From 415a8a19ebb4b41d8ea0ea02ccf7eb54fe1fb30a Mon Sep 17 00:00:00 2001 From: agree <37550360+greenbea@users.noreply.github.com> Date: Sat, 19 Mar 2022 22:44:26 -0400 Subject: [PATCH 001/155] [mod_callcenter] Fix globals.nodes gets unset `globals` was getting initialized to null after `switch_event_bind_removable` binding causing `globals.nodes` to get set to NULL causing `switch_event_unbind` not to be able to unbind the SWITCH_EVENT_PRESENCE_PROBE event when unloading the module. Besides not being able to unbind the event, this was also causing a segfault upon receiving a PRESENCE_PROBE event when unloading or reloading the module --- src/mod/applications/mod_callcenter/mod_callcenter.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index cba6dc84f4..6eee6dd514 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -4213,6 +4213,10 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", CALLCENTER_EVENT); return SWITCH_STATUS_TERM; } + + + memset(&globals, 0, sizeof(globals)); + globals.pool = pool; /* Subscribe to presence request events */ if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_PROBE, SWITCH_EVENT_SUBCLASS_ANY, @@ -4221,9 +4225,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_callcenter_load) return SWITCH_STATUS_GENERR; } - memset(&globals, 0, sizeof(globals)); - globals.pool = pool; - switch_core_hash_init(&globals.queue_hash); switch_mutex_init(&globals.mutex, SWITCH_MUTEX_NESTED, globals.pool); From caffa27a55cf29ae0d750874a2e899d3b39db77f Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 22 Apr 2022 21:02:50 +0300 Subject: [PATCH 002/155] [Documentation] Fix typo in README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1660933611..04caad913e 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ Step by step tutorials to install FreeSWITCH from packages: ### Build from source Example Dockerfiles to build FreeSWITCH and dependencies from source: - * https://github.com/signalwire/freeswitch/tree/dockerfile/docker/examples + * https://github.com/signalwire/freeswitch/tree/master/docker/examples Step by step tutorials to build FreeSWITCH with provided dependency packages: * [Debian](https://freeswitch.org/confluence/display/FREESWITCH/Debian#Debian-buildfromsource) [Recommended] From 04df9c12f7e1a786875a6f3299dc766c314b73c1 Mon Sep 17 00:00:00 2001 From: Ken Date: Tue, 7 Jun 2022 11:56:54 -0500 Subject: [PATCH 003/155] [mod_sofia] on call term optionally ignore Q.850 Reason Currently SIP termination messages with Q.850 override the SIP reason. Add chanvar ignore_q850_reason to ignore the Q.850 reason and keep the SIP Reason Code. Using the chan var avoids unexpected changes in behavior. Co-authored-by: Brian West --- 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 5066a13ef8..09d877527a 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -8718,7 +8718,7 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status, sofia_clear_flag_locked(tech_pvt, TFLAG_NOHUP); } else if (switch_channel_up(channel)) { int cause; - if (tech_pvt->q850_cause) { + if (tech_pvt->q850_cause && !switch_channel_var_true(channel, "ignore_q850_reason")) { cause = tech_pvt->q850_cause; } else { cause = sofia_glue_sip_cause_to_freeswitch(status); From 3b65b1bedb4189d6ba8717df2cb80b594631bcd8 Mon Sep 17 00:00:00 2001 From: Ken Date: Tue, 7 Jun 2022 13:44:48 -0500 Subject: [PATCH 004/155] [Core] Change values for switch_call_cause_t to avoid SIP causecode collissions Update values for switch_call_cause_t in switch_types.h to avoid sip cause code collisions that can affect continue_on_fail or failure_causes channel variables when numeric SIP or ISUP cause codes are used. Co-authored-by: Ken Rice --- src/include/switch_types.h | 58 +++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/include/switch_types.h b/src/include/switch_types.h index b8405511d8..f6a62a4632 100644 --- a/src/include/switch_types.h +++ b/src/include/switch_types.h @@ -2231,35 +2231,35 @@ typedef enum { SWITCH_CAUSE_INTERWORKING = 127, SWITCH_CAUSE_SUCCESS = 142, SWITCH_CAUSE_ORIGINATOR_CANCEL = 487, - SWITCH_CAUSE_CRASH = 500, - SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501, - SWITCH_CAUSE_LOSE_RACE = 502, - SWITCH_CAUSE_MANAGER_REQUEST = 503, - SWITCH_CAUSE_BLIND_TRANSFER = 600, - SWITCH_CAUSE_ATTENDED_TRANSFER = 601, - SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602, - SWITCH_CAUSE_USER_CHALLENGE = 603, - SWITCH_CAUSE_MEDIA_TIMEOUT = 604, - SWITCH_CAUSE_PICKED_OFF = 605, - SWITCH_CAUSE_USER_NOT_REGISTERED = 606, - SWITCH_CAUSE_PROGRESS_TIMEOUT = 607, - SWITCH_CAUSE_INVALID_GATEWAY = 608, - SWITCH_CAUSE_GATEWAY_DOWN = 609, - SWITCH_CAUSE_INVALID_URL = 610, - SWITCH_CAUSE_INVALID_PROFILE = 611, - SWITCH_CAUSE_NO_PICKUP = 612, - SWITCH_CAUSE_SRTP_READ_ERROR = 613, - SWITCH_CAUSE_BOWOUT = 614, - SWITCH_CAUSE_BUSY_EVERYWHERE = 615, - SWITCH_CAUSE_DECLINE = 616, - SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE = 617, - SWITCH_CAUSE_NOT_ACCEPTABLE = 618, - SWITCH_CAUSE_UNWANTED = 619, - SWITCH_CAUSE_NO_IDENTITY = 620, - SWITCH_CAUSE_BAD_IDENTITY_INFO = 621, - SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE = 622, - SWITCH_CAUSE_INVALID_IDENTITY = 623, - SWITCH_CAUSE_STALE_DATE = 624 + SWITCH_CAUSE_CRASH = 700, + SWITCH_CAUSE_SYSTEM_SHUTDOWN = 701, + SWITCH_CAUSE_LOSE_RACE = 702, + SWITCH_CAUSE_MANAGER_REQUEST = 703, + SWITCH_CAUSE_BLIND_TRANSFER = 800, + SWITCH_CAUSE_ATTENDED_TRANSFER = 801, + SWITCH_CAUSE_ALLOTTED_TIMEOUT = 802, + SWITCH_CAUSE_USER_CHALLENGE = 803, + SWITCH_CAUSE_MEDIA_TIMEOUT = 804, + SWITCH_CAUSE_PICKED_OFF = 805, + SWITCH_CAUSE_USER_NOT_REGISTERED = 806, + SWITCH_CAUSE_PROGRESS_TIMEOUT = 807, + SWITCH_CAUSE_INVALID_GATEWAY = 808, + SWITCH_CAUSE_GATEWAY_DOWN = 809, + SWITCH_CAUSE_INVALID_URL = 810, + SWITCH_CAUSE_INVALID_PROFILE = 811, + SWITCH_CAUSE_NO_PICKUP = 812, + SWITCH_CAUSE_SRTP_READ_ERROR = 813, + SWITCH_CAUSE_BOWOUT = 814, + SWITCH_CAUSE_BUSY_EVERYWHERE = 815, + SWITCH_CAUSE_DECLINE = 816, + SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE = 817, + SWITCH_CAUSE_NOT_ACCEPTABLE = 818, + SWITCH_CAUSE_UNWANTED = 819, + SWITCH_CAUSE_NO_IDENTITY = 820, + SWITCH_CAUSE_BAD_IDENTITY_INFO = 821, + SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE = 822, + SWITCH_CAUSE_INVALID_IDENTITY = 823, + SWITCH_CAUSE_STALE_DATE = 824 } switch_call_cause_t; typedef enum { From a83e2f6b419ad0b75a99ac5ae27f6f1f16761c3f Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 7 Jun 2022 19:38:29 +0000 Subject: [PATCH 005/155] swigall --- .../languages/mod_managed/freeswitch_wrap.cxx | 22 ++++++ src/mod/languages/mod_managed/managed/swig.cs | 74 +++++++++++-------- 2 files changed, 67 insertions(+), 29 deletions(-) diff --git a/src/mod/languages/mod_managed/freeswitch_wrap.cxx b/src/mod/languages/mod_managed/freeswitch_wrap.cxx index 7443ed5232..4ded90cb0e 100644 --- a/src/mod/languages/mod_managed/freeswitch_wrap.cxx +++ b/src/mod/languages/mod_managed/freeswitch_wrap.cxx @@ -28820,6 +28820,28 @@ SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_vol_get__ } +SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_volgranular_set___(void * jarg1, int jarg2) { + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + int32_t arg2 ; + + arg1 = (switch_file_handle *)jarg1; + arg2 = (int32_t)jarg2; + if (arg1) (arg1)->volgranular = arg2; +} + + +SWIGEXPORT int SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_volgranular_get___(void * jarg1) { + int jresult ; + switch_file_handle *arg1 = (switch_file_handle *) 0 ; + int32_t result; + + arg1 = (switch_file_handle *)jarg1; + result = (int32_t) ((arg1)->volgranular); + jresult = result; + return jresult; +} + + SWIGEXPORT void SWIGSTDCALL CSharp_FreeSWITCHfNative_switch_file_handle_resampler_set___(void * jarg1, void * jarg2) { switch_file_handle *arg1 = (switch_file_handle *) 0 ; switch_audio_resampler_t *arg2 = (switch_audio_resampler_t *) 0 ; diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs index 901476e9f1..5586d3f981 100644 --- a/src/mod/languages/mod_managed/managed/swig.cs +++ b/src/mod/languages/mod_managed/managed/swig.cs @@ -22447,6 +22447,12 @@ class freeswitchPINVOKE { [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle_vol_get___")] public static extern int switch_file_handle_vol_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle_volgranular_set___")] + public static extern void switch_file_handle_volgranular_set(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2); + + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle_volgranular_get___")] + public static extern int switch_file_handle_volgranular_get(global::System.Runtime.InteropServices.HandleRef jarg1); + [global::System.Runtime.InteropServices.DllImport("mod_managed", EntryPoint="CSharp_FreeSWITCHfNative_switch_file_handle_resampler_set___")] public static extern void switch_file_handle_resampler_set(global::System.Runtime.InteropServices.HandleRef jarg1, global::System.Runtime.InteropServices.HandleRef jarg2); @@ -31035,35 +31041,35 @@ public enum switch_call_cause_t { SWITCH_CAUSE_INTERWORKING = 127, SWITCH_CAUSE_SUCCESS = 142, SWITCH_CAUSE_ORIGINATOR_CANCEL = 487, - SWITCH_CAUSE_CRASH = 500, - SWITCH_CAUSE_SYSTEM_SHUTDOWN = 501, - SWITCH_CAUSE_LOSE_RACE = 502, - SWITCH_CAUSE_MANAGER_REQUEST = 503, - SWITCH_CAUSE_BLIND_TRANSFER = 600, - SWITCH_CAUSE_ATTENDED_TRANSFER = 601, - SWITCH_CAUSE_ALLOTTED_TIMEOUT = 602, - SWITCH_CAUSE_USER_CHALLENGE = 603, - SWITCH_CAUSE_MEDIA_TIMEOUT = 604, - SWITCH_CAUSE_PICKED_OFF = 605, - SWITCH_CAUSE_USER_NOT_REGISTERED = 606, - SWITCH_CAUSE_PROGRESS_TIMEOUT = 607, - SWITCH_CAUSE_INVALID_GATEWAY = 608, - SWITCH_CAUSE_GATEWAY_DOWN = 609, - SWITCH_CAUSE_INVALID_URL = 610, - SWITCH_CAUSE_INVALID_PROFILE = 611, - SWITCH_CAUSE_NO_PICKUP = 612, - SWITCH_CAUSE_SRTP_READ_ERROR = 613, - SWITCH_CAUSE_BOWOUT = 614, - SWITCH_CAUSE_BUSY_EVERYWHERE = 615, - SWITCH_CAUSE_DECLINE = 616, - SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE = 617, - SWITCH_CAUSE_NOT_ACCEPTABLE = 618, - SWITCH_CAUSE_UNWANTED = 619, - SWITCH_CAUSE_NO_IDENTITY = 620, - SWITCH_CAUSE_BAD_IDENTITY_INFO = 621, - SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE = 622, - SWITCH_CAUSE_INVALID_IDENTITY = 623, - SWITCH_CAUSE_STALE_DATE = 624 + SWITCH_CAUSE_CRASH = 700, + SWITCH_CAUSE_SYSTEM_SHUTDOWN = 701, + SWITCH_CAUSE_LOSE_RACE = 702, + SWITCH_CAUSE_MANAGER_REQUEST = 703, + SWITCH_CAUSE_BLIND_TRANSFER = 800, + SWITCH_CAUSE_ATTENDED_TRANSFER = 801, + SWITCH_CAUSE_ALLOTTED_TIMEOUT = 802, + SWITCH_CAUSE_USER_CHALLENGE = 803, + SWITCH_CAUSE_MEDIA_TIMEOUT = 804, + SWITCH_CAUSE_PICKED_OFF = 805, + SWITCH_CAUSE_USER_NOT_REGISTERED = 806, + SWITCH_CAUSE_PROGRESS_TIMEOUT = 807, + SWITCH_CAUSE_INVALID_GATEWAY = 808, + SWITCH_CAUSE_GATEWAY_DOWN = 809, + SWITCH_CAUSE_INVALID_URL = 810, + SWITCH_CAUSE_INVALID_PROFILE = 811, + SWITCH_CAUSE_NO_PICKUP = 812, + SWITCH_CAUSE_SRTP_READ_ERROR = 813, + SWITCH_CAUSE_BOWOUT = 814, + SWITCH_CAUSE_BUSY_EVERYWHERE = 815, + SWITCH_CAUSE_DECLINE = 816, + SWITCH_CAUSE_DOES_NOT_EXIST_ANYWHERE = 817, + SWITCH_CAUSE_NOT_ACCEPTABLE = 818, + SWITCH_CAUSE_UNWANTED = 819, + SWITCH_CAUSE_NO_IDENTITY = 820, + SWITCH_CAUSE_BAD_IDENTITY_INFO = 821, + SWITCH_CAUSE_UNSUPPORTED_CERTIFICATE = 822, + SWITCH_CAUSE_INVALID_IDENTITY = 823, + SWITCH_CAUSE_STALE_DATE = 824 } } @@ -37582,6 +37588,16 @@ public class switch_file_handle : global::System.IDisposable { } } + public int volgranular { + set { + freeswitchPINVOKE.switch_file_handle_volgranular_set(swigCPtr, value); + } + get { + int ret = freeswitchPINVOKE.switch_file_handle_volgranular_get(swigCPtr); + return ret; + } + } + public switch_audio_resampler_t resampler { set { freeswitchPINVOKE.switch_file_handle_resampler_set(swigCPtr, switch_audio_resampler_t.getCPtr(value)); From 92a336a07dfc633ec911a075225fd37afb81e74e Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 8 Jun 2022 13:25:35 +0300 Subject: [PATCH 006/155] [core] fix loglevel - switch_ivr_phrase_macro_event() --- 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 7f8a44eeeb..1cd4c623df 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -259,7 +259,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio switch_normalize_volume_granular(volume) pfh.volgranular = volume; - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Setting playback volume to %d\n", pfh.volgranular); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Setting playback volume to %d\n", pfh.volgranular); } status = switch_ivr_play_file(session, &pfh, odata, args); } else if (!strcasecmp(func, "phrase")) { From 75e858407f43b5707701b65ca7f1c13fdfc118f8 Mon Sep 17 00:00:00 2001 From: FusionPBX Date: Thu, 16 Jun 2022 09:00:09 -0600 Subject: [PATCH 007/155] [mod_sofia] Add Fanvil to vendors allowed to update. --- 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 844ec13a70..8363038bba 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -2070,6 +2070,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi (switch_stristr("cisco/spa50", ua) || switch_stristr("cisco/spa525", ua)) || switch_stristr("cisco/spa30", ua) || + switch_stristr("Fanvil", ua) || switch_stristr("Grandstream", ua) || switch_stristr("Yealink", ua) || switch_stristr("Mitel", ua) || From beffab1d680104f2c469d0947a2a8b0e09d9c343 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Sun, 20 Mar 2022 17:25:37 +0300 Subject: [PATCH 008/155] [core] RTP: a media timeout fix + add pcap based-unit tests. --- configure.ac | 16 + src/switch_core_media.c | 12 +- src/switch_rtp.c | 2 +- tests/unit/Makefile.am | 6 + tests/unit/conf_rtp/freeswitch.xml | 73 +++ tests/unit/pcap/milliwatt.long.pcmu.rtp.pcap | Bin 0 -> 164014 bytes tests/unit/pcap/milliwatt.pcmu.rtp.pcap | Bin 0 -> 53384 bytes tests/unit/switch_rtp_pcap.c | 580 +++++++++++++++++++ 8 files changed, 687 insertions(+), 2 deletions(-) create mode 100644 tests/unit/conf_rtp/freeswitch.xml create mode 100644 tests/unit/pcap/milliwatt.long.pcmu.rtp.pcap create mode 100644 tests/unit/pcap/milliwatt.pcmu.rtp.pcap create mode 100644 tests/unit/switch_rtp_pcap.c diff --git a/configure.ac b/configure.ac index 4131e629a6..3ee7c58f9d 100644 --- a/configure.ac +++ b/configure.ac @@ -1970,6 +1970,22 @@ else AC_MSG_WARN([python3 support disabled, building mod_python3 will fail!]) fi +# pcap lib for unit-testing +AC_MSG_CHECKING(libpcap) +AC_CHECK_PROG(HAVE_PCAP_CONFIG,pcap-config,[true],[false]) +if test x"$HAVE_PCAP_CONFIG" = x"true"; then + AC_MSG_RESULT(yes) + PCAP_CONFIG=pcap-config + PCAP_LIBS="`$PCAP_CONFIG --libs`" + PCAP_CFLAGS="`$PCAP_CONFIG --cflags`" + AM_CONDITIONAL([HAVE_PCAP], [true]) +else + AC_MSG_RESULT(no) + AM_CONDITIONAL([HAVE_PCAP], [false]) +fi +AC_SUBST([PCAP_CFLAGS]) +AC_SUBST([PCAP_LIBS]) + # # SNMP checks for mod_snmp # diff --git a/src/switch_core_media.c b/src/switch_core_media.c index e27b81e166..347735cf1b 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -2882,8 +2882,18 @@ static void check_media_timeout_params(switch_core_session_t *session, switch_rt if (switch_rtp_ready(engine->rtp_session) && engine->media_timeout) { switch_rtp_set_media_timeout(engine->rtp_session, engine->media_timeout); - } + if (engine->type == SWITCH_MEDIA_TYPE_AUDIO) { + /* the values are in milliseconds, not in seconds as the deprecated rtp_timeout_sec */ + engine->max_missed_packets = (engine->read_impl.samples_per_second * engine->media_timeout / 1000) / engine->read_impl.samples_per_packet; + switch_rtp_set_max_missed_packets(engine->rtp_session, engine->max_missed_packets); + if (!engine->media_hold_timeout) { + engine->media_hold_timeout = engine->media_timeout * 10; + } + + engine->max_missed_hold_packets = (engine->read_impl.samples_per_second * engine->media_hold_timeout / 1000) / engine->read_impl.samples_per_packet; + } + } } SWITCH_DECLARE(switch_status_t) switch_core_media_read_frame(switch_core_session_t *session, switch_frame_t **frame, diff --git a/src/switch_rtp.c b/src/switch_rtp.c index a7bd2f8d83..5f4ce0f738 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -7350,7 +7350,7 @@ static void check_timeout(switch_rtp_t *rtp_session) } switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_DEBUG10, - "%s MEDIA TIMEOUT %s %d/%d", switch_core_session_get_name(rtp_session->session), rtp_type(rtp_session), + "%s MEDIA TIMEOUT %s %d/%d\n", switch_core_session_get_name(rtp_session->session), rtp_type(rtp_session), elapsed, rtp_session->media_timeout); if (elapsed > rtp_session->media_timeout) { diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index d24e30f62b..e2cec69089 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -5,6 +5,12 @@ noinst_PROGRAMS = switch_event switch_hash switch_ivr_originate switch_utils swi noinst_PROGRAMS += switch_core_video switch_core_db switch_vad switch_packetizer switch_core_session test_sofia switch_ivr_async switch_core_asr switch_log noinst_PROGRAMS+= switch_hold switch_sip + +if HAVE_PCAP +noinst_PROGRAMS += switch_rtp_pcap +AM_LDFLAGS += $(PCAP_LIBS) +endif + AM_LDFLAGS += -avoid-version -no-undefined $(SWITCH_AM_LDFLAGS) $(openssl_LIBS) AM_LDFLAGS += $(FREESWITCH_LIBS) $(switch_builddir)/libfreeswitch.la $(CORE_LIBS) $(APR_LIBS) diff --git a/tests/unit/conf_rtp/freeswitch.xml b/tests/unit/conf_rtp/freeswitch.xml new file mode 100644 index 0000000000..69130f8f82 --- /dev/null +++ b/tests/unit/conf_rtp/freeswitch.xml @@ -0,0 +1,73 @@ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + +
+
diff --git a/tests/unit/pcap/milliwatt.long.pcmu.rtp.pcap b/tests/unit/pcap/milliwatt.long.pcmu.rtp.pcap new file mode 100644 index 0000000000000000000000000000000000000000..36ed6a1779602d0846fa8cc3f5e5b73d2bdabd00 GIT binary patch literal 164014 zcmd7bca&7svIg)vA}T1Nh=|ZLG#MldND^oyNK}%jfY2&tvM_n1!5mRBpff-tK|q3l zh=^hXW{jw)sMsn-Oo(0-1Gm1KIX$zFOfihj^nPpI#e09eyVkGwnbW&#f4l14&8y}f zK}VANKl}F+IsAW|bme;&554F(+Q$Do{?lzmgWaiVKj%C(wadg~s5{ZilaCKj>l4q} z99cw1@PC}lbE+?-Cz_lP3Jv&{{~y8^fBN(7yB^7zms;CbX9xc~s+Ot})hsEw^|IVqPc%(RZnHFZ){{+q$?c%L{T)?VNtDl-%9~CJ z(SYyxlL|n&GjeW@-mgLTUx{)ur^mqj^qo@?N%(f!e! zIhz~!{Jj?D%z350&wuWMobc=Qd^Lygzgz42YK@qmGj}`xJ9=KuBRlK(YVYNL_wt9g zlRv!CwS9HB^M^NrKfJATa~2HY5ASvU@XoF2tN+TJoP~Y(!+U{0yt8Zg8f@ebuPc9u z8|LJFc+W!larX+^TAm`xr%h%5vaH<2$|#h)6rF1L8m;H0IFpxP9WO{nKPPjo~G%AC2|cnL<$&v|4AFF`6V!LB;KI)$F&`Gub2dWD|jg|X+Dm!LS$ zF@JcC*Yb1RmOn)P@RsI(c+2uXyyg7iHOGg?&++N}9LtBdJQvDg->Pd_LzJsbWp-Eo zyZnKuOa#ijCE%r4(1nV35YIMT$oA(^g*}zNCm7n8{{2ZUn zOYj0e$9?jiN^bI_0G{LgmjIL}wm4pUVrz+V zg{eH{SYFE?iH;0HiC0O3{8vfCLa&m=`LB{C#e0?H=DkX0>8}#^B~ZNQ*pKHJ%A=;J z%KD;QVk(>6!OEYA$`X|F*T8=TvA+g>euwg_M4n@Qeq+yZ!K^aVRmCT8Kc>GFx+3dn!W>8K((b4`c+lg|fsr>j`R{qAy2$cW+O3Z(i9Ox^NUm>xt zM1F`GBch@jWa5M^r8d<>A_8yU+7~-5*1_ zX_=}#Qefba3 z@j)ov!c)9=+40&RL)j+zNbQLoBFaot`Q86m$#uYr1ZANg?8PlS6>FCrul+HUSC3Ye z=ZiAKRNkB$qJdnftQeNH?5G!>aTA4B=n)2i}9QKp&7kDg*B7j#buKzX=! z+40&RLpkG^vf2|nRFtWvvieo5Jc5-`C=b^zJ6`)^C_f#dDu;9qRvyF3FqF>~ zoXHe?HCj}KhO%j+qqQe?v?wn#l}Qa)S&r!B0F*@?Xcbw2D&;CPlv~nOyfw@;p=d72ZC_6IBgDDQDyEfmXqpOu>QH;>1>=q5ONls>~MUU{l%e zT~<~kI+dU-t*l2$_s38^c}_X)?{bPL2b#*Bc>A2d$}p7t)mSQ7kCN_>p?ow~RZbJ- zxu&vWGgh8RR4o8yX=Oc1x<7{UrSDYb4WjI4D&M$`m6cc-h0dmV1PEmF_@;*^^G?kn2tYuV1-l^p7U*1zJ92l+}Y+5Q;H zJ;PMx!=h|sD$}22Wi?htJS%-fHT_T?EK%(~&xxu+L%E=bnvb0;%I2oBO-oiLu`&YX!4lOa z-DSsXe=N%TRONh8HZhf}vG++PsuhG%;^<1E`XH~AVrM-{x<7{Umd{n?Vo^3Qm32F@ zvIbFYf-?6YiRwgGp`o1DT+PQW5oLW-xojFM{j3Z_nRhdw=tOl%ciHjUA47TBb*gfi zDC?NYb!V`$CQ+RLl*-KjE2_{?-u{}ZTrSGmrt*U!tgOY#D3o%oLP=DYbeA2k{V|k1 zd}`Ktl_+bN%Ae-2vNloO5R?Z?RF`y@9k2cI$*de&PtC`!7G<)j3|+*^Iz;vSQ1T@s zHBp`DDm0XLPg0dnh%(7kPM^ohx~zy$54*dv(B%HvaG2*tu8AY5uFx- zQf|&3_<;7X-Z=EW42rrd2xS#L>-@SXk2IB6{>IA2M2-AVChEpvarehiZu(NqI=?MS zGL>B#v$6>*BTydX@^Zqf&`{26spezfgRo2RPE z?V{XkDu*Z`iiB68p?pNoI)5(8pG@U>BUpJlE2B^*>c(Ml zv(Qlfu4kRU7Ug%Qa@Rsuwj^p6f)afY5^>|Oxcg%$N9kGT??m~vsoaN3Wh%n7Q;FjD^(gKxJ6`)^ zC|?Yy`Pe^1`GKkY>N{4pWo1~DhuGJnxV!9l?T?|nR?j-`6XpA+@>6`1v?FR6fU@9# zws?I#io45>*ZvsF&?o9z?ib}&Q@QLqR<>tl6iR9CbEpTjrI>|=vV)p+PB}u9Z<@;M zk!tEd)G7q!q4xDC?k+oC`(r2y1Vr3_yGlEbSYIVh5 zg|Vg*)>NUPJYLN@r<@?lji$2m7*=*BYC}*Spw-nuz7k8f3Jv8jHS3&mq9`M#GW||g z23Q$}Qu>4yd9C8#eLaf1%Z}In7|PM4B}Y>#i}G1h*{(S&yAZVvKpAU}lHk5~MeUEF zY^!FSQ>uz`ovG}LO66Isj6#XNVSGI(;eGFl+8;xCmzs4>sV>SVO=b77tn5nEE(GPF z_VtL@jl<&J6@+q>nsrV|7UgPF8Cc26Zba?zqzhpe^MahsC`s z2xUOcI;S)irKca>5}XG0BI+1`vZSqGOREYE<<#f2taC~eQO-Bl@@t%5_GV=i%0q1K zQ|eV{D95Q;=alB6^mP4ej9*@Th&qL!lvc2Xy7Agpg@)2UT+7F%v=*hOAKqDMtn5qF z*$-vCEq3(1D{6lX<#09YoYGd551CKw6Q~vRV`T)&1Ga*-s0t0`QNOEe*-@1DnaU4w zN_!4bAPD7u?Jix^E<0ZPV<-oxS?824qV#l%dvYQx&n4YSuYrs3^Ui;!xeXkm&3Hln0zvVNn$t$~|h< zIc1nAJ)PpNj<9klE2B`_I(^0cQiHON+SfT{geb2y|1P^Aw?2%hX9&tf-8d}nT|p@C zRr@-p1VuT)R4&5r%i%=5{7~9DeZ}1$L#bz-Q!W7NES_(MjQc;dIm7O1Av26N^TZM+QyxP|}yn$2CQ47&zZoC0@^YecgHRUCB1&xEyP`VQ zK{-p!I;Uia@_chG?;OX-{Q2|$@Q zGnxC;c&-Q8QiX< zmmRPDF_iuFtn++Pdb<84C9^V>XedGHP7-%(*|t@oq3ok)ofnF-k@>{_50%O^R)(Q; zCyBeYY}=~PP`1~z&X0+*o~c~Dg_Y?<5~ie5iv?<6eb^a+;oXUMEUV548c^(bjd1Ij1#tn;g)Jla&wY{<%Ktc*gLo43W|>p{}Tk(Xc%U&5DZLi`-# zd48IkRUKrY(_!oj4dqs~uXD<4qV)8`d!Yv_uP3@V1ZB>ny{zbaS5!w1C^zX@=Ql)I z#$3y!Pgr>a(ItK;=e%I&^cA-+G?WYVtn*eV`|dZD!BbgzBP%0NE^nEX)ckSY;_+J@ zZ+F|O&`_?_v(E2}a-XRz_bMxIBDypPWuaGzl{3Jh{7ug~Zx^MfA6`vVDsLtlMNo3} zt}}1#WQ%9x4DeG}IY7@k?+~S@A6|v>th|MlVJMS*?iR1<6SH!cwYIGa4dre<>-?!G ze=(of8vR&#E74^ED1CKymh^g1sZ^n%%-N)7op*}z2UFSfT~^-4%BZYmhvI!DCaMYz zJTR&YDfEbBlRb5XwqwU+0wHMfstr{P`nR-p$G|l)1~fde{8m zKirGzE?v|vJ6`)^C|BxP=Y68|^uz1)GAr*Px;g-5!LLO-XMjUVt<!^Ydhqq2gE#j{R23S^_tdO&sw2v`Ol7nFth}F<5h#7h`Df&o z&H#t<6E*9cT1J$f-iG7av+@C=F+ou_%HQHyIs+Wa95w5ldWbLQJ;e>GM<%*rT~3v`6tRsz6svSnkqDud(^(psi%nY zX;XRn_pHn%n&5{rXTd;k4AQD9G?e4jtaEBLQLZ(WNxNA&i5^Qw38IG{Z|9XX)9 zAgc9sPW6d$jj24QH7jQmO$u757LL%DdF8b7})oE;g0dW4At+ zXi@-5Zf&ey4@z_u8p^xXtaEB3QF?kC-i}|`_WdzFD*3Qxy;86Bav(BmQL^;!Z`$V_1av@P_5X#5%VmB>p zodFKzM76JTYDZCey8a#CfR&FDr4f{+mGvm;{us(SyR<}iY8O#@y8d+?#L7ji3`3bS z=Q(cC-92vr&SA`Ylr*IQWwgE43pll#DDO0%*tMuSFD6P4K$*KVzj|ls3~(q{-=Zpe zit<)dnbDV(OIR6&a^C2}v&)Xx{us)#YSuZmmnd&BmBF#Be2gd~1Z6QYO9cnC38+Ft z*;&mxr}h)&4W{zqN~~N;l<9}^OdemoZg%ctw$1>DvW1#;P8}#pPp7z5sK+j2Wduq- zpiSk>-7Z^afJ3=o?dzO6Sd`i3TDHB5mCK2;f>0JZnB}b+E<+ByRq%0X(@ zId!D0VbLwTH9Br;8)nVmoqA4LLxq9~;-*Cy_;`w{oR)vOg>3v$qzq1Xloy-I zlj^eaNusGiC}*#4+X_xx?M!6zsPC zD0`dAX%ktwf#{|nlxK7GE_OZ0qUkH{+!QGHEmha@Hc@)|ZY^2O%IAn~CMe~4h4IxW zmp`qkLPNPy%{r&vB}z}Prhc!pGQ!F*l!>}=SllW!l((r_=hW$zsOzC_NpiCe>gizngD~iW1ek#)X>vSXPCG@?kaW zoO-_~Jzb0*d61QxiEa%+`N&S*;_WSbKx^r)Y+nJ zX|ClfpR@8sqT7Q|@>k?gKA@EWk^FD$CyFgqXeh_&S?91QJ-wPPe}R=R5#2#hCgpAM z_*zhF&fY!I#I`CllvnFn=LMo{Y_4U_7p#1lm0>7-4GL}X@~#J2RfUFfk)Cy4C`wNk zqdlpte1+)F0F(s>T8DZ)sB}7VK>3WGbzUUOhUQvMzz*+KRz{&LUUQ$sWuc+`QO`Or z6J;G!dHWr#+(L9$2+D1|Bt!WtGS;HovMMx`qZeo$k5iY6vbL%GqdzNOBbx4qlDBrT zEuM`tz@hw0&pNLZrQcM3eKRXxXJrIR_kgyvZyXl)t{{}%)xOTDPl~d-sr>l}R=z=W zcMwWBpe<-Cqn>qsRg|7yO(SQr@?E0){80M*eew=wYsNC9R#l;)EHg^$c%1sCD337TJ}+O( z%J*0qfikJtft&l-QiX=Hvz~Q+2g*MGn97qbXXQ4c`-4#0I(@}GQibvqJ?s3QDE~5* z1M&OveWC{l%Fc`JoW9~-jDWI(o^}3El)szG%SW>E16GEiJoo`^Vynap@;qKEuY9{hkdu~ld& zC+b<}??m~vsl4eMR(`_D2$X7b9}B9`P>$5I&OeFrb5r>M{w{YAJsgD6Z0=*v^cA-+ zG?bU?S?6Cw`KhUVcMU5)CCVWvZJoa2rZk|Op=X`UtcUy0Vu z0Ecq;acXk(4^e(#D$C!(%Fl>$15g&D6>LJQ&`{EFRr!}FJ^g)tL8bC@Rz{(;b^3}s zHwDVYi&f>{qI}m}%bstt@(ZF_At+1M+^6)a&`|!lS5^Ka%6ClV^vbNO;yi3LVf|RE36e zotkw{D<{gAP35Owv+^5OhM}}|`ieU@1FBOxeloxbAE zO*xg7W9n%s;Ivaj>FMvY^LbW&Pc+XDrMJ0{ZB=L}8%g?hRcI)Ct6Ar? zhN4_#DjU~iui<-z+mCbkL<<=n51 zP|l*$T8J`iD!2TPmA|nv0wwx49@+tI=~khk{HLXsk4-y6lsTsI{Zm-^KcdA!C~cj- z;?7Nh^2e#FvV$leFqOyM!^*uxO9)CHoWA1Td4=*UHS3(#Rg`y`%0c+P{DbJR0F-Y3Mz@x2TNN70zG~Jvt(z!4U5xrw zXXQRtMxpc_`arT$twKYYrDmPedWiCNb1lD(u<}o$r6F0%gA61~bQT)QY&GkgcD5*Q zGnE}bVdY;$%luH3M~*4eDwPqc!dv~~K5n}vq* zH?^;G+7MA@nroTyX@~|9E5lIcgk!Ul>-i4e%Xejr7to3zHyHJ#Art(c<2vJEyO>cV3}f3>f3 z+GV2j^lGYo4J*sCG6H46!E8Z>G@P@rpPQ&obQK!Pd(^CR+SQ`G!d%O5IZ!FZLDzRB;D34RK z&S@EP1LM&+Kr;@Yp&&6dsulq(NjSv=WKM7sCLc(hw=n9>zsD8C_P<_ zF6_X{ibU%ON_UdDtuw%(tf^+5({2;x+2&dfugA(0SQ&ir=%eJiw4P^&4 z>zsDGD0`U7H@;`(i9}BapyV31d)dg!8Q@S(RI|=$(?xlfseGw6D=V=w3T09K8*QmV zL)lyH>zp=2l$}iF+S#l;iD-QYN>6j2g!R2EDy0GCPPMOd+Wn&RbTNAOBvw`?dd4qn zS>onCrPGlEN=NPMoc4eyJD6+v(RNmz%*u%TU1Dp;*-_i3uef(!p&YAbozor`WgAoZ z)?QXtA$m3lsjY{qHJm^PsZNoRHEksQ0C0xB&r2{ z?_}P@0Xo(}*-g(nFA$}tSJTaxu(BE}qfq8rI(@~Rn*!xjJ?p$!lnu|`p`mQ3XPuXe($n9k`Y=}dh&KA6j5YW9cmGB!s?bob*R#&6L|MaJ z%l4V9Ok!mON?WI|xJ|XIvGS^VYCd+YD65&u0i1OnluWcK2&FB3?~3YJ2W92Ss`438 zo@^>VpUTP_M4Jgp?%&8aX6>84;?7Nha>*uD`K%}_o66lUvC_}VuqdTPcPAbYY3B@Z zC{H?3%{oU!>FMt?<2hE=Bziso<-reT6I+FbvVop;-Ym-F&9%(9ft9sb8HLhp?o)a< z4vTwN5Xu@W)wO(4l*gLNR%=*Uo9KlQlrM2iq1S&s*gA|=XehhsS?8BUSUteKA^Rt3Jql+J?s3YD336eTTW$VeWI5MN@>l_ExK)+zT(bJ zf%0ZO>%0}p-uq4Ey#B0gz{)U`woYGh@4P~}N6$KM6Xl<#^2cSYY)JG<0LopKPG527 zra)Oo&pLk~%0Eoyvu#*;8Y`nvx(Bqj&H#tf%NTU}N*B6>9hr8`O7 z)*0YXKCEY*KNsasrt%}yV;d7~@k8mWB}vq}w$1>D@&P^T{FNwonaZ`(SlNV?5h!ix zdspyf#`QL&jq>YlP|ne_&bvhUm8tBvg_TW-UJF9mU?Xqwy4K(yI(E(ghw??WuXEbZ zqWsKM4!?kv&4^wnD5Za+h0|BuxhYU)&R0{wdqlazRHhGPWph@Bp8v~~K5TZM+Qjh=P>Qq0CmZ&gn;qa*Mf^UoL0m8ANXfp*&!7A08ChHaV$e&8p(u7aGdD)U0#*v7&s@ zR8FYH$~Ht>3CeiSIE?pnLMZ2`S?BZ5Li+h($|9nm`hD1F%CSvY;gJ&J;Iq}taxy^1K;n`=4u9#*zzWfV$(ztYKiu6?bk5l%d(>lv+W0O;LKfr7TCKvLh=aQ1XAQDTl(G=)v*rB^6koNYgu2EOHAb>@3FEo(fb5t&b(CjveCh=2_>Wo z4drQS);YbgC_Q~do*vH104u{#&R%!G>lM~ip`qNVW}VZUh;qKUmScyovJ24%0r|VM zboz=rHwDW38XT)VvCTy}*Hl)h&&sn{8HG{?>~RZCx0Y>N6&lK~u2q#SMCs`XGZ*>T zu0$V(pyX=D8GHkLja$pMtqKk0Lu%GJy_G0udDgNTE4vYG_e06myAoXwDy=Lul(}lw zIlY}IXPU}hnXK&2$_SK)*xaYov(QjR)U0!QM^WBqDyQR@R}Z3(f>0)5i}!dz)y}pm zG?aVPzRu|ZQQl)J=jXEWY@&||%6ePOTDEOfXebw}S?Ba_qV)8Hse&6&Jy{us@__vt zEviC8d7+whPVXtoTg|oXFo2c4h&~BG=}r=NYuUC{p`q-dW}VY}i_+6ArRsyM?9Iw3 zl-!zobV*(*rIm$-@+mdzoZeTIH=1j?@qJeIA=(jwGI#dVd_a4UCO-+xLPI(B^y9U? zPk&KPHI@4!tn5qlsb7>!^0#=F&H#t9-V{|iK$IazqDRl&Pk2+I_4%m*_KsGXH>9 zrU&I;6N+U>ZI}UGos|#O)AF(D!$mpSRE9oaWq($Nq2#Z|fqWqFrmZu;p$tw|l^2O} zlBo>*#L59gp9i2!;w@h8tjDdJzT(bJfiiQGsvIfGiKg=CzN{R`$|#h|!ECAay({X= z49Xp9);axRQI0p23+`g&AfhiqP}b<~W=Hv7X)$kC6&lL-MrbME^vgu)>3oxo>egVQ zoqi~ru0B9^)S@ahl#|rH&gqwn@)~n3U)#yb^H>>ya)+hUSKPTNP>xZv&gs{P@^Vu- z?*>*5A^I{1rLEIf+`EEM)>X64>7zw?nW-#4i4X{OL=ruXFmfq8wo==RV8I3yHoC zK*`lRIoK+0Uysu6$N}ZgYSuY@k|-}SmA~TqawsdKP%i4iRlGvYeQcWn4rQBZT3_e% zR8bB!l^OT2av0G!At+=08!epy4yE4LIXz31=b6f^W~>}e^sOJtBEK5rob@PaN(0K| z8d}ylJzJE6P35>>S$PpFBT(AX_pYdpbx>ZSW}VZgiSk@i`NcL?jv)Fj2&J#a*}S!T zp`^`yN>Va9r2R3Jf2djK^czIk&s2`s$I6jJy9mmprukJnOJ{&X`C&ONADe!&C_P<_ zc6MWBkdwl&3!DL0S@KMYSuaZPEmF< zl|Rj3%}=$y&gnU#^mM*St;WjBiGB(~>Gp55bp|+;pX*uYuqa!YYdNekE3Y8> znV>9mKwI>+iUd}np&Y1Zo#%6k+}y{W8Q@S(*R#&^McKq$%bQ5%yX<)FkD<)fv(Ar;vZkpFuVLkAqCI{nYw*o)xdGl~QO=wL zwwOUXRh!^#Mh?j-S&U8^|!S!gJG>sjYjqV#kzdUO;k#}fS- zgfiYU4h!!qIuz9e^AI|6Kv{i`ngU)UN}suwckW>2IHKPO%B8upp5*LZtdFB@RcI*J zt9_l**NL*Ksa*UZE61}k3}tC$JxZF=fbt+&=ch$^im4nEVdVs({{^6w1KNW(`AJw6 z8p^7A)_J`stC-3uXR&f3E2B`(T6y5>6}D8Np=_sTou3tDWm9=Ub5>qUv^NB$J4xKu z8Q@Uvs->oYH;J;MsXX~-R!$=N-4CTZN!->M;80Ff`#Pt;C`wPSrhdCvIhmCaD80>n zY^y>;nXG4>w}|p6b1m1bWMvA`A3-SHN#eH70Ecpvo^^gpl#Z! zvx)6{S5(J3D0k^u=MO~b>F={Uz{(6(Mxkua)s6#S4@&Ix758EUlpp9>=Z{7CoB71f zn8nIWqQ62=7CNAfWk}<(%Z}In7|NiYb>1P$J*IN-I96s6{q2X6Gk7vd+}0W3P(JcS z1uX^qxhOqdjP~_oWi~4#P`Z=EZJhxQWkBugoc@(4Jzb3IU&G4li2eye=}r>2bq2Wn zUFuoq??m~v`NW1CR!$+>Pf(WpfVOlxazHst&pQ7k%Fj*ZrjD!(u`&#$t8rD|q}PK=r3#I;JYCH?XOJj8U5xJjos~DTG9qhv$jyC9 zw+apA_iENTql_ruFxRp>Y6UluQzj^Xm-(%^ZJhxQWgj)`oN<&WJzb36+{VhA$vKjs zbSH_&t_Sh+iw*|G?Jj+|`$9u``(IjaJ>ytWdb${mzJQgturds#J4xKu8Q@SZR%QotD}h;pN;+~a5EZLEw!S;FfTrB;Q8 z@*OqnoN=-!pD~q#h?TdKb5sb*+~wSwyZOPJ{3NOh4Q1_CS_(L$nkYS8jKbfu@(yy2 z_Cr~4Kx^0Z6?bk5l%J?s=Zs`gt~S?lM>kg9$;t?n?j-R89?+Iz-@BqZ)zvV5ly{lR5HgiBSs8}X*6Azm+!QERsafZYZld&bF}nIfRz5^d z#Q>B`+ql&`<5iMd-0sqcyDv19*Qr_Oj9#L=#azpWu4CoHtc*g*&3)=@=L1@|mTg-V z8p;$k>zr|pD6cn_>G&0$L(T~yC~cj-;$Db=a+{iU&KMxdkg5C-3e_ z+!R(e9;Nkl&KM#}Pv@H-@GE*2DhZ!IftB+2ufS0ueftlpuAJfI%ixe%CY8J zp4EYsVOEBrjBV{KodFKz8M#{4Ib)P4$9Rp>!vS+ctg0y%+)Iw{5k)&KcK;@^VwTAeEK#$T>L#rE$F?fqn0CV`(Gv zt{{}n)U0!cbW7>w>6TIrRp+}_OZVHqqsafZYak7@4ZYdv+XXOG`Mxb;j ziQ75@9LkZkwXAc-1W^XfCw9}ltXxRWDM2WU(ZA6hyx{MbfGRYUt<u zVCAFaR3#{l<~|lpUvaC@P_|RE&KYTIkv^)t(}E4z*%{{nsv^YBFcg0T2Ac2$|bCfLg`Kt&$|I`-wbf9 z<$g8moNGp3t`1PQ~WTBz_d^<&fp9TuM%L zKa{8Q)~<-_L9^GoE#?n6Dxq|;(6W|l);Z%=QF{7_%sQ2o%UBtKatm+qFmCd2XFW=q z(tz?LHS3&lyC{2@Yk5geRxT&U7laZwX!!7qQ#RDSa?D_4+{ zL{Peu#1GKN(TW-1P|i`a&KY-$vWuyFZyqZjXJr`5ocW`yoW9~#p`mP`W}P$c5oN$s zPVU9ZmEav(6d!i}FlU`QjCN6&lKF z)hlY>BoB(x(-X#zQ`*(!)CfUo>+}_OZb}j>$EjK8j2uyVdcs_s!OADd@%y2)b^3~X zqzYv!-=i!#>zt7*%GTx+JFO)v*RV1IWf9GNio70F;;csrQyNe{u}M|V6=ic%dFC)y zK1oi^Ae6qEd@y_P=01t5LbI}*o^@Uz%EqShyiZuUmYiAyr8_g(w&^SG+!UeJSl}%n_K=Sn4WcBCdxXda_0lATt`mr0F*}mMvJDexN}pW z%vAe2XRHuqEmL{i2dsRWl~E{doxb8;jDT{So^@U=%4AcyVmB+-lT#-IWx)Y$L55Uo z@>AMbXegJeeVsF&5M`37%y^NN&yZ8s4`uFbH;H04_>&nV! zSs4+frPEj3xhYWIsP=Wvcv_U6ZYf7T!^#ch)C)rS$WE@_?X_?EiaR$2%A548^LkNw zx~07E4lAD{r#?YxH1|2w1KLukLPI%P&pJON%9G6}_6nR|Mpzk!5`7zOoWA1DO@Xqn zo^_6h@gu??W#g!Eicfs&M%3wys7*LYq^=6h9M~3N#eH70EhCaW7K@?tD-#GRGyd1%IC>B z%@1Y4f!5*8dXzM!0p?9%U-ud7qUpurdN=vz3LiqeV9NNn92h$`94P&Ka+Z z@<>zp!{e-ck(@?BD7WzzZzxysY@GoP<#WHNYx#yK%b3bxIN5uNoW=yDJ4xKu8Q@TM zR{J_!vS+ctg0otpw>Z$0b070RCbP36G)tbB!>CIKjO9@%B( z^c8n*3X~o6tn)jf^z>>9;vM@cE2B^*>c(Ng?>zmkAe4jjtn)TedU`coaTzPOkkd3I zf0y~Kxow-i;?7NhvTVlDTBUNkDEFFA>=-0rUL&WOA4+$UxUDn5pfdO|^cD9=70PLP*7;LW{$eWk_*nS{In9GmChW#xF{{u}Ua4oDcZ%`{ zQ@QaOR=!D23xd+;mn3Tal6IFq?0unG`GDHjIpZ5qerqaEo5{+zSQ&;g$-?uEx0%XMUT5XI!2uQhH~L9>1Luj(OGCH%cxoB%rc_%bTRVxVdeYeoIy|?{D8J}`rZ}Qu@1`f z)U0!6Sy8@buI0DKvGM~}hM`>5EWdikRlHdB&K;L(K@}Rx!IQN_cjnQeeAQI`fxpWS z$!QaS(w!u3>kM!xpH;KYndL0rt+gftlUXX zCqI<7PG527ra(DW?dzP`K$MG3<(_w0`6VkOP}(|u#hsgy%*r>^taD~VQ7$r-r##Hc zugK{fgp&I=wov;wCb$X><G^K?

VUF4hXe!69VdXEZ zj6!*?rPEj3xhYT%RI|>R=ZbQgscicNEBBCdb_hyar?14C60-&q-k($?uKZWS8J3)Q~PnHPz2lBsOo zfR%rc(tzo-9 z<}8f$Z?tOqircXc z%8uJq<;|k(ZLVd@s;n$W&UpbS|NCIF!<&VMa#bxg1$?_GJ$)+Ik7Q+eRz{&**4jAG zvS#{wDKSuWI+Nj&-cup=X^R7G)b#c?RcW2UjHL zLXx#?=VnI_^;$*gbmYKV9;fzo&dd>|r%z?a{j5BJm0|h2%x~^pWkSO-yCEb*!w!$|#h!PG527ra+mY_I1u& zD9T2r^3P0GoD5R|q~UvcNAK>4tqbzUsW2BtCN%$~x^Q^*-XP!{WewiNo_71gn>1}h(Ipr(MI5T&P2W$qkS zR%K-vO3p0hUp7iA*#Yfgu0lgud9tcpBTApSmaD&E<*DS13_xk?^cDBcE0o(dsmisY ztY#{^Eo5aiRz{)pCAZ_PorTj^8g7u329yCk>%2~sRZZof?^#)$oM1?ldHoxCKxFwfuMyE0b6mfwC3< z;PG4!vZ@LVWhFi9{G2E&naT$~WMwirmjt1-b^3}sHwDT?YG3EfO`@!5Do?^WNeyx? zB`CT2A(xG8o4(@CO@T6Hrkdz}UX&F~We8) zP@bu0oqrPL=caNVzDb&qGlrmaCyCoS102ei^{n%5QF?lgPI!rx%~=_S64g8RvQe?G z36)|M8p^-*tn(gG?l9N#Y^0i6kTW&_Wv3bi)jRW=kR4TMD0k{v=ify6v8jBg2P;o! zWfV$xlDMriz@glI=`q?j$seNpz*G+ZjFm0P85e@m*6Azm+!QFk(X-C`MESm{{QenM zwjyV|A4*%Nuef&wp=_!4bBtcN>-=}=P|Q1M{y&md<)5K6tdPvWMpxN}pWJVNd3oK;4Yp8m0ar?IjPITH!WSc`5;XMjUF zMa?>A9W6>vXVnwNva&5J!%*5feZ{@|3T3r+T0S=GSW&)cKC$K2va%gH*9M@pb^40i zu@1^%YSuZcq9`|+$|Lu&vOO!KQ0B}_=P!5@(Dyxceov9qh zJ-P>XWMu?OTc@wMb5o$)p=O=4P8H=-rm_t3v7N|C2|^j`-*}j_9wkm`u<{Qz>zq|x zluw$2bp|-r@lk5&MyP33`1${^p*U%DNr_FqIIv% zsv}BIH_qMo<<*6pv;dUSzp+rCFx#roP;ONFI%m}vkM!x zuTitkSxrPa-&CfdR?wB4^bnNpByqQvZCe!@%AGT`j>lO|MLEw@&cZ2eH*zxkP`Z=E zZJhxQC8>R#vs#MM)2A|HJuADjG6JPLN!->M;86Bev(8y_j-fJpf zxRsSXSs8}Xog{AS3~(sRs9EQ%uA;olR9=51D|?ZX9e~oEByQ^ra6c;-*3Wfe6f1kPG76=w(^uTPf>3Usq$+!f($m55bG&`}kaJxKN_UdDtuw%(Y`s}ko+HZZ z&9$6&5-aOY?8R8Gr*zjpk|%328hzr_3x_jtnA0i2$Z%?UvcNAK>6MXt*>(y z|McKgQ?|L5N3Uk(Ipl-<{;Ui`$<@1gqY9e*ST_S4%IRv>IZL|!o$cxRS9UQg z2aq!@0A*=qJxZF=fO4tY*EwsXtmQ;=El1<`;s9EQ%D@A#gxt3)FJ^N@fubR zA?L;*l(GJe955Klu`%1K&`|D6I#S6MWK9(1NOLWB3}WT^!vSC%W%lQ61~BmLI5D=d4Uo4l$M8|77KbWYjGS9S zP`Z=E3;r7HngI^wiwnwXZ=b26>~AVBsKv_RqMA^qwHtoR5k>uP?P{w=4VZ5gkLfLbNmUYg$MU=fv<=?NfGRVp>leQMS@>sC?rG?gFXEc#+{?g&8X_HVRx1~`;2W*x1)V{aFwryt(4ZCQBU><&`+uyOf+eLs0hNt=$W5qxx8j`5bwE^P5%0 zIvK=%YRkxk(#b+YxlGMEXWc8x&ZhF)?^rpCoV)x`a&sTq;<>eK+p5q|PEq?hXFVXw z4yN+t_N=^&l@Tay>3dgH$2utMtkM$QSr3Y`y{UW&HN4BonI44FS9fc13s0pxeI@@w z1eBfBtaH{wqHJp_kJ!%2E6BN|v+_z-hM{yP ziI=Ro&*85^L-~fDbuvbC#u0ei_d7G-xP&U!C&dWtv+f=4iX5~0??k6bS zN#eH70EaUCoVu2ei?XJve7qtn$FnjFr8`O7)*0YXZq>8St3{b?Do?=;s0rje5P-6l zub_HYxVcZkbKI~*qY~n^KZdfso^^gwl+{gTg>zUrk(E&>rMb^+Y0b^8t~Rwd6b)5~ZcnSKPTNP*zp@I%lmHWfgNR({Kl25;-&d zP}YfU?GoGfuBeW6Q0D4c=VwJ(*;Ed?jFppF8G*7rS3B164RBj$fJ0eL?dzQNoG3m0 z@P0$CAcdTVf>0JZpp8}UY?=WM2bp|+;@9J6S*F;&?RNgwBmFeW<1fX;$iQ75@ z9Lk&Ytn=HVBvbi$T~=nWG79CK7fSloczCC;xN}pW9PX>ARh_p&*~8OAt@{LNY%pzx&AIc#-`}_60M)mbxDYC_U;;PV4 z9z9uAek{u0OyyUoRA#d>0;M}i+}0W3P`1>w&QVeBHkEG=WaV|_%nm{snRIQ{Md|4-_Qn0IoI=hVg3?!KXGyOIl}Z&F%HQ;?^B1E0(OkAQ8^d{*8-&Le&(|8+o{7ceODfVQ-=&`^%iv(CSW@>BDPJ+C_}Z)9Zz z$`W3$D7B6pP}XQwM%&^2Pm~{-$~ARZc@sJFf>64X#NAr9ZB=L}r|Vhgy`tQ1D$AV6 z%A3iVPf!;0Z?tm;IF$3=RM+wkQF^+I1&}tpg_U6_(W1M^1KK!dJxZF=fU>XJ*E#D? zQEoHWa$?|aa(7AL;1rsYNC6;D7Tu*{ui{%ht$5#*~f|U1yeaT z%*wmSSrmlQog{AS3~(slP_xe2Cx~*Rsk{aC*y-dfCMY-a7O#6roBWhQ78=S?RuVu6HK5~}&pmyh^O8LPMFUW}UNrqFiGt|9pg%_p>qr zr8`O7t!3L*g@$sWnsv@j7UgPF`B67kK0wa0Ae7clU-6yx4By%A2xUagI%n4w<#JPb zHg@X|lCzwkv~~K5d!!0wSj{?THxT7wQ`sNCqGz%)3}vC}omJCU+>Uine&=W%kF%wR zS`SYTwe6_kJw(omfUIR3Z+7%huT>o0Dm0Y))xOTzEo3dj=2|wYz{-bN8HKXp2EJZV zXk6-{c9(9kg7*_eUOWEpS!gI1s9ERiGentVD(8=6Wez!yhoH1|`ieU@1zv(I zlnnztJ7M z;P01!Dm0WnHS3(+Ta-7OPi);`tbBx(Q7Db(KBai$&<)}q?5-e`jnu4jc0WGTzMZVHq=)V|Ky7mISdseFDkD;JZqE&!!FN!;z@Xj>H;%EfBdIr~ykjy09NpJU|` zRz{(8CyBeYY}=~PP}ZArypo>CzFd^on94RUv+^-=o(@6jP7=3u1~`;;)vR;&HKM%S zRK7okl}pK4?}yUX=__u>Iw<#7)3VOl(hskPrypK}J6O4ll@Tayoxb9BtgFS!8`P|G z_IO##i_NvX9;dX+$$2ISe>Llzohr(qrgHWaR<0yxLjX!&%^?eN M4&K}+VKc!04{qP;cmMzZ literal 0 HcmV?d00001 diff --git a/tests/unit/pcap/milliwatt.pcmu.rtp.pcap b/tests/unit/pcap/milliwatt.pcmu.rtp.pcap new file mode 100644 index 0000000000000000000000000000000000000000..8f68eaca98346a4eba5c4d4c77d71034ec9b4184 GIT binary patch literal 53384 zcmd7bcbJn^_6P7oQ;?z*6*L(_2Zy0|M1p{HQBazKL9vivFMvN>gD492vWhzy2vvG- zQloT4#R4kpVpLWXRzzi&)fM@j@0m#^H_RL|;ho95&%-mjf9xNh_ukz1yyu>K?x$Op zPcKd-De|Awr-_R3|M=t1eZyzIS(f(mf5*QrOX~kTdd%_6wc|TIP@1|D?YwJ`n_5=9 zsZ?k#73Y7&?wE4<99p@jyWhXV&;N(u@Gp-)baY1M%+a+RwGZ;&5j7ok_D|28HH80u z7|fjAuZE-Ud;GVL%TaH~w9L19xE%Gj@ZYZ09St^5%beS(y5owCQv>rl^4|?p1M@qi zInvin4J>G%=4iNfYG7g8G)KnjtiZz7Y0gF~vjU4+ra2og&k8JV?sPU;nw7PrsngkX zNg!)!6Q{HJ;y~8&#?G{sivn3I8#&WjFAQX@&Tyo)g>u;ss`4XIlBuk7ou77$=O^Wc za$#WV+J=s__VWW%*QGnsI?M}9-Ef7YdPn}dv4Nv{r@5KaHrIDl@A_8ev@P`=t{!tT zr|qieaP^&?8GOI4qs9RK`*9sd&0(`Lrytm>g@$q(-kKfF=39CZ%x z!yCpA@8jv2vj_0Qd!HX(-x`j3yQXE%>BSFk8$Y~m)gATU;fL3mAL6EI*$;0cl+U*) zr;X))D2M#dRQ}X~l~1rT3?&c6Rn;Bo>v<@yk^OZTR7>;fL35LC(YDhZuc$ z{1D~g@k7jcc-4FGL)^g+ug{#!;CuY=`tig2u&$%#kXcY}e?nD$Arln1(%*T(WYQ64pwj&c0Ee3Ga{2+Hgs;GtNR z;lvPRt>K}-5WLMpaU~DI`gBM2t1y4F=kc^nJOrJ29>2r$xEl|_HlD}5vgdJ)n0Y)s zW**myna4Au^O)yvbRP5kjm~3U1Tc?t76B;7-=iuIi}Hx6T-}++@+qQ{9w@Pt)X!N; z8pJFm^KzDw`H3whf$XIuOJ7PNi$G%Y*oAoviu^IQaE9_PIXK>5rC6|@<9 zRFvPD%3mh2@@ZBEp^Pjg=C2`U9_K72k$KGPu*_qgztMTj^H=6EKl9`icrj2H0VppWq$+%()2Za+Z=Sa)uy18c*cD67!8G@?8YvWi~bTWp;{{mtC73!{!sm{vpbJrgB_O zRzAnd5R_-W5_6W4yk3dCghXG7yo5wwiM)hFUx_(!am@D}zuLR+OzSDfrIIT?}f*EC#{s#X!FEBtC|6@iVIO0#WWTl|Ns| z%9n`Bx}iM#*J5%}c1&DxPVq66OFmVVWktE&RF)~r%9mLgh7wxK8CXW&8o7BC^wqQ$&Fe0I?;s$Wy}YAqKT)3 zqHL?;V<^+-smf}iTx%-p?qlT}tPILncF+?~^1+@&lx;iL zL>IZCEUYNos`wbnMO{m3zss7UTw*HMO=snstPDe0SW&iB@iCO|yrwGaigJOeEL)Y8 ze_ zvFW0mV=CAD%E|yMLr}(K?%GrI*T((tFwpH;ll($@Vo;G7!h%(Dmj!$FdG*$+o z+?=~7llyA4Q5G7?d+$<}ZACf7RBrIFGDvi>8_N7PwDL_r6>%0C%42I(Wjj&6VJbb3 zvvN8s!%*gK%;skAVn5hZorQ+->yqbdGq$5BUon++`m=Hd(ItK;9dWsAtDV1=OrlF&qQu^KOfK81C_Bxf_!!FG(^X}6QBE?ItK6)d#mW$rXKu{e zD+>+fBga)`Z&5yFDxVt8%GpF!Jy6Qtcw|E>cTXmFLu+1Yv(QlP>`+?!UG^2_6Q=UV za;%&~RE?l4s#=d^<6|i2JgX|N6XkeQdAJ`d-(qDDN`5sKNv%h+@iCOoeW5CE5ana0 za`Bz4oJ(|>8_J@p^++~8hO$GwGTMwCEXpya^6o9HoX5&Al<~Q2tD4tWcVj^NB9^Lz%lrUbwX$$;QV}2DYfmn??DsseHXJD;E$sTu{c9jpemLo6;;a zl&30Qpv~CfqP)*kzS)kI3t1V0GN){;&}%)C%|b)j$fGK673ICAvRpA%E+TSzpe(9d zk7TpZP_A99D(@7f*Ho5l!^*`(X#{0{<&SpBLPJ^Wl&bWK@=jBEVmT|9urdgxlt1Qf zXcbzmN3!uTlv{ghm7^m^iSl++S+PDVml9QX%UHIJL?s2?&^n|1@hq>zJ$6M0ty;tbjOnIg!f`<$xlp^++}g4Q1z+ zT7B%u2Squ|R34hk$`wR4Tu`2^qB=64Q1f%gVJxwcSuECj)Geg@&?H8Le`3yL z+)#22UP?|JCK?|@IZ&^4ep8ffOl1wcFW+Hh7|K+gI7~D?hVtEsY87y%C|jAzT|-&< zF3}Z!DCOjA-W#-qdg3sCG05+%Ae6=Tsmd%-wlI~Y8?kZ=QMwDtRGm0XG(Lv1s$T0H z6lGIW86LsPt*i_|d6vV=DbGSf`K?~-JWG@rrZW9qR&FC|=z;QRicTCR8XrUXxnAo$ zSCkD*%xt%D3pp0zL7WIk4MB`&9+f-01N9T#MzNy^NmX$kL8H6&?L-?u6LPObI zuXSD^%DSeqD)O;Ai5j_~j2^7Tb>cA5 zT4*R|>9x+QMCmYyc=bZB={>VY!R;}wy<9*IWTR>j9qexuhqzbncMO=Z;?to(qe89|xdR3h=d9*IWTR>j9q zR`IJKZc#mWy^85Cs!`+6iAWm^>=LwSu}>%2ph7nsVwyur%7M9tk$=5Ej? z*4HD^DBG&|7|O<%tM##aL>bq`sP`IHe#FW!l+xU%pc}MBSPKp1WWCmTuPBR|V_6eb zO&=4r@IzV9z8;B2*;d8JP)=X1j^(FN4nAcn7q?>NCqyk>P-ZvxNxZK|qEWV0@iCOX zQflSsXQKSwRJQ(zm7lUQ1Z6?{dK7gQ8p!dv&Id*LtEoIVo0a>CS`(Ccw7NRWE3s&^&`|#Km^x#>66G(Zvg&qLe#Xim zl+q_G-(wYL_Vq|K%C;&#hVqDB>l_y4&!+P8yIA=-Q5!du(dH;A?t7PCd<J|2|vzIXY>$577GYn=~^@`$NCG>4T3h}!z0ENEX3t4itPDe0z~(+ho`r_;6}{H^ zv?xC|m3#2z^$pQgeki3CY)m&^yJexF9H@3Y_L3++GL>I1W#zX-9bHh?ea{|!@A8X} zp?pNGb@mn$Wn8DY{>T*^Vr2-*JX^uqC<_f`Q?=IFd!8uYGskkw?X3JKk=q01xptS% zFUqzmK8AAL1g#3#d%h@lo5~v(u<|>iP6Xw-c9+gC%C;&#hVs})s`3I+#&wGO^C&A1 zvoZ+fxptR6%P03a*Fr;irCRIkEhoxt=2*7g$I9=Cu6Bzu+9f@;eed$?$N^rLgxf3fmk ztPDZPug084^~rUYF6=BclvUo+s(`(hiE@pp{7VT|{z%l-17*&I3rTmEF6=Bclw;Le zXK$J)SD4B!9#$SBx`v=sE?lrh7WycNWf029g$udIDvIXB zVWPFrP-a}KDr<>yv8h~#?ACFjZf+>^ysg4US!gJm2UKN!QO5O9EAtyGe`aMEO1s{^ z5_zdX`6a*ic*{fnoq5-cw}B|bp9ZrB~HJi*Eklrgtf*y{F`NR$VMY1M^fg_VVda_UW5MYp$$DC0WCxsVb0ov4o=%5%KP zsnD~~P=?f6XYVzleAb+?feNhrAJMfgD4jOFeI-&04dn{8*4f)ll#@+mjlrz^gOwpD zvoF@;uf%A9fxWWOQ0`Z2oxR;f8Q1l%c_mh!BI@gbGWRZ`)b_p0uVWpQzp1s(-kzd- z+8oP<$cX$&bR9uy^&N+iDBG&|7|MZat+Tg}D4#TyWB<*{)2s|aY4sh4R%fB1d`zu% z_FgYazo{&f?x&sn9do@KN~`ZUj6~U1#m7)Sr1o|8-YCj(rtn?_g1mF_ly5v$6zHe;1T7 z8?-6ydzW9wIw)tTwa(t5qI}3ycIKVEoh4Zrf->*xQj@>qFcM{36(2*nNUe4DdPI4@ zsoZ*im8FPo@IV>4tJA7G4z12YL#g+5_6`?iTyMkU4On>|(TxOUVMW^qaWPfgtM zAiHFtp}g@Ybu8}@N)1Ry?!^$v}88O%XT5-o=ezhLSR%t*vQLT0M-Y3equ78Kd zu<`<;fqp1YT71W0q9+a$Ju3+1Cbh4#_d!v{^~2l!3oFYK4RS#lxk=pWDBG&|7|Ka% zt+V%GQQmCM*zXpwvK%WzP^Rj{VWMXRq5Mv*b@q-H#9z{(0lLkP;qP2!PUw%xMOQ2s~l>+F3@lsA~lzjk5eg{%xh z8M#S3lFPPR78=Ukm9+X;?|4zhb&Bg>l9d+`-Q7baEP~z?@qQl%C;&#hVnYKud{cuDC2sl{j!afm56TkLz&-osj0qw zC30^Hlq>#FXYBK$>|&1P_Z?VSnP{jBN{57aat(W4cPAJ0qEpMW&`|d5rS$^#zAQ?& zsT_J0E32?FB+87O+EJU{0S;wAuXTQ1l%G%NEtBdx;VWMXRq1>(4 zI%kS9uJ2Z(8(Db?(JcgJJFdBV+lIHVM6%FOmep&WvqTx!cWdu5R$j`=Ae3m)jT5w1 zN7+`z$50+o`#O84iL#kFV_%-Y%Bn;jHm#H!74t4 zFSiNtJjQ%p$IYtFa-mZp_JxLWPj$6Ec8)01P34HkS$P@Ja6gopZ}qT6-@E)eazJ^$ z+Sl1TPn2DnP%FBsvbwN38n>}w|iS&hr@^-z}d4VY7`fi=Ro|O((hM-*B-05tx zltVmDpkj5mTNWD1MQUGX??O@5F=y<&;;eKM-R6NZW+}1d9pF$dSNl49mxuAkwZHP@$7g9IF!ygYOV7MQKp&7g;%q(IxB-vra2-ZUZa&+fkiFtmW770 zqF(E~R+QCD<))`t=_0z_4W*;@p=6H-6-gEv%6*+K)G9~Ui88K-+6U!WS%Z~f8O!#G zy%JNEg{Hgq4KJbBIk!@Lfs*?-cHAzm}SMQ9lx6Uw92e16@f^NX^rijSeJrq?>}6=hrxwS&aU`b1tgl(}Dv_Phfe z$}ab-RluJ@IVi4&+U0{;*?^T{C^u>ww7i6*ItvZuHnp#_cfTnAXZ|jG|IW%Qh-;dXp{>|&U*0iptCpkNmUja%659K^FdL@ z^-%lZ8CEuAWe7?~TFxH1P457Qa=u>c{EaAoGG}as2U(dxbhk&8={X^uP457QGE=X0 z{#KN6-Nhc^D&U=si0&aMYmTtz?JJR&8ImwBCm3AvcuV+E_gvlSvz}Wp`q-f);jyjigLTDEOm;N?TH?7 zLD^svXYZn|x%t;%vn(`}kE*rKz6zq;Vk#f+%gQTR8G|7 z(qEaC9f(GIpj?`ry=!XMJHVlQRjqaQRTAZ9Q@O~)%BzUR5R^q#>yd1H3}vzUS{1Ob ziYPal%5R=!Wk*&9q0F4NnOk&s&AtGq5Nkb>tW4Ccnx)(g+7x7=q10=geQBbM>n=vUSlOBA|6EXB$=6rEJvFevu6KY#*S z5_2rCpTx>8tPDZP8?>Xj=I*Fn?*NB#np*4Zt1Ze!rt-7xtn5lO&I4u4#w>?+xJAfb zS!gIXsC}J%^+Y+}R4y69%4>)oBPbmWHWf*&M_Q6q8c@D6MXTucrHeAI@7APUtn9|h zAe52*jdr~QT*gwZb@nw9wZ$FaP!4US^#b-a5#@AKc_4$8 zJy;or^1ZlRw%xMOP|jCtoqf$jIn7i~yP1_ei5~Yu$=SQje8MFs#B=qqTNWD1NouXL zueB)uW-99}VP!8OzY9ubgVq*VXebA(wa&iwqI}&{R$9x--mDBknZO2ZO0&>VmRDxd?}p^O}>uC zK=d?0DaR{}SEJOB+9nGP<*jP1v+rh6K5UNVkEK{Skd;9wQ+47n(JVBScc`__zM-Og z$W*R5z{){H&$yusOx=LvLAU_t%oNU zW3wzYl&5NHRlvRxqKxZE)oCv)hY(HjLpkFRhj=GrH)!pZg@&@DTI=k)U6iBDu`K>Q zD{ms2?1FMNhjwiv&3y{`YAk{*G?ZU#Qpa+nDC7EW&Fag_n^_rxGG>D|T0?55EHspr z)xOR?uPE;{$8zN5tQ<=8tOrVdMGoN&TDc&S|3*Ji?2?6sa)4Uv?7LT#x0=dQf3k8I z(Q^c)GdslNV?iys_HJc{-LlY7{yA5xTlYOE%DBE;?H#PVg_S`l9ra^EyzJvaw#q_7 z`G;ET?0ZC%H<@Gk%2HN(h@N*tnY*D?(BnZx(~$$pwQ8-iZ;UA8I#OMP2yZwm!%!yH z+$VLl&`{QVt)z0w)c2SuZ!pL5ifydCmFNXOl>2!|hVUygzl!QqXQ83gYn^?Mi?W}o zoPwRb+lXFtLCK+AG{m#x9pF&jpw>G3o)l#tQ#moj$`Py#K^fVgE$S18iJldN(xuiq z`zDGquJ6{1?OAy{(MujEWrH@i$xkB3go-o^4dokZUuWO5qP)f&%Pg$1cM!cyP^Rj{ mVWMXRq3odcb@sg^%1)+o)>u~F$;zPoE_0gu%(Lko;QtT)4?M{L literal 0 HcmV?d00001 diff --git a/tests/unit/switch_rtp_pcap.c b/tests/unit/switch_rtp_pcap.c new file mode 100644 index 0000000000..74b79f9a24 --- /dev/null +++ b/tests/unit/switch_rtp_pcap.c @@ -0,0 +1,580 @@ +/* +* FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application +* Copyright (C) 2005-2021, 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): +* Dragos Oancea +* +* switch_rtp_pcap.c -- tests RTP stack using PCAP. +*/ + + +#include +#include + +/* before adding a pcap file: tcprewrite --dstipmap=X.X.X.X/32:192.168.0.1/32 --srcipmap=X.X.X.X/32:192.168.0.2/32 -i in.pcap -o out.pcap */ + +#include + +#ifndef MSG_CONFIRM +#define MSG_CONFIRM 0 +#endif + +static const char *rx_host = "127.0.0.1"; +static const char *tx_host = "127.0.0.1"; +static switch_rtp_t *rtp_session = NULL; +const char *err = NULL; +switch_rtp_packet_t rtp_packet; +switch_frame_flag_t *frame_flags; +switch_io_flag_t io_flags; +switch_payload_t read_pt; +static switch_port_t audio_rx_port = 1234; + +static int got_media_timeout = 0; + +//#define USE_RTCP_PCAP + +#define NTP_TIME_OFFSET 2208988800UL + +/* https://www.tcpdump.org/pcap.html */ +/* IP header */ +struct sniff_ip { + u_char ip_vhl; /* version << 4 | header length >> 2 */ + u_char ip_tos; /* type of service */ + u_short ip_len; /* total length */ + u_short ip_id; /* identification */ + u_short ip_off; /* fragment offset field */ +#define IP_RF 0x8000 /* reserved fragment flag */ +#define IP_DF 0x4000 /* dont fragment flag */ +#define IP_MF 0x2000 /* more fragments flag */ +#define IP_OFFMASK 0x1fff /* mask for fragmenting bits */ + u_char ip_ttl; /* time to live */ + u_char ip_p; /* protocol */ + u_short ip_sum; /* checksum */ + struct in_addr ip_src,ip_dst; /* source and dest address */ +}; + +#define IP_HL(ip) (((ip)->ip_vhl) & 0x0f) + +/* switch_rtp.c - calc_local_lsr_now() */ +static inline uint32_t test_calc_local_lsr_now(switch_time_t now, uint32_t past /*milliseconds*/) +{ +// switch_time_t now; + uint32_t ntp_sec, ntp_usec, lsr_now, sec; +// now = switch_micro_time_now() - (past * 1000); + now = now - (past * 1000); + sec = (uint32_t)(now/1000000); /* convert to seconds */ + ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ + ntp_usec = (uint32_t)(now - ((switch_time_t) sec*1000000)); /* remove seconds to keep only the microseconds */ + + lsr_now = (uint32_t)(ntp_usec*0.065536) | (ntp_sec&0x0000ffff)<<16; /* 0.065536 is used for convertion from useconds to fraction of 65536 (x65536/1000000) */ + return lsr_now; +} + +#if 0 +static void test_prepare_rtcp(void *rtcp_packet, float est_last, uint32_t rtt, uint8_t loss) +{ + /* taken from switch_rtp.c, rtcp_generate_sender_info() */ + /* === */ + char *rtcp_sr_trigger = rtcp_packet; + switch_time_t now; + uint32_t sec, ntp_sec, ntp_usec; + uint32_t ntp_msw; + uint32_t ntp_lsw; + uint32_t *ptr_msw; + uint32_t *ptr_lsw; + uint32_t lsr; + uint32_t *ptr_lsr; + uint32_t dlsr = 0; + uint32_t *ptr_dlsr; + uint8_t *ptr_loss; + + now = switch_micro_time_now(); + sec = (uint32_t)(now/1000000); /* convert to seconds */ + ntp_sec = sec+NTP_TIME_OFFSET; /* convert to NTP seconds */ + ntp_msw = htonl(ntp_sec); /* store result in "most significant word" */ + ntp_usec = (uint32_t)(now - (sec*1000000)); /* remove seconds to keep only the microseconds */ + ntp_lsw = htonl((u_long)(ntp_usec*(double)(((uint64_t)1)<<32)*1.0e-6)); + + /* === */ + + /*patch the RTCP payload to set the RTT we want */ + + ptr_msw = (uint32_t *)rtcp_sr_trigger + 2; + *ptr_msw = ntp_msw; + + ptr_lsw = (uint32_t *)rtcp_sr_trigger + 3; + *ptr_lsw = ntp_lsw; + + lsr = test_calc_local_lsr_now(now, est_last * 1000 + rtt /*ms*/); + + ptr_lsr = (uint32_t *)rtcp_sr_trigger + 11; + *ptr_lsr = htonl(lsr); + + ptr_dlsr = (uint32_t *)rtcp_sr_trigger + 12; + *ptr_dlsr = htonl(dlsr); + + ptr_loss = (uint8_t *)rtcp_sr_trigger + 32; + *ptr_loss = loss; +} +#endif + +static switch_status_t rtp_test_start_call(switch_core_session_t **psession) +{ + char *r_sdp; + uint8_t match = 0, p = 0; + switch_core_session_t *session; + switch_channel_t *channel = NULL; + switch_status_t status; + switch_media_handle_t *media_handle; + switch_core_media_params_t *mparams; + switch_stream_handle_t stream = { 0 }; + switch_call_cause_t cause; + + /*tone stream extension*/ + status = switch_ivr_originate(NULL, psession, &cause, "null/+1234", 2, NULL, NULL, NULL, NULL, NULL, SOF_NONE, NULL, NULL); + session = *psession; + + if (!(session)) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "no session\n"); + return SWITCH_STATUS_FALSE; + } + + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "switch_ivr_originate() failed\n"); + return SWITCH_STATUS_FALSE; + } + + channel = switch_core_session_get_channel(session); + if (!channel) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "switch_core_session_get_channel() failed\n"); + return SWITCH_STATUS_FALSE; + } + mparams = switch_core_session_alloc(session, sizeof(switch_core_media_params_t)); + mparams->inbound_codec_string = switch_core_session_strdup(session, "PCMU"); + mparams->outbound_codec_string = switch_core_session_strdup(session, "PCMU"); + mparams->rtpip = switch_core_session_strdup(session, (char *)rx_host); + + status = switch_media_handle_create(&media_handle, session, mparams); + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "switch_media_handle_create() failed\n"); + return SWITCH_STATUS_FALSE; + } + + switch_channel_set_variable(channel, "absolute_codec_string", "PCMU"); + switch_channel_set_variable(channel, "send_silence_when_idle", "-1"); + switch_channel_set_variable(channel, "rtp_timer_name", "soft"); + switch_channel_set_variable(channel, "media_timeout", "1000"); + + switch_channel_set_variable(channel, SWITCH_LOCAL_MEDIA_IP_VARIABLE, rx_host); + switch_channel_set_variable_printf(channel, SWITCH_LOCAL_MEDIA_PORT_VARIABLE, "%d", audio_rx_port); + + r_sdp = switch_core_session_sprintf(session, + "v=0\n" + "o=FreeSWITCH 1632033305 1632033306 IN IP4 %s\n" + "s=-\n" + "c=IN IP4 %s\n" + "t=0 0\n" + "m=audio 11114 RTP/AVP 0 101\n" + "a=rtpmap:0 PCMU/8000\n" + "a=rtpmap:101 telephone-event/8000\n" + "a=rtcp-mux\n", + tx_host, tx_host); + + status = switch_core_media_prepare_codecs(session, SWITCH_FALSE); + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "switch_core_media_prepare_codecs() failed\n"); + return SWITCH_STATUS_FALSE; + } + + match = switch_core_media_negotiate_sdp(session, r_sdp, &p, SDP_TYPE_REQUEST); + if (match != 1) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "switch_core_media_negotiate_sdp() failed\n"); + return SWITCH_STATUS_FALSE; + } + + status = switch_core_media_choose_ports(session, SWITCH_TRUE, SWITCH_FALSE); + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "switch_core_media_choose_ports() failed\n"); + return SWITCH_STATUS_FALSE; + } + + status = switch_core_media_activate_rtp(session); + if (status != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "switch_core_media_activate_rtp() failed\n"); + return SWITCH_STATUS_FALSE; + } + + switch_core_media_set_rtp_flag(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_RTP_FLAG_DEBUG_RTP_READ); + switch_core_media_set_rtp_flag(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_RTP_FLAG_DEBUG_RTP_WRITE); + + SWITCH_STANDARD_STREAM(stream); + switch_api_execute("fsctl", "debug_level 10", session, &stream); + switch_safe_free(stream.data); + + return SWITCH_STATUS_SUCCESS; +} + +static switch_status_t rtp_test_end_call(switch_core_session_t **psession) +{ + switch_channel_t *channel = NULL; + switch_core_session_t *session = *psession; + + channel = switch_core_session_get_channel(session); + if (!channel) { + return SWITCH_STATUS_FALSE; + } + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_media_handle_destroy(session); + switch_core_session_rwunlock(session); + + return SWITCH_STATUS_SUCCESS; +} + +static void rtp_test_init_frame(switch_frame_t **pwrite_frame, switch_core_session_t **psession) +{ + const unsigned char hdr_packet[]="\x80\x00\xcd\x15\xfd\x86\x00\x00\x61\x5a\xe1\x37"; + + switch_frame_alloc(pwrite_frame, SWITCH_RECOMMENDED_BUFFER_SIZE); + (*pwrite_frame)->codec = switch_core_session_get_write_codec(*psession); + + (*pwrite_frame)->datalen = SWITCH_RTP_HEADER_LEN; /*init with dummy RTP header*/ + memcpy((*pwrite_frame)->data, &hdr_packet, SWITCH_RTP_HEADER_LEN); +} + +static void show_event(switch_event_t *event) { + char *str; + /*print the event*/ + switch_event_serialize_json(event, &str); + if (str) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "%s\n", str); + switch_safe_free(str); + } +} + +static void event_handler(switch_event_t *event) +{ + const char *new_ev = switch_event_get_header(event, "Event-Name"); + + if (new_ev && !strcmp(new_ev, "CHANNEL_HANGUP")) { + if (!strcmp(switch_event_get_header(event, "Hangup-Cause"), "MEDIA_TIMEOUT")) { + got_media_timeout = 1; + } + } + + show_event(event); +} + +FST_CORE_DB_BEGIN("./conf_rtp") +{ +FST_SUITE_BEGIN(switch_rtp_pcap) +{ + +FST_SETUP_BEGIN() +{ + fst_requires_module("mod_loopback"); +} +FST_SETUP_END() + +FST_TEARDOWN_BEGIN() +{ +} +FST_TEARDOWN_END() +#if 0 + FST_TEST_BEGIN(test_rtp_stall_with_rtcp_muxed_with_timer) + { + switch_core_session_t *session = NULL; + switch_status_t status; + uint32_t plen = SWITCH_RTP_HEADER_LEN; + char rpacket[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_payload_t pt = { 0 }; + switch_frame_flag_t frameflags = { 0 }; + int x = 0; + switch_frame_t *write_frame; + pcap_t *pcap; + const unsigned char *packet; + char errbuf[PCAP_ERRBUF_SIZE]; + struct pcap_pkthdr pcap_header; + char rtcp_sr_trigger[] = "\x81\xc8\x00\x0c\x78\x9d\xac\x45\xe2\x67\xa5\x74\x30\x60\x56\x81\x00\x19" + "\xaa\x00\x00\x00\x06\xd7\x00\x01\x2c\x03\x5e\xbd\x2f\x0b\x00" + "\x00\x00\x00\x00\x00\x57\xc4\x00\x00\x00\x39\xa5\x73\xfe\x90\x00\x00\x2c\x87" + "\x81\xca\x00\x0c\x78\x9d\xac\x45\x01\x18\x73\x69\x70\x3a\x64\x72\x40\x31\x39\x32\x2e" + "\x31\x36\x38\x2e\x30\x2e\x31\x33\x3a\x37\x30\x36\x30\x06\x0e\x4c\x69\x6e\x70\x68\x6f" + "\x6e\x65\x2d\x33\x2e\x36\x2e\x31\x00\x00"; + const struct sniff_ip *ip; /* The IP header */ + int size_ip, jump_over; + struct timeval prev_ts = { 0 }; + switch_time_t time_nowpacket = 0, time_prevpacket = 0; + switch_socket_t *sock_rtp = NULL; + switch_sockaddr_t *sock_addr = NULL; + const char *str_err; + switch_size_t rough_add = 0; + + status = rtp_test_start_call(&session); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(session); + + pcap = pcap_open_offline_with_tstamp_precision("pcap/milliwatt.long.pcmu.rtp.pcap", PCAP_TSTAMP_PRECISION_MICRO, errbuf); + fst_requires(pcap); + + switch_core_media_set_rtp_flag(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_RTP_FLAG_ENABLE_RTCP); + + rtp_session = switch_core_media_get_rtp_session(session, SWITCH_MEDIA_TYPE_AUDIO); + + rtp_test_init_frame(&write_frame, &session); + + switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_PAUSE); + + if (switch_socket_create(&sock_rtp, AF_INET, SOCK_DGRAM, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + fst_requires(0); /*exit*/ + } + + switch_sockaddr_new(&sock_addr, rx_host, audio_rx_port, switch_core_session_get_pool(session)); + fst_requires(sock_addr); + + switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(sock_addr), 0, SWITCH_FALSE, &str_err); + switch_rtp_reset(rtp_session); + + while ((packet = pcap_next(pcap, &pcap_header))) { + /*assume only UDP/RTP packets in the pcap*/ + uint32_t rcvd_datalen = pcap_header.caplen; + size_t len; + switch_size_t tmp_len; + + int diff_us = (pcap_header.ts.tv_sec-prev_ts.tv_sec)*1000000+(pcap_header.ts.tv_usec-prev_ts.tv_usec); + + if (diff_us > 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SENT pkt diff: %d us\n", diff_us); + usleep(diff_us); + } + + prev_ts = pcap_header.ts; + + len = pcap_header.caplen; + + if (len <= 42) { + continue; + } + + ip = (struct sniff_ip*)(packet + 14); + size_ip = IP_HL(ip) * 4; + + jump_over = 14 /*SIZE_ETHERNET*/ + size_ip /*IP HDR size*/ + 8 /* UDP HDR SIZE */; /* jump 42 bytes over network layers/headers */ + packet += jump_over; + x++; + + if (!(x%10)) { /* send a RTCP SR packet every 10th RTP packet */ + int add_rtt = 200; + test_prepare_rtcp(&rtcp_sr_trigger, 2, add_rtt, 0xa0); + tmp_len = sizeof(rtcp_sr_trigger); + /*RTCP muxed*/ + if (switch_socket_sendto(sock_rtp, sock_addr, MSG_CONFIRM, (const char*)rtcp_sr_trigger, &tmp_len) != SWITCH_STATUS_SUCCESS) { + fst_requires(0); + } + + plen = sizeof(rtcp_sr_trigger); + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_INFO, "Sent RTCP. Packet size = [%u]\n", plen); + status = switch_rtp_read(rtp_session, (void *)rpacket, &rcvd_datalen, &pt, &frameflags, io_flags); + if (pt == SWITCH_RTP_CNG_PAYLOAD /*timeout*/) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "read CNG/RTCP, skip\n"); + while (1) { + status = switch_rtp_read(rtp_session, (void *)&rpacket, &rcvd_datalen, &pt, &frameflags, io_flags); + if (frameflags || SFF_RTCP) break; + } + } + fst_requires(status == SWITCH_STATUS_SUCCESS); + } + + if (packet[0] == 0x80 && packet[1] == 0 /*PCMU*/) { + int16_t *seq = (int16_t *)packet + 1; + plen = len - jump_over; + tmp_len = plen; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sent RTP. Packet size = [%u] seq = [%d]\n", plen, htons(*seq)); + if (switch_socket_sendto(sock_rtp, sock_addr, MSG_CONFIRM, (const char*)packet, &tmp_len) != SWITCH_STATUS_SUCCESS) { + fst_requires(0); + } + } + + status = switch_rtp_read(rtp_session, (void *)&rpacket, &rcvd_datalen, &pt, &frameflags, io_flags); + if (pt == SWITCH_RTP_CNG_PAYLOAD /*timeout*/) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "read CNG, skip\n"); + continue; + } + time_prevpacket = time_nowpacket; + time_nowpacket = switch_time_now(); + if (time_prevpacket) { // skip init. + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RECV pkt diff: %ld us\n", time_nowpacket - time_prevpacket); + + fst_requires((time_nowpacket - time_prevpacket) < 80000); + rough_add += time_nowpacket - time_prevpacket; /* just add to var for visual comparison */ + } + fst_requires(status == SWITCH_STATUS_SUCCESS); + if (pt == SWITCH_RTP_CNG_PAYLOAD /*timeout*/) continue; + fst_requires(rcvd_datalen == plen - SWITCH_RTP_HEADER_LEN); + } + + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "RECV total delay: %lu\n", rough_add); /*around 17092408 us*/ + switch_yield(1000 * 1000); + + if (write_frame) switch_frame_free(&write_frame); + + switch_rtp_destroy(&rtp_session); + + rtp_test_end_call(&session); + + switch_socket_close(sock_rtp); + + pcap_close(pcap); + + switch_yield(1000 * 1000); + } + FST_TEST_END() +#endif + + FST_TEST_BEGIN(test_rtp_media_timeout) + { + switch_core_session_t *session = NULL; + switch_status_t status; + uint32_t plen = SWITCH_RTP_HEADER_LEN; + char rpacket[SWITCH_RECOMMENDED_BUFFER_SIZE]; + switch_payload_t pt = { 0 }; + switch_frame_flag_t frameflags = { 0 }; + int x = 0; + switch_frame_t *write_frame; + pcap_t *pcap; + const unsigned char *packet; + char errbuf[PCAP_ERRBUF_SIZE]; + struct pcap_pkthdr pcap_header; + const struct sniff_ip *ip; /* The IP header */ + int size_ip, jump_over; + struct timeval prev_ts = { 0 }; + switch_socket_t *sock_rtp = NULL; + switch_sockaddr_t *sock_addr = NULL; + const char *str_err; + + status = rtp_test_start_call(&session); + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(session); + + switch_event_bind("", SWITCH_EVENT_ALL, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL); + + pcap = pcap_open_offline_with_tstamp_precision("pcap/milliwatt.pcmu.rtp.pcap", PCAP_TSTAMP_PRECISION_MICRO, errbuf); + fst_requires(pcap); + + switch_core_media_set_rtp_flag(session, SWITCH_MEDIA_TYPE_AUDIO, SWITCH_RTP_FLAG_ENABLE_RTCP); + + rtp_session = switch_core_media_get_rtp_session(session, SWITCH_MEDIA_TYPE_AUDIO); + fst_requires(rtp_session); + + rtp_test_init_frame(&write_frame, &session); + + switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_PAUSE); + + if (switch_socket_create(&sock_rtp, AF_INET, SOCK_DGRAM, 0, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) { + fst_requires(0); /*exit*/ + } + + switch_sockaddr_new(&sock_addr, rx_host, audio_rx_port, switch_core_session_get_pool(session)); + fst_requires(sock_addr); + + switch_rtp_set_remote_address(rtp_session, tx_host, switch_sockaddr_get_port(sock_addr), 0, SWITCH_FALSE, &str_err); + switch_rtp_reset(rtp_session); + + /* send 3 packets then wait and expect RTP timeout */ + while ((packet = pcap_next(pcap, &pcap_header)) && x < 3) { + /*assume only UDP/RTP packets in the pcap*/ + uint32_t rcvd_datalen = pcap_header.caplen; + size_t len; + switch_size_t tmp_len; + + int diff_us = (pcap_header.ts.tv_sec-prev_ts.tv_sec)*1000000+(pcap_header.ts.tv_usec-prev_ts.tv_usec); + if (diff_us > 0) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "SENT pkt diff: %d us\n", diff_us); + usleep(diff_us); + } + + x++; + + prev_ts = pcap_header.ts; + + len = pcap_header.caplen; + + if (len <= 42) { + continue; + } + + ip = (struct sniff_ip*)(packet + 14); + size_ip = IP_HL(ip) * 4; + + jump_over = 14 /*SIZE_ETHERNET*/ + size_ip /*IP HDR size*/ + 8 /* UDP HDR SIZE */; /* jump 42 bytes over network layers/headers */ + packet += jump_over; + + if (packet[0] == 0x80 && packet[1] == 0 /*PCMU*/) { + int16_t *seq = (int16_t *)packet + 1; + plen = len - jump_over; + tmp_len = plen; + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Sent RTP. Packet size = [%u] seq = [%d]\n", plen, htons(*seq)); + if (switch_socket_sendto(sock_rtp, sock_addr, MSG_CONFIRM, (const char*)packet, &tmp_len) != SWITCH_STATUS_SUCCESS) { + fst_requires(0); + } + } + + status = switch_rtp_read(rtp_session, (void *)&rpacket, &rcvd_datalen, &pt, &frameflags, io_flags); + if (pt == SWITCH_RTP_CNG_PAYLOAD /*timeout*/) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "read CNG, skip\n"); + continue; + } + + fst_requires(status == SWITCH_STATUS_SUCCESS); + fst_requires(rcvd_datalen == plen - SWITCH_RTP_HEADER_LEN); + } + + x = 150; /* 3 seconds max */ + while (x || !got_media_timeout) { + uint32_t rcvd_datalen; + status = switch_rtp_read(rtp_session, (void *)&rpacket, &rcvd_datalen, &pt, &frameflags, io_flags); + if (pt == SWITCH_RTP_CNG_PAYLOAD /*timeout*/) { + switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "read CNG, skip\n"); + } + switch_yield(20 * 1000); + fst_requires(status == SWITCH_STATUS_SUCCESS); + x--; + } + + if (write_frame) switch_frame_free(&write_frame); + + switch_rtp_destroy(&rtp_session); + + rtp_test_end_call(&session); + + switch_socket_close(sock_rtp); + + pcap_close(pcap); + + fst_check(got_media_timeout); + } + FST_TEST_END() +} +FST_SUITE_END() +} +FST_CORE_END() + From d38ed7d37973a49a1f047cf210d4c2486c8d902d Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 29 Jun 2022 21:42:37 +0300 Subject: [PATCH 009/155] [Unit-tests] Fix unused function in switch_rtp_pcap --- tests/unit/switch_rtp_pcap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/switch_rtp_pcap.c b/tests/unit/switch_rtp_pcap.c index 74b79f9a24..647e481c8e 100644 --- a/tests/unit/switch_rtp_pcap.c +++ b/tests/unit/switch_rtp_pcap.c @@ -76,6 +76,7 @@ struct sniff_ip { #define IP_HL(ip) (((ip)->ip_vhl) & 0x0f) /* switch_rtp.c - calc_local_lsr_now() */ +#if 0 static inline uint32_t test_calc_local_lsr_now(switch_time_t now, uint32_t past /*milliseconds*/) { // switch_time_t now; @@ -90,7 +91,6 @@ static inline uint32_t test_calc_local_lsr_now(switch_time_t now, uint32_t past return lsr_now; } -#if 0 static void test_prepare_rtcp(void *rtcp_packet, float est_last, uint32_t rtt, uint8_t loss) { /* taken from switch_rtp.c, rtcp_generate_sender_info() */ From 871cc585b1498d8c495afa67e9adcb293c18f7b7 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Wed, 6 Jul 2022 15:26:43 +0300 Subject: [PATCH 010/155] [mod_voicemail] fix vm_fsdb_msg_list --- 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 1768f59585..0dc84b34ce 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -5430,7 +5430,7 @@ SWITCH_STANDARD_API(vm_fsdb_msg_list_function) if (!msg_order) { msg_order = "ASC"; - } else if (strcasecmp(msg_order, "ASC") || strcasecmp(msg_order, "DESC")) { + } else if (strcasecmp(msg_order, "ASC") && strcasecmp(msg_order, "DESC")) { stream->write_function(stream, "-ERR Bad Argument: '%s'\n", msg_order); goto done; } From 86ad85161bf025da8cb115a653e272087dd9f0f5 Mon Sep 17 00:00:00 2001 From: Thiadmer Date: Sun, 10 Jul 2022 15:16:07 +0200 Subject: [PATCH 011/155] [mod_say_de] Let de_say_time handle short_date_time type --- src/mod/say/mod_say_de/mod_say_de.c | 1 + 1 file changed, 1 insertion(+) 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 3f0245aac2..3003ab4bc2 100644 --- a/src/mod/say/mod_say_de/mod_say_de.c +++ b/src/mod/say/mod_say_de/mod_say_de.c @@ -517,6 +517,7 @@ static switch_status_t de_say(switch_core_session_t *session, char *tosay, switc case SST_CURRENT_DATE: case SST_CURRENT_TIME: case SST_CURRENT_DATE_TIME: + case SST_SHORT_DATE_TIME: say_cb = de_say_time; break; case SST_IP_ADDRESS: From c671ebcb886f0f0ceabc9a73dd5764872434e5d3 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 26 Jul 2022 01:47:27 +0300 Subject: [PATCH 012/155] [mod_sofia] unit-tests: Give mod_sofia time to spin up profile threads on load. Remove some fst_requires(). --- .../endpoints/mod_sofia/test/sipp-based-tests.c | 14 +++++++------- .../endpoints/mod_sofia/test/test_sofia_funcs.c | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c index 33259f043f..52c7c2f66c 100644 --- a/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c +++ b/src/mod/endpoints/mod_sofia/test/sipp-based-tests.c @@ -247,6 +247,7 @@ FST_CORE_EX_BEGIN("./conf-sipp", SCF_VG | SCF_USE_SQL) FST_TEARDOWN_BEGIN() { + switch_sleep(200 * 1000); } FST_TEARDOWN_END() @@ -681,15 +682,14 @@ skiptest: fst_check(status == SWITCH_STATUS_SUCCESS); /*test is considered PASSED if we get a session*/ - if (!session) { - fst_requires(session); + fst_check(session); + if (session) { + switch_sleep(1000 * 1000); + channel = switch_core_session_get_channel(session); + switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); + switch_core_session_rwunlock(session); } - switch_sleep(1000 * 1000); - - channel = switch_core_session_get_channel(session); - switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); - switch_core_session_rwunlock(session); switch_safe_free(to); /* sipp should timeout, attempt kill, just in case.*/ kill_sipp(); diff --git a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c index 7ea194f6e4..dbc75390d4 100644 --- a/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c +++ b/src/mod/endpoints/mod_sofia/test/test_sofia_funcs.c @@ -34,6 +34,7 @@ #include "../mod_sofia.c" static int timeout_sec = 10; +static switch_interval_time_t delay_start_ms = 5000; FST_CORE_EX_BEGIN("./conf", SCF_VG | SCF_USE_SQL) @@ -41,6 +42,11 @@ FST_MODULE_BEGIN(mod_sofia, sofia) FST_SETUP_BEGIN() { + /* Give mod_sofia time to spinup profile threads */ + if (delay_start_ms) { + switch_sleep(delay_start_ms * 1000); + delay_start_ms = 0; + } } FST_SETUP_END() @@ -108,7 +114,6 @@ FST_TEST_BEGIN(originate_test) fst_check(status == SWITCH_STATUS_SUCCESS); if (session) { channel = switch_core_session_get_channel(session); - fst_requires(channel); switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING); switch_core_session_rwunlock(session); switch_sleep(1 * 1000 * 1000); From d96b6a4a8f97fe2bead4099c3ad9dbd16276ae40 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 23 Jul 2022 22:07:40 +0300 Subject: [PATCH 013/155] [Core] Fix possible race condition between locking a session and reading it's flags in switch_core_session_read_lock() and switch_core_session_read_lock_hangup(). --- src/switch_core_rwlock.c | 44 +++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/src/switch_core_rwlock.c b/src/switch_core_rwlock.c index 61c9ca45b9..69e188ed79 100644 --- a/src/switch_core_rwlock.c +++ b/src/switch_core_rwlock.c @@ -85,9 +85,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio switch_status_t status = SWITCH_STATUS_FALSE; if (session->rwlock) { - if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_down_nosig(session->channel)) { - status = SWITCH_STATUS_FALSE; - if (switch_thread_rwlock_tryrdlock(session->rwlock) == SWITCH_STATUS_SUCCESS) { + if ((status = switch_thread_rwlock_tryrdlock(session->rwlock)) == SWITCH_STATUS_SUCCESS) { + if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_down_nosig(session->channel)) { + status = SWITCH_STATUS_FALSE; if (switch_channel_test_flag(session->channel, CF_THREAD_SLEEPING)) { #ifdef SWITCH_DEBUG_RWLOCKS switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Ping thread\n", @@ -95,18 +95,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock(switch_core_sessio #endif switch_core_session_wake_session_thread(session); } + +#ifdef SWITCH_DEBUG_RWLOCKS + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Read lock FAIL\n", + switch_core_session_get_uuid(session), switch_channel_get_name(session->channel)); +#endif switch_thread_rwlock_unlock(session->rwlock); + } else { +#ifdef SWITCH_DEBUG_RWLOCKS + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Read lock ACQUIRED\n", + switch_core_session_get_uuid(session), switch_channel_get_name(session->channel)); +#endif } -#ifdef SWITCH_DEBUG_RWLOCKS - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Read lock FAIL\n", - switch_core_session_get_uuid(session), switch_channel_get_name(session->channel)); -#endif - } else { - status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock); -#ifdef SWITCH_DEBUG_RWLOCKS - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Read lock ACQUIRED\n", - switch_core_session_get_uuid(session), switch_channel_get_name(session->channel)); -#endif } } @@ -123,18 +123,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_lock_hangup(switch_core switch_status_t status = SWITCH_STATUS_FALSE; if (session->rwlock) { - if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_get_state(session->channel) >= CS_DESTROY) { - status = SWITCH_STATUS_FALSE; + if ((status = switch_thread_rwlock_tryrdlock(session->rwlock)) == SWITCH_STATUS_SUCCESS) { + if (switch_test_flag(session, SSF_DESTROYED) || switch_channel_get_state(session->channel) >= CS_DESTROY) { + status = SWITCH_STATUS_FALSE; #ifdef SWITCH_DEBUG_RWLOCKS - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Read lock FAIL\n", - switch_core_session_get_uuid(session), switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Read lock FAIL\n", + switch_core_session_get_uuid(session), switch_channel_get_name(session->channel)); #endif - } else { - status = (switch_status_t) switch_thread_rwlock_tryrdlock(session->rwlock); + switch_thread_rwlock_unlock(session->rwlock); + } else { #ifdef SWITCH_DEBUG_RWLOCKS - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Read lock ACQUIRED\n", - switch_core_session_get_uuid(session), switch_channel_get_name(session->channel)); + switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, switch_core_session_get_uuid(session), SWITCH_LOG_ERROR, "%s %s Read lock ACQUIRED\n", + switch_core_session_get_uuid(session), switch_channel_get_name(session->channel)); #endif + } } } From 29afa27cdd64ee79a9c31d4965fddd82f3da01a1 Mon Sep 17 00:00:00 2001 From: Len Date: Fri, 5 Aug 2022 13:52:48 -0400 Subject: [PATCH 014/155] [Sounds] Add new sounds to en-us-callie and correct en-us-allison 40.wav and 60.wav --- build/sounds_version.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/sounds_version.txt b/build/sounds_version.txt index b0b46ff4e2..12d0f30d10 100644 --- a/build/sounds_version.txt +++ b/build/sounds_version.txt @@ -1,5 +1,5 @@ -en-us-callie 1.0.52 -en-us-allison 1.0.1 +en-us-callie 1.0.53 +en-us-allison 1.0.2 ru-RU-elena 1.0.51 ru-RU-kirill 1.0.0 ru-RU-vika 1.0.0 From c9def5990e00ef16661707054f871c019291a094 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Mon, 8 Aug 2022 18:56:09 +0300 Subject: [PATCH 015/155] [core, mod_sofia] add some extra checks when creating the digest. --- src/mod/endpoints/mod_sofia/sofia_reg.c | 9 +++++---- src/switch_utils.c | 4 ++++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index a07d47b758..42c792c08b 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2943,23 +2943,24 @@ sofia_auth_algs_t sofia_alg_str2id(char *algorithm, switch_bool_t permissive) switch_status_t sofia_make_digest(sofia_auth_algs_t use_alg, char **digest, const void *input, unsigned int *outputlen) { + switch_status_t status = SWITCH_STATUS_FALSE; switch (use_alg) { case ALG_MD5: - switch_digest_string("md5", digest, input, strlen((char *)input), outputlen); + status = switch_digest_string("md5", digest, input, strlen((char *)input), outputlen); break; case ALG_SHA256: - switch_digest_string("sha256", digest, input, strlen((char *)input), outputlen); + status = switch_digest_string("sha256", digest, input, strlen((char *)input), outputlen); break; #if OPENSSL_VERSION_NUMBER >= 0x10101000L case ALG_SHA512: - switch_digest_string("sha512-256", digest, input, strlen((char *)input), outputlen); + status = switch_digest_string("sha512-256", digest, input, strlen((char *)input), outputlen); break; #endif default: return SWITCH_STATUS_FALSE; } - return SWITCH_STATUS_SUCCESS; + return status; } auth_res_t sofia_reg_parse_auth(sofia_profile_t *profile, diff --git a/src/switch_utils.c b/src/switch_utils.c index d869ddfda4..1a93411489 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -4640,6 +4640,10 @@ SWITCH_DECLARE(switch_status_t) switch_digest_string(const char *digest_name, ch } (*digest_str)[i] = '\0'; + } else { + switch_safe_free(digest); + *outputlen = 0; + return SWITCH_STATUS_FALSE; } } From b1ab1cf276d35703768fef93f623c056ed9fd5d9 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 4 Jan 2022 18:51:16 +0300 Subject: [PATCH 016/155] [miniupnpc] Fix build on Debian Bullseye --- libs/miniupnpc/upnpreplyparse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/miniupnpc/upnpreplyparse.c b/libs/miniupnpc/upnpreplyparse.c index c72b4c825f..ab2b87ecb7 100644 --- a/libs/miniupnpc/upnpreplyparse.c +++ b/libs/miniupnpc/upnpreplyparse.c @@ -30,7 +30,7 @@ NameValueParserGetData(void * d, const char * datas, int l) nv = malloc(sizeof(struct NameValue)); if(l>63) l = 63; - strncpy(nv->name, data->curelt, 64); + memcpy(nv->name, data->curelt, 64); nv->name[63] = '\0'; memcpy(nv->value, datas, l); nv->value[l] = '\0'; From a7740c3cf402a5606db95749a95e20b748dedd41 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 6 Jan 2022 19:18:26 +0300 Subject: [PATCH 017/155] [stb] Fix dead nested assignments in stbi__tga_load() --- libs/stb/stb_image.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libs/stb/stb_image.h b/libs/stb/stb_image.h index 0ea47afd9f..e4a227325a 100644 --- a/libs/stb/stb_image.h +++ b/libs/stb/stb_image.h @@ -5806,6 +5806,10 @@ static void *stbi__tga_load(stbi__context *s, int *x, int *y, int *comp, int req tga_palette_start = tga_palette_len = tga_palette_bits = tga_x_origin = tga_y_origin = 0; STBI_NOTUSED(tga_palette_start); + STBI_NOTUSED(tga_palette_len); + STBI_NOTUSED(tga_palette_bits); + STBI_NOTUSED(tga_x_origin); + STBI_NOTUSED(tga_y_origin); // OK, done return tga_data; } From e53e8a17c1238bca18401f345b249a12f04b6b70 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 6 Jan 2022 16:39:31 +0300 Subject: [PATCH 018/155] [esl] Fix dead nested assignment in esl_recv_event() --- libs/esl/src/esl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/esl/src/esl.c b/libs/esl/src/esl.c index e23144b9c0..825d89dd54 100644 --- a/libs/esl/src/esl.c +++ b/libs/esl/src/esl.c @@ -1444,7 +1444,7 @@ ESL_DECLARE(esl_status_t) esl_recv_event(esl_handle_t *handle, int check_q, esl_ } } - if (beg && (cl = esl_event_get_header(handle->last_ievent, "content-length"))) { + if (beg && esl_event_get_header(handle->last_ievent, "content-length")) { handle->last_ievent->body = strdup(beg); } From c47c16b1ddfbbd719c4d7d4970008c8343a67705 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 12 Jan 2022 16:30:34 +0300 Subject: [PATCH 019/155] Fix dead nested assignments in various modules --- libs/iksemel/src/stream.c | 4 +-- libs/libvpx/vpx_dsp/x86/avg_intrin_avx2.c | 1 + libs/libvpx/vpx_dsp/x86/avg_intrin_sse2.c | 1 + .../mod_directory/mod_directory.c | 3 +- .../applications/mod_dptools/mod_dptools.c | 3 +- src/mod/applications/mod_expr/exprilfs.h | 6 ++-- src/mod/applications/mod_fifo/mod_fifo.c | 3 +- src/mod/applications/mod_hash/mod_hash.c | 4 +-- src/mod/applications/mod_httapi/mod_httapi.c | 5 ++- src/mod/applications/mod_oreka/mod_oreka.c | 25 +++++++------ src/mod/applications/mod_redis/credis.c | 6 ++-- src/mod/applications/mod_rss/mod_rss.c | 2 +- .../mod_signalwire/mod_signalwire.c | 3 +- src/mod/applications/mod_snom/mod_snom.c | 3 +- .../mod_soundtouch/mod_soundtouch.cpp | 19 +++++----- .../mod_spandsp/mod_spandsp_fax.c | 35 +++++++++---------- src/mod/applications/mod_spandsp/udptl.c | 4 +-- src/mod/applications/mod_spy/mod_spy.c | 3 +- .../applications/mod_stress/mod_stress.cpp | 8 ++--- .../mod_translate/mod_translate.c | 3 +- .../mod_voicemail/mod_voicemail.c | 5 ++- .../codecs/mod_dahdi_codec/mod_dahdi_codec.c | 4 +-- .../mod_dialplan_asterisk.c | 15 +------- .../endpoints/mod_dingaling/mod_dingaling.c | 6 ++-- .../endpoints/mod_portaudio/mod_portaudio.c | 3 +- src/mod/endpoints/mod_skinny/mod_skinny.c | 2 +- .../mod_event_socket/mod_event_socket.c | 2 +- .../mod_kazoo/kazoo_ei_config.c | 3 +- .../event_handlers/mod_rayo/xmpp_streams.c | 2 +- .../mod_local_stream/mod_local_stream.c | 3 +- .../formats/mod_tone_stream/mod_tone_stream.c | 3 +- src/mod/languages/mod_lua/mod_lua.cpp | 6 ++-- .../mod_python3/freeswitch_python.cpp | 4 +-- src/mod/languages/mod_python3/mod_python3.c | 3 +- 34 files changed, 82 insertions(+), 120 deletions(-) diff --git a/libs/iksemel/src/stream.c b/libs/iksemel/src/stream.c index e05e5d06ef..f304f67c64 100644 --- a/libs/iksemel/src/stream.c +++ b/libs/iksemel/src/stream.c @@ -879,11 +879,11 @@ iks_send_raw (iksparser *prs, const char *xmlstr) } else #elif HAVE_SSL if (data->flags & SF_SECURE) { - int r, err; + int r; do { r = SSL_write(data->ssl, xmlstr, strlen (xmlstr)); - } while (r == -1 && (err = SSL_get_error(data->ssl, r)) == SSL_ERROR_WANT_WRITE); + } while (r == -1 && SSL_get_error(data->ssl, r) == SSL_ERROR_WANT_WRITE); if (r < 0) { return IKS_NET_RWERR; diff --git a/libs/libvpx/vpx_dsp/x86/avg_intrin_avx2.c b/libs/libvpx/vpx_dsp/x86/avg_intrin_avx2.c index 3f4f577a21..ac33e160b9 100644 --- a/libs/libvpx/vpx_dsp/x86/avg_intrin_avx2.c +++ b/libs/libvpx/vpx_dsp/x86/avg_intrin_avx2.c @@ -305,6 +305,7 @@ static void hadamard_8x8x2_avx2(const int16_t *src_diff, ptrdiff_t src_stride, src[5] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride)); src[6] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride)); src[7] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride)); + (void)src_diff; hadamard_col8x2_avx2(src, 0); hadamard_col8x2_avx2(src, 1); diff --git a/libs/libvpx/vpx_dsp/x86/avg_intrin_sse2.c b/libs/libvpx/vpx_dsp/x86/avg_intrin_sse2.c index 5aba903a2d..45bfefe08a 100644 --- a/libs/libvpx/vpx_dsp/x86/avg_intrin_sse2.c +++ b/libs/libvpx/vpx_dsp/x86/avg_intrin_sse2.c @@ -276,6 +276,7 @@ static INLINE void hadamard_8x8_sse2(const int16_t *src_diff, src[5] = _mm_load_si128((const __m128i *)(src_diff += src_stride)); src[6] = _mm_load_si128((const __m128i *)(src_diff += src_stride)); src[7] = _mm_load_si128((const __m128i *)(src_diff += src_stride)); + (void)src_diff; hadamard_col8_sse2(src, 0); hadamard_col8_sse2(src, 1); diff --git a/src/mod/applications/mod_directory/mod_directory.c b/src/mod/applications/mod_directory/mod_directory.c index 3046558c5d..fc46e478da 100644 --- a/src/mod/applications/mod_directory/mod_directory.c +++ b/src/mod/applications/mod_directory/mod_directory.c @@ -953,7 +953,6 @@ switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *p SWITCH_STANDARD_APP(directory_function) { switch_channel_t *channel = switch_core_session_get_channel(session); - int argc = 0; char *argv[6] = { 0 }; char *mydata = NULL; const char *profile_name = NULL; @@ -975,7 +974,7 @@ SWITCH_STANDARD_APP(directory_function) } mydata = switch_core_session_strdup(session, data); - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough args [%s]\n", data); return; } diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index b9ef0708d8..afe6cbef68 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -1459,7 +1459,6 @@ SWITCH_STANDARD_APP(wait_for_video_ready_function) SWITCH_STANDARD_APP(presence_function) { char *argv[6] = { 0 }; - int argc; char *mydata = NULL; switch_channel_t *channel = switch_core_session_get_channel(session); @@ -1468,7 +1467,7 @@ SWITCH_STANDARD_APP(presence_function) return; } - if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 2) { + if (switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])) < 2) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n"); return; } diff --git a/src/mod/applications/mod_expr/exprilfs.h b/src/mod/applications/mod_expr/exprilfs.h index f89eadfadc..e881b68d8c 100644 --- a/src/mod/applications/mod_expr/exprilfs.h +++ b/src/mod/applications/mod_expr/exprilfs.h @@ -563,10 +563,12 @@ case EXPR_NODEFUNC_RECTTOPOLA: tmp = atan2(d2, d1); EXPR_CHECK_ERR(); - if (tmp < 0.0) + if (tmp < 0.0) { *val = tmp = (2.0 * M_PI); - else + (void)tmp; + } else { *val = tmp; + } } else return err; diff --git a/src/mod/applications/mod_fifo/mod_fifo.c b/src/mod/applications/mod_fifo/mod_fifo.c index 724d1dd24f..304996981a 100644 --- a/src/mod/applications/mod_fifo/mod_fifo.c +++ b/src/mod/applications/mod_fifo/mod_fifo.c @@ -2353,7 +2353,6 @@ SWITCH_STANDARD_API(fifo_check_bridge_function) SWITCH_STANDARD_API(fifo_add_outbound_function) { char *data = NULL, *argv[4] = { 0 }; - int argc; uint32_t priority = 0; if (zstr(cmd)) { @@ -2362,7 +2361,7 @@ SWITCH_STANDARD_API(fifo_add_outbound_function) data = strdup(cmd); - if ((argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2 || !argv[0]) { + if (switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2 || !argv[0]) { goto fail; } diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index 70bffd18e1..5b987f7fa0 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -435,7 +435,7 @@ SWITCH_STANDARD_APP(hash_function) if (argc < 4) { goto usage; } - if (!(value = switch_core_hash_find(globals.db_hash, hash_key))) { + if (!switch_core_hash_find(globals.db_hash, hash_key)) { switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]); } @@ -507,7 +507,7 @@ SWITCH_STANDARD_API(hash_api_function) goto usage; } switch_thread_rwlock_wrlock(globals.db_hash_rwlock); - if ((value = switch_core_hash_find(globals.db_hash, hash_key))) { + if (switch_core_hash_find(globals.db_hash, hash_key)) { stream->write_function(stream, "-ERR key already exists\n"); } else { switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]); diff --git a/src/mod/applications/mod_httapi/mod_httapi.c b/src/mod/applications/mod_httapi/mod_httapi.c index 0b89fd35a7..4b32d87c6d 100644 --- a/src/mod/applications/mod_httapi/mod_httapi.c +++ b/src/mod/applications/mod_httapi/mod_httapi.c @@ -2378,7 +2378,6 @@ static char *load_cache_data(http_file_context_t *context, const char *url) char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 }; char meta_buffer[1024] = ""; int fd; - switch_ssize_t bytes; switch_md5_string(digest, (void *) url, strlen(url)); @@ -2390,7 +2389,7 @@ static char *load_cache_data(http_file_context_t *context, const char *url) ext = find_ext(url); } - if (ext && (p = strchr(ext, '?'))) { + if (ext && strchr(ext, '?')) { dext = strdup(ext); if ((p = strchr(dext, '?'))) { *p = '\0'; @@ -2402,7 +2401,7 @@ static char *load_cache_data(http_file_context_t *context, const char *url) context->meta_file = switch_core_sprintf(context->pool, "%s%s%s.meta", globals.cache_path, SWITCH_PATH_SEPARATOR, digest); if (switch_file_exists(context->meta_file, context->pool) == SWITCH_STATUS_SUCCESS && ((fd = open(context->meta_file, O_RDONLY, 0)) > -1)) { - if ((bytes = read(fd, meta_buffer, sizeof(meta_buffer))) > 0) { + if (read(fd, meta_buffer, sizeof(meta_buffer)) > 0) { char *p; if ((p = strchr(meta_buffer, ':'))) { diff --git a/src/mod/applications/mod_oreka/mod_oreka.c b/src/mod/applications/mod_oreka/mod_oreka.c index f3fe676386..560c34f6c6 100644 --- a/src/mod/applications/mod_oreka/mod_oreka.c +++ b/src/mod/applications/mod_oreka/mod_oreka.c @@ -583,10 +583,9 @@ SWITCH_STANDARD_APP(oreka_start_function) oreka_session_t *oreka = NULL; switch_media_bug_t *bug = NULL; char *argv[6]; - int argc; - int flags = 0; + int flags = 0; char *lbuf = NULL; - const char *var; + const char *var; if ((oreka = (oreka_session_t *) switch_channel_get_private(channel, OREKA_PRIVATE))) { if (!zstr(data) && !strcasecmp(data, "stop")) { @@ -606,14 +605,14 @@ SWITCH_STANDARD_APP(oreka_start_function) switch_assert(oreka); memset(oreka, 0, sizeof(*oreka)); - oreka->mux_streams = globals.mux_streams; + oreka->mux_streams = globals.mux_streams; - if ((var = switch_channel_get_variable(channel, "oreka_mux_streams"))) { - oreka->mux_streams = switch_true(var); - } + if ((var = switch_channel_get_variable(channel, "oreka_mux_streams"))) { + oreka->mux_streams = switch_true(var); + } if (data && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { #if 0 if (!strncasecmp(argv[x], "server", sizeof("server"))) { /* parse server=192.168.1.144 string */ @@ -623,11 +622,11 @@ SWITCH_STANDARD_APP(oreka_start_function) oreka->session = session; - if (oreka->mux_streams) { - flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING | SMBF_ANSWER_REQ; - } else { - flags = SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_ANSWER_REQ; - } + if (oreka->mux_streams) { + flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING | SMBF_ANSWER_REQ; + } else { + flags = SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_ANSWER_REQ; + } status = switch_core_media_bug_add(session, OREKA_BUG_NAME_READ, NULL, oreka_audio_callback, oreka, 0, flags, &bug); diff --git a/src/mod/applications/mod_redis/credis.c b/src/mod/applications/mod_redis/credis.c index 58e57ce1cd..040ab3ae83 100644 --- a/src/mod/applications/mod_redis/credis.c +++ b/src/mod/applications/mod_redis/credis.c @@ -367,7 +367,7 @@ static int cr_readln(REDIS rhnd, int start, char **line, int *idx) static int cr_receivemultibulk(REDIS rhnd, char *line) { - int bnum, blen, i, rc=0, idx=0; + int bnum, blen, i, idx=0; bnum = atoi(line); @@ -381,7 +381,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line) return CREDIS_ERR_NOMEM; } - for (i = 0; bnum > 0 && (rc = cr_readln(rhnd, 0, &line, NULL)) > 0; i++, bnum--) { + for (i = 0; bnum > 0 && cr_readln(rhnd, 0, &line, NULL) > 0; i++, bnum--) { if (*(line++) != CR_BULK) return CREDIS_ERR_PROTOCOL; @@ -389,7 +389,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line) if (blen == -1) rhnd->reply.multibulk.idxs[i] = -1; else { - if ((rc = cr_readln(rhnd, blen, &line, &idx)) != blen) + if (cr_readln(rhnd, blen, &line, &idx) != blen) return CREDIS_ERR_PROTOCOL; rhnd->reply.multibulk.idxs[i] = idx; diff --git a/src/mod/applications/mod_rss/mod_rss.c b/src/mod/applications/mod_rss/mod_rss.c index 5f23024da2..16cd35412b 100644 --- a/src/mod/applications/mod_rss/mod_rss.c +++ b/src/mod/applications/mod_rss/mod_rss.c @@ -305,7 +305,7 @@ SWITCH_STANDARD_APP(rss_function) char cmd[3]; main_menu: filename = NULL; - len = idx = 0; + len = 0; *cmd = '\0'; title_txt = description_txt = rights_txt = ""; diff --git a/src/mod/applications/mod_signalwire/mod_signalwire.c b/src/mod/applications/mod_signalwire/mod_signalwire.c index 466adfa745..5b0be47a91 100644 --- a/src/mod/applications/mod_signalwire/mod_signalwire.c +++ b/src/mod/applications/mod_signalwire/mod_signalwire.c @@ -464,7 +464,6 @@ done: #define SIGNALWIRE_SYNTAX "token | token-reset | adoption | adopted | reload | update | debug | kslog " SWITCH_STANDARD_API(mod_signalwire_api_function) { - int argc = 0; char *argv[2] = { 0 }; char *buf = NULL; @@ -474,7 +473,7 @@ SWITCH_STANDARD_API(mod_signalwire_api_function) return SWITCH_STATUS_SUCCESS; } - if ((argc = switch_separate_string(buf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + if (switch_separate_string(buf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { if (!strcmp(argv[0], "token")) { if (globals.adoption_token[0]) { stream->write_function(stream, diff --git a/src/mod/applications/mod_snom/mod_snom.c b/src/mod/applications/mod_snom/mod_snom.c index 2f706c2556..b3cf2b478e 100644 --- a/src/mod/applications/mod_snom/mod_snom.c +++ b/src/mod/applications/mod_snom/mod_snom.c @@ -149,10 +149,9 @@ SWITCH_STANDARD_API(snom_command_api_function) char *ret = NULL; switch_cache_db_handle_t *db = NULL; switch_stream_handle_t apistream = { 0 }; - switch_status_t status; SWITCH_STANDARD_STREAM(apistream); - if ((status = switch_api_execute("sofia_contact", argv[0], NULL, &apistream)) != SWITCH_STATUS_SUCCESS) { + if (switch_api_execute("sofia_contact", argv[0], NULL, &apistream) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR error executing sofia_contact\n"); goto end; } diff --git a/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp b/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp index fc2843440b..05461bc453 100644 --- a/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp +++ b/src/mod/applications/mod_soundtouch/mod_soundtouch.cpp @@ -246,7 +246,6 @@ static switch_bool_t soundtouch_callback(switch_media_bug_t *bug, void *user_dat SWITCH_STANDARD_APP(soundtouch_start_function) { switch_media_bug_t *bug; - switch_status_t status; switch_channel_t *channel = switch_core_session_get_channel(session); struct soundtouch_helper *sth; char *argv[6]; @@ -311,14 +310,13 @@ SWITCH_STANDARD_APP(soundtouch_start_function) sth->session = session; - if ((status = switch_core_media_bug_add(session, "soundtouch", NULL, soundtouch_callback, sth, 0, - sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_add(session, "soundtouch", NULL, soundtouch_callback, sth, 0, + sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n"); return; } switch_channel_set_private(channel, "_soundtouch_", bug); - } /* API Interface Function */ @@ -327,12 +325,11 @@ SWITCH_STANDARD_API(soundtouch_api_function) { switch_core_session_t *rsession = NULL; switch_channel_t *channel = NULL; - switch_media_bug_t *bug; - switch_status_t status; - struct soundtouch_helper *sth; + switch_media_bug_t *bug; + struct soundtouch_helper *sth; char *mycmd = NULL; - int argc = 0; - char *argv[10] = { 0 }; + int argc = 0; + char *argv[10] = { 0 }; char *uuid = NULL; char *action = NULL; int x, n; @@ -420,8 +417,8 @@ SWITCH_STANDARD_API(soundtouch_api_function) sth->session = rsession; - if ((status = switch_core_media_bug_add(rsession, "soundtouch", NULL, soundtouch_callback, sth, 0, - sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_add(rsession, "soundtouch", NULL, soundtouch_callback, sth, 0, + sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Failure!\n"); goto done; } else { diff --git a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c index 2af4babf08..8c8d0103c4 100644 --- a/src/mod/applications/mod_spandsp/mod_spandsp_fax.c +++ b/src/mod/applications/mod_spandsp/mod_spandsp_fax.c @@ -1266,32 +1266,29 @@ static t38_mode_t request_t38(pvt_t *pvt) insist = spandsp_globals.enable_t38_insist; } - if ((t38_options = switch_channel_get_private(channel, "t38_options"))) { + if (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) { + if (!(t38_options = switch_channel_get_private(channel, "_preconfigured_t38_options"))) { + 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"; + } - if (!(t38_options = switch_channel_get_private(channel, "_preconfigured_t38_options"))) { - 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); - switch_channel_set_private(channel, "_preconfigured_t38_options", NULL); + switch_channel_set_private(channel, "t38_options", t38_options); + switch_channel_set_private(channel, "_preconfigured_t38_options", NULL); pvt->t38_mode = T38_MODE_REQUESTED; switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_REQ); diff --git a/src/mod/applications/mod_spandsp/udptl.c b/src/mod/applications/mod_spandsp/udptl.c index aa82f953d0..35b9f29f77 100644 --- a/src/mod/applications/mod_spandsp/udptl.c +++ b/src/mod/applications/mod_spandsp/udptl.c @@ -188,7 +188,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len) 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) + if (decode_open_type(buf, len, &ptr, &msg, &msg_len) != 0) return -1; /* Decode error_recovery */ if (ptr + 1 > len) @@ -290,7 +290,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len) /* 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) + if (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; diff --git a/src/mod/applications/mod_spy/mod_spy.c b/src/mod/applications/mod_spy/mod_spy.c index 0200ee9bdf..ced290f0d7 100644 --- a/src/mod/applications/mod_spy/mod_spy.c +++ b/src/mod/applications/mod_spy/mod_spy.c @@ -286,12 +286,11 @@ static void event_handler(switch_event_t *event) #define USERSPY_SYNTAX " [uuid]" SWITCH_STANDARD_APP(userspy_function) { - int argc = 0; char *argv[2] = { 0 }; char *params = NULL; if (!zstr(data) && (params = switch_core_session_strdup(session, data))) { - if ((argc = switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { + if (switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) { switch_channel_t *channel = switch_core_session_get_channel(session); char *uuid = switch_core_session_get_uuid(session); switch_status_t status; diff --git a/src/mod/applications/mod_stress/mod_stress.cpp b/src/mod/applications/mod_stress/mod_stress.cpp index 791ad06f89..66da2d26dc 100644 --- a/src/mod/applications/mod_stress/mod_stress.cpp +++ b/src/mod/applications/mod_stress/mod_stress.cpp @@ -197,11 +197,9 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s SWITCH_STANDARD_APP(stress_start_function) { switch_media_bug_t *bug; - switch_status_t status; switch_channel_t *channel = switch_core_session_get_channel(session); struct stress_helper *sth; char *argv[6]; - int argc; char *lbuf = NULL; int x = 0; @@ -220,7 +218,7 @@ SWITCH_STANDARD_APP(stress_start_function) if (data && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { if (!strncasecmp(argv[x], "read", 4)) { sth->read = 1; } @@ -228,14 +226,12 @@ SWITCH_STANDARD_APP(stress_start_function) sth->session = session; - if ((status = switch_core_media_bug_add(session, "stress", NULL, stress_callback, sth, 0, - sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_add(session, "stress", NULL, stress_callback, sth, 0, sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n"); return; } switch_channel_set_private(channel, "_stress_", bug); - } SWITCH_MODULE_LOAD_FUNCTION(mod_stress_load) diff --git a/src/mod/applications/mod_translate/mod_translate.c b/src/mod/applications/mod_translate/mod_translate.c index 3e7402c30d..efbcd3f14b 100644 --- a/src/mod/applications/mod_translate/mod_translate.c +++ b/src/mod/applications/mod_translate/mod_translate.c @@ -333,7 +333,6 @@ SWITCH_STANDARD_API(translate_function) char *translated = NULL; switch_event_t *event = NULL; char *argv[32] = { 0 }; - int argc = 0; if (zstr(cmd)) { stream->write_function(stream, "USAGE: %s\n", TRANSLATE_SYNTAX); @@ -344,7 +343,7 @@ SWITCH_STANDARD_API(translate_function) mydata = strdup(cmd); - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { if (!session) { char *areacode = switch_core_get_variable("default_areacode"); switch_core_new_memory_pool(&pool); diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 0dc84b34ce..6ece9f4f47 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3165,7 +3165,6 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t char *dup = NULL, *user = NULL, *domain = NULL, *profile_name = NULL; switch_status_t status = SWITCH_STATUS_SUCCESS; int isgroup = 0, isall = 0; - int argc = 0; char *argv[6] = { 0 }; char *box, *path, *cid_num, *cid_name; switch_memory_pool_t *pool = NULL; @@ -3181,7 +3180,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t dup = strdup(data); switch_assert(dup); - if ((argc = switch_separate_string(dup, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) { + if (switch_separate_string(dup, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough args [%s]\n", data); status = SWITCH_STATUS_FALSE; goto end; @@ -3338,7 +3337,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t } else { switch_xml_t x_group = NULL; - if ((status = switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group)) == SWITCH_STATUS_SUCCESS) { + if (switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group) == SWITCH_STATUS_SUCCESS) { switch_xml_merge_user(ut, x_domain, x_group); switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS); status = deliver_vm(profile, ut, domain, path, 0, read_flags, diff --git a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c index df09429ced..6e7f15428c 100644 --- a/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c +++ b/src/mod/codecs/mod_dahdi_codec/mod_dahdi_codec.c @@ -440,7 +440,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dahdi_codec_load) switch_codec_interface_t *codec_interface; struct stat statbuf; struct dahdi_transcoder_info info = { 0 }; - int32_t fd, res; + int32_t fd; int mpf = 20000; /* Algorithmic delay of 15ms with 5ms of look-ahead delay */ int spf = 160; int bpfd = 320; @@ -472,7 +472,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dahdi_codec_load) return SWITCH_STATUS_FALSE; } - for (info.tcnum = 0; !(res = ioctl(fd, DAHDI_TC_GETINFO, &info)); info.tcnum++) { + for (info.tcnum = 0; !ioctl(fd, DAHDI_TC_GETINFO, &info); info.tcnum++) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found dahdi transcoder name: %s\n", info.name); if ((info.srcfmts & DAHDI_FORMAT_ULAW) && (info.dstfmts & (DAHDI_FORMAT_G729A | DAHDI_FORMAT_G723_1))) { total_encoders += info.numchannels; diff --git a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c index 691b640a78..24119f6f8c 100644 --- a/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c +++ b/src/mod/dialplans/mod_dialplan_asterisk/mod_dialplan_asterisk.c @@ -103,12 +103,11 @@ SWITCH_STANDARD_APP(avoid_function) SWITCH_STANDARD_APP(goto_function) { - int argc; char *argv[3] = { 0 }; char *mydata; if (data && (mydata = switch_core_session_strdup(session, data))) { - if ((argc = switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) { + if (switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0]))) < 1) { goto error; } @@ -352,24 +351,12 @@ static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session, return switch_core_session_outgoing_channel(session, var_event, "iax", outbound_profile, new_session, pool, SOF_NONE, cancel_cause); } - -#define WE_DONT_NEED_NO_STINKIN_KEY "true" -static char *key() -{ - return WE_DONT_NEED_NO_STINKIN_KEY; -} - SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_asterisk_load) { switch_dialplan_interface_t *dp_interface; switch_application_interface_t *app_interface; - char *mykey = NULL; int x = 0; - if ((mykey = key())) { - mykey = NULL; - } - /* connect my internal structure to the blank pointer passed to me */ *module_interface = switch_loadable_module_create_module_interface(pool, modname); /* add a dialplan interface */ diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c index 99a6587409..6b1728ebe5 100644 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ b/src/mod/endpoints/mod_dingaling/mod_dingaling.c @@ -883,10 +883,9 @@ static void dl_logger(char *file, const char *func, int line, int level, char *f { va_list ap; char *data = NULL; - int ret; va_start(ap, fmt); - if ((ret = switch_vasprintf(&data, fmt, ap)) != -1) { + if (switch_vasprintf(&data, fmt, ap) != -1) { if (!strncasecmp(data, "+xml:", 5)) { switch_xml_t xml; char *form; @@ -3062,7 +3061,6 @@ SWITCH_STANDARD_API(dl_logout) SWITCH_STANDARD_API(dingaling) { char *argv[10] = { 0 }; - int argc = 0; void *val; char *myarg = NULL; mdl_profile_t *profile = NULL; @@ -3077,7 +3075,7 @@ SWITCH_STANDARD_API(dingaling) return SWITCH_STATUS_FALSE; } - if ((argc = switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) != 1) { + if (switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) != 1) { stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX); goto done; } diff --git a/src/mod/endpoints/mod_portaudio/mod_portaudio.c b/src/mod/endpoints/mod_portaudio/mod_portaudio.c index 0e24faef16..62eba524d3 100644 --- a/src/mod/endpoints/mod_portaudio/mod_portaudio.c +++ b/src/mod/endpoints/mod_portaudio/mod_portaudio.c @@ -2962,7 +2962,6 @@ static switch_status_t list_calls(char **argv, int argc, switch_stream_handle_t static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t *stream) { switch_core_session_t *session; - switch_status_t status = SWITCH_STATUS_SUCCESS; char *dest = NULL; if (zstr(argv[0])) { @@ -3025,7 +3024,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t switch_channel_set_caller_profile(channel, tech_pvt->caller_profile); } tech_pvt->session = session; - if ((status = validate_main_audio_stream()) == SWITCH_STATUS_SUCCESS) { + if (validate_main_audio_stream() == SWITCH_STATUS_SUCCESS) { switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); switch_channel_mark_answered(channel); switch_channel_set_state(channel, CS_INIT); diff --git a/src/mod/endpoints/mod_skinny/mod_skinny.c b/src/mod/endpoints/mod_skinny/mod_skinny.c index 3df1290047..c6cfc716c7 100644 --- a/src/mod/endpoints/mod_skinny/mod_skinny.c +++ b/src/mod/endpoints/mod_skinny/mod_skinny.c @@ -2056,7 +2056,7 @@ sock_fail: assert(profile->sock); - if ((rv = switch_socket_accept(&inbound_socket, profile->sock, listener_pool))) { + if (switch_socket_accept(&inbound_socket, profile->sock, listener_pool)) { if (!skinny_globals.running) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n"); goto end; 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 0b01e55e66..70331a95e2 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 @@ -3007,7 +3007,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime) } - if ((rv = switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool))) { + if (switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool)) { if (prefs.done) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n"); goto end; diff --git a/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c b/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c index b2f3baf963..f1726b677b 100644 --- a/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c +++ b/src/mod/event_handlers/mod_kazoo/kazoo_ei_config.c @@ -53,7 +53,6 @@ static int read_cookie_from_file(char *filename) { char cookie[MAXATOMLEN + 1]; char *end; struct stat buf; - ssize_t res; if (!stat(filename, &buf)) { if ((buf.st_mode & S_IRWXG) || (buf.st_mode & S_IRWXO)) { @@ -70,7 +69,7 @@ static int read_cookie_from_file(char *filename) { return 2; } - if ((res = read(fd, cookie, MAXATOMLEN)) < 1) { + if (read(fd, cookie, MAXATOMLEN) < 1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to read cookie file %s : %d.\n", filename, errno); } diff --git a/src/mod/event_handlers/mod_rayo/xmpp_streams.c b/src/mod/event_handlers/mod_rayo/xmpp_streams.c index e8e9f6487d..c78fff78e3 100644 --- a/src/mod/event_handlers/mod_rayo/xmpp_streams.c +++ b/src/mod/event_handlers/mod_rayo/xmpp_streams.c @@ -1589,7 +1589,7 @@ static void *SWITCH_THREAD_FUNC xmpp_listener_thread(switch_thread_t *thread, vo } /* accept the connection */ - if ((rv = switch_socket_accept(&socket, listener->socket, pool))) { + if (switch_socket_accept(&socket, listener->socket, pool)) { if (context->shutdown) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting down xmpp listener\n"); goto end; diff --git a/src/mod/formats/mod_local_stream/mod_local_stream.c b/src/mod/formats/mod_local_stream/mod_local_stream.c index 2587313c36..b3898ab200 100644 --- a/src/mod/formats/mod_local_stream/mod_local_stream.c +++ b/src/mod/formats/mod_local_stream/mod_local_stream.c @@ -1367,7 +1367,6 @@ SWITCH_STANDARD_API(local_stream_function) char *mycmd = NULL, *argv[5] = { 0 }; char *local_stream_name = NULL; int argc = 0; - int ok = 0; if (zstr(cmd)) { goto usage; @@ -1461,7 +1460,7 @@ SWITCH_STANDARD_API(local_stream_function) stream->write_function(stream, "+OK stream: %s", source->name); switch_thread_rwlock_unlock(source->rwlock); } else { - if ((ok = launch_streams(local_stream_name))) { + if (launch_streams(local_stream_name)) { stream->write_function(stream, "+OK stream: %s", local_stream_name); } } diff --git a/src/mod/formats/mod_tone_stream/mod_tone_stream.c b/src/mod/formats/mod_tone_stream/mod_tone_stream.c index e3d5d26074..412baacf1d 100644 --- a/src/mod/formats/mod_tone_stream/mod_tone_stream.c +++ b/src/mod/formats/mod_tone_stream/mod_tone_stream.c @@ -130,7 +130,6 @@ static switch_status_t tone_stream_file_open(switch_file_handle_t *handle, const char *tmp; int fd = -1; char buf[1024] = ""; - size_t len; memset(&ts, 0, sizeof(ts)); @@ -172,7 +171,7 @@ static switch_status_t tone_stream_file_open(switch_file_handle_t *handle, const return SWITCH_STATUS_FALSE; } - while ((len = switch_fd_read_line(fd, buf, sizeof(buf)))) { + while (switch_fd_read_line(fd, buf, sizeof(buf))) { teletone_run(&ts, buf); } close(fd); diff --git a/src/mod/languages/mod_lua/mod_lua.cpp b/src/mod/languages/mod_lua/mod_lua.cpp index 63aaf25fc0..b1d19428dc 100644 --- a/src/mod/languages/mod_lua/mod_lua.cpp +++ b/src/mod/languages/mod_lua/mod_lua.cpp @@ -241,7 +241,6 @@ static switch_xml_t lua_fetch(const char *section, if (!zstr(globals.xml_handler)) { L = lua_init(); const char *str; - int error; mycmd = strdup(globals.xml_handler); switch_assert(mycmd); @@ -266,7 +265,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, NULL))){ + if(lua_parse_and_execute(L, mycmd, NULL)){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LUA script parse/execute error!\n"); goto end; } @@ -522,7 +521,6 @@ SWITCH_STANDARD_API(lua_api_function) { char *mycmd; - int error; if (zstr(cmd)) { stream->write_function(stream, ""); @@ -541,7 +539,7 @@ SWITCH_STANDARD_API(lua_api_function) mod_lua_conjure_event(L, stream->param_event, "env", 1); } - if ((error = lua_parse_and_execute(L, mycmd, session))) { + if (lua_parse_and_execute(L, mycmd, session)) { char * http = switch_event_get_header(stream->param_event, "http-uri"); if (http && (!strncasecmp(http, "/api/", 5) || !strncasecmp(http, "/webapi/", 8))) { /* api -> fs api streams the Content-Type e.g. text/html or text/xml */ diff --git a/src/mod/languages/mod_python3/freeswitch_python.cpp b/src/mod/languages/mod_python3/freeswitch_python.cpp index 0893c47c91..77c04fa9fc 100644 --- a/src/mod/languages/mod_python3/freeswitch_python.cpp +++ b/src/mod/languages/mod_python3/freeswitch_python.cpp @@ -144,7 +144,7 @@ void Session::check_hangup_hook() void Session::do_hangup_hook() { - PyObject *result, *arglist; + PyObject *arglist; const char *what = hook_state == CS_HANGUP ? "hangup" : "transfer"; if (hh && !mark) { @@ -167,7 +167,7 @@ void Session::do_hangup_hook() arglist = Py_BuildValue("(Os)", Self, what); } - if (!(result = PyEval_CallObject(hangup_func, arglist))) { + if (!PyEval_CallObject(hangup_func, arglist)) { PyErr_Print(); } diff --git a/src/mod/languages/mod_python3/mod_python3.c b/src/mod/languages/mod_python3/mod_python3.c index d0c7c20df5..52a3312361 100644 --- a/src/mod/languages/mod_python3/mod_python3.c +++ b/src/mod/languages/mod_python3/mod_python3.c @@ -178,7 +178,6 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi PyThreadState *tstate = NULL; char *dupargs = NULL; char *argv[2] = { 0 }; - int argc; char *script = NULL; PyObject *module_o = NULL, *module = NULL, *sp = NULL, *stp = NULL, *eve = NULL; PyObject *function = NULL; @@ -198,7 +197,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi assert(dupargs != NULL); - if (!(argc = switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + if (!switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No module name specified!\n"); goto done; } From b9b0b0091200ecd6dc540cc1f3a646c39769d8ed Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 5 Jan 2022 18:35:06 +0300 Subject: [PATCH 020/155] [libvpx] scan-build: prevent division by zero in vpx_int_pro_row_c() --- libs/libvpx/vpx_dsp/avg.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/libvpx/vpx_dsp/avg.c b/libs/libvpx/vpx_dsp/avg.c index 1c45e8a73d..576d683fef 100644 --- a/libs/libvpx/vpx_dsp/avg.c +++ b/libs/libvpx/vpx_dsp/avg.c @@ -344,6 +344,7 @@ void vpx_int_pro_row_c(int16_t hbuf[16], const uint8_t *ref, const int ref_stride, const int height) { int idx; const int norm_factor = height >> 1; + if (height == 1) return; for (idx = 0; idx < 16; ++idx) { int i; hbuf[idx] = 0; From 1499acac9ddf8fd0ae2ce91a3a8ef2cd715b1f48 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 12 Jan 2022 20:07:20 +0300 Subject: [PATCH 021/155] [libvpx] scan-build: avoid dereference of null pointer --- libs/libvpx/vp9/common/vp9_onyxc_int.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libs/libvpx/vp9/common/vp9_onyxc_int.h b/libs/libvpx/vp9/common/vp9_onyxc_int.h index 662b8ef5e1..c5b98c0021 100644 --- a/libs/libvpx/vp9/common/vp9_onyxc_int.h +++ b/libs/libvpx/vp9/common/vp9_onyxc_int.h @@ -299,6 +299,8 @@ static INLINE int get_free_fb(VP9_COMMON *cm) { static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) { const int ref_index = *idx; + if (!bufs) return; + if (ref_index >= 0 && bufs[ref_index].ref_count > 0) bufs[ref_index].ref_count--; From 56b6e954cfa0173083770be2e9248c25aa10303b Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 11 Jan 2022 19:16:53 +0300 Subject: [PATCH 022/155] [Core] Fix dead nested assignments --- src/switch.c | 8 ++++---- src/switch_core.c | 4 ++-- src/switch_core_file.c | 4 ++-- src/switch_core_media.c | 10 ++-------- src/switch_core_media_bug.c | 8 +++----- src/switch_core_session.c | 20 +++++++------------- src/switch_core_sqldb.c | 12 +++++------- src/switch_core_state_machine.c | 2 +- src/switch_event.c | 4 +--- src/switch_ivr.c | 3 +-- src/switch_ivr_async.c | 10 ++++------ src/switch_ivr_bridge.c | 6 ++---- src/switch_ivr_originate.c | 4 ++-- src/switch_ivr_play_say.c | 2 +- src/switch_loadable_module.c | 4 +--- src/switch_msrp.c | 3 +-- src/switch_rtp.c | 8 ++++---- src/switch_stun.c | 3 +-- src/switch_time.c | 4 ++-- src/switch_utils.c | 5 ++--- src/switch_xml.c | 2 +- 21 files changed, 49 insertions(+), 77 deletions(-) diff --git a/src/switch.c b/src/switch.c index 2f5274099e..3ace9fb7cf 100644 --- a/src/switch.c +++ b/src/switch.c @@ -230,7 +230,7 @@ void WINAPI service_main(DWORD numArgs, char **args) static int check_fd(int fd, int ms) { struct pollfd pfds[2] = { { 0 } }; - int s, r = 0, i = 0; + int s, r = 0; pfds[0].fd = fd; pfds[0].events = POLLIN | POLLERR; @@ -242,7 +242,7 @@ static int check_fd(int fd, int ms) r = -1; if ((pfds[0].revents & POLLIN)) { - if ((i = read(fd, &r, sizeof(r))) > -1) { + if (read(fd, &r, sizeof(r)) > -1) { (void)write(fd, &r, sizeof(r)); } } @@ -1206,9 +1206,9 @@ int main(int argc, char *argv[]) #ifndef WIN32 if (do_wait) { if (fds[1] > -1) { - int i, v = 1; + int v = 1; - if ((i = write(fds[1], &v, sizeof(v))) < 0) { + if (write(fds[1], &v, sizeof(v)) < 0) { fprintf(stderr, "System Error [%s]\n", strerror(errno)); } else { (void)read(fds[1], &v, sizeof(v)); diff --git a/src/switch_core.c b/src/switch_core.c index 48903eee95..d1bba3fa3e 100644 --- a/src/switch_core.c +++ b/src/switch_core.c @@ -3425,7 +3425,7 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t shell, sw switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "posix_spawn is unsupported on current platform\n"); return 1; #else - int status = 0, rval; + int status = 0; char buffer[1024]; pid_t pid; char *pdata = NULL, *argv[64]; @@ -3521,7 +3521,7 @@ SWITCH_DECLARE(int) switch_stream_spawn(const char *cmd, switch_bool_t shell, sw .revents = 0 }; - while ((rval = poll(pfds, 2, /*timeout*/-1)) > 0) { + while (poll(pfds, 2, /*timeout*/-1) > 0) { if (pfds[0].revents & POLLIN) { int bytes_read = read(cout_pipe[0], buffer, sizeof(buffer)); stream->raw_write_function(stream, (unsigned char *)buffer, bytes_read); diff --git a/src/switch_core_file.c b/src/switch_core_file.c index bc99a451ef..84e6acb3c0 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -949,10 +949,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_file_pre_close(switch_file_handle_t if (fh->pre_buffer) { if (switch_test_flag(fh, SWITCH_FILE_FLAG_WRITE)) { - switch_size_t rlen, blen; + switch_size_t blen; int asis = switch_test_flag(fh, SWITCH_FILE_NATIVE); - while ((rlen = switch_buffer_inuse(fh->pre_buffer))) { + while (switch_buffer_inuse(fh->pre_buffer)) { if ((blen = switch_buffer_read(fh->pre_buffer, fh->pre_buffer_data, fh->pre_buffer_datalen))) { if (!asis) blen /= 2; diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 347735cf1b..d1397a833e 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -6667,7 +6667,6 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session if (switch_channel_test_flag(session->channel, CF_PROTO_HOLD)) { int media_on_hold_a = switch_true(switch_channel_get_variable_dup(session->channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1)); - int media_on_hold_b = 0; int bypass_after_hold_a = 0; int bypass_after_hold_b = 0; @@ -6676,7 +6675,7 @@ SWITCH_DECLARE(int) switch_core_media_toggle_hold(switch_core_session_t *session } if (b_channel) { - if ((media_on_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1)))) { + if (switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_resume_on_hold", SWITCH_FALSE, -1))) { bypass_after_hold_b = switch_true(switch_channel_get_variable_dup(b_channel, "bypass_media_after_hold", SWITCH_FALSE, -1)); } } @@ -13622,16 +13621,12 @@ SWITCH_DECLARE(void) switch_core_media_set_sdp_codec_string(switch_core_session_ SWITCH_DECLARE(void) switch_core_media_merge_sdp_codec_string(switch_core_session_t *session, const char *r_sdp, switch_sdp_type_t sdp_type, const char *codec_string) { - - - sdp_parser_t *parser; sdp_session_t *sdp; - switch_media_handle_t *smh; switch_assert(session); - if (!(smh = session->media_handle)) { + if (!session->media_handle) { return; } @@ -13652,7 +13647,6 @@ SWITCH_DECLARE(void) switch_core_media_merge_sdp_codec_string(switch_core_sessio sdp_parser_free(parser); } - } diff --git a/src/switch_core_media_bug.c b/src/switch_core_media_bug.c index eca4c495d2..7aabceb7b7 100644 --- a/src/switch_core_media_bug.c +++ b/src/switch_core_media_bug.c @@ -466,7 +466,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med { switch_queue_t *spy_q = NULL; int w = 0, h = 0; - switch_status_t status; void *pop; int i; @@ -479,7 +478,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_patch_spy_frame(switch_med spy_q = bug->spy_video_queue[rw]; while(switch_queue_size(spy_q) > 0) { - if ((status = switch_queue_trypop(spy_q, &pop)) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_trypop(spy_q, &pop) == SWITCH_STATUS_SUCCESS) { switch_img_free(&bug->spy_img[rw]); if (!(bug->spy_img[rw] = (switch_image_t *) pop)) { break; @@ -641,7 +640,6 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void * switch_core_timer_init(&timer, "soft", fps_data.ms, fps_data.samples, NULL); while (bug->ready) { - switch_status_t status; int w = 0, h = 0, ok = 1, new_main = 0, new_other = 0, new_canvas = 0; switch_core_timer_next(&timer); @@ -657,7 +655,7 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void * w = vw / 2; h = vh; - if ((status = switch_queue_trypop(main_q, &pop)) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_trypop(main_q, &pop) == SWITCH_STATUS_SUCCESS) { switch_img_free(&img); if (!pop) { @@ -678,7 +676,7 @@ static void *SWITCH_THREAD_FUNC video_bug_thread(switch_thread_t *thread, void * if (other_q) { flush_video_queue(other_q, 1); - if ((status = switch_queue_trypop(other_q, &other_pop)) == SWITCH_STATUS_SUCCESS) { + if (switch_queue_trypop(other_q, &other_pop) == SWITCH_STATUS_SUCCESS) { switch_img_free(&other_img); other_img = (switch_image_t *) other_pop; diff --git a/src/switch_core_session.c b/src/switch_core_session.c index 32139ac98a..a590f7467c 100644 --- a/src/switch_core_session.c +++ b/src/switch_core_session.c @@ -526,7 +526,6 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ switch_originate_flag_t flags, switch_call_cause_t *cancel_cause) { switch_io_event_hook_outgoing_channel_t *ptr; - switch_status_t status = SWITCH_STATUS_FALSE; switch_endpoint_interface_t *endpoint_interface; switch_channel_t *channel = NULL; switch_caller_profile_t *outgoing_profile = caller_profile; @@ -608,7 +607,7 @@ SWITCH_DECLARE(switch_call_cause_t) switch_core_session_outgoing_channel(switch_ if (session) { for (ptr = session->event_hooks.outgoing_channel; ptr; ptr = ptr->next) { - if ((status = ptr->outgoing_channel(session, var_event, caller_profile, *new_session, flags)) != SWITCH_STATUS_SUCCESS) { + if (ptr->outgoing_channel(session, var_event, caller_profile, *new_session, flags) != SWITCH_STATUS_SUCCESS) { break; } } @@ -1116,15 +1115,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_message(switch_core_ SWITCH_DECLARE(switch_status_t) switch_core_session_flush_message(switch_core_session_t *session) { - switch_status_t status = SWITCH_STATUS_FALSE; void *pop; switch_core_session_message_t *message; switch_assert(session != NULL); - if (session->message_queue) { - while ((status = (switch_status_t) switch_queue_trypop(session->message_queue, &pop)) == SWITCH_STATUS_SUCCESS) { + while (switch_queue_trypop(session->message_queue, &pop) == SWITCH_STATUS_SUCCESS) { message = (switch_core_session_message_t *) pop; switch_ivr_process_indications(session, message); switch_core_session_free_message(&message); @@ -1353,19 +1350,18 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_dequeue_private_event(switch SWITCH_DECLARE(uint32_t) switch_core_session_flush_private_events(switch_core_session_t *session) { - switch_status_t status = SWITCH_STATUS_FALSE; int x = 0; void *pop; if (session->private_event_queue) { - while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue_pri, &pop)) == SWITCH_STATUS_SUCCESS) { + while (switch_queue_trypop(session->private_event_queue_pri, &pop) == SWITCH_STATUS_SUCCESS) { if (pop) { switch_event_t *event = (switch_event_t *) pop; switch_event_destroy(&event); } x++; } - while ((status = (switch_status_t) switch_queue_trypop(session->private_event_queue, &pop)) == SWITCH_STATUS_SUCCESS) { + while (switch_queue_trypop(session->private_event_queue, &pop) == SWITCH_STATUS_SUCCESS) { if (pop) { switch_event_t *event = (switch_event_t *) pop; switch_event_destroy(&event); @@ -1398,7 +1394,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_try_reset(switch_core_sessio SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, switch_bool_t flush_dtmf, switch_bool_t reset_read_codec) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_size_t has; if (reset_read_codec) { switch_core_session_set_read_codec(session, NULL); @@ -1425,7 +1420,7 @@ SWITCH_DECLARE(void) switch_core_session_reset(switch_core_session_t *session, s switch_mutex_unlock(session->codec_read_mutex); if (flush_dtmf) { - while ((has = switch_channel_has_dtmf(channel))) { + while (switch_channel_has_dtmf(channel)) { switch_channel_flush_dtmf(channel); } } @@ -1496,7 +1491,7 @@ SWITCH_DECLARE(void) switch_core_session_signal_state_change(switch_core_session if (status == SWITCH_STATUS_SUCCESS) { for (ptr = session->event_hooks.state_change; ptr; ptr = ptr->next) { - if ((status = ptr->state_change(session)) != SWITCH_STATUS_SUCCESS) { + if (ptr->state_change(session) != SWITCH_STATUS_SUCCESS) { break; } } @@ -1608,9 +1603,8 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t * } if ((*session)->event_queue) { - switch_status_t status; void *pop; - while ((status = (switch_status_t) switch_queue_trypop((*session)->event_queue, &pop)) == SWITCH_STATUS_SUCCESS) { + while (switch_queue_trypop((*session)->event_queue, &pop) == SWITCH_STATUS_SUCCESS) { if (pop) { switch_event_t *event = (switch_event_t *) pop; switch_event_destroy(&event); diff --git a/src/switch_core_sqldb.c b/src/switch_core_sqldb.c index 0f6ecd5841..702ee6a79c 100644 --- a/src/switch_core_sqldb.c +++ b/src/switch_core_sqldb.c @@ -744,7 +744,6 @@ static switch_status_t switch_cache_db_execute_sql_chunked(switch_cache_db_handl { switch_status_t status = SWITCH_STATUS_FALSE; char *p, *s, *e; - switch_size_t chunk_count; switch_size_t len; switch_assert(chunk_size); @@ -758,7 +757,7 @@ static switch_status_t switch_cache_db_execute_sql_chunked(switch_cache_db_handl return switch_cache_db_execute_sql_real(dbh, sql, err); } - if (!(chunk_count = strlen(sql) / chunk_size)) { + if (!(strlen(sql) / chunk_size)) { return SWITCH_STATUS_FALSE; } @@ -878,14 +877,13 @@ SWITCH_DECLARE(char *) switch_cache_db_execute_sql2str(switch_cache_db_handle_t goto end; } else { int running = 1; - int colcount; while (running < 5000) { int result = switch_core_db_step(stmt); const unsigned char *txt; if (result == SWITCH_CORE_DB_ROW) { - if ((colcount = switch_core_db_column_count(stmt)) > 0) { + if (switch_core_db_column_count(stmt) > 0) { if ((txt = switch_core_db_column_text(stmt, 0))) { switch_copy_string(str, (char *) txt, len); status = SWITCH_STATUS_SUCCESS; @@ -2244,7 +2242,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, qm->thread_running = 1; while (qm->thread_running == 1) { - uint32_t i, lc; + uint32_t i; uint32_t written = 0, iterations = 0; if (qm->paused) { @@ -2286,7 +2284,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, check: - if ((lc = qm_ttl(qm)) == 0) { + if (qm_ttl(qm) == 0) { switch_mutex_lock(qm->cond2_mutex); if (qm->skip_wait > 0) { qm->skip_wait--; @@ -2299,7 +2297,7 @@ static void *SWITCH_THREAD_FUNC switch_user_sql_thread(switch_thread_t *thread, i = 40; - while (--i > 0 && (lc = qm_ttl(qm)) < 500) { + while (--i > 0 && qm_ttl(qm) < 500) { switch_yield(5000); } diff --git a/src/switch_core_state_machine.c b/src/switch_core_state_machine.c index ce47a6cd68..b2bc14a1df 100644 --- a/src/switch_core_state_machine.c +++ b/src/switch_core_state_machine.c @@ -589,7 +589,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session_t *session) if (rstatus == SWITCH_STATUS_SUCCESS) { for (ptr = session->event_hooks.state_run; ptr; ptr = ptr->next) { - if ((rstatus = ptr->state_run(session)) != SWITCH_STATUS_SUCCESS) { + if (ptr->state_run(session) != SWITCH_STATUS_SUCCESS) { break; } } diff --git a/src/switch_event.c b/src/switch_event.c index a24bee0126..4cc60fa60c 100644 --- a/src/switch_event.c +++ b/src/switch_event.c @@ -1723,10 +1723,8 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_brackets(char *data, char a, int x = 0; for (x = 0; x < var_count; x++) { char *inner_var_array[2] = { 0 }; - int inner_var_count; - if ((inner_var_count = switch_separate_string(var_array[x], '=', - inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0])))) == 2) { + if (switch_separate_string(var_array[x], '=', inner_var_array, (sizeof(inner_var_array) / sizeof(inner_var_array[0]))) == 2) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "Parsing variable [%s]=[%s]\n", inner_var_array[0], inner_var_array[1]); switch_event_add_header_string(e, SWITCH_STACK_BOTTOM, inner_var_array[0], inner_var_array[1]); } diff --git a/src/switch_ivr.c b/src/switch_ivr.c index ddd3a8e529..77d957fb7c 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -2135,10 +2135,9 @@ SWITCH_DECLARE(void) switch_ivr_bg_media(const char *uuid, switch_media_flag_t f SWITCH_DECLARE(void) switch_ivr_check_hold(switch_core_session_t *session) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_media_flow_t flow; if (switch_channel_test_flag(channel, CF_ANSWERED) && switch_channel_test_cap(channel, CC_MUTE_VIA_MEDIA_STREAM) && - (flow = switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO)) != SWITCH_MEDIA_FLOW_SENDRECV) { + switch_core_session_media_flow(session, SWITCH_MEDIA_TYPE_AUDIO) != SWITCH_MEDIA_FLOW_SENDRECV) { switch_core_session_message_t msg = { 0 }; msg.message_id = SWITCH_MESSAGE_INDICATE_MEDIA_RENEG; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index 707f8672dd..6dfdcf7248 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1020,7 +1020,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_ return SWITCH_STATUS_FALSE; } - if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) { + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } @@ -2944,7 +2944,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session_event(switch_core_sess hangup_on_error = switch_true(p); } - if ((status = switch_channel_pre_answer(channel)) != SWITCH_STATUS_SUCCESS) { + if (switch_channel_pre_answer(channel) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } @@ -3803,7 +3803,6 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da switch_inband_dtmf_t *pvt = (switch_inband_dtmf_t *) user_data; switch_frame_t *frame = NULL; switch_channel_t *channel = switch_core_session_get_channel(pvt->session); - teletone_hit_type_t hit; switch (type) { case SWITCH_ABC_TYPE_INIT: @@ -3812,7 +3811,7 @@ static switch_bool_t inband_dtmf_callback(switch_media_bug_t *bug, void *user_da break; case SWITCH_ABC_TYPE_READ_REPLACE: if ((frame = switch_core_media_bug_get_read_replace_frame(bug))) { - if ((hit = teletone_dtmf_detect(&pvt->dtmf_detect, frame->data, frame->samples)) == TT_HIT_END) { + if (teletone_dtmf_detect(&pvt->dtmf_detect, frame->data, frame->samples) == TT_HIT_END) { switch_dtmf_t dtmf = {0}; teletone_dtmf_get(&pvt->dtmf_detect, &dtmf.digit, &dtmf.duration); @@ -5457,7 +5456,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t * const char *grammar, const char *name, const char *dest, switch_asr_handle_t *ah) { switch_channel_t *channel = switch_core_session_get_channel(session); - switch_status_t status; struct speech_thread_handle *sth = switch_channel_get_private(channel, SWITCH_SPEECH_KEY); const char *p; int resume = 0; @@ -5465,7 +5463,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t * if (!sth) { /* No speech thread handle available yet, init speech detection first. */ - if ((status = switch_ivr_detect_speech_init(session, mod_name, dest, ah)) != SWITCH_STATUS_SUCCESS) { + if (switch_ivr_detect_speech_init(session, mod_name, dest, ah) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_NOT_INITALIZED; } diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 3e5e2145be..f91fc2c69f 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -507,7 +507,6 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) for (;;) { - switch_channel_state_t b_state; switch_status_t status; switch_event_t *event; @@ -543,7 +542,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) goto end_of_bridge_loop; } - if ((b_state = switch_channel_down_nosig(chan_b))) { + if (switch_channel_down_nosig(chan_b)) { goto end_of_bridge_loop; } @@ -953,14 +952,13 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj) static void transfer_after_bridge(switch_core_session_t *session, const char *where) { - int argc; char *argv[4] = { 0 }; char *mydata; switch_channel_set_variable(switch_core_session_get_channel(session), SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE, NULL); if (!zstr(where) && (mydata = switch_core_session_strdup(session, where))) { - if ((argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { + if (switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) { switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "No extension specified.\n"); diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c index 627f43ead6..c4f4bfa2b2 100644 --- a/src/switch_ivr_originate.c +++ b/src/switch_ivr_originate.c @@ -2532,12 +2532,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess oglobals.ignore_ring_ready = 1; } - if ((var_val = switch_event_get_header(var_event, "monitor_early_media_ring"))) { + if ((var_val = switch_event_get_header(var_event, "monitor_early_media_ring")) && switch_true(var_val)) { oglobals.early_ok = 0; oglobals.monitor_early_media_ring = 1; } - if ((var_val = switch_event_get_header(var_event, "monitor_early_media_fail"))) { + if ((var_val = switch_event_get_header(var_event, "monitor_early_media_fail")) && switch_true(var_val)) { oglobals.early_ok = 0; oglobals.monitor_early_media_fail = 1; } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index 1cd4c623df..25486eee7f 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -1375,7 +1375,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess status = SWITCH_STATUS_SUCCESS; - if ((alt = strchr(file, ':'))) { + if (strchr(file, ':')) { char *dup; if (!strncasecmp(file, "phrase:", 7)) { diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c index 5442cca03a..439b8d0c19 100644 --- a/src/switch_loadable_module.c +++ b/src/switch_loadable_module.c @@ -3191,12 +3191,11 @@ 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, ...) { char buf[256] = ""; - int ret; va_list ap; va_start(ap, fmt); - if ((ret = switch_vsnprintf(buf, sizeof(buf), fmt, ap)) > 0) { + if (switch_vsnprintf(buf, sizeof(buf), fmt, ap) > 0) { if (!sh->cnt++) { sh->stream.write_function(&sh->stream, "file_string://%s.%s", buf, sh->ext); } else if (strstr(buf, "://")) { @@ -3204,7 +3203,6 @@ SWITCH_DECLARE(void) switch_say_file(switch_say_file_handle_t *sh, const char *f } else { sh->stream.write_function(&sh->stream, "!%s.%s", buf, sh->ext); } - } va_end(ap); diff --git a/src/switch_msrp.c b/src/switch_msrp.c index b76a043261..1f5db7ac20 100644 --- a/src/switch_msrp.c +++ b/src/switch_msrp.c @@ -1425,7 +1425,6 @@ end: static void *SWITCH_THREAD_FUNC msrp_listener(switch_thread_t *thread, void *obj) { switch_msrp_socket_t *msock = (switch_msrp_socket_t *)obj; - switch_status_t rv; switch_memory_pool_t *pool = NULL; switch_threadattr_t *thd_attr = NULL; switch_socket_t *sock = NULL; @@ -1440,7 +1439,7 @@ static void *SWITCH_THREAD_FUNC msrp_listener(switch_thread_t *thread, void *obj switch_socket_opt_set(msock->sock, SWITCH_SO_TCP_NODELAY, TRUE); // switch_socket_opt_set(msock->sock, SWITCH_SO_NONBLOCK, TRUE); - while (globals.running && (rv = switch_socket_accept(&sock, msock->sock, pool)) == SWITCH_STATUS_SUCCESS) { + while (globals.running && switch_socket_accept(&sock, msock->sock, pool) == SWITCH_STATUS_SUCCESS) { switch_memory_pool_t *worker_pool; worker_helper_t *helper; diff --git a/src/switch_rtp.c b/src/switch_rtp.c index 5f4ce0f738..f0be8db97b 100644 --- a/src/switch_rtp.c +++ b/src/switch_rtp.c @@ -8780,8 +8780,8 @@ static int rtp_common_write(switch_rtp_t *rtp_session, switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET); srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]); rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL; - if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], - &rtp_session->send_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) { + if (srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], + &rtp_session->send_policy[rtp_session->srtp_idx_rtp]) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating %s Secure RTP SEND\n", rtp_type(rtp_session)); rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] = 0; @@ -9376,8 +9376,8 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_write_raw(switch_rtp_t *rtp_session, switch_rtp_clear_flag(rtp_session, SWITCH_RTP_FLAG_SECURE_SEND_RESET); srtp_dealloc(rtp_session->send_ctx[rtp_session->srtp_idx_rtp]); rtp_session->send_ctx[rtp_session->srtp_idx_rtp] = NULL; - if ((stat = srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], - &rtp_session->send_policy[rtp_session->srtp_idx_rtp])) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) { + if (srtp_create(&rtp_session->send_ctx[rtp_session->srtp_idx_rtp], + &rtp_session->send_policy[rtp_session->srtp_idx_rtp]) || !rtp_session->send_ctx[rtp_session->srtp_idx_rtp]) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(rtp_session->session), SWITCH_LOG_ERROR, "Error! RE-Activating Secure RTP SEND\n"); rtp_session->flags[SWITCH_RTP_FLAG_SECURE_SEND] = 0; status = SWITCH_STATUS_FALSE; diff --git a/src/switch_stun.c b/src/switch_stun.c index 6149ac3dc3..b0ff45b3dc 100644 --- a/src/switch_stun.c +++ b/src/switch_stun.c @@ -717,7 +717,6 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip, char rip[50] = { 0 }; uint16_t rport = 0; switch_time_t started = 0; - unsigned int elapsed = 0; int funny = 0; int size = sizeof(buf); int xlen = sizeof(switch_stun_packet_header_t); @@ -787,7 +786,7 @@ SWITCH_DECLARE(switch_status_t) switch_stun_lookup(char **ip, break; } - if ((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > 5000) { + if (((unsigned int)((switch_micro_time_now() - started) / 1000)) > 5000) { *err = "Timeout"; switch_socket_shutdown(sock, SWITCH_SHUTDOWN_READWRITE); switch_socket_close(sock); diff --git a/src/switch_time.c b/src/switch_time.c index 182d9ad6bd..39ad4bb597 100644 --- a/src/switch_time.c +++ b/src/switch_time.c @@ -413,7 +413,7 @@ typedef struct interval_timer interval_timer_t; static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval) { struct itimerspec val; - int fd, r; + int fd; uint64_t exp; fd = timerfd_create(CLOCK_MONOTONIC, 0); @@ -432,7 +432,7 @@ static switch_status_t timerfd_start_interval(interval_timer_t *it, int interval return SWITCH_STATUS_GENERR; } - if ((r = read(fd, &exp, sizeof(exp))) < 0) { + if (read(fd, &exp, sizeof(exp)) < 0) { close(fd); return SWITCH_STATUS_GENERR; } diff --git a/src/switch_utils.c b/src/switch_utils.c index 1a93411489..d8b830943a 100644 --- a/src/switch_utils.c +++ b/src/switch_utils.c @@ -1142,7 +1142,7 @@ SWITCH_DECLARE(switch_bool_t) switch_simple_email(const char *to, } if (!zstr(file) && !zstr(convert_cmd) && !zstr(convert_ext)) { - if ((ext = strrchr(file, '.'))) { + if (strrchr(file, '.')) { dupfile = strdup(file); if ((ext = strrchr(dupfile, '.'))) { *ext++ = '\0'; @@ -1820,9 +1820,8 @@ SWITCH_DECLARE(switch_status_t) switch_resolve_host(const char *host, char *buf, { struct addrinfo *ai; - int err; - if ((err = getaddrinfo(host, 0, 0, &ai))) { + if (getaddrinfo(host, 0, 0, &ai)) { return SWITCH_STATUS_FALSE; } diff --git a/src/switch_xml.c b/src/switch_xml.c index 6467758b72..1a3ecef9b6 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -1257,7 +1257,7 @@ static char *expand_vars(char *buf, char *ebuf, switch_size_t elen, switch_size_ char *wp = ebuf; char *ep = ebuf + elen - 1; - if (!(var = strstr(rp, "$${"))) { + if (!strstr(rp, "$${")) { *newlen = strlen(buf); return buf; } From 01844013a0d7b4c2e045ad0dfd1747bcdca091a9 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 5 Jan 2022 01:46:21 +0300 Subject: [PATCH 023/155] [mod_sofia] Fix potential memory leak in sofia_reg_handle_sip_r_challenge() --- src/mod/endpoints/mod_sofia/sofia_reg.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/sofia_reg.c b/src/mod/endpoints/mod_sofia/sofia_reg.c index 42c792c08b..9791190f5f 100644 --- a/src/mod/endpoints/mod_sofia/sofia_reg.c +++ b/src/mod/endpoints/mod_sofia/sofia_reg.c @@ -2810,9 +2810,11 @@ void sofia_reg_handle_sip_r_challenge(int status, const char *val = switch_xml_attr_soft(x_param, "value"); if (!strcasecmp(var, "reverse-auth-user")) { + switch_safe_free(dup_user); dup_user = strdup(val); sip_auth_username = dup_user; } else if (!strcasecmp(var, "reverse-auth-pass")) { + switch_safe_free(dup_pass); dup_pass = strdup(val); sip_auth_password = dup_pass; } From 6ef22a6f7dabf0d2d227307ab6a49f9e0b909dc1 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 11 Jan 2022 14:15:44 +0300 Subject: [PATCH 024/155] [mod_v8] Fix dead nested assignments --- src/mod/languages/mod_v8/src/fseventhandler.cpp | 3 +-- src/mod/languages/mod_v8/src/fsodbc.cpp | 3 +-- src/mod/languages/mod_v8/src/fssession.cpp | 6 ++---- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mod/languages/mod_v8/src/fseventhandler.cpp b/src/mod/languages/mod_v8/src/fseventhandler.cpp index e4e256e689..145984c83f 100644 --- a/src/mod/languages/mod_v8/src/fseventhandler.cpp +++ b/src/mod/languages/mod_v8/src/fseventhandler.cpp @@ -389,10 +389,9 @@ JS_EVENTHANDLER_FUNCTION_IMPL(SendEvent) if (session_uuid.length() > 0) { /* This is a session event */ switch_core_session_t *session; - switch_status_t status = SWITCH_STATUS_FALSE; if ((session = switch_core_session_locate(session_uuid.c_str()))) { - if ((status = switch_core_session_queue_private_event(session, event, SWITCH_FALSE)) == SWITCH_STATUS_SUCCESS) { + if (switch_core_session_queue_private_event(session, event, SWITCH_FALSE) == SWITCH_STATUS_SUCCESS) { info.GetReturnValue().Set(true); } else { info.GetReturnValue().Set(false); diff --git a/src/mod/languages/mod_v8/src/fsodbc.cpp b/src/mod/languages/mod_v8/src/fsodbc.cpp index 5b34ebe36e..2b75661c50 100644 --- a/src/mod/languages/mod_v8/src/fsodbc.cpp +++ b/src/mod/languages/mod_v8/src/fsodbc.cpp @@ -273,7 +273,6 @@ JS_ODBC_FUNCTION_IMPL(NumCols) JS_ODBC_FUNCTION_IMPL(NextRow) { HandleScope handle_scope(info.GetIsolate()); - int result = 0; bool tf = false; if (switch_odbc_handle_get_state(_handle) != SWITCH_ODBC_STATE_CONNECTED) { @@ -282,7 +281,7 @@ JS_ODBC_FUNCTION_IMPL(NextRow) } if (_stmt) { - if ((result = SQLFetch(_stmt) == SQL_SUCCESS)) { + if (SQLFetch(_stmt) == SQL_SUCCESS) { tf = true; } } diff --git a/src/mod/languages/mod_v8/src/fssession.cpp b/src/mod/languages/mod_v8/src/fssession.cpp index c8a315ced0..d3bc77ae13 100644 --- a/src/mod/languages/mod_v8/src/fssession.cpp +++ b/src/mod/languages/mod_v8/src/fssession.cpp @@ -1250,7 +1250,6 @@ JS_SESSION_FUNCTION_IMPL(WaitForMedia) HandleScope handle_scope(info.GetIsolate()); switch_channel_t *channel; switch_time_t started; - unsigned int elapsed; int32_t timeout = 60000; bool ret = true; @@ -1273,7 +1272,7 @@ JS_SESSION_FUNCTION_IMPL(WaitForMedia) } for (;;) { - if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout) + if (((/* Elapsed */(unsigned int)((switch_micro_time_now() - started) / 1000)) > (switch_time_t)timeout) || switch_channel_down(channel)) { info.GetReturnValue().Set(false); break; @@ -1297,7 +1296,6 @@ JS_SESSION_FUNCTION_IMPL(WaitForAnswer) HandleScope handle_scope(info.GetIsolate()); switch_channel_t *channel; switch_time_t started; - unsigned int elapsed; int32_t timeout = 60000; bool ret = true; @@ -1319,7 +1317,7 @@ JS_SESSION_FUNCTION_IMPL(WaitForAnswer) } for (;;) { - if (((elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000)) > (switch_time_t) timeout) + if (((/* Elapsed */(unsigned int)((switch_micro_time_now() - started) / 1000)) > (switch_time_t)timeout) || switch_channel_down(channel)) { info.GetReturnValue().Set(false); break; From d8c3595076ed641314c3740825c0f0eb7c6aabbe Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 7 Jan 2022 03:09:08 +0300 Subject: [PATCH 025/155] [apr] Fix dead nested assignments --- libs/apr/locks/unix/proc_mutex.c | 3 +-- libs/apr/memory/unix/apr_pools.c | 2 +- libs/apr/strings/apr_snprintf.c | 2 +- libs/apr/threadproc/unix/proc.c | 7 +++---- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/libs/apr/locks/unix/proc_mutex.c b/libs/apr/locks/unix/proc_mutex.c index 26b2f9029a..579bb8af4d 100644 --- a/libs/apr/locks/unix/proc_mutex.c +++ b/libs/apr/locks/unix/proc_mutex.c @@ -730,10 +730,9 @@ static apr_status_t proc_mutex_choose_method(apr_proc_mutex_t *new_mutex, apr_lo APR_DECLARE(const char *) apr_proc_mutex_defname(void) { - apr_status_t rv; apr_proc_mutex_t mutex; - if ((rv = proc_mutex_choose_method(&mutex, APR_LOCK_DEFAULT)) != APR_SUCCESS) { + if (proc_mutex_choose_method(&mutex, APR_LOCK_DEFAULT) != APR_SUCCESS) { return "unknown"; } mutex.meth = mutex.inter_meth; diff --git a/libs/apr/memory/unix/apr_pools.c b/libs/apr/memory/unix/apr_pools.c index 7e37a5d0a0..acd8512ca1 100644 --- a/libs/apr/memory/unix/apr_pools.c +++ b/libs/apr/memory/unix/apr_pools.c @@ -1005,7 +1005,7 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) if (pool->user_mutex) apr_thread_mutex_lock(pool->user_mutex); #endif - ps.node = active = pool->active; + ps.node = pool->active; ps.pool = pool; ps.vbuff.curpos = ps.node->first_avail; diff --git a/libs/apr/strings/apr_snprintf.c b/libs/apr/strings/apr_snprintf.c index 611f2d7972..8c5030d725 100644 --- a/libs/apr/strings/apr_snprintf.c +++ b/libs/apr/strings/apr_snprintf.c @@ -1069,7 +1069,7 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), s_len = strlen(s); - if (alternate_form && (q = strchr(s, '.')) == NULL) { + if (alternate_form && strchr(s, '.') == NULL) { s[s_len++] = '.'; s[s_len] = '\0'; /* delimit for following strchr() */ } diff --git a/libs/apr/threadproc/unix/proc.c b/libs/apr/threadproc/unix/proc.c index 0f3437aee0..fc7f925eb4 100644 --- a/libs/apr/threadproc/unix/proc.c +++ b/libs/apr/threadproc/unix/proc.c @@ -369,7 +369,6 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, return errno; } else if (new->pid == 0) { - int status; /* child process */ /* @@ -433,7 +432,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, /* Only try to switch if we are running as root */ if (attr->gid != -1 && !geteuid()) { - if ((status = setgid(attr->gid))) { + if (setgid(attr->gid)) { if (attr->errfn) { attr->errfn(pool, errno, "setting of group failed"); } @@ -442,7 +441,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } if (attr->uid != -1 && !geteuid()) { - if ((status = setuid(attr->uid))) { + if (setuid(attr->uid)) { if (attr->errfn) { attr->errfn(pool, errno, "setting of user failed"); } @@ -450,7 +449,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } } - if ((status = limit_proc(attr)) != APR_SUCCESS) { + if (limit_proc(attr) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(pool, errno, "setting of resource limits failed"); } From fa6d0c4157004d3d356e59c04a14fd4e0e8ed400 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 5 Jan 2022 19:14:27 +0300 Subject: [PATCH 026/155] [iksemel] Fix potential memory leak in iksroster --- libs/iksemel/tools/iksroster.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libs/iksemel/tools/iksroster.c b/libs/iksemel/tools/iksroster.c index e97f81cd15..71237972b3 100644 --- a/libs/iksemel/tools/iksroster.c +++ b/libs/iksemel/tools/iksroster.c @@ -299,6 +299,7 @@ main (int argc, char *argv[]) strtok (to_pw, "\r\n"); break; case 'f': + if (file) free(file); file = strdup (optarg); break; case 't': From c062f85e1660bbc59e5096cfc6f1583ca153b7b7 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 6 Jan 2022 23:03:02 +0300 Subject: [PATCH 027/155] [mod_commands] Fix dead nested assignments --- .../applications/mod_commands/mod_commands.c | 35 ++++++------------- 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/src/mod/applications/mod_commands/mod_commands.c b/src/mod/applications/mod_commands/mod_commands.c index a86cea3538..8e737a78a2 100644 --- a/src/mod/applications/mod_commands/mod_commands.c +++ b/src/mod/applications/mod_commands/mod_commands.c @@ -1175,7 +1175,6 @@ SWITCH_STANDARD_API(group_call_function) SWITCH_STANDARD_API(in_group_function) { switch_xml_t x_domain, xml = NULL, x_group; - int argc; char *mydata = NULL, *argv[2], *user, *domain, *dup_domain = NULL; char delim = ','; switch_event_t *params = NULL; @@ -1186,7 +1185,7 @@ SWITCH_STANDARD_API(in_group_function) goto end; } - if ((argc = switch_separate_string(mydata, delim, argv, (sizeof(argv) / sizeof(argv[0])))) < 2) { + if (switch_separate_string(mydata, delim, argv, (sizeof(argv) / sizeof(argv[0]))) < 2) { goto end; } @@ -1229,7 +1228,6 @@ SWITCH_STANDARD_API(in_group_function) SWITCH_STANDARD_API(domain_data_function) { switch_xml_t x_domain = NULL, xml_root = NULL, x_param, x_params; - int argc; char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *domain, *dup_domain = NULL; char delim = ' '; const char *container = "params", *elem = "param"; @@ -1240,7 +1238,7 @@ SWITCH_STANDARD_API(domain_data_function) goto end; } - if ((argc = switch_separate_string(mydata, delim, argv, (sizeof(argv) / sizeof(argv[0])))) < 3) { + if (switch_separate_string(mydata, delim, argv, (sizeof(argv) / sizeof(argv[0]))) < 3) { goto end; } @@ -1299,7 +1297,6 @@ end: SWITCH_STANDARD_API(user_data_function) { switch_xml_t x_user = NULL, x_param, x_params; - int argc; char *mydata = NULL, *argv[3], *key = NULL, *type = NULL, *user, *domain, *dup_domain = NULL; char delim = ' '; const char *container = "params", *elem = "param"; @@ -1310,7 +1307,7 @@ SWITCH_STANDARD_API(user_data_function) goto end; } - if ((argc = switch_separate_string(mydata, delim, argv, (sizeof(argv) / sizeof(argv[0])))) < 3) { + if (switch_separate_string(mydata, delim, argv, (sizeof(argv) / sizeof(argv[0]))) < 3) { goto end; } @@ -1564,7 +1561,6 @@ SWITCH_STANDARD_API(expand_function) char *dup; char *arg = NULL; char *mycmd; - switch_status_t status; const char *p; switch_core_session_t *xsession; char uuid[80] = ""; @@ -1603,7 +1599,7 @@ SWITCH_STANDARD_API(expand_function) } expanded = arg ? switch_event_expand_headers(stream->param_event, arg) : arg; - if ((status = switch_api_execute(mycmd, expanded, session, stream)) != SWITCH_STATUS_SUCCESS) { + if (switch_api_execute(mycmd, expanded, session, stream) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Cannot execute command\n"); } @@ -3108,7 +3104,6 @@ SWITCH_STANDARD_API(dual_transfer_function) SWITCH_STANDARD_API(tone_detect_session_function) { char *argv[8] = { 0 }; - int argc; char *mydata = NULL; time_t to = 0; switch_core_session_t *rsession; @@ -3122,7 +3117,7 @@ SWITCH_STANDARD_API(tone_detect_session_function) mydata = strdup(cmd); switch_assert(mydata != NULL); - if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 3 || !argv[0]) { + if (switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])) < 3 || !argv[0]) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "-ERR INVALID ARGS!\n"); return SWITCH_STATUS_SUCCESS; } @@ -4833,7 +4828,6 @@ SWITCH_STANDARD_API(session_displace_function) switch_core_session_t *rsession = NULL; char *mycmd = NULL, *argv[5] = { 0 }; char *uuid = NULL, *action = NULL, *path = NULL; - int argc = 0; uint32_t limit = 0; char *flags = NULL; @@ -4841,7 +4835,7 @@ SWITCH_STANDARD_API(session_displace_function) goto usage; } - if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 3) { + if (switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 3) { goto usage; } @@ -5368,7 +5362,6 @@ static void *SWITCH_THREAD_FUNC bgapi_exec(switch_thread_t *thread, void *obj) { struct bg_job *job = (struct bg_job *) obj; switch_stream_handle_t stream = { 0 }; - switch_status_t status; char *reply, *freply = NULL; switch_event_t *event; char *arg; @@ -5388,7 +5381,7 @@ static void *SWITCH_THREAD_FUNC bgapi_exec(switch_thread_t *thread, void *obj) *arg++ = '\0'; } - if ((status = switch_api_execute(job->cmd, arg, NULL, &stream)) == SWITCH_STATUS_SUCCESS) { + if (switch_api_execute(job->cmd, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) { reply = stream.data; } else { freply = switch_mprintf("%s: Command not found!\n", job->cmd); @@ -5636,9 +5629,7 @@ static int show_callback(void *pArg, int argc, char **argv, char **columnNames) #define COMPLETE_SYNTAX "add |del [|*]" SWITCH_STANDARD_API(complete_function) { - switch_status_t status; - - if ((status = switch_console_set_complete(cmd)) == SWITCH_STATUS_SUCCESS) { + if (switch_console_set_complete(cmd) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-USAGE: %s\n", COMPLETE_SYNTAX); @@ -5650,9 +5641,7 @@ SWITCH_STANDARD_API(complete_function) #define ALIAS_SYNTAX "[add|stickyadd] | del [|*]" SWITCH_STANDARD_API(alias_function) { - switch_status_t status; - - if ((status = switch_console_set_alias(cmd)) == SWITCH_STATUS_SUCCESS) { + if (switch_console_set_alias(cmd) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "+OK\n"); } else { stream->write_function(stream, "-USAGE: %s\n", ALIAS_SYNTAX); @@ -6350,7 +6339,6 @@ SWITCH_STANDARD_API(uuid_send_dtmf_function) switch_core_session_t *psession = NULL; char *mycmd = NULL, *argv[2] = { 0 }; char *uuid = NULL, *dtmf_data = NULL; - int argc = 0; if (zstr(cmd)) { goto usage; @@ -6360,7 +6348,7 @@ SWITCH_STANDARD_API(uuid_send_dtmf_function) goto usage; } - if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) { + if (switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2) { goto usage; } @@ -6403,7 +6391,6 @@ SWITCH_STANDARD_API(uuid_recv_dtmf_function) switch_core_session_t *psession = NULL; char *mycmd = NULL, *argv[2] = { 0 }; char *uuid = NULL, *dtmf_data = NULL; - int argc = 0; if (zstr(cmd)) { goto usage; @@ -6413,7 +6400,7 @@ SWITCH_STANDARD_API(uuid_recv_dtmf_function) goto usage; } - if ((argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) { + if (switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2) { goto usage; } From 688984f8b94ab916215251fd546ae70b138d3985 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 7 Jan 2022 22:44:48 +0300 Subject: [PATCH 028/155] [mod_dptools] Fix dead nested assignments. --- .../applications/mod_dptools/mod_dptools.c | 61 +++++++------------ 1 file changed, 22 insertions(+), 39 deletions(-) diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index afe6cbef68..f38509016b 100644 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -115,7 +115,6 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t switch_core_session_t *session = (switch_core_session_t *) match->user_data; switch_channel_t *channel; switch_event_t *event; - switch_status_t status; switch_core_session_t *use_session = session; if (switch_ivr_dmachine_get_target(match->dmachine) == DIGIT_TARGET_PEER) { @@ -135,7 +134,7 @@ static switch_status_t digit_nomatch_action_callback(switch_ivr_dmachine_match_t if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) { switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "digits", match->match_digits); - if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_session_queue_event(use_session, &event) != SWITCH_STATUS_SUCCESS) { switch_event_destroy(&event); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n", switch_core_session_get_name(use_session)); @@ -157,7 +156,6 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) { struct action_binding *act = (struct action_binding *) match->user_data; switch_event_t *event; - switch_status_t status; int exec = 0; int api = 0; char *string = NULL; @@ -218,7 +216,7 @@ static switch_status_t digit_action_callback(switch_ivr_dmachine_match_t *match) switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "execute", exec == 1 ? "non-blocking" : "blocking"); } - if ((status = switch_core_session_queue_event(use_session, &event)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_session_queue_event(use_session, &event) != SWITCH_STATUS_SUCCESS) { switch_event_destroy(&event); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(use_session), SWITCH_LOG_WARNING, "%s event queue failure.\n", switch_core_session_get_name(use_session)); @@ -651,11 +649,10 @@ SWITCH_STANDARD_APP(keepalive_function) SWITCH_STANDARD_APP(exe_function) { char *argv[4] = { 0 }; - int argc; char *lbuf = NULL; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { switch_core_session_execute_exten(session, argv[0], argv[1], argv[2]); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", EXE_SYNTAX); @@ -695,11 +692,10 @@ SWITCH_STANDARD_APP(rename_function) SWITCH_STANDARD_APP(transfer_vars_function) { char *argv[1] = { 0 }; - int argc; char *lbuf = NULL; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) { switch_core_session_t *nsession = NULL; switch_core_session_get_partner(session, &nsession); @@ -717,11 +713,10 @@ SWITCH_STANDARD_APP(transfer_vars_function) SWITCH_STANDARD_APP(soft_hold_function) { char *argv[3] = { 0 }; - int argc; char *lbuf = NULL; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) { switch_ivr_soft_hold(session, argv[0], argv[1], argv[2]); } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Usage: %s\n", SOFT_HOLD_SYNTAX); @@ -774,11 +769,10 @@ SWITCH_STANDARD_APP(dtmf_unbind_function) SWITCH_STANDARD_APP(dtmf_bind_function) { char *argv[4] = { 0 }; - int argc; char *lbuf = NULL; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) == 4) { int kval = switch_dtmftoi(argv[0]); switch_bind_flag_t bind_flags = 0; @@ -849,14 +843,13 @@ SWITCH_STANDARD_APP(dtmf_bind_function) #define INTERCEPT_SYNTAX "[-bleg] " SWITCH_STANDARD_APP(intercept_function) { - int argc; char *argv[4] = { 0 }; char *mydata; char *uuid; switch_bool_t bleg = SWITCH_FALSE; if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) { - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) { if (!strcasecmp(argv[0], "-bleg")) { if (argv[1]) { uuid = argv[1]; @@ -1196,14 +1189,13 @@ SWITCH_STANDARD_APP(flush_dtmf_function) SWITCH_STANDARD_APP(transfer_function) { - int argc; char *argv[4] = { 0 }; char *mydata; int bleg = 0, both = 0; if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) { - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) { bleg = !strcasecmp(argv[0], "-bleg"); both = !strcasecmp(argv[0], "-both"); @@ -1233,12 +1225,11 @@ SWITCH_STANDARD_APP(transfer_function) SWITCH_STANDARD_APP(sched_transfer_function) { - int argc; char *argv[4] = { 0 }; char *mydata; if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) { - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 2) { time_t when; uint32_t id; char ids[80] = ""; @@ -1260,12 +1251,11 @@ SWITCH_STANDARD_APP(sched_transfer_function) SWITCH_STANDARD_APP(sched_hangup_function) { - int argc; char *argv[5] = { 0 }; char *mydata; if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) { - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) { time_t when; switch_call_cause_t cause = SWITCH_CAUSE_ALLOTTED_TIMEOUT; switch_bool_t bleg = SWITCH_FALSE; @@ -1298,12 +1288,11 @@ SWITCH_STANDARD_APP(sched_hangup_function) SWITCH_STANDARD_APP(sched_broadcast_function) { - int argc; char *argv[6] = { 0 }; char *mydata; if (!zstr(data) && (mydata = switch_core_session_strdup(session, data))) { - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 2) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 2) { time_t when; switch_media_flag_t flags = SMF_NONE; uint32_t id; @@ -1992,11 +1981,10 @@ SWITCH_STANDARD_APP(privacy_function) SWITCH_STANDARD_APP(strftime_function) { char *argv[2] = { 0 }; - int argc; char *lbuf; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0])))) > 1) { + && switch_separate_string(lbuf, '=', argv, (sizeof(argv) / sizeof(argv[0]))) > 1) { switch_size_t retsize; switch_time_exp_t tm; char date[80] = ""; @@ -2135,10 +2123,9 @@ SWITCH_STANDARD_API(presence_api_function) SWITCH_STANDARD_API(chat_api_function) { char *lbuf = NULL, *argv[5]; - int argc = 0; if (!zstr(cmd) && (lbuf = strdup(cmd)) - && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) >= 4) { + && 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_TRUE) == SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "Sent"); @@ -2270,7 +2257,6 @@ SWITCH_STANDARD_APP(bgsystem_session_function) SWITCH_STANDARD_APP(tone_detect_session_function) { char *argv[7] = { 0 }; - int argc; char *mydata = NULL; time_t to = 0; int hits = 0; @@ -2281,7 +2267,7 @@ SWITCH_STANDARD_APP(tone_detect_session_function) return; } - if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 2) { + if (switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])) < 2) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n"); return; } @@ -3226,14 +3212,13 @@ SWITCH_STANDARD_APP(stop_displace_session_function) SWITCH_STANDARD_APP(capture_function) { char *argv[3] = { 0 }; - int argc; switch_regex_t *re = NULL; int ovector[30] = {0}; char *lbuf; int proceed; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0])))) == 3) { + && switch_separate_string(lbuf, '|', argv, (sizeof(argv) / sizeof(argv[0]))) == 3) { if ((proceed = switch_regex_perform(argv[1], argv[2], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { switch_capture_regex(re, proceed, argv[1], ovector, argv[0], switch_regex_set_var_callback, session); } @@ -4587,11 +4572,10 @@ SWITCH_STANDARD_APP(wait_for_silence_function) { char *argv[5] = { 0 }; uint32_t thresh, silence_hits, listen_hits, timeout_ms = 0; - int argc; char *lbuf = NULL; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 4) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 4) { thresh = atoi(argv[0]); silence_hits = atoi(argv[1]); listen_hits = atoi(argv[2]); @@ -4615,11 +4599,10 @@ SWITCH_STANDARD_APP(detect_audio_function) { char *argv[4] = { 0 }; uint32_t thresh, audio_hits, timeout_ms = 0; - int argc; char *lbuf = NULL; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 3) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 3) { thresh = atoi(argv[0]); audio_hits = atoi(argv[1]); timeout_ms = atoi(argv[2]); @@ -4639,11 +4622,10 @@ SWITCH_STANDARD_APP(detect_silence_function) { char *argv[4] = { 0 }; uint32_t thresh, silence_hits, timeout_ms = 0; - int argc; char *lbuf = NULL; if (!zstr(data) && (lbuf = switch_core_session_strdup(session, data)) - && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 3) { + && switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 3) { thresh = atoi(argv[0]); silence_hits = atoi(argv[1]); timeout_ms = atoi(argv[2]); @@ -5070,11 +5052,12 @@ static switch_status_t next_file(switch_file_handle_t *handle) if (context->file && switch_test_flag(handle, SWITCH_FILE_DATA_SHORT)) { /* TODO handle other data type flags */ switch_size_t len; uint16_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; - switch_status_t stat; switch_file_handle_t fh = { 0 }; - if ((stat = switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate, - SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL)) == SWITCH_STATUS_SUCCESS) { + if (switch_core_file_open(&fh, context->file, handle->channels, handle->samplerate, + SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) { + switch_status_t stat; + do { len = SWITCH_RECOMMENDED_BUFFER_SIZE / handle->channels; if ((stat = switch_core_file_read(&fh, buf, &len)) == SWITCH_STATUS_SUCCESS) { From b6264e264c7aff3577d64d1623d2789bd6ee7286 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 7 Jan 2022 13:43:20 +0300 Subject: [PATCH 029/155] [mod_enum] Fix dead nested assignments --- src/mod/applications/mod_enum/mod_enum.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_enum/mod_enum.c b/src/mod/applications/mod_enum/mod_enum.c index de5804e1fd..2908a1eb1e 100644 --- a/src/mod/applications/mod_enum/mod_enum.c +++ b/src/mod/applications/mod_enum/mod_enum.c @@ -303,7 +303,6 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t char *argv[11] = { 0 }; int i, argc; char *pack[4] = { 0 }; - int packc; char *p; int order = 10; @@ -351,7 +350,7 @@ static void parse_naptr(const ldns_rr *naptr, const char *number, enum_record_t } - if ((packc = switch_split(packstr, '!', pack))) { + if (switch_split(packstr, '!', pack)) { regex = pack[1]; replace = pack[2]; } else { @@ -673,7 +672,6 @@ SWITCH_STANDARD_DIALPLAN(enum_dialplan_hunt) SWITCH_STANDARD_APP(enum_app_function) { - int argc = 0; char *argv[4] = { 0 }; char *mydata = NULL; char *dest = NULL, *root = NULL; @@ -691,7 +689,7 @@ SWITCH_STANDARD_APP(enum_app_function) return; } - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { dest = argv[0]; root = argv[1]; if (enum_lookup(root, dest, &results, channel, session) == SWITCH_STATUS_SUCCESS) { @@ -737,7 +735,6 @@ SWITCH_STANDARD_APP(enum_app_function) SWITCH_STANDARD_API(enum_api) { - int argc = 0; char *argv[4] = { 0 }; char *mydata = NULL; char *dest = NULL, *root = NULL; @@ -758,7 +755,7 @@ SWITCH_STANDARD_API(enum_api) abort(); } - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { dest = argv[0]; root = argv[1]; switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Looking up %s@%s\n", dest, root); @@ -814,7 +811,6 @@ static void do_load(void) SWITCH_STANDARD_API(enum_function) { - int argc = 0; char *argv[4] = { 0 }; enum_record_t *results, *rp; char *mydata = NULL; @@ -830,7 +826,7 @@ SWITCH_STANDARD_API(enum_function) return SWITCH_STATUS_SUCCESS; } - if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) { + if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) { dest = argv[0]; root = argv[1]; switch_assert(dest); From 1c83a92b7de9a5321a2601212b51841b893cef39 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Fri, 7 Jan 2022 14:53:45 +0300 Subject: [PATCH 030/155] [mod_video_filter] Fix dead nested assignments --- .../mod_video_filter/mod_video_filter.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/mod/applications/mod_video_filter/mod_video_filter.c b/src/mod/applications/mod_video_filter/mod_video_filter.c index 2f4d5d5bf7..7cf1f1dd0f 100644 --- a/src/mod/applications/mod_video_filter/mod_video_filter.c +++ b/src/mod/applications/mod_video_filter/mod_video_filter.c @@ -687,7 +687,6 @@ static switch_bool_t chromakey_bug_callback(switch_media_bug_t *bug, void *user_ SWITCH_STANDARD_APP(chromakey_start_function) { switch_media_bug_t *bug; - switch_status_t status; switch_channel_t *channel = switch_core_session_get_channel(session); char *argv[4] = { 0 }; int argc; @@ -721,7 +720,7 @@ SWITCH_STANDARD_APP(chromakey_start_function) switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock); - if ((status = switch_core_media_bug_add(session, function, NULL, chromakey_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_add(session, function, NULL, chromakey_bug_callback, context, 0, flags, &bug) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n"); switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); return; @@ -737,7 +736,6 @@ SWITCH_STANDARD_API(chromakey_api_function) switch_core_session_t *rsession = NULL; switch_channel_t *channel = NULL; switch_media_bug_t *bug; - switch_status_t status; chromakey_context_t *context; char *mycmd = NULL; int argc = 0; @@ -800,8 +798,8 @@ SWITCH_STANDARD_API(chromakey_api_function) switch_thread_rwlock_rdlock(MODULE_INTERFACE->rwlock); - if ((status = switch_core_media_bug_add(rsession, function, NULL, - chromakey_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_add(rsession, function, NULL, + chromakey_bug_callback, context, 0, flags, &bug) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Failure!\n"); switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); goto done; @@ -970,7 +968,6 @@ static switch_bool_t video_replace_bug_callback(switch_media_bug_t *bug, void *u SWITCH_STANDARD_APP(video_replace_start_function) { switch_media_bug_t *bug; - switch_status_t status; switch_channel_t *channel = switch_core_session_get_channel(session); switch_media_bug_flag_t flags = 0; const char *function = "video_replace"; @@ -1034,7 +1031,7 @@ SWITCH_STANDARD_APP(video_replace_start_function) return; } - if ((status = switch_core_media_bug_add(session, function, NULL, video_replace_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_add(session, function, NULL, video_replace_bug_callback, context, 0, flags, &bug) != SWITCH_STATUS_SUCCESS) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n"); switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); return; @@ -1050,7 +1047,6 @@ SWITCH_STANDARD_API(video_replace_api_function) switch_core_session_t *rsession = NULL; switch_channel_t *channel = NULL; switch_media_bug_t *bug; - switch_status_t status; video_replace_context_t *context; char *mycmd = NULL; int argc = 0; @@ -1150,8 +1146,8 @@ SWITCH_STANDARD_API(video_replace_api_function) goto done; } - if ((status = switch_core_media_bug_add(rsession, function, NULL, - video_replace_bug_callback, context, 0, flags, &bug)) != SWITCH_STATUS_SUCCESS) { + if (switch_core_media_bug_add(rsession, function, NULL, + video_replace_bug_callback, context, 0, flags, &bug) != SWITCH_STATUS_SUCCESS) { stream->write_function(stream, "-ERR Failure!\n"); switch_thread_rwlock_unlock(MODULE_INTERFACE->rwlock); goto done; From d38d83339dff4988dcdc89a6f21883b0436604d0 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 12 Jan 2022 14:37:56 +0300 Subject: [PATCH 031/155] [mod_say_hr,hu,pl,sv] Fix dead nested assignments --- src/mod/say/mod_say_hr/mod_say_hr.c | 4 ++-- src/mod/say/mod_say_hu/mod_say_hu.c | 2 +- src/mod/say/mod_say_pl/mod_say_pl.c | 2 +- src/mod/say/mod_say_sv/mod_say_sv.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) 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 f996c7424d..20582c01d4 100644 --- a/src/mod/say/mod_say_hr/mod_say_hr.c +++ b/src/mod/say/mod_say_hr/mod_say_hr.c @@ -751,7 +751,7 @@ static switch_status_t hr_say_time(switch_core_session_t *session, char *tosay, } if (say_date) { - say_year = say_month = say_day = say_dow = 1; + say_year = say_month = say_day = 1; } if (say_day) { @@ -1018,7 +1018,7 @@ static switch_status_t hr_say_money(switch_core_session_t *session, char *tosay, int zadnja_lipa = 0; int predzadnja_lipa = 0; - if (strlen(tosay) > 15 || !(tosay = strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1))) + if (strlen(tosay) > 15 || !strip_nonnumerics(tosay, sbuf, sizeof(sbuf)-1)) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Parse Error!\n"); return SWITCH_STATUS_GENERR; diff --git a/src/mod/say/mod_say_hu/mod_say_hu.c b/src/mod/say/mod_say_hu/mod_say_hu.c index 839fe47421..f49716fc20 100644 --- a/src/mod/say/mod_say_hu/mod_say_hu.c +++ b/src/mod/say/mod_say_hu/mod_say_hu.c @@ -325,7 +325,7 @@ static switch_status_t hu_say_time(switch_core_session_t *session, char *tosay, } if (say_date) { - say_year = say_month = say_day = say_dow = 1; + say_year = say_month = say_day = 1; } if (say_year) { diff --git a/src/mod/say/mod_say_pl/mod_say_pl.c b/src/mod/say/mod_say_pl/mod_say_pl.c index 4030b96391..35e2adb608 100644 --- a/src/mod/say/mod_say_pl/mod_say_pl.c +++ b/src/mod/say/mod_say_pl/mod_say_pl.c @@ -385,7 +385,7 @@ static switch_status_t pl_say_time(switch_say_file_handle_t *sh, char *tosay, sw } if (say_date) { - say_year = say_month = say_day = say_dow = 1; + say_year = say_month = say_day = 1; } if (say_day) { diff --git a/src/mod/say/mod_say_sv/mod_say_sv.c b/src/mod/say/mod_say_sv/mod_say_sv.c index d495ac91f3..c1d1b63678 100644 --- a/src/mod/say/mod_say_sv/mod_say_sv.c +++ b/src/mod/say/mod_say_sv/mod_say_sv.c @@ -429,7 +429,7 @@ static switch_status_t sv_say_time(switch_say_file_handle_t *sh, char *tosay, sw } if (say_date) { - say_year = say_month = say_day = say_dow = 1; + say_year = say_month = say_day = 1; } if (say_month) { From 1f9305098d4d9b3b56512997ef80ba72390f0aa5 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 5 Jan 2022 01:49:16 +0300 Subject: [PATCH 032/155] [mod_xml_ldap] Fix potential memory leaks in xml_ldap_search() --- src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c b/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c index eecdb49549..a28d91a44a 100644 --- a/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c +++ b/src/mod/xml_int/mod_xml_ldap/mod_xml_ldap.c @@ -721,8 +721,10 @@ static switch_xml_t xml_ldap_search(const char *section, const char *tag_name, c case XML_LDAP_DIRECTORY: switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "from cb got %s=%s\n", hi->name, hi->value); if (!strncmp(hi->name, "user", strlen(hi->name))) { + switch_safe_free(dir_exten); dir_exten = strdup(hi->value); } else if (!strncmp(hi->name, "domain", strlen(hi->name))) { + switch_safe_free(dir_domain); dir_domain = strdup(hi->value); } break; From 884917cb117c8ecbd8d6c6dbe939130841e8835b Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 12 Jan 2022 14:34:22 +0300 Subject: [PATCH 033/155] [mod_xml_scgi] Fix dead initialization in mod_xml_scgi_shutdown() --- 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 e346230efe..63306c76a3 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 @@ -406,7 +406,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_scgi_shutdown) if (bp->thread) { switch_status_t st; scgi_handle_t handle = { 0 }; - unsigned char buf[16336] = ""; + unsigned char buf[16336]; int x = 3; scgi_add_param(&handle, "REQUEST_METHOD", "POST"); From 19a7debc1b44b48e072482584f844acbde119091 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Sat, 8 Jan 2022 12:09:53 +0300 Subject: [PATCH 034/155] [mod_sofia] Fix dead nested assignments --- src/mod/endpoints/mod_sofia/mod_sofia.c | 9 ++++----- src/mod/endpoints/mod_sofia/sofia.c | 14 ++++++-------- src/mod/endpoints/mod_sofia/sofia_glue.c | 3 +-- src/mod/endpoints/mod_sofia/sofia_media.c | 4 +--- src/mod/endpoints/mod_sofia/sofia_presence.c | 4 ++-- 5 files changed, 14 insertions(+), 20 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 8363038bba..97f735189d 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -918,7 +918,7 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session) } if (sofia_test_flag(tech_pvt, TFLAG_NAT) || - (val = switch_channel_get_variable(channel, "sip-force-contact")) || + switch_channel_get_variable(channel, "sip-force-contact") || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) { sticky = tech_pvt->record_route; session_timeout = SOFIA_NAT_SESSION_TIMEOUT; @@ -2615,7 +2615,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi if (sofia_test_flag(tech_pvt, TFLAG_NAT) || - (val = switch_channel_get_variable(channel, "sip-force-contact")) || + switch_channel_get_variable(channel, "sip-force-contact") || ((val = switch_channel_get_variable(channel, "sip_sticky_contact")) && switch_true(val))) { sticky = tech_pvt->record_route; switch_channel_set_variable(channel, "sip_nat_detected", "true"); @@ -4389,7 +4389,6 @@ SWITCH_STANDARD_API(sofia_gateway_data_function) { char *argv[4]; char *mydata; - int argc; sofia_gateway_t *gateway; char *gwname, *param, *varname; const char *val = NULL; @@ -4402,7 +4401,7 @@ SWITCH_STANDARD_API(sofia_gateway_data_function) return SWITCH_STATUS_FALSE; } - if (!(argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) || !argv[0]) { + if (!switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) || !argv[0]) { goto end; } @@ -4679,7 +4678,7 @@ static int protect_dest_uri(switch_caller_profile_t *cp) switch_size_t enclen = 0; int mod = 0; - if (!(e = strchr(p, '@'))) { + if (!strchr(p, '@')) { return 0; } diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 09d877527a..82f990d906 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -949,11 +949,11 @@ void sofia_handle_sip_i_bye(switch_core_session_t *session, int status, if (switch_channel_test_flag(tech_pvt->channel, CF_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) { + /* Checking ttl */ + if (switch_core_media_bug_count(bargee_session, "eavesdrop") == 1) { if (switch_core_session_check_interface(bargee_session, sofia_endpoint_interface)) { switch_channel_clear_flag(switch_core_session_get_channel(bargee_session), CF_SLA_BARGE); } @@ -3784,7 +3784,7 @@ static void parse_gateways(sofia_profile_t *profile, switch_xml_t gateways_tag, } switch_mutex_lock(mod_sofia_globals.hash_mutex); - if ((gp = switch_core_hash_find(mod_sofia_globals.gateway_hash, name)) && (gp = switch_core_hash_find(mod_sofia_globals.gateway_hash, pkey)) && !gp->deleted) { + if (switch_core_hash_find(mod_sofia_globals.gateway_hash, name) && (gp = switch_core_hash_find(mod_sofia_globals.gateway_hash, pkey)) && !gp->deleted) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring duplicate gateway '%s'\n", name); switch_mutex_unlock(mod_sofia_globals.hash_mutex); free(pkey); @@ -6950,7 +6950,7 @@ static void sofia_handle_sip_r_invite(switch_core_session_t *session, int status } if (sofia_test_pflag(profile, PFLAG_MANUAL_REDIRECT)) { - if (!(v = switch_channel_get_variable(channel, "outbound_redirect_info"))) { + if (!switch_channel_get_variable(channel, "outbound_redirect_info")) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Redirect: Transfering to %s %s %s\n", p_contact->m_url->url_user, sip_redirect_dialplan, sip_redirect_context); @@ -9928,7 +9928,6 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t char *cmd = strdup(sip->sip_payload->pl_data); char *arg; switch_stream_handle_t stream = { 0 }; - switch_status_t status; switch_assert(cmd); SWITCH_STANDARD_STREAM(stream); @@ -9938,7 +9937,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t *arg++ = '\0'; } - if ((status = switch_api_execute(cmd, arg, NULL, &stream)) == SWITCH_STATUS_SUCCESS) { + if (switch_api_execute(cmd, arg, NULL, &stream) == SWITCH_STATUS_SUCCESS) { nua_respond(nh, SIP_200_OK, SIPTAG_CONTENT_TYPE_STR("freeswitch/api-response"), SIPTAG_PAYLOAD_STR(stream.data), NUTAG_WITH_THIS_MSG(de->data->e_msg), TAG_IF(!zstr(session_id_header), SIPTAG_HEADER_STR(session_id_header)), @@ -10959,9 +10958,8 @@ void sofia_handle_sip_i_invite(switch_core_session_t *session, nua_t *nua, sofia if (x1 == 0) { switch_channel_set_variable(channel, "sip_req_user", argv1[0]); } else { - int argc2 = 0; char *argv2[2] = { 0 }; - if ((argc2 = switch_separate_string(argv1[x1], '=', argv2, (sizeof(argv2) / sizeof(argv2[0])))) == 2) { + if (switch_separate_string(argv1[x1], '=', argv2, (sizeof(argv2) / sizeof(argv2[0]))) == 2) { char *var_name = NULL; var_name = switch_mprintf("sip_invite_%s", argv2[0]); switch_channel_set_variable(channel, var_name, argv2[1]); diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 955b75f899..35704b44ab 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -908,7 +908,6 @@ char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix const char *exclude_regex = NULL; switch_regex_t *re = NULL; int ovector[30] = {0}; - int proceed; exclude_regex = switch_channel_get_variable(channel, "exclude_outgoing_extra_header"); SWITCH_STANDARD_STREAM(stream); @@ -922,7 +921,7 @@ char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix } if (!strncasecmp(name, prefix, strlen(prefix))) { - if ( !exclude_regex || !(proceed = switch_regex_perform(name, exclude_regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { + if ( !exclude_regex || !(/*proceed*/ switch_regex_perform(name, exclude_regex, &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) { const char *hname = name + strlen(prefix); stream.write_function(&stream, "%s: %s\r\n", hname, value); switch_regex_safe_free(re); diff --git a/src/mod/endpoints/mod_sofia/sofia_media.c b/src/mod/endpoints/mod_sofia/sofia_media.c index 74b4d4a836..bb10a7f579 100644 --- a/src/mod/endpoints/mod_sofia/sofia_media.c +++ b/src/mod/endpoints/mod_sofia/sofia_media.c @@ -71,8 +71,6 @@ switch_status_t sofia_media_activate_rtp(private_object_t *tech_pvt) switch_status_t sofia_media_tech_media(private_object_t *tech_pvt, const char *r_sdp, switch_sdp_type_t type) { - uint8_t match = 0; - switch_assert(tech_pvt != NULL); switch_assert(r_sdp != NULL); @@ -80,7 +78,7 @@ switch_status_t sofia_media_tech_media(private_object_t *tech_pvt, const char *r return SWITCH_STATUS_FALSE; } - if ((match = sofia_media_negotiate_sdp(tech_pvt->session, r_sdp, type))) { + if (sofia_media_negotiate_sdp(tech_pvt->session, r_sdp, type)) { if (switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0) != SWITCH_STATUS_SUCCESS) { return SWITCH_STATUS_FALSE; } diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index ce04b2b46f..828f665b6c 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -482,7 +482,7 @@ struct mwi_helper { static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) { - char *account, *dup_account, *yn, *host = NULL, *user; + char *account, *dup_account, *host = NULL, *user; char *sql; sofia_profile_t *profile = NULL; switch_stream_handle_t stream = { 0 }; @@ -500,7 +500,7 @@ static void actual_sofia_presence_mwi_event_handler(switch_event_t *event) return; } - if (!(yn = switch_event_get_header(event, "mwi-messages-waiting"))) { + if (!switch_event_get_header(event, "mwi-messages-waiting")) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing required Header 'MWI-Messages-Waiting'\n"); return; } From 716a21b0b55185a122653f8687dbdaa7eaeeb520 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 6 Jan 2022 20:16:26 +0300 Subject: [PATCH 035/155] [mod_callcenter] Fix dead nested assignments in cc_config_api_function --- src/mod/applications/mod_callcenter/mod_callcenter.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_callcenter/mod_callcenter.c b/src/mod/applications/mod_callcenter/mod_callcenter.c index cba6dc84f4..7c625126e4 100644 --- a/src/mod/applications/mod_callcenter/mod_callcenter.c +++ b/src/mod/applications/mod_callcenter/mod_callcenter.c @@ -3820,8 +3820,7 @@ SWITCH_STANDARD_API(cc_config_api_function) goto done; } else { const char *queue_name = argv[0 + initial_argc]; - cc_queue_t *queue = NULL; - if ((queue = load_queue(queue_name, SWITCH_TRUE, SWITCH_TRUE, NULL))) { + if (load_queue(queue_name, SWITCH_TRUE, SWITCH_TRUE, NULL)) { stream->write_function(stream, "%s", "+OK\n"); } else { stream->write_function(stream, "%s", "-ERR Invalid Queue not found!\n"); @@ -3845,9 +3844,8 @@ SWITCH_STANDARD_API(cc_config_api_function) goto done; } else { const char *queue_name = argv[0 + initial_argc]; - cc_queue_t *queue = NULL; destroy_queue(queue_name); - if ((queue = load_queue(queue_name, SWITCH_TRUE, SWITCH_TRUE, NULL))) { + if (load_queue(queue_name, SWITCH_TRUE, SWITCH_TRUE, NULL)) { stream->write_function(stream, "%s", "+OK\n"); } else { stream->write_function(stream, "%s", "-ERR Invalid Queue not found!\n"); From f3c7c4d445ce0c26ef51b31328fe009f31b95694 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 5 Jan 2022 02:15:42 +0300 Subject: [PATCH 036/155] [Core] scan-build: Fix false-positive bad free by switch_must_realloc() in switch_xml_proc_inst() --- src/switch_xml.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/switch_xml.c b/src/switch_xml.c index 1a3ecef9b6..108473918f 100644 --- a/src/switch_xml.c +++ b/src/switch_xml.c @@ -795,7 +795,7 @@ static void switch_xml_proc_inst(switch_xml_root_t root, char *s, switch_size_t return; } - if (!root->pi || !root->pi[0]) { + if (root->pi == (char ***)(SWITCH_XML_NIL) || !root->pi || !root->pi[0]) { root->pi = (char ***) switch_must_malloc(sizeof(char **)); *(root->pi) = NULL; /* first pi */ } From cd86de2f1f38ef4cfab7dc9cdcedd6bcbc8506ef Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 11 Jan 2022 22:40:17 +0300 Subject: [PATCH 037/155] [mod_av] Fix dead nested assignments --- src/mod/applications/mod_av/avformat.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mod/applications/mod_av/avformat.c b/src/mod/applications/mod_av/avformat.c index da7d543fa7..a791665c08 100644 --- a/src/mod/applications/mod_av/avformat.c +++ b/src/mod/applications/mod_av/avformat.c @@ -742,7 +742,7 @@ GCC_DIAG_ON(deprecated-declarations) av_opt_set_int(mst->resample_ctx, "out_sample_fmt", c->sample_fmt, 0); av_opt_set_int(mst->resample_ctx, "out_channel_layout", c->channel_layout, 0); - if ((ret = swr_init(mst->resample_ctx)) < 0) { + if (swr_init(mst->resample_ctx) < 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to initialize the resampling context\n"); av_free(mst->resample_ctx); mst->resample_ctx = NULL; @@ -2003,7 +2003,6 @@ static switch_status_t av_file_truncate(switch_file_handle_t *handle, int64_t of static switch_status_t av_file_write(switch_file_handle_t *handle, void *data, size_t *len) { - uint32_t datalen = 0; switch_status_t status = SWITCH_STATUS_SUCCESS; // uint8_t buf[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }, *bp = buf; @@ -2095,7 +2094,7 @@ GCC_DIAG_ON(deprecated-declarations) } } - while ((inuse = switch_buffer_inuse(context->audio_buffer)) >= bytes) { + while (switch_buffer_inuse(context->audio_buffer) >= bytes) { AVPacket pkt[2] = { {0} }; int got_packet[2] = {0}; int j = 0, ret = -1, audio_stream_count = 1; From 1e5e3216d8325faa7677d2324b83ebe682ec8787 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 6 Jan 2022 20:54:33 +0300 Subject: [PATCH 038/155] [mod_conference] Fix dead nested assignments --- src/mod/applications/mod_conference/conference_api.c | 3 +-- src/mod/applications/mod_conference/conference_event.c | 4 ++-- src/mod/applications/mod_conference/conference_member.c | 2 +- src/mod/applications/mod_conference/mod_conference.c | 5 ++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/mod/applications/mod_conference/conference_api.c b/src/mod/applications/mod_conference/conference_api.c index bd24484928..8bcfc5862f 100644 --- a/src/mod/applications/mod_conference/conference_api.c +++ b/src/mod/applications/mod_conference/conference_api.c @@ -2020,7 +2020,6 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit } if (!strncasecmp(argv[2], "group", 5)) { - layout_group_t *lg = NULL; int xx = 4; if ((group_name = strchr(argv[2], ':'))) { @@ -2034,7 +2033,7 @@ switch_status_t conference_api_sub_vid_layout(conference_obj_t *conference, swit stream->write_function(stream, "-ERR Group name not specified.\n"); return SWITCH_STATUS_SUCCESS; } else { - if (((lg = switch_core_hash_find(conference->layout_group_hash, group_name)))) { + if (switch_core_hash_find(conference->layout_group_hash, group_name)) { if (conference_utils_test_flag(conference, CFLAG_PERSONAL_CANVAS)) { stream->write_function(stream, "-ERR Change personal canvas to layout group [%s]\n", group_name); conference->video_layout_group = switch_core_strdup(conference->pool, group_name); diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index 23adb127a8..a88a5feab9 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -305,7 +305,7 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json } else if (!strcasecmp(action, "shift-click-layer")) { } else if (!strcasecmp(action, "reset-layer") || !strcasecmp(action, "layer-pan-x") || !strcasecmp(action, "layer-pan-y")) { cJSON *v; - int layer_id = 0, canvas_id = 0, metric = 0, absolute = 0; + int layer_id = 0, canvas_id = 0, metric = 0; const char *i = "i", *xy = ""; if ((v = cJSON_GetObjectItem(data, "layerID"))) { @@ -321,7 +321,7 @@ void conference_event_mod_channel_handler(const char *event_channel, cJSON *json } if ((v = cJSON_GetObjectItem(data, "absolute"))) { - if ((absolute = v->valueint)) { + if (v->valueint) { i = ""; } } diff --git a/src/mod/applications/mod_conference/conference_member.c b/src/mod/applications/mod_conference/conference_member.c index 6df96fca97..6112a2890c 100644 --- a/src/mod/applications/mod_conference/conference_member.c +++ b/src/mod/applications/mod_conference/conference_member.c @@ -592,7 +592,7 @@ void conference_member_add_file_data(conference_member_t *member, int16_t *data, if (switch_core_speech_read_tts(member->fnode->sh, file_frame, &speech_len, &flags) == SWITCH_STATUS_SUCCESS) { file_sample_len = file_data_len / 2 / member->conference->channels; } else { - file_sample_len = file_data_len = 0; + file_sample_len = 0; } } else if (member->fnode->type == NODE_TYPE_FILE) { switch_core_file_read(&member->fnode->fh, file_frame, &file_sample_len); diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index d6cdab6ef7..619cd8c4a6 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -490,7 +490,7 @@ void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t *thread, void *ob } else { - file_sample_len = file_data_len = 0; + file_sample_len = 0; } } else if (conference->fnode->type == NODE_TYPE_FILE) { switch_core_file_read(&conference->fnode->fh, file_frame, &file_sample_len); @@ -1891,7 +1891,6 @@ switch_status_t conference_text_thread_callback(switch_core_session_t *session, /* Application interface function that is called from the dialplan to join the channel to a conference */ SWITCH_STANDARD_APP(conference_function) { - switch_codec_t *read_codec = NULL; //uint32_t flags = 0; conference_member_t member = { 0 }; conference_obj_t *conference = NULL; @@ -1931,7 +1930,7 @@ SWITCH_STANDARD_APP(conference_function) } /* Save the original read codec. */ - if (!(read_codec = switch_core_session_get_read_codec(session))) { + if (!switch_core_session_get_read_codec(session)) { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Channel has no media!\n"); goto end; } From 372182fc8b92f66484158c3fc8b0634d0fe678fb Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Tue, 9 Aug 2022 01:08:40 +0300 Subject: [PATCH 039/155] [Testing] Enable scan-build 11 on Drone CI --- .drone.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.drone.yml b/.drone.yml index efef5de4da..3d4c06f05a 100644 --- a/.drone.yml +++ b/.drone.yml @@ -4,14 +4,14 @@ name: unit-tests steps: - name: bootstrap - image: signalwire/freeswitch-public-base + image: signalwire/freeswitch-public-base:bullseye pull: always commands: - cat /proc/sys/kernel/core_pattern - ./bootstrap.sh -j - name: configure - image: signalwire/freeswitch-public-base + image: signalwire/freeswitch-public-base:bullseye pull: always environment: REPOTOKEN: @@ -33,7 +33,7 @@ steps: - ./configure --enable-address-sanitizer - name: build - image: signalwire/freeswitch-public-base + image: signalwire/freeswitch-public-base:bullseye pull: always environment: REPOTOKEN: @@ -50,7 +50,7 @@ steps: - ./build.sh - name: run-tests - image: signalwire/freeswitch-public-base + image: signalwire/freeswitch-public-base:bullseye pull: always environment: REPOTOKEN: @@ -97,13 +97,13 @@ name: scan-build steps: - name: bootstrap - image: signalwire/freeswitch-public-base + image: signalwire/freeswitch-public-base:bullseye pull: always commands: - ./bootstrap.sh -j - name: configure - image: signalwire/freeswitch-public-base + image: signalwire/freeswitch-public-base:bullseye pull: always environment: REPOTOKEN: @@ -140,7 +140,7 @@ steps: - ./configure - name: scan-build - image: signalwire/freeswitch-public-base + image: signalwire/freeswitch-public-base:bullseye pull: always environment: REPOTOKEN: @@ -152,7 +152,7 @@ steps: - export REPOTOKEN='' - rm -rf /etc/apt/auth.conf - mkdir -p scan-build - - echo '#!/bin/bash\nscan-build-7 -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./scan-build-status.txt\n' > scan.sh + - echo '#!/bin/bash\nscan-build-11 -o ./scan-build/ make -j`nproc --all` |& tee ./scan-build-result.txt\nexitstatus=$${PIPESTATUS[0]}\necho $$exitstatus > ./scan-build-status.txt\n' > scan.sh - chmod +x scan.sh - ./scan.sh - exitstatus=`cat ./scan-build-status.txt` @@ -178,6 +178,6 @@ trigger: --- kind: signature -hmac: 8fd652a876c5578617608e516c37c156219c62a29b2f14114e876745a1aab597 +hmac: 96f5b3ecee6a6b61fa39bc748bd68295be30eff4768dcfc53091dd448d3ee28d ... From f538fd3d7bdfb3d83dcb2b9d39b5db9180a7770a Mon Sep 17 00:00:00 2001 From: agree Date: Sun, 21 Aug 2022 01:16:36 -0400 Subject: [PATCH 040/155] [mod_say_en] change epoch to 64 bit int handle time after 2038-01-18 22:14:07 --- src/mod/say/mod_say_en/mod_say_en.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mod/say/mod_say_en/mod_say_en.c b/src/mod/say/mod_say_en/mod_say_en.c index 5ea52357dd..1f8d6e017a 100644 --- a/src/mod/say/mod_say_en/mod_say_en.c +++ b/src/mod/say/mod_say_en/mod_say_en.c @@ -196,7 +196,7 @@ static switch_status_t en_say_general_count(switch_say_file_handle_t *sh, char * static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, switch_say_args_t *say_args) { - int32_t t = 0; + int64_t t = 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; @@ -287,7 +287,7 @@ static switch_status_t en_say_time(switch_say_file_handle_t *sh, char *tosay, sw if (strchr(tosay, ':')) { switch_time_t tme = switch_str_time(tosay); - t = (int32_t) ((tme) / (int64_t) (1000000)); + t = (int64_t) ((tme) / (int64_t) (1000000)); target = switch_time_make(t, 0); target_now = switch_micro_time_now(); From a8dee4b2ffe647f0905dc7083a98559a7da1985c Mon Sep 17 00:00:00 2001 From: Ruslan <80762065+ruslan-voip@users.noreply.github.com> Date: Tue, 23 Aug 2022 17:07:55 +0200 Subject: [PATCH 041/155] [mod_conference] file descriptor stays open Solution: don't even start to play file if conference is not running. Co-authored-by: Ruslan Andronov --- src/mod/applications/mod_conference/conference_file.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mod/applications/mod_conference/conference_file.c b/src/mod/applications/mod_conference/conference_file.c index 8f0dc1d8b7..b42599ef6d 100644 --- a/src/mod/applications/mod_conference/conference_file.c +++ b/src/mod/applications/mod_conference/conference_file.c @@ -164,6 +164,11 @@ switch_status_t conference_file_play(conference_obj_t *conference, char *file, u switch_assert(conference != NULL); + if (!conference_utils_test_flag(conference, CFLAG_RUNNING)) { + return SWITCH_STATUS_FALSE; + } + + if (zstr(file)) { return SWITCH_STATUS_NOTFOUND; } From a1d2f83104c3a80127dcbc00388099a56df0e0ef Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Thu, 25 Aug 2022 20:14:47 +0300 Subject: [PATCH 042/155] [Core] ODBC: Add odbc-skip-autocommit-flip switch param. --- conf/vanilla/autoload_configs/switch.conf.xml | 3 +++ src/include/switch_odbc.h | 1 + src/switch_core.c | 4 ++++ src/switch_odbc.c | 11 +++++++++++ 4 files changed, 19 insertions(+) diff --git a/conf/vanilla/autoload_configs/switch.conf.xml b/conf/vanilla/autoload_configs/switch.conf.xml index 714b62c54c..ba54eb7fce 100644 --- a/conf/vanilla/autoload_configs/switch.conf.xml +++ b/conf/vanilla/autoload_configs/switch.conf.xml @@ -184,6 +184,9 @@ + + + | - * +--------+---------------------+ - * | F R E E A R E A | - * +--------------+---------------+ - * | <---- - - - | data | - * +--------+-----+----+----------+ - * | key | data | key | - * +--------+----------+----------+ - * - * calculating the offsets for free area: if the number - * of entries (ino[0]) is zero, the offset to the END of - * the free area is the block size. Otherwise, it is the - * nth (ino[ino[0]]) entry's offset. - */ - -int -fitpair(pag, need) -char *pag; -int need; -{ - register int n; - register int off; - register int avail; - register short *ino = (short *) pag; - - off = ((n = ino[0]) > 0) ? ino[n] : PBLKSIZ; - avail = off - (n + 1) * sizeof(short); - need += 2 * sizeof(short); - - debug(("avail %d need %d\n", avail, need)); - - return need <= avail; -} - -void -putpair(pag, key, val) -char *pag; -apr_sdbm_datum_t key; -apr_sdbm_datum_t val; -{ - register int n; - register int off; - register short *ino = (short *) pag; - - off = ((n = ino[0]) > 0) ? ino[n] : PBLKSIZ; -/* - * enter the key first - */ - off -= key.dsize; - (void) memcpy(pag + off, key.dptr, key.dsize); - ino[n + 1] = off; -/* - * now the data - */ - off -= val.dsize; - (void) memcpy(pag + off, val.dptr, val.dsize); - ino[n + 2] = off; -/* - * adjust item count - */ - ino[0] += 2; -} - -apr_sdbm_datum_t -getpair(pag, key) -char *pag; -apr_sdbm_datum_t key; -{ - register int i; - register int n; - apr_sdbm_datum_t val; - register short *ino = (short *) pag; - - if ((n = ino[0]) == 0) - return sdbm_nullitem; - - if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0) - return sdbm_nullitem; - - val.dptr = pag + ino[i + 1]; - val.dsize = ino[i] - ino[i + 1]; - return val; -} - -int -duppair(pag, key) -char *pag; -apr_sdbm_datum_t key; -{ - register short *ino = (short *) pag; - return ino[0] > 0 && seepair(pag, ino[0], key.dptr, key.dsize) > 0; -} - -apr_sdbm_datum_t -getnkey(pag, num) -char *pag; -int num; -{ - apr_sdbm_datum_t key; - register int off; - register short *ino = (short *) pag; - - num = num * 2 - 1; - if (ino[0] == 0 || num > ino[0]) - return sdbm_nullitem; - - off = (num > 1) ? ino[num - 1] : PBLKSIZ; - - key.dptr = pag + ino[num]; - key.dsize = off - ino[num]; - - return key; -} - -int -delpair(pag, key) -char *pag; -apr_sdbm_datum_t key; -{ - register int n; - register int i; - register short *ino = (short *) pag; - - if ((n = ino[0]) == 0) - return 0; - - if ((i = seepair(pag, n, key.dptr, key.dsize)) == 0) - return 0; -/* - * found the key. if it is the last entry - * [i.e. i == n - 1] we just adjust the entry count. - * hard case: move all data down onto the deleted pair, - * shift offsets onto deleted offsets, and adjust them. - * [note: 0 < i < n] - */ - if (i < n - 1) { - register int m; - register char *dst = pag + (i == 1 ? PBLKSIZ : ino[i - 1]); - register char *src = pag + ino[i + 1]; - register int zoo = dst - src; - - debug(("free-up %d ", zoo)); -/* - * shift data/keys down - */ - m = ino[i + 1] - ino[n]; - -#undef DUFF /* just use memmove. it should be plenty fast. */ -#ifdef DUFF -#define MOVB *--dst = *--src - - if (m > 0) { - register int loop = (m + 8 - 1) >> 3; - - switch (m & (8 - 1)) { - case 0: do { - MOVB; case 7: MOVB; - case 6: MOVB; case 5: MOVB; - case 4: MOVB; case 3: MOVB; - case 2: MOVB; case 1: MOVB; - } while (--loop); - } - } -#else - dst -= m; - src -= m; - memmove(dst, src, m); -#endif - -/* - * adjust offset index up - */ - while (i < n - 1) { - ino[i] = ino[i + 2] + zoo; - i++; - } - } - ino[0] -= 2; - return 1; -} - -/* - * search for the key in the page. - * return offset index in the range 0 < i < n. - * return 0 if not found. - */ -static int -seepair(pag, n, key, siz) -char *pag; -register int n; -register char *key; -register int siz; -{ - register int i; - register int off = PBLKSIZ; - register short *ino = (short *) pag; - - for (i = 1; i < n; i += 2) { - if (siz == off - ino[i] && - memcmp(key, pag + ino[i], siz) == 0) - return i; - off = ino[i + 1]; - } - return 0; -} - -void -splpage(pag, new, sbit) -char *pag; -char *new; -long sbit; -{ - apr_sdbm_datum_t key; - apr_sdbm_datum_t val; - - register int n; - register int off = PBLKSIZ; - char cur[PBLKSIZ]; - register short *ino = (short *) cur; - - (void) memcpy(cur, pag, PBLKSIZ); - (void) memset(pag, 0, PBLKSIZ); - (void) memset(new, 0, PBLKSIZ); - - n = ino[0]; - for (ino++; n > 0; ino += 2) { - key.dptr = cur + ino[0]; - key.dsize = off - ino[0]; - val.dptr = cur + ino[1]; - val.dsize = ino[0] - ino[1]; -/* - * select the page pointer (by looking at sbit) and insert - */ - (void) putpair((exhash(key) & sbit) ? new : pag, key, val); - - off = ino[1]; - n -= 2; - } - - debug(("%d split %d/%d\n", ((short *) cur)[0] / 2, - ((short *) new)[0] / 2, - ((short *) pag)[0] / 2)); -} - -/* - * check page sanity: - * number of entries should be something - * reasonable, and all offsets in the index should be in order. - * this could be made more rigorous. - */ -int -chkpage(pag) -char *pag; -{ - register int n; - register int off; - register short *ino = (short *) pag; - - if ((n = ino[0]) < 0 || n > PBLKSIZ / sizeof(short)) - return 0; - - if (n > 0) { - off = PBLKSIZ; - for (ino++; n > 0; ino += 2) { - if (ino[0] > off || ino[1] > off || - ino[1] > ino[0]) - return 0; - off = ino[1]; - n -= 2; - } - } - return 1; -} diff --git a/libs/apr-util/dbm/sdbm/sdbm_pair.h b/libs/apr-util/dbm/sdbm/sdbm_pair.h deleted file mode 100644 index 51d1065871..0000000000 --- a/libs/apr-util/dbm/sdbm/sdbm_pair.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef SDBM_PAIR_H -#define SDBM_PAIR_H - -/* Mini EMBED (pair.c) */ -#define chkpage apu__sdbm_chkpage -#define delpair apu__sdbm_delpair -#define duppair apu__sdbm_duppair -#define fitpair apu__sdbm_fitpair -#define getnkey apu__sdbm_getnkey -#define getpair apu__sdbm_getpair -#define putpair apu__sdbm_putpair -#define splpage apu__sdbm_splpage - -int fitpair(char *, int); -void putpair(char *, apr_sdbm_datum_t, apr_sdbm_datum_t); -apr_sdbm_datum_t getpair(char *, apr_sdbm_datum_t); -int delpair(char *, apr_sdbm_datum_t); -int chkpage (char *); -apr_sdbm_datum_t getnkey(char *, int); -void splpage(char *, char *, long); -int duppair(char *, apr_sdbm_datum_t); - -#endif /* SDBM_PAIR_H */ - diff --git a/libs/apr-util/dbm/sdbm/sdbm_private.h b/libs/apr-util/dbm/sdbm/sdbm_private.h deleted file mode 100644 index a1ad29d471..0000000000 --- a/libs/apr-util/dbm/sdbm/sdbm_private.h +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * sdbm - ndbm work-alike hashed database library - * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - */ - -#ifndef SDBM_PRIVATE_H -#define SDBM_PRIVATE_H - -#include "apr.h" -#include "apr_pools.h" -#include "apr_file_io.h" -#include "apr_errno.h" /* for apr_status_t */ - -#if 0 -/* if the block/page size is increased, it breaks perl apr_sdbm_t compatibility */ -#define DBLKSIZ 16384 -#define PBLKSIZ 8192 -#define PAIRMAX 8008 /* arbitrary on PBLKSIZ-N */ -#else -#define DBLKSIZ 4096 -#define PBLKSIZ 1024 -#define PAIRMAX 1008 /* arbitrary on PBLKSIZ-N */ -#endif -#define SPLTMAX 10 /* maximum allowed splits */ - -/* for apr_sdbm_t.flags */ -#define SDBM_RDONLY 0x1 /* data base open read-only */ -#define SDBM_SHARED 0x2 /* data base open for sharing */ -#define SDBM_SHARED_LOCK 0x4 /* data base locked for shared read */ -#define SDBM_EXCLUSIVE_LOCK 0x8 /* data base locked for write */ - -struct apr_sdbm_t { - apr_pool_t *pool; - apr_file_t *dirf; /* directory file descriptor */ - apr_file_t *pagf; /* page file descriptor */ - apr_int32_t flags; /* status/error flags, see below */ - long maxbno; /* size of dirfile in bits */ - long curbit; /* current bit number */ - long hmask; /* current hash mask */ - long blkptr; /* current block for nextkey */ - int keyptr; /* current key for nextkey */ - long blkno; /* current page to read/write */ - long pagbno; /* current page in pagbuf */ - char pagbuf[PBLKSIZ]; /* page file block buffer */ - long dirbno; /* current block in dirbuf */ - char dirbuf[DBLKSIZ]; /* directory file block buffer */ - int lckcnt; /* number of calls to sdbm_lock */ -}; - - -#define sdbm_hash apu__sdbm_hash -#define sdbm_nullitem apu__sdbm_nullitem - -extern const apr_sdbm_datum_t sdbm_nullitem; - -long sdbm_hash(const char *str, int len); - -/* - * zero the cache - */ -#define SDBM_INVALIDATE_CACHE(db, finfo) \ - do { db->dirbno = (!finfo.size) ? 0 : -1; \ - db->pagbno = -1; \ - db->maxbno = (long)(finfo.size * BYTESIZ); \ - } while (0); - -#endif /* SDBM_PRIVATE_H */ diff --git a/libs/apr-util/dbm/sdbm/sdbm_tune.h b/libs/apr-util/dbm/sdbm/sdbm_tune.h deleted file mode 100644 index 92ed6a253c..0000000000 --- a/libs/apr-util/dbm/sdbm/sdbm_tune.h +++ /dev/null @@ -1,40 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * sdbm - ndbm work-alike hashed database library - * tuning and portability constructs [not nearly enough] - * author: oz@nexus.yorku.ca - */ - -#ifndef SDBM_TUNE_H -#define SDBM_TUNE_H - -#include "apr_errno.h" - -/* ### this might be better off as sizeof(char *) */ -#define BYTESIZ 8 - -/* - * misc - */ -#ifdef DEBUG -#define debug(x) printf x -#else -#define debug(x) -#endif - -#endif /* SDBM_TUNE_H */ diff --git a/libs/apr-util/docs/doxygen.conf b/libs/apr-util/docs/doxygen.conf deleted file mode 100644 index dc49609dad..0000000000 --- a/libs/apr-util/docs/doxygen.conf +++ /dev/null @@ -1,30 +0,0 @@ -PROJECT_NAME="Apache Portable Runtime Utility Library" - -INPUT=. -QUIET=YES -RECURSIVE=YES -FILE_PATTERNS=*.h - -OUTPUT_DIRECTORY=docs/dox - -MACRO_EXPANSION=YES -EXPAND_ONLY_PREDEF=YES -#EXPAND_AS_DEFINED= -# not sure why this doesn't work as EXPAND_AS_DEFINED, it should! -PREDEFINED="APU_DECLARE(x)=x" \ - "APU_DECLARE_NONSTD(x)=x" \ - "APU_DECLARE_DATA" \ - "APR_HAS_MMAP" \ - "APR_HAS_THREADS" \ - "APR_HAS_XLATE" \ - "__attribute__(x)=" \ - DOXYGEN= - -OPTIMIZE_OUTPUT_FOR_C=YES - -FULL_PATH_NAMES=YES -CASE_SENSE_NAMES=NO -# some autoconf guru needs to make configure set this correctly... -#STRIP_FROM_PATH=/root/apache/httpd-2.0-8/srclib/apr-util - -GENERATE_TAGFILE=docs/dox/apu.tag diff --git a/libs/apr-util/encoding/apr_base64.c b/libs/apr-util/encoding/apr_base64.c deleted file mode 100644 index 4a1f49c568..0000000000 --- a/libs/apr-util/encoding/apr_base64.c +++ /dev/null @@ -1,268 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* base64 encoder/decoder. Originally part of main/util.c - * but moved here so that support/ab and apr_sha1.c could - * use it. This meant removing the apr_palloc()s and adding - * ugly 'len' functions, which is quite a nasty cost. - */ - -#include "apr_base64.h" -#if APR_CHARSET_EBCDIC -#include "apr_xlate.h" -#endif /* APR_CHARSET_EBCDIC */ - -/* aaaack but it's fast and const should make it shared text page. */ -static const unsigned char pr2six[256] = -{ -#if !APR_CHARSET_EBCDIC - /* ASCII table */ - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, 64, 64, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64, - 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, - 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64 -#else /*APR_CHARSET_EBCDIC*/ - /* EBCDIC table */ - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 62, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 63, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 26, 27, 28, 29, 30, 31, 32, 33, 34, 64, 64, 64, 64, 64, 64, - 64, 35, 36, 37, 38, 39, 40, 41, 42, 43, 64, 64, 64, 64, 64, 64, - 64, 64, 44, 45, 46, 47, 48, 49, 50, 51, 64, 64, 64, 64, 64, 64, - 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, - 64, 0, 1, 2, 3, 4, 5, 6, 7, 8, 64, 64, 64, 64, 64, 64, - 64, 9, 10, 11, 12, 13, 14, 15, 16, 17, 64, 64, 64, 64, 64, 64, - 64, 64, 18, 19, 20, 21, 22, 23, 24, 25, 64, 64, 64, 64, 64, 64, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 64, 64, 64, 64, 64, 64 -#endif /*APR_CHARSET_EBCDIC*/ -}; - -#if APR_CHARSET_EBCDIC -static apr_xlate_t *xlate_to_ebcdic; -static unsigned char os_toascii[256]; - -APU_DECLARE(apr_status_t) apr_base64init_ebcdic(apr_xlate_t *to_ascii, - apr_xlate_t *to_ebcdic) -{ - int i; - apr_size_t inbytes_left, outbytes_left; - apr_status_t rv; - int onoff; - - /* Only single-byte conversion is supported. - */ - rv = apr_xlate_sb_get(to_ascii, &onoff); - if (rv) { - return rv; - } - if (!onoff) { /* If conversion is not single-byte-only */ - return APR_EINVAL; - } - rv = apr_xlate_sb_get(to_ebcdic, &onoff); - if (rv) { - return rv; - } - if (!onoff) { /* If conversion is not single-byte-only */ - return APR_EINVAL; - } - xlate_to_ebcdic = to_ebcdic; - for (i = 0; i < sizeof(os_toascii); i++) { - os_toascii[i] = i; - } - inbytes_left = outbytes_left = sizeof(os_toascii); - apr_xlate_conv_buffer(to_ascii, os_toascii, &inbytes_left, - os_toascii, &outbytes_left); - - return APR_SUCCESS; -} -#endif /*APR_CHARSET_EBCDIC*/ - -APU_DECLARE(int) apr_base64_decode_len(const char *bufcoded) -{ - int nbytesdecoded; - register const unsigned char *bufin; - register int nprbytes; - - bufin = (const unsigned char *) bufcoded; - while (pr2six[*(bufin++)] <= 63); - - nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; - nbytesdecoded = ((nprbytes + 3) / 4) * 3; - - return nbytesdecoded + 1; -} - -APU_DECLARE(int) apr_base64_decode(char *bufplain, const char *bufcoded) -{ -#if APR_CHARSET_EBCDIC - apr_size_t inbytes_left, outbytes_left; -#endif /* APR_CHARSET_EBCDIC */ - int len; - - len = apr_base64_decode_binary((unsigned char *) bufplain, bufcoded); -#if APR_CHARSET_EBCDIC - inbytes_left = outbytes_left = len; - apr_xlate_conv_buffer(xlate_to_ebcdic, bufplain, &inbytes_left, - bufplain, &outbytes_left); -#endif /* APR_CHARSET_EBCDIC */ - bufplain[len] = '\0'; - return len; -} - -/* This is the same as apr_base64_decode() except on EBCDIC machines, where - * the conversion of the output to ebcdic is left out. - */ -APU_DECLARE(int) apr_base64_decode_binary(unsigned char *bufplain, - const char *bufcoded) -{ - int nbytesdecoded; - register const unsigned char *bufin; - register unsigned char *bufout; - register int nprbytes; - - bufin = (const unsigned char *) bufcoded; - while (pr2six[*(bufin++)] <= 63); - nprbytes = (bufin - (const unsigned char *) bufcoded) - 1; - nbytesdecoded = ((nprbytes + 3) / 4) * 3; - - bufout = (unsigned char *) bufplain; - bufin = (const unsigned char *) bufcoded; - - while (nprbytes > 4) { - *(bufout++) = - (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); - *(bufout++) = - (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); - *(bufout++) = - (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); - bufin += 4; - nprbytes -= 4; - } - - /* Note: (nprbytes == 1) would be an error, so just ingore that case */ - if (nprbytes > 1) { - *(bufout++) = - (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4); - } - if (nprbytes > 2) { - *(bufout++) = - (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); - } - if (nprbytes > 3) { - *(bufout++) = - (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); - } - - nbytesdecoded -= (4 - nprbytes) & 3; - return nbytesdecoded; -} - -static const char basis_64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -APU_DECLARE(int) apr_base64_encode_len(int len) -{ - return ((len + 2) / 3 * 4) + 1; -} - -APU_DECLARE(int) apr_base64_encode(char *encoded, const char *string, int len) -{ -#if !APR_CHARSET_EBCDIC - return apr_base64_encode_binary(encoded, (const unsigned char *) string, len); -#else /* APR_CHARSET_EBCDIC */ - int i; - char *p; - - p = encoded; - for (i = 0; i < len - 2; i += 3) { - *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F]; - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | - ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)]; - *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) | - ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)]; - *p++ = basis_64[os_toascii[string[i + 2]] & 0x3F]; - } - if (i < len) { - *p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F]; - if (i == (len - 1)) { - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4)]; - *p++ = '='; - } - else { - *p++ = basis_64[((os_toascii[string[i]] & 0x3) << 4) | - ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)]; - *p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)]; - } - *p++ = '='; - } - - *p++ = '\0'; - return p - encoded; -#endif /* APR_CHARSET_EBCDIC */ -} - -/* This is the same as apr_base64_encode() except on EBCDIC machines, where - * the conversion of the input to ascii is left out. - */ -APU_DECLARE(int) apr_base64_encode_binary(char *encoded, - const unsigned char *string, int len) -{ - int i; - char *p; - - p = encoded; - for (i = 0; i < len - 2; i += 3) { - *p++ = basis_64[(string[i] >> 2) & 0x3F]; - *p++ = basis_64[((string[i] & 0x3) << 4) | - ((int) (string[i + 1] & 0xF0) >> 4)]; - *p++ = basis_64[((string[i + 1] & 0xF) << 2) | - ((int) (string[i + 2] & 0xC0) >> 6)]; - *p++ = basis_64[string[i + 2] & 0x3F]; - } - if (i < len) { - *p++ = basis_64[(string[i] >> 2) & 0x3F]; - if (i == (len - 1)) { - *p++ = basis_64[((string[i] & 0x3) << 4)]; - *p++ = '='; - } - else { - *p++ = basis_64[((string[i] & 0x3) << 4) | - ((int) (string[i + 1] & 0xF0) >> 4)]; - *p++ = basis_64[((string[i + 1] & 0xF) << 2)]; - } - *p++ = '='; - } - - *p++ = '\0'; - return p - encoded; -} diff --git a/libs/apr-util/export_vars.sh.in b/libs/apr-util/export_vars.sh.in deleted file mode 100644 index 96a9352631..0000000000 --- a/libs/apr-util/export_vars.sh.in +++ /dev/null @@ -1,13 +0,0 @@ -# -# export_vars.sh -# -# This shell script is used to export vars to the application using the -# APRUTIL library. This script should be "sourced" to ensure the variable -# values are set within the calling script's context. For example: -# -# $ . path/to/apr-util/export_vars.sh -# - -APRUTIL_EXPORT_INCLUDES="@APRUTIL_INCLUDES@" -APRUTIL_EXPORT_LIBS="@APRUTIL_EXPORT_LIBS@" -APRUTIL_LDFLAGS="@APRUTIL_LDFLAGS@" diff --git a/libs/apr-util/hooks/apr_hooks.c b/libs/apr-util/hooks/apr_hooks.c deleted file mode 100644 index 776bc884e7..0000000000 --- a/libs/apr-util/hooks/apr_hooks.c +++ /dev/null @@ -1,404 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include -#include -#include - -#include "apr_pools.h" -#include "apr_tables.h" -#include "apr.h" -#include "apr_hooks.h" -#include "apr_hash.h" -#include "apr_optional_hooks.h" -#include "apr_optional.h" -#define APR_WANT_MEMFUNC -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if 0 -#define apr_palloc(pool,size) malloc(size) -#endif - -APU_DECLARE_DATA apr_pool_t *apr_hook_global_pool = NULL; -APU_DECLARE_DATA int apr_hook_debug_enabled = 0; -APU_DECLARE_DATA const char *apr_hook_debug_current = NULL; - -/** @deprecated @see apr_hook_global_pool */ -APU_DECLARE_DATA apr_pool_t *apr_global_hook_pool = NULL; - -/** @deprecated @see apr_hook_debug_enabled */ -APU_DECLARE_DATA int apr_debug_module_hooks = 0; - -/** @deprecated @see apr_hook_debug_current */ -APU_DECLARE_DATA const char *apr_current_hooking_module = NULL; - -/* NB: This must echo the LINK_##name structure */ -typedef struct -{ - void (*dummy)(void *); - const char *szName; - const char * const *aszPredecessors; - const char * const *aszSuccessors; - int nOrder; -} TSortData; - -typedef struct tsort_ -{ - void *pData; - int nPredecessors; - struct tsort_ **ppPredecessors; - struct tsort_ *pNext; -} TSort; - -#ifdef NETWARE -#include "apr_private.h" -#define get_apd APP_DATA* apd = (APP_DATA*)get_app_data(gLibId); -#define s_aHooksToSort ((apr_array_header_t *)(apd->gs_aHooksToSort)) -#define s_phOptionalHooks ((apr_hash_t *)(apd->gs_phOptionalHooks)) -#define s_phOptionalFunctions ((apr_hash_t *)(apd->gs_phOptionalFunctions)) -#endif - -static int crude_order(const void *a_,const void *b_) -{ - const TSortData *a=a_; - const TSortData *b=b_; - - return a->nOrder-b->nOrder; -} - -static TSort *prepare(apr_pool_t *p,TSortData *pItems,int nItems) -{ - TSort *pData=apr_palloc(p,nItems*sizeof *pData); - int n; - - qsort(pItems,nItems,sizeof *pItems,crude_order); - for(n=0 ; n < nItems ; ++n) { - pData[n].nPredecessors=0; - pData[n].ppPredecessors=apr_pcalloc(p,nItems*sizeof *pData[n].ppPredecessors); - pData[n].pNext=NULL; - pData[n].pData=&pItems[n]; - } - - for(n=0 ; n < nItems ; ++n) { - int i,k; - - for(i=0 ; pItems[n].aszPredecessors && pItems[n].aszPredecessors[i] ; ++i) - for(k=0 ; k < nItems ; ++k) - if(!strcmp(pItems[k].szName,pItems[n].aszPredecessors[i])) { - int l; - - for(l=0 ; l < pData[n].nPredecessors ; ++l) - if(pData[n].ppPredecessors[l] == &pData[k]) - goto got_it; - pData[n].ppPredecessors[pData[n].nPredecessors]=&pData[k]; - ++pData[n].nPredecessors; - got_it: - break; - } - for(i=0 ; pItems[n].aszSuccessors && pItems[n].aszSuccessors[i] ; ++i) - for(k=0 ; k < nItems ; ++k) - if(!strcmp(pItems[k].szName,pItems[n].aszSuccessors[i])) { - int l; - - for(l=0 ; l < pData[k].nPredecessors ; ++l) - if(pData[k].ppPredecessors[l] == &pData[n]) - goto got_it2; - pData[k].ppPredecessors[pData[k].nPredecessors]=&pData[n]; - ++pData[k].nPredecessors; - got_it2: - break; - } - } - - return pData; -} - -/* Topologically sort, dragging out-of-order items to the front. Note that - this tends to preserve things that want to be near the front better, and - changing that behaviour might compromise some of Apache's behaviour (in - particular, mod_log_forensic might otherwise get pushed to the end, and - core.c's log open function used to end up at the end when pushing items - to the back was the methedology). Also note that the algorithm could - go back to its original simplicity by sorting from the back instead of - the front. -*/ -static TSort *tsort(TSort *pData,int nItems) -{ - int nTotal; - TSort *pHead=NULL; - TSort *pTail=NULL; - - for(nTotal=0 ; nTotal < nItems ; ++nTotal) { - int n,i,k; - - for(n=0 ; ; ++n) { - if(n == nItems) - assert(0); /* we have a loop... */ - if(!pData[n].pNext) { - if(pData[n].nPredecessors) { - for(k=0 ; ; ++k) { - assert(k < nItems); - if(pData[n].ppPredecessors[k]) - break; - } - for(i=0 ; ; ++i) { - assert(i < nItems); - if(&pData[i] == pData[n].ppPredecessors[k]) { - n=i-1; - break; - } - } - } else - break; - } - } - if(pTail) - pTail->pNext=&pData[n]; - else - pHead=&pData[n]; - pTail=&pData[n]; - pTail->pNext=pTail; /* fudge it so it looks linked */ - for(i=0 ; i < nItems ; ++i) - for(k=0 ; k < nItems ; ++k) - if(pData[i].ppPredecessors[k] == &pData[n]) { - --pData[i].nPredecessors; - pData[i].ppPredecessors[k]=NULL; - break; - } - } - if (pTail) { - pTail->pNext = NULL; /* unfudge the tail */ - } - return pHead; -} - -static apr_array_header_t *sort_hook(apr_array_header_t *pHooks, - const char *szName) -{ - apr_pool_t *p; - TSort *pSort; - apr_array_header_t *pNew; - int n; - - apr_pool_create(&p, apr_hook_global_pool); - pSort=prepare(p,(TSortData *)pHooks->elts,pHooks->nelts); - pSort=tsort(pSort,pHooks->nelts); - pNew=apr_array_make(apr_hook_global_pool,pHooks->nelts,sizeof(TSortData)); - if(apr_hook_debug_enabled) - printf("Sorting %s:",szName); - for(n=0 ; pSort ; pSort=pSort->pNext,++n) { - TSortData *pHook; - assert(n < pHooks->nelts); - pHook=apr_array_push(pNew); - memcpy(pHook,pSort->pData,sizeof *pHook); - if(apr_hook_debug_enabled) - printf(" %s",pHook->szName); - } - if(apr_hook_debug_enabled) - fputc('\n',stdout); - return pNew; -} - -#ifndef NETWARE -static apr_array_header_t *s_aHooksToSort; -#endif - -typedef struct -{ - const char *szHookName; - apr_array_header_t **paHooks; -} HookSortEntry; - -APU_DECLARE(void) apr_hook_sort_register(const char *szHookName, - apr_array_header_t **paHooks) -{ -#ifdef NETWARE - get_apd -#endif - HookSortEntry *pEntry; - - if(!s_aHooksToSort) - s_aHooksToSort=apr_array_make(apr_hook_global_pool,1,sizeof(HookSortEntry)); - pEntry=apr_array_push(s_aHooksToSort); - pEntry->szHookName=szHookName; - pEntry->paHooks=paHooks; -} - -APU_DECLARE(void) apr_hook_sort_all(void) -{ -#ifdef NETWARE - get_apd -#endif - int n; - - for(n=0 ; n < s_aHooksToSort->nelts ; ++n) { - HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n]; - *pEntry->paHooks=sort_hook(*pEntry->paHooks,pEntry->szHookName); - } -} - -#ifndef NETWARE -static apr_hash_t *s_phOptionalHooks; -static apr_hash_t *s_phOptionalFunctions; -#endif - -APU_DECLARE(void) apr_hook_deregister_all(void) -{ -#ifdef NETWARE - get_apd -#endif - int n; - - for(n=0 ; n < s_aHooksToSort->nelts ; ++n) { - HookSortEntry *pEntry=&((HookSortEntry *)s_aHooksToSort->elts)[n]; - *pEntry->paHooks=NULL; - } - s_aHooksToSort=NULL; - s_phOptionalHooks=NULL; - s_phOptionalFunctions=NULL; -} - -APU_DECLARE(void) apr_hook_debug_show(const char *szName, - const char * const *aszPre, - const char * const *aszSucc) -{ - int nFirst; - - printf(" Hooked %s",szName); - if(aszPre) { - fputs(" pre(",stdout); - nFirst=1; - while(*aszPre) { - if(!nFirst) - fputc(',',stdout); - nFirst=0; - fputs(*aszPre,stdout); - ++aszPre; - } - fputc(')',stdout); - } - if(aszSucc) { - fputs(" succ(",stdout); - nFirst=1; - while(*aszSucc) { - if(!nFirst) - fputc(',',stdout); - nFirst=0; - fputs(*aszSucc,stdout); - ++aszSucc; - } - fputc(')',stdout); - } - fputc('\n',stdout); -} - -/* Optional hook support */ - -APR_DECLARE_EXTERNAL_HOOK(apr,APU,void,_optional,(void)) - -APU_DECLARE(apr_array_header_t *) apr_optional_hook_get(const char *szName) -{ -#ifdef NETWARE - get_apd -#endif - apr_array_header_t **ppArray; - - if(!s_phOptionalHooks) - return NULL; - ppArray=apr_hash_get(s_phOptionalHooks,szName,strlen(szName)); - if(!ppArray) - return NULL; - return *ppArray; -} - -APU_DECLARE(void) apr_optional_hook_add(const char *szName,void (*pfn)(void), - const char * const *aszPre, - const char * const *aszSucc,int nOrder) -{ -#ifdef NETWARE - get_apd -#endif - apr_array_header_t *pArray=apr_optional_hook_get(szName); - apr_LINK__optional_t *pHook; - - if(!pArray) { - apr_array_header_t **ppArray; - - pArray=apr_array_make(apr_hook_global_pool,1, - sizeof(apr_LINK__optional_t)); - if(!s_phOptionalHooks) - s_phOptionalHooks=apr_hash_make(apr_hook_global_pool); - ppArray=apr_palloc(apr_hook_global_pool,sizeof *ppArray); - *ppArray=pArray; - apr_hash_set(s_phOptionalHooks,szName,strlen(szName),ppArray); - apr_hook_sort_register(szName,ppArray); - } - pHook=apr_array_push(pArray); - pHook->pFunc=pfn; - pHook->aszPredecessors=aszPre; - pHook->aszSuccessors=aszSucc; - pHook->nOrder=nOrder; - pHook->szName=apr_hook_debug_current; - if(apr_hook_debug_enabled) - apr_hook_debug_show(szName,aszPre,aszSucc); -} - -/* optional function support */ - -APU_DECLARE(apr_opt_fn_t *) apr_dynamic_fn_retrieve(const char *szName) -{ -#ifdef NETWARE - get_apd -#endif - if(!s_phOptionalFunctions) - return NULL; - return (void(*)(void))apr_hash_get(s_phOptionalFunctions,szName,strlen(szName)); -} - -/* Deprecated */ -APU_DECLARE_NONSTD(void) apr_dynamic_fn_register(const char *szName, - apr_opt_fn_t *pfn) -{ -#ifdef NETWARE - get_apd -#endif - if(!s_phOptionalFunctions) - s_phOptionalFunctions=apr_hash_make(apr_hook_global_pool); - apr_hash_set(s_phOptionalFunctions,szName,strlen(szName),(void *)pfn); -} - -#if 0 -void main() -{ - const char *aszAPre[]={"b","c",NULL}; - const char *aszBPost[]={"a",NULL}; - const char *aszCPost[]={"b",NULL}; - TSortData t1[]= - { - { "a",aszAPre,NULL }, - { "b",NULL,aszBPost }, - { "c",NULL,aszCPost } - }; - TSort *pResult; - - pResult=prepare(t1,3); - pResult=tsort(pResult,3); - - for( ; pResult ; pResult=pResult->pNext) - printf("%s\n",pResult->pData->szName); -} -#endif diff --git a/libs/apr-util/include/apr_anylock.h b/libs/apr-util/include/apr_anylock.h deleted file mode 100644 index 6b724de2c3..0000000000 --- a/libs/apr-util/include/apr_anylock.h +++ /dev/null @@ -1,128 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/** - * @file apr_anylock.h - * @brief APR-Util transparent any lock flavor wrapper - */ -#ifndef APR_ANYLOCK_H -#define APR_ANYLOCK_H - -#include "apr_proc_mutex.h" -#include "apr_thread_mutex.h" -#include "apr_thread_rwlock.h" - -/** Structure that may contain any APR lock type */ -typedef struct apr_anylock_t { - /** Indicates what type of lock is in lock */ - enum tm_lock { - apr_anylock_none, /**< None */ - apr_anylock_procmutex, /**< Process-based */ - apr_anylock_threadmutex, /**< Thread-based */ - apr_anylock_readlock, /**< Read lock */ - apr_anylock_writelock /**< Write lock */ - } type; - /** Union of all possible APR locks */ - union apr_anylock_u_t { - apr_proc_mutex_t *pm; /**< Process mutex */ -#if APR_HAS_THREADS - apr_thread_mutex_t *tm; /**< Thread mutex */ - apr_thread_rwlock_t *rw; /**< Read-write lock */ -#endif - } lock; -} apr_anylock_t; - -#if APR_HAS_THREADS - -/** Lock an apr_anylock_t structure */ -#define APR_ANYLOCK_LOCK(lck) \ - (((lck)->type == apr_anylock_none) \ - ? APR_SUCCESS \ - : (((lck)->type == apr_anylock_threadmutex) \ - ? apr_thread_mutex_lock((lck)->lock.tm) \ - : (((lck)->type == apr_anylock_procmutex) \ - ? apr_proc_mutex_lock((lck)->lock.pm) \ - : (((lck)->type == apr_anylock_readlock) \ - ? apr_thread_rwlock_rdlock((lck)->lock.rw) \ - : (((lck)->type == apr_anylock_writelock) \ - ? apr_thread_rwlock_wrlock((lck)->lock.rw) \ - : APR_EINVAL))))) - -#else /* APR_HAS_THREADS */ - -#define APR_ANYLOCK_LOCK(lck) \ - (((lck)->type == apr_anylock_none) \ - ? APR_SUCCESS \ - : (((lck)->type == apr_anylock_procmutex) \ - ? apr_proc_mutex_lock((lck)->lock.pm) \ - : APR_EINVAL)) - -#endif /* APR_HAS_THREADS */ - -#if APR_HAS_THREADS - -/** Try to lock an apr_anylock_t structure */ -#define APR_ANYLOCK_TRYLOCK(lck) \ - (((lck)->type == apr_anylock_none) \ - ? APR_SUCCESS \ - : (((lck)->type == apr_anylock_threadmutex) \ - ? apr_thread_mutex_trylock((lck)->lock.tm) \ - : (((lck)->type == apr_anylock_procmutex) \ - ? apr_proc_mutex_trylock((lck)->lock.pm) \ - : (((lck)->type == apr_anylock_readlock) \ - ? apr_thread_rwlock_tryrdlock((lck)->lock.rw) \ - : (((lck)->type == apr_anylock_writelock) \ - ? apr_thread_rwlock_trywrlock((lck)->lock.rw) \ - : APR_EINVAL))))) - -#else /* APR_HAS_THREADS */ - -#define APR_ANYLOCK_TRYLOCK(lck) \ - (((lck)->type == apr_anylock_none) \ - ? APR_SUCCESS \ - : (((lck)->type == apr_anylock_procmutex) \ - ? apr_proc_mutex_trylock((lck)->lock.pm) \ - : APR_EINVAL)) - -#endif /* APR_HAS_THREADS */ - -#if APR_HAS_THREADS - -/** Unlock an apr_anylock_t structure */ -#define APR_ANYLOCK_UNLOCK(lck) \ - (((lck)->type == apr_anylock_none) \ - ? APR_SUCCESS \ - : (((lck)->type == apr_anylock_threadmutex) \ - ? apr_thread_mutex_unlock((lck)->lock.tm) \ - : (((lck)->type == apr_anylock_procmutex) \ - ? apr_proc_mutex_unlock((lck)->lock.pm) \ - : ((((lck)->type == apr_anylock_readlock) || \ - ((lck)->type == apr_anylock_writelock)) \ - ? apr_thread_rwlock_unlock((lck)->lock.rw) \ - : APR_EINVAL)))) - -#else /* APR_HAS_THREADS */ - -#define APR_ANYLOCK_UNLOCK(lck) \ - (((lck)->type == apr_anylock_none) \ - ? APR_SUCCESS \ - : (((lck)->type == apr_anylock_procmutex) \ - ? apr_proc_mutex_unlock((lck)->lock.pm) \ - : APR_EINVAL)) - -#endif /* APR_HAS_THREADS */ - -#endif /* !APR_ANYLOCK_H */ diff --git a/libs/apr-util/include/apr_base64.h b/libs/apr-util/include/apr_base64.h deleted file mode 100644 index d26aeb2d22..0000000000 --- a/libs/apr-util/include/apr_base64.h +++ /dev/null @@ -1,111 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - * The apr_vsnprintf/apr_snprintf functions are based on, and used with the - * permission of, the SIO stdio-replacement strx_* functions by Panos - * Tsirigotis for xinetd. - */ - -/** - * @file apr_base64.h - * @brief APR-UTIL Base64 Encoding - */ -#ifndef APR_BASE64_H -#define APR_BASE64_H - -#include "apu.h" -#include "apr_general.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup APR_Util_Base64 Base64 Encoding - * @ingroup APR_Util - * @{ - */ - -/* Simple BASE64 encode/decode functions. - * - * As we might encode binary strings, hence we require the length of - * the incoming plain source. And return the length of what we decoded. - * - * The decoding function takes any non valid char (i.e. whitespace, \0 - * or anything non A-Z,0-9 etc as terminal. - * - * plain strings/binary sequences are not assumed '\0' terminated. Encoded - * strings are neither. But probably should. - * - */ - -/** - * Given the length of an un-encrypted string, get the length of the - * encrypted string. - * @param len the length of an unencrypted string. - * @return the length of the string after it is encrypted - */ -APU_DECLARE(int) apr_base64_encode_len(int len); - -/** - * Encode a text string using base64encoding. - * @param coded_dst The destination string for the encoded string. - * @param plain_src The original string in plain text - * @param len_plain_src The length of the plain text string - * @return the length of the encoded string - */ -APU_DECLARE(int) apr_base64_encode(char * coded_dst, const char *plain_src, - int len_plain_src); - -/** - * Encode an EBCDIC string using base64encoding. - * @param coded_dst The destination string for the encoded string. - * @param plain_src The original string in plain text - * @param len_plain_src The length of the plain text string - * @return the length of the encoded string - */ -APU_DECLARE(int) apr_base64_encode_binary(char * coded_dst, - const unsigned char *plain_src, - int len_plain_src); - -/** - * Determine the length of a plain text string given the encoded version - * @param coded_src The encoded string - * @return the length of the plain text string - */ -APU_DECLARE(int) apr_base64_decode_len(const char * coded_src); - -/** - * Decode a string to plain text - * @param plain_dst The destination string for the plain text - * @param coded_src The encoded string - * @return the length of the plain text string - */ -APU_DECLARE(int) apr_base64_decode(char * plain_dst, const char *coded_src); - -/** - * Decode an EBCDIC string to plain text - * @param plain_dst The destination string for the plain text - * @param coded_src The encoded string - * @return the length of the plain text string - */ -APU_DECLARE(int) apr_base64_decode_binary(unsigned char * plain_dst, - const char *coded_src); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* !APR_BASE64_H */ diff --git a/libs/apr-util/include/apr_buckets.h b/libs/apr-util/include/apr_buckets.h deleted file mode 100644 index 01f6743d97..0000000000 --- a/libs/apr-util/include/apr_buckets.h +++ /dev/null @@ -1,1464 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ -/** - * @file apr_buckets.h - * @brief APR-UTIL Buckets/Bucket Brigades - */ - -#ifndef APR_BUCKETS_H -#define APR_BUCKETS_H - -#if defined(APR_BUCKET_DEBUG) && !defined(APR_RING_DEBUG) -#define APR_RING_DEBUG -#endif - -#include "apu.h" -#include "apr_network_io.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_mmap.h" -#include "apr_errno.h" -#include "apr_ring.h" -#include "apr.h" -#if APR_HAVE_SYS_UIO_H -#include /* for struct iovec */ -#endif -#if APR_HAVE_STDARG_H -#include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup APR_Util_Bucket_Brigades Bucket Brigades - * @ingroup APR_Util - * @{ - */ - -/** default bucket buffer size - 8KB minus room for memory allocator headers */ -#define APR_BUCKET_BUFF_SIZE 8000 - -/** Determines how a bucket or brigade should be read */ -typedef enum { - APR_BLOCK_READ, /**< block until data becomes available */ - APR_NONBLOCK_READ /**< return immediately if no data is available */ -} apr_read_type_e; - -/** - * The one-sentence buzzword-laden overview: Bucket brigades represent - * a complex data stream that can be passed through a layered IO - * system without unnecessary copying. A longer overview follows... - * - * A bucket brigade is a doubly linked list (ring) of buckets, so we - * aren't limited to inserting at the front and removing at the end. - * Buckets are only passed around as members of a brigade, although - * singleton buckets can occur for short periods of time. - * - * Buckets are data stores of various types. They can refer to data in - * memory, or part of a file or mmap area, or the output of a process, - * etc. Buckets also have some type-dependent accessor functions: - * read, split, copy, setaside, and destroy. - * - * read returns the address and size of the data in the bucket. If the - * data isn't in memory then it is read in and the bucket changes type - * so that it can refer to the new location of the data. If all the - * data doesn't fit in the bucket then a new bucket is inserted into - * the brigade to hold the rest of it. - * - * split divides the data in a bucket into two regions. After a split - * the original bucket refers to the first part of the data and a new - * bucket inserted into the brigade after the original bucket refers - * to the second part of the data. Reference counts are maintained as - * necessary. - * - * setaside ensures that the data in the bucket has a long enough - * lifetime. Sometimes it is convenient to create a bucket referring - * to data on the stack in the expectation that it will be consumed - * (output to the network) before the stack is unwound. If that - * expectation turns out not to be valid, the setaside function is - * called to move the data somewhere safer. - * - * copy makes a duplicate of the bucket structure as long as it's - * possible to have multiple references to a single copy of the - * data itself. Not all bucket types can be copied. - * - * destroy maintains the reference counts on the resources used by a - * bucket and frees them if necessary. - * - * Note: all of the above functions have wrapper macros (apr_bucket_read(), - * apr_bucket_destroy(), etc), and those macros should be used rather - * than using the function pointers directly. - * - * To write a bucket brigade, they are first made into an iovec, so that we - * don't write too little data at one time. Currently we ignore compacting the - * buckets into as few buckets as possible, but if we really want good - * performance, then we need to compact the buckets before we convert to an - * iovec, or possibly while we are converting to an iovec. - */ - -/* - * Forward declaration of the main types. - */ - -/** @see apr_bucket_brigade */ -typedef struct apr_bucket_brigade apr_bucket_brigade; -/** @see apr_bucket */ -typedef struct apr_bucket apr_bucket; -/** @see apr_bucket_alloc_t */ -typedef struct apr_bucket_alloc_t apr_bucket_alloc_t; - -/** @see apr_bucket_type_t */ -typedef struct apr_bucket_type_t apr_bucket_type_t; - -/** - * Basic bucket type - */ -struct apr_bucket_type_t { - /** - * The name of the bucket type - */ - const char *name; - /** - * The number of functions this bucket understands. Can not be less than - * five. - */ - int num_func; - /** - * Whether the bucket contains metadata (ie, information that - * describes the regular contents of the brigade). The metadata - * is not returned by apr_bucket_read() and is not indicated by - * the ->length of the apr_bucket itself. In other words, an - * empty bucket is safe to arbitrarily remove if and only if it - * contains no metadata. In this sense, "data" is just raw bytes - * that are the "content" of the brigade and "metadata" describes - * that data but is not a proper part of it. - */ - enum { - /** This bucket type represents actual data to send to the client. */ - APR_BUCKET_DATA = 0, - /** This bucket type represents metadata. */ - APR_BUCKET_METADATA = 1 - } is_metadata; - /** - * Free the private data and any resources used by the bucket (if they - * aren't shared with another bucket). This function is required to be - * implemented for all bucket types, though it might be a no-op on some - * of them (namely ones that never allocate any private data structures). - * @param data The private data pointer from the bucket to be destroyed - */ - void (*destroy)(void *data); - - /** - * Read the data from the bucket. This is required to be implemented - * for all bucket types. - * @param b The bucket to read from - * @param str A place to store the data read. Allocation should only be - * done if absolutely necessary. - * @param len The amount of data read. - * @param block Should this read function block if there is more data that - * cannot be read immediately. - */ - apr_status_t (*read)(apr_bucket *b, const char **str, apr_size_t *len, - apr_read_type_e block); - - /** - * Make it possible to set aside the data for at least as long as the - * given pool. Buckets containing data that could potentially die before - * this pool (e.g. the data resides on the stack, in a child pool of - * the given pool, or in a disjoint pool) must somehow copy, shift, or - * transform the data to have the proper lifetime. - * @param e The bucket to convert - * @remark Some bucket types contain data that will always outlive the - * bucket itself. For example no data (EOS and FLUSH), or the data - * resides in global, constant memory (IMMORTAL), or the data is on - * the heap (HEAP). For these buckets, apr_bucket_setaside_noop can - * be used. - */ - apr_status_t (*setaside)(apr_bucket *e, apr_pool_t *pool); - - /** - * Split one bucket in two at the specified position by duplicating - * the bucket structure (not the data) and modifying any necessary - * start/end/offset information. If it's not possible to do this - * for the bucket type (perhaps the length of the data is indeterminate, - * as with pipe and socket buckets), then APR_ENOTIMPL is returned. - * @param e The bucket to split - * @param point The offset of the first byte in the new bucket - */ - apr_status_t (*split)(apr_bucket *e, apr_size_t point); - - /** - * Copy the bucket structure (not the data), assuming that this is - * possible for the bucket type. If it's not, APR_ENOTIMPL is returned. - * @param e The bucket to copy - * @param c Returns a pointer to the new bucket - */ - apr_status_t (*copy)(apr_bucket *e, apr_bucket **c); - -}; - -/** - * apr_bucket structures are allocated on the malloc() heap and - * their lifetime is controlled by the parent apr_bucket_brigade - * structure. Buckets can move from one brigade to another e.g. by - * calling APR_BRIGADE_CONCAT(). In general the data in a bucket has - * the same lifetime as the bucket and is freed when the bucket is - * destroyed; if the data is shared by more than one bucket (e.g. - * after a split) the data is freed when the last bucket goes away. - */ -struct apr_bucket { - /** Links to the rest of the brigade */ - APR_RING_ENTRY(apr_bucket) link; - /** The type of bucket. */ - const apr_bucket_type_t *type; - /** The length of the data in the bucket. This could have been implemented - * with a function, but this is an optimization, because the most - * common thing to do will be to get the length. If the length is unknown, - * the value of this field will be (apr_size_t)(-1). - */ - apr_size_t length; - /** The start of the data in the bucket relative to the private base - * pointer. The vast majority of bucket types allow a fixed block of - * data to be referenced by multiple buckets, each bucket pointing to - * a different segment of the data. That segment starts at base+start - * and ends at base+start+length. - * If the length == (apr_size_t)(-1), then start == -1. - */ - apr_off_t start; - /** type-dependent data hangs off this pointer */ - void *data; - /** - * Pointer to function used to free the bucket. This function should - * always be defined and it should be consistent with the memory - * function used to allocate the bucket. For example, if malloc() is - * used to allocate the bucket, this pointer should point to free(). - * @param e Pointer to the bucket being freed - */ - void (*free)(void *e); - /** The freelist from which this bucket was allocated */ - apr_bucket_alloc_t *list; -}; - -/** A list of buckets */ -struct apr_bucket_brigade { - /** The pool to associate the brigade with. The data is not allocated out - * of the pool, but a cleanup is registered with this pool. If the - * brigade is destroyed by some mechanism other than pool destruction, - * the destroying function is responsible for killing the cleanup. - */ - apr_pool_t *p; - /** The buckets in the brigade are on this list. */ - /* - * The apr_bucket_list structure doesn't actually need a name tag - * because it has no existence independent of struct apr_bucket_brigade; - * the ring macros are designed so that you can leave the name tag - * argument empty in this situation but apparently the Windows compiler - * doesn't like that. - */ - APR_RING_HEAD(apr_bucket_list, apr_bucket) list; - /** The freelist from which this bucket was allocated */ - apr_bucket_alloc_t *bucket_alloc; -}; - - -/** - * Function called when a brigade should be flushed - */ -typedef apr_status_t (*apr_brigade_flush)(apr_bucket_brigade *bb, void *ctx); - -/* - * define APR_BUCKET_DEBUG if you want your brigades to be checked for - * validity at every possible instant. this will slow your code down - * substantially but is a very useful debugging tool. - */ -#ifdef APR_BUCKET_DEBUG - -#define APR_BRIGADE_CHECK_CONSISTENCY(b) \ - APR_RING_CHECK_CONSISTENCY(&(b)->list, apr_bucket, link) - -#define APR_BUCKET_CHECK_CONSISTENCY(e) \ - APR_RING_CHECK_ELEM_CONSISTENCY((e), apr_bucket, link) - -#else -/** - * checks the ring pointers in a bucket brigade for consistency. an - * abort() will be triggered if any inconsistencies are found. - * note: this is a no-op unless APR_BUCKET_DEBUG is defined. - * @param b The brigade - */ -#define APR_BRIGADE_CHECK_CONSISTENCY(b) -/** - * checks the brigade a bucket is in for ring consistency. an - * abort() will be triggered if any inconsistencies are found. - * note: this is a no-op unless APR_BUCKET_DEBUG is defined. - * @param e The bucket - */ -#define APR_BUCKET_CHECK_CONSISTENCY(e) -#endif - - -/** - * Wrappers around the RING macros to reduce the verbosity of the code - * that handles bucket brigades. - */ -/** - * The magic pointer value that indicates the head of the brigade - * @remark This is used to find the beginning and end of the brigade, eg: - *

- *      while (e != APR_BRIGADE_SENTINEL(b)) {
- *          ...
- *          e = APR_BUCKET_NEXT(e);
- *      }
- * 
- * @param b The brigade - * @return The magic pointer value - */ -#define APR_BRIGADE_SENTINEL(b) APR_RING_SENTINEL(&(b)->list, apr_bucket, link) - -/** - * Determine if the bucket brigade is empty - * @param b The brigade to check - * @return true or false - */ -#define APR_BRIGADE_EMPTY(b) APR_RING_EMPTY(&(b)->list, apr_bucket, link) - -/** - * Return the first bucket in a brigade - * @param b The brigade to query - * @return The first bucket in the brigade - */ -#define APR_BRIGADE_FIRST(b) APR_RING_FIRST(&(b)->list) -/** - * Return the last bucket in a brigade - * @param b The brigade to query - * @return The last bucket in the brigade - */ -#define APR_BRIGADE_LAST(b) APR_RING_LAST(&(b)->list) - -/** - * Insert a list of buckets at the front of a brigade - * @param b The brigade to add to - * @param e The first bucket in a list of buckets to insert - */ -#define APR_BRIGADE_INSERT_HEAD(b, e) do { \ - apr_bucket *ap__b = (e); \ - APR_RING_INSERT_HEAD(&(b)->list, ap__b, apr_bucket, link); \ - APR_BRIGADE_CHECK_CONSISTENCY((b)); \ - } while (0) - -/** - * Insert a list of buckets at the end of a brigade - * @param b The brigade to add to - * @param e The first bucket in a list of buckets to insert - */ -#define APR_BRIGADE_INSERT_TAIL(b, e) do { \ - apr_bucket *ap__b = (e); \ - APR_RING_INSERT_TAIL(&(b)->list, ap__b, apr_bucket, link); \ - APR_BRIGADE_CHECK_CONSISTENCY((b)); \ - } while (0) - -/** - * Concatenate brigade b onto the end of brigade a, leaving brigade b empty - * @param a The first brigade - * @param b The second brigade - */ -#define APR_BRIGADE_CONCAT(a, b) do { \ - APR_RING_CONCAT(&(a)->list, &(b)->list, apr_bucket, link); \ - APR_BRIGADE_CHECK_CONSISTENCY((a)); \ - } while (0) - -/** - * Prepend brigade b onto the beginning of brigade a, leaving brigade b empty - * @param a The first brigade - * @param b The second brigade - */ -#define APR_BRIGADE_PREPEND(a, b) do { \ - APR_RING_PREPEND(&(a)->list, &(b)->list, apr_bucket, link); \ - APR_BRIGADE_CHECK_CONSISTENCY((a)); \ - } while (0) - -/** - * Insert a list of buckets before a specified bucket - * @param a The bucket to insert before - * @param b The buckets to insert - */ -#define APR_BUCKET_INSERT_BEFORE(a, b) do { \ - apr_bucket *ap__a = (a), *ap__b = (b); \ - APR_RING_INSERT_BEFORE(ap__a, ap__b, link); \ - APR_BUCKET_CHECK_CONSISTENCY(ap__a); \ - } while (0) - -/** - * Insert a list of buckets after a specified bucket - * @param a The bucket to insert after - * @param b The buckets to insert - */ -#define APR_BUCKET_INSERT_AFTER(a, b) do { \ - apr_bucket *ap__a = (a), *ap__b = (b); \ - APR_RING_INSERT_AFTER(ap__a, ap__b, link); \ - APR_BUCKET_CHECK_CONSISTENCY(ap__a); \ - } while (0) - -/** - * Get the next bucket in the list - * @param e The current bucket - * @return The next bucket - */ -#define APR_BUCKET_NEXT(e) APR_RING_NEXT((e), link) -/** - * Get the previous bucket in the list - * @param e The current bucket - * @return The previous bucket - */ -#define APR_BUCKET_PREV(e) APR_RING_PREV((e), link) - -/** - * Remove a bucket from its bucket brigade - * @param e The bucket to remove - */ -#define APR_BUCKET_REMOVE(e) APR_RING_REMOVE((e), link) - -/** - * Initialize a new bucket's prev/next pointers - * @param e The bucket to initialize - */ -#define APR_BUCKET_INIT(e) APR_RING_ELEM_INIT((e), link) - -/** - * Determine if a bucket contains metadata. An empty bucket is - * safe to arbitrarily remove if and only if this is false. - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_METADATA(e) ((e)->type->is_metadata) - -/** - * Determine if a bucket is a FLUSH bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_FLUSH(e) ((e)->type == &apr_bucket_type_flush) -/** - * Determine if a bucket is an EOS bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_EOS(e) ((e)->type == &apr_bucket_type_eos) -/** - * Determine if a bucket is a FILE bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_FILE(e) ((e)->type == &apr_bucket_type_file) -/** - * Determine if a bucket is a PIPE bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_PIPE(e) ((e)->type == &apr_bucket_type_pipe) -/** - * Determine if a bucket is a SOCKET bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_SOCKET(e) ((e)->type == &apr_bucket_type_socket) -/** - * Determine if a bucket is a HEAP bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_HEAP(e) ((e)->type == &apr_bucket_type_heap) -/** - * Determine if a bucket is a TRANSIENT bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_TRANSIENT(e) ((e)->type == &apr_bucket_type_transient) -/** - * Determine if a bucket is a IMMORTAL bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_IMMORTAL(e) ((e)->type == &apr_bucket_type_immortal) -#if APR_HAS_MMAP -/** - * Determine if a bucket is a MMAP bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_MMAP(e) ((e)->type == &apr_bucket_type_mmap) -#endif -/** - * Determine if a bucket is a POOL bucket - * @param e The bucket to inspect - * @return true or false - */ -#define APR_BUCKET_IS_POOL(e) ((e)->type == &apr_bucket_type_pool) - -/* - * General-purpose reference counting for the various bucket types. - * - * Any bucket type that keeps track of the resources it uses (i.e. - * most of them except for IMMORTAL, TRANSIENT, and EOS) needs to - * attach a reference count to the resource so that it can be freed - * when the last bucket that uses it goes away. Resource-sharing may - * occur because of bucket splits or buckets that refer to globally - * cached data. */ - -/** @see apr_bucket_refcount */ -typedef struct apr_bucket_refcount apr_bucket_refcount; -/** - * The structure used to manage the shared resource must start with an - * apr_bucket_refcount which is updated by the general-purpose refcount - * code. A pointer to the bucket-type-dependent private data structure - * can be cast to a pointer to an apr_bucket_refcount and vice versa. - */ -struct apr_bucket_refcount { - /** The number of references to this bucket */ - int refcount; -}; - -/* ***** Reference-counted bucket types ***** */ - -/** @see apr_bucket_heap */ -typedef struct apr_bucket_heap apr_bucket_heap; -/** - * A bucket referring to data allocated off the heap. - */ -struct apr_bucket_heap { - /** Number of buckets using this memory */ - apr_bucket_refcount refcount; - /** The start of the data actually allocated. This should never be - * modified, it is only used to free the bucket. - */ - char *base; - /** how much memory was allocated */ - apr_size_t alloc_len; - /** function to use to delete the data */ - void (*free_func)(void *data); -}; - -/** @see apr_bucket_pool */ -typedef struct apr_bucket_pool apr_bucket_pool; -/** - * A bucket referring to data allocated from a pool - */ -struct apr_bucket_pool { - /** The pool bucket must be able to be easily morphed to a heap - * bucket if the pool gets cleaned up before all references are - * destroyed. This apr_bucket_heap structure is populated automatically - * when the pool gets cleaned up, and subsequent calls to pool_read() - * will result in the apr_bucket in question being morphed into a - * regular heap bucket. (To avoid having to do many extra refcount - * manipulations and b->data manipulations, the apr_bucket_pool - * struct actually *contains* the apr_bucket_heap struct that it - * will become as its first element; the two share their - * apr_bucket_refcount members.) - */ - apr_bucket_heap heap; - /** The block of data actually allocated from the pool. - * Segments of this block are referenced by adjusting - * the start and length of the apr_bucket accordingly. - * This will be NULL after the pool gets cleaned up. - */ - const char *base; - /** The pool the data was allocated from. When the pool - * is cleaned up, this gets set to NULL as an indicator - * to pool_read() that the data is now on the heap and - * so it should morph the bucket into a regular heap - * bucket before continuing. - */ - apr_pool_t *pool; - /** The freelist this structure was allocated from, which is - * needed in the cleanup phase in order to allocate space on the heap - */ - apr_bucket_alloc_t *list; -}; - -#if APR_HAS_MMAP -/** @see apr_bucket_mmap */ -typedef struct apr_bucket_mmap apr_bucket_mmap; -/** - * A bucket referring to an mmap()ed file - */ -struct apr_bucket_mmap { - /** Number of buckets using this memory */ - apr_bucket_refcount refcount; - /** The mmap this sub_bucket refers to */ - apr_mmap_t *mmap; -}; -#endif - -/** @see apr_bucket_file */ -typedef struct apr_bucket_file apr_bucket_file; -/** - * A bucket referring to an file - */ -struct apr_bucket_file { - /** Number of buckets using this memory */ - apr_bucket_refcount refcount; - /** The file this bucket refers to */ - apr_file_t *fd; - /** The pool into which any needed structures should - * be created while reading from this file bucket */ - apr_pool_t *readpool; -#if APR_HAS_MMAP - /** Whether this bucket should be memory-mapped if - * a caller tries to read from it */ - int can_mmap; -#endif /* APR_HAS_MMAP */ -}; - -/** @see apr_bucket_structs */ -typedef union apr_bucket_structs apr_bucket_structs; -/** - * A union of all bucket structures so we know what - * the max size is. - */ -union apr_bucket_structs { - apr_bucket b; /**< Bucket */ - apr_bucket_heap heap; /**< Heap */ - apr_bucket_pool pool; /**< Pool */ -#if APR_HAS_MMAP - apr_bucket_mmap mmap; /**< MMap */ -#endif - apr_bucket_file file; /**< File */ -}; - -/** - * The amount that apr_bucket_alloc() should allocate in the common case. - * Note: this is twice as big as apr_bucket_structs to allow breathing - * room for third-party bucket types. - */ -#define APR_BUCKET_ALLOC_SIZE APR_ALIGN_DEFAULT(2*sizeof(apr_bucket_structs)) - -/* ***** Bucket Brigade Functions ***** */ -/** - * Create a new bucket brigade. The bucket brigade is originally empty. - * @param p The pool to associate with the brigade. Data is not allocated out - * of the pool, but a cleanup is registered. - * @param list The bucket allocator to use - * @return The empty bucket brigade - */ -APU_DECLARE(apr_bucket_brigade *) apr_brigade_create(apr_pool_t *p, - apr_bucket_alloc_t *list); - -/** - * destroy an entire bucket brigade. This includes destroying all of the - * buckets within the bucket brigade's bucket list. - * @param b The bucket brigade to destroy - */ -APU_DECLARE(apr_status_t) apr_brigade_destroy(apr_bucket_brigade *b); - -/** - * empty out an entire bucket brigade. This includes destroying all of the - * buckets within the bucket brigade's bucket list. This is similar to - * apr_brigade_destroy(), except that it does not deregister the brigade's - * pool cleanup function. - * @param data The bucket brigade to clean up - * @remark Generally, you should use apr_brigade_destroy(). This function - * can be useful in situations where you have a single brigade that - * you wish to reuse many times by destroying all of the buckets in - * the brigade and putting new buckets into it later. - */ -APU_DECLARE(apr_status_t) apr_brigade_cleanup(void *data); - -/** - * Split a bucket brigade into two, such that the given bucket is the - * first in the new bucket brigade. This function is useful when a - * filter wants to pass only the initial part of a brigade to the next - * filter. - * @param b The brigade to split - * @param e The first element of the new brigade - * @return The new brigade - */ -APU_DECLARE(apr_bucket_brigade *) apr_brigade_split(apr_bucket_brigade *b, - apr_bucket *e); - -/** - * Partition a bucket brigade at a given offset (in bytes from the start of - * the brigade). This is useful whenever a filter wants to use known ranges - * of bytes from the brigade; the ranges can even overlap. - * @param b The brigade to partition - * @param point The offset at which to partition the brigade - * @param after_point Returns a pointer to the first bucket after the partition - * @return APR_SUCCESS on success, APR_INCOMPLETE if the contents of the - * brigade were shorter than @a point, or an error code. - * @remark if APR_INCOMPLETE is returned, @a after_point will be set to - * the brigade sentinel. - */ -APU_DECLARE(apr_status_t) apr_brigade_partition(apr_bucket_brigade *b, - apr_off_t point, - apr_bucket **after_point); - -/** - * Return the total length of the brigade. - * @param bb The brigade to compute the length of - * @param read_all Read unknown-length buckets to force a size - * @param length Returns the length of the brigade, or -1 if the brigade has - * buckets of indeterminate length and read_all is 0. - */ -APU_DECLARE(apr_status_t) apr_brigade_length(apr_bucket_brigade *bb, - int read_all, - apr_off_t *length); - -/** - * Take a bucket brigade and store the data in a flat char* - * @param bb The bucket brigade to create the char* from - * @param c The char* to write into - * @param len The maximum length of the char array. On return, it is the - * actual length of the char array. - */ -APU_DECLARE(apr_status_t) apr_brigade_flatten(apr_bucket_brigade *bb, - char *c, - apr_size_t *len); - -/** - * Creates a pool-allocated string representing a flat bucket brigade - * @param bb The bucket brigade to create the char array from - * @param c On return, the allocated char array - * @param len On return, the length of the char array. - * @param pool The pool to allocate the string from. - */ -APU_DECLARE(apr_status_t) apr_brigade_pflatten(apr_bucket_brigade *bb, - char **c, - apr_size_t *len, - apr_pool_t *pool); - -/** - * Split a brigade to represent one LF line. - * @param bbOut The bucket brigade that will have the LF line appended to. - * @param bbIn The input bucket brigade to search for a LF-line. - * @param block The blocking mode to be used to split the line. - * @param maxbytes The maximum bytes to read. If this many bytes are seen - * without a LF, the brigade will contain a partial line. - */ -APU_DECLARE(apr_status_t) apr_brigade_split_line(apr_bucket_brigade *bbOut, - apr_bucket_brigade *bbIn, - apr_read_type_e block, - apr_off_t maxbytes); - -/** - * create an iovec of the elements in a bucket_brigade... return number - * of elements used. This is useful for writing to a file or to the - * network efficiently. - * @param b The bucket brigade to create the iovec from - * @param vec The iovec to create - * @param nvec The number of elements in the iovec. On return, it is the - * number of iovec elements actually filled out. - */ -APU_DECLARE(apr_status_t) apr_brigade_to_iovec(apr_bucket_brigade *b, - struct iovec *vec, int *nvec); - -/** - * This function writes a list of strings into a bucket brigade. - * @param b The bucket brigade to add to - * @param flush The flush function to use if the brigade is full - * @param ctx The structure to pass to the flush function - * @param va A list of strings to add - * @return APR_SUCCESS or error code. - */ -APU_DECLARE(apr_status_t) apr_brigade_vputstrs(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, - va_list va); - -/** - * This function writes a string into a bucket brigade. - * @param b The bucket brigade to add to - * @param flush The flush function to use if the brigade is full - * @param ctx The structure to pass to the flush function - * @param str The string to add - * @param nbyte The number of bytes to write - * @return APR_SUCCESS or error code - */ -APU_DECLARE(apr_status_t) apr_brigade_write(apr_bucket_brigade *b, - apr_brigade_flush flush, void *ctx, - const char *str, apr_size_t nbyte); - -/** - * This function writes multiple strings into a bucket brigade. - * @param b The bucket brigade to add to - * @param flush The flush function to use if the brigade is full - * @param ctx The structure to pass to the flush function - * @param vec The strings to add (address plus length for each) - * @param nvec The number of entries in iovec - * @return APR_SUCCESS or error code - */ -APU_DECLARE(apr_status_t) apr_brigade_writev(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, - const struct iovec *vec, - apr_size_t nvec); - -/** - * This function writes a string into a bucket brigade. - * @param bb The bucket brigade to add to - * @param flush The flush function to use if the brigade is full - * @param ctx The structure to pass to the flush function - * @param str The string to add - * @return APR_SUCCESS or error code - */ -APU_DECLARE(apr_status_t) apr_brigade_puts(apr_bucket_brigade *bb, - apr_brigade_flush flush, void *ctx, - const char *str); - -/** - * This function writes a character into a bucket brigade. - * @param b The bucket brigade to add to - * @param flush The flush function to use if the brigade is full - * @param ctx The structure to pass to the flush function - * @param c The character to add - * @return APR_SUCCESS or error code - */ -APU_DECLARE(apr_status_t) apr_brigade_putc(apr_bucket_brigade *b, - apr_brigade_flush flush, void *ctx, - const char c); - -/** - * This function writes an unspecified number of strings into a bucket brigade. - * @param b The bucket brigade to add to - * @param flush The flush function to use if the brigade is full - * @param ctx The structure to pass to the flush function - * @param ... The strings to add - * @return APR_SUCCESS or error code - */ -APU_DECLARE_NONSTD(apr_status_t) apr_brigade_putstrs(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, ...); - -/** - * Evaluate a printf and put the resulting string at the end - * of the bucket brigade. - * @param b The brigade to write to - * @param flush The flush function to use if the brigade is full - * @param ctx The structure to pass to the flush function - * @param fmt The format of the string to write - * @param ... The arguments to fill out the format - * @return APR_SUCCESS or error code - */ -APU_DECLARE_NONSTD(apr_status_t) apr_brigade_printf(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, - const char *fmt, ...) - __attribute__((format(printf,4,5))); - -/** - * Evaluate a printf and put the resulting string at the end - * of the bucket brigade. - * @param b The brigade to write to - * @param flush The flush function to use if the brigade is full - * @param ctx The structure to pass to the flush function - * @param fmt The format of the string to write - * @param va The arguments to fill out the format - * @return APR_SUCCESS or error code - */ -APU_DECLARE(apr_status_t) apr_brigade_vprintf(apr_bucket_brigade *b, - apr_brigade_flush flush, - void *ctx, - const char *fmt, va_list va); - -/** - * Utility function to insert a file (or a segment of a file) onto the - * end of the brigade. The file is split into multiple buckets if it - * is larger than the maximum size which can be represented by a - * single bucket. - * @param bb the brigade to insert into - * @param f the file to insert - * @param start the offset of the start of the segment - * @param len the length of the segment of the file to insert - * @param p pool from which file buckets are allocated - * @return the last bucket inserted - */ -APU_DECLARE(apr_bucket *) apr_brigade_insert_file(apr_bucket_brigade *bb, - apr_file_t *f, - apr_off_t start, - apr_off_t len, - apr_pool_t *p); - - - -/* ***** Bucket freelist functions ***** */ -/** - * Create a bucket allocator. - * @param p This pool's underlying apr_allocator_t is used to allocate memory - * for the bucket allocator. When the pool is destroyed, the bucket - * allocator's cleanup routine will free all memory that has been - * allocated from it. - * @remark The reason the allocator gets its memory from the pool's - * apr_allocator_t rather than from the pool itself is because - * the bucket allocator will free large memory blocks back to the - * allocator when it's done with them, thereby preventing memory - * footprint growth that would occur if we allocated from the pool. - * @warning The allocator must never be used by more than one thread at a time. - */ -APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create(apr_pool_t *p); - -/** - * Create a bucket allocator. - * @param allocator This apr_allocator_t is used to allocate both the bucket - * allocator and all memory handed out by the bucket allocator. The - * caller is responsible for destroying the bucket allocator and the - * apr_allocator_t -- no automatic cleanups will happen. - * @warning The allocator must never be used by more than one thread at a time. - */ -APU_DECLARE_NONSTD(apr_bucket_alloc_t *) apr_bucket_alloc_create_ex(apr_allocator_t *allocator); - -/** - * Destroy a bucket allocator. - * @param list The allocator to be destroyed - */ -APU_DECLARE_NONSTD(void) apr_bucket_alloc_destroy(apr_bucket_alloc_t *list); - -/** - * Allocate memory for use by the buckets. - * @param size The amount to allocate. - * @param list The allocator from which to allocate the memory. - */ -APU_DECLARE_NONSTD(void *) apr_bucket_alloc(apr_size_t size, apr_bucket_alloc_t *list); - -/** - * Free memory previously allocated with apr_bucket_alloc(). - * @param block The block of memory to be freed. - */ -APU_DECLARE_NONSTD(void) apr_bucket_free(void *block); - - -/* ***** Bucket Functions ***** */ -/** - * Free the resources used by a bucket. If multiple buckets refer to - * the same resource it is freed when the last one goes away. - * @see apr_bucket_delete() - * @param e The bucket to destroy - */ -#define apr_bucket_destroy(e) do { \ - (e)->type->destroy((e)->data); \ - (e)->free(e); \ - } while (0) - -/** - * Delete a bucket by removing it from its brigade (if any) and then - * destroying it. - * @remark This mainly acts as an aid in avoiding code verbosity. It is - * the preferred exact equivalent to: - *
- *      APR_BUCKET_REMOVE(e);
- *      apr_bucket_destroy(e);
- * 
- * @param e The bucket to delete - */ -#define apr_bucket_delete(e) do { \ - APR_BUCKET_REMOVE(e); \ - apr_bucket_destroy(e); \ - } while (0) - -/** - * read the data from the bucket - * @param e The bucket to read from - * @param str The location to store the data in - * @param len The amount of data read - * @param block Whether the read function blocks - */ -#define apr_bucket_read(e,str,len,block) (e)->type->read(e, str, len, block) - -/** - * Setaside data so that stack data is not destroyed on returning from - * the function - * @param e The bucket to setaside - * @param p The pool to setaside into - */ -#define apr_bucket_setaside(e,p) (e)->type->setaside(e,p) - -/** - * Split one bucket in two. - * @param e The bucket to split - * @param point The offset to split the bucket at - */ -#define apr_bucket_split(e,point) (e)->type->split(e, point) - -/** - * Copy a bucket. - * @param e The bucket to copy - * @param c Returns a pointer to the new bucket - */ -#define apr_bucket_copy(e,c) (e)->type->copy(e, c) - -/* Bucket type handling */ - -/** - * This function simply returns APR_SUCCESS to denote that the bucket does - * not require anything to happen for its setaside() function. This is - * appropriate for buckets that have "immortal" data -- the data will live - * at least as long as the bucket. - * @param data The bucket to setaside - * @param pool The pool defining the desired lifetime of the bucket data - * @return APR_SUCCESS - */ -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_noop(apr_bucket *data, - apr_pool_t *pool); - -/** - * A place holder function that signifies that the setaside function was not - * implemented for this bucket - * @param data The bucket to setaside - * @param pool The pool defining the desired lifetime of the bucket data - * @return APR_ENOTIMPL - */ -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_setaside_notimpl(apr_bucket *data, - apr_pool_t *pool); - -/** - * A place holder function that signifies that the split function was not - * implemented for this bucket - * @param data The bucket to split - * @param point The location to split the bucket - * @return APR_ENOTIMPL - */ -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_split_notimpl(apr_bucket *data, - apr_size_t point); - -/** - * A place holder function that signifies that the copy function was not - * implemented for this bucket - * @param e The bucket to copy - * @param c Returns a pointer to the new bucket - * @return APR_ENOTIMPL - */ -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_copy_notimpl(apr_bucket *e, - apr_bucket **c); - -/** - * A place holder function that signifies that this bucket does not need - * to do anything special to be destroyed. That's only the case for buckets - * that either have no data (metadata buckets) or buckets whose data pointer - * points to something that's not a bucket-type-specific structure, as with - * simple buckets where data points to a string and pipe buckets where data - * points directly to the apr_file_t. - * @param data The bucket data to destroy - */ -APU_DECLARE_NONSTD(void) apr_bucket_destroy_noop(void *data); - -/** - * There is no apr_bucket_destroy_notimpl, because destruction is required - * to be implemented (it could be a noop, but only if that makes sense for - * the bucket type) - */ - -/* There is no apr_bucket_read_notimpl, because it is a required function - */ - - -/* All of the bucket types implemented by the core */ -/** - * The flush bucket type. This signifies that all data should be flushed to - * the next filter. The flush bucket should be sent with the other buckets. - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_flush; -/** - * The EOS bucket type. This signifies that there will be no more data, ever. - * All filters MUST send all data to the next filter when they receive a - * bucket of this type - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_eos; -/** - * The FILE bucket type. This bucket represents a file on disk - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_file; -/** - * The HEAP bucket type. This bucket represents a data allocated from the - * heap. - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_heap; -#if APR_HAS_MMAP -/** - * The MMAP bucket type. This bucket represents an MMAP'ed file - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_mmap; -#endif -/** - * The POOL bucket type. This bucket represents a data that was allocated - * from a pool. IF this bucket is still available when the pool is cleared, - * the data is copied on to the heap. - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pool; -/** - * The PIPE bucket type. This bucket represents a pipe to another program. - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_pipe; -/** - * The IMMORTAL bucket type. This bucket represents a segment of data that - * the creator is willing to take responsibility for. The core will do - * nothing with the data in an immortal bucket - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_immortal; -/** - * The TRANSIENT bucket type. This bucket represents a data allocated off - * the stack. When the setaside function is called, this data is copied on - * to the heap - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_transient; -/** - * The SOCKET bucket type. This bucket represents a socket to another machine - */ -APU_DECLARE_DATA extern const apr_bucket_type_t apr_bucket_type_socket; - - -/* ***** Simple buckets ***** */ - -/** - * Split a simple bucket into two at the given point. Most non-reference - * counting buckets that allow multiple references to the same block of - * data (eg transient and immortal) will use this as their split function - * without any additional type-specific handling. - * @param b The bucket to be split - * @param point The offset of the first byte in the new bucket - * @return APR_EINVAL if the point is not within the bucket; - * APR_ENOMEM if allocation failed; - * or APR_SUCCESS - */ -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_split(apr_bucket *b, - apr_size_t point); - -/** - * Copy a simple bucket. Most non-reference-counting buckets that allow - * multiple references to the same block of data (eg transient and immortal) - * will use this as their copy function without any additional type-specific - * handling. - * @param a The bucket to copy - * @param b Returns a pointer to the new bucket - * @return APR_ENOMEM if allocation failed; - * or APR_SUCCESS - */ -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_simple_copy(apr_bucket *a, - apr_bucket **b); - - -/* ***** Shared, reference-counted buckets ***** */ - -/** - * Initialize a bucket containing reference-counted data that may be - * shared. The caller must allocate the bucket if necessary and - * initialize its type-dependent fields, and allocate and initialize - * its own private data structure. This function should only be called - * by type-specific bucket creation functions. - * @param b The bucket to initialize - * @param data A pointer to the private data structure - * with the reference count at the start - * @param start The start of the data in the bucket - * relative to the private base pointer - * @param length The length of the data in the bucket - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_shared_make(apr_bucket *b, void *data, - apr_off_t start, - apr_size_t length); - -/** - * Decrement the refcount of the data in the bucket. This function - * should only be called by type-specific bucket destruction functions. - * @param data The private data pointer from the bucket to be destroyed - * @return TRUE or FALSE; TRUE if the reference count is now - * zero, indicating that the shared resource itself can - * be destroyed by the caller. - */ -APU_DECLARE(int) apr_bucket_shared_destroy(void *data); - -/** - * Split a bucket into two at the given point, and adjust the refcount - * to the underlying data. Most reference-counting bucket types will - * be able to use this function as their split function without any - * additional type-specific handling. - * @param b The bucket to be split - * @param point The offset of the first byte in the new bucket - * @return APR_EINVAL if the point is not within the bucket; - * APR_ENOMEM if allocation failed; - * or APR_SUCCESS - */ -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_split(apr_bucket *b, - apr_size_t point); - -/** - * Copy a refcounted bucket, incrementing the reference count. Most - * reference-counting bucket types will be able to use this function - * as their copy function without any additional type-specific handling. - * @param a The bucket to copy - * @param b Returns a pointer to the new bucket - * @return APR_ENOMEM if allocation failed; - or APR_SUCCESS - */ -APU_DECLARE_NONSTD(apr_status_t) apr_bucket_shared_copy(apr_bucket *a, - apr_bucket **b); - - -/* ***** Functions to Create Buckets of varying types ***** */ -/* - * Each bucket type foo has two initialization functions: - * apr_bucket_foo_make which sets up some already-allocated memory as a - * bucket of type foo; and apr_bucket_foo_create which allocates memory - * for the bucket, calls apr_bucket_make_foo, and initializes the - * bucket's list pointers. The apr_bucket_foo_make functions are used - * inside the bucket code to change the type of buckets in place; - * other code should call apr_bucket_foo_create. All the initialization - * functions change nothing if they fail. - */ - -/** - * Create an End of Stream bucket. This indicates that there is no more data - * coming from down the filter stack. All filters should flush at this point. - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_eos_create(apr_bucket_alloc_t *list); - -/** - * Make the bucket passed in an EOS bucket. This indicates that there is no - * more data coming from down the filter stack. All filters should flush at - * this point. - * @param b The bucket to make into an EOS bucket - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_eos_make(apr_bucket *b); - -/** - * Create a flush bucket. This indicates that filters should flush their - * data. There is no guarantee that they will flush it, but this is the - * best we can do. - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_flush_create(apr_bucket_alloc_t *list); - -/** - * Make the bucket passed in a FLUSH bucket. This indicates that filters - * should flush their data. There is no guarantee that they will flush it, - * but this is the best we can do. - * @param b The bucket to make into a FLUSH bucket - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_flush_make(apr_bucket *b); - -/** - * Create a bucket referring to long-lived data. - * @param buf The data to insert into the bucket - * @param nbyte The size of the data to insert. - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_immortal_create(const char *buf, - apr_size_t nbyte, - apr_bucket_alloc_t *list); - -/** - * Make the bucket passed in a bucket refer to long-lived data - * @param b The bucket to make into a IMMORTAL bucket - * @param buf The data to insert into the bucket - * @param nbyte The size of the data to insert. - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_immortal_make(apr_bucket *b, - const char *buf, - apr_size_t nbyte); - -/** - * Create a bucket referring to data on the stack. - * @param buf The data to insert into the bucket - * @param nbyte The size of the data to insert. - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_transient_create(const char *buf, - apr_size_t nbyte, - apr_bucket_alloc_t *list); - -/** - * Make the bucket passed in a bucket refer to stack data - * @param b The bucket to make into a TRANSIENT bucket - * @param buf The data to insert into the bucket - * @param nbyte The size of the data to insert. - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_transient_make(apr_bucket *b, - const char *buf, - apr_size_t nbyte); - -/** - * Create a bucket referring to memory on the heap. If the caller asks - * for the data to be copied, this function always allocates 4K of - * memory so that more data can be added to the bucket without - * requiring another allocation. Therefore not all the data may be put - * into the bucket. If copying is not requested then the bucket takes - * over responsibility for free()ing the memory. - * @param buf The buffer to insert into the bucket - * @param nbyte The size of the buffer to insert. - * @param free_func Function to use to free the data; NULL indicates that the - * bucket should make a copy of the data - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_heap_create(const char *buf, - apr_size_t nbyte, - void (*free_func)(void *data), - apr_bucket_alloc_t *list); -/** - * Make the bucket passed in a bucket refer to heap data - * @param b The bucket to make into a HEAP bucket - * @param buf The buffer to insert into the bucket - * @param nbyte The size of the buffer to insert. - * @param free_func Function to use to free the data; NULL indicates that the - * bucket should make a copy of the data - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_heap_make(apr_bucket *b, const char *buf, - apr_size_t nbyte, - void (*free_func)(void *data)); - -/** - * Create a bucket referring to memory allocated from a pool. - * - * @param buf The buffer to insert into the bucket - * @param length The number of bytes referred to by this bucket - * @param pool The pool the memory was allocated from - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_pool_create(const char *buf, - apr_size_t length, - apr_pool_t *pool, - apr_bucket_alloc_t *list); - -/** - * Make the bucket passed in a bucket refer to pool data - * @param b The bucket to make into a pool bucket - * @param buf The buffer to insert into the bucket - * @param length The number of bytes referred to by this bucket - * @param pool The pool the memory was allocated from - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_pool_make(apr_bucket *b, const char *buf, - apr_size_t length, - apr_pool_t *pool); - -#if APR_HAS_MMAP -/** - * Create a bucket referring to mmap()ed memory. - * @param mm The mmap to insert into the bucket - * @param start The offset of the first byte in the mmap - * that this bucket refers to - * @param length The number of bytes referred to by this bucket - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_mmap_create(apr_mmap_t *mm, - apr_off_t start, - apr_size_t length, - apr_bucket_alloc_t *list); - -/** - * Make the bucket passed in a bucket refer to an MMAP'ed file - * @param b The bucket to make into a MMAP bucket - * @param mm The mmap to insert into the bucket - * @param start The offset of the first byte in the mmap - * that this bucket refers to - * @param length The number of bytes referred to by this bucket - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_mmap_make(apr_bucket *b, apr_mmap_t *mm, - apr_off_t start, - apr_size_t length); -#endif - -/** - * Create a bucket referring to a socket. - * @param thissock The socket to put in the bucket - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_socket_create(apr_socket_t *thissock, - apr_bucket_alloc_t *list); -/** - * Make the bucket passed in a bucket refer to a socket - * @param b The bucket to make into a SOCKET bucket - * @param thissock The socket to put in the bucket - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_socket_make(apr_bucket *b, - apr_socket_t *thissock); - -/** - * Create a bucket referring to a pipe. - * @param thispipe The pipe to put in the bucket - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_pipe_create(apr_file_t *thispipe, - apr_bucket_alloc_t *list); - -/** - * Make the bucket passed in a bucket refer to a pipe - * @param b The bucket to make into a PIPE bucket - * @param thispipe The pipe to put in the bucket - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_pipe_make(apr_bucket *b, - apr_file_t *thispipe); - -/** - * Create a bucket referring to a file. - * @param fd The file to put in the bucket - * @param offset The offset where the data of interest begins in the file - * @param len The amount of data in the file we are interested in - * @param p The pool into which any needed structures should be created - * while reading from this file bucket - * @param list The freelist from which this bucket should be allocated - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_file_create(apr_file_t *fd, - apr_off_t offset, - apr_size_t len, - apr_pool_t *p, - apr_bucket_alloc_t *list); - -/** - * Make the bucket passed in a bucket refer to a file - * @param b The bucket to make into a FILE bucket - * @param fd The file to put in the bucket - * @param offset The offset where the data of interest begins in the file - * @param len The amount of data in the file we are interested in - * @param p The pool into which any needed structures should be created - * while reading from this file bucket - * @return The new bucket, or NULL if allocation failed - */ -APU_DECLARE(apr_bucket *) apr_bucket_file_make(apr_bucket *b, apr_file_t *fd, - apr_off_t offset, - apr_size_t len, apr_pool_t *p); - -/** - * Enable or disable memory-mapping for a FILE bucket (default is enabled) - * @param b The bucket - * @param enabled Whether memory-mapping should be enabled - * @return APR_SUCCESS normally, or an error code if the operation fails - */ -APU_DECLARE(apr_status_t) apr_bucket_file_enable_mmap(apr_bucket *b, - int enabled); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* !APR_BUCKETS_H */ diff --git a/libs/apr-util/include/apr_date.h b/libs/apr-util/include/apr_date.h deleted file mode 100644 index 87500a3394..0000000000 --- a/libs/apr-util/include/apr_date.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_DATE_H -#define APR_DATE_H - -/** - * @file apr_date.h - * @brief APR-UTIL date routines - */ - -/** - * @defgroup APR_Util_Date Date routines - * @ingroup APR_Util - * @{ - */ - -/* - * apr_date.h: prototypes for date parsing utility routines - */ - -#include "apu.h" -#include "apr_time.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** A bad date. */ -#define APR_DATE_BAD ((apr_time_t)0) - -/** - * Compare a string to a mask - * @param data The string to compare - * @param mask Mask characters (arbitrary maximum is 256 characters): - *
- *   '\@' - uppercase letter
- *   '\$' - lowercase letter
- *   '\&' - hex digit
- *   '#' - digit
- *   '~' - digit or space
- *   '*' - swallow remaining characters
- * 
- * @remark The mask tests for an exact match for any other character - * @return 1 if the string matches, 0 otherwise - */ -APU_DECLARE(int) apr_date_checkmask(const char *data, const char *mask); - -/** - * Parses an HTTP date in one of three standard forms: - *
- *     Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
- *     Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
- *     Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format
- * 
- * @param date The date in one of the three formats above - * @return the apr_time_t number of microseconds since 1 Jan 1970 GMT, or - * 0 if this would be out of range or if the date is invalid. - */ -APU_DECLARE(apr_time_t) apr_date_parse_http(const char *date); - -/** - * Parses a string resembling an RFC 822 date. This is meant to be - * leinent in its parsing of dates. Hence, this will parse a wider - * range of dates than apr_date_parse_http. - * - * The prominent mailer (or poster, if mailer is unknown) that has - * been seen in the wild is included for the unknown formats. - *
- *     Sun, 06 Nov 1994 08:49:37 GMT  ; RFC 822, updated by RFC 1123
- *     Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
- *     Sun Nov  6 08:49:37 1994       ; ANSI C's asctime() format
- *     Sun, 6 Nov 1994 08:49:37 GMT   ; RFC 822, updated by RFC 1123
- *     Sun, 06 Nov 94 08:49:37 GMT    ; RFC 822
- *     Sun, 6 Nov 94 08:49:37 GMT     ; RFC 822
- *     Sun, 06 Nov 94 08:49 GMT       ; Unknown [drtr\@ast.cam.ac.uk] 
- *     Sun, 6 Nov 94 08:49 GMT        ; Unknown [drtr\@ast.cam.ac.uk]
- *     Sun, 06 Nov 94 8:49:37 GMT     ; Unknown [Elm 70.85]
- *     Sun, 6 Nov 94 8:49:37 GMT      ; Unknown [Elm 70.85] 
- * 
- * - * @param date The date in one of the formats above - * @return the apr_time_t number of microseconds since 1 Jan 1970 GMT, or - * 0 if this would be out of range or if the date is invalid. - */ -APU_DECLARE(apr_time_t) apr_date_parse_rfc(const char *date); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* !APR_DATE_H */ diff --git a/libs/apr-util/include/apr_dbd.h b/libs/apr-util/include/apr_dbd.h deleted file mode 100644 index 103ff9cb5e..0000000000 --- a/libs/apr-util/include/apr_dbd.h +++ /dev/null @@ -1,357 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* Overview of what this is and does: - * http://www.apache.org/~niq/dbd.html - */ - -#ifndef APR_DBD_H -#define APR_DBD_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file apr_dbd.h - * @brief APR-UTIL DBD library - */ -/** - * @defgroup APR_Util_DBD DBD routines - * @ingroup APR_Util - * @{ - */ - -/* These are opaque structs. Instantiation is up to each backend */ -typedef struct apr_dbd_driver_t apr_dbd_driver_t; -typedef struct apr_dbd_t apr_dbd_t; -typedef struct apr_dbd_transaction_t apr_dbd_transaction_t; -typedef struct apr_dbd_results_t apr_dbd_results_t; -typedef struct apr_dbd_row_t apr_dbd_row_t; -typedef struct apr_dbd_prepared_t apr_dbd_prepared_t; - -/** apr_dbd_init: perform once-only initialisation. Call once only. - * - * @param pool - pool to register any shutdown cleanups, etc - */ -APU_DECLARE(apr_status_t) apr_dbd_init(apr_pool_t *pool); - -/** apr_dbd_get_driver: get the driver struct for a name - * - * @param pool - (process) pool to register cleanup - * @param name - driver name - * @param driver - pointer to driver struct. - * @return APR_SUCCESS for success - * @return APR_ENOTIMPL for no driver (when DSO not enabled) - * @return APR_EDSOOPEN if DSO driver file can't be opened - * @return APR_ESYMNOTFOUND if the driver file doesn't contain a driver - */ -APU_DECLARE(apr_status_t) apr_dbd_get_driver(apr_pool_t *pool, const char *name, - const apr_dbd_driver_t **driver); - -/** apr_dbd_open: open a connection to a backend - * - * @param pool - working pool - * @param params - arguments to driver (implementation-dependent) - * @param handle - pointer to handle to return - * @param driver - driver struct. - * @return APR_SUCCESS for success - * @return APR_EGENERAL if driver exists but connection failed - * @remarks PostgreSQL: the params is passed directly to the PQconnectdb() - * function (check PostgreSQL documentation for more details on the syntax). - * @remarks SQLite2: the params is split on a colon, with the first part used - * as the filename and second part converted to an integer and used as file - * mode. - * @remarks SQLite3: the params is passed directly to the sqlite3_open() - * function as a filename to be opened (check SQLite3 documentation for more - * details). - * @remarks MySQL: the params can have "host", "port", "user", "pass", - * "dbname", "sock", "flags" and "fldsz" keys, each followed by an equal sign - * and a value. Such key/value pairs can be delimited by space, CR, LF, tab, - * semicolon, vertical bar or comma. For now, "flags" can only recognise - * CLIENT_FOUND_ROWS (check MySQL manual for details). The value associated - * with "fldsz" determines maximum amount of memory (in bytes) for each of - * the fields in the result set of prepared statements. By default, this - * value is 1 MB. - */ -APU_DECLARE(apr_status_t) apr_dbd_open(const apr_dbd_driver_t *driver, - apr_pool_t *pool, const char *params, - apr_dbd_t **handle); - -/** apr_dbd_close: close a connection to a backend - * - * @param handle - handle to close - * @param driver - driver struct. - * @return APR_SUCCESS for success or error status - */ -APU_DECLARE(apr_status_t) apr_dbd_close(const apr_dbd_driver_t *driver, - apr_dbd_t *handle); - -/* apr-function-shaped versions of things */ - -/** apr_dbd_name: get the name of the driver - * - * @param driver - the driver - * @return - name - */ -APU_DECLARE(const char*) apr_dbd_name(const apr_dbd_driver_t *driver); - -/** apr_dbd_native_handle: get native database handle of the underlying db - * - * @param driver - the driver - * @param handle - apr_dbd handle - * @return - native handle - */ -APU_DECLARE(void*) apr_dbd_native_handle(const apr_dbd_driver_t *driver, - apr_dbd_t *handle); - -/** check_conn: check status of a database connection - * - * @param driver - the driver - * @param pool - working pool - * @param handle - the connection to check - * @return APR_SUCCESS or error - */ -APU_DECLARE(int) apr_dbd_check_conn(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle); - -/** apr_dbd_set_dbname: select database name. May be a no-op if not supported. - * - * @param driver - the driver - * @param pool - working pool - * @param handle - the connection - * @param name - the database to select - * @return 0 for success or error code - */ -APU_DECLARE(int) apr_dbd_set_dbname(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle, const char *name); - -/** apr_dbd_transaction_start: start a transaction. May be a no-op. - * - * @param driver - the driver - * @param pool - a pool to use for error messages (if any). - * @param handle - the db connection - * @param trans - ptr to a transaction. May be null on entry - * @return 0 for success or error code - * @remarks If any of the query/select calls during a transaction return - * non-zero status code, the transaction will inherit this code and any - * further query/select calls will fail immediately. - */ -APU_DECLARE(int) apr_dbd_transaction_start(const apr_dbd_driver_t *driver, - apr_pool_t *pool, - apr_dbd_t *handle, - apr_dbd_transaction_t **trans); - -/** apr_dbd_transaction_end: end a transaction - * (commit on success, rollback on error). - * May be a no-op. - * - * @param driver - the driver - * @param handle - the db connection - * @param trans - the transaction. - * @return 0 for success or error code - */ -APU_DECLARE(int) apr_dbd_transaction_end(const apr_dbd_driver_t *driver, - apr_pool_t *pool, - apr_dbd_transaction_t *trans); - -/** apr_dbd_query: execute an SQL query that doesn't return a result set - * - * @param driver - the driver - * @param handle - the connection - * @param nrows - number of rows affected. - * @param statement - the SQL statement to execute - * @return 0 for success or error code - */ -APU_DECLARE(int) apr_dbd_query(const apr_dbd_driver_t *driver, apr_dbd_t *handle, - int *nrows, const char *statement); - -/** apr_dbd_select: execute an SQL query that returns a result set - * - * @param driver - the driver - * @param pool - pool to allocate the result set - * @param handle - the connection - * @param res - pointer to result set pointer. May point to NULL on entry - * @param statement - the SQL statement to execute - * @param random - 1 to support random access to results (seek any row); - * 0 to support only looping through results in order - * (async access - faster) - * @return 0 for success or error code - */ -APU_DECLARE(int) apr_dbd_select(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle, apr_dbd_results_t **res, - const char *statement, int random); - -/** apr_dbd_num_cols: get the number of columns in a results set - * - * @param driver - the driver - * @param res - result set. - * @return number of columns - */ -APU_DECLARE(int) apr_dbd_num_cols(const apr_dbd_driver_t *driver, - apr_dbd_results_t *res); - -/** apr_dbd_num_tuples: get the number of rows in a results set - * of a synchronous select - * - * @param driver - the driver - * @param res - result set. - * @return number of rows, or -1 if the results are asynchronous - */ -APU_DECLARE(int) apr_dbd_num_tuples(const apr_dbd_driver_t *driver, - apr_dbd_results_t *res); - -/** apr_dbd_get_row: get a row from a result set - * - * @param driver - the driver - * @param pool - pool to allocate the row - * @param res - result set pointer - * @param row - pointer to row pointer. May point to NULL on entry - * @param rownum - row number, or -1 for "next row". Ignored if random - * access is not supported. - * @return 0 for success, -1 for rownum out of range or data finished - */ -APU_DECLARE(int) apr_dbd_get_row(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_results_t *res, apr_dbd_row_t **row, - int rownum); - -/** apr_dbd_get_entry: get an entry from a row - * - * @param driver - the driver - * @param row - row pointer - * @param col - entry number - * @return value from the row, or NULL if col is out of bounds. - */ -APU_DECLARE(const char*) apr_dbd_get_entry(const apr_dbd_driver_t *driver, - apr_dbd_row_t *row, int col); - -/** apr_dbd_error: get current error message (if any) - * - * @param driver - the driver - * @param handle - the connection - * @param errnum - error code from operation that returned an error - * @return the database current error message, or message for errnum - * (implementation-dependent whether errnum is ignored) - */ -APU_DECLARE(const char*) apr_dbd_error(const apr_dbd_driver_t *driver, - apr_dbd_t *handle, int errnum); - -/** apr_dbd_escape: escape a string so it is safe for use in query/select - * - * @param driver - the driver - * @param pool - pool to alloc the result from - * @param string - the string to escape - * @param handle - the connection - * @return the escaped, safe string - */ -APU_DECLARE(const char*) apr_dbd_escape(const apr_dbd_driver_t *driver, - apr_pool_t *pool, const char *string, - apr_dbd_t *handle); - -/** apr_dbd_prepare: prepare a statement - * - * @param driver - the driver - * @param pool - pool to alloc the result from - * @param handle - the connection - * @param query - the SQL query - * @param label - A label for the prepared statement. - * use NULL for temporary prepared statements - * (eg within a Request in httpd) - * @param statement - statement to prepare. May point to null on entry. - * @return 0 for success or error code - * @remarks To specify parameters of the prepared query, use %s in place of - * database specific parameter syntax (e.g. for PostgreSQL, this would be $1, - * $2, for SQLite3 this would be ? etc.). For instance: "SELECT name FROM - * customers WHERE name=%s" would be a query that this function understands. - * Some drivers may support different data types using printf-like format: - * for example %d (e.g. PostgreSQL) or %f for numeric data. - */ -APU_DECLARE(int) apr_dbd_prepare(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle, const char *query, - const char *label, - apr_dbd_prepared_t **statement); - - -/** apr_dbd_pquery: query using a prepared statement + args - * - * @param driver - the driver - * @param pool - working pool - * @param handle - the connection - * @param nrows - number of rows affected. - * @param statement - the prepared statement to execute - * @param nargs - number of args to prepared statement - * @param args - args to prepared statement - * @return 0 for success or error code - */ -APU_DECLARE(int) apr_dbd_pquery(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle, int *nrows, - apr_dbd_prepared_t *statement, int nargs, - const char **args); - -/** apr_dbd_pselect: select using a prepared statement + args - * - * @param driver - the driver - * @param pool - working pool - * @param handle - the connection - * @param res - pointer to query results. May point to NULL on entry - * @param statement - the prepared statement to execute - * @param random - Whether to support random-access to results - * @param nargs - number of args to prepared statement - * @param args - args to prepared statement - * @return 0 for success or error code - */ -APU_DECLARE(int) apr_dbd_pselect(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle, apr_dbd_results_t **res, - apr_dbd_prepared_t *statement, int random, - int nargs, const char **args); - -/** apr_dbd_pvquery: query using a prepared statement + args - * - * @param driver - the driver - * @param pool - working pool - * @param handle - the connection - * @param nrows - number of rows affected. - * @param statement - the prepared statement to execute - * @param ... - varargs list - * @return 0 for success or error code - */ -APU_DECLARE(int) apr_dbd_pvquery(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle, int *nrows, - apr_dbd_prepared_t *statement, ...); - -/** apr_dbd_pvselect: select using a prepared statement + args - * - * @param driver - the driver - * @param pool - working pool - * @param handle - the connection - * @param res - pointer to query results. May point to NULL on entry - * @param statement - the prepared statement to execute - * @param random - Whether to support random-access to results - * @param ... - varargs list - * @return 0 for success or error code - */ -APU_DECLARE(int) apr_dbd_pvselect(const apr_dbd_driver_t *driver, apr_pool_t *pool, - apr_dbd_t *handle, apr_dbd_results_t **res, - apr_dbd_prepared_t *statement, int random, - ...); - -/** @} */ - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libs/apr-util/include/apr_dbm.h b/libs/apr-util/include/apr_dbm.h deleted file mode 100644 index d34f9ad3f3..0000000000 --- a/libs/apr-util/include/apr_dbm.h +++ /dev/null @@ -1,224 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_DBM_H -#define APR_DBM_H - -#include "apu.h" -#include "apr.h" -#include "apr_errno.h" -#include "apr_pools.h" -#include "apr_file_info.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file apr_dbm.h - * @brief APR-UTIL DBM library - */ -/** - * @defgroup APR_Util_DBM DBM routines - * @ingroup APR_Util - * @{ - */ -/** - * Structure for referencing a dbm - */ -typedef struct apr_dbm_t apr_dbm_t; - -/** - * Structure for referencing the datum record within a dbm - */ -typedef struct -{ - /** pointer to the 'data' to retrieve/store in the DBM */ - char *dptr; - /** size of the 'data' to retrieve/store in the DBM */ - apr_size_t dsize; -} apr_datum_t; - -/* modes to open the DB */ -#define APR_DBM_READONLY 1 /**< open for read-only access */ -#define APR_DBM_READWRITE 2 /**< open for read-write access */ -#define APR_DBM_RWCREATE 3 /**< open for r/w, create if needed */ -#define APR_DBM_RWTRUNC 4 /**< open for r/w, truncating an existing - DB if present */ -/** - * Open a dbm file by file name and type of DBM - * @param dbm The newly opened database - * @param type The type of the DBM (not all may be available at run time) - *
- *  GDBM for GDBM files
- *  SDBM for SDBM files
- *  DB   for berkeley DB files
- *  NDBM for NDBM files
- *  default for the default DBM type
- *  
- * @param name The dbm file name to open - * @param mode The flag value - *
- *           APR_DBM_READONLY   open for read-only access
- *           APR_DBM_READWRITE  open for read-write access
- *           APR_DBM_RWCREATE   open for r/w, create if needed
- *           APR_DBM_RWTRUNC    open for r/w, truncate if already there
- * 
- * @param perm Permissions to apply to if created - * @param cntxt The pool to use when creating the dbm - * @remark The dbm name may not be a true file name, as many dbm packages - * append suffixes for seperate data and index files. - */ - -APU_DECLARE(apr_status_t) apr_dbm_open_ex(apr_dbm_t **dbm, const char* type, - const char *name, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *cntxt); - - -/** - * Open a dbm file by file name - * @param dbm The newly opened database - * @param name The dbm file name to open - * @param mode The flag value - *
- *           APR_DBM_READONLY   open for read-only access
- *           APR_DBM_READWRITE  open for read-write access
- *           APR_DBM_RWCREATE   open for r/w, create if needed
- *           APR_DBM_RWTRUNC    open for r/w, truncate if already there
- * 
- * @param perm Permissions to apply to if created - * @param cntxt The pool to use when creating the dbm - * @remark The dbm name may not be a true file name, as many dbm packages - * append suffixes for seperate data and index files. - */ -APU_DECLARE(apr_status_t) apr_dbm_open(apr_dbm_t **dbm, const char *name, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *cntxt); - -/** - * Close a dbm file previously opened by apr_dbm_open - * @param dbm The database to close - */ -APU_DECLARE(void) apr_dbm_close(apr_dbm_t *dbm); - -/** - * Fetch a dbm record value by key - * @param dbm The database - * @param key The key datum to find this record - * @param pvalue The value datum retrieved for this record - */ -APU_DECLARE(apr_status_t) apr_dbm_fetch(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t *pvalue); -/** - * Store a dbm record value by key - * @param dbm The database - * @param key The key datum to store this record by - * @param value The value datum to store in this record - */ -APU_DECLARE(apr_status_t) apr_dbm_store(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t value); - -/** - * Delete a dbm record value by key - * @param dbm The database - * @param key The key datum of the record to delete - * @remark It is not an error to delete a non-existent record. - */ -APU_DECLARE(apr_status_t) apr_dbm_delete(apr_dbm_t *dbm, apr_datum_t key); - -/** - * Search for a key within the dbm - * @param dbm The database - * @param key The datum describing a key to test - */ -APU_DECLARE(int) apr_dbm_exists(apr_dbm_t *dbm, apr_datum_t key); - -/** - * Retrieve the first record key from a dbm - * @param dbm The database - * @param pkey The key datum of the first record - */ -APU_DECLARE(apr_status_t) apr_dbm_firstkey(apr_dbm_t *dbm, apr_datum_t *pkey); - -/** - * Retrieve the next record key from a dbm - * @param dbm The database - * @param pkey The key datum of the next record - */ -APU_DECLARE(apr_status_t) apr_dbm_nextkey(apr_dbm_t *dbm, apr_datum_t *pkey); - -/** - * Proactively toss any memory associated with the apr_datum_t. - * @param dbm The database - * @param data The datum to free. - */ -APU_DECLARE(void) apr_dbm_freedatum(apr_dbm_t *dbm, apr_datum_t data); - -/** - * Report more information when an apr_dbm function fails. - * @param dbm The database - * @param errcode A DBM-specific value for the error (for logging). If this - * isn't needed, it may be NULL. - * @param errbuf Location to store the error text - * @param errbufsize The size of the provided buffer - * @return The errbuf parameter, for convenience. - */ -APU_DECLARE(char *) apr_dbm_geterror(apr_dbm_t *dbm, int *errcode, - char *errbuf, apr_size_t errbufsize); -/** - * If the specified file/path were passed to apr_dbm_open(), return the - * actual file/path names which would be (created and) used. At most, two - * files may be used; used2 may be NULL if only one file is used. - * @param pool The pool for allocating used1 and used2. - * @param type The type of DBM you require info on - * @param pathname The path name to generate used-names from. - * @param used1 The first pathname used by the apr_dbm implementation. - * @param used2 The second pathname used by apr_dbm. If only one file is - * used by the specific implementation, this will be set to NULL. - * @return An error if the specified type is invalid. - * @remark The dbm file(s) don't need to exist. This function only manipulates - * the pathnames. - */ -APU_DECLARE(apr_status_t) apr_dbm_get_usednames_ex(apr_pool_t *pool, - const char *type, - const char *pathname, - const char **used1, - const char **used2); - -/** - * If the specified file/path were passed to apr_dbm_open(), return the - * actual file/path names which would be (created and) used. At most, two - * files may be used; used2 may be NULL if only one file is used. - * @param pool The pool for allocating used1 and used2. - * @param pathname The path name to generate used-names from. - * @param used1 The first pathname used by the apr_dbm implementation. - * @param used2 The second pathname used by apr_dbm. If only one file is - * used by the specific implementation, this will be set to NULL. - * @remark The dbm file(s) don't need to exist. This function only manipulates - * the pathnames. - */ -APU_DECLARE(void) apr_dbm_get_usednames(apr_pool_t *pool, - const char *pathname, - const char **used1, - const char **used2); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* !APR_DBM_H */ diff --git a/libs/apr-util/include/apr_hooks.h b/libs/apr-util/include/apr_hooks.h deleted file mode 100644 index 287fb8cb0e..0000000000 --- a/libs/apr-util/include/apr_hooks.h +++ /dev/null @@ -1,256 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_HOOKS_H -#define APR_HOOKS_H - -#include "apu.h" -/* For apr_array_header_t */ -#include "apr_tables.h" - -/** - * @file apr_hooks.h - * @brief Apache hook functions - */ - -#ifdef __cplusplus -extern "C" { -#endif -/** - * @defgroup APR_Util_Hook Hook Functions - * @ingroup APR_Util - * @{ - */ -/** macro to return the prototype of the hook function */ -#define APR_IMPLEMENT_HOOK_GET_PROTO(ns,link,name) \ -link##_DECLARE(apr_array_header_t *) ns##_hook_get_##name(void) - -/** macro to declare the hook correctly */ -#define APR_DECLARE_EXTERNAL_HOOK(ns,link,ret,name,args) \ -typedef ret ns##_HOOK_##name##_t args; \ -link##_DECLARE(void) ns##_hook_##name(ns##_HOOK_##name##_t *pf, \ - const char * const *aszPre, \ - const char * const *aszSucc, int nOrder); \ -link##_DECLARE(ret) ns##_run_##name args; \ -APR_IMPLEMENT_HOOK_GET_PROTO(ns,link,name); \ -typedef struct ns##_LINK_##name##_t \ - { \ - ns##_HOOK_##name##_t *pFunc; \ - const char *szName; \ - const char * const *aszPredecessors; \ - const char * const *aszSuccessors; \ - int nOrder; \ - } ns##_LINK_##name##_t; - -/** macro to declare the hook structure */ -#define APR_HOOK_STRUCT(members) \ -static struct { members } _hooks; - -/** macro to link the hook structure */ -#define APR_HOOK_LINK(name) \ - apr_array_header_t *link_##name; - -/** macro to implement the hook */ -#define APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \ -link##_DECLARE(void) ns##_hook_##name(ns##_HOOK_##name##_t *pf,const char * const *aszPre, \ - const char * const *aszSucc,int nOrder) \ - { \ - ns##_LINK_##name##_t *pHook; \ - if(!_hooks.link_##name) \ - { \ - _hooks.link_##name=apr_array_make(apr_hook_global_pool,1,sizeof(ns##_LINK_##name##_t)); \ - apr_hook_sort_register(#name,&_hooks.link_##name); \ - } \ - pHook=apr_array_push(_hooks.link_##name); \ - pHook->pFunc=pf; \ - pHook->aszPredecessors=aszPre; \ - pHook->aszSuccessors=aszSucc; \ - pHook->nOrder=nOrder; \ - pHook->szName=apr_hook_debug_current; \ - if(apr_hook_debug_enabled) \ - apr_hook_debug_show(#name,aszPre,aszSucc); \ - } \ - APR_IMPLEMENT_HOOK_GET_PROTO(ns,link,name) \ - { \ - return _hooks.link_##name; \ - } - -/** - * Implement a hook that has no return code, and therefore runs all of the - * registered functions - * @param ns The namespace prefix of the hook functions - * @param link The linkage declaration prefix of the hook - * @param name The name of the hook - * @param args_decl The declaration of the arguments for the hook - * @param args_use The names for the arguments for the hook - * @note The link prefix FOO corresponds to FOO_DECLARE() macros, which - * provide export linkage from the module that IMPLEMENTs the hook, and - * import linkage from external modules that link to the hook's module. - */ -#define APR_IMPLEMENT_EXTERNAL_HOOK_VOID(ns,link,name,args_decl,args_use) \ -APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \ -link##_DECLARE(void) ns##_run_##name args_decl \ - { \ - ns##_LINK_##name##_t *pHook; \ - int n; \ -\ - if(!_hooks.link_##name) \ - return; \ -\ - pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \ - for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \ - pHook[n].pFunc args_use; \ - } - -/* FIXME: note that this returns ok when nothing is run. I suspect it should - really return decline, but that breaks Apache currently - Ben -*/ -/** - * Implement a hook that runs until one of the functions returns something - * other than OK or DECLINE - * @param ns The namespace prefix of the hook functions - * @param link The linkage declaration prefix of the hook - * @param ret Type to return - * @param name The name of the hook - * @param args_decl The declaration of the arguments for the hook - * @param args_use The names for the arguments for the hook - * @param ok Success value - * @param decline Decline value - * @note The link prefix FOO corresponds to FOO_DECLARE() macros, which - * provide export linkage from the module that IMPLEMENTs the hook, and - * import linkage from external modules that link to the hook's module. - */ -#define APR_IMPLEMENT_EXTERNAL_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline) \ -APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \ -link##_DECLARE(ret) ns##_run_##name args_decl \ - { \ - ns##_LINK_##name##_t *pHook; \ - int n; \ - ret rv; \ -\ - if(!_hooks.link_##name) \ - return ok; \ -\ - pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \ - for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \ - { \ - rv=pHook[n].pFunc args_use; \ -\ - if(rv != ok && rv != decline) \ - return rv; \ - } \ - return ok; \ - } - - -/** - * Implement a hook that runs until the first function returns something - * other than the value of decline - * @param ns The namespace prefix of the hook functions - * @param link The linkage declaration prefix of the hook - * @param name The name of the hook - * @param ret Type to return - * @param args_decl The declaration of the arguments for the hook - * @param args_use The names for the arguments for the hook - * @param decline Decline value - * @note The link prefix FOO corresponds to FOO_DECLARE() macros, which - * provide export linkage from the module that IMPLEMENTs the hook, and - * import linkage from external modules that link to the hook's module. - */ -#define APR_IMPLEMENT_EXTERNAL_HOOK_RUN_FIRST(ns,link,ret,name,args_decl,args_use,decline) \ -APR_IMPLEMENT_EXTERNAL_HOOK_BASE(ns,link,name) \ -link##_DECLARE(ret) ns##_run_##name args_decl \ - { \ - ns##_LINK_##name##_t *pHook; \ - int n; \ - ret rv; \ -\ - if(!_hooks.link_##name) \ - return decline; \ -\ - pHook=(ns##_LINK_##name##_t *)_hooks.link_##name->elts; \ - for(n=0 ; n < _hooks.link_##name->nelts ; ++n) \ - { \ - rv=pHook[n].pFunc args_use; \ -\ - if(rv != decline) \ - return rv; \ - } \ - return decline; \ - } - - /* Hook orderings */ -/** run this hook first, before ANYTHING */ -#define APR_HOOK_REALLY_FIRST (-10) -/** run this hook first */ -#define APR_HOOK_FIRST 0 -/** run this hook somewhere */ -#define APR_HOOK_MIDDLE 10 -/** run this hook after every other hook which is defined*/ -#define APR_HOOK_LAST 20 -/** run this hook last, after EVERYTHING */ -#define APR_HOOK_REALLY_LAST 30 - -/** - * The global pool used to allocate any memory needed by the hooks. - */ -APU_DECLARE_DATA extern apr_pool_t *apr_hook_global_pool; - -/** - * A global variable to determine if debugging information about the - * hooks functions should be printed - */ -APU_DECLARE_DATA extern int apr_hook_debug_enabled; - -/** - * The name of the module that is currently registering a function - */ -APU_DECLARE_DATA extern const char *apr_hook_debug_current; - -/** - * Register a hook function to be sorted - * @param szHookName The name of the Hook the function is registered for - * @param aHooks The array which stores all of the functions for this hook - */ -APU_DECLARE(void) apr_hook_sort_register(const char *szHookName, - apr_array_header_t **aHooks); -/** - * Sort all of the registerd functions for a given hook - */ -APU_DECLARE(void) apr_hook_sort_all(void); - -/** - * Print all of the information about the current hook. This is used for - * debugging purposes. - * @param szName The name of the hook - * @param aszPre All of the functions in the predecessor array - * @param aszSucc All of the functions in the successor array - */ -APU_DECLARE(void) apr_hook_debug_show(const char *szName, - const char * const *aszPre, - const char * const *aszSucc); - -/** - * Remove all currently registered functions. - */ -APU_DECLARE(void) apr_hook_deregister_all(void); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* APR_HOOKS_H */ diff --git a/libs/apr-util/include/apr_ldap.h.in b/libs/apr-util/include/apr_ldap.h.in deleted file mode 100644 index e44729d63b..0000000000 --- a/libs/apr-util/include/apr_ldap.h.in +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * apr_ldap.h is generated from apr_ldap.h.in by configure -- do not edit apr_ldap.h - */ -/** - * @file apr_ldap.h - * @brief APR-UTIL LDAP - */ -#ifndef APU_LDAP_H -#define APU_LDAP_H - -/** - * @defgroup APR_Util_LDAP LDAP - * @ingroup APR_Util - * @{ - */ - -/* this will be defined if LDAP support was compiled into apr-util */ -#define APR_HAS_LDAP @apu_has_ldap@ - -/* identify the LDAP toolkit used */ -#define APR_HAS_NETSCAPE_LDAPSDK @apu_has_ldap_netscape@ -#define APR_HAS_SOLARIS_LDAPSDK @apu_has_ldap_solaris@ -#define APR_HAS_NOVELL_LDAPSDK @apu_has_ldap_novell@ -#define APR_HAS_MOZILLA_LDAPSDK @apu_has_ldap_mozilla@ -#define APR_HAS_OPENLDAP_LDAPSDK @apu_has_ldap_openldap@ -#define APR_HAS_MICROSOFT_LDAPSDK @apu_has_ldap_microsoft@ -#define APR_HAS_OTHER_LDAPSDK @apu_has_ldap_other@ - - -/* - * Handle the case when LDAP is enabled - */ -#if APR_HAS_LDAP - -/* - * The following #defines are DEPRECATED and should not be used for - * anything. They remain to maintain binary compatibility. - * The original code defined the OPENLDAP SDK as present regardless - * of what really was there, which was way bogus. In addition, the - * apr_ldap_url_parse*() functions have been rewritten specifically for - * APR, so the APR_HAS_LDAP_URL_PARSE macro is forced to zero. - */ -#define APR_HAS_LDAP_SSL 1 -#define APR_HAS_LDAP_URL_PARSE 0 - -#if APR_HAS_OPENLDAP_LDAPSDK && !defined(LDAP_DEPRECATED) -/* Ensure that the "deprecated" interfaces are still exposed - * with OpenLDAP >= 2.3; these were exposed by default in earlier - * releases. */ -#define LDAP_DEPRECATED 1 -#endif - -/* - * Include the standard LDAP header files. - */ - -@lber_h@ -@ldap_h@ -@ldap_ssl_h@ - - -/* - * Detected standard functions - */ -#define APR_HAS_LDAPSSL_CLIENT_INIT @apu_has_ldapssl_client_init@ -#define APR_HAS_LDAPSSL_CLIENT_DEINIT @apu_has_ldapssl_client_deinit@ -#define APR_HAS_LDAPSSL_ADD_TRUSTED_CERT @apu_has_ldapssl_add_trusted_cert@ -#define APR_HAS_LDAP_START_TLS_S @apu_has_ldap_start_tls_s@ -#define APR_HAS_LDAP_SSLINIT @apu_has_ldap_sslinit@ -#define APR_HAS_LDAPSSL_INIT @apu_has_ldapssl_init@ -#define APR_HAS_LDAPSSL_INSTALL_ROUTINES @apu_has_ldapssl_install_routines@ - -/* - * Make sure the secure LDAP port is defined - */ -#ifndef LDAPS_PORT -#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */ -#endif - - -/* Note: Macros defining const casting has been removed in APR v1.0, - * pending real support for LDAP v2.0 toolkits. - * - * In the mean time, please use an LDAP v3.0 toolkit. - */ -#if LDAP_VERSION_MAX <= 2 -#error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit. -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * This structure allows the C LDAP API error codes to be returned - * along with plain text error messages that explain to us mere mortals - * what really happened. - */ -typedef struct apr_ldap_err_t { - const char *reason; - const char *msg; - int rc; -} apr_ldap_err_t; - -#ifdef __cplusplus -} -#endif - -#include "apr_ldap_url.h" -#include "apr_ldap_init.h" -#include "apr_ldap_option.h" - -/** @} */ -#endif /* APR_HAS_LDAP */ -#endif /* APU_LDAP_H */ diff --git a/libs/apr-util/include/apr_ldap.hnw b/libs/apr-util/include/apr_ldap.hnw deleted file mode 100644 index 947eaac2d7..0000000000 --- a/libs/apr-util/include/apr_ldap.hnw +++ /dev/null @@ -1,133 +0,0 @@ -/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * apr_ldap.h is generated from apr_ldap.h.in by configure -- do not edit apr_ldap.h - */ -/** - * @file apr_ldap.h - * @brief APR-UTIL LDAP - */ -#ifndef APU_LDAP_H -#define APU_LDAP_H - -/** - * @defgroup APR_Util_LDAP LDAP - * @ingroup APR_Util - * @{ - */ - -/* this will be defined if LDAP support was compiled into apr-util */ -#define APR_HAS_LDAP 1 - -/* identify the LDAP toolkit used */ -#define APR_HAS_NETSCAPE_LDAPSDK 0 -#define APR_HAS_SOLARIS_LDAPSDK 0 -#define APR_HAS_NOVELL_LDAPSDK 1 -#define APR_HAS_MOZILLA_LDAPSDK 0 -#define APR_HAS_OPENLDAP_LDAPSDK 0 -#define APR_HAS_MICROSOFT_LDAPSDK 0 -#define APR_HAS_OTHER_LDAPSDK 0 - - -/* - * Handle the case when LDAP is enabled - */ -#if APR_HAS_LDAP - -/* - * The following #defines are DEPRECATED and should not be used for - * anything. They remain to maintain binary compatibility. - * The original code defined the OPENLDAP SDK as present regardless - * of what really was there, which was way bogus. In addition, the - * apr_ldap_url_parse*() functions have been rewritten specifically for - * APR, so the APR_HAS_LDAP_URL_PARSE macro is forced to zero. - */ -#define APR_HAS_LDAP_SSL 1 -#define APR_HAS_LDAP_URL_PARSE 0 - - -/* - * Include the standard LDAP header files. - */ - -#ifdef GENEXPORTS -#define LDAP_VERSION_MAX 3 -#else -#include -#include -#if APR_HAS_LDAP_SSL -#include -#endif -#endif - - -/* - * Detected standard functions - */ -#define APR_HAS_LDAPSSL_CLIENT_INIT 1 -#define APR_HAS_LDAPSSL_CLIENT_DEINIT 1 -#define APR_HAS_LDAPSSL_ADD_TRUSTED_CERT 1 -#define APR_HAS_LDAP_START_TLS_S 0 -#define APR_HAS_LDAP_SSLINIT 0 -#define APR_HAS_LDAPSSL_INIT 1 -#define APR_HAS_LDAPSSL_INSTALL_ROUTINES 0 - - -/* - * Make sure the secure LDAP port is defined - */ -#ifndef LDAPS_PORT -#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */ -#endif - - -/* Note: Macros defining const casting has been removed in APR v1.0, - * pending real support for LDAP v2.0 toolkits. - * - * In the mean time, please use an LDAP v3.0 toolkit. - */ -#if LDAP_VERSION_MAX <= 2 -#error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit. -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * This structure allows the C LDAP API error codes to be returned - * along with plain text error messages that explain to us mere mortals - * what really happened. - */ -typedef struct apr_ldap_err_t { - const char *reason; - const char *msg; - int rc; -} apr_ldap_err_t; - -#ifdef __cplusplus -} -#endif - -#include "apr_ldap_url.h" -#include "apr_ldap_init.h" -#include "apr_ldap_option.h" - -/** @} */ -#endif /* APR_HAS_LDAP */ -#endif /* APU_LDAP_H */ - diff --git a/libs/apr-util/include/apr_ldap.hw b/libs/apr-util/include/apr_ldap.hw deleted file mode 100644 index 7a4d67f8f5..0000000000 --- a/libs/apr-util/include/apr_ldap.hw +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * apr_ldap.h is generated from apr_ldap.h.in by configure -- do not edit apr_ldap.h - */ -/** - * @file apr_ldap.h - * @brief APR-UTIL LDAP - */ -#ifndef APU_LDAP_H -#define APU_LDAP_H - -/** - * @defgroup APR_Util_LDAP LDAP - * @ingroup APR_Util - * @{ - */ - -/* this will be defined if LDAP support was compiled into apr-util */ -#define APR_HAS_LDAP 1 - -/* identify the LDAP toolkit used */ -#define APR_HAS_NETSCAPE_LDAPSDK 0 -#define APR_HAS_SOLARIS_LDAPSDK 0 -#define APR_HAS_NOVELL_LDAPSDK 0 -#define APR_HAS_MOZILLA_LDAPSDK 0 -#define APR_HAS_OPENLDAP_LDAPSDK 0 -#define APR_HAS_MICROSOFT_LDAPSDK 1 -#define APR_HAS_OTHER_LDAPSDK 0 - - -/* - * Handle the case when LDAP is enabled - */ -#if APR_HAS_LDAP - -/* - * The following #defines are DEPRECATED and should not be used for - * anything. They remain to maintain binary compatibility. - * The original code defined the OPENLDAP SDK as present regardless - * of what really was there, which was way bogus. In addition, the - * apr_ldap_url_parse*() functions have been rewritten specifically for - * APR, so the APR_HAS_LDAP_URL_PARSE macro is forced to zero. - */ -#define APR_HAS_LDAP_SSL 1 -#define APR_HAS_LDAP_URL_PARSE 0 - - -/* - * Include the standard LDAP header files. - */ - -#include - - -/* - * Detected standard functions - */ -#define APR_HAS_LDAPSSL_CLIENT_INIT 0 -#define APR_HAS_LDAPSSL_CLIENT_DEINIT 0 -#define APR_HAS_LDAPSSL_ADD_TRUSTED_CERT 0 -#define APR_HAS_LDAP_START_TLS_S 0 -#define APR_HAS_LDAP_SSLINIT 1 -#define APR_HAS_LDAPSSL_INIT 0 -#define APR_HAS_LDAPSSL_INSTALL_ROUTINES 0 - - -/* - * Make sure the secure LDAP port is defined - */ -#ifndef LDAPS_PORT -#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */ -#endif - - -/* Note: Macros defining const casting has been removed in APR v1.0, - * pending real support for LDAP v2.0 toolkits. - * - * In the mean time, please use an LDAP v3.0 toolkit. - */ -#if LDAP_VERSION_MAX <= 2 -#error Support for LDAP v2.0 toolkits has been removed from apr-util. Please use an LDAP v3.0 toolkit. -#endif - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * This structure allows the C LDAP API error codes to be returned - * along with plain text error messages that explain to us mere mortals - * what really happened. - */ -typedef struct apr_ldap_err_t { - const char *reason; - const char *msg; - int rc; -} apr_ldap_err_t; - -#ifdef __cplusplus -} -#endif - -#include "apr_ldap_url.h" -#include "apr_ldap_init.h" -#include "apr_ldap_option.h" - -/** @} */ -#endif /* APR_HAS_LDAP */ -#endif /* APU_LDAP_H */ diff --git a/libs/apr-util/include/apr_ldap_init.h b/libs/apr-util/include/apr_ldap_init.h deleted file mode 100644 index bd13d070bc..0000000000 --- a/libs/apr-util/include/apr_ldap_init.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/** - * @file apr_ldap_init.h - * @brief APR-UTIL LDAP ldap_init() functions - */ -#ifndef APR_LDAP_INIT_H -#define APR_LDAP_INIT_H - -/** - * @defgroup APR_Util_LDAP LDAP - * @ingroup APR_Util - * @{ - */ - -#include "apr_ldap.h" - -#if APR_HAS_LDAP - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * APR LDAP SSL Initialise function - * - * This function initialises SSL on the underlying LDAP toolkit - * if this is necessary. - * - * If a CA certificate is provided, this is set, however the setting - * of certificates via this method has been deprecated and will be removed in - * APR v2.0. - * - * The apr_ldap_set_option() function with the APR_LDAP_OPT_TLS_CERT option - * should be used instead to set certificates. - * - * If SSL support is not available on this platform, or a problem - * was encountered while trying to set the certificate, the function - * will return APR_EGENERAL. Further LDAP specific error information - * can be found in result_err. - * @param pool The pool to use - * @param cert_auth_file The name of the certificate to use, can be NULL - * @param cert_file_type The type of certificate specified. See the - * apr_ldap_set_option() APR_LDAP_OPT_TLS_CERT option for details. - * @param result_err The returned result - */ -APU_DECLARE(int) apr_ldap_ssl_init(apr_pool_t *pool, - const char *cert_auth_file, - int cert_file_type, - apr_ldap_err_t **result_err); - -/** - * APR LDAP SSL De-Initialise function - * - * This function tears down any SSL certificate setup previously - * set using apr_ldap_ssl_init(). It should be called to clean - * up if a graceful restart of a service is attempted. - * @todo currently we do not check whether apr_ldap_ssl_init() - * has been called first - we probably should. - */ -APU_DECLARE(int) apr_ldap_ssl_deinit(void); - -/** - * APR LDAP initialise function - * - * This function is responsible for initialising an LDAP - * connection in a toolkit independant way. It does the - * job of ldap_init() from the C api. - * - * It handles both the SSL and non-SSL case, and attempts - * to hide the complexity setup from the user. This function - * assumes that any certificate setup necessary has already - * been done. - * - * If SSL or STARTTLS needs to be enabled, and the underlying - * toolkit supports it, the following values are accepted for - * secure: - * - * APR_LDAP_NONE: No encryption - * APR_LDAP_SSL: SSL encryption (ldaps://) - * APR_LDAP_STARTTLS: Force STARTTLS on ldap:// - * @remark The Novell toolkit is only able to set the SSL mode via this - * function. To work around this limitation, set the SSL mode here if no - * per connection client certificates are present, otherwise set secure - * APR_LDAP_NONE here, then set the per connection client certificates, - * followed by setting the SSL mode via apr_ldap_set_option(). As Novell - * does not support per connection client certificates, this problem is - * worked around while still being compatible with other LDAP toolkits. - * @param pool The pool to use - * @param ldap The LDAP handle - * @param hostname The name of the host to connect to. This can be either a - * DNS name, or an IP address. - * @param portno The port to connect to - * @param secure The security mode to set - * @param result_err The returned result - */ -APU_DECLARE(int) apr_ldap_init(apr_pool_t *pool, - LDAP **ldap, - const char *hostname, - int portno, - int secure, - apr_ldap_err_t **result_err); - -/** - * APR LDAP info function - * - * This function returns a string describing the LDAP toolkit - * currently in use. The string is placed inside result_err->reason. - * @param pool The pool to use - * @param result_err The returned result - */ -APU_DECLARE(int) apr_ldap_info(apr_pool_t *pool, - apr_ldap_err_t **result_err); - -#ifdef __cplusplus -} -#endif - -#endif /* APR_HAS_LDAP */ - -/** @} */ - -#endif /* APR_LDAP_URL_H */ diff --git a/libs/apr-util/include/apr_ldap_option.h b/libs/apr-util/include/apr_ldap_option.h deleted file mode 100644 index 489dc0c8b5..0000000000 --- a/libs/apr-util/include/apr_ldap_option.h +++ /dev/null @@ -1,240 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/** - * @file apr_ldap_option.h - * @brief APR-UTIL LDAP ldap_*_option() functions - */ -#ifndef APR_LDAP_OPTION_H -#define APR_LDAP_OPTION_H - -/** - * @defgroup APR_Util_LDAP LDAP - * @ingroup APR_Util - * @{ - */ - -#include "apr_ldap.h" - -#if APR_HAS_LDAP - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* - * The following defines handle the different TLS certificate - * options available. If these options are missing, APR will try and - * emulate support for this using the deprecated ldap_start_tls_s() - * function. - */ -/** - * Set SSL mode to one of APR_LDAP_NONE, APR_LDAP_SSL, APR_LDAP_STARTTLS - * or APR_LDAP_STOPTLS. - */ -#define APR_LDAP_OPT_TLS 0x6fff -/** - * Set zero or more CA certificates, client certificates or private - * keys globally, or per connection (where supported). - */ -#define APR_LDAP_OPT_TLS_CERT 0x6ffe -/** - * Set the LDAP library to no verify the server certificate. This means - * all servers are considered trusted. - */ -#define APR_LDAP_OPT_VERIFY_CERT 0x6ffd - -/** - * Structures for the apr_set_option() cases - */ - -/** - * APR_LDAP_OPT_TLS_CERT - * - * This structure includes possible options to set certificates on - * system initialisation. Different SDKs have different certificate - * requirements, and to achieve this multiple certificates must be - * specified at once passed as an (apr_array_header_t *). - * - * Netscape: - * Needs the CA cert database (cert7.db), the client cert database (key3.db) - * and the security module file (secmod.db) set at the system initialisation - * time. Three types are supported: APR_LDAP_CERT7_DB, APR_LDAP_KEY3_DB and - * APR_LDAP_SECMOD. - * - * To specify a client cert connection, a certificate nickname needs to be - * provided with a type of APR_LDAP_CERT. - * int ldapssl_enable_clientauth( LDAP *ld, char *keynickname, - * char *keypasswd, char *certnickname ); - * keynickname is currently not used, and should be set to "" - * - * Novell: - * Needs CA certificates and client certificates set at system initialisation - * time. Three types are supported: APR_LDAP_CA*, APR_LDAP_CERT* and - * APR_LDAP_KEY*. - * - * Certificates cannot be specified per connection. - * - * The functions used are: - * ldapssl_add_trusted_cert(serverTrustedRoot, serverTrustedRootEncoding); - * Clients certs and keys are set at system initialisation time with - * int ldapssl_set_client_cert ( - * void *cert, - * int type - * void *password); - * type can be LDAPSSL_CERT_FILETYPE_B64 or LDAPSSL_CERT_FILETYPE_DER - * ldapssl_set_client_private_key(clientPrivateKey, - * clientPrivateKeyEncoding, - * clientPrivateKeyPassword); - * - * OpenSSL: - * Needs one or more CA certificates to be set at system initialisation time - * with a type of APR_LDAP_CA*. - * - * May have one or more client certificates set per connection with a type of - * APR_LDAP_CERT*, and keys with APR_LDAP_KEY*. - */ -/** CA certificate type unknown */ -#define APR_LDAP_CA_TYPE_UNKNOWN 0 -/** binary DER encoded CA certificate */ -#define APR_LDAP_CA_TYPE_DER 1 -/** PEM encoded CA certificate */ -#define APR_LDAP_CA_TYPE_BASE64 2 -/** Netscape/Mozilla cert7.db CA certificate database */ -#define APR_LDAP_CA_TYPE_CERT7_DB 3 -/** Netscape/Mozilla secmod file */ -#define APR_LDAP_CA_TYPE_SECMOD 4 -/** Client certificate type unknown */ -#define APR_LDAP_CERT_TYPE_UNKNOWN 5 -/** binary DER encoded client certificate */ -#define APR_LDAP_CERT_TYPE_DER 6 -/** PEM encoded client certificate */ -#define APR_LDAP_CERT_TYPE_BASE64 7 -/** Netscape/Mozilla key3.db client certificate database */ -#define APR_LDAP_CERT_TYPE_KEY3_DB 8 -/** Netscape/Mozilla client certificate nickname */ -#define APR_LDAP_CERT_TYPE_NICKNAME 9 -/** Private key type unknown */ -#define APR_LDAP_KEY_TYPE_UNKNOWN 10 -/** binary DER encoded private key */ -#define APR_LDAP_KEY_TYPE_DER 11 -/** PEM encoded private key */ -#define APR_LDAP_KEY_TYPE_BASE64 12 -/** PKCS#12 encoded client certificate */ -#define APR_LDAP_CERT_TYPE_PFX 13 -/** PKCS#12 encoded private key */ -#define APR_LDAP_KEY_TYPE_PFX 14 - -/** - * Certificate structure. - * - * This structure is used to store certificate details. An array of - * these structures is passed to apr_ldap_set_option() to set CA - * and client certificates. - * @param type Type of certificate APR_LDAP_*_TYPE_* - * @param path Path, file or nickname of the certificate - * @param password Optional password, can be NULL - */ -typedef struct apr_ldap_opt_tls_cert_t apr_ldap_opt_tls_cert_t; -struct apr_ldap_opt_tls_cert_t { - int type; - const char *path; - const char *password; -}; - -/** - * APR_LDAP_OPT_TLS - * - * This sets the SSL level on the LDAP handle. - * - * Netscape/Mozilla: - * Supports SSL, but not STARTTLS - * SSL is enabled by calling ldapssl_install_routines(). - * - * Novell: - * Supports SSL and STARTTLS. - * SSL is enabled by calling ldapssl_install_routines(). Note that calling - * other ldap functions before ldapssl_install_routines() may cause this - * function to fail. - * STARTTLS is enabled by calling ldapssl_start_tls_s() after calling - * ldapssl_install_routines() (check this). - * - * OpenLDAP: - * Supports SSL and supports STARTTLS, but none of this is documented: - * http://www.openldap.org/lists/openldap-software/200409/msg00618.html - * Documentation for both SSL support and STARTTLS has been deleted from - * the OpenLDAP documentation and website. - */ - -/** No encryption */ -#define APR_LDAP_NONE 0 -/** SSL encryption (ldaps://) */ -#define APR_LDAP_SSL 1 -/** TLS encryption (STARTTLS) */ -#define APR_LDAP_STARTTLS 2 -/** end TLS encryption (STOPTLS) */ -#define APR_LDAP_STOPTLS 3 - -/** - * APR LDAP get option function - * - * This function gets option values from a given LDAP session if - * one was specified. It maps to the native ldap_get_option() function. - * @param pool The pool to use - * @param ldap The LDAP handle - * @param option The LDAP_OPT_* option to return - * @param outvalue The value returned (if any) - * @param result_err The apr_ldap_err_t structure contained detailed results - * of the operation. - */ -APU_DECLARE(int) apr_ldap_get_option(apr_pool_t *pool, - LDAP *ldap, - int option, - void *outvalue, - apr_ldap_err_t **result_err); - -/** - * APR LDAP set option function - * - * This function sets option values to a given LDAP session if - * one was specified. It maps to the native ldap_set_option() function. - * - * Where an option is not supported by an LDAP toolkit, this function - * will try and apply legacy functions to achieve the same effect, - * depending on the platform. - * @param pool The pool to use - * @param ldap The LDAP handle - * @param option The LDAP_OPT_* option to set - * @param invalue The value to set - * @param result_err The apr_ldap_err_t structure contained detailed results - * of the operation. - */ -APU_DECLARE(int) apr_ldap_set_option(apr_pool_t *pool, - LDAP *ldap, - int option, - const void *invalue, - apr_ldap_err_t **result_err); - -#ifdef __cplusplus -} -#endif - -#endif /* APR_HAS_LDAP */ - -/** @} */ - -#endif /* APR_LDAP_OPTION_H */ - diff --git a/libs/apr-util/include/apr_ldap_url.h b/libs/apr-util/include/apr_ldap_url.h deleted file mode 100644 index de59161409..0000000000 --- a/libs/apr-util/include/apr_ldap_url.h +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/** - * @file apr_ldap_url.h - * @brief APR-UTIL LDAP ldap_init() functions - */ -#ifndef APR_LDAP_URL_H -#define APR_LDAP_URL_H - -/** - * @defgroup APR_Util_LDAP LDAP - * @ingroup APR_Util - * @{ - */ - -#if APR_HAS_LDAP - -#include "apu.h" -#include "apr_pools.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** Structure to access an exploded LDAP URL */ -typedef struct apr_ldap_url_desc_t { - struct apr_ldap_url_desc_t *lud_next; - char *lud_scheme; - char *lud_host; - int lud_port; - char *lud_dn; - char **lud_attrs; - int lud_scope; - char *lud_filter; - char **lud_exts; - int lud_crit_exts; -} apr_ldap_url_desc_t; - -#ifndef APR_LDAP_URL_SUCCESS -#define APR_LDAP_URL_SUCCESS 0x00 /* Success */ -#define APR_LDAP_URL_ERR_MEM 0x01 /* can't allocate memory space */ -#define APR_LDAP_URL_ERR_PARAM 0x02 /* parameter is bad */ -#define APR_LDAP_URL_ERR_BADSCHEME 0x03 /* URL doesn't begin with "ldap[si]://" */ -#define APR_LDAP_URL_ERR_BADENCLOSURE 0x04 /* URL is missing trailing ">" */ -#define APR_LDAP_URL_ERR_BADURL 0x05 /* URL is bad */ -#define APR_LDAP_URL_ERR_BADHOST 0x06 /* host port is bad */ -#define APR_LDAP_URL_ERR_BADATTRS 0x07 /* bad (or missing) attributes */ -#define APR_LDAP_URL_ERR_BADSCOPE 0x08 /* scope string is invalid (or missing) */ -#define APR_LDAP_URL_ERR_BADFILTER 0x09 /* bad or missing filter */ -#define APR_LDAP_URL_ERR_BADEXTS 0x0a /* bad or missing extensions */ -#endif - -/** - * Is this URL an ldap url? ldap:// - * @param url The url to test - */ -APU_DECLARE(int) apr_ldap_is_ldap_url(const char *url); - -/** - * Is this URL an SSL ldap url? ldaps:// - * @param url The url to test - */ -APU_DECLARE(int) apr_ldap_is_ldaps_url(const char *url); - -/** - * Is this URL an ldap socket url? ldapi:// - * @param url The url to test - */ -APU_DECLARE(int) apr_ldap_is_ldapi_url(const char *url); - -/** - * Parse an LDAP URL. - * @param pool The pool to use - * @param url_in The URL to parse - * @param ludpp The structure to return the exploded URL - * @param result_err The result structure of the operation - */ -APU_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool, - const char *url_in, - apr_ldap_url_desc_t **ludpp, - apr_ldap_err_t **result_err); - -/** - * Parse an LDAP URL. - * @param pool The pool to use - * @param url_in The URL to parse - * @param ludpp The structure to return the exploded URL - * @param result_err The result structure of the operation - */ -APU_DECLARE(int) apr_ldap_url_parse(apr_pool_t *pool, - const char *url_in, - apr_ldap_url_desc_t **ludpp, - apr_ldap_err_t **result_err); - -#ifdef __cplusplus -} -#endif - -#endif /* APR_HAS_LDAP */ - -/** @} */ - -#endif /* APR_LDAP_URL_H */ diff --git a/libs/apr-util/include/apr_md4.h b/libs/apr-util/include/apr_md4.h deleted file mode 100644 index 42d108df9f..0000000000 --- a/libs/apr-util/include/apr_md4.h +++ /dev/null @@ -1,135 +0,0 @@ -/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ -/* This is derived from material copyright RSA Data Security, Inc. - * Their notice is reproduced below in its entirety. - * - * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - * rights reserved. - * - * License to copy and use this software is granted provided that it - * is identified as the "RSA Data Security, Inc. MD4 Message-Digest - * Algorithm" in all material mentioning or referencing this software - * or this function. - * - * License is also granted to make and use derivative works provided - * that such works are identified as "derived from the RSA Data - * Security, Inc. MD4 Message-Digest Algorithm" in all material - * mentioning or referencing the derived work. - * - * RSA Data Security, Inc. makes no representations concerning either - * the merchantability of this software or the suitability of this - * software for any particular purpose. It is provided "as is" - * without express or implied warranty of any kind. - * - * These notices must be retained in any copies of any part of this - * documentation and/or software. - */ - -#ifndef APR_MD4_H -#define APR_MD4_H - -#include "apu.h" -#include "apr_xlate.h" -/** - * @file apr_md4.h - * @brief APR-UTIL MD4 Library - */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup APR_Util_MD4 MD4 Library - * @ingroup APR_Util - * @{ - */ - -/** The digestsize for MD4 */ -#define APR_MD4_DIGESTSIZE 16 - -/** @see apr_md4_ctx_t */ -typedef struct apr_md4_ctx_t apr_md4_ctx_t; - -/** MD4 context. */ -struct apr_md4_ctx_t { - /** state (ABCD) */ - apr_uint32_t state[4]; - /** number of bits, modulo 2^64 (lsb first) */ - apr_uint32_t count[2]; - /** input buffer */ - unsigned char buffer[64]; -#if APR_HAS_XLATE - /** translation handle */ - apr_xlate_t *xlate; -#endif -}; - -/** - * MD4 Initialize. Begins an MD4 operation, writing a new context. - * @param context The MD4 context to initialize. - */ -APU_DECLARE(apr_status_t) apr_md4_init(apr_md4_ctx_t *context); - -#if APR_HAS_XLATE -/** - * MDr4 translation setup. Provides the APR translation handle to be used - * for translating the content before calculating the digest. - * @param context The MD4 content to set the translation for. - * @param xlate The translation handle to use for this MD4 context - */ -APU_DECLARE(apr_status_t) apr_md4_set_xlate(apr_md4_ctx_t *context, - apr_xlate_t *xlate); -#else -#define apr_md4_set_xlate(context, xlate) APR_ENOTIMPL -#endif - -/** - * MD4 block update operation. Continue an MD4 message-digest operation, - * processing another message block, and updating the context. - * @param context The MD4 content to update. - * @param input next message block to update - * @param inputLen The length of the next message block - */ -APU_DECLARE(apr_status_t) apr_md4_update(apr_md4_ctx_t *context, - const unsigned char *input, - apr_size_t inputLen); - -/** - * MD4 finalization. Ends an MD4 message-digest operation, writing the - * message digest and zeroing the context - * @param digest The final MD4 digest - * @param context The MD4 content we are finalizing. - */ -APU_DECLARE(apr_status_t) apr_md4_final( - unsigned char digest[APR_MD4_DIGESTSIZE], - apr_md4_ctx_t *context); - -/** - * MD4 digest computation - * @param digest The MD4 digest - * @param input message block to use - * @param inputLen The length of the message block - */ -APU_DECLARE(apr_status_t) apr_md4(unsigned char digest[APR_MD4_DIGESTSIZE], - const unsigned char *input, - apr_size_t inputLen); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* !APR_MD4_H */ diff --git a/libs/apr-util/include/apr_md5.h b/libs/apr-util/include/apr_md5.h deleted file mode 100644 index c6a306e3c4..0000000000 --- a/libs/apr-util/include/apr_md5.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * This is work is derived from material Copyright RSA Data Security, Inc. - * - * The RSA copyright statement and Licence for that original material is - * included below. This is followed by the Apache copyright statement and - * licence for the modifications made to that material. - */ - -/* Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - rights reserved. - - License to copy and use this software is granted provided that it - is identified as the "RSA Data Security, Inc. MD5 Message-Digest - Algorithm" in all material mentioning or referencing this software - or this function. - - License is also granted to make and use derivative works provided - that such works are identified as "derived from the RSA Data - Security, Inc. MD5 Message-Digest Algorithm" in all material - mentioning or referencing the derived work. - - RSA Data Security, Inc. makes no representations concerning either - the merchantability of this software or the suitability of this - software for any particular purpose. It is provided "as is" - without express or implied warranty of any kind. - - These notices must be retained in any copies of any part of this - documentation and/or software. - */ - -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_MD5_H -#define APR_MD5_H - -#include "apu.h" -#include "apr_xlate.h" - -#ifdef __cplusplus -extern "C" { -#endif -/** - * @file apr_md5.h - * @brief APR MD5 Routines - */ - -/** - * @defgroup APR_MD5 MD5 Routines - * @ingroup APR - * @{ - */ - -/** The MD5 digest size */ -#define APR_MD5_DIGESTSIZE 16 - -/** @see apr_md5_ctx_t */ -typedef struct apr_md5_ctx_t apr_md5_ctx_t; - -/** MD5 context. */ -struct apr_md5_ctx_t { - /** state (ABCD) */ - apr_uint32_t state[4]; - /** number of bits, modulo 2^64 (lsb first) */ - apr_uint32_t count[2]; - /** input buffer */ - unsigned char buffer[64]; - /** translation handle - * ignored if xlate is unsupported - */ - apr_xlate_t *xlate; -}; - -/** - * MD5 Initialize. Begins an MD5 operation, writing a new context. - * @param context The MD5 context to initialize. - */ -APU_DECLARE(apr_status_t) apr_md5_init(apr_md5_ctx_t *context); - -/** - * MD5 translation setup. Provides the APR translation handle to be used - * for translating the content before calculating the digest. - * @param context The MD5 content to set the translation for. - * @param xlate The translation handle to use for this MD5 context - */ -APU_DECLARE(apr_status_t) apr_md5_set_xlate(apr_md5_ctx_t *context, - apr_xlate_t *xlate); - -/** - * MD5 block update operation. Continue an MD5 message-digest operation, - * processing another message block, and updating the context. - * @param context The MD5 content to update. - * @param input next message block to update - * @param inputLen The length of the next message block - */ -APU_DECLARE(apr_status_t) apr_md5_update(apr_md5_ctx_t *context, - const void *input, - apr_size_t inputLen); - -/** - * MD5 finalization. Ends an MD5 message-digest operation, writing the - * message digest and zeroing the context - * @param digest The final MD5 digest - * @param context The MD5 content we are finalizing. - */ -APU_DECLARE(apr_status_t) apr_md5_final(unsigned char digest[APR_MD5_DIGESTSIZE], - apr_md5_ctx_t *context); - -/** - * MD5 in one step - * @param digest The final MD5 digest - * @param input The message block to use - * @param inputLen The length of the message block - */ -APU_DECLARE(apr_status_t) apr_md5(unsigned char digest[APR_MD5_DIGESTSIZE], - const void *input, - apr_size_t inputLen); - -/** - * Encode a password using an MD5 algorithm - * @param password The password to encode - * @param salt The salt to use for the encoding - * @param result The string to store the encoded password in - * @param nbytes The size of the result buffer - */ -APU_DECLARE(apr_status_t) apr_md5_encode(const char *password, const char *salt, - char *result, apr_size_t nbytes); - - -/** - * Validate hashes created by APR-supported algorithms: md5 and sha1. - * hashes created by crypt are supported only on platforms that provide - * crypt(3), so don't rely on that function unless you know that your - * application will be run only on platforms that support it. On platforms - * that don't support crypt(3), this falls back to a clear text string - * comparison. - * @param passwd The password to validate - * @param hash The password to validate against - */ -APU_DECLARE(apr_status_t) apr_password_validate(const char *passwd, - const char *hash); - - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* !APR_MD5_H */ diff --git a/libs/apr-util/include/apr_optional.h b/libs/apr-util/include/apr_optional.h deleted file mode 100644 index 8c9413f9a0..0000000000 --- a/libs/apr-util/include/apr_optional.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_OPTIONAL_H -#define APR_OPTIONAL_H - -#include "apu.h" -/** - * @file apr_optional.h - * @brief APR-UTIL registration of functions exported by modules - */ -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup APR_Util_Opt Optional Functions - * @ingroup APR_Util - * - * Typesafe registration and retrieval of functions that may not be present - * (i.e. functions exported by optional modules) - * @{ - */ - -/** - * The type of an optional function. - * @param name The name of the function - */ -#define APR_OPTIONAL_FN_TYPE(name) apr_OFN_##name##_t - -/** - * Declare an optional function. - * @param ret The return type of the function - * @param name The name of the function - * @param args The function arguments (including brackets) - */ -#define APR_DECLARE_OPTIONAL_FN(ret,name,args) \ -typedef ret (APR_OPTIONAL_FN_TYPE(name)) args - -/** - * XXX: This doesn't belong here, then! - * Private function! DO NOT USE! - * @internal - */ - -typedef void (apr_opt_fn_t)(void); -/** @internal */ -APU_DECLARE_NONSTD(void) apr_dynamic_fn_register(const char *szName, - apr_opt_fn_t *pfn); - -/** - * Register an optional function. This can be later retrieved, type-safely, by - * name. Like all global functions, the name must be unique. Note that, - * confusingly but correctly, the function itself can be static! - * @param name The name of the function - */ -#define APR_REGISTER_OPTIONAL_FN(name) do { \ - APR_OPTIONAL_FN_TYPE(name) *apu__opt = name; \ - apr_dynamic_fn_register(#name,(apr_opt_fn_t *)apu__opt); \ -} while (0) - -/** @internal - * Private function! DO NOT USE! - */ -APU_DECLARE(apr_opt_fn_t *) apr_dynamic_fn_retrieve(const char *szName); - -/** - * Retrieve an optional function. Returns NULL if the function is not present. - * @param name The name of the function - */ -#define APR_RETRIEVE_OPTIONAL_FN(name) \ - (APR_OPTIONAL_FN_TYPE(name) *)apr_dynamic_fn_retrieve(#name) - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* APR_OPTIONAL_H */ diff --git a/libs/apr-util/include/apr_optional_hooks.h b/libs/apr-util/include/apr_optional_hooks.h deleted file mode 100644 index 7d01ab0068..0000000000 --- a/libs/apr-util/include/apr_optional_hooks.h +++ /dev/null @@ -1,117 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ -/** - * @file apr_optional_hooks.h - * @brief Apache optional hook functions - */ - - -#ifndef APR_OPTIONAL_HOOK_H -#define APR_OPTIONAL_HOOK_H - -#include "apr_tables.h" - -#ifdef __cplusplus -extern "C" { -#endif -/** - * @defgroup APR_Util_OPT_HOOK Optional Hook Functions - * @ingroup APR_Util_Hook - * @{ - */ -/** - * Function to implemnt the APR_OPTIONAL_HOOK Macro - * @internal - * @see APR_OPTIONAL_HOOK - * - * @param name The name of the hook - * @param pfn A pointer to a function that will be called - * @param aszPre a NULL-terminated array of strings that name modules whose hooks should precede this one - * @param aszSucc a NULL-terminated array of strings that name modules whose hooks should succeed this one - * @param nOrder an integer determining order before honouring aszPre and aszSucc (for example HOOK_MIDDLE) - */ - - -APU_DECLARE(void) apr_optional_hook_add(const char *szName,void (*pfn)(void), - const char * const *aszPre, - const char * const *aszSucc, - int nOrder); - -/** - * Hook to an optional hook. - * - * @param ns The namespace prefix of the hook functions - * @param name The name of the hook - * @param pfn A pointer to a function that will be called - * @param aszPre a NULL-terminated array of strings that name modules whose hooks should precede this one - * @param aszSucc a NULL-terminated array of strings that name modules whose hooks should succeed this one - * @param nOrder an integer determining order before honouring aszPre and aszSucc (for example HOOK_MIDDLE) - */ - -#define APR_OPTIONAL_HOOK(ns,name,pfn,aszPre,aszSucc,nOrder) do { \ - ns##_HOOK_##name##_t *apu__hook = pfn; \ - apr_optional_hook_add(#name,(void (*)(void))apu__hook,aszPre, aszSucc, nOrder); \ -} while (0) - -/** - * @internal - * @param szName - the name of the function - * @return the hook structure for a given hook - */ -APU_DECLARE(apr_array_header_t *) apr_optional_hook_get(const char *szName); - -/** - * Implement an optional hook that runs until one of the functions - * returns something other than OK or DECLINE. - * - * @param ns The namespace prefix of the hook functions - * @param link The linkage declaration prefix of the hook - * @param ret The type of the return value of the hook - * @param ret The type of the return value of the hook - * @param name The name of the hook - * @param args_decl The declaration of the arguments for the hook - * @param args_use The names for the arguments for the hook - * @param ok Success value - * @param decline Decline value - */ -#define APR_IMPLEMENT_OPTIONAL_HOOK_RUN_ALL(ns,link,ret,name,args_decl,args_use,ok,decline) \ -link##_DECLARE(ret) ns##_run_##name args_decl \ - { \ - ns##_LINK_##name##_t *pHook; \ - int n; \ - ret rv; \ - apr_array_header_t *pHookArray=apr_optional_hook_get(#name); \ -\ - if(!pHookArray) \ - return ok; \ -\ - pHook=(ns##_LINK_##name##_t *)pHookArray->elts; \ - for(n=0 ; n < pHookArray->nelts ; ++n) \ - { \ - rv=(pHook[n].pFunc)args_use; \ -\ - if(rv != ok && rv != decline) \ - return rv; \ - } \ - return ok; \ - } - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* APR_OPTIONAL_HOOK_H */ diff --git a/libs/apr-util/include/apr_queue.h b/libs/apr-util/include/apr_queue.h deleted file mode 100644 index dcf0c137ed..0000000000 --- a/libs/apr-util/include/apr_queue.h +++ /dev/null @@ -1,154 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_QUEUE_H -#define APR_QUEUE_H - -/** - * @file apr_queue.h - * @brief Thread Safe FIFO bounded queue - * @note Since most implementations of the queue are backed by a condition - * variable implementation, it isn't available on systems without threads. - * Although condition variables are some times available without threads. - */ - -#include "apu.h" -#include "apr_errno.h" -#include "apr_pools.h" - -#if APR_HAS_THREADS - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup APR_Util_FIFO Thread Safe FIFO bounded queue - * @ingroup APR_Util - * @{ - */ - -/** - * opaque structure - */ -typedef struct apr_queue_t apr_queue_t; - -/** - * create a FIFO queue - * @param queue The new queue - * @param queue_capacity maximum size of the queue - * @param a pool to allocate queue from - */ -APU_DECLARE(apr_status_t) apr_queue_create(apr_queue_t **queue, - unsigned int queue_capacity, - apr_pool_t *a); - -/** - * push/add a object to the queue, blocking if the queue is already full - * - * @param queue the queue - * @param data the data - * @returns APR_EINTR the blocking was interrupted (try again) - * @returns APR_EOF the queue has been terminated - * @returns APR_SUCCESS on a successfull push - */ -APU_DECLARE(apr_status_t) apr_queue_push(apr_queue_t *queue, void *data); - -/** - * pop/get an object from the queue, blocking if the queue is already empty - * - * @param queue the queue - * @param data the data - * @returns APR_EINTR the blocking was interrupted (try again) - * @returns APR_EOF if the queue has been terminated - * @returns APR_SUCCESS on a successfull pop - */ -APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void **data); - -/** - * pop/get an object from the queue, blocking if the queue is already empty - * - * @param queue the queue - * @param data the data - * @param timeout The amount of time in microseconds to wait. This is - * a maximum, not a minimum. If the condition is signaled, we - * will wake up before this time, otherwise the error APR_TIMEUP - * is returned. - * @returns APR_TIMEUP the request timed out - * @returns APR_EINTR the blocking was interrupted (try again) - * @returns APR_EOF if the queue has been terminated - * @returns APR_SUCCESS on a successfull pop - */ -APU_DECLARE(apr_status_t) apr_queue_pop_timeout(apr_queue_t *queue, void **data, apr_interval_time_t timeout); - -/** - * push/add a object to the queue, returning immediatly if the queue is full - * - * @param queue the queue - * @param data the data - * @returns APR_EINTR the blocking operation was interrupted (try again) - * @returns APR_EAGAIN the queue is full - * @returns APR_EOF the queue has been terminated - * @returns APR_SUCCESS on a successfull push - */ -APU_DECLARE(apr_status_t) apr_queue_trypush(apr_queue_t *queue, void *data); - -/** - * pop/get an object to the queue, returning immediatly if the queue is empty - * - * @param queue the queue - * @param data the data - * @returns APR_EINTR the blocking operation was interrupted (try again) - * @returns APR_EAGAIN the queue is empty - * @returns APR_EOF the queue has been terminated - * @returns APR_SUCCESS on a successfull push - */ -APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void **data); - -/** - * returns the size of the queue. - * - * @warning this is not threadsafe, and is intended for reporting/monitoring - * of the queue. - * @param queue the queue - * @returns the size of the queue - */ -APU_DECLARE(unsigned int) apr_queue_size(apr_queue_t *queue); - -/** - * interrupt all the threads blocking on this queue. - * - * @param queue the queue - */ -APU_DECLARE(apr_status_t) apr_queue_interrupt_all(apr_queue_t *queue); - -/** - * terminate all queue, sendinging a interupt to all the - * blocking threads - * - * @param queue the queue - */ -APU_DECLARE(apr_status_t) apr_queue_term(apr_queue_t *queue); - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif /* APR_HAS_THREADS */ - -#endif /* APRQUEUE_H */ diff --git a/libs/apr-util/include/apr_reslist.h b/libs/apr-util/include/apr_reslist.h deleted file mode 100644 index e6b64846d2..0000000000 --- a/libs/apr-util/include/apr_reslist.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_RESLIST_H -#define APR_RESLIST_H - -/** - * @file apr_reslist.h - * @brief APR-UTIL Resource List Routines - */ - -#include "apr.h" -#include "apu.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_time.h" - -#if APR_HAS_THREADS - -/** - * @defgroup APR_Util_RL Resource List Routines - * @ingroup APR_Util - * @{ - */ - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** Opaque resource list object */ -typedef struct apr_reslist_t apr_reslist_t; - -/* Generic constructor called by resource list when it needs to create a - * resource. - * @param resource opaque resource - * @param param flags - * @param pool Pool - */ -typedef apr_status_t (*apr_reslist_constructor)(void **resource, void *params, - apr_pool_t *pool); - -/* Generic destructor called by resource list when it needs to destroy a - * resource. - * @param resource opaque resource - * @param param flags - * @param pool Pool - */ -typedef apr_status_t (*apr_reslist_destructor)(void *resource, void *params, - apr_pool_t *pool); - -/** - * Create a new resource list with the following parameters: - * @param reslist An address where the pointer to the new resource - * list will be stored. - * @param pool The pool to use for local storage and management - * @param min Allowed minimum number of available resources. Zero - * creates new resources only when needed. - * @param smax Resources will be destroyed to meet this maximum - * restriction as they expire. - * @param hmax Absolute maximum limit on the number of total resources. - * @param ttl If non-zero, sets the maximum amount of time a resource - * may be available while exceeding the soft limit. - * @param con Constructor routine that is called to create a new resource. - * @param de Destructor routine that is called to destroy an expired resource. - * @param params Passed to constructor and deconstructor - * @param pool The pool from which to create this resoure list. Also the - * same pool that is passed to the constructor and destructor - * routines. - */ -APU_DECLARE(apr_status_t) apr_reslist_create(apr_reslist_t **reslist, - int min, int smax, int hmax, - apr_interval_time_t ttl, - apr_reslist_constructor con, - apr_reslist_destructor de, - void *params, - apr_pool_t *pool); - -/** - * Destroy the given resource list and all resources controlled by - * this list. - * FIXME: Should this block until all resources become available, - * or maybe just destroy all the free ones, or maybe destroy - * them even though they might be in use by something else? - * Currently it will abort if there are resources that haven't - * been released, so there is an assumption that all resources - * have been released to the list before calling this function. - * @param reslist The reslist to destroy - */ -APU_DECLARE(apr_status_t) apr_reslist_destroy(apr_reslist_t *reslist); - -/** - * Retrieve a resource from the list, creating a new one if necessary. - * If we have met our maximum number of resources, we will block - * until one becomes available. - */ -APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist, - void **resource); - -/** - * Return a resource back to the list of available resources. - */ -APU_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist, - void *resource); - -/** - * Set the timeout the acquire will wait for a free resource - * when the maximum number of resources is exceeded. - * @param reslist The resource list. - * @param timeout Timeout to wait. The zero waits forewer. - */ -APU_DECLARE(void) apr_reslist_timeout_set(apr_reslist_t *reslist, - apr_interval_time_t timeout); - -/** - * Invalidate a resource in the pool - e.g. a database connection - * that returns a "lost connection" error and can't be restored. - * Use this instead of apr_reslist_release if the resource is bad. - */ -APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist, - void *resource); - - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif /* APR_HAS_THREADS */ - -#endif /* ! APR_RESLIST_H */ diff --git a/libs/apr-util/include/apr_rmm.h b/libs/apr-util/include/apr_rmm.h deleted file mode 100644 index a1f0d67605..0000000000 --- a/libs/apr-util/include/apr_rmm.h +++ /dev/null @@ -1,137 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_RMM_H -#define APR_RMM_H -/** - * @file apr_rmm.h - * @brief APR-UTIL Relocatable Memory Management Routines - */ -/** - * @defgroup APR_Util_RMM Relocatable Memory Management Routines - * @ingroup APR_Util - * @{ - */ - -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apu.h" -#include "apr_anylock.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** Structure to access Relocatable, Managed Memory */ -typedef struct apr_rmm_t apr_rmm_t; - -/** Fundamental allocation unit, within a specific apr_rmm_t */ -typedef apr_size_t apr_rmm_off_t; - -/** - * Initialize a relocatable memory block to be managed by the apr_rmm API. - * @param rmm The relocatable memory block - * @param lock An apr_anylock_t of the appropriate type of lock, or NULL - * if no locking is required. - * @param membuf The block of relocatable memory to be managed - * @param memsize The size of relocatable memory block to be managed - * @param cont The pool to use for local storage and management - * @remark Both @param membuf and @param memsize must be aligned - * (for instance using APR_ALIGN_DEFAULT). - */ -APU_DECLARE(apr_status_t) apr_rmm_init(apr_rmm_t **rmm, apr_anylock_t *lock, - void *membuf, apr_size_t memsize, - apr_pool_t *cont); - -/** - * Destroy a managed memory block. - * @param rmm The relocatable memory block to destroy - */ -APU_DECLARE(apr_status_t) apr_rmm_destroy(apr_rmm_t *rmm); - -/** - * Attach to a relocatable memory block already managed by the apr_rmm API. - * @param rmm The relocatable memory block - * @param lock An apr_anylock_t of the appropriate type of lock - * @param membuf The block of relocatable memory already under management - * @param cont The pool to use for local storage and management - */ -APU_DECLARE(apr_status_t) apr_rmm_attach(apr_rmm_t **rmm, apr_anylock_t *lock, - void *membuf, apr_pool_t *cont); - -/** - * Detach from the managed block of memory. - * @param rmm The relocatable memory block to detach from - */ -APU_DECLARE(apr_status_t) apr_rmm_detach(apr_rmm_t *rmm); - -/** - * Allocate memory from the block of relocatable memory. - * @param rmm The relocatable memory block - * @param reqsize How much memory to allocate - */ -APU_DECLARE(apr_rmm_off_t) apr_rmm_malloc(apr_rmm_t *rmm, apr_size_t reqsize); - -/** - * Realloc memory from the block of relocatable memory. - * @param rmm The relocatable memory block - * @param entity The memory allocation to realloc - * @param reqsize The new size - */ -APU_DECLARE(apr_rmm_off_t) apr_rmm_realloc(apr_rmm_t *rmm, void *entity, apr_size_t reqsize); - -/** - * Allocate memory from the block of relocatable memory and initialize it to zero. - * @param rmm The relocatable memory block - * @param reqsize How much memory to allocate - */ -APU_DECLARE(apr_rmm_off_t) apr_rmm_calloc(apr_rmm_t *rmm, apr_size_t reqsize); - -/** - * Free allocation returned by apr_rmm_malloc or apr_rmm_calloc. - * @param rmm The relocatable memory block - * @param entity The memory allocation to free - */ -APU_DECLARE(apr_status_t) apr_rmm_free(apr_rmm_t *rmm, apr_rmm_off_t entity); - -/** - * Retrieve the physical address of a relocatable allocation of memory - * @param rmm The relocatable memory block - * @param entity The memory allocation to free - * @return address The address, aligned with APR_ALIGN_DEFAULT. - */ -APU_DECLARE(void *) apr_rmm_addr_get(apr_rmm_t *rmm, apr_rmm_off_t entity); - -/** - * Compute the offset of a relocatable allocation of memory - * @param rmm The relocatable memory block - * @param entity The physical address to convert to an offset - */ -APU_DECLARE(apr_rmm_off_t) apr_rmm_offset_get(apr_rmm_t *rmm, void *entity); - -/** - * Compute the required overallocation of memory needed to fit n allocs - * @param n The number of alloc/calloc regions desired - */ -APU_DECLARE(apr_size_t) apr_rmm_overhead_get(int n); - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif /* ! APR_RMM_H */ - diff --git a/libs/apr-util/include/apr_sdbm.h b/libs/apr-util/include/apr_sdbm.h deleted file mode 100644 index 7fcf7f6e53..0000000000 --- a/libs/apr-util/include/apr_sdbm.h +++ /dev/null @@ -1,175 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * sdbm - ndbm work-alike hashed database library - * based on Per-Ake Larson's Dynamic Hashing algorithms. BIT 18 (1978). - * author: oz@nexus.yorku.ca - * status: ex-public domain - */ - -#ifndef APR_SDBM_H -#define APR_SDBM_H - -#include "apu.h" -#include "apr_errno.h" -#include "apr_file_io.h" /* for apr_fileperms_t */ - -/** - * @file apr_sdbm.h - * @brief apr-util SDBM library - */ -/** - * @defgroup APR_Util_DBM_SDBM SDBM library - * @ingroup APR_Util_DBM - * @{ - */ - -/** - * Structure for referencing an sdbm - */ -typedef struct apr_sdbm_t apr_sdbm_t; - -/** - * Structure for referencing the datum record within an sdbm - */ -typedef struct { - /** pointer to the data stored/retrieved */ - char *dptr; - /** size of data */ - int dsize; -} apr_sdbm_datum_t; - -/* The extensions used for the database files */ -/** SDBM Directory file extension */ -#define APR_SDBM_DIRFEXT ".dir" -/** SDBM page file extension */ -#define APR_SDBM_PAGFEXT ".pag" - -/* flags to sdbm_store */ -#define APR_SDBM_INSERT 0 /**< Insert */ -#define APR_SDBM_REPLACE 1 /**< Replace */ -#define APR_SDBM_INSERTDUP 2 /**< Insert with duplicates */ - -/** - * Open an sdbm database by file name - * @param db The newly opened database - * @param name The sdbm file to open - * @param mode The flag values (APR_READ and APR_BINARY flags are implicit) - *
- *           APR_WRITE          open for read-write access
- *           APR_CREATE         create the sdbm if it does not exist
- *           APR_TRUNCATE       empty the contents of the sdbm
- *           APR_EXCL           fail for APR_CREATE if the file exists
- *           APR_DELONCLOSE     delete the sdbm when closed
- *           APR_SHARELOCK      support locking across process/machines
- * 
- * @param perms Permissions to apply to if created - * @param p The pool to use when creating the sdbm - * @remark The sdbm name is not a true file name, as sdbm appends suffixes - * for seperate data and index files. - */ -APU_DECLARE(apr_status_t) apr_sdbm_open(apr_sdbm_t **db, const char *name, - apr_int32_t mode, - apr_fileperms_t perms, apr_pool_t *p); - -/** - * Close an sdbm file previously opened by apr_sdbm_open - * @param db The database to close - */ -APU_DECLARE(apr_status_t) apr_sdbm_close(apr_sdbm_t *db); - -/** - * Lock an sdbm database for concurency of multiple operations - * @param db The database to lock - * @param type The lock type - *
- *           APR_FLOCK_SHARED
- *           APR_FLOCK_EXCLUSIVE
- * 
- * @remark Calls to apr_sdbm_lock may be nested. All apr_sdbm functions - * perform implicit locking. Since an APR_FLOCK_SHARED lock cannot be - * portably promoted to an APR_FLOCK_EXCLUSIVE lock, apr_sdbm_store and - * apr_sdbm_delete calls will fail if an APR_FLOCK_SHARED lock is held. - * The apr_sdbm_lock call requires the database to be opened with the - * APR_SHARELOCK mode value. - */ -APU_DECLARE(apr_status_t) apr_sdbm_lock(apr_sdbm_t *db, int type); - -/** - * Release an sdbm lock previously aquired by apr_sdbm_lock - * @param db The database to unlock - */ -APU_DECLARE(apr_status_t) apr_sdbm_unlock(apr_sdbm_t *db); - -/** - * Fetch an sdbm record value by key - * @param db The database - * @param value The value datum retrieved for this record - * @param key The key datum to find this record - */ -APU_DECLARE(apr_status_t) apr_sdbm_fetch(apr_sdbm_t *db, - apr_sdbm_datum_t *value, - apr_sdbm_datum_t key); - -/** - * Store an sdbm record value by key - * @param db The database - * @param key The key datum to store this record by - * @param value The value datum to store in this record - * @param opt The method used to store the record - *
- *           APR_SDBM_INSERT     return an error if the record exists
- *           APR_SDBM_REPLACE    overwrite any existing record for key
- * 
- */ -APU_DECLARE(apr_status_t) apr_sdbm_store(apr_sdbm_t *db, apr_sdbm_datum_t key, - apr_sdbm_datum_t value, int opt); - -/** - * Delete an sdbm record value by key - * @param db The database - * @param key The key datum of the record to delete - * @remark It is not an error to delete a non-existent record. - */ -APU_DECLARE(apr_status_t) apr_sdbm_delete(apr_sdbm_t *db, - const apr_sdbm_datum_t key); - -/** - * Retrieve the first record key from a dbm - * @param db The database - * @param key The key datum of the first record - * @remark The keys returned are not ordered. To traverse the list of keys - * for an sdbm opened with APR_SHARELOCK, the caller must use apr_sdbm_lock - * prior to retrieving the first record, and hold the lock until after the - * last call to apr_sdbm_nextkey. - */ -APU_DECLARE(apr_status_t) apr_sdbm_firstkey(apr_sdbm_t *db, apr_sdbm_datum_t *key); - -/** - * Retrieve the next record key from an sdbm - * @param db The database - * @param key The key datum of the next record - */ -APU_DECLARE(apr_status_t) apr_sdbm_nextkey(apr_sdbm_t *db, apr_sdbm_datum_t *key); - -/** - * Returns true if the sdbm database opened for read-only access - * @param db The database to test - */ -APU_DECLARE(int) apr_sdbm_rdonly(apr_sdbm_t *db); -/** @} */ -#endif /* APR_SDBM_H */ diff --git a/libs/apr-util/include/apr_sha1.h b/libs/apr-util/include/apr_sha1.h deleted file mode 100644 index 1ad506556d..0000000000 --- a/libs/apr-util/include/apr_sha1.h +++ /dev/null @@ -1,121 +0,0 @@ -/* Copyright 2001-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ -/* NIST Secure Hash Algorithm - * heavily modified by Uwe Hollerbach uh@alumni.caltech edu - * from Peter C. Gutmann's implementation as found in - * Applied Cryptography by Bruce Schneier - * This code is hereby placed in the public domain - */ - -#ifndef APR_SHA1_H -#define APR_SHA1_H - -#include "apu.h" -#include "apr_general.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @file apr_sha1.h - * @brief APR-UTIL SHA1 library - */ - -/** size of the SHA1 DIGEST */ -#define APR_SHA1_DIGESTSIZE 20 - -/** - * Define the Magic String prefix that identifies a password as being - * hashed using our algorithm. - */ -#define APR_SHA1PW_ID "{SHA}" - -/** length of the SHA Password */ -#define APR_SHA1PW_IDLEN 5 - -/** @see apr_sha1_ctx_t */ -typedef struct apr_sha1_ctx_t apr_sha1_ctx_t; - -/** - * SHA1 context structure - */ -struct apr_sha1_ctx_t { - /** message digest */ - apr_uint32_t digest[5]; - /** 64-bit bit counts */ - apr_uint32_t count_lo, count_hi; - /** SHA data buffer */ - apr_uint32_t data[16]; - /** unprocessed amount in data */ - int local; -}; - -/** - * Provide a means to SHA1 crypt/encode a plaintext password in a way which - * makes password file compatible with those commonly use in netscape web - * and ldap installations. - * @param clear The plaintext password - * @param len The length of the plaintext password - * @param out The encrypted/encoded password - * @note SHA1 support is useful for migration purposes, but is less - * secure than Apache's password format, since Apache's (MD5) - * password format uses a random eight character salt to generate - * one of many possible hashes for the same password. Netscape - * uses plain SHA1 without a salt, so the same password - * will always generate the same hash, making it easier - * to break since the search space is smaller. - */ -APU_DECLARE(void) apr_sha1_base64(const char *clear, int len, char *out); - -/** - * Initialize the SHA digest - * @param context The SHA context to initialize - */ -APU_DECLARE(void) apr_sha1_init(apr_sha1_ctx_t *context); - -/** - * Update the SHA digest - * @param context The SHA1 context to update - * @param input The buffer to add to the SHA digest - * @param inputLen The length of the input buffer - */ -APU_DECLARE(void) apr_sha1_update(apr_sha1_ctx_t *context, const char *input, - unsigned int inputLen); - -/** - * Update the SHA digest with binary data - * @param context The SHA1 context to update - * @param input The buffer to add to the SHA digest - * @param inputLen The length of the input buffer - */ -APU_DECLARE(void) apr_sha1_update_binary(apr_sha1_ctx_t *context, - const unsigned char *input, - unsigned int inputLen); - -/** - * Finish computing the SHA digest - * @param digest the output buffer in which to store the digest - * @param context The context to finalize - */ -APU_DECLARE(void) apr_sha1_final(unsigned char digest[APR_SHA1_DIGESTSIZE], - apr_sha1_ctx_t *context); - -#ifdef __cplusplus -} -#endif - -#endif /* APR_SHA1_H */ diff --git a/libs/apr-util/include/apr_strmatch.h b/libs/apr-util/include/apr_strmatch.h deleted file mode 100644 index 4753318b75..0000000000 --- a/libs/apr-util/include/apr_strmatch.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_STRMATCH_H -#define APR_STRMATCH_H -/** - * @file apr_strmatch.h - * @brief APR-UTIL string matching routines - */ - -#include "apu.h" -#include "apr_pools.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup APR_Util_StrMatch String matching routines - * @ingroup APR_Util - * @{ - */ - -/** @see apr_strmatch_pattern */ -typedef struct apr_strmatch_pattern apr_strmatch_pattern; - -/** - * Precompiled search pattern - */ -struct apr_strmatch_pattern { - /** Function called to compare */ - const char *(*compare)(const apr_strmatch_pattern *this_pattern, - const char *s, apr_size_t slen); - const char *pattern; /**< Current pattern */ - apr_size_t length; /**< Current length */ - void *context; /**< hook to add precomputed metadata */ -}; - -#if defined(DOXYGEN) -/** - * Search for a precompiled pattern within a string - * @param pattern The pattern - * @param s The string in which to search for the pattern - * @param slen The length of s (excluding null terminator) - * @return A pointer to the first instance of the pattern in s, or - * NULL if not found - */ -APU_DECLARE(const char *) apr_strmatch(const apr_strmatch_pattern *pattern, - const char *s, apr_size_t slen); -#else -#define apr_strmatch(pattern, s, slen) (*((pattern)->compare))((pattern), (s), (slen)) -#endif - -/** - * Precompile a pattern for matching using the Boyer-Moore-Horspool algorithm - * @param p The pool from which to allocate the pattern - * @param s The pattern string - * @param case_sensitive Whether the matching should be case-sensitive - * @return a pointer to the compiled pattern, or NULL if compilation fails - */ -APU_DECLARE(const apr_strmatch_pattern *) apr_strmatch_precompile(apr_pool_t *p, const char *s, int case_sensitive); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* !APR_STRMATCH_H */ diff --git a/libs/apr-util/include/apr_uri.h b/libs/apr-util/include/apr_uri.h deleted file mode 100644 index 82a86b24e5..0000000000 --- a/libs/apr-util/include/apr_uri.h +++ /dev/null @@ -1,178 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * apr_uri.h: External Interface of apr_uri.c - */ - -/** - * @file apr_uri.h - * @brief APR-UTIL URI Routines - */ - -#ifndef APR_URI_H -#define APR_URI_H - -#include "apu.h" - -#include "apr_network_io.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @defgroup APR_Util_URI URI - * @ingroup APR_Util - * @{ - */ - -#define APR_URI_FTP_DEFAULT_PORT 21 /**< default FTP port */ -#define APR_URI_SSH_DEFAULT_PORT 22 /**< default SSH port */ -#define APR_URI_TELNET_DEFAULT_PORT 23 /**< default telnet port */ -#define APR_URI_GOPHER_DEFAULT_PORT 70 /**< default Gopher port */ -#define APR_URI_HTTP_DEFAULT_PORT 80 /**< default HTTP port */ -#define APR_URI_POP_DEFAULT_PORT 110 /**< default POP port */ -#define APR_URI_NNTP_DEFAULT_PORT 119 /**< default NNTP port */ -#define APR_URI_IMAP_DEFAULT_PORT 143 /**< default IMAP port */ -#define APR_URI_PROSPERO_DEFAULT_PORT 191 /**< default Prospero port */ -#define APR_URI_WAIS_DEFAULT_PORT 210 /**< default WAIS port */ -#define APR_URI_LDAP_DEFAULT_PORT 389 /**< default LDAP port */ -#define APR_URI_HTTPS_DEFAULT_PORT 443 /**< default HTTPS port */ -#define APR_URI_RTSP_DEFAULT_PORT 554 /**< default RTSP port */ -#define APR_URI_SNEWS_DEFAULT_PORT 563 /**< default SNEWS port */ -#define APR_URI_ACAP_DEFAULT_PORT 674 /**< default ACAP port */ -#define APR_URI_NFS_DEFAULT_PORT 2049 /**< default NFS port */ -#define APR_URI_TIP_DEFAULT_PORT 3372 /**< default TIP port */ -#define APR_URI_SIP_DEFAULT_PORT 5060 /**< default SIP port */ - -/** Flags passed to unparse_uri_components(): */ -/** suppress "scheme://user\@site:port" */ -#define APR_URI_UNP_OMITSITEPART (1U<<0) -/** Just omit user */ -#define APR_URI_UNP_OMITUSER (1U<<1) -/** Just omit password */ -#define APR_URI_UNP_OMITPASSWORD (1U<<2) -/** omit "user:password\@" part */ -#define APR_URI_UNP_OMITUSERINFO (APR_URI_UNP_OMITUSER | \ - APR_URI_UNP_OMITPASSWORD) -/** Show plain text password (default: show XXXXXXXX) */ -#define APR_URI_UNP_REVEALPASSWORD (1U<<3) -/** Show "scheme://user\@site:port" only */ -#define APR_URI_UNP_OMITPATHINFO (1U<<4) -/** Omit the "?queryarg" from the path */ -#define APR_URI_UNP_OMITQUERY (1U<<5) - -/** @see apr_uri_t */ -typedef struct apr_uri_t apr_uri_t; - -/** - * A structure to encompass all of the fields in a uri - */ -struct apr_uri_t { - /** scheme ("http"/"ftp"/...) */ - char *scheme; - /** combined [user[:password]\@]host[:port] */ - char *hostinfo; - /** user name, as in http://user:passwd\@host:port/ */ - char *user; - /** password, as in http://user:passwd\@host:port/ */ - char *password; - /** hostname from URI (or from Host: header) */ - char *hostname; - /** port string (integer representation is in "port") */ - char *port_str; - /** the request path (or "/" if only scheme://host was given) */ - char *path; - /** Everything after a '?' in the path, if present */ - char *query; - /** Trailing "#fragment" string, if present */ - char *fragment; - - /** structure returned from gethostbyname() */ - struct hostent *hostent; - - /** The port number, numeric, valid only if port_str != NULL */ - apr_port_t port; - - /** has the structure been initialized */ - unsigned is_initialized:1; - - /** has the DNS been looked up yet */ - unsigned dns_looked_up:1; - /** has the dns been resolved yet */ - unsigned dns_resolved:1; -}; - -/* apr_uri.c */ -/** - * Return the default port for a given scheme. The schemes recognized are - * http, ftp, https, gopher, wais, nntp, snews, and prospero - * @param scheme_str The string that contains the current scheme - * @return The default port for this scheme - */ -APU_DECLARE(apr_port_t) apr_uri_port_of_scheme(const char *scheme_str); - -/** - * Unparse a apr_uri_t structure to an URI string. Optionally - * suppress the password for security reasons. - * @param p The pool to allocate out of - * @param uptr All of the parts of the uri - * @param flags How to unparse the uri. One of: - *
- *    APR_URI_UNP_OMITSITEPART        Suppress "scheme://user\@site:port" 
- *    APR_URI_UNP_OMITUSER            Just omit user 
- *    APR_URI_UNP_OMITPASSWORD        Just omit password 
- *    APR_URI_UNP_OMITUSERINFO        Omit "user:password\@" part
- *    APR_URI_UNP_REVEALPASSWORD      Show plain text password (default: show XXXXXXXX)
- *    APR_URI_UNP_OMITPATHINFO        Show "scheme://user\@site:port" only 
- *    APR_URI_UNP_OMITQUERY           Omit "?queryarg" or "#fragment" 
- * 
- * @return The uri as a string - */ -APU_DECLARE(char *) apr_uri_unparse(apr_pool_t *p, - const apr_uri_t *uptr, - unsigned flags); - -/** - * Parse a given URI, fill in all supplied fields of a apr_uri_t - * structure. This eliminates the necessity of extracting host, port, - * path, query info repeatedly in the modules. - * @param p The pool to allocate out of - * @param uri The uri to parse - * @param uptr The apr_uri_t to fill out - * @return APR_SUCCESS for success or error code - */ -APU_DECLARE(apr_status_t) apr_uri_parse(apr_pool_t *p, const char *uri, - apr_uri_t *uptr); - -/** - * Special case for CONNECT parsing: it comes with the hostinfo part only - * @param p The pool to allocate out of - * @param hostinfo The hostinfo string to parse - * @param uptr The apr_uri_t to fill out - * @return APR_SUCCESS for success or error code - */ -APU_DECLARE(apr_status_t) apr_uri_parse_hostinfo(apr_pool_t *p, - const char *hostinfo, - apr_uri_t *uptr); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* APR_URI_H */ diff --git a/libs/apr-util/include/apr_uuid.h b/libs/apr-util/include/apr_uuid.h deleted file mode 100644 index 820d7409db..0000000000 --- a/libs/apr-util/include/apr_uuid.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/** - * @file apr_uuid.h - * @brief APR UUID library - */ -#ifndef APR_UUID_H -#define APR_UUID_H - -#include "apu.h" -#include "apr_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @defgroup APR_UUID UUID Handling - * @ingroup APR - * @{ - */ - -/** - * we represent a UUID as a block of 16 bytes. - */ - -typedef struct { - unsigned char data[16]; /**< the actual UUID */ -} apr_uuid_t; - -/** UUIDs are formatted as: 00112233-4455-6677-8899-AABBCCDDEEFF */ -#define APR_UUID_FORMATTED_LENGTH 36 - - -/** - * Generate and return a (new) UUID - * @param uuid The resulting UUID - */ -APU_DECLARE(void) apr_uuid_get(apr_uuid_t *uuid); - -/** - * Format a UUID into a string, following the standard format - * @param buffer The buffer to place the formatted UUID string into. It must - * be at least APR_UUID_FORMATTED_LENGTH + 1 bytes long to hold - * the formatted UUID and a null terminator - * @param uuid The UUID to format - */ -APU_DECLARE(void) apr_uuid_format(char *buffer, const apr_uuid_t *uuid); - -/** - * Parse a standard-format string into a UUID - * @param uuid The resulting UUID - * @param uuid_str The formatted UUID - */ -APU_DECLARE(apr_status_t) apr_uuid_parse(apr_uuid_t *uuid, const char *uuid_str); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* APR_UUID_H */ diff --git a/libs/apr-util/include/apr_xlate.h b/libs/apr-util/include/apr_xlate.h deleted file mode 100644 index 19402a76cd..0000000000 --- a/libs/apr-util/include/apr_xlate.h +++ /dev/null @@ -1,163 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_XLATE_H -#define APR_XLATE_H - -#include "apu.h" -#include "apr_pools.h" -#include "apr_errno.h" - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/** - * @file apr_xlate.h - * @brief APR I18N translation library - */ - -/** - * @defgroup APR_XLATE I18N translation library - * @ingroup APR - * @{ - */ -/** Opaque translation buffer */ -typedef struct apr_xlate_t apr_xlate_t; - -/** - * Set up for converting text from one charset to another. - * @param convset The handle to be filled in by this function - * @param topage The name of the target charset - * @param frompage The name of the source charset - * @param pool The pool to use - * @remark - * Specify APR_DEFAULT_CHARSET for one of the charset - * names to indicate the charset of the source code at - * compile time. This is useful if there are literal - * strings in the source code which must be translated - * according to the charset of the source code. - * APR_DEFAULT_CHARSET is not useful if the source code - * of the caller was not encoded in the same charset as - * APR at compile time. - * - * @remark - * Specify APR_LOCALE_CHARSET for one of the charset - * names to indicate the charset of the current locale. - * - * @remark - * Return APR_EINVAL if unable to procure a convset, or APR_ENOTIMPL - * if charset transcoding is not available in this instance of - * apr-util at all (i.e., APR_HAS_XLATE is undefined). - */ -APU_DECLARE(apr_status_t) apr_xlate_open(apr_xlate_t **convset, - const char *topage, - const char *frompage, - apr_pool_t *pool); - -/** - * This is to indicate the charset of the sourcecode at compile time - * names to indicate the charset of the source code at - * compile time. This is useful if there are literal - * strings in the source code which must be translated - * according to the charset of the source code. - */ -#define APR_DEFAULT_CHARSET (const char *)0 -/** - * To indicate charset names of the current locale - */ -#define APR_LOCALE_CHARSET (const char *)1 - -/** - * Find out whether or not the specified conversion is single-byte-only. - * @param convset The handle allocated by apr_xlate_open, specifying the - * parameters of conversion - * @param onoff Output: whether or not the conversion is single-byte-only - * @remark - * Return APR_ENOTIMPL if charset transcoding is not available - * in this instance of apr-util (i.e., APR_HAS_XLATE is undefined). - */ -APU_DECLARE(apr_status_t) apr_xlate_sb_get(apr_xlate_t *convset, int *onoff); - -/** - * Convert a buffer of text from one codepage to another. - * @param convset The handle allocated by apr_xlate_open, specifying - * the parameters of conversion - * @param inbuf The address of the source buffer - * @param inbytes_left Input: the amount of input data to be translated - * Output: the amount of input data not yet translated - * @param outbuf The address of the destination buffer - * @param outbytes_left Input: the size of the output buffer - * Output: the amount of the output buffer not yet used - * @remark - * Returns APR_ENOTIMPL if charset transcoding is not available - * in this instance of apr-util (i.e., APR_HAS_XLATE is undefined). - * Returns APR_INCOMPLETE if the input buffer ends in an incomplete - * multi-byte character. - * - * To correctly terminate the output buffer for some multi-byte - * character set encodings, a final call must be made to this function - * after the complete input string has been converted, passing - * the inbuf and inbytes_left parameters as NULL. (Note that this - * mode only works from version 1.1.0 onwards) - */ -APU_DECLARE(apr_status_t) apr_xlate_conv_buffer(apr_xlate_t *convset, - const char *inbuf, - apr_size_t *inbytes_left, - char *outbuf, - apr_size_t *outbytes_left); - -/* @see apr_file_io.h the comment in apr_file_io.h about this hack */ -#ifdef APR_NOT_DONE_YET -/** - * The purpose of apr_xlate_conv_char is to translate one character - * at a time. This needs to be written carefully so that it works - * with double-byte character sets. - * @param convset The handle allocated by apr_xlate_open, specifying the - * parameters of conversion - * @param inchar The character to convert - * @param outchar The converted character - */ -APU_DECLARE(apr_status_t) apr_xlate_conv_char(apr_xlate_t *convset, - char inchar, char outchar); -#endif - -/** - * Convert a single-byte character from one charset to another. - * @param convset The handle allocated by apr_xlate_open, specifying the - * parameters of conversion - * @param inchar The single-byte character to convert. - * @warning This only works when converting between single-byte character sets. - * -1 will be returned if the conversion can't be performed. - */ -APU_DECLARE(apr_int32_t) apr_xlate_conv_byte(apr_xlate_t *convset, - unsigned char inchar); - -/** - * Close a codepage translation handle. - * @param convset The codepage translation handle to close - * @remark - * Return APR_ENOTIMPL if charset transcoding is not available - * in this instance of apr-util (i.e., APR_HAS_XLATE is undefined). - */ -APU_DECLARE(apr_status_t) apr_xlate_close(apr_xlate_t *convset); - -/** @} */ -#ifdef __cplusplus -} -#endif - -#endif /* ! APR_XLATE_H */ diff --git a/libs/apr-util/include/apr_xml.h b/libs/apr-util/include/apr_xml.h deleted file mode 100644 index ab184e7a7e..0000000000 --- a/libs/apr-util/include/apr_xml.h +++ /dev/null @@ -1,356 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ -/** - * @file apr_xml.h - * @brief APR-UTIL XML Library - */ -#ifndef APR_XML_H -#define APR_XML_H - -/** - * @defgroup APR_Util_XML XML - * @ingroup APR_Util - * @{ - */ -#include "apr_pools.h" -#include "apr_tables.h" -#include "apr_file_io.h" - -#include "apu.h" -#if APR_CHARSET_EBCDIC -#include "apr_xlate.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @package Apache XML library - */ - -/* -------------------------------------------------------------------- */ - -/* ### these will need to move at some point to a more logical spot */ - -/** @see apr_text */ -typedef struct apr_text apr_text; - -/** Structure to keep a linked list of pieces of text */ -struct apr_text { - /** The current piece of text */ - const char *text; - /** a pointer to the next piece of text */ - struct apr_text *next; -}; - -/** @see apr_text_header */ -typedef struct apr_text_header apr_text_header; - -/** A list of pieces of text */ -struct apr_text_header { - /** The first piece of text in the list */ - apr_text *first; - /** The last piece of text in the list */ - apr_text *last; -}; - -/** - * Append a piece of text to the end of a list - * @param p The pool to allocate out of - * @param hdr The text header to append to - * @param text The new text to append - */ -APU_DECLARE(void) apr_text_append(apr_pool_t *p, apr_text_header *hdr, - const char *text); - - -/* -------------------------------------------------------------------- -** -** XML PARSING -*/ - -/* -** Qualified namespace values -** -** APR_XML_NS_DAV_ID -** We always insert the "DAV:" namespace URI at the head of the -** namespace array. This means that it will always be at ID==0, -** making it much easier to test for. -** -** APR_XML_NS_NONE -** This special ID is used for two situations: -** -** 1) The namespace prefix begins with "xml" (and we do not know -** what it means). Namespace prefixes with "xml" (any case) as -** their first three characters are reserved by the XML Namespaces -** specification for future use. mod_dav will pass these through -** unchanged. When this identifier is used, the prefix is LEFT in -** the element/attribute name. Downstream processing should not -** prepend another prefix. -** -** 2) The element/attribute does not have a namespace. -** -** a) No prefix was used, and a default namespace has not been -** defined. -** b) No prefix was used, and the default namespace was specified -** to mean "no namespace". This is done with a namespace -** declaration of: xmlns="" -** (this declaration is typically used to override a previous -** specification for the default namespace) -** -** In these cases, we need to record that the elem/attr has no -** namespace so that we will not attempt to prepend a prefix. -** All namespaces that are used will have a prefix assigned to -** them -- mod_dav will never set or use the default namespace -** when generating XML. This means that "no prefix" will always -** mean "no namespace". -** -** In both cases, the XML generation will avoid prepending a prefix. -** For the first case, this means the original prefix/name will be -** inserted into the output stream. For the latter case, it means -** the name will have no prefix, and since we never define a default -** namespace, this means it will have no namespace. -** -** Note: currently, mod_dav understands the "xmlns" prefix and the -** "xml:lang" attribute. These are handled specially (they aren't -** left within the XML tree), so the APR_XML_NS_NONE value won't ever -** really apply to these values. -*/ -#define APR_XML_NS_DAV_ID 0 /**< namespace ID for "DAV:" */ -#define APR_XML_NS_NONE -10 /**< no namespace for this elem/attr */ - -#define APR_XML_NS_ERROR_BASE -100 /**< used only during processing */ -/** Is this namespace an error? */ -#define APR_XML_NS_IS_ERROR(e) ((e) <= APR_XML_NS_ERROR_BASE) - -/** @see apr_xml_attr */ -typedef struct apr_xml_attr apr_xml_attr; -/** @see apr_xml_elem */ -typedef struct apr_xml_elem apr_xml_elem; -/** @see apr_xml_doc */ -typedef struct apr_xml_doc apr_xml_doc; - -/** apr_xml_attr: holds a parsed XML attribute */ -struct apr_xml_attr { - /** attribute name */ - const char *name; - /** index into namespace array */ - int ns; - - /** attribute value */ - const char *value; - - /** next attribute */ - struct apr_xml_attr *next; -}; - -/** apr_xml_elem: holds a parsed XML element */ -struct apr_xml_elem { - /** element name */ - const char *name; - /** index into namespace array */ - int ns; - /** xml:lang for attrs/contents */ - const char *lang; - - /** cdata right after start tag */ - apr_text_header first_cdata; - /** cdata after MY end tag */ - apr_text_header following_cdata; - - /** parent element */ - struct apr_xml_elem *parent; - /** next (sibling) element */ - struct apr_xml_elem *next; - /** first child element */ - struct apr_xml_elem *first_child; - /** first attribute */ - struct apr_xml_attr *attr; - - /* used only during parsing */ - /** last child element */ - struct apr_xml_elem *last_child; - /** namespaces scoped by this elem */ - struct apr_xml_ns_scope *ns_scope; - - /* used by modules during request processing */ - /** Place for modules to store private data */ - void *priv; -}; - -/** Is this XML element empty? */ -#define APR_XML_ELEM_IS_EMPTY(e) ((e)->first_child == NULL && \ - (e)->first_cdata.first == NULL) - -/** apr_xml_doc: holds a parsed XML document */ -struct apr_xml_doc { - /** root element */ - apr_xml_elem *root; - /** array of namespaces used */ - apr_array_header_t *namespaces; -}; - -/** Opaque XML parser structure */ -typedef struct apr_xml_parser apr_xml_parser; - -/** - * Create an XML parser - * @param pool The pool for allocating the parser and the parse results. - * @return The new parser. - */ -APU_DECLARE(apr_xml_parser *) apr_xml_parser_create(apr_pool_t *pool); - -/** - * Parse a File, producing a xml_doc - * @param p The pool for allocating the parse results. - * @param parser A pointer to *parser (needed so calling function can get - * errors), will be set to NULL on successfull completion. - * @param ppdoc A pointer to *apr_xml_doc (which has the parsed results in it) - * @param xmlfd A file to read from. - * @param buffer_length Buffer length which would be suitable - * @return Any errors found during parsing. - */ -APU_DECLARE(apr_status_t) apr_xml_parse_file(apr_pool_t *p, - apr_xml_parser **parser, - apr_xml_doc **ppdoc, - apr_file_t *xmlfd, - apr_size_t buffer_length); - - -/** - * Feed input into the parser - * @param parser The XML parser for parsing this data. - * @param data The data to parse. - * @param len The length of the data. - * @return Any errors found during parsing. - * @remark Use apr_xml_parser_geterror() to get more error information. - */ -APU_DECLARE(apr_status_t) apr_xml_parser_feed(apr_xml_parser *parser, - const char *data, - apr_size_t len); - -/** - * Terminate the parsing and return the result - * @param parser The XML parser for parsing this data. - * @param pdoc The resulting parse information. May be NULL to simply - * terminate the parsing without fetching the info. - * @return Any errors found during the final stage of parsing. - * @remark Use apr_xml_parser_geterror() to get more error information. - */ -APU_DECLARE(apr_status_t) apr_xml_parser_done(apr_xml_parser *parser, - apr_xml_doc **pdoc); - -/** - * Fetch additional error information from the parser. - * @param parser The XML parser to query for errors. - * @param errbuf A buffer for storing error text. - * @param errbufsize The length of the error text buffer. - * @return The error buffer - */ -APU_DECLARE(char *) apr_xml_parser_geterror(apr_xml_parser *parser, - char *errbuf, - apr_size_t errbufsize); - - -/** - * Converts an XML element tree to flat text - * @param p The pool to allocate out of - * @param elem The XML element to convert - * @param style How to covert the XML. One of: - *
- *     APR_XML_X2T_FULL                start tag, contents, end tag 
- *     APR_XML_X2T_INNER               contents only 
- *     APR_XML_X2T_LANG_INNER          xml:lang + inner contents 
- *     APR_XML_X2T_FULL_NS_LANG        FULL + ns defns + xml:lang 
- * 
- * @param namespaces The namespace of the current XML element - * @param ns_map Namespace mapping - * @param pbuf Buffer to put the converted text into - * @param psize Size of the converted text - */ -APU_DECLARE(void) apr_xml_to_text(apr_pool_t *p, const apr_xml_elem *elem, - int style, apr_array_header_t *namespaces, - int *ns_map, const char **pbuf, - apr_size_t *psize); - -/* style argument values: */ -#define APR_XML_X2T_FULL 0 /**< start tag, contents, end tag */ -#define APR_XML_X2T_INNER 1 /**< contents only */ -#define APR_XML_X2T_LANG_INNER 2 /**< xml:lang + inner contents */ -#define APR_XML_X2T_FULL_NS_LANG 3 /**< FULL + ns defns + xml:lang */ - -/** - * empty XML element - * @param p The pool to allocate out of - * @param elem The XML element to empty - * @return the string that was stored in the XML element - */ -APU_DECLARE(const char *) apr_xml_empty_elem(apr_pool_t *p, - const apr_xml_elem *elem); - -/** - * quote an XML string - * Replace '<', '>', and '&' with '<', '>', and '&'. - * @param p The pool to allocate out of - * @param s The string to quote - * @param quotes If quotes is true, then replace '"' with '"'. - * @return The quoted string - * @note If the string does not contain special characters, it is not - * duplicated into the pool and the original string is returned. - */ -APU_DECLARE(const char *) apr_xml_quote_string(apr_pool_t *p, const char *s, - int quotes); - -/** - * Quote an XML element - * @param p The pool to allocate out of - * @param elem The element to quote - */ -APU_DECLARE(void) apr_xml_quote_elem(apr_pool_t *p, apr_xml_elem *elem); - -/* manage an array of unique URIs: apr_xml_insert_uri() and APR_XML_URI_ITEM() */ - -/** - * return the URI's (existing) index, or insert it and return a new index - * @param uri_array array to insert into - * @param uri The uri to insert - * @return int The uri's index - */ -APU_DECLARE(int) apr_xml_insert_uri(apr_array_header_t *uri_array, - const char *uri); - -/** Get the URI item for this XML element */ -#define APR_XML_GET_URI_ITEM(ary, i) (((const char * const *)(ary)->elts)[i]) - -#if APR_CHARSET_EBCDIC -/** - * Convert parsed tree in EBCDIC - * @param p The pool to allocate out of - * @param pdoc The apr_xml_doc to convert. - * @param xlate The translation handle to use. - * @return Any errors found during conversion. - */ -APU_DECLARE(apr_status_t) apr_xml_parser_convert_doc(apr_pool_t *p, - apr_xml_doc *pdoc, - apr_xlate_t *convset); -#endif - -#ifdef __cplusplus -} -#endif -/** @} */ -#endif /* APR_XML_H */ diff --git a/libs/apr-util/include/apu.h.in b/libs/apr-util/include/apu.h.in deleted file mode 100644 index 5bd7d00f56..0000000000 --- a/libs/apr-util/include/apu.h.in +++ /dev/null @@ -1,91 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * apu.h is generated from apu.h.in by configure -- do not edit apu.h - */ -/* @file apu.h - * @brief APR-Utility main file - */ -/** - * @defgroup APR_Util APR Utility Functions - * @{ - */ - - -#ifndef APU_H -#define APU_H - -/** - * APU_DECLARE_EXPORT is defined when building the APR-UTIL dynamic library, - * so that all public symbols are exported. - * - * APU_DECLARE_STATIC is defined when including the APR-UTIL public headers, - * to provide static linkage when the dynamic library may be unavailable. - * - * APU_DECLARE_STATIC and APU_DECLARE_EXPORT are left undefined when - * including the APR-UTIL public headers, to import and link the symbols from - * the dynamic APR-UTIL library and assure appropriate indirection and calling - * conventions at compile time. - */ - -/** - * The public APR-UTIL functions are declared with APU_DECLARE(), so they may - * use the most appropriate calling convention. Public APR functions with - * variable arguments must use APU_DECLARE_NONSTD(). - * - * @deffunc APU_DECLARE(rettype) apr_func(args); - */ -#define APU_DECLARE(type) type -/** - * The public APR-UTIL functions using variable arguments are declared with - * APU_DECLARE_NONSTD(), as they must use the C language calling convention. - * - * @deffunc APU_DECLARE_NONSTD(rettype) apr_func(args, ...); - */ -#define APU_DECLARE_NONSTD(type) type -/** - * The public APR-UTIL variables are declared with APU_DECLARE_DATA. - * This assures the appropriate indirection is invoked at compile time. - * - * @deffunc APU_DECLARE_DATA type apr_variable; - * @tip APU_DECLARE_DATA extern type apr_variable; syntax is required for - * declarations within headers to properly import the variable. - */ -#define APU_DECLARE_DATA -/* - * we always have SDBM (it's in our codebase) - */ -#define APU_HAVE_SDBM @apu_have_sdbm@ -#define APU_HAVE_GDBM @apu_have_gdbm@ -#define APU_HAVE_NDBM @apu_have_ndbm@ -#define APU_HAVE_DB @apu_have_db@ - -#if APU_HAVE_DB -#define APU_HAVE_DB_VERSION @apu_db_version@ -#endif /* APU_HAVE_DB */ - -#define APU_HAVE_PGSQL @apu_have_pgsql@ -#define APU_HAVE_MYSQL @apu_have_mysql@ -#define APU_HAVE_SQLITE3 @apu_have_sqlite3@ -#define APU_HAVE_SQLITE2 @apu_have_sqlite2@ - -#define APU_HAVE_APR_ICONV @have_apr_iconv@ -#define APU_HAVE_ICONV @have_iconv@ -#define APR_HAS_XLATE (APU_HAVE_APR_ICONV || APU_HAVE_ICONV) - -#endif /* APU_H */ -/** @} */ diff --git a/libs/apr-util/include/apu.hnw b/libs/apr-util/include/apu.hnw deleted file mode 100644 index 8c3cee7832..0000000000 --- a/libs/apr-util/include/apu.hnw +++ /dev/null @@ -1,84 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * Note: This is a NetWare specific version of apu.h. It is renamed to - * apu.h at the start of a NetWare build. - */ -/* @file apu.h - * @brief APR-Utility main file - */ -/** - * @defgroup APR_Util APR Utility Functions - * @{ - */ - - -#ifndef APU_H -#define APU_H - -/** - * APU_DECLARE_EXPORT is defined when building the APR-UTIL dynamic library, - * so that all public symbols are exported. - * - * APU_DECLARE_STATIC is defined when including the APR-UTIL public headers, - * to provide static linkage when the dynamic library may be unavailable. - * - * APU_DECLARE_STATIC and APU_DECLARE_EXPORT are left undefined when - * including the APR-UTIL public headers, to import and link the symbols from - * the dynamic APR-UTIL library and assure appropriate indirection and calling - * conventions at compile time. - */ - -/** - * The public APR-UTIL functions are declared with APU_DECLARE(), so they may - * use the most appropriate calling convention. Public APR functions with - * variable arguments must use APU_DECLARE_NONSTD(). - * - * @deffunc APU_DECLARE(rettype) apr_func(args); - */ -#define APU_DECLARE(type) type -/** - * The public APR-UTIL functions using variable arguments are declared with - * APU_DECLARE_NONSTD(), as they must use the C language calling convention. - * - * @deffunc APU_DECLARE_NONSTD(rettype) apr_func(args, ...); - */ -#define APU_DECLARE_NONSTD(type) type -/** - * The public APR-UTIL variables are declared with APU_DECLARE_DATA. - * This assures the appropriate indirection is invoked at compile time. - * - * @deffunc APU_DECLARE_DATA type apr_variable; - * @tip APU_DECLARE_DATA extern type apr_variable; syntax is required for - * declarations within headers to properly import the variable. - */ -#define APU_DECLARE_DATA -/* - * we always have SDBM (it's in our codebase) - */ -#define APU_HAVE_SDBM 1 -#define APU_HAVE_GDBM 0 -#define APU_HAVE_DB 0 - - -#define HAVE_ICONV_H 1 -#define APU_HAVE_APR_ICONV 0 -#define APU_HAVE_ICONV 1 -#define APR_HAS_XLATE (APU_HAVE_APR_ICONV || APU_HAVE_ICONV) - -#endif /* APU_H */ -/** @} */ diff --git a/libs/apr-util/include/apu.hw b/libs/apr-util/include/apu.hw deleted file mode 100644 index c710ee2b13..0000000000 --- a/libs/apr-util/include/apu.hw +++ /dev/null @@ -1,113 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * Note: This is a Windows specific version of apu.h. It is renamed to - * apu.h at the start of a Windows build. - */ -/* @file apu.h - * @brief APR-Utility main file - */ - -#ifdef WIN32 -#ifndef APU_H -#define APU_H -/** - * @defgroup APR_Util APR Utility Functions - * @{ - */ - - -/** - * APU_DECLARE_EXPORT is defined when building the APR-UTIL dynamic library, - * so that all public symbols are exported. - * - * APU_DECLARE_STATIC is defined when including the APR-UTIL public headers, - * to provide static linkage when the dynamic library may be unavailable. - * - * APU_DECLARE_STATIC and APU_DECLARE_EXPORT are left undefined when - * including the APR-UTIL public headers, to import and link the symbols from - * the dynamic APR-UTIL library and assure appropriate indirection and calling - * conventions at compile time. - */ - -#if defined(DOXYGEN) || !defined(WIN32) -/** - * The public APR-UTIL functions are declared with APU_DECLARE(), so they may - * use the most appropriate calling convention. Public APR functions with - * variable arguments must use APU_DECLARE_NONSTD(). - * - * @deffunc APU_DECLARE(rettype) apr_func(args); - */ -#define APU_DECLARE(type) type -/** - * The public APR-UTIL functions using variable arguments are declared with - * APU_DECLARE_NONSTD(), as they must use the C language calling convention. - * - * @deffunc APU_DECLARE_NONSTD(rettype) apr_func(args, ...); - */ -#define APU_DECLARE_NONSTD(type) type -/** - * The public APR-UTIL variables are declared with APU_DECLARE_DATA. - * This assures the appropriate indirection is invoked at compile time. - * - * @deffunc APU_DECLARE_DATA type apr_variable; - * @tip extern APU_DECLARE_DATA type apr_variable; syntax is required for - * declarations within headers to properly import the variable. - */ -#define APU_DECLARE_DATA -#elif defined(APU_DECLARE_STATIC) -#define APU_DECLARE(type) type __stdcall -#define APU_DECLARE_NONSTD(type) type __cdecl -#define APU_DECLARE_DATA -#elif defined(APU_DECLARE_EXPORT) -#define APU_DECLARE(type) __declspec(dllexport) type __stdcall -#define APU_DECLARE_NONSTD(type) __declspec(dllexport) type __cdecl -#define APU_DECLARE_DATA __declspec(dllexport) -#else -#define APU_DECLARE(type) __declspec(dllimport) type __stdcall -#define APU_DECLARE_NONSTD(type) __declspec(dllimport) type __cdecl -#define APU_DECLARE_DATA __declspec(dllimport) -#endif -/** @} */ -/* - * we always have SDBM (it's in our codebase) - */ -#define APU_HAVE_SDBM 1 -#define APU_HAVE_GDBM 0 - -/* Allow external override */ -#if !defined(APU_HAVE_DB) -#define APU_HAVE_DB 0 -#endif - - -#define APU_HAVE_APR_ICONV 0 -#define APU_HAVE_ICONV 0 -#define APR_HAS_XLATE (APU_HAVE_APR_ICONV || APU_HAVE_ICONV) - -#if !defined(APU_HAVE_PGSQL) -#define APU_HAVE_PGSQL 0 -#endif -#if !defined(APU_HAVE_SQLITE2) -#define APU_HAVE_SQLITE2 0 -#endif -#if !defined(APU_HAVE_SQLITE3) -#define APU_HAVE_SQLITE3 0 -#endif - -#endif /* APU_H */ -#endif /* WIN32 */ diff --git a/libs/apr-util/include/apu_version.h b/libs/apr-util/include/apu_version.h deleted file mode 100644 index 578106ec4b..0000000000 --- a/libs/apr-util/include/apu_version.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APU_VERSION_H -#define APU_VERSION_H - -/** - * @file apu_version.h - * @brief APR-util Versioning Interface - * - * APR-util's Version - * - * There are several different mechanisms for accessing the version. There - * is a string form, and a set of numbers; in addition, there are constants - * which can be compiled into your application, and you can query the library - * being used for its actual version. - * - * Note that it is possible for an application to detect that it has been - * compiled against a different version of APU by use of the compile-time - * constants and the use of the run-time query function. - * - * APU version numbering follows the guidelines specified in: - * - * http://apr.apache.org/versioning.html - */ - - -/* The numeric compile-time version constants. These constants are the - * authoritative version numbers for APU. - */ - -/** major version - * Major API changes that could cause compatibility problems for older - * programs such as structure size changes. No binary compatibility is - * possible across a change in the major version. - */ -#define APU_MAJOR_VERSION 1 - -/** minor version - * Minor API changes that do not cause binary compatibility problems. - * Reset to 0 when upgrading APU_MAJOR_VERSION - */ -#define APU_MINOR_VERSION 2 - -/** patch level - * The Patch Level never includes API changes, simply bug fixes. - * Reset to 0 when upgrading APR_MINOR_VERSION - */ -#define APU_PATCH_VERSION 8 - -/** - * The symbol APU_IS_DEV_VERSION is only defined for internal, - * "development" copies of APU. It is undefined for released versions - * of APU. - */ -/* #define APU_IS_DEV_VERSION */ - - -#if defined(APU_IS_DEV_VERSION) || defined(DOXYGEN) -/** Internal: string form of the "is dev" flag */ -#define APU_IS_DEV_STRING "-dev" -#else -#define APU_IS_DEV_STRING "" -#endif - - -#ifndef APU_STRINGIFY -/** Properly quote a value as a string in the C preprocessor */ -#define APU_STRINGIFY(n) APU_STRINGIFY_HELPER(n) -/** Helper macro for APU_STRINGIFY */ -#define APU_STRINGIFY_HELPER(n) #n -#endif - -/** The formatted string of APU's version */ -#define APU_VERSION_STRING \ - APU_STRINGIFY(APU_MAJOR_VERSION) "." \ - APU_STRINGIFY(APU_MINOR_VERSION) "." \ - APU_STRINGIFY(APU_PATCH_VERSION) \ - APU_IS_DEV_STRING - -/** An alternative formatted string of APR's version */ -/* macro for Win32 .rc files using numeric csv representation */ -#define APU_VERSION_STRING_CSV APU_MAJOR_VERSION ##, \ - ##APU_MINOR_VERSION ##, \ - ##APU_PATCH_VERSION - - -#ifndef APU_VERSION_ONLY - -/* The C language API to access the version at run time, - * as opposed to compile time. APU_VERSION_ONLY may be defined - * externally when preprocessing apr_version.h to obtain strictly - * the C Preprocessor macro declarations. - */ - -#include "apr_version.h" - -#include "apu.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Return APR-util's version information information in a numeric form. - * - * @param pvsn Pointer to a version structure for returning the version - * information. - */ -APU_DECLARE(void) apu_version(apr_version_t *pvsn); - -/** Return APU's version information as a string. */ -APU_DECLARE(const char *) apu_version_string(void); - -#ifdef __cplusplus -} -#endif - -#endif /* ndef APU_VERSION_ONLY */ - -#endif /* ndef APU_VERSION_H */ diff --git a/libs/apr-util/include/apu_want.h.in b/libs/apr-util/include/apu_want.h.in deleted file mode 100644 index ac297292ba..0000000000 --- a/libs/apr-util/include/apu_want.h.in +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apu.h" /* configuration data */ - -/** - * @file apu_want.h - * @brief APR Standard Headers Support - * - *
- * Features:
- *
- *   APU_WANT_DB:       <@apu_db_header@>
- *
- * Typical usage:
- *
- *   #define APU_WANT_DB
- *   #include "apu_want.h"
- *
- * The appropriate headers will be included.
- *
- * Note: it is safe to use this in a header (it won't interfere with other
- *       headers' or source files' use of apu_want.h)
- * 
- */ - -/* --------------------------------------------------------------------- */ - -#ifdef APU_WANT_DB - -#if APU_HAVE_DB -#include <@apu_db_header@> -#endif - -#undef APU_WANT_DB -#endif - -/* --------------------------------------------------------------------- */ diff --git a/libs/apr-util/include/apu_want.hnw b/libs/apr-util/include/apu_want.hnw deleted file mode 100644 index 4927da8b9d..0000000000 --- a/libs/apr-util/include/apu_want.hnw +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apu.h" /* configuration data */ - -/** - * @file apu_want.h - * @brief APR Standard Headers Support - * - *
- * Features:
- *
- *   APU_WANT_DB:       <@apu_db_header>
- *
- * Typical usage:
- *
- *   #define APU_WANT_DB
- *   #include "apu_want.h"
- *
- * The appropriate headers will be included.
- *
- * Note: it is safe to use this in a header (it won't interfere with other
- *       headers' or source files' use of apu_want.h)
- * 
- */ - -/* --------------------------------------------------------------------- */ - -#ifdef APU_WANT_DB - -#if APU_HAVE_DB -/* win32 note.. you will need to change this for db1 */ -#include -#endif - -#undef APU_WANT_DB -#endif - -/* --------------------------------------------------------------------- */ diff --git a/libs/apr-util/include/apu_want.hw b/libs/apr-util/include/apu_want.hw deleted file mode 100644 index 4927da8b9d..0000000000 --- a/libs/apr-util/include/apu_want.hw +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apu.h" /* configuration data */ - -/** - * @file apu_want.h - * @brief APR Standard Headers Support - * - *
- * Features:
- *
- *   APU_WANT_DB:       <@apu_db_header>
- *
- * Typical usage:
- *
- *   #define APU_WANT_DB
- *   #include "apu_want.h"
- *
- * The appropriate headers will be included.
- *
- * Note: it is safe to use this in a header (it won't interfere with other
- *       headers' or source files' use of apu_want.h)
- * 
- */ - -/* --------------------------------------------------------------------- */ - -#ifdef APU_WANT_DB - -#if APU_HAVE_DB -/* win32 note.. you will need to change this for db1 */ -#include -#endif - -#undef APU_WANT_DB -#endif - -/* --------------------------------------------------------------------- */ diff --git a/libs/apr-util/include/private/apr_dbd_internal.h b/libs/apr-util/include/private/apr_dbd_internal.h deleted file mode 100644 index fcefc2345f..0000000000 --- a/libs/apr-util/include/private/apr_dbd_internal.h +++ /dev/null @@ -1,257 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* Overview of what this is and does: - * http://www.apache.org/~niq/dbd.html - */ - -#ifndef APR_DBD_INTERNAL_H -#define APR_DBD_INTERNAL_H - -#include - -#include "apr_dbd.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct apr_dbd_driver_t { - /** name */ - const char *name; - - /** init: allow driver to perform once-only initialisation. - * Called once only. May be NULL - */ - void (*init)(apr_pool_t *pool); - - /** native_handle: return the native database handle of the underlying db - * - * @param handle - apr_dbd handle - * @return - native handle - */ - void *(*native_handle)(apr_dbd_t *handle); - - /** open: obtain a database connection from the server rec. - * Must be explicitly closed when you're finished with it. - * WARNING: only use this when you need a connection with - * a lifetime other than a request - * - * @param pool - a pool to use for error messages (if any). - * @param s - server rec managing the underlying connection/pool. - * @return database handle, or NULL on error. - */ - apr_dbd_t *(*open)(apr_pool_t *pool, const char *params); - - /** check_conn: check status of a database connection - * - * @param pool - a pool to use for error messages (if any). - * @param handle - the connection to check - * @return APR_SUCCESS or error - */ - apr_status_t (*check_conn)(apr_pool_t *pool, apr_dbd_t *handle); - - /** close: close/release a connection obtained from open() - * - * @param handle - the connection to release - * @return APR_SUCCESS or error - */ - apr_status_t (*close)(apr_dbd_t *handle); - - /** set_dbname: select database name. May be a no-op if not supported. - * - * @param pool - working pool - * @param handle - the connection - * @param name - the database to select - * @return 0 for success or error code - */ - int (*set_dbname)(apr_pool_t* pool, apr_dbd_t *handle, const char *name); - - /** transaction: start a transaction. May be a no-op. - * - * @param pool - a pool to use for error messages (if any). - * @param handle - the connection - * @param transaction - ptr to a transaction. May be null on entry - * @return 0 for success or error code - */ - int (*start_transaction)(apr_pool_t *pool, apr_dbd_t *handle, - apr_dbd_transaction_t **trans); - - /** end_transaction: end a transaction - * (commit on success, rollback on error). - * May be a no-op. - * - * @param transaction - the transaction. - * @return 0 for success or error code - */ - int (*end_transaction)(apr_dbd_transaction_t *trans); - - /** query: execute an SQL query that doesn't return a result set - * - * @param handle - the connection - * @param nrows - number of rows affected. - * @param statement - the SQL statement to execute - * @return 0 for success or error code - */ - int (*query)(apr_dbd_t *handle, int *nrows, const char *statement); - - /** select: execute an SQL query that returns a result set - * - * @param pool - pool to allocate the result set - * @param handle - the connection - * @param res - pointer to result set pointer. May point to NULL on entry - * @param statement - the SQL statement to execute - * @param random - 1 to support random access to results (seek any row); - * 0 to support only looping through results in order - * (async access - faster) - * @return 0 for success or error code - */ - int (*select)(apr_pool_t *pool, apr_dbd_t *handle, apr_dbd_results_t **res, - const char *statement, int random); - - /** num_cols: get the number of columns in a results set - * - * @param res - result set. - * @return number of columns - */ - int (*num_cols)(apr_dbd_results_t *res); - - /** num_tuples: get the number of rows in a results set - * of a synchronous select - * - * @param res - result set. - * @return number of rows, or -1 if the results are asynchronous - */ - int (*num_tuples)(apr_dbd_results_t *res); - - /** get_row: get a row from a result set - * - * @param pool - pool to allocate the row - * @param res - result set pointer - * @param row - pointer to row pointer. May point to NULL on entry - * @param rownum - row number, or -1 for "next row". Ignored if random - * access is not supported. - * @return 0 for success, -1 for rownum out of range or data finished - */ - int (*get_row)(apr_pool_t *pool, apr_dbd_results_t *res, - apr_dbd_row_t **row, int rownum); - - /** get_entry: get an entry from a row - * - * @param row - row pointer - * @param col - entry number - * @param val - entry to fill - * @return 0 for success, -1 for no data, +1 for general error - */ - const char* (*get_entry)(const apr_dbd_row_t *row, int col); - - /** error: get current error message (if any) - * - * @param handle - the connection - * @param errnum - error code from operation that returned an error - * @return the database current error message, or message for errnum - * (implementation-dependent whether errnum is ignored) - */ - const char *(*error)(apr_dbd_t *handle, int errnum); - - /** escape: escape a string so it is safe for use in query/select - * - * @param pool - pool to alloc the result from - * @param string - the string to escape - * @param handle - the connection - * @return the escaped, safe string - */ - const char *(*escape)(apr_pool_t *pool, const char *string, - apr_dbd_t *handle); - - /** prepare: prepare a statement - * - * @param pool - pool to alloc the result from - * @param handle - the connection - * @param query - the SQL query - * @param label - A label for the prepared statement. - * use NULL for temporary prepared statements - * (eg within a Request in httpd) - * @param statement - statement to prepare. May point to null on entry. - * @return 0 for success or error code - */ - int (*prepare)(apr_pool_t *pool, apr_dbd_t *handle, const char *query, - const char *label, apr_dbd_prepared_t **statement); - - /** pvquery: query using a prepared statement + args - * - * @param pool - working pool - * @param handle - the connection - * @param nrows - number of rows affected. - * @param statement - the prepared statement to execute - * @param args - args to prepared statement - * @return 0 for success or error code - */ - int (*pvquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, - apr_dbd_prepared_t *statement, va_list args); - - /** pvselect: select using a prepared statement + args - * - * @param pool - working pool - * @param handle - the connection - * @param res - pointer to query results. May point to NULL on entry - * @param statement - the prepared statement to execute - * @param random - Whether to support random-access to results - * @param args - args to prepared statement - * @return 0 for success or error code - */ - int (*pvselect)(apr_pool_t *pool, apr_dbd_t *handle, - apr_dbd_results_t **res, - apr_dbd_prepared_t *statement, int random, va_list args); - - /** pquery: query using a prepared statement + args - * - * @param pool - working pool - * @param handle - the connection - * @param nrows - number of rows affected. - * @param statement - the prepared statement to execute - * @param nargs - number of args to prepared statement - * @param args - args to prepared statement - * @return 0 for success or error code - */ - int (*pquery)(apr_pool_t *pool, apr_dbd_t *handle, int *nrows, - apr_dbd_prepared_t *statement, int nargs, - const char **args); - - /** pselect: select using a prepared statement + args - * - * @param pool - working pool - * @param handle - the connection - * @param res - pointer to query results. May point to NULL on entry - * @param statement - the prepared statement to execute - * @param random - Whether to support random-access to results - * @param nargs - number of args to prepared statement - * @param args - args to prepared statement - * @return 0 for success or error code - */ - int (*pselect)(apr_pool_t *pool, apr_dbd_t *handle, - apr_dbd_results_t **res, apr_dbd_prepared_t *statement, - int random, int nargs, const char **args); - - -}; - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/libs/apr-util/include/private/apr_dbm_private.h b/libs/apr-util/include/private/apr_dbm_private.h deleted file mode 100644 index 7faae8bf3b..0000000000 --- a/libs/apr-util/include/private/apr_dbm_private.h +++ /dev/null @@ -1,125 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_DBM_PRIVATE_H -#define APR_DBM_PRIVATE_H - -#include "apr.h" -#include "apr_errno.h" -#include "apr_pools.h" -#include "apr_dbm.h" -#include "apr_file_io.h" - -#include "apu.h" - -/* ### for now, include the DBM selection; this will go away once we start - ### building and linking all of the DBMs at once. */ -#include "apu_select_dbm.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/** @internal */ - -/** - * Most DBM libraries take a POSIX mode for creating files. Don't trust - * the mode_t type, some platforms may not support it, int is safe. - */ -APU_DECLARE(int) apr_posix_perms2mode(apr_fileperms_t perm); - -/** - * Structure to describe the operations of the DBM - */ -typedef struct { - /** The name of the DBM Type */ - const char *name; - - /** Open the DBM */ - apr_status_t (*open)(apr_dbm_t **pdb, const char *pathname, - apr_int32_t mode, apr_fileperms_t perm, - apr_pool_t *pool); - - /** Close the DBM */ - void (*close)(apr_dbm_t *dbm); - - /** Fetch a dbm record value by key */ - apr_status_t (*fetch)(apr_dbm_t *dbm, apr_datum_t key, - apr_datum_t * pvalue); - - /** Store a dbm record value by key */ - apr_status_t (*store)(apr_dbm_t *dbm, apr_datum_t key, apr_datum_t value); - - /** Delete a dbm record value by key */ - apr_status_t (*del)(apr_dbm_t *dbm, apr_datum_t key); - - /** Search for a key within the dbm */ - int (*exists)(apr_dbm_t *dbm, apr_datum_t key); - - /** Retrieve the first record key from a dbm */ - apr_status_t (*firstkey)(apr_dbm_t *dbm, apr_datum_t * pkey); - - /** Retrieve the next record key from a dbm */ - apr_status_t (*nextkey)(apr_dbm_t *dbm, apr_datum_t * pkey); - - /** Proactively toss any memory associated with the apr_datum_t. */ - void (*freedatum)(apr_dbm_t *dbm, apr_datum_t data); - - /** Get the names that the DBM will use for a given pathname. */ - void (*getusednames)(apr_pool_t *pool, - const char *pathname, - const char **used1, - const char **used2); - -} apr_dbm_type_t; - - -/** - * The actual DBM - */ -struct apr_dbm_t -{ - /** Associated pool */ - apr_pool_t *pool; - - /** pointer to DB Implementation Specific data */ - void *file; - - /** Current integer error code */ - int errcode; - /** Current string error code */ - const char *errmsg; - - /** the type of DBM */ - const apr_dbm_type_t *type; -}; - - -/* Declare all of the builtin DBM providers */ -APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_sdbm; -APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_gdbm; -APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_ndbm; -APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db1; -APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db2; -APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db3; -APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db4; -APU_DECLARE_DATA extern const apr_dbm_type_t apr_dbm_type_db; - -#ifdef __cplusplus -} -#endif - -#endif /* APR_DBM_PRIVATE_H */ diff --git a/libs/apr-util/include/private/apu_config.hw b/libs/apr-util/include/private/apu_config.hw deleted file mode 100644 index c4d7d093fb..0000000000 --- a/libs/apr-util/include/private/apu_config.hw +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * Note: This is a Windows specific version of apu_config.hw. It is copied - * as apu_config.h at the start of a Windows build. - */ - -#ifdef WIN32 - -#ifndef APU_CONFIG_H -#define APU_CONFIG_H - -/* - * Windows does not have GDBM, and we always use the bundled (new) Expat - */ - -/* Define if you have the gdbm library (-lgdbm). */ -/* #undef HAVE_LIBGDBM */ - -/* define if Expat 1.0 or 1.1 was found */ -/* #undef APR_HAVE_OLD_EXPAT */ - - -#endif /* APU_CONFIG_H */ -#endif /* WIN32 */ diff --git a/libs/apr-util/include/private/apu_select_dbm.h.in b/libs/apr-util/include/private/apu_select_dbm.h.in deleted file mode 100644 index c24ebe52a9..0000000000 --- a/libs/apr-util/include/private/apu_select_dbm.h.in +++ /dev/null @@ -1,28 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APU_SELECT_DBM_H -#define APU_SELECT_DBM_H - -/* -** The following macros control what features APRUTIL will use -*/ -#define APU_USE_SDBM @apu_use_sdbm@ -#define APU_USE_NDBM @apu_use_ndbm@ -#define APU_USE_GDBM @apu_use_gdbm@ -#define APU_USE_DB @apu_use_db@ - -#endif /* !APU_SELECT_DBM_H */ diff --git a/libs/apr-util/include/private/apu_select_dbm.hw b/libs/apr-util/include/private/apu_select_dbm.hw deleted file mode 100644 index 0561cb8f84..0000000000 --- a/libs/apr-util/include/private/apu_select_dbm.hw +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APU_SELECT_DBM_H -#define APU_SELECT_DBM_H - -/* -** The following macros control what features APRUTIL will use -*/ -#define APU_USE_SDBM 1 -#define APU_USE_GDBM 0 -#define APU_USE_NDBM 0 -#define APU_USE_DB 0 - -#if APU_USE_DB -#include -#endif - -#endif /* !APU_SELECT_DBM_H */ diff --git a/libs/apr-util/ldap/NWGNUmakefile b/libs/apr-util/ldap/NWGNUmakefile deleted file mode 100644 index a0ecc3bac6..0000000000 --- a/libs/apr-util/ldap/NWGNUmakefile +++ /dev/null @@ -1,260 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(APR_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(APR)/include \ - $(APR)/include/arch/NetWare \ - $(APRUTIL)/include \ - $(LDAPSDK)/inc \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -#LDAP client requires the use of Winsock -# -ifdef USE_STDSOCKETS -XDEFINES += -DUSE_WINSOCK \ - $(EOLIST) -endif - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = -# -# If this is specified, it will override VERSION value in -# $(APR_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If this is specified it will be used by the link '-flags' directive -# -NLM_FLAGS = - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can -# be disabled by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# Declare all target files (you must add your files here) -# - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(OBJDIR)/apuldap.lib \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override the default copyright. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(OBJDIR)/apr_ldap_init.o \ - $(OBJDIR)/apr_ldap_option.o \ - $(OBJDIR)/apr_ldap_url.o \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(APR_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(APR_WORK)\build\NWGNUtail.inc - diff --git a/libs/apr-util/ldap/apr_ldap_init.c b/libs/apr-util/ldap/apr_ldap_init.c deleted file mode 100644 index 6aec5d16a0..0000000000 --- a/libs/apr-util/ldap/apr_ldap_init.c +++ /dev/null @@ -1,189 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * apr_ldap_init.c: LDAP v2/v3 common initialise - * - * Original code from auth_ldap module for Apache v1.3: - * Copyright 1998, 1999 Enbridge Pipelines Inc. - * Copyright 1999-2001 Dave Carrigan - */ - -#include "apr.h" -#include "apu.h" -#include "apr_ldap.h" -#include "apr_errno.h" -#include "apr_pools.h" -#include "apr_strings.h" - -#if APR_HAS_LDAP - -/** - * APR LDAP SSL Initialise function - * - * This function initialises SSL on the underlying LDAP toolkit - * if this is necessary. - * - * If a CA certificate is provided, this is set, however the setting - * of certificates via this method has been deprecated and will be removed in - * APR v2.0. - * - * The apr_ldap_set_option() function with the APR_LDAP_OPT_TLS_CERT option - * should be used instead to set certificates. - * - * If SSL support is not available on this platform, or a problem - * was encountered while trying to set the certificate, the function - * will return APR_EGENERAL. Further LDAP specific error information - * can be found in result_err. - */ -APU_DECLARE(int) apr_ldap_ssl_init(apr_pool_t *pool, - const char *cert_auth_file, - int cert_file_type, - apr_ldap_err_t **result_err) { - - apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); - *result_err = result; - -#if APR_HAS_LDAP_SSL /* compiled with ssl support */ - - /* Novell */ -#if APR_HAS_NOVELL_LDAPSDK - ldapssl_client_init(NULL, NULL); -#endif - - /* if a certificate was specified, set it */ - if (cert_auth_file) { - apr_ldap_opt_tls_cert_t *cert = (apr_ldap_opt_tls_cert_t *)apr_pcalloc(pool, sizeof(apr_ldap_opt_tls_cert_t)); - cert->type = cert_file_type; - cert->path = cert_auth_file; - return apr_ldap_set_option(pool, NULL, APR_LDAP_OPT_TLS_CERT, (void *)cert, result_err); - } - -#else /* not compiled with SSL Support */ - if (cert_auth_file) { - result->reason = "LDAP: Attempt to set certificate store failed. " - "Not built with SSL support"; - result->rc = -1; - } -#endif /* APR_HAS_LDAP_SSL */ - - if (result->rc != -1) { - result->msg = ldap_err2string(result->rc); - } - - if (LDAP_SUCCESS != result->rc) { - return APR_EGENERAL; - } - - return APR_SUCCESS; - -} - - -/** - * APR LDAP SSL De-Initialise function - * - * This function tears down any SSL certificate setup previously - * set using apr_ldap_ssl_init(). It should be called to clean - * up if a graceful restart of a service is attempted. - * - * This function only does anything on Netware. - * - * @todo currently we do not check whether apr_ldap_ssl_init() - * has been called first - should we? - */ -APU_DECLARE(int) apr_ldap_ssl_deinit(void) { - -#if APR_HAS_LDAP_SSL && APR_HAS_LDAPSSL_CLIENT_DEINIT - ldapssl_client_deinit(); -#endif - return APR_SUCCESS; - -} - - -/** - * APR LDAP initialise function - * - * This function is responsible for initialising an LDAP - * connection in a toolkit independant way. It does the - * job of ldap_init() from the C api. - * - * It handles both the SSL and non-SSL case, and attempts - * to hide the complexity setup from the user. This function - * assumes that any certificate setup necessary has already - * been done. - * - * If SSL or STARTTLS needs to be enabled, and the underlying - * toolkit supports it, the following values are accepted for - * secure: - * - * APR_LDAP_NONE: No encryption - * APR_LDAP_SSL: SSL encryption (ldaps://) - * APR_LDAP_STARTTLS: Force STARTTLS on ldap:// - */ -APU_DECLARE(int) apr_ldap_init(apr_pool_t *pool, - LDAP **ldap, - const char *hostname, - int portno, - int secure, - apr_ldap_err_t **result_err) { - - apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); - *result_err = result; - -#if APR_HAS_LDAPSSL_INIT - *ldap = ldapssl_init(hostname, portno, 0); -#elif APR_HAS_LDAP_SSLINIT - *ldap = ldap_sslinit((char *)hostname, portno, 0); -#else - *ldap = ldap_init((char *)hostname, portno); -#endif - if (*ldap != NULL) { - return apr_ldap_set_option(pool, *ldap, APR_LDAP_OPT_TLS, &secure, result_err); - } - else { - /* handle the error case */ - apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); - *result_err = result; - - result->reason = "APR LDAP: Unable to initialize the LDAP connection"; - result->rc = -1; - return APR_EGENERAL; - } - -} - - -/** - * APR LDAP info function - * - * This function returns a string describing the LDAP toolkit - * currently in use. The string is placed inside result_err->reason. - */ -APU_DECLARE(int) apr_ldap_info(apr_pool_t *pool, apr_ldap_err_t **result_err) -{ - apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); - *result_err = result; - - result->reason = "APR LDAP: Built with " - LDAP_VENDOR_NAME - " LDAP SDK"; - return APR_SUCCESS; - -} - -#endif /* APR_HAS_LDAP */ diff --git a/libs/apr-util/ldap/apr_ldap_option.c b/libs/apr-util/ldap/apr_ldap_option.c deleted file mode 100644 index 43eb8d090e..0000000000 --- a/libs/apr-util/ldap/apr_ldap_option.c +++ /dev/null @@ -1,598 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* apr_ldap_option.c -- LDAP options - * - * The LDAP SDK allows the getting and setting of options on an LDAP - * connection. - * - */ - -#include "apr.h" -#include "apu.h" -#include "apr_ldap.h" -#include "apr_errno.h" -#include "apr_pools.h" -#include "apr_strings.h" -#include "apr_tables.h" - -#if APR_HAS_LDAP - -static void option_set_cert(apr_pool_t *pool, LDAP *ldap, const void *invalue, - apr_ldap_err_t *result); -static void option_set_tls(apr_pool_t *pool, LDAP *ldap, const void *invalue, - apr_ldap_err_t *result); - -/** - * APR LDAP get option function - * - * This function gets option values from a given LDAP session if - * one was specified. - */ -APU_DECLARE(int) apr_ldap_get_option(apr_pool_t *pool, - LDAP *ldap, - int option, - void *outvalue, - apr_ldap_err_t **result_err) -{ - apr_ldap_err_t *result; - - result = apr_pcalloc(pool, sizeof(apr_ldap_err_t)); - *result_err = result; - if (!result) { - return APR_ENOMEM; - } - - /* get the option specified using the native LDAP function */ - result->rc = ldap_get_option(ldap, option, outvalue); - - /* handle the error case */ - if (result->rc != LDAP_SUCCESS) { - result->msg = ldap_err2string(result-> rc); - result->reason = apr_pstrdup(pool, "LDAP: Could not get an option"); - return APR_EGENERAL; - } - - return APR_SUCCESS; - -} - -/** - * APR LDAP set option function - * - * This function sets option values to a given LDAP session if - * one was specified. - * - * Where an option is not supported by an LDAP toolkit, this function - * will try and apply legacy functions to achieve the same effect, - * depending on the platform. - */ -APU_DECLARE(int) apr_ldap_set_option(apr_pool_t *pool, - LDAP *ldap, - int option, - const void *invalue, - apr_ldap_err_t **result_err) -{ - apr_ldap_err_t *result; - - result = apr_pcalloc(pool, sizeof(apr_ldap_err_t)); - *result_err = result; - if (!result) { - return APR_ENOMEM; - } - - switch (option) { - case APR_LDAP_OPT_TLS_CERT: - option_set_cert(pool, ldap, invalue, result); - break; - - case APR_LDAP_OPT_TLS: - option_set_tls(pool, ldap, invalue, result); - break; - - case APR_LDAP_OPT_VERIFY_CERT: -#if APR_HAS_NETSCAPE_LDAPSDK || APR_HAS_SOLARIS_LDAPSDK || APR_HAS_MOZILLA_LDAPSK - result->reason = "LDAP: Verify certificate not yet supported by APR on the " - "Netscape, Solaris or Mozilla LDAP SDKs"; - result->rc = -1; - return APR_EGENERAL; -#endif -#if APR_HAS_NOVELL_LDAPSDK - if (*((int*)invalue)) { - result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_SERVER); - } - else { - result->rc = ldapssl_set_verify_mode(LDAPSSL_VERIFY_NONE); - } -#endif -#if APR_HAS_OPENLDAP_LDAPSDK -#ifdef LDAP_OPT_X_TLS - /* This is not a per-connection setting so just pass NULL for the - Ldap connection handle */ - if (*((int*)invalue)) { - int i = LDAP_OPT_X_TLS_DEMAND; - result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i); - } - else { - int i = LDAP_OPT_X_TLS_NEVER; - result->rc = ldap_set_option(NULL, LDAP_OPT_X_TLS_REQUIRE_CERT, &i); - } -#else - result->reason = "LDAP: SSL/TLS not yet supported by APR on this " - "version of the OpenLDAP toolkit"; - result->rc = -1; - return APR_EGENERAL; -#endif -#endif - - /* handle the error case */ - if (result->rc != LDAP_SUCCESS) { - result->msg = ldap_err2string(result->rc); - result->reason = "LDAP: Could not set verify mode"; - } - break; - - default: - /* set the option specified using the native LDAP function */ - result->rc = ldap_set_option(ldap, option, (void *)invalue); - - /* handle the error case */ - if (result->rc != LDAP_SUCCESS) { - result->msg = ldap_err2string(result->rc); - result->reason = "LDAP: Could not set an option"; - } - break; - } - - /* handle the error case */ - if (result->rc != LDAP_SUCCESS) { - return APR_EGENERAL; - } - - return APR_SUCCESS; - -} - -/** - * Handle APR_LDAP_OPT_TLS - * - * This function sets the type of TLS to be applied to this connection. - * The options are: - * APR_LDAP_NONE: no encryption - * APR_LDAP_SSL: SSL encryption (ldaps://) - * APR_LDAP_STARTTLS: STARTTLS encryption - * APR_LDAP_STOPTLS: Stop existing TLS connecttion - */ -static void option_set_tls(apr_pool_t *pool, LDAP *ldap, const void *invalue, - apr_ldap_err_t *result) -{ - int tls = * (const int *)invalue; - -#if APR_HAS_LDAP_SSL /* compiled with ssl support */ - - /* Netscape/Mozilla/Solaris SDK */ -#if APR_HAS_NETSCAPE_LDAPSDK || APR_HAS_SOLARIS_LDAPSDK || APR_HAS_MOZILLA_LDAPSK -#if APR_HAS_LDAPSSL_INSTALL_ROUTINES - if (tls == APR_LDAP_SSL) { - result->rc = ldapssl_install_routines(ldap); -#ifdef LDAP_OPT_SSL - /* apparently Netscape and Mozilla need this too, Solaris doesn't */ - if (result->rc == LDAP_SUCCESS) { - result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, LDAP_OPT_ON); - } -#endif - if (result->rc != LDAP_SUCCESS) { - result->msg = ldap_err2string(result->rc); - result->reason = "LDAP: Could not switch SSL on for this " - "connection."; - } - } - else if (tls == APR_LDAP_STARTTLS) { - result->reason = "LDAP: STARTTLS is not supported by the " - "Netscape/Mozilla/Solaris SDK"; - result->rc = -1; - } - else if (tls == APR_LDAP_STOPTLS) { - result->reason = "LDAP: STOPTLS is not supported by the " - "Netscape/Mozilla/Solaris SDK"; - result->rc = -1; - } -#else - if (tls != APR_LDAP_NONE) { - result->reason = "LDAP: SSL/TLS is not supported by this version " - "of the Netscape/Mozilla/Solaris SDK"; - result->rc = -1; - } -#endif -#endif - - /* Novell SDK */ -#if APR_HAS_NOVELL_LDAPSDK - /* ldapssl_install_routines(ldap) - * Behavior is unpredictable when other LDAP functions are called - * between the ldap_init function and the ldapssl_install_routines - * function. - * - * STARTTLS is supported by the ldap_start_tls_s() method - */ - if (tls == APR_LDAP_SSL) { - result->rc = ldapssl_install_routines(ldap); - if (result->rc != LDAP_SUCCESS) { - result->msg = ldap_err2string(result->rc); - result->reason = "LDAP: Could not switch SSL on for this " - "connection."; - } - } - if (tls == APR_LDAP_STARTTLS) { - result->rc = ldapssl_start_tls(ldap); - if (result->rc != LDAP_SUCCESS) { - result->msg = ldap_err2string(result->rc); - result->reason = "LDAP: Could not start TLS on this connection"; - } - } - else if (tls == APR_LDAP_STOPTLS) { - result->rc = ldapssl_stop_tls(ldap); - if (result->rc != LDAP_SUCCESS) { - result->msg = ldap_err2string(result->rc); - result->reason = "LDAP: Could not stop TLS on this connection"; - } - } -#endif - - /* OpenLDAP SDK */ -#if APR_HAS_OPENLDAP_LDAPSDK -#ifdef LDAP_OPT_X_TLS - if (tls == APR_LDAP_SSL) { - int SSLmode = LDAP_OPT_X_TLS_HARD; - result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS, &SSLmode); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: ldap_set_option failed. " - "Could not set LDAP_OPT_X_TLS to " - "LDAP_OPT_X_TLS_HARD"; - result->msg = ldap_err2string(result->rc); - } - } - else if (tls == APR_LDAP_STARTTLS) { - result->rc = ldap_start_tls_s(ldap, NULL, NULL); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: ldap_start_tls_s() failed"; - result->msg = ldap_err2string(result->rc); - } - } - else if (tls == APR_LDAP_STOPTLS) { - result->reason = "LDAP: STOPTLS is not supported by the " - "OpenLDAP SDK"; - result->rc = -1; - } -#else - if (tls != APR_LDAP_NONE) { - result->reason = "LDAP: SSL/TLS not yet supported by APR on this " - "version of the OpenLDAP toolkit"; - result->rc = -1; - } -#endif -#endif - - /* Microsoft SDK */ -#if APR_HAS_MICROSOFT_LDAPSDK - if (tls == APR_LDAP_NONE) { - result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, LDAP_OPT_OFF); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: an attempt to set LDAP_OPT_SSL off " - "failed."; - result->msg = ldap_err2string(result->rc); - } - } - else if (tls == APR_LDAP_SSL) { - result->rc = ldap_set_option(ldap, LDAP_OPT_SSL, LDAP_OPT_ON); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: an attempt to set LDAP_OPT_SSL on " - "failed."; - result->msg = ldap_err2string(result->rc); - } - } -#if APR_HAS_LDAP_START_TLS_S - else if (tls == APR_LDAP_STARTTLS) { - result->rc = ldap_start_tls_s(ldap, NULL, NULL, NULL, NULL); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: ldap_start_tls_s() failed"; - result->msg = ldap_err2string(result->rc); - } - } - else if (tls == APR_LDAP_STOPTLS) { - result->rc = ldap_stop_tls_s(ldap); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: ldap_stop_tls_s() failed"; - result->msg = ldap_err2string(result->rc); - } - } -#endif -#endif - -#if APR_HAS_OTHER_LDAPSDK - if (tls != APR_LDAP_NONE) { - result->reason = "LDAP: SSL/TLS is currently not supported by " - "APR on this LDAP SDK"; - result->rc = -1; - } -#endif - -#endif /* APR_HAS_LDAP_SSL */ - -} - -/** - * Handle APR_LDAP_OPT_TLS_CACERTFILE - * - * This function sets the CA certificate for further SSL/TLS connections. - * - * The file provided are in different formats depending on the toolkit used: - * - * Netscape: cert7.db file - * Novell: PEM or DER - * OpenLDAP: PEM (others supported?) - * Microsoft: unknown - * Solaris: unknown - */ -static void option_set_cert(apr_pool_t *pool, LDAP *ldap, - const void *invalue, apr_ldap_err_t *result) -{ - apr_array_header_t *certs = (apr_array_header_t *)invalue; - struct apr_ldap_opt_tls_cert_t *ents = (struct apr_ldap_opt_tls_cert_t *)certs->elts; - int i = 0; - -#if APR_HAS_LDAP_SSL - - /* Netscape/Mozilla/Solaris SDK */ -#if APR_HAS_NETSCAPE_LDAPSDK || APR_HAS_SOLARIS_LDAPSDK || APR_HAS_MOZILLA_LDAPSDK -#if APR_HAS_LDAPSSL_CLIENT_INIT - const char *nickname = NULL; - const char *secmod = NULL; - const char *key3db = NULL; - const char *cert7db = NULL; - const char *password = NULL; - - /* set up cert7.db, key3.db and secmod parameters */ - for (i = 0; i < certs->nelts; i++) { - switch (ents[i].type) { - case APR_LDAP_CA_TYPE_CERT7_DB: - cert7db = ents[i].path; - break; - case APR_LDAP_CA_TYPE_SECMOD: - secmod = ents[i].path; - break; - case APR_LDAP_CERT_TYPE_KEY3_DB: - key3db = ents[i].path; - break; - case APR_LDAP_CERT_TYPE_NICKNAME: - nickname = ents[i].path; - password = ents[i].password; - break; - default: - result->rc = -1; - result->reason = "LDAP: The Netscape/Mozilla LDAP SDK only " - "understands the CERT7, KEY3 and SECMOD " - "file types."; - break; - } - if (result->rc != LDAP_SUCCESS) { - break; - } - } - - /* actually set the certificate parameters */ - if (result->rc == LDAP_SUCCESS) { - if (nickname) { - result->rc = ldapssl_enable_clientauth(ldap, "", - (char *)password, - (char *)nickname); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: could not set client certificate: " - "ldapssl_enable_clientauth() failed."; - result->msg = ldap_err2string(result->rc); - } - } - else if (secmod) { - result->rc = ldapssl_advclientauth_init(cert7db, NULL, - key3db ? 1 : 0, key3db, NULL, - 1, secmod, LDAPSSL_AUTH_CNCHECK); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: ldapssl_advclientauth_init() failed."; - result->msg = ldap_err2string(result->rc); - } - } - else if (key3db) { - result->rc = ldapssl_clientauth_init(cert7db, NULL, - 1, key3db, NULL); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: ldapssl_clientauth_init() failed."; - result->msg = ldap_err2string(result->rc); - } - } - else { - result->rc = ldapssl_client_init(cert7db, NULL); - if (result->rc != LDAP_SUCCESS) { - result->reason = "LDAP: ldapssl_client_init() failed."; - result->msg = ldap_err2string(result->rc); - } - } - } -#else - result->reason = "LDAP: SSL/TLS ldapssl_client_init() function not " - "supported by this Netscape/Mozilla/Solaris SDK. " - "Certificate authority file not set"; - result->rc = -1; -#endif -#endif - - /* Novell SDK */ -#if APR_HAS_NOVELL_LDAPSDK -#if APR_HAS_LDAPSSL_CLIENT_INIT && APR_HAS_LDAPSSL_ADD_TRUSTED_CERT && APR_HAS_LDAPSSL_CLIENT_DEINIT - /* The Novell library cannot support per connection certificates. Error - * out if the ldap handle is provided. - */ - if (ldap) { - result->rc = -1; - result->reason = "LDAP: The Novell LDAP SDK cannot support the setting " - "of certificates or keys on a per connection basis."; - } - /* Novell's library needs to be initialised first */ - else { - result->rc = ldapssl_client_init(NULL, NULL); - if (result->rc != LDAP_SUCCESS) { - result->msg = ldap_err2string(result-> rc); - result->reason = apr_pstrdup(pool, "LDAP: Could not " - "initialize SSL"); - } - } - /* set one or more certificates */ - for (i = 0; LDAP_SUCCESS == result->rc && i < certs->nelts; i++) { - /* Novell SDK supports DER or BASE64 files. */ - switch (ents[i].type) { - case APR_LDAP_CA_TYPE_DER: - result->rc = ldapssl_add_trusted_cert((void *)ents[i].path, - LDAPSSL_CERT_FILETYPE_DER); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_CA_TYPE_BASE64: - result->rc = ldapssl_add_trusted_cert((void *)ents[i].path, - LDAPSSL_CERT_FILETYPE_B64); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_CERT_TYPE_DER: - result->rc = ldapssl_set_client_cert((void *)ents[i].path, - LDAPSSL_CERT_FILETYPE_DER, - (void*)ents[i].password); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_CERT_TYPE_BASE64: - result->rc = ldapssl_set_client_cert((void *)ents[i].path, - LDAPSSL_CERT_FILETYPE_B64, - (void*)ents[i].password); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_CERT_TYPE_PFX: - result->rc = ldapssl_set_client_cert((void *)ents[i].path, - LDAPSSL_FILETYPE_P12, - (void*)ents[i].password); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_KEY_TYPE_DER: - result->rc = ldapssl_set_client_private_key((void *)ents[i].path, - LDAPSSL_CERT_FILETYPE_DER, - (void*)ents[i].password); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_KEY_TYPE_BASE64: - result->rc = ldapssl_set_client_private_key((void *)ents[i].path, - LDAPSSL_CERT_FILETYPE_B64, - (void*)ents[i].password); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_KEY_TYPE_PFX: - result->rc = ldapssl_set_client_private_key((void *)ents[i].path, - LDAPSSL_FILETYPE_P12, - (void*)ents[i].password); - result->msg = ldap_err2string(result->rc); - break; - default: - result->rc = -1; - result->reason = "LDAP: The Novell LDAP SDK only understands the " - "DER and PEM (BASE64) file types."; - break; - } - if (result->rc != LDAP_SUCCESS) { - break; - } - } -#else - result->reason = "LDAP: ldapssl_client_init(), " - "ldapssl_add_trusted_cert() or " - "ldapssl_client_deinit() functions not supported " - "by this Novell SDK. Certificate authority file " - "not set"; - result->rc = -1; -#endif -#endif - - /* OpenLDAP SDK */ -#if APR_HAS_OPENLDAP_LDAPSDK -#ifdef LDAP_OPT_X_TLS_CACERTFILE - /* set one or more certificates */ - /* FIXME: make it support setting directories as well as files */ - for (i = 0; i < certs->nelts; i++) { - /* OpenLDAP SDK supports BASE64 files. */ - switch (ents[i].type) { - case APR_LDAP_CA_TYPE_BASE64: - result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS_CACERTFILE, - (void *)ents[i].path); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_CERT_TYPE_BASE64: - result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS_CERTFILE, - (void *)ents[i].path); - result->msg = ldap_err2string(result->rc); - break; - case APR_LDAP_KEY_TYPE_BASE64: - result->rc = ldap_set_option(ldap, LDAP_OPT_X_TLS_KEYFILE, - (void *)ents[i].path); - result->msg = ldap_err2string(result->rc); - break; - default: - result->rc = -1; - result->reason = "LDAP: The OpenLDAP SDK only understands the " - "PEM (BASE64) file type."; - break; - } - if (result->rc != LDAP_SUCCESS) { - break; - } - } -#else - result->reason = "LDAP: LDAP_OPT_X_TLS_CACERTFILE not " - "defined by this OpenLDAP SDK. Certificate " - "authority file not set"; - result->rc = -1; -#endif -#endif - - /* Microsoft SDK */ -#if APR_HAS_MICROSOFT_LDAPSDK - /* Microsoft SDK use the registry certificate store - error out - * here with a message explaining this. */ - result->reason = "LDAP: CA certificates cannot be set using this method, " - "as they are stored in the registry instead."; - result->rc = -1; -#endif - - /* SDK not recognised */ -#if APR_HAS_OTHER_LDAPSDK - result->reason = "LDAP: LDAP_OPT_X_TLS_CACERTFILE not " - "defined by this LDAP SDK. Certificate " - "authority file not set"; - result->rc = -1; -#endif - -#else /* not compiled with SSL Support */ - result->reason = "LDAP: Attempt to set certificate(s) failed. " - "Not built with SSL support"; - result->rc = -1; -#endif /* APR_HAS_LDAP_SSL */ - -} - -#endif /* APR_HAS_LDAP */ - diff --git a/libs/apr-util/ldap/apr_ldap_url.c b/libs/apr-util/ldap/apr_ldap_url.c deleted file mode 100644 index 29684b7756..0000000000 --- a/libs/apr-util/ldap/apr_ldap_url.c +++ /dev/null @@ -1,694 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* Portions Copyright 1998-2002 The OpenLDAP Foundation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted only as authorized by the OpenLDAP - * Public License. A copy of this license is available at - * http://www.OpenLDAP.org/license.html or in file LICENSE in the - * top-level directory of the distribution. - * - * OpenLDAP is a registered trademark of the OpenLDAP Foundation. - * - * Individual files and/or contributed packages may be copyright by - * other parties and subject to additional restrictions. - * - * This work is derived from the University of Michigan LDAP v3.3 - * distribution. Information concerning this software is available - * at: http://www.umich.edu/~dirsvcs/ldap/ - * - * This work also contains materials derived from public sources. - * - * Additional information about OpenLDAP can be obtained at: - * http://www.openldap.org/ - */ - -/* - * Portions Copyright (c) 1992-1996 Regents of the University of Michigan. - * All rights reserved. - * - * Redistribution and use in source and binary forms are permitted - * provided that this notice is preserved and that due credit is given - * to the University of Michigan at Ann Arbor. The name of the University - * may not be used to endorse or promote products derived from this - * software without specific prior written permission. This software - * is provided ``as is'' without express or implied warranty. - */ - -/* apr_ldap_url.c -- LDAP URL (RFC 2255) related routines - * - * Win32 and perhaps other non-OpenLDAP based ldap libraries may be - * missing ldap_url_* APIs. We focus here on the one significant - * aspect, which is parsing. We have [for the time being] omitted - * the ldap_url_search APIs. - * - * LDAP URLs look like this: - * ldap[is]://host:port[/[dn[?[attributes][?[scope][?[filter][?exts]]]]]] - * - * where: - * attributes is a comma separated list - * scope is one of these three strings: base one sub (default=base) - * filter is an string-represented filter as in RFC 2254 - * - * e.g., ldap://host:port/dc=com?o,cn?base?o=openldap?extension - * - * Tolerates URLs that look like: and - */ - -#include "apu.h" -#include "apr_pools.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_ldap.h" - -#if APR_HAS_LDAP - -#if APR_HAVE_STDLIB_H -#include -#endif - -#ifndef LDAPS_PORT -#define LDAPS_PORT 636 /* ldaps:/// default LDAP over TLS port */ -#endif - -#define APR_LDAP_URL_PREFIX "ldap://" -#define APR_LDAP_URL_PREFIX_LEN (sizeof(APR_LDAP_URL_PREFIX)-1) -#define APR_LDAPS_URL_PREFIX "ldaps://" -#define APR_LDAPS_URL_PREFIX_LEN (sizeof(APR_LDAPS_URL_PREFIX)-1) -#define APR_LDAPI_URL_PREFIX "ldapi://" -#define APR_LDAPI_URL_PREFIX_LEN (sizeof(APR_LDAPI_URL_PREFIX)-1) -#define APR_LDAP_URL_URLCOLON "URL:" -#define APR_LDAP_URL_URLCOLON_LEN (sizeof(APR_LDAP_URL_URLCOLON)-1) - - -/* local functions */ -static const char* skip_url_prefix(const char *url, - int *enclosedp, - const char **scheme); - -static void apr_ldap_pvt_hex_unescape(char *s); - -static int apr_ldap_pvt_unhex(int c); - -static char **apr_ldap_str2charray(apr_pool_t *pool, - const char *str, - const char *brkstr); - - -/** - * Is this URL an ldap url? - * - */ -APU_DECLARE(int) apr_ldap_is_ldap_url(const char *url) -{ - int enclosed; - const char * scheme; - - if( url == NULL ) { - return 0; - } - - if( skip_url_prefix( url, &enclosed, &scheme ) == NULL ) { - return 0; - } - - return 1; -} - -/** - * Is this URL a secure ldap url? - * - */ -APU_DECLARE(int) apr_ldap_is_ldaps_url(const char *url) -{ - int enclosed; - const char * scheme; - - if( url == NULL ) { - return 0; - } - - if( skip_url_prefix( url, &enclosed, &scheme ) == NULL ) { - return 0; - } - - return strcmp(scheme, "ldaps") == 0; -} - -/** - * Is this URL an ldap socket url? - * - */ -APU_DECLARE(int) apr_ldap_is_ldapi_url(const char *url) -{ - int enclosed; - const char * scheme; - - if( url == NULL ) { - return 0; - } - - if( skip_url_prefix( url, &enclosed, &scheme ) == NULL ) { - return 0; - } - - return strcmp(scheme, "ldapi") == 0; -} - - -static const char *skip_url_prefix(const char *url, int *enclosedp, - const char **scheme) -{ - /* - * return non-zero if this looks like a LDAP URL; zero if not - * if non-zero returned, *urlp will be moved past "ldap://" part of URL - */ - const char *p; - - if ( url == NULL ) { - return( NULL ); - } - - p = url; - - /* skip leading '<' (if any) */ - if ( *p == '<' ) { - *enclosedp = 1; - ++p; - } else { - *enclosedp = 0; - } - - /* skip leading "URL:" (if any) */ - if ( strncasecmp( p, APR_LDAP_URL_URLCOLON, APR_LDAP_URL_URLCOLON_LEN ) == 0 ) { - p += APR_LDAP_URL_URLCOLON_LEN; - } - - /* check for "ldap://" prefix */ - if ( strncasecmp( p, APR_LDAP_URL_PREFIX, APR_LDAP_URL_PREFIX_LEN ) == 0 ) { - /* skip over "ldap://" prefix and return success */ - p += APR_LDAP_URL_PREFIX_LEN; - *scheme = "ldap"; - return( p ); - } - - /* check for "ldaps://" prefix */ - if ( strncasecmp( p, APR_LDAPS_URL_PREFIX, APR_LDAPS_URL_PREFIX_LEN ) == 0 ) { - /* skip over "ldaps://" prefix and return success */ - p += APR_LDAPS_URL_PREFIX_LEN; - *scheme = "ldaps"; - return( p ); - } - - /* check for "ldapi://" prefix */ - if ( strncasecmp( p, APR_LDAPI_URL_PREFIX, APR_LDAPI_URL_PREFIX_LEN ) == 0 ) { - /* skip over "ldapi://" prefix and return success */ - p += APR_LDAPI_URL_PREFIX_LEN; - *scheme = "ldapi"; - return( p ); - } - - return( NULL ); -} - - -static int str2scope(const char *p) -{ - if ( strcasecmp( p, "one" ) == 0 ) { - return LDAP_SCOPE_ONELEVEL; - - } else if ( strcasecmp( p, "onetree" ) == 0 ) { - return LDAP_SCOPE_ONELEVEL; - - } else if ( strcasecmp( p, "base" ) == 0 ) { - return LDAP_SCOPE_BASE; - - } else if ( strcasecmp( p, "sub" ) == 0 ) { - return LDAP_SCOPE_SUBTREE; - - } else if ( strcasecmp( p, "subtree" ) == 0 ) { - return LDAP_SCOPE_SUBTREE; - } - - return( -1 ); -} - - -/** - * Parse the URL provided into an apr_ldap_url_desc_t object. - * - * APR_SUCCESS is returned on success, APR_EGENERAL on failure. - * The LDAP result code and reason string is returned in the - * apr_ldap_err_t structure. - */ -APU_DECLARE(int) apr_ldap_url_parse_ext(apr_pool_t *pool, - const char *url_in, - apr_ldap_url_desc_t **ludpp, - apr_ldap_err_t **result_err) -{ - apr_ldap_url_desc_t *ludp; - char *p, *q, *r; - int i, enclosed; - const char *scheme = NULL; - const char *url_tmp; - char *url; - - apr_ldap_err_t *result = (apr_ldap_err_t *)apr_pcalloc(pool, sizeof(apr_ldap_err_t)); - *result_err = result; - - /* sanity check our parameters */ - if( url_in == NULL || ludpp == NULL ) { - result->reason = "Either the LDAP URL, or the URL structure was NULL. Oops."; - result->rc = APR_LDAP_URL_ERR_PARAM; - return APR_EGENERAL; - } - - *ludpp = NULL; /* pessimistic */ - - url_tmp = skip_url_prefix( url_in, &enclosed, &scheme ); - if ( url_tmp == NULL ) { - result->reason = "The scheme was not recognised as a valid LDAP URL scheme."; - result->rc = APR_LDAP_URL_ERR_BADSCHEME; - return APR_EGENERAL; - } - - /* make working copy of the remainder of the URL */ - url = (char *)apr_pstrdup(pool, url_tmp); - if ( url == NULL ) { - result->reason = "Out of memory parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_MEM; - return APR_EGENERAL; - } - - if ( enclosed ) { - p = &url[strlen(url)-1]; - - if( *p != '>' ) { - result->reason = "Bad enclosure error while parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_BADENCLOSURE; - return APR_EGENERAL; - } - - *p = '\0'; - } - - /* allocate return struct */ - ludp = (apr_ldap_url_desc_t *)apr_pcalloc(pool, sizeof(apr_ldap_url_desc_t)); - if ( ludp == NULL ) { - result->reason = "Out of memory parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_MEM; - return APR_EGENERAL; - } - - ludp->lud_next = NULL; - ludp->lud_host = NULL; - ludp->lud_port = LDAP_PORT; - ludp->lud_dn = NULL; - ludp->lud_attrs = NULL; - ludp->lud_filter = NULL; - ludp->lud_scope = -1; - ludp->lud_filter = NULL; - ludp->lud_exts = NULL; - - ludp->lud_scheme = (char *)apr_pstrdup(pool, scheme); - if ( ludp->lud_scheme == NULL ) { - result->reason = "Out of memory parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_MEM; - return APR_EGENERAL; - } - - if( strcasecmp( ludp->lud_scheme, "ldaps" ) == 0 ) { - ludp->lud_port = LDAPS_PORT; - } - - /* scan forward for '/' that marks end of hostport and begin. of dn */ - p = strchr( url, '/' ); - - if( p != NULL ) { - /* terminate hostport; point to start of dn */ - *p++ = '\0'; - } - - /* IPv6 syntax with [ip address]:port */ - if ( *url == '[' ) { - r = strchr( url, ']' ); - if ( r == NULL ) { - result->reason = "Bad LDAP URL while parsing IPV6 syntax."; - result->rc = APR_LDAP_URL_ERR_BADURL; - return APR_EGENERAL; - } - *r++ = '\0'; - q = strrchr( r, ':' ); - } else { - q = strrchr( url, ':' ); - } - - if ( q != NULL ) { - apr_ldap_pvt_hex_unescape( ++q ); - - if( *q == '\0' ) { - result->reason = "Bad LDAP URL while parsing."; - result->rc = APR_LDAP_URL_ERR_BADURL; - return APR_EGENERAL; - } - - ludp->lud_port = atoi( q ); - } - - apr_ldap_pvt_hex_unescape( url ); - - /* If [ip address]:port syntax, url is [ip and we skip the [ */ - ludp->lud_host = (char *)apr_pstrdup(pool, url + ( *url == '[' )); - if( ludp->lud_host == NULL ) { - result->reason = "Out of memory parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_MEM; - return APR_EGENERAL; - } - - /* - * Kludge. ldap://111.222.333.444:389??cn=abc,o=company - * - * On early Novell releases, search references/referrals were returned - * in this format, i.e., the dn was kind of in the scope position, - * but the required slash is missing. The whole thing is illegal syntax, - * but we need to account for it. Fortunately it can't be confused with - * anything real. - */ - if( (p == NULL) && (q != NULL) && ((q = strchr( q, '?')) != NULL)) { - q++; - /* ? immediately followed by question */ - if( *q == '?') { - q++; - if( *q != '\0' ) { - /* parse dn part */ - apr_ldap_pvt_hex_unescape( q ); - ludp->lud_dn = (char *)apr_pstrdup(pool, q); - } else { - ludp->lud_dn = (char *)apr_pstrdup(pool, ""); - } - - if( ludp->lud_dn == NULL ) { - result->reason = "Out of memory parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_MEM; - return APR_EGENERAL; - } - } - } - - if( p == NULL ) { - *ludpp = ludp; - return APR_SUCCESS; - } - - /* scan forward for '?' that may marks end of dn */ - q = strchr( p, '?' ); - - if( q != NULL ) { - /* terminate dn part */ - *q++ = '\0'; - } - - if( *p != '\0' ) { - /* parse dn part */ - apr_ldap_pvt_hex_unescape( p ); - ludp->lud_dn = (char *)apr_pstrdup(pool, p); - } else { - ludp->lud_dn = (char *)apr_pstrdup(pool, ""); - } - - if( ludp->lud_dn == NULL ) { - result->reason = "Out of memory parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_MEM; - return APR_EGENERAL; - } - - if( q == NULL ) { - /* no more */ - *ludpp = ludp; - return APR_SUCCESS; - } - - /* scan forward for '?' that may marks end of attributes */ - p = q; - q = strchr( p, '?' ); - - if( q != NULL ) { - /* terminate attributes part */ - *q++ = '\0'; - } - - if( *p != '\0' ) { - /* parse attributes */ - apr_ldap_pvt_hex_unescape( p ); - ludp->lud_attrs = apr_ldap_str2charray(pool, p, ","); - - if( ludp->lud_attrs == NULL ) { - result->reason = "Bad attributes encountered while parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_BADATTRS; - return APR_EGENERAL; - } - } - - if ( q == NULL ) { - /* no more */ - *ludpp = ludp; - return APR_SUCCESS; - } - - /* scan forward for '?' that may marks end of scope */ - p = q; - q = strchr( p, '?' ); - - if( q != NULL ) { - /* terminate the scope part */ - *q++ = '\0'; - } - - if( *p != '\0' ) { - /* parse the scope */ - apr_ldap_pvt_hex_unescape( p ); - ludp->lud_scope = str2scope( p ); - - if( ludp->lud_scope == -1 ) { - result->reason = "Bad scope encountered while parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_BADSCOPE; - return APR_EGENERAL; - } - } - - if ( q == NULL ) { - /* no more */ - *ludpp = ludp; - return APR_SUCCESS; - } - - /* scan forward for '?' that may marks end of filter */ - p = q; - q = strchr( p, '?' ); - - if( q != NULL ) { - /* terminate the filter part */ - *q++ = '\0'; - } - - if( *p != '\0' ) { - /* parse the filter */ - apr_ldap_pvt_hex_unescape( p ); - - if( ! *p ) { - /* missing filter */ - result->reason = "Bad filter encountered while parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_BADFILTER; - return APR_EGENERAL; - } - - ludp->lud_filter = (char *)apr_pstrdup(pool, p); - if( ludp->lud_filter == NULL ) { - result->reason = "Out of memory parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_MEM; - return APR_EGENERAL; - } - } - - if ( q == NULL ) { - /* no more */ - *ludpp = ludp; - return APR_SUCCESS; - } - - /* scan forward for '?' that may marks end of extensions */ - p = q; - q = strchr( p, '?' ); - - if( q != NULL ) { - /* extra '?' */ - result->reason = "Bad URL encountered while parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_BADURL; - return APR_EGENERAL; - } - - /* parse the extensions */ - ludp->lud_exts = apr_ldap_str2charray(pool, p, ","); - if( ludp->lud_exts == NULL ) { - result->reason = "Bad extensions encountered while parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_BADEXTS; - return APR_EGENERAL; - } - - for( i=0; ludp->lud_exts[i] != NULL; i++ ) { - apr_ldap_pvt_hex_unescape( ludp->lud_exts[i] ); - - if( *ludp->lud_exts[i] == '!' ) { - /* count the number of critical extensions */ - ludp->lud_crit_exts++; - } - } - - if( i == 0 ) { - /* must have 1 or more */ - result->reason = "Bad extensions encountered while parsing LDAP URL."; - result->rc = APR_LDAP_URL_ERR_BADEXTS; - return APR_EGENERAL; - } - - /* no more */ - *ludpp = ludp; - return APR_SUCCESS; -} - - -/** - * Parse the URL provided into an apr_ldap_url_desc_t object. - * - * APR_SUCCESS is returned on success, APR_EGENERAL on failure. - * The LDAP result code and reason string is returned in the - * apr_ldap_err_t structure. - */ -APU_DECLARE(int) apr_ldap_url_parse(apr_pool_t *pool, - const char *url_in, - apr_ldap_url_desc_t **ludpp, - apr_ldap_err_t **result_err) -{ - - int rc = apr_ldap_url_parse_ext(pool, url_in, ludpp, result_err); - if( rc != APR_SUCCESS ) { - return rc; - } - - if ((*ludpp)->lud_scope == -1) { - (*ludpp)->lud_scope = LDAP_SCOPE_BASE; - } - - if ((*ludpp)->lud_host != NULL && *(*ludpp)->lud_host == '\0') { - (*ludpp)->lud_host = NULL; - } - - return rc; - -} - - -static void apr_ldap_pvt_hex_unescape(char *s) -{ - /* - * Remove URL hex escapes from s... done in place. The basic concept for - * this routine is borrowed from the WWW library HTUnEscape() routine. - */ - char *p; - - for ( p = s; *s != '\0'; ++s ) { - if ( *s == '%' ) { - if ( *++s == '\0' ) { - break; - } - *p = apr_ldap_pvt_unhex( *s ) << 4; - if ( *++s == '\0' ) { - break; - } - *p++ += apr_ldap_pvt_unhex( *s ); - } else { - *p++ = *s; - } - } - - *p = '\0'; -} - - -static int apr_ldap_pvt_unhex(int c) -{ - return( c >= '0' && c <= '9' ? c - '0' - : c >= 'A' && c <= 'F' ? c - 'A' + 10 - : c - 'a' + 10 ); -} - - -/** - * Convert a string to a character array - */ -static char **apr_ldap_str2charray(apr_pool_t *pool, - const char *str_in, - const char *brkstr) -{ - char **res; - char *str, *s; - char *lasts; - int i; - - /* protect the input string from strtok */ - str = (char *)apr_pstrdup(pool, str_in); - if( str == NULL ) { - return NULL; - } - - i = 1; - for ( s = str; *s; s++ ) { - /* Warning: this strchr was previously ldap_utf8_strchr(), check - * whether this particular code has any charset issues. - */ - if ( strchr( brkstr, *s ) != NULL ) { - i++; - } - } - - res = (char **) apr_pcalloc(pool, (i + 1) * sizeof(char *)); - if( res == NULL ) { - return NULL; - } - - i = 0; - - for ( s = (char *)apr_strtok( str, brkstr, &lasts ); - s != NULL; - s = (char *)apr_strtok( NULL, brkstr, &lasts ) ) { - - res[i] = (char *)apr_pstrdup(pool, s); - if(res[i] == NULL) { - return NULL; - } - - i++; - } - - res[i] = NULL; - - return( res ); - -} - -#endif /* APR_HAS_LDAP */ diff --git a/libs/apr-util/libaprutil.dsp b/libs/apr-util/libaprutil.dsp deleted file mode 100644 index 4eb1c49351..0000000000 --- a/libs/apr-util/libaprutil.dsp +++ /dev/null @@ -1,614 +0,0 @@ -# Microsoft Developer Studio Project File - Name="libaprutil" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=libaprutil - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "libaprutil.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "libaprutil.mak" CFG="libaprutil - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "libaprutil - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "libaprutil - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "libaprutil - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "./include" /I "../apr/include" /I "./include/private" /I "../apr-iconv/include" /I "./dbm/sdbm" /I "./xml/expat/lib" /D "NDEBUG" /D "APU_DECLARE_EXPORT" /D "APU_USE_SDBM" /D "WIN32" /D "_WINDOWS" /Fd"Release\libaprutil_src" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" /d "APU_VERSION_ONLY" /I "./include" /I "../apr/include" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib wldap32.lib ole32.lib /nologo /base:"0x6EE60000" /subsystem:windows /dll /incremental:no /debug /machine:I386 /opt:ref -# ADD LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib wldap32.lib ole32.lib /nologo /base:"0x6EE60000" /subsystem:windows /dll /incremental:no /debug /machine:I386 /out:"Release/libaprutil-1.dll" /opt:ref -# Begin Special Build Tool -OutDir=.\Release -SOURCE="$(InputPath)" -PostBuild_Desc=Embed .manifest -PostBuild_Cmds=if exist $(OUTDIR)\libaprutil-1.dll.manifest mt.exe -manifest $(OUTDIR)\libaprutil-1.dll.manifest -outputresource:$(OUTDIR)\libaprutil-1.dll;2 -# End Special Build Tool - -!ELSEIF "$(CFG)" == "libaprutil - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "./include" /I "../apr/include" /I "./include/private" /I "../apr-iconv/include" /I "./dbm/sdbm" /I "./xml/expat/lib" /D "_DEBUG" /D "APU_DECLARE_EXPORT" /D "APU_USE_SDBM" /D "WIN32" /D "_WINDOWS" /Fd"Debug\libaprutil_src" /FD /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" /d "APU_VERSION_ONLY" /I "./include" /I "../apr/include" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib wldap32.lib ole32.lib /nologo /base:"0x6EE60000" /subsystem:windows /dll /incremental:no /debug /machine:I386 -# ADD LINK32 kernel32.lib advapi32.lib ws2_32.lib mswsock.lib wldap32.lib ole32.lib /nologo /base:"0x6EE60000" /subsystem:windows /dll /incremental:no /debug /machine:I386 /out:"Debug/libaprutil-1.dll" -# Begin Special Build Tool -OutDir=.\Debug -SOURCE="$(InputPath)" -PostBuild_Desc=Embed .manifest -PostBuild_Cmds=if exist $(OUTDIR)\libaprutil-1.dll.manifest mt.exe -manifest $(OUTDIR)\libaprutil-1.dll.manifest -outputresource:$(OUTDIR)\libaprutil-1.dll;2 -# End Special Build Tool - -!ENDIF - -# Begin Target - -# Name "libaprutil - Win32 Release" -# Name "libaprutil - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "" -# Begin Group "buckets" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\buckets\apr_brigade.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_alloc.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_eos.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_file.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_flush.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_heap.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_mmap.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_pipe.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_pool.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_refcount.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_simple.c -# End Source File -# Begin Source File - -SOURCE=.\buckets\apr_buckets_socket.c -# End Source File -# End Group -# Begin Group "crypto" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\crypto\apr_md4.c -# End Source File -# Begin Source File - -SOURCE=.\crypto\apr_md5.c -# End Source File -# Begin Source File - -SOURCE=.\crypto\apr_sha1.c -# End Source File -# Begin Source File - -SOURCE=.\crypto\getuuid.c -# End Source File -# Begin Source File - -SOURCE=.\crypto\uuid.c -# End Source File -# End Group -# Begin Group "dbd" -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\dbd\apr_dbd.c -# End Source File -# Begin Source File - -SOURCE=.\dbd\apr_dbd_pgsql.c -# End Source File -# Begin Source File - -SOURCE=.\dbd\apr_dbd_sqlite2.c -# End Source File -# Begin Source File - -SOURCE=.\dbd\apr_dbd_sqlite3.c -# End Source File -# End Group -# Begin Group "dbm" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\dbm\apr_dbm.c -# End Source File -# Begin Source File - -SOURCE=.\dbm\apr_dbm_berkeleydb.c -# End Source File -# Begin Source File - -SOURCE=.\dbm\apr_dbm_gdbm.c -# End Source File -# Begin Source File - -SOURCE=.\dbm\apr_dbm_sdbm.c -# End Source File -# End Group -# Begin Group "encoding" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\encoding\apr_base64.c -# End Source File -# End Group -# Begin Group "hooks" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\hooks\apr_hooks.c -# End Source File -# End Group -# Begin Group "ldap" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\ldap\apr_ldap_init.c -# End Source File -# Begin Source File - -SOURCE=.\ldap\apr_ldap_url.c -# End Source File -# Begin Source File - -SOURCE=.\ldap\apr_ldap_option.c -# End Source File -# End Group -# Begin Group "misc" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\misc\apr_date.c -# End Source File -# Begin Source File - -SOURCE=.\misc\apr_queue.c -# End Source File -# Begin Source File - -SOURCE=.\misc\apr_reslist.c -# End Source File -# Begin Source File - -SOURCE=.\misc\apr_rmm.c -# End Source File -# Begin Source File - -SOURCE=.\misc\apu_version.c -# End Source File -# End Group -# Begin Group "sdbm" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\dbm\sdbm\sdbm.c -# End Source File -# Begin Source File - -SOURCE=.\dbm\sdbm\sdbm_hash.c -# End Source File -# Begin Source File - -SOURCE=.\dbm\sdbm\sdbm_lock.c -# End Source File -# Begin Source File - -SOURCE=.\dbm\sdbm\sdbm_pair.c -# End Source File -# Begin Source File - -SOURCE=.\dbm\sdbm\sdbm_pair.h -# End Source File -# Begin Source File - -SOURCE=.\dbm\sdbm\sdbm_private.h -# End Source File -# Begin Source File - -SOURCE=.\dbm\sdbm\sdbm_tune.h -# End Source File -# End Group -# Begin Group "strmatch" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\strmatch\apr_strmatch.c -# End Source File -# End Group -# Begin Group "uri" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\uri\apr_uri.c -# End Source File -# End Group -# Begin Group "xlate" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\xlate\xlate.c -# End Source File -# End Group -# Begin Group "xml" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\xml\apr_xml.c -# End Source File -# End Group -# End Group -# Begin Group "Generated Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\apr_ldap.h.in -# End Source File -# Begin Source File - -SOURCE=.\include\apr_ldap.hnw -# End Source File -# Begin Source File - -SOURCE=.\include\apr_ldap.hw - -!IF "$(CFG)" == "libaprutil - Win32 Release" - -# Begin Custom Build - Creating apr_ldap.h from apr_ldap.hw -InputPath=.\include\apr_ldap.hw - -".\include\apr_ldap.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apr_ldap.hw > .\include\apr_ldap.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "libaprutil - Win32 Debug" - -# Begin Custom Build - Creating apr_ldap.h from apr_ldap.hw -InputPath=.\include\apr_ldap.hw - -".\include\apr_ldap.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apr_ldap.hw > .\include\apr_ldap.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\include\apu.h.in -# End Source File -# Begin Source File - -SOURCE=.\include\apu.hnw -# End Source File -# Begin Source File - -SOURCE=.\include\apu.hw - -!IF "$(CFG)" == "libaprutil - Win32 Release" - -# Begin Custom Build - Creating apu.h from apu.hw -InputPath=.\include\apu.hw - -".\include\apu.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apu.hw > .\include\apu.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "libaprutil - Win32 Debug" - -# Begin Custom Build - Creating apu.h from apu.hw -InputPath=.\include\apu.hw - -".\include\apu.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apu.hw > .\include\apu.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\include\private\apu_config.h.in -# End Source File -# Begin Source File - -SOURCE=.\include\private\apu_config.hw - -!IF "$(CFG)" == "libaprutil - Win32 Release" - -# Begin Custom Build - Creating apu_config.h from apu_config.hw -InputPath=.\include\private\apu_config.hw - -".\include\private\apu_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\private\apu_config.hw > .\include\private\apu_config.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "libaprutil - Win32 Debug" - -# Begin Custom Build - Creating apu_config.h from apu_config.hw -InputPath=.\include\private\apu_config.hw - -".\include\private\apu_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\private\apu_config.hw > .\include\private\apu_config.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\include\private\apu_select_dbm.h.in -# End Source File -# Begin Source File - -SOURCE=.\include\private\apu_select_dbm.hw - -!IF "$(CFG)" == "libaprutil - Win32 Release" - -# Begin Custom Build - Creating apu_select_dbm.h from apu_select_dbm.hw -InputPath=.\include\private\apu_select_dbm.hw - -".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\private\apu_select_dbm.hw > .\include\private\apu_select_dbm.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "libaprutil - Win32 Debug" - -# Begin Custom Build - Creating apu_select_dbm.h from apu_select_dbm.hw -InputPath=.\include\private\apu_select_dbm.hw - -".\include\private\apu_select_dbm.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\private\apu_select_dbm.hw > .\include\private\apu_select_dbm.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\include\apu_want.h.in -# End Source File -# Begin Source File - -SOURCE=.\include\apu_want.hnw -# End Source File -# Begin Source File - -SOURCE=.\include\apu_want.hw - -!IF "$(CFG)" == "libaprutil - Win32 Release" - -# Begin Custom Build - Creating apu_want.h from apu_want.hw -InputPath=.\include\apu_want.hw - -".\include\apu_want.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apu_want.hw > .\include\apu_want.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "libaprutil - Win32 Debug" - -# Begin Custom Build - Creating apu_want.h from apu_want.hw -InputPath=.\include\apu_want.hw - -".\include\apu_want.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apu_want.hw > .\include\apu_want.h - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Group "Public Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\include\apr_anylock.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_base64.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_buckets.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_date.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_dbm.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_hooks.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_ldap_url.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_md4.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_md5.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_optional.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_optional_hooks.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_queue.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_reslist.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_rmm.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_sdbm.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_sha1.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_strmatch.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_uri.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_uuid.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_xlate.h -# End Source File -# Begin Source File - -SOURCE=.\include\apr_xml.h -# End Source File -# Begin Source File - -SOURCE=.\include\apu_version.h -# End Source File -# End Group -# Begin Source File - -SOURCE=.\libaprutil.rc -# End Source File - -# End Target -# End Project diff --git a/libs/apr-util/libaprutil.rc b/libs/apr-util/libaprutil.rc deleted file mode 100644 index 06a527f6bc..0000000000 --- a/libs/apr-util/libaprutil.rc +++ /dev/null @@ -1,66 +0,0 @@ -#include "apu_version.h" - -#define APU_COPYRIGHT "Copyright 2000-2005 The Apache Software " \ - "Foundation or its licensors, as applicable." - -#define APU_LICENSE "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\r\n\r\n" \ - "http://www.apache.org/licenses/LICENSE-2.0\r\n\r\n" \ - "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." - -#define APU_DLL_BASENAME "libaprutil-" APU_STRINGIFY(APU_MAJOR_VERSION) - - -1 VERSIONINFO - FILEVERSION APU_VERSION_STRING_CSV,0 - PRODUCTVERSION APU_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(APU_IS_DEV_VERSION) -#if defined(_DEBUG) - FILEFLAGS 0x03L -#else - FILEFLAGS 0x02L -#endif -#else -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", APU_LICENSE "\0" - VALUE "CompanyName", "Apache Software Foundation\0" - VALUE "FileDescription", "Apache Portable Runtime Library\0" - VALUE "FileVersion", APU_VERSION_STRING "\0" - VALUE "InternalName", APU_DLL_BASENAME "\0" - VALUE "LegalCopyright", APU_COPYRIGHT "\0" - VALUE "OriginalFilename", APU_DLL_BASENAME ".dll\0" - VALUE "ProductName", "Apache Portable Runtime Project\0" - VALUE "ProductVersion", APU_VERSION_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/libs/apr-util/misc/apr_date.c b/libs/apr-util/misc/apr_date.c deleted file mode 100644 index f584e09314..0000000000 --- a/libs/apr-util/misc/apr_date.c +++ /dev/null @@ -1,616 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * apr_date.c: date parsing utility routines - * These routines are (hopefully) platform independent. - * - * 27 Oct 1996 Roy Fielding - * Extracted (with many modifications) from mod_proxy.c and - * tested with over 50,000 randomly chosen valid date strings - * and several hundred variations of invalid date strings. - * - */ - -#include "apr.h" -#include "apr_lib.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_STDLIB_H -#include -#endif - -#if APR_HAVE_CTYPE_H -#include -#endif - -#include "apr_date.h" - -/* - * Compare a string to a mask - * Mask characters (arbitrary maximum is 256 characters, just in case): - * @ - uppercase letter - * $ - lowercase letter - * & - hex digit - * # - digit - * ~ - digit or space - * * - swallow remaining characters - * - exact match for any other character - */ -APU_DECLARE(int) apr_date_checkmask(const char *data, const char *mask) -{ - int i; - char d; - - for (i = 0; i < 256; i++) { - d = data[i]; - switch (mask[i]) { - case '\0': - return (d == '\0'); - - case '*': - return 1; - - case '@': - if (!apr_isupper(d)) - return 0; - break; - case '$': - if (!apr_islower(d)) - return 0; - break; - case '#': - if (!apr_isdigit(d)) - return 0; - break; - case '&': - if (!apr_isxdigit(d)) - return 0; - break; - case '~': - if ((d != ' ') && !apr_isdigit(d)) - return 0; - break; - default: - if (mask[i] != d) - return 0; - break; - } - } - return 0; /* We only get here if mask is corrupted (exceeds 256) */ -} - -/* - * Parses an HTTP date in one of three standard forms: - * - * Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 - * Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 - * Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format - * - * and returns the apr_time_t number of microseconds since 1 Jan 1970 GMT, - * or APR_DATE_BAD if this would be out of range or if the date is invalid. - * - * The restricted HTTP syntax is - * - * HTTP-date = rfc1123-date | rfc850-date | asctime-date - * - * rfc1123-date = wkday "," SP date1 SP time SP "GMT" - * rfc850-date = weekday "," SP date2 SP time SP "GMT" - * asctime-date = wkday SP date3 SP time SP 4DIGIT - * - * date1 = 2DIGIT SP month SP 4DIGIT - * ; day month year (e.g., 02 Jun 1982) - * date2 = 2DIGIT "-" month "-" 2DIGIT - * ; day-month-year (e.g., 02-Jun-82) - * date3 = month SP ( 2DIGIT | ( SP 1DIGIT )) - * ; month day (e.g., Jun 2) - * - * time = 2DIGIT ":" 2DIGIT ":" 2DIGIT - * ; 00:00:00 - 23:59:59 - * - * wkday = "Mon" | "Tue" | "Wed" - * | "Thu" | "Fri" | "Sat" | "Sun" - * - * weekday = "Monday" | "Tuesday" | "Wednesday" - * | "Thursday" | "Friday" | "Saturday" | "Sunday" - * - * month = "Jan" | "Feb" | "Mar" | "Apr" - * | "May" | "Jun" | "Jul" | "Aug" - * | "Sep" | "Oct" | "Nov" | "Dec" - * - * However, for the sake of robustness (and Netscapeness), we ignore the - * weekday and anything after the time field (including the timezone). - * - * This routine is intended to be very fast; 10x faster than using sscanf. - * - * Originally from Andrew Daviel , 29 Jul 96 - * but many changes since then. - * - */ -APU_DECLARE(apr_time_t) apr_date_parse_http(const char *date) -{ - apr_time_exp_t ds; - apr_time_t result; - int mint, mon; - const char *monstr, *timstr; - static const int months[12] = - { - ('J' << 16) | ('a' << 8) | 'n', ('F' << 16) | ('e' << 8) | 'b', - ('M' << 16) | ('a' << 8) | 'r', ('A' << 16) | ('p' << 8) | 'r', - ('M' << 16) | ('a' << 8) | 'y', ('J' << 16) | ('u' << 8) | 'n', - ('J' << 16) | ('u' << 8) | 'l', ('A' << 16) | ('u' << 8) | 'g', - ('S' << 16) | ('e' << 8) | 'p', ('O' << 16) | ('c' << 8) | 't', - ('N' << 16) | ('o' << 8) | 'v', ('D' << 16) | ('e' << 8) | 'c'}; - - if (!date) - return APR_DATE_BAD; - - while (*date && apr_isspace(*date)) /* Find first non-whitespace char */ - ++date; - - if (*date == '\0') - return APR_DATE_BAD; - - if ((date = strchr(date, ' ')) == NULL) /* Find space after weekday */ - return APR_DATE_BAD; - - ++date; /* Now pointing to first char after space, which should be */ - - /* start of the actual date information for all 4 formats. */ - - if (apr_date_checkmask(date, "## @$$ #### ##:##:## *")) { - /* RFC 1123 format with two days */ - ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100; - if (ds.tm_year < 0) - return APR_DATE_BAD; - - ds.tm_year += ((date[9] - '0') * 10) + (date[10] - '0'); - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 12; - } - else if (apr_date_checkmask(date, "##-@$$-## ##:##:## *")) { - /* RFC 850 format */ - ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0'); - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 10; - } - else if (apr_date_checkmask(date, "@$$ ~# ##:##:## ####*")) { - /* asctime format */ - ds.tm_year = ((date[16] - '0') * 10 + (date[17] - '0') - 19) * 100; - if (ds.tm_year < 0) - return APR_DATE_BAD; - - ds.tm_year += ((date[18] - '0') * 10) + (date[19] - '0'); - - if (date[4] == ' ') - ds.tm_mday = 0; - else - ds.tm_mday = (date[4] - '0') * 10; - - ds.tm_mday += (date[5] - '0'); - - monstr = date; - timstr = date + 7; - } - else if (apr_date_checkmask(date, "# @$$ #### ##:##:## *")) { - /* RFC 1123 format with one day */ - ds.tm_year = ((date[6] - '0') * 10 + (date[7] - '0') - 19) * 100; - if (ds.tm_year < 0) - return APR_DATE_BAD; - - ds.tm_year += ((date[8] - '0') * 10) + (date[9] - '0'); - - ds.tm_mday = (date[0] - '0'); - - monstr = date + 2; - timstr = date + 11; - } - else - return APR_DATE_BAD; - - if (ds.tm_mday <= 0 || ds.tm_mday > 31) - return APR_DATE_BAD; - - ds.tm_hour = ((timstr[0] - '0') * 10) + (timstr[1] - '0'); - ds.tm_min = ((timstr[3] - '0') * 10) + (timstr[4] - '0'); - ds.tm_sec = ((timstr[6] - '0') * 10) + (timstr[7] - '0'); - - if ((ds.tm_hour > 23) || (ds.tm_min > 59) || (ds.tm_sec > 61)) - return APR_DATE_BAD; - - mint = (monstr[0] << 16) | (monstr[1] << 8) | monstr[2]; - for (mon = 0; mon < 12; mon++) - if (mint == months[mon]) - break; - - if (mon == 12) - return APR_DATE_BAD; - - if ((ds.tm_mday == 31) && (mon == 3 || mon == 5 || mon == 8 || mon == 10)) - return APR_DATE_BAD; - - /* February gets special check for leapyear */ - if ((mon == 1) && - ((ds.tm_mday > 29) || - ((ds.tm_mday == 29) - && ((ds.tm_year & 3) - || (((ds.tm_year % 100) == 0) - && (((ds.tm_year % 400) != 100))))))) - return APR_DATE_BAD; - - ds.tm_mon = mon; - - /* ap_mplode_time uses tm_usec and tm_gmtoff fields, but they haven't - * been set yet. - * It should be safe to just zero out these values. - * tm_usec is the number of microseconds into the second. HTTP only - * cares about second granularity. - * tm_gmtoff is the number of seconds off of GMT the time is. By - * definition all times going through this function are in GMT, so this - * is zero. - */ - ds.tm_usec = 0; - ds.tm_gmtoff = 0; - if (apr_time_exp_get(&result, &ds) != APR_SUCCESS) - return APR_DATE_BAD; - - return result; -} - -/* - * Parses a string resembling an RFC 822 date. This is meant to be - * leinent in its parsing of dates. Hence, this will parse a wider - * range of dates than apr_date_parse_http. - * - * The prominent mailer (or poster, if mailer is unknown) that has - * been seen in the wild is included for the unknown formats. - * - * Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 - * Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036 - * Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format - * Sun, 6 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123 - * Sun, 06 Nov 94 08:49:37 GMT ; RFC 822 - * Sun, 6 Nov 94 08:49:37 GMT ; RFC 822 - * Sun, 06 Nov 94 08:49 GMT ; Unknown [drtr@ast.cam.ac.uk] - * Sun, 6 Nov 94 08:49 GMT ; Unknown [drtr@ast.cam.ac.uk] - * Sun, 06 Nov 94 8:49:37 GMT ; Unknown [Elm 70.85] - * Sun, 6 Nov 94 8:49:37 GMT ; Unknown [Elm 70.85] - * Mon, 7 Jan 2002 07:21:22 GMT ; Unknown [Postfix] - * Sun, 06-Nov-1994 08:49:37 GMT ; RFC 850 with four digit years - * - */ - -#define TIMEPARSE(ds,hr10,hr1,min10,min1,sec10,sec1) \ - { \ - ds.tm_hour = ((hr10 - '0') * 10) + (hr1 - '0'); \ - ds.tm_min = ((min10 - '0') * 10) + (min1 - '0'); \ - ds.tm_sec = ((sec10 - '0') * 10) + (sec1 - '0'); \ - } -#define TIMEPARSE_STD(ds,timstr) \ - { \ - TIMEPARSE(ds, timstr[0],timstr[1], \ - timstr[3],timstr[4], \ - timstr[6],timstr[7]); \ - } - -APU_DECLARE(apr_time_t) apr_date_parse_rfc(const char *date) -{ - apr_time_exp_t ds; - apr_time_t result; - int mint, mon; - const char *monstr, *timstr, *gmtstr; - static const int months[12] = - { - ('J' << 16) | ('a' << 8) | 'n', ('F' << 16) | ('e' << 8) | 'b', - ('M' << 16) | ('a' << 8) | 'r', ('A' << 16) | ('p' << 8) | 'r', - ('M' << 16) | ('a' << 8) | 'y', ('J' << 16) | ('u' << 8) | 'n', - ('J' << 16) | ('u' << 8) | 'l', ('A' << 16) | ('u' << 8) | 'g', - ('S' << 16) | ('e' << 8) | 'p', ('O' << 16) | ('c' << 8) | 't', - ('N' << 16) | ('o' << 8) | 'v', ('D' << 16) | ('e' << 8) | 'c' }; - - if (!date) - return APR_DATE_BAD; - - /* Not all dates have text months at the beginning. */ - if (!apr_isdigit(date[0])) - { - while (*date && apr_isspace(*date)) /* Find first non-whitespace char */ - ++date; - - if (*date == '\0') - return APR_DATE_BAD; - - if ((date = strchr(date, ' ')) == NULL) /* Find space after weekday */ - return APR_DATE_BAD; - - ++date; /* Now pointing to first char after space, which should be */ } - - /* start of the actual date information for all 11 formats. */ - if (apr_date_checkmask(date, "## @$$ #### ##:##:## *")) { /* RFC 1123 format */ - ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100; - - if (ds.tm_year < 0) - return APR_DATE_BAD; - - ds.tm_year += ((date[9] - '0') * 10) + (date[10] - '0'); - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 12; - gmtstr = date + 20; - - TIMEPARSE_STD(ds, timstr); - } - else if (apr_date_checkmask(date, "##-@$$-## ##:##:## *")) {/* RFC 850 format */ - ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0'); - - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 10; - gmtstr = date + 19; - - TIMEPARSE_STD(ds, timstr); - } - else if (apr_date_checkmask(date, "@$$ ~# ##:##:## ####*")) { - /* asctime format */ - ds.tm_year = ((date[16] - '0') * 10 + (date[17] - '0') - 19) * 100; - if (ds.tm_year < 0) - return APR_DATE_BAD; - - ds.tm_year += ((date[18] - '0') * 10) + (date[19] - '0'); - - if (date[4] == ' ') - ds.tm_mday = 0; - else - ds.tm_mday = (date[4] - '0') * 10; - - ds.tm_mday += (date[5] - '0'); - - monstr = date; - timstr = date + 7; - gmtstr = NULL; - - TIMEPARSE_STD(ds, timstr); - } - else if (apr_date_checkmask(date, "# @$$ #### ##:##:## *")) { - /* RFC 1123 format*/ - ds.tm_year = ((date[6] - '0') * 10 + (date[7] - '0') - 19) * 100; - - if (ds.tm_year < 0) - return APR_DATE_BAD; - - ds.tm_year += ((date[8] - '0') * 10) + (date[9] - '0'); - ds.tm_mday = (date[0] - '0'); - - monstr = date + 2; - timstr = date + 11; - gmtstr = date + 20; - - TIMEPARSE_STD(ds, timstr); - } - else if (apr_date_checkmask(date, "## @$$ ## ##:##:## *")) { - /* This is the old RFC 1123 date format - many many years ago, people - * used two-digit years. Oh, how foolish. */ - ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0'); - - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 10; - gmtstr = date + 19; - - TIMEPARSE_STD(ds, timstr); - } - else if (apr_date_checkmask(date, "# @$$ ## ##:##:## *")) { - /* This is the old RFC 1123 date format - many many years ago, people - * used two-digit years. Oh, how foolish. */ - ds.tm_year = ((date[6] - '0') * 10) + (date[7] - '0'); - - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = (date[0] - '0'); - - monstr = date + 2; - timstr = date + 9; - gmtstr = date + 18; - - TIMEPARSE_STD(ds, timstr); - } - else if (apr_date_checkmask(date, "## @$$ ## ##:## *")) { - /* Loser format. This is quite bogus. */ - ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0'); - - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 10; - gmtstr = NULL; - - TIMEPARSE(ds, timstr[0],timstr[1], timstr[3],timstr[4], '0','0'); - } - else if (apr_date_checkmask(date, "# @$$ ## ##:## *")) { - /* Loser format. This is quite bogus. */ - ds.tm_year = ((date[6] - '0') * 10) + (date[7] - '0'); - - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = (date[0] - '0'); - - monstr = date + 2; - timstr = date + 9; - gmtstr = NULL; - - TIMEPARSE(ds, timstr[0],timstr[1], timstr[3],timstr[4], '0','0'); - } - else if (apr_date_checkmask(date, "## @$$ ## #:##:## *")) { - /* Loser format. This is quite bogus. */ - ds.tm_year = ((date[7] - '0') * 10) + (date[8] - '0'); - - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 9; - gmtstr = date + 18; - - TIMEPARSE(ds, '0',timstr[1], timstr[3],timstr[4], timstr[6],timstr[7]); - } - else if (apr_date_checkmask(date, "# @$$ ## #:##:## *")) { - /* Loser format. This is quite bogus. */ - ds.tm_year = ((date[6] - '0') * 10) + (date[7] - '0'); - - if (ds.tm_year < 70) - ds.tm_year += 100; - - ds.tm_mday = (date[0] - '0'); - - monstr = date + 2; - timstr = date + 8; - gmtstr = date + 17; - - TIMEPARSE(ds, '0',timstr[1], timstr[3],timstr[4], timstr[6],timstr[7]); - } - else if (apr_date_checkmask(date, " # @$$ #### ##:##:## *")) { - /* RFC 1123 format with a space instead of a leading zero. */ - ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100; - - if (ds.tm_year < 0) - return APR_DATE_BAD; - - ds.tm_year += ((date[9] - '0') * 10) + (date[10] - '0'); - - ds.tm_mday = (date[1] - '0'); - - monstr = date + 3; - timstr = date + 12; - gmtstr = date + 20; - - TIMEPARSE_STD(ds, timstr); - } - else if (apr_date_checkmask(date, "##-@$$-#### ##:##:## *")) { - /* RFC 1123 with dashes instead of spaces between date/month/year - * This also looks like RFC 850 with four digit years. - */ - ds.tm_year = ((date[7] - '0') * 10 + (date[8] - '0') - 19) * 100; - if (ds.tm_year < 0) - return APR_DATE_BAD; - - ds.tm_year += ((date[9] - '0') * 10) + (date[10] - '0'); - - ds.tm_mday = ((date[0] - '0') * 10) + (date[1] - '0'); - - monstr = date + 3; - timstr = date + 12; - gmtstr = date + 21; - - TIMEPARSE_STD(ds, timstr); - } - else - return APR_DATE_BAD; - - if (ds.tm_mday <= 0 || ds.tm_mday > 31) - return APR_DATE_BAD; - - if ((ds.tm_hour > 23) || (ds.tm_min > 59) || (ds.tm_sec > 61)) - return APR_DATE_BAD; - - mint = (monstr[0] << 16) | (monstr[1] << 8) | monstr[2]; - for (mon = 0; mon < 12; mon++) - if (mint == months[mon]) - break; - - if (mon == 12) - return APR_DATE_BAD; - - if ((ds.tm_mday == 31) && (mon == 3 || mon == 5 || mon == 8 || mon == 10)) - return APR_DATE_BAD; - - /* February gets special check for leapyear */ - - if ((mon == 1) && - ((ds.tm_mday > 29) - || ((ds.tm_mday == 29) - && ((ds.tm_year & 3) - || (((ds.tm_year % 100) == 0) - && (((ds.tm_year % 400) != 100))))))) - return APR_DATE_BAD; - - ds.tm_mon = mon; - - /* tm_gmtoff is the number of seconds off of GMT the time is. - * - * We only currently support: [+-]ZZZZ where Z is the offset in - * hours from GMT. - * - * If there is any confusion, tm_gmtoff will remain 0. - */ - ds.tm_gmtoff = 0; - if (gmtstr && *gmtstr != '\0') { - /* Do we have a GMT? */ - if (*(++gmtstr) != '\0') { - int offset; - switch (*(gmtstr++)) { - case '-': - offset = atoi(gmtstr); - ds.tm_gmtoff -= (offset / 100) * 60 * 60; - ds.tm_gmtoff -= (offset % 100) * 60; - break; - case '+': - offset = atoi(gmtstr); - ds.tm_gmtoff += (offset / 100) * 60 * 60; - ds.tm_gmtoff += (offset % 100) * 60; - break; - } - } - } - - /* apr_time_exp_get uses tm_usec field, but it hasn't been set yet. - * It should be safe to just zero out this value. - * tm_usec is the number of microseconds into the second. HTTP only - * cares about second granularity. - */ - ds.tm_usec = 0; - - if (apr_time_exp_gmt_get(&result, &ds) != APR_SUCCESS) - return APR_DATE_BAD; - - return result; -} diff --git a/libs/apr-util/misc/apr_reslist.c b/libs/apr-util/misc/apr_reslist.c deleted file mode 100644 index c8ed5062dc..0000000000 --- a/libs/apr-util/misc/apr_reslist.c +++ /dev/null @@ -1,376 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include - -#include "apu.h" -#include "apr_reslist.h" -#include "apr_errno.h" -#include "apr_strings.h" -#include "apr_thread_mutex.h" -#include "apr_thread_cond.h" -#include "apr_ring.h" - -#if APR_HAS_THREADS - -/** - * A single resource element. - */ -struct apr_res_t { - apr_time_t freed; - void *opaque; - APR_RING_ENTRY(apr_res_t) link; -}; -typedef struct apr_res_t apr_res_t; - -/** - * A ring of resources representing the list of available resources. - */ -APR_RING_HEAD(apr_resring_t, apr_res_t); -typedef struct apr_resring_t apr_resring_t; - -struct apr_reslist_t { - apr_pool_t *pool; /* the pool used in constructor and destructor calls */ - int ntotal; /* total number of resources managed by this list */ - int nidle; /* number of available resources */ - int min; /* desired minimum number of available resources */ - int smax; /* soft maximum on the total number of resources */ - int hmax; /* hard maximum on the total number of resources */ - apr_interval_time_t ttl; /* TTL when we have too many resources */ - apr_interval_time_t timeout; /* Timeout for waiting on resource */ - apr_reslist_constructor constructor; - apr_reslist_destructor destructor; - void *params; /* opaque data passed to constructor and destructor calls */ - apr_resring_t avail_list; - apr_resring_t free_list; - apr_thread_mutex_t *listlock; - apr_thread_cond_t *avail; -}; - -/** - * Grab a resource from the front of the resource list. - * Assumes: that the reslist is locked. - */ -static apr_res_t *pop_resource(apr_reslist_t *reslist) -{ - apr_res_t *res; - res = APR_RING_FIRST(&reslist->avail_list); - APR_RING_REMOVE(res, link); - reslist->nidle--; - return res; -} - -/** - * Add a resource to the end of the list, set the time at which - * it was added to the list. - * Assumes: that the reslist is locked. - */ -static void push_resource(apr_reslist_t *reslist, apr_res_t *resource) -{ - APR_RING_INSERT_TAIL(&reslist->avail_list, resource, apr_res_t, link); - resource->freed = apr_time_now(); - reslist->nidle++; -} - -/** - * Get an resource container from the free list or create a new one. - */ -static apr_res_t *get_container(apr_reslist_t *reslist) -{ - apr_res_t *res; - - if (!APR_RING_EMPTY(&reslist->free_list, apr_res_t, link)) { - res = APR_RING_FIRST(&reslist->free_list); - APR_RING_REMOVE(res, link); - } - else - res = apr_pcalloc(reslist->pool, sizeof(*res)); - return res; -} - -/** - * Free up a resource container by placing it on the free list. - */ -static void free_container(apr_reslist_t *reslist, apr_res_t *container) -{ - APR_RING_INSERT_TAIL(&reslist->free_list, container, apr_res_t, link); -} - -/** - * Create a new resource and return it. - * Assumes: that the reslist is locked. - */ -static apr_status_t create_resource(apr_reslist_t *reslist, apr_res_t **ret_res) -{ - apr_status_t rv; - apr_res_t *res; - - res = get_container(reslist); - - rv = reslist->constructor(&res->opaque, reslist->params, reslist->pool); - - *ret_res = res; - return rv; -} - -/** - * Destroy a single idle resource. - * Assumes: that the reslist is locked. - */ -static apr_status_t destroy_resource(apr_reslist_t *reslist, apr_res_t *res) -{ - return reslist->destructor(res->opaque, reslist->params, reslist->pool); -} - -static apr_status_t reslist_cleanup(void *data_) -{ - apr_status_t rv; - apr_reslist_t *rl = data_; - apr_res_t *res; - - apr_thread_mutex_lock(rl->listlock); - - while (rl->nidle > 0) { - res = pop_resource(rl); - rl->ntotal--; - rv = destroy_resource(rl, res); - if (rv != APR_SUCCESS) { - return rv; - } - free_container(rl, res); - } - - assert(rl->nidle == 0); - assert(rl->ntotal == 0); - - apr_thread_mutex_destroy(rl->listlock); - apr_thread_cond_destroy(rl->avail); - - return APR_SUCCESS; -} - -/** - * Perform routine maintenance on the resource list. This call - * may instantiate new resources or expire old resources. - */ -static apr_status_t reslist_maint(apr_reslist_t *reslist) -{ - apr_time_t now; - apr_status_t rv; - apr_res_t *res; - int created_one = 0; - - apr_thread_mutex_lock(reslist->listlock); - - /* Check if we need to create more resources, and if we are allowed to. */ - while (reslist->nidle < reslist->min && reslist->ntotal <= reslist->hmax) { - /* Create the resource */ - rv = create_resource(reslist, &res); - if (rv != APR_SUCCESS) { - free_container(reslist, res); - apr_thread_mutex_unlock(reslist->listlock); - return rv; - } - /* Add it to the list */ - push_resource(reslist, res); - /* Update our counters */ - reslist->ntotal++; - /* If someone is waiting on that guy, wake them up. */ - rv = apr_thread_cond_signal(reslist->avail); - if (rv != APR_SUCCESS) { - apr_thread_mutex_unlock(reslist->listlock); - return rv; - } - created_one++; - } - - /* We don't need to see if we're over the max if we were under it before */ - if (created_one) { - apr_thread_mutex_unlock(reslist->listlock); - return APR_SUCCESS; - } - - /* Check if we need to expire old resources */ - now = apr_time_now(); - while (reslist->nidle > reslist->smax && reslist->nidle > 0) { - /* Peak at the first resource in the list */ - res = APR_RING_FIRST(&reslist->avail_list); - /* See if the oldest entry should be expired */ - if (now - res->freed < reslist->ttl) { - /* If this entry is too young, none of the others - * will be ready to be expired either, so we are done. */ - break; - } - res = pop_resource(reslist); - reslist->ntotal--; - rv = destroy_resource(reslist, res); - free_container(reslist, res); - if (rv != APR_SUCCESS) { - apr_thread_mutex_unlock(reslist->listlock); - return rv; - } - } - - apr_thread_mutex_unlock(reslist->listlock); - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_reslist_create(apr_reslist_t **reslist, - int min, int smax, int hmax, - apr_interval_time_t ttl, - apr_reslist_constructor con, - apr_reslist_destructor de, - void *params, - apr_pool_t *pool) -{ - apr_status_t rv; - apr_reslist_t *rl; - - /* Do some sanity checks so we don't thrash around in the - * maintenance routine later. */ - if (min > smax || min > hmax || smax > hmax || ttl < 0) { - return APR_EINVAL; - } - - rl = apr_pcalloc(pool, sizeof(*rl)); - rl->pool = pool; - rl->min = min; - rl->smax = smax; - rl->hmax = hmax; - rl->ttl = ttl; - rl->constructor = con; - rl->destructor = de; - rl->params = params; - - APR_RING_INIT(&rl->avail_list, apr_res_t, link); - APR_RING_INIT(&rl->free_list, apr_res_t, link); - - rv = apr_thread_mutex_create(&rl->listlock, APR_THREAD_MUTEX_DEFAULT, - pool); - if (rv != APR_SUCCESS) { - return rv; - } - rv = apr_thread_cond_create(&rl->avail, pool); - if (rv != APR_SUCCESS) { - return rv; - } - - rv = reslist_maint(rl); - if (rv != APR_SUCCESS) { - return rv; - } - - apr_pool_cleanup_register(rl->pool, rl, reslist_cleanup, - apr_pool_cleanup_null); - - *reslist = rl; - - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_reslist_destroy(apr_reslist_t *reslist) -{ - return apr_pool_cleanup_run(reslist->pool, reslist, reslist_cleanup); -} - -APU_DECLARE(apr_status_t) apr_reslist_acquire(apr_reslist_t *reslist, - void **resource) -{ - apr_status_t rv; - apr_res_t *res; - - apr_thread_mutex_lock(reslist->listlock); - /* If there are idle resources on the available list, use - * them right away. */ - if (reslist->nidle > 0) { - /* Pop off the first resource */ - res = pop_resource(reslist); - *resource = res->opaque; - free_container(reslist, res); - apr_thread_mutex_unlock(reslist->listlock); - return APR_SUCCESS; - } - /* If we've hit our max, block until we're allowed to create - * a new one, or something becomes free. */ - else while (reslist->ntotal >= reslist->hmax - && reslist->nidle <= 0) { - if (reslist->timeout) { - if ((rv = apr_thread_cond_timedwait(reslist->avail, - reslist->listlock, reslist->timeout)) != APR_SUCCESS) { - apr_thread_mutex_unlock(reslist->listlock); - return rv; - } - } - else - apr_thread_cond_wait(reslist->avail, reslist->listlock); - } - /* If we popped out of the loop, first try to see if there - * are new resources available for immediate use. */ - if (reslist->nidle > 0) { - res = pop_resource(reslist); - *resource = res->opaque; - free_container(reslist, res); - apr_thread_mutex_unlock(reslist->listlock); - return APR_SUCCESS; - } - /* Otherwise the reason we dropped out of the loop - * was because there is a new slot available, so create - * a resource to fill the slot and use it. */ - else { - rv = create_resource(reslist, &res); - if (rv == APR_SUCCESS) { - reslist->ntotal++; - *resource = res->opaque; - } - free_container(reslist, res); - apr_thread_mutex_unlock(reslist->listlock); - return rv; - } -} - -APU_DECLARE(apr_status_t) apr_reslist_release(apr_reslist_t *reslist, - void *resource) -{ - apr_res_t *res; - - apr_thread_mutex_lock(reslist->listlock); - res = get_container(reslist); - res->opaque = resource; - push_resource(reslist, res); - apr_thread_cond_signal(reslist->avail); - apr_thread_mutex_unlock(reslist->listlock); - - return reslist_maint(reslist); -} - -APU_DECLARE(void) apr_reslist_timeout_set(apr_reslist_t *reslist, - apr_interval_time_t timeout) -{ - reslist->timeout = timeout; -} - -APU_DECLARE(apr_status_t) apr_reslist_invalidate(apr_reslist_t *reslist, - void *resource) -{ - apr_status_t ret; - apr_thread_mutex_lock(reslist->listlock); - ret = reslist->destructor(resource, reslist->params, reslist->pool); - reslist->ntotal--; - apr_thread_mutex_unlock(reslist->listlock); - return ret; -} - -#endif /* APR_HAS_THREADS */ diff --git a/libs/apr-util/misc/apr_rmm.c b/libs/apr-util/misc/apr_rmm.c deleted file mode 100644 index 87d0513213..0000000000 --- a/libs/apr-util/misc/apr_rmm.c +++ /dev/null @@ -1,446 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apr_general.h" -#include "apr_rmm.h" -#include "apr_errno.h" -#include "apr_lib.h" -#include "apr_strings.h" - -/* The RMM region is made up of two doubly-linked-list of blocks; the - * list of used blocks, and the list of free blocks (either list may - * be empty). The base pointer, rmm->base, points at the beginning of - * the shmem region in use. Each block is addressable by an - * apr_rmm_off_t value, which represents the offset from the base - * pointer. The term "address" is used here to mean such a value; an - * "offset from rmm->base". - * - * The RMM region contains exactly one "rmm_hdr_block_t" structure, - * the "header block", which is always stored at the base pointer. - * The firstused field in this structure is the address of the first - * block in the "used blocks" list; the firstfree field is the address - * of the first block in the "free blocks" list. - * - * Each block is prefixed by an "rmm_block_t" structure, followed by - * the caller-usable region represented by the block. The next and - * prev fields of the structure are zero if the block is at the end or - * beginning of the linked-list respectively, or otherwise hold the - * address of the next and previous blocks in the list. ("address 0", - * i.e. rmm->base is *not* a valid address for a block, since the - * header block is always stored at that address). - * - * At creation, the RMM region is initialized to hold a single block - * on the free list representing the entire available shm segment - * (minus header block); subsequent allocation and deallocation of - * blocks involves splitting blocks and coalescing adjacent blocks, - * and switching them between the free and used lists as - * appropriate. */ - -typedef struct rmm_block_t { - apr_size_t size; - apr_rmm_off_t prev; - apr_rmm_off_t next; -} rmm_block_t; - -/* Always at our apr_rmm_off(0): - */ -typedef struct rmm_hdr_block_t { - apr_size_t abssize; - apr_rmm_off_t /* rmm_block_t */ firstused; - apr_rmm_off_t /* rmm_block_t */ firstfree; -} rmm_hdr_block_t; - -#define RMM_HDR_BLOCK_SIZE (APR_ALIGN_DEFAULT(sizeof(rmm_hdr_block_t))) -#define RMM_BLOCK_SIZE (APR_ALIGN_DEFAULT(sizeof(rmm_block_t))) - -struct apr_rmm_t { - apr_pool_t *p; - rmm_hdr_block_t *base; - apr_size_t size; - apr_anylock_t lock; -}; - -static apr_rmm_off_t find_block_by_offset(apr_rmm_t *rmm, apr_rmm_off_t next, - apr_rmm_off_t find, int includes) -{ - apr_rmm_off_t prev = 0; - - while (next) { - struct rmm_block_t *blk = (rmm_block_t*)((char*)rmm->base + next); - - if (find == next) - return next; - - /* Overshot? */ - if (find < next) - return includes ? prev : 0; - - prev = next; - next = blk->next; - } - return includes ? prev : 0; -} - -static apr_rmm_off_t find_block_of_size(apr_rmm_t *rmm, apr_size_t size) -{ - apr_rmm_off_t next = rmm->base->firstfree; - apr_rmm_off_t best = 0; - apr_rmm_off_t bestsize = 0; - - while (next) { - struct rmm_block_t *blk = (rmm_block_t*)((char*)rmm->base + next); - - if (blk->size == size) - return next; - - if (blk->size >= size) { - /* XXX: sub optimal algorithm - * We need the most thorough best-fit logic, since we can - * never grow our rmm, we are SOL when we hit the wall. - */ - if (!bestsize || (blk->size < bestsize)) { - bestsize = blk->size; - best = next; - } - } - - next = blk->next; - } - - if (bestsize > RMM_BLOCK_SIZE + size) { - struct rmm_block_t *blk = (rmm_block_t*)((char*)rmm->base + best); - struct rmm_block_t *new = (rmm_block_t*)((char*)rmm->base + best + size); - - new->size = blk->size - size; - new->next = blk->next; - new->prev = best; - - blk->size = size; - blk->next = best + size; - - if (new->next) { - blk = (rmm_block_t*)((char*)rmm->base + new->next); - blk->prev = best + size; - } - } - - return best; -} - -static void move_block(apr_rmm_t *rmm, apr_rmm_off_t this, int free) -{ - struct rmm_block_t *blk = (rmm_block_t*)((char*)rmm->base + this); - - /* close the gap */ - if (blk->prev) { - struct rmm_block_t *prev = (rmm_block_t*)((char*)rmm->base + blk->prev); - prev->next = blk->next; - } - else { - if (free) { - rmm->base->firstused = blk->next; - } - else { - rmm->base->firstfree = blk->next; - } - } - if (blk->next) { - struct rmm_block_t *next = (rmm_block_t*)((char*)rmm->base + blk->next); - next->prev = blk->prev; - } - - /* now find it in the other list, pushing it to the head if required */ - if (free) { - blk->prev = find_block_by_offset(rmm, rmm->base->firstfree, this, 1); - if (!blk->prev) { - blk->next = rmm->base->firstfree; - rmm->base->firstfree = this; - } - } - else { - blk->prev = find_block_by_offset(rmm, rmm->base->firstused, this, 1); - if (!blk->prev) { - blk->next = rmm->base->firstused; - rmm->base->firstused = this; - } - } - - /* and open it up */ - if (blk->prev) { - struct rmm_block_t *prev = (rmm_block_t*)((char*)rmm->base + blk->prev); - if (free && (blk->prev + prev->size == this)) { - /* Collapse us into our predecessor */ - prev->size += blk->size; - this = blk->prev; - blk = prev; - } - else { - blk->next = prev->next; - prev->next = this; - } - } - - if (blk->next) { - struct rmm_block_t *next = (rmm_block_t*)((char*)rmm->base + blk->next); - if (free && (this + blk->size == blk->next)) { - /* Collapse us into our successor */ - blk->size += next->size; - blk->next = next->next; - if (blk->next) { - next = (rmm_block_t*)((char*)rmm->base + blk->next); - next->prev = this; - } - } - else { - next->prev = this; - } - } -} - -APU_DECLARE(apr_status_t) apr_rmm_init(apr_rmm_t **rmm, apr_anylock_t *lock, - void *base, apr_size_t size, - apr_pool_t *p) -{ - apr_status_t rv; - rmm_block_t *blk; - apr_anylock_t nulllock; - - if (!lock) { - nulllock.type = apr_anylock_none; - nulllock.lock.pm = NULL; - lock = &nulllock; - } - if ((rv = APR_ANYLOCK_LOCK(lock)) != APR_SUCCESS) - return rv; - - (*rmm) = (apr_rmm_t *)apr_pcalloc(p, sizeof(apr_rmm_t)); - (*rmm)->p = p; - (*rmm)->base = base; - (*rmm)->size = size; - (*rmm)->lock = *lock; - - (*rmm)->base->abssize = size; - (*rmm)->base->firstused = 0; - (*rmm)->base->firstfree = RMM_HDR_BLOCK_SIZE; - - blk = (rmm_block_t *)((char*)base + (*rmm)->base->firstfree); - - blk->size = size - (*rmm)->base->firstfree; - blk->prev = 0; - blk->next = 0; - - return APR_ANYLOCK_UNLOCK(lock); -} - -APU_DECLARE(apr_status_t) apr_rmm_destroy(apr_rmm_t *rmm) -{ - apr_status_t rv; - rmm_block_t *blk; - - if ((rv = APR_ANYLOCK_LOCK(&rmm->lock)) != APR_SUCCESS) { - return rv; - } - /* Blast it all --- no going back :) */ - if (rmm->base->firstused) { - apr_rmm_off_t this = rmm->base->firstused; - do { - blk = (rmm_block_t *)((char*)rmm->base + this); - this = blk->next; - blk->next = blk->prev = 0; - } while (this); - rmm->base->firstused = 0; - } - if (rmm->base->firstfree) { - apr_rmm_off_t this = rmm->base->firstfree; - do { - blk = (rmm_block_t *)((char*)rmm->base + this); - this = blk->next; - blk->next = blk->prev = 0; - } while (this); - rmm->base->firstfree = 0; - } - rmm->base->abssize = 0; - rmm->size = 0; - - return APR_ANYLOCK_UNLOCK(&rmm->lock); -} - -APU_DECLARE(apr_status_t) apr_rmm_attach(apr_rmm_t **rmm, apr_anylock_t *lock, - void *base, apr_pool_t *p) -{ - apr_anylock_t nulllock; - - if (!lock) { - nulllock.type = apr_anylock_none; - nulllock.lock.pm = NULL; - lock = &nulllock; - } - - /* sanity would be good here */ - (*rmm) = (apr_rmm_t *)apr_pcalloc(p, sizeof(apr_rmm_t)); - (*rmm)->p = p; - (*rmm)->base = base; - (*rmm)->size = (*rmm)->base->abssize; - (*rmm)->lock = *lock; - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_rmm_detach(apr_rmm_t *rmm) -{ - /* A noop until we introduce locked/refcounts */ - return APR_SUCCESS; -} - -APU_DECLARE(apr_rmm_off_t) apr_rmm_malloc(apr_rmm_t *rmm, apr_size_t reqsize) -{ - apr_rmm_off_t this; - - reqsize = APR_ALIGN_DEFAULT(reqsize) + RMM_BLOCK_SIZE; - - APR_ANYLOCK_LOCK(&rmm->lock); - - this = find_block_of_size(rmm, reqsize); - - if (this) { - move_block(rmm, this, 0); - this += RMM_BLOCK_SIZE; - } - - APR_ANYLOCK_UNLOCK(&rmm->lock); - return this; -} - -APU_DECLARE(apr_rmm_off_t) apr_rmm_calloc(apr_rmm_t *rmm, apr_size_t reqsize) -{ - apr_rmm_off_t this; - - reqsize = APR_ALIGN_DEFAULT(reqsize) + RMM_BLOCK_SIZE; - - APR_ANYLOCK_LOCK(&rmm->lock); - - this = find_block_of_size(rmm, reqsize); - - if (this) { - move_block(rmm, this, 0); - this += RMM_BLOCK_SIZE; - memset((char*)rmm->base + this, 0, reqsize - RMM_BLOCK_SIZE); - } - - APR_ANYLOCK_UNLOCK(&rmm->lock); - return this; -} - -APU_DECLARE(apr_rmm_off_t) apr_rmm_realloc(apr_rmm_t *rmm, void *entity, - apr_size_t reqsize) -{ - apr_rmm_off_t this; - apr_rmm_off_t old; - struct rmm_block_t *blk; - apr_size_t oldsize; - - if (!entity) { - return apr_rmm_malloc(rmm, reqsize); - } - - reqsize = APR_ALIGN_DEFAULT(reqsize); - old = apr_rmm_offset_get(rmm, entity); - - if ((this = apr_rmm_malloc(rmm, reqsize)) == 0) { - return 0; - } - - blk = (rmm_block_t*)((char*)rmm->base + old - RMM_BLOCK_SIZE); - oldsize = blk->size; - - memcpy(apr_rmm_addr_get(rmm, this), - apr_rmm_addr_get(rmm, old), oldsize < reqsize ? oldsize : reqsize); - apr_rmm_free(rmm, old); - - return this; -} - -APU_DECLARE(apr_status_t) apr_rmm_free(apr_rmm_t *rmm, apr_rmm_off_t this) -{ - apr_status_t rv; - struct rmm_block_t *blk; - - /* A little sanity check is always healthy, especially here. - * If we really cared, we could make this compile-time - */ - if (this < RMM_HDR_BLOCK_SIZE + RMM_BLOCK_SIZE) { - return APR_EINVAL; - } - - this -= RMM_BLOCK_SIZE; - - blk = (rmm_block_t*)((char*)rmm->base + this); - - if ((rv = APR_ANYLOCK_LOCK(&rmm->lock)) != APR_SUCCESS) { - return rv; - } - if (blk->prev) { - struct rmm_block_t *prev = (rmm_block_t*)((char*)rmm->base + blk->prev); - if (prev->next != this) { - APR_ANYLOCK_UNLOCK(&rmm->lock); - return APR_EINVAL; - } - } - else { - if (rmm->base->firstused != this) { - APR_ANYLOCK_UNLOCK(&rmm->lock); - return APR_EINVAL; - } - } - - if (blk->next) { - struct rmm_block_t *next = (rmm_block_t*)((char*)rmm->base + blk->next); - if (next->prev != this) { - APR_ANYLOCK_UNLOCK(&rmm->lock); - return APR_EINVAL; - } - } - - /* Ok, it remained [apparently] sane, so unlink it - */ - move_block(rmm, this, 1); - - return APR_ANYLOCK_UNLOCK(&rmm->lock); -} - -APU_DECLARE(void *) apr_rmm_addr_get(apr_rmm_t *rmm, apr_rmm_off_t entity) -{ - /* debug-sanity checking here would be good - */ - return (void*)((char*)rmm->base + entity); -} - -APU_DECLARE(apr_rmm_off_t) apr_rmm_offset_get(apr_rmm_t *rmm, void* entity) -{ - /* debug, or always, sanity checking here would be good - * since the primitive is apr_rmm_off_t, I don't mind penalizing - * inverse conversions for safety, unless someone can prove that - * there is no choice in some cases. - */ - return ((char*)entity - (char*)rmm->base); -} - -APU_DECLARE(apr_size_t) apr_rmm_overhead_get(int n) -{ - /* overhead per block is at most APR_ALIGN_DEFAULT(1) wasted bytes - * for alignment overhead, plus the size of the rmm_block_t - * structure. */ - return RMM_HDR_BLOCK_SIZE + n * (RMM_BLOCK_SIZE + APR_ALIGN_DEFAULT(1)); -} diff --git a/libs/apr-util/misc/apu_version.c b/libs/apr-util/misc/apu_version.c deleted file mode 100644 index dab34b71ad..0000000000 --- a/libs/apr-util/misc/apu_version.c +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apr_general.h" /* for APR_STRINGIFY */ - -#include "apu.h" -#include "apu_version.h" - -APU_DECLARE(void) apu_version(apr_version_t *pvsn) -{ - pvsn->major = APU_MAJOR_VERSION; - pvsn->minor = APU_MINOR_VERSION; - pvsn->patch = APU_PATCH_VERSION; -#ifdef APU_IS_DEV_VERSION - pvsn->is_dev = 1; -#else - pvsn->is_dev = 0; -#endif -} - -APU_DECLARE(const char *) apu_version_string(void) -{ - return APU_VERSION_STRING; -} diff --git a/libs/apr-util/renames_pending b/libs/apr-util/renames_pending deleted file mode 100644 index 0ebcfe2eb3..0000000000 --- a/libs/apr-util/renames_pending +++ /dev/null @@ -1,2 +0,0 @@ -Symbol renames pending for apr-util (keep ordered and complete, please!) - diff --git a/libs/apr-util/strmatch/apr_strmatch.c b/libs/apr-util/strmatch/apr_strmatch.c deleted file mode 100644 index 86f874f358..0000000000 --- a/libs/apr-util/strmatch/apr_strmatch.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apr_strmatch.h" -#include "apr_lib.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" - - -#define NUM_CHARS 256 - -/* - * String searching functions - */ -static const char *match_no_op(const apr_strmatch_pattern *this_pattern, - const char *s, apr_size_t slen) -{ - return s; -} - -static const char *match_boyer_moore_horspool( - const apr_strmatch_pattern *this_pattern, - const char *s, apr_size_t slen) -{ - const char *s_end = s + slen; - int *shift = (int *)(this_pattern->context); - const char *s_next = s + this_pattern->length - 1; - const char *p_start = this_pattern->pattern; - const char *p_end = p_start + this_pattern->length - 1; - while (s_next < s_end) { - const char *s_tmp = s_next; - const char *p_tmp = p_end; - while (*s_tmp == *p_tmp) { - p_tmp--; - if (p_tmp < p_start) { - return s_tmp; - } - s_tmp--; - } - s_next += shift[(int)*((const unsigned char *)s_next)]; - } - return NULL; -} - -static const char *match_boyer_moore_horspool_nocase( - const apr_strmatch_pattern *this_pattern, - const char *s, apr_size_t slen) -{ - const char *s_end = s + slen; - int *shift = (int *)(this_pattern->context); - const char *s_next = s + this_pattern->length - 1; - const char *p_start = this_pattern->pattern; - const char *p_end = p_start + this_pattern->length - 1; - while (s_next < s_end) { - const char *s_tmp = s_next; - const char *p_tmp = p_end; - while (apr_tolower(*s_tmp) == apr_tolower(*p_tmp)) { - p_tmp--; - if (p_tmp < p_start) { - return s_tmp; - } - s_tmp--; - } - s_next += shift[apr_tolower(*s_next)]; - } - return NULL; -} - -APU_DECLARE(const apr_strmatch_pattern *) apr_strmatch_precompile( - apr_pool_t *p, const char *s, - int case_sensitive) -{ - apr_strmatch_pattern *pattern; - apr_size_t i; - int *shift; - - pattern = apr_palloc(p, sizeof(*pattern)); - pattern->pattern = s; - pattern->length = strlen(s); - if (pattern->length == 0) { - pattern->compare = match_no_op; - pattern->context = NULL; - return pattern; - } - - shift = (int *)apr_palloc(p, sizeof(int) * NUM_CHARS); - for (i = 0; i < NUM_CHARS; i++) { - shift[i] = pattern->length; - } - if (case_sensitive) { - pattern->compare = match_boyer_moore_horspool; - for (i = 0; i < pattern->length - 1; i++) { - shift[(int)s[i]] = pattern->length - i - 1; - } - } - else { - pattern->compare = match_boyer_moore_horspool_nocase; - for (i = 0; i < pattern->length - 1; i++) { - shift[apr_tolower(s[i])] = pattern->length - i - 1; - } - } - pattern->context = shift; - - return pattern; -} diff --git a/libs/apr-util/test/Makefile.in b/libs/apr-util/test/Makefile.in deleted file mode 100644 index eb101720d8..0000000000 --- a/libs/apr-util/test/Makefile.in +++ /dev/null @@ -1,81 +0,0 @@ -VPATH = @srcdir@ - -INCLUDES = @APRUTIL_PRIV_INCLUDES@ @APR_INCLUDES@ @APRUTIL_INCLUDES@ - -PROGRAMS = testall testdbm testdate testxml testrmm \ - testreslist testqueue testxlate dbd -TARGETS = $(PROGRAMS) - -APRUTIL_DOTTED_VERSION=@APRUTIL_DOTTED_VERSION@ -APRUTIL_MAJOR_VERSION=@APRUTIL_MAJOR_VERSION@ -TARGET_LIB_PATH = ../lib@APRUTIL_LIBNAME@.la - -CLEAN_TARGETS = manyfile.bin testfile.txt data/sqlite*.db - -# bring in rules.mk for standard functionality -@INCLUDE_RULES@ -PROGRAM_DEPENDENCIES = @APRUTIL_LIBS@ -APRUTIL_LDFLAGS = -no-install @APRUTIL_LDFLAGS@ - -all: $(PROGRAMS) - -check: $(PROGRAMS) - for prog in $(PROGRAMS); do \ - ./$$prog ;\ - if test $$? = 255; then \ - echo "$$prog failed"; \ - break; \ - fi; \ - done - -testdbm_OBJECTS = testdbm.lo -testdbm_LDADD = $(TARGET_LIB_PATH) -testdbm: $(testdbm_OBJECTS) $(testdbm_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testdbm_OBJECTS) $(testdbm_LDADD) $(PROGRAM_DEPENDENCIES) - -dbd_OBJECTS = dbd.lo -dbd_LDADD = $(TARGET_LIB_PATH) -dbd: $(dbd_OBJECTS) $(dbd_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(dbd_OBJECTS) $(dbd_LDADD) $(PROGRAM_DEPENDENCIES) - -testdbd_OBJECTS = testdbd.lo -testdbd_LDADD = $(TARGET_LIB_PATH) -testdbd: $(testdbd_OBJECTS) $(testdbd_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testdbd_OBJECTS) $(testdbd_LDADD) $(PROGRAM_DEPENDENCIES) - -testdate_OBJECTS = testdate.lo -testdate_LDADD = $(TARGET_LIB_PATH) -testdate: $(testdate_OBJECTS) $(testdate_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testdate_OBJECTS) $(testdate_LDADD) $(PROGRAM_DEPENDENCIES) - -testxml_OBJECTS = testxml.lo -testxml_LDADD = $(TARGET_LIB_PATH) -testxml: $(testxml_OBJECTS) $(testxml_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testxml_OBJECTS) $(testxml_LDADD) $(PROGRAM_DEPENDENCIES) - -testrmm_OBJECTS = testrmm.lo -testrmm_LDADD = $(TARGET_LIB_PATH) -testrmm: $(testrmm_OBJECTS) $(testrmm_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testrmm_OBJECTS) $(testrmm_LDADD) $(PROGRAM_DEPENDENCIES) - -testreslist_OBJECTS = testreslist.lo -testreslist_LDADD = $(TARGET_LIB_PATH) -testreslist: $(testreslist_OBJECTS) $(testreslist_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testreslist_OBJECTS) $(testreslist_LDADD) $(PROGRAM_DEPENDENCIES) - -testqueue_OBJECTS = testqueue.lo -testqueue_LDADD = $(TARGET_LIB_PATH) -testqueue: $(testqueue_OBJECTS) $(testqueue_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testqueue_OBJECTS) $(testqueue_LDADD) $(PROGRAM_DEPENDENCIES) - -testxlate_OBJECTS = testxlate.lo -testxlate_LDADD = $(TARGET_LIB_PATH) -testxlate: $(testxlate_OBJECTS) $(testxlate_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testxlate_OBJECTS) $(testxlate_LDADD) $(PROGRAM_DEPENDENCIES) - -testall_OBJECTS = teststrmatch.lo testuri.lo testuuid.lo abts.lo testutil.lo \ - testbuckets.lo testpass.lo testmd4.lo testmd5.lo testldap.lo testdbd.lo -testall_LDADD = $(TARGET_LIB_PATH) -testall: $(testall_OBJECTS) $(testall_LDADD) - $(LINK) $(APRUTIL_LDFLAGS) $(testall_OBJECTS) $(testall_LDADD) $(PROGRAM_DEPENDENCIES) - diff --git a/libs/apr-util/test/Makefile.win b/libs/apr-util/test/Makefile.win deleted file mode 100644 index 374f0ebb83..0000000000 --- a/libs/apr-util/test/Makefile.win +++ /dev/null @@ -1,131 +0,0 @@ -# -*- Makefile -*- -!IF "$(OS)" == "Windows_NT" -NULL= -rmdir=rd /s /q -!ELSE -NULL=nul -rmdir=deltree /y -!ENDIF - -SILENT=@ - -# Default build and bind modes -BUILD_MODE = release -BIND_MODE = shared - -!IF "$(BUILD_MODE)" == "release" || "$(BUILD_MODE)" == "Release" -!IF "$(BIND_MODE)" == "shared" -# release shared -APR_LIB_PFX = $(APR_SOURCE)\Release\lib -APU_LIB_PFX = $(APU_SOURCE)\Release\lib -API_LIB_PFX = $(API_SOURCE)\Release\lib -CFG_CFLAGS = /MD /O2 -CFG_DEFINES = /D "NDEBUG" -CFG_OUTPUT = Release - -!ELSE -!IF "$(BIND_MODE)" == "static" -# release static -APR_LIB_PFX = $(APR_SOURCE)\LibR\ # no line continuation -APU_LIB_PFX = $(APU_SOURCE)\LibR\ # no line continuation -API_LIB_PFX = $(API_SOURCE)\LibR\ # no line continuation -CFG_CFLAGS = /MD /O2 -CFG_DEFINES = /D "NDEBUG" /D "APR_DECLARE_STATIC" \ - /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC" -CFG_API_LIB = $(API_LIB_PFX)apriconv-1.lib -CFG_OUTPUT = LibR - -!ELSE -!ERROR Unknown bind mode "$(BIND_MODE)" -!ENDIF -!ENDIF - -!ELSE -!IF "$(BUILD_MODE)" == "debug" || "$(BUILD_MODE)" == "Debug" -!IF "$(BIND_MODE)" == "shared" -# debug shared -APR_LIB_PFX = $(APR_SOURCE)\Debug\lib -APU_LIB_PFX = $(APU_SOURCE)\Debug\lib -API_LIB_PFX = $(API_SOURCE)\Debug\lib -CFG_CFLAGS = /MDd /Zi /Od -CFG_DEFINES = /D "_DEBUG" -CFG_LDFLAGS = /DEBUG -CFG_OUTPUT = Debug - -!ELSE -!IF "$(BIND_MODE)" == "static" -# debug static -APR_LIB_PFX = $(APR_SOURCE)\LibD\ # no line continuation -APU_LIB_PFX = $(APU_SOURCE)\LibD\ # no line continuation -API_LIB_PFX = $(API_SOURCE)\LibD\ # no line continuation -CFG_CFLAGS = /MDd /Zi /Od -CFG_DEFINES = /D "_DEBUG" /D "APR_DECLARE_STATIC" \ - /D "APU_DECLARE_STATIC" /D "API_DECLARE_STATIC" -CFG_LDFLAGS = /DEBUG -CFG_API_LIB = $(API_LIB_PFX)apriconv-1.lib -CFG_OUTPUT = LibD - -!ELSE -!ERROR Unknown bind mode "$(BIND_MODE)" -!ENDIF -!ENDIF - -!ELSE -!ERROR Unknown build mode "$(BUILD_MODE)" -!ENDIF -!ENDIF - - -APR_SOURCE = ..\..\apr -APU_SOURCE = .. -API_SOURCE = ..\..\apr-iconv -OUTPUT_DIR = .\$(CFG_OUTPUT) - -INT_CFLAGS = /nologo $(CFG_CFLAGS) /Fp"$(OUTPUT_DIR)\iconv.pch" /YX"iconv.h" -INT_INCLUDES = /I "$(APU_SOURCE)\include" /I "$(APR_SOURCE)\include" -# /I "$(API_SOURCE)\include" -INT_DEFINES = /D "WIN32" /D "_CONSOLE" /D "_MBCS" $(CFG_DEFINES) -INT_LDFLAGS = /nologo /incremental:no /subsystem:console $(CFG_LDFLAGS) - -CFLAGS = /W3 -ALL_CFLAGS = $(INT_CFLAGS) $(INT_INCLUDES) $(INT_DEFINES) $(CFLAGS) - -LDFLAGS = /WARN:0 -ALL_LDFLAGS = $(INT_LDFLAGS) $(LDFLAGS) - -.c{$(OUTPUT_DIR)}.exe: - -$(SILENT)if not exist "$(OUTPUT_DIR)\$(NULL)" mkdir "$(OUTPUT_DIR)" - $(SILENT)echo Compiling and linking $@... - $(SILENT)cl $(ALL_CFLAGS) /Fo"$*.obj" /Fd"$*" $< \ - /link $(ALL_LDFLAGS) /out:$@ \ - "$(APU_LIB_PFX)aprutil-1.lib" \ - "$(APR_LIB_PFX)apr-1.lib" \ - "$(CFG_API)" \ - kernel32.lib advapi32.lib ws2_32.lib mswsock.lib - - -##!ALL_TARGETS = $(OUTPUT_DIR)\testdate.exe \ -##! $(OUTPUT_DIR)\testdbm.exe \ -##! $(OUTPUT_DIR)\testmd4.exe \ -##! $(OUTPUT_DIR)\testmd5.exe \ -##! $(OUTPUT_DIR)\testqueue.exe \ -##! $(OUTPUT_DIR)\testreslist.exe \ -##! $(OUTPUT_DIR)\testrmm.exe \ -##! $(OUTPUT_DIR)\teststrmatch.exe \ -##! $(OUTPUT_DIR)\testuri.exe \ -##! $(OUTPUT_DIR)\testuuid.exe \ -##! $(OUTPUT_DIR)\testxlate.exe \ -##! $(OUTPUT_DIR)\testxml.exe - -ALL_TARGETS = $(OUTPUT_DIR)\testxlate.exe \ - $(OUTPUT_DIR)\testdbm.exe \ - $(OUTPUT_DIR)\testqueue.exe \ - $(OUTPUT_DIR)\testrmm.exe \ - $(OUTPUT_DIR)\testmd4.exe \ - $(OUTPUT_DIR)\testmd5.exe \ - $(OUTPUT_DIR)\testxml.exe - -all: $(ALL_TARGETS) - -clean: - -$(SILENT)if exist "$(OUTPUT_DIR)/$(NULL)" $(rmdir) $(OUTPUT_DIR) diff --git a/libs/apr-util/test/NWGNUmakefile b/libs/apr-util/test/NWGNUmakefile deleted file mode 100644 index e0bb2d5b0b..0000000000 --- a/libs/apr-util/test/NWGNUmakefile +++ /dev/null @@ -1,258 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(APR_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(APR)/include \ - $(APR)/include/arch/NetWare \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) - -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = NLM is to test the apu layer - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = - -# -# This is used by the '-screenname' directive. If left blank, -# 'Apache for NetWare' Thread will be used. -# -NLM_SCREEN_NAME = - -# -# If this is specified, it will override VERSION value in -# $(APR_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If this is specified it will be used by the link '-flags' directive -# -NLM_FLAGS = - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can -# be disabled by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# Declare all target files (you must add your files here) -# - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/aputest.nlm \ - $(OBJDIR)/testdate.nlm \ - $(EOLIST) -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - aprlib \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override the default copyright. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(APR_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - copy $(OBJDIR)\*.nlm $(INSTALL)\Apache2 - -# -# Any specialized rules here -# - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(APR_WORK)\build\NWGNUtail.inc - diff --git a/libs/apr-util/test/abts.c b/libs/apr-util/test/abts.c deleted file mode 100644 index 03ae16d1b3..0000000000 --- a/libs/apr-util/test/abts.c +++ /dev/null @@ -1,416 +0,0 @@ -/* Copyright 2000-2004 Ryan Bloom - * - * 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. - * - * Portions of this file were taken from testall.c in the APR test suite, - * written by members of the Apache Software Foundation. - */ - -#include "abts.h" -#include "abts_tests.h" -#include "testutil.h" - -#define ABTS_STAT_SIZE 6 -static char status[ABTS_STAT_SIZE] = {'|', '/', '-', '|', '\\', '-'}; -static int curr_char; -static int verbose = 0; -static int exclude = 0; -static int quiet = 0; -static int list_tests = 0; - -const char **testlist = NULL; - -static int find_test_name(const char *testname) { - int i; - for (i = 0; testlist[i] != NULL; i++) { - if (!strcmp(testlist[i], testname)) { - return 1; - } - } - return 0; -} - -/* Determine if the test should be run at all */ -static int should_test_run(const char *testname) { - int found = 0; - if (list_tests == 1) { - return 0; - } - if (testlist == NULL) { - return 1; - } - found = find_test_name(testname); - if ((found && !exclude) || (!found && exclude)) { - return 1; - } - return 0; -} - -static void reset_status(void) -{ - curr_char = 0; -} - -static void update_status(void) -{ - if (!quiet) { - curr_char = (curr_char + 1) % ABTS_STAT_SIZE; - fprintf(stdout, "\b%c", status[curr_char]); - fflush(stdout); - } -} - -static void end_suite(abts_suite *suite) -{ - if (suite != NULL) { - sub_suite *last = suite->tail; - if (!quiet) { - fprintf(stdout, "\b"); - fflush(stdout); - } - if (last->failed == 0) { - fprintf(stdout, "SUCCESS\n"); - fflush(stdout); - } - else { - fprintf(stdout, "FAILED %d of %d\n", last->failed, last->num_test); - fflush(stdout); - } - } -} - -abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name_full) -{ - sub_suite *subsuite; - char *p; - const char *suite_name; - curr_char = 0; - - /* Only end the suite if we actually ran it */ - if (suite && suite->tail &&!suite->tail->not_run) { - end_suite(suite); - } - - subsuite = malloc(sizeof(*subsuite)); - subsuite->num_test = 0; - subsuite->failed = 0; - subsuite->next = NULL; - /* suite_name_full may be an absolute path depending on __FILE__ - * expansion */ - suite_name = strrchr(suite_name_full, '/'); - if (suite_name) { - suite_name++; - } else { - suite_name = suite_name_full; - } - p = strrchr(suite_name, '.'); - if (p) { - subsuite->name = memcpy(calloc(p - suite_name + 1, 1), - suite_name, p - suite_name); - } - else { - subsuite->name = suite_name; - } - - if (list_tests) { - fprintf(stdout, "%s\n", subsuite->name); - } - - subsuite->not_run = 0; - - if (suite == NULL) { - suite = malloc(sizeof(*suite)); - suite->head = subsuite; - suite->tail = subsuite; - } - else { - suite->tail->next = subsuite; - suite->tail = subsuite; - } - - if (!should_test_run(subsuite->name)) { - subsuite->not_run = 1; - return suite; - } - - reset_status(); - fprintf(stdout, "%-20s: ", subsuite->name); - update_status(); - fflush(stdout); - - return suite; -} - -void abts_run_test(abts_suite *ts, test_func f, void *value) -{ - abts_case *tc; - sub_suite *ss; - - if (!should_test_run(ts->tail->name)) { - return; - } - ss = ts->tail; - - tc = malloc(sizeof(*tc)); - tc->failed = 0; - tc->suite = ss; - - ss->num_test++; - update_status(); - - f(tc, value); - - if (tc->failed) { - ss->failed++; - } - free(tc); -} - -static int report(abts_suite *suite) -{ - int count = 0; - sub_suite *dptr; - - if (suite && suite->tail &&!suite->tail->not_run) { - end_suite(suite); - } - - for (dptr = suite->head; dptr; dptr = dptr->next) { - count += dptr->failed; - } - - if (list_tests) { - return 0; - } - - if (count == 0) { - printf("All tests passed.\n"); - return 0; - } - - dptr = suite->head; - fprintf(stdout, "%-15s\t\tTotal\tFail\tFailed %%\n", "Failed Tests"); - fprintf(stdout, "===================================================\n"); - while (dptr != NULL) { - if (dptr->failed != 0) { - float percent = ((float)dptr->failed / (float)dptr->num_test); - fprintf(stdout, "%-15s\t\t%5d\t%4d\t%6.2f%%\n", dptr->name, - dptr->num_test, dptr->failed, percent * 100); - } - dptr = dptr->next; - } - return 1; -} - -void abts_log_message(const char *fmt, ...) -{ - va_list args; - update_status(); - - if (verbose) { - va_start(args, fmt); - vfprintf(stderr, fmt, args); - va_end(args); - fprintf(stderr, "\n"); - fflush(stderr); - } -} - -void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected == actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected != actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%d>, but saw <%d>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - /* If both are NULL, match is good */ - if (!expected && !actual) return; - if (expected && actual) - if (!strcmp(expected, actual)) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%s>, but saw <%s>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_str_nequal(abts_case *tc, const char *expected, const char *actual, - size_t n, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (!strncmp(expected, actual, n)) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%s>, but saw <%s>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (ptr != NULL) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Expected NULL, but saw <%p>\n", lineno, ptr); - fflush(stderr); - } -} - -void abts_ptr_equal(abts_case *tc, const void *expected, const void *actual, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (expected == actual) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: expected <%p>, but saw <%p>\n", lineno, expected, actual); - fflush(stderr); - } -} - -void abts_fail(abts_case *tc, const char *message, int lineno) -{ - update_status(); - if (tc->failed) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -void abts_assert(abts_case *tc, const char *message, int condition, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (condition) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -void abts_true(abts_case *tc, int condition, int lineno) -{ - update_status(); - if (tc->failed) return; - - if (condition) return; - - tc->failed = TRUE; - if (verbose) { - fprintf(stderr, "Line %d: Condition is false, but expected true\n", lineno); - fflush(stderr); - } -} - -void abts_not_impl(abts_case *tc, const char *message, int lineno) -{ - update_status(); - - tc->suite->not_impl++; - if (verbose) { - fprintf(stderr, "Line %d: %s\n", lineno, message); - fflush(stderr); - } -} - -int main(int argc, const char *const argv[]) { - int i; - int rv; - int list_provided = 0; - abts_suite *suite = NULL; - - initialize(); - for (i = 1; i < argc; i++) { - if (!strcmp(argv[i], "-v")) { - verbose = 1; - continue; - } - if (!strcmp(argv[i], "-x")) { - exclude = 1; - continue; - } - if (!strcmp(argv[i], "-l")) { - list_tests = 1; - continue; - } - if (!strcmp(argv[i], "-q")) { - quiet = 1; - continue; - } - if (argv[i][0] == '-') { - fprintf(stderr, "Invalid option: `%s'\n", argv[i]); - exit(1); - } - list_provided = 1; - } - - if (list_provided) { - /* Waste a little space here, because it is easier than counting the - * number of tests listed. Besides it is at most three char *. - */ - testlist = calloc(argc + 1, sizeof(char *)); - for (i = 1; i < argc; i++) { - testlist[i - 1] = argv[i]; - } - } - - for (i = 0; i < (sizeof(alltests) / sizeof(struct testlist *)); i++) { - suite = alltests[i].func(suite); - } - - rv = report(suite); - return rv; -} - diff --git a/libs/apr-util/test/abts.h b/libs/apr-util/test/abts.h deleted file mode 100644 index 51123ff079..0000000000 --- a/libs/apr-util/test/abts.h +++ /dev/null @@ -1,98 +0,0 @@ -/* Copyright 2000-2004 Ryan Bloom - * - * 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. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include -#include - -#ifndef ABTS_H -#define ABTS_H - -#ifndef FALSE -#define FALSE 0 -#endif -#ifndef TRUE -#define TRUE 1 -#endif - -struct sub_suite { - const char *name; - int num_test; - int failed; - int not_run; - int not_impl; - struct sub_suite *next; -}; -typedef struct sub_suite sub_suite; - -struct abts_suite { - sub_suite *head; - sub_suite *tail; -}; -typedef struct abts_suite abts_suite; - -struct abts_case { - int failed; - sub_suite *suite; -}; -typedef struct abts_case abts_case; - -typedef void (*test_func)(abts_case *tc, void *data); - -#define ADD_SUITE(suite) abts_add_suite(suite, __FILE__); - -abts_suite *abts_add_suite(abts_suite *suite, const char *suite_name); -void abts_run_test(abts_suite *ts, test_func f, void *value); -void abts_log_message(const char *fmt, ...); - -void abts_int_equal(abts_case *tc, const int expected, const int actual, int lineno); -void abts_int_nequal(abts_case *tc, const int expected, const int actual, int lineno); -void abts_str_equal(abts_case *tc, const char *expected, const char *actual, int lineno); -void abts_str_nequal(abts_case *tc, const char *expected, const char *actual, - size_t n, int lineno); -void abts_ptr_notnull(abts_case *tc, const void *ptr, int lineno); -void abts_ptr_equal(abts_case *tc, const void *expected, const void *actual, int lineno); -void abts_true(abts_case *tc, int condition, int lineno); -void abts_fail(abts_case *tc, const char *message, int lineno); -void abts_not_impl(abts_case *tc, const char *message, int lineno); -void abts_assert(abts_case *tc, const char *message, int condition, int lineno); - -/* Convenience macros. Ryan hates these! */ -#define ABTS_INT_EQUAL(a, b, c) abts_int_equal(a, b, c, __LINE__) -#define ABTS_INT_NEQUAL(a, b, c) abts_int_nequal(a, b, c, __LINE__) -#define ABTS_STR_EQUAL(a, b, c) abts_str_equal(a, b, c, __LINE__) -#define ABTS_STR_NEQUAL(a, b, c, d) abts_str_nequal(a, b, c, d, __LINE__) -#define ABTS_PTR_NOTNULL(a, b) abts_ptr_notnull(a, b, __LINE__) -#define ABTS_PTR_EQUAL(a, b, c) abts_ptr_equal(a, b, c, __LINE__) -#define ABTS_TRUE(a, b) abts_true(a, b, __LINE__); -#define ABTS_FAIL(a, b) abts_fail(a, b, __LINE__); -#define ABTS_NOT_IMPL(a, b) abts_not_impl(a, b, __LINE__); -#define ABTS_ASSERT(a, b, c) abts_assert(a, b, c, __LINE__); - -abts_suite *run_tests(abts_suite *suite); -abts_suite *run_tests1(abts_suite *suite); - - -#endif - -#ifdef __cplusplus -} -#endif - diff --git a/libs/apr-util/test/abts_tests.h b/libs/apr-util/test/abts_tests.h deleted file mode 100644 index b137ce58dc..0000000000 --- a/libs/apr-util/test/abts_tests.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#ifndef APR_TEST_INCLUDES -#define APR_TEST_INCLUDES - -#include "abts.h" -#include "testutil.h" - -const struct testlist { - abts_suite *(*func)(abts_suite *suite); -} alltests[] = { - {teststrmatch}, - {testuri}, - {testuuid}, - {testbuckets}, - {testpass}, - {testmd4}, - {testmd5}, - {testldap}, - {testdbd} -}; - -#endif /* APR_TEST_INCLUDES */ diff --git a/libs/apr-util/test/data/.empty b/libs/apr-util/test/data/.empty deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/apr-util/test/dbd.c b/libs/apr-util/test/dbd.c deleted file mode 100644 index f8832539c1..0000000000 --- a/libs/apr-util/test/dbd.c +++ /dev/null @@ -1,407 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apu.h" -#include "apr_pools.h" -#include "apr_dbd.h" - -#include - -#define TEST(msg,func) \ - printf("======== %s ========\n", msg); \ - rv = func(pool, sql, driver); \ - if (rv != 0) { \ - printf("Error in %s: rc=%d\n\n", msg, rv); \ - } \ - else { \ - printf("%s test successful\n\n", msg); \ - } \ - fflush(stdout); - -static int create_table(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int rv = 0; - int nrows; - const char *statement = "CREATE TABLE apr_dbd_test (" - "col1 varchar(40) not null," - "col2 varchar(40)," - "col3 integer)" ; - rv = apr_dbd_query(driver, handle, &nrows, statement); - return rv; -} -static int drop_table(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int rv = 0; - int nrows; - const char *statement = "DROP TABLE apr_dbd_test" ; - rv = apr_dbd_query(driver, handle, &nrows, statement); - return rv; -} -static int insert_rows(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int i; - int rv = 0; - int nrows; - int nerrors = 0; - const char *statement = - "INSERT into apr_dbd_test (col1) values ('foo');" - "INSERT into apr_dbd_test values ('wibble', 'other', 5);" - "INSERT into apr_dbd_test values ('wibble', 'nothing', 5);" - "INSERT into apr_dbd_test values ('qwerty', 'foo', 0);" - "INSERT into apr_dbd_test values ('asdfgh', 'bar', 1);" - ; - rv = apr_dbd_query(driver, handle, &nrows, statement); - if (rv) { - const char* stmt[] = { - "INSERT into apr_dbd_test (col1) values ('foo');", - "INSERT into apr_dbd_test values ('wibble', 'other', 5);", - "INSERT into apr_dbd_test values ('wibble', 'nothing', 5);", - "INSERT into apr_dbd_test values ('qwerty', 'foo', 0);", - "INSERT into apr_dbd_test values ('asdfgh', 'bar', 1);", - NULL - }; - printf("Compound insert failed; trying statements one-by-one\n") ; - for (i=0; stmt[i] != NULL; ++i) { - statement = stmt[i]; - rv = apr_dbd_query(driver, handle, &nrows, statement); - if (rv) { - nerrors++; - } - } - if (nerrors) { - printf("%d single inserts failed too.\n", nerrors) ; - } - } - return rv; -} -static int invalid_op(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int rv = 0; - int nrows; - const char *statement = "INSERT into apr_dbd_test1 (col2) values ('foo')" ; - rv = apr_dbd_query(driver, handle, &nrows, statement); - printf("invalid op returned %d (should be nonzero). Error msg follows\n", rv); - printf("'%s'\n", apr_dbd_error(driver, handle, rv)); - statement = "INSERT into apr_dbd_test (col1, col2) values ('bar', 'foo')" ; - rv = apr_dbd_query(driver, handle, &nrows, statement); - printf("valid op returned %d (should be zero; error shouldn't affect subsequent ops)\n", rv); - return rv; -} -static int select_sequential(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int rv = 0; - int i = 0; - int n; - const char* entry; - const char* statement = "SELECT * FROM apr_dbd_test ORDER BY col1, col2"; - apr_dbd_results_t *res = NULL; - apr_dbd_row_t *row = NULL; - rv = apr_dbd_select(driver,pool,handle,&res,statement,0); - if (rv) { - printf("Select failed: %s", apr_dbd_error(driver, handle, rv)); - return rv; - } - for (rv = apr_dbd_get_row(driver, pool, res, &row, -1); - rv == 0; - rv = apr_dbd_get_row(driver, pool, res, &row, -1)) { - printf("ROW %d: ", i++) ; - for (n = 0; n < apr_dbd_num_cols(driver, res); ++n) { - entry = apr_dbd_get_entry(driver, row, n); - if (entry == NULL) { - printf("(null) ") ; - } - else { - printf("%s ", entry); - } - } - fputs("\n", stdout); - } - return (rv == -1) ? 0 : 1; -} -static int select_random(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int rv = 0; - int n; - const char* entry; - const char* statement = "SELECT * FROM apr_dbd_test ORDER BY col1, col2"; - apr_dbd_results_t *res = NULL; - apr_dbd_row_t *row = NULL; - rv = apr_dbd_select(driver,pool,handle,&res,statement,1); - if (rv) { - printf("Select failed: %s", apr_dbd_error(driver, handle, rv)); - return rv; - } - rv = apr_dbd_get_row(driver, pool, res, &row, 5) ; - if (rv) { - printf("get_row failed: %s", apr_dbd_error(driver, handle, rv)); - return rv; - } - printf("ROW 5: "); - for (n = 0; n < apr_dbd_num_cols(driver, res); ++n) { - entry = apr_dbd_get_entry(driver, row, n); - if (entry == NULL) { - printf("(null) ") ; - } - else { - printf("%s ", entry); - } - } - fputs("\n", stdout); - rv = apr_dbd_get_row(driver, pool, res, &row, 1) ; - if (rv) { - printf("get_row failed: %s", apr_dbd_error(driver, handle, rv)); - return rv; - } - printf("ROW 1: "); - for (n = 0; n < apr_dbd_num_cols(driver, res); ++n) { - entry = apr_dbd_get_entry(driver, row, n); - if (entry == NULL) { - printf("(null) ") ; - } - else { - printf("%s ", entry); - } - } - fputs("\n", stdout); - rv = apr_dbd_get_row(driver, pool, res, &row, 11) ; - if (rv != -1) { - printf("Oops! get_row out of range but thinks it succeeded!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return -1; - } - rv = 0; - - return rv; -} -static int test_transactions(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int rv = 0; - int nrows; - apr_dbd_transaction_t *trans = NULL; - const char* statement; - - /* trans 1 - error out early */ - printf("Transaction 1\n"); - rv = apr_dbd_transaction_start(driver, pool, handle, &trans); - if (rv) { - printf("Start transaction failed!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return rv; - } - statement = "UPDATE apr_dbd_test SET col2 = 'failed'"; - rv = apr_dbd_query(driver, handle, &nrows, statement); - if (rv) { - printf("Update failed: '%s'\n", apr_dbd_error(driver, handle, rv)); - apr_dbd_transaction_end(driver, pool, trans); - return rv; - } - printf("%d rows updated\n", nrows); - - statement = "INSERT INTO apr_dbd_test1 (col3) values (3)"; - rv = apr_dbd_query(driver, handle, &nrows, statement); - if (!rv) { - printf("Oops, invalid op succeeded but shouldn't!\n"); - } - statement = "INSERT INTO apr_dbd_test values ('zzz', 'aaa', 3)"; - rv = apr_dbd_query(driver, handle, &nrows, statement); - printf("Valid insert returned %d. Should be nonzero (fail) because transaction is bad\n", rv) ; - - rv = apr_dbd_transaction_end(driver, pool, trans); - if (rv) { - printf("End transaction failed!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return rv; - } - printf("Transaction ended (should be rollback) - viewing table\n" - "A column of \"failed\" indicates transaction failed (no rollback)\n"); - select_sequential(pool, handle, driver); - - /* trans 2 - complete successfully */ - printf("Transaction 2\n"); - rv = apr_dbd_transaction_start(driver, pool, handle, &trans); - if (rv) { - printf("Start transaction failed!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return rv; - } - statement = "UPDATE apr_dbd_test SET col2 = 'success'"; - rv = apr_dbd_query(driver, handle, &nrows, statement); - if (rv) { - printf("Update failed: '%s'\n", apr_dbd_error(driver, handle, rv)); - apr_dbd_transaction_end(driver, pool, trans); - return rv; - } - printf("%d rows updated\n", nrows); - statement = "INSERT INTO apr_dbd_test values ('aaa', 'zzz', 3)"; - rv = apr_dbd_query(driver, handle, &nrows, statement); - printf("Valid insert returned %d. Should be zero (OK)\n", rv) ; - rv = apr_dbd_transaction_end(driver, pool, trans); - if (rv) { - printf("End transaction failed!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return rv; - } - printf("Transaction ended (should be commit) - viewing table\n"); - select_sequential(pool, handle, driver); - return rv; -} -static int test_pselect(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int rv = 0; - int i, n; - const char *query = - "SELECT * FROM apr_dbd_test WHERE col3 <= %s or col1 = 'bar'" ; - const char *label = "lowvalues"; - apr_dbd_prepared_t *statement = NULL; - apr_dbd_results_t *res = NULL; - apr_dbd_row_t *row = NULL; - const char *entry = NULL; - - rv = apr_dbd_prepare(driver, pool, handle, query, label, &statement); - if (rv) { - printf("Prepare statement failed!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return rv; - } - rv = apr_dbd_pvselect(driver, pool, handle, &res, statement, 0, "3", NULL); - if (rv) { - printf("Exec of prepared statement failed!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return rv; - } - i = 0; - printf("Selecting rows where col3 <= 3 and bar row where it's unset.\nShould show four rows.\n"); - for (rv = apr_dbd_get_row(driver, pool, res, &row, -1); - rv == 0; - rv = apr_dbd_get_row(driver, pool, res, &row, -1)) { - printf("ROW %d: ", i++) ; - for (n = 0; n < apr_dbd_num_cols(driver, res); ++n) { - entry = apr_dbd_get_entry(driver, row, n); - if (entry == NULL) { - printf("(null) ") ; - } - else { - printf("%s ", entry); - } - } - fputs("\n", stdout); - } - return (rv == -1) ? 0 : 1; -} -static int test_pquery(apr_pool_t* pool, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - int rv = 0; - const char *query = "INSERT INTO apr_dbd_test VALUES (%s, %s, %d)"; - apr_dbd_prepared_t *statement = NULL; - const char *label = "testpquery"; - int nrows; - apr_dbd_transaction_t *trans =0; - - rv = apr_dbd_prepare(driver, pool, handle, query, label, &statement); - /* rv = apr_dbd_prepare(driver, pool, handle, query, NULL, &statement); */ - if (rv) { - printf("Prepare statement failed!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return rv; - } - apr_dbd_transaction_start(driver, pool, handle, &trans); - rv = apr_dbd_pvquery(driver, pool, handle, &nrows, statement, - "prepared", "insert", "2", NULL); - apr_dbd_transaction_end(driver, pool, trans); - if (rv) { - printf("Exec of prepared statement failed!\n%s\n", - apr_dbd_error(driver, handle, rv)); - return rv; - } - printf("Showing table (should now contain row \"prepared insert 2\")\n"); - select_sequential(pool, handle, driver); - return rv; -} -int main(int argc, char** argv) -{ - const char *name; - const char *params; - apr_pool_t *pool = NULL; - apr_dbd_t *sql = NULL; - const apr_dbd_driver_t *driver = NULL; - int rv; - - apr_initialize(); - apr_pool_create(&pool, NULL); - - if (argc >= 2 && argc <= 3) { - name = argv[1]; - params = ( argc == 3 ) ? argv[2] : ""; - apr_dbd_init(pool); - setbuf(stdout,NULL); - rv = apr_dbd_get_driver(pool, name, &driver); - switch (rv) { - case APR_SUCCESS: - printf("Loaded %s driver OK.\n", name); - break; - case APR_EDSOOPEN: - printf("Failed to load driver file apr_dbd_%s.so\n", name); - goto finish; - case APR_ESYMNOTFOUND: - printf("Failed to load driver apr_dbd_%s_driver.\n", name); - goto finish; - case APR_ENOTIMPL: - printf("No driver available for %s.\n", name); - goto finish; - default: /* it's a bug if none of the above happen */ - printf("Internal error loading %s.\n", name); - goto finish; - } - rv = apr_dbd_open(driver, pool, params, &sql); - switch (rv) { - case APR_SUCCESS: - printf("Opened %s[%s] OK\n", name, params); - break; - case APR_EGENERAL: - printf("Failed to open %s[%s]\n", name, params); - goto finish; - default: /* it's a bug if none of the above happen */ - printf("Internal error opening %s[%s]\n", name, params); - goto finish; - } - TEST("create table", create_table); - TEST("insert rows", insert_rows); - TEST("invalid op", invalid_op); - TEST("select random", select_random); - TEST("select sequential", select_sequential); - TEST("transactions", test_transactions); - TEST("prepared select", test_pselect); - TEST("prepared query", test_pquery); - TEST("drop table", drop_table); - apr_dbd_close(driver, sql); - } - else { - fprintf(stderr, "Usage: %s driver-name [params]\n", argv[0]); - } -finish: - apr_pool_destroy(pool); - apr_terminate(); - return 0; -} diff --git a/libs/apr-util/test/nw_misc.c b/libs/apr-util/test/nw_misc.c deleted file mode 100644 index cf68692bde..0000000000 --- a/libs/apr-util/test/nw_misc.c +++ /dev/null @@ -1,16 +0,0 @@ -#include -#include -#include "testutil.h" - -void _NonAppStop( void ) -{ - pressanykey(); -} - -/* -static void test_not_impl(CuTest *tc) -{ - CuNotImpl(tc, "Test not implemented on this platform yet"); -} -*/ - diff --git a/libs/apr-util/test/nwgnuaputest b/libs/apr-util/test/nwgnuaputest deleted file mode 100644 index 1611a58273..0000000000 --- a/libs/apr-util/test/nwgnuaputest +++ /dev/null @@ -1,272 +0,0 @@ -# -# Make sure all needed macro's are defined -# - -# -# Get the 'head' of the build environment if necessary. This includes default -# targets and paths to tools -# - -ifndef EnvironmentDefined -include $(APR_WORK)\build\NWGNUhead.inc -endif - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(APR)/include \ - $(APR)/include/arch/NetWare \ - $(APRUTIL)/include \ - $(LDAPSDK)/inc \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME =aputest -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = NLM is to test the apu layer - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = aputest - -# -# This is used by the '-screenname' directive. If left blank, -# 'Apache for NetWare' Thread will be used. -# -NLM_SCREEN_NAME = aputest - -# -# If this is specified, it will override VERSION value in -# $(APR_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = 1,0,0 - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 524288 - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = _LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = _LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If this is specified it will be used by the link '-flags' directive -# -NLM_FLAGS = AUTOUNLOAD, PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can -# be disabled by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# Declare all target files (you must add your files here) -# - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(OBJDIR)/aputest.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# - -FILES_nlm_objs = \ - $(OBJDIR)/abts.o \ - $(OBJDIR)/teststrmatch.o \ - $(OBJDIR)/testuri.o \ - $(OBJDIR)/testuuid.o \ - $(OBJDIR)/testbuckets.o \ - $(OBJDIR)/testpass.o \ - $(OBJDIR)/testmd4.o \ - $(OBJDIR)/testmd5.o \ - $(OBJDIR)/testldap.o \ - $(OBJDIR)/testutil.o \ - $(OBJDIR)/nw_misc.o \ - $(EOLIST) - -# Pending tests - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - Libc \ - APRLIB \ - lldapsdk \ - lldapssl \ - lldapx \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override the default copyright. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @libc.imp \ - @$(APR)/aprlib.imp \ - @$(LDAPSDK)/imports/lldapsdk.imp \ - @$(LDAPSDK)/imports/lldapssl.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(APR_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(APR_WORK)\build\NWGNUtail.inc - diff --git a/libs/apr-util/test/test_apu.h b/libs/apr-util/test/test_apu.h deleted file mode 100644 index 8d5f6ddee2..0000000000 --- a/libs/apr-util/test/test_apu.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* Some simple functions to make the test apps easier to write and - * a bit more consistent... - * this is a >copy< of apr_test.h - */ - -/* Things to bear in mind when using these... - * - * If you include '\t' within the string passed in it won't be included - * in the spacing, so use spaces instead :) - * - */ - -#ifndef APU_TEST_INCLUDES -#define APU_TEST_INCLUDES - -#include "apr_strings.h" -#include "apr_time.h" - -#define TEST_EQ(str, func, value, good, bad) \ - printf("%-60s", str); \ - { \ - apr_status_t rv; \ - if ((rv = func) == value){ \ - char errmsg[200]; \ - printf("%s\n", bad); \ - fprintf(stderr, "Error was %d : %s\n", rv, \ - apr_strerror(rv, (char*)&errmsg, 200)); \ - exit(-1); \ - } \ - printf("%s\n", good); \ - } - -#define TEST_NEQ(str, func, value, good, bad) \ - printf("%-60s", str); \ - { \ - apr_status_t rv; \ - if ((rv = func) != value){ \ - char errmsg[200]; \ - printf("%s\n", bad); \ - fprintf(stderr, "Error was %d : %s\n", rv, \ - apr_strerror(rv, (char*)&errmsg, 200)); \ - exit(-1); \ - } \ - printf("%s\n", good); \ - } - -#define TEST_STATUS(str, func, testmacro, good, bad) \ - printf("%-60s", str); \ - { \ - apr_status_t rv = func; \ - if (!testmacro(rv)) { \ - char errmsg[200]; \ - printf("%s\n", bad); \ - fprintf(stderr, "Error was %d : %s\n", rv, \ - apr_strerror(rv, (char*)&errmsg, 200)); \ - exit(-1); \ - } \ - printf("%s\n", good); \ - } - -#define STD_TEST_NEQ(str, func) \ - TEST_NEQ(str, func, APR_SUCCESS, "OK", "Failed"); - -#define PRINT_ERROR(rv) \ - { \ - char errmsg[200]; \ - fprintf(stderr, "Error was %d : %s\n", rv, \ - apr_strerror(rv, (char*)&errmsg, 200)); \ - exit(-1); \ - } - -#define MSG_AND_EXIT(msg) \ - printf("%s\n", msg); \ - exit (-1); - -#define TIME_FUNCTION(time, function) \ - { \ - apr_time_t tt = apr_time_now(); \ - function; \ - time = apr_time_now() - tt; \ - } - - -#endif /* APU_TEST_INCLUDES */ diff --git a/libs/apr-util/test/testbuckets.c b/libs/apr-util/test/testbuckets.c deleted file mode 100644 index 52b4840039..0000000000 --- a/libs/apr-util/test/testbuckets.c +++ /dev/null @@ -1,490 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "abts.h" -#include "testutil.h" -#include "apr_buckets.h" -#include "apr_strings.h" - -static void test_create(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba; - apr_bucket_brigade *bb; - - ba = apr_bucket_alloc_create(p); - bb = apr_brigade_create(p, ba); - - ABTS_ASSERT(tc, "new brigade not NULL", bb != NULL); - ABTS_ASSERT(tc, "new brigade is empty", APR_BRIGADE_EMPTY(bb)); - - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -static void test_simple(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba; - apr_bucket_brigade *bb; - apr_bucket *fb, *tb; - - ba = apr_bucket_alloc_create(p); - bb = apr_brigade_create(p, ba); - - fb = APR_BRIGADE_FIRST(bb); - ABTS_ASSERT(tc, "first bucket of empty brigade is sentinel", - fb == APR_BRIGADE_SENTINEL(bb)); - - fb = apr_bucket_flush_create(ba); - APR_BRIGADE_INSERT_HEAD(bb, fb); - - ABTS_ASSERT(tc, "first bucket of brigade is flush", - APR_BRIGADE_FIRST(bb) == fb); - - ABTS_ASSERT(tc, "bucket after flush is sentinel", - APR_BUCKET_NEXT(fb) == APR_BRIGADE_SENTINEL(bb)); - - tb = apr_bucket_transient_create("aaa", 3, ba); - APR_BUCKET_INSERT_BEFORE(fb, tb); - - ABTS_ASSERT(tc, "bucket before flush now transient", - APR_BUCKET_PREV(fb) == tb); - ABTS_ASSERT(tc, "bucket after transient is flush", - APR_BUCKET_NEXT(tb) == fb); - ABTS_ASSERT(tc, "bucket before transient is sentinel", - APR_BUCKET_PREV(tb) == APR_BRIGADE_SENTINEL(bb)); - - apr_brigade_cleanup(bb); - - ABTS_ASSERT(tc, "cleaned up brigade was empty", APR_BRIGADE_EMPTY(bb)); - - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -static apr_bucket_brigade *make_simple_brigade(apr_bucket_alloc_t *ba, - const char *first, - const char *second) -{ - apr_bucket_brigade *bb = apr_brigade_create(p, ba); - apr_bucket *e; - - e = apr_bucket_transient_create(first, strlen(first), ba); - APR_BRIGADE_INSERT_TAIL(bb, e); - - e = apr_bucket_transient_create(second, strlen(second), ba); - APR_BRIGADE_INSERT_TAIL(bb, e); - - return bb; -} - -/* tests that 'bb' flattens to string 'expect'. */ -static void flatten_match(abts_case *tc, const char *ctx, - apr_bucket_brigade *bb, - const char *expect) -{ - apr_size_t elen = strlen(expect); - char *buf = malloc(elen); - apr_size_t len = elen; - char msg[200]; - - sprintf(msg, "%s: flatten brigade", ctx); - apr_assert_success(tc, msg, apr_brigade_flatten(bb, buf, &len)); - sprintf(msg, "%s: length match (%ld not %ld)", ctx, - (long)len, (long)elen); - ABTS_ASSERT(tc, msg, len == elen); - sprintf(msg, "%s: result match", msg); - ABTS_STR_NEQUAL(tc, expect, buf, len); - free(buf); -} - -static void test_flatten(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bb; - - bb = make_simple_brigade(ba, "hello, ", "world"); - - flatten_match(tc, "flatten brigade", bb, "hello, world"); - - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -static int count_buckets(apr_bucket_brigade *bb) -{ - apr_bucket *e; - int count = 0; - - for (e = APR_BRIGADE_FIRST(bb); - e != APR_BRIGADE_SENTINEL(bb); - e = APR_BUCKET_NEXT(e)) { - count++; - } - - return count; -} - -static void test_split(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bb, *bb2; - apr_bucket *e; - - bb = make_simple_brigade(ba, "hello, ", "world"); - - /* split at the "world" bucket */ - e = APR_BRIGADE_LAST(bb); - bb2 = apr_brigade_split(bb, e); - - ABTS_ASSERT(tc, "split brigade contains one bucket", - count_buckets(bb2) == 1); - ABTS_ASSERT(tc, "original brigade contains one bucket", - count_buckets(bb) == 1); - - flatten_match(tc, "match original brigade", bb, "hello, "); - flatten_match(tc, "match split brigade", bb2, "world"); - - apr_brigade_destroy(bb2); - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -#define COUNT 3000 -#define THESTR "hello" - -static void test_bwrite(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bb = apr_brigade_create(p, ba); - apr_off_t length; - int n; - - for (n = 0; n < COUNT; n++) { - apr_assert_success(tc, "brigade_write", - apr_brigade_write(bb, NULL, NULL, - THESTR, sizeof THESTR)); - } - - apr_assert_success(tc, "determine brigade length", - apr_brigade_length(bb, 1, &length)); - - ABTS_ASSERT(tc, "brigade has correct length", - length == (COUNT * sizeof THESTR)); - - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -static void test_splitline(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bin, *bout; - - bin = make_simple_brigade(ba, "blah blah blah-", - "end of line.\nfoo foo foo"); - bout = apr_brigade_create(p, ba); - - apr_assert_success(tc, "split line", - apr_brigade_split_line(bout, bin, - APR_BLOCK_READ, 100)); - - flatten_match(tc, "split line", bout, "blah blah blah-end of line.\n"); - flatten_match(tc, "remainder", bin, "foo foo foo"); - - apr_brigade_destroy(bout); - apr_brigade_destroy(bin); - apr_bucket_alloc_destroy(ba); -} - -/* Test that bucket E has content EDATA of length ELEN. */ -static void test_bucket_content(abts_case *tc, - apr_bucket *e, - const char *edata, - apr_size_t elen) -{ - const char *adata; - apr_size_t alen; - - apr_assert_success(tc, "read from bucket", - apr_bucket_read(e, &adata, &alen, - APR_BLOCK_READ)); - - ABTS_ASSERT(tc, "read expected length", alen == elen); - ABTS_STR_NEQUAL(tc, edata, adata, elen); -} - -static void test_splits(abts_case *tc, void *ctx) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bb; - apr_bucket *e; - char *str = "alphabeta"; - int n; - - bb = apr_brigade_create(p, ba); - - APR_BRIGADE_INSERT_TAIL(bb, - apr_bucket_immortal_create(str, 9, ba)); - APR_BRIGADE_INSERT_TAIL(bb, - apr_bucket_transient_create(str, 9, ba)); - APR_BRIGADE_INSERT_TAIL(bb, - apr_bucket_heap_create(strdup(str), 9, free, ba)); - APR_BRIGADE_INSERT_TAIL(bb, - apr_bucket_pool_create(apr_pstrdup(p, str), 9, p, - ba)); - - ABTS_ASSERT(tc, "four buckets inserted", count_buckets(bb) == 4); - - /* now split each of the buckets after byte 5 */ - for (n = 0, e = APR_BRIGADE_FIRST(bb); n < 4; n++) { - ABTS_ASSERT(tc, "reached end of brigade", - e != APR_BRIGADE_SENTINEL(bb)); - ABTS_ASSERT(tc, "split bucket OK", - apr_bucket_split(e, 5) == APR_SUCCESS); - e = APR_BUCKET_NEXT(e); - ABTS_ASSERT(tc, "split OK", e != APR_BRIGADE_SENTINEL(bb)); - e = APR_BUCKET_NEXT(e); - } - - ABTS_ASSERT(tc, "four buckets split into eight", - count_buckets(bb) == 8); - - for (n = 0, e = APR_BRIGADE_FIRST(bb); n < 4; n++) { - const char *data; - apr_size_t len; - - apr_assert_success(tc, "read alpha from bucket", - apr_bucket_read(e, &data, &len, APR_BLOCK_READ)); - ABTS_ASSERT(tc, "read 5 bytes", len == 5); - ABTS_STR_NEQUAL(tc, "alpha", data, 5); - - e = APR_BUCKET_NEXT(e); - - apr_assert_success(tc, "read beta from bucket", - apr_bucket_read(e, &data, &len, APR_BLOCK_READ)); - ABTS_ASSERT(tc, "read 4 bytes", len == 4); - ABTS_STR_NEQUAL(tc, "beta", data, 5); - - e = APR_BUCKET_NEXT(e); - } - - /* now delete the "alpha" buckets */ - for (n = 0, e = APR_BRIGADE_FIRST(bb); n < 4; n++) { - apr_bucket *f; - - ABTS_ASSERT(tc, "reached end of brigade", - e != APR_BRIGADE_SENTINEL(bb)); - f = APR_BUCKET_NEXT(e); - apr_bucket_delete(e); - e = APR_BUCKET_NEXT(f); - } - - ABTS_ASSERT(tc, "eight buckets reduced to four", - count_buckets(bb) == 4); - - flatten_match(tc, "flatten beta brigade", bb, - "beta" "beta" "beta" "beta"); - - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -#define TIF_FNAME "testfile.txt" - -static void test_insertfile(abts_case *tc, void *ctx) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bb; - const apr_off_t bignum = (APR_INT64_C(2) << 32) + 424242; - apr_off_t count; - apr_file_t *f; - apr_bucket *e; - - ABTS_ASSERT(tc, "open test file", - apr_file_open(&f, TIF_FNAME, - APR_WRITE|APR_TRUNCATE|APR_CREATE, - APR_OS_DEFAULT, p) == APR_SUCCESS); - - if (apr_file_trunc(f, bignum)) { - apr_file_close(f); - apr_file_remove(TIF_FNAME, p); - ABTS_NOT_IMPL(tc, "Skipped: could not create large file"); - return; - } - - bb = apr_brigade_create(p, ba); - - e = apr_brigade_insert_file(bb, f, 0, bignum, p); - - ABTS_ASSERT(tc, "inserted file was not at end of brigade", - e == APR_BRIGADE_LAST(bb)); - - /* check that the total size of inserted buckets is equal to the - * total size of the file. */ - count = 0; - - for (e = APR_BRIGADE_FIRST(bb); - e != APR_BRIGADE_SENTINEL(bb); - e = APR_BUCKET_NEXT(e)) { - ABTS_ASSERT(tc, "bucket size sane", e->length != (apr_size_t)-1); - count += e->length; - } - - ABTS_ASSERT(tc, "total size of buckets incorrect", count == bignum); - - apr_brigade_destroy(bb); - - /* Truncate the file to zero size before close() so that we don't - * actually write out the large file if we are on a non-sparse file - * system - like Mac OS X's HFS. Otherwise, pity the poor user who - * has to wait for the 8GB file to be written to disk. - */ - apr_file_trunc(f, 0); - - apr_file_close(f); - apr_bucket_alloc_destroy(ba); - apr_file_remove(TIF_FNAME, p); -} - -/* Make a test file named FNAME, and write CONTENTS to it. */ -static apr_file_t *make_test_file(abts_case *tc, const char *fname, - const char *contents) -{ - apr_file_t *f; - - ABTS_ASSERT(tc, "create test file", - apr_file_open(&f, fname, - APR_READ|APR_WRITE|APR_TRUNCATE|APR_CREATE, - APR_OS_DEFAULT, p) == APR_SUCCESS); - - ABTS_ASSERT(tc, "write test file contents", - apr_file_puts(contents, f) == APR_SUCCESS); - - return f; -} - -static void test_manyfile(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bb = apr_brigade_create(p, ba); - apr_file_t *f; - - f = make_test_file(tc, "manyfile.bin", - "world" "hello" "brave" " ,\n"); - - apr_brigade_insert_file(bb, f, 5, 5, p); - apr_brigade_insert_file(bb, f, 16, 1, p); - apr_brigade_insert_file(bb, f, 15, 1, p); - apr_brigade_insert_file(bb, f, 10, 5, p); - apr_brigade_insert_file(bb, f, 15, 1, p); - apr_brigade_insert_file(bb, f, 0, 5, p); - apr_brigade_insert_file(bb, f, 17, 1, p); - - /* can you tell what it is yet? */ - flatten_match(tc, "file seek test", bb, - "hello, brave world\n"); - - apr_file_close(f); - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -/* Regression test for PR 34708, where a file bucket will keep - * duplicating itself on being read() when EOF is reached - * prematurely. */ -static void test_truncfile(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bb = apr_brigade_create(p, ba); - apr_file_t *f = make_test_file(tc, "testfile.txt", "hello"); - apr_bucket *e; - const char *buf; - apr_size_t len; - - apr_brigade_insert_file(bb, f, 0, 5, p); - - apr_file_trunc(f, 0); - - e = APR_BRIGADE_FIRST(bb); - - ABTS_ASSERT(tc, "single bucket in brigade", - APR_BUCKET_NEXT(e) == APR_BRIGADE_SENTINEL(bb)); - - apr_bucket_file_enable_mmap(e, 0); - - ABTS_ASSERT(tc, "read gave APR_EOF", - apr_bucket_read(e, &buf, &len, APR_BLOCK_READ) == APR_EOF); - - ABTS_ASSERT(tc, "read length 0", len == 0); - - ABTS_ASSERT(tc, "still a single bucket in brigade", - APR_BUCKET_NEXT(e) == APR_BRIGADE_SENTINEL(bb)); - - apr_file_close(f); - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -static const char hello[] = "hello, world"; - -static void test_partition(abts_case *tc, void *data) -{ - apr_bucket_alloc_t *ba = apr_bucket_alloc_create(p); - apr_bucket_brigade *bb = apr_brigade_create(p, ba); - apr_bucket *e; - - e = apr_bucket_immortal_create(hello, strlen(hello), ba); - APR_BRIGADE_INSERT_HEAD(bb, e); - - apr_assert_success(tc, "partition brigade", - apr_brigade_partition(bb, 5, &e)); - - test_bucket_content(tc, APR_BRIGADE_FIRST(bb), - "hello", 5); - - test_bucket_content(tc, APR_BRIGADE_LAST(bb), - ", world", 7); - - ABTS_ASSERT(tc, "partition returns APR_INCOMPLETE", - apr_brigade_partition(bb, 8192, &e)); - - ABTS_ASSERT(tc, "APR_INCOMPLETE partition returned sentinel", - e == APR_BRIGADE_SENTINEL(bb)); - - apr_brigade_destroy(bb); - apr_bucket_alloc_destroy(ba); -} - -abts_suite *testbuckets(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, test_create, NULL); - abts_run_test(suite, test_simple, NULL); - abts_run_test(suite, test_flatten, NULL); - abts_run_test(suite, test_split, NULL); - abts_run_test(suite, test_bwrite, NULL); - abts_run_test(suite, test_splitline, NULL); - abts_run_test(suite, test_splits, NULL); - abts_run_test(suite, test_insertfile, NULL); - abts_run_test(suite, test_manyfile, NULL); - abts_run_test(suite, test_truncfile, NULL); - abts_run_test(suite, test_partition, NULL); - - return suite; -} - - diff --git a/libs/apr-util/test/testdate.c b/libs/apr-util/test/testdate.c deleted file mode 100644 index b13bc4d1f4..0000000000 --- a/libs/apr-util/test/testdate.c +++ /dev/null @@ -1,198 +0,0 @@ -/* This program tests the date_parse_http routine in ../main/util_date.c. - * - * It is only semiautomated in that I would run it, modify the code to - * use a different algorithm or seed, recompile and run again, etc. - * Obviously it should use an argument for that, but I never got around - * to changing the implementation. - * - * gcc -g -O2 -I../main -o test_date ../main/util_date.o test_date.c - * test_date | egrep '^No ' - * - * Roy Fielding, 1996 - */ - -#include -#include -#include -#include "apr_date.h" - -#ifndef srand48 -#define srand48 srandom -#endif - -#ifndef mrand48 -#define mrand48 random -#endif - -void gm_timestr_822(char *ts, apr_time_t sec); -void gm_timestr_850(char *ts, apr_time_t sec); -void gm_timestr_ccc(char *ts, apr_time_t sec); - -static const apr_time_t year2secs[] = { - 0LL, /* 1970 */ - 31536000LL, /* 1971 */ - 63072000LL, /* 1972 */ - 94694400LL, /* 1973 */ - 126230400LL, /* 1974 */ - 157766400LL, /* 1975 */ - 189302400LL, /* 1976 */ - 220924800LL, /* 1977 */ - 252460800LL, /* 1978 */ - 283996800LL, /* 1979 */ - 315532800LL, /* 1980 */ - 347155200LL, /* 1981 */ - 378691200LL, /* 1982 */ - 410227200LL, /* 1983 */ - 441763200LL, /* 1984 */ - 473385600LL, /* 1985 */ - 504921600LL, /* 1986 */ - 536457600LL, /* 1987 */ - 567993600LL, /* 1988 */ - 599616000LL, /* 1989 */ - 631152000LL, /* 1990 */ - 662688000LL, /* 1991 */ - 694224000LL, /* 1992 */ - 725846400LL, /* 1993 */ - 757382400LL, /* 1994 */ - 788918400LL, /* 1995 */ - 820454400LL, /* 1996 */ - 852076800LL, /* 1997 */ - 883612800LL, /* 1998 */ - 915148800LL, /* 1999 */ - 946684800LL, /* 2000 */ - 978307200LL, /* 2001 */ - 1009843200LL, /* 2002 */ - 1041379200LL, /* 2003 */ - 1072915200LL, /* 2004 */ - 1104537600LL, /* 2005 */ - 1136073600LL, /* 2006 */ - 1167609600LL, /* 2007 */ - 1199145600LL, /* 2008 */ - 1230768000LL, /* 2009 */ - 1262304000LL, /* 2010 */ - 1293840000LL, /* 2011 */ - 1325376000LL, /* 2012 */ - 1356998400LL, /* 2013 */ - 1388534400LL, /* 2014 */ - 1420070400LL, /* 2015 */ - 1451606400LL, /* 2016 */ - 1483228800LL, /* 2017 */ - 1514764800LL, /* 2018 */ - 1546300800LL, /* 2019 */ - 1577836800LL, /* 2020 */ - 1609459200LL, /* 2021 */ - 1640995200LL, /* 2022 */ - 1672531200LL, /* 2023 */ - 1704067200LL, /* 2024 */ - 1735689600LL, /* 2025 */ - 1767225600LL, /* 2026 */ - 1798761600LL, /* 2027 */ - 1830297600LL, /* 2028 */ - 1861920000LL, /* 2029 */ - 1893456000LL, /* 2030 */ - 1924992000LL, /* 2031 */ - 1956528000LL, /* 2032 */ - 1988150400LL, /* 2033 */ - 2019686400LL, /* 2034 */ - 2051222400LL, /* 2035 */ - 2082758400LL, /* 2036 */ - 2114380800LL, /* 2037 */ - 2145916800LL /* 2038 */ -}; - -const char month_snames[12][4] = { - "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" -}; - -void gm_timestr_822(char *ts, apr_time_t sec) -{ - static const char *const days[7]= - {"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; - struct tm *tms; - time_t ls = (time_t)sec; - - tms = gmtime(&ls); - - sprintf(ts, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", days[tms->tm_wday], - tms->tm_mday, month_snames[tms->tm_mon], tms->tm_year + 1900, - tms->tm_hour, tms->tm_min, tms->tm_sec); -} - -void gm_timestr_850(char *ts, apr_time_t sec) -{ - static const char *const days[7]= - {"Sunday","Monday", "Tuesday", "Wednesday", "Thursday", "Friday", - "Saturday"}; - struct tm *tms; - int year; - time_t ls = (time_t)sec; - - tms = gmtime(&ls); - - year = tms->tm_year; - if (year >= 100) year -= 100; - - sprintf(ts, "%s, %.2d-%s-%.2d %.2d:%.2d:%.2d GMT", days[tms->tm_wday], - tms->tm_mday, month_snames[tms->tm_mon], year, - tms->tm_hour, tms->tm_min, tms->tm_sec); -} - -void gm_timestr_ccc(char *ts, apr_time_t sec) -{ - static const char *const days[7]= - {"Sun","Mon", "Tue", "Wed", "Thu", "Fri", "Sat"}; - struct tm *tms; - time_t ls = (time_t)sec; - - tms = gmtime(&ls); - - sprintf(ts, "%s %s %2d %.2d:%.2d:%.2d %d", days[tms->tm_wday], - month_snames[tms->tm_mon], tms->tm_mday, - tms->tm_hour, tms->tm_min, tms->tm_sec, tms->tm_year + 1900); -} - -int main (void) -{ - int year, i; - apr_time_t guess; - apr_time_t offset = 0; - /* apr_time_t offset = 0; */ - /* apr_time_t offset = ((31 + 28) * 24 * 3600) - 1; */ - apr_time_t secstodate, newsecs; - char datestr[50]; - - for (year = 1970; year < 2038; ++year) { - secstodate = year2secs[year - 1970] + offset; - gm_timestr_822(datestr, secstodate); - secstodate *= APR_USEC_PER_SEC; - newsecs = apr_date_parse_http(datestr); - if (secstodate == newsecs) - printf("Yes %4d %19" APR_TIME_T_FMT " %s\n", year, secstodate, datestr); - else if (newsecs == APR_DATE_BAD) - printf("No %4d %19" APR_TIME_T_FMT " %19" APR_TIME_T_FMT " %s\n", - year, secstodate, newsecs, datestr); - else - printf("No* %4d %19" APR_TIME_T_FMT " %19" APR_TIME_T_FMT " %s\n", - year, secstodate, newsecs, datestr); - } - - srand48(978245L); - - for (i = 0; i < 10000; ++i) { - guess = (time_t)mrand48(); - if (guess < 0) guess *= -1; - secstodate = guess + offset; - gm_timestr_822(datestr, secstodate); - secstodate *= APR_USEC_PER_SEC; - newsecs = apr_date_parse_http(datestr); - if (secstodate == newsecs) - printf("Yes %" APR_TIME_T_FMT " %s\n", secstodate, datestr); - else if (newsecs == APR_DATE_BAD) - printf("No %" APR_TIME_T_FMT " %" APR_TIME_T_FMT " %s\n", - secstodate, newsecs, datestr); - else - printf("No* %" APR_TIME_T_FMT " %" APR_TIME_T_FMT " %s\n", - secstodate, newsecs, datestr); - } - exit(0); -} diff --git a/libs/apr-util/test/testdbd.c b/libs/apr-util/test/testdbd.c deleted file mode 100644 index 9f2dcbc8a5..0000000000 --- a/libs/apr-util/test/testdbd.c +++ /dev/null @@ -1,233 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "testutil.h" -#include "apr.h" -#include "apu.h" -#include "apr_pools.h" -#include "apr_dbd.h" -#include "apr_strings.h" - -static void test_dbd_init(abts_case *tc, void *data) -{ - apr_pool_t *pool = p; - apr_status_t rv; - - rv = apr_dbd_init(pool); - ABTS_ASSERT(tc, "failed to init apr_dbd", rv == APR_SUCCESS); -} - -#if APU_HAVE_SQLITE2 || APU_HAVE_SQLITE3 -static void test_statement(abts_case *tc, apr_dbd_t* handle, - const apr_dbd_driver_t* driver, const char* sql) -{ - int nrows; - apr_status_t rv; - - rv = apr_dbd_query(driver, handle, &nrows, sql); - - ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); -} - -static void create_table(abts_case *tc, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - const char *sql = "CREATE TABLE apr_dbd_test (" - "col1 varchar(40) not null," - "col2 varchar(40)," - "col3 integer)"; - - test_statement(tc, handle, driver, sql); -} - -static void drop_table(abts_case *tc, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - const char *sql = "DROP TABLE apr_dbd_test"; - test_statement(tc, handle, driver, sql); -} - -static void delete_rows(abts_case *tc, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - const char *sql = "DELETE FROM apr_dbd_test"; - test_statement(tc, handle, driver, sql); -} - - -static void insert_data(abts_case *tc, apr_dbd_t* handle, - const apr_dbd_driver_t* driver, int count) -{ - apr_pool_t* pool = p; - const char* sql = "INSERT INTO apr_dbd_test VALUES('%d', '%d', %d)"; - char* sqf = NULL; - int i; - int nrows; - apr_status_t rv; - - for (i=0; i 0) { - row = NULL; - rv = apr_dbd_get_row(driver, pool, res, &row, -1); - ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); - ABTS_PTR_NOTNULL(tc, row); - apr_pool_clear(tpool); - i--; - } - ABTS_ASSERT(tc, "Missing Rows!", i == 0); - - res = NULL; - i = count; - - rv = apr_dbd_select(driver, pool, handle, &res, sql, 1); - ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); - ABTS_PTR_NOTNULL(tc, res); - - rv = apr_dbd_num_tuples(driver, res); - ABTS_ASSERT(tc, "invalid row count", rv == count); - - while (i > 0) { - row = NULL; - rv = apr_dbd_get_row(driver, pool, res, &row, i); - ABTS_ASSERT(tc, sql, rv == APR_SUCCESS); - ABTS_PTR_NOTNULL(tc, row); - apr_pool_clear(tpool); - i--; - } - ABTS_ASSERT(tc, "Missing Rows!", i == 0); - rv = apr_dbd_get_row(driver, pool, res, &row, count+100); - ABTS_ASSERT(tc, "If we overseek, get_row should return -1", rv == -1); -} - -static void test_escape(abts_case *tc, apr_dbd_t *handle, - const apr_dbd_driver_t *driver) -{ - const char *escaped = apr_dbd_escape(driver, p, "foo'bar", handle); - - ABTS_STR_EQUAL(tc, "foo''bar", escaped); -} - -static void test_dbd_generic(abts_case *tc, apr_dbd_t* handle, - const apr_dbd_driver_t* driver) -{ - void* native; - apr_pool_t *pool = p; - apr_status_t rv; - - native = apr_dbd_native_handle(driver, handle); - ABTS_PTR_NOTNULL(tc, native); - - rv = apr_dbd_check_conn(driver, pool, handle); - - create_table(tc, handle, driver); - select_rows(tc, handle, driver, 0); - insert_data(tc, handle, driver, 5); - select_rows(tc, handle, driver, 5); - delete_rows(tc, handle, driver); - select_rows(tc, handle, driver, 0); - drop_table(tc, handle, driver); - - test_escape(tc, handle, driver); - - rv = apr_dbd_close(driver, handle); - ABTS_ASSERT(tc, "failed to close database", rv == APR_SUCCESS); -} -#endif - -#if APU_HAVE_SQLITE2 -static void test_dbd_sqlite2(abts_case *tc, void *data) -{ - apr_pool_t *pool = p; - apr_status_t rv; - const apr_dbd_driver_t* driver = NULL; - apr_dbd_t* handle = NULL; - - rv = apr_dbd_get_driver(pool, "sqlite2", &driver); - ABTS_ASSERT(tc, "failed to fetch driver", rv == APR_SUCCESS); - ABTS_PTR_NOTNULL(tc, driver); - - ABTS_STR_EQUAL(tc, apr_dbd_name(driver), "sqlite2"); - - rv = apr_dbd_open(driver, pool, "data/sqlite2.db:600", &handle); - ABTS_ASSERT(tc, "failed to open database", rv == APR_SUCCESS); - ABTS_PTR_NOTNULL(tc, handle); - - test_dbd_generic(tc, handle, driver); -} -#endif - -#if APU_HAVE_SQLITE3 -static void test_dbd_sqlite3(abts_case *tc, void *data) -{ - apr_pool_t *pool = p; - apr_status_t rv; - const apr_dbd_driver_t* driver = NULL; - apr_dbd_t* handle = NULL; - - rv = apr_dbd_get_driver(pool, "sqlite3", &driver); - ABTS_ASSERT(tc, "failed to fetch driver", rv == APR_SUCCESS); - ABTS_PTR_NOTNULL(tc, driver); - - ABTS_STR_EQUAL(tc, apr_dbd_name(driver), "sqlite3"); - - rv = apr_dbd_open(driver, pool, "data/sqlite3.db", &handle); - ABTS_ASSERT(tc, "failed to open database", rv == APR_SUCCESS); - ABTS_PTR_NOTNULL(tc, handle); - - test_dbd_generic(tc, handle, driver); -} -#endif - -abts_suite *testdbd(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - - abts_run_test(suite, test_dbd_init, NULL); - -#if APU_HAVE_SQLITE2 - abts_run_test(suite, test_dbd_sqlite2, NULL); -#endif - -#if APU_HAVE_SQLITE3 - abts_run_test(suite, test_dbd_sqlite3, NULL); -#endif - return suite; -} diff --git a/libs/apr-util/test/testdbm.c b/libs/apr-util/test/testdbm.c deleted file mode 100644 index da787125f0..0000000000 --- a/libs/apr-util/test/testdbm.c +++ /dev/null @@ -1,425 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ -/* This file came from the SDBM package (written by oz@nexus.yorku.ca). - * That package was under public domain. This file has been ported to - * APR, updated to ANSI C and other, newer idioms, and added to the Apache - * codebase under the above copyright and license. - */ - -/* - * testdbm: Simple APR dbm tester. - * Automatic test case: ./testdbm auto foo - * - Attempts to store and fetch values from the DBM. - * - * Run the program for more help. - */ - -#include "apr.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_getopt.h" -#include "apr_time.h" -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#if APR_HAVE_STDIO_H -#include -#endif -#if APR_HAVE_UNISTD_H -#include -#endif -#include /* for atexit(), malloc() */ -#include - -#include "apr_dbm.h" - -static const char *progname; -static int rflag; - -#define DERROR 0 -#define DLOOK 1 - -#define DDELETE 3 -#define DCAT 4 -#define DBUILD 5 -#define DPRESS 6 -#define DCREAT 7 -#define DNAME 8 -#define DTRUNC 9 -#define DAUTO 10 - -#define LINEMAX 8192 - -typedef struct { - const char *sname; - int scode; - int flags; -} cmd; - -static const cmd cmds[] = { - - { "fetch", DLOOK, APR_DBM_READONLY }, - { "get", DLOOK, APR_DBM_READONLY }, - { "look", DLOOK, APR_DBM_READONLY }, - { "add", DBUILD, APR_DBM_READWRITE }, - { "insert", DBUILD, APR_DBM_READWRITE }, - { "store", DBUILD, APR_DBM_READWRITE }, - { "delete", DDELETE, APR_DBM_READWRITE }, - { "remove", DDELETE, APR_DBM_READWRITE }, - { "dump", DCAT, APR_DBM_READONLY }, - { "list", DCAT, APR_DBM_READONLY }, - { "cat", DCAT, APR_DBM_READONLY }, - { "build", DBUILD, APR_DBM_RWCREATE }, /** this one creates the DB */ - { "creat", DCREAT, APR_DBM_RWCREATE }, - { "trunc", DTRUNC, APR_DBM_RWTRUNC }, - { "new", DCREAT, APR_DBM_RWCREATE }, - { "names", DNAME, APR_DBM_READONLY }, -#if 0 - {"squash", DPRESS, APR_DBM_READWRITE, }, - {"compact", DPRESS, APR_DBM_READWRITE, }, - {"compress", DPRESS, APR_DBM_READWRITE, }, -#endif - { "auto", DAUTO, APR_DBM_RWCREATE }, -}; - -#define CMD_SIZE (sizeof(cmds)/sizeof(cmd)) - -static void doit(const cmd *act, const char*type, const char *file, apr_pool_t *pool); -static const cmd *parse_command(const char *str); -static void prdatum(FILE *stream, apr_datum_t d); -static void oops(apr_dbm_t *dbm, apr_status_t rv, const char *s1, - const char *s2); -static void show_usage(void); - -int main(int argc, const char * const * argv) -{ - apr_pool_t *pool; - const cmd *act; - apr_getopt_t *os; - char optch; - const char *optarg; - const char*dbtype; - - (void) apr_initialize(); - apr_pool_create(&pool, NULL); - atexit(apr_terminate); - - (void) apr_getopt_init(&os, pool, argc, argv); - - progname = argv[0]; - dbtype = "default"; - - while (apr_getopt(os, "Rt:", &optch, &optarg) == APR_SUCCESS) { - switch (optch) { - case 'R': /* raw processing */ - rflag++; - break; - case 't': - dbtype = optarg; - break; - default: - show_usage(); - fputs("unknown option.",stderr); - exit(-1); - break; - } - } - - if (argc <= os->ind) { - show_usage(); - fputs("Note: If you have no clue what this program is, start with:\n", stderr); - fputs(" ./testdbm auto foo\n", stderr); - fputs(" where foo is the DBM prefix.\n", stderr); - exit(-2); - } - - if ((act = parse_command(argv[os->ind])) == NULL) { - show_usage(); - fprintf(stderr, "unrecognized command: %s\n", argv[os->ind]); - exit(-3); - } - - if (++os->ind >= argc) { - show_usage(); - fputs("please supply a DB file to use (may be created)\n", stderr); - exit(-4); - } - - doit(act, dbtype, argv[os->ind], pool); - - apr_pool_destroy(pool); - - return 0; -} - -static void doit(const cmd *act, const char*type, const char *file, - apr_pool_t *pool) -{ - apr_status_t rv; - apr_datum_t key; - apr_datum_t val; - apr_dbm_t *db; - char *op; - int n; - char *line; - const char *use1; - const char *use2; -#ifdef TIME - long start; - extern long time(); -#endif - - rv = apr_dbm_open_ex(&db, type, file, act->flags, APR_OS_DEFAULT, pool); - if (rv != APR_SUCCESS) - oops(db, rv, "cannot open: %s", file); - - line = (char *) apr_palloc(pool,LINEMAX); - - switch (act->scode) { - - case DLOOK: - while (fgets(line, LINEMAX, stdin) != NULL) { - n = strlen(line) - 1; - line[n] = 0; - if (n == 0) - break; - - key.dptr = line; - key.dsize = n; - rv = apr_dbm_fetch(db, key, &val); - if (rv == APR_SUCCESS) { - prdatum(stdout, val); - putchar('\n'); - continue; - } - prdatum(stderr, key); - fprintf(stderr, ": not found.\n"); - } - break; - - case DDELETE: - while (fgets(line, LINEMAX, stdin) != NULL) { - n = strlen(line) - 1; - line[n] = 0; - if (n == 0) - break; - - key.dptr = line; - key.dsize = n; - if (apr_dbm_delete(db, key) != APR_SUCCESS) { - prdatum(stderr, key); - fprintf(stderr, ": not found.\n"); - } - } - break; - case DCAT: - rv = apr_dbm_firstkey(db, &key); - if (rv != APR_SUCCESS) - oops(db, rv, "could not fetch first key: %s", file); - - while (key.dptr != NULL) { - prdatum(stdout, key); - putchar('\t'); - rv = apr_dbm_fetch(db, key, &val); - if (rv != APR_SUCCESS) - oops(db, rv, "apr_dbm_fetch", "failure"); - prdatum(stdout, val); - putchar('\n'); - rv = apr_dbm_nextkey(db, &key); - if (rv != APR_SUCCESS) - oops(db, rv, "NextKey", "failure"); - } - break; - case DBUILD: -#ifdef TIME - start = time(0); -#endif - while (fgets(line, LINEMAX, stdin) != NULL) { - n = strlen(line) - 1; - line[n] = 0; - if (n == 0) - break; - - key.dptr = line; - if ((op = strchr(line, '\t')) != 0) { - key.dsize = op - line; - *op++ = 0; - val.dptr = op; - val.dsize = line + n - op; - } - else - oops(NULL, APR_EGENERAL, "bad input: %s", line); - - rv = apr_dbm_store(db, key, val); - if (rv != APR_SUCCESS) { - prdatum(stderr, key); - fprintf(stderr, ": "); - oops(db, rv, "store: %s", "failed"); - } - } -#ifdef TIME - printf("done: %d seconds.\n", time(0) - start); -#endif - break; - case DPRESS: - break; - case DCREAT: - break; - case DTRUNC: - break; - case DNAME: - apr_dbm_get_usednames(pool, file, &use1, &use2); - fprintf(stderr, "%s %s\n", use1, use2); - break; - case DAUTO: - { - int i; - char *valdata = "0123456789"; - fprintf(stderr, "Generating data: "); - for (i = 0; i < 10; i++) { - int j; - char c, keydata[10]; - for (j = 0, c = 'A' + (i % 16); j < 10; j++, c++) { - keydata[j] = c; - } - key.dptr = keydata; - key.dsize = 10; - val.dptr = valdata; - val.dsize = 10; - rv = apr_dbm_store(db, key, val); - if (rv != APR_SUCCESS) { - prdatum(stderr, key); - fprintf(stderr, ": "); - oops(db, rv, "store: %s", "failed"); - } - } - fputs("OK\n", stderr); - fputs("Testing existence/retrieval: ", stderr); - for (i = 0; i < 10; i++) { - int j; - char c, keydata[10]; - for (j = 0, c = 'A' + (i % 16); j < 10; j++, c++) { - keydata[j] = c; - } - key.dptr = keydata; - key.dsize = 10; - if (!apr_dbm_exists(db, key)) { - prdatum(stderr, key); - oops(db, 0, "exists: %s", "failed"); - } - rv = apr_dbm_fetch(db, key, &val); - if (rv != APR_SUCCESS || val.dsize != 10 || - (strncmp(val.dptr, valdata, 10) != 0) ) { - prdatum(stderr, key); - fprintf(stderr, ": "); - oops(db, rv, "fetch: %s", "failed"); - } - } - fputs("OK\n", stderr); - } - break; - } - - apr_dbm_close(db); -} - -static const cmd *parse_command(const char *str) -{ - int i; - - for (i = 0; i < CMD_SIZE; i++) - if (strcasecmp(cmds[i].sname, str) == 0) - return &cmds[i]; - - return NULL; -} - -static void prdatum(FILE *stream, apr_datum_t d) -{ - int c; - const char *p = d.dptr; - int n = d.dsize; - - while (n--) { - c = *p++ & 0377; - if (c & 0200) { - fprintf(stream, "M-"); - c &= 0177; - } - if (c == 0177 || c < ' ') - fprintf(stream, "^%c", (c == 0177) ? '?' : c + '@'); - else - putc(c, stream); - } -} - -static void oops(apr_dbm_t * dbm, apr_status_t rv, const char *s1, - const char *s2) -{ - char errbuf[200]; - - if (progname) { - fprintf(stderr, "%s: ", progname); - } - fprintf(stderr, s1, s2); - fprintf(stderr, "\n"); - - if (rv != APR_SUCCESS) { - apr_strerror(rv, errbuf, sizeof(errbuf)); - fprintf(stderr, "APR Error %d - %s\n", rv, errbuf); - - if (dbm) { - apr_dbm_geterror(dbm, &rv, errbuf, sizeof(errbuf)); - fprintf(stderr, "APR_DB Error %d - %s\n", rv, errbuf); - } - } - exit(1); -} - -static void show_usage(void) -{ - int i; - - if (!progname) { - progname = "testdbm"; - } - - fprintf(stderr, "%s [-t DBM-type] [-R] [commands] dbm-file-path\n", - progname); - - fputs("Available DBM-types:", stderr); -#if APU_HAVE_GDBM - fputs(" GDBM", stderr); -#endif -#if APU_HAVE_NDBM - fputs(" NDBM", stderr); -#endif -#if APU_HAVE_SDBM - fputs(" SDBM", stderr); -#endif -#if APU_HAVE_DB - fputs(" DB", stderr); -#endif - fputs(" default\n", stderr); - - fputs("Available commands:\n", stderr); - for (i = 0; i < CMD_SIZE; i++) { - fprintf(stderr, "%-8s%c", cmds[i].sname, - ((i + 1) % 6 == 0) ? '\n' : ' '); - } - fputs("\n", stderr); -} diff --git a/libs/apr-util/test/testldap.c b/libs/apr-util/test/testldap.c deleted file mode 100644 index b0a6369242..0000000000 --- a/libs/apr-util/test/testldap.c +++ /dev/null @@ -1,250 +0,0 @@ -/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - - /* Setup: - * - Create or edit the file data/host.data and add an - * ldap server DN. Multiple DNs may be listed on - * a single line. - * - Copy the server certificates to the data/ directory. - * All DER type certificates must have the .der extention. - * All BASE64 or PEM certificates must have the .b64 - * extension. All certificate files copied to the /data - * directory will be added to the ldap certificate store. - */ - - /* This test covers the following three types of connections: - * - Unsecure ldap:// - * - Secure ldaps:// - * - Secure ldap://+Start_TLS - * - * - (TBD) Mutual authentication - * - * There are other variations that should be tested: - * - All of the above with multiple redundant LDAP servers - * This can be done by listing more than one server DN - * in the host.data file. The DNs should all be listed - * on one line separated by a space. - * - All of the above with multiple certificates - * If more than one certificate is found in the data/ - * directory, each certificate found will be added - * to the certificate store. - * - All of the above on alternate ports - * An alternate port can be specified as part of the - * host in the host.data file. The ":port" should - * follow each DN listed. Default is 389 and 636. - * - Secure connections with mutual authentication - */ - -#include "testutil.h" - -#include "apr.h" -#include "apr_general.h" -#include "apr_ldap.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_strings.h" -#if APR_HAVE_STDLIB_H -#include -#endif -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#define DIRNAME "data" -#define FILENAME DIRNAME "/host.data" -#define CERTFILEDER DIRNAME "/*.der" -#define CERTFILEB64 DIRNAME "/*.b64" - -#if APR_HAS_LDAP - -static char ldap_host[256]; - -static int get_ldap_host(void) -{ - apr_status_t rv; - apr_file_t *thefile = NULL; - char *ptr; - - ldap_host[0] = '\0'; - rv = apr_file_open(&thefile, FILENAME, - APR_READ, - APR_UREAD | APR_UWRITE | APR_GREAD, p); - if (rv != APR_SUCCESS) { - return 0; - } - - rv = apr_file_gets(ldap_host, sizeof(ldap_host), thefile); - if (rv != APR_SUCCESS) { - return 0; - } - - ptr = strstr (ldap_host, "\r\n"); - if (ptr) { - *ptr = '\0'; - } - apr_file_close(thefile); - - return 1; - -} - -static int add_ldap_certs(abts_case *tc) -{ - apr_status_t status; - apr_dir_t *thedir; - apr_finfo_t dirent; - apr_ldap_err_t *result = NULL; - - if ((status = apr_dir_open(&thedir, DIRNAME, p)) == APR_SUCCESS) { - apr_ldap_opt_tls_cert_t *cert = (apr_ldap_opt_tls_cert_t *)apr_pcalloc(p, sizeof(apr_ldap_opt_tls_cert_t)); - - do { - status = apr_dir_read(&dirent, APR_FINFO_MIN | APR_FINFO_NAME, thedir); - if (APR_STATUS_IS_INCOMPLETE(status)) { - continue; /* ignore un-stat()able files */ - } - else if (status != APR_SUCCESS) { - break; - } - - if (strstr(dirent.name, ".der")) { - cert->type = APR_LDAP_CA_TYPE_DER; - cert->path = apr_pstrcat (p, DIRNAME, "/", dirent.name, NULL); - apr_ldap_set_option(p, NULL, APR_LDAP_OPT_TLS_CERT, (void *)cert, &result); - ABTS_TRUE(tc, result->rc == LDAP_SUCCESS); - } - if (strstr(dirent.name, ".b64")) { - cert->type = APR_LDAP_CA_TYPE_BASE64; - cert->path = apr_pstrcat (p, DIRNAME, "/", dirent.name, NULL); - apr_ldap_set_option(p, NULL, APR_LDAP_OPT_TLS_CERT, (void *)cert, &result); - ABTS_TRUE(tc, result->rc == LDAP_SUCCESS); - } - - } while (1); - - apr_dir_close(thedir); - } - return 0; -} - -static void test_ldap_connection(abts_case *tc, LDAP *ldap) -{ - int version = LDAP_VERSION3; - int failures, result; - - /* always default to LDAP V3 */ - ldap_set_option(ldap, LDAP_OPT_PROTOCOL_VERSION, &version); - - for (failures=0; failures<10; failures++) - { - result = ldap_simple_bind_s(ldap, - (char *)NULL, - (char *)NULL); - if (LDAP_SERVER_DOWN != result) - break; - } - - ABTS_TRUE(tc, result == LDAP_SUCCESS); - if (result != LDAP_SUCCESS) { - abts_log_message("%s\n", ldap_err2string(result)); - } - - ldap_unbind_s(ldap); - - return; -} - -static void test_ldap(abts_case *tc, void *data) -{ - apr_pool_t *pool = p; - LDAP *ldap; - apr_ldap_err_t *result = NULL; - - - ABTS_ASSERT(tc, "failed to get host", ldap_host[0] != '\0'); - - apr_ldap_init(pool, &ldap, - ldap_host, LDAP_PORT, - APR_LDAP_NONE, &(result)); - - ABTS_TRUE(tc, ldap != NULL); - ABTS_PTR_NOTNULL(tc, result); - - if (result->rc == LDAP_SUCCESS) { - test_ldap_connection(tc, ldap); - } -} - -static void test_ldaps(abts_case *tc, void *data) -{ - apr_pool_t *pool = p; - LDAP *ldap; - apr_ldap_err_t *result = NULL; - - apr_ldap_init(pool, &ldap, - ldap_host, LDAPS_PORT, - APR_LDAP_SSL, &(result)); - - ABTS_TRUE(tc, ldap != NULL); - ABTS_PTR_NOTNULL(tc, result); - - if (result->rc == LDAP_SUCCESS) { - add_ldap_certs(tc); - - test_ldap_connection(tc, ldap); - } -} - -static void test_ldap_tls(abts_case *tc, void *data) -{ - apr_pool_t *pool = p; - LDAP *ldap; - apr_ldap_err_t *result = NULL; - - apr_ldap_init(pool, &ldap, - ldap_host, LDAP_PORT, - APR_LDAP_STARTTLS, &(result)); - - ABTS_TRUE(tc, ldap != NULL); - ABTS_PTR_NOTNULL(tc, result); - - if (result->rc == LDAP_SUCCESS) { - add_ldap_certs(tc); - - test_ldap_connection(tc, ldap); - } -} - -#endif /* APR_HAS_LDAP */ - -abts_suite *testldap(abts_suite *suite) -{ -#if APR_HAS_LDAP - apr_ldap_err_t *result = NULL; - suite = ADD_SUITE(suite); - - apr_ldap_ssl_init(p, NULL, 0, &result); - - if (get_ldap_host()) { - abts_run_test(suite, test_ldap, NULL); - abts_run_test(suite, test_ldaps, NULL); - abts_run_test(suite, test_ldap_tls, NULL); - } -#endif /* APR_HAS_LDAP */ - - return suite; -} - diff --git a/libs/apr-util/test/testmd4.c b/libs/apr-util/test/testmd4.c deleted file mode 100644 index 494529d3cf..0000000000 --- a/libs/apr-util/test/testmd4.c +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ -/* This is derived from material copyright RSA Data Security, Inc. - * Their notice is reproduced below in its entirety. - * - * Copyright (C) 1990-2, RSA Data Security, Inc. Created 1990. All - * rights reserved. - * - * RSA Data Security, Inc. makes no representations concerning either - * the merchantability of this software or the suitability of this - * software for any particular purpose. It is provided "as is" - * without express or implied warranty of any kind. - * - * These notices must be retained in any copies of any part of this - * documentation and/or software. - */ - -#include -#include -#include - -#include "apr_errno.h" -#include "apr_md4.h" -#include "apr_file_io.h" - -#include "abts.h" -#include "testutil.h" - -static struct { - const char *string; - const char *md4sum; -} md4sums[] = -{ -/* -* Taken from the old md4 test suite. -* MD4 ("") = 31d6cfe0d16ae931b73c59d7e0c089c0 -* MD4 ("a") = bde52cb31de33e46245e05fbdbd6fb24 -* MD4 ("abc") = a448017aaf21d8525fc10ae87aa6729d -* MD4 ("message digest") = d9130a8164549fe818874806e1c7014b -* MD4 ("abcdefghijklmnopqrstuvwxyz") = d79e1c308aa5bbcdeea8ed63df412da9 -* MD4 ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789") -* MD4 ("12345678901234567890123456789012345678901234567890123456789012345678901234567890") = e33b4ddc9c38f2199c3e7b164fcc0536 -* -*/ - {"", - "\x31\xd6\xcf\xe0\xd1\x6a\xe9\x31\xb7\x3c\x59\xd7\xe0\xc0\x89\xc0"}, - {"a", - "\xbd\xe5\x2c\xb3\x1d\xe3\x3e\x46\x24\x5e\x05\xfb\xdb\xd6\xfb\x24"}, - {"abc", - "\xa4\x48\x01\x7a\xaf\x21\xd8\x52\x5f\xc1\x0a\xe8\x7a\xa6\x72\x9d"}, - {"message digest", - "\xd9\x13\x0a\x81\x64\x54\x9f\xe8\x18\x87\x48\x06\xe1\xc7\x01\x4b"}, - {"abcdefghijklmnopqrstuvwxyz", - "\xd7\x9e\x1c\x30\x8a\xa5\xbb\xcd\xee\xa8\xed\x63\xdf\x41\x2d\xa9"}, - {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "\x04\x3f\x85\x82\xf2\x41\xdb\x35\x1c\xe6\x27\xe1\x53\xe7\xf0\xe4"}, - {"12345678901234567890123456789012345678901234567890123456789012345678901234567890", - "\xe3\x3b\x4d\xdc\x9c\x38\xf2\x19\x9c\x3e\x7b\x16\x4f\xcc\x05\x36"} -}; - -static int num_sums = sizeof(md4sums) / sizeof(md4sums[0]); -static int count; - -#if 0 -static int MDStringComp(const void *string, const void *sum) -{ - apr_md4_ctx_t context; - unsigned char digest[APR_MD4_DIGESTSIZE]; - unsigned int len = strlen(string); - - apr_md4_init(&context); - apr_md4_update(&context, (unsigned char *)string, len); - apr_md4_final(digest, &context); - return (memcmp(digest, sum, APR_MD4_DIGESTSIZE)); - -} -#endif - -static void test_md4sum(abts_case *tc, void *data) -{ - apr_md4_ctx_t context; - unsigned char digest[APR_MD4_DIGESTSIZE]; - const void *string = md4sums[count].string; - const void *sum = md4sums[count].md4sum; - unsigned int len = strlen(string); - - ABTS_ASSERT(tc, "apr_md4_init", (apr_md4_init(&context) == 0)); - ABTS_ASSERT(tc, "apr_md4_update", - (apr_md4_update(&context, - (unsigned char *)string, len) == 0)); - - ABTS_ASSERT(tc, "apr_md4_final", (apr_md4_final(digest, &context) ==0)); - ABTS_ASSERT(tc, "check for correct md4 digest", - (memcmp(digest, sum, APR_MD4_DIGESTSIZE) == 0)); -} - -abts_suite *testmd4(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - for (count=0; count < num_sums; count++) { - abts_run_test(suite, test_md4sum, NULL); - } - - return suite; -} diff --git a/libs/apr-util/test/testmd5.c b/libs/apr-util/test/testmd5.c deleted file mode 100644 index 4f06f0d7d3..0000000000 --- a/libs/apr-util/test/testmd5.c +++ /dev/null @@ -1,78 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include -#include -#include - -#include "apr_md5.h" -#include "apr_xlate.h" -#include "apr_general.h" - -#include "abts.h" -#include "testutil.h" - -static struct { - const char *string; - const char *digest; -} md5sums[] = -{ - {"Jeff was here!", - "\xa5\x25\x8a\x89\x11\xb2\x9d\x1f\x81\x75\x96\x3b\x60\x94\x49\xc0"}, - {"01234567890aBcDeFASDFGHJKLPOIUYTR" - "POIUYTREWQZXCVBN LLLLLLLLLLLLLLL", - "\xd4\x1a\x06\x2c\xc5\xfd\x6f\x24\x67\x68\x56\x7c\x40\x8a\xd5\x69"}, - {"111111118888888888888888*******%%%%%%%%%%#####" - "142134u8097289720432098409289nkjlfkjlmn,m.. ", - "\xb6\xea\x5b\xe8\xca\x45\x8a\x33\xf0\xf1\x84\x6f\xf9\x65\xa8\xe1"}, - {"01234567890aBcDeFASDFGHJKLPOIUYTR" - "POIUYTREWQZXCVBN LLLLLLLLLLLLLLL" - "01234567890aBcDeFASDFGHJKLPOIUYTR" - "POIUYTREWQZXCVBN LLLLLLLLLLLLLLL" - "1", - "\xd1\xa1\xc0\x97\x8a\x60\xbb\xfb\x2a\x25\x46\x9d\xa5\xae\xd0\xb0"} -}; - -static int num_sums = sizeof(md5sums) / sizeof(md5sums[0]); -static int count; - -static void test_md5sum(abts_case *tc, void *data) -{ - apr_md5_ctx_t context; - unsigned char digest[APR_MD5_DIGESTSIZE]; - const void *string = md5sums[count].string; - const void *sum = md5sums[count].digest; - unsigned int len = strlen(string); - - ABTS_ASSERT(tc, "apr_md5_init", (apr_md5_init(&context) == 0)); - ABTS_ASSERT(tc, "apr_md5_update", - (apr_md5_update(&context, string, len) == 0)); - ABTS_ASSERT(tc, "apr_md5_final", (apr_md5_final(digest, &context) - == 0)); - ABTS_ASSERT(tc, "check for correct md5 digest", - (memcmp(digest, sum, APR_MD5_DIGESTSIZE) == 0)); -} - -abts_suite *testmd5(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - for (count=0; count < num_sums; count++) { - abts_run_test(suite, test_md5sum, NULL); - } - - return suite; -} diff --git a/libs/apr-util/test/testpass.c b/libs/apr-util/test/testpass.c deleted file mode 100644 index 67bbdbeaf8..0000000000 --- a/libs/apr-util/test/testpass.c +++ /dev/null @@ -1,140 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include -#include -#include - -#include "apr_errno.h" -#include "apr_strings.h" -#include "apr_file_io.h" -#include "apr_thread_proc.h" -#include "apr_md5.h" -#include "apr_sha1.h" - -#include "abts.h" -#include "testutil.h" - -static struct { - const char *password; - const char *hash; -} passwords[] = -{ -/* - passwords and hashes created with Apache's htpasswd utility like this: - - htpasswd -c -b passwords pass1 pass1 - htpasswd -b passwords pass2 pass2 - htpasswd -b passwords pass3 pass3 - htpasswd -b passwords pass4 pass4 - htpasswd -b passwords pass5 pass5 - htpasswd -b passwords pass6 pass6 - htpasswd -b passwords pass7 pass7 - htpasswd -b passwords pass8 pass8 - (insert Perl one-liner to convert to initializer :) ) - */ - {"pass1", "1fWDc9QWYCWrQ"}, - {"pass2", "1fiGx3u7QoXaM"}, - {"pass3", "1fzijMylTiwCs"}, - {"pass4", "nHUYc8U2UOP7s"}, - {"pass5", "nHpETGLGPwAmA"}, - {"pass6", "nHbsbWmJ3uyhc"}, - {"pass7", "nHQ3BbF0Y9vpI"}, - {"pass8", "nHZA1rViSldQk"} -}; -static int num_passwords = sizeof(passwords) / sizeof(passwords[0]); - -static void test_crypt(abts_case *tc, void *data) -{ - int i; - - for (i = 0; i < num_passwords; i++) { - apr_assert_success(tc, "check for valid password", - apr_password_validate(passwords[i].password, - passwords[i].hash)); - } -} - -#if APR_HAS_THREADS - -static void * APR_THREAD_FUNC testing_thread(apr_thread_t *thd, - void *data) -{ - abts_case *tc = data; - int i; - - for (i = 0; i < 100; i++) { - test_crypt(tc, NULL); - } - - return APR_SUCCESS; -} - -/* test for threadsafe crypt() */ -static void test_threadsafe(abts_case *tc, void *data) -{ -#define NUM_THR 20 - apr_thread_t *my_threads[NUM_THR]; - int i; - apr_status_t rv; - - for (i = 0; i < NUM_THR; i++) { - apr_assert_success(tc, "create test thread", - apr_thread_create(&my_threads[i], NULL, - testing_thread, tc, p)); - } - - for (i = 0; i < NUM_THR; i++) { - apr_thread_join(&rv, my_threads[i]); - } -} -#endif - -static void test_shapass(abts_case *tc, void *data) -{ - const char *pass = "hellojed"; - char hash[100]; - - apr_sha1_base64(pass, strlen(pass), hash); - - apr_assert_success(tc, "SHA1 password validated", - apr_password_validate(pass, hash)); -} - -static void test_md5pass(abts_case *tc, void *data) -{ - const char *pass = "hellojed", *salt = "sardine"; - char hash[100]; - - apr_md5_encode(pass, salt, hash, sizeof hash); - - apr_assert_success(tc, "MD5 password validated", - apr_password_validate(pass, hash)); -} - -abts_suite *testpass(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, test_crypt, NULL); -#if APR_HAS_THREADS - abts_run_test(suite, test_threadsafe, NULL); -#endif - abts_run_test(suite, test_shapass, NULL); - abts_run_test(suite, test_md5pass, NULL); - - return suite; -} diff --git a/libs/apr-util/test/testqueue.c b/libs/apr-util/test/testqueue.c deleted file mode 100644 index 9a971f4b11..0000000000 --- a/libs/apr-util/test/testqueue.c +++ /dev/null @@ -1,282 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include -#include -#include -#include -#include -#include "errno.h" -#include -#include -#include -#if APR_HAVE_UNISTD_H -#include -#endif -#include -#include "apr_queue.h" - -#if !APR_HAS_THREADS -int main(void) -{ - fprintf(stderr, - "This program won't work on this platform because there is no " - "support for threads.\n"); - return 0; -} -#else /* !APR_HAS_THREADS */ - -apr_pool_t *context; -int consumer_activity=400; -int producer_activity=300; -int verbose=0; -static void * APR_THREAD_FUNC consumer(apr_thread_t *thd, void *data); -static void * APR_THREAD_FUNC producer(apr_thread_t *thd, void *data); -static void usage(void); - -static void * APR_THREAD_FUNC consumer(apr_thread_t *thd, void *data) -{ - long sleeprate; - apr_queue_t *q = (apr_queue_t*)data; - apr_status_t rv; - int val; - void *v; - char current_thread_str[30]; - apr_os_thread_t current_thread = apr_os_thread_current(); - - apr_snprintf(current_thread_str, sizeof current_thread_str, - "%pT", ¤t_thread); - - sleeprate = 1000000/consumer_activity; - apr_sleep( (rand() % 4 ) * 1000000 ); /* sleep random seconds */ - while (1) { - do { - rv = apr_queue_pop(q, &v); - if (rv == APR_EINTR) { - fprintf(stderr, "%s\tconsumer intr\n", current_thread_str); - } - - } while (rv == APR_EINTR) ; - if (rv != APR_SUCCESS) { - if (rv == APR_EOF) { - fprintf(stderr, "%s\tconsumer:queue terminated APR_EOF\n", current_thread_str); - rv=APR_SUCCESS; - } - else - fprintf(stderr, "%s\tconsumer thread exit rv %d\n", current_thread_str, rv); - apr_thread_exit(thd, rv); - return NULL; - } - val = *(int*)v; - if (verbose) - fprintf(stderr, "%s\tpop %d\n", current_thread_str, val); - apr_sleep( sleeprate ); /* sleep this long to acheive our rate */ - } - /* not reached */ - return NULL; -} - -static void * APR_THREAD_FUNC producer(apr_thread_t *thd, void *data) -{ - int i=0; - long sleeprate; - apr_queue_t *q = (apr_queue_t*)data; - apr_status_t rv; - int *val; - char current_thread_str[30]; - apr_os_thread_t current_thread = apr_os_thread_current(); - - apr_snprintf(current_thread_str, sizeof current_thread_str, - "%pT", ¤t_thread); - - sleeprate = 1000000/producer_activity; - apr_sleep( (rand() % 4 ) * 1000000 ); /* sleep random seconds */ - - while(1) { - val = apr_palloc(context, sizeof(int)); - *val=i; - if (verbose) - fprintf(stderr, "%s\tpush %d\n", current_thread_str, *val); - do { - rv = apr_queue_push(q, val); - if (rv == APR_EINTR) - fprintf(stderr, "%s\tproducer intr\n", current_thread_str); - } while (rv == APR_EINTR); - - if (rv != APR_SUCCESS) { - if (rv == APR_EOF) { - fprintf(stderr, "%s\tproducer: queue terminated APR_EOF\n", current_thread_str); - rv = APR_SUCCESS; - } - else - fprintf(stderr, "%s\tproducer thread exit rv %d\n", current_thread_str, rv); - apr_thread_exit(thd, rv); - return NULL; - } - i++; - apr_sleep( sleeprate ); /* sleep this long to acheive our rate */ - } - /* not reached */ - return NULL; -} - -static void usage(void) -{ - fprintf(stderr,"usage: testqueue -p n -P n -c n -C n -q n -s n\n"); - fprintf(stderr,"-c # of consumer\n"); - fprintf(stderr,"-C amount they consumer before dying\n"); - fprintf(stderr,"-p # of producers\n"); - fprintf(stderr,"-P amount they produce before dying\n"); - fprintf(stderr,"-q queue size\n"); - fprintf(stderr,"-s amount of time to sleep before killing it\n"); - fprintf(stderr,"-v verbose\n"); -} - -int main(int argc, const char* const argv[]) -{ - apr_thread_t **t; - apr_queue_t *queue; - int i; - apr_status_t rv; - apr_getopt_t *opt; - const char *optarg; - char c; - int numconsumers=3; - int numproducers=4; - int queuesize=100; - int sleeptime=30; - char errorbuf[200]; - - apr_initialize(); - srand((unsigned int)apr_time_now()); - printf("APR Queue Test\n======================\n\n"); - - printf("%-60s", "Initializing the context"); - if (apr_pool_create(&context, NULL) != APR_SUCCESS) { - fflush(stdout); - fprintf(stderr, "Failed.\nCould not initialize\n"); - exit(-1); - } - printf("OK\n"); - - apr_getopt_init(&opt, context, argc, argv); - while ((rv = apr_getopt(opt, "p:c:P:C:q:s:v", &c, &optarg)) - == APR_SUCCESS) { - switch (c) { - case 'c': - numconsumers = atoi( optarg); - break; - case 'p': - numproducers = atoi( optarg); - break; - case 'C': - consumer_activity = atoi( optarg); - break; - case 'P': - producer_activity = atoi( optarg); - break; - case 's': - sleeptime= atoi(optarg); - break; - case 'q': - queuesize = atoi(optarg); - break; - case 'v': - verbose= 1; - break; - default: - usage(); - exit(-1); - } - } - /* bad cmdline option? then we die */ - if (rv != APR_EOF || opt->ind < opt->argc) { - usage(); - exit(-1); - } - - - - printf("test stats %d consumers (rate %d/sec) %d producers (rate %d/sec) queue size %d sleep %d\n", - numconsumers,consumer_activity, numproducers, producer_activity, queuesize,sleeptime); - printf("%-60s", "Initializing the queue"); - rv = apr_queue_create(&queue, queuesize, context); - - if (rv != APR_SUCCESS) { - fflush(stdout); - fprintf(stderr, "Failed\nCould not create queue %d\n",rv); - apr_strerror(rv, errorbuf,200); - fprintf(stderr,"%s\n",errorbuf); - exit(-1); - } - printf("OK\n"); - - t = apr_palloc( context, sizeof(apr_thread_t*) * (numconsumers+numproducers)); - printf("%-60s", "Starting consumers"); - for (i=0;i -#include -#include "apr_reslist.h" -#include "apr_thread_proc.h" - -#if APR_HAVE_TIME_H -#include -#endif /* APR_HAVE_TIME_H */ - -#if !APR_HAS_THREADS - -int main(void) -{ - fprintf(stderr, "this program requires APR thread support\n"); - return 0; -} - -#else - -#define RESLIST_MIN 3 -#define RESLIST_SMAX 10 -#define RESLIST_HMAX 20 -#define RESLIST_TTL APR_TIME_C(350000) /* 35 ms */ -#define CONSUMER_THREADS 25 -#define CONSUMER_ITERATIONS 250 -#define CONSTRUCT_SLEEP_TIME APR_TIME_C(250000) /* 25 ms */ -#define DESTRUCT_SLEEP_TIME APR_TIME_C(100000) /* 10 ms */ -#define WORK_DELAY_SLEEP_TIME APR_TIME_C(150000) /* 15 ms */ - -typedef struct { - apr_interval_time_t sleep_upon_construct; - apr_interval_time_t sleep_upon_destruct; - int c_count; - int d_count; -} my_parameters_t; - -typedef struct { - int id; -} my_resource_t; - -static apr_status_t my_constructor(void **resource, void *params, - apr_pool_t *pool) -{ - my_resource_t *res; - my_parameters_t *my_params = params; - - /* Create some resource */ - res = apr_palloc(pool, sizeof(*res)); - res->id = my_params->c_count++; - - printf("++ constructing new resource [id:%d, #%d/%d]\n", res->id, - my_params->c_count, my_params->d_count); - - /* Sleep for awhile, to simulate construction overhead. */ - apr_sleep(my_params->sleep_upon_construct); - - /* Set the resource so it can be managed by the reslist */ - *resource = res; - return APR_SUCCESS; -} - -static apr_status_t my_destructor(void *resource, void *params, - apr_pool_t *pool) -{ - my_resource_t *res = resource; - my_parameters_t *my_params = params; - - printf("-- destructing old resource [id:%d, #%d/%d]\n", res->id, - my_params->c_count, ++my_params->d_count); - - apr_sleep(my_params->sleep_upon_destruct); - - return APR_SUCCESS; -} - -typedef struct { - int tid; - apr_reslist_t *reslist; - apr_interval_time_t work_delay_sleep; -} my_thread_info_t; - -static void * APR_THREAD_FUNC resource_consuming_thread(apr_thread_t *thd, - void *data) -{ - apr_status_t rv; - my_thread_info_t *thread_info = data; - apr_reslist_t *rl = thread_info->reslist; - int i; - - for (i = 0; i < CONSUMER_ITERATIONS; i++) { - my_resource_t *res; - void *vp; - rv = apr_reslist_acquire(rl, &vp); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Failed to retrieve resource from reslist\n"); - apr_thread_exit(thd, rv); - return NULL; - } - res = vp; - printf(" [tid:%d,iter:%d] using resource id:%d\n", thread_info->tid, - i, res->id); - apr_sleep(thread_info->work_delay_sleep); -/* simulate a 5% chance of the resource being bad */ - if ( drand48() < 0.95 ) { - rv = apr_reslist_release(rl, res); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Failed to return resource to reslist\n"); - apr_thread_exit(thd, rv); - return NULL; - } - } else { - printf("invalidating resource id:%d\n", res->id) ; - rv = apr_reslist_invalidate(rl, res); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Failed to invalidate resource\n"); - apr_thread_exit(thd, rv); - return NULL; - } - } - } - - return APR_SUCCESS; -} - -static void test_timeout(apr_reslist_t *rl) -{ - apr_status_t rv; - my_resource_t *resources[RESLIST_HMAX]; - my_resource_t *res; - void *vp; - int i; - - printf("Setting timeout to 1000us: "); - apr_reslist_timeout_set(rl, 1000); - fprintf(stdout, "OK\n"); - - /* deplete all possible resources from the resource list - * so that the next call will block until timeout is reached - * (since there are no other threads to make a resource - * available) - */ - - for (i = 0; i < RESLIST_HMAX; i++) { - rv = apr_reslist_acquire(rl, (void**)&resources[i]); - if (rv != APR_SUCCESS) { - fprintf(stderr, "couldn't acquire resource: %d\n", rv); - exit(1); - } - } - - /* next call will block until timeout is reached */ - rv = apr_reslist_acquire(rl, &vp); - if (!APR_STATUS_IS_TIMEUP(rv)) { - fprintf(stderr, "apr_reslist_acquire()->%d instead of TIMEUP\n", - rv); - exit(1); - } - res = vp; - - /* release the resources; otherwise the destroy operation - * will blow - */ - for (i = 0; i < RESLIST_HMAX; i++) { - rv = apr_reslist_release(rl, &resources[i]); - if (rv != APR_SUCCESS) { - fprintf(stderr, "couldn't release resource: %d\n", rv); - exit(1); - } - } -} - -static apr_status_t test_reslist(apr_pool_t *parpool) -{ - apr_status_t rv; - apr_pool_t *pool; - apr_reslist_t *rl; - my_parameters_t *params; - int i; - apr_thread_t *my_threads[CONSUMER_THREADS]; - my_thread_info_t my_thread_info[CONSUMER_THREADS]; - srand48(time(0)) ; - - printf("Creating child pool......................."); - rv = apr_pool_create(&pool, parpool); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Error creating child pool\n"); - return rv; - } - printf("OK\n"); - - /* Create some parameters that will be passed into each - * constructor and destructor call. */ - params = apr_pcalloc(pool, sizeof(*params)); - params->sleep_upon_construct = CONSTRUCT_SLEEP_TIME; - params->sleep_upon_destruct = DESTRUCT_SLEEP_TIME; - - /* We're going to want 10 blocks of data from our target rmm. */ - printf("Creating resource list:\n" - " min/smax/hmax: %d/%d/%d\n" - " ttl: %" APR_TIME_T_FMT "\n", RESLIST_MIN, RESLIST_SMAX, - RESLIST_HMAX, RESLIST_TTL); - rv = apr_reslist_create(&rl, RESLIST_MIN, RESLIST_SMAX, RESLIST_HMAX, - RESLIST_TTL, my_constructor, my_destructor, - params, pool); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Error allocating shared memory block\n"); - return rv; - } - fprintf(stdout, "OK\n"); - - printf("Creating %d threads", CONSUMER_THREADS); - for (i = 0; i < CONSUMER_THREADS; i++) { - putchar('.'); - my_thread_info[i].tid = i; - my_thread_info[i].reslist = rl; - my_thread_info[i].work_delay_sleep = WORK_DELAY_SLEEP_TIME; - rv = apr_thread_create(&my_threads[i], NULL, - resource_consuming_thread, &my_thread_info[i], - pool); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Failed to create thread %d\n", i); - return rv; - } - } - printf("\nDone!\n"); - - printf("Waiting for threads to finish"); - for (i = 0; i < CONSUMER_THREADS; i++) { - apr_status_t thread_rv; - putchar('.'); - apr_thread_join(&thread_rv, my_threads[i]); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Failed to join thread %d\n", i); - return rv; - } - } - printf("\nDone!\n"); - - test_timeout(rl); - - printf("Destroying resource list................."); - rv = apr_reslist_destroy(rl); - if (rv != APR_SUCCESS) { - printf("FAILED\n"); - return rv; - } - printf("OK\n"); - - apr_pool_destroy(pool); - - return APR_SUCCESS; -} - - -int main(void) -{ - apr_status_t rv; - apr_pool_t *pool; - char errmsg[200]; - - apr_initialize(); - - printf("APR Resource List Test\n"); - printf("======================\n\n"); - - printf("Initializing the pool............................"); - if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { - printf("could not initialize pool\n"); - exit(-1); - } - printf("OK\n"); - - rv = test_reslist(pool); - if (rv != APR_SUCCESS) { - printf("Resource list test FAILED: [%d] %s\n", - rv, apr_strerror(rv, errmsg, sizeof(errmsg))); - exit(-2); - } - printf("Resource list test passed!\n"); - - return 0; -} - -#endif /* APR_HAS_THREADS */ diff --git a/libs/apr-util/test/testrmm.c b/libs/apr-util/test/testrmm.c deleted file mode 100644 index 3c3ac604d0..0000000000 --- a/libs/apr-util/test/testrmm.c +++ /dev/null @@ -1,281 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apr_shm.h" -#include "apr_rmm.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_time.h" -#include -#include -#include -#if APR_HAVE_UNISTD_H -#include -#endif - -#if APR_HAS_SHARED_MEMORY - -#define FRAG_SIZE 80 -#define FRAG_COUNT 10 -#define SHARED_SIZE (apr_size_t)(FRAG_SIZE * FRAG_COUNT * sizeof(char*)) - -static apr_status_t test_rmm(apr_pool_t *parpool) -{ - apr_status_t rv; - apr_pool_t *pool; - apr_shm_t *shm; - apr_rmm_t *rmm; - apr_size_t size, fragsize; - apr_rmm_off_t *off; - int i; - void *entity; - - rv = apr_pool_create(&pool, parpool); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Error creating child pool\n"); - return rv; - } - - /* We're going to want 10 blocks of data from our target rmm. */ - size = SHARED_SIZE + apr_rmm_overhead_get(FRAG_COUNT + 1); - printf("Creating anonymous shared memory (%" - APR_SIZE_T_FMT " bytes).....", size); - rv = apr_shm_create(&shm, size, NULL, pool); - if (rv != APR_SUCCESS) { - fprintf(stderr, "Error allocating shared memory block\n"); - return rv; - } - fprintf(stdout, "OK\n"); - - printf("Creating rmm segment............................."); - rv = apr_rmm_init(&rmm, NULL, apr_shm_baseaddr_get(shm), size, - pool); - - if (rv != APR_SUCCESS) { - fprintf(stderr, "Error allocating rmm..............\n"); - return rv; - } - fprintf(stdout, "OK\n"); - - fragsize = SHARED_SIZE / FRAG_COUNT; - printf("Creating each fragment of size %" APR_SIZE_T_FMT "................", - fragsize); - off = apr_palloc(pool, FRAG_COUNT * sizeof(apr_rmm_off_t)); - for (i = 0; i < FRAG_COUNT; i++) { - off[i] = apr_rmm_malloc(rmm, fragsize); - } - fprintf(stdout, "OK\n"); - - printf("Checking for out of memory allocation............"); - if (apr_rmm_malloc(rmm, FRAG_SIZE * FRAG_COUNT) == 0) { - fprintf(stdout, "OK\n"); - } - else { - return APR_EGENERAL; - } - - printf("Checking each fragment for address alignment....."); - for (i = 0; i < FRAG_COUNT; i++) { - char *c = apr_rmm_addr_get(rmm, off[i]); - apr_size_t sc = (apr_size_t)c; - - if (off[i] == 0) { - printf("allocation failed for offset %d\n", i); - return APR_ENOMEM; - } - - if (sc & 7) { - printf("Bad alignment for fragment %d; %p not %p!\n", - i, c, (void *)APR_ALIGN_DEFAULT((apr_size_t)c)); - return APR_EGENERAL; - } - } - fprintf(stdout, "OK\n"); - - printf("Setting each fragment to a unique value.........."); - for (i = 0; i < FRAG_COUNT; i++) { - int j; - char **c = apr_rmm_addr_get(rmm, off[i]); - for (j = 0; j < FRAG_SIZE; j++, c++) { - *c = apr_itoa(pool, i + j); - } - } - fprintf(stdout, "OK\n"); - - printf("Checking each fragment for its unique value......"); - for (i = 0; i < FRAG_COUNT; i++) { - int j; - char **c = apr_rmm_addr_get(rmm, off[i]); - for (j = 0; j < FRAG_SIZE; j++, c++) { - char *d = apr_itoa(pool, i + j); - if (strcmp(*c, d) != 0) { - return APR_EGENERAL; - } - } - } - fprintf(stdout, "OK\n"); - - printf("Freeing each fragment............................"); - for (i = 0; i < FRAG_COUNT; i++) { - rv = apr_rmm_free(rmm, off[i]); - if (rv != APR_SUCCESS) { - return rv; - } - } - fprintf(stdout, "OK\n"); - - printf("Creating one large segment......................."); - off[0] = apr_rmm_calloc(rmm, SHARED_SIZE); - fprintf(stdout, "OK\n"); - - printf("Setting large segment............................"); - for (i = 0; i < FRAG_COUNT * FRAG_SIZE; i++) { - char **c = apr_rmm_addr_get(rmm, off[0]); - c[i] = apr_itoa(pool, i); - } - fprintf(stdout, "OK\n"); - - printf("Freeing large segment............................"); - apr_rmm_free(rmm, off[0]); - fprintf(stdout, "OK\n"); - - printf("Creating each fragment of size %" APR_SIZE_T_FMT " (again)........", - fragsize); - for (i = 0; i < FRAG_COUNT; i++) { - off[i] = apr_rmm_malloc(rmm, fragsize); - } - fprintf(stdout, "OK\n"); - - printf("Freeing each fragment backwards.................."); - for (i = FRAG_COUNT - 1; i >= 0; i--) { - rv = apr_rmm_free(rmm, off[i]); - if (rv != APR_SUCCESS) { - return rv; - } - } - fprintf(stdout, "OK\n"); - - printf("Creating one large segment (again)..............."); - off[0] = apr_rmm_calloc(rmm, SHARED_SIZE); - fprintf(stdout, "OK\n"); - - printf("Freeing large segment............................"); - apr_rmm_free(rmm, off[0]); - fprintf(stdout, "OK\n"); - - printf("Checking realloc................................."); - off[0] = apr_rmm_calloc(rmm, SHARED_SIZE - 100); - off[1] = apr_rmm_calloc(rmm, 100); - if (off[0] == 0 || off[1] == 0) { - printf("FAILED\n"); - return APR_EINVAL; - } - entity = apr_rmm_addr_get(rmm, off[1]); - rv = apr_rmm_free(rmm, off[0]); - if (rv != APR_SUCCESS) { - printf("FAILED\n"); - return rv; - } - - { - unsigned char *c = entity; - - /* Fill in the region; the first half with zereos, which will - * likely catch the apr_rmm_realloc offset calculation bug by - * making it think the old region was zero length. */ - for (i = 0; i < 100; i++) { - c[i] = (i < 50) ? 0 : i; - } - } - - /* now we can realloc off[1] and get many more bytes */ - off[0] = apr_rmm_realloc(rmm, entity, SHARED_SIZE - 100); - if (off[0] == 0) { - printf("FAILED\n"); - return APR_EINVAL; - } - - { - unsigned char *c = apr_rmm_addr_get(rmm, off[0]); - - /* fill in the region */ - for (i = 0; i < 100; i++) { - if (c[i] != (i < 50 ? 0 : i)) { - printf("FAILED at offset %d: %hx\n", i, c[i]); - return APR_EGENERAL; - } - } - } - - fprintf(stdout, "OK\n"); - - printf("Destroying rmm segment..........................."); - rv = apr_rmm_destroy(rmm); - if (rv != APR_SUCCESS) { - printf("FAILED\n"); - return rv; - } - printf("OK\n"); - - printf("Destroying shared memory segment................."); - rv = apr_shm_destroy(shm); - if (rv != APR_SUCCESS) { - printf("FAILED\n"); - return rv; - } - printf("OK\n"); - - apr_pool_destroy(pool); - - return APR_SUCCESS; -} - - -int main(void) -{ - apr_status_t rv; - apr_pool_t *pool; - char errmsg[200]; - - apr_initialize(); - - printf("APR RMM Memory Test\n"); - printf("======================\n\n"); - - printf("Initializing the pool............................"); - if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { - printf("could not initialize pool\n"); - exit(-1); - } - printf("OK\n"); - - rv = test_rmm(pool); - if (rv != APR_SUCCESS) { - printf("Anonymous shared memory test FAILED: [%d] %s\n", - rv, apr_strerror(rv, errmsg, sizeof(errmsg))); - exit(-2); - } - printf("RMM test passed!\n"); - - return 0; -} - -#else /* APR_HAS_SHARED_MEMORY */ -#error shmem is not supported on this platform -#endif /* APR_HAS_SHARED_MEMORY */ - diff --git a/libs/apr-util/test/teststrmatch.c b/libs/apr-util/test/teststrmatch.c deleted file mode 100644 index e86b4c13c9..0000000000 --- a/libs/apr-util/test/teststrmatch.c +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright 2002-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "testutil.h" - -#include "apr.h" -#include "apr_general.h" -#include "apr_strmatch.h" -#if APR_HAVE_STDLIB_H -#include -#endif -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include "apr_want.h" - -static void test_str(abts_case *tc, void *data) -{ - apr_pool_t *pool = p; - const apr_strmatch_pattern *pattern; - const apr_strmatch_pattern *pattern_nocase; - const apr_strmatch_pattern *pattern_onechar; - const apr_strmatch_pattern *pattern_zero; - const char *match = NULL; - const char *input1 = "string that contains a patterN..."; - const char *input2 = "string that contains a pattern..."; - const char *input3 = "pattern at the start of a string"; - const char *input4 = "string that ends with a pattern"; - const char *input5 = "patter\200n not found, negative chars in input"; - const char *input6 = "patter\200n, negative chars, contains pattern..."; - - pattern = apr_strmatch_precompile(pool, "pattern", 1); - ABTS_PTR_NOTNULL(tc, pattern); - - pattern_nocase = apr_strmatch_precompile(pool, "pattern", 0); - ABTS_PTR_NOTNULL(tc, pattern_nocase); - - pattern_onechar = apr_strmatch_precompile(pool, "g", 0); - ABTS_PTR_NOTNULL(tc, pattern_onechar); - - pattern_zero = apr_strmatch_precompile(pool, "", 0); - ABTS_PTR_NOTNULL(tc, pattern_zero); - - match = apr_strmatch(pattern, input1, strlen(input1)); - ABTS_PTR_EQUAL(tc, match, NULL); - - match = apr_strmatch(pattern, input2, strlen(input2)); - ABTS_PTR_EQUAL(tc, match, input2 + 23); - - match = apr_strmatch(pattern_onechar, input1, strlen(input1)); - ABTS_PTR_EQUAL(tc, match, input1 + 5); - - match = apr_strmatch(pattern_zero, input1, strlen(input1)); - ABTS_PTR_EQUAL(tc, match, input1); - - match = apr_strmatch(pattern_nocase, input1, strlen(input1)); - ABTS_PTR_EQUAL(tc, match, input1 + 23); - - match = apr_strmatch(pattern, input3, strlen(input3)); - ABTS_PTR_EQUAL(tc, match, input3); - - match = apr_strmatch(pattern, input4, strlen(input4)); - ABTS_PTR_EQUAL(tc, match, input4 + 24); - - match = apr_strmatch(pattern, input5, strlen(input5)); - ABTS_PTR_EQUAL(tc, match, NULL); - - match = apr_strmatch(pattern, input6, strlen(input6)); - ABTS_PTR_EQUAL(tc, match, input6 + 35); -} - -abts_suite *teststrmatch(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, test_str, NULL); - - return suite; -} - diff --git a/libs/apr-util/test/testuri.c b/libs/apr-util/test/testuri.c deleted file mode 100644 index c4d385d3c9..0000000000 --- a/libs/apr-util/test/testuri.c +++ /dev/null @@ -1,230 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include -#include - -#include "testutil.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_uri.h" - -struct aup_test { - const char *uri; - apr_status_t rv; - const char *scheme; - const char *hostinfo; - const char *user; - const char *password; - const char *hostname; - const char *port_str; - const char *path; - const char *query; - const char *fragment; - apr_port_t port; -}; - -struct aup_test aup_tests[] = -{ - { "http://[/::1]/index.html", APR_EGENERAL }, - { "http://[", APR_EGENERAL }, - { "http://[?::1]/index.html", APR_EGENERAL }, - - { - "http://127.0.0.1:9999/asdf.html", - 0, "http", "127.0.0.1:9999", NULL, NULL, "127.0.0.1", "9999", "/asdf.html", NULL, NULL, 9999 - }, - { - "http://127.0.0.1:9999a/asdf.html", - APR_EGENERAL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 - }, - { - "http://[::127.0.0.1]:9999/asdf.html", - 0, "http", "[::127.0.0.1]:9999", NULL, NULL, "::127.0.0.1", "9999", "/asdf.html", NULL, NULL, 9999 - }, - { - "http://[::127.0.0.1]:9999a/asdf.html", - APR_EGENERAL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0 - }, - { - "/error/include/top.html", - 0, NULL, NULL, NULL, NULL, NULL, NULL, "/error/include/top.html", NULL, NULL, 0 - }, - { - "/error/include/../contact.html.var", - 0, NULL, NULL, NULL, NULL, NULL, NULL, "/error/include/../contact.html.var", NULL, NULL, 0 - }, - { - "/", - 0, NULL, NULL, NULL, NULL, NULL, NULL, "/", NULL, NULL, 0 - }, - { - "/manual/", - 0, NULL, NULL, NULL, NULL, NULL, NULL, "/manual/", NULL, NULL, 0 - }, - { - "/cocoon/developing/graphics/Using%20Databases-label_over.jpg", - 0, NULL, NULL, NULL, NULL, NULL, NULL, "/cocoon/developing/graphics/Using%20Databases-label_over.jpg", NULL, NULL, 0 - }, - { - "http://sonyamt:garbage@127.0.0.1/filespace/", - 0, "http", "sonyamt:garbage@127.0.0.1", "sonyamt", "garbage", "127.0.0.1", NULL, "/filespace/", NULL, NULL, 0 - }, - { - "http://sonyamt:garbage@[fe80::1]/filespace/", - 0, "http", "sonyamt:garbage@[fe80::1]", "sonyamt", "garbage", "fe80::1", NULL, "/filespace/", NULL, NULL, 0 - }, - { - "http://sonyamt@[fe80::1]/filespace/?arg1=store", - 0, "http", "sonyamt@[fe80::1]", "sonyamt", NULL, "fe80::1", NULL, "/filespace/", "arg1=store", NULL, 0 - }, - { - "//www.apache.org/", - 0, NULL, "www.apache.org", NULL, NULL, "www.apache.org", NULL, "/", NULL, NULL, 0 - }, -}; - -struct uph_test { - const char *hostinfo; - apr_status_t rv; - const char *hostname; - const char *port_str; - apr_port_t port; -}; - -struct uph_test uph_tests[] = -{ - { - "www.ibm.com:443", - 0, "www.ibm.com", "443", 443 - }, - { - "[fe80::1]:443", - 0, "fe80::1", "443", 443 - }, - { - "127.0.0.1:443", - 0, "127.0.0.1", "443", 443 - }, - { - "127.0.0.1", - APR_EGENERAL, NULL, NULL, 0 - }, - { - "[fe80:80", - APR_EGENERAL, NULL, NULL, 0 - }, - { - "fe80::80]:443", - APR_EGENERAL, NULL, NULL, 0 - } -}; - -#if 0 -static void show_info(apr_status_t rv, apr_status_t expected, const apr_uri_t *info) -{ - if (rv != expected) { - fprintf(stderr, " actual rv: %d expected rv: %d\n", rv, expected); - } - else { - fprintf(stderr, - " scheme: %s\n" - " hostinfo: %s\n" - " user: %s\n" - " password: %s\n" - " hostname: %s\n" - " port_str: %s\n" - " path: %s\n" - " query: %s\n" - " fragment: %s\n" - " hostent: %p\n" - " port: %u\n" - " is_initialized: %u\n" - " dns_looked_up: %u\n" - " dns_resolved: %u\n", - info->scheme, info->hostinfo, info->user, info->password, - info->hostname, info->port_str, info->path, info->query, - info->fragment, info->hostent, info->port, info->is_initialized, - info->dns_looked_up, info->dns_resolved); - } -} -#endif - -static void test_aup(abts_case *tc, void *data) -{ - int i; - apr_status_t rv; - apr_uri_t info; - struct aup_test *t; - const char *s = NULL; - - for (i = 0; i < sizeof(aup_tests) / sizeof(aup_tests[0]); i++) { - char msg[256]; - - memset(&info, 0, sizeof(info)); - t = &aup_tests[i]; - rv = apr_uri_parse(p, t->uri, &info); - apr_snprintf(msg, sizeof msg, "uri '%s': rv=%d not %d", t->uri, - rv, t->rv); - ABTS_ASSERT(tc, msg, rv == t->rv); - if (t->rv == APR_SUCCESS) { - ABTS_STR_EQUAL(tc, info.scheme, t->scheme); - ABTS_STR_EQUAL(tc, info.hostinfo, t->hostinfo); - ABTS_STR_EQUAL(tc, info.user, t->user); - ABTS_STR_EQUAL(tc, info.password, t->password); - ABTS_STR_EQUAL(tc, info.hostname, t->hostname); - ABTS_STR_EQUAL(tc, info.port_str, t->port_str); - ABTS_STR_EQUAL(tc, info.path, t->path); - ABTS_STR_EQUAL(tc, info.query, t->query); - ABTS_STR_EQUAL(tc, info.user, t->user); - ABTS_INT_EQUAL(tc, info.port, t->port); - - s = apr_uri_unparse(p, &info, APR_URI_UNP_REVEALPASSWORD); - ABTS_STR_EQUAL(tc, s, t->uri); - } - } -} - -static void test_uph(abts_case *tc, void *data) -{ - int i; - apr_status_t rv; - apr_uri_t info; - struct uph_test *t; - - for (i = 0; i < sizeof(uph_tests) / sizeof(uph_tests[0]); i++) { - memset(&info, 0, sizeof(info)); - t = &uph_tests[i]; - rv = apr_uri_parse_hostinfo(p, t->hostinfo, &info); - ABTS_INT_EQUAL(tc, rv, t->rv); - if (t->rv == APR_SUCCESS) { - ABTS_STR_EQUAL(tc, info.hostname, t->hostname); - ABTS_STR_EQUAL(tc, info.port_str, t->port_str); - ABTS_INT_EQUAL(tc, info.port, t->port); - } - } -} - -abts_suite *testuri(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, test_aup, NULL); - abts_run_test(suite, test_uph, NULL); - - return suite; -} - diff --git a/libs/apr-util/test/testutil.c b/libs/apr-util/test/testutil.c deleted file mode 100644 index f60ef21af2..0000000000 --- a/libs/apr-util/test/testutil.c +++ /dev/null @@ -1,48 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include -#include - -#include "abts.h" -#include "testutil.h" -#include "apr_pools.h" - -apr_pool_t *p; - -void apr_assert_success(abts_case* tc, const char* context, apr_status_t rv) -{ - if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, context); - } - - if (rv != APR_SUCCESS) { - char buf[STRING_MAX], ebuf[128]; - sprintf(buf, "%s (%d): %s\n", context, rv, - apr_strerror(rv, ebuf, sizeof ebuf)); - ABTS_FAIL(tc, buf); - } -} - -void initialize(void) { - if (apr_initialize() != APR_SUCCESS) { - abort(); - } - atexit(apr_terminate); - - apr_pool_create(&p, NULL); - apr_pool_tag(p, "apr-util global test pool"); -} diff --git a/libs/apr-util/test/testutil.h b/libs/apr-util/test/testutil.h deleted file mode 100644 index 95318e17c4..0000000000 --- a/libs/apr-util/test/testutil.h +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apr_pools.h" -#include "abts.h" - -#ifndef APR_TEST_UTIL -#define APR_TEST_UTIL - -/* XXX FIXME */ -#ifdef WIN32 -#define EXTENSION ".exe" -#elif NETWARE -#define EXTENSION ".nlm" -#else -#define EXTENSION -#endif - -#define STRING_MAX 8096 - -/* Some simple functions to make the test apps easier to write and - * a bit more consistent... - */ - -extern apr_pool_t *p; - -/* Assert that RV is an APR_SUCCESS value; else fail giving strerror - * for RV and CONTEXT message. */ -void apr_assert_success(abts_case* tc, const char *context, apr_status_t rv); - -void initialize(void); - -abts_suite *teststrmatch(abts_suite *suite); -abts_suite *testuri(abts_suite *suite); -abts_suite *testuuid(abts_suite *suite); -abts_suite *testbuckets(abts_suite *suite); -abts_suite *testpass(abts_suite *suite); -abts_suite *testmd4(abts_suite *suite); -abts_suite *testmd5(abts_suite *suite); -abts_suite *testldap(abts_suite *suite); -abts_suite *testdbd(abts_suite *suite); - -#endif /* APR_TEST_INCLUDES */ diff --git a/libs/apr-util/test/testuuid.c b/libs/apr-util/test/testuuid.c deleted file mode 100644 index 2bd6ef37fb..0000000000 --- a/libs/apr-util/test/testuuid.c +++ /dev/null @@ -1,56 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "testutil.h" -#include "apr_general.h" -#include "apr_uuid.h" - -static void test_uuid_parse(abts_case *tc, void *data) -{ - apr_uuid_t uuid; - apr_uuid_t uuid2; - char buf[APR_UUID_FORMATTED_LENGTH + 1]; - - apr_uuid_get(&uuid); - apr_uuid_format(buf, &uuid); - - apr_uuid_parse(&uuid2, buf); - ABTS_ASSERT(tc, "parse produced a different UUID", - memcmp(&uuid, &uuid2, sizeof(uuid)) == 0); -} - -static void test_gen2(abts_case *tc, void *data) -{ - apr_uuid_t uuid; - apr_uuid_t uuid2; - - /* generate two of them quickly */ - apr_uuid_get(&uuid); - apr_uuid_get(&uuid2); - - ABTS_ASSERT(tc, "generated the same UUID twice", - memcmp(&uuid, &uuid2, sizeof(uuid)) != 0); -} - -abts_suite *testuuid(abts_suite *suite) -{ - suite = ADD_SUITE(suite); - - abts_run_test(suite, test_uuid_parse, NULL); - abts_run_test(suite, test_gen2, NULL); - - return suite; -} diff --git a/libs/apr-util/test/testxlate.c b/libs/apr-util/test/testxlate.c deleted file mode 100644 index f6819914f0..0000000000 --- a/libs/apr-util/test/testxlate.c +++ /dev/null @@ -1,124 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include -#include - -#include "apr.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_xlate.h" - -static const char test_utf8[] = "Edelwei\xc3\x9f"; -static const char test_utf7[] = "Edelwei+AN8-"; -static const char test_latin1[] = "Edelwei\xdf"; -static const char test_latin2[] = "Edelwei\xdf"; - - -static int check_status (apr_status_t status, const char *msg) -{ - if (status) - { - static char buf[1024]; - printf("ERROR: %s\n %s\n", msg, - apr_strerror(status, buf, sizeof(buf))); - return 1; - } - return 0; -} - -static int test_conversion (apr_xlate_t *convset, - const char *inbuf, - const char *expected) -{ - static char buf[1024]; - int retcode = 0; - apr_size_t inbytes_left = strlen(inbuf); - apr_size_t outbytes_left = sizeof(buf) - 1; - apr_status_t status = apr_xlate_conv_buffer(convset, - inbuf, - &inbytes_left, - buf, - &outbytes_left); - if (status == APR_SUCCESS) { - status = apr_xlate_conv_buffer(convset, NULL, NULL, - buf + sizeof(buf) - outbytes_left - 1, - &outbytes_left); - } - buf[sizeof(buf) - outbytes_left - 1] = '\0'; - retcode |= check_status(status, "apr_xlate_conv_buffer"); - if ((!status || APR_STATUS_IS_INCOMPLETE(status)) - && strcmp(buf, expected)) - { - printf("ERROR: expected: '%s'\n actual: '%s'" - "\n inbytes_left: %"APR_SIZE_T_FMT"\n", - expected, buf, inbytes_left); - retcode |= 1; - } - return retcode; -} - -static int one_test (const char *cs1, const char *cs2, - const char *str1, const char *str2, - apr_pool_t *pool) -{ - apr_xlate_t *convset; - const char *msg = apr_psprintf(pool, "apr_xlate_open(%s, %s)", cs2, cs1); - int retcode = check_status(apr_xlate_open(&convset, cs2, cs1, pool), msg); - if (!retcode) - { - retcode |= test_conversion(convset, str1, str2); - retcode |= check_status(apr_xlate_close(convset), "apr_xlate_close"); - } - printf("%s: %s -> %s\n", (retcode ? "FAIL" : "PASS"), cs1, cs2); - return retcode; -} - - -int main (int argc, char **argv) -{ - apr_pool_t *pool; - int retcode = 0; - -#ifndef APR_HAS_XLATE - puts("SKIP: apr_xlate not implemented"); - return 0; -#endif - - apr_initialize(); - atexit(apr_terminate); - apr_pool_create(&pool, NULL); - - /* 1. Identity transformation: UTF-8 -> UTF-8 */ - retcode |= one_test("UTF-8", "UTF-8", test_utf8, test_utf8, pool); - - /* 2. UTF-8 <-> ISO-8859-1 */ - retcode |= one_test("UTF-8", "ISO-8859-1", test_utf8, test_latin1, pool); - retcode |= one_test("ISO-8859-1", "UTF-8", test_latin1, test_utf8, pool); - - /* 3. ISO-8859-1 <-> ISO-8859-2, identity */ - retcode |= one_test("ISO-8859-1", "ISO-8859-2", - test_latin1, test_latin2, pool); - retcode |= one_test("ISO-8859-2", "ISO-8859-1", - test_latin2, test_latin1, pool); - - /* 4. Transformation using charset aliases */ - retcode |= one_test("UTF-8", "UTF-7", test_utf8, test_utf7, pool); - retcode |= one_test("UTF-7", "UTF-8", test_utf7, test_utf8, pool); - - return retcode; -} diff --git a/libs/apr-util/test/testxml.c b/libs/apr-util/test/testxml.c deleted file mode 100644 index 9808f21065..0000000000 --- a/libs/apr-util/test/testxml.c +++ /dev/null @@ -1,219 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apr.h" -#include "apr_general.h" -#include "apr_xml.h" - -#if APR_HAVE_STDLIB_H -#include /* for exit() */ -#endif - -static const char *progname; -static const char *usage = "%s [xmlfile]\nIt will create " - "a dummy XML file if none is supplied"; -/* - * If our platform knows about the tmpnam() external buffer size, create - * a buffer to pass in. This is needed in a threaded environment, or - * one that thinks it is (like HP-UX). - */ - -#ifdef L_tmpnam -static char tname_buf[L_tmpnam]; -#else -static char *tname_buf = NULL; -#endif - -static apr_status_t create_dummy_file_error(apr_pool_t *p, apr_file_t **fd) -{ - apr_status_t rv; - char *tmpfile; - int i; - apr_off_t off = 0L; - tmpfile = tmpnam(tname_buf); - - if ((tmpfile == NULL) || (*tmpfile == '\0')) { - fprintf(stderr, "unable to generate temporary filename\n"); - if (errno == 0) { - errno = ENOENT; - } - perror("tmpnam"); - return APR_ENOENT; - } - rv = apr_file_open(fd, tmpfile, APR_CREATE|APR_TRUNCATE|APR_DELONCLOSE| - APR_READ|APR_WRITE|APR_EXCL, APR_OS_DEFAULT, p); - - if (rv != APR_SUCCESS) - return rv; - rv = apr_file_puts("\n" - "\n", *fd); - if (rv != APR_SUCCESS) - return rv; - - for (i = 0; i < 5000; i++) { - rv = apr_file_puts("yummy\n", *fd); - if (rv != APR_SUCCESS) - return rv; - } - rv = apr_file_puts("\n", *fd); - if (rv != APR_SUCCESS) - return rv; - - return apr_file_seek(*fd, APR_SET, &off); -} - -static apr_status_t create_dummy_file(apr_pool_t *p, apr_file_t **fd) -{ - apr_status_t rv; - char *tmpfile; - int i; - apr_off_t off = 0L; - tmpfile = tmpnam(tname_buf); - - if ((tmpfile == NULL) || (*tmpfile == '\0')) { - fprintf(stderr, "unable to generate temporary filename\n"); - if (errno == 0) { - errno = ENOENT; - } - perror("tmpnam"); - return APR_ENOENT; - } - rv = apr_file_open(fd, tmpfile, APR_CREATE|APR_TRUNCATE|APR_DELONCLOSE| - APR_READ|APR_WRITE|APR_EXCL, APR_OS_DEFAULT, p); - - if (rv != APR_SUCCESS) - return rv; - rv = apr_file_puts("\n" - "\n", *fd); - if (rv != APR_SUCCESS) - return rv; - - for (i = 0; i < 5000; i++) { - rv = apr_file_puts("yummy\n", *fd); - if (rv != APR_SUCCESS) - return rv; - } - rv = apr_file_puts("\n", *fd); - if (rv != APR_SUCCESS) - return rv; - - rv = apr_file_seek(*fd, APR_SET, &off); - return rv; -} - -static void dump_xml(apr_xml_elem *e, int level) -{ - apr_xml_attr *a; - apr_xml_elem *ec; - - printf("%d: element %s\n", level, e->name); - if (e->attr) { - a = e->attr; - printf("%d:\tattrs\t", level); - while (a) { - printf("%s=%s\t", a->name, a->value); - a = a->next; - } - printf("\n"); - } - if (e->first_child) { - ec = e->first_child; - while (ec) { - dump_xml(ec, level + 1); - ec = ec->next; - } - } -} - -static void oops(const char *s1, const char *s2, apr_status_t rv) -{ - if (progname) - fprintf(stderr, "%s: ", progname); - fprintf(stderr, s1, s2); - if (rv != APR_SUCCESS) { - char buf[120]; - - fprintf(stderr, " (%s)", apr_strerror(rv, buf, sizeof buf)); - } - fprintf(stderr, "\n"); - exit(1); -} - -int main(int argc, const char *const * argv) -{ - apr_pool_t *pool; - apr_file_t *fd; - apr_xml_parser *parser; - apr_xml_doc *doc; - apr_status_t rv; - char errbuf[2000]; - char errbufXML[2000]; - - (void) apr_initialize(); - apr_pool_create(&pool, NULL); - progname = argv[0]; - if (argc == 1) { - rv = create_dummy_file(pool, &fd); - if (rv != APR_SUCCESS) { - oops("cannot create dummy file", "oops", rv); - } - } - else { - if (argc == 2) { - rv = apr_file_open(&fd, argv[1], APR_READ, APR_OS_DEFAULT, pool); - if (rv != APR_SUCCESS) { - oops("cannot open: %s", argv[1], rv); - } - } - else { - oops("usage: %s", usage, 0); - } - } - rv = apr_xml_parse_file(pool, &parser, &doc, fd, 2000); - if (rv != APR_SUCCESS) { - fprintf(stderr, "APR Error %s\nXML Error: %s\n", - apr_strerror(rv, errbuf, sizeof(errbuf)), - apr_xml_parser_geterror(parser, errbufXML, sizeof(errbufXML))); - return rv; - } - dump_xml(doc->root, 0); - apr_file_close(fd); - if (argc == 1) { - rv = create_dummy_file_error(pool, &fd); - if (rv != APR_SUCCESS) { - oops("cannot create error dummy file", "oops", rv); - } - rv = apr_xml_parse_file(pool, &parser, &doc, fd, 2000); - if (rv != APR_SUCCESS) { - fprintf(stdout, "APR Error %s\nXML Error: %s " - "(EXPECTED) This is good.\n", - apr_strerror(rv, errbuf, sizeof(errbuf)), - apr_xml_parser_geterror(parser, errbufXML, sizeof(errbufXML))); - rv = APR_SUCCESS; /* reset the return code, as the test is supposed to get this error */ - } - else { - fprintf(stderr, "Expected an error, but didn't get one ;( "); - return APR_EGENERAL; - } - } - apr_pool_destroy(pool); - apr_terminate(); - return rv; -} diff --git a/libs/apr-util/uri/NWGNUmakefile b/libs/apr-util/uri/NWGNUmakefile deleted file mode 100644 index bf97c96f6e..0000000000 --- a/libs/apr-util/uri/NWGNUmakefile +++ /dev/null @@ -1,257 +0,0 @@ -# -# NWGNUmakefile for GenUri.nlm (Apache2) -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(APR_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(APR)/include/arch/NetWare \ - $(APR)/include \ - $(APRUTIL)/include \ - $(APRUTIL)/include/private \ - $(APRUTIL)/xml/expat/lib \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = Genuri - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = Generate URI Delimiters - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = genuri - -# -# If this is specified, it will override VERSION value in -# $(APR_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = 1,0,0 - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = 8192 - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM =_LibCPrelude - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM =_LibCPostlude - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If this is specified it will be used by the link '-flags' directive -# -NLM_FLAGS = PSEUDOPREEMPTION - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(APR)/misc/netware/apr.xdc. XDCData can -# be disabled by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# Declare all target files (you must add your files here) -# - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ -$(OBJDIR)/Genuri.nlm \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(OBJDIR)/gen_uri_delims.o \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - libcpre.o \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - Libc \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override $(NWOS)\copyright.txt. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - @libc.imp \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(APR_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(APR_WORK)\build\NWGNUtail.inc - diff --git a/libs/apr-util/uri/apr_uri.c b/libs/apr-util/uri/apr_uri.c deleted file mode 100644 index 3245c19a41..0000000000 --- a/libs/apr-util/uri/apr_uri.c +++ /dev/null @@ -1,462 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -/* - * apr_uri.c: URI related utility things - * - */ - -#include - -#include "apu.h" -#include "apr.h" -#include "apr_general.h" -#include "apr_strings.h" - -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "apr_uri.h" - -typedef struct schemes_t schemes_t; - -/** Structure to store various schemes and their default ports */ -struct schemes_t { - /** The name of the scheme */ - const char *name; - /** The default port for the scheme */ - apr_port_t default_port; -}; - -/* Some WWW schemes and their default ports; this is basically /etc/services */ -/* This will become global when the protocol abstraction comes */ -/* As the schemes are searched by a linear search, */ -/* they are sorted by their expected frequency */ -static schemes_t schemes[] = -{ - {"http", APR_URI_HTTP_DEFAULT_PORT}, - {"ftp", APR_URI_FTP_DEFAULT_PORT}, - {"https", APR_URI_HTTPS_DEFAULT_PORT}, - {"gopher", APR_URI_GOPHER_DEFAULT_PORT}, - {"ldap", APR_URI_LDAP_DEFAULT_PORT}, - {"nntp", APR_URI_NNTP_DEFAULT_PORT}, - {"snews", APR_URI_SNEWS_DEFAULT_PORT}, - {"imap", APR_URI_IMAP_DEFAULT_PORT}, - {"pop", APR_URI_POP_DEFAULT_PORT}, - {"sip", APR_URI_SIP_DEFAULT_PORT}, - {"rtsp", APR_URI_RTSP_DEFAULT_PORT}, - {"wais", APR_URI_WAIS_DEFAULT_PORT}, - {"z39.50r", APR_URI_WAIS_DEFAULT_PORT}, - {"z39.50s", APR_URI_WAIS_DEFAULT_PORT}, - {"prospero", APR_URI_PROSPERO_DEFAULT_PORT}, - {"nfs", APR_URI_NFS_DEFAULT_PORT}, - {"tip", APR_URI_TIP_DEFAULT_PORT}, - {"acap", APR_URI_ACAP_DEFAULT_PORT}, - {"telnet", APR_URI_TELNET_DEFAULT_PORT}, - {"ssh", APR_URI_SSH_DEFAULT_PORT}, - { NULL, 0xFFFF } /* unknown port */ -}; - -APU_DECLARE(apr_port_t) apr_uri_port_of_scheme(const char *scheme_str) -{ - schemes_t *scheme; - - if (scheme_str) { - for (scheme = schemes; scheme->name != NULL; ++scheme) { - if (strcasecmp(scheme_str, scheme->name) == 0) { - return scheme->default_port; - } - } - } - return 0; -} - -/* Unparse a apr_uri_t structure to an URI string. - * Optionally suppress the password for security reasons. - */ -APU_DECLARE(char *) apr_uri_unparse(apr_pool_t *p, - const apr_uri_t *uptr, - unsigned flags) -{ - char *ret = ""; - - /* If suppressing the site part, omit both user name & scheme://hostname */ - if (!(flags & APR_URI_UNP_OMITSITEPART)) { - - /* Construct a "user:password@" string, honoring the passed - * APR_URI_UNP_ flags: */ - if (uptr->user || uptr->password) { - ret = apr_pstrcat(p, - (uptr->user && !(flags & APR_URI_UNP_OMITUSER)) - ? uptr->user : "", - (uptr->password && !(flags & APR_URI_UNP_OMITPASSWORD)) - ? ":" : "", - (uptr->password && !(flags & APR_URI_UNP_OMITPASSWORD)) - ? ((flags & APR_URI_UNP_REVEALPASSWORD) - ? uptr->password : "XXXXXXXX") - : "", - ((uptr->user && !(flags & APR_URI_UNP_OMITUSER)) || - (uptr->password && !(flags & APR_URI_UNP_OMITPASSWORD))) - ? "@" : "", - NULL); - } - - /* Construct scheme://site string */ - if (uptr->hostname) { - int is_default_port; - const char *lbrk = "", *rbrk = ""; - - if (strchr(uptr->hostname, ':')) { /* v6 literal */ - lbrk = "["; - rbrk = "]"; - } - - is_default_port = - (uptr->port_str == NULL || - uptr->port == 0 || - uptr->port == apr_uri_port_of_scheme(uptr->scheme)); - - if (uptr->scheme) { - ret = apr_pstrcat(p, - uptr->scheme, "://", ret, - lbrk, uptr->hostname, rbrk, - is_default_port ? "" : ":", - is_default_port ? "" : uptr->port_str, - NULL); - } - else { - /* A violation of RFC2396, but it is clear from section 3.2 - * that the : belongs above to the scheme, while // belongs - * to the authority, so include the authority prefix while - * omitting the "scheme:" that the user neglected to pass us. - */ - ret = apr_pstrcat(p, - "//", ret, lbrk, uptr->hostname, rbrk, - is_default_port ? "" : ":", - is_default_port ? "" : uptr->port_str, - NULL); - } - } - } - - /* Should we suppress all path info? */ - if (!(flags & APR_URI_UNP_OMITPATHINFO)) { - /* Append path, query and fragment strings: */ - ret = apr_pstrcat(p, - ret, - (uptr->path) - ? uptr->path : "", - (uptr->query && !(flags & APR_URI_UNP_OMITQUERY)) - ? "?" : "", - (uptr->query && !(flags & APR_URI_UNP_OMITQUERY)) - ? uptr->query : "", - (uptr->fragment && !(flags & APR_URI_UNP_OMITQUERY)) - ? "#" : NULL, - (uptr->fragment && !(flags & APR_URI_UNP_OMITQUERY)) - ? uptr->fragment : NULL, - NULL); - } - return ret; -} - -/* Here is the hand-optimized parse_uri_components(). There are some wild - * tricks we could pull in assembly language that we don't pull here... like we - * can do word-at-time scans for delimiter characters using the same technique - * that fast memchr()s use. But that would be way non-portable. -djg - */ - -/* We have a apr_table_t that we can index by character and it tells us if the - * character is one of the interesting delimiters. Note that we even get - * compares for NUL for free -- it's just another delimiter. - */ - -#define T_COLON 0x01 /* ':' */ -#define T_SLASH 0x02 /* '/' */ -#define T_QUESTION 0x04 /* '?' */ -#define T_HASH 0x08 /* '#' */ -#define T_NUL 0x80 /* '\0' */ - -#if APR_CHARSET_EBCDIC -/* Delimiter table for the EBCDIC character set */ -static const unsigned char uri_delims[256] = { - T_NUL,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,T_SLASH,0,0,0,0,0,0,0,0,0,0,0,0,0,T_QUESTION, - 0,0,0,0,0,0,0,0,0,0,T_COLON,T_HASH,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,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 -}; -#else -/* Delimiter table for the ASCII character set */ -static const unsigned char uri_delims[256] = { - T_NUL,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,T_HASH,0,0,0,0,0,0,0,0,0,0,0,T_SLASH, - 0,0,0,0,0,0,0,0,0,0,T_COLON,0,0,0,0,T_QUESTION, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,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 -}; -#endif - - -/* it works like this: - if (uri_delims[ch] & NOTEND_foobar) { - then we're not at a delimiter for foobar - } -*/ - -/* Note that we optimize the scheme scanning here, we cheat and let the - * compiler know that it doesn't have to do the & masking. - */ -#define NOTEND_SCHEME (0xff) -#define NOTEND_HOSTINFO (T_SLASH | T_QUESTION | T_HASH | T_NUL) -#define NOTEND_PATH (T_QUESTION | T_HASH | T_NUL) - -/* parse_uri_components(): - * Parse a given URI, fill in all supplied fields of a uri_components - * structure. This eliminates the necessity of extracting host, port, - * path, query info repeatedly in the modules. - * Side effects: - * - fills in fields of uri_components *uptr - * - none on any of the r->* fields - */ -APU_DECLARE(apr_status_t) apr_uri_parse(apr_pool_t *p, const char *uri, - apr_uri_t *uptr) -{ - const char *s; - const char *s1; - const char *hostinfo; - char *endstr; - int port; - int v6_offset1 = 0, v6_offset2 = 0; - - /* Initialize the structure. parse_uri() and parse_uri_components() - * can be called more than once per request. - */ - memset (uptr, '\0', sizeof(*uptr)); - uptr->is_initialized = 1; - - /* We assume the processor has a branch predictor like most -- - * it assumes forward branches are untaken and backwards are taken. That's - * the reason for the gotos. -djg - */ - if (uri[0] == '/') { - /* RFC2396 #4.3 says that two leading slashes mean we have an - * authority component, not a path! Fixing this looks scary - * with the gotos here. But if the existing logic is valid, - * then presumably a goto pointing to deal_with_authority works. - * - * RFC2396 describes this as resolving an ambiguity. In the - * case of three or more slashes there would seem to be no - * ambiguity, so it is a path after all. - */ - if (uri[1] == '/' && uri[2] != '/') { - s = uri + 2 ; - goto deal_with_authority ; - } - -deal_with_path: - /* we expect uri to point to first character of path ... remember - * that the path could be empty -- http://foobar?query for example - */ - s = uri; - while ((uri_delims[*(unsigned char *)s] & NOTEND_PATH) == 0) { - ++s; - } - if (s != uri) { - uptr->path = apr_pstrmemdup(p, uri, s - uri); - } - if (*s == 0) { - return APR_SUCCESS; - } - if (*s == '?') { - ++s; - s1 = strchr(s, '#'); - if (s1) { - uptr->fragment = apr_pstrdup(p, s1 + 1); - uptr->query = apr_pstrmemdup(p, s, s1 - s); - } - else { - uptr->query = apr_pstrdup(p, s); - } - return APR_SUCCESS; - } - /* otherwise it's a fragment */ - uptr->fragment = apr_pstrdup(p, s + 1); - return APR_SUCCESS; - } - - /* find the scheme: */ - s = uri; - while ((uri_delims[*(unsigned char *)s] & NOTEND_SCHEME) == 0) { - ++s; - } - /* scheme must be non-empty and followed by :// */ - if (s == uri || s[0] != ':' || s[1] != '/' || s[2] != '/') { - goto deal_with_path; /* backwards predicted taken! */ - } - - uptr->scheme = apr_pstrmemdup(p, uri, s - uri); - s += 3; - -deal_with_authority: - hostinfo = s; - while ((uri_delims[*(unsigned char *)s] & NOTEND_HOSTINFO) == 0) { - ++s; - } - uri = s; /* whatever follows hostinfo is start of uri */ - uptr->hostinfo = apr_pstrmemdup(p, hostinfo, uri - hostinfo); - - /* If there's a username:password@host:port, the @ we want is the last @... - * too bad there's no memrchr()... For the C purists, note that hostinfo - * is definately not the first character of the original uri so therefore - * &hostinfo[-1] < &hostinfo[0] ... and this loop is valid C. - */ - do { - --s; - } while (s >= hostinfo && *s != '@'); - if (s < hostinfo) { - /* again we want the common case to be fall through */ -deal_with_host: - /* We expect hostinfo to point to the first character of - * the hostname. If there's a port it is the first colon, - * except with IPv6. - */ - if (*hostinfo == '[') { - v6_offset1 = 1; - v6_offset2 = 2; - s = memchr(hostinfo, ']', uri - hostinfo); - if (s == NULL) { - return APR_EGENERAL; - } - if (*++s != ':') { - s = NULL; /* no port */ - } - } - else { - s = memchr(hostinfo, ':', uri - hostinfo); - } - if (s == NULL) { - /* we expect the common case to have no port */ - uptr->hostname = apr_pstrmemdup(p, - hostinfo + v6_offset1, - uri - hostinfo - v6_offset2); - goto deal_with_path; - } - uptr->hostname = apr_pstrmemdup(p, - hostinfo + v6_offset1, - s - hostinfo - v6_offset2); - ++s; - uptr->port_str = apr_pstrmemdup(p, s, uri - s); - if (uri != s) { - port = strtol(uptr->port_str, &endstr, 10); - uptr->port = port; - if (*endstr == '\0') { - goto deal_with_path; - } - /* Invalid characters after ':' found */ - return APR_EGENERAL; - } - uptr->port = apr_uri_port_of_scheme(uptr->scheme); - goto deal_with_path; - } - - /* first colon delimits username:password */ - s1 = memchr(hostinfo, ':', s - hostinfo); - if (s1) { - uptr->user = apr_pstrmemdup(p, hostinfo, s1 - hostinfo); - ++s1; - uptr->password = apr_pstrmemdup(p, s1, s - s1); - } - else { - uptr->user = apr_pstrmemdup(p, hostinfo, s - hostinfo); - } - hostinfo = s + 1; - goto deal_with_host; -} - -/* Special case for CONNECT parsing: it comes with the hostinfo part only */ -/* See the INTERNET-DRAFT document "Tunneling SSL Through a WWW Proxy" - * currently at http://www.mcom.com/newsref/std/tunneling_ssl.html - * for the format of the "CONNECT host:port HTTP/1.0" request - */ -APU_DECLARE(apr_status_t) apr_uri_parse_hostinfo(apr_pool_t *p, - const char *hostinfo, - apr_uri_t *uptr) -{ - const char *s; - char *endstr; - const char *rsb; - int v6_offset1 = 0; - - /* Initialize the structure. parse_uri() and parse_uri_components() - * can be called more than once per request. - */ - memset(uptr, '\0', sizeof(*uptr)); - uptr->is_initialized = 1; - uptr->hostinfo = apr_pstrdup(p, hostinfo); - - /* We expect hostinfo to point to the first character of - * the hostname. There must be a port, separated by a colon - */ - if (*hostinfo == '[') { - if ((rsb = strchr(hostinfo, ']')) == NULL || - *(rsb + 1) != ':') { - return APR_EGENERAL; - } - /* literal IPv6 address */ - s = rsb + 1; - ++hostinfo; - v6_offset1 = 1; - } - else { - s = strchr(hostinfo, ':'); - } - if (s == NULL) { - return APR_EGENERAL; - } - uptr->hostname = apr_pstrndup(p, hostinfo, s - hostinfo - v6_offset1); - ++s; - uptr->port_str = apr_pstrdup(p, s); - if (*s != '\0') { - uptr->port = (unsigned short) strtol(uptr->port_str, &endstr, 10); - if (*endstr == '\0') { - return APR_SUCCESS; - } - /* Invalid characters after ':' found */ - } - return APR_EGENERAL; -} diff --git a/libs/apr-util/xlate/xlate.c b/libs/apr-util/xlate/xlate.c deleted file mode 100644 index 5e955ef258..0000000000 --- a/libs/apr-util/xlate/xlate.c +++ /dev/null @@ -1,458 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apu.h" -#include "apu_config.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_xlate.h" - -/* If no implementation is available, don't generate code here since - * apr_xlate.h emitted macros which return APR_ENOTIMPL. - */ - -#if APR_HAS_XLATE - -#ifdef HAVE_STDDEF_H -#include /* for NULL */ -#endif -#if APR_HAVE_STRING_H -#include -#endif -#if APR_HAVE_STRINGS_H -#include -#endif -#ifdef HAVE_ICONV_H -#include -#endif -#if APU_HAVE_APR_ICONV -#include -#endif - -#if defined(APU_ICONV_INBUF_CONST) || APU_HAVE_APR_ICONV -#define ICONV_INBUF_TYPE const char ** -#else -#define ICONV_INBUF_TYPE char ** -#endif - -#ifndef min -#define min(x,y) ((x) <= (y) ? (x) : (y)) -#endif - -struct apr_xlate_t { - apr_pool_t *pool; - char *frompage; - char *topage; - char *sbcs_table; -#if APU_HAVE_ICONV - iconv_t ich; -#elif APU_HAVE_APR_ICONV - apr_iconv_t ich; -#endif -}; - - -static const char *handle_special_names(const char *page, apr_pool_t *pool) -{ - if (page == APR_DEFAULT_CHARSET) { - return apr_os_default_encoding(pool); - } - else if (page == APR_LOCALE_CHARSET) { - return apr_os_locale_encoding(pool); - } - else { - return page; - } -} - -static apr_status_t apr_xlate_cleanup(void *convset) -{ - apr_xlate_t *old = convset; - -#if APU_HAVE_APR_ICONV - if (old->ich != (apr_iconv_t)-1) { - return apr_iconv_close(old->ich, old->pool); - } - -#elif APU_HAVE_ICONV - if (old->ich != (iconv_t)-1) { - if (iconv_close(old->ich)) { - int rv = errno; - - /* Sometimes, iconv is not good about setting errno. */ - return rv ? rv : APR_EINVAL; - } - } -#endif - - return APR_SUCCESS; -} - -#if APU_HAVE_ICONV -static void check_sbcs(apr_xlate_t *convset) -{ - char inbuf[256], outbuf[256]; - char *inbufptr = inbuf; - char *outbufptr = outbuf; - apr_size_t inbytes_left, outbytes_left; - int i; - apr_size_t translated; - - for (i = 0; i < sizeof(inbuf); i++) { - inbuf[i] = i; - } - - inbytes_left = outbytes_left = sizeof(inbuf); - translated = iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr, - &inbytes_left, &outbufptr, &outbytes_left); - - if (translated != (apr_size_t)-1 - && inbytes_left == 0 - && outbytes_left == 0) { - /* hurray... this is simple translation; save the table, - * close the iconv descriptor - */ - - convset->sbcs_table = apr_palloc(convset->pool, sizeof(outbuf)); - memcpy(convset->sbcs_table, outbuf, sizeof(outbuf)); - iconv_close(convset->ich); - convset->ich = (iconv_t)-1; - - /* TODO: add the table to the cache */ - } - else { - /* reset the iconv descriptor, since it's now in an undefined - * state. */ - iconv_close(convset->ich); - convset->ich = iconv_open(convset->topage, convset->frompage); - } -} -#elif APU_HAVE_APR_ICONV -static void check_sbcs(apr_xlate_t *convset) -{ - char inbuf[256], outbuf[256]; - char *inbufptr = inbuf; - char *outbufptr = outbuf; - apr_size_t inbytes_left, outbytes_left; - int i; - apr_size_t translated; - apr_status_t rv; - - for (i = 0; i < sizeof(inbuf); i++) { - inbuf[i] = i; - } - - inbytes_left = outbytes_left = sizeof(inbuf); - rv = apr_iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr, - &inbytes_left, &outbufptr, &outbytes_left, - &translated); - - if ((rv == APR_SUCCESS) - && (translated != (apr_size_t)-1) - && inbytes_left == 0 - && outbytes_left == 0) { - /* hurray... this is simple translation; save the table, - * close the iconv descriptor - */ - - convset->sbcs_table = apr_palloc(convset->pool, sizeof(outbuf)); - memcpy(convset->sbcs_table, outbuf, sizeof(outbuf)); - apr_iconv_close(convset->ich, convset->pool); - convset->ich = (apr_iconv_t)-1; - - /* TODO: add the table to the cache */ - } - else { - /* reset the iconv descriptor, since it's now in an undefined - * state. */ - apr_iconv_close(convset->ich, convset->pool); - rv = apr_iconv_open(convset->topage, convset->frompage, - convset->pool, &convset->ich); - } -} -#endif /* APU_HAVE_APR_ICONV */ - -static void make_identity_table(apr_xlate_t *convset) -{ - int i; - - convset->sbcs_table = apr_palloc(convset->pool, 256); - for (i = 0; i < 256; i++) - convset->sbcs_table[i] = i; -} - -APU_DECLARE(apr_status_t) apr_xlate_open(apr_xlate_t **convset, - const char *topage, - const char *frompage, - apr_pool_t *pool) -{ - apr_status_t rv; - apr_xlate_t *new; - int found = 0; - - *convset = NULL; - - topage = handle_special_names(topage, pool); - frompage = handle_special_names(frompage, pool); - - new = (apr_xlate_t *)apr_pcalloc(pool, sizeof(apr_xlate_t)); - if (!new) { - return APR_ENOMEM; - } - - new->pool = pool; - new->topage = apr_pstrdup(pool, topage); - new->frompage = apr_pstrdup(pool, frompage); - if (!new->topage || !new->frompage) { - return APR_ENOMEM; - } - -#ifdef TODO - /* search cache of codepage pairs; we may be able to avoid the - * expensive iconv_open() - */ - - set found to non-zero if found in the cache -#endif - - if ((! found) && (strcmp(topage, frompage) == 0)) { - /* to and from are the same */ - found = 1; - make_identity_table(new); - } - -#if APU_HAVE_APR_ICONV - if (!found) { - rv = apr_iconv_open(topage, frompage, pool, &new->ich); - if (rv != APR_SUCCESS) { - return rv; - } - found = 1; - check_sbcs(new); - } else - new->ich = (apr_iconv_t)-1; - -#elif APU_HAVE_ICONV - if (!found) { - new->ich = iconv_open(topage, frompage); - if (new->ich == (iconv_t)-1) { - int rv = errno; - /* Sometimes, iconv is not good about setting errno. */ - return rv ? rv : APR_EINVAL; - } - found = 1; - check_sbcs(new); - } else - new->ich = (iconv_t)-1; -#endif /* APU_HAVE_ICONV */ - - if (found) { - *convset = new; - apr_pool_cleanup_register(pool, (void *)new, apr_xlate_cleanup, - apr_pool_cleanup_null); - rv = APR_SUCCESS; - } - else { - rv = APR_EINVAL; /* iconv() would return EINVAL if it - couldn't handle the pair */ - } - - return rv; -} - -APU_DECLARE(apr_status_t) apr_xlate_sb_get(apr_xlate_t *convset, int *onoff) -{ - *onoff = convset->sbcs_table != NULL; - return APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_xlate_conv_buffer(apr_xlate_t *convset, - const char *inbuf, - apr_size_t *inbytes_left, - char *outbuf, - apr_size_t *outbytes_left) -{ - apr_status_t status = APR_SUCCESS; - -#if APU_HAVE_APR_ICONV - if (convset->ich != (apr_iconv_t)-1) { - const char *inbufptr = inbuf; - apr_size_t translated; - char *outbufptr = outbuf; - status = apr_iconv(convset->ich, &inbufptr, inbytes_left, - &outbufptr, outbytes_left, &translated); - - /* If everything went fine but we ran out of buffer, don't - * report it as an error. Caller needs to look at the two - * bytes-left values anyway. - * - * There are three expected cases where rc is -1. In each of - * these cases, *inbytes_left != 0. - * a) the non-error condition where we ran out of output - * buffer - * b) the non-error condition where we ran out of input (i.e., - * the last input character is incomplete) - * c) the error condition where the input is invalid - */ - switch (status) { - - case E2BIG: /* out of space on output */ - status = 0; /* change table lookup code below if you - make this an error */ - break; - - case EINVAL: /* input character not complete (yet) */ - status = APR_INCOMPLETE; - break; - - case EILSEQ: /* bad input byte */ - status = APR_EINVAL; - break; - - /* Sometimes, iconv is not good about setting errno. */ - case 0: - if (*inbytes_left) - status = APR_INCOMPLETE; - break; - - default: - break; - } - } - else - -#elif APU_HAVE_ICONV - if (convset->ich != (iconv_t)-1) { - const char *inbufptr = inbuf; - char *outbufptr = outbuf; - apr_size_t translated; - translated = iconv(convset->ich, (ICONV_INBUF_TYPE)&inbufptr, - inbytes_left, &outbufptr, outbytes_left); - - /* If everything went fine but we ran out of buffer, don't - * report it as an error. Caller needs to look at the two - * bytes-left values anyway. - * - * There are three expected cases where rc is -1. In each of - * these cases, *inbytes_left != 0. - * a) the non-error condition where we ran out of output - * buffer - * b) the non-error condition where we ran out of input (i.e., - * the last input character is incomplete) - * c) the error condition where the input is invalid - */ - if (translated == (apr_size_t)-1) { - int rv = errno; - switch (rv) { - - case E2BIG: /* out of space on output */ - status = 0; /* change table lookup code below if you - make this an error */ - break; - - case EINVAL: /* input character not complete (yet) */ - status = APR_INCOMPLETE; - break; - - case EILSEQ: /* bad input byte */ - status = APR_EINVAL; - break; - - /* Sometimes, iconv is not good about setting errno. */ - case 0: - status = APR_INCOMPLETE; - break; - - default: - status = rv; - break; - } - } - } - else -#endif - - if (inbuf) { - int to_convert = min(*inbytes_left, *outbytes_left); - int converted = to_convert; - char *table = convset->sbcs_table; - - while (to_convert) { - *outbuf = table[(unsigned char)*inbuf]; - ++outbuf; - ++inbuf; - --to_convert; - } - *inbytes_left -= converted; - *outbytes_left -= converted; - } - - return status; -} - -APU_DECLARE(apr_int32_t) apr_xlate_conv_byte(apr_xlate_t *convset, - unsigned char inchar) -{ - if (convset->sbcs_table) { - return convset->sbcs_table[inchar]; - } - else { - return -1; - } -} - -APU_DECLARE(apr_status_t) apr_xlate_close(apr_xlate_t *convset) -{ - return apr_pool_cleanup_run(convset->pool, convset, apr_xlate_cleanup); -} - -#else /* !APR_HAS_XLATE */ - -APU_DECLARE(apr_status_t) apr_xlate_open(apr_xlate_t **convset, - const char *topage, - const char *frompage, - apr_pool_t *pool) -{ - return APR_ENOTIMPL; -} - -APU_DECLARE(apr_status_t) apr_xlate_sb_get(apr_xlate_t *convset, int *onoff) -{ - return APR_ENOTIMPL; -} - -APU_DECLARE(apr_int32_t) apr_xlate_conv_byte(apr_xlate_t *convset, - unsigned char inchar) -{ - return (-1); -} - -APU_DECLARE(apr_status_t) apr_xlate_conv_buffer(apr_xlate_t *convset, - const char *inbuf, - apr_size_t *inbytes_left, - char *outbuf, - apr_size_t *outbytes_left) -{ - return APR_ENOTIMPL; -} - -APU_DECLARE(apr_status_t) apr_xlate_close(apr_xlate_t *convset) -{ - return APR_ENOTIMPL; -} - -#endif /* APR_HAS_XLATE */ diff --git a/libs/apr-util/xml/NWGNUmakefile b/libs/apr-util/xml/NWGNUmakefile deleted file mode 100644 index 5f85964f6c..0000000000 --- a/libs/apr-util/xml/NWGNUmakefile +++ /dev/null @@ -1,258 +0,0 @@ -# -# Declare the sub-directories to be built here -# - -SUBDIRS = \ - $(EOLIST) - -# -# Get the 'head' of the build environment. This includes default targets and -# paths to tools -# - -include $(APR_WORK)\build\NWGNUhead.inc - -# -# build this level's files - -# -# Make sure all needed macro's are defined -# - -# -# These directories will be at the beginning of the include list, followed by -# INCDIRS -# -XINCDIRS += \ - $(APR)/include \ - $(APR)/include/arch/NetWare \ - $(APRUTIL)/include \ - $(APRUTIL)/uri \ - $(APRUTIL)/dbm/sdbm \ - $(APRUTIL)/include/private \ - $(APRUTIL)/xml/expat/lib \ - $(EOLIST) - -# -# These flags will come after CFLAGS -# -XCFLAGS += \ - $(EOLIST) - -# -# These defines will come after DEFINES -# -XDEFINES += \ - $(EOLIST) - -# -# These flags will be added to the link.opt file -# -XLFLAGS += \ - $(EOLIST) - -# -# These values will be appended to the correct variables based on the value of -# RELEASE -# -ifeq "$(RELEASE)" "debug" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "noopt" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -ifeq "$(RELEASE)" "release" -XINCDIRS += \ - $(EOLIST) - -XCFLAGS += \ - $(EOLIST) - -XDEFINES += \ - $(EOLIST) - -XLFLAGS += \ - $(EOLIST) -endif - -# -# These are used by the link target if an NLM is being generated -# This is used by the link 'name' directive to name the nlm. If left blank -# TARGET_nlm (see below) will be used. -# -NLM_NAME = - -# -# This is used by the link '-desc ' directive. -# If left blank, NLM_NAME will be used. -# -NLM_DESCRIPTION = - -# -# This is used by the '-threadname' directive. If left blank, -# NLM_NAME Thread will be used. -# -NLM_THREAD_NAME = -# -# If this is specified, it will override VERSION value in -# $(APR_WORK)\build\NWGNUenvironment.inc -# -NLM_VERSION = - -# -# If this is specified, it will override the default of 64K -# -NLM_STACK_SIZE = - -# -# If this is specified it will be used by the link '-entry' directive -# -NLM_ENTRY_SYM = - -# -# If this is specified it will be used by the link '-exit' directive -# -NLM_EXIT_SYM = - -# -# If this is specified it will be used by the link '-check' directive -# -NLM_CHECK_SYM = - -# -# If this is specified it will be used by the link '-flags' directive -# -NLM_FLAGS = - -# -# If this is specified it will be linked in with the XDCData option in the def -# file instead of the default of $(APR)/misc/netware/apache.xdc. XDCData can -# be disabled by setting APACHE_UNIPROC in the environment -# -XDCDATA = - -# -# Declare all target files (you must add your files here) -# - -# -# If there is an NLM target, put it here -# -TARGET_nlm = \ - $(EOLIST) - -# -# If there is an LIB target, put it here -# -TARGET_lib = \ - $(OBJDIR)/xmllib.lib \ - $(EOLIST) - -# -# These are the OBJ files needed to create the NLM target above. -# Paths must all use the '/' character -# -FILES_nlm_objs = \ - $(EOLIST) - -# -# These are the LIB files needed to create the NLM target above. -# These will be added as a library command in the link.opt file. -# -FILES_nlm_libs = \ - $(EOLIST) - -# -# These are the modules that the above NLM target depends on to load. -# These will be added as a module command in the link.opt file. -# -FILES_nlm_modules = \ - $(EOLIST) - -# -# If the nlm has a msg file, put it's path here -# -FILE_nlm_msg = - -# -# If the nlm has a hlp file put it's path here -# -FILE_nlm_hlp = - -# -# If this is specified, it will override the default copyright. -# -FILE_nlm_copyright = - -# -# Any additional imports go here -# -FILES_nlm_Ximports = \ - $(EOLIST) - -# -# Any symbols exported to here -# -FILES_nlm_exports = \ - $(EOLIST) - -# -# These are the OBJ files needed to create the LIB target above. -# Paths must all use the '/' character -# -FILES_lib_objs = \ - $(OBJDIR)/apr_xml.o \ - $(OBJDIR)/xmlparse.o \ - $(OBJDIR)/xmlrole.o \ - $(OBJDIR)/xmltok.o \ - $(EOLIST) - -# -# implement targets and dependancies (leave this section alone) -# - -libs :: $(OBJDIR) $(TARGET_lib) - -nlms :: libs $(TARGET_nlm) - -# -# Updated this target to create necessary directories and copy files to the -# correct place. (See $(APR_WORK)\build\NWGNUhead.inc for examples) -# -install :: nlms FORCE - -# -# Any specialized rules here -# - -vpath %.c expat/lib - -# -# Include the 'tail' makefile that has targets that depend on variables defined -# in this makefile -# - -include $(APR_WORK)\build\NWGNUtail.inc - diff --git a/libs/apr-util/xml/apr_xml.c b/libs/apr-util/xml/apr_xml.c deleted file mode 100644 index a05348d60f..0000000000 --- a/libs/apr-util/xml/apr_xml.c +++ /dev/null @@ -1,976 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ - -#include "apr.h" -#include "apr_strings.h" - -#define APR_WANT_STDIO /* for sprintf() */ -#define APR_WANT_STRFUNC -#include "apr_want.h" - -#include "apr_xml.h" - -#include "apu_config.h" - -#ifdef APR_HAVE_OLD_EXPAT -#include "xmlparse.h" -#else -#include "expat.h" -#endif - -#define DEBUG_CR "\r\n" - -static const char APR_KW_xmlns[] = { 0x78, 0x6D, 0x6C, 0x6E, 0x73, '\0' }; -static const char APR_KW_xmlns_lang[] = { 0x78, 0x6D, 0x6C, 0x3A, 0x6C, 0x61, 0x6E, 0x67, '\0' }; -static const char APR_KW_DAV[] = { 0x44, 0x41, 0x56, 0x3A, '\0' }; - -/* errors related to namespace processing */ -#define APR_XML_NS_ERROR_UNKNOWN_PREFIX (-1000) -#define APR_XML_NS_ERROR_INVALID_DECL (-1001) - -/* test for a namespace prefix that begins with [Xx][Mm][Ll] */ -#define APR_XML_NS_IS_RESERVED(name) \ - ( (name[0] == 0x58 || name[0] == 0x78) && \ - (name[1] == 0x4D || name[1] == 0x6D) && \ - (name[2] == 0x4C || name[2] == 0x6C) ) - - -/* the real (internal) definition of the parser context */ -struct apr_xml_parser { - apr_xml_doc *doc; /* the doc we're parsing */ - apr_pool_t *p; /* the pool we allocate from */ - apr_xml_elem *cur_elem; /* current element */ - - int error; /* an error has occurred */ -#define APR_XML_ERROR_EXPAT 1 -#define APR_XML_ERROR_PARSE_DONE 2 -/* also: public APR_XML_NS_ERROR_* values (if any) */ - - XML_Parser xp; /* the actual (Expat) XML parser */ - enum XML_Error xp_err; /* stored Expat error code */ -}; - -/* struct for scoping namespace declarations */ -typedef struct apr_xml_ns_scope { - const char *prefix; /* prefix used for this ns */ - int ns; /* index into namespace table */ - int emptyURI; /* the namespace URI is the empty string */ - struct apr_xml_ns_scope *next; /* next scoped namespace */ -} apr_xml_ns_scope; - - -/* return namespace table index for a given prefix */ -static int find_prefix(apr_xml_parser *parser, const char *prefix) -{ - apr_xml_elem *elem = parser->cur_elem; - - /* - ** Walk up the tree, looking for a namespace scope that defines this - ** prefix. - */ - for (; elem; elem = elem->parent) { - apr_xml_ns_scope *ns_scope; - - for (ns_scope = elem->ns_scope; ns_scope; ns_scope = ns_scope->next) { - if (strcmp(prefix, ns_scope->prefix) == 0) { - if (ns_scope->emptyURI) { - /* - ** It is possible to set the default namespace to an - ** empty URI string; this resets the default namespace - ** to mean "no namespace." We just found the prefix - ** refers to an empty URI, so return "no namespace." - */ - return APR_XML_NS_NONE; - } - - return ns_scope->ns; - } - } - } - - /* - * If the prefix is empty (""), this means that a prefix was not - * specified in the element/attribute. The search that was performed - * just above did not locate a default namespace URI (which is stored - * into ns_scope with an empty prefix). This means the element/attribute - * has "no namespace". We have a reserved value for this. - */ - if (*prefix == '\0') { - return APR_XML_NS_NONE; - } - - /* not found */ - return APR_XML_NS_ERROR_UNKNOWN_PREFIX; -} - -static void start_handler(void *userdata, const char *name, const char **attrs) -{ - apr_xml_parser *parser = userdata; - apr_xml_elem *elem; - apr_xml_attr *attr; - apr_xml_attr *prev; - char *colon; - const char *quoted; - char *elem_name; - - /* punt once we find an error */ - if (parser->error) - return; - - elem = apr_pcalloc(parser->p, sizeof(*elem)); - - /* prep the element */ - elem->name = elem_name = apr_pstrdup(parser->p, name); - - /* fill in the attributes (note: ends up in reverse order) */ - while (*attrs) { - attr = apr_palloc(parser->p, sizeof(*attr)); - attr->name = apr_pstrdup(parser->p, *attrs++); - attr->value = apr_pstrdup(parser->p, *attrs++); - attr->next = elem->attr; - elem->attr = attr; - } - - /* hook the element into the tree */ - if (parser->cur_elem == NULL) { - /* no current element; this also becomes the root */ - parser->cur_elem = parser->doc->root = elem; - } - else { - /* this element appeared within the current elem */ - elem->parent = parser->cur_elem; - - /* set up the child/sibling links */ - if (elem->parent->last_child == NULL) { - /* no first child either */ - elem->parent->first_child = elem->parent->last_child = elem; - } - else { - /* hook onto the end of the parent's children */ - elem->parent->last_child->next = elem; - elem->parent->last_child = elem; - } - - /* this element is now the current element */ - parser->cur_elem = elem; - } - - /* scan the attributes for namespace declarations */ - for (prev = NULL, attr = elem->attr; - attr; - attr = attr->next) { - if (strncmp(attr->name, APR_KW_xmlns, 5) == 0) { - const char *prefix = &attr->name[5]; - apr_xml_ns_scope *ns_scope; - - /* test for xmlns:foo= form and xmlns= form */ - if (*prefix == 0x3A) { - /* a namespace prefix declaration must have a - non-empty value. */ - if (attr->value[0] == '\0') { - parser->error = APR_XML_NS_ERROR_INVALID_DECL; - return; - } - ++prefix; - } - else if (*prefix != '\0') { - /* advance "prev" since "attr" is still present */ - prev = attr; - continue; - } - - /* quote the URI before we ever start working with it */ - quoted = apr_xml_quote_string(parser->p, attr->value, 1); - - /* build and insert the new scope */ - ns_scope = apr_pcalloc(parser->p, sizeof(*ns_scope)); - ns_scope->prefix = prefix; - ns_scope->ns = apr_xml_insert_uri(parser->doc->namespaces, quoted); - ns_scope->emptyURI = *quoted == '\0'; - ns_scope->next = elem->ns_scope; - elem->ns_scope = ns_scope; - - /* remove this attribute from the element */ - if (prev == NULL) - elem->attr = attr->next; - else - prev->next = attr->next; - - /* Note: prev will not be advanced since we just removed "attr" */ - } - else if (strcmp(attr->name, APR_KW_xmlns_lang) == 0) { - /* save away the language (in quoted form) */ - elem->lang = apr_xml_quote_string(parser->p, attr->value, 1); - - /* remove this attribute from the element */ - if (prev == NULL) - elem->attr = attr->next; - else - prev->next = attr->next; - - /* Note: prev will not be advanced since we just removed "attr" */ - } - else { - /* advance "prev" since "attr" is still present */ - prev = attr; - } - } - - /* - ** If an xml:lang attribute didn't exist (lang==NULL), then copy the - ** language from the parent element (if present). - ** - ** NOTE: elem_size() *depends* upon this pointer equality. - */ - if (elem->lang == NULL && elem->parent != NULL) - elem->lang = elem->parent->lang; - - /* adjust the element's namespace */ - colon = strchr(elem_name, 0x3A); - if (colon == NULL) { - /* - * The element is using the default namespace, which will always - * be found. Either it will be "no namespace", or a default - * namespace URI has been specified at some point. - */ - elem->ns = find_prefix(parser, ""); - } - else if (APR_XML_NS_IS_RESERVED(elem->name)) { - elem->ns = APR_XML_NS_NONE; - } - else { - *colon = '\0'; - elem->ns = find_prefix(parser, elem->name); - elem->name = colon + 1; - - if (APR_XML_NS_IS_ERROR(elem->ns)) { - parser->error = elem->ns; - return; - } - } - - /* adjust all remaining attributes' namespaces */ - for (attr = elem->attr; attr; attr = attr->next) { - /* - * apr_xml_attr defines this as "const" but we dup'd it, so we - * know that we can change it. a bit hacky, but the existing - * structure def is best. - */ - char *attr_name = (char *)attr->name; - - colon = strchr(attr_name, 0x3A); - if (colon == NULL) { - /* - * Attributes do NOT use the default namespace. Therefore, - * we place them into the "no namespace" category. - */ - attr->ns = APR_XML_NS_NONE; - } - else if (APR_XML_NS_IS_RESERVED(attr->name)) { - attr->ns = APR_XML_NS_NONE; - } - else { - *colon = '\0'; - attr->ns = find_prefix(parser, attr->name); - attr->name = colon + 1; - - if (APR_XML_NS_IS_ERROR(attr->ns)) { - parser->error = attr->ns; - return; - } - } - } -} - -static void end_handler(void *userdata, const char *name) -{ - apr_xml_parser *parser = userdata; - - /* punt once we find an error */ - if (parser->error) - return; - - /* pop up one level */ - parser->cur_elem = parser->cur_elem->parent; -} - -static void cdata_handler(void *userdata, const char *data, int len) -{ - apr_xml_parser *parser = userdata; - apr_xml_elem *elem; - apr_text_header *hdr; - const char *s; - - /* punt once we find an error */ - if (parser->error) - return; - - elem = parser->cur_elem; - s = apr_pstrndup(parser->p, data, len); - - if (elem->last_child == NULL) { - /* no children yet. this cdata follows the start tag */ - hdr = &elem->first_cdata; - } - else { - /* child elements exist. this cdata follows the last child. */ - hdr = &elem->last_child->following_cdata; - } - - apr_text_append(parser->p, hdr, s); -} - -static apr_status_t cleanup_parser(void *ctx) -{ - apr_xml_parser *parser = ctx; - - XML_ParserFree(parser->xp); - parser->xp = NULL; - - return APR_SUCCESS; -} - -APU_DECLARE(apr_xml_parser *) apr_xml_parser_create(apr_pool_t *pool) -{ - apr_xml_parser *parser = apr_pcalloc(pool, sizeof(*parser)); - - parser->p = pool; - parser->doc = apr_pcalloc(pool, sizeof(*parser->doc)); - - parser->doc->namespaces = apr_array_make(pool, 5, sizeof(const char *)); - - /* ### is there a way to avoid hard-coding this? */ - apr_xml_insert_uri(parser->doc->namespaces, APR_KW_DAV); - - parser->xp = XML_ParserCreate(NULL); - if (parser->xp == NULL) { - (*apr_pool_abort_get(pool))(APR_ENOMEM); - return NULL; - } - - apr_pool_cleanup_register(pool, parser, cleanup_parser, - apr_pool_cleanup_null); - - XML_SetUserData(parser->xp, parser); - XML_SetElementHandler(parser->xp, start_handler, end_handler); - XML_SetCharacterDataHandler(parser->xp, cdata_handler); - - return parser; -} - -static apr_status_t do_parse(apr_xml_parser *parser, - const char *data, apr_size_t len, - int is_final) -{ - if (parser->xp == NULL) { - parser->error = APR_XML_ERROR_PARSE_DONE; - } - else { - int rv = XML_Parse(parser->xp, data, len, is_final); - - if (rv == 0) { - parser->error = APR_XML_ERROR_EXPAT; - parser->xp_err = XML_GetErrorCode(parser->xp); - } - } - - /* ### better error code? */ - return parser->error ? APR_EGENERAL : APR_SUCCESS; -} - -APU_DECLARE(apr_status_t) apr_xml_parser_feed(apr_xml_parser *parser, - const char *data, - apr_size_t len) -{ - return do_parse(parser, data, len, 0 /* is_final */); -} - -APU_DECLARE(apr_status_t) apr_xml_parser_done(apr_xml_parser *parser, - apr_xml_doc **pdoc) -{ - char end; - apr_status_t status = do_parse(parser, &end, 0, 1 /* is_final */); - - /* get rid of the parser */ - (void) apr_pool_cleanup_run(parser->p, parser, cleanup_parser); - - if (status) - return status; - - if (pdoc != NULL) - *pdoc = parser->doc; - return APR_SUCCESS; -} - -APU_DECLARE(char *) apr_xml_parser_geterror(apr_xml_parser *parser, - char *errbuf, - apr_size_t errbufsize) -{ - int error = parser->error; - const char *msg; - - /* clear our record of an error */ - parser->error = 0; - - switch (error) { - case 0: - msg = "No error."; - break; - - case APR_XML_NS_ERROR_UNKNOWN_PREFIX: - msg = "An undefined namespace prefix was used."; - break; - - case APR_XML_NS_ERROR_INVALID_DECL: - msg = "A namespace prefix was defined with an empty URI."; - break; - - case APR_XML_ERROR_EXPAT: - (void) apr_snprintf(errbuf, errbufsize, - "XML parser error code: %s (%d)", - XML_ErrorString(parser->xp_err), parser->xp_err); - return errbuf; - - case APR_XML_ERROR_PARSE_DONE: - msg = "The parser is not active."; - break; - - default: - msg = "There was an unknown error within the XML body."; - break; - } - - (void) apr_cpystrn(errbuf, msg, errbufsize); - return errbuf; -} - -APU_DECLARE(apr_status_t) apr_xml_parse_file(apr_pool_t *p, - apr_xml_parser **parser, - apr_xml_doc **ppdoc, - apr_file_t *xmlfd, - apr_size_t buffer_length) -{ - apr_status_t rv; - char *buffer; - apr_size_t length; - - *parser = apr_xml_parser_create(p); - if (*parser == NULL) { - /* FIXME: returning an error code would be nice, - * but we dont get one ;( */ - return APR_EGENERAL; - } - buffer = apr_palloc(p, buffer_length); - length = buffer_length; - - rv = apr_file_read(xmlfd, buffer, &length); - - while (rv == APR_SUCCESS) { - rv = apr_xml_parser_feed(*parser, buffer, length); - if (rv != APR_SUCCESS) { - return rv; - } - - length = buffer_length; - rv = apr_file_read(xmlfd, buffer, &length); - } - if (rv != APR_EOF) { - return rv; - } - rv = apr_xml_parser_done(*parser, ppdoc); - *parser = NULL; - return rv; -} - -APU_DECLARE(void) apr_text_append(apr_pool_t * p, apr_text_header *hdr, - const char *text) -{ - apr_text *t = apr_palloc(p, sizeof(*t)); - - t->text = text; - t->next = NULL; - - if (hdr->first == NULL) { - /* no text elements yet */ - hdr->first = hdr->last = t; - } - else { - /* append to the last text element */ - hdr->last->next = t; - hdr->last = t; - } -} - - -/* --------------------------------------------------------------- -** -** XML UTILITY FUNCTIONS -*/ - -/* -** apr_xml_quote_string: quote an XML string -** -** Replace '<', '>', and '&' with '<', '>', and '&'. -** If quotes is true, then replace '"' with '"'. -** -** quotes is typically set to true for XML strings that will occur within -** double quotes -- attribute values. -*/ -APU_DECLARE(const char *) apr_xml_quote_string(apr_pool_t *p, const char *s, - int quotes) -{ - const char *scan; - apr_size_t len = 0; - apr_size_t extra = 0; - char *qstr; - char *qscan; - char c; - - for (scan = s; (c = *scan) != '\0'; ++scan, ++len) { - if (c == '<' || c == '>') - extra += 3; /* < or > */ - else if (c == '&') - extra += 4; /* & */ - else if (quotes && c == '"') - extra += 5; /* " */ - } - - /* nothing to do? */ - if (extra == 0) - return s; - - qstr = apr_palloc(p, len + extra + 1); - for (scan = s, qscan = qstr; (c = *scan) != '\0'; ++scan) { - if (c == '<') { - *qscan++ = '&'; - *qscan++ = 'l'; - *qscan++ = 't'; - *qscan++ = ';'; - } - else if (c == '>') { - *qscan++ = '&'; - *qscan++ = 'g'; - *qscan++ = 't'; - *qscan++ = ';'; - } - else if (c == '&') { - *qscan++ = '&'; - *qscan++ = 'a'; - *qscan++ = 'm'; - *qscan++ = 'p'; - *qscan++ = ';'; - } - else if (quotes && c == '"') { - *qscan++ = '&'; - *qscan++ = 'q'; - *qscan++ = 'u'; - *qscan++ = 'o'; - *qscan++ = 't'; - *qscan++ = ';'; - } - else { - *qscan++ = c; - } - } - - *qscan = '\0'; - return qstr; -} - -/* how many characters for the given integer? */ -#define APR_XML_NS_LEN(ns) ((ns) < 10 ? 1 : (ns) < 100 ? 2 : (ns) < 1000 ? 3 : \ - (ns) < 10000 ? 4 : (ns) < 100000 ? 5 : \ - (ns) < 1000000 ? 6 : (ns) < 10000000 ? 7 : \ - (ns) < 100000000 ? 8 : (ns) < 1000000000 ? 9 : 10) - -static apr_size_t text_size(const apr_text *t) -{ - apr_size_t size = 0; - - for (; t; t = t->next) - size += strlen(t->text); - return size; -} - -static apr_size_t elem_size(const apr_xml_elem *elem, int style, - apr_array_header_t *namespaces, int *ns_map) -{ - apr_size_t size; - - if (style == APR_XML_X2T_FULL || style == APR_XML_X2T_FULL_NS_LANG) { - const apr_xml_attr *attr; - - size = 0; - - if (style == APR_XML_X2T_FULL_NS_LANG) { - int i; - - /* - ** The outer element will contain xmlns:ns%d="%s" attributes - ** and an xml:lang attribute, if applicable. - */ - - for (i = namespaces->nelts; i--;) { - /* compute size of: ' xmlns:ns%d="%s"' */ - size += (9 + APR_XML_NS_LEN(i) + 2 + - strlen(APR_XML_GET_URI_ITEM(namespaces, i)) + 1); - } - - if (elem->lang != NULL) { - /* compute size of: ' xml:lang="%s"' */ - size += 11 + strlen(elem->lang) + 1; - } - } - - if (elem->ns == APR_XML_NS_NONE) { - /* compute size of: <%s> */ - size += 1 + strlen(elem->name) + 1; - } - else { - int ns = ns_map ? ns_map[elem->ns] : elem->ns; - - /* compute size of: */ - size += 3 + APR_XML_NS_LEN(ns) + 1 + strlen(elem->name) + 1; - } - - if (APR_XML_ELEM_IS_EMPTY(elem)) { - /* insert a closing "/" */ - size += 1; - } - else { - /* - * two of above plus "/": - * ... - * OR <%s> ... - */ - size = 2 * size + 1; - } - - for (attr = elem->attr; attr; attr = attr->next) { - if (attr->ns == APR_XML_NS_NONE) { - /* compute size of: ' %s="%s"' */ - size += 1 + strlen(attr->name) + 2 + strlen(attr->value) + 1; - } - else { - /* compute size of: ' ns%d:%s="%s"' */ - size += 3 + APR_XML_NS_LEN(attr->ns) + 1 + strlen(attr->name) + 2 + strlen(attr->value) + 1; - } - } - - /* - ** If the element has an xml:lang value that is *different* from - ** its parent, then add the thing in: ' xml:lang="%s"'. - ** - ** NOTE: we take advantage of the pointer equality established by - ** the parsing for "inheriting" the xml:lang values from parents. - */ - if (elem->lang != NULL && - (elem->parent == NULL || elem->lang != elem->parent->lang)) { - size += 11 + strlen(elem->lang) + 1; - } - } - else if (style == APR_XML_X2T_LANG_INNER) { - /* - * This style prepends the xml:lang value plus a null terminator. - * If a lang value is not present, then we insert a null term. - */ - size = elem->lang ? strlen(elem->lang) + 1 : 1; - } - else - size = 0; - - size += text_size(elem->first_cdata.first); - - for (elem = elem->first_child; elem; elem = elem->next) { - /* the size of the child element plus the CDATA that follows it */ - size += (elem_size(elem, APR_XML_X2T_FULL, NULL, ns_map) + - text_size(elem->following_cdata.first)); - } - - return size; -} - -static char *write_text(char *s, const apr_text *t) -{ - for (; t; t = t->next) { - apr_size_t len = strlen(t->text); - memcpy(s, t->text, len); - s += len; - } - return s; -} - -static char *write_elem(char *s, const apr_xml_elem *elem, int style, - apr_array_header_t *namespaces, int *ns_map) -{ - const apr_xml_elem *child; - apr_size_t len; - int ns; - - if (style == APR_XML_X2T_FULL || style == APR_XML_X2T_FULL_NS_LANG) { - int empty = APR_XML_ELEM_IS_EMPTY(elem); - const apr_xml_attr *attr; - - if (elem->ns == APR_XML_NS_NONE) { - len = sprintf(s, "<%s", elem->name); - } - else { - ns = ns_map ? ns_map[elem->ns] : elem->ns; - len = sprintf(s, "name); - } - s += len; - - for (attr = elem->attr; attr; attr = attr->next) { - if (attr->ns == APR_XML_NS_NONE) - len = sprintf(s, " %s=\"%s\"", attr->name, attr->value); - else - len = sprintf(s, " ns%d:%s=\"%s\"", attr->ns, attr->name, attr->value); - s += len; - } - - /* add the xml:lang value if necessary */ - if (elem->lang != NULL && - (style == APR_XML_X2T_FULL_NS_LANG || - elem->parent == NULL || - elem->lang != elem->parent->lang)) { - len = sprintf(s, " xml:lang=\"%s\"", elem->lang); - s += len; - } - - /* add namespace definitions, if required */ - if (style == APR_XML_X2T_FULL_NS_LANG) { - int i; - - for (i = namespaces->nelts; i--;) { - len = sprintf(s, " xmlns:ns%d=\"%s\"", i, - APR_XML_GET_URI_ITEM(namespaces, i)); - s += len; - } - } - - /* no more to do. close it up and go. */ - if (empty) { - *s++ = '/'; - *s++ = '>'; - return s; - } - - /* just close it */ - *s++ = '>'; - } - else if (style == APR_XML_X2T_LANG_INNER) { - /* prepend the xml:lang value */ - if (elem->lang != NULL) { - len = strlen(elem->lang); - memcpy(s, elem->lang, len); - s += len; - } - *s++ = '\0'; - } - - s = write_text(s, elem->first_cdata.first); - - for (child = elem->first_child; child; child = child->next) { - s = write_elem(s, child, APR_XML_X2T_FULL, NULL, ns_map); - s = write_text(s, child->following_cdata.first); - } - - if (style == APR_XML_X2T_FULL || style == APR_XML_X2T_FULL_NS_LANG) { - if (elem->ns == APR_XML_NS_NONE) { - len = sprintf(s, "", elem->name); - } - else { - ns = ns_map ? ns_map[elem->ns] : elem->ns; - len = sprintf(s, "", ns, elem->name); - } - s += len; - } - - return s; -} - -APU_DECLARE(void) apr_xml_quote_elem(apr_pool_t *p, apr_xml_elem *elem) -{ - apr_text *scan_txt; - apr_xml_attr *scan_attr; - apr_xml_elem *scan_elem; - - /* convert the element's text */ - for (scan_txt = elem->first_cdata.first; - scan_txt != NULL; - scan_txt = scan_txt->next) { - scan_txt->text = apr_xml_quote_string(p, scan_txt->text, 0); - } - for (scan_txt = elem->following_cdata.first; - scan_txt != NULL; - scan_txt = scan_txt->next) { - scan_txt->text = apr_xml_quote_string(p, scan_txt->text, 0); - } - - /* convert the attribute values */ - for (scan_attr = elem->attr; - scan_attr != NULL; - scan_attr = scan_attr->next) { - scan_attr->value = apr_xml_quote_string(p, scan_attr->value, 1); - } - - /* convert the child elements */ - for (scan_elem = elem->first_child; - scan_elem != NULL; - scan_elem = scan_elem->next) { - apr_xml_quote_elem(p, scan_elem); - } -} - -/* convert an element to a text string */ -APU_DECLARE(void) apr_xml_to_text(apr_pool_t * p, const apr_xml_elem *elem, - int style, apr_array_header_t *namespaces, - int *ns_map, const char **pbuf, - apr_size_t *psize) -{ - /* get the exact size, plus a null terminator */ - apr_size_t size = elem_size(elem, style, namespaces, ns_map) + 1; - char *s = apr_palloc(p, size); - - (void) write_elem(s, elem, style, namespaces, ns_map); - s[size - 1] = '\0'; - - *pbuf = s; - if (psize) - *psize = size; -} - -APU_DECLARE(const char *) apr_xml_empty_elem(apr_pool_t * p, - const apr_xml_elem *elem) -{ - if (elem->ns == APR_XML_NS_NONE) { - /* - * The prefix (xml...) is already within the prop name, or - * the element simply has no prefix. - */ - return apr_psprintf(p, "<%s/>" DEBUG_CR, elem->name); - } - - return apr_psprintf(p, "" DEBUG_CR, elem->ns, elem->name); -} - -/* return the URI's (existing) index, or insert it and return a new index */ -APU_DECLARE(int) apr_xml_insert_uri(apr_array_header_t *uri_array, - const char *uri) -{ - int i; - const char **pelt; - - /* never insert an empty URI; this index is always APR_XML_NS_NONE */ - if (*uri == '\0') - return APR_XML_NS_NONE; - - for (i = uri_array->nelts; i--;) { - if (strcmp(uri, APR_XML_GET_URI_ITEM(uri_array, i)) == 0) - return i; - } - - pelt = apr_array_push(uri_array); - *pelt = uri; /* assume uri is const or in a pool */ - return uri_array->nelts - 1; -} - -/* convert the element to EBCDIC */ -#if APR_CHARSET_EBCDIC -static apr_status_t apr_xml_parser_convert_elem(apr_xml_elem *e, - apr_xlate_t *convset) -{ - apr_xml_attr *a; - apr_xml_elem *ec; - apr_text *t; - apr_size_t inbytes_left, outbytes_left; - apr_status_t status; - - inbytes_left = outbytes_left = strlen(e->name); - status = apr_xlate_conv_buffer(convset, e->name, &inbytes_left, (char *) e->name, &outbytes_left); - if (status) { - return status; - } - - for (t = e->first_cdata.first; t != NULL; t = t->next) { - inbytes_left = outbytes_left = strlen(t->text); - status = apr_xlate_conv_buffer(convset, t->text, &inbytes_left, (char *) t->text, &outbytes_left); - if (status) { - return status; - } - } - - for (t = e->following_cdata.first; t != NULL; t = t->next) { - inbytes_left = outbytes_left = strlen(t->text); - status = apr_xlate_conv_buffer(convset, t->text, &inbytes_left, (char *) t->text, &outbytes_left); - if (status) { - return status; - } - } - - for (a = e->attr; a != NULL; a = a->next) { - inbytes_left = outbytes_left = strlen(a->name); - status = apr_xlate_conv_buffer(convset, a->name, &inbytes_left, (char *) a->name, &outbytes_left); - if (status) { - return status; - } - inbytes_left = outbytes_left = strlen(a->value); - status = apr_xlate_conv_buffer(convset, a->value, &inbytes_left, (char *) a->value, &outbytes_left); - if (status) { - return status; - } - } - - for (ec = e->first_child; ec != NULL; ec = ec->next) { - status = apr_xml_parser_convert_elem(ec, convset); - if (status) { - return status; - } - } - return APR_SUCCESS; -} - -/* convert the whole document to EBCDIC */ -APU_DECLARE(apr_status_t) apr_xml_parser_convert_doc(apr_pool_t *pool, - apr_xml_doc *pdoc, - apr_xlate_t *convset) -{ - apr_status_t status; - /* Don't convert the namespaces: they are constant! */ - if (pdoc->namespaces != NULL) { - int i; - apr_array_header_t *namespaces; - namespaces = apr_array_make(pool, pdoc->namespaces->nelts, sizeof(const char *)); - if (namespaces == NULL) - return APR_ENOMEM; - for (i = 0; i < pdoc->namespaces->nelts; i++) { - apr_size_t inbytes_left, outbytes_left; - char *ptr = (char *) APR_XML_GET_URI_ITEM(pdoc->namespaces, i); - ptr = apr_pstrdup(pool, ptr); - if ( ptr == NULL) - return APR_ENOMEM; - inbytes_left = outbytes_left = strlen(ptr); - status = apr_xlate_conv_buffer(convset, ptr, &inbytes_left, ptr, &outbytes_left); - if (status) { - return status; - } - apr_xml_insert_uri(namespaces, ptr); - } - pdoc->namespaces = namespaces; - } - return apr_xml_parser_convert_elem(pdoc->root, convset); -} -#endif diff --git a/libs/apr-util/xml/expat/COPYING b/libs/apr-util/xml/expat/COPYING deleted file mode 100644 index fc97b02d90..0000000000 --- a/libs/apr-util/xml/expat/COPYING +++ /dev/null @@ -1,21 +0,0 @@ -Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - and Clark Cooper - -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. diff --git a/libs/apr-util/xml/expat/Makefile.in b/libs/apr-util/xml/expat/Makefile.in deleted file mode 100644 index aee7a354cc..0000000000 --- a/libs/apr-util/xml/expat/Makefile.in +++ /dev/null @@ -1,156 +0,0 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile -# -# Copyright 2000 Clark Cooper -# -# This file is part of EXPAT. -# -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. -# -# EXPAT 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 EXPAT. -# -# --- -# I started using automake, but -# 1) it seemed like overkill -# 2) I don't want all the GNU policies -# 3) I wanted more explicit control over what gets built -# -# So I'm doing my Makefile.in files manually. But a fair part is based -# on what I learned from perusing the Makefile.in's generated by automake, -# and the automake authors still get my kudos. -# - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -top_builddir = . - - -AUTOCONF = autoconf - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ - -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -host_alias = @host_alias@ -host_triplet = @host@ - -CC = @CC@ - -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -VERSION = @VERSION@ - -SUBDIRS = lib -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -CONFIG_HEADERS = config.h - -DISTDIR = $(PACKAGE)-$(VERSION) -DISTRIBUTION = $(DISTDIR).tar.gz - -all: build-subdirs - -.PHONY: all build-subdirs clean distclean extraclean maintainer-clean dist install \ - uninstall distdir - -Makefile: Makefile.in config.status - CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) config.status - -config.status: configure - @if test -f $@; then \ - $(SHELL) config.status --recheck ; \ - else \ - $(SHELL) configure ; \ - fi - -configure: configure.ac - $(AUTOCONF) - -config.h: config.h.in config.status - CONFIG_FILES= CONFIG_HEADERS=$(CONFIG_HEADERS) \ - $(SHELL) ./config.status - -build-subdirs: - @list='$(SUBDIRS)'; \ - for dir in $$list; do \ - cd $$dir; $(MAKE); cd ..; \ - done - -clean: - @list='$(SUBDIRS)'; for dir in $$list; do \ - cd $$dir; $(MAKE) clean; cd ..; \ - done - rm -f core *~ - -distclean: - @list='$(SUBDIRS)'; for dir in $$list; do \ - cd $$dir; $(MAKE) distclean; cd ..; \ - done - rm -f config.h config.status config.log libtool examples/Makefile xmlwf/Makefile Makefile - -extraclean: distclean - rm -f configure aclocal.m4 - -maintainer-clean: distclean - rm -f $(DISTRIBUTION) - rm -rf $(DISTDIR) - -distdir: MANIFEST - test -d $(DISTDIR) && rm -rf $(DISTDIR); \ - mkdir $(DISTDIR); \ - flist=`sed -e "s/[ ]:.*$$//" MANIFEST`; for file in $$flist; do \ - cp -P $$file $(DISTDIR); \ - done - -$(DISTRIBUTION): distdir - tar cfz $(DISTRIBUTION) $(DISTDIR) - -dist: $(DISTRIBUTION) - -install: - @list='$(SUBDIRS)'; for dir in $$list; do \ - cd $$dir; $(MAKE) install; cd ..; \ - done - -uninstall: - @list='$(SUBDIRS)'; for dir in $$list; do \ - cd $$dir; $(MAKE) uninstall; cd ..; \ - done - -depend: - echo SOMEONE SHOULD MAKE THIS DO SOMETHING!!! diff --git a/libs/apr-util/xml/expat/README b/libs/apr-util/xml/expat/README deleted file mode 100644 index 15bcdccb50..0000000000 --- a/libs/apr-util/xml/expat/README +++ /dev/null @@ -1,72 +0,0 @@ - - Expat, Release 1.95.2 - -This is expat, a C library for parsing XML, written by James Clark. -Expat is a stream-oriented XML parser. This means that you register -handlers with the parser before starting the parse. These handlers -are called when the parser discovers the associated structures in the -document being parsed. A start tag is an example of the kind of -structures for which you may register handlers. - -Windows users should use the expat_win32bin package, which includes -both precompiled libraries and executalbes, and source code for -developers. - -Expat is free software. You may copy, distribute, and modify it under -the terms of the License contained in the file COPYING distributed -with this package. This license is the same as the MIT/X Consortium -license. - -Versions of expat that have an odd minor version (the middle number in -the release above), are development releases and should be considered -as beta software. Releases with even minor version numbers are -intended to be production grade software. - -To build expat, you first run the configuration shell script in the -top level distribution directory: - - ./configure - -There are many options which you may provide to configure (which you -can discover by running configure with the --help option). But the -one of most interest is the one that sets the installation directory. -By default, the configure script will set things up to install -libexpat into /usr/local/lib, expat.h into /usr/local/include, and -xmlwf into /usr/local/bin. If, for example, you'd prefer to install -into /home/me/mystuff/lib, /home/me/mystuff/include, and -/home/me/mystuff/bin, you can tell configure about that with: - - ./configure --prefix=/home/me/mystuff - -After running the configure script, the "make" command will build -things and "make install" will install things into their proper -location. Note that you need to have write permission into the -directories into which things will be installed. - -When building for use with C++, you may need to add additional -compiler flags to support proper interaction with exceptions. This -can be done by setting the CFLAGS environment variable. For example, -when using GCC, you can use: - - CFLAGS=-fexceptions ./configure - -Note for Solaris users: The "ar" command is usually located in -"/usr/ccs/bin", which is not in the default PATH. You will need to -add this to your path for the "make" command, and probably also switch -to GNU make (the "make" found in /usr/ccs/bin does not seem to work -properly -- appearantly it does not understand .PHONY directives). If -you're using ksh or bash, use this command to build: - - PATH=/usr/ccs/bin:$PATH make - -A reference manual is available in the file doc/reference.html in this -distribution. - -The homepage for this project is http://expat.sourceforge.net/. There -are links there to connect you to the bug reports page. If you need -to report a bug when you don't have access to a browser, you may also -send a bug report by email to expat-bugs@lists.sourceforge.net. - -Discussion related to the direction of future expat development takes -place on expat-discuss@lists.sourceforge.net. Archives of this list -may be found at http://www.geocrawler.com/redir-sf.php3?list=expat-discuss. diff --git a/libs/apr-util/xml/expat/buildconf.sh b/libs/apr-util/xml/expat/buildconf.sh deleted file mode 100755 index 9050a0282a..0000000000 --- a/libs/apr-util/xml/expat/buildconf.sh +++ /dev/null @@ -1,77 +0,0 @@ -#! /bin/sh - -# -# Find libtoolize -# -libtoolize=`conftools/PrintPath glibtoolize libtoolize libtoolize15 libtoolize14` -if [ "x$libtoolize" = "x" ]; then - echo "libtoolize not found in path" - exit 1 -fi - -# -# Create the libtool helper files -# -# Note: we copy (rather than link) the files. -# -# Note: This bundled version of expat will not always replace the -# files since we have a special config.guess/config.sub that we -# want to ensure is used. -echo "Copying libtool helper files ..." - -# Remove any m4 cache and libtool files so one can switch between -# autoconf and libtool versions by simply rerunning the buildconf script. -# -(cd conftools ; rm -f ltconfig ltmain.sh) -rm -rf aclocal.m4 libtool.m4 ltsugar.m4 autom4te*.cache - -$libtoolize --copy --automake - -# -# find libtool.m4 -# -if [ ! -f libtool.m4 ]; then - ltpath=`dirname $libtoolize` - ltfile=${LIBTOOL_M4-`cd $ltpath/../share/aclocal ; pwd`/libtool.m4} - if [ -f $ltfile ]; then - echo "libtool.m4 found at $ltfile" - cp $ltfile libtool.m4 - else - echo "libtool.m4 not found - aborting!" - exit 1 - fi -fi - -# -# Build aclocal.m4 from libtool's m4 files -# -echo "dnl THIS FILE IS AUTOMATICALLY GENERATED BY buildconf.sh" > aclocal.m4 -echo "dnl edits here will be lost" >> aclocal.m4 - -for m4file in libtool.m4 ltsugar.m4 ltoptions.m4 ltversion.m4 lt~obsolete.m4 -do - if [ -f $m4file ]; then - echo "Incorporating $m4file into aclocal.m4 ..." - cat $m4file >> aclocal.m4 - rm -f $m4file - fi -done - -cross_compile_warning="warning: AC_TRY_RUN called without default to allow cross compiling" - -# -# Generate the autoconf header template (config.h.in) and ./configure -# -echo "Creating config.h.in ..." -${AUTOHEADER:-autoheader} 2>&1 | grep -v "$cross_compile_warning" - -echo "Creating configure ..." -${ACLOCAL:-aclocal} - -### do some work to toss config.cache? -${AUTOCONF:-autoconf} 2>&1 | grep -v "$cross_compile_warning" - -# Remove autoconf caches -rm -rf autom4te*.cache - -exit 0 diff --git a/libs/apr-util/xml/expat/configure.ac b/libs/apr-util/xml/expat/configure.ac deleted file mode 100644 index f808df4cce..0000000000 --- a/libs/apr-util/xml/expat/configure.ac +++ /dev/null @@ -1,120 +0,0 @@ -dnl configuration script for expat -dnl Process this file with autoconf to produce a configure script. -dnl -dnl Copyright 2000 Clark Cooper -dnl -dnl This file is part of EXPAT. -dnl -dnl EXPAT is free software; you can redistribute it and/or modify it -dnl under the terms of the License (based on the MIT/X license) contained -dnl in the file COPYING that comes with this distribution. -dnl - -AC_INIT(Makefile.in) -AC_CONFIG_AUX_DIR(conftools) -AC_CONFIG_MACRO_DIR(.) - -dnl -dnl Follow the GNU/Linux convention of odd number minor version for -dnl beta/development releases and even number minor version for stable -dnl releases. Edit is bumped with each release and set to 0 with -dnl change to major or minor version. -dnl - -EXPAT_MAJOR_VERSION=1 -EXPAT_MINOR_VERSION=95 -EXPAT_EDIT=2 - -EXPAT_VERSION=$EXPAT_MAJOR_VERSION.$EXPAT_MINOR_VERSION.$EXPAT_EDIT -VERSION=$EXPAT_VERSION -PACKAGE=expat - -dnl -dnl Increment LIBREVISION if source code has changed at all -dnl -dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0 -dnl -dnl If the API changes compatibly (i.e. simply adding a new function -dnl without changing or removing earlier interfaces), then increment LIBAGE. -dnl -dnl If the API changes incompatibly set LIBAGE back to 0 -dnl - -LIBCURRENT=1 -LIBREVISION=0 -LIBAGE=1 - -AC_CONFIG_HEADER(config.h) - -AC_CANONICAL_SYSTEM -case "$host_os" in -*os2*) - # Use a custom made libtool replacement - echo Using aplibtool - LIBTOOL="$srcdir/../../../apr/build/aplibtool" - ;; -*) - AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - ;; -esac - -blddir=`pwd` -AC_SUBST(blddir) - -AC_SUBST(PACKAGE) -AC_SUBST(VERSION) -AC_SUBST(EXPAT_MAJOR_VERSION) -AC_SUBST(EXPAT_MINOR_VERSION) -AC_SUBST(EXPAT_EDIT) - -AC_SUBST(LIBCURRENT) -AC_SUBST(LIBREVISION) -AC_SUBST(LIBAGE) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_INSTALL - -dnl Checks for libraries. - -dnl Checks for header files. -AC_HEADER_STDC -AC_CHECK_HEADERS(fcntl.h unistd.h string.h) - -dnl Checks for typedefs, structures, and compiler characteristics. -dnl check for endianness -if test "$cross_compiling" = "no"; then - AC_C_BIGENDIAN -else - AC_DEFINE(AP_UNKNOWN_BYTE_ORDER,1,[byte order is unknown due to cross-compilation]) -fi - -if test "$ac_cv_c_bigendian" = "yes"; then - AC_DEFINE(XML_BYTE_ORDER,21,[21 for big endian or 12 for little]) -else - AC_DEFINE(XML_BYTE_ORDER,12,[z]) -fi - -AC_DEFINE(XML_NS,,[Define me]) -AC_DEFINE(XML_DTD,,[Define me]) -AC_DEFINE(XML_CONTEXT_BYTES,1024,[1024]) - -AC_C_CONST -AC_TYPE_OFF_T -AC_TYPE_SIZE_T - -dnl Checks for library functions. - -AC_FUNC_MEMCMP -AC_FUNC_MMAP -AC_SUBST(FILEMAP_OBJ) -if test -z "$HAVE_MMAP"; then -FILEMAP_OBJ=unixfilemap.o -else -FILEMAP_OBJ=readfilemap.o -fi - -AC_CHECK_FUNCS(memmove bcopy) - -AC_OUTPUT(Makefile lib/Makefile lib/expat.h) diff --git a/libs/apr-util/xml/expat/conftools/PrintPath b/libs/apr-util/xml/expat/conftools/PrintPath deleted file mode 100755 index 68435f3744..0000000000 --- a/libs/apr-util/xml/expat/conftools/PrintPath +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -# Look for program[s] somewhere in $PATH. -# -# Options: -# -s -# Do not print out full pathname. (silent) -# -pPATHNAME -# Look in PATHNAME instead of $PATH -# -# Usage: -# PrintPath [-s] [-pPATHNAME] program [program ...] -# -# Initially written by Jim Jagielski for the Apache configuration mechanism -# (with kudos to Kernighan/Pike) -# -# This script falls under the Apache License. -# See http://www.apache.org/docs/LICENSE - -## -# Some "constants" -## -pathname=$PATH -echo="yes" - -## -# Find out what OS we are running for later on -## -os=`(uname) 2>/dev/null` - -## -# Parse command line -## -for args in $* -do - case $args in - -s ) echo="no" ;; - -p* ) pathname="`echo $args | sed 's/^..//'`" ;; - * ) programs="$programs $args" ;; - esac -done - -## -# Now we make the adjustments required for OS/2 and everyone -# else :) -# -# First of all, all OS/2 programs have the '.exe' extension. -# Next, we adjust PATH (or what was given to us as PATH) to -# be whitespace seperated directories. -# Finally, we try to determine the best flag to use for -# test/[] to look for an executable file. OS/2 just has '-r' -# but with other OSs, we do some funny stuff to check to see -# if test/[] knows about -x, which is the prefered flag. -## - -if [ "x$os" = "xOS/2" ] -then - ext=".exe" - pathname=`echo -E $pathname | - sed 's/^;/.;/ - s/;;/;.;/g - s/;$/;./ - s/;/ /g - s/\\\\/\\//g' ` - test_exec_flag="-r" -else - ext="" # No default extensions - pathname=`echo $pathname | - sed 's/^:/.:/ - s/::/:.:/g - s/:$/:./ - s/:/ /g' ` - # Here is how we test to see if test/[] can handle -x - testfile="pp.t.$$" - - cat > $testfile </dev/null`; then - test_exec_flag="-x" - else - test_exec_flag="-r" - fi - rm -f $testfile -fi - -for program in $programs -do - for path in $pathname - do - if [ $test_exec_flag $path/${program}${ext} ] && \ - [ ! -d $path/${program}${ext} ]; then - if [ "x$echo" = "xyes" ]; then - echo $path/${program}${ext} - fi - exit 0 - fi - -# Next try without extension (if one was used above) - if [ "x$ext" != "x" ]; then - if [ $test_exec_flag $path/${program} ] && \ - [ ! -d $path/${program} ]; then - if [ "x$echo" = "xyes" ]; then - echo $path/${program} - fi - exit 0 - fi - fi - done -done -exit 1 - diff --git a/libs/apr-util/xml/expat/conftools/config.guess b/libs/apr-util/xml/expat/conftools/config.guess deleted file mode 100755 index 1f5c50c0d1..0000000000 --- a/libs/apr-util/xml/expat/conftools/config.guess +++ /dev/null @@ -1,1420 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. - -timestamp='2014-03-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 -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception 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. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -# -# Please send patches with a ChangeLog entry to config-patches@gnu.org. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; 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) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - 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_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 -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - 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:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *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. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - 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 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - 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 ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - 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 - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - 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 ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - 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 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - 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 - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - 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 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - 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 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - 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 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - 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 ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - 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]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - 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 -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - 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 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - 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 ;; - 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 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - 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 ;; - 8664:Windows_NT:*) - echo x86_64-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 i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - 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/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - 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-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - 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 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - 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.[02]*:*) - 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 - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - 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 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - 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 i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - 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 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - 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; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { 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; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - 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; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - 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 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - 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 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - 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 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - 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 ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; -esac - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/libs/apr-util/xml/expat/conftools/config.sub b/libs/apr-util/xml/expat/conftools/config.sub deleted file mode 100755 index bba4efb805..0000000000 --- a/libs/apr-util/xml/expat/conftools/config.sub +++ /dev/null @@ -1,1799 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. - -timestamp='2014-09-11' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception 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. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches with a ChangeLog entry to config-patches@gnu.org. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2014 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -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/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -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/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | 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 \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | 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-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # 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) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | 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 - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - 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 - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - 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-*) - basic_machine=ns32k-pc532 - ;; - 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 | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-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 - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -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* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -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|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - 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 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/libs/apr-util/xml/expat/conftools/install-sh b/libs/apr-util/xml/expat/conftools/install-sh deleted file mode 100755 index e9de23842d..0000000000 --- a/libs/apr-util/xml/expat/conftools/install-sh +++ /dev/null @@ -1,251 +0,0 @@ -#!/bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5 (mit/util/scripts/install.sh). -# -# Copyright 1991 by the Massachusetts Institute of Technology -# -# Permission to use, copy, modify, distribute, and sell this software and its -# documentation for any purpose is hereby granted without fee, provided that -# the above copyright notice appear in all copies and that both that -# copyright notice and this permission notice appear in supporting -# documentation, and that the name of M.I.T. not be used in advertising or -# publicity pertaining to distribution of the software without specific, -# written prior permission. M.I.T. makes no representations about the -# suitability of this software for any purpose. It is provided "as is" -# without express or implied warranty. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - chmodcmd="" - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/libs/apr-util/xml/expat/conftools/missing b/libs/apr-util/xml/expat/conftools/missing deleted file mode 100755 index 8c9d99736f..0000000000 --- a/libs/apr-util/xml/expat/conftools/missing +++ /dev/null @@ -1,190 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. -# Copyright (C) 1996, 1997 Free Software Foundation, Inc. -# Franc,ois Pinard , 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, 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. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -case "$1" in - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - yacc create \`y.tab.[ch]', if possible, from existing .[ch]" - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing - GNU libit 0.0" - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - - aclocal) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acinclude.m4' or \`configure.ac'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`configure.ac'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`acconfig.h' or \`configure.ac'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' configure.ac` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`configure.ac'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is missing on your system. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file` - fi - touch $file - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and you do not seem to have it handy on your - system. You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequirements for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 diff --git a/libs/apr-util/xml/expat/conftools/mkinstalldirs b/libs/apr-util/xml/expat/conftools/mkinstalldirs deleted file mode 100755 index 25b7bd1a0f..0000000000 --- a/libs/apr-util/xml/expat/conftools/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -# $Id: mkinstalldirs 106501 2004-11-24 23:41:24Z nd $ - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/libs/apr-util/xml/expat/lib/Makefile.in b/libs/apr-util/xml/expat/lib/Makefile.in deleted file mode 100644 index b5e4b3def5..0000000000 --- a/libs/apr-util/xml/expat/lib/Makefile.in +++ /dev/null @@ -1,154 +0,0 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile -# -# Copyright 2000 Clark Cooper -# -# This file is part of EXPAT. -# -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. -# -# EXPAT 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 EXPAT. -# - - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -blddir = @blddir@/lib -bindir = @bindir@ -sbindir = @sbindir@ -libexecdir = @libexecdir@ -datadir = @datadir@ -sysconfdir = @sysconfdir@ -sharedstatedir = @sharedstatedir@ -localstatedir = @localstatedir@ -libdir = @libdir@ -infodir = @infodir@ -mandir = @mandir@ -includedir = @includedir@ -oldincludedir = /usr/include - -subdir = lib - -top_builddir = .. - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_DATA = @INSTALL_DATA@ - -host_alias = @host_alias@ -host_triplet = @host@ -AS = @AS@ -CC = @CC@ -DLLTOOL = @DLLTOOL@ -LIBTOOL = @LIBTOOL@ -LN_S = @LN_S@ -OBJDUMP = @OBJDUMP@ -PACKAGE = @PACKAGE@ -RANLIB = @RANLIB@ -VERSION = @VERSION@ - -LIBRARY = libexpat.la -SOURCES = xmlparse.c xmltok.c xmlrole.c -OBJECTS = $(SOURCES:.c=.o) -LTOBJECTS = $(SOURCES:.c=.lo) - -TEMPLATES = xmltok_impl.c xmltok_ns.c -APIHEADER = expat.h -HEADERS = ascii.h iasciitab.h utf8tab.h xmltok.h asciitab.h latin1tab.h \ - nametab.h xmldef.h xmlrole.h xmltok_impl.h - -mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs -CONFIG_HEADER = ../config.h -CONFIG_CLEAN_FILES = - -INCLUDES = -I$(srcdir) -I.. -I$(blddir) -DEFS = @DEFS@ -DPACKAGE='"$(PACKAGE)"' -DVERSION='"$(PACKAGE)_$(VERSION)"' - -CPPFLAGS = @CPPFLAGS@ -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -CFLAGS = @CFLAGS@ - -LIBREVISION = @LIBREVISION@ -LIBCURRENT = @LIBCURRENT@ -LIBAGE = @LIBAGE@ - -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -CCLD = $(CC) -LINK = $(LIBTOOL) --mode=link $(CCLD) -version-info $(LIBCURRENT):$(LIBREVISION):$(LIBAGE) $(CFLAGS) $(LDFLAGS) -o $@ -DIST_COMMON = Makefile.in - - -DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEMPLATES) $(APIHEADER) $(HEADERS) - -TAR = gtar -GZIP_ENV = --best - -all: $(LIBRARY) - -.SUFFIXES: .c .lo .o -.PHONY: all clean distclean maintainer-clean - -.c.o: - $(COMPILE) -c $< - -.c.lo: - $(LTCOMPILE) -c $< - -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - -$(top_builddir)/config.status: $(top_builddir)/configure - cd $(top_builddir) && $(MAKE) config.status - -$(top_builddir)/config.h: $(top_builddir)/config.h.in - cd $(top_builddir) && $(MAKE) config.h - -clean: - rm -f $(LIBRARY) *.o *.lo *~ - rm -rf .libs _libs - -distclean: clean - rm -f Makefile expat.h - -maintainer-clean: distclean - -install: $(LIBRARY) $(APIHEADER) - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) - $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY) - $(INSTALL_DATA) $(APIHEADER) $(DESTDIR)$(includedir) - -uninstall: - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY); - rm -f $(DESTDIR)$(libdir)/$(APIHEADER) - -$(LIBRARY): $(LTOBJECTS) - $(LINK) -rpath $(libdir) $(LDFLAGS) $(LTOBJECTS) - -xmlparse.o \ -xmlparse.lo: xmlparse.c expat.h xmlrole.h xmltok.h $(top_builddir)/config.h - -xmlrole.o \ -xmlrole.lo: xmlrole.c ascii.h xmlrole.h $(top_builddir)/config.h - -xmltok.o \ -xmltok.lo: xmltok.c xmltok_impl.c xmltok_ns.c \ - ascii.h asciitab.h iasciitab.h latin1tab.h nametab.h utf8tab.h \ - xmltok.h xmltok_impl.h $(top_builddir)/config.h diff --git a/libs/apr-util/xml/expat/lib/ascii.h b/libs/apr-util/xml/expat/lib/ascii.h deleted file mode 100644 index 6376b1f311..0000000000 --- a/libs/apr-util/xml/expat/lib/ascii.h +++ /dev/null @@ -1,86 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -#define ASCII_A 0x41 -#define ASCII_B 0x42 -#define ASCII_C 0x43 -#define ASCII_D 0x44 -#define ASCII_E 0x45 -#define ASCII_F 0x46 -#define ASCII_G 0x47 -#define ASCII_H 0x48 -#define ASCII_I 0x49 -#define ASCII_J 0x4A -#define ASCII_K 0x4B -#define ASCII_L 0x4C -#define ASCII_M 0x4D -#define ASCII_N 0x4E -#define ASCII_O 0x4F -#define ASCII_P 0x50 -#define ASCII_Q 0x51 -#define ASCII_R 0x52 -#define ASCII_S 0x53 -#define ASCII_T 0x54 -#define ASCII_U 0x55 -#define ASCII_V 0x56 -#define ASCII_W 0x57 -#define ASCII_X 0x58 -#define ASCII_Y 0x59 -#define ASCII_Z 0x5A - -#define ASCII_a 0x61 -#define ASCII_b 0x62 -#define ASCII_c 0x63 -#define ASCII_d 0x64 -#define ASCII_e 0x65 -#define ASCII_f 0x66 -#define ASCII_g 0x67 -#define ASCII_h 0x68 -#define ASCII_i 0x69 -#define ASCII_j 0x6A -#define ASCII_k 0x6B -#define ASCII_l 0x6C -#define ASCII_m 0x6D -#define ASCII_n 0x6E -#define ASCII_o 0x6F -#define ASCII_p 0x70 -#define ASCII_q 0x71 -#define ASCII_r 0x72 -#define ASCII_s 0x73 -#define ASCII_t 0x74 -#define ASCII_u 0x75 -#define ASCII_v 0x76 -#define ASCII_w 0x77 -#define ASCII_x 0x78 -#define ASCII_y 0x79 -#define ASCII_z 0x7A - -#define ASCII_0 0x30 -#define ASCII_1 0x31 -#define ASCII_2 0x32 -#define ASCII_3 0x33 -#define ASCII_4 0x34 -#define ASCII_5 0x35 -#define ASCII_6 0x36 -#define ASCII_7 0x37 -#define ASCII_8 0x38 -#define ASCII_9 0x39 - -#define ASCII_TAB 0x09 -#define ASCII_SPACE 0x20 -#define ASCII_EXCL 0x21 -#define ASCII_QUOT 0x22 -#define ASCII_AMP 0x26 -#define ASCII_APOS 0x27 -#define ASCII_MINUS 0x2D -#define ASCII_PERIOD 0x2E -#define ASCII_COLON 0x3A -#define ASCII_SEMI 0x3B -#define ASCII_LT 0x3C -#define ASCII_EQUALS 0x3D -#define ASCII_GT 0x3E -#define ASCII_LSQB 0x5B -#define ASCII_RSQB 0x5D -#define ASCII_UNDERSCORE 0x5F diff --git a/libs/apr-util/xml/expat/lib/asciitab.h b/libs/apr-util/xml/expat/lib/asciitab.h deleted file mode 100644 index eb445cc52c..0000000000 --- a/libs/apr-util/xml/expat/lib/asciitab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/libs/apr-util/xml/expat/lib/config.hnw b/libs/apr-util/xml/expat/lib/config.hnw deleted file mode 100644 index de129d343c..0000000000 --- a/libs/apr-util/xml/expat/lib/config.hnw +++ /dev/null @@ -1,23 +0,0 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) -** -** -*/ - -#ifndef CONFIG_HNW -#define CONFIG_HNW - -#include -#include - -#define XML_NS 1 -#define XML_DTD 1 -#define XML_BYTE_ORDER 12 -#define XML_CONTEXT_BYTES 1024 - -#endif /* ndef CONFIG_HNW */ diff --git a/libs/apr-util/xml/expat/lib/expat.dsp b/libs/apr-util/xml/expat/lib/expat.dsp deleted file mode 100644 index 3de22e9eb3..0000000000 --- a/libs/apr-util/xml/expat/lib/expat.dsp +++ /dev/null @@ -1,227 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expat" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=expat - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expat.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expat.mak" CFG="expat - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expat - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "expat - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expat - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /EHsc /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /EHsc /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /D "COMPILED_FROM_DSP" /Yu"stdafx.h" /FD /c -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /EHsc /Zi /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "expat - Win32 Release" -# Name "expat - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\xmlparse.c - -!IF "$(CFG)" == "expat - Win32 Release" - -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# ADD CPP /GX- /Od /D VERSION=\"expat_1.95.2\" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c - -!IF "$(CFG)" == "expat - Win32 Release" - -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c - -!IF "$(CFG)" == "expat - Win32 Release" - -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=xmltok_impl.c - -!IF "$(CFG)" == "expat - Win32 Release" - -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# PROP Exclude_From_Build 1 -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=xmltok_ns.c - -!IF "$(CFG)" == "expat - Win32 Release" - -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# PROP Exclude_From_Build 1 -# ADD CPP /D VERSION=\"expat_1.95.2\" - -!ENDIF - -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\config.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/libs/apr-util/xml/expat/lib/expat.h.in b/libs/apr-util/xml/expat/lib/expat.h.in deleted file mode 100644 index 9e440e2009..0000000000 --- a/libs/apr-util/xml/expat/lib/expat.h.in +++ /dev/null @@ -1,742 +0,0 @@ -/* -Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -#ifndef XmlParse_INCLUDED -#define XmlParse_INCLUDED 1 - -#include - -#ifndef XMLPARSEAPI -# if defined(__declspec) && !defined(__CYGWIN__) -# define XMLPARSEAPI __declspec(dllimport) -# else -# define XMLPARSEAPI /* nothing */ -# endif -#endif /* not defined XMLPARSEAPI */ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef void *XML_Parser; - -/* Information is UTF-8 encoded. */ -typedef char XML_Char; -typedef char XML_LChar; - -enum XML_Content_Type { - XML_CTYPE_EMPTY = 1, - XML_CTYPE_ANY, - XML_CTYPE_MIXED, - XML_CTYPE_NAME, - XML_CTYPE_CHOICE, - XML_CTYPE_SEQ -}; - -enum XML_Content_Quant { - XML_CQUANT_NONE, - XML_CQUANT_OPT, - XML_CQUANT_REP, - XML_CQUANT_PLUS -}; - -/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be - XML_CQUANT_NONE, and the other fields will be zero or NULL. - If type == XML_CTYPE_MIXED, then quant will be NONE or REP and - numchildren will contain number of elements that may be mixed in - and children point to an array of XML_Content cells that will be - all of XML_CTYPE_NAME type with no quantification. - - If type == XML_CTYPE_NAME, then the name points to the name, and - the numchildren field will be zero and children will be NULL. The - quant fields indicates any quantifiers placed on the name. - - CHOICE and SEQ will have name NULL, the number of children in - numchildren and children will point, recursively, to an array - of XML_Content cells. - - The EMPTY, ANY, and MIXED types will only occur at top level. -*/ - -typedef struct XML_cp XML_Content; - -struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - const XML_Char * name; - unsigned int numchildren; - XML_Content * children; -}; - - -/* This is called for an element declaration. See above for - description of the model argument. It's the caller's responsibility - to free model when finished with it. -*/ - -typedef void (*XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); - -void XMLPARSEAPI -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); - -/* - The Attlist declaration handler is called for *each* attribute. So - a single Attlist declaration with multiple attributes declared will - generate multiple calls to this handler. The "default" parameter - may be NULL in the case of the "#IMPLIED" or "#REQUIRED" keyword. - The "isrequired" parameter will be true and the default value will - be NULL in the case of "#REQUIRED". If "isrequired" is true and - default is non-NULL, then this is a "#FIXED" default. - */ - -typedef void (*XML_AttlistDeclHandler) (void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); - -void XMLPARSEAPI -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); - - - /* The XML declaration handler is called for *both* XML declarations and - text declarations. The way to distinguish is that the version parameter - will be null for text declarations. The encoding parameter may be null - for XML declarations. The standalone parameter will be -1, 0, or 1 - indicating respectively that there was no standalone parameter in - the declaration, that it was given as no, or that it was given as yes. - */ - -typedef void (*XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); - -void XMLPARSEAPI -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); - - -typedef struct { - void *(*malloc_fcn)(size_t size); - void *(*realloc_fcn)(void *ptr, size_t size); - void (*free_fcn)(void *ptr); -} XML_Memory_Handling_Suite; - -/* Constructs a new parser; encoding is the encoding specified by the -external protocol or null if there is none specified. */ - -XML_Parser XMLPARSEAPI -XML_ParserCreate(const XML_Char *encoding); - -/* Constructs a new parser and namespace processor. Element type -names and attribute names that belong to a namespace will be expanded; -unprefixed attribute names are never expanded; unprefixed element type -names are expanded only if there is a default namespace. The expanded -name is the concatenation of the namespace URI, the namespace -separator character, and the local part of the name. If the namespace -separator is '\0' then the namespace URI and the local part will be -concatenated without any separator. When a namespace is not declared, -the name and prefix will be passed through without expansion. */ - -XML_Parser XMLPARSEAPI -XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); - - -/* Constructs a new parser using the memory management suit referred to - by memsuite. If memsuite is NULL, then use the standard library memory - suite. If namespaceSeparator is non-NULL it creates a parser with - namespace processing as described above. The character pointed at - will serve as the namespace separator. - - All further memory operations used for the created parser will come from - the given suite. -*/ - -XML_Parser XMLPARSEAPI -XML_ParserCreate_MM(const XML_Char *encoding, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); - -/* atts is array of name/value pairs, terminated by 0; - names and values are 0 terminated. */ - -typedef void (*XML_StartElementHandler)(void *userData, - const XML_Char *name, - const XML_Char **atts); - -typedef void (*XML_EndElementHandler)(void *userData, - const XML_Char *name); - - -/* s is not 0 terminated. */ -typedef void (*XML_CharacterDataHandler)(void *userData, - const XML_Char *s, - int len); - -/* target and data are 0 terminated */ -typedef void (*XML_ProcessingInstructionHandler)(void *userData, - const XML_Char *target, - const XML_Char *data); - -/* data is 0 terminated */ -typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data); - -typedef void (*XML_StartCdataSectionHandler)(void *userData); -typedef void (*XML_EndCdataSectionHandler)(void *userData); - -/* This is called for any characters in the XML document for -which there is no applicable handler. This includes both -characters that are part of markup which is of a kind that is -not reported (comments, markup declarations), or characters -that are part of a construct which could be reported but -for which no handler has been supplied. The characters are passed -exactly as they were in the XML document except that -they will be encoded in UTF-8. Line boundaries are not normalized. -Note that a byte order mark character is not passed to the default handler. -There are no guarantees about how characters are divided between calls -to the default handler: for example, a comment might be split between -multiple calls. */ - -typedef void (*XML_DefaultHandler)(void *userData, - const XML_Char *s, - int len); - -/* This is called for the start of the DOCTYPE declaration, before - any DTD or internal subset is parsed. */ - -typedef void (*XML_StartDoctypeDeclHandler)(void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset - ); - -/* This is called for the start of the DOCTYPE declaration when the -closing > is encountered, but after processing any external subset. */ -typedef void (*XML_EndDoctypeDeclHandler)(void *userData); - -/* This is called for entity declarations. The is_parameter_entity - argument will be non-zero if the entity is a parameter entity, zero - otherwise. - - For internal entities (), value will - be non-null and systemId, publicID, and notationName will be null. - The value string is NOT null terminated; the length is provided in - the value_length argument. Since it is legal to have zero-length - values, do not use this argument to test for internal entities. - - For external entities, value will be null and systemId will be non-null. - The publicId argument will be null unless a public identifier was - provided. The notationName argument will have a non-null value only - for unparsed entity declarations. -*/ - -typedef void (*XML_EntityDeclHandler) (void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -void XMLPARSEAPI -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); - -/* OBSOLETE -- OBSOLETE -- OBSOLETE - This handler has been superceded by the EntityDeclHandler above. - It is provided here for backward compatibility. -This is called for a declaration of an unparsed (NDATA) -entity. The base argument is whatever was set by XML_SetBase. -The entityName, systemId and notationName arguments will never be null. -The other arguments may be. */ - -typedef void (*XML_UnparsedEntityDeclHandler)(void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -/* This is called for a declaration of notation. -The base argument is whatever was set by XML_SetBase. -The notationName will never be null. The other arguments can be. */ - -typedef void (*XML_NotationDeclHandler)(void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* When namespace processing is enabled, these are called once for -each namespace declaration. The call to the start and end element -handlers occur between the calls to the start and end namespace -declaration handlers. For an xmlns attribute, prefix will be null. -For an xmlns="" attribute, uri will be null. */ - -typedef void (*XML_StartNamespaceDeclHandler)(void *userData, - const XML_Char *prefix, - const XML_Char *uri); - -typedef void (*XML_EndNamespaceDeclHandler)(void *userData, - const XML_Char *prefix); - -/* This is called if the document is not standalone (it has an -external subset or a reference to a parameter entity, but does not -have standalone="yes"). If this handler returns 0, then processing -will not continue, and the parser will return a -XML_ERROR_NOT_STANDALONE error. */ - -typedef int (*XML_NotStandaloneHandler)(void *userData); - -/* This is called for a reference to an external parsed general entity. -The referenced entity is not automatically parsed. -The application can parse it immediately or later using -XML_ExternalEntityParserCreate. -The parser argument is the parser parsing the entity containing the reference; -it can be passed as the parser argument to XML_ExternalEntityParserCreate. -The systemId argument is the system identifier as specified in the entity -declaration; it will not be null. -The base argument is the system identifier that should be used as the base for -resolving systemId if systemId was relative; this is set by XML_SetBase; -it may be null. -The publicId argument is the public identifier as specified in the entity -declaration, or null if none was specified; the whitespace in the public -identifier will have been normalized as required by the XML spec. -The context argument specifies the parsing context in the format -expected by the context argument to -XML_ExternalEntityParserCreate; context is valid only until the handler -returns, so if the referenced entity is to be parsed later, it must be copied. -The handler should return 0 if processing should not continue because of -a fatal error in the handling of the external entity. -In this case the calling parser will return an -XML_ERROR_EXTERNAL_ENTITY_HANDLING error. -Note that unlike other handlers the first argument is the parser, not -userData. */ - -typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* This structure is filled in by the XML_UnknownEncodingHandler -to provide information to the parser about encodings that are unknown -to the parser. -The map[b] member gives information about byte sequences -whose first byte is b. -If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar -value c. -If map[b] is -1, then the byte sequence is malformed. -If map[b] is -n, where n >= 2, then b is the first byte of an n-byte -sequence that encodes a single Unicode scalar value. -The data member will be passed as the first argument to the convert function. -The convert function is used to convert multibyte sequences; -s will point to a n-byte sequence where map[(unsigned char)*s] == -n. -The convert function must return the Unicode scalar value -represented by this byte sequence or -1 if the byte sequence is malformed. -The convert function may be null if the encoding is a single-byte encoding, -that is if map[b] >= -1 for all bytes b. -When the parser is finished with the encoding, then if release is not null, -it will call release passing it the data member; -once release has been called, the convert function will not be called again. - -Expat places certain restrictions on the encodings that are supported -using this mechanism. - -1. Every ASCII character that can appear in a well-formed XML document, -other than the characters - - $@\^`{}~ - -must be represented by a single byte, and that byte must be the -same byte that represents that character in ASCII. - -2. No character may require more than 4 bytes to encode. - -3. All characters encoded must have Unicode scalar values <= 0xFFFF, -(ie characters that would be encoded by surrogates in UTF-16 -are not allowed). Note that this restriction doesn't apply to -the built-in support for UTF-8 and UTF-16. - -4. No Unicode character may be encoded by more than one distinct sequence -of bytes. */ - -typedef struct { - int map[256]; - void *data; - int (*convert)(void *data, const char *s); - void (*release)(void *data); -} XML_Encoding; - -/* This is called for an encoding that is unknown to the parser. -The encodingHandlerData argument is that which was passed as the -second argument to XML_SetUnknownEncodingHandler. -The name argument gives the name of the encoding as specified in -the encoding declaration. -If the callback can provide information about the encoding, -it must fill in the XML_Encoding structure, and return 1. -Otherwise it must return 0. -If info does not describe a suitable encoding, -then the parser will return an XML_UNKNOWN_ENCODING error. */ - -typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); - -void XMLPARSEAPI -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end); - -void XMLPARSEAPI -XML_SetStartElementHandler(XML_Parser, XML_StartElementHandler); - -void XMLPARSEAPI -XML_SetEndElementHandler(XML_Parser, XML_EndElementHandler); - -void XMLPARSEAPI -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler); - -void XMLPARSEAPI -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler); -void XMLPARSEAPI -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); - -void XMLPARSEAPI -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end); - -void XMLPARSEAPI -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start); - -void XMLPARSEAPI -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end); - -/* This sets the default handler and also inhibits expansion of -internal entities. The entity reference will be passed to the default -handler. */ - -void XMLPARSEAPI -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); - -/* This sets the default handler but does not inhibit expansion of -internal entities. The entity reference will not be passed to the -default handler. */ - -void XMLPARSEAPI -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); - -void XMLPARSEAPI -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end); - -void XMLPARSEAPI -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start); - -void XMLPARSEAPI -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); - -void XMLPARSEAPI -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler); - -void XMLPARSEAPI -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); - -void XMLPARSEAPI -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); - -void XMLPARSEAPI -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start); - -void XMLPARSEAPI -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end); - -void XMLPARSEAPI -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler); - -void XMLPARSEAPI -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler); - -/* If a non-null value for arg is specified here, then it will be passed -as the first argument to the external entity ref handler instead -of the parser object. */ -void XMLPARSEAPI -XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg); - -void XMLPARSEAPI -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *encodingHandlerData); - -/* This can be called within a handler for a start element, end element, -processing instruction or character data. It causes the corresponding -markup to be passed to the default handler. */ -void XMLPARSEAPI -XML_DefaultCurrent(XML_Parser parser); - -/* If do_nst is non-zero, and namespace processing is in effect, and - a name has a prefix (i.e. an explicit namespace qualifier) then - that name is returned as a triplet in a single - string separated by the separator character specified when the parser - was created: URI + sep + local_name + sep + prefix. - - If do_nst is zero, then namespace information is returned in the - default manner (URI + sep + local_name) whether or not the names - has a prefix. -*/ - -void XMLPARSEAPI -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); - -/* This value is passed as the userData argument to callbacks. */ -void XMLPARSEAPI -XML_SetUserData(XML_Parser parser, void *userData); - -/* Returns the last value set by XML_SetUserData or null. */ -#define XML_GetUserData(parser) (*(void **)(parser)) - -/* This is equivalent to supplying an encoding argument -to XML_ParserCreate. It must not be called after XML_Parse -or XML_ParseBuffer. */ - -int XMLPARSEAPI -XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); - -/* If this function is called, then the parser will be passed -as the first argument to callbacks instead of userData. -The userData will still be accessible using XML_GetUserData. */ - -void XMLPARSEAPI -XML_UseParserAsHandlerArg(XML_Parser parser); - -/* Sets the base to be used for resolving relative URIs in system -identifiers in declarations. Resolving relative identifiers is left -to the application: this value will be passed through as the base -argument to the XML_ExternalEntityRefHandler, XML_NotationDeclHandler -and XML_UnparsedEntityDeclHandler. The base argument will be copied. -Returns zero if out of memory, non-zero otherwise. */ - -int XMLPARSEAPI -XML_SetBase(XML_Parser parser, const XML_Char *base); - -const XML_Char XMLPARSEAPI * -XML_GetBase(XML_Parser parser); - -/* Returns the number of the attribute/value pairs passed in last call -to the XML_StartElementHandler that were specified in the start-tag -rather than defaulted. Each attribute/value pair counts as 2; thus -this correspondds to an index into the atts array passed to the -XML_StartElementHandler. */ - -int XMLPARSEAPI -XML_GetSpecifiedAttributeCount(XML_Parser parser); - -/* Returns the index of the ID attribute passed in the last call to -XML_StartElementHandler, or -1 if there is no ID attribute. Each -attribute/value pair counts as 2; thus this correspondds to an index -into the atts array passed to the XML_StartElementHandler. */ - -int XMLPARSEAPI -XML_GetIdAttributeIndex(XML_Parser parser); - -/* Parses some input. Returns 0 if a fatal error is detected. -The last call to XML_Parse must have isFinal true; -len may be zero for this call (or any other). */ -int XMLPARSEAPI -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); - -void XMLPARSEAPI * -XML_GetBuffer(XML_Parser parser, int len); - -int XMLPARSEAPI -XML_ParseBuffer(XML_Parser parser, int len, int isFinal); - -/* Creates an XML_Parser object that can parse an external general -entity; context is a '\0'-terminated string specifying the parse -context; encoding is a '\0'-terminated string giving the name of the -externally specified encoding, or null if there is no externally -specified encoding. The context string consists of a sequence of -tokens separated by formfeeds (\f); a token consisting of a name -specifies that the general entity of the name is open; a token of the -form prefix=uri specifies the namespace for a particular prefix; a -token of the form =uri specifies the default namespace. This can be -called at any point after the first call to an -ExternalEntityRefHandler so longer as the parser has not yet been -freed. The new parser is completely independent and may safely be -used in a separate thread. The handlers and userData are initialized -from the parser argument. Returns 0 if out of memory. Otherwise -returns a new XML_Parser object. */ -XML_Parser XMLPARSEAPI -XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, - const XML_Char *encoding); - -enum XML_ParamEntityParsing { - XML_PARAM_ENTITY_PARSING_NEVER, - XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, - XML_PARAM_ENTITY_PARSING_ALWAYS -}; - -/* Controls parsing of parameter entities (including the external DTD -subset). If parsing of parameter entities is enabled, then references -to external parameter entities (including the external DTD subset) -will be passed to the handler set with -XML_SetExternalEntityRefHandler. The context passed will be 0. -Unlike external general entities, external parameter entities can only -be parsed synchronously. If the external parameter entity is to be -parsed, it must be parsed during the call to the external entity ref -handler: the complete sequence of XML_ExternalEntityParserCreate, -XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during -this call. After XML_ExternalEntityParserCreate has been called to -create the parser for the external parameter entity (context must be 0 -for this call), it is illegal to make any calls on the old parser -until XML_ParserFree has been called on the newly created parser. If -the library has been compiled without support for parameter entity -parsing (ie without XML_DTD being defined), then -XML_SetParamEntityParsing will return 0 if parsing of parameter -entities is requested; otherwise it will return non-zero. */ - -int XMLPARSEAPI -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing); - -enum XML_Error { - XML_ERROR_NONE, - XML_ERROR_NO_MEMORY, - XML_ERROR_SYNTAX, - XML_ERROR_NO_ELEMENTS, - XML_ERROR_INVALID_TOKEN, - XML_ERROR_UNCLOSED_TOKEN, - XML_ERROR_PARTIAL_CHAR, - XML_ERROR_TAG_MISMATCH, - XML_ERROR_DUPLICATE_ATTRIBUTE, - XML_ERROR_JUNK_AFTER_DOC_ELEMENT, - XML_ERROR_PARAM_ENTITY_REF, - XML_ERROR_UNDEFINED_ENTITY, - XML_ERROR_RECURSIVE_ENTITY_REF, - XML_ERROR_ASYNC_ENTITY, - XML_ERROR_BAD_CHAR_REF, - XML_ERROR_BINARY_ENTITY_REF, - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, - XML_ERROR_MISPLACED_XML_PI, - XML_ERROR_UNKNOWN_ENCODING, - XML_ERROR_INCORRECT_ENCODING, - XML_ERROR_UNCLOSED_CDATA_SECTION, - XML_ERROR_EXTERNAL_ENTITY_HANDLING, - XML_ERROR_NOT_STANDALONE, - XML_ERROR_UNEXPECTED_STATE -}; - -/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode -returns information about the error. */ - -enum XML_Error XMLPARSEAPI -XML_GetErrorCode(XML_Parser parser); - -/* These functions return information about the current parse location. -They may be called when XML_Parse or XML_ParseBuffer return 0; -in this case the location is the location of the character at which -the error was detected. -They may also be called from any other callback called to report -some parse event; in this the location is the location of the first -of the sequence of characters that generated the event. */ - -int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser); -int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser); -long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser); - -/* Return the number of bytes in the current event. -Returns 0 if the event is in an internal entity. */ - -int XMLPARSEAPI -XML_GetCurrentByteCount(XML_Parser parser); - -/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets - the integer pointed to by offset to the offset within this buffer - of the current parse position, and sets the integer pointed to by size - to the size of this buffer (the number of input bytes). Otherwise - returns a null pointer. Also returns a null pointer if a parse isn't - active. - - NOTE: The character pointer returned should not be used outside - the handler that makes the call. */ - -const char XMLPARSEAPI * -XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); - -/* For backwards compatibility with previous versions. */ -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber -#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex - -/* Frees memory used by the parser. */ -void XMLPARSEAPI -XML_ParserFree(XML_Parser parser); - -/* Returns a string describing the error. */ -const XML_LChar XMLPARSEAPI * -XML_ErrorString(int code); - -/* Return a string containing the version number of this expat */ -const XML_LChar XMLPARSEAPI * -XML_ExpatVersion(void); - -typedef struct { - int major; - int minor; - int micro; -} XML_Expat_Version; - -/* Return an XML_Expat_Version structure containing numeric version - number information for this version of expat */ - -XML_Expat_Version XMLPARSEAPI -XML_ExpatVersionInfo(void); - -#ifndef XML_MAJOR_VERSION -#define XML_MAJOR_VERSION 1 -#endif -#ifndef XML_MINOR_VERSION -#define XML_MINOR_VERSION 95 -#endif -#ifndef XML_MICRO_VERSION -#define XML_MICRO_VERSION 2 -#endif - -#ifdef __cplusplus -} -#endif - -#endif /* not XmlParse_INCLUDED */ diff --git a/libs/apr-util/xml/expat/lib/iasciitab.h b/libs/apr-util/xml/expat/lib/iasciitab.h deleted file mode 100644 index 55dbc398b8..0000000000 --- a/libs/apr-util/xml/expat/lib/iasciitab.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/libs/apr-util/xml/expat/lib/latin1tab.h b/libs/apr-util/xml/expat/lib/latin1tab.h deleted file mode 100644 index 178b1d186d..0000000000 --- a/libs/apr-util/xml/expat/lib/latin1tab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, -/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, diff --git a/libs/apr-util/xml/expat/lib/map_osd_ebcdic_df04_1.h b/libs/apr-util/xml/expat/lib/map_osd_ebcdic_df04_1.h deleted file mode 100644 index 93ece0c887..0000000000 --- a/libs/apr-util/xml/expat/lib/map_osd_ebcdic_df04_1.h +++ /dev/null @@ -1,18 +0,0 @@ -static unsigned char ebcdic[] = { -/* 00 */ 0x00 ,0x01 ,0x02 ,0x03 ,0x85 ,0x09 ,0x86 ,0x7f ,0x87 ,0x8d ,0x8e ,0x0b ,0x0c ,0x0d ,0x0e ,0x0f , -/* 10 */ 0x10 ,0x11 ,0x12 ,0x13 ,0x8f ,0x0a ,0x08 ,0x97 ,0x18 ,0x19 ,0x9c ,0x9d ,0x1c ,0x1d ,0x1e ,0x1f , -/* 20 */ 0x80 ,0x81 ,0x82 ,0x83 ,0x84 ,0x92 ,0x17 ,0x1b ,0x88 ,0x89 ,0x8a ,0x8b ,0x8c ,0x05 ,0x06 ,0x07 , -/* 30 */ 0x90 ,0x91 ,0x16 ,0x93 ,0x94 ,0x95 ,0x96 ,0x04 ,0x98 ,0x99 ,0x9a ,0x9b ,0x14 ,0x15 ,0x9e ,0x1a , -/* 40 */ 0x20 ,0xa0 ,0xe2 ,0xe4 ,0xe0 ,0xe1 ,0xe3 ,0xe5 ,0xe7 ,0xf1 ,0x60 ,0x2e ,0x3c ,0x28 ,0x2b ,0x7c , -/* 50 */ 0x26 ,0xe9 ,0xea ,0xeb ,0xe8 ,0xed ,0xee ,0xef ,0xec ,0xdf ,0x21 ,0x24 ,0x2a ,0x29 ,0x3b ,0x9f , -/* 60 */ 0x2d ,0x2f ,0xc2 ,0xc4 ,0xc0 ,0xc1 ,0xc3 ,0xc5 ,0xc7 ,0xd1 ,0x5e ,0x2c ,0x25 ,0x5f ,0x3e ,0x3f , -/* 70 */ 0xf8 ,0xc9 ,0xca ,0xcb ,0xc8 ,0xcd ,0xce ,0xcf ,0xcc ,0xa8 ,0x3a ,0x23 ,0x40 ,0x27 ,0x3d ,0x22 , -/* 80 */ 0xd8 ,0x61 ,0x62 ,0x63 ,0x64 ,0x65 ,0x66 ,0x67 ,0x68 ,0x69 ,0xab ,0xbb ,0xf0 ,0xfd ,0xfe ,0xb1 , -/* 90 */ 0xb0 ,0x6a ,0x6b ,0x6c ,0x6d ,0x6e ,0x6f ,0x70 ,0x71 ,0x72 ,0xaa ,0xba ,0xe6 ,0xb8 ,0xc6 ,0xa4 , -/* a0 */ 0xb5 ,0xaf ,0x73 ,0x74 ,0x75 ,0x76 ,0x77 ,0x78 ,0x79 ,0x7a ,0xa1 ,0xbf ,0xd0 ,0xdd ,0xde ,0xae , -/* b0 */ 0xa2 ,0xa3 ,0xa5 ,0xb7 ,0xa9 ,0xa7 ,0xb6 ,0xbc ,0xbd ,0xbe ,0xac ,0x5b ,0x5c ,0x5d ,0xb4 ,0xd7 , -/* c0 */ 0xf9 ,0x41 ,0x42 ,0x43 ,0x44 ,0x45 ,0x46 ,0x47 ,0x48 ,0x49 ,0xad ,0xf4 ,0xf6 ,0xf2 ,0xf3 ,0xf5 , -/* d0 */ 0xa6 ,0x4a ,0x4b ,0x4c ,0x4d ,0x4e ,0x4f ,0x50 ,0x51 ,0x52 ,0xb9 ,0xfb ,0xfc ,0xdb ,0xfa ,0xff , -/* e0 */ 0xd9 ,0xf7 ,0x53 ,0x54 ,0x55 ,0x56 ,0x57 ,0x58 ,0x59 ,0x5a ,0xb2 ,0xd4 ,0xd6 ,0xd2 ,0xd3 ,0xd5 , -/* f0 */ 0x30 ,0x31 ,0x32 ,0x33 ,0x34 ,0x35 ,0x36 ,0x37 ,0x38 ,0x39 ,0xb3 ,0x7b ,0xdc ,0x7d ,0xda ,0x7e -}; diff --git a/libs/apr-util/xml/expat/lib/nametab.h b/libs/apr-util/xml/expat/lib/nametab.h deleted file mode 100644 index b05e62c77a..0000000000 --- a/libs/apr-util/xml/expat/lib/nametab.h +++ /dev/null @@ -1,150 +0,0 @@ -static const unsigned namingBitmap[] = { -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, -0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, -0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, -0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, -0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, -0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, -0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, -0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, -0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, -0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, -0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, -0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, -0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, -0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, -0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, -0x40000000, 0xF580C900, 0x00000007, 0x02010800, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, -0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, -0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, -0x00000000, 0x00004C40, 0x00000000, 0x00000000, -0x00000007, 0x00000000, 0x00000000, 0x00000000, -0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, -0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, -0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, -0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, -0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, -0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, -0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, -0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, -0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, -0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, -0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, -0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, -0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, -0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, -0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, -0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, -0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, -0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, -}; -static const unsigned char nmstrtPages[] = { -0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, -0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -static const unsigned char namePages[] = { -0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, -0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; diff --git a/libs/apr-util/xml/expat/lib/osd_ebcdic_df04_1.h b/libs/apr-util/xml/expat/lib/osd_ebcdic_df04_1.h deleted file mode 100644 index 968256ba2b..0000000000 --- a/libs/apr-util/xml/expat/lib/osd_ebcdic_df04_1.h +++ /dev/null @@ -1,81 +0,0 @@ -/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as - * applicable. - * - * 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. - */ -/* Table for the OSD_EBCDIC_DF04_1 encoding */ - -/* 00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 04 */ BT_OTHER, BT_S, BT_OTHER, BT_OTHER, -/* 08 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_NONXML, -/* 0c */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, -/* 10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 14 */ BT_OTHER, BT_LF, BT_NONXML, BT_OTHER, -/* 18 */ BT_NONXML, BT_NONXML, BT_OTHER, BT_OTHER, -/* 1c */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 20 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 24 */ BT_OTHER, BT_OTHER, BT_NONXML, BT_NONXML, -/* 28 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 2c */ BT_OTHER, BT_NONXML, BT_NONXML, BT_NONXML, -/* 30 */ BT_OTHER, BT_OTHER, BT_NONXML, BT_OTHER, -/* 34 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_NONXML, -/* 38 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 3c */ BT_NONXML, BT_NONXML, BT_OTHER, BT_NONXML, -/* 40 */ BT_S, BT_OTHER, BT_NMSTRT, BT_NMSTRT, -/* 44 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 48 */ BT_NMSTRT, BT_NMSTRT, BT_OTHER, BT_NAME, -/* 4c */ BT_LT, BT_LPAR, BT_PLUS, BT_VERBAR, -/* 50 */ BT_AMP, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 58 */ BT_NMSTRT, BT_NMSTRT, BT_EXCL, BT_OTHER, -/* 5c */ BT_AST, BT_RPAR, BT_SEMI, BT_OTHER, -/* 60 */ BT_MINUS, BT_SOL, BT_NMSTRT, BT_NMSTRT, -/* 64 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 68 */ BT_NMSTRT, BT_NMSTRT, BT_OTHER, BT_COMMA, -/* 6c */ BT_PERCNT, BT_NMSTRT, BT_GT, BT_QUEST, -/* 70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 78 */ BT_NMSTRT, BT_OTHER, BT_COLON, BT_NUM, -/* 7c */ BT_OTHER, BT_APOS, BT_EQUALS, BT_QUOT, -/* 80 */ BT_NMSTRT, BT_HEX, BT_HEX, BT_HEX, -/* 84 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 88 */ BT_NMSTRT, BT_NMSTRT, BT_OTHER, BT_OTHER, -/* 8c */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 90 */ BT_OTHER, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 94 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 98 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 9c */ BT_NMSTRT, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* a0 */ BT_NMSTRT, BT_OTHER, BT_NMSTRT, BT_NMSTRT, -/* a4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* a8 */ BT_NMSTRT, BT_NMSTRT, BT_OTHER, BT_OTHER, -/* ac */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* b0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_NAME, -/* b4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* b8 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_LSQB, -/* bc */ BT_OTHER, BT_RSQB, BT_OTHER, BT_OTHER, -/* c0 */ BT_NMSTRT, BT_HEX, BT_HEX, BT_HEX, -/* c4 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* c8 */ BT_NMSTRT, BT_NMSTRT, BT_OTHER, BT_NMSTRT, -/* cc */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* d0 */ BT_OTHER, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* d4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* d8 */ BT_NMSTRT, BT_NMSTRT, BT_OTHER, BT_NMSTRT, -/* dc */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* e0 */ BT_NMSTRT, BT_OTHER, BT_NMSTRT, BT_NMSTRT, -/* e4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* e8 */ BT_NMSTRT, BT_NMSTRT, BT_OTHER, BT_NMSTRT, -/* ec */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* f0 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* f4 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* f8 */ BT_DIGIT, BT_DIGIT, BT_OTHER, BT_OTHER, -/* fc */ BT_NMSTRT, BT_OTHER, BT_NMSTRT, BT_OTHER, diff --git a/libs/apr-util/xml/expat/lib/utf8tab.h b/libs/apr-util/xml/expat/lib/utf8tab.h deleted file mode 100644 index 9e3b6b83eb..0000000000 --- a/libs/apr-util/xml/expat/lib/utf8tab.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - - -/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, -/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, diff --git a/libs/apr-util/xml/expat/lib/winconfig.h b/libs/apr-util/xml/expat/lib/winconfig.h deleted file mode 100644 index 602ea94111..0000000000 --- a/libs/apr-util/xml/expat/lib/winconfig.h +++ /dev/null @@ -1,28 +0,0 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) -** -** -*/ - -#ifndef WINCONFIG_H -#define WINCONFIG_H - -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN - -#include -#include - -#define XML_NS 1 -#define XML_DTD 1 -#define XML_BYTE_ORDER 12 -#define XML_CONTEXT_BYTES 1024 -#define HAVE_MEMMOVE - -#endif /* ndef WINCONFIG_H */ diff --git a/libs/apr-util/xml/expat/lib/xml.dsp b/libs/apr-util/xml/expat/lib/xml.dsp deleted file mode 100644 index 55baa4865d..0000000000 --- a/libs/apr-util/xml/expat/lib/xml.dsp +++ /dev/null @@ -1,221 +0,0 @@ -# Microsoft Developer Studio Project File - Name="xml" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=xml - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "xml.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "xml.mak" CFG="xml - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "xml - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "xml - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "xml - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "LibR" -# PROP BASE Intermediate_Dir "LibR" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "LibR" -# PROP Intermediate_Dir "LibR" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "." /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D VERSION=\"expat_1.95.2\" /Fd"LibR\xml_src" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "xml - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "LibD" -# PROP BASE Intermediate_Dir "LibD" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "LibD" -# PROP Intermediate_Dir "LibD" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /FD /c -# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "." /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D VERSION=\"expat_1.95.2\" /Fd"LibD\xml_src" /FD /c -# ADD BASE RSC /l 0x409 -# ADD RSC /l 0x409 -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ENDIF - -# Begin Target - -# Name "xml - Win32 Release" -# Name "xml - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\xmlparse.c -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=xmltok_impl.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=xmltok_ns.c -# PROP Exclude_From_Build 1 -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\config.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# Begin Group "Generated Header Files" - -# PROP Default_Filter "" -# Begin Source File - -SOURCE=.\expat.h.in - -!IF "$(CFG)" == "xml - Win32 Release" - -# Begin Custom Build - Creating expat.h from expat.h.in -InputPath=.\expat.h.in - -".\expat.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\expat.h.in > .\expat.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "xml - Win32 Debug" - -# Begin Custom Build - Creating expat.h from expat.h.in -InputPath=.\expat.h.in - -".\expat.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\expat.h.in > .\expat.h - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\winconfig.h - -!IF "$(CFG)" == "xml - Win32 Release" - -# Begin Custom Build - Creating config.h from winconfig.h -InputPath=.\winconfig.h - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\winconfig.h > .\config.h - -# End Custom Build - -!ELSEIF "$(CFG)" == "xml - Win32 Debug" - -# Begin Custom Build - Creating config.h from winconfig.h -InputPath=.\winconfig.h - -".\config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\winconfig.h > .\config.h - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project diff --git a/libs/apr-util/xml/expat/lib/xmlparse.c b/libs/apr-util/xml/expat/lib/xmlparse.c deleted file mode 100644 index 822fabdd86..0000000000 --- a/libs/apr-util/xml/expat/lib/xmlparse.c +++ /dev/null @@ -1,4650 +0,0 @@ -/* -Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -static char RCSId[] - = "$Header: /home/cvs/apr-util/xml/expat/lib/xmlparse.c,v 1.4 2001/08/30 05:44:18 wrowe Exp $"; - -#ifdef COMPILED_FROM_DSP -# include "winconfig.h" -# define XMLPARSEAPI __declspec(dllexport) -# include "expat.h" -# undef XMLPARSEAPI -#else -#include - -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#define memmove(d,s,l) ;punting on memmove; -#endif -#endif - -#ifdef HAVE_STRING_H -# include -#endif - -#ifndef __CYGWIN__ -#ifdef __declspec -# define XMLPARSEAPI __declspec(dllexport) -#endif -#endif - -#include "expat.h" - -#ifdef __declspec -# undef XMLPARSEAPI -#endif -#endif /* ndef COMPILED_FROM_DSP */ - -#include - -#ifdef XML_UNICODE -#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX -#define XmlConvert XmlUtf16Convert -#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS -#define XmlEncode XmlUtf16Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((unsigned long)s) & 1)) -typedef unsigned short ICHAR; -#else -#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX -#define XmlConvert XmlUtf8Convert -#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS -#define XmlEncode XmlUtf8Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf8) -typedef char ICHAR; -#endif - - -#ifndef XML_NS - -#define XmlInitEncodingNS XmlInitEncoding -#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding -#undef XmlGetInternalEncodingNS -#define XmlGetInternalEncodingNS XmlGetInternalEncoding -#define XmlParseXmlDeclNS XmlParseXmlDecl - -#endif - -#ifdef XML_UNICODE_WCHAR_T -#define XML_T(x) L ## x -#else -#define XML_T(x) x -#endif - -/* Round up n to be a multiple of sz, where sz is a power of 2. */ -#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) - -#include "xmltok.h" -#include "xmlrole.h" - -typedef const XML_Char *KEY; - -typedef struct { - KEY name; -} NAMED; - -typedef struct { - NAMED **v; - size_t size; - size_t used; - size_t usedLim; - XML_Memory_Handling_Suite *mem; -} HASH_TABLE; - -typedef struct { - NAMED **p; - NAMED **end; -} HASH_TABLE_ITER; - -#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ -#define INIT_DATA_BUF_SIZE 1024 -#define INIT_ATTS_SIZE 16 -#define INIT_BLOCK_SIZE 1024 -#define INIT_BUFFER_SIZE 1024 - -#define EXPAND_SPARE 24 - -typedef struct binding { - struct prefix *prefix; - struct binding *nextTagBinding; - struct binding *prevPrefixBinding; - const struct attribute_id *attId; - XML_Char *uri; - int uriLen; - int uriAlloc; -} BINDING; - -typedef struct prefix { - const XML_Char *name; - BINDING *binding; -} PREFIX; - -typedef struct { - const XML_Char *str; - const XML_Char *localPart; - int uriLen; -} TAG_NAME; - -typedef struct tag { - struct tag *parent; - const char *rawName; - int rawNameLength; - TAG_NAME name; - char *buf; - char *bufEnd; - BINDING *bindings; -} TAG; - -typedef struct { - const XML_Char *name; - const XML_Char *textPtr; - int textLen; - const XML_Char *systemId; - const XML_Char *base; - const XML_Char *publicId; - const XML_Char *notation; - char open; - char is_param; -} ENTITY; - -typedef struct { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - const XML_Char * name; - int firstchild; - int lastchild; - int childcnt; - int nextsib; -} CONTENT_SCAFFOLD; - -typedef struct block { - struct block *next; - int size; - XML_Char s[1]; -} BLOCK; - -typedef struct { - BLOCK *blocks; - BLOCK *freeBlocks; - const XML_Char *end; - XML_Char *ptr; - XML_Char *start; - XML_Memory_Handling_Suite *mem; -} STRING_POOL; - -/* The XML_Char before the name is used to determine whether -an attribute has been specified. */ -typedef struct attribute_id { - XML_Char *name; - PREFIX *prefix; - char maybeTokenized; - char xmlns; -} ATTRIBUTE_ID; - -typedef struct { - const ATTRIBUTE_ID *id; - char isCdata; - const XML_Char *value; -} DEFAULT_ATTRIBUTE; - -typedef struct { - const XML_Char *name; - PREFIX *prefix; - const ATTRIBUTE_ID *idAtt; - int nDefaultAtts; - int allocDefaultAtts; - DEFAULT_ATTRIBUTE *defaultAtts; -} ELEMENT_TYPE; - -typedef struct { - HASH_TABLE generalEntities; - HASH_TABLE elementTypes; - HASH_TABLE attributeIds; - HASH_TABLE prefixes; - STRING_POOL pool; - int complete; - int standalone; -#ifdef XML_DTD - HASH_TABLE paramEntities; -#endif /* XML_DTD */ - PREFIX defaultPrefix; - /* === scaffolding for building content model === */ - int in_eldecl; - CONTENT_SCAFFOLD *scaffold; - unsigned contentStringLen; - unsigned scaffSize; - unsigned scaffCount; - int scaffLevel; - int *scaffIndex; -} DTD; - -typedef struct open_internal_entity { - const char *internalEventPtr; - const char *internalEventEndPtr; - struct open_internal_entity *next; - ENTITY *entity; -} OPEN_INTERNAL_ENTITY; - -typedef enum XML_Error Processor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr); - -static Processor prologProcessor; -static Processor prologInitProcessor; -static Processor contentProcessor; -static Processor cdataSectionProcessor; -#ifdef XML_DTD -static Processor ignoreSectionProcessor; -#endif /* XML_DTD */ -static Processor epilogProcessor; -static Processor errorProcessor; -static Processor externalEntityInitProcessor; -static Processor externalEntityInitProcessor2; -static Processor externalEntityInitProcessor3; -static Processor externalEntityContentProcessor; - -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, const char *, const char *); -static enum XML_Error -initializeEncoding(XML_Parser parser); -static enum XML_Error -doProlog(XML_Parser parser, const ENCODING *enc, const char *s, - const char *end, int tok, const char *next, const char **nextPtr); -static enum XML_Error -processInternalParamEntity(XML_Parser parser, ENTITY *entity); -static enum XML_Error -doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, - const char *start, const char *end, const char **endPtr); -static enum XML_Error -doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr); -#ifdef XML_DTD -static enum XML_Error -doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, const char *end, const char **nextPtr); -#endif /* XML_DTD */ -static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *, const char *s, - TAG_NAME *tagNamePtr, BINDING **bindingsPtr); -static -int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr); - -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, - int isCdata, int isId, const XML_Char *dfltValue, - XML_Parser parser); - -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *, - STRING_POOL *); -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *, int isCdata, const char *, const char *, - STRING_POOL *); -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); -static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); -static enum XML_Error -storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); -static int -reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); -static void -reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, const char *end); - -static const XML_Char *getContext(XML_Parser parser); -static int setContext(XML_Parser parser, const XML_Char *context); -static void normalizePublicId(XML_Char *s); -static int dtdInit(DTD *, XML_Parser parser); - -static void dtdDestroy(DTD *, XML_Parser parser); - -static int dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser); - -static int copyEntityTable(HASH_TABLE *, STRING_POOL *, const HASH_TABLE *, - XML_Parser parser); - -#ifdef XML_DTD -static void dtdSwap(DTD *, DTD *); -#endif /* XML_DTD */ - -static NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize); - -static void hashTableInit(HASH_TABLE *, XML_Memory_Handling_Suite *ms); - -static void hashTableDestroy(HASH_TABLE *); -static void hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); -static NAMED *hashTableIterNext(HASH_TABLE_ITER *); -static void poolInit(STRING_POOL *, XML_Memory_Handling_Suite *ms); -static void poolClear(STRING_POOL *); -static void poolDestroy(STRING_POOL *); -static XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); - -static int poolGrow(STRING_POOL *pool); - -static int nextScaffoldPart(XML_Parser parser); -static XML_Content *build_model(XML_Parser parser); - -static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s); -static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); -static const XML_Char *poolAppendString(STRING_POOL *pool, const XML_Char *s); -static ELEMENT_TYPE * getElementType(XML_Parser Paraser, - const ENCODING *enc, - const char *ptr, - const char *end); - -#define poolStart(pool) ((pool)->start) -#define poolEnd(pool) ((pool)->ptr) -#define poolLength(pool) ((pool)->ptr - (pool)->start) -#define poolChop(pool) ((void)--(pool->ptr)) -#define poolLastChar(pool) (((pool)->ptr)[-1]) -#define poolDiscard(pool) ((pool)->ptr = (pool)->start) -#define poolFinish(pool) ((pool)->start = (pool)->ptr) -#define poolAppendChar(pool, c) \ - (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ - ? 0 \ - : ((*((pool)->ptr)++ = c), 1)) - -typedef struct { - /* The first member must be userData so that the XML_GetUserData macro works. */ - void *m_userData; - void *m_handlerArg; - char *m_buffer; - XML_Memory_Handling_Suite m_mem; - /* first character to be parsed */ - const char *m_bufferPtr; - /* past last character to be parsed */ - char *m_bufferEnd; - /* allocated end of buffer */ - const char *m_bufferLim; - long m_parseEndByteIndex; - const char *m_parseEndPtr; - XML_Char *m_dataBuf; - XML_Char *m_dataBufEnd; - XML_StartElementHandler m_startElementHandler; - XML_EndElementHandler m_endElementHandler; - XML_CharacterDataHandler m_characterDataHandler; - XML_ProcessingInstructionHandler m_processingInstructionHandler; - XML_CommentHandler m_commentHandler; - XML_StartCdataSectionHandler m_startCdataSectionHandler; - XML_EndCdataSectionHandler m_endCdataSectionHandler; - XML_DefaultHandler m_defaultHandler; - XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; - XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; - XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; - XML_NotationDeclHandler m_notationDeclHandler; - XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler; - XML_NotStandaloneHandler m_notStandaloneHandler; - XML_ExternalEntityRefHandler m_externalEntityRefHandler; - void *m_externalEntityRefHandlerArg; - XML_UnknownEncodingHandler m_unknownEncodingHandler; - XML_ElementDeclHandler m_elementDeclHandler; - XML_AttlistDeclHandler m_attlistDeclHandler; - XML_EntityDeclHandler m_entityDeclHandler; - XML_XmlDeclHandler m_xmlDeclHandler; - const ENCODING *m_encoding; - INIT_ENCODING m_initEncoding; - const ENCODING *m_internalEncoding; - const XML_Char *m_protocolEncodingName; - int m_ns; - int m_ns_triplets; - void *m_unknownEncodingMem; - void *m_unknownEncodingData; - void *m_unknownEncodingHandlerData; - void (*m_unknownEncodingRelease)(void *); - PROLOG_STATE m_prologState; - Processor *m_processor; - enum XML_Error m_errorCode; - const char *m_eventPtr; - const char *m_eventEndPtr; - const char *m_positionPtr; - OPEN_INTERNAL_ENTITY *m_openInternalEntities; - int m_defaultExpandInternalEntities; - int m_tagLevel; - ENTITY *m_declEntity; - const XML_Char *m_doctypeName; - const XML_Char *m_doctypeSysid; - const XML_Char *m_doctypePubid; - const XML_Char *m_declAttributeType; - const XML_Char *m_declNotationName; - const XML_Char *m_declNotationPublicId; - ELEMENT_TYPE *m_declElementType; - ATTRIBUTE_ID *m_declAttributeId; - char m_declAttributeIsCdata; - char m_declAttributeIsId; - DTD m_dtd; - const XML_Char *m_curBase; - TAG *m_tagStack; - TAG *m_freeTagList; - BINDING *m_inheritedBindings; - BINDING *m_freeBindingList; - int m_attsSize; - int m_nSpecifiedAtts; - int m_idAttIndex; - ATTRIBUTE *m_atts; - POSITION m_position; - STRING_POOL m_tempPool; - STRING_POOL m_temp2Pool; - char *m_groupConnector; - unsigned m_groupSize; - int m_hadExternalDoctype; - XML_Char m_namespaceSeparator; -#ifdef XML_DTD - enum XML_ParamEntityParsing m_paramEntityParsing; - XML_Parser m_parentParser; -#endif -} Parser; - -#define MALLOC(s) (((Parser *)parser)->m_mem.malloc_fcn((s))) -#define REALLOC(p,s) (((Parser *)parser)->m_mem.realloc_fcn((p),(s))) -#define FREE(p) (((Parser *)parser)->m_mem.free_fcn((p))) - -#define userData (((Parser *)parser)->m_userData) -#define handlerArg (((Parser *)parser)->m_handlerArg) -#define startElementHandler (((Parser *)parser)->m_startElementHandler) -#define endElementHandler (((Parser *)parser)->m_endElementHandler) -#define characterDataHandler (((Parser *)parser)->m_characterDataHandler) -#define processingInstructionHandler (((Parser *)parser)->m_processingInstructionHandler) -#define commentHandler (((Parser *)parser)->m_commentHandler) -#define startCdataSectionHandler (((Parser *)parser)->m_startCdataSectionHandler) -#define endCdataSectionHandler (((Parser *)parser)->m_endCdataSectionHandler) -#define defaultHandler (((Parser *)parser)->m_defaultHandler) -#define startDoctypeDeclHandler (((Parser *)parser)->m_startDoctypeDeclHandler) -#define endDoctypeDeclHandler (((Parser *)parser)->m_endDoctypeDeclHandler) -#define unparsedEntityDeclHandler (((Parser *)parser)->m_unparsedEntityDeclHandler) -#define notationDeclHandler (((Parser *)parser)->m_notationDeclHandler) -#define startNamespaceDeclHandler (((Parser *)parser)->m_startNamespaceDeclHandler) -#define endNamespaceDeclHandler (((Parser *)parser)->m_endNamespaceDeclHandler) -#define notStandaloneHandler (((Parser *)parser)->m_notStandaloneHandler) -#define externalEntityRefHandler (((Parser *)parser)->m_externalEntityRefHandler) -#define externalEntityRefHandlerArg (((Parser *)parser)->m_externalEntityRefHandlerArg) -#define unknownEncodingHandler (((Parser *)parser)->m_unknownEncodingHandler) -#define elementDeclHandler (((Parser *)parser)->m_elementDeclHandler) -#define attlistDeclHandler (((Parser *)parser)->m_attlistDeclHandler) -#define entityDeclHandler (((Parser *)parser)->m_entityDeclHandler) -#define xmlDeclHandler (((Parser *)parser)->m_xmlDeclHandler) -#define encoding (((Parser *)parser)->m_encoding) -#define initEncoding (((Parser *)parser)->m_initEncoding) -#define internalEncoding (((Parser *)parser)->m_internalEncoding) -#define unknownEncodingMem (((Parser *)parser)->m_unknownEncodingMem) -#define unknownEncodingData (((Parser *)parser)->m_unknownEncodingData) -#define unknownEncodingHandlerData \ - (((Parser *)parser)->m_unknownEncodingHandlerData) -#define unknownEncodingRelease (((Parser *)parser)->m_unknownEncodingRelease) -#define protocolEncodingName (((Parser *)parser)->m_protocolEncodingName) -#define ns (((Parser *)parser)->m_ns) -#define ns_triplets (((Parser *)parser)->m_ns_triplets) -#define prologState (((Parser *)parser)->m_prologState) -#define processor (((Parser *)parser)->m_processor) -#define errorCode (((Parser *)parser)->m_errorCode) -#define eventPtr (((Parser *)parser)->m_eventPtr) -#define eventEndPtr (((Parser *)parser)->m_eventEndPtr) -#define positionPtr (((Parser *)parser)->m_positionPtr) -#define position (((Parser *)parser)->m_position) -#define openInternalEntities (((Parser *)parser)->m_openInternalEntities) -#define defaultExpandInternalEntities (((Parser *)parser)->m_defaultExpandInternalEntities) -#define tagLevel (((Parser *)parser)->m_tagLevel) -#define buffer (((Parser *)parser)->m_buffer) -#define bufferPtr (((Parser *)parser)->m_bufferPtr) -#define bufferEnd (((Parser *)parser)->m_bufferEnd) -#define parseEndByteIndex (((Parser *)parser)->m_parseEndByteIndex) -#define parseEndPtr (((Parser *)parser)->m_parseEndPtr) -#define bufferLim (((Parser *)parser)->m_bufferLim) -#define dataBuf (((Parser *)parser)->m_dataBuf) -#define dataBufEnd (((Parser *)parser)->m_dataBufEnd) -#define dtd (((Parser *)parser)->m_dtd) -#define curBase (((Parser *)parser)->m_curBase) -#define declEntity (((Parser *)parser)->m_declEntity) -#define doctypeName (((Parser *)parser)->m_doctypeName) -#define doctypeSysid (((Parser *)parser)->m_doctypeSysid) -#define doctypePubid (((Parser *)parser)->m_doctypePubid) -#define declAttributeType (((Parser *)parser)->m_declAttributeType) -#define declNotationName (((Parser *)parser)->m_declNotationName) -#define declNotationPublicId (((Parser *)parser)->m_declNotationPublicId) -#define declElementType (((Parser *)parser)->m_declElementType) -#define declAttributeId (((Parser *)parser)->m_declAttributeId) -#define declAttributeIsCdata (((Parser *)parser)->m_declAttributeIsCdata) -#define declAttributeIsId (((Parser *)parser)->m_declAttributeIsId) -#define freeTagList (((Parser *)parser)->m_freeTagList) -#define freeBindingList (((Parser *)parser)->m_freeBindingList) -#define inheritedBindings (((Parser *)parser)->m_inheritedBindings) -#define tagStack (((Parser *)parser)->m_tagStack) -#define atts (((Parser *)parser)->m_atts) -#define attsSize (((Parser *)parser)->m_attsSize) -#define nSpecifiedAtts (((Parser *)parser)->m_nSpecifiedAtts) -#define idAttIndex (((Parser *)parser)->m_idAttIndex) -#define tempPool (((Parser *)parser)->m_tempPool) -#define temp2Pool (((Parser *)parser)->m_temp2Pool) -#define groupConnector (((Parser *)parser)->m_groupConnector) -#define groupSize (((Parser *)parser)->m_groupSize) -#define hadExternalDoctype (((Parser *)parser)->m_hadExternalDoctype) -#define namespaceSeparator (((Parser *)parser)->m_namespaceSeparator) -#ifdef XML_DTD -#define parentParser (((Parser *)parser)->m_parentParser) -#define paramEntityParsing (((Parser *)parser)->m_paramEntityParsing) -#endif /* XML_DTD */ - -#ifdef COMPILED_FROM_DSP -BOOL WINAPI DllMain(HINSTANCE h, DWORD r, LPVOID p) { - return TRUE; -} -#endif /* def COMPILED_FROM_DSP */ - -#ifdef _MSC_VER -#ifdef _DEBUG -Parser *asParser(XML_Parser parser) -{ - return parser; -} -#endif -#endif - -XML_Parser XML_ParserCreate(const XML_Char *encodingName) -{ - return XML_ParserCreate_MM(encodingName, NULL, NULL); -} - -XML_Parser XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) -{ - XML_Char tmp[2]; - *tmp = nsSep; - return XML_ParserCreate_MM(encodingName, NULL, tmp); -} - -XML_Parser -XML_ParserCreate_MM(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep) { - - XML_Parser parser; - static - const XML_Char implicitContext[] = { - XML_T('x'), XML_T('m'), XML_T('l'), XML_T('='), - XML_T('h'), XML_T('t'), XML_T('t'), XML_T('p'), XML_T(':'), - XML_T('/'), XML_T('/'), XML_T('w'), XML_T('w'), XML_T('w'), - XML_T('.'), XML_T('w'), XML_T('3'), - XML_T('.'), XML_T('o'), XML_T('r'), XML_T('g'), - XML_T('/'), XML_T('X'), XML_T('M'), XML_T('L'), - XML_T('/'), XML_T('1'), XML_T('9'), XML_T('9'), XML_T('8'), - XML_T('/'), XML_T('n'), XML_T('a'), XML_T('m'), XML_T('e'), - XML_T('s'), XML_T('p'), XML_T('a'), XML_T('c'), XML_T('e'), - XML_T('\0') - }; - - - if (memsuite) { - XML_Memory_Handling_Suite *mtemp; - parser = memsuite->malloc_fcn(sizeof(Parser)); - mtemp = &(((Parser *) parser)->m_mem); - mtemp->malloc_fcn = memsuite->malloc_fcn; - mtemp->realloc_fcn = memsuite->realloc_fcn; - mtemp->free_fcn = memsuite->free_fcn; - } - else { - XML_Memory_Handling_Suite *mtemp; - parser = malloc(sizeof(Parser)); - mtemp = &(((Parser *) parser)->m_mem); - mtemp->malloc_fcn = malloc; - mtemp->realloc_fcn = realloc; - mtemp->free_fcn = free; - } - - if (!parser) - return parser; - processor = prologInitProcessor; - XmlPrologStateInit(&prologState); - userData = 0; - handlerArg = 0; - startElementHandler = 0; - endElementHandler = 0; - characterDataHandler = 0; - processingInstructionHandler = 0; - commentHandler = 0; - startCdataSectionHandler = 0; - endCdataSectionHandler = 0; - defaultHandler = 0; - startDoctypeDeclHandler = 0; - endDoctypeDeclHandler = 0; - unparsedEntityDeclHandler = 0; - notationDeclHandler = 0; - startNamespaceDeclHandler = 0; - endNamespaceDeclHandler = 0; - notStandaloneHandler = 0; - externalEntityRefHandler = 0; - externalEntityRefHandlerArg = parser; - unknownEncodingHandler = 0; - elementDeclHandler = 0; - attlistDeclHandler = 0; - entityDeclHandler = 0; - xmlDeclHandler = 0; - buffer = 0; - bufferPtr = 0; - bufferEnd = 0; - parseEndByteIndex = 0; - parseEndPtr = 0; - bufferLim = 0; - declElementType = 0; - declAttributeId = 0; - declEntity = 0; - doctypeName = 0; - doctypeSysid = 0; - doctypePubid = 0; - declAttributeType = 0; - declNotationName = 0; - declNotationPublicId = 0; - memset(&position, 0, sizeof(POSITION)); - errorCode = XML_ERROR_NONE; - eventPtr = 0; - eventEndPtr = 0; - positionPtr = 0; - openInternalEntities = 0; - tagLevel = 0; - tagStack = 0; - freeTagList = 0; - freeBindingList = 0; - inheritedBindings = 0; - attsSize = INIT_ATTS_SIZE; - atts = MALLOC(attsSize * sizeof(ATTRIBUTE)); - nSpecifiedAtts = 0; - dataBuf = MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); - groupSize = 0; - groupConnector = 0; - hadExternalDoctype = 0; - unknownEncodingMem = 0; - unknownEncodingRelease = 0; - unknownEncodingData = 0; - unknownEncodingHandlerData = 0; - namespaceSeparator = '!'; -#ifdef XML_DTD - parentParser = 0; - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif - ns = 0; - ns_triplets = 0; - poolInit(&tempPool, &(((Parser *) parser)->m_mem)); - poolInit(&temp2Pool, &(((Parser *) parser)->m_mem)); - protocolEncodingName = encodingName ? poolCopyString(&tempPool, encodingName) : 0; - curBase = 0; - if (!dtdInit(&dtd, parser) || !atts || !dataBuf - || (encodingName && !protocolEncodingName)) { - XML_ParserFree(parser); - return 0; - } - dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; - - if (nameSep) { - XmlInitEncodingNS(&initEncoding, &encoding, 0); - ns = 1; - internalEncoding = XmlGetInternalEncodingNS(); - namespaceSeparator = *nameSep; - - if (! setContext(parser, implicitContext)) { - XML_ParserFree(parser); - return 0; - } - } - else { - XmlInitEncoding(&initEncoding, &encoding, 0); - internalEncoding = XmlGetInternalEncoding(); - } - - return parser; -} /* End XML_ParserCreate_MM */ - -int XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - if (!encodingName) - protocolEncodingName = 0; - else { - protocolEncodingName = poolCopyString(&tempPool, encodingName); - if (!protocolEncodingName) - return 0; - } - return 1; -} - -XML_Parser XML_ExternalEntityParserCreate(XML_Parser oldParser, - const XML_Char *context, - const XML_Char *encodingName) -{ - XML_Parser parser = oldParser; - DTD *oldDtd = &dtd; - XML_StartElementHandler oldStartElementHandler = startElementHandler; - XML_EndElementHandler oldEndElementHandler = endElementHandler; - XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; - XML_ProcessingInstructionHandler oldProcessingInstructionHandler = processingInstructionHandler; - XML_CommentHandler oldCommentHandler = commentHandler; - XML_StartCdataSectionHandler oldStartCdataSectionHandler = startCdataSectionHandler; - XML_EndCdataSectionHandler oldEndCdataSectionHandler = endCdataSectionHandler; - XML_DefaultHandler oldDefaultHandler = defaultHandler; - XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler = unparsedEntityDeclHandler; - XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; - XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler = startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler = endNamespaceDeclHandler; - XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; - XML_ExternalEntityRefHandler oldExternalEntityRefHandler = externalEntityRefHandler; - XML_UnknownEncodingHandler oldUnknownEncodingHandler = unknownEncodingHandler; - XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; - XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; - XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; - XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; - ELEMENT_TYPE * oldDeclElementType = declElementType; - - void *oldUserData = userData; - void *oldHandlerArg = handlerArg; - int oldDefaultExpandInternalEntities = defaultExpandInternalEntities; - void *oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; -#ifdef XML_DTD - int oldParamEntityParsing = paramEntityParsing; -#endif - int oldns_triplets = ns_triplets; - - if (ns) { - XML_Char tmp[2]; - - *tmp = namespaceSeparator; - parser = XML_ParserCreate_MM(encodingName, &((Parser *)parser)->m_mem, - tmp); - } - else { - parser = XML_ParserCreate_MM(encodingName, &((Parser *)parser)->m_mem, - NULL); - } - - if (!parser) - return 0; - - startElementHandler = oldStartElementHandler; - endElementHandler = oldEndElementHandler; - characterDataHandler = oldCharacterDataHandler; - processingInstructionHandler = oldProcessingInstructionHandler; - commentHandler = oldCommentHandler; - startCdataSectionHandler = oldStartCdataSectionHandler; - endCdataSectionHandler = oldEndCdataSectionHandler; - defaultHandler = oldDefaultHandler; - unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; - notationDeclHandler = oldNotationDeclHandler; - startNamespaceDeclHandler = oldStartNamespaceDeclHandler; - endNamespaceDeclHandler = oldEndNamespaceDeclHandler; - notStandaloneHandler = oldNotStandaloneHandler; - externalEntityRefHandler = oldExternalEntityRefHandler; - unknownEncodingHandler = oldUnknownEncodingHandler; - elementDeclHandler = oldElementDeclHandler; - attlistDeclHandler = oldAttlistDeclHandler; - entityDeclHandler = oldEntityDeclHandler; - xmlDeclHandler = oldXmlDeclHandler; - declElementType = oldDeclElementType; - userData = oldUserData; - if (oldUserData == oldHandlerArg) - handlerArg = userData; - else - handlerArg = parser; - if (oldExternalEntityRefHandlerArg != oldParser) - externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; - defaultExpandInternalEntities = oldDefaultExpandInternalEntities; - ns_triplets = oldns_triplets; -#ifdef XML_DTD - paramEntityParsing = oldParamEntityParsing; - if (context) { -#endif /* XML_DTD */ - if (!dtdCopy(&dtd, oldDtd, parser) || !setContext(parser, context)) { - XML_ParserFree(parser); - return 0; - } - processor = externalEntityInitProcessor; -#ifdef XML_DTD - } - else { - dtdSwap(&dtd, oldDtd); - parentParser = oldParser; - XmlPrologStateInitExternalEntity(&prologState); - dtd.complete = 1; - hadExternalDoctype = 1; - } -#endif /* XML_DTD */ - return parser; -} - -static -void destroyBindings(BINDING *bindings, XML_Parser parser) -{ - for (;;) { - BINDING *b = bindings; - if (!b) - break; - bindings = b->nextTagBinding; - FREE(b->uri); - FREE(b); - } -} - -void XML_ParserFree(XML_Parser parser) -{ - for (;;) { - TAG *p; - if (tagStack == 0) { - if (freeTagList == 0) - break; - tagStack = freeTagList; - freeTagList = 0; - } - p = tagStack; - tagStack = tagStack->parent; - FREE(p->buf); - destroyBindings(p->bindings, parser); - FREE(p); - } - destroyBindings(freeBindingList, parser); - destroyBindings(inheritedBindings, parser); - poolDestroy(&tempPool); - poolDestroy(&temp2Pool); -#ifdef XML_DTD - if (parentParser) { - if (hadExternalDoctype) - dtd.complete = 0; - dtdSwap(&dtd, &((Parser *)parentParser)->m_dtd); - } -#endif /* XML_DTD */ - dtdDestroy(&dtd, parser); - FREE((void *)atts); - if (groupConnector) - FREE(groupConnector); - if (buffer) - FREE(buffer); - FREE(dataBuf); - if (unknownEncodingMem) - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - FREE(parser); -} - -void XML_UseParserAsHandlerArg(XML_Parser parser) -{ - handlerArg = parser; -} - -void -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) { - ns_triplets = do_nst; -} - -void XML_SetUserData(XML_Parser parser, void *p) -{ - if (handlerArg == userData) - handlerArg = userData = p; - else - userData = p; -} - -int XML_SetBase(XML_Parser parser, const XML_Char *p) -{ - if (p) { - p = poolCopyString(&dtd.pool, p); - if (!p) - return 0; - curBase = p; - } - else - curBase = 0; - return 1; -} - -const XML_Char *XML_GetBase(XML_Parser parser) -{ - return curBase; -} - -int XML_GetSpecifiedAttributeCount(XML_Parser parser) -{ - return nSpecifiedAtts; -} - -int XML_GetIdAttributeIndex(XML_Parser parser) -{ - return idAttIndex; -} - -void XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end) -{ - startElementHandler = start; - endElementHandler = end; -} - -void XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler start) { - startElementHandler = start; -} - -void XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler end) { - endElementHandler = end; -} - -void XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler) -{ - characterDataHandler = handler; -} - -void XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler) -{ - processingInstructionHandler = handler; -} - -void XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler) -{ - commentHandler = handler; -} - -void XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end) -{ - startCdataSectionHandler = start; - endCdataSectionHandler = end; -} - -void XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start) { - startCdataSectionHandler = start; -} - -void XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end) { - endCdataSectionHandler = end; -} - -void XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = 0; -} - -void XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = 1; -} - -void XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end) -{ - startDoctypeDeclHandler = start; - endDoctypeDeclHandler = end; -} - -void XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start) { - startDoctypeDeclHandler = start; -} - -void XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end) { - endDoctypeDeclHandler = end; -} - -void XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler) -{ - unparsedEntityDeclHandler = handler; -} - -void XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler) -{ - notationDeclHandler = handler; -} - -void XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end) -{ - startNamespaceDeclHandler = start; - endNamespaceDeclHandler = end; -} - -void XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start) { - startNamespaceDeclHandler = start; -} - -void XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end) { - endNamespaceDeclHandler = end; -} - - -void XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler) -{ - notStandaloneHandler = handler; -} - -void XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler) -{ - externalEntityRefHandler = handler; -} - -void XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) -{ - if (arg) - externalEntityRefHandlerArg = arg; - else - externalEntityRefHandlerArg = parser; -} - -void XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *data) -{ - unknownEncodingHandler = handler; - unknownEncodingHandlerData = data; -} - -void XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl) -{ - elementDeclHandler = eldecl; -} - -void XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl) -{ - attlistDeclHandler = attdecl; -} - -void XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler) -{ - entityDeclHandler = handler; -} - -void XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler handler) { - xmlDeclHandler = handler; -} - -int XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing) -{ -#ifdef XML_DTD - paramEntityParsing = parsing; - return 1; -#else - return parsing == XML_PARAM_ENTITY_PARSING_NEVER; -#endif -} - -int XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) -{ - if (len == 0) { - if (!isFinal) - return 1; - positionPtr = bufferPtr; - errorCode = processor(parser, bufferPtr, parseEndPtr = bufferEnd, 0); - if (errorCode == XML_ERROR_NONE) - return 1; - eventEndPtr = eventPtr; - processor = errorProcessor; - return 0; - } -#ifndef XML_CONTEXT_BYTES - else if (bufferPtr == bufferEnd) { - const char *end; - int nLeftOver; - parseEndByteIndex += len; - positionPtr = s; - if (isFinal) { - errorCode = processor(parser, s, parseEndPtr = s + len, 0); - if (errorCode == XML_ERROR_NONE) - return 1; - eventEndPtr = eventPtr; - processor = errorProcessor; - return 0; - } - errorCode = processor(parser, s, parseEndPtr = s + len, &end); - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return 0; - } - XmlUpdatePosition(encoding, positionPtr, end, &position); - nLeftOver = s + len - end; - if (nLeftOver) { - if (buffer == 0 || nLeftOver > bufferLim - buffer) { - /* FIXME avoid integer overflow */ - buffer = buffer == 0 ? MALLOC(len * 2) : REALLOC(buffer, len * 2); - /* FIXME storage leak if realloc fails */ - if (!buffer) { - errorCode = XML_ERROR_NO_MEMORY; - eventPtr = eventEndPtr = 0; - processor = errorProcessor; - return 0; - } - bufferLim = buffer + len * 2; - } - memcpy(buffer, end, nLeftOver); - bufferPtr = buffer; - bufferEnd = buffer + nLeftOver; - } - return 1; - } -#endif /* not defined XML_CONTEXT_BYTES */ - else { - memcpy(XML_GetBuffer(parser, len), s, len); - return XML_ParseBuffer(parser, len, isFinal); - } -} - -int XML_ParseBuffer(XML_Parser parser, int len, int isFinal) -{ - const char *start = bufferPtr; - positionPtr = start; - bufferEnd += len; - parseEndByteIndex += len; - errorCode = processor(parser, start, parseEndPtr = bufferEnd, - isFinal ? (const char **)0 : &bufferPtr); - if (errorCode == XML_ERROR_NONE) { - if (!isFinal) - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - return 1; - } - else { - eventEndPtr = eventPtr; - processor = errorProcessor; - return 0; - } -} - -void *XML_GetBuffer(XML_Parser parser, int len) -{ - if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ - int neededSize = len + (bufferEnd - bufferPtr); -#ifdef XML_CONTEXT_BYTES - int keep = bufferPtr - buffer; - - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - neededSize += keep; -#endif /* defined XML_CONTEXT_BYTES */ - if (neededSize <= bufferLim - buffer) { -#ifdef XML_CONTEXT_BYTES - if (keep < bufferPtr - buffer) { - int offset = (bufferPtr - buffer) - keep; - memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep); - bufferEnd -= offset; - bufferPtr -= offset; - } -#else - memmove(buffer, bufferPtr, bufferEnd - bufferPtr); - bufferEnd = buffer + (bufferEnd - bufferPtr); - bufferPtr = buffer; -#endif /* not defined XML_CONTEXT_BYTES */ - } - else { - char *newBuf; - int bufferSize = bufferLim - bufferPtr; - if (bufferSize == 0) - bufferSize = INIT_BUFFER_SIZE; - do { - bufferSize *= 2; - } while (bufferSize < neededSize); - newBuf = MALLOC(bufferSize); - if (newBuf == 0) { - errorCode = XML_ERROR_NO_MEMORY; - return 0; - } - bufferLim = newBuf + bufferSize; -#ifdef XML_CONTEXT_BYTES - if (bufferPtr) { - int keep = bufferPtr - buffer; - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep); - FREE(buffer); - buffer = newBuf; - bufferEnd = buffer + (bufferEnd - bufferPtr) + keep; - bufferPtr = buffer + keep; - } - else { - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; - } -#else - if (bufferPtr) { - memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); - FREE(buffer); - } - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; -#endif /* not defined XML_CONTEXT_BYTES */ - } - } - return bufferEnd; -} - -enum XML_Error XML_GetErrorCode(XML_Parser parser) -{ - return errorCode; -} - -long XML_GetCurrentByteIndex(XML_Parser parser) -{ - if (eventPtr) - return parseEndByteIndex - (parseEndPtr - eventPtr); - return -1; -} - -int XML_GetCurrentByteCount(XML_Parser parser) -{ - if (eventEndPtr && eventPtr) - return eventEndPtr - eventPtr; - return 0; -} - -const char * XML_GetInputContext(XML_Parser parser, int *offset, int *size) -{ -#ifdef XML_CONTEXT_BYTES - if (eventPtr && buffer) { - *offset = eventPtr - buffer; - *size = bufferEnd - buffer; - return buffer; - } -#endif /* defined XML_CONTEXT_BYTES */ - return (char *) 0; -} - -int XML_GetCurrentLineNumber(XML_Parser parser) -{ - if (eventPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.lineNumber + 1; -} - -int XML_GetCurrentColumnNumber(XML_Parser parser) -{ - if (eventPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.columnNumber; -} - -void XML_DefaultCurrent(XML_Parser parser) -{ - if (defaultHandler) { - if (openInternalEntities) - reportDefault(parser, - internalEncoding, - openInternalEntities->internalEventPtr, - openInternalEntities->internalEventEndPtr); - else - reportDefault(parser, encoding, eventPtr, eventEndPtr); - } -} - -const XML_LChar *XML_ErrorString(int code) -{ - static const XML_LChar *message[] = { - 0, - XML_T("out of memory"), - XML_T("syntax error"), - XML_T("no element found"), - XML_T("not well-formed (invalid token)"), - XML_T("unclosed token"), - XML_T("unclosed token"), - XML_T("mismatched tag"), - XML_T("duplicate attribute"), - XML_T("junk after document element"), - XML_T("illegal parameter entity reference"), - XML_T("undefined entity"), - XML_T("recursive entity reference"), - XML_T("asynchronous entity"), - XML_T("reference to invalid character number"), - XML_T("reference to binary entity"), - XML_T("reference to external entity in attribute"), - XML_T("xml processing instruction not at start of external entity"), - XML_T("unknown encoding"), - XML_T("encoding specified in XML declaration is incorrect"), - XML_T("unclosed CDATA section"), - XML_T("error in processing external entity reference"), - XML_T("document is not standalone"), - XML_T("unexpected parser state - please send a bug report") - }; - if (code > 0 && code < sizeof(message)/sizeof(message[0])) - return message[code]; - return 0; -} - -const XML_LChar * -XML_ExpatVersion(void) { - return VERSION; -} - -XML_Expat_Version -XML_ExpatVersionInfo(void) { - XML_Expat_Version version; - - version.major = XML_MAJOR_VERSION; - version.minor = XML_MINOR_VERSION; - version.micro = XML_MICRO_VERSION; - - return version; -} - -static -enum XML_Error contentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - return doContent(parser, 0, encoding, start, end, endPtr); -} - -static -enum XML_Error externalEntityInitProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = externalEntityInitProcessor2; - return externalEntityInitProcessor2(parser, start, end, endPtr); -} - -static -enum XML_Error externalEntityInitProcessor2(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - const char *next; - int tok = XmlContentTok(encoding, start, end, &next); - switch (tok) { - case XML_TOK_BOM: - start = next; - break; - case XML_TOK_PARTIAL: - if (endPtr) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (endPtr) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityInitProcessor3; - return externalEntityInitProcessor3(parser, start, end, endPtr); -} - -static -enum XML_Error externalEntityInitProcessor3(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - const char *next; - int tok = XmlContentTok(encoding, start, end, &next); - switch (tok) { - case XML_TOK_XML_DECL: - { - enum XML_Error result = processXmlDecl(parser, 1, start, next); - if (result != XML_ERROR_NONE) - return result; - start = next; - } - break; - case XML_TOK_PARTIAL: - if (endPtr) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (endPtr) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityContentProcessor; - tagLevel = 1; - return doContent(parser, 1, encoding, start, end, endPtr); -} - -static -enum XML_Error externalEntityContentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - return doContent(parser, 1, encoding, start, end, endPtr); -} - -static enum XML_Error -doContent(XML_Parser parser, - int startTagLevel, - const ENCODING *enc, - const char *s, - const char *end, - const char **nextPtr) -{ - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - for (;;) { - const char *next = s; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_TRAILING_CR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - *eventEndPP = end; - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - if (startTagLevel == 0) - return XML_ERROR_NO_ELEMENTS; - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - return XML_ERROR_NONE; - case XML_TOK_NONE: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (startTagLevel > 0) { - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - return XML_ERROR_NONE; - } - return XML_ERROR_NO_ELEMENTS; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - XML_Char ch = XmlPredefinedEntityName(enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (characterDataHandler) - characterDataHandler(handlerArg, &ch, 1); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - name = poolStoreString(&dtd.pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); - poolDiscard(&dtd.pool); - if (!entity) { - if (dtd.complete || dtd.standalone) - return XML_ERROR_UNDEFINED_ENTITY; - if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->notation) - return XML_ERROR_BINARY_ENTITY_REF; - if (entity) { - if (entity->textPtr) { - enum XML_Error result; - OPEN_INTERNAL_ENTITY openEntity; - if (defaultHandler && !defaultExpandInternalEntities) { - reportDefault(parser, enc, s, next); - break; - } - entity->open = 1; - openEntity.next = openInternalEntities; - openInternalEntities = &openEntity; - openEntity.entity = entity; - openEntity.internalEventPtr = 0; - openEntity.internalEventEndPtr = 0; - result = doContent(parser, - tagLevel, - internalEncoding, - (char *)entity->textPtr, - (char *)(entity->textPtr + entity->textLen), - 0); - entity->open = 0; - openInternalEntities = openEntity.next; - if (result) - return result; - } - else if (externalEntityRefHandler) { - const XML_Char *context; - entity->open = 1; - context = getContext(parser); - entity->open = 0; - if (!context) - return XML_ERROR_NO_MEMORY; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - context, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - poolDiscard(&tempPool); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - } - case XML_TOK_START_TAG_WITH_ATTS: - if (!startElementHandler) { - enum XML_Error result = storeAtts(parser, enc, s, 0, 0); - if (result) - return result; - } - /* fall through */ - case XML_TOK_START_TAG_NO_ATTS: - { - TAG *tag; - if (freeTagList) { - tag = freeTagList; - freeTagList = freeTagList->parent; - } - else { - tag = MALLOC(sizeof(TAG)); - if (!tag) - return XML_ERROR_NO_MEMORY; - tag->buf = MALLOC(INIT_TAG_BUF_SIZE); - if (!tag->buf) - return XML_ERROR_NO_MEMORY; - tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; - } - tag->bindings = 0; - tag->parent = tagStack; - tagStack = tag; - tag->name.localPart = 0; - tag->rawName = s + enc->minBytesPerChar; - tag->rawNameLength = XmlNameLength(enc, tag->rawName); - if (nextPtr) { - /* Need to guarantee that: - tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)) <= tag->bufEnd - sizeof(XML_Char) */ - if (tag->rawNameLength + (int)(sizeof(XML_Char) - 1) + (int)sizeof(XML_Char) > tag->bufEnd - tag->buf) { - int bufSize = tag->rawNameLength * 4; - bufSize = ROUND_UP(bufSize, sizeof(XML_Char)); - tag->buf = REALLOC(tag->buf, bufSize); - if (!tag->buf) - return XML_ERROR_NO_MEMORY; - tag->bufEnd = tag->buf + bufSize; - } - memcpy(tag->buf, tag->rawName, tag->rawNameLength); - tag->rawName = tag->buf; - } - ++tagLevel; - if (startElementHandler) { - enum XML_Error result; - XML_Char *toPtr; - for (;;) { - const char *rawNameEnd = tag->rawName + tag->rawNameLength; - const char *fromPtr = tag->rawName; - int bufSize; - if (nextPtr) - toPtr = (XML_Char *)(tag->buf + ROUND_UP(tag->rawNameLength, sizeof(XML_Char))); - else - toPtr = (XML_Char *)tag->buf; - tag->name.str = toPtr; - XmlConvert(enc, - &fromPtr, rawNameEnd, - (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); - if (fromPtr == rawNameEnd) - break; - bufSize = (tag->bufEnd - tag->buf) << 1; - tag->buf = REALLOC(tag->buf, bufSize); - if (!tag->buf) - return XML_ERROR_NO_MEMORY; - tag->bufEnd = tag->buf + bufSize; - if (nextPtr) - tag->rawName = tag->buf; - } - *toPtr = XML_T('\0'); - result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); - if (result) - return result; - startElementHandler(handlerArg, tag->name.str, (const XML_Char **)atts); - poolClear(&tempPool); - } - else { - tag->name.str = 0; - if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - } - case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: - if (!startElementHandler) { - enum XML_Error result = storeAtts(parser, enc, s, 0, 0); - if (result) - return result; - } - /* fall through */ - case XML_TOK_EMPTY_ELEMENT_NO_ATTS: - if (startElementHandler || endElementHandler) { - const char *rawName = s + enc->minBytesPerChar; - enum XML_Error result; - BINDING *bindings = 0; - TAG_NAME name; - name.str = poolStoreString(&tempPool, enc, rawName, - rawName + XmlNameLength(enc, rawName)); - if (!name.str) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - result = storeAtts(parser, enc, s, &name, &bindings); - if (result) - return result; - poolFinish(&tempPool); - if (startElementHandler) - startElementHandler(handlerArg, name.str, (const XML_Char **)atts); - if (endElementHandler) { - if (startElementHandler) - *eventPP = *eventEndPP; - endElementHandler(handlerArg, name.str); - } - poolClear(&tempPool); - while (bindings) { - BINDING *b = bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - break; - case XML_TOK_END_TAG: - if (tagLevel == startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - else { - int len; - const char *rawName; - TAG *tag = tagStack; - tagStack = tag->parent; - tag->parent = freeTagList; - freeTagList = tag; - rawName = s + enc->minBytesPerChar*2; - len = XmlNameLength(enc, rawName); - if (len != tag->rawNameLength - || memcmp(tag->rawName, rawName, len) != 0) { - *eventPP = rawName; - return XML_ERROR_TAG_MISMATCH; - } - --tagLevel; - if (endElementHandler && tag->name.str) { - if (tag->name.localPart) { - XML_Char *to = (XML_Char *)tag->name.str + tag->name.uriLen; - const XML_Char *from = tag->name.localPart; - while ((*to++ = *from++) != 0) - ; - } - endElementHandler(handlerArg, tag->name.str); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - while (tag->bindings) { - BINDING *b = tag->bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - tag->bindings = tag->bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - } - break; - case XML_TOK_CHAR_REF: - { - int n = XmlCharRefNumber(enc, s); - if (n < 0) - return XML_ERROR_BAD_CHAR_REF; - if (characterDataHandler) { - XML_Char buf[XML_ENCODE_MAX]; - characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_CDATA_SECT_OPEN: - { - enum XML_Error result; - if (startCdataSectionHandler) - startCdataSectionHandler(handlerArg); -#if 0 - /* Suppose you doing a transformation on a document that involves - changing only the character data. You set up a defaultHandler - and a characterDataHandler. The defaultHandler simply copies - characters through. The characterDataHandler does the transformation - and writes the characters out escaping them as necessary. This case - will fail to work if we leave out the following two lines (because & - and < inside CDATA sections will be incorrectly escaped). - - However, now we have a start/endCdataSectionHandler, so it seems - easier to let the user deal with this. */ - - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - result = doCdataSection(parser, enc, &next, end, nextPtr); - if (!next) { - processor = cdataSectionProcessor; - return result; - } - } - break; - case XML_TOK_TRAILING_RSQB: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (XML_Char *)end - (XML_Char *)s); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - if (startTagLevel == 0) { - *eventPP = end; - return XML_ERROR_NO_ELEMENTS; - } - if (tagLevel != startTagLevel) { - *eventPP = end; - return XML_ERROR_ASYNC_ENTITY; - } - return XML_ERROR_NONE; - case XML_TOK_DATA_CHARS: - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); - if (s == next) - break; - *eventPP = s; - } - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (XML_Char *)next - (XML_Char *)s); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - default: - if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - *eventPP = s = next; - } - /* not reached */ -} - -/* If tagNamePtr is non-null, build a real list of attributes, -otherwise just check the attributes for well-formedness. */ - -static enum XML_Error storeAtts(XML_Parser parser, const ENCODING *enc, - const char *attStr, TAG_NAME *tagNamePtr, - BINDING **bindingsPtr) -{ - ELEMENT_TYPE *elementType = 0; - int nDefaultAtts = 0; - const XML_Char **appAtts; /* the attribute list to pass to the application */ - int attIndex = 0; - int i; - int n; - int nPrefixes = 0; - BINDING *binding; - const XML_Char *localPart; - - /* lookup the element type name */ - if (tagNamePtr) { - elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str,0); - if (!elementType) { - tagNamePtr->str = poolCopyString(&dtd.pool, tagNamePtr->str); - if (!tagNamePtr->str) - return XML_ERROR_NO_MEMORY; - elementType = (ELEMENT_TYPE *)lookup(&dtd.elementTypes, tagNamePtr->str, sizeof(ELEMENT_TYPE)); - if (!elementType) - return XML_ERROR_NO_MEMORY; - if (ns && !setElementTypePrefix(parser, elementType)) - return XML_ERROR_NO_MEMORY; - } - nDefaultAtts = elementType->nDefaultAtts; - } - /* get the attributes from the tokenizer */ - n = XmlGetAttributes(enc, attStr, attsSize, atts); - if (n + nDefaultAtts > attsSize) { - int oldAttsSize = attsSize; - attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; - atts = REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); - if (!atts) - return XML_ERROR_NO_MEMORY; - if (n > oldAttsSize) - XmlGetAttributes(enc, attStr, n, atts); - } - appAtts = (const XML_Char **)atts; - for (i = 0; i < n; i++) { - /* add the name and value to the attribute list */ - ATTRIBUTE_ID *attId = getAttributeId(parser, enc, atts[i].name, - atts[i].name - + XmlNameLength(enc, atts[i].name)); - if (!attId) - return XML_ERROR_NO_MEMORY; - /* detect duplicate attributes */ - if ((attId->name)[-1]) { - if (enc == encoding) - eventPtr = atts[i].name; - return XML_ERROR_DUPLICATE_ATTRIBUTE; - } - (attId->name)[-1] = 1; - appAtts[attIndex++] = attId->name; - if (!atts[i].normalized) { - enum XML_Error result; - int isCdata = 1; - - /* figure out whether declared as other than CDATA */ - if (attId->maybeTokenized) { - int j; - for (j = 0; j < nDefaultAtts; j++) { - if (attId == elementType->defaultAtts[j].id) { - isCdata = elementType->defaultAtts[j].isCdata; - break; - } - } - } - - /* normalize the attribute value */ - result = storeAttributeValue(parser, enc, isCdata, - atts[i].valuePtr, atts[i].valueEnd, - &tempPool); - if (result) - return result; - if (tagNamePtr) { - appAtts[attIndex] = poolStart(&tempPool); - poolFinish(&tempPool); - } - else - poolDiscard(&tempPool); - } - else if (tagNamePtr) { - /* the value did not need normalizing */ - appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, atts[i].valueEnd); - if (appAtts[attIndex] == 0) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - } - /* handle prefixed attribute names */ - if (attId->prefix && tagNamePtr) { - if (attId->xmlns) { - /* deal with namespace declarations here */ - if (!addBinding(parser, attId->prefix, attId, appAtts[attIndex], bindingsPtr)) - return XML_ERROR_NO_MEMORY; - --attIndex; - } - else { - /* deal with other prefixed names later */ - attIndex++; - nPrefixes++; - (attId->name)[-1] = 2; - } - } - else - attIndex++; - } - if (tagNamePtr) { - int j; - nSpecifiedAtts = attIndex; - if (elementType->idAtt && (elementType->idAtt->name)[-1]) { - for (i = 0; i < attIndex; i += 2) - if (appAtts[i] == elementType->idAtt->name) { - idAttIndex = i; - break; - } - } - else - idAttIndex = -1; - /* do attribute defaulting */ - for (j = 0; j < nDefaultAtts; j++) { - const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + j; - if (!(da->id->name)[-1] && da->value) { - if (da->id->prefix) { - if (da->id->xmlns) { - if (!addBinding(parser, da->id->prefix, da->id, da->value, bindingsPtr)) - return XML_ERROR_NO_MEMORY; - } - else { - (da->id->name)[-1] = 2; - nPrefixes++; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - else { - (da->id->name)[-1] = 1; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - } - appAtts[attIndex] = 0; - } - i = 0; - if (nPrefixes) { - /* expand prefixed attribute names */ - for (; i < attIndex; i += 2) { - if (appAtts[i][-1] == 2) { - ATTRIBUTE_ID *id; - ((XML_Char *)(appAtts[i]))[-1] = 0; - id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, appAtts[i], 0); - if (id->prefix->binding) { - int j; - const BINDING *b = id->prefix->binding; - const XML_Char *s = appAtts[i]; - for (j = 0; j < b->uriLen; j++) { - if (!poolAppendChar(&tempPool, b->uri[j])) - return XML_ERROR_NO_MEMORY; - } - while (*s++ != ':') - ; - do { - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - } while (*s++); - if (ns_triplets) { - tempPool.ptr[-1] = namespaceSeparator; - s = b->prefix->name; - do { - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - } while (*s++); - } - - appAtts[i] = poolStart(&tempPool); - poolFinish(&tempPool); - } - if (!--nPrefixes) - break; - } - else - ((XML_Char *)(appAtts[i]))[-1] = 0; - } - } - /* clear the flags that say whether attributes were specified */ - for (; i < attIndex; i += 2) - ((XML_Char *)(appAtts[i]))[-1] = 0; - if (!tagNamePtr) - return XML_ERROR_NONE; - for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) - binding->attId->name[-1] = 0; - /* expand the element type name */ - if (elementType->prefix) { - binding = elementType->prefix->binding; - if (!binding) - return XML_ERROR_NONE; - localPart = tagNamePtr->str; - while (*localPart++ != XML_T(':')) - ; - } - else if (dtd.defaultPrefix.binding) { - binding = dtd.defaultPrefix.binding; - localPart = tagNamePtr->str; - } - else - return XML_ERROR_NONE; - tagNamePtr->localPart = localPart; - tagNamePtr->uriLen = binding->uriLen; - for (i = 0; localPart[i++];) - ; - n = i + binding->uriLen; - if (n > binding->uriAlloc) { - TAG *p; - XML_Char *uri = MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char)); - if (!uri) - return XML_ERROR_NO_MEMORY; - binding->uriAlloc = n + EXPAND_SPARE; - memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char)); - for (p = tagStack; p; p = p->parent) - if (p->name.str == binding->uri) - p->name.str = uri; - FREE(binding->uri); - binding->uri = uri; - } - memcpy(binding->uri + binding->uriLen, localPart, i * sizeof(XML_Char)); - tagNamePtr->str = binding->uri; - return XML_ERROR_NONE; -} - -static -int addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, const XML_Char *uri, BINDING **bindingsPtr) -{ - BINDING *b; - int len; - for (len = 0; uri[len]; len++) - ; - if (namespaceSeparator) - len++; - if (freeBindingList) { - b = freeBindingList; - if (len > b->uriAlloc) { - b->uri = REALLOC(b->uri, sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (!b->uri) - return 0; - b->uriAlloc = len + EXPAND_SPARE; - } - freeBindingList = b->nextTagBinding; - } - else { - b = MALLOC(sizeof(BINDING)); - if (!b) - return 0; - b->uri = MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (!b->uri) { - FREE(b); - return 0; - } - b->uriAlloc = len + EXPAND_SPARE; - } - b->uriLen = len; - memcpy(b->uri, uri, len * sizeof(XML_Char)); - if (namespaceSeparator) - b->uri[len - 1] = namespaceSeparator; - b->prefix = prefix; - b->attId = attId; - b->prevPrefixBinding = prefix->binding; - if (*uri == XML_T('\0') && prefix == &dtd.defaultPrefix) - prefix->binding = 0; - else - prefix->binding = b; - b->nextTagBinding = *bindingsPtr; - *bindingsPtr = b; - if (startNamespaceDeclHandler) - startNamespaceDeclHandler(handlerArg, prefix->name, - prefix->binding ? uri : 0); - return 1; -} - -/* The idea here is to avoid using stack for each CDATA section when -the whole file is parsed with one call. */ - -static -enum XML_Error cdataSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doCdataSection(parser, encoding, &start, end, endPtr); - if (start) { - processor = contentProcessor; - return contentProcessor(parser, start, end, endPtr); - } - return result; -} - -/* startPtr gets set to non-null is the section is closed, and to null if -the section is not yet closed. */ - -static -enum XML_Error doCdataSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr) -{ - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = 0; - for (;;) { - const char *next; - int tok = XmlCdataSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_CDATA_SECT_CLOSE: - if (endCdataSectionHandler) - endCdataSectionHandler(handlerArg); -#if 0 - /* see comment under XML_TOK_CDATA_SECT_OPEN */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - return XML_ERROR_NONE; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_DATA_CHARS: - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = next; - characterDataHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); - if (s == next) - break; - *eventPP = s; - } - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (XML_Char *)next - (XML_Char *)s); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_CDATA_SECTION; - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - *eventPP = s = next; - } - /* not reached */ -} - -#ifdef XML_DTD - -/* The idea here is to avoid using stack for each IGNORE section when -the whole file is parsed with one call. */ - -static -enum XML_Error ignoreSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, endPtr); - if (start) { - processor = prologProcessor; - return prologProcessor(parser, start, end, endPtr); - } - return result; -} - -/* startPtr gets set to non-null is the section is closed, and to null if -the section is not yet closed. */ - -static -enum XML_Error doIgnoreSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr) -{ - const char *next; - int tok; - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = 0; - tok = XmlIgnoreSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_IGNORE_SECT: - if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - return XML_ERROR_NONE; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - /* not reached */ -} - -#endif /* XML_DTD */ - -static enum XML_Error -initializeEncoding(XML_Parser parser) -{ - const char *s; -#ifdef XML_UNICODE - char encodingBuf[128]; - if (!protocolEncodingName) - s = 0; - else { - int i; - for (i = 0; protocolEncodingName[i]; i++) { - if (i == sizeof(encodingBuf) - 1 - || (protocolEncodingName[i] & ~0x7f) != 0) { - encodingBuf[0] = '\0'; - break; - } - encodingBuf[i] = (char)protocolEncodingName[i]; - } - encodingBuf[i] = '\0'; - s = encodingBuf; - } -#else - s = protocolEncodingName; -#endif - if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) - return XML_ERROR_NONE; - return handleUnknownEncoding(parser, protocolEncodingName); -} - -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next) -{ - const char *encodingName = 0; - const char *storedEncName = 0; - const ENCODING *newEncoding = 0; - const char *version = 0; - const char *versionend; - const char *storedversion = 0; - int standalone = -1; - if (!(ns - ? XmlParseXmlDeclNS - : XmlParseXmlDecl)(isGeneralTextEntity, - encoding, - s, - next, - &eventPtr, - &version, - &versionend, - &encodingName, - &newEncoding, - &standalone)) - return XML_ERROR_SYNTAX; - if (!isGeneralTextEntity && standalone == 1) { - dtd.standalone = 1; -#ifdef XML_DTD - if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif /* XML_DTD */ - } - if (xmlDeclHandler) { - if (encodingName) { - storedEncName = poolStoreString(&temp2Pool, - encoding, - encodingName, - encodingName - + XmlNameLength(encoding, encodingName)); - if (! storedEncName) - return XML_ERROR_NO_MEMORY; - poolFinish(&temp2Pool); - } - if (version) { - storedversion = poolStoreString(&temp2Pool, - encoding, - version, - versionend - encoding->minBytesPerChar); - if (! storedversion) - return XML_ERROR_NO_MEMORY; - } - xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone); - } - else if (defaultHandler) - reportDefault(parser, encoding, s, next); - if (!protocolEncodingName) { - if (newEncoding) { - if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { - eventPtr = encodingName; - return XML_ERROR_INCORRECT_ENCODING; - } - encoding = newEncoding; - } - else if (encodingName) { - enum XML_Error result; - if (! storedEncName) { - storedEncName = poolStoreString(&temp2Pool, - encoding, - encodingName, - encodingName - + XmlNameLength(encoding, encodingName)); - if (! storedEncName) - return XML_ERROR_NO_MEMORY; - } - result = handleUnknownEncoding(parser, storedEncName); - poolClear(&tempPool); - if (result == XML_ERROR_UNKNOWN_ENCODING) - eventPtr = encodingName; - return result; - } - } - - if (storedEncName || storedversion) - poolClear(&temp2Pool); - - return XML_ERROR_NONE; -} - -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - if (unknownEncodingHandler) { - XML_Encoding info; - int i; - for (i = 0; i < 256; i++) - info.map[i] = -1; - info.convert = 0; - info.data = 0; - info.release = 0; - if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, &info)) { - ENCODING *enc; - unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding()); - if (!unknownEncodingMem) { - if (info.release) - info.release(info.data); - return XML_ERROR_NO_MEMORY; - } - enc = (ns - ? XmlInitUnknownEncodingNS - : XmlInitUnknownEncoding)(unknownEncodingMem, - info.map, - info.convert, - info.data); - if (enc) { - unknownEncodingData = info.data; - unknownEncodingRelease = info.release; - encoding = enc; - return XML_ERROR_NONE; - } - } - if (info.release) - info.release(info.data); - } - return XML_ERROR_UNKNOWN_ENCODING; -} - -static enum XML_Error -prologInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = prologProcessor; - return prologProcessor(parser, s, end, nextPtr); -} - -static enum XML_Error -prologProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *next; - int tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, nextPtr); -} - -static enum XML_Error -doProlog(XML_Parser parser, - const ENCODING *enc, - const char *s, - const char *end, - int tok, - const char *next, - const char **nextPtr) -{ -#ifdef XML_DTD - static const XML_Char externalSubsetName[] = { '#' , '\0' }; -#endif /* XML_DTD */ - - const char **eventPP; - const char **eventEndPP; - enum XML_Content_Quant quant; - - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - for (;;) { - int role; - *eventPP = s; - *eventEndPP = next; - if (tok <= 0) { - if (nextPtr != 0 && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: -#ifdef XML_DTD - if (enc != encoding) - return XML_ERROR_NONE; - if (parentParser) { - if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) - == XML_ROLE_ERROR) - return XML_ERROR_SYNTAX; - hadExternalDoctype = 0; - return XML_ERROR_NONE; - } -#endif /* XML_DTD */ - return XML_ERROR_NO_ELEMENTS; - default: - tok = -tok; - next = end; - break; - } - } - role = XmlTokenRole(&prologState, tok, s, next, enc); - switch (role) { - case XML_ROLE_XML_DECL: - { - enum XML_Error result = processXmlDecl(parser, 0, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - } - break; - case XML_ROLE_DOCTYPE_NAME: - if (startDoctypeDeclHandler) { - doctypeName = poolStoreString(&tempPool, enc, s, next); - if (! doctypeName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - doctypeSysid = 0; - doctypePubid = 0; - } - break; - case XML_ROLE_DOCTYPE_INTERNAL_SUBSET: - if (startDoctypeDeclHandler) { - startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, - doctypePubid, 1); - doctypeName = 0; - poolClear(&tempPool); - } - break; -#ifdef XML_DTD - case XML_ROLE_TEXT_DECL: - { - enum XML_Error result = processXmlDecl(parser, 1, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - } - break; -#endif /* XML_DTD */ - case XML_ROLE_DOCTYPE_PUBLIC_ID: - if (startDoctypeDeclHandler) { - doctypePubid = poolStoreString(&tempPool, enc, s + 1, next - 1); - if (! doctypePubid) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - } -#ifdef XML_DTD - declEntity = (ENTITY *)lookup(&dtd.paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; -#endif /* XML_DTD */ - /* fall through */ - case XML_ROLE_ENTITY_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; - if (declEntity) { - XML_Char *tem = poolStoreString(&dtd.pool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declEntity->publicId = tem; - poolFinish(&dtd.pool); - } - break; - case XML_ROLE_DOCTYPE_CLOSE: - if (doctypeName) { - startDoctypeDeclHandler(handlerArg, doctypeName, - doctypeSysid, doctypePubid, 0); - poolClear(&tempPool); - } - if (dtd.complete && hadExternalDoctype) { - dtd.complete = 0; -#ifdef XML_DTD - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(&dtd.paramEntities, - externalSubsetName, - 0); - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - } -#endif /* XML_DTD */ - if (!dtd.complete - && !dtd.standalone - && notStandaloneHandler - && !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - } - if (endDoctypeDeclHandler) - endDoctypeDeclHandler(handlerArg); - break; - case XML_ROLE_INSTANCE_START: - processor = contentProcessor; - return contentProcessor(parser, s, end, nextPtr); - case XML_ROLE_ATTLIST_ELEMENT_NAME: - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - break; - case XML_ROLE_ATTRIBUTE_NAME: - declAttributeId = getAttributeId(parser, enc, s, next); - if (!declAttributeId) - return XML_ERROR_NO_MEMORY; - declAttributeIsCdata = 0; - declAttributeType = 0; - declAttributeIsId = 0; - break; - case XML_ROLE_ATTRIBUTE_TYPE_CDATA: - declAttributeIsCdata = 1; - declAttributeType = "CDATA"; - break; - case XML_ROLE_ATTRIBUTE_TYPE_ID: - declAttributeIsId = 1; - declAttributeType = "ID"; - break; - case XML_ROLE_ATTRIBUTE_TYPE_IDREF: - declAttributeType = "IDREF"; - break; - case XML_ROLE_ATTRIBUTE_TYPE_IDREFS: - declAttributeType = "IDREFS"; - break; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITY: - declAttributeType = "ENTITY"; - break; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES: - declAttributeType = "ENTITIES"; - break; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN: - declAttributeType = "NMTOKEN"; - break; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS: - declAttributeType = "NMTOKENS"; - break; - - case XML_ROLE_ATTRIBUTE_ENUM_VALUE: - case XML_ROLE_ATTRIBUTE_NOTATION_VALUE: - if (attlistDeclHandler) - { - char *prefix; - if (declAttributeType) { - prefix = "|"; - } - else { - prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE - ? "NOTATION(" - : "("); - } - if (! poolAppendString(&tempPool, prefix)) - return XML_ERROR_NO_MEMORY; - if (! poolAppend(&tempPool, enc, s, next)) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - } - break; - case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: - case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: - if (dtd.complete - && !defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, declAttributeIsId, 0, - parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == '(' - || (*declAttributeType == 'N' && declAttributeType[1] == 'O')) { - /* Enumerated or Notation type */ - if (! poolAppendChar(&tempPool, ')') - || ! poolAppendChar(&tempPool, '\0')) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - } - break; - case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: - case XML_ROLE_FIXED_ATTRIBUTE_VALUE: - { - const XML_Char *attVal; - enum XML_Error result - = storeAttributeValue(parser, enc, declAttributeIsCdata, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar, - &dtd.pool); - if (result) - return result; - attVal = poolStart(&dtd.pool); - poolFinish(&dtd.pool); - if (dtd.complete - /* ID attributes aren't allowed to have a default */ - && !defineAttribute(declElementType, declAttributeId, declAttributeIsCdata, 0, attVal, parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == '(' - || (*declAttributeType == 'N' && declAttributeType[1] == 'O')) { - /* Enumerated or Notation type */ - if (! poolAppendChar(&tempPool, ')') - || ! poolAppendChar(&tempPool, '\0')) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - attVal, - role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - } - break; - } - case XML_ROLE_ENTITY_VALUE: - { - enum XML_Error result = storeEntityValue(parser, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (declEntity) { - declEntity->textPtr = poolStart(&dtd.pool); - declEntity->textLen = poolLength(&dtd.pool); - poolFinish(&dtd.pool); - if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - declEntity->textPtr, - declEntity->textLen, - curBase, 0, 0, 0); - } - } - else - poolDiscard(&dtd.pool); - if (result != XML_ERROR_NONE) - return result; - } - break; - case XML_ROLE_DOCTYPE_SYSTEM_ID: - if (startDoctypeDeclHandler) { - doctypeSysid = poolStoreString(&tempPool, enc, s + 1, next - 1); - if (! doctypeSysid) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - } - if (!dtd.standalone -#ifdef XML_DTD - && !paramEntityParsing -#endif /* XML_DTD */ - && notStandaloneHandler - && !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - hadExternalDoctype = 1; -#ifndef XML_DTD - break; -#else /* XML_DTD */ - if (!declEntity) { - declEntity = (ENTITY *)lookup(&dtd.paramEntities, - externalSubsetName, - sizeof(ENTITY)); - declEntity->publicId = 0; - if (!declEntity) - return XML_ERROR_NO_MEMORY; - } - /* fall through */ -#endif /* XML_DTD */ - case XML_ROLE_ENTITY_SYSTEM_ID: - if (declEntity) { - declEntity->systemId = poolStoreString(&dtd.pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!declEntity->systemId) - return XML_ERROR_NO_MEMORY; - declEntity->base = curBase; - poolFinish(&dtd.pool); - } - break; - case XML_ROLE_ENTITY_COMPLETE: - if (declEntity && entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - 0,0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - 0); - } - break; - case XML_ROLE_ENTITY_NOTATION_NAME: - if (declEntity) { - declEntity->notation = poolStoreString(&dtd.pool, enc, s, next); - if (!declEntity->notation) - return XML_ERROR_NO_MEMORY; - poolFinish(&dtd.pool); - if (unparsedEntityDeclHandler) { - *eventEndPP = s; - unparsedEntityDeclHandler(handlerArg, - declEntity->name, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - } - else if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - 0,0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - } - } - break; - case XML_ROLE_GENERAL_ENTITY_NAME: - { - const XML_Char *name; - if (XmlPredefinedEntityName(enc, s, next)) { - declEntity = 0; - break; - } - name = poolStoreString(&dtd.pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - if (dtd.complete) { - declEntity = (ENTITY *)lookup(&dtd.generalEntities, name, sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd.pool); - declEntity = 0; - } - else { - poolFinish(&dtd.pool); - declEntity->publicId = 0; - declEntity->is_param = 0; - } - } - else { - poolDiscard(&dtd.pool); - declEntity = 0; - } - } - break; - case XML_ROLE_PARAM_ENTITY_NAME: -#ifdef XML_DTD - if (dtd.complete) { - const XML_Char *name = poolStoreString(&dtd.pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(&dtd.paramEntities, - name, sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd.pool); - declEntity = 0; - } - else { - poolFinish(&dtd.pool); - declEntity->publicId = 0; - declEntity->is_param = 1; - } - } -#else /* not XML_DTD */ - declEntity = 0; -#endif /* not XML_DTD */ - break; - case XML_ROLE_NOTATION_NAME: - declNotationPublicId = 0; - declNotationName = 0; - if (notationDeclHandler) { - declNotationName = poolStoreString(&tempPool, enc, s, next); - if (!declNotationName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - } - break; - case XML_ROLE_NOTATION_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_SYNTAX; - if (declNotationName) { - XML_Char *tem = poolStoreString(&tempPool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declNotationPublicId = tem; - poolFinish(&tempPool); - } - break; - case XML_ROLE_NOTATION_SYSTEM_ID: - if (declNotationName && notationDeclHandler) { - const XML_Char *systemId - = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!systemId) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - systemId, - declNotationPublicId); - } - poolClear(&tempPool); - break; - case XML_ROLE_NOTATION_NO_SYSTEM_ID: - if (declNotationPublicId && notationDeclHandler) { - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - 0, - declNotationPublicId); - } - poolClear(&tempPool); - break; - case XML_ROLE_ERROR: - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: - return XML_ERROR_PARAM_ENTITY_REF; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - default: - return XML_ERROR_SYNTAX; - } -#ifdef XML_DTD - case XML_ROLE_IGNORE_SECT: - { - enum XML_Error result; - if (defaultHandler) - reportDefault(parser, enc, s, next); - result = doIgnoreSection(parser, enc, &next, end, nextPtr); - if (!next) { - processor = ignoreSectionProcessor; - return result; - } - } - break; -#endif /* XML_DTD */ - case XML_ROLE_GROUP_OPEN: - if (prologState.level >= groupSize) { - if (groupSize) { - groupConnector = REALLOC(groupConnector, groupSize *= 2); - if (dtd.scaffIndex) - dtd.scaffIndex = REALLOC(dtd.scaffIndex, groupSize * sizeof(int)); - } - else - groupConnector = MALLOC(groupSize = 32); - if (!groupConnector) - return XML_ERROR_NO_MEMORY; - } - groupConnector[prologState.level] = 0; - if (dtd.in_eldecl) { - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd.scaffIndex[dtd.scaffLevel] = myindex; - dtd.scaffLevel++; - dtd.scaffold[myindex].type = XML_CTYPE_SEQ; - } - break; - case XML_ROLE_GROUP_SEQUENCE: - if (groupConnector[prologState.level] == '|') - return XML_ERROR_SYNTAX; - groupConnector[prologState.level] = ','; - break; - case XML_ROLE_GROUP_CHOICE: - if (groupConnector[prologState.level] == ',') - return XML_ERROR_SYNTAX; - if (dtd.in_eldecl - && ! groupConnector[prologState.level] - && dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type != XML_CTYPE_MIXED - ) { - dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type = XML_CTYPE_CHOICE; - } - groupConnector[prologState.level] = '|'; - break; - case XML_ROLE_PARAM_ENTITY_REF: -#ifdef XML_DTD - case XML_ROLE_INNER_PARAM_ENTITY_REF: - if (paramEntityParsing - && (dtd.complete || role == XML_ROLE_INNER_PARAM_ENTITY_REF)) { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&dtd.pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0); - poolDiscard(&dtd.pool); - if (!entity) { - /* FIXME what to do if !dtd.complete? */ - return XML_ERROR_UNDEFINED_ENTITY; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - result = processInternalParamEntity(parser, entity); - if (result != XML_ERROR_NONE) - return result; - break; - } - if (role == XML_ROLE_INNER_PARAM_ENTITY_REF) - return XML_ERROR_PARAM_ENTITY_REF; - if (externalEntityRefHandler) { - dtd.complete = 0; - entity->open = 1; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = 0; - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - } - entity->open = 0; - if (dtd.complete) - break; - } - } -#endif /* XML_DTD */ - if (!dtd.standalone - && notStandaloneHandler - && !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - dtd.complete = 0; - if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - - /* Element declaration stuff */ - - case XML_ROLE_ELEMENT_NAME: - if (elementDeclHandler) { - declElementType = getElementType(parser, enc, s, next); - if (! declElementType) - return XML_ERROR_NO_MEMORY; - dtd.scaffLevel = 0; - dtd.scaffCount = 0; - dtd.in_eldecl = 1; - } - break; - - case XML_ROLE_CONTENT_ANY: - case XML_ROLE_CONTENT_EMPTY: - if (dtd.in_eldecl) { - if (elementDeclHandler) { - XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content)); - if (! content) - return XML_ERROR_NO_MEMORY; - content->quant = XML_CQUANT_NONE; - content->name = 0; - content->numchildren = 0; - content->children = 0; - content->type = ((role == XML_ROLE_CONTENT_ANY) ? - XML_CTYPE_ANY : - XML_CTYPE_EMPTY); - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, content); - } - dtd.in_eldecl = 0; - } - break; - - case XML_ROLE_CONTENT_PCDATA: - if (dtd.in_eldecl) { - dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]].type = XML_CTYPE_MIXED; - } - break; - - case XML_ROLE_CONTENT_ELEMENT: - quant = XML_CQUANT_NONE; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_OPT: - quant = XML_CQUANT_OPT; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_REP: - quant = XML_CQUANT_REP; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_PLUS: - quant = XML_CQUANT_PLUS; - elementContent: - if (dtd.in_eldecl) - { - ELEMENT_TYPE *el; - const char *nxt = quant == XML_CQUANT_NONE ? next : next - 1; - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd.scaffold[myindex].type = XML_CTYPE_NAME; - dtd.scaffold[myindex].quant = quant; - el = getElementType(parser, enc, s, nxt); - if (! el) - return XML_ERROR_NO_MEMORY; - dtd.scaffold[myindex].name = el->name; - dtd.contentStringLen += nxt - s + 1; - } - break; - - case XML_ROLE_GROUP_CLOSE: - quant = XML_CQUANT_NONE; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_OPT: - quant = XML_CQUANT_OPT; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_REP: - quant = XML_CQUANT_REP; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_PLUS: - quant = XML_CQUANT_PLUS; - closeGroup: - if (dtd.in_eldecl) { - dtd.scaffLevel--; - dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel]].quant = quant; - if (dtd.scaffLevel == 0) { - if (elementDeclHandler) { - XML_Content *model = build_model(parser); - if (! model) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, model); - } - dtd.in_eldecl = 0; - dtd.contentStringLen = 0; - } - } - break; - /* End element declaration stuff */ - - case XML_ROLE_NONE: - switch (tok) { - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - } - break; - } - if (defaultHandler) { - switch (tok) { - case XML_TOK_PI: - case XML_TOK_COMMENT: - case XML_TOK_BOM: - case XML_TOK_XML_DECL: -#ifdef XML_DTD - case XML_TOK_IGNORE_SECT: -#endif /* XML_DTD */ - case XML_TOK_PARAM_ENTITY_REF: - break; - default: -#ifdef XML_DTD - if (role != XML_ROLE_IGNORE_SECT) -#endif /* XML_DTD */ - reportDefault(parser, enc, s, next); - } - } - s = next; - tok = XmlPrologTok(enc, s, end, &next); - } - /* not reached */ -} - -static -enum XML_Error epilogProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - processor = epilogProcessor; - eventPtr = s; - for (;;) { - const char *next; - int tok = XmlPrologTok(encoding, s, end, &next); - eventEndPtr = next; - switch (tok) { - case -XML_TOK_PROLOG_S: - if (defaultHandler) { - eventEndPtr = end; - reportDefault(parser, encoding, s, end); - } - /* fall through */ - case XML_TOK_NONE: - if (nextPtr) - *nextPtr = end; - return XML_ERROR_NONE; - case XML_TOK_PROLOG_S: - if (defaultHandler) - reportDefault(parser, encoding, s, next); - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_INVALID: - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (nextPtr) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - default: - return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; - } - eventPtr = s = next; - } -} - -#ifdef XML_DTD - -static enum XML_Error -processInternalParamEntity(XML_Parser parser, ENTITY *entity) -{ - const char *s, *end, *next; - int tok; - enum XML_Error result; - OPEN_INTERNAL_ENTITY openEntity; - entity->open = 1; - openEntity.next = openInternalEntities; - openInternalEntities = &openEntity; - openEntity.entity = entity; - openEntity.internalEventPtr = 0; - openEntity.internalEventEndPtr = 0; - s = (char *)entity->textPtr; - end = (char *)(entity->textPtr + entity->textLen); - tok = XmlPrologTok(internalEncoding, s, end, &next); - result = doProlog(parser, internalEncoding, s, end, tok, next, 0); - entity->open = 0; - openInternalEntities = openEntity.next; - return result; -} - -#endif /* XML_DTD */ - -static -enum XML_Error errorProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - return errorCode; -} - -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, end, pool); - if (result) - return result; - if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) - poolChop(pool); - if (!poolAppendChar(pool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - return XML_ERROR_NONE; -} - -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *enc, int isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - for (;;) { - const char *next; - int tok = XmlAttributeValueTok(enc, ptr, end, &next); - switch (tok) { - case XML_TOK_NONE: - return XML_ERROR_NONE; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, ptr); - if (n < 0) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - if (!isCdata - && n == 0x20 /* space */ - && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - for (i = 0; i < n; i++) { - if (!poolAppendChar(pool, buf[i])) - return XML_ERROR_NO_MEMORY; - } - } - break; - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, ptr, next)) - return XML_ERROR_NO_MEMORY; - break; - break; - case XML_TOK_TRAILING_CR: - next = ptr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_ATTRIBUTE_VALUE_S: - case XML_TOK_DATA_NEWLINE: - if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - if (!poolAppendChar(pool, 0x20)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - XML_Char ch = XmlPredefinedEntityName(enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (!poolAppendChar(pool, ch)) - return XML_ERROR_NO_MEMORY; - break; - } - name = poolStoreString(&temp2Pool, enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(&dtd.generalEntities, name, 0); - poolDiscard(&temp2Pool); - if (!entity) { - if (dtd.complete) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_UNDEFINED_ENTITY; - } - } - else if (entity->open) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_RECURSIVE_ENTITY_REF; - } - else if (entity->notation) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BINARY_ENTITY_REF; - } - else if (!entity->textPtr) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; - } - else { - enum XML_Error result; - const XML_Char *textEnd = entity->textPtr + entity->textLen; - entity->open = 1; - result = appendAttributeValue(parser, internalEncoding, isCdata, (char *)entity->textPtr, (char *)textEnd, pool); - entity->open = 0; - if (result) - return result; - } - } - break; - default: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_UNEXPECTED_STATE; - } - ptr = next; - } - /* not reached */ -} - -static -enum XML_Error storeEntityValue(XML_Parser parser, - const ENCODING *enc, - const char *entityTextPtr, - const char *entityTextEnd) -{ - STRING_POOL *pool = &(dtd.pool); - for (;;) { - const char *next; - int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: -#ifdef XML_DTD - if (parentParser || enc != encoding) { - enum XML_Error result; - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&tempPool, enc, - entityTextPtr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(&dtd.paramEntities, name, 0); - poolDiscard(&tempPool); - if (!entity) { - if (enc == encoding) - eventPtr = entityTextPtr; - return XML_ERROR_UNDEFINED_ENTITY; - } - if (entity->open) { - if (enc == encoding) - eventPtr = entityTextPtr; - return XML_ERROR_RECURSIVE_ENTITY_REF; - } - if (entity->systemId) { - if (enc == encoding) - eventPtr = entityTextPtr; - return XML_ERROR_PARAM_ENTITY_REF; - } - entity->open = 1; - result = storeEntityValue(parser, - internalEncoding, - (char *)entity->textPtr, - (char *)(entity->textPtr + entity->textLen)); - entity->open = 0; - if (result) - return result; - break; - } -#endif /* XML_DTD */ - eventPtr = entityTextPtr; - return XML_ERROR_SYNTAX; - case XML_TOK_NONE: - return XML_ERROR_NONE; - case XML_TOK_ENTITY_REF: - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, entityTextPtr, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_TRAILING_CR: - next = entityTextPtr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_DATA_NEWLINE: - if (pool->end == pool->ptr && !poolGrow(pool)) - return XML_ERROR_NO_MEMORY; - *(pool->ptr)++ = 0xA; - break; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, entityTextPtr); - if (n < 0) { - if (enc == encoding) - eventPtr = entityTextPtr; - return XML_ERROR_BAD_CHAR_REF; - } - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = entityTextPtr; - return XML_ERROR_BAD_CHAR_REF; - } - for (i = 0; i < n; i++) { - if (pool->end == pool->ptr && !poolGrow(pool)) - return XML_ERROR_NO_MEMORY; - *(pool->ptr)++ = buf[i]; - } - } - break; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = entityTextPtr; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - default: - if (enc == encoding) - eventPtr = entityTextPtr; - return XML_ERROR_UNEXPECTED_STATE; - } - entityTextPtr = next; - } - /* not reached */ -} - -static void -normalizeLines(XML_Char *s) -{ - XML_Char *p; - for (;; s++) { - if (*s == XML_T('\0')) - return; - if (*s == 0xD) - break; - } - p = s; - do { - if (*s == 0xD) { - *p++ = 0xA; - if (*++s == 0xA) - s++; - } - else - *p++ = *s++; - } while (*s); - *p = XML_T('\0'); -} - -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) -{ - const XML_Char *target; - XML_Char *data; - const char *tem; - if (!processingInstructionHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - start += enc->minBytesPerChar * 2; - tem = start + XmlNameLength(enc, start); - target = poolStoreString(&tempPool, enc, start, tem); - if (!target) - return 0; - poolFinish(&tempPool); - data = poolStoreString(&tempPool, enc, - XmlSkipS(enc, tem), - end - enc->minBytesPerChar*2); - if (!data) - return 0; - normalizeLines(data); - processingInstructionHandler(handlerArg, target, data); - poolClear(&tempPool); - return 1; -} - -static int -reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) -{ - XML_Char *data; - if (!commentHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - data = poolStoreString(&tempPool, - enc, - start + enc->minBytesPerChar * 4, - end - enc->minBytesPerChar * 3); - if (!data) - return 0; - normalizeLines(data); - commentHandler(handlerArg, data); - poolClear(&tempPool); - return 1; -} - -static void -reportDefault(XML_Parser parser, const ENCODING *enc, const char *s, const char *end) -{ - if (MUST_CONVERT(enc, s)) { - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - do { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - defaultHandler(handlerArg, dataBuf, dataPtr - (ICHAR *)dataBuf); - *eventPP = s; - } while (s != end); - } - else - defaultHandler(handlerArg, (XML_Char *)s, (XML_Char *)end - (XML_Char *)s); -} - - -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, int isCdata, - int isId, const XML_Char *value, XML_Parser parser) -{ - DEFAULT_ATTRIBUTE *att; - if (value || isId) { - /* The handling of default attributes gets messed up if we have - a default which duplicates a non-default. */ - int i; - for (i = 0; i < type->nDefaultAtts; i++) - if (attId == type->defaultAtts[i].id) - return 1; - if (isId && !type->idAtt && !attId->xmlns) - type->idAtt = attId; - } - if (type->nDefaultAtts == type->allocDefaultAtts) { - if (type->allocDefaultAtts == 0) { - type->allocDefaultAtts = 8; - type->defaultAtts = MALLOC(type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE)); - } - else { - type->allocDefaultAtts *= 2; - type->defaultAtts = REALLOC(type->defaultAtts, - type->allocDefaultAtts*sizeof(DEFAULT_ATTRIBUTE)); - } - if (!type->defaultAtts) - return 0; - } - att = type->defaultAtts + type->nDefaultAtts; - att->id = attId; - att->value = value; - att->isCdata = isCdata; - if (!isCdata) - attId->maybeTokenized = 1; - type->nDefaultAtts += 1; - return 1; -} - -static int setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) -{ - const XML_Char *name; - for (name = elementType->name; *name; name++) { - if (*name == XML_T(':')) { - PREFIX *prefix; - const XML_Char *s; - for (s = elementType->name; s != name; s++) { - if (!poolAppendChar(&dtd.pool, *s)) - return 0; - } - if (!poolAppendChar(&dtd.pool, XML_T('\0'))) - return 0; - prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX)); - if (!prefix) - return 0; - if (prefix->name == poolStart(&dtd.pool)) - poolFinish(&dtd.pool); - else - poolDiscard(&dtd.pool); - elementType->prefix = prefix; - - } - } - return 1; -} - -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) -{ - ATTRIBUTE_ID *id; - const XML_Char *name; - if (!poolAppendChar(&dtd.pool, XML_T('\0'))) - return 0; - name = poolStoreString(&dtd.pool, enc, start, end); - if (!name) - return 0; - ++name; - id = (ATTRIBUTE_ID *)lookup(&dtd.attributeIds, name, sizeof(ATTRIBUTE_ID)); - if (!id) - return 0; - if (id->name != name) - poolDiscard(&dtd.pool); - else { - poolFinish(&dtd.pool); - if (!ns) - ; - else if (name[0] == 'x' - && name[1] == 'm' - && name[2] == 'l' - && name[3] == 'n' - && name[4] == 's' - && (name[5] == XML_T('\0') || name[5] == XML_T(':'))) { - if (name[5] == '\0') - id->prefix = &dtd.defaultPrefix; - else - id->prefix = (PREFIX *)lookup(&dtd.prefixes, name + 6, sizeof(PREFIX)); - id->xmlns = 1; - } - else { - int i; - for (i = 0; name[i]; i++) { - if (name[i] == XML_T(':')) { - int j; - for (j = 0; j < i; j++) { - if (!poolAppendChar(&dtd.pool, name[j])) - return 0; - } - if (!poolAppendChar(&dtd.pool, XML_T('\0'))) - return 0; - id->prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&dtd.pool), sizeof(PREFIX)); - if (id->prefix->name == poolStart(&dtd.pool)) - poolFinish(&dtd.pool); - else - poolDiscard(&dtd.pool); - break; - } - } - } - } - return id; -} - -#define CONTEXT_SEP XML_T('\f') - -static -const XML_Char *getContext(XML_Parser parser) -{ - HASH_TABLE_ITER iter; - int needSep = 0; - - if (dtd.defaultPrefix.binding) { - int i; - int len; - if (!poolAppendChar(&tempPool, XML_T('='))) - return 0; - len = dtd.defaultPrefix.binding->uriLen; - if (namespaceSeparator != XML_T('\0')) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, dtd.defaultPrefix.binding->uri[i])) - return 0; - needSep = 1; - } - - hashTableIterInit(&iter, &(dtd.prefixes)); - for (;;) { - int i; - int len; - const XML_Char *s; - PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); - if (!prefix) - break; - if (!prefix->binding) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return 0; - for (s = prefix->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return 0; - if (!poolAppendChar(&tempPool, XML_T('='))) - return 0; - len = prefix->binding->uriLen; - if (namespaceSeparator != XML_T('\0')) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) - return 0; - needSep = 1; - } - - - hashTableIterInit(&iter, &(dtd.generalEntities)); - for (;;) { - const XML_Char *s; - ENTITY *e = (ENTITY *)hashTableIterNext(&iter); - if (!e) - break; - if (!e->open) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return 0; - for (s = e->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return 0; - needSep = 1; - } - - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return 0; - return tempPool.start; -} - -static -int setContext(XML_Parser parser, const XML_Char *context) -{ - const XML_Char *s = context; - - while (*context != XML_T('\0')) { - if (*s == CONTEXT_SEP || *s == XML_T('\0')) { - ENTITY *e; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return 0; - e = (ENTITY *)lookup(&dtd.generalEntities, poolStart(&tempPool), 0); - if (e) - e->open = 1; - if (*s != XML_T('\0')) - s++; - context = s; - poolDiscard(&tempPool); - } - else if (*s == '=') { - PREFIX *prefix; - if (poolLength(&tempPool) == 0) - prefix = &dtd.defaultPrefix; - else { - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return 0; - prefix = (PREFIX *)lookup(&dtd.prefixes, poolStart(&tempPool), sizeof(PREFIX)); - if (!prefix) - return 0; - if (prefix->name == poolStart(&tempPool)) { - prefix->name = poolCopyString(&dtd.pool, prefix->name); - if (!prefix->name) - return 0; - } - poolDiscard(&tempPool); - } - for (context = s + 1; *context != CONTEXT_SEP && *context != XML_T('\0'); context++) - if (!poolAppendChar(&tempPool, *context)) - return 0; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return 0; - if (!addBinding(parser, prefix, 0, poolStart(&tempPool), &inheritedBindings)) - return 0; - poolDiscard(&tempPool); - if (*context != XML_T('\0')) - ++context; - s = context; - } - else { - if (!poolAppendChar(&tempPool, *s)) - return 0; - s++; - } - } - return 1; -} - - -static -void normalizePublicId(XML_Char *publicId) -{ - XML_Char *p = publicId; - XML_Char *s; - for (s = publicId; *s; s++) { - switch (*s) { - case 0x20: - case 0xD: - case 0xA: - if (p != publicId && p[-1] != 0x20) - *p++ = 0x20; - break; - default: - *p++ = *s; - } - } - if (p != publicId && p[-1] == 0x20) - --p; - *p = XML_T('\0'); -} - -static int dtdInit(DTD *p, XML_Parser parser) -{ - XML_Memory_Handling_Suite *ms = &((Parser *) parser)->m_mem; - poolInit(&(p->pool), ms); - hashTableInit(&(p->generalEntities), ms); - hashTableInit(&(p->elementTypes), ms); - hashTableInit(&(p->attributeIds), ms); - hashTableInit(&(p->prefixes), ms); - p->complete = 1; - p->standalone = 0; -#ifdef XML_DTD - hashTableInit(&(p->paramEntities), ms); -#endif /* XML_DTD */ - p->defaultPrefix.name = 0; - p->defaultPrefix.binding = 0; - - p->in_eldecl = 0; - p->scaffIndex = 0; - p->scaffLevel = 0; - p->scaffold = 0; - p->contentStringLen = 0; - p->scaffSize = 0; - p->scaffCount = 0; - - return 1; -} - -#ifdef XML_DTD - -static void dtdSwap(DTD *p1, DTD *p2) -{ - DTD tem; - memcpy(&tem, p1, sizeof(DTD)); - memcpy(p1, p2, sizeof(DTD)); - memcpy(p2, &tem, sizeof(DTD)); -} - -#endif /* XML_DTD */ - -static void dtdDestroy(DTD *p, XML_Parser parser) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - FREE(e->defaultAtts); - } - hashTableDestroy(&(p->generalEntities)); -#ifdef XML_DTD - hashTableDestroy(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableDestroy(&(p->elementTypes)); - hashTableDestroy(&(p->attributeIds)); - hashTableDestroy(&(p->prefixes)); - poolDestroy(&(p->pool)); - if (p->scaffIndex) - FREE(p->scaffIndex); - if (p->scaffold) - FREE(p->scaffold); -} - -/* Do a deep copy of the DTD. Return 0 for out of memory; non-zero otherwise. -The new DTD has already been initialized. */ - -static int dtdCopy(DTD *newDtd, const DTD *oldDtd, XML_Parser parser) -{ - HASH_TABLE_ITER iter; - - /* Copy the prefix table. */ - - hashTableIterInit(&iter, &(oldDtd->prefixes)); - for (;;) { - const XML_Char *name; - const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); - if (!oldP) - break; - name = poolCopyString(&(newDtd->pool), oldP->name); - if (!name) - return 0; - if (!lookup(&(newDtd->prefixes), name, sizeof(PREFIX))) - return 0; - } - - hashTableIterInit(&iter, &(oldDtd->attributeIds)); - - /* Copy the attribute id table. */ - - for (;;) { - ATTRIBUTE_ID *newA; - const XML_Char *name; - const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); - - if (!oldA) - break; - /* Remember to allocate the scratch byte before the name. */ - if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) - return 0; - name = poolCopyString(&(newDtd->pool), oldA->name); - if (!name) - return 0; - ++name; - newA = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), name, sizeof(ATTRIBUTE_ID)); - if (!newA) - return 0; - newA->maybeTokenized = oldA->maybeTokenized; - if (oldA->prefix) { - newA->xmlns = oldA->xmlns; - if (oldA->prefix == &oldDtd->defaultPrefix) - newA->prefix = &newDtd->defaultPrefix; - else - newA->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldA->prefix->name, 0); - } - } - - /* Copy the element type table. */ - - hashTableIterInit(&iter, &(oldDtd->elementTypes)); - - for (;;) { - int i; - ELEMENT_TYPE *newE; - const XML_Char *name; - const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(&(newDtd->pool), oldE->name); - if (!name) - return 0; - newE = (ELEMENT_TYPE *)lookup(&(newDtd->elementTypes), name, sizeof(ELEMENT_TYPE)); - if (!newE) - return 0; - if (oldE->nDefaultAtts) { - newE->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); - if (!newE->defaultAtts) - return 0; - } - if (oldE->idAtt) - newE->idAtt = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->idAtt->name, 0); - newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; - if (oldE->prefix) - newE->prefix = (PREFIX *)lookup(&(newDtd->prefixes), oldE->prefix->name, 0); - for (i = 0; i < newE->nDefaultAtts; i++) { - newE->defaultAtts[i].id = (ATTRIBUTE_ID *)lookup(&(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); - newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; - if (oldE->defaultAtts[i].value) { - newE->defaultAtts[i].value = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); - if (!newE->defaultAtts[i].value) - return 0; - } - else - newE->defaultAtts[i].value = 0; - } - } - - /* Copy the entity tables. */ - if (!copyEntityTable(&(newDtd->generalEntities), - &(newDtd->pool), - &(oldDtd->generalEntities), parser)) - return 0; - -#ifdef XML_DTD - if (!copyEntityTable(&(newDtd->paramEntities), - &(newDtd->pool), - &(oldDtd->paramEntities), parser)) - return 0; -#endif /* XML_DTD */ - - newDtd->complete = oldDtd->complete; - newDtd->standalone = oldDtd->standalone; - - /* Don't want deep copying for scaffolding */ - newDtd->in_eldecl = oldDtd->in_eldecl; - newDtd->scaffold = oldDtd->scaffold; - newDtd->contentStringLen = oldDtd->contentStringLen; - newDtd->scaffSize = oldDtd->scaffSize; - newDtd->scaffLevel = oldDtd->scaffLevel; - newDtd->scaffIndex = oldDtd->scaffIndex; - - return 1; -} /* End dtdCopy */ - -static int copyEntityTable(HASH_TABLE *newTable, - STRING_POOL *newPool, - const HASH_TABLE *oldTable, - XML_Parser parser) -{ - HASH_TABLE_ITER iter; - const XML_Char *cachedOldBase = 0; - const XML_Char *cachedNewBase = 0; - - hashTableIterInit(&iter, oldTable); - - for (;;) { - ENTITY *newE; - const XML_Char *name; - const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(newPool, oldE->name); - if (!name) - return 0; - newE = (ENTITY *)lookup(newTable, name, sizeof(ENTITY)); - if (!newE) - return 0; - if (oldE->systemId) { - const XML_Char *tem = poolCopyString(newPool, oldE->systemId); - if (!tem) - return 0; - newE->systemId = tem; - if (oldE->base) { - if (oldE->base == cachedOldBase) - newE->base = cachedNewBase; - else { - cachedOldBase = oldE->base; - tem = poolCopyString(newPool, cachedOldBase); - if (!tem) - return 0; - cachedNewBase = newE->base = tem; - } - } - } - else { - const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, oldE->textLen); - if (!tem) - return 0; - newE->textPtr = tem; - newE->textLen = oldE->textLen; - } - if (oldE->notation) { - const XML_Char *tem = poolCopyString(newPool, oldE->notation); - if (!tem) - return 0; - newE->notation = tem; - } - } - return 1; -} - -#define INIT_SIZE 64 - -static -int keyeq(KEY s1, KEY s2) -{ - for (; *s1 == *s2; s1++, s2++) - if (*s1 == 0) - return 1; - return 0; -} - -static -unsigned long hash(KEY s) -{ - unsigned long h = 0; - while (*s) - h = (h << 5) + h + (unsigned char)*s++; - return h; -} - -static -NAMED *lookup(HASH_TABLE *table, KEY name, size_t createSize) -{ - size_t i; - if (table->size == 0) { - size_t tsize; - - if (!createSize) - return 0; - tsize = INIT_SIZE * sizeof(NAMED *); - table->v = table->mem->malloc_fcn(tsize); - if (!table->v) - return 0; - memset(table->v, 0, tsize); - table->size = INIT_SIZE; - table->usedLim = INIT_SIZE / 2; - i = hash(name) & (table->size - 1); - } - else { - unsigned long h = hash(name); - for (i = h & (table->size - 1); - table->v[i]; - i == 0 ? i = table->size - 1 : --i) { - if (keyeq(name, table->v[i]->name)) - return table->v[i]; - } - if (!createSize) - return 0; - if (table->used == table->usedLim) { - /* check for overflow */ - size_t newSize = table->size * 2; - size_t tsize = newSize * sizeof(NAMED *); - NAMED **newV = table->mem->malloc_fcn(tsize); - if (!newV) - return 0; - memset(newV, 0, tsize); - for (i = 0; i < table->size; i++) - if (table->v[i]) { - size_t j; - for (j = hash(table->v[i]->name) & (newSize - 1); - newV[j]; - j == 0 ? j = newSize - 1 : --j) - ; - newV[j] = table->v[i]; - } - table->mem->free_fcn(table->v); - table->v = newV; - table->size = newSize; - table->usedLim = newSize/2; - for (i = h & (table->size - 1); - table->v[i]; - i == 0 ? i = table->size - 1 : --i) - ; - } - } - table->v[i] = table->mem->malloc_fcn(createSize); - if (!table->v[i]) - return 0; - memset(table->v[i], 0, createSize); - table->v[i]->name = name; - (table->used)++; - return table->v[i]; -} - -static -void hashTableDestroy(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) { - NAMED *p = table->v[i]; - if (p) - table->mem->free_fcn(p); - } - if (table->v) - table->mem->free_fcn(table->v); -} - -static -void hashTableInit(HASH_TABLE *p, XML_Memory_Handling_Suite *ms) -{ - p->size = 0; - p->usedLim = 0; - p->used = 0; - p->v = 0; - p->mem = ms; -} - -static -void hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) -{ - iter->p = table->v; - iter->end = iter->p + table->size; -} - -static -NAMED *hashTableIterNext(HASH_TABLE_ITER *iter) -{ - while (iter->p != iter->end) { - NAMED *tem = *(iter->p)++; - if (tem) - return tem; - } - return 0; -} - - -static -void poolInit(STRING_POOL *pool, XML_Memory_Handling_Suite *ms) -{ - pool->blocks = 0; - pool->freeBlocks = 0; - pool->start = 0; - pool->ptr = 0; - pool->end = 0; - pool->mem = ms; -} - -static -void poolClear(STRING_POOL *pool) -{ - if (!pool->freeBlocks) - pool->freeBlocks = pool->blocks; - else { - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - p->next = pool->freeBlocks; - pool->freeBlocks = p; - p = tem; - } - } - pool->blocks = 0; - pool->start = 0; - pool->ptr = 0; - pool->end = 0; -} - -static -void poolDestroy(STRING_POOL *pool) -{ - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } - pool->blocks = 0; - p = pool->freeBlocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } - pool->freeBlocks = 0; - pool->ptr = 0; - pool->start = 0; - pool->end = 0; -} - -static -XML_Char *poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!pool->ptr && !poolGrow(pool)) - return 0; - for (;;) { - XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); - if (ptr == end) - break; - if (!poolGrow(pool)) - return 0; - } - return pool->start; -} - -static const XML_Char *poolCopyString(STRING_POOL *pool, const XML_Char *s) -{ - do { - if (!poolAppendChar(pool, *s)) - return 0; - } while (*s++); - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char *poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) -{ - if (!pool->ptr && !poolGrow(pool)) - return 0; - for (; n > 0; --n, s++) { - if (!poolAppendChar(pool, *s)) - return 0; - - } - s = pool->start; - poolFinish(pool); - return s; -} - -static -const XML_Char *poolAppendString(STRING_POOL *pool, const XML_Char *s) -{ - while (*s) { - if (!poolAppendChar(pool, *s)) - return 0; - s++; - } - return pool->start; -} /* End poolAppendString */ - -static -XML_Char *poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!poolAppend(pool, enc, ptr, end)) - return 0; - if (pool->ptr == pool->end && !poolGrow(pool)) - return 0; - *(pool->ptr)++ = 0; - return pool->start; -} - -static -int poolGrow(STRING_POOL *pool) -{ - if (pool->freeBlocks) { - if (pool->start == 0) { - pool->blocks = pool->freeBlocks; - pool->freeBlocks = pool->freeBlocks->next; - pool->blocks->next = 0; - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - pool->ptr = pool->start; - return 1; - } - if (pool->end - pool->start < pool->freeBlocks->size) { - BLOCK *tem = pool->freeBlocks->next; - pool->freeBlocks->next = pool->blocks; - pool->blocks = pool->freeBlocks; - pool->freeBlocks = tem; - memcpy(pool->blocks->s, pool->start, (pool->end - pool->start) * sizeof(XML_Char)); - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - return 1; - } - } - if (pool->blocks && pool->start == pool->blocks->s) { - int blockSize = (pool->end - pool->start)*2; - pool->blocks = pool->mem->realloc_fcn(pool->blocks, offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); - if (!pool->blocks) - return 0; - pool->blocks->size = blockSize; - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + blockSize; - } - else { - BLOCK *tem; - int blockSize = pool->end - pool->start; - if (blockSize < INIT_BLOCK_SIZE) - blockSize = INIT_BLOCK_SIZE; - else - blockSize *= 2; - tem = pool->mem->malloc_fcn(offsetof(BLOCK, s) + blockSize * sizeof(XML_Char)); - if (!tem) - return 0; - tem->size = blockSize; - tem->next = pool->blocks; - pool->blocks = tem; - if (pool->ptr != pool->start) - memcpy(tem->s, pool->start, (pool->ptr - pool->start) * sizeof(XML_Char)); - pool->ptr = tem->s + (pool->ptr - pool->start); - pool->start = tem->s; - pool->end = tem->s + blockSize; - } - return 1; -} - -static int -nextScaffoldPart(XML_Parser parser) -{ - CONTENT_SCAFFOLD * me; - int next; - - if (! dtd.scaffIndex) { - dtd.scaffIndex = MALLOC(groupSize * sizeof(int)); - if (! dtd.scaffIndex) - return -1; - dtd.scaffIndex[0] = 0; - } - - if (dtd.scaffCount >= dtd.scaffSize) { - if (dtd.scaffold) { - dtd.scaffSize *= 2; - dtd.scaffold = (CONTENT_SCAFFOLD *) REALLOC(dtd.scaffold, - dtd.scaffSize * sizeof(CONTENT_SCAFFOLD)); - } - else { - dtd.scaffSize = 32; - dtd.scaffold = (CONTENT_SCAFFOLD *) MALLOC(dtd.scaffSize * sizeof(CONTENT_SCAFFOLD)); - } - if (! dtd.scaffold) - return -1; - } - next = dtd.scaffCount++; - me = &dtd.scaffold[next]; - if (dtd.scaffLevel) { - CONTENT_SCAFFOLD *parent = &dtd.scaffold[dtd.scaffIndex[dtd.scaffLevel - 1]]; - if (parent->lastchild) { - dtd.scaffold[parent->lastchild].nextsib = next; - } - if (! parent->childcnt) - parent->firstchild = next; - parent->lastchild = next; - parent->childcnt++; - } - me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0; - return next; -} /* End nextScaffoldPart */ - -static void -build_node (XML_Parser parser, - int src_node, - XML_Content *dest, - XML_Content **contpos, - char **strpos) -{ - dest->type = dtd.scaffold[src_node].type; - dest->quant = dtd.scaffold[src_node].quant; - if (dest->type == XML_CTYPE_NAME) { - const char *src; - dest->name = *strpos; - src = dtd.scaffold[src_node].name; - for (;;) { - *(*strpos)++ = *src; - if (! *src) - break; - src++; - } - dest->numchildren = 0; - dest->children = 0; - } - else { - unsigned int i; - int cn; - dest->numchildren = dtd.scaffold[src_node].childcnt; - dest->children = *contpos; - *contpos += dest->numchildren; - for (i = 0, cn = dtd.scaffold[src_node].firstchild; - i < dest->numchildren; - i++, cn = dtd.scaffold[cn].nextsib) { - build_node(parser, cn, &(dest->children[i]), contpos, strpos); - } - dest->name = 0; - } -} /* End build_node */ - -static XML_Content * -build_model (XML_Parser parser) -{ - XML_Content *ret; - XML_Content *cpos; - char * str; - int allocsize = dtd.scaffCount * sizeof(XML_Content) + dtd.contentStringLen; - - ret = MALLOC(allocsize); - if (! ret) - return 0; - - str = (char *) (&ret[dtd.scaffCount]); - cpos = &ret[1]; - - build_node(parser, 0, ret, &cpos, &str); - return ret; -} /* End build_model */ - -static ELEMENT_TYPE * -getElementType(XML_Parser parser, - const ENCODING *enc, - const char *ptr, - const char *end) -{ - const XML_Char *name = poolStoreString(&dtd.pool, enc, ptr, end); - ELEMENT_TYPE *ret; - - if (! name) - return 0; - ret = (ELEMENT_TYPE *) lookup(&dtd.elementTypes, name, sizeof(ELEMENT_TYPE)); - if (! ret) - return 0; - if (ret->name != name) - poolDiscard(&dtd.pool); - else { - poolFinish(&dtd.pool); - if (!setElementTypePrefix(parser, ret)) - return 0; - } - return ret; -} /* End getElementType */ diff --git a/libs/apr-util/xml/expat/lib/xmlrole.c b/libs/apr-util/xml/expat/lib/xmlrole.c deleted file mode 100644 index ac130392ef..0000000000 --- a/libs/apr-util/xml/expat/lib/xmlrole.c +++ /dev/null @@ -1,1275 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -static char RCSId[] - = "$Header: /home/cvs/apr-util/xml/expat/lib/xmlrole.c,v 1.1 2001/02/28 14:41:26 gstein Exp $"; - -#ifdef COMPILED_FROM_DSP -# include "winconfig.h" -#else -# include -#endif /* ndef COMPILED_FROM_DSP */ - -#include "xmlrole.h" -#include "ascii.h" - -/* Doesn't check: - - that ,| are not mixed in a model group - content of literals - -*/ - -static const char KW_ANY[] = { ASCII_A, ASCII_N, ASCII_Y, '\0' }; -static const char KW_ATTLIST[] = { ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' }; -static const char KW_CDATA[] = { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_DOCTYPE[] = { ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' }; -static const char KW_ELEMENT[] = { ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' }; -static const char KW_EMPTY[] = { ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' }; -static const char KW_ENTITIES[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' }; -static const char KW_ENTITY[] = { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; -static const char KW_FIXED[] = { ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' }; -static const char KW_ID[] = { ASCII_I, ASCII_D, '\0' }; -static const char KW_IDREF[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; -static const char KW_IDREFS[] = { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; -static const char KW_IGNORE[] = { ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; -static const char KW_IMPLIED[] = { ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; -static const char KW_INCLUDE[] = { ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; -static const char KW_NDATA[] = { ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_NMTOKEN[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; -static const char KW_NMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' }; -static const char KW_NOTATION[] = { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, '\0' }; -static const char KW_PCDATA[] = { ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_PUBLIC[] = { ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' }; -static const char KW_REQUIRED[] = { ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, '\0' }; -static const char KW_SYSTEM[] = { ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' }; - -#ifndef MIN_BYTES_PER_CHAR -#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) -#endif - -#ifdef XML_DTD -#define setTopLevel(state) \ - ((state)->handler = ((state)->documentEntity \ - ? internalSubset \ - : externalSubset1)) -#else /* not XML_DTD */ -#define setTopLevel(state) ((state)->handler = internalSubset) -#endif /* not XML_DTD */ - -typedef int PROLOG_HANDLER(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - -static PROLOG_HANDLER - prolog0, prolog1, prolog2, - doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, - internalSubset, - entity0, entity1, entity2, entity3, entity4, entity5, entity6, - entity7, entity8, entity9, - notation0, notation1, notation2, notation3, notation4, - attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, - attlist7, attlist8, attlist9, - element0, element1, element2, element3, element4, element5, element6, - element7, -#ifdef XML_DTD - externalSubset0, externalSubset1, - condSect0, condSect1, condSect2, -#endif /* XML_DTD */ - declClose, - error; - -static -int common(PROLOG_STATE *state, int tok); - -static -int prolog0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - state->handler = prolog1; - return XML_ROLE_NONE; - case XML_TOK_XML_DECL: - state->handler = prolog1; - return XML_ROLE_XML_DECL; - case XML_TOK_PI: - state->handler = prolog1; - return XML_ROLE_NONE; - case XML_TOK_COMMENT: - state->handler = prolog1; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static -int prolog1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - case XML_TOK_COMMENT: - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static -int prolog2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - case XML_TOK_COMMENT: - return XML_ROLE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static -int doctype0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = doctype1; - return XML_ROLE_DOCTYPE_NAME; - } - return common(state, tok); -} - -static -int doctype1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = doctype3; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = doctype2; - return XML_ROLE_NONE; - } - break; - } - return common(state, tok); -} - -static -int doctype2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype3; - return XML_ROLE_DOCTYPE_PUBLIC_ID; - } - return common(state, tok); -} - -static -int doctype3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype4; - return XML_ROLE_DOCTYPE_SYSTEM_ID; - } - return common(state, tok); -} - -static -int doctype4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static -int doctype5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static -int internalSubset(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ENTITY)) { - state->handler = entity0; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ATTLIST)) { - state->handler = attlist0; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ELEMENT)) { - state->handler = element0; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_NOTATION)) { - state->handler = notation0; - return XML_ROLE_NONE; - } - break; - case XML_TOK_PI: - case XML_TOK_COMMENT: - return XML_ROLE_NONE; - case XML_TOK_PARAM_ENTITY_REF: - return XML_ROLE_PARAM_ENTITY_REF; - case XML_TOK_CLOSE_BRACKET: - state->handler = doctype5; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static -int externalSubset0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - state->handler = externalSubset1; - if (tok == XML_TOK_XML_DECL) - return XML_ROLE_TEXT_DECL; - return externalSubset1(state, tok, ptr, end, enc); -} - -static -int externalSubset1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_COND_SECT_OPEN: - state->handler = condSect0; - return XML_ROLE_NONE; - case XML_TOK_COND_SECT_CLOSE: - if (state->includeLevel == 0) - break; - state->includeLevel -= 1; - return XML_ROLE_NONE; - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_BRACKET: - break; - case XML_TOK_NONE: - if (state->includeLevel) - break; - return XML_ROLE_NONE; - default: - return internalSubset(state, tok, ptr, end, enc); - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static -int entity0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PERCENT: - state->handler = entity1; - return XML_ROLE_NONE; - case XML_TOK_NAME: - state->handler = entity2; - return XML_ROLE_GENERAL_ENTITY_NAME; - } - return common(state, tok); -} - -static -int entity1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - state->handler = entity7; - return XML_ROLE_PARAM_ENTITY_NAME; - } - return common(state, tok); -} - -static -int entity2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity4; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity3; - return XML_ROLE_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static -int entity3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = entity4; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - - -static -int entity4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = entity5; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static -int entity5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) { - state->handler = entity6; - return XML_ROLE_NONE; - } - break; - } - return common(state, tok); -} - -static -int entity6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - state->handler = declClose; - return XML_ROLE_ENTITY_NOTATION_NAME; - } - return common(state, tok); -} - -static -int entity7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity9; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity8; - return XML_ROLE_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static -int entity8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = entity9; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static -int entity9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static -int notation0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - state->handler = notation1; - return XML_ROLE_NOTATION_NAME; - } - return common(state, tok); -} - -static -int notation1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = notation3; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = notation2; - return XML_ROLE_NONE; - } - break; - } - return common(state, tok); -} - -static -int notation2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = notation4; - return XML_ROLE_NOTATION_PUBLIC_ID; - } - return common(state, tok); -} - -static -int notation3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - return XML_ROLE_NOTATION_SYSTEM_ID; - } - return common(state, tok); -} - -static -int notation4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - return XML_ROLE_NOTATION_SYSTEM_ID; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_NOTATION_NO_SYSTEM_ID; - } - return common(state, tok); -} - -static -int attlist0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist1; - return XML_ROLE_ATTLIST_ELEMENT_NAME; - } - return common(state, tok); -} - -static -int attlist1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist2; - return XML_ROLE_ATTRIBUTE_NAME; - } - return common(state, tok); -} - -static -int attlist2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - { - static const char *types[] = { - KW_CDATA, - KW_ID, - KW_IDREF, - KW_IDREFS, - KW_ENTITY, - KW_ENTITIES, - KW_NMTOKEN, - KW_NMTOKENS, - }; - int i; - for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) - if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { - state->handler = attlist8; - return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; - } - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) { - state->handler = attlist5; - return XML_ROLE_NONE; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = attlist3; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static -int attlist3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NMTOKEN: - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist4; - return XML_ROLE_ATTRIBUTE_ENUM_VALUE; - } - return common(state, tok); -} - -static -int attlist4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_NONE; - case XML_TOK_OR: - state->handler = attlist3; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static -int attlist5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_PAREN: - state->handler = attlist6; - return XML_ROLE_NONE; - } - return common(state, tok); -} - - -static -int attlist6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - state->handler = attlist7; - return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; - } - return common(state, tok); -} - -static -int attlist7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_NONE; - case XML_TOK_OR: - state->handler = attlist6; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -/* default value */ -static -int attlist8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_IMPLIED)) { - state->handler = attlist1; - return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_REQUIRED)) { - state->handler = attlist1; - return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_FIXED)) { - state->handler = attlist9; - return XML_ROLE_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static -int attlist9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_FIXED_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static -int element0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element1; - return XML_ROLE_ELEMENT_NAME; - } - return common(state, tok); -} - -static -int element1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) { - state->handler = declClose; - return XML_ROLE_CONTENT_EMPTY; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) { - state->handler = declClose; - return XML_ROLE_CONTENT_ANY; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = element2; - state->level = 1; - return XML_ROLE_GROUP_OPEN; - } - return common(state, tok); -} - -static -int element2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_PCDATA)) { - state->handler = element3; - return XML_ROLE_CONTENT_PCDATA; - } - break; - case XML_TOK_OPEN_PAREN: - state->level = 2; - state->handler = element6; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static -int element3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = declClose; - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static -int element4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element5; - return XML_ROLE_CONTENT_ELEMENT; - } - return common(state, tok); -} - -static -int element5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static -int element6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_PAREN: - state->level += 1; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static -int element7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_PAREN: - state->level -= 1; - if (state->level == 0) - state->handler = declClose; - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->level -= 1; - if (state->level == 0) - state->handler = declClose; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_CLOSE_PAREN_QUESTION: - state->level -= 1; - if (state->level == 0) - state->handler = declClose; - return XML_ROLE_GROUP_CLOSE_OPT; - case XML_TOK_CLOSE_PAREN_PLUS: - state->level -= 1; - if (state->level == 0) - state->handler = declClose; - return XML_ROLE_GROUP_CLOSE_PLUS; - case XML_TOK_COMMA: - state->handler = element6; - return XML_ROLE_GROUP_SEQUENCE; - case XML_TOK_OR: - state->handler = element6; - return XML_ROLE_GROUP_CHOICE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static -int condSect0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) { - state->handler = condSect1; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) { - state->handler = condSect2; - return XML_ROLE_NONE; - } - break; - } - return common(state, tok); -} - -static -int condSect1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - state->includeLevel += 1; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static -int condSect2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - return XML_ROLE_IGNORE_SECT; - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static -int declClose(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_NONE; - } - return common(state, tok); -} - -#if 0 - -static -int ignore(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_DECL_CLOSE: - state->handler = internalSubset; - return 0; - default: - return XML_ROLE_NONE; - } - return common(state, tok); -} -#endif - -static -int error(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - return XML_ROLE_NONE; -} - -static -int common(PROLOG_STATE *state, int tok) -{ -#ifdef XML_DTD - if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) - return XML_ROLE_INNER_PARAM_ENTITY_REF; -#endif - state->handler = error; - return XML_ROLE_ERROR; -} - -void XmlPrologStateInit(PROLOG_STATE *state) -{ - state->handler = prolog0; -#ifdef XML_DTD - state->documentEntity = 1; - state->includeLevel = 0; -#endif /* XML_DTD */ -} - -#ifdef XML_DTD - -void XmlPrologStateInitExternalEntity(PROLOG_STATE *state) -{ - state->handler = externalSubset0; - state->documentEntity = 0; - state->includeLevel = 0; -} - -#endif /* XML_DTD */ diff --git a/libs/apr-util/xml/expat/lib/xmlrole.h b/libs/apr-util/xml/expat/lib/xmlrole.h deleted file mode 100644 index db3ebc8484..0000000000 --- a/libs/apr-util/xml/expat/lib/xmlrole.h +++ /dev/null @@ -1,100 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -#ifndef XmlRole_INCLUDED -#define XmlRole_INCLUDED 1 - -#include "xmltok.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - XML_ROLE_ERROR = -1, - XML_ROLE_NONE = 0, - XML_ROLE_XML_DECL, - XML_ROLE_INSTANCE_START, - XML_ROLE_DOCTYPE_NAME, - XML_ROLE_DOCTYPE_SYSTEM_ID, - XML_ROLE_DOCTYPE_PUBLIC_ID, - XML_ROLE_DOCTYPE_INTERNAL_SUBSET, - XML_ROLE_DOCTYPE_CLOSE, - XML_ROLE_GENERAL_ENTITY_NAME, - XML_ROLE_PARAM_ENTITY_NAME, - XML_ROLE_ENTITY_VALUE, - XML_ROLE_ENTITY_SYSTEM_ID, - XML_ROLE_ENTITY_PUBLIC_ID, - XML_ROLE_ENTITY_COMPLETE, - XML_ROLE_ENTITY_NOTATION_NAME, - XML_ROLE_NOTATION_NAME, - XML_ROLE_NOTATION_SYSTEM_ID, - XML_ROLE_NOTATION_NO_SYSTEM_ID, - XML_ROLE_NOTATION_PUBLIC_ID, - XML_ROLE_ATTRIBUTE_NAME, - XML_ROLE_ATTRIBUTE_TYPE_CDATA, - XML_ROLE_ATTRIBUTE_TYPE_ID, - XML_ROLE_ATTRIBUTE_TYPE_IDREF, - XML_ROLE_ATTRIBUTE_TYPE_IDREFS, - XML_ROLE_ATTRIBUTE_TYPE_ENTITY, - XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, - XML_ROLE_ATTRIBUTE_ENUM_VALUE, - XML_ROLE_ATTRIBUTE_NOTATION_VALUE, - XML_ROLE_ATTLIST_ELEMENT_NAME, - XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, - XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, - XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, - XML_ROLE_FIXED_ATTRIBUTE_VALUE, - XML_ROLE_ELEMENT_NAME, - XML_ROLE_CONTENT_ANY, - XML_ROLE_CONTENT_EMPTY, - XML_ROLE_CONTENT_PCDATA, - XML_ROLE_GROUP_OPEN, - XML_ROLE_GROUP_CLOSE, - XML_ROLE_GROUP_CLOSE_REP, - XML_ROLE_GROUP_CLOSE_OPT, - XML_ROLE_GROUP_CLOSE_PLUS, - XML_ROLE_GROUP_CHOICE, - XML_ROLE_GROUP_SEQUENCE, - XML_ROLE_CONTENT_ELEMENT, - XML_ROLE_CONTENT_ELEMENT_REP, - XML_ROLE_CONTENT_ELEMENT_OPT, - XML_ROLE_CONTENT_ELEMENT_PLUS, -#ifdef XML_DTD - XML_ROLE_TEXT_DECL, - XML_ROLE_IGNORE_SECT, - XML_ROLE_INNER_PARAM_ENTITY_REF, -#endif /* XML_DTD */ - XML_ROLE_PARAM_ENTITY_REF -}; - -typedef struct prolog_state { - int (*handler)(struct prolog_state *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - unsigned level; -#ifdef XML_DTD - unsigned includeLevel; - int documentEntity; -#endif /* XML_DTD */ -} PROLOG_STATE; - -void XmlPrologStateInit(PROLOG_STATE *); -#ifdef XML_DTD -void XmlPrologStateInitExternalEntity(PROLOG_STATE *); -#endif /* XML_DTD */ - -#define XmlTokenRole(state, tok, ptr, end, enc) \ - (((state)->handler)(state, tok, ptr, end, enc)) - -#ifdef __cplusplus -} -#endif - -#endif /* not XmlRole_INCLUDED */ diff --git a/libs/apr-util/xml/expat/lib/xmltok.c b/libs/apr-util/xml/expat/lib/xmltok.c deleted file mode 100644 index 74c681f1e6..0000000000 --- a/libs/apr-util/xml/expat/lib/xmltok.c +++ /dev/null @@ -1,1569 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -static char RCSId[] - = "$Header: /home/cvs/apr-util/xml/expat/lib/xmltok.c,v 1.1 2001/02/28 14:41:26 gstein Exp $"; - -#ifdef COMPILED_FROM_DSP -# include "winconfig.h" -#else -# include -#endif /* ndef COMPILED_FROM_DSP */ - -#include "xmltok.h" -#include "nametab.h" - -#ifdef XML_DTD -#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) -#else -#define IGNORE_SECTION_TOK_VTABLE /* as nothing */ -#endif - -#define VTABLE1 \ - { PREFIX(prologTok), PREFIX(contentTok), \ - PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ - { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ - PREFIX(sameName), \ - PREFIX(nameMatchesAscii), \ - PREFIX(nameLength), \ - PREFIX(skipS), \ - PREFIX(getAtts), \ - PREFIX(charRefNumber), \ - PREFIX(predefinedEntityName), \ - PREFIX(updatePosition), \ - PREFIX(isPublicId) - -#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) - -#define UCS2_GET_NAMING(pages, hi, lo) \ - (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) - -/* A 2 byte UTF-8 representation splits the characters 11 bits -between the bottom 5 and 6 bits of the bytes. -We need 8 bits to index into pages, 3 bits to add to that index and -5 bits to generate the mask. */ -#define UTF8_GET_NAMING2(pages, byte) \ - (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ - + ((((byte)[0]) & 3) << 1) \ - + ((((byte)[1]) >> 5) & 1)] \ - & (1 << (((byte)[1]) & 0x1F))) - -/* A 3 byte UTF-8 representation splits the characters 16 bits -between the bottom 4, 6 and 6 bits of the bytes. -We need 8 bits to index into pages, 3 bits to add to that index and -5 bits to generate the mask. */ -#define UTF8_GET_NAMING3(pages, byte) \ - (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ - + ((((byte)[1]) >> 2) & 0xF)] \ - << 3) \ - + ((((byte)[1]) & 3) << 1) \ - + ((((byte)[2]) >> 5) & 1)] \ - & (1 << (((byte)[2]) & 0x1F))) - -#define UTF8_GET_NAMING(pages, p, n) \ - ((n) == 2 \ - ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ - : ((n) == 3 \ - ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ - : 0)) - -#define UTF8_INVALID3(p) \ - ((*p) == 0xED \ - ? (((p)[1] & 0x20) != 0) \ - : ((*p) == 0xEF \ - ? ((p)[1] == 0xBF && ((p)[2] == 0xBF || (p)[2] == 0xBE)) \ - : 0)) - -#define UTF8_INVALID4(p) ((*p) == 0xF4 && ((p)[1] & 0x30) != 0) - -static -int isNever(const ENCODING *enc, const char *p) -{ - return 0; -} - -static -int utf8_isName2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); -} - -static -int utf8_isName3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); -} - -#define utf8_isName4 isNever - -static -int utf8_isNmstrt2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); -} - -static -int utf8_isNmstrt3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); -} - -#define utf8_isNmstrt4 isNever - -#define utf8_isInvalid2 isNever - -static -int utf8_isInvalid3(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID3((const unsigned char *)p); -} - -static -int utf8_isInvalid4(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID4((const unsigned char *)p); -} - -struct normal_encoding { - ENCODING enc; - unsigned char type[256]; -#ifdef XML_MIN_SIZE - int (*byteType)(const ENCODING *, const char *); - int (*isNameMin)(const ENCODING *, const char *); - int (*isNmstrtMin)(const ENCODING *, const char *); - int (*byteToAscii)(const ENCODING *, const char *); - int (*charMatches)(const ENCODING *, const char *, int); -#endif /* XML_MIN_SIZE */ - int (*isName2)(const ENCODING *, const char *); - int (*isName3)(const ENCODING *, const char *); - int (*isName4)(const ENCODING *, const char *); - int (*isNmstrt2)(const ENCODING *, const char *); - int (*isNmstrt3)(const ENCODING *, const char *); - int (*isNmstrt4)(const ENCODING *, const char *); - int (*isInvalid2)(const ENCODING *, const char *); - int (*isInvalid3)(const ENCODING *, const char *); - int (*isInvalid4)(const ENCODING *, const char *); -}; - -#ifdef XML_MIN_SIZE - -#define STANDARD_VTABLE(E) \ - E ## byteType, \ - E ## isNameMin, \ - E ## isNmstrtMin, \ - E ## byteToAscii, \ - E ## charMatches, - -#else - -#define STANDARD_VTABLE(E) /* as nothing */ - -#endif - -#define NORMAL_VTABLE(E) \ - E ## isName2, \ - E ## isName3, \ - E ## isName4, \ - E ## isNmstrt2, \ - E ## isNmstrt3, \ - E ## isNmstrt4, \ - E ## isInvalid2, \ - E ## isInvalid3, \ - E ## isInvalid4 - -static int checkCharRefNumber(int); - -#include "xmltok_impl.h" -#include "ascii.h" - -#ifdef XML_MIN_SIZE -#define sb_isNameMin isNever -#define sb_isNmstrtMin isNever -#endif - -#ifdef XML_MIN_SIZE -#define MINBPC(enc) ((enc)->minBytesPerChar) -#else -/* minimum bytes per character */ -#define MINBPC(enc) 1 -#endif - -#define SB_BYTE_TYPE(enc, p) \ - (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) - -#ifdef XML_MIN_SIZE -static -int sb_byteType(const ENCODING *enc, const char *p) -{ - return SB_BYTE_TYPE(enc, p); -} -#define BYTE_TYPE(enc, p) \ - (((const struct normal_encoding *)(enc))->byteType(enc, p)) -#else -#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) -#endif - -#ifdef XML_MIN_SIZE -#define BYTE_TO_ASCII(enc, p) \ - (((const struct normal_encoding *)(enc))->byteToAscii(enc, p)) -static -int sb_byteToAscii(const ENCODING *enc, const char *p) -{ - return *p; -} -#else -#define BYTE_TO_ASCII(enc, p) (*(p)) -#endif - -#define IS_NAME_CHAR(enc, p, n) \ - (((const struct normal_encoding *)(enc))->isName ## n(enc, p)) -#define IS_NMSTRT_CHAR(enc, p, n) \ - (((const struct normal_encoding *)(enc))->isNmstrt ## n(enc, p)) -#define IS_INVALID_CHAR(enc, p, n) \ - (((const struct normal_encoding *)(enc))->isInvalid ## n(enc, p)) - -#ifdef XML_MIN_SIZE -#define IS_NAME_CHAR_MINBPC(enc, p) \ - (((const struct normal_encoding *)(enc))->isNameMin(enc, p)) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ - (((const struct normal_encoding *)(enc))->isNmstrtMin(enc, p)) -#else -#define IS_NAME_CHAR_MINBPC(enc, p) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) -#endif - -#ifdef XML_MIN_SIZE -#define CHAR_MATCHES(enc, p, c) \ - (((const struct normal_encoding *)(enc))->charMatches(enc, p, c)) -static -int sb_charMatches(const ENCODING *enc, const char *p, int c) -{ - return *p == c; -} -#else -/* c is an ASCII character */ -#define CHAR_MATCHES(enc, p, c) (*(p) == c) -#endif - -#define PREFIX(ident) normal_ ## ident -#include "xmltok_impl.c" - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ - UTF8_cval1 = 0x00, - UTF8_cval2 = 0xc0, - UTF8_cval3 = 0xe0, - UTF8_cval4 = 0xf0 -}; - -static -void utf8_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - char *to; - const char *from; - if (fromLim - *fromP > toLim - *toP) { - /* Avoid copying partial characters. */ - for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) - if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) - break; - } - for (to = *toP, from = *fromP; from != fromLim; from++, to++) - *to = *from; - *fromP = from; - *toP = to; -} - -static -void utf8_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - unsigned short *to = *toP; - const char *from = *fromP; - while (from != fromLim && to != toLim) { - switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { - case BT_LEAD2: - *to++ = ((from[0] & 0x1f) << 6) | (from[1] & 0x3f); - from += 2; - break; - case BT_LEAD3: - *to++ = ((from[0] & 0xf) << 12) | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f); - from += 3; - break; - case BT_LEAD4: - { - unsigned long n; - if (to + 1 == toLim) - break; - n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); - n -= 0x10000; - to[0] = (unsigned short)((n >> 10) | 0xD800); - to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); - to += 2; - from += 4; - } - break; - default: - *to++ = *from++; - break; - } - } - *fromP = from; - *toP = to; -} - -#ifdef XML_NS -static const struct normal_encoding utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; -#endif - -static const struct normal_encoding utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#ifdef XML_NS - -static const struct normal_encoding internal_utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "iasciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#endif - -static const struct normal_encoding internal_utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -static -void latin1_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - for (;;) { - unsigned char c; - if (*fromP == fromLim) - break; - c = (unsigned char)**fromP; - if (c & 0x80) { - if (toLim - *toP < 2) - break; - *(*toP)++ = ((c >> 6) | UTF8_cval2); - *(*toP)++ = ((c & 0x3f) | 0x80); - (*fromP)++; - } - else { - if (*toP == toLim) - break; - *(*toP)++ = *(*fromP)++; - } - } -} - -static -void latin1_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = (unsigned char)*(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding latin1_encoding_ns = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding latin1_encoding = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -static -void ascii_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = *(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding ascii_encoding_ns = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding ascii_encoding = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -static int unicode_byte_type(char hi, char lo) -{ - switch ((unsigned char)hi) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - return BT_LEAD4; - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return BT_TRAIL; - case 0xFF: - switch ((unsigned char)lo) { - case 0xFF: - case 0xFE: - return BT_NONXML; - } - break; - } - return BT_NONASCII; -} - -#define DEFINE_UTF16_TO_UTF8(E) \ -static \ -void E ## toUtf8(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - char **toP, const char *toLim) \ -{ \ - const char *from; \ - for (from = *fromP; from != fromLim; from += 2) { \ - int plane; \ - unsigned char lo2; \ - unsigned char lo = GET_LO(from); \ - unsigned char hi = GET_HI(from); \ - switch (hi) { \ - case 0: \ - if (lo < 0x80) { \ - if (*toP == toLim) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = lo; \ - break; \ - } \ - /* fall through */ \ - case 0x1: case 0x2: case 0x3: \ - case 0x4: case 0x5: case 0x6: case 0x7: \ - if (toLim - *toP < 2) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - default: \ - if (toLim - *toP < 3) { \ - *fromP = from; \ - return; \ - } \ - /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ - *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ - *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ - if (toLim - *toP < 4) { \ - *fromP = from; \ - return; \ - } \ - plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ - *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ - *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ - from += 2; \ - lo2 = GET_LO(from); \ - *(*toP)++ = (((lo & 0x3) << 4) \ - | ((GET_HI(from) & 0x3) << 2) \ - | (lo2 >> 6) \ - | 0x80); \ - *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ - break; \ - } \ - } \ - *fromP = from; \ -} - -#define DEFINE_UTF16_TO_UTF16(E) \ -static \ -void E ## toUtf16(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - unsigned short **toP, const unsigned short *toLim) \ -{ \ - /* Avoid copying first half only of surrogate */ \ - if (fromLim - *fromP > ((toLim - *toP) << 1) \ - && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ - fromLim -= 2; \ - for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ - *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ -} - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) -#define GET_LO(ptr) ((unsigned char)(ptr)[0]) -#define GET_HI(ptr) ((unsigned char)(ptr)[1]) - -DEFINE_UTF16_TO_UTF8(little2_) -DEFINE_UTF16_TO_UTF16(little2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) -#define GET_LO(ptr) ((unsigned char)(ptr)[1]) -#define GET_HI(ptr) ((unsigned char)(ptr)[0]) - -DEFINE_UTF16_TO_UTF8(big2_) -DEFINE_UTF16_TO_UTF16(big2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define LITTLE2_BYTE_TYPE(enc, p) \ - ((p)[1] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ - : unicode_byte_type((p)[1], (p)[0])) -#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) -#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) -#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) -#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) - -#ifdef XML_MIN_SIZE - -static -int little2_byteType(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TYPE(enc, p); -} - -static -int little2_byteToAscii(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TO_ASCII(enc, p); -} - -static -int little2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return LITTLE2_CHAR_MATCHES(enc, p, c); -} - -static -int little2_isNameMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static -int little2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) little2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#include "xmltok_impl.c" - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding little2_encoding_ns = { - { VTABLE, 2, 0, -#if XML_BYTE_ORDER == 12 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding little2_encoding = { - { VTABLE, 2, 0, -#if XML_BYTE_ORDER == 12 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#if XML_BYTE_ORDER != 21 - -#ifdef XML_NS - -static const struct normal_encoding internal_little2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding internal_little2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - - -#define BIG2_BYTE_TYPE(enc, p) \ - ((p)[0] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ - : unicode_byte_type((p)[0], (p)[1])) -#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) -#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) -#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) -#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) - -#ifdef XML_MIN_SIZE - -static -int big2_byteType(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TYPE(enc, p); -} - -static -int big2_byteToAscii(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TO_ASCII(enc, p); -} - -static -int big2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return BIG2_CHAR_MATCHES(enc, p, c); -} - -static -int big2_isNameMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static -int big2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) big2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#include "xmltok_impl.c" - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding big2_encoding_ns = { - { VTABLE, 2, 0, -#if XML_BYTE_ORDER == 21 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding big2_encoding = { - { VTABLE, 2, 0, -#if XML_BYTE_ORDER == 21 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#if XML_BYTE_ORDER != 12 - -#ifdef XML_NS - -static const struct normal_encoding internal_big2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding internal_big2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -#undef PREFIX - -static -int streqci(const char *s1, const char *s2) -{ - for (;;) { - char c1 = *s1++; - char c2 = *s2++; - if (ASCII_a <= c1 && c1 <= ASCII_z) - c1 += ASCII_A - ASCII_a; - if (ASCII_a <= c2 && c2 <= ASCII_z) - c2 += ASCII_A - ASCII_a; - if (c1 != c2) - return 0; - if (!c1) - break; - } - return 1; -} - -static -void initUpdatePosition(const ENCODING *enc, const char *ptr, - const char *end, POSITION *pos) -{ - normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); -} - -static -int toAscii(const ENCODING *enc, const char *ptr, const char *end) -{ - char buf[1]; - char *p = buf; - XmlUtf8Convert(enc, &ptr, end, &p, p + 1); - if (p == buf) - return -1; - else - return buf[0]; -} - -static -int isSpace(int c) -{ - switch (c) { - case 0x20: - case 0xD: - case 0xA: - case 0x9: - return 1; - } - return 0; -} - -/* Return 1 if there's just optional white space -or there's an S followed by name=val. */ -static -int parsePseudoAttribute(const ENCODING *enc, - const char *ptr, - const char *end, - const char **namePtr, - const char **nameEndPtr, - const char **valPtr, - const char **nextTokPtr) -{ - int c; - char open; - if (ptr == end) { - *namePtr = 0; - return 1; - } - if (!isSpace(toAscii(enc, ptr, end))) { - *nextTokPtr = ptr; - return 0; - } - do { - ptr += enc->minBytesPerChar; - } while (isSpace(toAscii(enc, ptr, end))); - if (ptr == end) { - *namePtr = 0; - return 1; - } - *namePtr = ptr; - for (;;) { - c = toAscii(enc, ptr, end); - if (c == -1) { - *nextTokPtr = ptr; - return 0; - } - if (c == ASCII_EQUALS) { - *nameEndPtr = ptr; - break; - } - if (isSpace(c)) { - *nameEndPtr = ptr; - do { - ptr += enc->minBytesPerChar; - } while (isSpace(c = toAscii(enc, ptr, end))); - if (c != ASCII_EQUALS) { - *nextTokPtr = ptr; - return 0; - } - break; - } - ptr += enc->minBytesPerChar; - } - if (ptr == *namePtr) { - *nextTokPtr = ptr; - return 0; - } - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - while (isSpace(c)) { - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - } - if (c != ASCII_QUOT && c != ASCII_APOS) { - *nextTokPtr = ptr; - return 0; - } - open = c; - ptr += enc->minBytesPerChar; - *valPtr = ptr; - for (;; ptr += enc->minBytesPerChar) { - c = toAscii(enc, ptr, end); - if (c == open) - break; - if (!(ASCII_a <= c && c <= ASCII_z) - && !(ASCII_A <= c && c <= ASCII_Z) - && !(ASCII_0 <= c && c <= ASCII_9) - && c != ASCII_PERIOD - && c != ASCII_MINUS - && c != ASCII_UNDERSCORE) { - *nextTokPtr = ptr; - return 0; - } - } - *nextTokPtr = ptr + enc->minBytesPerChar; - return 1; -} - -static const char KW_version[] = { - ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0' -}; - -static const char KW_encoding[] = { - ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0' -}; - -static const char KW_standalone[] = { - ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, ASCII_n, ASCII_e, '\0' -}; - -static const char KW_yes[] = { - ASCII_y, ASCII_e, ASCII_s, '\0' -}; - -static const char KW_no[] = { - ASCII_n, ASCII_o, '\0' -}; - -static -int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, - const char *, - const char *), - int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - const char *val = 0; - const char *name = 0; - const char *nameEnd = 0; - ptr += 5 * enc->minBytesPerChar; - end -= 2 * enc->minBytesPerChar; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) || !name) { - *badPtr = ptr; - return 0; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { - if (!isGeneralTextEntity) { - *badPtr = name; - return 0; - } - } - else { - if (versionPtr) - *versionPtr = val; - if (versionEndPtr) - *versionEndPtr = ptr; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) { - if (isGeneralTextEntity) { - /* a TextDecl must have an EncodingDecl */ - *badPtr = ptr; - return 0; - } - return 1; - } - } - if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) { - int c = toAscii(enc, val, end); - if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) { - *badPtr = val; - return 0; - } - if (encodingName) - *encodingName = val; - if (encoding) - *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) - return 1; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) || isGeneralTextEntity) { - *badPtr = name; - return 0; - } - if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) { - if (standalone) - *standalone = 1; - } - else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { - if (standalone) - *standalone = 0; - } - else { - *badPtr = val; - return 0; - } - while (isSpace(toAscii(enc, ptr, end))) - ptr += enc->minBytesPerChar; - if (ptr != end) { - *badPtr = ptr; - return 0; - } - return 1; -} - -static -int checkCharRefNumber(int result) -{ - switch (result >> 8) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return -1; - case 0: - if (latin1_encoding.type[result] == BT_NONXML) - return -1; - break; - case 0xFF: - if (result == 0xFFFE || result == 0xFFFF) - return -1; - break; - } - return result; -} - -int XmlUtf8Encode(int c, char *buf) -{ - enum { - /* minN is minimum legal resulting value for N byte sequence */ - min2 = 0x80, - min3 = 0x800, - min4 = 0x10000 - }; - - if (c < 0) - return 0; - if (c < min2) { - buf[0] = (c | UTF8_cval1); - return 1; - } - if (c < min3) { - buf[0] = ((c >> 6) | UTF8_cval2); - buf[1] = ((c & 0x3f) | 0x80); - return 2; - } - if (c < min4) { - buf[0] = ((c >> 12) | UTF8_cval3); - buf[1] = (((c >> 6) & 0x3f) | 0x80); - buf[2] = ((c & 0x3f) | 0x80); - return 3; - } - if (c < 0x110000) { - buf[0] = ((c >> 18) | UTF8_cval4); - buf[1] = (((c >> 12) & 0x3f) | 0x80); - buf[2] = (((c >> 6) & 0x3f) | 0x80); - buf[3] = ((c & 0x3f) | 0x80); - return 4; - } - return 0; -} - -int XmlUtf16Encode(int charNum, unsigned short *buf) -{ - if (charNum < 0) - return 0; - if (charNum < 0x10000) { - buf[0] = charNum; - return 1; - } - if (charNum < 0x110000) { - charNum -= 0x10000; - buf[0] = (charNum >> 10) + 0xD800; - buf[1] = (charNum & 0x3FF) + 0xDC00; - return 2; - } - return 0; -} - -struct unknown_encoding { - struct normal_encoding normal; - int (*convert)(void *userData, const char *p); - void *userData; - unsigned short utf16[256]; - char utf8[256][4]; -}; - -int XmlSizeOfUnknownEncoding(void) -{ - return sizeof(struct unknown_encoding); -} - -static -int unknown_isName(const ENCODING *enc, const char *p) -{ - int c = ((const struct unknown_encoding *)enc) - ->convert(((const struct unknown_encoding *)enc)->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); -} - -static -int unknown_isNmstrt(const ENCODING *enc, const char *p) -{ - int c = ((const struct unknown_encoding *)enc) - ->convert(((const struct unknown_encoding *)enc)->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); -} - -static -int unknown_isInvalid(const ENCODING *enc, const char *p) -{ - int c = ((const struct unknown_encoding *)enc) - ->convert(((const struct unknown_encoding *)enc)->userData, p); - return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; -} - -static -void unknown_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - char buf[XML_UTF8_ENCODE_MAX] = {0}; - for (;;) { - const char *utf8; - int n; - if (*fromP == fromLim) - break; - utf8 = ((const struct unknown_encoding *)enc)->utf8[(unsigned char)**fromP]; - n = *utf8++; - if (n == 0) { - int c = ((const struct unknown_encoding *)enc) - ->convert(((const struct unknown_encoding *)enc)->userData, *fromP); - n = XmlUtf8Encode(c, buf); - if (n > toLim - *toP) - break; - utf8 = buf; - *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2); - } - else { - if (n > toLim - *toP) - break; - (*fromP)++; - } - do { - *(*toP)++ = *utf8++; - } while (--n != 0); - } -} - -static -void unknown_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - while (*fromP != fromLim && *toP != toLim) { - unsigned short c - = ((const struct unknown_encoding *)enc)->utf16[(unsigned char)**fromP]; - if (c == 0) { - c = (unsigned short)((const struct unknown_encoding *)enc) - ->convert(((const struct unknown_encoding *)enc)->userData, *fromP); - *fromP += ((const struct normal_encoding *)enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2); - } - else - (*fromP)++; - *(*toP)++ = c; - } -} - -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - int (*convert)(void *userData, const char *p), - void *userData) -{ - int i; - struct unknown_encoding *e = mem; - for (i = 0; i < (int)sizeof(struct normal_encoding); i++) - ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; - for (i = 0; i < 128; i++) - if (latin1_encoding.type[i] != BT_OTHER - && latin1_encoding.type[i] != BT_NONXML - && table[i] != i) - return 0; - for (i = 0; i < 256; i++) { - int c = table[i]; - if (c == -1) { - e->normal.type[i] = BT_MALFORM; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else if (c < 0) { - if (c < -4) - return 0; - e->normal.type[i] = BT_LEAD2 - (c + 2); - e->utf8[i][0] = 0; - e->utf16[i] = 0; - } - else if (c < 0x80) { - if (latin1_encoding.type[c] != BT_OTHER - && latin1_encoding.type[c] != BT_NONXML - && c != i) - return 0; - e->normal.type[i] = latin1_encoding.type[c]; - e->utf8[i][0] = 1; - e->utf8[i][1] = (char)c; - e->utf16[i] = c == 0 ? 0xFFFF : c; - } - else if (checkCharRefNumber(c) < 0) { - e->normal.type[i] = BT_NONXML; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else { - if (c > 0xFFFF) - return 0; - if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NMSTRT; - else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NAME; - else - e->normal.type[i] = BT_OTHER; - e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); - e->utf16[i] = c; - } - } - e->userData = userData; - e->convert = convert; - if (convert) { - e->normal.isName2 = unknown_isName; - e->normal.isName3 = unknown_isName; - e->normal.isName4 = unknown_isName; - e->normal.isNmstrt2 = unknown_isNmstrt; - e->normal.isNmstrt3 = unknown_isNmstrt; - e->normal.isNmstrt4 = unknown_isNmstrt; - e->normal.isInvalid2 = unknown_isInvalid; - e->normal.isInvalid3 = unknown_isInvalid; - e->normal.isInvalid4 = unknown_isInvalid; - } - e->normal.enc.utf8Convert = unknown_toUtf8; - e->normal.enc.utf16Convert = unknown_toUtf16; - return &(e->normal.enc); -} - -/* If this enumeration is changed, getEncodingIndex and encodings -must also be changed. */ -enum { - UNKNOWN_ENC = -1, - ISO_8859_1_ENC = 0, - US_ASCII_ENC, - UTF_8_ENC, - UTF_16_ENC, - UTF_16BE_ENC, - UTF_16LE_ENC, - /* must match encodingNames up to here */ - NO_ENC -}; - -static const char KW_ISO_8859_1[] = { - ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, ASCII_MINUS, ASCII_1, '\0' -}; -static const char KW_US_ASCII[] = { - ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, '\0' -}; -static const char KW_UTF_8[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0' -}; -static const char KW_UTF_16[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0' -}; -static const char KW_UTF_16BE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, '\0' -}; -static const char KW_UTF_16LE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, '\0' -}; - -static -int getEncodingIndex(const char *name) -{ - static const char *encodingNames[] = { - KW_ISO_8859_1, - KW_US_ASCII, - KW_UTF_8, - KW_UTF_16, - KW_UTF_16BE, - KW_UTF_16LE, - }; - int i; - if (name == 0) - return NO_ENC; - for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++) - if (streqci(name, encodingNames[i])) - return i; - return UNKNOWN_ENC; -} - -/* For binary compatibility, we store the index of the encoding specified -at initialization in the isUtf16 member. */ - -#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16) -#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i) - -/* This is what detects the encoding. -encodingTable maps from encoding indices to encodings; -INIT_ENC_INDEX(enc) is the index of the external (protocol) specified encoding; -state is XML_CONTENT_STATE if we're parsing an external text entity, -and XML_PROLOG_STATE otherwise. -*/ - - -static -int initScan(const ENCODING **encodingTable, - const INIT_ENCODING *enc, - int state, - const char *ptr, - const char *end, - const char **nextTokPtr) -{ - const ENCODING **encPtr; - - if (ptr == end) - return XML_TOK_NONE; - encPtr = enc->encPtr; - if (ptr + 1 == end) { - /* only a single byte available for auto-detection */ -#ifndef XML_DTD /* FIXME */ - /* a well-formed document entity must have more than one byte */ - if (state != XML_CONTENT_STATE) - return XML_TOK_PARTIAL; -#endif - /* so we're parsing an external text entity... */ - /* if UTF-16 was externally specified, then we need at least 2 bytes */ - switch (INIT_ENC_INDEX(enc)) { - case UTF_16_ENC: - case UTF_16LE_ENC: - case UTF_16BE_ENC: - return XML_TOK_PARTIAL; - } - switch ((unsigned char)*ptr) { - case 0xFE: - case 0xFF: - case 0xEF: /* possibly first byte of UTF-8 BOM */ - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - /* fall through */ - case 0x00: - case 0x3C: - return XML_TOK_PARTIAL; - } - } - else { - switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { - case 0xFEFF: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XML_TOK_BOM; - /* 00 3C is handled in the default case */ - case 0x3C00: - if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC - || INIT_ENC_INDEX(enc) == UTF_16_ENC) - && state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - case 0xFFFE: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XML_TOK_BOM; - case 0xEFBB: - /* Maybe a UTF-8 BOM (EF BB BF) */ - /* If there's an explicitly specified (external) encoding - of ISO-8859-1 or some flavour of UTF-16 - and this is an external text entity, - don't look for the BOM, - because it might be a legal data. */ - if (state == XML_CONTENT_STATE) { - int e = INIT_ENC_INDEX(enc); - if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC || e == UTF_16LE_ENC || e == UTF_16_ENC) - break; - } - if (ptr + 2 == end) - return XML_TOK_PARTIAL; - if ((unsigned char)ptr[2] == 0xBF) { - *nextTokPtr = ptr + 3; - *encPtr = encodingTable[UTF_8_ENC]; - return XML_TOK_BOM; - } - break; - default: - if (ptr[0] == '\0') { - /* 0 isn't a legal data character. Furthermore a document entity can only - start with ASCII characters. So the only way this can fail to be big-endian - UTF-16 if it it's an external parsed general entity that's labelled as - UTF-16LE. */ - if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC) - break; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - else if (ptr[1] == '\0') { - /* We could recover here in the case: - - parsing an external entity - - second byte is 0 - - no externally specified encoding - - no encoding declaration - by assuming UTF-16LE. But we don't, because this would mean when - presented just with a single byte, we couldn't reliably determine - whether we needed further bytes. */ - if (state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - break; - } - } - *encPtr = encodingTable[INIT_ENC_INDEX(enc)]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); -} - - -#define NS(x) x -#define ns(x) x -#include "xmltok_ns.c" -#undef NS -#undef ns - -#ifdef XML_NS - -#define NS(x) x ## NS -#define ns(x) x ## _ns - -#include "xmltok_ns.c" - -#undef NS -#undef ns - -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - int (*convert)(void *userData, const char *p), - void *userData) -{ - ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); - if (enc) - ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON; - return enc; -} - -#endif /* XML_NS */ diff --git a/libs/apr-util/xml/expat/lib/xmltok.h b/libs/apr-util/xml/expat/lib/xmltok.h deleted file mode 100644 index 8b02324c38..0000000000 --- a/libs/apr-util/xml/expat/lib/xmltok.h +++ /dev/null @@ -1,299 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -#ifndef XmlTok_INCLUDED -#define XmlTok_INCLUDED 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* The following token may be returned by XmlContentTok */ -#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of - illegal ]]> sequence */ -/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */ -#define XML_TOK_NONE -4 /* The string to be scanned is empty */ -#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; - might be part of CRLF sequence */ -#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ -#define XML_TOK_PARTIAL -1 /* only part of a token */ -#define XML_TOK_INVALID 0 - -/* The following tokens are returned by XmlContentTok; some are also - returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */ - -#define XML_TOK_START_TAG_WITH_ATTS 1 -#define XML_TOK_START_TAG_NO_ATTS 2 -#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ -#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 -#define XML_TOK_END_TAG 5 -#define XML_TOK_DATA_CHARS 6 -#define XML_TOK_DATA_NEWLINE 7 -#define XML_TOK_CDATA_SECT_OPEN 8 -#define XML_TOK_ENTITY_REF 9 -#define XML_TOK_CHAR_REF 10 /* numeric character reference */ - -/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */ -#define XML_TOK_PI 11 /* processing instruction */ -#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ -#define XML_TOK_COMMENT 13 -#define XML_TOK_BOM 14 /* Byte order mark */ - -/* The following tokens are returned only by XmlPrologTok */ -#define XML_TOK_PROLOG_S 15 -#define XML_TOK_DECL_OPEN 16 /* */ -#define XML_TOK_NAME 18 -#define XML_TOK_NMTOKEN 19 -#define XML_TOK_POUND_NAME 20 /* #name */ -#define XML_TOK_OR 21 /* | */ -#define XML_TOK_PERCENT 22 -#define XML_TOK_OPEN_PAREN 23 -#define XML_TOK_CLOSE_PAREN 24 -#define XML_TOK_OPEN_BRACKET 25 -#define XML_TOK_CLOSE_BRACKET 26 -#define XML_TOK_LITERAL 27 -#define XML_TOK_PARAM_ENTITY_REF 28 -#define XML_TOK_INSTANCE_START 29 - -/* The following occur only in element type declarations */ -#define XML_TOK_NAME_QUESTION 30 /* name? */ -#define XML_TOK_NAME_ASTERISK 31 /* name* */ -#define XML_TOK_NAME_PLUS 32 /* name+ */ -#define XML_TOK_COND_SECT_OPEN 33 /* */ -#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ -#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ -#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ -#define XML_TOK_COMMA 38 - -/* The following token is returned only by XmlAttributeValueTok */ -#define XML_TOK_ATTRIBUTE_VALUE_S 39 - -/* The following token is returned only by XmlCdataSectionTok */ -#define XML_TOK_CDATA_SECT_CLOSE 40 - -/* With namespace processing this is returned by XmlPrologTok - for a name with a colon. */ -#define XML_TOK_PREFIXED_NAME 41 - -#ifdef XML_DTD -#define XML_TOK_IGNORE_SECT 42 -#endif /* XML_DTD */ - -#ifdef XML_DTD -#define XML_N_STATES 4 -#else /* not XML_DTD */ -#define XML_N_STATES 3 -#endif /* not XML_DTD */ - -#define XML_PROLOG_STATE 0 -#define XML_CONTENT_STATE 1 -#define XML_CDATA_SECTION_STATE 2 -#ifdef XML_DTD -#define XML_IGNORE_SECTION_STATE 3 -#endif /* XML_DTD */ - -#define XML_N_LITERAL_TYPES 2 -#define XML_ATTRIBUTE_VALUE_LITERAL 0 -#define XML_ENTITY_VALUE_LITERAL 1 - -/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ -#define XML_UTF8_ENCODE_MAX 4 -/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ -#define XML_UTF16_ENCODE_MAX 2 - -typedef struct position { - /* first line and first column are 0 not 1 */ - unsigned long lineNumber; - unsigned long columnNumber; -} POSITION; - -typedef struct { - const char *name; - const char *valuePtr; - const char *valueEnd; - char normalized; -} ATTRIBUTE; - -struct encoding; -typedef struct encoding ENCODING; - -struct encoding { - int (*scanners[XML_N_STATES])(const ENCODING *, - const char *, - const char *, - const char **); - int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *, - const char *, - const char *, - const char **); - int (*sameName)(const ENCODING *, - const char *, const char *); - int (*nameMatchesAscii)(const ENCODING *, - const char *, const char *, const char *); - int (*nameLength)(const ENCODING *, const char *); - const char *(*skipS)(const ENCODING *, const char *); - int (*getAtts)(const ENCODING *enc, const char *ptr, - int attsMax, ATTRIBUTE *atts); - int (*charRefNumber)(const ENCODING *enc, const char *ptr); - int (*predefinedEntityName)(const ENCODING *, const char *, const char *); - void (*updatePosition)(const ENCODING *, - const char *ptr, - const char *end, - POSITION *); - int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end, - const char **badPtr); - void (*utf8Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - char **toP, - const char *toLim); - void (*utf16Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - unsigned short **toP, - const unsigned short *toLim); - int minBytesPerChar; - char isUtf8; - char isUtf16; -}; - -/* -Scan the string starting at ptr until the end of the next complete token, -but do not scan past eptr. Return an integer giving the type of token. - -Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. - -Return XML_TOK_PARTIAL when the string does not contain a complete token; -nextTokPtr will not be set. - -Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr -will be set to point to the character which made the token invalid. - -Otherwise the string starts with a valid token; nextTokPtr will be set to point -to the character following the end of that token. - -Each data character counts as a single token, but adjacent data characters -may be returned together. Similarly for characters in the prolog outside -literals, comments and processing instructions. -*/ - - -#define XmlTok(enc, state, ptr, end, nextTokPtr) \ - (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) - -#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) - -#define XmlContentTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) - -#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) - -#ifdef XML_DTD - -#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) - -#endif /* XML_DTD */ - -/* This is used for performing a 2nd-level tokenization on -the content of a literal that has already been returned by XmlTok. */ - -#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ - (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) - -#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) - -#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ - (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) - -#define XmlNameLength(enc, ptr) \ - (((enc)->nameLength)(enc, ptr)) - -#define XmlSkipS(enc, ptr) \ - (((enc)->skipS)(enc, ptr)) - -#define XmlGetAttributes(enc, ptr, attsMax, atts) \ - (((enc)->getAtts)(enc, ptr, attsMax, atts)) - -#define XmlCharRefNumber(enc, ptr) \ - (((enc)->charRefNumber)(enc, ptr)) - -#define XmlPredefinedEntityName(enc, ptr, end) \ - (((enc)->predefinedEntityName)(enc, ptr, end)) - -#define XmlUpdatePosition(enc, ptr, end, pos) \ - (((enc)->updatePosition)(enc, ptr, end, pos)) - -#define XmlIsPublicId(enc, ptr, end, badPtr) \ - (((enc)->isPublicId)(enc, ptr, end, badPtr)) - -#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) - -#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) - -typedef struct { - ENCODING initEnc; - const ENCODING **encPtr; -} INIT_ENCODING; - -int XmlParseXmlDecl(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); - -int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncoding(void); -const ENCODING *XmlGetUtf16InternalEncoding(void); -int XmlUtf8Encode(int charNumber, char *buf); -int XmlUtf16Encode(int charNumber, unsigned short *buf); - -int XmlSizeOfUnknownEncoding(void); -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - int (*conv)(void *userData, const char *p), - void *userData); - -int XmlParseXmlDeclNS(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); -int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncodingNS(void); -const ENCODING *XmlGetUtf16InternalEncodingNS(void); -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - int (*conv)(void *userData, const char *p), - void *userData); -#ifdef __cplusplus -} -#endif - -#endif /* not XmlTok_INCLUDED */ diff --git a/libs/apr-util/xml/expat/lib/xmltok_impl.c b/libs/apr-util/xml/expat/lib/xmltok_impl.c deleted file mode 100644 index 36d2065ce3..0000000000 --- a/libs/apr-util/xml/expat/lib/xmltok_impl.c +++ /dev/null @@ -1,1768 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -#ifndef IS_INVALID_CHAR -#define IS_INVALID_CHAR(enc, ptr, n) (0) -#endif - -#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_INVALID_CHAR(enc, ptr, n)) { \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define INVALID_CASES(ptr, nextTokPtr) \ - INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ - case BT_NONXML: \ - case BT_MALFORM: \ - case BT_TRAIL: \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; - -#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NAME_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - case BT_DIGIT: \ - case BT_NAME: \ - case BT_MINUS: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) - -#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) - -#ifndef PREFIX -#define PREFIX(ident) ident -#endif - -/* ptr points to character following " */ - switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { - case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - /* fall through */ - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DECL_OPEN; - case BT_NMSTRT: - case BT_HEX: - ptr += MINBPC(enc); - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static -int PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, const char *end, int *tokPtr) -{ - int upper = 0; - *tokPtr = XML_TOK_PI; - if (end - ptr != MINBPC(enc)*3) - return 1; - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_x: - break; - case ASCII_X: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_m: - break; - case ASCII_M: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - break; - case ASCII_L: - upper = 1; - break; - default: - return 1; - } - if (upper) - return 0; - *tokPtr = XML_TOK_XML_DECL; - return 1; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CDATA_SECT_CLOSE; - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - case BT_RSQB: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_LT: - return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_AMP: - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_RSQB: - if (ptr + MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { - ptr += MINBPC(enc); - break; - } - if (ptr + 2*MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { - ptr += MINBPC(enc); - break; - } - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_INVALID; - } - } - /* fall through */ - case BT_AMP: - case BT_LT: - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following "%" */ - -static -int PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_PERCENT; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_SEMI: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_PARAM_ENTITY_REF; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static -int PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_CR: case BT_LF: case BT_S: - case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: - *nextTokPtr = ptr; - return XML_TOK_POUND_NAME; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -XML_TOK_POUND_NAME; -} - -static -int PREFIX(scanLit)(int open, const ENCODING *enc, - const char *ptr, const char *end, - const char **nextTokPtr) -{ - while (ptr != end) { - int t = BYTE_TYPE(enc, ptr); - switch (t) { - INVALID_CASES(ptr, nextTokPtr) - case BT_QUOT: - case BT_APOS: - ptr += MINBPC(enc); - if (t != open) - break; - if (ptr == end) - return -XML_TOK_LITERAL; - *nextTokPtr = ptr; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_CR: case BT_LF: - case BT_GT: case BT_PERCNT: case BT_LSQB: - return XML_TOK_LITERAL; - default: - return XML_TOK_INVALID; - } - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -static -int PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - int tok; - if (ptr == end) - return XML_TOK_NONE; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_QUOT: - return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_APOS: - return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_LT: - { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - case BT_EXCL: - return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_QUEST: - return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_NMSTRT: - case BT_HEX: - case BT_NONASCII: - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - *nextTokPtr = ptr - MINBPC(enc); - return XML_TOK_INSTANCE_START; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - case BT_CR: - if (ptr + MINBPC(enc) == end) - return -XML_TOK_PROLOG_S; - /* fall through */ - case BT_S: case BT_LF: - for (;;) { - ptr += MINBPC(enc); - if (ptr == end) - break; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_LF: - break; - case BT_CR: - /* don't split CR/LF pair */ - if (ptr + MINBPC(enc) != end) - break; - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - } - } - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - case BT_PERCNT: - return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_COMMA: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_COMMA; - case BT_LSQB: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_BRACKET; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_BRACKET; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if (ptr + MINBPC(enc) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_COND_SECT_CLOSE; - } - } - *nextTokPtr = ptr; - return XML_TOK_CLOSE_BRACKET; - case BT_LPAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_PAREN; - case BT_RPAR: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_PAREN; - switch (BYTE_TYPE(enc, ptr)) { - case BT_AST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_ASTERISK; - case BT_QUEST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_QUESTION; - case BT_PLUS: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_PLUS; - case BT_CR: case BT_LF: case BT_S: - case BT_GT: case BT_COMMA: case BT_VERBAR: - case BT_RPAR: - *nextTokPtr = ptr; - return XML_TOK_CLOSE_PAREN; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_VERBAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OR; - case BT_GT: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DECL_CLOSE; - case BT_NUM: - return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NAME; \ - break; \ - } \ - if (IS_NAME_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NMTOKEN; \ - break; \ - } \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NMSTRT: - case BT_HEX: - tok = XML_TOK_NAME; - ptr += MINBPC(enc); - break; - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: -#ifdef XML_NS - case BT_COLON: -#endif - tok = XML_TOK_NMTOKEN; - ptr += MINBPC(enc); - break; - case BT_NONASCII: - if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NAME; - break; - } - if (IS_NAME_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NMTOKEN; - break; - } - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_GT: case BT_RPAR: case BT_COMMA: - case BT_VERBAR: case BT_LSQB: case BT_PERCNT: - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return tok; -#ifdef XML_NS - case BT_COLON: - ptr += MINBPC(enc); - switch (tok) { - case XML_TOK_NAME: - if (ptr == end) - return XML_TOK_PARTIAL; - tok = XML_TOK_PREFIXED_NAME; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - default: - tok = XML_TOK_NMTOKEN; - break; - } - break; - case XML_TOK_PREFIXED_NAME: - tok = XML_TOK_NMTOKEN; - break; - } - break; -#endif - case BT_PLUS: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_PLUS; - case BT_AST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_ASTERISK; - case BT_QUEST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_QUESTION; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -tok; -} - -static -int PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LT: - /* this is for inside entity references */ - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_S: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_ATTRIBUTE_VALUE_S; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -static -int PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_PERCNT: - if (ptr == start) { - int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), - end, nextTokPtr); - return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -#ifdef XML_DTD - -static -int PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - int level = 0; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - end = ptr + n; - } - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - INVALID_CASES(ptr, nextTokPtr) - case BT_LT: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { - ++level; - ptr += MINBPC(enc); - } - } - break; - case BT_RSQB: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr += MINBPC(enc); - if (level == 0) { - *nextTokPtr = ptr; - return XML_TOK_IGNORE_SECT; - } - --level; - } - } - break; - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -#endif /* XML_DTD */ - -static -int PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, - const char **badPtr) -{ - ptr += MINBPC(enc); - end -= MINBPC(enc); - for (; ptr != end; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - case BT_HEX: - case BT_MINUS: - case BT_APOS: - case BT_LPAR: - case BT_RPAR: - case BT_PLUS: - case BT_COMMA: - case BT_SOL: - case BT_EQUALS: - case BT_QUEST: - case BT_CR: - case BT_LF: - case BT_SEMI: - case BT_EXCL: - case BT_AST: - case BT_PERCNT: - case BT_NUM: -#ifdef XML_NS - case BT_COLON: -#endif - break; - case BT_S: - if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) { - *badPtr = ptr; - return 0; - } - break; - case BT_NAME: - case BT_NMSTRT: - if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) - break; - default: - switch (BYTE_TO_ASCII(enc, ptr)) { - case 0x24: /* $ */ - case 0x40: /* @ */ - break; - default: - *badPtr = ptr; - return 0; - } - break; - } - } - return 1; -} - -/* This must only be called for a well-formed start-tag or empty element tag. -Returns the number of attributes. Pointers to the first attsMax attributes -are stored in atts. */ - -static -int PREFIX(getAtts)(const ENCODING *enc, const char *ptr, - int attsMax, ATTRIBUTE *atts) -{ - enum { other, inName, inValue } state = inName; - int nAtts = 0; - int open = 0; /* defined when state == inValue; - initialization just to shut up compilers */ - - for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { -#define START_NAME \ - if (state == other) { \ - if (nAtts < attsMax) { \ - atts[nAtts].name = ptr; \ - atts[nAtts].normalized = 1; \ - } \ - state = inName; \ - } -#define LEAD_CASE(n) \ - case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: - case BT_HEX: - START_NAME - break; -#undef START_NAME - case BT_QUOT: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_QUOT; - } - else if (open == BT_QUOT) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_APOS: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_APOS; - } - else if (open == BT_APOS) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_AMP: - if (nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_S: - if (state == inName) - state = other; - else if (state == inValue - && nAtts < attsMax - && atts[nAtts].normalized - && (ptr == atts[nAtts].valuePtr - || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE - || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE - || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) - atts[nAtts].normalized = 0; - break; - case BT_CR: case BT_LF: - /* This case ensures that the first attribute name is counted - Apart from that we could just change state on the quote. */ - if (state == inName) - state = other; - else if (state == inValue && nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_GT: - case BT_SOL: - if (state != inValue) - return nAtts; - break; - default: - break; - } - } - /* not reached */ -} - -static -int PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) -{ - int result = 0; - /* skip &# */ - ptr += 2*MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_x)) { - for (ptr += MINBPC(enc); !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - switch (c) { - case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4: - case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9: - result <<= 4; - result |= (c - ASCII_0); - break; - case ASCII_A: case ASCII_B: case ASCII_C: case ASCII_D: case ASCII_E: case ASCII_F: - result <<= 4; - result += 10 + (c - ASCII_A); - break; - case ASCII_a: case ASCII_b: case ASCII_c: case ASCII_d: case ASCII_e: case ASCII_f: - result <<= 4; - result += 10 + (c - ASCII_a); - break; - } - if (result >= 0x110000) - return -1; - } - } - else { - for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - result *= 10; - result += (c - ASCII_0); - if (result >= 0x110000) - return -1; - } - } - return checkCharRefNumber(result); -} - -static -int PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, const char *end) -{ - switch ((end - ptr)/MINBPC(enc)) { - case 2: - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) { - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - return ASCII_LT; - case ASCII_g: - return ASCII_GT; - } - } - break; - case 3: - if (CHAR_MATCHES(enc, ptr, ASCII_a)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_m)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) - return ASCII_AMP; - } - } - break; - case 4: - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_q: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_u)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_t)) - return ASCII_QUOT; - } - } - break; - case ASCII_a: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_s)) - return ASCII_APOS; - } - } - break; - } - } - return 0; -} - -static -int PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr1)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (*ptr1++ != *ptr2++) \ - return 0; - LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) -#undef LEAD_CASE - /* fall through */ - if (*ptr1++ != *ptr2++) - return 0; - break; - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 1) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 2) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 3) { - if (*ptr2++ != *ptr1++) - return 0; - } - } - } - break; - default: - if (MINBPC(enc) == 1 && *ptr1 == *ptr2) - return 1; - switch (BYTE_TYPE(enc, ptr2)) { - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - return 0; - default: - return 1; - } - } - } - /* not reached */ -} - -static -int PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, - const char *end1, const char *ptr2) -{ - for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { - if (ptr1 == end1) - return 0; - if (!CHAR_MATCHES(enc, ptr1, *ptr2)) - return 0; - } - return ptr1 == end1; -} - -static -int PREFIX(nameLength)(const ENCODING *enc, const char *ptr) -{ - const char *start = ptr; - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - ptr += MINBPC(enc); - break; - default: - return ptr - start; - } - } -} - -static -const char *PREFIX(skipS)(const ENCODING *enc, const char *ptr) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_LF: - case BT_CR: - case BT_S: - ptr += MINBPC(enc); - break; - default: - return ptr; - } - } -} - -static -void PREFIX(updatePosition)(const ENCODING *enc, - const char *ptr, - const char *end, - POSITION *pos) -{ - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_LF: - pos->columnNumber = (unsigned)-1; - pos->lineNumber++; - ptr += MINBPC(enc); - break; - case BT_CR: - pos->lineNumber++; - ptr += MINBPC(enc); - if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - pos->columnNumber = (unsigned)-1; - break; - default: - ptr += MINBPC(enc); - break; - } - pos->columnNumber++; - } -} - -#undef DO_LEAD_CASE -#undef MULTIBYTE_CASES -#undef INVALID_CASES -#undef CHECK_NAME_CASE -#undef CHECK_NAME_CASES -#undef CHECK_NMSTRT_CASE -#undef CHECK_NMSTRT_CASES diff --git a/libs/apr-util/xml/expat/lib/xmltok_impl.h b/libs/apr-util/xml/expat/lib/xmltok_impl.h deleted file mode 100644 index da0ea60a65..0000000000 --- a/libs/apr-util/xml/expat/lib/xmltok_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -enum { - BT_NONXML, - BT_MALFORM, - BT_LT, - BT_AMP, - BT_RSQB, - BT_LEAD2, - BT_LEAD3, - BT_LEAD4, - BT_TRAIL, - BT_CR, - BT_LF, - BT_GT, - BT_QUOT, - BT_APOS, - BT_EQUALS, - BT_QUEST, - BT_EXCL, - BT_SOL, - BT_SEMI, - BT_NUM, - BT_LSQB, - BT_S, - BT_NMSTRT, - BT_COLON, - BT_HEX, - BT_DIGIT, - BT_NAME, - BT_MINUS, - BT_OTHER, /* known not to be a name or name start character */ - BT_NONASCII, /* might be a name or name start character */ - BT_PERCNT, - BT_LPAR, - BT_RPAR, - BT_AST, - BT_PLUS, - BT_COMMA, - BT_VERBAR -}; - -#include diff --git a/libs/apr-util/xml/expat/lib/xmltok_ns.c b/libs/apr-util/xml/expat/lib/xmltok_ns.c deleted file mode 100644 index 21859738ac..0000000000 --- a/libs/apr-util/xml/expat/lib/xmltok_ns.c +++ /dev/null @@ -1,98 +0,0 @@ -const ENCODING *NS(XmlGetUtf8InternalEncoding)(void) -{ - return &ns(internal_utf8_encoding).enc; -} - -const ENCODING *NS(XmlGetUtf16InternalEncoding)(void) -{ -#if XML_BYTE_ORDER == 12 - return &ns(internal_little2_encoding).enc; -#elif XML_BYTE_ORDER == 21 - return &ns(internal_big2_encoding).enc; -#else - const short n = 1; - return *(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc; -#endif -} - -static -const ENCODING *NS(encodings)[] = { - &ns(latin1_encoding).enc, - &ns(ascii_encoding).enc, - &ns(utf8_encoding).enc, - &ns(big2_encoding).enc, - &ns(big2_encoding).enc, - &ns(little2_encoding).enc, - &ns(utf8_encoding).enc /* NO_ENC */ -}; - -static -int NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, ptr, end, nextTokPtr); -} - -static -int NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr); -} - -int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name) -{ - int i = getEncodingIndex(name); - if (i == UNKNOWN_ENC) - return 0; - SET_INIT_ENC_INDEX(p, i); - p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); - p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); - p->initEnc.updatePosition = initUpdatePosition; - p->encPtr = encPtr; - *encPtr = &(p->initEnc); - return 1; -} - -static -const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) -{ -#define ENCODING_MAX 128 - char buf[ENCODING_MAX]; - char *p = buf; - int i; - XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); - if (ptr != end) - return 0; - *p = 0; - if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) - return enc; - i = getEncodingIndex(buf); - if (i == UNKNOWN_ENC) - return 0; - return NS(encodings)[i]; -} - -int NS(XmlParseXmlDecl)(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - return doParseXmlDecl(NS(findEncoding), - isGeneralTextEntity, - enc, - ptr, - end, - badPtr, - versionPtr, - versionEndPtr, - encodingName, - encoding, - standalone); -} diff --git a/src/include/private/switch_apr_pvt.h b/src/include/private/switch_apr_pvt.h index ae4dc9c995..f908f0df84 100644 --- a/src/include/private/switch_apr_pvt.h +++ b/src/include/private/switch_apr_pvt.h @@ -52,6 +52,17 @@ #include +typedef struct switch_apr_queue_t switch_apr_queue_t; +apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, apr_pool_t *a); +apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data); +apr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data); +unsigned int switch_apr_queue_size(switch_apr_queue_t *queue); +apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data); +apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, apr_interval_time_t timeout); +apr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data); +apr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue); +apr_status_t switch_apr_queue_term(switch_apr_queue_t *queue); + #endif // __SWITCH_APR_PVT_H__ /* For Emacs: diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index e9799c2068..57d7e994e7 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -587,7 +587,7 @@ SWITCH_DECLARE(switch_status_t) switch_md5_string(char digest_str[SWITCH_MD5_DIG */ /** Opaque structure used for queue API */ - typedef struct apr_queue_t switch_queue_t; + typedef struct switch_apr_queue_t switch_queue_t; /** * create a FIFO queue diff --git a/src/switch_apr.c b/src/switch_apr.c index 91204acba7..0f07276b86 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -36,6 +36,7 @@ #include #endif #include "private/switch_core_pvt.h" +#include "private/switch_apr_pvt.h" /* apr headers*/ #include @@ -70,17 +71,14 @@ /* apr_vformatter_buff_t definition*/ #include -/* apr-util headers */ -#include -#include #if (defined(HAVE_LIBMD5) || defined(HAVE_LIBMD) || defined(HAVE_MD5INIT)) #include #elif defined(HAVE_LIBCRYPTO) #include -#else -#include #endif +#include + /* apr stubs */ SWITCH_DECLARE(int) switch_status_is_timeup(int status) @@ -1131,7 +1129,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollset(switch_pollfd_t ** SWITCH_DECLARE(void) switch_uuid_format(char *buffer, const switch_uuid_t *uuid) { #ifndef WIN32 - apr_uuid_format(buffer, (const apr_uuid_t *) uuid); + uuid_unparse_lower(uuid->data, buffer); #else RPC_CSTR buf; UuidToString((const UUID *) uuid, &buf); @@ -1144,7 +1142,7 @@ SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid) { switch_mutex_lock(runtime.uuid_mutex); #ifndef WIN32 - apr_uuid_get((apr_uuid_t *) uuid); + uuid_generate(uuid->data); #else UuidCreate((UUID *) uuid); #endif @@ -1154,7 +1152,10 @@ SWITCH_DECLARE(void) switch_uuid_get(switch_uuid_t *uuid) SWITCH_DECLARE(switch_status_t) switch_uuid_parse(switch_uuid_t *uuid, const char *uuid_str) { #ifndef WIN32 - return apr_uuid_parse((apr_uuid_t *) uuid, uuid_str); + if (uuid_parse(uuid_str, uuid->data)) { + return SWITCH_STATUS_FALSE; + } + return SWITCH_STATUS_SUCCESS; #else return UuidFromString((RPC_CSTR) uuid_str, (UUID *) uuid); #endif @@ -1179,7 +1180,7 @@ SWITCH_DECLARE(switch_status_t) switch_md5(unsigned char digest[SWITCH_MD5_DIGES return SWITCH_STATUS_SUCCESS; #else - return apr_md5(digest, input, inputLen); + return SWITCH_STATUS_NOTIMPL; #endif } @@ -1207,22 +1208,22 @@ SWITCH_DECLARE(switch_status_t) switch_md5_string(char digest_str[SWITCH_MD5_DIG SWITCH_DECLARE(switch_status_t) switch_queue_create(switch_queue_t ** queue, unsigned int queue_capacity, switch_memory_pool_t *pool) { - return apr_queue_create(queue, queue_capacity, pool); + return switch_apr_queue_create(queue, queue_capacity, pool); } SWITCH_DECLARE(unsigned int) switch_queue_size(switch_queue_t *queue) { - return apr_queue_size(queue); + return switch_apr_queue_size(queue); } SWITCH_DECLARE(switch_status_t) switch_queue_pop(switch_queue_t *queue, void **data) { - return apr_queue_pop(queue, data); + return switch_apr_queue_pop(queue, data); } SWITCH_DECLARE(switch_status_t) switch_queue_pop_timeout(switch_queue_t *queue, void **data, switch_interval_time_t timeout) { - return apr_queue_pop_timeout(queue, data, timeout); + return switch_apr_queue_pop_timeout(queue, data, timeout); } SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data) @@ -1230,7 +1231,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *d apr_status_t s; do { - s = apr_queue_push(queue, data); + s = switch_apr_queue_push(queue, data); } while (s == APR_EINTR); return s; @@ -1238,17 +1239,17 @@ SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *d SWITCH_DECLARE(switch_status_t) switch_queue_trypop(switch_queue_t *queue, void **data) { - return apr_queue_trypop(queue, data); + return switch_apr_queue_trypop(queue, data); } SWITCH_DECLARE(switch_status_t) switch_queue_interrupt_all(switch_queue_t *queue) { - return apr_queue_interrupt_all(queue); + return switch_apr_queue_interrupt_all(queue); } SWITCH_DECLARE(switch_status_t) switch_queue_term(switch_queue_t *queue) { - return apr_queue_term(queue); + return switch_apr_queue_term(queue); } SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data) @@ -1256,7 +1257,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void apr_status_t s; do { - s = apr_queue_trypush(queue, data); + s = switch_apr_queue_trypush(queue, data); } while (s == APR_EINTR); return s; diff --git a/libs/apr-util/misc/apr_queue.c b/src/switch_apr_queue.c similarity index 87% rename from libs/apr-util/misc/apr_queue.c rename to src/switch_apr_queue.c index a947df8a08..289bbdf0cc 100644 --- a/libs/apr-util/misc/apr_queue.c +++ b/src/switch_apr_queue.c @@ -14,33 +14,18 @@ * limitations under the License. */ -#include "apr.h" +#include +#include +#include +#include -#if APR_HAVE_STDIO_H -#include -#endif -#if APR_HAVE_STDLIB_H -#include -#endif -#if APR_HAVE_UNISTD_H -#include -#endif - -#include "apu.h" -#include "apr_portable.h" -#include "apr_thread_mutex.h" -#include "apr_thread_cond.h" -#include "apr_errno.h" -#include "apr_queue.h" - -#if APR_HAS_THREADS /* * define this to get debug messages * #define QUEUE_DEBUG */ -struct apr_queue_t { +struct switch_apr_queue_t { void **data; unsigned int nelts; /**< # elements */ unsigned int in; /**< next empty location */ @@ -54,8 +39,10 @@ struct apr_queue_t { int terminated; }; +typedef struct switch_apr_queue_t switch_apr_queue_t; + #ifdef QUEUE_DEBUG -static void Q_DBG(char*msg, apr_queue_t *q) { +static void Q_DBG(char*msg, switch_apr_queue_t *q) { fprintf(stderr, "%ld\t#%d in %d out %d\t%s\n", apr_os_thread_current(), q->nelts, q->in, q->out, @@ -67,24 +54,24 @@ static void Q_DBG(char*msg, apr_queue_t *q) { #endif /** - * Detects when the apr_queue_t is full. This utility function is expected + * Detects when the switch_apr_queue_t is full. This utility function is expected * to be called from within critical sections, and is not threadsafe. */ #define apr_queue_full(queue) ((queue)->nelts == (queue)->bounds) /** - * Detects when the apr_queue_t is empty. This utility function is expected + * Detects when the switch_apr_queue_t is empty. This utility function is expected * to be called from within critical sections, and is not threadsafe. */ #define apr_queue_empty(queue) ((queue)->nelts == 0) /** * Callback routine that is called to destroy this - * apr_queue_t when its pool is destroyed. + * switch_apr_queue_t when its pool is destroyed. */ static apr_status_t queue_destroy(void *data) { - apr_queue_t *queue = data; + switch_apr_queue_t *queue = data; /* Ignore errors here, we can't do anything about them anyway. */ @@ -96,15 +83,13 @@ static apr_status_t queue_destroy(void *data) } /** - * Initialize the apr_queue_t. + * Initialize the switch_apr_queue_t. */ -APU_DECLARE(apr_status_t) apr_queue_create(apr_queue_t **q, - unsigned int queue_capacity, - apr_pool_t *a) +apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, apr_pool_t *a) { apr_status_t rv; - apr_queue_t *queue; - queue = apr_palloc(a, sizeof(apr_queue_t)); + switch_apr_queue_t *queue; + queue = apr_palloc(a, sizeof(switch_apr_queue_t)); *q = queue; /* nested doesn't work ;( */ @@ -147,7 +132,7 @@ APU_DECLARE(apr_status_t) apr_queue_create(apr_queue_t **q, * the push operation has completed, it signals other threads waiting * in apr_queue_pop() that they may continue consuming sockets. */ -APU_DECLARE(apr_status_t) apr_queue_push(apr_queue_t *queue, void *data) +apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data) { apr_status_t rv; @@ -208,7 +193,7 @@ APU_DECLARE(apr_status_t) apr_queue_push(apr_queue_t *queue, void *data) * the push operation has completed, it signals other threads waiting * in apr_queue_pop() that they may continue consuming sockets. */ -APU_DECLARE(apr_status_t) apr_queue_trypush(apr_queue_t *queue, void *data) +apr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data) { apr_status_t rv; @@ -246,7 +231,7 @@ APU_DECLARE(apr_status_t) apr_queue_trypush(apr_queue_t *queue, void *data) /** * not thread safe */ -APU_DECLARE(unsigned int) apr_queue_size(apr_queue_t *queue) { +unsigned int switch_apr_queue_size(switch_apr_queue_t *queue) { return queue->nelts; } @@ -256,7 +241,7 @@ APU_DECLARE(unsigned int) apr_queue_size(apr_queue_t *queue) { * Once retrieved, the item is placed into the address specified by * 'data'. */ -APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void **data) +apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data) { apr_status_t rv; @@ -319,7 +304,7 @@ APU_DECLARE(apr_status_t) apr_queue_pop(apr_queue_t *queue, void **data) * until timeout is elapsed. Once retrieved, the item is placed into * the address specified by'data'. */ -APU_DECLARE(apr_status_t) apr_queue_pop_timeout(apr_queue_t *queue, void **data, apr_interval_time_t timeout) +apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, apr_interval_time_t timeout) { apr_status_t rv; @@ -383,7 +368,7 @@ APU_DECLARE(apr_status_t) apr_queue_pop_timeout(apr_queue_t *queue, void **data, * items available, return APR_EAGAIN. Once retrieved, * the item is placed into the address specified by 'data'. */ -APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void **data) +apr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data) { apr_status_t rv; @@ -418,7 +403,7 @@ APU_DECLARE(apr_status_t) apr_queue_trypop(apr_queue_t *queue, void **data) return rv; } -APU_DECLARE(apr_status_t) apr_queue_interrupt_all(apr_queue_t *queue) +apr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue) { apr_status_t rv; Q_DBG("intr all", queue); @@ -435,7 +420,7 @@ APU_DECLARE(apr_status_t) apr_queue_interrupt_all(apr_queue_t *queue) return APR_SUCCESS; } -APU_DECLARE(apr_status_t) apr_queue_term(apr_queue_t *queue) +apr_status_t switch_apr_queue_term(switch_apr_queue_t *queue) { apr_status_t rv; @@ -451,7 +436,6 @@ APU_DECLARE(apr_status_t) apr_queue_term(apr_queue_t *queue) if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) { return rv; } - return apr_queue_interrupt_all(queue); + return switch_apr_queue_interrupt_all(queue); } -#endif /* APR_HAS_THREADS */ From 01c1e74f36511f1dc02923ac7f40738939cfa5fe Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 16 Aug 2022 18:01:53 -0400 Subject: [PATCH 049/155] [core] remove libdingaling from tree --- LICENSE | 9 - Makefile.am | 4 +- bootstrap.sh | 2 +- build/modules.conf.in | 1 - build/modules.conf.most | 1 - conf/curl/autoload_configs/dingaling.conf.xml | 9 - configure.ac | 4 +- debian/bootstrap.sh | 2 - debian/control-modules | 4 - debian/copyright | 9 - freeswitch.spec | 15 +- libs/.gitignore | 12 - libs/libdingaling/.update | 1 - libs/libdingaling/AUTHORS | 18 - libs/libdingaling/COPYING | 471 -- libs/libdingaling/ChangeLog | 0 libs/libdingaling/INSTALL | 231 - libs/libdingaling/Makefile.am | 42 - libs/libdingaling/NEWS | 1 - libs/libdingaling/README | 8 - libs/libdingaling/acsite.m4 | 6 - .../build/config/ac_cflags_gcc_option.m4 | 142 - .../build/config/ac_cflags_sun_option.m4 | 140 - .../build/config/ac_gcc_archflag.m4 | 148 - .../build/config/ac_gcc_x86_cpuid.m4 | 21 - .../libdingaling/build/config/ac_prog_gzip.m4 | 9 - .../libdingaling/build/config/ac_prog_wget.m4 | 9 - .../libdingaling/build/config/ax_cc_maxopt.m4 | 120 - .../build/config/ax_cflags_warn_all_ansi.m4 | 94 - .../build/config/ax_check_compiler_flags.m4 | 26 - .../build/config/ax_compiler_vendor.m4 | 15 - libs/libdingaling/compile | 142 - libs/libdingaling/config.guess | 1420 ---- libs/libdingaling/config.sub | 1799 ----- libs/libdingaling/configure.ac | 149 - libs/libdingaling/configure.gnu | 4 - libs/libdingaling/depcomp | 530 -- libs/libdingaling/doc | 1 - libs/libdingaling/docs/Doxygen.conf | 264 - libs/libdingaling/docs/docs.vcproj | 178 - libs/libdingaling/install-sh | 323 - libs/libdingaling/libdingaling.2008.vcproj | 621 -- .../libdingaling.2010.vcxproj.filters | 38 - libs/libdingaling/libdingaling.2017.vcxproj | 303 - libs/libdingaling/libdingaling.vcproj | 343 - libs/libdingaling/ltmain.sh | 6530 ----------------- libs/libdingaling/missing | 360 - libs/libdingaling/mkinstalldirs | 158 - libs/libdingaling/src/dingaling.def | 30 - libs/libdingaling/src/ldl_compat.h | 76 - libs/libdingaling/src/libdingaling.c | 3301 --------- libs/libdingaling/src/libdingaling.h | 751 -- libs/libdingaling/src/sha1.c | 639 -- libs/libdingaling/src/sha1.h | 86 - src/include/switch.h | 5 - src/mod/Makefile.am | 2 +- src/mod/endpoints/mod_dingaling/Makefile.am | 24 - .../mod_dingaling/mod_dingaling.2017.vcxproj | 165 - .../endpoints/mod_dingaling/mod_dingaling.c | 4482 ----------- 59 files changed, 6 insertions(+), 24292 deletions(-) delete mode 100644 conf/curl/autoload_configs/dingaling.conf.xml delete mode 100644 libs/libdingaling/.update delete mode 100644 libs/libdingaling/AUTHORS delete mode 100644 libs/libdingaling/COPYING delete mode 100644 libs/libdingaling/ChangeLog delete mode 100644 libs/libdingaling/INSTALL delete mode 100644 libs/libdingaling/Makefile.am delete mode 100644 libs/libdingaling/NEWS delete mode 100644 libs/libdingaling/README delete mode 100644 libs/libdingaling/acsite.m4 delete mode 100644 libs/libdingaling/build/config/ac_cflags_gcc_option.m4 delete mode 100644 libs/libdingaling/build/config/ac_cflags_sun_option.m4 delete mode 100644 libs/libdingaling/build/config/ac_gcc_archflag.m4 delete mode 100644 libs/libdingaling/build/config/ac_gcc_x86_cpuid.m4 delete mode 100644 libs/libdingaling/build/config/ac_prog_gzip.m4 delete mode 100644 libs/libdingaling/build/config/ac_prog_wget.m4 delete mode 100644 libs/libdingaling/build/config/ax_cc_maxopt.m4 delete mode 100644 libs/libdingaling/build/config/ax_cflags_warn_all_ansi.m4 delete mode 100644 libs/libdingaling/build/config/ax_check_compiler_flags.m4 delete mode 100644 libs/libdingaling/build/config/ax_compiler_vendor.m4 delete mode 100755 libs/libdingaling/compile delete mode 100644 libs/libdingaling/config.guess delete mode 100644 libs/libdingaling/config.sub delete mode 100755 libs/libdingaling/configure.ac delete mode 100644 libs/libdingaling/configure.gnu delete mode 100644 libs/libdingaling/depcomp delete mode 100644 libs/libdingaling/doc delete mode 100644 libs/libdingaling/docs/Doxygen.conf delete mode 100644 libs/libdingaling/docs/docs.vcproj delete mode 100644 libs/libdingaling/install-sh delete mode 100644 libs/libdingaling/libdingaling.2008.vcproj delete mode 100644 libs/libdingaling/libdingaling.2010.vcxproj.filters delete mode 100644 libs/libdingaling/libdingaling.2017.vcxproj delete mode 100644 libs/libdingaling/libdingaling.vcproj delete mode 100755 libs/libdingaling/ltmain.sh delete mode 100644 libs/libdingaling/missing delete mode 100644 libs/libdingaling/mkinstalldirs delete mode 100644 libs/libdingaling/src/dingaling.def delete mode 100644 libs/libdingaling/src/ldl_compat.h delete mode 100644 libs/libdingaling/src/libdingaling.c delete mode 100644 libs/libdingaling/src/libdingaling.h delete mode 100644 libs/libdingaling/src/sha1.c delete mode 100644 libs/libdingaling/src/sha1.h delete mode 100644 src/mod/endpoints/mod_dingaling/Makefile.am delete mode 100644 src/mod/endpoints/mod_dingaling/mod_dingaling.2017.vcxproj delete mode 100644 src/mod/endpoints/mod_dingaling/mod_dingaling.c diff --git a/LICENSE b/LICENSE index 8d2aa962f4..46a2c712e9 100644 --- a/LICENSE +++ b/LICENSE @@ -1595,15 +1595,6 @@ Files: libs/silk/* Copyright: 2006-2011, Skype Limited. License: BSD-2-clause -Files: libs/libdingaling/* -Copyright: 2005-2014, Anthony Minessale II - 2001-2003 Allan Saddi -License: MPL-1.1 - -Files: libs/libdingaling/src/sha1.[ch] -Copyright: 2001-2003 Allan Saddi -License: BSD-2-clause - Files: libs/libcodec2/* Copyright: 1990-2010 David Rowe 1990-2010 David Rowe 2009 diff --git a/Makefile.am b/Makefile.am index 815eafd188..f869072ff7 100644 --- a/Makefile.am +++ b/Makefile.am @@ -685,7 +685,7 @@ yesdepends: rm .nodepends iksemel-dep: - make -C src/mod/endpoints/mod_dingaling deps + make -C src/mod/formats/mod_ssml deps core: $(switch_builddir)/modules.conf src/include/switch_version.h $(CORE_LIBS) $(MAKE) $(AM_MAKEFLAGS) libfreeswitch.la @@ -765,7 +765,7 @@ iks-reconf: cd libs/iksemel && $(MAKE) clean cd libs/iksemel && autoreconf -fi cd libs/iksemel && sh ./configure.gnu $(MY_DEFAULT_ARGS) - $(MAKE) mod_dingaling-clean + $(MAKE) mod_ssml-clean cluecon: @clear diff --git a/bootstrap.sh b/bootstrap.sh index 46e09f3537..a68a0624ac 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -10,7 +10,7 @@ BGJOB=false VERBOSE=false BASEDIR=`pwd`; LIBDIR=${BASEDIR}/libs; -SUBDIRS="apr libzrtp iksemel libdingaling srtp unimrcp fs"; +SUBDIRS="apr libzrtp iksemel srtp unimrcp fs"; while getopts 'jhd:v' o; do case "$o" in diff --git a/build/modules.conf.in b/build/modules.conf.in index feb902994b..ab50bd53dc 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -87,7 +87,6 @@ dialplans/mod_dialplan_asterisk dialplans/mod_dialplan_xml #directories/mod_ldap #endpoints/mod_alsa -#endpoints/mod_dingaling #endpoints/mod_gsmopen #endpoints/mod_h323 #endpoints/mod_khomp diff --git a/build/modules.conf.most b/build/modules.conf.most index a981c273db..86063db582 100644 --- a/build/modules.conf.most +++ b/build/modules.conf.most @@ -84,7 +84,6 @@ dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml directories/mod_ldap #endpoints/mod_alsa -endpoints/mod_dingaling #endpoints/mod_gsmopen #endpoints/mod_h323 #endpoints/mod_khomp diff --git a/conf/curl/autoload_configs/dingaling.conf.xml b/conf/curl/autoload_configs/dingaling.conf.xml deleted file mode 100644 index e68c8b4b44..0000000000 --- a/conf/curl/autoload_configs/dingaling.conf.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/configure.ac b/configure.ac index 6d8d140a60..24e838731a 100644 --- a/configure.ac +++ b/configure.ac @@ -1088,7 +1088,7 @@ if test "x${ax_cv_c_compiler_vendor}" = "xclang" ; then fi # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready -# Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_dingaling mod_opal mod_h323 mod_khomp +# Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_opal mod_h323 mod_khomp # mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed # #saved_CFLAGS="$CFLAGS" @@ -2173,7 +2173,6 @@ AC_CONFIG_FILES([Makefile src/mod/dialplans/mod_dialplan_xml/Makefile src/mod/directories/mod_ldap/Makefile src/mod/endpoints/mod_alsa/Makefile - src/mod/endpoints/mod_dingaling/Makefile src/mod/endpoints/mod_gsmopen/Makefile src/mod/endpoints/mod_h323/Makefile src/mod/endpoints/mod_khomp/Makefile @@ -2332,7 +2331,6 @@ if test "$use_system_apr" != "yes"; then AC_CONFIG_SUBDIRS([libs/apr]) fi AC_CONFIG_SUBDIRS([libs/iksemel]) -#AC_CONFIG_SUBDIRS([libs/libdingaling]) #AC_CONFIG_SUBDIRS([libs/unimrcp]) if test "x${enable_zrtp}" = "xyes"; then AC_CONFIG_SUBDIRS([libs/libzrtp]) diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index fd5ff75cf0..ba94c9d1ce 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -657,7 +657,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-dialplan-asterisk (= \${binary:Version}), freeswitch-mod-dialplan-directory (= \${binary:Version}), freeswitch-mod-dialplan-xml (= \${binary:Version}), - freeswitch-mod-dingaling (= \${binary:Version}), freeswitch-mod-loopback (= \${binary:Version}), freeswitch-mod-portaudio (= \${binary:Version}), freeswitch-mod-rtc (= \${binary:Version}), @@ -896,7 +895,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-dialplan-asterisk-dbg (= \${binary:Version}), freeswitch-mod-dialplan-directory-dbg (= \${binary:Version}), freeswitch-mod-dialplan-xml-dbg (= \${binary:Version}), - freeswitch-mod-dingaling-dbg (= \${binary:Version}), freeswitch-mod-loopback-dbg (= \${binary:Version}), freeswitch-mod-portaudio-dbg (= \${binary:Version}), freeswitch-mod-rtc-dbg (= \${binary:Version}), diff --git a/debian/control-modules b/debian/control-modules index a3b53790a4..f438d0277d 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -431,10 +431,6 @@ Description: mod_alsa Adds mod_alsa. Build-Depends: libasound2-dev -Module: endpoints/mod_dingaling -Description: mod_dingaling - Adds mod_dingaling. - Module: endpoints/mod_gsmopen Description: mod_gsmopen Adds mod_gsmopen. diff --git a/debian/copyright b/debian/copyright index 6745df1f35..af7a6fe152 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1595,15 +1595,6 @@ Files: libs/silk/* Copyright: 2006-2011, Skype Limited. License: BSD-2-clause -Files: libs/libdingaling/* -Copyright: 2005-2014, Anthony Minessale II - 2001-2003 Allan Saddi -License: MPL-1.1 - -Files: libs/libdingaling/src/sha1.[ch] -Copyright: 2001-2003 Allan Saddi -License: BSD-2-clause - Files: libs/libcodec2/* Copyright: 1990-2010 David Rowe 1990-2010 David Rowe 2009 diff --git a/freeswitch.spec b/freeswitch.spec index 19a7dd5516..7bdb8eaec6 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -841,15 +841,6 @@ PostgreSQL native support for FreeSWITCH. # FreeSWITCH Endpoint Modules ###################################################################################################################### -%package endpoint-dingaling -Summary: Generic XMPP support for FreeSWITCH open source telephony platform -Group: System/Libraries -Requires: %{name} = %{version}-%{release} - -%description endpoint-dingaling -XMPP support for FreeSWITCH open source telephony platform. Allows FreeSWITCH -to be used as a client for GoogleTalk or other XMPP Servers. - #%package endpoint-gsmopen #Summary: Generic GSM endpoint support for FreeSWITCH open source telephony platform #Group: System/Libraries @@ -1485,7 +1476,7 @@ DIRECTORIES_MODULES="" # Endpoints # ###################################################################################################################### -ENDPOINTS_MODULES="endpoints/mod_dingaling \ +ENDPOINTS_MODULES=" \ endpoints/mod_loopback endpoints/mod_portaudio endpoints/mod_rtmp \ endpoints/mod_skinny endpoints/mod_verto endpoints/mod_rtc endpoints/mod_sofia" @@ -1920,7 +1911,6 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/curl.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/db.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/dialplan_directory.conf.xml -%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/dingaling.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/directory.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/distributor.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/easyroute.conf.xml @@ -2258,9 +2248,6 @@ fi # ###################################################################################################################### -%files endpoint-dingaling -%{MODINSTDIR}/mod_dingaling.so* - #%files endpoint-gsmopen #%{MODINSTDIR}/mod_gsmopen.so* diff --git a/libs/.gitignore b/libs/.gitignore index 7fbd445cf3..cb4112eb88 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -199,11 +199,6 @@ opal /libcodec2/unittest/vqtrainjnd /libcodec2/unittest/vqtrainph /libcodec2/unittest/vqtrainsp -/libdingaling/build/compile -/libdingaling/Makefile -/libdingaling/Makefile.in -/libdingaling/src/config.h -/libdingaling/src/stamp-h1 /libg722_1/config-h.in /libg722_1/doc/Makefile /libg722_1/doc/Makefile.in @@ -702,12 +697,6 @@ opal # build products we should remove !/iksemel/ltmain.sh -!/libdingaling/config.guess -!/libdingaling/config.sub -!/libdingaling/depcomp -!/libdingaling/install-sh -!/libdingaling/ltmain.sh -!/libdingaling/missing !/libg722_1/config/depcomp !/libg722_1/config/missing !/tiff-*/config/depcomp @@ -730,7 +719,6 @@ unimrcp/build/compile portaudio.*.log apr/configure iksemel/configure -libdingaling/configure libyuv/Makefile libyuv/convert srtp/configure diff --git a/libs/libdingaling/.update b/libs/libdingaling/.update deleted file mode 100644 index 84faa7df3c..0000000000 --- a/libs/libdingaling/.update +++ /dev/null @@ -1 +0,0 @@ -Fri Mar 9 17:53:09 CST 2007 diff --git a/libs/libdingaling/AUTHORS b/libs/libdingaling/AUTHORS deleted file mode 100644 index 3d05d943aa..0000000000 --- a/libs/libdingaling/AUTHORS +++ /dev/null @@ -1,18 +0,0 @@ -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: - diff --git a/libs/libdingaling/COPYING b/libs/libdingaling/COPYING deleted file mode 100644 index 1bf2b1279d..0000000000 --- a/libs/libdingaling/COPYING +++ /dev/null @@ -1,471 +0,0 @@ - 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/libs/libdingaling/ChangeLog b/libs/libdingaling/ChangeLog deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/libdingaling/INSTALL b/libs/libdingaling/INSTALL deleted file mode 100644 index 095b1eb406..0000000000 --- a/libs/libdingaling/INSTALL +++ /dev/null @@ -1,231 +0,0 @@ -Installation Instructions -************************* - -Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004 Free -Software Foundation, Inc. - -This file is free documentation; the Free Software Foundation gives -unlimited permission to copy, distribute and modify it. - -Basic Installation -================== - -These are generic installation instructions. - - 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 only 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. If you're - using `csh' on an old version of System V, you might need to type - `sh ./configure' instead to prevent `csh' from trying to execute - `configure' itself. - - Running `configure' takes awhile. 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. - - 4. Type `make install' to install the programs and any data files and - documentation. - - 5. 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. - -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=c89 CFLAGS=-O2 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 must use a version of `make' that -supports the `VPATH' variable, such as 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 `..'. - - If you have to use a `make' that does not support the `VPATH' -variable, you have 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. - -Installation Names -================== - -By default, `make install' will install the package's files in -`/usr/local/bin', `/usr/local/man', etc. You can specify an -installation prefix other than `/usr/local' by giving `configure' the -option `--prefix=PREFIX'. - - You can specify separate installation prefixes for -architecture-specific files and architecture-independent files. If you -give `configure' the option `--exec-prefix=PREFIX', the package will -use PREFIX as the prefix for installing programs and libraries. -Documentation and other data files will 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. - - 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'. - -Optional Features -================= - -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. - -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 `--target=TYPE' option 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 - -will cause the specified gcc to be used as the C compiler (unless it is -overridden in the site shell script). - -`configure' Invocation -====================== - -`configure' recognizes the following options to control how it operates. - -`--help' -`-h' - Print a summary of the options to `configure', and exit. - -`--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. - -`configure' also accepts some other, not widely useful, options. Run -`configure --help' for more details. - diff --git a/libs/libdingaling/Makefile.am b/libs/libdingaling/Makefile.am deleted file mode 100644 index 37bf42cb31..0000000000 --- a/libs/libdingaling/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -EXTRA_DIST = -SUBDIRS = -AUTOMAKE_OPTIONS = foreign -NAME=dingaling -PREFIX=$(prefix) -TOUCH_TARGET=@if test -f "$@" ; then touch "$@" ; fi ; - -AM_CFLAGS = $(new_AM_CFLAGS) -I./src -I$(prefix)/include -AM_CPPFLAGS = $(AM_CFLAGS) -AM_LDFLAGS = $(new_AM_LDFLAGS) - -AM_CFLAGS += `../apr/apr-1-config --cflags --cppflags --includes || $(prefix)/bin/apr-1-config --cflags --cppflags --includes` -AM_CFLAGS += `../apr-util/apu-1-config --includes || $(prefix)/bin/apu-1-config --includes` -AM_CFLAGS += -I../iksemel/include - -lib_LTLIBRARIES = libdingaling.la -libdingaling_la_SOURCES = src/libdingaling.c src/sha1.c -libdingaling_la_CFLAGS = $(AM_CFLAGS) -libdingaling_la_LDFLAGS = $(AM_LDFLAGS) -libdingaling_la_LIBADD = ../iksemel/src/libiksemel.la ../apr/libapr-1.la ../apr-util/libaprutil-1.la -library_includedir = $(prefix)/include -library_include_HEADERS = src/libdingaling.h - -$(libdingaling_la_SOURCES): $(libdingaling_la_LIBADD) - -../apr/libapr-1.la: ../apr ../apr/.update - cd ../apr && $(MAKE) - $(TOUCH_TARGET) - -../apr-util/libaprutil-1.la: ../apr-util ../apr-util/.update - cd ../apr-util && $(MAKE) - $(TOUCH_TARGET) - -../iksemel/src/libiksemel.la: ../iksemel ../iksemel/.update - cd ../iksemel && $(MAKE) - $(TOUCH_TARGET) - -dox: - cd docs && doxygen $(PWD)/docs/Doxygen.conf - -doxclean: - rm -fr docs/html/ docs/man/ docs/perlmod/ docs/xml/ diff --git a/libs/libdingaling/NEWS b/libs/libdingaling/NEWS deleted file mode 100644 index eef3e09d2b..0000000000 --- a/libs/libdingaling/NEWS +++ /dev/null @@ -1 +0,0 @@ -Developed on UNIX where the motto is "no news is good news!". diff --git a/libs/libdingaling/README b/libs/libdingaling/README deleted file mode 100644 index 95e0a39bcf..0000000000 --- a/libs/libdingaling/README +++ /dev/null @@ -1,8 +0,0 @@ -Install is common: - -./configure --with-prefix= -make -make install - - - diff --git a/libs/libdingaling/acsite.m4 b/libs/libdingaling/acsite.m4 deleted file mode 100644 index 80f8cf4138..0000000000 --- a/libs/libdingaling/acsite.m4 +++ /dev/null @@ -1,6 +0,0 @@ -m4_include([build/config/ax_compiler_vendor.m4]) -m4_include([build/config/ax_cflags_warn_all_ansi.m4]) -m4_include([build/config/ax_cc_maxopt.m4]) -m4_include([build/config/ax_check_compiler_flags.m4]) -m4_include([build/config/ac_gcc_archflag.m4]) -m4_include([build/config/ac_gcc_x86_cpuid.m4]) diff --git a/libs/libdingaling/build/config/ac_cflags_gcc_option.m4 b/libs/libdingaling/build/config/ac_cflags_gcc_option.m4 deleted file mode 100644 index e651a5e6c5..0000000000 --- a/libs/libdingaling/build/config/ac_cflags_gcc_option.m4 +++ /dev/null @@ -1,142 +0,0 @@ -AC_DEFUN([AX_CFLAGS_GCC_OPTION_OLD], [dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$2])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_OLD], [dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$2])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for gcc m4_ifval($2,$2,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % m4_ifval($2,$2,-option)" dnl GCC - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl ------------------------------------------------------------------------- - -AC_DEFUN([AX_CFLAGS_GCC_OPTION_NEW], [dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_gcc_option_$1])dnl -AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) - m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_GCC_OPTION_NEW], [dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_gcc_option_$1])dnl -AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for gcc m4_ifval($1,$1,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "-pedantic % m4_ifval($1,$1,-option)" dnl GCC - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) - m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -AC_DEFUN([AX_CFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, -[AX_CFLAGS_GCC_OPTION_NEW($@)],[AX_CFLAGS_GCC_OPTION_OLD($@)])]) - -AC_DEFUN([AX_CXXFLAGS_GCC_OPTION],[ifelse(m4_bregexp([$2],[-]),-1, -[AX_CXXFLAGS_GCC_OPTION_NEW($@)],[AX_CXXFLAGS_GCC_OPTION_OLD($@)])]) - diff --git a/libs/libdingaling/build/config/ac_cflags_sun_option.m4 b/libs/libdingaling/build/config/ac_cflags_sun_option.m4 deleted file mode 100644 index a09e6fb695..0000000000 --- a/libs/libdingaling/build/config/ac_cflags_sun_option.m4 +++ /dev/null @@ -1,140 +0,0 @@ -AC_DEFUN([AX_CFLAGS_SUN_OPTION_OLD], [dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$2])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "+xstrconst % -xc99=all m4_ifval($2,$2,-option)" dnl Solaris C - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_OLD], [dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$2])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for sun/cc m4_ifval($2,$2,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "+xstrconst % -xc99=all m4_ifval($2,$2,-option)" dnl Solaris C - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl ----------------------------------------------------------------------- - -AC_DEFUN([AX_CFLAGS_SUN_OPTION_NEW], [dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_sun_option_$1])dnl -AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "+xstrconst % -xc99=all m4_ifval($1,$1,-option)" dnl Solaris C - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) - m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_SUN_OPTION_NEW], [dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_sun_option_$1])dnl -AC_CACHE_CHECK([m4_ifval($2,$2,FLAGS) for sun/cc m4_ifval($1,$1,-option)], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -for ac_arg dnl -in "+xstrconst % -xc99=all m4_ifval($1,$1,-option)" dnl Solaris C - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($2,$2,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($2,$2,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR"]) - m4_ifval($2,$2,FLAGS)="$m4_ifval($2,$2,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -AC_DEFUN([AX_CFLAGS_SUN_OPTION],[ifelse(m4_regexp([$2],[-]),-1, -[AX_CFLAGS_SUN_OPTION_NEW($@)],[AX_CFLAGS_SUN_OPTION_OLD($@)])]) - -AC_DEFUN([AX_CXXFLAGS_SUN_OPTION],[ifelse(m4_regexp([$2],[-]),-1, -[AX_CXXFLAGS_SUN_OPTION_NEW($@)],[AX_CXXFLAGS_SUN_OPTION_OLD($@)])]) - diff --git a/libs/libdingaling/build/config/ac_gcc_archflag.m4 b/libs/libdingaling/build/config/ac_gcc_archflag.m4 deleted file mode 100644 index b38a564902..0000000000 --- a/libs/libdingaling/build/config/ac_gcc_archflag.m4 +++ /dev/null @@ -1,148 +0,0 @@ -AC_DEFUN([AX_GCC_ARCHFLAG], -[AC_REQUIRE([AC_PROG_CC]) - -AC_ARG_WITH(gcc-arch, [AC_HELP_STRING([--with-gcc-arch=], [use architecture for gcc -march/-mtune, instead of guessing])], - ax_gcc_arch=$withval, ax_gcc_arch=yes) - -AC_MSG_CHECKING([for gcc architecture flag]) -AC_MSG_RESULT([]) -AC_CACHE_VAL(ax_cv_gcc_archflag, -[ -ax_cv_gcc_archflag="unknown" - -if test "$GCC" = yes; then - -if test "x$ax_gcc_arch" = xyes; then -ax_gcc_arch="" -if test "$cross_compiling" = no; then -case $host_cpu in - i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones - AX_GCC_X86_CPUID(0) - AX_GCC_X86_CPUID(1) - case $ax_cv_gcc_x86_cpuid_0 in - *:756e6547:*:*) # Intel - case $ax_cv_gcc_x86_cpuid_1 in - *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; - *5??:*:*:*) ax_gcc_arch=pentium ;; - *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; - *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; - *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; - *6??:*:*:*) ax_gcc_arch=pentiumpro ;; - *f3[[347]]:*:*:*|*f4[1347]:*:*:*) - case $host_cpu in - x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; - *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; - esac ;; - *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; - esac ;; - *:68747541:*:*) # AMD - case $ax_cv_gcc_x86_cpuid_1 in - *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;; - *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; - *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; - *60?:*:*:*) ax_gcc_arch=k7 ;; - *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;; - *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; - *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; - *6[[68a]]?:*:*:*) - AX_GCC_X86_CPUID(0x80000006) # L2 cache size - case $ax_cv_gcc_x86_cpuid_0x80000006 in - *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256 - ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; - *) ax_gcc_arch="athlon-4 athlon k7" ;; - esac ;; - *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; - *f5?:*:*:*) ax_gcc_arch="opteron k8" ;; - *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; - *f??:*:*:*) ax_gcc_arch="k8" ;; - esac ;; - *:746e6543:*:*) # IDT - case $ax_cv_gcc_x86_cpuid_1 in - *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; - *58?:*:*:*) ax_gcc_arch=winchip2 ;; - *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;; - *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; - esac ;; - esac - if test x"$ax_gcc_arch" = x; then # fallback - case $host_cpu in - i586*) ax_gcc_arch=pentium ;; - i686*) ax_gcc_arch=pentiumpro ;; - esac - fi - ;; - - sparc*) - AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/]) - cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` - cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` - case $cputype in - *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; - *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; - *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; - *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;; - *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;; - *cypress*) ax_gcc_arch=cypress ;; - esac ;; - - alphaev5) ax_gcc_arch=ev5 ;; - alphaev56) ax_gcc_arch=ev56 ;; - alphapca56) ax_gcc_arch="pca56 ev56" ;; - alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; - alphaev6) ax_gcc_arch=ev6 ;; - alphaev67) ax_gcc_arch=ev67 ;; - alphaev68) ax_gcc_arch="ev68 ev67" ;; - alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; - alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; - alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; - - powerpc*) - cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` - cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` - case $cputype in - *750*) ax_gcc_arch="750 G3" ;; - *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;; - *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;; - *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;; - *970*) ax_gcc_arch="970 G5 power4";; - *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; - *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; - 603ev|8240) ax_gcc_arch="$cputype 603e 603";; - *) ax_gcc_arch=$cputype ;; - esac - ax_gcc_arch="$ax_gcc_arch powerpc" - ;; -esac -fi # not cross-compiling -fi # guess arch - -if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then -for arch in $ax_gcc_arch; do - if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code - flags="-mtune=$arch" - # -mcpu=$arch and m$arch generate nonportable code on every arch except - # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. - case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac - else - flags="-march=$arch -mcpu=$arch -m$arch" - fi - for flag in $flags; do - AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break]) - done - test "x$ax_cv_gcc_archflag" = xunknown || break -done -fi - -fi # $GCC=yes -]) -AC_MSG_CHECKING([for gcc architecture flag]) -AC_MSG_RESULT($ax_cv_gcc_archflag) -if test "x$ax_cv_gcc_archflag" = xunknown; then - m4_default([$3],:) -else - m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"]) -fi -]) - diff --git a/libs/libdingaling/build/config/ac_gcc_x86_cpuid.m4 b/libs/libdingaling/build/config/ac_gcc_x86_cpuid.m4 deleted file mode 100644 index 3cf22d0dde..0000000000 --- a/libs/libdingaling/build/config/ac_gcc_x86_cpuid.m4 +++ /dev/null @@ -1,21 +0,0 @@ -AC_DEFUN([AX_GCC_X86_CPUID], -[AC_REQUIRE([AC_PROG_CC]) -AC_LANG_PUSH([C]) -AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1, - [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [ - int op = $1, eax, ebx, ecx, edx; - FILE *f; - __asm__("cpuid" - : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) - : "a" (op)); - f = fopen("conftest_cpuid", "w"); if (!f) return 1; - fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); - fclose(f); - return 0; -])], - [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid], - [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid], - [ax_cv_gcc_x86_cpuid_$1=unknown])]) -AC_LANG_POP([C]) -]) - diff --git a/libs/libdingaling/build/config/ac_prog_gzip.m4 b/libs/libdingaling/build/config/ac_prog_gzip.m4 deleted file mode 100644 index f37a4cc9ce..0000000000 --- a/libs/libdingaling/build/config/ac_prog_gzip.m4 +++ /dev/null @@ -1,9 +0,0 @@ -AC_DEFUN([AC_PROG_GZIP],[ -AC_CHECK_PROGS(gzip,[gzip],no) -export gzip; -if test $gzip = "no" ; -then - AC_MSG_ERROR([Unable to find the gzip application]); -fi -AC_SUBST(gzip) -]) diff --git a/libs/libdingaling/build/config/ac_prog_wget.m4 b/libs/libdingaling/build/config/ac_prog_wget.m4 deleted file mode 100644 index 56b6b8334f..0000000000 --- a/libs/libdingaling/build/config/ac_prog_wget.m4 +++ /dev/null @@ -1,9 +0,0 @@ -AC_DEFUN([AC_PROG_WGET],[ -AC_CHECK_PROGS(wget,[wget],no) -export wget; -if test $wget = "no" ; -then - AC_MSG_ERROR([Unable to find the wget application]); -fi -AC_SUBST(wget) -]) diff --git a/libs/libdingaling/build/config/ax_cc_maxopt.m4 b/libs/libdingaling/build/config/ax_cc_maxopt.m4 deleted file mode 100644 index 6205ee84c8..0000000000 --- a/libs/libdingaling/build/config/ax_cc_maxopt.m4 +++ /dev/null @@ -1,120 +0,0 @@ -AC_DEFUN([AX_CC_MAXOPT], -[ -AC_REQUIRE([AC_PROG_CC]) -AC_REQUIRE([AX_COMPILER_VENDOR]) - -AC_ARG_ENABLE(portable-binary, [AC_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], - acx_maxopt_portable=$withval, acx_maxopt_portable=no) - -# Try to determine "good" native compiler flags if none specified via CFLAGS -if test "$ac_test_CFLAGS" != "set"; then - CFLAGS="" - case $ax_cv_c_compiler_vendor in - dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" - if test "x$acx_maxopt_portable" = xno; then - CFLAGS="$CFLAGS -arch host" - fi;; - - sun) CFLAGS="-native -fast -xO5 -dalign -xc99=all" - if test "x$acx_maxopt_portable" = xyes; then - CFLAGS="$CFLAGS -xarch=generic" - fi;; - - hp) CFLAGS="+Oall +Optrs_ansi +DSnative" - if test "x$acx_maxopt_portable" = xyes; then - CFLAGS="$CFLAGS +DAportable" - fi;; - - ibm) if test "x$acx_maxopt_portable" = xno; then - xlc_opt="-qarch=auto -qtune=auto" - else - xlc_opt="-qtune=auto" - fi - AX_CHECK_COMPILER_FLAGS($xlc_opt, - CFLAGS="-O3 -qansialias -w $xlc_opt", - [CFLAGS="-O3 -qansialias -w" - echo "******************************************************" - echo "* You seem to have the IBM C compiler. It is *" - echo "* recommended for best performance that you use: *" - echo "* *" - echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" - echo "* ^^^ ^^^ *" - echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" - echo "* CPU you have. (Set the CFLAGS environment var. *" - echo "* and re-run configure.) For more info, man cc. *" - echo "******************************************************"]) - ;; - - intel) CFLAGS="-O3 -ansi_alias" - if test "x$acx_maxopt_portable" = xno; then - icc_archflag=unknown - icc_flags="" - case $host_cpu in - i686*|x86_64*) - # icc accepts gcc assembly syntax, so these should work: - AX_GCC_X86_CPUID(0) - AX_GCC_X86_CPUID(1) - case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG - *:756e6547:*:*) # Intel - case $ax_cv_gcc_x86_cpuid_1 in - *6a?:*[[234]]:*:*|*6[[789b]]?:*:*:*) icc_flags="-xK";; - *f3[[347]]:*:*:*|*f4[1347]:*:*:*) icc_flags="-xP -xN -xW -xK";; - *f??:*:*:*) icc_flags="-xN -xW -xK";; - esac ;; - esac ;; - esac - if test "x$icc_flags" != x; then - for flag in $icc_flags; do - AX_CHECK_COMPILER_FLAGS($flag, [icc_archflag=$flag; break]) - done - fi - AC_MSG_CHECKING([for icc architecture flag]) - AC_MSG_RESULT($icc_archflag) - if test "x$icc_archflag" != xunknown; then - CFLAGS="$CFLAGS $icc_archflag" - fi - fi - ;; - - gnu) - # default optimization flags for gcc on all systems - CFLAGS="-O3 -fomit-frame-pointer" - - # -malign-double for x86 systems - AX_CHECK_COMPILER_FLAGS(-malign-double, CFLAGS="$CFLAGS -malign-double") - - # -fstrict-aliasing for gcc-2.95+ - AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing, - CFLAGS="$CFLAGS -fstrict-aliasing") - - # note that we enable "unsafe" fp optimization with other compilers, too - AX_CHECK_COMPILER_FLAGS(-ffast-math, CFLAGS="$CFLAGS -ffast-math") - - AX_GCC_ARCHFLAG($acx_maxopt_portable) - ;; - esac - - if test -z "$CFLAGS"; then - echo "" - echo "********************************************************" - echo "* WARNING: Don't know the best CFLAGS for this system *" - echo "* Use ./configure CFLAGS=... to specify your own flags *" - echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" - echo "********************************************************" - echo "" - CFLAGS="-O3" - fi - - AX_CHECK_COMPILER_FLAGS($CFLAGS, [], [ - echo "" - echo "********************************************************" - echo "* WARNING: The guessed CFLAGS don't seem to work with *" - echo "* your compiler. *" - echo "* Use ./configure CFLAGS=... to specify your own flags *" - echo "********************************************************" - echo "" - CFLAGS="" - ]) - -fi -]) diff --git a/libs/libdingaling/build/config/ax_cflags_warn_all_ansi.m4 b/libs/libdingaling/build/config/ax_cflags_warn_all_ansi.m4 deleted file mode 100644 index 5b35464457..0000000000 --- a/libs/libdingaling/build/config/ax_cflags_warn_all_ansi.m4 +++ /dev/null @@ -1,94 +0,0 @@ -AC_DEFUN([AX_CFLAGS_WARN_ALL_ANSI],[dnl -AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all_ansi])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_C - ac_save_[]FLAGS="$[]FLAGS" -# IRIX C compiler: -# -use_readonly_const is the default for IRIX C, -# puts them into .rodata, but they are copied later. -# need to be "-G0 -rdatashared" for strictmode but -# I am not sure what effect that has really. - guidod -for ac_arg dnl -in "-pedantic % -Wall -std=c99 -pedantic" dnl GCC - "-xstrconst % -v -xc99=all" dnl Solaris C - "-std1 % -verbose -w0 -warnprotos -std1" dnl Digital Unix - " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX - " % -ansi -ansiE -fullwarn" dnl IRIX - "+ESlit % +w1 -Aa" dnl HP-UX C - "-Xc % -pvctl[,]fullmsg -Xc" dnl NEC SX-5 (Super-UX 10) - "-h conform % -h msglevel 2 -h conform" dnl Cray C (Unicos) - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - -dnl the only difference - the LANG selection... and the default FLAGS - -AC_DEFUN([AX_CXXFLAGS_WARN_ALL_ANSI],[dnl -AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl -AS_VAR_PUSHDEF([VAR],[ac_cv_cxxflags_warn_all_ansi])dnl -AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum ansi warnings], -VAR,[VAR="no, unknown" - AC_LANG_SAVE - AC_LANG_CXX - ac_save_[]FLAGS="$[]FLAGS" -# IRIX C compiler: -# -use_readonly_const is the default for IRIX C, -# puts them into .rodata, but they are copied later. -# need to be "-G0 -rdatashared" for strictmode but -# I am not sure what effect that has really. - guidod -for ac_arg dnl -in "-pedantic % -Wall -ansi -pedantic" dnl GCC - "-xstrconst % -v -Xc" dnl Solaris C - "-std1 % -verbose -w0 -warnprotos -std1" dnl Digital Unix - " % -qlanglvl=ansi -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX - " % -ansi -ansiE -fullwarn" dnl IRIX - "+ESlit % +w1 -Aa" dnl HP-UX C - "-Xc % -pvctl[,]fullmsg -Xc" dnl NEC SX-5 (Super-UX 10) - "-h conform % -h msglevel 2 -h conform" dnl Cray C (Unicos) - # -do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` - AC_TRY_COMPILE([],[return 0;], - [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) -done - FLAGS="$ac_save_[]FLAGS" - AC_LANG_RESTORE -]) -case ".$VAR" in - .ok|.ok,*) m4_ifvaln($3,$3) ;; - .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ - AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; - *) m4_ifvaln($3,$3,[ - if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null - then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) - else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) - m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" - fi ]) ;; -esac -AS_VAR_POPDEF([VAR])dnl -AS_VAR_POPDEF([FLAGS])dnl -]) - diff --git a/libs/libdingaling/build/config/ax_check_compiler_flags.m4 b/libs/libdingaling/build/config/ax_check_compiler_flags.m4 deleted file mode 100644 index 73377b7c59..0000000000 --- a/libs/libdingaling/build/config/ax_check_compiler_flags.m4 +++ /dev/null @@ -1,26 +0,0 @@ -AC_DEFUN([AX_CHECK_COMPILER_FLAGS], -[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX -AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) -dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: -AS_LITERAL_IF([$1], - [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1), [ - ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, - AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])], - [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS - _AC_LANG_PREFIX[]FLAGS="$1" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=yes, - eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1)=no) - _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS]) -eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_$1) -AC_MSG_RESULT($ax_check_compiler_flags) -if test "x$ax_check_compiler_flags" = xyes; then - m4_default([$2], :) -else - m4_default([$3], :) -fi -])dnl AX_CHECK_COMPILER_FLAG diff --git a/libs/libdingaling/build/config/ax_compiler_vendor.m4 b/libs/libdingaling/build/config/ax_compiler_vendor.m4 deleted file mode 100644 index a24a58da0f..0000000000 --- a/libs/libdingaling/build/config/ax_compiler_vendor.m4 +++ /dev/null @@ -1,15 +0,0 @@ -AC_DEFUN([AX_COMPILER_VENDOR], -[ -AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, - [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown - # note: don't check for gcc first since some other compilers define __GNUC__ - for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do - vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" - AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ -#if !($vencpp) - thisisanerror; -#endif -])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) - done - ]) -]) diff --git a/libs/libdingaling/compile b/libs/libdingaling/compile deleted file mode 100755 index 1b1d232169..0000000000 --- a/libs/libdingaling/compile +++ /dev/null @@ -1,142 +0,0 @@ -#! /bin/sh -# Wrapper for compilers which do not understand `-c -o'. - -scriptversion=2005-05-14.22 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc. -# Written by Tom Tromey . -# -# 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., 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. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: compile [--help] [--version] PROGRAM [ARGS] - -Wrapper for compilers which do not understand `-c -o'. -Remove `-o dest.o' from ARGS, run PROGRAM with the remaining -arguments, and rename the output as expected. - -If you are trying to build a whole package this is not the -right script to run: please start by reading the file `INSTALL'. - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "compile $scriptversion" - exit $? - ;; -esac - -ofile= -cfile= -eat= - -for arg -do - if test -n "$eat"; then - eat= - else - case $1 in - -o) - # configure might choose to run compile as `compile cc -o foo foo.c'. - # So we strip `-o arg' only if arg is an object. - eat=1 - case $2 in - *.o | *.obj) - ofile=$2 - ;; - *) - set x "$@" -o "$2" - shift - ;; - esac - ;; - *.c) - cfile=$1 - set x "$@" "$1" - shift - ;; - *) - set x "$@" "$1" - shift - ;; - esac - fi - shift -done - -if test -z "$ofile" || test -z "$cfile"; then - # If no `-o' option was seen then we might have been invoked from a - # pattern rule where we don't need one. That is ok -- this is a - # normal compilation that the losing compiler can handle. If no - # `.c' file was seen then we are probably linking. That is also - # ok. - exec "$@" -fi - -# Name of file we expect compiler to create. -cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'` - -# Create the lock directory. -# Note: use `[/.-]' here to ensure that we don't use the same name -# that we are using for the .o file. Also, base the name on the expected -# object file name, since that is what matters with a parallel build. -lockdir=`echo "$cofile" | sed -e 's|[/.-]|_|g'`.d -while true; do - if mkdir "$lockdir" >/dev/null 2>&1; then - break - fi - sleep 1 -done -# FIXME: race condition here if user kills between mkdir and trap. -trap "rmdir '$lockdir'; exit 1" 1 2 15 - -# Run the compile. -"$@" -ret=$? - -if test -f "$cofile"; then - mv "$cofile" "$ofile" -elif test -f "${cofile}bj"; then - mv "${cofile}bj" "$ofile" -fi - -rmdir "$lockdir" -exit $ret - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/libs/libdingaling/config.guess b/libs/libdingaling/config.guess deleted file mode 100644 index 1f5c50c0d1..0000000000 --- a/libs/libdingaling/config.guess +++ /dev/null @@ -1,1420 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright 1992-2014 Free Software Foundation, Inc. - -timestamp='2014-03-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 -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception 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. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). -# -# Originally written by Per Bothner. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD -# -# Please send patches with a ChangeLog entry to config-patches@gnu.org. - - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright 1992-2014 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; 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) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -case "${UNAME_SYSTEM}" in -Linux|GNU|GNU/*) - # If the system lacks a compiler, then just pick glibc. - # We could probably try harder. - LIBC=gnu - - eval $set_cc_for_build - cat <<-EOF > $dummy.c - #include - #if defined(__UCLIBC__) - LIBC=uclibc - #elif defined(__dietlibc__) - LIBC=dietlibc - #else - LIBC=gnu - #endif - EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'` - ;; -esac - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - 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_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 -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:Bitrig:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE} - 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:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *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. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - 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 ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - 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 ;; - arm*:riscos:*:*|arm*:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - 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 - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - 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 ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - 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 ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - 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 - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - 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 ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - 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 ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - 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 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - 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 ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - 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]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - 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 -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - 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 ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - 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 ;; - 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 ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - UNAME_PROCESSOR=`/usr/bin/uname -p` - case ${UNAME_PROCESSOR} in - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW64*:*) - echo ${UNAME_MACHINE}-pc-mingw64 - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - *:MSYS*:*) - echo ${UNAME_MACHINE}-pc-msys - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - 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 ;; - 8664:Windows_NT:*) - echo x86_64-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 i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - 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/[-(].*//'`-${LIBC} - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - aarch64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - aarch64_be:Linux:*:*) - UNAME_MACHINE=aarch64_be - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - arc:Linux:*:* | arceb:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - 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-${LIBC} - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi - else - echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - cris:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - crisv32:Linux:*:*) - echo ${UNAME_MACHINE}-axis-linux-${LIBC} - exit ;; - frv:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - hexagon:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - i*86:Linux:*:*) - echo ${UNAME_MACHINE}-pc-linux-${LIBC} - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; } - ;; - openrisc*:Linux:*:*) - echo or1k-unknown-linux-${LIBC} - exit ;; - or32:Linux:*:* | or1k*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-${LIBC} - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-${LIBC} - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-${LIBC} ;; - PA8*) echo hppa2.0-unknown-linux-${LIBC} ;; - *) echo hppa-unknown-linux-${LIBC} ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-${LIBC} - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-${LIBC} - exit ;; - ppc64le:Linux:*:*) - echo powerpc64le-unknown-linux-${LIBC} - exit ;; - ppcle:Linux:*:*) - echo powerpcle-unknown-linux-${LIBC} - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux-${LIBC} - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-${LIBC} - exit ;; - x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} - 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 ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - 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.[02]*:*) - 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 - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - 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 ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - 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 i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - 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 ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - 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; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { 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; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - 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; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - 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 ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - 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 ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - x86_64:Haiku:*:*) - echo x86_64-unknown-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - 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 ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - eval $set_cc_for_build - if test "$UNAME_PROCESSOR" = unknown ; then - UNAME_PROCESSOR=powerpc - fi - if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - case $UNAME_PROCESSOR in - i386) UNAME_PROCESSOR=x86_64 ;; - powerpc) UNAME_PROCESSOR=powerpc64 ;; - esac - fi - fi - elif test "$UNAME_PROCESSOR" = i386 ; then - # Avoid executing cc on OS X 10.9, as it ships with a stub - # that puts up a graphical alert prompting to install - # developer tools. Any system running Mac OS X 10.7 or - # later (Darwin 11 and later) is required to have a 64-bit - # processor. This is not true of the ARM version of Darwin - # that Apple uses in portable devices. - UNAME_PROCESSOR=x86_64 - fi - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-*:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - 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 ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; - x86_64:VMkernel:*:*) - echo ${UNAME_MACHINE}-unknown-esx - exit ;; -esac - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/libs/libdingaling/config.sub b/libs/libdingaling/config.sub deleted file mode 100644 index bba4efb805..0000000000 --- a/libs/libdingaling/config.sub +++ /dev/null @@ -1,1799 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright 1992-2014 Free Software Foundation, Inc. - -timestamp='2014-09-11' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, see . -# -# As a special exception 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. This Exception is an additional permission under section 7 -# of the GNU General Public License, version 3 ("GPLv3"). - - -# Please send patches with a ChangeLog entry to config-patches@gnu.org. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright 1992-2014 Free Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - android-linux) - os=-linux-android - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze*) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -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/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -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/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*178) - os=-lynxos178 - ;; - -lynx*5) - os=-lynxos5 - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | aarch64 | aarch64_be \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arceb \ - | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ - | avr | avr32 \ - | be32 | be64 \ - | bfin \ - | c4x | c8051 | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | epiphany \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | hexagon \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | k1om \ - | le32 | le64 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa32r6 | mipsisa32r6el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64r6 | mipsisa64r6el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipsr5900 | mipsr5900el \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 | nios2eb | nios2el \ - | ns16k | ns32k \ - | open8 | or1k | or1knd | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | riscv32 | riscv64 \ - | rl78 | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | 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 \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip) - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - xgate) - basic_machine=$basic_machine-unknown - os=-none - ;; - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | aarch64-* | aarch64_be-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | be32-* | be64-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | c8051-* | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | hexagon-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | k1om-* \ - | le32-* | le64-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ - | microblaze-* | microblazeel-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa32r6-* | mipsisa32r6el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64r6-* | mipsisa64r6el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipsr5900-* | mipsr5900el-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* | nios2eb-* | nios2el-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | or1k*-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | rl78-* | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | 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-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile*-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ - | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # 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) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | 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 - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze*) - basic_machine=microblaze-xilinx - ;; - mingw64) - basic_machine=x86_64-pc - os=-mingw64 - ;; - mingw32) - basic_machine=i686-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - moxiebox) - basic_machine=moxie-unknown - os=-moxiebox - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - msys) - basic_machine=i686-pc - os=-msys - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - nacl) - basic_machine=le32-unknown - os=-nacl - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - 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 - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - 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-*) - basic_machine=ns32k-pc532 - ;; - 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 | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos | rdos64) - basic_machine=x86_64-pc - os=-rdos - ;; - rdos32) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - tile*) - basic_machine=$basic_machine-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 - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* | -plan9* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -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* | -cegcc* \ - | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-musl* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -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|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - c8051-*) - os=-elf - ;; - hexagon-*) - os=-elf - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - ;; - 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 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/libs/libdingaling/configure.ac b/libs/libdingaling/configure.ac deleted file mode 100755 index 0d7e832fa1..0000000000 --- a/libs/libdingaling/configure.ac +++ /dev/null @@ -1,149 +0,0 @@ -# -*- Autoconf -*- -# Process this file with autoconf to produce a configure script. - - -AC_INIT(libdingaling, 0.1) -AC_CONFIG_AUX_DIR(build) -AM_INIT_AUTOMAKE -AC_CONFIG_SRCDIR([src]) -AC_CONFIG_HEADERS([src/config.h]) - -CFLAGS="$CFLAGS $CONFIGURE_CFLAGS" -CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS" -LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS" - -#Set default language -AC_LANG_C -# Checks for programs. -AC_PROG_CC -AC_PROG_MAKE_SET -AC_PROG_LIBTOOL -AC_PROG_INSTALL - -#Check for compiler vendor -AX_COMPILER_VENDOR - -# Optimize -AC_ARG_ENABLE(optimization, -[AC_HELP_STRING([--enable-optimization],[Set if you want us to add max optimising compiler flags])],[enable_optimizer="$enableval"],[enable_optimizer="no"]) - -if test "${enable_optimizer}" = "yes" ; then - AC_DEFINE([OPTIMZER],[],[Enable Optimization.]) - AX_CC_MAXOPT -fi - -# Enable debugging -AC_ARG_ENABLE(debug, -[AC_HELP_STRING([--enable-debug],[build with debug information])],[enable_debug="$enable_debug"],[enable_debug="yes"]) - -if test "${enable_debug}" = "yes"; then - AC_DEFINE([DEBUG],[],[Enable extra debugging.]) - AX_CFLAGS_WARN_ALL_ANSI -fi - -AM_CONDITIONAL([WANT_DEBUG],[test "${enable_debug}" = "yes"]) - - -case "$host" in - *-solaris2*) - if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-KPIC -DPIC" - new_AM_LDFLAGS="-R${prefix}/lib" - FUNC_DEF=__func__ - IN_LINE="" - elif test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-fPIC" - new_AM_LDFLAGS="" - IN_LINE=inline - fi - ;; - *-darwin*) - if test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then - SOLINK="-dynamic -bundle -force-flat-namespace" - new_AM_CFLAGS="-DMACOSX" - new_AM_LDFLAGS="" - fi - IN_LINE=inline - ;; - x86_64-*-linux-gnu) - if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-KPIC -DPIC" - new_AM_LDFLAGS="-R${prefix}/lib" - FUNC_DEF=__func__ - elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then - SOLINK="-shared -Xlinker -x" - new_AM_CFLAGS="-fPIC" - new_AM_LDFLAGS="" - fi - IN_LINE=inline - ;; - i*6-*-linux-gnu) - if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-KPIC -DPIC" - new_AM_LDFLAGS="-R${prefix}/lib" - FUNC_DEF=__func__ - elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then - SOLINK="-shared -Xlinker -x" - new_AM_CFLAGS="-fpic" - new_AM_LDFLAGS="" - fi - IN_LINE=inline - ;; - *) - if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - SOLINK="-Bdynamic -dy -G" - new_AM_CFLAGS="-KPIC -DPIC" - new_AM_LDFLAGS="-R${prefix}/lib" - FUNC_DEF=__func__ - elif test "x${ax_cv_c_compiler_vendor}"="xgnu" ; then - SOLINK="-shared -Xlinker -x" - new_AM_CFLAGS="-fPIC" - new_AM_LDFLAGS="" - fi - IN_LINE=inline -esac - -# Enable 64 bit build -AC_ARG_ENABLE(64, -[AC_HELP_STRING([--enable-64],[build with 64 bit support])],[enable_64="$enable_64"],[enable_64="no"]) - -if test "x${ax_cv_c_compiler_vendor}" = "xsun" ; then - if test "${enable_64}" = "yes"; then - new_AM_CFLAGS="$new_AM_CFLAGS -m64" - fi -fi - -AC_SUBST(new_AM_CFLAGS) -AC_SUBST(new_AM_LDFLAGS) -AC_SUBST(SOLINK) -AC_DEFINE_UNQUOTED([__inline__],[$IN_LINE],[sunpro is bad at inline]) - -# Checks for header files. -AC_HEADER_DIRENT -AC_HEADER_STDC -#AC_CHECK_HEADERS([arpa/inet.h fcntl.h netdb.h netinet/in.h stdlib.h string.h sys/ioctl.h sys/socket.h sys/time.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_C_CONST -AC_C_INLINE -AC_TYPE_SIZE_T -AC_HEADER_TIME -AC_STRUCT_TM - -# Checks for library functions. -AC_PROG_GCC_TRADITIONAL -AC_TYPE_SIGNAL -AC_FUNC_STRFTIME -#AC_CHECK_FUNCS([gethostname gettimeofday localtime_r memmove memset socket strcasecmp strchr strdup strncasecmp strstr]) - -AC_C_BIGENDIAN(AC_DEFINE([__BYTE_ORDER],__BIG_ENDIAN,[Big Endian]),AC_DEFINE([__BYTE_ORDER],__LITTLE_ENDIAN,[Little Endian])) -AC_DEFINE([__LITTLE_ENDIAN],1234,[for the places where it is not defined]) -AC_DEFINE([__BIG_ENDIAN],4321,[for the places where it is not defined]) - -AC_CONFIG_FILES([Makefile]) - -AC_OUTPUT diff --git a/libs/libdingaling/configure.gnu b/libs/libdingaling/configure.gnu deleted file mode 100644 index 53c204581f..0000000000 --- a/libs/libdingaling/configure.gnu +++ /dev/null @@ -1,4 +0,0 @@ -#! /bin/sh -srcpath=$(dirname $0 2>/dev/null ) || srcpath="." -$srcpath/configure "$@" --disable-shared - diff --git a/libs/libdingaling/depcomp b/libs/libdingaling/depcomp deleted file mode 100644 index 04701da536..0000000000 --- a/libs/libdingaling/depcomp +++ /dev/null @@ -1,530 +0,0 @@ -#! /bin/sh -# depcomp - compile a program generating dependencies as side-effects - -scriptversion=2005-07-09.11 - -# Copyright (C) 1999, 2000, 2003, 2004, 2005 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., 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. - -# Originally written by Alexandre Oliva . - -case $1 in - '') - echo "$0: No command. Try \`$0 --help' for more information." 1>&2 - exit 1; - ;; - -h | --h*) - cat <<\EOF -Usage: depcomp [--help] [--version] PROGRAM [ARGS] - -Run PROGRAMS ARGS to compile a file, generating dependencies -as side-effects. - -Environment variables: - depmode Dependency tracking mode. - source Source file read by `PROGRAMS ARGS'. - object Object file output by `PROGRAMS ARGS'. - DEPDIR directory where to store dependencies. - depfile Dependency file to output. - tmpdepfile Temporary file to use when outputing dependencies. - libtool Whether libtool is used (yes/no). - -Report bugs to . -EOF - exit $? - ;; - -v | --v*) - echo "depcomp $scriptversion" - exit $? - ;; -esac - -if test -z "$depmode" || test -z "$source" || test -z "$object"; then - echo "depcomp: Variables source, object and depmode must be set" 1>&2 - exit 1 -fi - -# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. -depfile=${depfile-`echo "$object" | - sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} -tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} - -rm -f "$tmpdepfile" - -# Some modes work just like other modes, but use different flags. We -# parameterize here, but still list the modes in the big case below, -# to make depend.m4 easier to write. Note that we *cannot* use a case -# here, because this file can only contain one case statement. -if test "$depmode" = hp; then - # HP compiler uses -M and no extra arg. - gccflag=-M - depmode=gcc -fi - -if test "$depmode" = dashXmstdout; then - # This is just like dashmstdout with a different argument. - dashmflag=-xM - depmode=dashmstdout -fi - -case "$depmode" in -gcc3) -## gcc 3 implements dependency tracking that does exactly what -## we want. Yay! Note: for some reason libtool 1.4 doesn't like -## it if -MD -MP comes after the -MF stuff. Hmm. - "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - mv "$tmpdepfile" "$depfile" - ;; - -gcc) -## There are various ways to get dependency output from gcc. Here's -## why we pick this rather obscure method: -## - Don't want to use -MD because we'd like the dependencies to end -## up in a subdir. Having to rename by hand is ugly. -## (We might end up doing this anyway to support other compilers.) -## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like -## -MM, not -M (despite what the docs say). -## - Using -M directly means running the compiler twice (even worse -## than renaming). - if test -z "$gccflag"; then - gccflag=-MD, - fi - "$@" -Wp,"$gccflag$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - echo "$object : \\" > "$depfile" - alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz -## The second -e expression handles DOS-style file names with drive letters. - sed -e 's/^[^:]*: / /' \ - -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -## This next piece of magic avoids the `deleted header file' problem. -## The problem is that when a header file which appears in a .P file -## is deleted, the dependency causes make to die (because there is -## typically no way to rebuild the header). We avoid this by adding -## dummy dependencies for each header file. Too bad gcc doesn't do -## this for us directly. - tr ' ' ' -' < "$tmpdepfile" | -## Some versions of gcc put a space before the `:'. On the theory -## that the space means something, we add a space to the output as -## well. -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -hp) - # This case exists only to let depend.m4 do its work. It works by - # looking at the text of this script. This case will never be run, - # since it is checked for above. - exit 1 - ;; - -sgi) - if test "$libtool" = yes; then - "$@" "-Wp,-MDupdate,$tmpdepfile" - else - "$@" -MDupdate "$tmpdepfile" - fi - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - - if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files - echo "$object : \\" > "$depfile" - - # Clip off the initial element (the dependent). Don't try to be - # clever and replace this with sed code, as IRIX sed won't handle - # lines with more than a fixed number of characters (4096 in - # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; - # the IRIX cc adds comments like `#:fec' to the end of the - # dependency line. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ - tr ' -' ' ' >> $depfile - echo >> $depfile - - # The second pass generates a dummy entry for each header file. - tr ' ' ' -' < "$tmpdepfile" \ - | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ - >> $depfile - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -aix) - # The C for AIX Compiler uses -M and outputs the dependencies - # in a .u file. In older versions, this file always lives in the - # current directory. Also, the AIX compiler puts `$object:' at the - # start of each line; $object doesn't have directory information. - # Version 6 uses the directory in both cases. - stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` - tmpdepfile="$stripped.u" - if test "$libtool" = yes; then - "$@" -Wc,-M - else - "$@" -M - fi - stat=$? - - if test -f "$tmpdepfile"; then : - else - stripped=`echo "$stripped" | sed 's,^.*/,,'` - tmpdepfile="$stripped.u" - fi - - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - - if test -f "$tmpdepfile"; then - outname="$stripped.o" - # Each line is of the form `foo.o: dependent.h'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" - sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" - else - # The sourcefile does not contain any dependencies, so just - # store a dummy comment line, to avoid errors with the Makefile - # "include basename.Plo" scheme. - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -icc) - # Intel's C compiler understands `-MD -MF file'. However on - # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c - # ICC 7.0 will fill foo.d with something like - # foo.o: sub/foo.c - # foo.o: sub/foo.h - # which is wrong. We want: - # sub/foo.o: sub/foo.c - # sub/foo.o: sub/foo.h - # sub/foo.c: - # sub/foo.h: - # ICC 7.1 will output - # foo.o: sub/foo.c sub/foo.h - # and will wrap long lines using \ : - # foo.o: sub/foo.c ... \ - # sub/foo.h ... \ - # ... - - "$@" -MD -MF "$tmpdepfile" - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile" - exit $stat - fi - rm -f "$depfile" - # Each line is of the form `foo.o: dependent.h', - # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. - # Do two passes, one to just change these to - # `$object: dependent.h' and one to simply `dependent.h:'. - sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" - # Some versions of the HPUX 10.20 sed can't process this invocation - # correctly. Breaking it into two sed invocations is a workaround. - sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | - sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -tru64) - # The Tru64 compiler uses -MD to generate dependencies as a side - # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. - # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put - # dependencies in `foo.d' instead, so we check for that too. - # Subdirectories are respected. - dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` - test "x$dir" = "x$object" && dir= - base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` - - if test "$libtool" = yes; then - # With Tru64 cc, shared objects can also be used to make a - # static library. This mecanism is used in libtool 1.4 series to - # handle both shared and static libraries in a single compilation. - # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. - # - # With libtool 1.5 this exception was removed, and libtool now - # generates 2 separate objects for the 2 libraries. These two - # compilations output dependencies in in $dir.libs/$base.o.d and - # in $dir$base.o.d. We have to check for both files, because - # one of the two compilations can be disabled. We should prefer - # $dir$base.o.d over $dir.libs/$base.o.d because the latter is - # automatically cleaned when .libs/ is deleted, while ignoring - # the former would cause a distcleancheck panic. - tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 - tmpdepfile2=$dir$base.o.d # libtool 1.5 - tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 - tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 - "$@" -Wc,-MD - else - tmpdepfile1=$dir$base.o.d - tmpdepfile2=$dir$base.d - tmpdepfile3=$dir$base.d - tmpdepfile4=$dir$base.d - "$@" -MD - fi - - stat=$? - if test $stat -eq 0; then : - else - rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - exit $stat - fi - - for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" - do - test -f "$tmpdepfile" && break - done - if test -f "$tmpdepfile"; then - sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" - # That's a tab and a space in the []. - sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" - else - echo "#dummy" > "$depfile" - fi - rm -f "$tmpdepfile" - ;; - -#nosideeffect) - # This comment above is used by automake to tell side-effect - # dependency tracking mechanisms from slower ones. - -dashmstdout) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - test -z "$dashmflag" && dashmflag=-M - # Require at least two characters before searching for `:' - # in the target name. This is to cope with DOS-style filenames: - # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. - "$@" $dashmflag | - sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - tr ' ' ' -' < "$tmpdepfile" | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -dashXmstdout) - # This case only exists to satisfy depend.m4. It is never actually - # run, as this mode is specially recognized in the preamble. - exit 1 - ;; - -makedepend) - "$@" || exit $? - # Remove any Libtool call - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - # X makedepend - shift - cleared=no - for arg in "$@"; do - case $cleared in - no) - set ""; shift - cleared=yes ;; - esac - case "$arg" in - -D*|-I*) - set fnord "$@" "$arg"; shift ;; - # Strip any option that makedepend may not understand. Remove - # the object too, otherwise makedepend will parse it as a source file. - -*|$object) - ;; - *) - set fnord "$@" "$arg"; shift ;; - esac - done - obj_suffix="`echo $object | sed 's/^.*\././'`" - touch "$tmpdepfile" - ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" - rm -f "$depfile" - cat < "$tmpdepfile" > "$depfile" - sed '1,2d' "$tmpdepfile" | tr ' ' ' -' | \ -## Some versions of the HPUX 10.20 sed can't process this invocation -## correctly. Breaking it into two sed invocations is a workaround. - sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" "$tmpdepfile".bak - ;; - -cpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout. - "$@" || exit $? - - # Remove the call to Libtool. - if test "$libtool" = yes; then - while test $1 != '--mode=compile'; do - shift - done - shift - fi - - # Remove `-o $object'. - IFS=" " - for arg - do - case $arg in - -o) - shift - ;; - $object) - shift - ;; - *) - set fnord "$@" "$arg" - shift # fnord - shift # $arg - ;; - esac - done - - "$@" -E | - sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ - -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | - sed '$ s: \\$::' > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - cat < "$tmpdepfile" >> "$depfile" - sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -msvisualcpp) - # Important note: in order to support this mode, a compiler *must* - # always write the preprocessed file to stdout, regardless of -o, - # because we must use -o when running libtool. - "$@" || exit $? - IFS=" " - for arg - do - case "$arg" in - "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") - set fnord "$@" - shift - shift - ;; - *) - set fnord "$@" "$arg" - shift - shift - ;; - esac - done - "$@" -E | - sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" - rm -f "$depfile" - echo "$object : \\" > "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" - echo " " >> "$depfile" - . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" - rm -f "$tmpdepfile" - ;; - -none) - exec "$@" - ;; - -*) - echo "Unknown depmode $depmode" 1>&2 - exit 1 - ;; -esac - -exit 0 - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/libs/libdingaling/doc b/libs/libdingaling/doc deleted file mode 100644 index ab09daa627..0000000000 --- a/libs/libdingaling/doc +++ /dev/null @@ -1 +0,0 @@ -http://iksemel.jabberstudio.org/iksemel.html diff --git a/libs/libdingaling/docs/Doxygen.conf b/libs/libdingaling/docs/Doxygen.conf deleted file mode 100644 index 8b5886ff4f..0000000000 --- a/libs/libdingaling/docs/Doxygen.conf +++ /dev/null @@ -1,264 +0,0 @@ -# Doxyfile 1.4.6 - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- -PROJECT_NAME = LibDingaLing -PROJECT_NUMBER = -OUTPUT_DIRECTORY = . -CREATE_SUBDIRS = NO -OUTPUT_LANGUAGE = English -USE_WINDOWS_ENCODING = YES -BRIEF_MEMBER_DESC = YES -REPEAT_BRIEF = YES -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the -ALWAYS_DETAILED_SEC = NO -INLINE_INHERITED_MEMB = NO -FULL_PATH_NAMES = NO -STRIP_FROM_PATH = -STRIP_FROM_INC_PATH = -SHORT_NAMES = NO -JAVADOC_AUTOBRIEF = NO -MULTILINE_CPP_IS_BRIEF = NO -DETAILS_AT_TOP = NO -INHERIT_DOCS = YES -SEPARATE_MEMBER_PAGES = NO -TAB_SIZE = 8 -ALIASES = -OPTIMIZE_OUTPUT_FOR_C = YES -OPTIMIZE_OUTPUT_JAVA = NO -DISTRIBUTE_GROUP_DOC = NO -SUBGROUPING = YES -IGNORE_PREFIX = ldl_ - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- -EXTRACT_ALL = NO -EXTRACT_PRIVATE = NO -EXTRACT_STATIC = NO -EXTRACT_LOCAL_CLASSES = YES -EXTRACT_LOCAL_METHODS = NO -HIDE_UNDOC_MEMBERS = YES -HIDE_UNDOC_CLASSES = YES -HIDE_FRIEND_COMPOUNDS = NO -HIDE_IN_BODY_DOCS = NO -INTERNAL_DOCS = NO -CASE_SENSE_NAMES = NO -HIDE_SCOPE_NAMES = NO -SHOW_INCLUDE_FILES = YES -INLINE_INFO = YES -SORT_MEMBER_DOCS = YES -SORT_BRIEF_DOCS = NO -SORT_BY_SCOPE_NAME = NO -GENERATE_TODOLIST = YES -GENERATE_TESTLIST = YES -GENERATE_BUGLIST = YES -GENERATE_DEPRECATEDLIST= YES -ENABLED_SECTIONS = -MAX_INITIALIZER_LINES = 30 -SHOW_USED_FILES = YES -SHOW_DIRECTORIES = NO -FILE_VERSION_FILTER = -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- -QUIET = NO -WARNINGS = YES -WARN_IF_UNDOCUMENTED = YES -WARN_IF_DOC_ERROR = YES -WARN_NO_PARAMDOC = NO -WARN_FORMAT = "$file:$line: $text" -WARN_LOGFILE = -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- -INPUT = ../src -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.mm \ - *.dox \ - *.py -RECURSIVE = NO -EXCLUDE = -EXCLUDE_SYMLINKS = NO -EXCLUDE_PATTERNS = -EXAMPLE_PATH = -EXAMPLE_PATTERNS = -EXAMPLE_RECURSIVE = NO -IMAGE_PATH = -INPUT_FILTER = -FILTER_PATTERNS = -FILTER_SOURCE_FILES = NO -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- -SOURCE_BROWSER = NO -INLINE_SOURCES = YES -STRIP_CODE_COMMENTS = YES -REFERENCED_BY_RELATION = YES -REFERENCES_RELATION = YES -USE_HTAGS = YES -VERBATIM_HEADERS = NO -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- -ALPHABETICAL_INDEX = YES -COLS_IN_ALPHA_INDEX = 1 -IGNORE_PREFIX = ldl_ -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- -GENERATE_HTML = YES -HTML_OUTPUT = html -HTML_FILE_EXTENSION = .html -HTML_HEADER = -HTML_FOOTER = -HTML_STYLESHEET = -HTML_ALIGN_MEMBERS = YES -GENERATE_HTMLHELP = NO -CHM_FILE = libDingaLing.chm -HHC_LOCATION = -GENERATE_CHI = YES -BINARY_TOC = NO -TOC_EXPAND = NO -DISABLE_INDEX = NO -ENUM_VALUES_PER_LINE = 4 -GENERATE_TREEVIEW = YES -TREEVIEW_WIDTH = 250 - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- -GENERATE_LATEX = NO -LATEX_OUTPUT = latex -LATEX_CMD_NAME = latex -MAKEINDEX_CMD_NAME = makeindex -COMPACT_LATEX = NO -PAPER_TYPE = a4wide -EXTRA_PACKAGES = -LATEX_HEADER = -PDF_HYPERLINKS = NO -USE_PDFLATEX = NO -LATEX_BATCHMODE = NO -LATEX_HIDE_INDICES = NO -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- -GENERATE_RTF = NO -RTF_OUTPUT = rtf -COMPACT_RTF = NO -RTF_HYPERLINKS = NO -RTF_STYLESHEET_FILE = -RTF_EXTENSIONS_FILE = -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- -GENERATE_MAN = YES -MAN_OUTPUT = man -MAN_EXTENSION = .3 -MAN_LINKS = NO -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- -GENERATE_XML = YES -XML_OUTPUT = xml -XML_SCHEMA = -XML_DTD = -XML_PROGRAMLISTING = YES -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- -GENERATE_AUTOGEN_DEF = NO -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- -GENERATE_PERLMOD = YES -PERLMOD_LATEX = NO -PERLMOD_PRETTY = YES -PERLMOD_MAKEVAR_PREFIX = -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- -ENABLE_PREPROCESSING = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = NO -SEARCH_INCLUDES = NO -INCLUDE_PATH = -INCLUDE_FILE_PATTERNS = *.h -PREDEFINED = SWITCH_DECLARE(x)=x \ - APR_DECLARE(x)=x \ - DoxyDefine(x)=x - -EXPAND_AS_DEFINED = NO -SKIP_FUNCTION_MACROS = NO -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- -TAGFILES = -GENERATE_TAGFILE = -ALLEXTERNALS = NO -EXTERNAL_GROUPS = YES -PERL_PATH = /usr/bin/perl -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- -CLASS_DIAGRAMS = YES -HIDE_UNDOC_RELATIONS = YES -HAVE_DOT = YES -CLASS_GRAPH = YES -COLLABORATION_GRAPH = YES -GROUP_GRAPHS = YES -UML_LOOK = YES -TEMPLATE_RELATIONS = YES -INCLUDE_GRAPH = YES -INCLUDED_BY_GRAPH = YES -CALL_GRAPH = YES -GRAPHICAL_HIERARCHY = YES -DIRECTORY_GRAPH = YES -DOT_IMAGE_FORMAT = jpg -DOT_PATH = -DOTFILE_DIRS = -MAX_DOT_GRAPH_WIDTH = 1024 -MAX_DOT_GRAPH_HEIGHT = 1024 -MAX_DOT_GRAPH_DEPTH = 1000 -DOT_TRANSPARENT = NO -DOT_MULTI_TARGETS = NO -GENERATE_LEGEND = YES -DOT_CLEANUP = YES -#--------------------------------------------------------------------------- -# Configuration::additions related to the search engine -#--------------------------------------------------------------------------- -SEARCHENGINE = NO diff --git a/libs/libdingaling/docs/docs.vcproj b/libs/libdingaling/docs/docs.vcproj deleted file mode 100644 index be9173ec07..0000000000 --- a/libs/libdingaling/docs/docs.vcproj +++ /dev/null @@ -1,178 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libdingaling/install-sh b/libs/libdingaling/install-sh deleted file mode 100644 index 4d4a9519ea..0000000000 --- a/libs/libdingaling/install-sh +++ /dev/null @@ -1,323 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2005-05-14.22 - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. It can only install one file at a time, a restriction -# shared with many OS's install programs. - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -chmodcmd="$chmodprog 0755" -chowncmd= -chgrpcmd= -stripcmd= -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src= -dst= -dir_arg= -dstarg= -no_target_directory= - -usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: --c (ignored) --d create directories instead of installing files. --g GROUP $chgrpprog installed files to GROUP. --m MODE $chmodprog installed files to MODE. --o USER $chownprog installed files to USER. --s $stripprog installed files. --t DIRECTORY install into DIRECTORY. --T report an error if DSTFILE is a directory. ---help display this help and exit. ---version display version info and exit. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG -" - -while test -n "$1"; do - case $1 in - -c) shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - --help) echo "$usage"; exit $?;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -s) stripcmd=$stripprog - shift - continue;; - - -t) dstarg=$2 - shift - shift - continue;; - - -T) no_target_directory=true - shift - continue;; - - --version) echo "$0 $scriptversion"; exit $?;; - - *) # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - test -n "$dir_arg$dstarg" && break - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dstarg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dstarg" - shift # fnord - fi - shift # arg - dstarg=$arg - done - break;; - esac -done - -if test -z "$1"; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src ;; - esac - - if test -n "$dir_arg"; then - dst=$src - src= - - if test -d "$dst"; then - mkdircmd=: - chmodcmd= - else - mkdircmd=$mkdirprog - fi - else - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dstarg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dstarg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst ;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dstarg: Is a directory" >&2 - exit 1 - fi - dst=$dst/`basename "$src"` - fi - fi - - # This sed command emulates the dirname command. - dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'` - - # Make sure that the destination directory exists. - - # Skip lots of stat calls in the usual case. - if test ! -d "$dstdir"; then - defaultIFS=' - ' - IFS="${IFS-$defaultIFS}" - - oIFS=$IFS - # Some sh's can't handle IFS=/ for some reason. - IFS='%' - set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'` - shift - IFS=$oIFS - - pathcomp= - - while test $# -ne 0 ; do - pathcomp=$pathcomp$1 - shift - if test ! -d "$pathcomp"; then - $mkdirprog "$pathcomp" - # mkdir can fail with a `File exist' error in case several - # install-sh are creating the directory concurrently. This - # is OK. - test -d "$pathcomp" || exit - fi - pathcomp=$pathcomp/ - done - fi - - if test -n "$dir_arg"; then - $doit $mkdircmd "$dst" \ - && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; } - - else - dstfile=`basename "$dst"` - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - trap '(exit $?); exit' 1 2 13 15 - - # Copy the file name to the temp name. - $doit $cpprog "$src" "$dsttmp" && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ - && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ - && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ - && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } && - - # Now rename the file to the real destination. - { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \ - || { - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - if test -f "$dstdir/$dstfile"; then - $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \ - || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \ - || { - echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2 - (exit 1); exit 1 - } - else - : - fi - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dstdir/$dstfile" - } - } - fi || { (exit 1); exit 1; } -done - -# The final little trick to "correctly" pass the exit status to the exit trap. -{ - (exit 0); exit 0 -} - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/libs/libdingaling/libdingaling.2008.vcproj b/libs/libdingaling/libdingaling.2008.vcproj deleted file mode 100644 index bf22a7e5e6..0000000000 --- a/libs/libdingaling/libdingaling.2008.vcproj +++ /dev/null @@ -1,621 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libdingaling/libdingaling.2010.vcxproj.filters b/libs/libdingaling/libdingaling.2010.vcxproj.filters deleted file mode 100644 index 18ef8e8b1a..0000000000 --- a/libs/libdingaling/libdingaling.2010.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav - - - - - Source Files - - - Source Files - - - - - Header Files - - - Header Files - - - - - Source Files - - - \ No newline at end of file diff --git a/libs/libdingaling/libdingaling.2017.vcxproj b/libs/libdingaling/libdingaling.2017.vcxproj deleted file mode 100644 index 899855def1..0000000000 --- a/libs/libdingaling/libdingaling.2017.vcxproj +++ /dev/null @@ -1,303 +0,0 @@ - - - - - Debug DLL - Win32 - - - Debug DLL - x64 - - - Debug - Win32 - - - Debug - x64 - - - Release DLL - Win32 - - - Release DLL - x64 - - - Release - Win32 - - - Release - x64 - - - - libdingaling - {1906D736-08BD-4EE1-924F-B536249B9A54} - libdingaling - Win32Proj - - - - DynamicLibrary - Unicode - true - $(DefaultPlatformToolset) - - - DynamicLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - DynamicLibrary - Unicode - true - $(DefaultPlatformToolset) - - - DynamicLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)Debug\ - $(Configuration)\ - $(SolutionDir)Release\ - $(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - - Disabled - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Level4 - 4718;4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings) - - - - - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - Level4 - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - - - Disabled - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - EditAndContinue - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) - ..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug;%(AdditionalLibraryDirectories) - .\src\dingaling.def - true - false - false - false - - - - - - - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level4 - ProgramDatabase - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) - ..\apr\Release;..\apr-util\Release;..\iksemel\Release;%(AdditionalLibraryDirectories) - .\src\dingaling.def - false - - - - - - - X64 - - - Disabled - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - Level4 - 4718;4456;4457;4701;4702;4703;4100;4706;%(DisableSpecificWarnings) - - - - - X64 - - - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;%(PreprocessorDefinitions) - MultiThreadedDLL - Level4 - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - - - X64 - - - Disabled - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level4 - ProgramDatabase - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) - ..\apr\Debug;..\apr-util\Debug;..\iksemel\Debug;%(AdditionalLibraryDirectories) - .\src\dingaling.def - true - false - false - false - - - MachineX64 - - - - - X64 - - - .;.\src;..\iksemel\include;..\include;..\apr\include;..\iksemel-1.2\include;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE;APR_DECLARE_STATIC;APU_DECLARE_STATIC;%(PreprocessorDefinitions) - MultiThreadedDLL - - - Level4 - ProgramDatabase - 4718;4456;4457;4701;4702;4703;4100;%(DisableSpecificWarnings) - - - libapr-1.lib;libaprutil-1.lib;iksemel.lib;Ws2_32.lib;%(AdditionalDependencies) - ..\apr\Release;..\apr-util\Release;..\iksemel\Release;%(AdditionalLibraryDirectories) - .\src\dingaling.def - false - - - MachineX64 - - - - - - - - - - - - - - - - {f057da7f-79e5-4b00-845c-ef446ef055e3} - false - - - {e727e8f6-935d-46fe-8b0e-37834748a0e3} - false - - - - - - \ No newline at end of file diff --git a/libs/libdingaling/libdingaling.vcproj b/libs/libdingaling/libdingaling.vcproj deleted file mode 100644 index 3cb660b406..0000000000 --- a/libs/libdingaling/libdingaling.vcproj +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libdingaling/ltmain.sh b/libs/libdingaling/ltmain.sh deleted file mode 100755 index 9e71d27d86..0000000000 --- a/libs/libdingaling/ltmain.sh +++ /dev/null @@ -1,6530 +0,0 @@ -# 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, 2003, 2004, 2005 -# 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., 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 -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. - shift -elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - exec $SHELL "$progpath" --no-reexec ${1+"$@"} -fi - -if test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <&2 - $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 - exit $EXIT_FAILURE -fi - -# Global variables. -mode=$default_mode -nonopt= -prev= -prevopt= -run= -show="$echo" -show_help= -execute_dlfiles= -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 -do - arg="$1" - shift - - case $arg in - -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; - *) optarg= ;; - esac - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - execute_dlfiles) - 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" - ;; - esac - - prev= - prevopt= - continue - fi - - # Have we seen a non-optional argument yet? - case $arg in - --help) - show_help=yes - ;; - - --version) - $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" - $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' $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" - set -x - preserve_args="$preserve_args $arg" - ;; - - --dry-run | -n) - run=: - ;; - - --features) - $echo "host: $host" - if test "$build_libtool_libs" = yes; then - $echo "enable shared libraries" - else - $echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - $echo "enable static libraries" - else - $echo "disable static libraries" - fi - exit $? - ;; - - --finish) mode="finish" ;; - - --mode) prevopt="--mode" prev=mode ;; - --mode=*) mode="$optarg" ;; - - --preserve-dup-deps) duplicate_deps="yes" ;; - - --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) - prevopt="-dlopen" - prev=execute_dlfiles - ;; - - -*) - $echo "$modename: unrecognized option \`$arg'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - - *) - nonopt="$arg" - break - ;; - esac -done - -if test -n "$prevopt"; then - $echo "$modename: option \`$prevopt' requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE -fi - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -if test -z "$show_help"; then - - # 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 | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) - mode=link - for arg - do - case $arg in - -c) - mode=compile - break - ;; - esac - done - ;; - *db | *dbx | *strace | *truss) - mode=execute - ;; - *install*|cp|mv) - mode=install - ;; - *rm) - mode=uninstall - ;; - *) - # If we have no mode, but dlfiles were specified, then do execute mode. - test -n "$execute_dlfiles" && mode=execute - - # Just use the default operation mode. - if test -z "$mode"; then - if test -n "$nonopt"; then - $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 - else - $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 - fi - fi - ;; - esac - fi - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$execute_dlfiles" && test "$mode" != execute; then - $echo "$modename: unrecognized option \`-dlopen'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$modename --help --mode=$mode' for more information." - - # These modes are in order of execution frequency so that they run quickly. - case $mode in - # libtool compile mode - compile) - modename="$modename: compile" - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - if test -n "$libobj" ; then - $echo "$modename: you cannot specify \`-o' more than once" 1>&2 - exit $EXIT_FAILURE - fi - arg_mode=target - continue - ;; - - -static | -prefer-pic | -prefer-non-pic) - later="$later $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - 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/^ //"` - - # Add the arguments to base_compile. - base_compile="$base_compile $lastarg" - continue - ;; - - * ) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - 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, 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 - - base_compile="$base_compile $lastarg" - done # for arg - - case $arg_mode in - arg) - $echo "$modename: you must specify an argument for -Xcompile" - exit $EXIT_FAILURE - ;; - target) - $echo "$modename: you must specify a target with \`-o'" 1>&2 - exit $EXIT_FAILURE - ;; - *) - # 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='[cCFSifmso]' - case $libobj in - *.ada) xform=ada ;; - *.adb) xform=adb ;; - *.ads) xform=ads ;; - *.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/"` - - case $libobj in - *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; - *) - $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 - 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 $EXIT_FAILURE - fi - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - $run $rm $removelist - 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 - cygwin* | mingw* | pw32* | os2*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - removelist="$removelist $output_obj $lockfile" - trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $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 "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - $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 "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - $show "$mv $output_obj $lobj" - if $run $mv $output_obj $lobj; then : - else - error=$? - $run $rm $removelist - exit $error - fi - 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 "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $run $rm $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - 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 - 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 <&2 - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - else - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - fi - build_libtool_libs=no - build_old_libs=yes - prefer_static_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test - ;; - *) qarg=$arg ;; - esac - libtool_args="$libtool_args $qarg" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - compile_command="$compile_command @OUTPUT@" - finalize_command="$finalize_command @OUTPUT@" - ;; - esac - - case $prev in - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - compile_command="$compile_command @SYMFILE@" - finalize_command="$finalize_command @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - if test ! -f "$arg"; then - $echo "$modename: symbol file \`$arg' does not exist" - exit $EXIT_FAILURE - fi - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat $save_arg` - do -# moreargs="$moreargs $fil" - arg=$fil - # 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 - */* | *\\*) . $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 $EXIT_FAILURE - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) rpath="$rpath $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) xrpath="$xrpath $arg" ;; - esac - fi - prev= - continue - ;; - xcompiler) - compiler_flags="$compiler_flags $qarg" - prev= - compile_command="$compile_command $qarg" - finalize_command="$finalize_command $qarg" - continue - ;; - xlinker) - linker_flags="$linker_flags $qarg" - compiler_flags="$compiler_flags $wl$qarg" - prev= - compile_command="$compile_command $wl$qarg" - 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" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - compile_command="$compile_command $link_static_flag" - finalize_command="$finalize_command $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 - continue - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: more than one -exported-symbols argument is not allowed" - exit $EXIT_FAILURE - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - 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 - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - ;; - esac - continue - ;; - - -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 - exit $EXIT_FAILURE - fi - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "*) ;; - *) - deplibs="$deplibs -L$dir" - lib_search_path="$lib_search_path $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$dir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-pw32* | *-*-beos*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-mingw* | *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - 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 - ;; - - # 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 - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - # The PATH hackery in wrapper scripts is required on Windows - # in order for the loader to find any dlls it needs. - $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 - $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - $echo "$modename: only absolute run-paths are allowed" 1>&2 - exit $EXIT_FAILURE - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - continue - ;; - - -static) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -Wc,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Wl,*) - args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - case $flag in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - flag="\"$flag\"" - ;; - esac - arg="$arg $wl$flag" - compiler_flags="$compiler_flags $wl$flag" - linker_flags="$linker_flags $flag" - done - IFS="$save_ifs" - arg=`$echo "X$arg" | $Xsed -e "s/^ //"` - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # Some other compiler flag. - -* | +*) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - - *.$objext) - # A standard object. - objs="$objs $arg" - ;; - - *.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 - */* | *\\*) . $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 - ;; - - *.$libext) - # An archive. - deplibs="$deplibs $arg" - old_deplibs="$old_deplibs $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - dlfiles="$dlfiles $arg" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - dlprefiles="$dlprefiles $arg" - prev= - else - deplibs="$deplibs $arg" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - done # argument parsing loop - - if test -n "$prev"; then - $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - compile_command="$compile_command $arg" - finalize_command="$finalize_command $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` - if test "X$output_objdir" = "X$output"; then - output_objdir="$objdir" - else - output_objdir="$output_objdir/$objdir" - fi - # Create the object directory. - if test ! -d "$output_objdir"; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test "$status" -ne 0 && test ! -d "$output_objdir"; then - exit $status - fi - fi - - # Determine the type of output - case $output in - "") - $echo "$modename: you must specify an output file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) 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) - for deplib in $deplibs; do - if test "X$duplicate_deps" = "Xyes" ; then - case "$libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - libs="$libs $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if 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" ;; - esac - pre_post_deps="$pre_post_deps $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - case $linkmode in - lib) - passes="conv link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - for pass in $passes; do - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; - esac - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - compiler_flags="$compiler_flags $deplib" - fi - 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 - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if (${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*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` - ;; - *) - $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) xrpath="$xrpath $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) lib="$deplib" ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - 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!" - deplibs="$deplib $deplibs" - fi - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - newdlprefiles="$newdlprefiles $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - newdlfiles="$newdlfiles $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - if test "$found" = yes || test -f "$lib"; then : - else - $echo "$modename: cannot find the library \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - - # Check to see that this really is a libtool archive. - 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 $EXIT_FAILURE - fi - - ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` - test "X$ladir" = "X$lib" && ladir="." - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && dlfiles="$dlfiles $dlopen" - test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $ladir/$objdir/$old_library" - old_convenience="$old_convenience $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - $echo "$modename: \`$lib' is not a convenience library" 1>&2 - 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 - linklib="$l" - done - if test -z "$linklib"; then - $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 - 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 $EXIT_FAILURE - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - dlprefiles="$dlprefiles $lib $dependency_libs" - else - newdlfiles="$newdlfiles $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 - $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 - abs_ladir="$ladir" - fi - ;; - esac - laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - $echo "$modename: warning: library \`$lib' was moved." 1>&2 - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$libdir" - absdir="$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - 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//'` - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir"; then - $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 - exit $EXIT_FAILURE - fi - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - newdlprefiles="$newdlprefiles $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - newdlprefiles="$newdlprefiles $dir/$dlname" - else - newdlprefiles="$newdlprefiles $dir/$linklib" - fi - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - newlib_search_path="$newlib_search_path $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -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 - - # 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 # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - 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 - set dummy $library_names - realname="$2" - shift; shift - libname=`eval \\$echo \"$libname_spec\"` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw*) - major=`expr $current - $age` - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # 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" - - # 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='~' - cmds=$extract_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - $show "generating import library for \`$soname'" - save_ifs="$IFS"; IFS='~' - cmds=$old_archive_from_expsyms_cmds - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $run eval "$cmd" || exit $? - done - IFS="$save_ifs" - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5* ) 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" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit $EXIT_FAILURE - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && \ - test "$hardcode_minus_L" != yes && \ - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) 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. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - add_dir="$add_dir -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - $echo - $echo "*** Warning: This system can not link to static lib archive $lib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - $echo "*** But as you try to build a module library, libtool will still create " - $echo "*** a static module, that should work as long as the dlopening application" - $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - *) temp_deplibs="$temp_deplibs $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - newlib_search_path="$newlib_search_path $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - if test "X$duplicate_deps" = "Xyes" ; then - case "$tmp_libs " in - *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; - esac - fi - tmp_libs="$tmp_libs $deplib" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - case $deplib in - -L*) path="$deplib" ;; - *.la) - dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$deplib" && dir="." - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 - absdir="$dir" - fi - ;; - esac - if grep "^installed=no" $deplib > /dev/null; then - path="$absdir/$objdir" - else - 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 $EXIT_FAILURE - fi - if test "$absdir" != "$libdir"; then - $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 - fi - 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="$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 - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - ;; - *) tmp_libs="$tmp_libs $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - tmp_libs="$tmp_libs $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - dlprefiles="$newdlprefiles" - fi - - 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 - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 - fi - - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 - fi - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - objs="$objs$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` - eval 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 $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$//'` - fi - ;; - esac - - 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 $EXIT_FAILURE - else - $echo - $echo "*** Warning: Linking the shared library $output against the non-libtool" - $echo "*** objects $objs is not portable!" - libobjs="$libobjs $objs" - fi - fi - - if test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 - fi - - set dummy $rpath - if test "$#" -gt 2; then - $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 - fi - install_libdir="$2" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # 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/-version-number' is ignored for convenience libraries" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 - fi - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - IFS="$save_ifs" - - if test -n "$8"; then - $echo "$modename: too many parameters to \`-version-info'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # 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" - ;; - esac - ;; - no) - current="$2" - revision="$3" - age="$4" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 - $echo "$modename: \`$vinfo' is not valid version information" 1>&2 - 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 $EXIT_FAILURE - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - minor_current=`expr $current + 1` - verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current"; - ;; - - irix | nonstopux) - major=`expr $current - $age + 1` - - 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="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - major=.`expr $current - $age` - versuffix="$major.$age.$revision" - ;; - - osf) - major=.`expr $current - $age` - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - iface=`expr $current - $loop` - loop=`expr $loop - 1` - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - verstring="$verstring:${current}.0" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - major=`expr $current - $age` - versuffix="-$major" - ;; - - *) - $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 - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - fi - - if test "$mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$echo "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext) - ;; - $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. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - oldlibs="$oldlibs $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` - fi - - # 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'` - done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) dlfiles="$dlfiles $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) dlprefiles="$dlprefiles $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - deplibs="$deplibs -framework System" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - 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" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $rm conftest.c - cat > conftest.c </dev/null` - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ - | grep " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ - | ${SED} 10q \ - | $EGREP "$file_magic_regex" > /dev/null; then - newdeplibs="$newdeplibs $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for file magic test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a file magic. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method - match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` - for a_deplib in $deplibs; do - name=`expr $a_deplib : '-l\(.*\)'` - # If $name is empty we are operating on a -L argument. - if test -n "$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 - 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 - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - $echo - $echo "*** Warning: linker path does not have real file for library $a_deplib." - $echo "*** I have the capability to make that library automatically link in when" - $echo "*** you link to this library. But I can only do this if you have a" - $echo "*** shared version of the library, which you do not appear to have" - $echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $echo "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $echo "*** with $libname and none of the candidates passed a file format test" - $echo "*** using a regex pattern. Last file checked: $potlib" - fi - fi - else - # Add a -L argument. - newdeplibs="$newdeplibs $a_deplib" - fi - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - 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." - else - $echo "*** Warning: inter-library dependencies are not known to be supported." - fi - $echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - fi - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - $echo - $echo "*** Warning: libtool could not satisfy all declared inter-library" - $echo "*** dependencies of module $libname. Therefore, libtool will create" - $echo "*** a static module, that should work as long as the dlopening" - $echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - $echo - $echo "*** However, this would only work if libtool was able to extract symbol" - $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - $echo "*** not find such a program. So, this module is probably useless." - $echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - $echo "*** The inter-library dependencies that have been dropped here will be" - $echo "*** automatically added whenever a program is linked with this library" - $echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - $echo - $echo "*** Since this library must not contain undefined symbols," - $echo "*** because either the platform does not support them or" - $echo "*** it was explicitly requested with -no-undefined," - $echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - dep_rpath="$dep_rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - realname="$2" - shift; shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - for link - do - linknames="$linknames $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - $show "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $run $rm $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - 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 "$mv \"${export_symbols}T\" \"$export_symbols\"" - $run eval '$mv "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' - fi - - 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" - generated="$generated $gentop" - - 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" - fi - - # Make a backup of the uninstalled library when relinking - if test "$mode" = relink; then - $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - len=`expr "X$test_cmds" : ".*" 2>/dev/null` && - test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # 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" || { - 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 $? - - 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. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" - $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$deplibs"; then - $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 - fi - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 - fi - - if test -n "$rpath"; then - $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 - fi - - if test -n "$xrpath"; then - $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 - fi - - if test -n "$vinfo"; then - $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 - fi - - case $output in - *.lo) - if test -n "$objs$old_deplibs"; then - $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 - exit $EXIT_FAILURE - fi - libobj="$output" - obj=`$echo "X$output" | $Xsed -e "$lo2o"` - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $run $rm $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" - else - gentop="$output_objdir/${obj}x" - generated="$generated $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # Create the old-style object. - 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" - 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" - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $run eval "echo timestamp > $libobj" || exit $? - exit $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" - 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" - fi - - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *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 - fi - - if test -n "$release"; then - $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 - fi - - if test "$preload" = yes; then - if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && - test "$dlopen_self_static" = unknown; then - $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." - fi - fi - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` - ;; - 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" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) perm_rpath="$perm_rpath $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) - case :$dllsearchpath: in - *":$libdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$libdir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - fi - - dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - dlsyms="${outputname}S.c" - else - $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 - fi - fi - - if test -n "$dlsyms"; then - case $dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" - - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - - # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" - - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -/* Prevent the only kind of declaration conflicts we can make. */ -#define lt_preloaded_symbols some_other_symbol - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - $show "generating symbol list for \`$output'" - - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - for arg in $progfiles; do - $show "extracting global C symbols from \`$arg'" - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - if test -n "$export_symbols_regex"; then - $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - $run eval '$mv "$nlist"T "$nlist"' - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $run $rm $export_symbols - $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - else - $run eval "${SED} -e 's/\([ ][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$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"' - $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" - done - - if test -z "$run"; then - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $mv "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if grep -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - grep -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' - else - $echo '/* NONE */' >> "$output_objdir/$dlsyms" - fi - - $echo >> "$output_objdir/$dlsyms" "\ - -#undef lt_preloaded_symbols - -#if defined (__STDC__) && __STDC__ -# define lt_ptr void * -#else -# define lt_ptr char * -# define const -#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; -} -lt_preloaded_symbols[] = -{\ -" - - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" - - $echo >> "$output_objdir/$dlsyms" "\ - {0, (lt_ptr) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - fi - - pic_flag_for_symtable= - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; - esac;; - *-*-hpux*) - case "$compile_command " in - *" -static "*) ;; - *) pic_flag_for_symtable=" $pic_flag";; - esac - esac - - # Now compile the dynamic symbol file. - $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" - $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" - - # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` - ;; - *) - $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 - exit $EXIT_FAILURE - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"` - fi - - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - # Replace the output file specification. - compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - $show "$link_command" - $run eval "$link_command" - status=$? - - # Delete the generated files. - if test -n "$dlsyms"; then - $show "$rm $output_objdir/${outputname}S.${objext}" - $run $rm "$output_objdir/${outputname}S.${objext}" - fi - - exit $status - fi - - if test -n "$shlibpath_var"; then - # We should set the shlibpath_var - rpath= - for dir in $temp_rpath; do - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) - # Absolute path. - rpath="$rpath$dir:" - ;; - *) - # Relative path: add a thisdir entry. - rpath="$rpath\$thisdir/$dir:" - ;; - esac - done - temp_rpath="$rpath" - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - rpath="$rpath$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - rpath="$rpath$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $run $rm $output - # Link the executable and exit - $show "$link_command" - $run eval "$link_command" || exit $? - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 - $echo "$modename: \`$output' will be relinked during installation" 1>&2 - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname - - $show "$link_command" - $run eval "$link_command" || exit $? - - # Now create the wrapper script. - $show "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` - fi - - # Quote $echo for shipping. - 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 - qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` - fi - - # Only actually do things if our run command is non-null. - if test -z "$run"; then - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *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 $EXIT_FAILURE" 1 2 15 - - $echo > $output "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed='${SED} -e 1s/^X//' -sed_quote_subst='$sed_quote_subst' - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variable: - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$echo are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - echo=\"$qecho\" - file=\"\$0\" - # Make sure echo works. - if test \"X\$1\" = X--no-reexec; then - # Discard the --no-reexec flag, and continue. - shift - elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then - # Yippee, \$echo works! - : - else - # Restart under the correct shell, and then maybe \$echo will work. - exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} - fi - fi\ -" - $echo >> $output "\ - - # Find the directory that this script lives in. - thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` - done - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $echo >> $output "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || \\ - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $mkdir \"\$progdir\" - else - $rm \"\$progdir/\$file\" - fi" - - $echo >> $output "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $echo \"\$relink_command_output\" >&2 - $rm \"\$progdir/\$file\" - exit $EXIT_FAILURE - fi - fi - - $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $rm \"\$progdir/\$program\"; - $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $rm \"\$progdir/\$file\" - fi" - else - $echo >> $output "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $echo >> $output "\ - - if test -f \"\$progdir/\$program\"; then" - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $echo >> $output "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` - - export $shlibpath_var -" - fi - - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - $echo >> $output "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2*) - $echo >> $output "\ - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $echo >> $output "\ - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $echo >> $output "\ - \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\" - exit $EXIT_FAILURE - fi - else - # The program doesn't exist. - \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$echo \"This script is just a wrapper for \$program.\" 1>&2 - $echo \"See the $PACKAGE documentation for more information.\" 1>&2 - exit $EXIT_FAILURE - fi -fi\ -" - chmod +x $output - fi - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - generated="$generated $gentop" - - 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 - cmds=$old_archive_from_new_cmds - else - # 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 - fi - - 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 $? - done - IFS="$save_ifs" - done - - if test -n "$generated"; then - $show "${rm}r$generated" - $run ${rm}r$generated - fi - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - $show "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` - relink_command="$var=\"$var_value\"; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$echo "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 - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` - 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 $EXIT_FAILURE - fi - newdependency_libs="$newdependency_libs $libdir/$name" - ;; - *) newdependency_libs="$newdependency_libs $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - for lib in $dlfiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - 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 $EXIT_FAILURE - fi - newdlfiles="$newdlfiles $libdir/$name" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` - 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 $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 | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; - esac - $echo > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $echo >> $output "\ -relink_command=\"$relink_command\"" - fi - done - fi - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" - $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? - ;; - esac - exit $EXIT_SUCCESS - ;; - - # libtool install mode - install) - modename="$modename: install" - - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - $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 - install_prog="$arg " - arg="$1" - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog$arg" - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - for arg - do - if test -n "$dest"; then - files="$files $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - 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 - continue - fi - ;; - esac - - # Aesthetically quote the argument. - arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` - case $arg in - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - arg="\"$arg\"" - ;; - esac - install_prog="$install_prog $arg" - done - - if test -z "$install_prog"; then - $echo "$modename: you must specify an install program" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -n "$prev"; then - $echo "$modename: the \`$prev' option requires an argument" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - if test -z "$files"; then - if test -z "$dest"; then - $echo "$modename: no file or destination specified" 1>&2 - else - $echo "$modename: you must specify a destination" 1>&2 - fi - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Strip any trailing slash from the destination. - dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` - test "X$destdir" = "X$dest" && destdir=. - destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` - - # Not a directory, so check to see that there is only one file specified. - set dummy $files - if test "$#" -gt 2; then - $echo "$modename: \`$dest' is not a directory" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - staticlibs="$staticlibs $file" - ;; - - *.la) - # Check to see that this really is a libtool archive. - 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 $EXIT_FAILURE - fi - - library_names= - old_library= - relink_command= - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) current_libdirs="$current_libdirs $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) future_libdirs="$future_libdirs $libdir" ;; - esac - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ - test "X$dir" = "X$file/" && dir= - dir="$dir$objdir" - - 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\$%%"` - - # 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 $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%"` - else - relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - $echo "$modename: warning: relinking \`$file'" 1>&2 - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - exit $EXIT_FAILURE - fi - fi - - # See the names of the shared library. - set dummy $library_names - if test -n "$2"; then - realname="$2" - shift - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - $show "$install_prog $dir/$srcname $destdir/$realname" - $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? - if test -n "$stripme" && test -n "$striplib"; then - $show "$striplib $destdir/$realname" - $run eval "$striplib $destdir/$realname" || exit $? - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - if test "$linkname" != "$realname"; then - $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" - cmds=$postinstall_cmds - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $show "$cmd" - $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 - - # Install the pseudo-library for information purposes. - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - instname="$dir/$name"i - $show "$install_prog $instname $destdir/$name" - $run eval "$install_prog $instname $destdir/$name" || exit $? - - # Maybe install the static library, too. - test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - # Install the libtool object if requested. - if test -n "$destfile"; then - $show "$install_prog $file $destfile" - $run eval "$install_prog $file $destfile" || exit $? - fi - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` - - $show "$install_prog $staticobj $staticdest" - $run eval "$install_prog \$staticobj \$staticdest" || exit $? - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - destfile="$destdir/$destfile" - fi - - # 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. - 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 $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 \`$wrapper'" 1>&2 - exit $EXIT_FAILURE - fi - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - # If there is no directory component, then add one. - case $lib in - */* | *\\*) . $lib ;; - *) . ./$lib ;; - esac - fi - libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 - finalize=no - fi - 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 $wrapper in - */* | *\\*) . ${wrapper} ;; - *) . ./${wrapper} ;; - esac - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes && test -z "$run"; then - tmpdir="/tmp" - test -n "$TMPDIR" && tmpdir="$TMPDIR" - tmpdir="$tmpdir/libtool-$$" - 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$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'` - - $show "$relink_command" - if $run eval "$relink_command"; then : - else - $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 - ${rm}r "$tmpdir" - continue - fi - file="$outputname" - else - $echo "$modename: warning: cannot relink \`$file'" 1>&2 - fi - else - # Install the binary that we compiled earlier. - file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` - ;; - esac - ;; - esac - $show "$install_prog$stripme $file $destfile" - $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" - ;; - esac - done - - for file in $staticlibs; do - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - $show "$install_prog $file $oldlib" - $run eval "$install_prog \$file \$oldlib" || exit $? - - 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. - 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 - IFS="$save_ifs" - done - - if test -n "$future_libdirs"; then - $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 - fi - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - test -n "$run" && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi - ;; - - # libtool finish mode - finish) - modename="$modename: finish" - libdirs="$nonopt" - admincmds= - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for dir - do - libdirs="$libdirs $dir" - done - - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - 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" - done - IFS="$save_ifs" - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $run eval "$cmds" || admincmds="$admincmds - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - test "$show" = : && exit $EXIT_SUCCESS - - $echo "----------------------------------------------------------------------" - $echo "Libraries have been installed in:" - for libdir in $libdirs; do - $echo " $libdir" - done - $echo - $echo "If you ever happen to want to link against installed libraries" - $echo "in a given directory, LIBDIR, you must either use libtool, and" - $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - $echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - $echo " during execution" - fi - if test -n "$runpath_var"; then - $echo " - add LIBDIR to the \`$runpath_var' environment variable" - $echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $echo " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $echo " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - $echo - $echo "See any operating system documentation about shared libraries for" - $echo "more information, such as the ld(1) and ld.so(8) manual pages." - $echo "----------------------------------------------------------------------" - exit $EXIT_SUCCESS - ;; - - # libtool execute mode - execute) - modename="$modename: execute" - - # The first argument is the command name. - cmd="$nonopt" - if test -z "$cmd"; then - $echo "$modename: you must specify a COMMAND" 1>&2 - $echo "$help" - exit $EXIT_FAILURE - fi - - # Handle -dlopen flags immediately. - for file in $execute_dlfiles; do - if test ! -f "$file"; then - $echo "$modename: \`$file' is not a file" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - fi - - dir= - case $file in - *.la) - # Check to see that this really is a libtool archive. - 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 $EXIT_FAILURE - fi - - # Read the libtool library. - dlname= - library_names= - - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" - continue - fi - - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - - if test -f "$dir/$objdir/$dlname"; then - dir="$dir/$objdir" - else - $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 - exit $EXIT_FAILURE - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` - test "X$dir" = "X$file" && dir=. - ;; - - *) - $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -*) ;; - *) - # Do a test to see if this is really a libtool program. - if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - # If there is no directory component, then add one. - case $file in - */* | *\\*) . $file ;; - *) . ./$file ;; - esac - - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` - args="$args \"$file\"" - done - - if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - if test "${save_LC_ALL+set}" = set; then - LC_ALL="$save_LC_ALL"; export LC_ALL - fi - if test "${save_LANG+set}" = set; then - LANG="$save_LANG"; export LANG - fi - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi - $echo "$cmd$args" - exit $EXIT_SUCCESS - fi - ;; - - # libtool clean and uninstall mode - clean | uninstall) - modename="$modename: $mode" - rm="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) rm="$rm $arg"; rmforce=yes ;; - -*) rm="$rm $arg" ;; - *) files="$files $arg" ;; - esac - done - - if test -z "$rm"; then - $echo "$modename: you must specify an RM program" 1>&2 - $echo "$help" 1>&2 - exit $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="$origobjdir" - else - objdir="$dir/$origobjdir" - fi - name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` - test "$mode" = uninstall && objdir="$dir" - - # Remember objdir for removal later, being careful to avoid duplicates - if test "$mode" = clean; then - case " $rmdirs " in - *" $objdir "*) ;; - *) rmdirs="$rmdirs $objdir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if (test -L "$file") >/dev/null 2>&1 \ - || (test -h "$file") >/dev/null 2>&1 \ - || test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then - . $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - rmfiles="$rmfiles $objdir/$n" - done - test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" - test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" - - if test "$mode" = uninstall; then - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - 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 - exit_status=1 - fi - done - IFS="$save_ifs" - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - 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 - exit_status=1 - fi - done - IFS="$save_ifs" - fi - # FIXME: should reinstall the best remaining shared library. - fi - fi - ;; - - *.lo) - # 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 - ;; - - *) - 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 - - # 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 - ;; - esac - $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 - if test -d "$dir"; then - $show "rmdir $dir" - $run rmdir $dir >/dev/null 2>&1 - fi - done - - exit $exit_status - ;; - - "") - $echo "$modename: you must specify a MODE" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - ;; - esac - - if test -z "$exec_cmd"; then - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$generic_help" 1>&2 - exit $EXIT_FAILURE - fi -fi # test -z "$show_help" - -if test -n "$exec_cmd"; then - eval exec $exec_cmd - exit $EXIT_FAILURE -fi - -# We need to display help for each of the modes. -case $mode in -"") $echo \ -"Usage: $modename [OPTION]... [MODE-ARG]... - -Provide generalized library-building support services. - - --config show all configuration variables - --debug enable verbose shell tracing --n, --dry-run display commands without modifying any files - --features display basic configuration information and exit - --finish same as \`--mode=finish' - --help display this help message and exit - --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] - --quiet same as \`--silent' - --silent don't print informational messages - --tag=TAG use configuration variables from tag TAG - --version print version information - -MODE must be one of the following: - - clean remove files from the build directory - compile compile a source file into a libtool object - execute automatically set library path, then run a program - finish complete the installation of libtool libraries - install install libraries or executables - link create a library or an executable - uninstall remove libraries from an installed directory - -MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for -a more detailed description of MODE. - -Report bugs to ." - exit $EXIT_SUCCESS - ;; - -clean) - $echo \ -"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - -compile) - $echo \ -"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -prefer-pic try to building PIC objects only - -prefer-non-pic try to building non-PIC objects only - -static always build a \`.o' file suitable for static linking - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - -execute) - $echo \ -"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - -finish) - $echo \ -"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - -install) - $echo \ -"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - -link) - $echo \ -"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -static do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - -uninstall) - $echo \ -"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - -*) - $echo "$modename: invalid operation mode \`$mode'" 1>&2 - $echo "$help" 1>&2 - exit $EXIT_FAILURE - ;; -esac - -$echo -$echo "Try \`$modename --help' for more information about other modes." - -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 -# sh-indentation:2 -# End: diff --git a/libs/libdingaling/missing b/libs/libdingaling/missing deleted file mode 100644 index 894e786e16..0000000000 --- a/libs/libdingaling/missing +++ /dev/null @@ -1,360 +0,0 @@ -#! /bin/sh -# Common stub for a few missing GNU programs while installing. - -scriptversion=2005-06-08.21 - -# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005 -# Free Software Foundation, Inc. -# Originally by Fran,cois Pinard , 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, 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. - -if test $# -eq 0; then - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 -fi - -run=: - -# In the cases where this matters, `missing' is being run in the -# srcdir already. -if test -f configure.ac; then - configure_ac=configure.ac -else - configure_ac=configure.in -fi - -msg="missing on your system" - -case "$1" in ---run) - # Try to run requested program, and just exit if it succeeds. - run= - shift - "$@" && exit 0 - # Exit code 63 means version mismatch. This often happens - # when the user try to use an ancient version of a tool on - # a file that requires a minimum version. In this case we - # we should proceed has if the program had been absent, or - # if --run hadn't been passed. - if test $? = 63; then - run=: - msg="probably too old" - fi - ;; - - -h|--h|--he|--hel|--help) - echo "\ -$0 [OPTION]... PROGRAM [ARGUMENT]... - -Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an -error status if there is no known handling for PROGRAM. - -Options: - -h, --help display this help and exit - -v, --version output version information and exit - --run try to run the given command, and emulate it if it fails - -Supported PROGRAM values: - aclocal touch file \`aclocal.m4' - autoconf touch file \`configure' - autoheader touch file \`config.h.in' - automake touch all \`Makefile.in' files - bison create \`y.tab.[ch]', if possible, from existing .[ch] - flex create \`lex.yy.c', if possible, from existing .c - help2man touch the output file - lex create \`lex.yy.c', if possible, from existing .c - makeinfo touch the output file - tar try tar, gnutar, gtar, then tar without non-portable flags - yacc create \`y.tab.[ch]', if possible, from existing .[ch] - -Send bug reports to ." - exit $? - ;; - - -v|--v|--ve|--ver|--vers|--versi|--versio|--version) - echo "missing $scriptversion (GNU Automake)" - exit $? - ;; - - -*) - echo 1>&2 "$0: Unknown \`$1' option" - echo 1>&2 "Try \`$0 --help' for more information" - exit 1 - ;; - -esac - -# Now exit if we have it, but it failed. Also exit now if we -# don't have it and --version was passed (most likely to detect -# the program). -case "$1" in - lex|yacc) - # Not GNU programs, they don't have --version. - ;; - - tar) - if test -n "$run"; then - echo 1>&2 "ERROR: \`tar' requires --run" - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - exit 1 - fi - ;; - - *) - if test -z "$run" && ($1 --version) > /dev/null 2>&1; then - # We have it, but it failed. - exit 1 - elif test "x$2" = "x--version" || test "x$2" = "x--help"; then - # Could not run --version or --help. This is probably someone - # running `$TOOL --version' or `$TOOL --help' to check whether - # $TOOL exists and not knowing $TOOL uses missing. - exit 1 - fi - ;; -esac - -# If it does not exist, or fails to run (possibly an outdated version), -# try to emulate it. -case "$1" in - aclocal*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acinclude.m4' or \`${configure_ac}'. You might want - to install the \`Automake' and \`Perl' packages. Grab them from - any GNU archive site." - touch aclocal.m4 - ;; - - autoconf) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`${configure_ac}'. You might want to install the - \`Autoconf' and \`GNU m4' packages. Grab them from any GNU - archive site." - touch configure - ;; - - autoheader) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`acconfig.h' or \`${configure_ac}'. You might want - to install the \`Autoconf' and \`GNU m4' packages. Grab them - from any GNU archive site." - files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` - test -z "$files" && files="config.h" - touch_files= - for f in $files; do - case "$f" in - *:*) touch_files="$touch_files "`echo "$f" | - sed -e 's/^[^:]*://' -e 's/:.*//'`;; - *) touch_files="$touch_files $f.in";; - esac - done - touch $touch_files - ;; - - automake*) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. - You might want to install the \`Automake' and \`Perl' packages. - Grab them from any GNU archive site." - find . -type f -name Makefile.am -print | - sed 's/\.am$/.in/' | - while read f; do touch "$f"; done - ;; - - autom4te) - echo 1>&2 "\ -WARNING: \`$1' is needed, but is $msg. - You might have modified some files without having the - proper tools for further handling them. - You can get \`$1' as part of \`Autoconf' from any GNU - archive site." - - file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'` - test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'` - if test -f "$file"; then - touch $file - else - test -z "$file" || exec >$file - echo "#! /bin/sh" - echo "# Created by GNU Automake missing as a replacement of" - echo "# $ $@" - echo "exit 0" - chmod +x $file - exit 1 - fi - ;; - - bison|yacc) - echo 1>&2 "\ -WARNING: \`$1' $msg. You should only need it if - you modified a \`.y' file. You may need the \`Bison' package - in order for those modifications to take effect. You can get - \`Bison' from any GNU archive site." - rm -f y.tab.c y.tab.h - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.y) - SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.c - fi - SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" y.tab.h - fi - ;; - esac - fi - if [ ! -f y.tab.h ]; then - echo >y.tab.h - fi - if [ ! -f y.tab.c ]; then - echo 'main() { return 0; }' >y.tab.c - fi - ;; - - lex|flex) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.l' file. You may need the \`Flex' package - in order for those modifications to take effect. You can get - \`Flex' from any GNU archive site." - rm -f lex.yy.c - if [ $# -ne 1 ]; then - eval LASTARG="\${$#}" - case "$LASTARG" in - *.l) - SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` - if [ -f "$SRCFILE" ]; then - cp "$SRCFILE" lex.yy.c - fi - ;; - esac - fi - if [ ! -f lex.yy.c ]; then - echo 'main() { return 0; }' >lex.yy.c - fi - ;; - - help2man) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a dependency of a manual page. You may need the - \`Help2man' package in order for those modifications to take - effect. You can get \`Help2man' from any GNU archive site." - - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'` - fi - if [ -f "$file" ]; then - touch $file - else - test -z "$file" || exec >$file - echo ".ab help2man is required to generate this page" - exit 1 - fi - ;; - - makeinfo) - echo 1>&2 "\ -WARNING: \`$1' is $msg. You should only need it if - you modified a \`.texi' or \`.texinfo' file, or any other file - indirectly affecting the aspect of the manual. The spurious - call might also be the consequence of using a buggy \`make' (AIX, - DU, IRIX). You might want to install the \`Texinfo' package or - the \`GNU make' package. Grab either from any GNU archive site." - # The file to touch is that specified with -o ... - file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'` - if test -z "$file"; then - # ... or it is the one specified with @setfilename ... - infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` - file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile` - # ... or it is derived from the source name (dir/f.texi becomes f.info) - test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info - fi - # If the file does not exist, the user really needs makeinfo; - # let's fail without touching anything. - test -f $file || exit 1 - touch $file - ;; - - tar) - shift - - # We have already tried tar in the generic part. - # Look for gnutar/gtar before invocation to avoid ugly error - # messages. - if (gnutar --version > /dev/null 2>&1); then - gnutar "$@" && exit 0 - fi - if (gtar --version > /dev/null 2>&1); then - gtar "$@" && exit 0 - fi - firstarg="$1" - if shift; then - case "$firstarg" in - *o*) - firstarg=`echo "$firstarg" | sed s/o//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - case "$firstarg" in - *h*) - firstarg=`echo "$firstarg" | sed s/h//` - tar "$firstarg" "$@" && exit 0 - ;; - esac - fi - - echo 1>&2 "\ -WARNING: I can't seem to be able to run \`tar' with the given arguments. - You may want to install GNU tar or Free paxutils, or check the - command line arguments." - exit 1 - ;; - - *) - echo 1>&2 "\ -WARNING: \`$1' is needed, and is $msg. - You might have modified some files without having the - proper tools for further handling them. Check the \`README' file, - it often tells you about the needed prerequisites for installing - this package. You may also peek at any GNU archive site, in case - some other package would contain this missing \`$1' program." - exit 1 - ;; -esac - -exit 0 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/libs/libdingaling/mkinstalldirs b/libs/libdingaling/mkinstalldirs deleted file mode 100644 index 259dbfcd35..0000000000 --- a/libs/libdingaling/mkinstalldirs +++ /dev/null @@ -1,158 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy - -scriptversion=2005-06-29.22 - -# Original author: Noah Friedman -# Created: 1993-05-16 -# Public domain. -# -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -errstatus=0 -dirmode= - -usage="\ -Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... - -Create each directory DIR (with mode MODE, if specified), including all -leading file name components. - -Report bugs to ." - -# process command line arguments -while test $# -gt 0 ; do - case $1 in - -h | --help | --h*) # -h for help - echo "$usage" - exit $? - ;; - -m) # -m PERM arg - shift - test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } - dirmode=$1 - shift - ;; - --version) - echo "$0 $scriptversion" - exit $? - ;; - --) # stop option processing - shift - break - ;; - -*) # unknown option - echo "$usage" 1>&2 - exit 1 - ;; - *) # first non-opt arg - break - ;; - esac -done - -for file -do - if test -d "$file"; then - shift - else - break - fi -done - -case $# in - 0) exit 0 ;; -esac - -# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and -# mkdir -p a/c at the same time, both will detect that a is missing, -# one will create a, then the other will try to create a and die with -# a "File exists" error. This is a problem when calling mkinstalldirs -# from a parallel make. We use --version in the probe to restrict -# ourselves to GNU mkdir, which is thread-safe. -case $dirmode in - '') - if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then - echo "mkdir -p -- $*" - exec 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. - test -d ./-p && rmdir ./-p - test -d ./--version && rmdir ./--version - fi - ;; - *) - if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && - test ! -d ./--version; then - echo "mkdir -m $dirmode -p -- $*" - exec mkdir -m "$dirmode" -p -- "$@" - else - # Clean up after NextStep and OpenStep mkdir. - for d in ./-m ./-p ./--version "./$dirmode"; - do - test -d $d && rmdir $d - done - fi - ;; -esac - -for file -do - case $file in - /*) pathcomp=/ ;; - *) pathcomp= ;; - esac - oIFS=$IFS - IFS=/ - set fnord $file - shift - IFS=$oIFS - - for d - do - test "x$d" = x && continue - - pathcomp=$pathcomp$d - case $pathcomp in - -*) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - else - if test ! -z "$dirmode"; then - echo "chmod $dirmode $pathcomp" - lasterr= - chmod "$dirmode" "$pathcomp" || lasterr=$? - - if test ! -z "$lasterr"; then - errstatus=$lasterr - fi - fi - fi - fi - - pathcomp=$pathcomp/ - done -done - -exit $errstatus - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-end: "$" -# End: diff --git a/libs/libdingaling/src/dingaling.def b/libs/libdingaling/src/dingaling.def deleted file mode 100644 index 16102267e1..0000000000 --- a/libs/libdingaling/src/dingaling.def +++ /dev/null @@ -1,30 +0,0 @@ -EXPORTS -ldl_session_get_caller -ldl_session_get_ip -ldl_session_set_private -ldl_session_get_private -ldl_session_terminate -ldl_handle_get_private -ldl_session_candidates -ldl_session_describe -ldl_session_get_state -ldl_session_get_candidates -ldl_session_get_payloads -ldl_global_init -ldl_global_destroy -ldl_global_set_log_stream -ldl_handle_init -ldl_handle_run -ldl_handle_destroy -ldl_handle_set_log_stream -ldl_session_create -ldl_handle_probe -ldl_handle_ready -ldl_session_get_id -ldl_session_set_ip -ldl_global_set_logger -ldl_handle_send_msg -ldl_session_get_value -ldl_session_set_value -ldl_session_accept_candidate -ldl_session_send_msg \ No newline at end of file diff --git a/libs/libdingaling/src/ldl_compat.h b/libs/libdingaling/src/ldl_compat.h deleted file mode 100644 index c14e0d2145..0000000000 --- a/libs/libdingaling/src/ldl_compat.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * libDingaLing XMPP Jingle Library - * Copyright (C) 2005-2014, 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 libDingaLing XMPP Jingle Library - * - * 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 - * - * ldl_compat.h -- Platform Compatability Header File - * - */ -/*! \file ldl_compat.h - \brief Platform Compatability Header File -*/ -#ifndef LDL_COMPAT_H -#define LDL_COMPAT_H -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __STUPIDFORMATBUG__ -} -#endif - - -#ifdef _MSC_VER -#if !defined(_STDINT) && !defined(uint32_t) -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned long in_addr_t; -#endif -#if _MSC_VER < 1900 -#define snprintf _snprintf -#endif -#endif - -#ifdef __cplusplus -} -#endif - -#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 noet: - */ diff --git a/libs/libdingaling/src/libdingaling.c b/libs/libdingaling/src/libdingaling.c deleted file mode 100644 index ee08f041c0..0000000000 --- a/libs/libdingaling/src/libdingaling.c +++ /dev/null @@ -1,3301 +0,0 @@ -/* - * libDingaLing XMPP Jingle Library - * Copyright (C) 2005-2014, 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 libDingaLing XMPP Jingle Library - * - * 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 - * - * libdingaling.c -- Main Library Code - * - * QMOD: XMPP Video Signaling + Presentation (video-v1 & camera-v1) - * - */ - - -#ifndef _MSC_VER -#include -#include -#include -#include -#include -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define APR_WANT_STDIO -#define APR_WANT_STRFUNC -#include -#include - -#include "ldl_compat.h" -#include "libdingaling.h" -#include "sha1.h" - -#ifdef _MSC_VER -#include -#pragma warning(disable:4127 4706) -#endif - -#define microsleep(x) apr_sleep(x * 1000) -#define LDL_CAPS_VER "1.0.0.1" - -static int opt_timeout = 30; - -static void sha1_hash(char *out, unsigned char *in, unsigned int len); -static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen); -static void ldl_random_string(char *buf, uint16_t len, char *set); - -static struct { - unsigned int flags; - FILE *log_stream; - int debug; - apr_pool_t *memory_pool; - unsigned int id; - ldl_logger_t logger; - apr_hash_t *avatar_hash; - apr_thread_mutex_t *flag_mutex; -} globals; - -struct packet_node { - char id[80]; - iks *xml; - unsigned int retries; - apr_time_t next; -}; - -struct ldl_buffer { - char *buf; - unsigned int len; - int hit; -}; - -typedef enum { - CS_NEW, - CS_START, - CS_CONNECTED -} ldl_handle_state_t; - -struct ldl_handle { - iksparser *parser; - iksid *acc; - iksfilter *filter; - char *login; - char *password; - char *server; - char *status_msg; - char *priority; - uint16_t port; - int features; - int counter; - int job_done; - unsigned int flags; - apr_queue_t *queue; - apr_queue_t *retry_queue; - apr_hash_t *sessions; - apr_hash_t *retry_hash; - apr_hash_t *probe_hash; - apr_hash_t *sub_hash; - apr_thread_mutex_t *lock; - apr_thread_mutex_t *flag_mutex; - ldl_loop_callback_t loop_callback; - ldl_session_callback_t session_callback; - ldl_response_callback_t response_callback; - apr_pool_t *pool; - void *private_info; - FILE *log_stream; - ldl_handle_state_t state; - int fail_count; -}; - -struct ldl_session { - ldl_state_t state; - ldl_handle_t *handle; - char *id; - char *initiator; - char *them; - char *ip; - char *login; - ldl_payload_t payloads[LDL_MAX_PAYLOADS]; - unsigned int payload_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; - void *private_data; - ldl_user_flag_t flags; -}; - -static int on_disco_default(void *user_data, ikspak *pak); -static int on_vcard(void *user_data, ikspak *pak); -typedef int (*iks_filter_callback_t)(void *user_data, ikspak *pak); - -struct ldl_feature { - const char *name; - iks_filter_callback_t callback; -}; -typedef struct ldl_feature ldl_feature_t; - -#define FEATURE_DISCO "http://jabber.org/protocol/disco" -#define FEATURE_DISCO_INFO "http://jabber.org/protocol/disco#info" -#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[] = { - { FEATURE_DISCO, on_disco_default }, - { FEATURE_DISCO_INFO, on_disco_default }, - { 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} -}; - - -struct ldl_avatar { - char *path; - char *base64; - char hash[256]; -}; - -typedef struct ldl_avatar ldl_avatar_t; - - -static void lowercase(char *str) -{ - size_t x = 0; - - if (str) { - for (x = 0; x < strlen(str); x++) { - str[x] = (char)tolower((int)str[x]); - } - } -} - -static char *cut_path(char *in) -{ - char *p, *ret = in; - char delims[] = "/\\"; - char *i; - - for (i = delims; *i; i++) { - p = in; - while ((p = strchr(p, *i)) != 0) { - ret = ++p; - } - } - return ret; -} - -static void default_logger(char *file, const char *func, int line, int level, char *fmt, ...) -{ - char *fp; - char data[1024]; - - va_list ap; - - fp = cut_path(file); - - va_start(ap, fmt); - - vsnprintf(data, sizeof(data), fmt, ap); - - fprintf(globals.log_stream, "%s:%d %s() %s", fp, line, func, data); - - va_end(ap); - -} - -static unsigned int next_id(void) -{ - return globals.id++; -} - -static char *iks_name_nons(iks *x) -{ - char *r = iks_name(x); - char *p; - - if (r && (p = strchr(r, ':'))) { - r = p + 1; - } - - return r; -} - - -char *ldl_session_get_value(ldl_session_t *session, char *key) -{ - return apr_hash_get(session->variables, key, APR_HASH_KEY_STRING); -} - -void ldl_session_set_value(ldl_session_t *session, const char *key, const char *val) -{ - apr_hash_set(session->variables, apr_pstrdup(session->pool, key), APR_HASH_KEY_STRING, apr_pstrdup(session->pool, val)); -} - -char *ldl_session_get_id(ldl_session_t *session) -{ - return session->id; -} - -void ldl_session_send_msg(ldl_session_t *session, char *subject, char *body) -{ - ldl_handle_send_msg(session->handle, session->login, session->them, subject, body); -} - -ldl_status ldl_session_destroy(ldl_session_t **session_p) -{ - ldl_session_t *session = *session_p; - - if (session) { - apr_pool_t *pool = session->pool; - apr_hash_t *hash = session->handle->sessions; - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Destroyed Session %s\n", session->id); - } - - if (session->id) { - apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); - } - - if (session->them) { - apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); - } - - apr_pool_destroy(pool); - pool = NULL; - *session_p = NULL; - return LDL_STATUS_SUCCESS; - } - - return LDL_STATUS_FALSE; -} - - -ldl_status ldl_session_create(ldl_session_t **session_p, ldl_handle_t *handle, char *id, char *them, char *me, ldl_user_flag_t flags) -{ - ldl_session_t *session = NULL; - - if (!(session = apr_palloc(handle->pool, sizeof(ldl_session_t)))) { - globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); - *session_p = NULL; - return LDL_STATUS_MEMERR; - } - memset(session, 0, sizeof(ldl_session_t)); - apr_pool_create(&session->pool, globals.memory_pool); - session->id = apr_pstrdup(session->pool, id); - session->them = apr_pstrdup(session->pool, them); - - if (flags & LDL_FLAG_OUTBOUND) { - session->initiator = apr_pstrdup(session->pool, me); - } - - if (ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - session->login = apr_pstrdup(session->pool, me); - } else { - session->login = apr_pstrdup(session->pool, handle->login); - } - - apr_hash_set(handle->sessions, session->id, APR_HASH_KEY_STRING, session); - apr_hash_set(handle->sessions, session->them, APR_HASH_KEY_STRING, session); - session->handle = handle; - session->created = apr_time_now(); - session->state = LDL_STATE_NEW; - session->variables = apr_hash_make(session->pool); - session->flags = flags; - *session_p = session; - - - if (globals.debug) { - globals.logger(DL_LOG_CRIT, "Created Session %s\n", id); - } - - return LDL_STATUS_SUCCESS; -} - -static ldl_status parse_session_code(ldl_handle_t *handle, char *id, char *from, char *to, iks *xml, char *xtype) -{ - ldl_session_t *session = NULL; - ldl_signal_t dl_signal = LDL_SIGNAL_NONE; - char *initiator = iks_find_attrib(xml, "initiator"); - char *msg = NULL; - - 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); - } - - while(xml) { - char *type = NULL; - iks *tag; - - if (iks_type(xml) != IKS_CDATA) { - type = xtype ? xtype : iks_find_attrib(xml, "type"); - } - - if (type) { - - if (!strcasecmp(type, "redirect")) { - 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(type, "initiate") || !strcasecmp(type, "accept")) { - - dl_signal = LDL_SIGNAL_INITIATE; - - if (!strcasecmp(type, "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), "description")) { - iks * itag = iks_child (tag); - while(itag) { - 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"); - 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 { - 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_CRIT, "Add Payload [%s] id='%s'\n", name, id); - } - } - } - itag = iks_next_tag(itag); - } - } - tag = iks_next_tag(tag); - } - } else if (!strcasecmp(type, "transport-accept")) { - dl_signal = LDL_SIGNAL_TRANSPORT_ACCEPT; - } else if (!strcasecmp(type, "reject")) { - dl_signal = LDL_SIGNAL_REJECT; - } else if (!strcasecmp(type, "transport-info") || !strcasecmp(type, "candidates")) { - char *tid = iks_find_attrib(xml, "id"); - dl_signal = LDL_SIGNAL_CANDIDATES; - tag = iks_child (xml); - id = type; - if (tag && !strcasecmp(iks_name_nons(tag), "transport")) { - tag = iks_child(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_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*/) { - 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"))) { - globals.logger(DL_LOG_WARNING, "Field preference was not set\n"); - continue; - } else { - unsigned int x; - - pref = strtod(key, NULL); - - /* 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_CRIT, "Duplicate Pref! Updating...\n"); - } - index = x; - break; - } - } - } - - if (index < 0) { - index = (*candidate_len)++; - } - - (*candidates)[index].pref = pref; - - if (tid) { - (*candidates)[index].tid = apr_pstrdup(session->pool, tid); - } - - if ((key = iks_find_attrib(tag, "name"))) { - (*candidates)[index].name = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "type"))) { - (*candidates)[index].type = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "protocol"))) { - (*candidates)[index].protocol = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "username"))) { - (*candidates)[index].username = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "password"))) { - (*candidates)[index].password = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "address"))) { - (*candidates)[index].address = apr_pstrdup(session->pool, key); - } - if ((key = iks_find_attrib(tag, "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 - ); - } - } - } - } else if (!strcasecmp(type, "terminate")) { - dl_signal = LDL_SIGNAL_TERMINATE; - } else if (!strcasecmp(type, "error")) { - dl_signal = LDL_SIGNAL_ERROR; - } - } - - xml = iks_child(xml); - } - - if (handle->session_callback && dl_signal) { - handle->session_callback(handle, session, dl_signal, to, from, id, msg); - } - - 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 && from)) { - 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; - } - } - } else { - globals.logger(DL_LOG_WARNING, "No preference specified"); - continue; - } - - 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"; - - -static int on_vcard(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_VCARD, to, from, pak->id, NULL); - } - - return IKS_FILTER_EAT; -} - - -static int on_disco_default(void *user_data, ikspak *pak) -{ - char *node = NULL; - char *ns = NULL; - ldl_handle_t *handle = user_data; - iks *iq = NULL, *query, *tag; - uint8_t send = 0; - int x; - - if (pak && pak->query) { - ns = iks_find_attrib(pak->query, "xmlns"); - node = iks_find_attrib(pak->query, "node"); - } - - if (pak && pak->subtype == IKS_TYPE_RESULT) { - globals.logger(DL_LOG_CRIT, "FixME!!! node=[%s]\n", node?node:""); - } else if (pak && pak->subtype == IKS_TYPE_GET) { - if (ns && (iq = iks_new("iq"))) { - int all = 0; - - iks_insert_attrib(iq, "from", handle->login); - if (pak->from) { - iks_insert_attrib(iq, "to", pak->from->full); - } - iks_insert_attrib(iq, "id", pak->id); - iks_insert_attrib(iq, "type", "result"); - - if (!(query = iks_insert (iq, "query"))) { - goto fail; - } - iks_insert_attrib(query, "xmlns", ns); - - if (!strcasecmp(ns, FEATURE_LAST)) { - iks_insert_attrib(query, "seconds", "1"); - } - - if (!(tag = iks_insert (query, "identity"))) { - goto fail; - } - - iks_insert_attrib(tag, "category", "gateway"); - //iks_insert_attrib(tag, "type", "voice"); - iks_insert_attrib(tag, "name", "LibDingaLing"); - - if (!strcasecmp(ns, FEATURE_DISCO_INFO)) { - if (!node) { - all++; - } else { - char *p; - - if ((p = strstr(node, "caps#"))) { - char *what = p + 5; - - if (!strcasecmp(what, "voice-v1")) { - if (!(tag = iks_insert (query, "feature"))) { - goto fail; - } - iks_insert_attrib(tag, "var", FEATURE_VOICE); - goto done; - } - - } - } - } - - for (x = 0; FEATURES[x].name; x++) { - if (all || !ns || !strcasecmp(ns, FEATURES[x].name)) { - if (!(tag = iks_insert (query, "feature"))) { - goto fail; - } - iks_insert_attrib(tag, "var", FEATURES[x].name); - } - } - - done: - - apr_queue_push(handle->queue, iq); - iq = NULL; - send = 1; - } - fail: - - if (iq) { - iks_delete(iq); - } - - if (!send) { - globals.logger(DL_LOG_CRIT, "Memory Error!\n"); - } - } - - return IKS_FILTER_EAT; -} - -static int on_presence(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - char *type = iks_find_attrib(pak->x, "type"); - char *show = iks_find_cdata(pak->x, "show"); - char *status = iks_find_cdata(pak->x, "status"); - char id[1024]; - char *resource; - struct ldl_buffer *buffer; - ldl_signal_t dl_signal = LDL_SIGNAL_PRESENCE_IN; - int done = 0; - - - if (type && *type) { - if (!strcasecmp(type, "unavailable")) { - dl_signal = LDL_SIGNAL_PRESENCE_OUT; - } else if (!strcasecmp(type, "probe")) { - dl_signal = LDL_SIGNAL_PRESENCE_PROBE; - } - if (!status) { - status = type; - } - } else { - if (!status) { - status = "Available"; - } - } - - - apr_cpystrn(id, from, sizeof(id)); - lowercase(id); - - if ((resource = strchr(id, '/'))) { - *resource++ = '\0'; - } - - - if (!apr_hash_get(handle->sub_hash, from, APR_HASH_KEY_STRING)) { - iks *msg; - apr_hash_set(handle->sub_hash, apr_pstrdup(handle->pool, from), APR_HASH_KEY_STRING, &marker); - if ((msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling...."))) { - apr_queue_push(handle->queue, msg); - msg = NULL; - } - } - - if (resource && (strstr(resource, "talk") || strstr(resource, "telepathy")) && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) { - apr_cpystrn(buffer->buf, from, buffer->len); - buffer->hit = 1; - done = 1; - } - - if (!done) { - iks *xml = iks_find(pak->x, "c"); - if (!xml) { - xml = iks_find(pak->x, "caps:c"); - } - - if (xml) { - char *ext = iks_find_attrib(xml, "ext");; - if (ext && strstr(ext, "voice-v1") && (buffer = apr_hash_get(handle->probe_hash, id, APR_HASH_KEY_STRING))) { - apr_cpystrn(buffer->buf, from, buffer->len); - buffer->hit = 1; - } - } - } - - - if (handle->session_callback) { - handle->session_callback(handle, NULL, dl_signal, to, id, status ? status : "n/a", show ? show : "n/a"); - } - - return IKS_FILTER_EAT; -} - -static char *ldl_handle_strdup(ldl_handle_t *handle, char *str) -{ - char *dup; - apr_size_t len; - - len = strlen(str) + 1; - dup = apr_palloc(handle->pool, len); - assert(dup != NULL); - strncpy(dup, str, len); - return dup; -} - -static void ldl_strip_resource(char *in) -{ - char *p; - - if ((p = strchr(in, '/'))) { - *p = '\0'; - } -} - -static ldl_avatar_t *ldl_get_avatar(ldl_handle_t *handle, char *path, char *from) -{ - ldl_avatar_t *ap; - uint8_t image[8192]; - unsigned char base64[9216] = ""; - int fd = -1; - size_t bytes; - char *key; - //char hash[128] = ""; - - if (from && (ap = (ldl_avatar_t *) apr_hash_get(globals.avatar_hash, from, APR_HASH_KEY_STRING))) { - return ap; - } - - if (path && from) { - if ((ap = (ldl_avatar_t *) apr_hash_get(globals.avatar_hash, path, APR_HASH_KEY_STRING))) { - key = ldl_handle_strdup(handle, from); - ldl_strip_resource(key); - apr_hash_set(globals.avatar_hash, key, APR_HASH_KEY_STRING, ap); - return ap; - } - } - - if (!(path && from)) { - return NULL; - } - - if ((fd = open(path, O_RDONLY, 0)) < 0) { - globals.logger(DL_LOG_ERR, "File %s does not exist!\n", path); - return NULL; - } - - bytes = read(fd, image, sizeof(image)); - close(fd); - - ap = malloc(sizeof(*ap)); - assert(ap != NULL); - memset(ap, 0, sizeof(*ap)); - sha1_hash(ap->hash, (unsigned char *) image, (unsigned int)bytes); - ap->path = strdup(path); - - key = ldl_handle_strdup(handle, from); - ldl_strip_resource(key); - - b64encode((unsigned char *)image, bytes, base64, sizeof(base64)); - ap->base64 = strdup((const char *)base64); - apr_hash_set(globals.avatar_hash, ap->path, APR_HASH_KEY_STRING, ap); - apr_hash_set(globals.avatar_hash, key, APR_HASH_KEY_STRING, ap); - return ap; -} - - -static void do_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message, char *avatar) -{ - iks *pres; - char buf[512]; - iks *tag; - - if (from && !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)) { - globals.logger(DL_LOG_ERR, "Refusal to send presence from and to the same domain in component mode [%s][%s]\n", from, to); - return; - } - - if ((pres = iks_new("presence"))) { - iks_insert_attrib(pres, "xmlns", "jabber:client"); - if (from) { - iks_insert_attrib(pres, "from", from); - } - if (to) { - iks_insert_attrib(pres, "to", to); - } - if (type) { - iks_insert_attrib(pres, "type", type); - } - - if (rpid) { - if ((tag = iks_insert (pres, "show"))) { - iks_insert_cdata(tag, rpid, 0); - } - } - - if (message) { - if ((tag = iks_insert (pres, "status"))) { - iks_insert_cdata(tag, message, 0); - } - } - - if (message || rpid) { - ldl_avatar_t *ap; - - if (avatar) { - if ((ap = ldl_get_avatar(handle, avatar, from))) { - if ((tag = iks_insert(pres, "x"))) { - iks *hash; - iks_insert_attrib(tag, "xmlns", "vcard-temp:x:update"); - if ((hash = iks_insert(tag, "photo"))) { - iks_insert_cdata(hash, ap->hash, 0); - } - } - } - } - - 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 video-v1 camera-v1"); - iks_insert_attrib(tag, "client", "libdingaling"); - iks_insert_attrib(tag, "xmlns", "http://jabber.org/protocol/caps"); - } - } - - apr_queue_push(handle->queue, pres); - pres = NULL; - } -} - -static void do_roster(ldl_handle_t *handle) -{ - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_ROSTER, NULL, handle->login, NULL, NULL); - } -} - -static int on_unsubscribe(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_UNSUBSCRIBE, to, from, NULL, NULL); - } - - return IKS_FILTER_EAT; -} - -static int on_subscribe(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - iks *msg = NULL; - char *id = strdup(from); - char *r; - - if (!id) { - return -1; - } - if ((r = strchr(from, '/'))) { - *r++ = '\0'; - } - - if ((msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, "Ding A Ling...."))) { - if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - iks_insert_attrib(msg, "from", to); - } - - apr_queue_push(handle->queue, msg); - msg = NULL; - } - - if ((msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, "Ding A Ling...."))) { - - if (to && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - iks_insert_attrib(msg, "from", to); - } - - apr_queue_push(handle->queue, msg); - msg = NULL; - } - - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_SUBSCRIBE, to, from, NULL, NULL); - } - - if (id) free(id); - - return IKS_FILTER_EAT; -} - -static void cancel_retry(ldl_handle_t *handle, char *id) -{ - struct packet_node *packet_node; - - 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_CRIT, "Cancel packet %s\n", packet_node->id); - } - packet_node->retries = 0; - } - apr_thread_mutex_unlock(handle->lock); -} - -static iks* working_find(iks *tag, const char *name) -{ - while(tag) { - if (!strcasecmp(iks_name(tag), name)) { - return tag; - } - tag = iks_next_tag(tag); - } - - 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; - char *from = iks_find_attrib(pak->x, "from"); - char *to = iks_find_attrib(pak->x, "to"); - char *iqid = iks_find_attrib(pak->x, "id"); - char *type = iks_find_attrib(pak->x, "type"); - 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); - - if (is_error) { - if ((xerror = working_find(xml, "error"))) { - char *code = iks_find_attrib(xerror, "code"); - if (code && !strcmp(code, "302") && - ((xredir = iks_find(xerror, "ses:redirect")) || (xredir = iks_find(xerror, "redirect")))) { - is_result = 0; - is_error = 0; - cancel_retry(handle, iqid); - } - } - } - - - if (is_result) { - iks *tag = iks_child (pak->x); - while(tag) { - if (!strcasecmp(iks_name_nons(tag), "bind")) { - char *jid = iks_find_cdata(tag, "jid"); - char *resource = strchr(jid, '/'); - if (resource) { - resource++; - handle->acc->resource = apr_pstrdup(handle->pool, resource); - } - handle->login = apr_pstrdup(handle->pool, jid); -#if 0 - if ((iq = iks_new("iq"))) { - iks_insert_attrib(iq, "type", "get"); - iks_insert_attrib(iq, "id", "roster"); - x = iks_insert(iq, "query"); - iks_insert_attrib(x, "xmlns", "jabber:iq:roster"); - iks_insert_attrib(x, "xmlns:gr", "google:roster"); - iks_insert_attrib(x, "gr:ext", "2"); - iks_insert_attrib(x, "gr:include", "all"); - apr_queue_push(handle->queue, iq); - iq = NULL; - break; - } -#endif - } - tag = iks_next_tag(tag); - } - } - - - - if ((is_result || is_error) && iqid && from) { - - cancel_retry(handle, iqid); - - if (is_result) { - if (handle->response_callback) { - handle->response_callback(handle, iqid); - } - return IKS_FILTER_EAT; - } else if (is_error) { - return IKS_FILTER_EAT; - - } - } - - - - 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"); - - if (xredir) { - to = iks_cdata(iks_child(xredir)); - type = "redirect"; - } - - if (strcasecmp(type, "error") && strcasecmp(type, "redirect")) { - type = NULL; - } - - if (parse_session_code(handle, id, from, to, xsession, 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; - } - } - } - - return IKS_FILTER_EAT; -} - - -static int on_result(void *user_data, ikspak *pak) -{ - ldl_handle_t *handle = user_data; - iks *msg, *ctag, *tag; - - if ((msg = iks_make_pres (IKS_SHOW_AVAILABLE, handle->status_msg))) { - 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 video-v1"); - iks_insert_attrib(ctag, "client", "libdingaling"); - iks_insert_attrib(ctag, "xmlns", "http://jabber.org/protocol/caps"); - - if (handle->priority && strlen(handle->priority)) { - tag = iks_insert (msg, "priority"); - iks_insert_cdata(tag, handle->priority, 0); - } - - apr_queue_push(handle->queue, msg); - msg = NULL; - } - return IKS_FILTER_EAT; -} - -static const char c64[65] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -#define B64BUFFLEN 1024 - -static int b64encode(unsigned char *in, size_t ilen, unsigned char *out, size_t olen) -{ - int y=0,bytes=0; - size_t x=0; - unsigned int b=0,l=0; - - for(x=0;x= 6) { - out[bytes++] = c64[(b>>(l-=6))%64]; - if(++y!=72) { - continue; - } - //out[bytes++] = '\n'; - y=0; - } - } - - if (l > 0) { - out[bytes++] = c64[((b%16)<<(6-l))%64]; - } - if (l != 0) while (l < 6) { - out[bytes++] = '=', l += 2; - } - - return 0; -} - -static void sha1_hash(char *out, unsigned char *in, unsigned int len) -{ - SHA1Context sha; - char *p; - int x; - unsigned char digest[SHA1_HASH_SIZE] = ""; - - SHA1Init(&sha); - - SHA1Update(&sha, in, len); - - SHA1Final(&sha, digest); - - p = out; - for (x = 0; x < SHA1_HASH_SIZE; x++) { - p += sprintf(p, "%2.2x", digest[x]); - } -} - - -static int on_stream_component(ldl_handle_t *handle, int type, iks *node) -{ - ikspak *pak = NULL; - - if (node) { - pak = iks_packet(node); - } - - switch (type) { - case IKS_NODE_START: - if (pak && handle->state == CS_NEW) { - char secret[256] = ""; - char hash[256] = ""; - char handshake[512] = ""; - - snprintf(secret, sizeof(secret), "%s%s", pak->id, handle->password); - sha1_hash(hash, (unsigned char *) secret, (unsigned int)strlen(secret)); - snprintf(handshake, sizeof(handshake), "%s", hash); - iks_send_raw(handle->parser, handshake); - handle->state = CS_START; - if (iks_recv(handle->parser, 1) == 2) { - handle->state = CS_CONNECTED; - if (!ldl_test_flag(handle, LDL_FLAG_AUTHORIZED)) { - do_roster(handle); - 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"); - ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED); - ldl_set_flag_locked(handle, LDL_FLAG_CONNECTED); - handle->fail_count = 0; - } - } else { - globals.logger(DL_LOG_ERR, "LOGIN ERROR!\n"); - handle->state = CS_NEW; - } - break; - } - break; - - case IKS_NODE_NORMAL: - break; - - case IKS_NODE_ERROR: - globals.logger(DL_LOG_ERR, "NODE ERROR!\n"); - return IKS_HOOK; - - case IKS_NODE_STOP: - globals.logger(DL_LOG_ERR, "DISCONNECTED!\n"); - return IKS_HOOK; - } - - iks_filter_packet(handle->filter, pak); - - if (handle->job_done == 1) { - return IKS_HOOK; - } - - if (node) { - iks_delete(node); - } - - return IKS_OK; -} - -static int on_stream(ldl_handle_t *handle, int type, iks *node) -{ - handle->counter = opt_timeout; - - - switch (type) { - case IKS_NODE_START: - if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser)) { - if (iks_has_tls()) { - iks_start_tls(handle->parser); - } else { - globals.logger(DL_LOG_WARNING, "TLS NOT SUPPORTED IN THIS BUILD!\n"); - } - } - break; - case IKS_NODE_NORMAL: - if (node && strcmp("stream:features", iks_name(node)) == 0) { - handle->features = iks_stream_features(node); - if (ldl_test_flag(handle, LDL_FLAG_TLS) && !iks_is_secure(handle->parser)) - break; - if (ldl_test_flag(handle, LDL_FLAG_CONNECTED)) { - iks *t; - if (handle->features & IKS_STREAM_BIND) { - if ((t = iks_make_resource_bind(handle->acc))) { - apr_queue_push(handle->queue, t); - t = NULL; - } - } - if (handle->features & IKS_STREAM_SESSION) { - if ((t = iks_make_session())) { - iks_insert_attrib(t, "id", "auth"); - apr_queue_push(handle->queue, t); - t = NULL; - } - } - } else { - if (handle->features & IKS_STREAM_SASL_MD5) { - iks_start_sasl(handle->parser, IKS_SASL_DIGEST_MD5, handle->acc->user, handle->password); - } else if (handle->features & IKS_STREAM_SASL_PLAIN) { - iks *x = NULL; - - if ((x = iks_new("auth"))) { - char s[512] = ""; - char base64[1024] = ""; - uint32_t slen; - - iks_insert_attrib(x, "xmlns", IKS_NS_XMPP_SASL); - iks_insert_attrib(x, "mechanism", "PLAIN"); - iks_insert_attrib(x, "encoding", "UTF-8"); - snprintf(s, sizeof(s), "%c%s%c%s", 0, handle->acc->user, 0, handle->password); - slen = (uint32_t)(strlen(handle->acc->user) + strlen(handle->password) + 2); - b64encode((unsigned char *)s, slen, (unsigned char *) base64, sizeof(base64)); - iks_insert_cdata(x, base64, 0); - apr_queue_push(handle->queue, x); - x = NULL; - } else { - globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); - break; - } - - } - } - } else if (node && strcmp("failure", iks_name_nons(node)) == 0) { - 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_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) { - handle->session_callback(handle, NULL, LDL_SIGNAL_CONNECTED, "user", "core", "Server Connected", handle->login); - } - } else { - ikspak *pak; - if (!ldl_test_flag(handle, LDL_FLAG_AUTHORIZED)) { - if (handle->session_callback) { - handle->session_callback(handle, NULL, LDL_SIGNAL_LOGIN_SUCCESS, "user", "core", "Login Success", handle->login); - } - globals.logger(DL_LOG_NOTICE, "XMPP authenticated\n"); - ldl_set_flag_locked(handle, LDL_FLAG_AUTHORIZED); - } - if (node) { - pak = iks_packet(node); - iks_filter_packet(handle->filter, pak); - } - if (handle->job_done == 1) { - return IKS_HOOK; - } - } - break; -#if 0 - case IKS_NODE_STOP: - globals.logger(DL_LOG_DEBUG, "server disconnected\n"); - break; - - case IKS_NODE_ERROR: - globals.logger(DL_LOG_DEBUG, "stream error\n"); - break; -#endif - - } - - if (node) { - iks_delete(node); - } - return IKS_OK; -} - -static int on_msg(void *user_data, ikspak *pak) -{ - char *cmd = iks_find_cdata(pak->x, "body"); - char *to = iks_find_attrib(pak->x, "to"); - char *from = iks_find_attrib(pak->x, "from"); - char *subject = iks_find_attrib(pak->x, "subject"); - ldl_handle_t *handle = user_data; - ldl_session_t *session = NULL; - - if (from) { - session = apr_hash_get(handle->sessions, from, APR_HASH_KEY_STRING); - } - - if (handle->session_callback) { - handle->session_callback(handle, session, LDL_SIGNAL_MSG, to, from, subject ? subject : "N/A", cmd); - } - - return 0; -} - -static int on_error(void *user_data, ikspak * pak) -{ - 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); - } - } -} - -static void j_setup_filter(ldl_handle_t *handle) -{ - int x = 0; - - if (handle->filter) { - iks_filter_delete(handle->filter); - } - handle->filter = iks_filter_new(); - - iks_filter_add_rule(handle->filter, on_msg, handle, IKS_RULE_TYPE, IKS_PAK_MESSAGE, IKS_RULE_SUBTYPE, IKS_TYPE_CHAT, IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_result, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, IKS_RULE_ID, "auth", IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_presence, handle, - IKS_RULE_TYPE, IKS_PAK_PRESENCE, - //IKS_RULE_SUBTYPE, IKS_TYPE_SET, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_commands, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_SET, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_commands, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_RESULT, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_commands, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_ERROR, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_subscribe, handle, - IKS_RULE_TYPE, IKS_PAK_S10N, - IKS_RULE_SUBTYPE, IKS_TYPE_SUBSCRIBE, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_unsubscribe, handle, - IKS_RULE_TYPE, IKS_PAK_S10N, - IKS_RULE_SUBTYPE, IKS_TYPE_UNSUBSCRIBE, - IKS_RULE_DONE); - - iks_filter_add_rule(handle->filter, on_error, handle, - IKS_RULE_TYPE, IKS_PAK_IQ, - IKS_RULE_SUBTYPE, IKS_TYPE_ERROR, IKS_RULE_ID, "auth", IKS_RULE_DONE); - - for (x = 0; FEATURES[x].name; x++) { - iks_filter_add_rule(handle->filter, FEATURES[x].callback, handle, - IKS_RULE_NS, FEATURES[x].name, IKS_RULE_DONE); - } -} - -static ldl_queue_t ldl_flush_queue(ldl_handle_t *handle, int done) -{ - iks *msg; - void *pop = NULL; - unsigned int len = 0, x = 0; - - ldl_queue_t sent_data = LDL_QUEUE_NONE; - - apr_thread_mutex_lock(handle->lock); - - 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"); - }; - }; - iks_delete(msg); - pop = NULL; - sent_data = LDL_QUEUE_SENT; - } else { - break; - } - } - - len = apr_queue_size(handle->retry_queue); - if (globals.debug && len) { - globals.logger(DL_LOG_CRIT, "Processing %u packets in retry queue\n", len); - } - - pop = NULL; - - while(x < len && apr_queue_trypop(handle->retry_queue, &pop) == APR_SUCCESS) { - if (!pop) { - break; - } else { - struct packet_node *packet_node = (struct packet_node *) pop; - apr_time_t now = apr_time_now(); - x++; - - if (packet_node->next <= now) { - if (packet_node->retries > 0) { - packet_node->retries--; - if (globals.debug) { - 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"); - }; - packet_node->next = now + 5000000; - sent_data = LDL_QUEUE_SENT; - } - } - if (packet_node->retries == 0 || done) { - if (globals.debug) { - 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); - free(packet_node); - } else { - apr_queue_push(handle->retry_queue, packet_node); - packet_node = NULL; - } - pop = NULL; - } - } - apr_thread_mutex_unlock(handle->lock); - return sent_data; -} - - -static void xmpp_connect(ldl_handle_t *handle, char *jabber_id, char *pass) -{ - int count_ka = LDL_KEEPALIVE_TIMEOUT; - time_t tstart, tnow; - - while (ldl_test_flag((&globals), LDL_FLAG_READY) && ldl_test_flag(handle, LDL_FLAG_RUNNING)) { - int e; - char tmp[512], *sl; - int fd; - - handle->parser = iks_stream_new(ldl_test_flag(handle, LDL_FLAG_COMPONENT) ? IKS_NS_COMPONENT : IKS_NS_CLIENT, - handle, - (iksStreamHook *) (ldl_test_flag(handle, LDL_FLAG_COMPONENT) ? on_stream_component : on_stream)); - - - iks_set_log_hook(handle->parser, (iksLogHook *) on_log); - - - strncpy(tmp, jabber_id, sizeof(tmp)-1); - sl = strchr(tmp, '/'); - - if (!sl && !ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - /* user gave no resource name, use the default */ - snprintf(tmp + strlen(tmp), sizeof(tmp) - strlen(tmp), "/%s", "talk"); - } else if (sl && ldl_test_flag(handle, LDL_FLAG_COMPONENT)) { - *sl = '\0'; - } - - handle->acc = iks_id_new(iks_parser_stack(handle->parser), tmp); - - handle->password = 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, - handle->acc->server); - - switch (e) { - case IKS_OK: - break; - case IKS_NET_NODNS: - globals.logger(DL_LOG_CRIT, "hostname lookup failed\n"); - microsleep(1000); - goto fail; - case IKS_NET_NOCONN: - globals.logger(DL_LOG_CRIT, "connection failed\n"); - microsleep(1000); - goto fail; - default: - 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 (handle->loop_callback) { - if (handle->loop_callback(handle) != LDL_STATUS_SUCCESS) { - ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); - break; - } - } - - if (handle->job_done) { - break; - } - - if (IKS_HOOK == e) { - break; - } - - 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; - } - 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; - } - } - - if (!ldl_test_flag(handle, LDL_FLAG_CONNECTED)) { - handle->counter--; - - if (IKS_NET_TLSFAIL == e) { - globals.logger(DL_LOG_CRIT, "tls handshake failed\n"); - microsleep(500); - break; - } - - if (handle->counter == 0) { - globals.logger(DL_LOG_CRIT, "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"); - microsleep(500); - break; - } - } - - } - - fail: - - ldl_clear_flag_locked(handle, LDL_FLAG_CONNECTED); - ldl_clear_flag_locked(handle, LDL_FLAG_AUTHORIZED); - ldl_clear_flag_locked(handle, LDL_FLAG_BREAK); - handle->state = CS_NEW; - - if ((fd = iks_fd(handle->parser)) > -1) { - shutdown(fd, 0x02); - } - - iks_disconnect(handle->parser); - iks_parser_delete(handle->parser); - } - ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); - - ldl_flush_queue(handle, 1); - - ldl_set_flag_locked(handle, LDL_FLAG_STOPPED); - -} - -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; - - apr_hash_this(hi, &key, NULL, &val); - if (val) { - iks *var = iks_insert(tag, "info_element"); - iks_insert_attrib(var, "xmlns", "http://www.freeswitch.org/jie"); - iks_insert_attrib(var, "name", (char *) key); - iks_insert_attrib(var, "value", (char *) val); - } - } -} - - -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; - 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); - sess = iks_insert (iq, "ses:session"); - iks_insert_attrib(sess, "xmlns:ses", "http://www.google.com/session"); - - iks_insert_attrib(sess, "type", type); - iks_insert_attrib(sess, "id", session->id); - iks_insert_attrib(sess, "initiator", session->initiator ? session->initiator : session->them); - - *sessp = sess; - *iqp = iq; - *id = myid; - return LDL_STATUS_SUCCESS; -} - -static void schedule_packet(ldl_handle_t *handle, unsigned int id, iks *xml, unsigned int retries) -{ - struct packet_node *packet_node; - - apr_thread_mutex_lock(handle->lock); - if ((packet_node = malloc(sizeof(*packet_node)))) { - memset(packet_node, 0, sizeof(*packet_node)); - snprintf(packet_node->id, sizeof(packet_node->id), "%u", id); - packet_node->xml = xml; - packet_node->retries = retries; - packet_node->next = apr_time_now(); - apr_hash_set(handle->retry_hash, packet_node->id, APR_HASH_KEY_STRING, packet_node); - apr_queue_push(handle->retry_queue, packet_node); - packet_node = NULL; - } - apr_thread_mutex_unlock(handle->lock); - -} - -char *ldl_session_get_caller(ldl_session_t *session) -{ - return session->them; -} - -char *ldl_session_get_callee(ldl_session_t *session) -{ - return session->login; -} - -void ldl_session_set_ip(ldl_session_t *session, char *ip) -{ - session->ip = apr_pstrdup(session->pool, ip); -} - -char *ldl_session_get_ip(ldl_session_t *session) -{ - return session->ip; -} - -void ldl_session_set_private(ldl_session_t *session, void *private_data) -{ - session->private_data = private_data; -} - -void *ldl_session_get_private(ldl_session_t *session) -{ - return session->private_data; -} - -void ldl_session_accept_candidate(ldl_session_t *session, ldl_candidate_t *candidate) -{ - iks *iq, *sess, *tp; - unsigned int myid; - char idbuf[80]; - myid = next_id(); - snprintf(idbuf, sizeof(idbuf), "%u", myid); - - if ((iq = iks_new("iq"))) { - if (!iks_insert_attrib(iq, "type", "set")) goto fail; - if (!iks_insert_attrib(iq, "id", idbuf)) goto fail; - if (!iks_insert_attrib(iq, "from", session->login)) goto fail; - if (!iks_insert_attrib(iq, "to", session->them)) goto fail; - if (!(sess = iks_insert (iq, "ses:session"))) goto fail; - if (!iks_insert_attrib(sess, "xmlns:ses", "http://www.google.com/session")) goto fail; - if (!iks_insert_attrib(sess, "type", "transport-accept")) goto fail; - if (!iks_insert_attrib(sess, "id", candidate->tid)) goto fail; - if (!iks_insert_attrib(sess, "xmlns", "http://www.google.com/session")) goto fail; - if (!iks_insert_attrib(sess, "initiator", session->initiator ? session->initiator : session->them)) goto fail; - if (!(tp = iks_insert (sess, "transport"))) goto fail; - if (!iks_insert_attrib(tp, "xmlns", "http://www.google.com/transport/p2p")) goto fail; - apr_queue_push(session->handle->queue, iq); - iq = NULL; - } - - fail: - if (iq) { - iks_delete(iq); - } - -} - -void *ldl_handle_get_private(ldl_handle_t *handle) -{ - return handle->private_info; -} - -char *ldl_handle_get_login(ldl_handle_t *handle) -{ - return handle->login; -} - -void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message, char *avatar) -{ - do_presence(handle, from, to, type, rpid, message, avatar); -} - -static void ldl_random_string(char *buf, uint16_t len, char *set) -{ - char chars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; - int max; - uint16_t x; - - if (!set) { - set = chars; - } - - max = (int) strlen(set); - - srand((unsigned int) time(NULL)); - - for (x = 0; x < len; x++) { - int j = (int) (max * 1.0 * rand() / (RAND_MAX + 1.0)); - buf[x] = set[j]; - } -} - -#define TLEN 8192 -void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, char *vcard) -{ - iks *vxml = NULL, *iq = NULL; - int e = 0; - ldl_avatar_t *ap = NULL; - char *text = NULL; - - ap = ldl_get_avatar(handle, NULL, from); - - if (!vcard) { - char *ext; - - if (!ap) { - return; - } - - if ((ext = strrchr(ap->path, '.'))) { - ext++; - } else { - ext = "png"; - } - text = malloc(TLEN); - snprintf(text, TLEN, - "image/%s%s", - ext, - ap->base64 - ); - vcard = text; - } else { - if (ap && (strstr(vcard, "photo") || strstr(vcard, "PHOTO"))) { - ldl_random_string(ap->hash, sizeof(ap->hash) -1, NULL); - } - } - - - if (!(vxml = iks_tree(vcard, 0, &e))) { - globals.logger(DL_LOG_ERR, "Parse returned error [%d]\n", e); - goto fail; - } - - if (!(iq = iks_new("iq"))) { - globals.logger(DL_LOG_ERR, "Memory Error\n"); - goto fail; - } - - if (!iks_insert_attrib(iq, "to", to)) goto fail; - if (!iks_insert_attrib(iq, "xmlns", "jabber:client")) goto fail; - if (!iks_insert_attrib(iq,"from", from)) goto fail; - if (!iks_insert_attrib(iq, "type", "result")) goto fail; - if (!iks_insert_attrib(iq, "id", id)) goto fail; - if (!iks_insert_node(iq, vxml)) goto fail; - - apr_queue_push(handle->queue, iq); - - iq = NULL; - vxml = NULL; - - fail: - - if (iq) { - iks_delete(iq); - } - - if (vxml) { - iks_delete(vxml); - } - - if (text) { - free(text); - } - -} - -void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body) -{ - iks *msg; - char *t, *e; - char *bdup = NULL; - int on = 0; - int len = 0; - char *my_body = strdup(body); - char *my_body_base = my_body; - - assert(handle != NULL); - assert(body != NULL); - - if (strchr(my_body, '<')) { - len = (int) strlen(my_body); - if (!(bdup = malloc(len))) { - if (my_body_base) { - free(my_body_base); - } - return; - } - - memset(bdup, 0, len); - - e = bdup; - for(t = my_body; *t; t++) { - if (*t == '<') { - on = 1; - } else if (*t == '>') { - t++; - on = 0; - } - - if (!on) { - *e++ = *t; - } - } - my_body = bdup; - } - - msg = iks_make_msg(IKS_TYPE_NONE, to, my_body); - iks_insert_attrib(msg, "type", "chat"); - - if (!from) { - from = handle->login; - } - - iks_insert_attrib(msg, "from", from); - - if (subject) { - iks_insert_attrib(msg, "subject", subject); - } - - if (bdup) { - free(bdup); - } - - if (my_body_base) { - free(my_body_base); - } - - apr_queue_push(handle->queue, msg); - msg = NULL; - -} - -int ldl_global_debug(int on) -{ - if (on > -1) { - globals.debug = on ? 1 : 0; - } - - return globals.debug ? 1 : 0; -} - -void ldl_global_set_logger(ldl_logger_t logger) -{ - globals.logger = logger; -} - -unsigned int ldl_session_terminate(ldl_session_t *session) -{ - iks *iq, *sess; - unsigned int id; - 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) { - apr_hash_set(hash, session->id, APR_HASH_KEY_STRING, NULL); - } - - if (session->them) { - apr_hash_set(hash, session->them, APR_HASH_KEY_STRING, NULL); - } - - return id; - -} - - - -unsigned int ldl_session_transport(ldl_session_t *session, - ldl_candidate_t *candidates, - unsigned int clen) - -{ - iks *iq, *sess, *tag; - 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; - sess = NULL; - id = 0; - - new_session_iq(session, &iq, &sess, &id, "transport-info"); - - tag = sess; - - //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"); - - 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); - } - - return id; -} - -unsigned int ldl_session_candidates(ldl_session_t *session, - ldl_candidate_t *candidates, - unsigned int clen) - -{ - 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; - 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; - - tag = iks_insert(sess, "ses: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); - - return id; -} - - - -char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len) -{ - iks *pres, *msg; - char *lid = NULL, *low_id = NULL; - struct ldl_buffer buffer; - time_t started, elapsed, next = 0; - char *notice = "Call Me!"; - - buffer.buf = buf; - buffer.len = len; - buffer.hit = 0; - - apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, &buffer); - - started = time(NULL); - for(;;) { - elapsed = time(NULL) - started; - if (elapsed == next) { - msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); - iks_insert_attrib(msg, "from", from); - apr_queue_push(handle->queue, msg); - msg = NULL; - - pres = iks_new("presence"); - iks_insert_attrib(pres, "xmlns", "jabber:client"); - iks_insert_attrib(pres, "type", "probe"); - iks_insert_attrib(pres, "to", id); - iks_insert_attrib(pres, "from", from); - apr_queue_push(handle->queue, pres); - pres = NULL; - next += 5; - } - if (elapsed >= 17) { - break; - } - if (buffer.hit) { - lid = buffer.buf; - break; - } - ldl_yield(1000); - } - - if ((low_id = strdup(id))) { - lowercase(id); - apr_hash_set(handle->probe_hash, low_id, APR_HASH_KEY_STRING, NULL); - free(low_id); - } - - return lid; -} - - -char *ldl_handle_disco(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len) -{ - iks *iq, *query, *msg; - char *lid = NULL; - struct ldl_buffer buffer; - apr_time_t started; - unsigned int elapsed; - char *notice = "Call Me!"; - int again = 0; - unsigned int myid; - char idbuf[80]; - - myid = next_id(); - snprintf(idbuf, sizeof(idbuf), "%u", myid); - - buffer.buf = buf; - buffer.len = len; - buffer.hit = 0; - - if ((iq = iks_new("iq"))) { - if ((query = iks_insert(iq, "query"))) { - iks_insert_attrib(iq, "type", "get"); - iks_insert_attrib(iq, "to", id); - iks_insert_attrib(iq,"from", from); - iks_insert_attrib(iq, "id", idbuf); - iks_insert_attrib(query, "xmlns", "http://jabber.org/protocol/disco#info"); - } else { - iks_delete(iq); - globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); - return NULL; - } - } else { - globals.logger(DL_LOG_CRIT, "Memory ERROR!\n"); - return NULL; - } - - apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, &buffer); - msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); - apr_queue_push(handle->queue, msg); - msg = NULL; - msg = iks_make_s10n (IKS_TYPE_SUBSCRIBED, id, notice); - apr_queue_push(handle->queue, msg); - msg = NULL; - apr_queue_push(handle->queue, iq); - iq = NULL; - - //schedule_packet(handle, next_id(), pres, LDL_RETRY); - - started = apr_time_now(); - for(;;) { - elapsed = (unsigned int)((apr_time_now() - started) / 1000); - if (elapsed > 5000 && ! again) { - msg = iks_make_s10n (IKS_TYPE_SUBSCRIBE, id, notice); - apr_queue_push(handle->queue, msg); - msg = NULL; - again++; - } - if (elapsed > 10000) { - break; - } - if (buffer.hit) { - lid = buffer.buf; - break; - } - ldl_yield(1000); - } - - apr_hash_set(handle->probe_hash, id, APR_HASH_KEY_STRING, NULL); - return lid; -} - - - -unsigned int ldl_session_describe(ldl_session_t *session, - 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; - 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; - - - 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); - } - - } 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; -} - -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_transport_type_t tport, ldl_candidate_t **candidates, unsigned int *len) -{ - assert(tport < LDL_TPORT_MAX); - - if (session->candidate_len[tport]) { - *candidates = session->candidates[tport]; - *len = session->candidate_len[tport]; - return LDL_STATUS_SUCCESS; - } else { - *candidates = NULL; - *len = 0; - return LDL_STATUS_FALSE; - } -} - -ldl_status ldl_session_get_payloads(ldl_session_t *session, ldl_payload_t **payloads, unsigned int *len) -{ - if (session->payload_len) { - *payloads = session->payloads; - *len = session->payload_len; - return LDL_STATUS_SUCCESS; - } else { - *payloads = NULL; - *len = 0; - return LDL_STATUS_FALSE; - } -} - -ldl_status ldl_global_terminate(void) -{ - if (globals.flag_mutex) { - ldl_clear_flag_locked((&globals), LDL_FLAG_READY); - } else { - ldl_clear_flag((&globals), LDL_FLAG_READY); - } - return LDL_STATUS_SUCCESS; -} - -ldl_status ldl_global_init(int debug) -{ - if (ldl_test_flag((&globals), LDL_FLAG_INIT)) { - return LDL_STATUS_FALSE; - } - - if (apr_initialize() != LDL_STATUS_SUCCESS) { - apr_terminate(); - return LDL_STATUS_MEMERR; - } - - memset(&globals, 0, sizeof(globals)); - - if (apr_pool_create(&globals.memory_pool, NULL) != LDL_STATUS_SUCCESS) { - globals.logger(DL_LOG_CRIT, "Could not allocate memory pool\n"); - return LDL_STATUS_MEMERR; - } - - apr_thread_mutex_create(&globals.flag_mutex, APR_THREAD_MUTEX_NESTED, globals.memory_pool); - globals.log_stream = stdout; - globals.debug = debug; - globals.id = 300; - globals.logger = default_logger; - globals.avatar_hash = apr_hash_make(globals.memory_pool); - ldl_set_flag_locked((&globals), LDL_FLAG_INIT); - ldl_set_flag_locked((&globals), LDL_FLAG_READY); - - return LDL_STATUS_SUCCESS; -} - -ldl_status ldl_global_destroy(void) -{ - if (!ldl_test_flag(&globals, LDL_FLAG_INIT)) { - return LDL_STATUS_FALSE; - } - - apr_pool_destroy(globals.memory_pool); - ldl_clear_flag(&globals, LDL_FLAG_INIT); - apr_terminate(); - - return LDL_STATUS_SUCCESS; -} - -void ldl_global_set_log_stream(FILE *log_stream) -{ - assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); - - globals.log_stream = log_stream; -} - -int8_t ldl_handle_ready(ldl_handle_t *handle) -{ - return (int8_t) (ldl_test_flag(handle, LDL_FLAG_RUNNING) && ldl_test_flag((&globals), LDL_FLAG_READY)); -} - -ldl_status ldl_handle_init(ldl_handle_t **handle, - char *login, - char *password, - char *server, - ldl_user_flag_t flags, - char *status_msg, - char *priority, - ldl_loop_callback_t loop_callback, - ldl_session_callback_t session_callback, - ldl_response_callback_t response_callback, - void *private_info) -{ - apr_pool_t *pool; - assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); - *handle = NULL; - - if ((apr_pool_create(&pool, globals.memory_pool)) != LDL_STATUS_SUCCESS) { - return LDL_STATUS_MEMERR; - } - - if (!login) { - globals.logger(DL_LOG_ERR, "No login supplied!\n"); - return LDL_STATUS_FALSE; - } - - if (!password) { - globals.logger(DL_LOG_ERR, "No password supplied!\n"); - return LDL_STATUS_FALSE; - } - - - if ((*handle = apr_palloc(pool, sizeof(ldl_handle_t)))) { - ldl_handle_t *new_handle = *handle; - memset(new_handle, 0, sizeof(ldl_handle_t)); - new_handle->log_stream = globals.log_stream; - new_handle->login = apr_pstrdup(pool, login); - new_handle->password = apr_pstrdup(pool, password); - - if (server) { - char *p; - - new_handle->server = apr_pstrdup(pool, server); - if ((p = strchr(new_handle->server, ':'))) { - *p++ = '\0'; - new_handle->port = (uint16_t)atoi(p); - } - } - - if (status_msg) { - new_handle->status_msg = apr_pstrdup(pool, status_msg); - } - - if (priority) { - new_handle->priority = apr_pstrdup(pool, priority); - } - - if (loop_callback) { - new_handle->loop_callback = loop_callback; - } - - if (session_callback) { - new_handle->session_callback = session_callback; - } - - if (response_callback) { - new_handle->response_callback = response_callback; - } - - new_handle->private_info = private_info; - new_handle->pool = pool; - new_handle->flags |= flags; - apr_queue_create(&new_handle->queue, LDL_HANDLE_QLEN, new_handle->pool); - apr_queue_create(&new_handle->retry_queue, LDL_HANDLE_QLEN, new_handle->pool); - new_handle->features |= IKS_STREAM_BIND|IKS_STREAM_SESSION; - - if (new_handle->flags & LDL_FLAG_SASL_PLAIN) { - new_handle->features |= IKS_STREAM_SASL_PLAIN; - } else if (new_handle->flags & LDL_FLAG_SASL_MD5) { - new_handle->features |= IKS_STREAM_SASL_MD5; - } - - new_handle->sessions = apr_hash_make(new_handle->pool); - new_handle->retry_hash = apr_hash_make(new_handle->pool); - new_handle->probe_hash = apr_hash_make(new_handle->pool); - new_handle->sub_hash = apr_hash_make(new_handle->pool); - apr_thread_mutex_create(&new_handle->lock, APR_THREAD_MUTEX_NESTED, new_handle->pool); - apr_thread_mutex_create(&new_handle->flag_mutex, APR_THREAD_MUTEX_NESTED, new_handle->pool); - - return LDL_STATUS_SUCCESS; - } - - return LDL_STATUS_FALSE; -} - -void ldl_handle_run(ldl_handle_t *handle) -{ - ldl_clear_flag_locked(handle, LDL_FLAG_STOPPED); - ldl_set_flag_locked(handle, LDL_FLAG_RUNNING); - xmpp_connect(handle, handle->login, handle->password); - ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); -} - -int ldl_handle_running(ldl_handle_t *handle) -{ - return ldl_test_flag(handle, LDL_FLAG_RUNNING) ? 1 : 0; -} - - -void ldl_session_set_gateway(ldl_session_t *session) -{ - ldl_set_flag(session, LDL_FLAG_GATEWAY); -} - -int ldl_session_gateway(ldl_session_t *session) -{ - return ldl_test_flag(session, LDL_FLAG_GATEWAY) ? 1 : 0; -} - -int ldl_handle_connected(ldl_handle_t *handle) -{ - return ldl_test_flag(handle, LDL_FLAG_CONNECTED) ? 1 : 0; -} - -int ldl_handle_authorized(ldl_handle_t *handle) -{ - return ldl_test_flag(handle, LDL_FLAG_AUTHORIZED) ? 1 : 0; -} - -void ldl_handle_stop(ldl_handle_t *handle) -{ - ldl_clear_flag_locked(handle, LDL_FLAG_RUNNING); -#if 0 - if (ldl_test_flag(handle, LDL_FLAG_TLS)) { - int fd; - if ((fd = iks_fd(handle->parser)) > -1) { - shutdown(fd, 0x02); - } - } -#endif - - while(!ldl_test_flag(handle, LDL_FLAG_STOPPED)) { - microsleep(100); - } - -} - -ldl_status ldl_handle_destroy(ldl_handle_t **handle) -{ - apr_pool_t *pool = (*handle)->pool; - - ldl_handle_stop(*handle); - ldl_flush_queue(*handle, 1); - - - apr_pool_destroy(pool); - *handle = NULL; - return LDL_STATUS_SUCCESS; -} - - -void ldl_handle_set_log_stream(ldl_handle_t *handle, FILE *log_stream) -{ - assert(ldl_test_flag(&globals, LDL_FLAG_INIT)); - - handle->log_stream = log_stream; -} - -/* 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 noet: - */ diff --git a/libs/libdingaling/src/libdingaling.h b/libs/libdingaling/src/libdingaling.h deleted file mode 100644 index 05fafc6da9..0000000000 --- a/libs/libdingaling/src/libdingaling.h +++ /dev/null @@ -1,751 +0,0 @@ -/* - * libDingaLing XMPP Jingle Library - * Copyright (C) 2005-2014, 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 libDingaLing XMPP Jingle Library - * - * 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 - * - * libdingaling.h -- Main Header File - * - */ - -/*! \file libdingaling.h - \brief Main Header File -*/ - -/*! - \defgroup core1 libDingaLing Library - \ingroup LIBDINGALING - \{ -*/ -/* OMG */ -#ifdef _MSC_VER -#define __LDL_FUNC__ __FUNCTION__ -#define inline __inline -#else -#define __LDL_FUNC__ (const char *)__func__ -#endif - -#ifndef LIBDINGALING_H -#define LIBDINGALING_H -#ifdef __cplusplus -extern "C" { -#endif -#ifdef __STUPIDFORMATBUG__ -} -#endif - -#if defined (__SVR4) && defined (__sun) -#define __EXTENSIONS__ 1 -#include -#endif - -#define LDL_HANDLE_QLEN 2000 -#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 - -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 { - /*! the transport id of the candidate */ - char *tid; - /*! the name of the candidate */ - char *name; - /*! the type of the candidate */ - char *type; - /*! the protocol of the candidate */ - char *protocol; - /*! the STUN username of the candidate */ - char *username; - /*! the STUN password of the candidate */ - char *password; - /*! the ip address of the candidate */ - char *address; - /*! the stun/rtp port of the candidate */ - uint16_t port; - /*! the preference level of the candidate */ - double pref; -}; -typedef struct ldl_candidate ldl_candidate_t; - -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; - -struct ldl_session; -typedef struct ldl_session ldl_session_t; - -typedef enum { - LDL_STATUS_SUCCESS, - LDL_STATUS_FALSE, - LDL_STATUS_MEMERR, -} ldl_status; - -typedef enum { - LDL_FLAG_INIT = (1 << 0), - LDL_FLAG_RUNNING = (1 << 1), - LDL_FLAG_AUTHORIZED = (1 << 2), - LDL_FLAG_READY = (1 << 3), - LDL_FLAG_CONNECTED = (1 << 4), - LDL_FLAG_STOPPED = (1 << 5), - LDL_FLAG_BREAK = (1 << 6) -} ldl_flag_t; - -typedef enum { - LDL_FLAG_NONE = 0, - LDL_FLAG_TLS = (1 << 10), - LDL_FLAG_SASL_PLAIN = (1 << 11), - LDL_FLAG_SASL_MD5 = (1 << 12), - LDL_FLAG_COMPONENT = (1 << 13), - LDL_FLAG_OUTBOUND = (1 << 14), - LDL_FLAG_GATEWAY = (1 << 15), - LDL_FLAG_JINGLE = (1 << 16) -} ldl_user_flag_t; - -typedef enum { - LDL_SIGNAL_NONE, - LDL_SIGNAL_INITIATE, - LDL_SIGNAL_CANDIDATES, - LDL_SIGNAL_MSG, - LDL_SIGNAL_PRESENCE_IN, - LDL_SIGNAL_PRESENCE_OUT, - LDL_SIGNAL_PRESENCE_PROBE, - LDL_SIGNAL_ROSTER, - LDL_SIGNAL_SUBSCRIBE, - LDL_SIGNAL_UNSUBSCRIBE, - LDL_SIGNAL_VCARD, - LDL_SIGNAL_TERMINATE, - LDL_SIGNAL_ERROR, - LDL_SIGNAL_LOGIN_SUCCESS, - LDL_SIGNAL_LOGIN_FAILURE, - LDL_SIGNAL_CONNECTED, - LDL_SIGNAL_TRANSPORT_ACCEPT, - LDL_SIGNAL_REJECT, - LDL_SIGNAL_REDIRECT -} ldl_signal_t; - -typedef enum { - LDL_REPLY_ACK, - LDL_REPLY_NACK, -} ldl_reply_t; - -typedef enum { - LDL_STATE_NEW, - LDL_STATE_ANSWERED, - LDL_STATE_DESTROYED, -} ldl_state_t; - -typedef enum { - LDL_DESCRIPTION_INITIATE, - LDL_DESCRIPTION_ACCEPT -} ldl_description_t; - -typedef enum { - LDL_QUEUE_NONE, - LDL_QUEUE_SENT -} ldl_queue_t; - -#define DL_PRE __FILE__, __LDL_FUNC__, __LINE__ -#define DL_LOG_DEBUG DL_PRE, 7 -#define DL_LOG_INFO DL_PRE, 6 -#define DL_LOG_NOTICE DL_PRE, 5 -#define DL_LOG_WARNING DL_PRE, 4 -#define DL_LOG_ERR DL_PRE, 3 -#define DL_LOG_CRIT DL_PRE, 2 -#define DL_LOG_ALERT DL_PRE, 1 -#define DL_LOG_EMERG DL_PRE, 0 - -typedef ldl_status (*ldl_loop_callback_t)(ldl_handle_t *); -typedef ldl_status (*ldl_session_callback_t)(ldl_handle_t *, ldl_session_t *, ldl_signal_t, char *, char *, char *, char *); -typedef ldl_status (*ldl_response_callback_t)(ldl_handle_t *, char *); -typedef void (*ldl_logger_t)(char *file, const char *func, int line, int level, char *fmt, ...); - -#define ldl_yield(ms) apr_sleep(ms * 10); apr_thread_yield(); - -/*! - \brief Test for a common domain in 2 jid - \param id_a the first id - \param id_b the second id - \return 1 if the domains match 0 if they dont or -1 if either id is invalid - \note the id may or may not contain a user and/or resource -*/ -static inline int ldl_jid_domcmp(char *id_a, char *id_b) -{ - char *id_a_host, *id_b_host, *id_a_r, *id_b_r; - - id_a_host = strchr(id_a, '@'); - if (id_a_host) { - id_a_host++; - } else { - id_a_host = id_a; - } - - id_b_host = strchr(id_b, '@'); - if (id_b_host) { - id_b_host++; - } else { - id_b_host = id_b; - } - - if (id_a_host && id_b_host) { - size_t id_a_len = 0, id_b_len = 0, len = 0; - - id_a_r = strchr(id_a_host, '/'); - if (id_a_r) { - id_a_len = id_a_r - id_a_host; - } else { - id_a_len = strlen(id_a_host); - } - - id_b_r = strchr(id_b_host, '/'); - if (id_b_r) { - id_b_len = id_b_r - id_b_host; - } else { - id_b_len = strlen(id_b_host); - } - - if (id_a_len > id_b_len) { - len = id_b_len; - } else { - len = id_a_len; - } - - return strncasecmp(id_a_host, id_b_host, len) ? 0 : 1; - } - return -1; -} - -/*! - \brief Test for the existance of a flag on an arbitary object - \param obj the object to test - \param flag the or'd list of flags to test - \return true value if the object has the flags defined -*/ -#define ldl_test_flag(obj, flag) ((obj)->flags & flag) - - -/*! - \brief Set a flag on an arbitrary object - \param obj the object to set the flags on - \param flag the or'd list of flags to set -*/ -#define ldl_set_flag(obj, flag) (obj)->flags |= (flag) - -/*! - \brief Clear a flag on an arbitrary object - \param obj the object to test - \param flag the or'd list of flags to clear -*/ -#define ldl_clear_flag(obj, flag) (obj)->flags &= ~(flag) - -/*! - \brief Set a flag on an arbitrary object while locked - \param obj the object to set the flags on - \param flag the or'd list of flags to set -*/ -#define ldl_set_flag_locked(obj, flag) assert(obj->flag_mutex != NULL);\ -apr_thread_mutex_lock(obj->flag_mutex);\ -(obj)->flags |= (flag);\ -apr_thread_mutex_unlock(obj->flag_mutex); - -/*! - \brief Clear a flag on an arbitrary object - \param obj the object to test - \param flag the or'd list of flags to clear -*/ -#define ldl_clear_flag_locked(obj, flag) apr_thread_mutex_lock(obj->flag_mutex); (obj)->flags &= ~(flag); apr_thread_mutex_unlock(obj->flag_mutex); - -/*! - \brief Copy flags from one arbitrary object to another - \param dest the object to copy the flags to - \param src the object to copy the flags from - \param flags the flags to copy -*/ -#define ldl_copy_flags(dest, src, flags) (dest)->flags &= ~(flags); (dest)->flags |= ((src)->flags & (flags)) - -/*! - \brief Test for NULL or zero length string - \param s the string to test - \return true value if the string is NULL or zero length -*/ -#define ldl_strlen_zero(s) (s && *s != '\0') ? 0 : 1 - -/*! - \brief Destroy a Jingle Session - \param session_p the session to destroy - \return SUCCESS OR FAILURE -*/ -ldl_status ldl_session_destroy(ldl_session_t **session_p); - -/*! - \brief Get a value from a session - \param session the session - \param key the key to look up - \return the value -*/ -char *ldl_session_get_value(ldl_session_t *session, char *key); - -/*! - \brief Set a value on a session - \param session the session - \param key the key to set - \param val the value of the key -*/ -void ldl_session_set_value(ldl_session_t *session, const char *key, const char *val); - -/*! - \brief Create a Jingle Session - \param session_p pointer to reference the session - \param handle handle to associate the session with - \param id the id to use for the session - \param them the id of the other end of the call - \param me the id of our end of the call - \param flags user flags - \return SUCCESS OR FAILURE -*/ -ldl_status ldl_session_create(ldl_session_t **session_p, ldl_handle_t *handle, char *id, char *them, char *me, ldl_user_flag_t flags); - -/*! - \brief get the id of a session - \param session the session to get the id of - \return the requested id -*/ -char *ldl_session_get_id(ldl_session_t *session); - -/*! - \brief Get the caller name of a session - \param session the session to get the caller from - \return the caller name -*/ -char *ldl_session_get_caller(ldl_session_t *session); - -/*! - \brief Get the callee name of a session - \param session the session to get the callee from - \return the callee name -*/ -char *ldl_session_get_callee(ldl_session_t *session); - -/*! - \brief Set the ip of a session - \param session the session to set the ip on - \param ip the ip -*/ -void ldl_session_set_ip(ldl_session_t *session, char *ip); - -/*! - \brief Get the ip of a session - \param session the session to get the ip from - \return the ip -*/ -char *ldl_session_get_ip(ldl_session_t *session); - -/*! - \brief Set a private pointer to associate with the session - \param session the session to set the data pointer to - \param private_data the data to associate -*/ -void ldl_session_set_private(ldl_session_t *session, void *private_data); - -/*! - \brief Get a private pointer from a session - \param session the session to get the data from - \return the data -*/ -void *ldl_session_get_private(ldl_session_t *session); - -/*! - \brief Accept a candidate - \param session the session to accept on - \param candidate the candidate to accept -*/ -void ldl_session_accept_candidate(ldl_session_t *session, ldl_candidate_t *candidate); - -/*! - \brief turn logging on/off - \param on (TRUE or FALSE) - \return current state -*/ -int ldl_global_debug(int on); - -/*! - \brief Set a custom logger - \param logger the logger function -*/ -void ldl_global_set_logger(ldl_logger_t logger); - -/*! - \brief Perform a probe on a given id to resolve the proper Jingle Resource - \param handle the connection handle to use. - \param id the id to probe - \param from the from string - \param buf a string to store the result - \param len the size in bytes of the string - \return a pointer to buf if a successful lookup was made otherwise NULL -*/ -char *ldl_handle_probe(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len); - -/*! - \brief Perform a discovery on a given id to resolve the proper Jingle Resource - \param handle the connection handle to use. - \param id the id to probe - \param from the from string - \param buf a string to store the result - \param len the size in bytes of the string - \return a pointer to buf if a successful lookup was made otherwise NULL -*/ -char *ldl_handle_disco(ldl_handle_t *handle, char *id, char *from, char *buf, unsigned int len); - -/*! - \brief Signal a termination request on a given session - \param session the session to terminate - \return TRUE if the signal was sent. -*/ -unsigned int ldl_session_terminate(ldl_session_t *session); - -/*! - \brief Get the private data of a connection handle - \param handle the conection handle - \return the requested data -*/ -void *ldl_handle_get_private(ldl_handle_t *handle); - -/*! - \brief Get the full login of a connection handle - \param handle the conection handle - \return the requested data -*/ -char *ldl_handle_get_login(ldl_handle_t *handle); - -/*! - \brief Send a message to a session - \param session the session handle - \param subject optional subject - \param body body of the message -*/ -void ldl_session_send_msg(ldl_session_t *session, char *subject, char *body); - -/*! - \brief Send a presence notification to a target - \param handle the handle to send with - \param from the from address - \param to the to address - \param type the type of presence - \param rpid data for the icon - \param message a status message - \param avatar the path to an avatar image -*/ -void ldl_handle_send_presence(ldl_handle_t *handle, char *from, char *to, char *type, char *rpid, char *message, char *avatar); - -/*! - \brief Send a vcard - \param handle the handle to send with - \param from the from address - \param to the to address - \param id the request id - \param vcard the text xml of the vcard -*/ -void ldl_handle_send_vcard(ldl_handle_t *handle, char *from, char *to, char *id, char *vcard); - -/*! - \brief Send a message - \param handle the conection handle - \param from the message sender - \param to the message recipiant - \param subject optional subject - \param body body of the message -*/ -void ldl_handle_send_msg(ldl_handle_t *handle, char *from, char *to, const char *subject, const char *body); - -/*! - \brief Offer candidates to a potential session - \param session the session to send candidates on - \param candidates an array of candidate description objects - \param clen the number of elements in the candidates array - \return the message_id of the generated xmpp request -*/ -unsigned int ldl_session_candidates(ldl_session_t *session, - ldl_candidate_t *candidates, - unsigned int clen); - -unsigned int ldl_session_transport(ldl_session_t *session, - ldl_candidate_t *candidates, - unsigned int clen); - -/*! - \brief Initiate or Accept a new session and provide transport options - \param session the session to initiate or accept - \param payloads an array of payload description objects - \param plen the number of elements in the payloads array - \param description the type of description LDL_DESCRIPTION_INITIATE or LDL_DESCRIPTION_ACCEPT - \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, unsigned int *audio_ssrc, unsigned int *video_ssrc, - ldl_crypto_data_t *audio_crypto_data, ldl_crypto_data_t *video_crypto_data); - - -/*! - \brief get a session's state - \param session a session to get the state from - \return the state -*/ -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_transport_type_t tport, ldl_candidate_t **candidates, unsigned int *len); - -/*! - \brief get the payloads - \param session the session - \param payloads pointer to point at array of the payloads - \param len the resulting len of the array pointer - \return success or failure -*/ -ldl_status ldl_session_get_payloads(ldl_session_t *session, ldl_payload_t **payloads, unsigned int *len); - -/*! - \brief Initilize libDingaLing - \param debug debug level - \return success or failure -*/ -ldl_status ldl_global_init(int debug); - -/*! - \brief Destroy libDingaLing - \return success or failure -*/ -ldl_status ldl_global_destroy(void); - -/*! - \brief Set the log stream - \param log_stream the new log stream -*/ -void ldl_global_set_log_stream(FILE *log_stream); - -int8_t ldl_handle_ready(ldl_handle_t *handle); - -/*! - \brief Initilize a new libDingaLing handle - \param handle the Dingaling handle to initialize - \param login the xmpp login - \param password the password - \param server the server address - \param flags user flags - \param status_msg status message to advertise - \param loop_callback optional loop callback - \param session_callback function to call on session signalling - \param response_callback function to call on responses - \param private_info optional pointer to private data - \return success or failure -*/ -ldl_status ldl_handle_init(ldl_handle_t **handle, - char *login, - char *password, - char *server, - ldl_user_flag_t flags, - char *status_msg, - char *priority, - ldl_loop_callback_t loop_callback, - ldl_session_callback_t session_callback, - ldl_response_callback_t response_callback, - void *private_info); - -/*! - \brief Run a libDingaLing handle - \param handle the Dingaling handle to run -*/ -void ldl_handle_run(ldl_handle_t *handle); - -int ldl_session_gateway(ldl_session_t *handle); -void ldl_session_set_gateway(ldl_session_t *session); - -/*! - \brief Stop a libDingaLing handle - \param handle the Dingaling handle to stop -*/ -void ldl_handle_stop(ldl_handle_t *handle); - -int ldl_handle_running(ldl_handle_t *handle); -int ldl_handle_connected(ldl_handle_t *handle); -int ldl_handle_authorized(ldl_handle_t *handle); - - -/*! - \brief Destroy a libDingaLing handle - \param handle the Dingaling handle to destroy - \return success or failure -*/ -ldl_status ldl_handle_destroy(ldl_handle_t **handle); - -/*! - \brief Set the log stream on a handle - \param handle the Dingaling handle - \param log_stream the new log stream -*/ -void ldl_handle_set_log_stream(ldl_handle_t *handle, FILE *log_stream); - -ldl_status ldl_global_terminate(void); - -///\} - - -#ifdef __cplusplus -} -#endif -/** \mainpage libDingaling - * libDingaling - Cross Platform Jingle (Google Talk) voip signaling library - - * \section intro Introduction - * - * \section supports Supported Platforms - * libDingaling has been built on the following platforms: - * - * - Linux (x86, x86_64) - * - Windows (MSVC 2005) - * - Mac OS X (intel & ppc ) - * - * \section depends Dependencies - * libDingaling makes use of the following external libraries. - * - * - APR (http://apr.apache.org) - * - iksemel (http://iksemel.jabberstudio.org/) - * - * \section license Licensing - * - * libDingaling is licensed under the terms of the MPL 1.1 - * - */ -#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 noet: - */ diff --git a/libs/libdingaling/src/sha1.c b/libs/libdingaling/src/sha1.c deleted file mode 100644 index 100ab0e513..0000000000 --- a/libs/libdingaling/src/sha1.c +++ /dev/null @@ -1,639 +0,0 @@ -/*- - * Copyright (c) 2001-2003 Allan Saddi - * 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 SOFTWARE IS PROVIDED BY ALLAN SADDI AND HIS 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 ALLAN SADDI OR HIS 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. - * - * $Id: sha1.c 680 2003-07-25 21:57:38Z asaddi $ - */ - -/* - * Define WORDS_BIGENDIAN if compiling on a big-endian architecture. - * - * Define SHA1_TEST to test the implementation using the NIST's - * sample messages. The output should be: - * - * a9993e36 4706816a ba3e2571 7850c26c 9cd0d89d - * 84983e44 1c3bd26e baae4aa1 f95129e5 e54670f1 - * 34aa973c d4c4daa4 f61eeb2b dbad2731 6534016f - */ - -#ifdef HAVE_CONFIG_H -#include -#endif /* HAVE_CONFIG_H */ - -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# endif -#endif - -#ifdef _MSC_VER -#define inline __inline -#endif - -#include - -#include "sha1.h" - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-const-variable" -#endif - -#if 0 -static const char rcsid[] = - "$Id: sha1.c 680 2003-07-25 21:57:38Z asaddi $"; -#endif /* !lint */ - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -#define ROTL(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) -#define ROTR(x, n) (((x) >> (n)) | ((x) << (32 - (n)))) - -#define F_0_19(x, y, z) ((z) ^ ((x) & ((y) ^ (z)))) -#define F_20_39(x, y, z) ((x) ^ (y) ^ (z)) -#define F_40_59(x, y, z) (((x) & ((y) | (z))) | ((y) & (z))) -#define F_60_79(x, y, z) ((x) ^ (y) ^ (z)) - -#define DO_ROUND(F, K) { \ - temp = ROTL(a, 5) + F(b, c, d) + e + *(W++) + K; \ - e = d; \ - d = c; \ - c = ROTL(b, 30); \ - b = a; \ - a = temp; \ -} - -#define K_0_19 0x5a827999L -#define K_20_39 0x6ed9eba1L -#define K_40_59 0x8f1bbcdcL -#define K_60_79 0xca62c1d6L - -#ifndef RUNTIME_ENDIAN - -#ifdef WORDS_BIGENDIAN - -#define BYTESWAP(x) (x) -#define BYTESWAP64(x) (x) - -#else /* WORDS_BIGENDIAN */ - -#define BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \ - (ROTL((x), 8) & 0x00ff00ffL)) -#define BYTESWAP64(x) _byteswap64(x) - -static inline uint64_t _byteswap64(uint64_t x) -{ - uint32_t a = (uint32_t)(x >> 32); - uint32_t b = (uint32_t) x; - return ((uint64_t) BYTESWAP(b) << 32) | (uint64_t) BYTESWAP(a); -} - -#endif /* WORDS_BIGENDIAN */ - -#else /* !RUNTIME_ENDIAN */ - -#define BYTESWAP(x) _byteswap(sc->littleEndian, x) -#define BYTESWAP64(x) _byteswap64(sc->littleEndian, x) - -#define _BYTESWAP(x) ((ROTR((x), 8) & 0xff00ff00L) | \ - (ROTL((x), 8) & 0x00ff00ffL)) -#define _BYTESWAP64(x) __byteswap64(x) - -static inline uint64_t __byteswap64(uint64_t x) -{ - uint32_t a = x >> 32; - uint32_t b = (uint32_t) x; - return ((uint64_t) _BYTESWAP(b) << 32) | (uint64_t) _BYTESWAP(a); -} - -static inline uint32_t _byteswap(int littleEndian, uint32_t x) -{ - if (!littleEndian) - return x; - else - return _BYTESWAP(x); -} - -static inline uint64_t _byteswap64(int littleEndian, uint64_t x) -{ - if (!littleEndian) - return x; - else - return _BYTESWAP64(x); -} - -static inline void setEndian(int *littleEndianp) -{ - union { - uint32_t w; - uint8_t b[4]; - } endian; - - endian.w = 1L; - *littleEndianp = endian.b[0] != 0; -} - -#endif /* !RUNTIME_ENDIAN */ - -static const uint8_t padding[64] = { - 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -void -SHA1Init (SHA1Context *sc) -{ -#ifdef RUNTIME_ENDIAN - setEndian (&sc->littleEndian); -#endif /* RUNTIME_ENDIAN */ - - sc->totalLength = 0LL; - sc->hash[0] = 0x67452301L; - sc->hash[1] = 0xefcdab89L; - sc->hash[2] = 0x98badcfeL; - sc->hash[3] = 0x10325476L; - sc->hash[4] = 0xc3d2e1f0L; - sc->bufferLength = 0L; -} - -static void -burnStack (int size) -{ - char buf[128]; - - memset (buf, 0, sizeof (buf)); - size -= sizeof (buf); - if (size > 0) - burnStack (size); -} - -static void -SHA1Guts (SHA1Context *sc, const uint32_t *cbuf) -{ - uint32_t buf[80]; - uint32_t *W, *W3, *W8, *W14, *W16; - uint32_t a, b, c, d, e, temp; - int i; - - W = buf; - - for (i = 15; i >= 0; i--) { - *(W++) = BYTESWAP(*cbuf); - cbuf++; - } - - W16 = &buf[0]; - W14 = &buf[2]; - W8 = &buf[8]; - W3 = &buf[13]; - - for (i = 63; i >= 0; i--) { - *W = *(W3++) ^ *(W8++) ^ *(W14++) ^ *(W16++); - *W = ROTL(*W, 1); - W++; - } - - a = sc->hash[0]; - b = sc->hash[1]; - c = sc->hash[2]; - d = sc->hash[3]; - e = sc->hash[4]; - - W = buf; - -#ifndef SHA1_UNROLL -#define SHA1_UNROLL 20 -#endif /* !SHA1_UNROLL */ - -#if SHA1_UNROLL == 1 - for (i = 19; i >= 0; i--) - DO_ROUND(F_0_19, K_0_19); - - for (i = 19; i >= 0; i--) - DO_ROUND(F_20_39, K_20_39); - - for (i = 19; i >= 0; i--) - DO_ROUND(F_40_59, K_40_59); - - for (i = 19; i >= 0; i--) - DO_ROUND(F_60_79, K_60_79); -#elif SHA1_UNROLL == 2 - for (i = 9; i >= 0; i--) { - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - } - - for (i = 9; i >= 0; i--) { - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - } - - for (i = 9; i >= 0; i--) { - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - } - - for (i = 9; i >= 0; i--) { - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - } -#elif SHA1_UNROLL == 4 - for (i = 4; i >= 0; i--) { - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - } - - for (i = 4; i >= 0; i--) { - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - } - - for (i = 4; i >= 0; i--) { - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - } - - for (i = 4; i >= 0; i--) { - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - } -#elif SHA1_UNROLL == 5 - for (i = 3; i >= 0; i--) { - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - } - - for (i = 3; i >= 0; i--) { - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - } - - for (i = 3; i >= 0; i--) { - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - } - - for (i = 3; i >= 0; i--) { - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - } -#elif SHA1_UNROLL == 10 - for (i = 1; i >= 0; i--) { - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - } - - for (i = 1; i >= 0; i--) { - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - } - - for (i = 1; i >= 0; i--) { - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - } - - for (i = 1; i >= 0; i--) { - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - } -#elif SHA1_UNROLL == 20 - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - DO_ROUND(F_0_19, K_0_19); - - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - DO_ROUND(F_20_39, K_20_39); - - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - DO_ROUND(F_40_59, K_40_59); - - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); - DO_ROUND(F_60_79, K_60_79); -#else /* SHA1_UNROLL */ -#error SHA1_UNROLL must be 1, 2, 4, 5, 10 or 20! -#endif - - sc->hash[0] += a; - sc->hash[1] += b; - sc->hash[2] += c; - sc->hash[3] += d; - sc->hash[4] += e; -} - -void -SHA1Update (SHA1Context *sc, const void *vdata, uint32_t len) -{ - const uint8_t *data = vdata; - uint32_t bufferBytesLeft; - uint32_t bytesToCopy; - int needBurn = 0; - -#ifdef SHA1_FAST_COPY - if (sc->bufferLength) { - bufferBytesLeft = 64L - sc->bufferLength; - - bytesToCopy = bufferBytesLeft; - if (bytesToCopy > len) - bytesToCopy = len; - - memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy); - - sc->totalLength += bytesToCopy * 8L; - - sc->bufferLength += bytesToCopy; - data += bytesToCopy; - len -= bytesToCopy; - - if (sc->bufferLength == 64L) { - SHA1Guts (sc, sc->buffer.words); - needBurn = 1; - sc->bufferLength = 0L; - } - } - - while (len > 63) { - sc->totalLength += 512L; - - SHA1Guts (sc, data); - needBurn = 1; - - data += 64L; - len -= 64L; - } - - if (len) { - memcpy (&sc->buffer.bytes[sc->bufferLength], data, len); - - sc->totalLength += len * 8L; - - sc->bufferLength += len; - } -#else /* SHA1_FAST_COPY */ - while (len) { - bufferBytesLeft = 64L - sc->bufferLength; - - bytesToCopy = bufferBytesLeft; - if (bytesToCopy > len) - bytesToCopy = len; - - memcpy (&sc->buffer.bytes[sc->bufferLength], data, bytesToCopy); - - sc->totalLength += bytesToCopy * 8L; - - sc->bufferLength += bytesToCopy; - data += bytesToCopy; - len -= bytesToCopy; - - if (sc->bufferLength == 64L) { - SHA1Guts (sc, sc->buffer.words); - needBurn = 1; - sc->bufferLength = 0L; - } - } -#endif /* SHA1_FAST_COPY */ - - if (needBurn) - burnStack (sizeof (uint32_t[86]) + sizeof (uint32_t *[5]) + sizeof (int)); -} - -void -SHA1Final (SHA1Context *sc, uint8_t hash[SHA1_HASH_SIZE]) -{ - uint32_t bytesToPad; - uint64_t lengthPad; - int i; - - bytesToPad = 120L - sc->bufferLength; - if (bytesToPad > 64L) - bytesToPad -= 64L; - - lengthPad = BYTESWAP64(sc->totalLength); - - SHA1Update (sc, padding, bytesToPad); - SHA1Update (sc, &lengthPad, 8L); - - if (hash) { - for (i = 0; i < SHA1_HASH_WORDS; i++) { -#ifdef SHA1_FAST_COPY - *((uint32_t *) hash) = BYTESWAP(sc->hash[i]); -#else /* SHA1_FAST_COPY */ - hash[0] = (uint8_t) (sc->hash[i] >> 24); - hash[1] = (uint8_t) (sc->hash[i] >> 16); - hash[2] = (uint8_t) (sc->hash[i] >> 8); - hash[3] = (uint8_t) sc->hash[i]; -#endif /* SHA1_FAST_COPY */ - hash += 4; - } - } -} - -#ifdef SHA1_TEST - -#include -#include -#include - -int -main (int argc, char *argv[]) -{ - SHA1Context foo; - uint8_t hash[SHA1_HASH_SIZE]; - char buf[1000]; - int i; - - SHA1Init (&foo); - SHA1Update (&foo, "abc", 3); - SHA1Final (&foo, hash); - - for (i = 0; i < SHA1_HASH_SIZE;) { - printf ("%02x", hash[i++]); - if (!(i % 4)) - printf (" "); - } - printf ("\n"); - - SHA1Init (&foo); - SHA1Update (&foo, - "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", - 56); - SHA1Final (&foo, hash); - - for (i = 0; i < SHA1_HASH_SIZE;) { - printf ("%02x", hash[i++]); - if (!(i % 4)) - printf (" "); - } - printf ("\n"); - - SHA1Init (&foo); - memset (buf, 'a', sizeof (buf)); - for (i = 0; i < 1000; i++) - SHA1Update (&foo, buf, sizeof (buf)); - SHA1Final (&foo, hash); - - for (i = 0; i < SHA1_HASH_SIZE;) { - printf ("%02x", hash[i++]); - if (!(i % 4)) - printf (" "); - } - printf ("\n"); - - exit (0); -} - -#endif /* SHA1_TEST */ diff --git a/libs/libdingaling/src/sha1.h b/libs/libdingaling/src/sha1.h deleted file mode 100644 index 9283165c76..0000000000 --- a/libs/libdingaling/src/sha1.h +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 2001-2003 Allan Saddi - * 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 SOFTWARE IS PROVIDED BY ALLAN SADDI AND HIS 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 ALLAN SADDI OR HIS 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. - * - * $Id: sha1.h 347 2003-02-23 22:11:49Z asaddi $ - */ - -#ifndef _SHA1_H -#define _SHA1_H - -#if HAVE_INTTYPES_H -# include -#else -# if HAVE_STDINT_H -# include -# else -# ifndef uint32_t -# ifdef WIN32 -typedef unsigned __int8 uint8_t; -typedef unsigned __int16 uint16_t; -typedef unsigned __int32 uint32_t; -typedef unsigned __int64 uint64_t; -typedef __int8 int8_t; -typedef __int16 int16_t; -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned long in_addr_t; -# endif -# endif -# endif -#endif - -#define SHA1_HASH_SIZE 20 - -/* Hash size in 32-bit words */ -#define SHA1_HASH_WORDS 5 - -struct _SHA1Context { - uint64_t totalLength; - uint32_t hash[SHA1_HASH_WORDS]; - uint32_t bufferLength; - union { - uint32_t words[16]; - uint8_t bytes[64]; - } buffer; -#ifdef RUNTIME_ENDIAN - int littleEndian; -#endif /* RUNTIME_ENDIAN */ -}; - -typedef struct _SHA1Context SHA1Context; - -#ifdef __cplusplus -extern "C" { -#endif - -void SHA1Init (SHA1Context *sc); -void SHA1Update (SHA1Context *sc, const void *data, uint32_t len); -void SHA1Final (SHA1Context *sc, uint8_t hash[SHA1_HASH_SIZE]); - -#ifdef __cplusplus -} -#endif - -#endif /* _SHA1_H */ diff --git a/src/include/switch.h b/src/include/switch.h index b7bae46c0e..8bfd15a3f6 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -226,11 +226,6 @@ * mod_portaudio * - portaudio (http://www.portaudio.com/) * - * mod_dingaling - * - libdingaling (internal library distributed with freeswitch which depends on) - * - APR (http://apr.apache.org) - * - iksemel (http://iksemel.jabberstudio.org/) - * * mod_sofia * - sofia-sip (http://opensource.nokia.com/projects/sofia-sip/) * diff --git a/src/mod/Makefile.am b/src/mod/Makefile.am index 05bea17bc4..4225ec7fd9 100644 --- a/src/mod/Makefile.am +++ b/src/mod/Makefile.am @@ -10,7 +10,7 @@ check: $(OUR_CHECK_MODULES) mod_skypopen-all: mod_gsmopen-all mod_gsmopen-all: mod_spandsp-all mod_unimrcp-all: mod_sofia-all -mod_rayo-all: mod_dingaling-all +mod_rayo-all: mod_ssml-all mod_ssml-all: mod_rayo-all $(OUR_MODULES) $(OUR_CLEAN_MODULES) $(OUR_INSTALL_MODULES) $(OUR_UNINSTALL_MODULES) $(OUR_DISABLED_MODULES) $(OUR_DISABLED_CLEAN_MODULES) $(OUR_DISABLED_INSTALL_MODULES) $(OUR_DISABLED_UNINSTALL_MODULES) $(OUR_TEST_MODULES) $(OUR_CHECK_MODULES): diff --git a/src/mod/endpoints/mod_dingaling/Makefile.am b/src/mod/endpoints/mod_dingaling/Makefile.am deleted file mode 100644 index 3412a3ef59..0000000000 --- a/src/mod/endpoints/mod_dingaling/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -include $(top_srcdir)/build/modmake.rulesam -MODNAME=mod_dingaling -IKS_DIR=$(switch_srcdir)/libs/iksemel -IKS_BUILDDIR=$(switch_builddir)/libs/iksemel -IKS_LA=$(IKS_BUILDDIR)/src/libiksemel.la -DING_DIR=$(switch_srcdir)/libs/libdingaling -DING_BUILDDIR=$(switch_builddir)/libs/libdingaling - -mod_LTLIBRARIES = mod_dingaling.la -mod_dingaling_la_SOURCES = mod_dingaling.c ../../../../libs/libdingaling/src/libdingaling.c ../../../../libs/libdingaling/src/sha1.c -mod_dingaling_la_CFLAGS = $(AM_CFLAGS) -mod_dingaling_la_CFLAGS += `$(switch_builddir)/libs/apr/apr-1-config --cflags --cppflags --includes` -mod_dingaling_la_CFLAGS += `$(switch_builddir)/libs/apr-util/apu-1-config --includes` -mod_dingaling_la_CFLAGS += -I$(DING_DIR)/src -I$(DING_BUILDDIR)/src -I$(IKS_DIR)/include -mod_dingaling_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(IKS_LA) -mod_dingaling_la_LDFLAGS = -avoid-version -module -no-undefined -shared - -BUILT_SOURCES=$(IKS_LA) - -$(IKS_LA): $(IKS_BUILDDIR) $(IKS_DIR) $(IKS_DIR)/.update - @cd $(IKS_BUILDDIR) && $(MAKE) - @$(TOUCH_TARGET) - -deps: $(IKS_LA) \ No newline at end of file diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.2017.vcxproj b/src/mod/endpoints/mod_dingaling/mod_dingaling.2017.vcxproj deleted file mode 100644 index 7c142aa75a..0000000000 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.2017.vcxproj +++ /dev/null @@ -1,165 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mod_dingaling - {FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} - mod_dingaling - Win32Proj - - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) - - - 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - /NODEFAULTLIB:LIMBCTD %(AdditionalOptions) - $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) - - - 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - /NODEFAULTLIB:LIMBCTD %(AdditionalOptions) - $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) - - - 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - %(RootDir)%(Directory)..\..\..\..\libs\libdingaling\src;%(AdditionalIncludeDirectories) - - - 4718;6340;6246;6011;6387;%(DisableSpecificWarnings) - - - $(ProjectDir)..\..\..\..\libs\libdingaling\$(OutDir);$(ProjectDir)..\..\..\..\libs\iksemel\$(OutDir);%(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - - - - {1906d736-08bd-4ee1-924f-b536249b9a54} - false - - - {f057da7f-79e5-4b00-845c-ef446ef055e3} - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - false - - - {e727e8f6-935d-46fe-8b0e-37834748a0e3} - false - - - {202d7a4e-760d-4d0e-afa1-d7459ced30ff} - false - - - - - - \ No newline at end of file diff --git a/src/mod/endpoints/mod_dingaling/mod_dingaling.c b/src/mod/endpoints/mod_dingaling/mod_dingaling.c deleted file mode 100644 index 6b1728ebe5..0000000000 --- a/src/mod/endpoints/mod_dingaling/mod_dingaling.c +++ /dev/null @@ -1,4482 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2005-2014, 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_dingaling.c -- Jingle Endpoint Module - * - */ -#include -#include -#include - -#define SWITCH_RTP_KEY_LEN 30 -#define SWITCH_RTP_CRYPTO_KEY_32 "AES_CM_128_HMAC_SHA1_32" -#define SWITCH_RTP_CRYPTO_KEY_80 "AES_CM_128_HMAC_SHA1_80" - -#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" -#define DL_EVENT_CONNECTED "dingaling::connected" -#define MDL_CHAT_PROTO "jingle" -#define MDL_CHAT_FROM_GUESS "auto_from" - -SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load); -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown); -SWITCH_MODULE_DEFINITION(mod_dingaling, mod_dingaling_load, mod_dingaling_shutdown, NULL); - -static switch_memory_pool_t *module_pool = NULL; -switch_endpoint_interface_t *dingaling_endpoint_interface; - -static char sub_sql[] = - "CREATE TABLE jabber_subscriptions (\n" - " sub_from VARCHAR(255),\n" " sub_to VARCHAR(255),\n" " show_pres VARCHAR(255),\n" " status VARCHAR(255)\n" ");\n"; - - -typedef enum { - TFLAG_IO = (1 << 0), - TFLAG_INBOUND = (1 << 1), - TFLAG_OUTBOUND = (1 << 2), - TFLAG_READING = (1 << 3), - TFLAG_WRITING = (1 << 4), - TFLAG_BYE = (1 << 5), - TFLAG_VOICE = (1 << 6), - TFLAG_RTP_READY = (1 << 7), - TFLAG_CODEC_READY = (1 << 8), - TFLAG_TRANSPORT = (1 << 9), - TFLAG_ANSWER = (1 << 10), - TFLAG_VAD_NONE = (1 << 11), - TFLAG_VAD_IN = (1 << 12), - TFLAG_VAD_OUT = (1 << 13), - TFLAG_VAD = (1 << 14), - TFLAG_DO_CAND = (1 << 15), - TFLAG_DO_DESC = (1 << 16), - TFLAG_LANADDR = (1 << 17), - TFLAG_AUTO = (1 << 18), - TFLAG_DTMF = (1 << 19), - TFLAG_TIMER = (1 << 20), - TFLAG_TERM = (1 << 21), - TFLAG_TRANSPORT_ACCEPT = (1 << 22), - TFLAG_READY = (1 << 23), - TFLAG_NAT_MAP = (1 << 24), - TFLAG_SECURE = (1 << 25), - TFLAG_VIDEO_RTP_READY = (1 << 7) -} TFLAGS; - -typedef enum { - GFLAG_MY_CODEC_PREFS = (1 << 0) -} GFLAGS; - -#define MAX_ACL 100 - -static struct { - int debug; - char *dialplan; - char *codec_string; - char *codec_order[SWITCH_MAX_CODECS]; - int codec_order_last; - char *codec_rates_string; - char *codec_rates[SWITCH_MAX_CODECS]; - int codec_rates_last; - unsigned int flags; - unsigned int init; - switch_hash_t *profile_hash; - int running; - int handles; - char guess_ip[80]; - switch_event_node_t *in_node; - switch_event_node_t *probe_node; - switch_event_node_t *out_node; - switch_event_node_t *roster_node; - int auto_nat; -} globals; - -struct mdl_profile { - char *name; - char *login; - char *password; - char *message; - char *priority; -#ifdef AUTO_REPLY - char *auto_reply; -#endif - char *dialplan; - char *ip; - char *extip; - char *lanaddr; - char *server; - char *exten; - char *context; - char *timer_name; - char *dbname; - char *avatar; - char *odbc_dsn; - switch_bool_t purge; - switch_thread_rwlock_t *rwlock; - switch_mutex_t *mutex; - ldl_handle_t *handle; - uint32_t flags; - uint32_t user_flags; - char *acl[MAX_ACL]; - uint32_t acl_count; - char *local_network; -}; -typedef struct mdl_profile mdl_profile_t; - -/*! \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; - - mdl_transport_t transports[LDL_TPORT_MAX+1]; - - ldl_session_t *dlsession; - - 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; - - switch_time_t next_desc; - switch_time_t next_cand; - - char *recip; - char *dnis; - switch_mutex_t *flag_mutex; - - int read_count; - switch_time_t audio_ready; - -}; - -struct rfc2833_digit { - char digit; - int duration; -}; - -SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_dialplan, globals.dialplan); -SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_string, globals.codec_string); -SWITCH_DECLARE_GLOBAL_STRING_FUNC(set_global_codec_rates_string, globals.codec_rates_string); - -SWITCH_STANDARD_API(dl_login); -SWITCH_STANDARD_API(dl_logout); -SWITCH_STANDARD_API(dl_pres); -SWITCH_STANDARD_API(dl_debug); -SWITCH_STANDARD_API(dingaling); -static switch_status_t channel_on_init(switch_core_session_t *session); -static switch_status_t channel_on_hangup(switch_core_session_t *session); -static switch_status_t channel_on_destroy(switch_core_session_t *session); -static switch_status_t channel_on_routing(switch_core_session_t *session); -static switch_status_t channel_on_exchange_media(switch_core_session_t *session); -static switch_status_t channel_on_soft_execute(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_kill_channel(switch_core_session_t *session, int sig); - -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); -static ldl_status handle_response(ldl_handle_t *handle, char *id); -static switch_status_t load_config(void); -static int sin_callback(void *pArg, int argc, char **argv, char **columnNames); - -static switch_status_t soft_reload(void); - -#define is_special(s) (s && (strstr(s, "ext+") || strstr(s, "user+"))) - -static char *translate_rpid(char *in, char *ext) -{ - char *r = NULL; - - if (in && (strstr(in, "null") || strstr(in, "NULL"))) { - in = NULL; - } - - if (!in) { - in = ext; - } - - if (!in) { - return NULL; - } - - if (!strcasecmp(in, "busy")) { - r = "dnd"; - } - - if (!strcasecmp(in, "unavailable")) { - r = "dnd"; - } - - if (!strcasecmp(in, "idle")) { - r = "away"; - } - - if (ext && !strcasecmp(ext, "idle")) { - r = "away"; - } else if (ext && !strcasecmp(ext, "away")) { - r = "away"; - } - - return r; -} - - -static switch_cache_db_handle_t *mdl_get_db_handle(mdl_profile_t *profile) -{ - switch_cache_db_handle_t *dbh = NULL; - char *dsn; - - if (!zstr(profile->odbc_dsn)) { - dsn = profile->odbc_dsn; - } else { - dsn = profile->dbname; - } - - if (switch_cache_db_get_db_handle_dsn(&dbh, dsn) != SWITCH_STATUS_SUCCESS) { - dbh = NULL; - } - - return dbh; - -} - - -static switch_status_t mdl_execute_sql(mdl_profile_t *profile, char *sql, switch_mutex_t *mutex) -{ - switch_cache_db_handle_t *dbh = NULL; - switch_status_t status = SWITCH_STATUS_FALSE; - - if (mutex) { - switch_mutex_lock(mutex); - } - - if (!(dbh = mdl_get_db_handle(profile))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); - goto end; - } - - status = switch_cache_db_execute_sql(dbh, sql, NULL); - - end: - - switch_cache_db_release_db_handle(&dbh); - - if (mutex) { - switch_mutex_unlock(mutex); - } - - return status; -} - -char *mdl_execute_sql2str(mdl_profile_t *profile, switch_mutex_t *mutex, char *sql, char *resbuf, size_t len) -{ - switch_cache_db_handle_t *dbh = NULL; - - char *ret = NULL; - - if (mutex) { - switch_mutex_lock(mutex); - } - - if (!(dbh = mdl_get_db_handle(profile))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); - goto end; - } - - ret = switch_cache_db_execute_sql2str(dbh, sql, resbuf, len, NULL); - -end: - - switch_cache_db_release_db_handle(&dbh); - - if (mutex) { - switch_mutex_unlock(mutex); - } - - return ret; - -} - - -static switch_bool_t mdl_execute_sql_callback(mdl_profile_t *profile, switch_mutex_t *mutex, char *sql, switch_core_db_callback_func_t callback, - void *pdata) -{ - switch_bool_t ret = SWITCH_FALSE; - char *errmsg = NULL; - switch_cache_db_handle_t *dbh = NULL; - - if (mutex) { - switch_mutex_lock(mutex); - } - - if (!(dbh = mdl_get_db_handle(profile))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Opening DB\n"); - goto end; - } - - switch_cache_db_execute_sql_callback(dbh, sql, callback, pdata, &errmsg); - - if (errmsg) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "SQL ERR: [%s] %s\n", sql, errmsg); - free(errmsg); - } - - end: - - switch_cache_db_release_db_handle(&dbh); - - if (mutex) { - switch_mutex_unlock(mutex); - } - - return ret; -} - - - - -static int sub_callback(void *pArg, int argc, char **argv, char **columnNames) -{ - mdl_profile_t *profile = (mdl_profile_t *) pArg; - - char *sub_from = argv[0]; - char *sub_to = argv[1]; - char *type = argv[2]; - char *rpid = argv[3]; - char *status = argv[4]; - //char *proto = argv[5]; - - if (zstr(type)) { - type = NULL; - } else if (!strcasecmp(type, "unavailable")) { - status = NULL; - } - rpid = translate_rpid(rpid, status); - - //ldl_handle_send_presence(profile->handle, sub_to, sub_from, "probe", rpid, status); - ldl_handle_send_presence(profile->handle, sub_to, sub_from, type, rpid, status, profile->avatar); - - - return 0; -} - -static int rost_callback(void *pArg, int argc, char **argv, char **columnNames) -{ - mdl_profile_t *profile = (mdl_profile_t *) pArg; - - char *sub_from = argv[0]; - char *sub_to = argv[1]; - char *show = argv[2]; - char *status = argv[3]; - - if (!strcasecmp(status, "n/a")) { - if (!strcasecmp(show, "dnd")) { - status = "Busy"; - } else if (!strcasecmp(show, "away")) { - status = "Idle"; - } - } - - ldl_handle_send_presence(profile->handle, sub_to, sub_from, NULL, show, status, profile->avatar); - - return 0; -} - -static void pres_event_handler(switch_event_t *event) -{ - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - void *val; - char *proto = switch_event_get_header(event, "proto"); - char *from = switch_event_get_header(event, "from"); - char *status = switch_event_get_header(event, "status"); - char *rpid = switch_event_get_header(event, "rpid"); - char *type = switch_event_get_header(event, "event_subtype"); - char *sql; - char pstr[128] = ""; - - if (globals.running != 1) { - return; - } - - if (!proto) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Missing 'proto' header\n"); - return; - } - - if (!from) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Missing 'from' header\n"); - return; - } - - if (status && !strcasecmp(status, "n/a")) { - status = NULL; - } - - switch (event->event_id) { - case SWITCH_EVENT_PRESENCE_PROBE: - if (proto) { - char *subsql; - char *to = switch_event_get_header(event, "to"); - char *f_host = NULL; - if (to) { - if ((f_host = strchr(to, '@'))) { - f_host++; - } - } - - if (f_host && (profile = switch_core_hash_find(globals.profile_hash, f_host))) { - if (to && (subsql = switch_mprintf("select * from jabber_subscriptions where sub_to='%q' and sub_from='%q'", to, from))) { - mdl_execute_sql_callback(profile, profile->mutex, subsql, sin_callback, profile); - switch_safe_free(subsql); - } - } - } - return; - case SWITCH_EVENT_PRESENCE_IN: - if (!status) { - status = "Available"; - } - break; - case SWITCH_EVENT_PRESENCE_OUT: - type = "unavailable"; - break; - default: - break; - } - - - if (!type) { - type = ""; - } - if (!rpid) { - rpid = ""; - } - if (!status) { - status = "Away"; - } - - if (proto) { - switch_snprintf(pstr, sizeof(pstr), "%s+", proto); - } - - sql = - switch_mprintf("select sub_from, sub_to,'%q','%q','%q','%q' from jabber_subscriptions where sub_to = '%q%q'", type, rpid, status, proto, pstr, - from); - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - - if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { - continue; - } - - - if (sql) { - switch_bool_t worked = mdl_execute_sql_callback(profile, profile->mutex, sql, sub_callback, profile); - - if (!worked) { - continue; - } - } - - - } - - switch_safe_free(sql); -} - -static switch_status_t chat_send(switch_event_t *message_event) -{ - char *user = NULL, *host, *f_user = NULL, *ffrom = NULL, *f_host = NULL, *f_resource = NULL; - mdl_profile_t *profile = NULL; - const char *proto; - const char *from; - const char *from_full; - const char *to_full; - const char *to; - const char *body; - const char *hint; - const char *profile_name; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - proto = switch_event_get_header(message_event, "proto"); - from = switch_event_get_header(message_event, "from"); - from_full = switch_event_get_header(message_event, "from_full"); - to_full = switch_event_get_header(message_event, "to_full"); - to = switch_event_get_header(message_event, "to"); - body = switch_event_get_body(message_event); - hint = switch_event_get_header(message_event, "hint"); - profile_name = switch_event_get_header(message_event, "ldl_profile"); - - switch_assert(proto != NULL); - - if (from && (f_user = strdup(from))) { - if ((f_host = strchr(f_user, '@'))) { - *f_host++ = '\0'; - if ((f_resource = strchr(f_host, '/'))) { - *f_resource++ = '\0'; - } - } - } - - if ((profile_name && (profile = switch_core_hash_find(globals.profile_hash, profile_name)))) { - from = from_full; - to = to_full; - - ldl_handle_send_msg(profile->handle, (char *) from, (char *) to, NULL, switch_str_nil(body)); - } else if (to && (user = strdup(to))) { - if ((host = strchr(user, '@'))) { - *host++ = '\0'; - } - - if (f_host && ((profile_name && (profile = switch_core_hash_find(globals.profile_hash, profile_name))) - || (profile = switch_core_hash_find(globals.profile_hash, f_host)))) { - - if (!strcmp(proto, MDL_CHAT_PROTO)) { - from = hint; - } else { - char *p; - - if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { - from = ffrom = strdup(profile->login); - } else { - from = ffrom = switch_mprintf("%s+%s", proto, from); - } - - if ((p = strchr(from, '/'))) { - *p = '\0'; - } - } - if (!(profile->user_flags & LDL_FLAG_COMPONENT) && !strcmp(f_user, MDL_CHAT_FROM_GUESS)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Using auto_from jid address for profile %s\n", profile->name); - ldl_handle_send_msg(profile->handle, NULL, (char *) to, NULL, switch_str_nil(body)); - } else { - ldl_handle_send_msg(profile->handle, (char *) from, (char *) to, NULL, switch_str_nil(body)); - } - switch_safe_free(ffrom); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid Profile %s\n", f_host ? f_host : "NULL"); - status = SWITCH_STATUS_FALSE; - goto done; - } - } - - done: - switch_safe_free(user); - switch_safe_free(f_user); - - return status; -} - - -static void roster_event_handler(switch_event_t *event) -{ - char *status = switch_event_get_header(event, "status"); - char *from = switch_event_get_header(event, "from"); - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - void *val; - char *sql; - - if (globals.running != 1) { - return; - } - - if (status && !strcasecmp(status, "n/a")) { - status = NULL; - } - - if (from) { - sql = switch_mprintf("select *,'%q' from jabber_subscriptions where sub_from='%q'", status ? status : "", from); - } else { - sql = switch_mprintf("select *,'%q' from jabber_subscriptions", status ? status : ""); - } - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - - if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { - continue; - } - - - if (sql) { - switch_bool_t worked = mdl_execute_sql_callback(profile, profile->mutex, sql, rost_callback, profile); - if (!worked) { - continue; - } - } - - } - - switch_safe_free(sql); - -} - -static void ipchanged_event_handler(switch_event_t *event) -{ - const char *cond = switch_event_get_header(event, "condition"); - - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "EVENT_TRAP: IP change detected\n"); - - if (cond && !strcmp(cond, "network-external-address-change")) { - const char *old_ip4 = switch_event_get_header_nil(event, "network-external-address-previous-v4"); - const char *new_ip4 = switch_event_get_header_nil(event, "network-external-address-change-v4"); - switch_hash_index_t *hi; - void *val; - char *tmp; - mdl_profile_t *profile; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "IP change detected [%s]->[%s]\n", old_ip4, new_ip4); - if (globals.profile_hash) { - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - if (old_ip4 && profile->extip && !strcmp(profile->extip, old_ip4)) { - tmp = profile->extip; - profile->extip = strdup(new_ip4); - switch_safe_free(tmp); - } - } - } - } -} - -static int so_callback(void *pArg, int argc, char **argv, char **columnNames) -{ - mdl_profile_t *profile = (mdl_profile_t *) pArg; - - char *sub_from = argv[0]; - char *sub_to = argv[1]; - - - ldl_handle_send_presence(profile->handle, sub_to, sub_from, "unavailable", "dnd", "Bub-Bye", profile->avatar); - - return 0; -} - - -static int sin_callback(void *pArg, int argc, char **argv, char **columnNames) -{ - mdl_profile_t *profile = (mdl_profile_t *) pArg; - switch_event_t *event; - - //char *sub_from = argv[0]; - char *sub_to = argv[1]; - - if (is_special(sub_to)) { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", sub_to); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "available"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Online"); - switch_event_fire(&event); - } - } - - return 0; -} - -static void sign_off(void) -{ - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - void *val; - char *sql; - - - - sql = switch_mprintf("select * from jabber_subscriptions"); - - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - - if (!(profile->user_flags & LDL_FLAG_COMPONENT)) { - continue; - } - - - if (sql) { - switch_bool_t worked = mdl_execute_sql_callback(profile, profile->mutex, sql, so_callback, profile); - if (!worked) { - continue; - } - } - - } - - switch_yield(1000000); - switch_safe_free(sql); - -} - -static void sign_on(mdl_profile_t *profile) -{ - char *sql; - - - if ((sql = switch_mprintf("select * from jabber_subscriptions where sub_to like 'ext+%%' or sub_to like 'user+%%' or sub_to like 'conf+%%'"))) { - mdl_execute_sql_callback(profile, profile->mutex, sql, sin_callback, profile); - switch_safe_free(sql); - } -} - -static void terminate_session(switch_core_session_t **session, int line, switch_call_cause_t cause) -{ - if (*session) { - switch_channel_t *channel = switch_core_session_get_channel(*session); - switch_channel_state_t state = switch_channel_get_state(channel); - struct private_object *tech_pvt = NULL; - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*session), SWITCH_LOG_DEBUG, "Terminate called from line %d state=%s\n", line, - switch_channel_state_name(state)); - - tech_pvt = switch_core_session_get_private(*session); - - - 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))) { - switch_core_session_destroy(session); - return; - } - - if (!tech_pvt || switch_test_flag(tech_pvt, TFLAG_TERM)) { - /*once is enough */ - return; - } - - if (state < CS_HANGUP) { - switch_channel_hangup(channel, cause); - } - - switch_mutex_lock(tech_pvt->flag_mutex); - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - switch_set_flag(tech_pvt, TFLAG_TERM); - } - switch_set_flag(tech_pvt, TFLAG_BYE); - switch_clear_flag(tech_pvt, TFLAG_IO); - switch_mutex_unlock(tech_pvt->flag_mutex); - - *session = NULL; - } - -} - -static void dl_logger(char *file, const char *func, int line, int level, char *fmt, ...) -{ - va_list ap; - char *data = NULL; - - va_start(ap, fmt); - if (switch_vasprintf(&data, fmt, ap) != -1) { - if (!strncasecmp(data, "+xml:", 5)) { - switch_xml_t xml; - char *form; - char *ll = data + 5; - char *xmltxt; - - if (ll) { - if ((xmltxt = strchr(ll, ':'))) { - *xmltxt++ = '\0'; - if (strlen(xmltxt) > 2) { - xml = switch_xml_parse_str(xmltxt, strlen(xmltxt)); - form = switch_xml_toxml(xml, SWITCH_FALSE); - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, - "%s:\n-------------------------------------------------------------------------------\n" "%s\n", ll, form); - switch_xml_free(xml); - free(data); - switch_safe_free(form); - } - } - } - } else { - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, level, "%s\n", data); - } - } - va_end(ap); -} - -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 ((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, NULL, - 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; - } - } - - return tech_pvt->num_codecs; -} - - - -static void *SWITCH_THREAD_FUNC handle_thread_run(switch_thread_t *thread, void *obj) -{ - ldl_handle_t *handle = obj; - mdl_profile_t *profile = NULL; - - - - profile = ldl_handle_get_private(handle); - globals.handles++; - switch_set_flag(profile, TFLAG_IO); - ldl_handle_run(handle); - switch_clear_flag(profile, TFLAG_IO); - globals.handles--; - ldl_handle_destroy(&profile->handle); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Handle %s [%s] Destroyed\n", profile->name, profile->login); - - return NULL; -} - -static void handle_thread_launch(ldl_handle_t *handle) -{ - switch_thread_t *thread; - switch_threadattr_t *thd_attr = NULL; - - switch_threadattr_create(&thd_attr, module_pool); - switch_threadattr_detach_set(thd_attr, 1); - switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE); - switch_thread_create(&thread, thd_attr, handle_thread_run, handle, module_pool); - -} - - -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) -{ - switch_secure_settings_t ssec; /* Used just to wrap over params in a call to switch_rtp_add_crypto_key. */ - - if (!switch_test_flag(tech_pvt, TFLAG_SECURE)) { - return; - } - - memset(&ssec, 0, sizeof(ssec)); - - 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) { - - memcpy(ssec.local_raw_key, tech_pvt->transports[ttype].local_raw_key, switch_core_media_crypto_keysalt_len(tech_pvt->transports[ttype].crypto_type)); - ssec.local_crypto_key = switch_core_session_strdup(tech_pvt->session, tech_pvt->transports[ttype].local_crypto_key); - switch_core_media_add_crypto(tech_pvt->session, &ssec, SWITCH_RTP_CRYPTO_SEND); - switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, SWITCH_RTP_CRYPTO_SEND_RTCP, tech_pvt->transports[ttype].crypto_type, &ssec); - - memcpy(ssec.remote_raw_key, tech_pvt->transports[ttype].remote_raw_key, switch_core_media_crypto_keysalt_len(tech_pvt->transports[ttype].crypto_type)); - ssec.remote_crypto_key = switch_core_session_strdup(tech_pvt->session, tech_pvt->transports[ttype].local_crypto_key); - switch_core_media_add_crypto(tech_pvt->session, &ssec, SWITCH_RTP_CRYPTO_RECV); - switch_rtp_add_crypto_key(tech_pvt->transports[ttype].rtp_session, SWITCH_RTP_CRYPTO_RECV, tech_pvt->transports[ttype].crypto_type, &ssec); - - 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 = tech_pvt->transports[LDL_TPORT_RTP].ptime; - switch_rtp_flag_t flags[SWITCH_RTP_FLAG_INVALID] = {0}; - int locked = 0; - int r = 1; - - - //if (switch_rtp_ready(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - // return 1; - //} - - 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_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, - 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_codec.session = tech_pvt->session; - - 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, - 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].write_codec.session = tech_pvt->session; - 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); - } - - 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->transports[LDL_TPORT_RTP].local_port, SWITCH_NAT_UDP, &external_port, SWITCH_FALSE); - - if (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->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 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]++; - flags[SWITCH_RTP_FLAG_GOOGLEHACK]++; - flags[SWITCH_RTP_FLAG_AUTOADJ]++; - flags[SWITCH_RTP_FLAG_RAW_WRITE]++; - flags[SWITCH_RTP_FLAG_AUTO_CNG]++; - - if (switch_test_flag(tech_pvt->profile, TFLAG_TIMER)) { - flags[SWITCH_RTP_FLAG_USE_TIMER]++; - } - - if (switch_true(switch_channel_get_variable(channel, "disable_rtp_auto_adjust"))) { - flags[SWITCH_RTP_FLAG_AUTOADJ] = 0; - } - - 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), 0, 0))) { - 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 { - 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_set_ssrc(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_RTP].ssrc); - - switch_rtp_intentional_bugs(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, RTP_BUG_GEN_ONE_GEN_ALL); - - - 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, SWITCH_FALSE); - - } - - 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, NULL, - IPR_RTP, - ICE_GOOGLE_JINGLE, 0); - - if ((vad_in && inb) || (vad_out && !inb)) { - 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); - r = 0; - goto end; - } - switch_set_flag_locked(tech_pvt, TFLAG_VAD); - } - //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_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, - NULL, IPR_RTCP, - ICE_GOOGLE_JINGLE, 0); - - } - - - - } - - 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[SWITCH_RTP_FLAG_INVALID] = {0}; - 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, - 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, - 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]++; - flags[SWITCH_RTP_FLAG_GOOGLEHACK]++; - flags[SWITCH_RTP_FLAG_AUTOADJ]++; - flags[SWITCH_RTP_FLAG_RAW_WRITE]++; - flags[SWITCH_RTP_FLAG_VIDEO]++; - - if (switch_true(switch_channel_get_variable(channel, "disable_rtp_auto_adjust"))) { - flags[SWITCH_RTP_FLAG_AUTOADJ] = 0; - } - - 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), 0, 0))) { - 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, SWITCH_FALSE); - } - 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, - NULL, NULL, IPR_RTP, ICE_GOOGLE_JINGLE, 0);//tech_pvt->transports[LDL_TPORT_VIDEO_RTP].remote_pass); - switch_channel_set_flag(channel, CF_VIDEO); - switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY); - //switch_rtp_set_default_payload(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num); - //switch_rtp_set_recv_pt(tech_pvt->transports[LDL_TPORT_VIDEO_RTP].rtp_session, tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_num); - - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].remote_port) { - - switch_rtp_activate_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, - NULL, NULL, IPR_RTCP, ICE_GOOGLE_JINGLE, 0);//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 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) { - if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted) { - 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)) { - char *lookup = switch_stun_host_lookup(address + 5, switch_core_session_get_pool(tech_pvt->session)); - - if (zstr(lookup)) { - address = address + 5; - } else { - address = lookup; - } - } - - 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 (advip && !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) || !tech_pvt->dlsession) { - return 0; - } - switch_set_flag_locked(tech_pvt, TFLAG_DO_CAND); - - idx += do_tport_candidates(tech_pvt, LDL_TPORT_RTP, &cand[idx], force); - idx += do_tport_candidates(tech_pvt, LDL_TPORT_RTCP, &cand[idx], force); - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_index > -1) { - 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, idx); - } else { - 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); - tech_pvt->audio_ready = switch_micro_time_now(); - } - - - switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND); - return 1; - -} - - - - -static char *lame(char *in) -{ - if (!strncasecmp(in, "ilbc", 4)) { - return "iLBC"; - } else { - return in; - } -} - - -static void setup_codecs(struct private_object *tech_pvt) -{ - ldl_payload_t payloads[LDL_MAX_PAYLOADS] = { {0} }; - unsigned 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_PAYLOAD_AUDIO; - 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_PAYLOAD_VIDEO; - 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 && 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; - } - - - 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) -{ - - if (!tech_pvt->session) { - return 0; - } - - tech_pvt->next_desc += DL_CAND_WAIT; - - if (switch_test_flag(tech_pvt, TFLAG_BYE)) { - return 0; - } - - - switch_set_flag_locked(tech_pvt, TFLAG_DO_CAND); - if (!get_codecs(tech_pvt)) { - terminate_session(&tech_pvt->session, __LINE__, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - return 0; - } - - - if (force || !switch_test_flag(tech_pvt, TFLAG_CODEC_READY)) { - setup_codecs(tech_pvt); - switch_set_flag_locked(tech_pvt, TFLAG_CODEC_READY); - } - switch_clear_flag_locked(tech_pvt, TFLAG_DO_CAND); - return 1; -} - -static switch_status_t negotiate_media(switch_core_session_t *session) -{ - switch_status_t ret = SWITCH_STATUS_FALSE; - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - switch_time_t started; - switch_time_t now; - unsigned int elapsed, audio_elapsed; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch_set_flag_locked(tech_pvt, TFLAG_IO); - - started = switch_micro_time_now(); - - /* jingle has no ringing indication so we will just pretend that we got one */ - switch_channel_mark_ring_ready(channel); - - if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - tech_pvt->next_cand = started + DL_CAND_WAIT; - tech_pvt->next_desc = started; - } else { - tech_pvt->next_cand = started + DL_CAND_WAIT; - tech_pvt->next_desc = started + DL_CAND_WAIT; - } - - while (!(switch_test_flag(tech_pvt, TFLAG_CODEC_READY) && - switch_test_flag(tech_pvt, TFLAG_RTP_READY) && - (switch_test_flag(tech_pvt, TFLAG_OUTBOUND) || switch_test_flag(tech_pvt, TFLAG_VIDEO_RTP_READY)) && - 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); - - - if (switch_test_flag(tech_pvt, TFLAG_RTP_READY) && !switch_test_flag(tech_pvt, TFLAG_VIDEO_RTP_READY)) { - audio_elapsed = (unsigned int) ((now - tech_pvt->audio_ready) / 1000); - if (audio_elapsed > 1000) { - switch_set_flag(tech_pvt, TFLAG_VIDEO_RTP_READY); - } - } - - if (switch_channel_down(channel) || switch_test_flag(tech_pvt, TFLAG_BYE)) { - goto out; - } - - - if (now >= tech_pvt->next_desc) { - if (!do_describe(tech_pvt, 0)) { - goto out; - } - } - - if (tech_pvt->next_cand && now >= tech_pvt->next_cand) { - if (!do_candidates(tech_pvt, 0)) { - goto out; - } - } - if (elapsed > 60000) { - terminate_session(&tech_pvt->session, __LINE__, SWITCH_CAUSE_NORMAL_CLEARING); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); - 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; - } - - 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)) { - goto done; - } - - if (!activate_rtp(tech_pvt)) { - goto done; - } - - if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - if (!do_candidates(tech_pvt, 0)) { - goto done; - } - if (switch_test_flag(tech_pvt, TFLAG_TRANSPORT_ACCEPT)) { - switch_channel_answer(channel); - } - } - ret = SWITCH_STATUS_SUCCESS; - - switch_channel_audio_sync(channel); - - - goto done; - - out: - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - done: - - return ret; -} - -/* - State methods they get called when the state changes to the specific state - returning SWITCH_STATUS_SUCCESS tells the core to execute the standard state method next - so if you fully implement the state you can return SWITCH_STATUS_FALSE to skip it. -*/ -static switch_status_t channel_on_init(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - switch_channel_set_variable(channel, "jitterbuffer_msec", "1p"); - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - tech_pvt->transports[LDL_TPORT_RTP].read_frame.buflen = SWITCH_RTP_MAX_BUF_LEN; - - switch_set_flag(tech_pvt, TFLAG_READY); - - if (negotiate_media(session) == SWITCH_STATUS_SUCCESS) { - if (switch_channel_direction(channel) == SWITCH_CALL_DIRECTION_OUTBOUND) { - switch_channel_mark_answered(channel); - } - status = SWITCH_STATUS_SUCCESS; - } - - return status; -} - -static switch_status_t channel_on_routing(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL ROUTING\n", switch_channel_get_name(channel)); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_execute(switch_core_session_t *session) -{ - - switch_channel_t *channel = NULL; - struct private_object *tech_pvt = NULL; - - channel = switch_core_session_get_channel(session); - switch_assert(channel != NULL); - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL EXECUTE\n", switch_channel_get_name(channel)); - - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_destroy(switch_core_session_t *session) -{ - //switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - - if (tech_pvt) { - 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->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->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->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->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) { - ldl_session_destroy(&tech_pvt->dlsession); - } - - 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_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name); - } - } - } - } - - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t channel_on_hangup(switch_core_session_t *session) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - 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); - switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); - - /* Dunno why, but if googletalk calls us for the first time, as soon as the call ends - they think we are offline for no reason so we send this presence packet to stop it from happening - We should find out why..... - */ - if ((tech_pvt->profile->user_flags & LDL_FLAG_COMPONENT) && is_special(tech_pvt->them)) { - ldl_handle_send_presence(tech_pvt->profile->handle, tech_pvt->them, tech_pvt->us, NULL, NULL, "Click To Call", tech_pvt->profile->avatar); - } - - if (!switch_test_flag(tech_pvt, TFLAG_TERM) && tech_pvt->dlsession) { - ldl_session_terminate(tech_pvt->dlsession); - switch_set_flag_locked(tech_pvt, TFLAG_TERM); - } - - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL HANGUP\n", switch_channel_get_name(channel)); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_kill_channel(switch_core_session_t *session, int sig) -{ - switch_channel_t *channel = switch_core_session_get_channel(session); - struct private_object *tech_pvt = NULL; - - if (!(tech_pvt = switch_core_session_get_private(session))) { - return SWITCH_STATUS_SUCCESS; - } - - switch (sig) { - case SWITCH_SIG_KILL: - switch_clear_flag_locked(tech_pvt, TFLAG_IO); - switch_clear_flag_locked(tech_pvt, TFLAG_VOICE); - switch_set_flag_locked(tech_pvt, TFLAG_BYE); - - 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->transports[LDL_TPORT_RTP].rtp_session)) { - switch_rtp_set_flag(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, SWITCH_RTP_FLAG_BREAK); - } - break; - } - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s CHANNEL KILL\n", switch_channel_get_name(channel)); - - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_exchange_media(switch_core_session_t *session) -{ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CHANNEL LOOPBACK\n"); - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_on_soft_execute(switch_core_session_t *session) -{ - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "CHANNEL TRANSMIT\n"); - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t channel_send_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf) -{ - struct private_object *tech_pvt = NULL; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "DTMF [%c]\n", dtmf->digit); - - return switch_rtp_queue_rfc2833(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, dtmf); - -} - -static switch_status_t channel_read_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; - - tech_pvt = (struct private_object *) switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - 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 { - return SWITCH_STATUS_GENERR; - } - } - - - tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen = 0; - switch_set_flag_locked(tech_pvt, TFLAG_READING); - -#if 0 - if (tech_pvt->last_read) { - elapsed = (unsigned int) ((switch_micro_time_now() - tech_pvt->last_read) / 1000); - if (elapsed > 60000) { - return SWITCH_STATUS_TIMEOUT; - } - } -#endif - - - if (switch_test_flag(tech_pvt, TFLAG_IO)) { - //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->transports[LDL_TPORT_RTP].read_frame.datalen == 0) { - tech_pvt->transports[LDL_TPORT_RTP].read_frame.flags = SFF_NONE; - - 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->transports[LDL_TPORT_RTP].read_frame.payload; - -#if 0 - elapsed = (unsigned int) ((switch_micro_time_now() - started) / 1000); - - if (timeout > -1) { - if (elapsed >= (unsigned int) timeout) { - return SWITCH_STATUS_BREAK; - } - } - - elapsed = (unsigned int) ((switch_micro_time_now() - last_act) / 1000); - if (elapsed >= hard_timeout) { - return SWITCH_STATUS_BREAK; - } -#endif - if (switch_rtp_has_dtmf(tech_pvt->transports[LDL_TPORT_RTP].rtp_session)) { - switch_dtmf_t dtmf = { 0 }; - switch_rtp_dequeue_dtmf(tech_pvt->transports[LDL_TPORT_RTP].rtp_session, &dtmf); - switch_channel_queue_dtmf(channel, &dtmf); - } - - - if (tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen > 0) { - size_t bytes = 0; - int frames = 1; - - 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 = (int)(tech_pvt->transports[LDL_TPORT_RTP].read_frame.datalen / bytes); - } - tech_pvt->transports[LDL_TPORT_RTP].read_frame.samples = (int) (frames * tech_pvt->transports[LDL_TPORT_RTP].read_codec.implementation->samples_per_packet); - } - break; - } - } - } - - switch_clear_flag_locked(tech_pvt, TFLAG_READING); - - 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->transports[LDL_TPORT_RTP].read_frame; - - 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) -{ - struct private_object *tech_pvt; - switch_channel_t *channel = switch_core_session_get_channel(session); - switch_status_t status = SWITCH_STATUS_SUCCESS; - int bytes = 0, samples = 0, frames = 0; - - tech_pvt = (struct private_object *) switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - 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 { - return SWITCH_STATUS_GENERR; - } - } - - 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; - } - - if (!switch_test_flag(tech_pvt, TFLAG_IO)) { - return SWITCH_STATUS_SUCCESS; - } - - switch_set_flag_locked(tech_pvt, TFLAG_WRITING); - - if (!switch_test_flag(frame, SFF_CNG)) { - 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->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", - switch_channel_get_name(channel), - tech_pvt->local_sdp_audio_ip, tech_pvt->remote_sdp_audio_ip, frame->datalen, samples, frames, tech_pvt->timestamp_send); -#endif - - tech_pvt->timestamp_send += samples; - //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; - } - - switch_clear_flag_locked(tech_pvt, TFLAG_WRITING); - 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 > -1 ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_GENERR; -} - -static switch_status_t channel_answer_channel(switch_core_session_t *session) -{ - struct private_object *tech_pvt; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - if (!switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - switch_set_flag_locked(tech_pvt, TFLAG_ANSWER); - } - - return SWITCH_STATUS_SUCCESS; -} - - -static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg) -{ - struct private_object *tech_pvt; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - switch (msg->message_id) { - case SWITCH_MESSAGE_INDICATE_ANSWER: - channel_answer_channel(session); - break; - case SWITCH_MESSAGE_INDICATE_STUN_ERROR: - //switch_channel_hangup(switch_core_session_get_channel(session), SWITCH_CAUSE_NORMAL_CLEARING); - break; - default: - break; - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t channel_receive_event(switch_core_session_t *session, switch_event_t *event) -{ - struct private_object *tech_pvt; - char *subject, *body; - - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - - if (!(body = switch_event_get_body(event))) { - body = ""; - } - - if (!(subject = switch_event_get_header(event, "subject"))) { - subject = "None"; - } - - ldl_session_send_msg(tech_pvt->dlsession, subject, body); - - return SWITCH_STATUS_SUCCESS; -} - -switch_state_handler_table_t dingaling_event_handlers = { - /*.on_init */ channel_on_init, - /*.on_routing */ channel_on_routing, - /*.on_execute */ channel_on_execute, - /*.on_hangup */ channel_on_hangup, - /*.on_exchange_media */ channel_on_exchange_media, - /*.on_soft_execute */ channel_on_soft_execute, - /*.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 dingaling_io_routines = { - /*.outgoing_channel */ channel_outgoing_channel, - /*.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, - /*.state_change */ NULL, - /*.read_video_frame */ channel_read_video_frame, - /*.write_video_frame */ channel_write_video_frame -}; - - - -/* Make sure when you have 2 sessions in the same scope that you pass the appropriate one to the routines - that allocate memory or you will have 1 channel with memory allocated from another channel's pool! -*/ -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 oflags, - switch_call_cause_t *cancel_cause) -{ - struct private_object *tech_pvt; - switch_channel_t *channel; - switch_caller_profile_t *caller_profile = NULL; - mdl_profile_t *mdl_profile = NULL; - ldl_session_t *dlsession = NULL; - char *profile_name; - char *callto; - char idbuf[1024]; - char *full_id = NULL; - char sess_id[11] = ""; - char *dnis = NULL; - char workspace[1024] = ""; - 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; - char name[128]; - - *new_session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_OUTBOUND, oflags, pool); - - if (!*new_session) { - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - if (!outbound_profile) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Doh! no caller profile\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - switch_copy_string(workspace, outbound_profile->destination_number, sizeof(workspace)); - profile_name = workspace; - - if ((callto = strchr(profile_name, '/'))) { - *callto++ = '\0'; - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Invalid URL!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_INVALID_NUMBER_FORMAT; - } - - if ((dnis = strchr(callto, ':'))) { - *dnis++ = '\0'; - } - - for (p = callto; p && *p; p++) { - *p = (char) tolower(*p); - } - - if ((p = strchr(profile_name, '@'))) { - *p++ = '\0'; - u = profile_name; - profile_name = p; - switch_snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", u, profile_name); - user = ubuf; - } - - mdl_profile = switch_core_hash_find(globals.profile_hash, profile_name); - - if (!mdl_profile) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Unknown Profile!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - if (!(mdl_profile->user_flags & LDL_FLAG_COMPONENT)) { - user = ldl_handle_get_login(mdl_profile->handle); - } else { - if (!user) { - const char *id_num; - - if (!(id_num = outbound_profile->caller_id_number)) { - if (!(id_num = outbound_profile->caller_id_name)) { - id_num = "nobody"; - } - } - - if (strchr(id_num, '@')) { - switch_snprintf(ubuf, sizeof(ubuf), "%s/talk", id_num); - user = ubuf; - } else { - switch_snprintf(ubuf, sizeof(ubuf), "%s@%s/talk", id_num, profile_name); - user = ubuf; - } - } - } - - if (mdl_profile->purge) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing outgoing call\n", - mdl_profile->name); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_NORMAL_UNSPECIFIED); - return SWITCH_CAUSE_NORMAL_UNSPECIFIED; - } - - if (switch_thread_rwlock_tryrdlock(mdl_profile->rwlock) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't do read lock on profile '%s'\n", mdl_profile->name); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_NORMAL_UNSPECIFIED); - 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); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - if (switch_stristr("voice.google.com", callto)) { - full_id = callto; - flags |= LDL_FLAG_GATEWAY; - } else if (!(full_id = ldl_handle_probe(mdl_profile->handle, callto, user, idbuf, sizeof(idbuf)))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Unknown Recipient!\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_NO_USER_RESPONSE); - return SWITCH_CAUSE_NO_USER_RESPONSE; - } - - switch_core_session_add_stream(*new_session, NULL); - tech_pvt = (struct private_object *) switch_core_session_alloc(*new_session, sizeof(struct private_object)); - - if (!tech_pvt) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_CRIT, "Hey where is my memory pool?\n"); - terminate_session(new_session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER; - } - - 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; - channel = switch_core_session_get_channel(*new_session); - switch_core_session_set_private(*new_session, tech_pvt); - tech_pvt->session = *new_session; - 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; - - 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); - - 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->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); - } - - switch_snprintf(name, sizeof(name), "dingaling/%s", outbound_profile->destination_number); - switch_channel_set_name(channel, name); - - caller_profile = switch_caller_profile_clone(*new_session, outbound_profile); - switch_channel_set_caller_profile(channel, caller_profile); - tech_pvt->caller_profile = caller_profile; - - switch_set_flag_locked(tech_pvt, TFLAG_OUTBOUND); - - switch_stun_random_string(sess_id, 10, "0123456789"); - tech_pvt->us = switch_core_session_strdup(*new_session, user); - tech_pvt->them = switch_core_session_strdup(*new_session, full_id); - ldl_session_create(&dlsession, mdl_profile->handle, sess_id, full_id, user, flags); - - if (session) { - switch_channel_t *calling_channel = switch_core_session_get_channel(session); - cid_msg = switch_channel_get_variable(calling_channel, "dl_cid_msg"); - } - - if (!cid_msg) { - f_cid_msg = switch_mprintf("Incoming Call From %s %s\n", outbound_profile->caller_id_name, outbound_profile->caller_id_number); - cid_msg = f_cid_msg; - } - - if ((flags & LDL_FLAG_GATEWAY)) { - cid_msg = NULL; - } - - if (cid_msg) { - char *them; - them = strdup(tech_pvt->them); - if (them) { - char *ptr; - if ((ptr = strchr(them, '/'))) { - *ptr = '\0'; - } - ldl_handle_send_msg(mdl_profile->handle, tech_pvt->us, them, "", switch_str_nil(cid_msg)); - } - switch_safe_free(them); - } - switch_safe_free(f_cid_msg); - - 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); - 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; - } - switch_channel_set_state(channel, CS_INIT); - return SWITCH_CAUSE_SUCCESS; -} - -static switch_status_t list_profiles(const char *line, const char *cursor, switch_console_callback_match_t **matches) -{ - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - void *val; - const void *vvar; - switch_console_callback_match_t *my_matches = NULL; - switch_status_t status = SWITCH_STATUS_FALSE; - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, &vvar, NULL, &val); - profile = (mdl_profile_t *) val; - if (!strncmp("dl_logout", line, 9)) { - if (profile->handle) { - switch_console_push_match(&my_matches, profile->name); - } - } else if (!strncmp("dl_login", line, 8)) { - if (!switch_test_flag(profile, TFLAG_IO)) { - char *profile_name = switch_mprintf("profile=%s", profile->name); - switch_console_push_match(&my_matches, profile_name); - free(profile_name); - } - } else if (!strncmp("dl_pres", line, 7)) { - if (profile->user_flags & LDL_FLAG_COMPONENT) { - switch_console_push_match(&my_matches, profile->name); - } - } else { - switch_console_push_match(&my_matches, profile->name); - } - } - - if (my_matches) { - *matches = my_matches; - status = SWITCH_STATUS_SUCCESS; - } - - return status; -} - -SWITCH_MODULE_LOAD_FUNCTION(mod_dingaling_load) -{ - switch_chat_interface_t *chat_interface; - switch_api_interface_t *api_interface; - - module_pool = pool; - - memset(&globals, 0, sizeof(globals)); - - load_config(); - - if (switch_event_reserve_subclass(DL_EVENT_LOGIN_SUCCESS) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", DL_EVENT_LOGIN_SUCCESS); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_reserve_subclass(DL_EVENT_LOGIN_FAILURE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", DL_EVENT_LOGIN_FAILURE); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_reserve_subclass(DL_EVENT_CONNECTED) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", DL_EVENT_CONNECTED); - return SWITCH_STATUS_GENERR; - } - - if (switch_event_bind_removable(modname, SWITCH_EVENT_PRESENCE_IN, SWITCH_EVENT_SUBCLASS_ANY, pres_event_handler, NULL, &globals.in_node) != - 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, pres_event_handler, NULL, &globals.probe_node) != - 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, pres_event_handler, NULL, &globals.out_node) != - 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, roster_event_handler, NULL, &globals.roster_node) - != 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_TRAP, SWITCH_EVENT_SUBCLASS_ANY, ipchanged_event_handler, NULL) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n"); - return SWITCH_STATUS_GENERR; - } - - - /* connect my internal structure to the blank pointer passed to me */ - *module_interface = switch_loadable_module_create_module_interface(pool, modname); - dingaling_endpoint_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ENDPOINT_INTERFACE); - dingaling_endpoint_interface->interface_name = "dingaling"; - dingaling_endpoint_interface->io_routines = &dingaling_io_routines; - dingaling_endpoint_interface->state_handler = &dingaling_event_handlers; - -#define PRES_SYNTAX "dl_pres " -#define LOGOUT_SYNTAX "dl_logout " -#define LOGIN_SYNTAX "Existing Profile:\ndl_login profile=\nDynamic Profile:\ndl_login var1=val1;var2=val2;varN=valN\n" -#define DEBUG_SYNTAX "dl_debug [true|false]" -#define DINGALING_SYNTAX "dingaling [status|reload]" - - SWITCH_ADD_API(api_interface, "dl_debug", "DingaLing Debug", dl_debug, DEBUG_SYNTAX); - SWITCH_ADD_API(api_interface, "dl_pres", "DingaLing Presence", dl_pres, PRES_SYNTAX); - SWITCH_ADD_API(api_interface, "dl_logout", "DingaLing Logout", dl_logout, LOGOUT_SYNTAX); - SWITCH_ADD_API(api_interface, "dl_login", "DingaLing Login", dl_login, LOGIN_SYNTAX); - SWITCH_ADD_API(api_interface, "dingaling", "DingaLing Menu", dingaling, DINGALING_SYNTAX); - SWITCH_ADD_CHAT(chat_interface, MDL_CHAT_PROTO, chat_send); - - switch_console_set_complete("add dl_debug ::[true:false"); - switch_console_set_complete("add dl_pres ::dingaling::list_profiles"); - switch_console_set_complete("add dl_logout ::dingaling::list_profiles"); - switch_console_set_complete("add dl_login ::dingaling::list_profiles"); - switch_console_set_complete("add dl_login login="); - switch_console_set_complete("add dingaling status"); - switch_console_set_complete("add dingaling reload"); - switch_console_add_complete_func("::dingaling::list_profiles", list_profiles); - - /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; -} - -static ldl_status handle_loop(ldl_handle_t *handle) -{ - if (!globals.running) { - return LDL_STATUS_FALSE; - } - return LDL_STATUS_SUCCESS; -} - -static switch_status_t init_profile(mdl_profile_t *profile, uint8_t login) -{ - ldl_handle_t *handle; - - if (!profile) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Invalid Profile\n"); - return SWITCH_STATUS_FALSE; - } - - if (!(profile->login && profile->password && profile->dialplan && profile->message && profile->ip && profile->name && profile->exten)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "Invalid Profile\n" "login[%s]\n" "pass[%s]\n" "dialplan[%s]\n" - "message[%s]\n" "rtp-ip[%s]\n" "name[%s]\n" "exten[%s]\n", - switch_str_nil(profile->login), - switch_str_nil(profile->password), - switch_str_nil(profile->dialplan), - switch_str_nil(profile->message), switch_str_nil(profile->ip), switch_str_nil(profile->name), switch_str_nil(profile->exten)); - - return SWITCH_STATUS_FALSE; - } - - if (switch_test_flag(profile, TFLAG_TIMER) && !profile->timer_name) { - profile->timer_name = switch_core_strdup(module_pool, "soft"); - } - - if (!login) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Created Profile for %s@%s\n", profile->login, profile->dialplan); - switch_core_hash_insert(globals.profile_hash, profile->name, profile); - return SWITCH_STATUS_SUCCESS; - } - - if (ldl_handle_init(&handle, - profile->login, - profile->password, - profile->server, - profile->user_flags, profile->message, profile->priority, handle_loop, handle_signalling, handle_response, profile) == LDL_STATUS_SUCCESS) { - profile->purge = SWITCH_FALSE; - switch_thread_rwlock_create(&profile->rwlock, module_pool); - - profile->handle = handle; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Started Thread for %s@%s\n", profile->login, profile->dialplan); - switch_core_hash_insert(globals.profile_hash, profile->name, profile); - handle_thread_launch(handle); - } - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_dingaling_shutdown) -{ - sign_off(); - - if (globals.running) { - int x = 0; - globals.running = 0; - ldl_global_terminate(); - while (globals.handles > 0) { - switch_yield(100000); - x++; - if (x > 100) { - break; - } - } - - if (globals.init) { - ldl_global_destroy(); - } - } - - switch_event_free_subclass(DL_EVENT_LOGIN_SUCCESS); - switch_event_free_subclass(DL_EVENT_LOGIN_FAILURE); - switch_event_free_subclass(DL_EVENT_CONNECTED); - switch_event_unbind(&globals.in_node); - switch_event_unbind(&globals.probe_node); - switch_event_unbind(&globals.out_node); - switch_event_unbind(&globals.roster_node); - switch_event_unbind_callback(ipchanged_event_handler); - - - switch_core_hash_destroy(&globals.profile_hash); - - switch_safe_free(globals.dialplan); - switch_safe_free(globals.codec_string); - switch_safe_free(globals.codec_rates_string); - - return SWITCH_STATUS_SUCCESS; -} - - -static void set_profile_val(mdl_profile_t *profile, char *var, char *val) -{ - if (!var) - return; - - if (!strcasecmp(var, "login")) { - profile->login = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "password")) { - profile->password = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "avatar")) { - profile->avatar = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) { - profile->odbc_dsn = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "use-rtp-timer") && switch_true(val)) { - switch_set_flag(profile, TFLAG_TIMER); - } else if (!strcasecmp(var, "dialplan") && !zstr(val)) { - profile->dialplan = switch_core_strdup(module_pool, val); -#ifdef AUTO_REPLY // gotta fix looping on this - } else if (!strcasecmp(var, "auto-reply")) { - profile->auto_reply = switch_core_strdup(module_pool, val); -#endif - } else if (!strcasecmp(var, "name") && !zstr(val)) { - profile->name = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "message") && !zstr(val)) { - profile->message = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "priority") && !zstr(val)) { - profile->priority = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "local-network-acl") && !zstr(val)) { - profile->local_network = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "rtp-ip")) { - profile->ip = switch_core_strdup(module_pool, strcasecmp(switch_str_nil(val), "auto") ? switch_str_nil(val) : globals.guess_ip); - } else if (!strcasecmp(var, "ext-rtp-ip")) { - char *ip = globals.guess_ip; - if (val && !strcasecmp(val, "auto-nat")) { - ip = globals.auto_nat ? switch_core_get_variable_pdup("nat_public_addr", module_pool) : globals.guess_ip; - } else if (val && !strcasecmp(val, "auto")) { - globals.auto_nat = 0; - ip = globals.guess_ip; - } else { - globals.auto_nat = 0; - ip = zstr(val) ? globals.guess_ip : val; - } - if (ip) { - profile->extip = switch_core_strdup(module_pool, ip); - } - } else if (!strcasecmp(var, "server") && !zstr(val)) { - profile->server = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "rtp-timer-name") && !zstr(val)) { - profile->timer_name = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "lanaddr") && !zstr(val)) { - profile->lanaddr = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "candidate-acl")) { - if (profile->acl_count < MAX_ACL) { - profile->acl[profile->acl_count++] = strdup(val); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Max acl records of %d reached\n", MAX_ACL); - } - } else if (!strcasecmp(var, "tls")) { - if (switch_true(val)) { - profile->user_flags |= LDL_FLAG_TLS; - } - } else if (!strcasecmp(var, "sasl")) { - if (val && !strcasecmp(val, "plain")) { - profile->user_flags |= LDL_FLAG_SASL_PLAIN; - } else if (val && !strcasecmp(val, "md5")) { - profile->user_flags |= LDL_FLAG_SASL_MD5; - } - } 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); - } else if (!strcasecmp(var, "context") && !zstr(val)) { - profile->context = switch_core_strdup(module_pool, val); - } else if (!strcasecmp(var, "auto-login") && !zstr(val)) { - if (switch_true(val)) { - switch_set_flag(profile, TFLAG_AUTO); - } - } else if (!strcasecmp(var, "vad") && val) { - if (!strcasecmp(val, "in")) { - switch_set_flag(profile, TFLAG_VAD_IN); - } else if (!strcasecmp(val, "out")) { - switch_set_flag(profile, TFLAG_VAD_OUT); - } else if (!strcasecmp(val, "both")) { - switch_set_flag(profile, TFLAG_VAD_IN); - switch_set_flag(profile, TFLAG_VAD_OUT); - } else if (!strcasecmp(val, "none")) { - switch_set_flag(profile, TFLAG_VAD_NONE); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid option %s for VAD\n", val); - } - } -} - -SWITCH_STANDARD_API(dl_debug) -{ - int on, cur; - - if (session) { - return SWITCH_STATUS_FALSE; - } - - if (cmd) { - on = switch_true(cmd); - cur = ldl_global_debug(on); - } else { - cur = ldl_global_debug(-1); - } - - - stream->write_function(stream, "DEBUG IS NOW %s\n", cur ? "ON" : "OFF"); - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_STANDARD_API(dl_pres) -{ - mdl_profile_t *profile; - - if (session) { - return SWITCH_STATUS_FALSE; - } - - if (!cmd) { - stream->write_function(stream, "USAGE: %s\n", PRES_SYNTAX); - return SWITCH_STATUS_SUCCESS; - } - - if ((profile = switch_core_hash_find(globals.profile_hash, cmd))) { - if (profile->user_flags & LDL_FLAG_COMPONENT) { - sign_on(profile); - stream->write_function(stream, "OK\n"); - } else { - stream->write_function(stream, "NO PROFILE %s NOT A COMPONENT\n", cmd); - } - } else { - stream->write_function(stream, "NO SUCH PROFILE %s\n", cmd); - } - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_STANDARD_API(dl_logout) -{ - mdl_profile_t *profile; - - if (session) { - return SWITCH_STATUS_FALSE; - } - - if (!cmd) { - stream->write_function(stream, "USAGE: %s\n", LOGOUT_SYNTAX); - return SWITCH_STATUS_SUCCESS; - } - - if (((profile = switch_core_hash_find(globals.profile_hash, cmd))) && profile->handle) { - ldl_handle_stop(profile->handle); - stream->write_function(stream, "OK\n"); - } else if (profile) { - stream->write_function(stream, "NOT LOGGED IN\n"); - } else { - stream->write_function(stream, "NO SUCH PROFILE %s\n", cmd); - } - - return SWITCH_STATUS_SUCCESS; -} - -SWITCH_STANDARD_API(dingaling) -{ - char *argv[10] = { 0 }; - void *val; - char *myarg = NULL; - mdl_profile_t *profile = NULL; - switch_hash_index_t *hi; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (session) - return status; - - if (zstr(cmd) || !(myarg = strdup(cmd))) { - stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX); - return SWITCH_STATUS_FALSE; - } - - if (switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) != 1) { - stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX); - goto done; - } - - if (argv[0] && !strncasecmp(argv[0], "status", 6)) { - stream->write_function(stream, "--DingaLing status--\n"); - stream->write_function(stream, "login | connected\n"); - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &val); - profile = (mdl_profile_t *) val; - stream->write_function(stream, "%s | ", profile->login); - if (profile->handle && ldl_handle_authorized(profile->handle)) { - stream->write_function(stream, "AUTHORIZED"); - } else if (profile->handle && ldl_handle_connected(profile->handle)) { - stream->write_function(stream, "CONNECTED"); - } else { - stream->write_function(stream, "UNCONNECTED"); - } - stream->write_function(stream, "\n"); - } - } else if (argv[0] && !strncasecmp(argv[0], "reload", 6)) { - soft_reload(); - stream->write_function(stream, "OK\n"); - } else { - stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX); - } - - done: - switch_safe_free(myarg); - return status; -} - -SWITCH_STANDARD_API(dl_login) -{ - char *argv[20] = { 0 }; - int argc = 0; - char *var, *val, *myarg = NULL; - mdl_profile_t *profile = NULL; - int x; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (session) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - if (zstr(cmd)) { - stream->write_function(stream, "USAGE: %s\n", LOGIN_SYNTAX); - status = SWITCH_STATUS_SUCCESS; - goto done; - } - - myarg = strdup(cmd); - - argc = switch_separate_string(myarg, ';', argv, (sizeof(argv) / sizeof(argv[0]))); - - if (argv[0] && !strncasecmp(argv[0], "profile=", 8)) { - char *profile_name = argv[0] + 8; - profile = switch_core_hash_find(globals.profile_hash, profile_name); - - if (profile) { - if (switch_test_flag(profile, TFLAG_IO)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile already exists.\n"); - stream->write_function(stream, "Profile already exists\n"); - status = SWITCH_STATUS_SUCCESS; - goto done; - } - - } - } else { - profile = switch_core_alloc(module_pool, sizeof(*profile)); - - for (x = 0; x < argc; x++) { - var = argv[x]; - if (var && (val = strchr(var, '='))) { - *val++ = '\0'; - set_profile_val(profile, var, val); - } - } - } - - - if (profile && init_profile(profile, 1) == SWITCH_STATUS_SUCCESS) { - stream->write_function(stream, "OK\n"); - } else { - stream->write_function(stream, "FAIL\n"); - } - done: - switch_safe_free(myarg); - - return status; -} - - -static switch_bool_t match_profile(mdl_profile_t *profile, mdl_profile_t *new_profile) -{ - if (profile == new_profile) { - return SWITCH_TRUE; - } - - if (((!new_profile->name && !profile->name) || - (new_profile->name && profile->name && !strcasecmp(new_profile->name, profile->name))) && - ((!new_profile->login && !profile->login) || - (new_profile->login && profile->login && !strcasecmp(new_profile->login, profile->login))) && - ((!new_profile->password && !profile->password) || - (new_profile->password && profile->password && !strcasecmp(new_profile->password, profile->password))) && - ((!new_profile->message && !profile->message) || - (new_profile->message && profile->message && !strcasecmp(new_profile->message, profile->message))) && - ((!new_profile->priority && !profile->priority) || - (new_profile->priority && profile->priority && !strcasecmp(new_profile->priority, profile->priority))) && - ((!new_profile->avatar && !profile->avatar) || (new_profile->avatar && profile->avatar && !strcasecmp(new_profile->avatar, profile->avatar))) && -#ifdef AUTO_REPLY - ((!new_profile->auto_reply && !profile->auto_reply) || - (new_profile->auto_reply && profile->auto_reply && !strcasecmp(new_profile->auto_reply, profile->auto_reply))) && -#endif - ((!new_profile->dialplan && !profile->dialplan) || - (new_profile->dialplan && profile->dialplan && !strcasecmp(new_profile->dialplan, profile->dialplan))) && - ((!new_profile->local_network && !profile->local_network) || - (new_profile->local_network && profile->local_network && !strcasecmp(new_profile->local_network, profile->local_network))) && - ((!new_profile->ip && !profile->ip) || - (new_profile->ip && profile->ip && !strcasecmp(new_profile->ip, profile->ip))) && - ((!new_profile->extip && !profile->extip) || - (new_profile->extip && profile->extip && !strcasecmp(new_profile->extip, profile->extip))) && - ((!new_profile->server && !profile->server) || - (new_profile->server && profile->server && !strcasecmp(new_profile->server, profile->server))) && - ((!new_profile->timer_name && !profile->timer_name) || - (new_profile->timer_name && profile->timer_name && !strcasecmp(new_profile->timer_name, profile->timer_name))) && - ((!new_profile->lanaddr && !profile->lanaddr) || - (new_profile->lanaddr && profile->lanaddr && !strcasecmp(new_profile->lanaddr, profile->lanaddr))) && - ((!new_profile->exten && !profile->exten) || - (new_profile->exten && profile->exten && !strcasecmp(new_profile->exten, profile->exten))) && - ((!new_profile->context && !profile->context) || - (new_profile->context && profile->context && !strcasecmp(new_profile->context, profile->context))) && - (new_profile->user_flags == profile->user_flags) && (new_profile->acl_count == profile->acl_count) - ) { - uint32_t i; - - if (!(((!new_profile->odbc_dsn && !profile->odbc_dsn) || - (new_profile->odbc_dsn && profile->odbc_dsn && !strcasecmp(new_profile->odbc_dsn, profile->odbc_dsn))) - )) { - return SWITCH_FALSE; - } - - - for (i = 0; i < new_profile->acl_count; i++) { - if (strcasecmp(new_profile->acl[i], profile->acl[i]) != 0) { - return SWITCH_FALSE; - } - } - } - - return SWITCH_TRUE; -} - -static switch_status_t destroy_profile(char *name) -{ - mdl_profile_t *profile = NULL; - - if ((profile = switch_core_hash_find(globals.profile_hash, name))) { - if (profile->user_flags & LDL_FLAG_COMPONENT) { - switch_mutex_destroy(profile->mutex); - } - - if (switch_thread_rwlock_trywrlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s is busy\n", profile->name); - profile->purge = SWITCH_TRUE; - if (profile->handle) { - ldl_handle_stop(profile->handle); - } - } else { - switch_thread_rwlock_unlock(profile->rwlock); - profile->purge = SWITCH_TRUE; - - if (profile->handle) { - ldl_handle_stop(profile->handle); - } - - if (switch_core_hash_delete(globals.profile_hash, profile->name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Profile %s deleted successfully\n", profile->name); - } - } - } - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t soft_reload(void) -{ - char *cf = "dingaling.conf"; - mdl_profile_t *profile = NULL, *old_profile = NULL; - switch_xml_t cfg, xml, /*settings, */ param, xmlint; - - void *data = NULL; - switch_hash_t *name_hash; - switch_hash_index_t *hi; - switch_core_hash_init(&name_hash); - - 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 (!(xmlint = switch_xml_child(cfg, "profile"))) { - if ((xmlint = switch_xml_child(cfg, "interface"))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!!!!!!! DEPRICATION WARNING 'interface' is now 'profile' !!!!!!!\n"); - } - } - - for (; xmlint; xmlint = xmlint->next) { - char *type = (char *) switch_xml_attr_soft(xmlint, "type"); - for (param = switch_xml_child(xmlint, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (!profile) { - profile = switch_core_alloc(module_pool, sizeof(*profile)); - } - - set_profile_val(profile, var, val); - } - - if (profile && type && !strcasecmp(type, "component")) { - char dbname[256]; - switch_cache_db_handle_t *dbh = NULL; - - if (!profile->login && profile->name) { - profile->login = switch_core_strdup(module_pool, profile->name); - } - - switch_set_flag(profile, TFLAG_AUTO); - profile->message = ""; - profile->priority = ""; - profile->user_flags |= LDL_FLAG_COMPONENT; - switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, module_pool); - switch_snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name); - profile->dbname = switch_core_strdup(module_pool, dbname); - - if ((dbh = mdl_get_db_handle(profile))) { - switch_cache_db_test_reactive(dbh, "select * from jabber_subscriptions", NULL, sub_sql); - switch_cache_db_release_db_handle(&dbh); - } - } - - if (profile) { - switch_core_hash_insert(name_hash, profile->name, profile->login); - - if ((old_profile = switch_core_hash_find(globals.profile_hash, profile->name))) { - if (match_profile(old_profile, profile)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found pre-existing profile %s [%s]\n", profile->name, profile->login); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Overwriting pre-existing profile %s [%s]\n", profile->name, profile->login); - destroy_profile(old_profile->name); - init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0); - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found new profile %s [%s]\n", profile->name, profile->login); - init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0); - } - - profile = NULL; - } - } - - switch_xml_free(xml); - - for (hi = switch_core_hash_first(globals.profile_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &data); - profile = (mdl_profile_t *) data; - - if (switch_core_hash_find(name_hash, profile->name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "New profile %s [%s] activated\n", profile->name, profile->login); - } else { - switch_core_hash_insert(name_hash, profile->name, profile->name); - } - } - - for (hi = switch_core_hash_first(name_hash); hi; hi = switch_core_hash_next(&hi)) { - switch_core_hash_this(hi, NULL, NULL, &data); - - if ((profile = switch_core_hash_find(globals.profile_hash, (char *) data))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Deleting unused profile %s [%s]\n", profile->name, profile->login); - destroy_profile(profile->name); - } - } - - switch_core_hash_destroy(&name_hash); - - return SWITCH_STATUS_SUCCESS; -} - -static switch_status_t load_config(void) -{ - char *cf = "dingaling.conf"; - mdl_profile_t *profile = NULL; - switch_xml_t cfg, xml, settings, param, xmlint; - - memset(&globals, 0, sizeof(globals)); - globals.running = 1; - globals.auto_nat = (switch_nat_get_type() ? 1 : 0); - - switch_find_local_ip(globals.guess_ip, sizeof(globals.guess_ip), NULL, AF_INET); - - switch_core_hash_init(&globals.profile_hash); - - 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 ((settings = switch_xml_child(cfg, "settings"))) { - for (param = switch_xml_child(settings, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (!strcasecmp(var, "debug")) { - globals.debug = atoi(val); - } else if (!strcasecmp(var, "codec-prefs")) { - set_global_codec_string(val); - globals.codec_order_last = switch_separate_string(globals.codec_string, ',', globals.codec_order, SWITCH_MAX_CODECS); - } else if (!strcasecmp(var, "codec-rates")) { - set_global_codec_rates_string(val); - globals.codec_rates_last = switch_separate_string(globals.codec_rates_string, ',', globals.codec_rates, SWITCH_MAX_CODECS); - } - } - } - - if (!(xmlint = switch_xml_child(cfg, "profile"))) { - if ((xmlint = switch_xml_child(cfg, "interface"))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "!!!!!!! DEPRICATION WARNING 'interface' is now 'profile' !!!!!!!\n"); - } - } - - for (; xmlint; xmlint = xmlint->next) { - char *type = (char *) switch_xml_attr_soft(xmlint, "type"); - for (param = switch_xml_child(xmlint, "param"); param; param = param->next) { - char *var = (char *) switch_xml_attr_soft(param, "name"); - char *val = (char *) switch_xml_attr_soft(param, "value"); - - if (!globals.init) { - ldl_global_init(globals.debug); - ldl_global_set_logger(dl_logger); - globals.init = 1; - } - - if (!profile) { - profile = switch_core_alloc(module_pool, sizeof(*profile)); - } - - set_profile_val(profile, var, val); - } - - - if (profile && type && !strcasecmp(type, "component")) { - char dbname[256]; - switch_cache_db_handle_t *dbh = NULL; - - if (!profile->login && profile->name) { - profile->login = switch_core_strdup(module_pool, profile->name); - } - - switch_set_flag(profile, TFLAG_AUTO); - profile->message = ""; - profile->priority = ""; - profile->user_flags |= LDL_FLAG_COMPONENT; - switch_mutex_init(&profile->mutex, SWITCH_MUTEX_NESTED, module_pool); - switch_snprintf(dbname, sizeof(dbname), "dingaling_%s", profile->name); - profile->dbname = switch_core_strdup(module_pool, dbname); - - - if ((dbh = mdl_get_db_handle(profile))) { - switch_cache_db_test_reactive(dbh, "select * from jabber_subscriptions", NULL, sub_sql); - switch_cache_db_release_db_handle(&dbh); - } - } - - if (profile) { - init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0); - profile = NULL; - } - } - - if (profile) { - init_profile(profile, switch_test_flag(profile, TFLAG_AUTO) ? 1 : 0); - profile = NULL; - } - - if (!globals.dialplan) { - set_global_dialplan("default"); - } - - if (!globals.init) { - ldl_global_init(globals.debug); - ldl_global_set_logger(dl_logger); - globals.init = 1; - } - - - switch_xml_free(xml); - - return SWITCH_STATUS_SUCCESS; -} - - -static void do_vcard(ldl_handle_t *handle, char *to, char *from, char *id) -{ - switch_event_t *params = NULL; - char *real_to, *to_user, *xmlstr = NULL, *to_host = NULL; - switch_xml_t domain, xml = NULL, user, vcard; - int sent = 0; - - if (!strncasecmp(to, "user+", 5)) { - real_to = to + 5; - } else { - real_to = to; - } - - - if ((to_user = strdup(real_to))) { - if ((to_host = strchr(to_user, '@'))) { - *to_host++ = '\0'; - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - goto end; - } - - if (!to_host) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Missing Host!\n"); - goto end; - } - - switch_event_create(¶ms, SWITCH_EVENT_REQUEST_PARAMS); - switch_assert(params); - switch_event_add_header(params, SWITCH_STACK_BOTTOM, "to", "%s@%s", to_user, to_host); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "object", "vcard"); - - if (switch_xml_locate("directory", "domain", "name", to_host, &xml, &domain, params, SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "can't find domain for [%s@%s]\n", to_user, to_host); - goto end; - } - - if (!(user = switch_xml_find_child(domain, "user", "id", to_user))) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find user [%s@%s]\n", to_user, to_host); - goto end; - } - - if (!(vcard = switch_xml_child(user, "vcard"))) { - //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "can't find tag for user [%s@%s]\n", to_user, to_host); - goto end; - } - - switch_xml_set_attr(vcard, "xmlns", "vcard-tmp"); - - if ((xmlstr = switch_xml_toxml(vcard, SWITCH_FALSE))) { - ldl_handle_send_vcard(handle, to, from, id, xmlstr); - sent = 1; - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); - } - - end: - - switch_event_destroy(¶ms); - - if (!sent) { - ldl_handle_send_vcard(handle, to, from, id, NULL); - } - - if (xml) - switch_xml_free(xml); - switch_safe_free(to_user); - switch_safe_free(params); - switch_safe_free(xmlstr); -} - -static ldl_status 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; - ldl_status status = LDL_STATUS_SUCCESS; - - if (!(tech_pvt = switch_core_session_get_private(session))) { - return LDL_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, "relay")) && - ((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)) { - - if (tech_pvt->transports[LDL_TPORT_VIDEO_RTP].accepted && - tech_pvt->transports[LDL_TPORT_VIDEO_RTCP].accepted) { - activate_video_rtp(tech_pvt); - } - - - if (tech_pvt->transports[LDL_TPORT_RTP].accepted && - tech_pvt->transports[LDL_TPORT_RTCP].accepted) { - 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; - ldl_status 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) -{ - mdl_profile_t *profile = NULL; - switch_core_session_t *session = NULL; - switch_channel_t *channel = NULL; - struct private_object *tech_pvt = NULL; - switch_event_t *event; - ldl_status status = LDL_STATUS_SUCCESS; - char *sql; - - switch_assert(handle != NULL); - - if (!(profile = ldl_handle_get_private(handle))) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "ERROR NO PROFILE!\n"); - status = LDL_STATUS_FALSE; - goto done; - } - - if (!dlsession) { - if (profile->user_flags & LDL_FLAG_COMPONENT) { - switch (dl_signal) { - case LDL_SIGNAL_VCARD: - do_vcard(handle, to, from, subject); - break; - case LDL_SIGNAL_UNSUBSCRIBE: - - if ((sql = switch_mprintf("delete from jabber_subscriptions where sub_from='%q' and sub_to='%q';", from, to))) { - mdl_execute_sql(profile, sql, profile->mutex); - free(sql); - } - - break; - - case LDL_SIGNAL_SUBSCRIBE: - if (profile->user_flags & LDL_FLAG_COMPONENT && ldl_jid_domcmp(from, to)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Attempt to add presence from/to our own domain [%s][%s]\n", - from, to); - } else { - switch_mutex_lock(profile->mutex); - if ((sql = switch_mprintf("delete from jabber_subscriptions where sub_from='%q' and sub_to='%q'", from, to))) { - mdl_execute_sql(profile, sql, NULL); - free(sql); - } - if ((sql = switch_mprintf("insert into jabber_subscriptions values('%q','%q','%q','%q');\n", - switch_str_nil(from), switch_str_nil(to), switch_str_nil(msg), switch_str_nil(subject)))) { - mdl_execute_sql(profile, sql, NULL); - free(sql); - } - switch_mutex_unlock(profile->mutex); - if (is_special(to)) { - ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call", profile->avatar); - } else { - ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Authenticated.\nCome to ClueCon!\nhttp://www.cluecon.com", - profile->avatar); - } -#if 0 - if (is_special(to)) { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", to); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Click To Call"); - switch_event_fire(&event); - } - } -#endif - } - break; - case LDL_SIGNAL_ROSTER: - if (switch_event_create(&event, SWITCH_EVENT_ROSTER) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_fire(&event); - } - break; - case LDL_SIGNAL_PRESENCE_PROBE: - if (is_special(to)) { - ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call", profile->avatar); - } else { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_PROBE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to); - switch_event_fire(&event); - } - } - break; - case LDL_SIGNAL_PRESENCE_IN: - - if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'", - switch_str_nil(msg), switch_str_nil(subject), switch_str_nil(from)))) { - mdl_execute_sql(profile, sql, profile->mutex); - free(sql); - } - - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", msg); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", subject); - switch_event_fire(&event); - } - - - if (is_special(to)) { - ldl_handle_send_presence(profile->handle, to, from, NULL, NULL, "Click To Call", profile->avatar); - } -#if 0 - if (is_special(to)) { - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", to); - //switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "rpid", "unknown"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "status", "Click To Call"); - switch_event_fire(&event); - } - } -#endif - break; - - case LDL_SIGNAL_PRESENCE_OUT: - - if ((sql = switch_mprintf("update jabber_subscriptions set show_pres='%q', status='%q' where sub_from='%q'", - switch_str_nil(msg), switch_str_nil(subject), switch_str_nil(from)))) { - mdl_execute_sql(profile, sql, profile->mutex); - free(sql); - } - if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_OUT) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", profile->login); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_fire(&event); - } - break; - default: - break; - } - } - - switch (dl_signal) { - case LDL_SIGNAL_MSG:{ - char *proto = MDL_CHAT_PROTO; - char *pproto = NULL, *ffrom = NULL; - char *hint; - char *from_user, *from_host; -#ifdef AUTO_REPLY - if (profile->auto_reply) { - ldl_handle_send_msg(handle, - (profile->user_flags & LDL_FLAG_COMPONENT) ? to : ldl_handle_get_login(profile->handle), from, "", - switch_str_nil(profile->auto_reply)); - } -#endif - - if (strchr(to, '+')) { - pproto = strdup(to); - if ((to = strchr(pproto, '+'))) { - *to++ = '\0'; - } - proto = pproto; - } - - hint = from; - - if (strchr(from, '/') && (ffrom = strdup(from))) { - char *p; - if ((p = strchr(ffrom, '/'))) { - *p = '\0'; - } - from = ffrom; - } - - from_user = strdup(from); - if ((from_host = strchr(from_user, '@'))) { - *from_host++ = '\0'; - } - - - if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_user", from_user); - if (from_host) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_host", from_host); - } - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", subject); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "text/plain"); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", hint); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from_full", hint); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "ldl_profile", profile->name); - - if (msg) { - switch_event_add_body(event, "%s", msg); - } - } else { - abort(); - } - - switch_safe_free(from_user); - - if (!zstr(msg)) { - if (strcasecmp(proto, MDL_CHAT_PROTO)) { /* yes no ! on purpose */ - switch_core_chat_send(proto, event); - } - - switch_core_chat_send("GLOBAL", event); - } - - switch_event_destroy(&event); - - switch_safe_free(pproto); - switch_safe_free(ffrom); - } - break; - case LDL_SIGNAL_LOGIN_SUCCESS: - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_SUCCESS) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", ldl_handle_get_login(profile->handle)); - switch_event_fire(&event); - } - if (profile->user_flags & LDL_FLAG_COMPONENT) { - sign_on(profile); - } - - break; - case LDL_SIGNAL_LOGIN_FAILURE: - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_LOGIN_FAILURE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", ldl_handle_get_login(profile->handle)); - switch_event_fire(&event); - } - break; - case LDL_SIGNAL_CONNECTED: - if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, DL_EVENT_CONNECTED) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", ldl_handle_get_login(profile->handle)); - switch_event_fire(&event); - } - break; - default: - break; - - } - status = LDL_STATUS_SUCCESS; - goto done; - } - - - if ((session = ldl_session_get_private(dlsession))) { - tech_pvt = switch_core_session_get_private(session); - switch_assert(tech_pvt != NULL); - - channel = switch_core_session_get_channel(session); - - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "using Existing session for %s\n", ldl_session_get_id(dlsession)); - - if (switch_channel_down(channel)) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Call %s is already over\n", switch_channel_get_name(channel)); - status = LDL_STATUS_FALSE; - goto done; - } - - } else { - if (dl_signal != LDL_SIGNAL_INITIATE && !msg) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Session is already dead\n"); - status = LDL_STATUS_FALSE; - goto done; - } - - if (profile->purge) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Profile '%s' is marked for deletion, disallowing incoming call\n", profile->name); - status = LDL_STATUS_FALSE; - goto done; - } - - if (switch_thread_rwlock_tryrdlock(profile->rwlock) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't do read lock on profile '%s'\n", profile->name); - status = LDL_STATUS_FALSE; - goto done; - } - - if ((session = switch_core_session_request(dingaling_endpoint_interface, SWITCH_CALL_DIRECTION_INBOUND, SOF_NONE, NULL)) != 0) { - switch_core_session_add_stream(session, NULL); - - if ((tech_pvt = (struct private_object *) switch_core_session_alloc(session, sizeof(struct private_object))) != 0) { - char *exten; - char *context; - char *cid_name; - char *cid_num; - char *tmp, *t, *them = NULL; - - memset(tech_pvt, 0, sizeof(*tech_pvt)); - switch_mutex_init(&tech_pvt->flag_mutex, SWITCH_MUTEX_NESTED, switch_core_session_get_pool(session)); - tech_pvt->flags |= globals.flags; - tech_pvt->flags |= profile->flags; - channel = switch_core_session_get_channel(session); - switch_core_session_set_private(session, tech_pvt); - tech_pvt->dlsession = dlsession; - - tech_pvt->session = session; - 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; - - 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); - - - 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->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"))) { - exten = profile->exten; - /* if it's _auto_ set the extension to match the username portion of the called address */ - if (!strcmp(exten, "_auto_")) { - if ((t = ldl_session_get_callee(dlsession))) { - if ((them = strdup(t))) { - char *a, *b, *p; - if ((p = strchr(them, '/'))) { - *p = '\0'; - } - - if ((a = strchr(them, '+')) && (b = strrchr(them, '+')) && a != b) { - *b++ = '\0'; - switch_channel_set_variable(channel, "dl_user", them); - switch_channel_set_variable(channel, "dl_host", b); - } - exten = them; - } - } - } - } - - if (!(context = ldl_session_get_value(dlsession, "context"))) { - context = profile->context; - } - - if (!(cid_name = ldl_session_get_value(dlsession, "caller_id_name"))) { - cid_name = tech_pvt->recip; - } - - if (!(cid_num = ldl_session_get_value(dlsession, "caller_id_number"))) { - cid_num = tech_pvt->recip; - } - - - if (switch_stristr("voice.google.com", from)) { - char *id = switch_core_session_strdup(session, from); - char *p; - - if ((p = strchr(id, '@'))) { - *p++ = '\0'; - cid_name = "Google Voice"; - cid_num = id; - } - - ldl_session_set_gateway(dlsession); - - do_candidates(tech_pvt, 1); - } - - - - /* context of "_auto_" means set it to the domain */ - if (profile->context && !strcmp(profile->context, "_auto_")) { - context = profile->name; - } - - tech_pvt->them = switch_core_session_strdup(session, ldl_session_get_callee(dlsession)); - - if (tech_pvt->them && (tmp = strdup(tech_pvt->them))) { - char *p, *q; - - if ((p = strchr(tmp, '@'))) { - *p++ = '\0'; - if ((q = strchr(p, '/'))) { - *q = '\0'; - } - switch_channel_set_variable(channel, "dl_to_user", tmp); - switch_channel_set_variable(channel, "dl_to_host", p); - } - - switch_safe_free(tmp); - } - - tech_pvt->us = switch_core_session_strdup(session, ldl_session_get_caller(dlsession)); - - if (tech_pvt->us && (tmp = strdup(tech_pvt->us))) { - char *p, *q; - - if ((p = strchr(tmp, '@'))) { - *p++ = '\0'; - if ((q = strchr(p, '/'))) { - *q = '\0'; - } - switch_channel_set_variable(channel, "dl_from_user", tmp); - switch_channel_set_variable(channel, "dl_from_host", p); - } - - switch_safe_free(tmp); - } - - if (!tech_pvt->caller_profile) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, - "Creating an identity for %s %s <%s> %s\n", ldl_session_get_id(dlsession), cid_name, cid_num, exten); - - if ((tech_pvt->caller_profile = switch_caller_profile_new(switch_core_session_get_pool(session), - ldl_handle_get_login(profile->handle), - profile->dialplan, - cid_name, - cid_num, - ldl_session_get_ip(dlsession), - ldl_session_get_value(dlsession, "ani"), - ldl_session_get_value(dlsession, "aniii"), - ldl_session_get_value(dlsession, "rdnis"), modname, context, exten)) != 0) { - char name[128]; - switch_snprintf(name, sizeof(name), "dingaling/%s", tech_pvt->caller_profile->destination_number); - switch_channel_set_name(channel, name); - switch_channel_set_caller_profile(channel, tech_pvt->caller_profile); - } - } - - switch_safe_free(them); - - switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - } else { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Hey where is my memory pool?\n"); - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Creating a session for %s\n", ldl_session_get_id(dlsession)); - ldl_session_set_private(dlsession, session); - - switch_channel_set_name(channel, "DingaLing/new"); - switch_channel_set_state(channel, CS_INIT); - if (switch_core_session_thread_launch(session) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Error spawning thread\n"); - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - } else { - status = LDL_STATUS_FALSE; - goto done; - } - - } - - switch (dl_signal) { - case LDL_SIGNAL_MSG: - if (msg) { - if (*msg == '+') { - char *p = msg + 1; - switch_dtmf_t dtmf = { 0, switch_core_default_dtmf_duration(0) }; - while (p && *p) { - dtmf.digit = *p; - switch_channel_queue_dtmf(channel, &dtmf); - p++; - } - switch_set_flag_locked(tech_pvt, TFLAG_DTMF); - 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); - } - - if (switch_event_create(&event, SWITCH_EVENT_MESSAGE) == SWITCH_STATUS_SUCCESS) { - char *hint = NULL, *p, *freeme = NULL; - - hint = from; - if (strchr(from, '/') && (freeme = strdup(from))) { - p = strchr(freeme, '/'); - *p = '\0'; - from = freeme; - } - - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", MDL_CHAT_PROTO); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", ldl_handle_get_login(profile->handle)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "hint", hint); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "from", from); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "to", to); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "subject", subject); - if (msg) { - switch_event_add_body(event, "%s", msg); - } - if (switch_core_session_queue_event(tech_pvt->session, &event) != SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "delivery-failure", "true"); - switch_event_fire(&event); - } - - switch_safe_free(freeme); - } - break; - case LDL_SIGNAL_TRANSPORT_ACCEPT: - switch_set_flag_locked(tech_pvt, TFLAG_TRANSPORT_ACCEPT); - - if (ldl_session_gateway(dlsession)) { - do_candidates(tech_pvt, 1); - } - - break; - case LDL_SIGNAL_INITIATE: - if (dl_signal) { - ldl_payload_t *payloads; - unsigned int len = 0; - - if (switch_test_flag(tech_pvt, TFLAG_OUTBOUND)) { - 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)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - } - } - - 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; - } - - - if (!get_codecs(tech_pvt)) { - terminate_session(&session, __LINE__, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER); - status = LDL_STATUS_FALSE; - goto done; - } - - if (ldl_session_get_payloads(dlsession, &payloads, &len) == LDL_STATUS_SUCCESS) { - status = parse_payloads(dlsession, session, payloads, len); - goto done; - } - - } - - break; - case LDL_SIGNAL_CANDIDATES: - if (dl_signal) { - parse_candidates(dlsession, session, LDL_TPORT_RTP, subject); - parse_candidates(dlsession, session, LDL_TPORT_VIDEO_RTP, subject); - 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) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "reject %s\n", switch_channel_get_name(channel)); - terminate_session(&session, __LINE__, SWITCH_CAUSE_CALL_REJECTED); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "End Call (Rejected)\n"); - goto done; - } - break; - case LDL_SIGNAL_REDIRECT: - do_describe(tech_pvt, 1); - tech_pvt->next_cand = switch_micro_time_now(); - if (channel) switch_channel_mark_ring_ready(channel); - break; - - case LDL_SIGNAL_ERROR: - case LDL_SIGNAL_TERMINATE: - if (channel) { - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "hungup %s\n", switch_channel_get_name(channel)); - terminate_session(&session, __LINE__, SWITCH_CAUSE_NORMAL_CLEARING); - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "End Call\n"); - goto done; - } - break; - - default: - switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "ERROR\n"); - break; - } - - - done: - - - return status; -} - -static ldl_status handle_response(ldl_handle_t *handle, char *id) -{ - return LDL_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 noet: - */ From 3c7e8ff989355bf518eabaeea83036585e4782b7 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Tue, 16 Aug 2022 18:29:47 -0400 Subject: [PATCH 050/155] [core] remove unimrcp from tree --- LICENSE | 6 - bootstrap.sh | 2 +- build/buildmrcpserver.sh | 6 - build/modules.conf.in | 1 - build/modules.conf.most | 1 - conf/rayo/autoload_configs/rayo.conf.xml | 30 - .../vanilla/autoload_configs/unimrcp.conf.xml | 23 - .../mrcp_profiles/loquendo-7-mrcp-v2.xml | 32 - .../mrcp_profiles/nuance-1.0.0-mrcp-v1.xml | 39 - .../mrcp_profiles/nuance-5.0-mrcp-v1.xml | 39 - .../mrcp_profiles/nuance-5.0-mrcp-v2.xml | 43 - .../mrcp_profiles/unimrcpserver-mrcp-v1.xml | 27 - conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml | 26 - .../voxeo-prophecy-8.0-mrcp-v1.xml | 27 - configure.ac | 4 +- debian/bootstrap.sh | 2 - debian/control-modules | 4 - debian/copyright | 6 - docs/Doxygen.conf | 2 +- freeswitch.spec | 15 +- libs/.gitignore | 98 - libs/unimrcp/.gitignore | 1 - libs/unimrcp/.update | 1 - libs/unimrcp/AUTHORS | 17 - libs/unimrcp/CHANGES | 214 - libs/unimrcp/INSTALL | 158 - libs/unimrcp/LICENSE | 202 - libs/unimrcp/Makefile.am | 36 - libs/unimrcp/NOTICE | 47 - libs/unimrcp/README | 59 - libs/unimrcp/acinclude.m4 | 7 - libs/unimrcp/bootstrap | 14 - libs/unimrcp/build/Makefile.am | 5 - libs/unimrcp/build/acmacros/apr.m4 | 79 - libs/unimrcp/build/acmacros/apr_common.m4 | 990 ---- libs/unimrcp/build/acmacros/apu.m4 | 2 - .../build/acmacros/ax_compiler_vendor.m4 | 41 - libs/unimrcp/build/acmacros/find_apr.m4 | 167 - libs/unimrcp/build/acmacros/find_apu.m4 | 176 - libs/unimrcp/build/acmacros/sofia-sip.m4 | 85 - libs/unimrcp/build/acmacros/uni_plugin.m4 | 45 - libs/unimrcp/build/get-version.sh | 37 - libs/unimrcp/build/init.d/unimrcp-server | 270 - libs/unimrcp/build/pkgconfig/Makefile.am | 4 - .../build/pkgconfig/unimrcpclient.pc.in | 11 - .../build/pkgconfig/unimrcpplugin.pc.in | 11 - .../build/pkgconfig/unimrcpserver.pc.in | 11 - libs/unimrcp/build/props/apr.props | 33 - libs/unimrcp/build/props/apt.props | 18 - libs/unimrcp/build/props/mpf.props | 18 - libs/unimrcp/build/props/mrcp.props | 18 - libs/unimrcp/build/props/mrcpclient.props | 15 - libs/unimrcp/build/props/mrcpengine.props | 15 - libs/unimrcp/build/props/mrcpserver.props | 16 - libs/unimrcp/build/props/mrcpsignaling.props | 15 - .../unimrcp/build/props/mrcpv2transport.props | 14 - .../build/props/sdk/unimrcpclient.props | 14 - .../build/props/sdk/unimrcpplugin.props | 14 - libs/unimrcp/build/props/sdk/unimrcpsdk.props | 23 - .../build/props/sdk/unimrcpserver.props | 14 - libs/unimrcp/build/props/sofiasip.props | 25 - libs/unimrcp/build/props/unibase.props | 29 - libs/unimrcp/build/props/unibin-x64.props | 21 - libs/unimrcp/build/props/unibin.props | 18 - libs/unimrcp/build/props/unidebug.props | 25 - libs/unimrcp/build/props/unilib-x64.props | 13 - libs/unimrcp/build/props/unilib.props | 8 - libs/unimrcp/build/props/unimrcpclient.props | 23 - libs/unimrcp/build/props/unimrcpserver.props | 23 - libs/unimrcp/build/props/uniplugin-x64.props | 22 - libs/unimrcp/build/props/uniplugin.props | 19 - libs/unimrcp/build/props/unirelease.props | 18 - libs/unimrcp/build/props/unirtsp.props | 15 - libs/unimrcp/build/rules/uniclientapp.am | 24 - libs/unimrcp/build/rules/uniclientlib.am | 30 - libs/unimrcp/build/rules/uniplugin.am | 14 - libs/unimrcp/build/rules/uniserverapp.am | 25 - libs/unimrcp/build/rules/uniserverlib.am | 32 - libs/unimrcp/build/tools/prepare.vcproj | 122 - libs/unimrcp/build/tools/prepare.vcxproj | 205 - libs/unimrcp/build/tools/unimrcp_service.c | 446 -- .../build/tools/unimrcpservice.exe.manifest | 11 - libs/unimrcp/build/tools/unimrcpservice.rc | 39 - .../unimrcp/build/tools/unimrcpservice.vcproj | 326 -- .../build/tools/unimrcpservice.vcxproj | 136 - .../tools/unimrcpservice.vcxproj.filters | 17 - libs/unimrcp/build/uni_revision.h | 43 - libs/unimrcp/build/uni_version.h | 100 - libs/unimrcp/build/vsprops/apr.vsprops | 24 - libs/unimrcp/build/vsprops/apt.vsprops | 13 - libs/unimrcp/build/vsprops/mpf.vsprops | 13 - libs/unimrcp/build/vsprops/mrcp.vsprops | 13 - libs/unimrcp/build/vsprops/mrcpclient.vsprops | 12 - libs/unimrcp/build/vsprops/mrcpengine.vsprops | 12 - libs/unimrcp/build/vsprops/mrcpserver.vsprops | 12 - .../build/vsprops/mrcpsignaling.vsprops | 12 - .../build/vsprops/mrcpv2transport.vsprops | 12 - .../build/vsprops/sdk/unimrcpclient.vsprops | 12 - .../build/vsprops/sdk/unimrcpplugin.vsprops | 12 - .../build/vsprops/sdk/unimrcpsdk.vsprops | 21 - .../build/vsprops/sdk/unimrcpserver.vsprops | 12 - libs/unimrcp/build/vsprops/sofiasip.vsprops | 16 - libs/unimrcp/build/vsprops/unibase.vsprops | 22 - libs/unimrcp/build/vsprops/unibin-x64.vsprops | 19 - libs/unimrcp/build/vsprops/unibin.vsprops | 15 - libs/unimrcp/build/vsprops/unidebug.vsprops | 23 - libs/unimrcp/build/vsprops/unilib-x64.vsprops | 17 - libs/unimrcp/build/vsprops/unilib.vsprops | 13 - .../build/vsprops/unimrcpclient.vsprops | 16 - .../build/vsprops/unimrcpserver.vsprops | 16 - .../build/vsprops/uniplugin-x64.vsprops | 20 - libs/unimrcp/build/vsprops/uniplugin.vsprops | 16 - libs/unimrcp/build/vsprops/unirelease.vsprops | 15 - libs/unimrcp/build/vsprops/unirtsp.vsprops | 13 - libs/unimrcp/conf/Makefile.am | 31 - .../unimrcp/conf/client-profiles/lumenvox.xml | 50 - libs/unimrcp/conf/client-profiles/nuance.xml | 78 - .../conf/client-profiles/speechpro.xml | 33 - libs/unimrcp/conf/client-profiles/unimrcp.xml | 51 - libs/unimrcp/conf/dirlayout.xml | 26 - libs/unimrcp/conf/logger.xml | 38 - libs/unimrcp/conf/umcscenarios.xml | 117 - libs/unimrcp/conf/unimrcpclient.xml | 111 - libs/unimrcp/conf/unimrcpclient.xsd | 277 - libs/unimrcp/conf/unimrcpserver.xml | 166 - libs/unimrcp/conf/unimrcpserver.xsd | 277 - libs/unimrcp/config.layout | 26 - libs/unimrcp/configure.ac | 285 - libs/unimrcp/configure.gnu | 3 - libs/unimrcp/data/Makefile.am | 31 - libs/unimrcp/data/demo-16kHz.pcm | Bin 70444 -> 0 bytes libs/unimrcp/data/demo-8kHz.pcm | Bin 35200 -> 0 bytes libs/unimrcp/data/grammar.jsgf | 3 - libs/unimrcp/data/grammar.mixed | 19 - libs/unimrcp/data/grammar.srgs | 4 - libs/unimrcp/data/grammar.xml | 10 - libs/unimrcp/data/johnsmith-16kHz.pcm | Bin 33214 -> 0 bytes libs/unimrcp/data/johnsmith-8kHz.pcm | Bin 16000 -> 0 bytes libs/unimrcp/data/one-16kHz.pcm | Bin 64508 -> 0 bytes libs/unimrcp/data/one-8kHz.pcm | Bin 32318 -> 0 bytes libs/unimrcp/data/result-verification.xml | 21 - libs/unimrcp/data/result.xml | 7 - libs/unimrcp/data/speak.txt | 1 - libs/unimrcp/data/speak.xml | 6 - libs/unimrcp/docs/doxygen.conf.in | 34 - libs/unimrcp/docs/mainpage.docs | 71 - libs/unimrcp/libs/Makefile.am | 3 - libs/unimrcp/libs/apr-toolkit/Makefile.am | 50 - .../libs/apr-toolkit/aprtoolkit.2017.vcxproj | 167 - .../libs/apr-toolkit/aprtoolkit.vcproj | 417 -- .../libs/apr-toolkit/aprtoolkit.vcxproj | 139 - .../apr-toolkit/aprtoolkit.vcxproj.filters | 143 - libs/unimrcp/libs/apr-toolkit/include/apt.h | 61 - .../apr-toolkit/include/apt_consumer_task.h | 79 - .../apr-toolkit/include/apt_cyclic_queue.h | 79 - .../libs/apr-toolkit/include/apt_dir_layout.h | 162 - .../apr-toolkit/include/apt_header_field.h | 178 - .../libs/apr-toolkit/include/apt_log.h | 274 - .../include/apt_multipart_content.h | 108 - .../libs/apr-toolkit/include/apt_net.h | 55 - .../libs/apr-toolkit/include/apt_nlsml_doc.h | 210 - .../libs/apr-toolkit/include/apt_obj_list.h | 139 - .../libs/apr-toolkit/include/apt_pair.h | 75 - .../apr-toolkit/include/apt_poller_task.h | 130 - .../libs/apr-toolkit/include/apt_pollset.h | 98 - .../libs/apr-toolkit/include/apt_pool.h | 49 - .../libs/apr-toolkit/include/apt_string.h | 156 - .../apr-toolkit/include/apt_string_table.h | 65 - .../libs/apr-toolkit/include/apt_task.h | 262 - .../libs/apr-toolkit/include/apt_task_msg.h | 86 - .../libs/apr-toolkit/include/apt_test_suite.h | 101 - .../apr-toolkit/include/apt_text_message.h | 125 - .../apr-toolkit/include/apt_text_stream.h | 241 - .../apr-toolkit/include/apt_timer_queue.h | 68 - .../libs/apr-toolkit/src/apt_consumer_task.c | 164 - .../libs/apr-toolkit/src/apt_cyclic_queue.c | 106 - .../libs/apr-toolkit/src/apt_dir_layout.c | 317 -- .../libs/apr-toolkit/src/apt_header_field.c | 187 - libs/unimrcp/libs/apr-toolkit/src/apt_log.c | 627 --- .../apr-toolkit/src/apt_multipart_content.c | 312 -- libs/unimrcp/libs/apr-toolkit/src/apt_net.c | 153 - .../libs/apr-toolkit/src/apt_nlsml_doc.c | 569 -- .../libs/apr-toolkit/src/apt_obj_list.c | 153 - libs/unimrcp/libs/apr-toolkit/src/apt_pair.c | 88 - .../libs/apr-toolkit/src/apt_poller_task.c | 296 -- .../libs/apr-toolkit/src/apt_pollset.c | 325 -- libs/unimrcp/libs/apr-toolkit/src/apt_pool.c | 57 - .../libs/apr-toolkit/src/apt_string_table.c | 68 - libs/unimrcp/libs/apr-toolkit/src/apt_task.c | 623 --- .../libs/apr-toolkit/src/apt_task_msg.c | 105 - .../libs/apr-toolkit/src/apt_test_suite.c | 121 - .../libs/apr-toolkit/src/apt_text_message.c | 451 -- .../libs/apr-toolkit/src/apt_text_stream.c | 554 -- .../libs/apr-toolkit/src/apt_timer_queue.c | 229 - libs/unimrcp/libs/mpf/Makefile.am | 82 - libs/unimrcp/libs/mpf/codecs/g711/g711.c | 73 - libs/unimrcp/libs/mpf/codecs/g711/g711.h | 374 -- libs/unimrcp/libs/mpf/include/mpf.h | 44 - .../libs/mpf/include/mpf_activity_detector.h | 68 - .../mpf/include/mpf_audio_file_descriptor.h | 56 - .../libs/mpf/include/mpf_audio_file_stream.h | 48 - libs/unimrcp/libs/mpf/include/mpf_bridge.h | 49 - libs/unimrcp/libs/mpf/include/mpf_buffer.h | 58 - libs/unimrcp/libs/mpf/include/mpf_codec.h | 177 - .../libs/mpf/include/mpf_codec_descriptor.h | 283 - .../libs/mpf/include/mpf_codec_manager.h | 55 - libs/unimrcp/libs/mpf/include/mpf_context.h | 133 - libs/unimrcp/libs/mpf/include/mpf_decoder.h | 42 - .../libs/mpf/include/mpf_dtmf_detector.h | 123 - .../libs/mpf/include/mpf_dtmf_generator.h | 131 - libs/unimrcp/libs/mpf/include/mpf_encoder.h | 42 - libs/unimrcp/libs/mpf/include/mpf_engine.h | 165 - .../libs/mpf/include/mpf_engine_factory.h | 48 - .../include/mpf_file_termination_factory.h | 39 - libs/unimrcp/libs/mpf/include/mpf_frame.h | 66 - .../libs/mpf/include/mpf_frame_buffer.h | 56 - .../libs/mpf/include/mpf_jitter_buffer.h | 68 - libs/unimrcp/libs/mpf/include/mpf_message.h | 94 - libs/unimrcp/libs/mpf/include/mpf_mixer.h | 51 - .../unimrcp/libs/mpf/include/mpf_multiplier.h | 51 - .../libs/mpf/include/mpf_named_event.h | 73 - libs/unimrcp/libs/mpf/include/mpf_object.h | 79 - libs/unimrcp/libs/mpf/include/mpf_resampler.h | 42 - .../libs/mpf/include/mpf_rtcp_packet.h | 203 - .../libs/mpf/include/mpf_rtp_attribs.h | 56 - libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h | 185 - .../libs/mpf/include/mpf_rtp_descriptor.h | 219 - .../unimrcp/libs/mpf/include/mpf_rtp_header.h | 88 - libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h | 48 - libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h | 115 - .../unimrcp/libs/mpf/include/mpf_rtp_stream.h | 62 - .../mpf/include/mpf_rtp_termination_factory.h | 42 - libs/unimrcp/libs/mpf/include/mpf_scheduler.h | 68 - libs/unimrcp/libs/mpf/include/mpf_stream.h | 171 - .../libs/mpf/include/mpf_stream_descriptor.h | 90 - .../libs/mpf/include/mpf_termination.h | 121 - .../mpf/include/mpf_termination_factory.h | 105 - libs/unimrcp/libs/mpf/include/mpf_trace.h | 51 - libs/unimrcp/libs/mpf/include/mpf_types.h | 61 - .../unimrcp/libs/mpf/mpf.2010.vcxproj.filters | 236 - libs/unimrcp/libs/mpf/mpf.2017.vcxproj | 201 - libs/unimrcp/libs/mpf/mpf.vcproj | 552 -- libs/unimrcp/libs/mpf/mpf.vcxproj | 200 - libs/unimrcp/libs/mpf/mpf.vcxproj.filters | 239 - .../libs/mpf/src/mpf_activity_detector.c | 183 - .../libs/mpf/src/mpf_audio_file_stream.c | 171 - libs/unimrcp/libs/mpf/src/mpf_bridge.c | 230 - libs/unimrcp/libs/mpf/src/mpf_buffer.c | 175 - .../libs/mpf/src/mpf_codec_descriptor.c | 279 - libs/unimrcp/libs/mpf/src/mpf_codec_g711.c | 191 - libs/unimrcp/libs/mpf/src/mpf_codec_linear.c | 90 - libs/unimrcp/libs/mpf/src/mpf_codec_manager.c | 199 - libs/unimrcp/libs/mpf/src/mpf_context.c | 548 -- libs/unimrcp/libs/mpf/src/mpf_decoder.c | 129 - libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c | 302 -- .../unimrcp/libs/mpf/src/mpf_dtmf_generator.c | 349 -- libs/unimrcp/libs/mpf/src/mpf_encoder.c | 125 - libs/unimrcp/libs/mpf/src/mpf_engine.c | 453 -- .../unimrcp/libs/mpf/src/mpf_engine_factory.c | 78 - .../mpf/src/mpf_file_termination_factory.c | 86 - libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c | 184 - libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c | 510 -- libs/unimrcp/libs/mpf/src/mpf_mixer.c | 210 - libs/unimrcp/libs/mpf/src/mpf_multiplier.c | 187 - libs/unimrcp/libs/mpf/src/mpf_named_event.c | 76 - libs/unimrcp/libs/mpf/src/mpf_resampler.c | 28 - libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c | 60 - libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c | 1507 ------ .../mpf/src/mpf_rtp_termination_factory.c | 204 - libs/unimrcp/libs/mpf/src/mpf_scheduler.c | 267 - libs/unimrcp/libs/mpf/src/mpf_stream.c | 160 - libs/unimrcp/libs/mpf/src/mpf_termination.c | 75 - .../libs/mpf/src/mpf_termination_factory.c | 85 - libs/unimrcp/libs/mrcp-client/Makefile.am | 23 - .../mrcp-client/include/mrcp_application.h | 360 -- .../libs/mrcp-client/include/mrcp_client.h | 254 - .../mrcp-client/include/mrcp_client_session.h | 215 - .../mrcp-client/include/mrcp_client_types.h | 50 - .../libs/mrcp-client/mrcpclient.2017.vcxproj | 131 - .../libs/mrcp-client/mrcpclient.vcproj | 280 - .../libs/mrcp-client/mrcpclient.vcxproj | 125 - .../mrcp-client/mrcpclient.vcxproj.filters | 38 - .../libs/mrcp-client/src/mrcp_application.c | 549 -- .../libs/mrcp-client/src/mrcp_client.c | 989 ---- .../mrcp-client/src/mrcp_client_session.c | 1314 ----- libs/unimrcp/libs/mrcp-engine/Makefile.am | 38 - .../mrcp-engine/include/mrcp_engine_factory.h | 62 - .../mrcp-engine/include/mrcp_engine_iface.h | 85 - .../mrcp-engine/include/mrcp_engine_impl.h | 135 - .../mrcp-engine/include/mrcp_engine_loader.h | 54 - .../mrcp-engine/include/mrcp_engine_plugin.h | 126 - .../mrcp-engine/include/mrcp_engine_types.h | 156 - .../mrcp-engine/include/mrcp_recog_engine.h | 35 - .../include/mrcp_recog_state_machine.h | 36 - .../include/mrcp_recorder_engine.h | 35 - .../include/mrcp_recorder_state_machine.h | 36 - .../include/mrcp_resource_engine.h | 51 - .../mrcp-engine/include/mrcp_state_machine.h | 86 - .../mrcp-engine/include/mrcp_synth_engine.h | 35 - .../include/mrcp_synth_state_machine.h | 36 - .../include/mrcp_verifier_engine.h | 35 - .../include/mrcp_verifier_state_machine.h | 36 - .../libs/mrcp-engine/mrcpengine.vcproj | 348 -- .../libs/mrcp-engine/mrcpengine.vcxproj | 142 - .../mrcp-engine/mrcpengine.vcxproj.filters | 89 - .../mrcp-engine/src/mrcp_engine_factory.c | 157 - .../libs/mrcp-engine/src/mrcp_engine_iface.c | 102 - .../libs/mrcp-engine/src/mrcp_engine_impl.c | 246 - .../libs/mrcp-engine/src/mrcp_engine_loader.c | 169 - .../src/mrcp_recog_state_machine.c | 553 -- .../src/mrcp_recorder_state_machine.c | 389 -- .../src/mrcp_synth_state_machine.c | 612 --- .../src/mrcp_verifier_state_machine.c | 524 -- libs/unimrcp/libs/mrcp-server/Makefile.am | 22 - .../libs/mrcp-server/include/mrcp_server.h | 226 - .../mrcp-server/include/mrcp_server_session.h | 163 - .../mrcp-server/include/mrcp_server_types.h | 42 - .../libs/mrcp-server/mrcpserver.vcproj | 272 - .../libs/mrcp-server/mrcpserver.vcxproj | 127 - .../mrcp-server/mrcpserver.vcxproj.filters | 32 - .../libs/mrcp-server/src/mrcp_server.c | 999 ---- .../mrcp-server/src/mrcp_server_session.c | 1191 ----- libs/unimrcp/libs/mrcp-signaling/Makefile.am | 17 - .../mrcp-signaling/include/mrcp_session.h | 206 - .../include/mrcp_session_descriptor.h | 150 - .../mrcp-signaling/include/mrcp_sig_agent.h | 97 - .../mrcp-signaling/include/mrcp_sig_types.h | 48 - .../mrcpsignaling.2010.vcxproj.filters | 35 - .../mrcp-signaling/mrcpsignaling.2017.vcxproj | 130 - .../libs/mrcp-signaling/mrcpsignaling.vcproj | 276 - .../libs/mrcp-signaling/mrcpsignaling.vcxproj | 124 - .../mrcpsignaling.vcxproj.filters | 35 - .../src/mrcp_session_descriptor.c | 52 - .../libs/mrcp-signaling/src/mrcp_sig_agent.c | 128 - libs/unimrcp/libs/mrcp/Makefile.am | 47 - .../libs/mrcp/control/include/mrcp_resource.h | 82 - .../control/include/mrcp_resource_factory.h | 50 - .../control/include/mrcp_resource_loader.h | 53 - .../libs/mrcp/control/include/mrcp_stream.h | 69 - .../mrcp/control/src/mrcp_resource_factory.c | 101 - .../mrcp/control/src/mrcp_resource_loader.c | 140 - .../libs/mrcp/control/src/mrcp_stream.c | 245 - libs/unimrcp/libs/mrcp/include/mrcp.h | 45 - libs/unimrcp/libs/mrcp/include/mrcp_types.h | 83 - .../message/include/mrcp_generic_header.h | 125 - .../libs/mrcp/message/include/mrcp_header.h | 121 - .../message/include/mrcp_header_accessor.h | 131 - .../libs/mrcp/message/include/mrcp_message.h | 253 - .../mrcp/message/include/mrcp_start_line.h | 117 - .../mrcp/message/src/mrcp_generic_header.c | 350 -- .../libs/mrcp/message/src/mrcp_header.c | 265 - .../mrcp/message/src/mrcp_header_accessor.c | 84 - .../libs/mrcp/message/src/mrcp_message.c | 259 - .../libs/mrcp/message/src/mrcp_start_line.c | 452 -- .../libs/mrcp/mrcp.2010.vcxproj.filters | 133 - libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj | 163 - libs/unimrcp/libs/mrcp/mrcp.vcproj | 433 -- libs/unimrcp/libs/mrcp/mrcp.vcxproj | 157 - libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters | 151 - .../resources/include/mrcp_recog_header.h | 273 - .../resources/include/mrcp_recog_resource.h | 64 - .../resources/include/mrcp_recorder_header.h | 138 - .../include/mrcp_recorder_resource.h | 55 - .../resources/include/mrcp_synth_header.h | 304 -- .../resources/include/mrcp_synth_resource.h | 60 - .../resources/include/mrcp_verifier_header.h | 162 - .../include/mrcp_verifier_resource.h | 63 - .../mrcp/resources/src/mrcp_recog_header.c | 781 --- .../mrcp/resources/src/mrcp_recog_resource.c | 99 - .../mrcp/resources/src/mrcp_recorder_header.c | 282 - .../resources/src/mrcp_recorder_resource.c | 59 - .../mrcp/resources/src/mrcp_synth_header.c | 563 -- .../mrcp/resources/src/mrcp_synth_resource.c | 63 - .../mrcp/resources/src/mrcp_verifier_header.c | 352 -- .../resources/src/mrcp_verifier_resource.c | 68 - .../unimrcp/libs/mrcpv2-transport/Makefile.am | 23 - .../include/mrcp_ca_factory.h | 45 - .../include/mrcp_client_connection.h | 186 - .../include/mrcp_connection.h | 110 - .../include/mrcp_connection_types.h | 140 - .../include/mrcp_control_descriptor.h | 147 - .../include/mrcp_server_connection.h | 175 - .../mrcpv2transport.2010.vcxproj.filters | 47 - .../mrcpv2transport.2017.vcxproj | 134 - .../mrcpv2-transport/mrcpv2transport.vcproj | 296 -- .../mrcpv2-transport/mrcpv2transport.vcxproj | 125 - .../mrcpv2transport.vcxproj.filters | 50 - .../mrcpv2-transport/src/mrcp_ca_factory.c | 65 - .../src/mrcp_client_connection.c | 696 --- .../mrcpv2-transport/src/mrcp_connection.c | 104 - .../src/mrcp_control_descriptor.c | 147 - .../src/mrcp_server_connection.c | 715 --- libs/unimrcp/libs/uni-rtsp/Makefile.am | 22 - libs/unimrcp/libs/uni-rtsp/include/rtsp.h | 45 - .../libs/uni-rtsp/include/rtsp_client.h | 155 - .../libs/uni-rtsp/include/rtsp_header.h | 232 - .../libs/uni-rtsp/include/rtsp_message.h | 78 - .../libs/uni-rtsp/include/rtsp_server.h | 147 - .../libs/uni-rtsp/include/rtsp_start_line.h | 181 - .../libs/uni-rtsp/include/rtsp_stream.h | 54 - libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c | 992 ---- libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c | 420 -- libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c | 80 - libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c | 889 ---- .../libs/uni-rtsp/src/rtsp_start_line.c | 261 - libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c | 124 - .../uni-rtsp/unirtsp.2010.vcxproj.filters | 56 - .../libs/uni-rtsp/unirtsp.2017.vcxproj | 141 - libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj | 304 -- libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj | 127 - .../libs/uni-rtsp/unirtsp.vcxproj.filters | 56 - libs/unimrcp/modules/Makefile.am | 3 - .../unimrcp/modules/mrcp-sofiasip/Makefile.am | 22 - .../modules/mrcp-sofiasip/include/mrcp_sdp.h | 42 - .../include/mrcp_sofiasip_client_agent.h | 82 - .../include/mrcp_sofiasip_server_agent.h | 85 - .../mrcpsofiasip.2010.vcxproj.filters | 38 - .../mrcp-sofiasip/mrcpsofiasip.2017.vcxproj | 143 - .../modules/mrcp-sofiasip/mrcpsofiasip.vcproj | 288 - .../mrcp-sofiasip/mrcpsofiasip.vcxproj | 147 - .../mrcpsofiasip.vcxproj.filters | 38 - .../modules/mrcp-sofiasip/src/mrcp_sdp.c | 421 -- .../src/mrcp_sofiasip_client_agent.c | 637 --- .../mrcp-sofiasip/src/mrcp_sofiasip_logger.c | 92 - .../src/mrcp_sofiasip_server_agent.c | 477 -- libs/unimrcp/modules/mrcp-unirtsp/Makefile.am | 22 - .../include/mrcp_unirtsp_client_agent.h | 59 - .../mrcp-unirtsp/include/mrcp_unirtsp_sdp.h | 89 - .../include/mrcp_unirtsp_server_agent.h | 70 - .../mrcpunirtsp.2010.vcxproj.filters | 35 - .../mrcp-unirtsp/mrcpunirtsp.2017.vcxproj | 146 - .../modules/mrcp-unirtsp/mrcpunirtsp.vcproj | 280 - .../modules/mrcp-unirtsp/mrcpunirtsp.vcxproj | 146 - .../mrcp-unirtsp/mrcpunirtsp.vcxproj.filters | 35 - .../src/mrcp_unirtsp_client_agent.c | 437 -- .../mrcp-unirtsp/src/mrcp_unirtsp_sdp.c | 598 --- .../src/mrcp_unirtsp_server_agent.c | 381 -- .../packages/inno-setup/setup-sdk-win32.txt | 3 - .../packages/inno-setup/setup-sdk-x64.txt | 4 - .../packages/inno-setup/setup-win32.txt | 3 - .../unimrcp/packages/inno-setup/setup-x64.txt | 5 - libs/unimrcp/packages/inno-setup/setup.txt | 14 - .../packages/inno-setup/unimrcp-sdk.iss | 56 - libs/unimrcp/packages/inno-setup/unimrcp.iss | 91 - libs/unimrcp/platforms/Makefile.am | 27 - libs/unimrcp/platforms/asr-client/Makefile.am | 10 - .../platforms/asr-client/asrclient.vcproj | 298 -- .../platforms/asr-client/asrclient.vcxproj | 136 - .../asr-client/asrclient.vcxproj.filters | 18 - libs/unimrcp/platforms/asr-client/src/main.c | 300 -- .../platforms/libasr-client/Makefile.am | 12 - .../libasr-client/include/asr_engine.h | 133 - .../libasr-client/libasrclient.vcproj | 308 -- .../libasr-client/libasrclient.vcxproj | 148 - .../libasrclient.vcxproj.filters | 23 - .../platforms/libasr-client/src/asr_engine.c | 752 --- .../platforms/libunimrcp-client/Makefile.am | 11 - .../include/unimrcp_client.h | 46 - .../libunimrcp-client/libunimrcpclient.vcproj | 272 - .../libunimrcpclient.vcxproj | 140 - .../libunimrcpclient.vcxproj.filters | 29 - .../libunimrcp-client/src/unimrcp_client.c | 1416 ----- .../platforms/libunimrcp-server/Makefile.am | 11 - .../include/unimrcp_server.h | 45 - .../libunimrcp-server/libunimrcpserver.vcproj | 272 - .../libunimrcpserver.vcxproj | 140 - .../libunimrcpserver.vcxproj.filters | 29 - .../libunimrcp-server/src/unimrcp_server.c | 1251 ----- libs/unimrcp/platforms/umc/Makefile.am | 26 - .../platforms/umc/include/dtmfscenario.h | 77 - .../platforms/umc/include/dtmfsession.h | 70 - .../platforms/umc/include/recogscenario.h | 97 - .../platforms/umc/include/recogsession.h | 75 - .../platforms/umc/include/recorderscenario.h | 68 - .../platforms/umc/include/recordersession.h | 70 - .../platforms/umc/include/setparamscenario.h | 49 - .../platforms/umc/include/setparamsession.h | 78 - .../platforms/umc/include/synthscenario.h | 76 - .../platforms/umc/include/synthsession.h | 69 - .../platforms/umc/include/umcconsole.h | 65 - .../platforms/umc/include/umcframework.h | 96 - .../platforms/umc/include/umcscenario.h | 129 - .../platforms/umc/include/umcsession.h | 131 - .../platforms/umc/include/verifierscenario.h | 75 - .../platforms/umc/include/verifiersession.h | 74 - .../platforms/umc/src/dtmfscenario.cpp | 79 - .../unimrcp/platforms/umc/src/dtmfsession.cpp | 279 - libs/unimrcp/platforms/umc/src/main.cpp | 26 - .../platforms/umc/src/recogscenario.cpp | 116 - .../platforms/umc/src/recogsession.cpp | 456 -- .../platforms/umc/src/recorderscenario.cpp | 72 - .../platforms/umc/src/recordersession.cpp | 286 - .../platforms/umc/src/setparamscenario.cpp | 25 - .../platforms/umc/src/setparamsession.cpp | 390 -- .../platforms/umc/src/synthscenario.cpp | 82 - .../platforms/umc/src/synthsession.cpp | 299 -- libs/unimrcp/platforms/umc/src/umcconsole.cpp | 333 -- .../platforms/umc/src/umcframework.cpp | 632 --- .../unimrcp/platforms/umc/src/umcscenario.cpp | 234 - libs/unimrcp/platforms/umc/src/umcsession.cpp | 252 - .../platforms/umc/src/verifierscenario.cpp | 82 - .../platforms/umc/src/verifiersession.cpp | 396 -- libs/unimrcp/platforms/umc/umc.rc | 39 - libs/unimrcp/platforms/umc/umc.vcproj | 460 -- libs/unimrcp/platforms/umc/umc.vcxproj | 176 - .../unimrcp/platforms/umc/umc.vcxproj.filters | 119 - .../platforms/unimrcp-client/Makefile.am | 16 - .../unimrcp-client/include/demo_application.h | 63 - .../unimrcp-client/include/demo_framework.h | 55 - .../unimrcp-client/include/demo_util.h | 44 - .../src/demo_bypass_application.c | 213 - .../src/demo_discover_application.c | 116 - .../unimrcp-client/src/demo_framework.c | 245 - .../src/demo_recog_application.c | 380 -- .../src/demo_synth_application.c | 317 -- .../platforms/unimrcp-client/src/demo_util.c | 176 - .../platforms/unimrcp-client/src/main.c | 275 - .../platforms/unimrcp-client/unimrcpclient.rc | 39 - .../unimrcp-client/unimrcpclient.vcproj | 368 -- .../unimrcp-client/unimrcpclient.vcxproj | 153 - .../unimrcpclient.vcxproj.filters | 50 - .../platforms/unimrcp-server/Makefile.am | 9 - .../platforms/unimrcp-server/src/main.c | 257 - .../unimrcp-server/src/uni_cmdline.c | 83 - .../platforms/unimrcp-server/src/uni_daemon.c | 52 - .../unimrcp-server/src/uni_service.c | 121 - .../platforms/unimrcp-server/unimrcpserver.rc | 39 - .../unimrcp-server/unimrcpserver.vcproj | 340 -- .../unimrcp-server/unimrcpserver.vcxproj | 135 - .../unimrcpserver.vcxproj.filters | 30 - libs/unimrcp/plugins/Makefile.am | 19 - libs/unimrcp/plugins/demo-recog/Makefile.am | 8 - .../plugins/demo-recog/demorecog.vcproj | 296 -- .../plugins/demo-recog/demorecog.vcxproj | 123 - .../demo-recog/demorecog.vcxproj.filters | 18 - .../demo-recog/src/demo_recog_engine.c | 564 -- libs/unimrcp/plugins/demo-synth/Makefile.am | 8 - .../plugins/demo-synth/demosynth.vcproj | 296 -- .../plugins/demo-synth/demosynth.vcxproj | 123 - .../demo-synth/demosynth.vcxproj.filters | 18 - .../demo-synth/src/demo_synth_engine.c | 557 -- .../unimrcp/plugins/demo-verifier/Makefile.am | 8 - .../plugins/demo-verifier/demoverifier.vcproj | 296 -- .../demo-verifier/demoverifier.vcxproj | 123 - .../demoverifier.vcxproj.filters | 18 - .../demo-verifier/src/demo_verifier_engine.c | 589 --- .../unimrcp/plugins/mrcp-recorder/Makefile.am | 8 - .../plugins/mrcp-recorder/mrcprecorder.vcproj | 296 -- .../mrcp-recorder/mrcprecorder.vcxproj | 123 - .../mrcprecorder.vcxproj.filters | 18 - .../mrcp-recorder/src/mrcp_recorder_engine.c | 481 -- libs/unimrcp/tests/Makefile.am | 3 - libs/unimrcp/tests/apttest/Makefile.am | 12 - libs/unimrcp/tests/apttest/apttest.vcproj | 304 -- libs/unimrcp/tests/apttest/apttest.vcxproj | 127 - .../tests/apttest/apttest.vcxproj.filters | 27 - .../tests/apttest/src/consumer_task_suite.c | 102 - libs/unimrcp/tests/apttest/src/main.c | 60 - .../tests/apttest/src/multipart_suite.c | 98 - libs/unimrcp/tests/apttest/src/task_suite.c | 64 - libs/unimrcp/tests/mpftest/Makefile.am | 12 - libs/unimrcp/tests/mpftest/mpftest.vcproj | 296 -- libs/unimrcp/tests/mpftest/mpftest.vcxproj | 125 - .../tests/mpftest/mpftest.vcxproj.filters | 21 - libs/unimrcp/tests/mpftest/src/main.c | 52 - libs/unimrcp/tests/mpftest/src/mpf_suite.c | 571 -- libs/unimrcp/tests/mrcptest/Makefile.am | 17 - libs/unimrcp/tests/mrcptest/mrcptest.vcproj | 304 -- libs/unimrcp/tests/mrcptest/mrcptest.vcxproj | 127 - .../tests/mrcptest/mrcptest.vcxproj.filters | 27 - libs/unimrcp/tests/mrcptest/src/main.c | 58 - .../tests/mrcptest/src/parse_gen_suite.c | 212 - .../tests/mrcptest/src/set_get_suite.c | 326 -- .../mrcptest/src/transparent_set_get_suite.c | 252 - .../tests/mrcptest/v1/definegrammar.msg | 18 - libs/unimrcp/tests/mrcptest/v1/getparams.msg | 5 - libs/unimrcp/tests/mrcptest/v1/multi.msg | 27 - libs/unimrcp/tests/mrcptest/v1/pause.msg | 3 - .../tests/mrcptest/v1/recognitioncomplete.msg | 20 - libs/unimrcp/tests/mrcptest/v1/recognize.msg | 30 - libs/unimrcp/tests/mrcptest/v1/response.msg | 3 - libs/unimrcp/tests/mrcptest/v1/resume.msg | 3 - libs/unimrcp/tests/mrcptest/v1/setparams.msg | 5 - libs/unimrcp/tests/mrcptest/v1/speak.msg | 19 - .../tests/mrcptest/v1/speakcomplete.msg | 4 - libs/unimrcp/tests/mrcptest/v1/stop.msg | 3 - .../tests/mrcptest/v2/definegrammar.msg | 30 - libs/unimrcp/tests/mrcptest/v2/getparams.msg | 5 - .../tests/mrcptest/v2/recognitioncomplete.msg | 20 - libs/unimrcp/tests/mrcptest/v2/recognize.msg | 30 - libs/unimrcp/tests/mrcptest/v2/setparams.msg | 5 - libs/unimrcp/tests/mrcptest/v2/speak.msg | 26 - .../tests/mrcptest/v2/speakcomplete.msg | 5 - libs/unimrcp/tests/mrcptest/v2/stop.msg | 3 - libs/unimrcp/tests/rtsptest/Makefile.am | 12 - libs/unimrcp/tests/rtsptest/msg/announce.msg | 24 - libs/unimrcp/tests/rtsptest/msg/ok.msg | 16 - libs/unimrcp/tests/rtsptest/msg/re-ok.msg | 6 - libs/unimrcp/tests/rtsptest/msg/re-setup.msg | 6 - libs/unimrcp/tests/rtsptest/msg/setup.msg | 16 - libs/unimrcp/tests/rtsptest/msg/teardown.msg | 4 - libs/unimrcp/tests/rtsptest/msg/ultimate.msg | 46 - libs/unimrcp/tests/rtsptest/rtsptest.vcproj | 296 -- libs/unimrcp/tests/rtsptest/rtsptest.vcxproj | 125 - .../tests/rtsptest/rtsptest.vcxproj.filters | 21 - libs/unimrcp/tests/rtsptest/src/main.c | 52 - .../tests/rtsptest/src/parse_gen_suite.c | 159 - libs/unimrcp/tests/sipp/mrcp_uac_multi | 108 - libs/unimrcp/tests/sipp/mrcp_uac_recog | 103 - libs/unimrcp/tests/sipp/mrcp_uac_synth | 103 - libs/unimrcp/tests/sipp/mrcp_uac_unknown | 102 - libs/unimrcp/tests/sipp/mrcp_uac_update | 179 - libs/unimrcp/tests/sipp/mrcp_uas_recog | 127 - libs/unimrcp/tests/sipp/mrcp_uas_reject | 49 - libs/unimrcp/tests/sipp/mrcp_uas_synth | 127 - libs/unimrcp/tests/sipp/mrcp_uas_unknown | 88 - libs/unimrcp/tests/strtablegen/Makefile.am | 9 - libs/unimrcp/tests/strtablegen/src/main.c | 146 - libs/unimrcp/tests/strtablegen/stringtable.in | 12 - .../tests/strtablegen/strtablegen.vcproj | 292 -- .../tests/strtablegen/strtablegen.vcxproj | 124 - .../strtablegen/strtablegen.vcxproj.filters | 18 - libs/unimrcp/unimrcp-2010.sln | 358 -- libs/unimrcp/unimrcp.sln | 447 -- src/include/switch.h | 3 - src/mod/.gitignore | 3 - src/mod/Makefile.am | 1 - src/mod/asr_tts/mod_unimrcp/Makefile.am | 44 - .../mod_unimrcp/mod_unimrcp.2017.vcxproj | 205 - src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c | 4631 ----------------- src/mod/asr_tts/mod_unimrcp/unimrcp.props | 15 - .../conf/autoload_configs/rayo.conf.xml | 30 - 632 files changed, 4 insertions(+), 93781 deletions(-) delete mode 100755 build/buildmrcpserver.sh delete mode 100644 conf/vanilla/autoload_configs/unimrcp.conf.xml delete mode 100644 conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml delete mode 100644 conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml delete mode 100644 conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml delete mode 100644 conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml delete mode 100644 conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml delete mode 100644 conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml delete mode 100644 conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml delete mode 100644 libs/unimrcp/.gitignore delete mode 100644 libs/unimrcp/.update delete mode 100644 libs/unimrcp/AUTHORS delete mode 100644 libs/unimrcp/CHANGES delete mode 100644 libs/unimrcp/INSTALL delete mode 100644 libs/unimrcp/LICENSE delete mode 100644 libs/unimrcp/Makefile.am delete mode 100644 libs/unimrcp/NOTICE delete mode 100644 libs/unimrcp/README delete mode 100644 libs/unimrcp/acinclude.m4 delete mode 100755 libs/unimrcp/bootstrap delete mode 100644 libs/unimrcp/build/Makefile.am delete mode 100644 libs/unimrcp/build/acmacros/apr.m4 delete mode 100644 libs/unimrcp/build/acmacros/apr_common.m4 delete mode 100644 libs/unimrcp/build/acmacros/apu.m4 delete mode 100644 libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 delete mode 100644 libs/unimrcp/build/acmacros/find_apr.m4 delete mode 100644 libs/unimrcp/build/acmacros/find_apu.m4 delete mode 100644 libs/unimrcp/build/acmacros/sofia-sip.m4 delete mode 100644 libs/unimrcp/build/acmacros/uni_plugin.m4 delete mode 100755 libs/unimrcp/build/get-version.sh delete mode 100755 libs/unimrcp/build/init.d/unimrcp-server delete mode 100644 libs/unimrcp/build/pkgconfig/Makefile.am delete mode 100644 libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in delete mode 100644 libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in delete mode 100644 libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in delete mode 100644 libs/unimrcp/build/props/apr.props delete mode 100644 libs/unimrcp/build/props/apt.props delete mode 100644 libs/unimrcp/build/props/mpf.props delete mode 100644 libs/unimrcp/build/props/mrcp.props delete mode 100644 libs/unimrcp/build/props/mrcpclient.props delete mode 100644 libs/unimrcp/build/props/mrcpengine.props delete mode 100644 libs/unimrcp/build/props/mrcpserver.props delete mode 100644 libs/unimrcp/build/props/mrcpsignaling.props delete mode 100644 libs/unimrcp/build/props/mrcpv2transport.props delete mode 100644 libs/unimrcp/build/props/sdk/unimrcpclient.props delete mode 100644 libs/unimrcp/build/props/sdk/unimrcpplugin.props delete mode 100644 libs/unimrcp/build/props/sdk/unimrcpsdk.props delete mode 100644 libs/unimrcp/build/props/sdk/unimrcpserver.props delete mode 100644 libs/unimrcp/build/props/sofiasip.props delete mode 100644 libs/unimrcp/build/props/unibase.props delete mode 100644 libs/unimrcp/build/props/unibin-x64.props delete mode 100644 libs/unimrcp/build/props/unibin.props delete mode 100644 libs/unimrcp/build/props/unidebug.props delete mode 100644 libs/unimrcp/build/props/unilib-x64.props delete mode 100644 libs/unimrcp/build/props/unilib.props delete mode 100644 libs/unimrcp/build/props/unimrcpclient.props delete mode 100644 libs/unimrcp/build/props/unimrcpserver.props delete mode 100644 libs/unimrcp/build/props/uniplugin-x64.props delete mode 100644 libs/unimrcp/build/props/uniplugin.props delete mode 100644 libs/unimrcp/build/props/unirelease.props delete mode 100644 libs/unimrcp/build/props/unirtsp.props delete mode 100644 libs/unimrcp/build/rules/uniclientapp.am delete mode 100644 libs/unimrcp/build/rules/uniclientlib.am delete mode 100644 libs/unimrcp/build/rules/uniplugin.am delete mode 100644 libs/unimrcp/build/rules/uniserverapp.am delete mode 100644 libs/unimrcp/build/rules/uniserverlib.am delete mode 100644 libs/unimrcp/build/tools/prepare.vcproj delete mode 100644 libs/unimrcp/build/tools/prepare.vcxproj delete mode 100644 libs/unimrcp/build/tools/unimrcp_service.c delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.exe.manifest delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.rc delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.vcproj delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.vcxproj delete mode 100644 libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters delete mode 100644 libs/unimrcp/build/uni_revision.h delete mode 100644 libs/unimrcp/build/uni_version.h delete mode 100644 libs/unimrcp/build/vsprops/apr.vsprops delete mode 100644 libs/unimrcp/build/vsprops/apt.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mpf.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcp.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpclient.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpengine.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpserver.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpsignaling.vsprops delete mode 100644 libs/unimrcp/build/vsprops/mrcpv2transport.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops delete mode 100644 libs/unimrcp/build/vsprops/sofiasip.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unibase.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unibin-x64.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unibin.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unidebug.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unilib-x64.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unilib.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unimrcpclient.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unimrcpserver.vsprops delete mode 100644 libs/unimrcp/build/vsprops/uniplugin-x64.vsprops delete mode 100644 libs/unimrcp/build/vsprops/uniplugin.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unirelease.vsprops delete mode 100644 libs/unimrcp/build/vsprops/unirtsp.vsprops delete mode 100644 libs/unimrcp/conf/Makefile.am delete mode 100644 libs/unimrcp/conf/client-profiles/lumenvox.xml delete mode 100644 libs/unimrcp/conf/client-profiles/nuance.xml delete mode 100644 libs/unimrcp/conf/client-profiles/speechpro.xml delete mode 100644 libs/unimrcp/conf/client-profiles/unimrcp.xml delete mode 100644 libs/unimrcp/conf/dirlayout.xml delete mode 100644 libs/unimrcp/conf/logger.xml delete mode 100644 libs/unimrcp/conf/umcscenarios.xml delete mode 100644 libs/unimrcp/conf/unimrcpclient.xml delete mode 100644 libs/unimrcp/conf/unimrcpclient.xsd delete mode 100644 libs/unimrcp/conf/unimrcpserver.xml delete mode 100644 libs/unimrcp/conf/unimrcpserver.xsd delete mode 100644 libs/unimrcp/config.layout delete mode 100644 libs/unimrcp/configure.ac delete mode 100755 libs/unimrcp/configure.gnu delete mode 100644 libs/unimrcp/data/Makefile.am delete mode 100644 libs/unimrcp/data/demo-16kHz.pcm delete mode 100644 libs/unimrcp/data/demo-8kHz.pcm delete mode 100644 libs/unimrcp/data/grammar.jsgf delete mode 100644 libs/unimrcp/data/grammar.mixed delete mode 100644 libs/unimrcp/data/grammar.srgs delete mode 100644 libs/unimrcp/data/grammar.xml delete mode 100644 libs/unimrcp/data/johnsmith-16kHz.pcm delete mode 100644 libs/unimrcp/data/johnsmith-8kHz.pcm delete mode 100644 libs/unimrcp/data/one-16kHz.pcm delete mode 100644 libs/unimrcp/data/one-8kHz.pcm delete mode 100644 libs/unimrcp/data/result-verification.xml delete mode 100644 libs/unimrcp/data/result.xml delete mode 100644 libs/unimrcp/data/speak.txt delete mode 100644 libs/unimrcp/data/speak.xml delete mode 100644 libs/unimrcp/docs/doxygen.conf.in delete mode 100644 libs/unimrcp/docs/mainpage.docs delete mode 100644 libs/unimrcp/libs/Makefile.am delete mode 100644 libs/unimrcp/libs/apr-toolkit/Makefile.am delete mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj delete mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj delete mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj delete mode 100644 libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_log.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_net.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_pair.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_pool.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_string.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_task.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_log.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_net.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_pair.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_pool.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_task.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c delete mode 100644 libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c delete mode 100644 libs/unimrcp/libs/mpf/Makefile.am delete mode 100644 libs/unimrcp/libs/mpf/codecs/g711/g711.c delete mode 100644 libs/unimrcp/libs/mpf/codecs/g711/g711.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_activity_detector.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_bridge.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_buffer.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_codec.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_codec_manager.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_context.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_decoder.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_encoder.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_engine.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_engine_factory.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_frame.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_message.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_mixer.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_multiplier.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_named_event.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_object.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_resampler.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_header.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_scheduler.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_stream.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_termination.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_termination_factory.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_trace.h delete mode 100644 libs/unimrcp/libs/mpf/include/mpf_types.h delete mode 100644 libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mpf/mpf.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mpf/mpf.vcproj delete mode 100644 libs/unimrcp/libs/mpf/mpf.vcxproj delete mode 100644 libs/unimrcp/libs/mpf/mpf.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_activity_detector.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_bridge.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_buffer.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_codec_g711.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_codec_linear.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_codec_manager.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_context.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_decoder.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_encoder.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_engine.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_engine_factory.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_mixer.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_multiplier.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_named_event.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_resampler.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_scheduler.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_stream.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_termination.c delete mode 100644 libs/unimrcp/libs/mpf/src/mpf_termination_factory.c delete mode 100644 libs/unimrcp/libs/mrcp-client/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp-client/include/mrcp_application.h delete mode 100644 libs/unimrcp/libs/mrcp-client/include/mrcp_client.h delete mode 100644 libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h delete mode 100644 libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h delete mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj delete mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-client/src/mrcp_application.c delete mode 100644 libs/unimrcp/libs/mrcp-client/src/mrcp_client.c delete mode 100644 libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h delete mode 100644 libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj delete mode 100644 libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c delete mode 100644 libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c delete mode 100644 libs/unimrcp/libs/mrcp-server/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp-server/include/mrcp_server.h delete mode 100644 libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h delete mode 100644 libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h delete mode 100644 libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj delete mode 100644 libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-server/src/mrcp_server.c delete mode 100644 libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c delete mode 100644 libs/unimrcp/libs/mrcp-signaling/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h delete mode 100644 libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h delete mode 100644 libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h delete mode 100644 libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c delete mode 100644 libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c delete mode 100644 libs/unimrcp/libs/mrcp/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h delete mode 100644 libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h delete mode 100644 libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h delete mode 100644 libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c delete mode 100644 libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c delete mode 100644 libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c delete mode 100644 libs/unimrcp/libs/mrcp/include/mrcp.h delete mode 100644 libs/unimrcp/libs/mrcp/include/mrcp_types.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_header.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_message.h delete mode 100644 libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_header.c delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_message.c delete mode 100644 libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.vcproj delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.vcxproj delete mode 100644 libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c delete mode 100644 libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/Makefile.am delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c delete mode 100644 libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/Makefile.am delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj delete mode 100644 libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters delete mode 100644 libs/unimrcp/modules/Makefile.am delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/Makefile.am delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_logger.c delete mode 100644 libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/Makefile.am delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2017.vcxproj delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj.filters delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c delete mode 100644 libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c delete mode 100644 libs/unimrcp/packages/inno-setup/setup-sdk-win32.txt delete mode 100644 libs/unimrcp/packages/inno-setup/setup-sdk-x64.txt delete mode 100644 libs/unimrcp/packages/inno-setup/setup-win32.txt delete mode 100644 libs/unimrcp/packages/inno-setup/setup-x64.txt delete mode 100644 libs/unimrcp/packages/inno-setup/setup.txt delete mode 100644 libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss delete mode 100644 libs/unimrcp/packages/inno-setup/unimrcp.iss delete mode 100644 libs/unimrcp/platforms/Makefile.am delete mode 100644 libs/unimrcp/platforms/asr-client/Makefile.am delete mode 100644 libs/unimrcp/platforms/asr-client/asrclient.vcproj delete mode 100644 libs/unimrcp/platforms/asr-client/asrclient.vcxproj delete mode 100644 libs/unimrcp/platforms/asr-client/asrclient.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/asr-client/src/main.c delete mode 100644 libs/unimrcp/platforms/libasr-client/Makefile.am delete mode 100644 libs/unimrcp/platforms/libasr-client/include/asr_engine.h delete mode 100644 libs/unimrcp/platforms/libasr-client/libasrclient.vcproj delete mode 100644 libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj delete mode 100644 libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/libasr-client/src/asr_engine.c delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/Makefile.am delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/Makefile.am delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c delete mode 100644 libs/unimrcp/platforms/umc/Makefile.am delete mode 100644 libs/unimrcp/platforms/umc/include/dtmfscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/dtmfsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/recogscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/recogsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/recorderscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/recordersession.h delete mode 100644 libs/unimrcp/platforms/umc/include/setparamscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/setparamsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/synthscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/synthsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/umcconsole.h delete mode 100644 libs/unimrcp/platforms/umc/include/umcframework.h delete mode 100644 libs/unimrcp/platforms/umc/include/umcscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/umcsession.h delete mode 100644 libs/unimrcp/platforms/umc/include/verifierscenario.h delete mode 100644 libs/unimrcp/platforms/umc/include/verifiersession.h delete mode 100644 libs/unimrcp/platforms/umc/src/dtmfscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/dtmfsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/main.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/recogscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/recogsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/recorderscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/recordersession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/setparamscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/setparamsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/synthscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/synthsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/umcconsole.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/umcframework.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/umcscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/umcsession.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/verifierscenario.cpp delete mode 100644 libs/unimrcp/platforms/umc/src/verifiersession.cpp delete mode 100644 libs/unimrcp/platforms/umc/umc.rc delete mode 100644 libs/unimrcp/platforms/umc/umc.vcproj delete mode 100644 libs/unimrcp/platforms/umc/umc.vcxproj delete mode 100644 libs/unimrcp/platforms/umc/umc.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/unimrcp-client/Makefile.am delete mode 100644 libs/unimrcp/platforms/unimrcp-client/include/demo_application.h delete mode 100644 libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h delete mode 100644 libs/unimrcp/platforms/unimrcp-client/include/demo_util.h delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/demo_util.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/src/main.c delete mode 100644 libs/unimrcp/platforms/unimrcp-client/unimrcpclient.rc delete mode 100644 libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj delete mode 100644 libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj delete mode 100644 libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj.filters delete mode 100644 libs/unimrcp/platforms/unimrcp-server/Makefile.am delete mode 100644 libs/unimrcp/platforms/unimrcp-server/src/main.c delete mode 100644 libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c delete mode 100644 libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c delete mode 100644 libs/unimrcp/platforms/unimrcp-server/src/uni_service.c delete mode 100644 libs/unimrcp/platforms/unimrcp-server/unimrcpserver.rc delete mode 100644 libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj delete mode 100644 libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj delete mode 100644 libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/Makefile.am delete mode 100644 libs/unimrcp/plugins/demo-recog/Makefile.am delete mode 100644 libs/unimrcp/plugins/demo-recog/demorecog.vcproj delete mode 100644 libs/unimrcp/plugins/demo-recog/demorecog.vcxproj delete mode 100644 libs/unimrcp/plugins/demo-recog/demorecog.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c delete mode 100644 libs/unimrcp/plugins/demo-synth/Makefile.am delete mode 100644 libs/unimrcp/plugins/demo-synth/demosynth.vcproj delete mode 100644 libs/unimrcp/plugins/demo-synth/demosynth.vcxproj delete mode 100644 libs/unimrcp/plugins/demo-synth/demosynth.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c delete mode 100644 libs/unimrcp/plugins/demo-verifier/Makefile.am delete mode 100644 libs/unimrcp/plugins/demo-verifier/demoverifier.vcproj delete mode 100644 libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj delete mode 100644 libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/demo-verifier/src/demo_verifier_engine.c delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/Makefile.am delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcproj delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj.filters delete mode 100644 libs/unimrcp/plugins/mrcp-recorder/src/mrcp_recorder_engine.c delete mode 100644 libs/unimrcp/tests/Makefile.am delete mode 100644 libs/unimrcp/tests/apttest/Makefile.am delete mode 100644 libs/unimrcp/tests/apttest/apttest.vcproj delete mode 100644 libs/unimrcp/tests/apttest/apttest.vcxproj delete mode 100644 libs/unimrcp/tests/apttest/apttest.vcxproj.filters delete mode 100644 libs/unimrcp/tests/apttest/src/consumer_task_suite.c delete mode 100644 libs/unimrcp/tests/apttest/src/main.c delete mode 100644 libs/unimrcp/tests/apttest/src/multipart_suite.c delete mode 100644 libs/unimrcp/tests/apttest/src/task_suite.c delete mode 100644 libs/unimrcp/tests/mpftest/Makefile.am delete mode 100644 libs/unimrcp/tests/mpftest/mpftest.vcproj delete mode 100644 libs/unimrcp/tests/mpftest/mpftest.vcxproj delete mode 100644 libs/unimrcp/tests/mpftest/mpftest.vcxproj.filters delete mode 100644 libs/unimrcp/tests/mpftest/src/main.c delete mode 100644 libs/unimrcp/tests/mpftest/src/mpf_suite.c delete mode 100644 libs/unimrcp/tests/mrcptest/Makefile.am delete mode 100644 libs/unimrcp/tests/mrcptest/mrcptest.vcproj delete mode 100644 libs/unimrcp/tests/mrcptest/mrcptest.vcxproj delete mode 100644 libs/unimrcp/tests/mrcptest/mrcptest.vcxproj.filters delete mode 100644 libs/unimrcp/tests/mrcptest/src/main.c delete mode 100644 libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c delete mode 100644 libs/unimrcp/tests/mrcptest/src/set_get_suite.c delete mode 100644 libs/unimrcp/tests/mrcptest/src/transparent_set_get_suite.c delete mode 100644 libs/unimrcp/tests/mrcptest/v1/definegrammar.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/getparams.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/multi.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/pause.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/recognize.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/response.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/resume.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/setparams.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/speak.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v1/stop.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/definegrammar.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/getparams.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/recognize.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/setparams.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/speak.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg delete mode 100644 libs/unimrcp/tests/mrcptest/v2/stop.msg delete mode 100644 libs/unimrcp/tests/rtsptest/Makefile.am delete mode 100644 libs/unimrcp/tests/rtsptest/msg/announce.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/ok.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/re-ok.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/re-setup.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/setup.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/teardown.msg delete mode 100644 libs/unimrcp/tests/rtsptest/msg/ultimate.msg delete mode 100644 libs/unimrcp/tests/rtsptest/rtsptest.vcproj delete mode 100644 libs/unimrcp/tests/rtsptest/rtsptest.vcxproj delete mode 100644 libs/unimrcp/tests/rtsptest/rtsptest.vcxproj.filters delete mode 100644 libs/unimrcp/tests/rtsptest/src/main.c delete mode 100644 libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_multi delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_recog delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_synth delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_unknown delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uac_update delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uas_recog delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uas_reject delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uas_synth delete mode 100644 libs/unimrcp/tests/sipp/mrcp_uas_unknown delete mode 100644 libs/unimrcp/tests/strtablegen/Makefile.am delete mode 100644 libs/unimrcp/tests/strtablegen/src/main.c delete mode 100644 libs/unimrcp/tests/strtablegen/stringtable.in delete mode 100644 libs/unimrcp/tests/strtablegen/strtablegen.vcproj delete mode 100644 libs/unimrcp/tests/strtablegen/strtablegen.vcxproj delete mode 100644 libs/unimrcp/tests/strtablegen/strtablegen.vcxproj.filters delete mode 100644 libs/unimrcp/unimrcp-2010.sln delete mode 100644 libs/unimrcp/unimrcp.sln delete mode 100644 src/mod/asr_tts/mod_unimrcp/Makefile.am delete mode 100644 src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2017.vcxproj delete mode 100644 src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c delete mode 100644 src/mod/asr_tts/mod_unimrcp/unimrcp.props diff --git a/LICENSE b/LICENSE index 46a2c712e9..2002b83219 100644 --- a/LICENSE +++ b/LICENSE @@ -1011,12 +1011,6 @@ License: MPL-1.1 or GPL-2+ use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.] -Files: libs/unimrcp/* -Copyright: 2008-2010 Arsen Chaloyan - 2009-2010 Tomas Valenta, Arsen Chaloyan - 2001-2006 Steve Underwood -License: Apache-2.0 - Files: */inet_pton.c libs/curl/lib/inet_ntop.c libs/curl/lib/mprintf.c diff --git a/bootstrap.sh b/bootstrap.sh index a68a0624ac..802c6098f7 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -10,7 +10,7 @@ BGJOB=false VERBOSE=false BASEDIR=`pwd`; LIBDIR=${BASEDIR}/libs; -SUBDIRS="apr libzrtp iksemel srtp unimrcp fs"; +SUBDIRS="apr libzrtp iksemel srtp fs"; while getopts 'jhd:v' o; do case "$o" in diff --git a/build/buildmrcpserver.sh b/build/buildmrcpserver.sh deleted file mode 100755 index a6468b06d2..0000000000 --- a/build/buildmrcpserver.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh -base=`pwd` -cd libs/unimrcp -./configure --with-pocketsphinx=$base/libs/pocketsphinx-0.5.99 --with-sphinxbase=$base/libs/sphinxbase-0.4.99 --with-flite=$base/libs/flite-1.3.99 --with-apr=$base/libs/apr --with-apr-util=$base/libs/apr-util --with-sofia-sip=$base/libs/sofia-sip --prefix=/usr/local/unimrcpserver --enable-pocketsphinx-plugin --enable-flite-plugin --disable-demosynth-plugin --disable-demorecog-plugin --disable-recorder-plugin --disable-cepstral-plugin -make -make install diff --git a/build/modules.conf.in b/build/modules.conf.in index ab50bd53dc..7bf59e2acc 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -60,7 +60,6 @@ applications/mod_voicemail #asr_tts/mod_flite #asr_tts/mod_pocketsphinx #asr_tts/mod_tts_commandline -#asr_tts/mod_unimrcp codecs/mod_amr #codecs/mod_amrwb codecs/mod_b64 diff --git a/build/modules.conf.most b/build/modules.conf.most index 86063db582..fbf8100a90 100644 --- a/build/modules.conf.most +++ b/build/modules.conf.most @@ -58,7 +58,6 @@ applications/mod_voicemail_ivr asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_commandline -asr_tts/mod_unimrcp codecs/mod_amr codecs/mod_amrwb codecs/mod_b64 diff --git a/conf/rayo/autoload_configs/rayo.conf.xml b/conf/rayo/autoload_configs/rayo.conf.xml index e5191909cb..9f525c597c 100644 --- a/conf/rayo/autoload_configs/rayo.conf.xml +++ b/conf/rayo/autoload_configs/rayo.conf.xml @@ -277,36 +277,6 @@ ]]> - - - - yesno - ]]]]> - - - ]]> - - - - - yesno - ]]]]> - - - ]]> - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml b/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml deleted file mode 100644 index dcf42821f5..0000000000 --- a/conf/vanilla/mrcp_profiles/loquendo-7-mrcp-v2.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml deleted file mode 100644 index 0700dec629..0000000000 --- a/conf/vanilla/mrcp_profiles/nuance-1.0.0-mrcp-v1.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml deleted file mode 100644 index 3c4938a66d..0000000000 --- a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v1.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml b/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml deleted file mode 100644 index b53cba0984..0000000000 --- a/conf/vanilla/mrcp_profiles/nuance-5.0-mrcp-v2.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml deleted file mode 100644 index fe02b1582f..0000000000 --- a/conf/vanilla/mrcp_profiles/unimrcpserver-mrcp-v1.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml deleted file mode 100644 index cbde87ca5a..0000000000 --- a/conf/vanilla/mrcp_profiles/vestec-mrcp-v1.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml b/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml deleted file mode 100644 index fb1d0ee287..0000000000 --- a/conf/vanilla/mrcp_profiles/voxeo-prophecy-8.0-mrcp-v1.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/configure.ac b/configure.ac index 24e838731a..52b0a3cd98 100644 --- a/configure.ac +++ b/configure.ac @@ -1089,7 +1089,7 @@ fi # Tested and fixed lot of modules, but some are untested. Will be added back when the core team decide it ready # Untested modules : mod_osp mod_soundtouch mod_sangoma_codec mod_opal mod_h323 mod_khomp -# mod_unimrcp mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed +# mod_cepstral mod_erlang_event mod_snmp mod_perl mod_java mod_managed # #saved_CFLAGS="$CFLAGS" #AC_CACHE_CHECK([whether compiler supports -Wunused-but-set-variable], [ac_cv_gcc_unused_but_set_variable], [ @@ -2144,7 +2144,6 @@ AC_CONFIG_FILES([Makefile src/mod/asr_tts/mod_flite/Makefile src/mod/asr_tts/mod_pocketsphinx/Makefile src/mod/asr_tts/mod_tts_commandline/Makefile - src/mod/asr_tts/mod_unimrcp/Makefile src/mod/codecs/mod_amr/Makefile src/mod/codecs/mod_amrwb/Makefile src/mod/codecs/mod_b64/Makefile @@ -2331,7 +2330,6 @@ if test "$use_system_apr" != "yes"; then AC_CONFIG_SUBDIRS([libs/apr]) fi AC_CONFIG_SUBDIRS([libs/iksemel]) -#AC_CONFIG_SUBDIRS([libs/unimrcp]) if test "x${enable_zrtp}" = "xyes"; then AC_CONFIG_SUBDIRS([libs/libzrtp]) fi diff --git a/debian/bootstrap.sh b/debian/bootstrap.sh index ba94c9d1ce..71c5b52f99 100755 --- a/debian/bootstrap.sh +++ b/debian/bootstrap.sh @@ -653,7 +653,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-flite (= \${binary:Version}), freeswitch-mod-pocketsphinx (= \${binary:Version}), freeswitch-mod-tts-commandline (= \${binary:Version}), - freeswitch-mod-unimrcp (= \${binary:Version}), freeswitch-mod-dialplan-asterisk (= \${binary:Version}), freeswitch-mod-dialplan-directory (= \${binary:Version}), freeswitch-mod-dialplan-xml (= \${binary:Version}), @@ -891,7 +890,6 @@ Depends: \${misc:Depends}, freeswitch (= \${binary:Version}), freeswitch-mod-flite-dbg (= \${binary:Version}), freeswitch-mod-pocketsphinx-dbg (= \${binary:Version}), freeswitch-mod-tts-commandline-dbg (= \${binary:Version}), - freeswitch-mod-unimrcp-dbg (= \${binary:Version}), freeswitch-mod-dialplan-asterisk-dbg (= \${binary:Version}), freeswitch-mod-dialplan-directory-dbg (= \${binary:Version}), freeswitch-mod-dialplan-xml-dbg (= \${binary:Version}), diff --git a/debian/control-modules b/debian/control-modules index f438d0277d..b9d7a05933 100644 --- a/debian/control-modules +++ b/debian/control-modules @@ -291,10 +291,6 @@ 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 diff --git a/debian/copyright b/debian/copyright index af7a6fe152..01473e4940 100644 --- a/debian/copyright +++ b/debian/copyright @@ -1011,12 +1011,6 @@ License: MPL-1.1 or GPL-2+ use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.] -Files: libs/unimrcp/* -Copyright: 2008-2010 Arsen Chaloyan - 2009-2010 Tomas Valenta, Arsen Chaloyan - 2001-2006 Steve Underwood -License: Apache-2.0 - Files: */inet_pton.c libs/curl/lib/inet_ntop.c libs/curl/lib/mprintf.c diff --git a/docs/Doxygen.conf b/docs/Doxygen.conf index 5df2a2bcb2..9e62b08232 100644 --- a/docs/Doxygen.conf +++ b/docs/Doxygen.conf @@ -1242,7 +1242,7 @@ SEARCH_INCLUDES = YES INCLUDE_PATH =../libs/apr ../libs/apr-util ../libs/iksemel ../libs/libnatpmp \ ../libs/miniupnpc ../libs/sofia-sip ../libs/spandsp \ - ../libs/srtp ../libs/unimrcp ../libs/win32 ../libs/xmlrpc-c + ../libs/srtp ../libs/win32 ../libs/xmlrpc-c # You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard # patterns (like *.h and *.hpp) to filter out the header-files in the diff --git a/freeswitch.spec b/freeswitch.spec index 7bdb8eaec6..8672b4fc59 100644 --- a/freeswitch.spec +++ b/freeswitch.spec @@ -636,15 +636,6 @@ Requires: %{name} = %{version}-%{release} Provides FreeSWITCH mod_tts_commandline, Run a command line and play the output file. -%package asrtts-unimrcp -Summary: FreeSWITCH mod_unimrcp -Group: System/Libraries -Requires: %{name} = %{version}-%{release} - -%description asrtts-unimrcp -Provides FreeSWITCH mod_unimrcp, allows communication with Media Resource -Control Protocol (MRCP) servers - ###################################################################################################################### # FreeSWITCH Codec Modules ###################################################################################################################### @@ -1435,7 +1426,7 @@ APPLICATIONS_MODULES="$APPLICATION_MODULES_AC $APPLICATION_MODULES_DE $APPLICATI # Automatic Speech Recognition and Text To Speech Modules # ###################################################################################################################### -ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_commandline asr_tts/mod_unimrcp" +ASR_TTS_MODULES="asr_tts/mod_flite asr_tts/mod_pocketsphinx asr_tts/mod_tts_commandline" ###################################################################################################################### # @@ -1962,7 +1953,6 @@ fi %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/translate.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/tts_commandline.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unicall.conf.xml -%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/unimrcp.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/verto.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail.conf.xml %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/voicemail_ivr.conf.xml @@ -2163,9 +2153,6 @@ fi %files asrtts-tts-commandline %{MODINSTDIR}/mod_tts_commandline.so* -%files asrtts-unimrcp -%{MODINSTDIR}/mod_unimrcp.so* - ###################################################################################################################### # # CODEC Packages diff --git a/libs/.gitignore b/libs/.gitignore index cb4112eb88..f1d983b2da 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -551,102 +551,6 @@ opal /tiff-*/tools/tiffmedian /tiff-*/tools/tiffset /tiff-*/tools/tiffsplit -/unimrcp/build/acmacros/libtool.m4 -/unimrcp/build/acmacros/lt~obsolete.m4 -/unimrcp/build/acmacros/ltoptions.m4 -/unimrcp/build/acmacros/ltsugar.m4 -/unimrcp/build/acmacros/ltversion.m4 -/unimrcp/build/Makefile -/unimrcp/build/Makefile.in -/unimrcp/build/pkgconfig/Makefile -/unimrcp/build/pkgconfig/Makefile.in -/unimrcp/build/svnrev/Makefile -/unimrcp/build/svnrev/Makefile.in -/unimrcp/build/svnrev/svnrev -!/unimrcp/build/tools/unimrcpservice.exe.manifest -!/unimrcp/build/uni_revision.h -!/unimrcp/configure.gnu -/unimrcp/conf/Makefile -/unimrcp/conf/Makefile.in -/unimrcp/data/Makefile -/unimrcp/data/Makefile.in -/unimrcp/docs/doxygen.conf -/unimrcp/libs/apr-toolkit/Makefile -/unimrcp/libs/apr-toolkit/Makefile.in -/unimrcp/libs/Makefile -/unimrcp/libs/Makefile.in -/unimrcp/libs/mpf/Makefile -/unimrcp/libs/mpf/Makefile.in -/unimrcp/libs/mrcp-client/Makefile -/unimrcp/libs/mrcp-client/Makefile.in -/unimrcp/libs/mrcp-engine/Makefile -/unimrcp/libs/mrcp-engine/Makefile.in -/unimrcp/libs/mrcp/Makefile -/unimrcp/libs/mrcp/Makefile.in -/unimrcp/libs/mrcp-server/Makefile -/unimrcp/libs/mrcp-server/Makefile.in -/unimrcp/libs/mrcp-signaling/Makefile -/unimrcp/libs/mrcp-signaling/Makefile.in -/unimrcp/libs/mrcpv2-transport/Makefile -/unimrcp/libs/mrcpv2-transport/Makefile.in -/unimrcp/libs/uni-rtsp/Makefile -/unimrcp/libs/uni-rtsp/Makefile.in -/unimrcp/Makefile -/unimrcp/Makefile.in -/unimrcp/modules/Makefile -/unimrcp/modules/Makefile.in -/unimrcp/modules/mrcp-sofiasip/Makefile -/unimrcp/modules/mrcp-sofiasip/Makefile.in -/unimrcp/modules/mrcp-unirtsp/Makefile -/unimrcp/modules/mrcp-unirtsp/Makefile.in -/unimrcp/platforms/asr-client/asrclient -/unimrcp/platforms/asr-client/Makefile -/unimrcp/platforms/asr-client/Makefile.in -/unimrcp/platforms/libasr-client/Makefile -/unimrcp/platforms/libasr-client/Makefile.in -/unimrcp/platforms/libunimrcp-client/Makefile -/unimrcp/platforms/libunimrcp-client/Makefile.in -/unimrcp/platforms/libunimrcp-server/Makefile -/unimrcp/platforms/libunimrcp-server/Makefile.in -/unimrcp/platforms/Makefile -/unimrcp/platforms/Makefile.in -/unimrcp/platforms/umc/Makefile -/unimrcp/platforms/umc/Makefile.in -/unimrcp/platforms/umc/umc -/unimrcp/platforms/unimrcp-client/Makefile -/unimrcp/platforms/unimrcp-client/Makefile.in -/unimrcp/platforms/unimrcp-client/unimrcpclient -/unimrcp/platforms/unimrcp-server/Makefile -/unimrcp/platforms/unimrcp-server/Makefile.in -/unimrcp/platforms/unimrcp-server/unimrcpserver -/unimrcp/plugins/demo-recog/Makefile -/unimrcp/plugins/demo-recog/Makefile.in -/unimrcp/plugins/demo-synth/Makefile -/unimrcp/plugins/demo-synth/Makefile.in -/unimrcp/plugins/demo-verifier/Makefile -/unimrcp/plugins/demo-verifier/Makefile.in -/unimrcp/plugins/Makefile -/unimrcp/plugins/Makefile.in -/unimrcp/plugins/mrcp-cepstral/Makefile -/unimrcp/plugins/mrcp-cepstral/Makefile.in -/unimrcp/plugins/mrcp-flite/Makefile -/unimrcp/plugins/mrcp-flite/Makefile.in -/unimrcp/plugins/mrcp-pocketsphinx/Makefile -/unimrcp/plugins/mrcp-pocketsphinx/Makefile.in -/unimrcp/plugins/mrcp-recorder/Makefile -/unimrcp/plugins/mrcp-recorder/Makefile.in -/unimrcp/tests/apttest/Makefile -/unimrcp/tests/apttest/Makefile.in -/unimrcp/tests/Makefile -/unimrcp/tests/Makefile.in -/unimrcp/tests/mpftest/Makefile -/unimrcp/tests/mpftest/Makefile.in -/unimrcp/tests/mrcptest/Makefile -/unimrcp/tests/mrcptest/Makefile.in -/unimrcp/tests/rtsptest/Makefile -/unimrcp/tests/rtsptest/Makefile.in -/unimrcp/tests/strtablegen/Makefile -/unimrcp/tests/strtablegen/Makefile.in /win32/celt/*/*/libcelt.log /win32/libg722_1/*/*/libg722_1.log /win32/libshout/*/*/libshout.log @@ -708,7 +612,6 @@ ilbc/config/compile libg722_1/config/compile pcre/compile srtp/build/compile -unimrcp/build/compile /pcre-*/ /speex-*/ /curl-*/ @@ -723,7 +626,6 @@ libyuv/Makefile libyuv/convert srtp/configure tiff-4.0.2/configure -unimrcp/configure zlib-*/ zlib-* libpq-*/ diff --git a/libs/unimrcp/.gitignore b/libs/unimrcp/.gitignore deleted file mode 100644 index 90ec22bee1..0000000000 --- a/libs/unimrcp/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.svn diff --git a/libs/unimrcp/.update b/libs/unimrcp/.update deleted file mode 100644 index 5875d6e932..0000000000 --- a/libs/unimrcp/.update +++ /dev/null @@ -1 +0,0 @@ -Mon Nov 17 11:06:30 EST 2014 diff --git a/libs/unimrcp/AUTHORS b/libs/unimrcp/AUTHORS deleted file mode 100644 index 6c7b0eee09..0000000000 --- a/libs/unimrcp/AUTHORS +++ /dev/null @@ -1,17 +0,0 @@ -Author(s): - Arsen Chaloyan - - -Contributor(s): - Kamil Shakirov - Anthony Masse - Vlad Socaciu - Garmt - Patrick Nunes - Bayram Boyraz - Mahmoud Hassan - Michael Jerris - Carlos Pina Soares - Chaitanya Chokkareddy - Tomas Valenta - Danijel Korzinek diff --git a/libs/unimrcp/CHANGES b/libs/unimrcp/CHANGES deleted file mode 100644 index 8271824144..0000000000 --- a/libs/unimrcp/CHANGES +++ /dev/null @@ -1,214 +0,0 @@ -Changes for UniMRCP-1.2.0 - - APR-toolkit library - - * Implemented a new interface for the NLSML parser in accordance with the NSLML schema defined in http://tools.ietf.org/html/rfc6787#section-16.1. - * Took out the legacy NLSML interface. - * Fixed a gcc warning for strict-aliasing rules. - * Implemented apt_pair_array_generate() in 2 passes, apr_pstrcatv() alike. - * Prevent compilation warnings for unused-but-set-variable. - * Use int instead of apt_task_msg_type_e to suppress a warning triggered by gcc 4.7: case value not in enumerated type 'apt_task_msg_type_e'. - * Upon creation of a new memory pool, register apr_abortfunc_t callback which is supposed to be invoked when memory allocation fails within apr_pool. - * Added apt_va_log() which accepts va_list as an input argument. - * Set the default maximum number of log files used in rotation to 100. - * Set thread names for APT tasks to be shown in debuggers. Thanks Vali. - * Enable apt_timer logs only if APT_TIMER_DEBUG is defined. - * Use a local temporary char buffer to construct the hostname in apt_ip_get() not to allocate memory from a permanent pool. - * Unified pointer logging in APT style. Thanks Vali. - * Define APT_PTR_FMT as 0x%I64x for 64-bit Windows. - * Removed unused function apt_text_boolean_value_insert/apt_boolean_value_insert (inconsistent declaration/definition). Thanks Vali. - - MPF library - - * The function mpf_codec_lists_intersect() now returns FALSE if there is no match for the primary codec descriptor. - * Reject the RTP session if there is no match in remote and local codecs. - * Use the reserved RTP payload type 19 in case codec list is empty (media stream is rejected). - * If the codec list does not match the capabilities, mark the stream as disabled. - * Do not set SO_REUSEADDR on RTP sockets. - * Made G.711 implementation bit-exact with ITU-T reference implementation. - * Use APR typedefs in G.711 implementation. - * Improved the RTP port management for those cases when the specified RTP port range is not enough to handle concurrent MRCP sessions. - * Check the number of ports per engine to be even to ensure there is a room for a pair of RTP/RTCP ports. - * Added debugging capabilities to mpf_frame_buffer. - * Copy name string when adding to codec capabilities. Thanks Vali. - - MRCP common library - - * Use apr_snprintf() instead of sprintf() in mrcp_request_id_generate(). - * Get rid of local fixed-size char buffers and additional string copies. Instead, allocate buffers from memory pool and generate strings straight into the buffers. - - MRCP client library - - * Completed the implementation of the new API function to retrieve a SIP/RTSP response code received from the server (Issue-90). - * Fixed a potential crash of the client stack which could happen when the server unexpectedly closes the MRCPv2 connection while the client stack is processing an application request. - * Allow a pool/factory of signaling agents to be defined with the MRCPv1 and/or MRCPv2 profiles. - * Respond straight away with success to the session termination request if the session creation failed in the first place. - * Keep track of associations between RTP termination factories (pools of RTP ports) and media engines. - * Allow a pool/factory of media processing engines to be defined with the MRCPv1 and/or MRCPv2 profiles. - * Allow a pool/factory of MRCPv2 connection agents to be defined with the MRCPv2 profiles. - * Added the ability to specify an IP address by the name of network interface/adapter. - * Added a new accessor function to the client API mrcp_client_profiles_get() which retrieves the available profiles. - * Store the profile name not only as a key in the profile table but also in the profile structure. - * Allow setting an arbitrary tag to the profile. - - MRCP server library - - * Handle separately the case when an RTSP SETUP contains no SDP, which means it's up to the server to decide which codec to use. - * Fixed a crash if MRCP resource not found. Thanks Vali. - * Keep track of associations between RTP termination factories (pools of RTP ports) and media engines. - * Added the ability to specify an IP address by the name of network interface/adapter. - * Log maximum engine channel count exceeded. Thanks Vali. - - Sofia-SIP module (MRCPv2 agent) - - * Do not generate media format list for a disabled audio stream. - * Use snprintf() consistently in mrcp_sdp.c. - * Implemented the log redirection routine of SofiaSIP. - * Added an indentifier of the SofiaSIP agent to the log statement "Receive SIP Event". - - RTSP module (MRCPv1 agent) - - * Do not generate media format list for a disabled audio stream. - - Demo plugins - - * Respond with failure if codec descriptor is unavailable (associated media stream is disabled). - - UMC sample application - - * Terminate execution of sample application if media descriptor is unavailable (media stream is disabled). - * Use the new NLSML parser interface in sample apps. - * Set the header field Save-Waveform to TRUE in the sample umc recog application. - * Fixed an invalid read of 8 bytes in umc application: sizeof(mpf_codec_capabilities_t) was meant to be allocated. - - ASR Client application (and library) - - * Get rid of 1Kb grammar file limit in libasrclient. Load the content into an allocated buffer instead. - - Miscellaneous - - * Copy the version and revision header files located in the build directory to the SDK include directory. - * Added/fixed support for DESTDIR. - * Take into consideration m4 macro files generated for/by libtool 2. - * Set ac_macro_dir variable manually, since newer versions of autoconf don't do that. - * Enable silent build rules (--enable-silent-rules)and use silent build by default. - * Enhanced the report generated by the ./configure script. - * Pass no-define to AM_INIT_AUTOMAKE in order not to define PACKAGE and VERSION. - * Do not use autoconf generated compiler DEFS by replacing confdefs.h after AC_INIT, AM_INIT_AUTOMAKE and AC_PROG_LIBTOLL getting called. - * Updated definition of the macro AX_COMPILER_VENDOR and moved it out from configure.ac to a separate m4 file. - * Added missing dereferences of pointers to the (potential) terminal NUL of some strings. Thanks Vali. - * Disabled DEFAULT_INCLUDES provided by automake. - * Added generic apr_common.m4 in order to use helper m4 macros APR_ADDTO() and APR_CONFIG_NICE(). - * Generate ./config.nice to reuse ./configure command-line. - * Added uni_plugin.m4 which provides generic macros UNI_PLUGIN_ENABLED(name) and UNI_PLUGIN_DISABLED(name). - * Added common GNU make rules/vars for plugins, client and server libs/apps alike VS property sheets. - * The macro UNIMRCP_CHECK_APR() now checks and sets variables for both APR and APR-util libraries. - * Added a brief description of the license definition which is intended to be used for Windows resource files only. - * Brought XML schema definitions of configuration file formats up to date. - * Cppcheck: printf-like formats fix, possible NULL pointer dereference, member not initialized in the constructor, - unused variable/value, method can be made static. Thanks Vali. - * Define _WIN64 in Visual Studio x64 targets (for IDE only, the compiler defines _WIN64 anyway). Thanks Vali. - * Fixed some GCC warnings. Thanks Vali. - * Moved mrcp-flite and mrcp-pocketsphinx plugins out of the source tree into the external solutions directory. - - -Changes for UniMRCP-1.1.0 - - APR-toolkit library - - * The function apt_log_file_open() makes a copy of dir_path and file_name variables passed from a user application. - * Applied a patch to the apt_log routine which allows the log file to be appended instead of being overwritten. The patch was submitted by Dani. Thanks. - * Added a new parameter to the function apt_log_file_open() which specifies whether the log file should be appended or overwritten. - * Fixed the formatting of float values in the header fields. Applied a patch submitted by Randy (Issue-108). Thanks. - * Fixed apt_log_output_mode_check() which returned TRUE if any mode was enabled or checked regardless their correspondence. Thanks Vali. - * Enhanced the debug output by adding task message identifier to the log statements "Signal Message" and "Process Message". - * Fixed a potential crash related to the use of pollsets. - * Fixed a potential buffer overflow in apt_text_pair_array_insert(). Thanks Vali. - * Remove a socket descriptor from the pollset only if the descriptor has been properly added to the pollset. Otherwise, this operation could cause a crash. - - MPF library - - * Tweaked DTMF detector's energy thresholds to eliminate false positives during in-band (from audio) DTMF detection. Thanks Vali. - * Took into consideration the RTP marker in order to re-sync the jitter buffer on a new talkspurt. Audio data loss could be experienced in the RTP receiver in case of consecutive SPEAK (for client) or RECOGNIZE (for server) requests. - * Instead of discarding a non-aligned RTP packet, adjust the timestamp and write available frames to the jitter buffer (Issue-122). - * Added support for the adaptive jitter buffer. Applied a reworked patch submitted by Erik. Thanks. - * Enhanced the detection of a new RTP talkspurt by implicitly setting the RTP marker if a gap between two RTP packets is more than the specified threshold (INTER_TALSKPUSRT_GAP = 1000 msec). - * Allow the initial playout delay in the jitter buffer to be set to 0. - * Implemented a time skew detection algorithm for RTP streams. The detection can be enabled and used for both the adaptive and static jitter buffer. - * Added support for redirection of RTP traces (RTP_TRACE, JB_TRACE) to the debug output window of Visual Studio. - * Enhanced the processing of the RTP named events. - - RTSP library - - * Use strcasecmp() instead of apr_strnatcasecmp() to match RTSP resource names (Issue-94). - * Fixed a crash in the RTSP client stack when the server closes a TCP connection while the associated RTSP session is being destroyed (Issue-124). - * Fixed the processing of RTSP TEARDOWN requests being timed out. Applied a patch submitted to Issue-125 by Chris. Thanks. - * For logging purposes, pass a string identifier of the RTSP/MRCPv1 signaling agent to the RTSP client and server stacks. - - MRCP common library - - * Added missing recognizer header fields used for voice enrollment (speaker-dependent recognition). - * Added support for custom MRCP header fields. - * Added support for speaker verification and identification resource. - * Added missing recognizer methods used for voice enrollment and interpretation. - * Updated the state machine of the recognizer resource to take into consideration requests, responses and events used for interpretation. - * Enhanced helper functions which operate on the MRCP header to properly set, get and inherit header fields (Issue-110). - - MRCP client library - - * Added support for SIP redirection with 300 Multiple Choices used by the Nuance Resource Manager. - * Added support for feature-tags set in the SIP Accept-Contact header field in an outgoing SIP INVITE message sent to the Nuance Resource Manager. - * Added a new accessor function to the client API to get an audio stream associated with the specified channel. The function name is mrcp_application_audio_stream_get(). - * Added the ability to retrieve an external object associated with the MRCP session through the log handler (apt_log_ext_handler_f). - * Fixed the processing of a response to the SIP OPTIONS request used for resource discovery (Issue-112). - * Added a new constructor function unimrcp_client_create2() which allows to pass the client XML configuration not by a file, but rather by a string parameter. Thanks Vali. - * Fixed the processing of more than one pending application requests upon reception of a SIP BYE message from the server. - * Fixed the loading of the client configuration parameter . - * Respond to client user application requests with failure if a new session couldn't be created due to an error in initialization of the SIP stack (Issue-127). - * When originating an offer from the client, take into account capabilities of an audio stream created by the client user application. - * Added a new function to the client API to retrieve a SIP/RTSP response code received from the server (Issue-90). The support is incomplete. - - MRCP server library - - * Fixed an interoperability issue with AVP. The mid attribute is not required when the SDP contains only one m-line. - * Fixed the build of C++ MRCP plugins for platforms other than Win32. Thanks Vali. - * Added the ability to take and use parameters set by the plugin in a response to the GET-PARAMS request. Thanks Vali. - - Sofia-SIP module - - * Took out unused tags (variables) to compile with Sofia-SIP 1.12.11. - * Added support for Sofia-SIP's TPTAG_LOG() and TPTAG_DUMP() tags which can be enabled from the client and server configuration to print out and/or dump SIP messages. - - PocketSphinx plugin - - * In the PocketSphinx plugin, instead of using one common timeout for detection of speech activity and inactivity, use two different timeouts: one for activity and the other for inactivity detection. - * In the recognition results sent from the PocketSphinx plugin, set both and elements. - * Fixed a race condition in the PocketSphinx plugin which caused the server to crash. - * Fixed the use of recognition timer in the PocketSphinx plugin. - * Set an MRCP version specific completion cause in the PocketSphinx plugin. - - UniMRCP server application - - * Enhanced the UniMRCP Windows service manager. Thanks Vali. - * Corrected FileType in Windows resources from DLL to APP. Thanks Vali. - * Added a Windows resource file for the unimrcpservice application. - - UMC sample application - - * Set the default profile name in umcscenarios.xml to "uni2". - * Added sample 8kHz and 16 kHz voiceprints in the data directory which are used by the umc application for a sample verification scenario. - * Added mandatory attributes for the SSML element in the sample speak.xml file. - * Added support for a binary recognition grammar used in RecogScenario by the sample umc application. Thanks Vali. - * Added a sample SRGS ABNF grammar to the data directory. - - Miscellaneous - - * Added init.d script. The script was originally submitted by pdeschen. Thanks. - * Modified the "prepare" utility project to use the new location of PthreadVC2.dll which is now built from source with other dependencies. - * Added support for Visual Studio 2010. - * Modified the MPF test application to read a raw PCM data from one file, transmit it over RTP, and write the data back to another file. - * Set the libtool parameters link_all_deplibs and link_all_deplibs_CXX to "yes" by default, with an option to disable them (--disable-interlib-deps), if ever needed. This fixes a link error on recent Debian/Ubuntu distributions. - * Modified the apr.m4 and apu.m4 macros to use '--link-ld' instead of '--link-libtool --libs' for the APR library dependencies. This addresses the problem with a wrong -L path to the expat library. - * Set prerequisite version for autoconf to 2.59. - * Added a checking for pkg-config to the configure script. - * Added a new option (-v or --version) to the unimrcpserver as well as the sample umc and unimrcpclient applications. diff --git a/libs/unimrcp/INSTALL b/libs/unimrcp/INSTALL deleted file mode 100644 index 2d4f0d8eec..0000000000 --- a/libs/unimrcp/INSTALL +++ /dev/null @@ -1,158 +0,0 @@ -BUILD REQUIREMENTS -================== - -The UniMRCP project depends on a number of third party tools and libraries which must be installed first. - -All the required dependencies are available to download prepackaged for the UniMRCP use from the -following location: - - http://www.unimrcp.org/downloads/dependencies - -Alternatively, original versions of the libraries as well as patches on them can be downloaded -separately from the following location: - - http://www.unimrcp.org/dependencies - -References: - -1. Apache Portable Runtime [>=1.2.x] (http://apr.apache.org). -In order to build any part of the UniMRCP project, the Apache Portable Runtime (APR) and -the APR Utility (APR-util) libraries are required. The libraries provide a consistent interface to -underlying platform-specific implementations. - -2. Sofia-SIP [>=1.12.6] (http://sofia-sip.sourceforge.net). -Sofia-SIP is an open-source SIP User-Agent library, compliant with the IETF RFC3261 specification. -The library is utilized for implementation of SIP signaling for MRCPv2. The SDP message parser is -also used for both MRCPv2 (SIP/SDP) and MRCPv1 (RTSP/SDP). - - -GNU BUILD -========= - -Prerequisites: - - autoconf 2.59 or newer - automake - libtool 1.4 or newer - gcc - pkg-config - - -Procedure: - -If the UniMRCP source is checked out from the repository, the "bootstrap" script must be run first -in order to generate the "configure" script and other required files. - - ./bootstrap - -The usual "configure", "make", "make install" sequence of commands should follow in order to build -and install the project from source. - - ./configure - make - make install - -As a result, the project will be installed in the directory "/usr/local/unimrcp" with the following -layout: - - bin binaries (unimrcpserver, unimrcpclient, ...) - conf configuration files (unimrcpserver.xml, unimrcpclient.xml, ...) - data data files - include header files - lib shared (convenience) libraries - log log files - plugin run-time loadable modules - -There are a couple of options which can additionally be configured. -In order to specify where to look for the APR and APR-util libraries, use the "--with-apr=" and -"--with-apr-util=" options respectively. For example: - - ./configure --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr - -In order to specify where to look for the Sofia-SIP library, use the "--with-sofia-sip=" option. -For example: - - ./configure --with-sofia-sip=/usr/local/sofia-sip - -In order to generate executables and shared libraries for x86-64 architecture, use the "-m64" -option as follows: - - CFLAGS=-m64 CXXFLAGS=-m64 LDFLAGS=-m64 ./configure - -In order to generate executables and shared libraries for i386 architecture, use the "-m32" option -as follows: - - CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 ./configure - -In order to install the default configuration, use the following commands: - - cd conf - make def-conf - -In order to install the default data files, use the following commands: - - cd data - make def-data - -In order to build a Doxygen generated documentation, use the following command: - - make dox - - -WINDOWS BUILD -============= - -Prerequisites: - - Microsoft Visual Studio 2005 or 2010. - -One-time pre-build setup: [optional] - -This step can be skipped if the dependencies are installed in their default locations. Otherwise, -the paths in the corresponding property sheets must be modified accordingly. Below is the content -of property sheets for Visual Studio 2005, which are located in the directory "build/vsprops". -Similarly, property sheets for Visual Studio 2010 can be found in the directory "build/props". - -apr.vsprops - - - -sofiasip.vsprops - - -Procedure: - -1. Open one of the available solution files: - * for Visual Studio 2005, use unimrcp.sln, - * for Visual Studio 2010, use unimrcp-2010.sln. -2. Choose a platform (Build -> Configuration Manager): - * win32 - * x64. -3. Choose a configuration (Build -> Configuration Manager): - * Debug - * Release. -4. Build the solution (Build -> Build Solution). - -One-time output directory setup: - -Build the "prepare.vcproj" utility project by right clicking on the project icon from the Solution -Explorer (tools->prepare) and selecting the Build command from the context menu. This routine will -setup the output directory and copy all the required APR, APR-Util, and Sofia-SIP libraries as well -as the default configuration and data files. As a result, the output directory layout will look -like the following: - - bin binaries (unimrcpserver, unimrcpclient, ...) and all the required dlls - conf configuration files (unimrcpserver.xml, unimrcpclient.xml, ...) - data data files - lib libraries - log log files - plugin run-time loadable modules diff --git a/libs/unimrcp/LICENSE b/libs/unimrcp/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/libs/unimrcp/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/libs/unimrcp/Makefile.am b/libs/unimrcp/Makefile.am deleted file mode 100644 index caa6756c06..0000000000 --- a/libs/unimrcp/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -macrodir = @ac_macro_dir@ -auxdir = @ac_aux_dir@ - -AUX_DIST = $(auxdir)/compile \ - $(auxdir)/config.guess \ - $(auxdir)/config.sub \ - $(auxdir)/install-sh \ - $(auxdir)/ltconfig \ - $(auxdir)/ltmain.sh \ - $(auxdir)/depcomp \ - $(auxdir)/missing - -MACRO_DIST = $(macrodir)/libtool.m4 \ - $(macrodir)/ltoptions.m4 \ - $(macrodir)/ltsugar.m4 \ - $(macrodir)/ltversion.m4 \ - $(macrodir)/lt~obsolete.m4 - -EXTRA_DIST = bootstrap - -AUTOMAKE_OPTIONS = foreign -MAINTAINERCLEANFILES = Makefile.in aclocal.m4 configure config.nice $(AUX_DIST) $(MACRO_DIST) - -ACLOCAL = aclocal -I $(macrodir) - -SUBDIRS = build conf data libs modules plugins platforms -if TEST_SUITES -SUBDIRS += tests -endif - -dox: - doxygen $(top_srcdir)/docs/doxygen.conf - -install-data-local: - test -d $(DESTDIR)$(logdir) || $(mkinstalldirs) $(DESTDIR)$(logdir) - test -d $(DESTDIR)$(vardir) || $(mkinstalldirs) $(DESTDIR)$(vardir) diff --git a/libs/unimrcp/NOTICE b/libs/unimrcp/NOTICE deleted file mode 100644 index 37f1bf3c01..0000000000 --- a/libs/unimrcp/NOTICE +++ /dev/null @@ -1,47 +0,0 @@ -The UniMRCP Project (http://www.unimrcp.org) -Copyright (C) 2008-2010 Arsen Chaloyan -Licensed under the Apache License, Version 2.0 (the "License"). - -This product includes a number of subcomponents with -separate copyright notices and license terms. - - -Notice for APR (Apache Portable Runtime) library ---------------------------------------------------- -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - -Portions of this software were developed at the National Center -for Supercomputing Applications (NCSA) at the University of -Illinois at Urbana-Champaign. - -This software contains code derived from the RSA Data Security -Inc. MD5 Message-Digest Algorithm. ---------------------------------------------------- - - -Notice for Sofia-SIP library ---------------------------------------------------- -Copyright (C) 2005-2006 Nokia Corporation and others (see the -in individual files for a detailed list of copyright holders). -Contact: Pekka Pessi - -This library is free software; you can redistribute it and/or -modify it under the terms of the GNU Lesser General Public License -as published by the Free Software Foundation; either version 2.1 of -the License, or (at your option) any later version. ---------------------------------------------------- - - -Notice for G711 implementation ---------------------------------------------------- -g711.h/g711.c - A-law and u-law transcoding routines - -Written by Steve Underwood -Copyright (C) 2006 Steve Underwood - -Despite my general liking of the GPL, I place this code in the -public domain for the benefit of all mankind - even the slimy -ones who might try to proprietize my work and use it to my -detriment. ---------------------------------------------------- diff --git a/libs/unimrcp/README b/libs/unimrcp/README deleted file mode 100644 index 55e84045be..0000000000 --- a/libs/unimrcp/README +++ /dev/null @@ -1,59 +0,0 @@ -INTRODUCTION -============ - -UniMRCP is an open source project compliant with the IETF RFC6787 (MRCPv2) and RFC4463 (MRCPv1) -specifications. - - -INSTALLATION -============ - -See the file "INSTALL" for installation tips. - - -DOCUMENTATION -============= - -Use the directory "docs/dox" for a documentation generated by Doxygen. -Use the directory "docs/ea" for UML based design concepts, HTML pages generated by Enterpise Architect. - - -REFERENCES -========== - -Website: - http://www.unimrcp.org - -Downloads: - http://www.unimrcp.org/downloads - -Documentation: - http://www.unimrcp.org/documentation - -Google Code: - http://code.google.com/p/unimrcp - -Issue Tracker: - http://code.google.com/p/unimrcp/issues/list - -Discussion Group: - http://groups.google.com/group/unimrcp - -Version Control Repository (SVN): - http://unimrcp.googlecode.com/svn/trunk - -UML Documentation File (Enterpise Architect): - http://unimrcp.googlecode.com/svn/misc/unimrcp.eap - -Commit Monitor: - http://code.google.com/p/unimrcp/source/list - http://groups.google.com/group/unimrcp-svn-commits - - -LICENSING -========= - -UniMRCP is licensed under terms of the Apache License 2.0. -See the file "LICENSE" for more information. - -Copyright 2008 - 2014 Arsen Chaloyan diff --git a/libs/unimrcp/acinclude.m4 b/libs/unimrcp/acinclude.m4 deleted file mode 100644 index 14fa221614..0000000000 --- a/libs/unimrcp/acinclude.m4 +++ /dev/null @@ -1,7 +0,0 @@ -m4_include([build/acmacros/apr.m4]) -m4_include([build/acmacros/find_apr.m4]) -m4_include([build/acmacros/find_apu.m4]) -m4_include([build/acmacros/sofia-sip.m4]) -m4_include([build/acmacros/ax_compiler_vendor.m4]) -m4_include([build/acmacros/apr_common.m4]) -m4_include([build/acmacros/uni_plugin.m4]) diff --git a/libs/unimrcp/bootstrap b/libs/unimrcp/bootstrap deleted file mode 100755 index e037f546a3..0000000000 --- a/libs/unimrcp/bootstrap +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/sh - -case `uname` in - Darwin) libtoolize=glibtoolize ;; - *) libtoolize=libtoolize ;; -esac - -set -x -$libtoolize --force --automake --copy -aclocal -I build/acmacros -automake --foreign --add-missing --copy -autoconf - -rm -rf autom4te.cache diff --git a/libs/unimrcp/build/Makefile.am b/libs/unimrcp/build/Makefile.am deleted file mode 100644 index 859d2a553f..0000000000 --- a/libs/unimrcp/build/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = pkgconfig - -include_HEADERS = uni_version.h uni_revision.h diff --git a/libs/unimrcp/build/acmacros/apr.m4 b/libs/unimrcp/build/acmacros/apr.m4 deleted file mode 100644 index 0fc55215eb..0000000000 --- a/libs/unimrcp/build/acmacros/apr.m4 +++ /dev/null @@ -1,79 +0,0 @@ -dnl -dnl UNIMRCP_CHECK_APR -dnl -dnl This macro attempts to find APR and APR-util libraries and -dnl set corresponding variables on exit. -dnl -AC_DEFUN([UNIMRCP_CHECK_APR], -[ - AC_MSG_NOTICE([Apache Portable Runtime (APR) library configuration]) - - APR_FIND_APR("", "", 1, 1) - - if test $apr_found = "no"; then - AC_MSG_WARN([APR not found]) - UNIMRCP_DOWNLOAD_APR - fi - - if test $apr_found = "reconfig"; then - AC_MSG_WARN([APR reconfig]) - fi - - dnl check APR version number - apr_version="`$apr_config --version`" - AC_MSG_RESULT([$apr_version]) - - dnl Get build information from APR - APR_ADDTO(CPPFLAGS,`$apr_config --cppflags`) - APR_ADDTO(CFLAGS,`$apr_config --cflags`) - APR_ADDTO(LDFLAGS,`$apr_config --ldflags`) - - APR_ADDTO(UNIMRCP_APR_INCLUDES,`$apr_config --includes`) - APR_ADDTO(UNIMRCP_APR_LIBS,`$apr_config --link-ld`) - - AC_MSG_NOTICE([Apache Portable Runtime Utility (APU) library configuration]) - - APR_FIND_APU("", "", 1, 1) - - if test $apu_found = "no"; then - AC_MSG_WARN([APU not found]) - UNIMRCP_DOWNLOAD_APU - fi - - if test $apu_found = "reconfig"; then - AC_MSG_WARN([APU reconfig]) - fi - - dnl check APU version number - apu_version="`$apu_config --version`" - AC_MSG_RESULT([$apu_version]) - - dnl Get build information from APU - APR_ADDTO(LDFLAGS,`$apu_config --ldflags`) - - APR_ADDTO(UNIMRCP_APR_INCLUDES,`$apu_config --includes`) - APR_ADDTO(UNIMRCP_APR_LIBS,`$apu_config --link-ld`) - - AC_SUBST(UNIMRCP_APR_INCLUDES) - AC_SUBST(UNIMRCP_APR_LIBS) -]) - -dnl UNIMRCP_DOWNLOAD_APR -dnl no apr found, print out a message telling the user what to do -AC_DEFUN([UNIMRCP_DOWNLOAD_APR], -[ - echo "The Apache Portable Runtime (APR) library cannot be found." - echo "Please install APR on this system and supply the appropriate" - echo "--with-apr option to 'configure'" - AC_MSG_ERROR([no suitable APR found]) -]) - -dnl UNIMRCP_DOWNLOAD_APU -dnl no apr-util found, print out a message telling the user what to do -AC_DEFUN([UNIMRCP_DOWNLOAD_APU], -[ - echo "The Apache Portable Runtime Utility (APU) library cannot be found." - echo "Please install APRUTIL on this system and supply the appropriate" - echo "--with-apr-util option to 'configure'" - AC_MSG_ERROR([no suitable APU found]) -]) diff --git a/libs/unimrcp/build/acmacros/apr_common.m4 b/libs/unimrcp/build/acmacros/apr_common.m4 deleted file mode 100644 index 6b5c0f033b..0000000000 --- a/libs/unimrcp/build/acmacros/apr_common.m4 +++ /dev/null @@ -1,990 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Licensed to the Apache Software Foundation (ASF) under one or more -dnl contributor license agreements. See the NOTICE file distributed with -dnl this work for additional information regarding copyright ownership. -dnl The ASF licenses this file to You under the Apache License, Version 2.0 -dnl (the "License"); you may not use this file except in compliance with -dnl the License. You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. - -dnl -dnl apr_common.m4: APR's general-purpose autoconf macros -dnl - -dnl -dnl APR_CONFIG_NICE(filename) -dnl -dnl Saves a snapshot of the configure command-line for later reuse -dnl -AC_DEFUN([APR_CONFIG_NICE], [ - rm -f $1 - cat >$1<> $1 - fi - if test -n "$CFLAGS"; then - echo "CFLAGS=\"$CFLAGS\"; export CFLAGS" >> $1 - fi - if test -n "$CPPFLAGS"; then - echo "CPPFLAGS=\"$CPPFLAGS\"; export CPPFLAGS" >> $1 - fi - if test -n "$LDFLAGS"; then - echo "LDFLAGS=\"$LDFLAGS\"; export LDFLAGS" >> $1 - fi - if test -n "$LTFLAGS"; then - echo "LTFLAGS=\"$LTFLAGS\"; export LTFLAGS" >> $1 - fi - if test -n "$LIBS"; then - echo "LIBS=\"$LIBS\"; export LIBS" >> $1 - fi - if test -n "$INCLUDES"; then - echo "INCLUDES=\"$INCLUDES\"; export INCLUDES" >> $1 - fi - if test -n "$NOTEST_CFLAGS"; then - echo "NOTEST_CFLAGS=\"$NOTEST_CFLAGS\"; export NOTEST_CFLAGS" >> $1 - fi - if test -n "$NOTEST_CPPFLAGS"; then - echo "NOTEST_CPPFLAGS=\"$NOTEST_CPPFLAGS\"; export NOTEST_CPPFLAGS" >> $1 - fi - if test -n "$NOTEST_LDFLAGS"; then - echo "NOTEST_LDFLAGS=\"$NOTEST_LDFLAGS\"; export NOTEST_LDFLAGS" >> $1 - fi - if test -n "$NOTEST_LIBS"; then - echo "NOTEST_LIBS=\"$NOTEST_LIBS\"; export NOTEST_LIBS" >> $1 - fi - - # Retrieve command-line arguments. - eval "set x $[0] $ac_configure_args" - shift - - for arg - do - APR_EXPAND_VAR(arg, $arg) - echo "\"[$]arg\" \\" >> $1 - done - echo '"[$]@"' >> $1 - chmod +x $1 -])dnl - -dnl APR_MKDIR_P_CHECK(fallback-mkdir-p) -dnl checks whether mkdir -p works -AC_DEFUN([APR_MKDIR_P_CHECK], [ - AC_CACHE_CHECK(for working mkdir -p, ac_cv_mkdir_p,[ - test -d conftestdir && rm -rf conftestdir - mkdir -p conftestdir/somedir >/dev/null 2>&1 - if test -d conftestdir/somedir; then - ac_cv_mkdir_p=yes - else - ac_cv_mkdir_p=no - fi - rm -rf conftestdir - ]) - if test "$ac_cv_mkdir_p" = "yes"; then - mkdir_p="mkdir -p" - else - mkdir_p="$1" - fi -]) - -dnl -dnl APR_SUBDIR_CONFIG(dir [, sub-package-cmdline-args, args-to-drop]) -dnl -dnl dir: directory to find configure in -dnl sub-package-cmdline-args: arguments to add to the invocation (optional) -dnl args-to-drop: arguments to drop from the invocation (optional) -dnl -dnl Note: This macro relies on ac_configure_args being set properly. -dnl -dnl The args-to-drop argument is shoved into a case statement, so -dnl multiple arguments can be separated with a |. -dnl -dnl Note: Older versions of autoconf do not single-quote args, while 2.54+ -dnl places quotes around every argument. So, if you want to drop the -dnl argument called --enable-layout, you must pass the third argument as: -dnl [--enable-layout=*|\'--enable-layout=*] -dnl -dnl Trying to optimize this is left as an exercise to the reader who wants -dnl to put up with more autoconf craziness. I give up. -dnl -AC_DEFUN([APR_SUBDIR_CONFIG], [ - # save our work to this point; this allows the sub-package to use it - AC_CACHE_SAVE - - echo "configuring package in $1 now" - ac_popdir=`pwd` - apr_config_subdirs="$1" - test -d $1 || $mkdir_p $1 - ac_abs_srcdir=`(cd $srcdir/$1 && pwd)` - cd $1 - -changequote(, )dnl - # A "../" for each directory in /$config_subdirs. - ac_dots=`echo $apr_config_subdirs|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` -changequote([, ])dnl - - # Make the cache file pathname absolute for the subdirs - # required to correctly handle subdirs that might actually - # be symlinks - case "$cache_file" in - /*) # already absolute - ac_sub_cache_file=$cache_file ;; - *) # Was relative path. - ac_sub_cache_file="$ac_popdir/$cache_file" ;; - esac - - ifelse($3, [], [apr_configure_args=$ac_configure_args],[ - apr_configure_args= - apr_sep= - for apr_configure_arg in $ac_configure_args - do - case "$apr_configure_arg" in - $3) - continue ;; - esac - apr_configure_args="$apr_configure_args$apr_sep'$apr_configure_arg'" - apr_sep=" " - done - ]) - - dnl autoconf doesn't add --silent to ac_configure_args; explicitly pass it - test "x$silent" = "xyes" && apr_configure_args="$apr_configure_args --silent" - - dnl AC_CONFIG_SUBDIRS silences option warnings, emulate this for 2.62 - apr_configure_args="--disable-option-checking $apr_configure_args" - - dnl The eval makes quoting arguments work - specifically the second argument - dnl where the quoting mechanisms used is "" rather than []. - dnl - dnl We need to execute another shell because some autoconf/shell combinations - dnl will choke after doing repeated APR_SUBDIR_CONFIG()s. (Namely Solaris - dnl and autoconf-2.54+) - if eval $SHELL $ac_abs_srcdir/configure $apr_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_abs_srcdir $2 - then : - echo "$1 configured properly" - else - echo "configure failed for $1" - exit 1 - fi - - cd $ac_popdir - - # grab any updates from the sub-package - AC_CACHE_LOAD -])dnl - -dnl -dnl APR_SAVE_THE_ENVIRONMENT(variable_name) -dnl -dnl Stores the variable (usually a Makefile macro) for later restoration -dnl -AC_DEFUN([APR_SAVE_THE_ENVIRONMENT], [ - apr_ste_save_$1="$$1" -])dnl - -dnl -dnl APR_RESTORE_THE_ENVIRONMENT(variable_name, prefix_) -dnl -dnl Uses the previously saved variable content to figure out what configure -dnl has added to the variable, moving the new bits to prefix_variable_name -dnl and restoring the original variable contents. This makes it possible -dnl for a user to override configure when it does something stupid. -dnl -AC_DEFUN([APR_RESTORE_THE_ENVIRONMENT], [ -dnl Check whether $apr_ste_save_$1 is empty or -dnl only whitespace. The verbatim "X" is token number 1, -dnl the following whitespace will be ignored. -set X $apr_ste_save_$1 -if test ${#} -eq 1; then - $2$1="$$1" - $1= -else - if test "x$apr_ste_save_$1" = "x$$1"; then - $2$1= - else - $2$1=`echo "$$1" | sed -e "s%${apr_ste_save_$1}%%"` - $1="$apr_ste_save_$1" - fi -fi -if test "x$silent" != "xyes"; then - echo " restoring $1 to \"$$1\"" - echo " setting $2$1 to \"$$2$1\"" -fi -AC_SUBST($2$1) -])dnl - -dnl -dnl APR_SETIFNULL(variable, value) -dnl -dnl Set variable iff it's currently null -dnl -AC_DEFUN([APR_SETIFNULL], [ - if test -z "$$1"; then - test "x$silent" != "xyes" && echo " setting $1 to \"$2\"" - $1="$2" - fi -])dnl - -dnl -dnl APR_SETVAR(variable, value) -dnl -dnl Set variable no matter what -dnl -AC_DEFUN([APR_SETVAR], [ - test "x$silent" != "xyes" && echo " forcing $1 to \"$2\"" - $1="$2" -])dnl - -dnl -dnl APR_ADDTO(variable, value) -dnl -dnl Add value to variable -dnl -AC_DEFUN([APR_ADDTO], [ - if test "x$$1" = "x"; then - test "x$silent" != "xyes" && echo " setting $1 to \"$2\"" - $1="$2" - else - apr_addto_bugger="$2" - for i in $apr_addto_bugger; do - apr_addto_duplicate="0" - for j in $$1; do - if test "x$i" = "x$j"; then - apr_addto_duplicate="1" - break - fi - done - if test $apr_addto_duplicate = "0"; then - test "x$silent" != "xyes" && echo " adding \"$i\" to $1" - $1="$$1 $i" - fi - done - fi -])dnl - -dnl -dnl APR_REMOVEFROM(variable, value) -dnl -dnl Remove a value from a variable -dnl -AC_DEFUN([APR_REMOVEFROM], [ - if test "x$$1" = "x$2"; then - test "x$silent" != "xyes" && echo " nulling $1" - $1="" - else - apr_new_bugger="" - apr_removed=0 - for i in $$1; do - if test "x$i" != "x$2"; then - apr_new_bugger="$apr_new_bugger $i" - else - apr_removed=1 - fi - done - if test $apr_removed = "1"; then - test "x$silent" != "xyes" && echo " removed \"$2\" from $1" - $1=$apr_new_bugger - fi - fi -]) dnl - -dnl -dnl APR_CHECK_DEFINE_FILES( symbol, header_file [header_file ...] ) -dnl -AC_DEFUN([APR_CHECK_DEFINE_FILES], [ - AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[ - ac_cv_define_$1=no - for curhdr in $2 - do - AC_EGREP_CPP(YES_IS_DEFINED, [ -#include <$curhdr> -#ifdef $1 -YES_IS_DEFINED -#endif - ], ac_cv_define_$1=yes) - done - ]) - if test "$ac_cv_define_$1" = "yes"; then - AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined]) - fi -]) - - -dnl -dnl APR_CHECK_DEFINE(symbol, header_file) -dnl -AC_DEFUN([APR_CHECK_DEFINE], [ - AC_CACHE_CHECK([for $1 in $2],ac_cv_define_$1,[ - AC_EGREP_CPP(YES_IS_DEFINED, [ -#include <$2> -#ifdef $1 -YES_IS_DEFINED -#endif - ], ac_cv_define_$1=yes, ac_cv_define_$1=no) - ]) - if test "$ac_cv_define_$1" = "yes"; then - AC_DEFINE(HAVE_$1, 1, [Define if $1 is defined in $2]) - fi -]) - -dnl -dnl APR_CHECK_APR_DEFINE( symbol ) -dnl -AC_DEFUN([APR_CHECK_APR_DEFINE], [ -apr_old_cppflags=$CPPFLAGS -CPPFLAGS="$CPPFLAGS $INCLUDES" -AC_EGREP_CPP(YES_IS_DEFINED, [ -#include -#if $1 -YES_IS_DEFINED -#endif -], ac_cv_define_$1=yes, ac_cv_define_$1=no) -CPPFLAGS=$apr_old_cppflags -]) - -dnl APR_CHECK_FILE(filename); set ac_cv_file_filename to -dnl "yes" if 'filename' is readable, else "no". -dnl @deprecated! - use AC_CHECK_FILE instead -AC_DEFUN([APR_CHECK_FILE], [ -dnl Pick a safe variable name -define([apr_cvname], ac_cv_file_[]translit([$1], [./+-], [__p_])) -AC_CACHE_CHECK([for $1], [apr_cvname], -[if test -r $1; then - apr_cvname=yes - else - apr_cvname=no - fi]) -]) - -define(APR_IFALLYES,[dnl -ac_rc=yes -for ac_spec in $1; do - ac_type=`echo "$ac_spec" | sed -e 's/:.*$//'` - ac_item=`echo "$ac_spec" | sed -e 's/^.*://'` - case $ac_type in - header ) - ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'` - ac_var="ac_cv_header_$ac_item" - ;; - file ) - ac_item=`echo "$ac_item" | sed 'y%./+-%__p_%'` - ac_var="ac_cv_file_$ac_item" - ;; - func ) ac_var="ac_cv_func_$ac_item" ;; - struct ) ac_var="ac_cv_struct_$ac_item" ;; - define ) ac_var="ac_cv_define_$ac_item" ;; - custom ) ac_var="$ac_item" ;; - esac - eval "ac_val=\$$ac_var" - if test ".$ac_val" != .yes; then - ac_rc=no - break - fi -done -if test ".$ac_rc" = .yes; then - : - $2 -else - : - $3 -fi -]) - - -define(APR_BEGIN_DECISION,[dnl -ac_decision_item='$1' -ac_decision_msg='FAILED' -ac_decision='' -]) - - -AC_DEFUN([APR_DECIDE],[dnl -dnl Define the flag (or not) in apr_private.h via autoheader -AH_TEMPLATE($1, [Define if $2 will be used]) -ac_decision='$1' -ac_decision_msg='$2' -ac_decision_$1=yes -ac_decision_$1_msg='$2' -]) - - -define(APR_DECISION_OVERRIDE,[dnl - ac_decision='' - for ac_item in $1; do - eval "ac_decision_this=\$ac_decision_${ac_item}" - if test ".$ac_decision_this" = .yes; then - ac_decision=$ac_item - eval "ac_decision_msg=\$ac_decision_${ac_item}_msg" - fi - done -]) - - -define(APR_DECISION_FORCE,[dnl -ac_decision="$1" -eval "ac_decision_msg=\"\$ac_decision_${ac_decision}_msg\"" -]) - - -define(APR_END_DECISION,[dnl -if test ".$ac_decision" = .; then - echo "[$]0:Error: decision on $ac_decision_item failed" 1>&2 - exit 1 -else - if test ".$ac_decision_msg" = .; then - ac_decision_msg="$ac_decision" - fi - AC_DEFINE_UNQUOTED(${ac_decision_item}) - AC_MSG_RESULT([decision on $ac_decision_item... $ac_decision_msg]) -fi -]) - - -dnl -dnl APR_CHECK_SIZEOF_EXTENDED(INCLUDES, TYPE [, CROSS_SIZE]) -dnl -dnl A variant of AC_CHECK_SIZEOF which allows the checking of -dnl sizes of non-builtin types -dnl -AC_DEFUN([APR_CHECK_SIZEOF_EXTENDED], -[changequote(<<, >>)dnl -dnl The name to #define. -define(<>, translit(sizeof_$2, [a-z *], [A-Z_P]))dnl -dnl The cache variable name. -define(<>, translit(ac_cv_sizeof_$2, [ *], [_p]))dnl -changequote([, ])dnl -AC_MSG_CHECKING(size of $2) -AC_CACHE_VAL(AC_CV_NAME, -[AC_TRY_RUN([#include -$1 -#ifdef WIN32 -#define binmode "b" -#else -#define binmode -#endif -main() -{ - FILE *f=fopen("conftestval", "w" binmode); - if (!f) exit(1); - fprintf(f, "%d\n", sizeof($2)); - exit(0); -}], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$3],,, -AC_CV_NAME=$3))])dnl -AC_MSG_RESULT($AC_CV_NAME) -AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The size of ]$2) -undefine([AC_TYPE_NAME])dnl -undefine([AC_CV_NAME])dnl -]) - - -dnl -dnl APR_TRY_COMPILE_NO_WARNING(INCLUDES, FUNCTION-BODY, -dnl [ACTIONS-IF-NO-WARNINGS], [ACTIONS-IF-WARNINGS]) -dnl -dnl Tries a compile test with warnings activated so that the result -dnl is false if the code doesn't compile cleanly. For compilers -dnl where it is not known how to activate a "fail-on-error" mode, -dnl it is undefined which of the sets of actions will be run. -dnl -AC_DEFUN([APR_TRY_COMPILE_NO_WARNING], -[apr_save_CFLAGS=$CFLAGS - CFLAGS="$CFLAGS $CFLAGS_WARN" - if test "$ac_cv_prog_gcc" = "yes"; then - CFLAGS="$CFLAGS -Werror" - fi - AC_COMPILE_IFELSE( - [AC_LANG_SOURCE( - [#include "confdefs.h" - ] - [[$1]] - [int main(int argc, const char *const *argv) {] - [[$2]] - [ return 0; }] - )], - [$3], [$4]) - CFLAGS=$apr_save_CFLAGS -]) - -dnl -dnl APR_CHECK_STRERROR_R_RC -dnl -dnl Decide which style of retcode is used by this system's -dnl strerror_r(). It either returns int (0 for success, -1 -dnl for failure), or it returns a pointer to the error -dnl string. -dnl -dnl -AC_DEFUN([APR_CHECK_STRERROR_R_RC], [ -AC_MSG_CHECKING(for type of return code from strerror_r) -AC_TRY_RUN([ -#include -#include -#include -main() -{ - char buf[1024]; - if (strerror_r(ERANGE, buf, sizeof buf) < 1) { - exit(0); - } - else { - exit(1); - } -}], [ - ac_cv_strerror_r_rc_int=yes ], [ - ac_cv_strerror_r_rc_int=no ], [ - ac_cv_strerror_r_rc_int=no ] ) -if test "x$ac_cv_strerror_r_rc_int" = xyes; then - AC_DEFINE(STRERROR_R_RC_INT, 1, [Define if strerror returns int]) - msg="int" -else - msg="pointer" -fi -AC_MSG_RESULT([$msg]) -] ) - -dnl -dnl APR_CHECK_DIRENT_INODE -dnl -dnl Decide if d_fileno or d_ino are available in the dirent -dnl structure on this platform. Single UNIX Spec says d_ino, -dnl BSD uses d_fileno. Undef to find the real beast. -dnl -AC_DEFUN([APR_CHECK_DIRENT_INODE], [ -AC_CACHE_CHECK([for inode member of struct dirent], apr_cv_dirent_inode, [ -apr_cv_dirent_inode=no -AC_TRY_COMPILE([ -#include -#include -],[ -#ifdef d_ino -#undef d_ino -#endif -struct dirent de; de.d_fileno; -], apr_cv_dirent_inode=d_fileno) -if test "$apr_cv_dirent_inode" = "no"; then -AC_TRY_COMPILE([ -#include -#include -],[ -#ifdef d_fileno -#undef d_fileno -#endif -struct dirent de; de.d_ino; -], apr_cv_dirent_inode=d_ino) -fi -]) -if test "$apr_cv_dirent_inode" != "no"; then - AC_DEFINE_UNQUOTED(DIRENT_INODE, $apr_cv_dirent_inode, - [Define if struct dirent has an inode member]) -fi -]) - -dnl -dnl APR_CHECK_DIRENT_TYPE -dnl -dnl Decide if d_type is available in the dirent structure -dnl on this platform. Not part of the Single UNIX Spec. -dnl Note that this is worthless without DT_xxx macros, so -dnl look for one while we are at it. -dnl -AC_DEFUN([APR_CHECK_DIRENT_TYPE], [ -AC_CACHE_CHECK([for file type member of struct dirent], apr_cv_dirent_type,[ -apr_cv_dirent_type=no -AC_TRY_COMPILE([ -#include -#include -],[ -struct dirent de; de.d_type = DT_REG; -], apr_cv_dirent_type=d_type) -]) -if test "$apr_cv_dirent_type" != "no"; then - AC_DEFINE_UNQUOTED(DIRENT_TYPE, $apr_cv_dirent_type, - [Define if struct dirent has a d_type member]) -fi -]) - -dnl the following is a newline, a space, a tab, and a backslash (the -dnl backslash is used by the shell to skip newlines, but m4 sees it; -dnl treat it like whitespace). -dnl WARNING: don't reindent these lines, or the space/tab will be lost! -define([apr_whitespace],[ - \]) - -dnl -dnl APR_COMMA_ARGS(ARG1 ...) -dnl convert the whitespace-separated arguments into comman-separated -dnl arguments. -dnl -dnl APR_FOREACH(CODE-BLOCK, ARG1, ARG2, ...) -dnl subsitute CODE-BLOCK for each ARG[i]. "eachval" will be set to ARG[i] -dnl within each iteration. -dnl -changequote({,}) -define({APR_COMMA_ARGS},{patsubst([$}{1],[[}apr_whitespace{]+],[,])}) -define({APR_FOREACH}, - {ifelse($}{2,,, - [define([eachval], - $}{2)$}{1[]APR_FOREACH([$}{1], - builtin([shift], - builtin([shift], $}{@)))])}) -changequote([,]) - -dnl APR_FLAG_HEADERS(HEADER-FILE ... [, FLAG-TO-SET ] [, "yes" ]) -dnl we set FLAG-TO-SET to 1 if we find HEADER-FILE, otherwise we set to 0 -dnl if FLAG-TO-SET is null, we automagically determine it's name -dnl by changing all "/" to "_" in the HEADER-FILE and dropping -dnl all "." and "-" chars. If the 3rd parameter is "yes" then instead of -dnl setting to 1 or 0, we set FLAG-TO-SET to yes or no. -dnl -AC_DEFUN([APR_FLAG_HEADERS], [ -AC_CHECK_HEADERS($1) -for aprt_i in $1 -do - ac_safe=`echo "$aprt_i" | sed 'y%./+-%__p_%'` - aprt_2=`echo "$aprt_i" | sed -e 's%/%_%g' -e 's/\.//g' -e 's/-//g'` - if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then - eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,yes,1)" - else - eval "ifelse($2,,$aprt_2,$2)=ifelse($3,yes,no,0)" - fi -done -]) - -dnl APR_FLAG_FUNCS(FUNC ... [, FLAG-TO-SET] [, "yes" ]) -dnl if FLAG-TO-SET is null, we automagically determine it's name -dnl prepending "have_" to the function name in FUNC, otherwise -dnl we use what's provided as FLAG-TO-SET. If the 3rd parameter -dnl is "yes" then instead of setting to 1 or 0, we set FLAG-TO-SET -dnl to yes or no. -dnl -AC_DEFUN([APR_FLAG_FUNCS], [ -AC_CHECK_FUNCS($1) -for aprt_j in $1 -do - aprt_3="have_$aprt_j" - if eval "test \"`echo '$ac_cv_func_'$aprt_j`\" = yes"; then - eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,yes,1)" - else - eval "ifelse($2,,$aprt_3,$2)=ifelse($3,yes,no,0)" - fi -done -]) - -dnl Iteratively interpolate the contents of the second argument -dnl until interpolation offers no new result. Then assign the -dnl final result to $1. -dnl -dnl Example: -dnl -dnl foo=1 -dnl bar='${foo}/2' -dnl baz='${bar}/3' -dnl APR_EXPAND_VAR(fraz, $baz) -dnl $fraz is now "1/2/3" -dnl -AC_DEFUN([APR_EXPAND_VAR], [ -ap_last= -ap_cur="$2" -while test "x${ap_cur}" != "x${ap_last}"; -do - ap_last="${ap_cur}" - ap_cur=`eval "echo ${ap_cur}"` -done -$1="${ap_cur}" -]) - -dnl -dnl Removes the value of $3 from the string in $2, strips of any leading -dnl slashes, and returns the value in $1. -dnl -dnl Example: -dnl orig_path="${prefix}/bar" -dnl APR_PATH_RELATIVE(final_path, $orig_path, $prefix) -dnl $final_path now contains "bar" -AC_DEFUN([APR_PATH_RELATIVE], [ -ap_stripped=`echo $2 | sed -e "s#^$3##"` -# check if the stripping was successful -if test "x$2" != "x${ap_stripped}"; then - # it was, so strip of any leading slashes - $1="`echo ${ap_stripped} | sed -e 's#^/*##'`" -else - # it wasn't so return the original - $1="$2" -fi -]) - -dnl APR_HELP_STRING(LHS, RHS) -dnl Autoconf 2.50 can not handle substr correctly. It does have -dnl AC_HELP_STRING, so let's try to call it if we can. -dnl Note: this define must be on one line so that it can be properly returned -dnl as the help string. When using this macro with a multi-line RHS, ensure -dnl that you surround the macro invocation with []s -AC_DEFUN([APR_HELP_STRING], [ifelse(regexp(AC_ACVERSION, 2\.1), -1, AC_HELP_STRING([$1],[$2]),[ ][$1] substr([ ],len($1))[$2])]) - -dnl -dnl APR_LAYOUT(configlayout, layoutname [, extravars]) -dnl -AC_DEFUN([APR_LAYOUT], [ - if test ! -f $srcdir/config.layout; then - echo "** Error: Layout file $srcdir/config.layout not found" - echo "** Error: Cannot use undefined layout '$LAYOUT'" - exit 1 - fi - # Catch layout names including a slash which will otherwise - # confuse the heck out of the sed script. - case $2 in - */*) - echo "** Error: $2 is not a valid layout name" - exit 1 ;; - esac - pldconf=./config.pld - changequote({,}) - sed -e "1s/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*//;1t" \ - -e "1,/[ ]*<[lL]ayout[ ]*$2[ ]*>[ ]*/d" \ - -e '/[ ]*<\/Layout>[ ]*/,$d' \ - -e "s/^[ ]*//g" \ - -e "s/:[ ]*/=\'/g" \ - -e "s/[ ]*$/'/g" \ - $1 > $pldconf - layout_name=$2 - if test ! -s $pldconf; then - echo "** Error: unable to find layout $layout_name" - exit 1 - fi - . $pldconf - rm $pldconf - for var in prefix exec_prefix bindir sbindir libexecdir mandir \ - sysconfdir datadir includedir localstatedir runtimedir \ - logfiledir libdir installbuilddir libsuffix $3; do - eval "val=\"\$$var\"" - case $val in - *+) - val=`echo $val | sed -e 's;\+$;;'` - eval "$var=\"\$val\"" - autosuffix=yes - ;; - *) - autosuffix=no - ;; - esac - val=`echo $val | sed -e 's:\(.\)/*$:\1:'` - val=`echo $val | sed -e 's:[\$]\([a-z_]*\):${\1}:g'` - if test "$autosuffix" = "yes"; then - if echo $val | grep apache >/dev/null; then - addtarget=no - else - addtarget=yes - fi - if test "$addtarget" = "yes"; then - val="$val/apache2" - fi - fi - eval "$var='$val'" - done - changequote([,]) -])dnl - -dnl -dnl APR_ENABLE_LAYOUT(default layout name [, extra vars]) -dnl -AC_DEFUN([APR_ENABLE_LAYOUT], [ -AC_ARG_ENABLE(layout, -[ --enable-layout=LAYOUT],[ - LAYOUT=$enableval -]) - -if test -z "$LAYOUT"; then - LAYOUT="$1" -fi -APR_LAYOUT($srcdir/config.layout, $LAYOUT, $2) - -AC_MSG_CHECKING(for chosen layout) -AC_MSG_RESULT($layout_name) -]) - - -dnl -dnl APR_PARSE_ARGUMENTS -dnl a reimplementation of autoconf's argument parser, -dnl used here to allow us to co-exist layouts and argument based -dnl set ups. -AC_DEFUN([APR_PARSE_ARGUMENTS], [ -ac_prev= -# Retrieve the command-line arguments. The eval is needed because -# the arguments are quoted to preserve accuracy. -eval "set x $ac_configure_args" -shift -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval "$ac_prev=\$ac_option" - ac_prev= - continue - fi - - ac_optarg=`expr "x$ac_option" : 'x[[^=]]*=\(.*\)'` - - case $ac_option in - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir="$ac_optarg" ;; - - -datadir | --datadir | --datadi | --datad | --data | --dat | --da) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ - | --da=*) - datadir="$ac_optarg" ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix="$ac_optarg" ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir="$ac_optarg" ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir="$ac_optarg" ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir="$ac_optarg" ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir="$ac_optarg" ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst \ - | --locals | --local | --loca | --loc | --lo) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* \ - | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) - localstatedir="$ac_optarg" ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir="$ac_optarg" ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix="$ac_optarg" ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir="$ac_optarg" ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir="$ac_optarg" ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir="$ac_optarg" ;; - - esac -done - -# Be sure to have absolute paths. -for ac_var in exec_prefix prefix -do - eval ac_val=$`echo $ac_var` - case $ac_val in - [[\\/$]]* | ?:[[\\/]]* | NONE | '' ) ;; - *) AC_MSG_ERROR([expected an absolute path for --$ac_var: $ac_val]);; - esac -done - -])dnl - -dnl -dnl APR_CHECK_DEPEND -dnl -dnl Determine what program we can use to generate .deps-style dependencies -dnl -AC_DEFUN([APR_CHECK_DEPEND], [ -dnl Try to determine what depend program we can use -dnl All GCC-variants should have -MM. -dnl If not, then we can check on those, too. -if test "$GCC" = "yes"; then - MKDEP='$(CC) -MM' -else - rm -f conftest.c -dnl should be available everywhere! - cat > conftest.c < - int main() { return 0; } -EOF - MKDEP="true" - for i in "$CC -MM" "$CC -M" "$CPP -MM" "$CPP -M" "cpp -M"; do - AC_MSG_CHECKING([if $i can create proper make dependencies]) - if $i conftest.c 2>/dev/null | grep 'conftest.o: conftest.c' >/dev/null; then - MKDEP=$i - AC_MSG_RESULT(yes) - break; - fi - AC_MSG_RESULT(no) - done - rm -f conftest.c -fi - -AC_SUBST(MKDEP) -]) - -dnl -dnl APR_CHECK_TYPES_COMPATIBLE(TYPE-1, TYPE-2, [ACTION-IF-TRUE]) -dnl -dnl Try to determine whether two types are the same. Only works -dnl for gcc and icc. -dnl -AC_DEFUN([APR_CHECK_TYPES_COMPATIBLE], [ -define([apr_cvname], apr_cv_typematch_[]translit([$1], [ ], [_])_[]translit([$2], [ ], [_])) -AC_CACHE_CHECK([whether $1 and $2 are the same], apr_cvname, [ -AC_TRY_COMPILE(AC_INCLUDES_DEFAULT, [ - int foo[0 - !__builtin_types_compatible_p($1, $2)]; -], [apr_cvname=yes -$3], [apr_cvname=no])]) -]) diff --git a/libs/unimrcp/build/acmacros/apu.m4 b/libs/unimrcp/build/acmacros/apu.m4 deleted file mode 100644 index 0399751157..0000000000 --- a/libs/unimrcp/build/acmacros/apu.m4 +++ /dev/null @@ -1,2 +0,0 @@ -dnl The macro UNIMRCP_CHECK_APU() has been merged with the macro UNIMRCP_CHECK_APR(). -dnl This file is no longer used and pending for removal. diff --git a/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 b/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 deleted file mode 100644 index 2f8d080249..0000000000 --- a/libs/unimrcp/build/acmacros/ax_compiler_vendor.m4 +++ /dev/null @@ -1,41 +0,0 @@ -dnl Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, -dnl hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, -dnl watcom, etc. The vendor is returned in the cache variable -dnl $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. - -AC_DEFUN([AX_COMPILER_VENDOR], -[AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, - [dnl note: don't check for gcc first since some other compilers define __GNUC__ - vendors="intel: __ICC,__ECC,__INTEL_COMPILER - ibm: __xlc__,__xlC__,__IBMC__,__IBMCPP__ - pathscale: __PATHCC__,__PATHSCALE__ - clang: __clang__ - gnu: __GNUC__ - sun: __SUNPRO_C,__SUNPRO_CC - hp: __HP_cc,__HP_aCC - dec: __DECC,__DECCXX,__DECC_VER,__DECCXX_VER - borland: __BORLANDC__,__TURBOC__ - comeau: __COMO__ - cray: _CRAYC - kai: __KCC - lcc: __LCC__ - sgi: __sgi,sgi - microsoft: _MSC_VER - metrowerks: __MWERKS__ - watcom: __WATCOMC__ - portland: __PGI - unknown: UNKNOWN" - for ventest in $vendors; do - case $ventest in - *:) vendor=$ventest; continue ;; - *) vencpp="defined("`echo $ventest | sed 's/,/) || defined(/g'`")" ;; - esac - AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ - #if !($vencpp) - thisisanerror; - #endif - ])], [break]) - done - ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=`echo $vendor | cut -d: -f1` - ]) -]) diff --git a/libs/unimrcp/build/acmacros/find_apr.m4 b/libs/unimrcp/build/acmacros/find_apr.m4 deleted file mode 100644 index 048cb7bfc8..0000000000 --- a/libs/unimrcp/build/acmacros/find_apr.m4 +++ /dev/null @@ -1,167 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Licensed to the Apache Software Foundation (ASF) under one or more -dnl contributor license agreements. See the NOTICE file distributed with -dnl this work for additional information regarding copyright ownership. -dnl The ASF licenses this file to You under the Apache License, Version 2.0 -dnl (the "License"); you may not use this file except in compliance with -dnl the License. You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. - -dnl -dnl find_apr.m4 : locate the APR include files and libraries -dnl -dnl This macro file can be used by applications to find and use the APR -dnl library. It provides a standardized mechanism for using APR. It supports -dnl embedding APR into the application source, or locating an installed -dnl copy of APR. -dnl -dnl APR_FIND_APR(srcdir, builddir, implicit-install-check, acceptable-majors) -dnl -dnl where srcdir is the location of the bundled APR source directory, or -dnl empty if source is not bundled. -dnl -dnl where builddir is the location where the bundled APR will will be built, -dnl or empty if the build will occur in the srcdir. -dnl -dnl where implicit-install-check set to 1 indicates if there is no -dnl --with-apr option specified, we will look for installed copies. -dnl -dnl where acceptable-majors is a space separated list of acceptable major -dnl version numbers. Often only a single major version will be acceptable. -dnl If multiple versions are specified, and --with-apr=PREFIX or the -dnl implicit installed search are used, then the first (leftmost) version -dnl in the list that is found will be used. Currently defaults to [0 1]. -dnl -dnl Sets the following variables on exit: -dnl -dnl apr_found : "yes", "no", "reconfig" -dnl -dnl apr_config : If the apr-config tool exists, this refers to it. If -dnl apr_found is "reconfig", then the bundled directory -dnl should be reconfigured *before* using apr_config. -dnl -dnl Note: this macro file assumes that apr-config has been installed; it -dnl is normally considered a required part of an APR installation. -dnl -dnl If a bundled source directory is available and needs to be (re)configured, -dnl then apr_found is set to "reconfig". The caller should reconfigure the -dnl (passed-in) source directory, placing the result in the build directory, -dnl as appropriate. -dnl -dnl If apr_found is "yes" or "reconfig", then the caller should use the -dnl value of apr_config to fetch any necessary build/link information. -dnl - -AC_DEFUN([APR_FIND_APR], [ - apr_found="no" - - if test "$target_os" = "os2-emx"; then - # Scripts don't pass test -x on OS/2 - TEST_X="test -f" - else - TEST_X="test -x" - fi - - ifelse([$4], [], [ - ifdef(AC_WARNING,AC_WARNING([$0: missing argument 4 (acceptable-majors): Defaulting to APR 0.x then APR 1.x])) - acceptable_majors="0 1"], - [acceptable_majors="$4"]) - - apr_temp_acceptable_apr_config="" - for apr_temp_major in $acceptable_majors - do - case $apr_temp_major in - 0) - apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-config" - ;; - *) - apr_temp_acceptable_apr_config="$apr_temp_acceptable_apr_config apr-$apr_temp_major-config" - ;; - esac - done - - AC_MSG_CHECKING(for APR) - AC_ARG_WITH(apr, - [ --with-apr=PATH prefix for installed APR, path to APR build tree, - or the full path to apr-config], - [ - if test "$withval" = "no" || test "$withval" = "yes"; then - AC_MSG_ERROR([--with-apr requires a directory or file to be provided]) - fi - - for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config - do - for lookdir in "$withval/bin" "$withval" - do - if $TEST_X "$lookdir/$apr_temp_apr_config_file"; then - apr_found="yes" - apr_config="$lookdir/$apr_temp_apr_config_file" - break 2 - fi - done - done - - if test "$apr_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then - apr_found="yes" - apr_config="$withval" - fi - - dnl if --with-apr is used, it is a fatal error for its argument - dnl to be invalid - if test "$apr_found" != "yes"; then - AC_MSG_ERROR([the --with-apr parameter is incorrect. It must specify an install prefix, a build directory, or an apr-config file.]) - fi - ],[ - dnl If we allow installed copies, check those before using bundled copy. - if test -n "$3" && test "$3" = "1"; then - for apr_temp_apr_config_file in $apr_temp_acceptable_apr_config - do - if $apr_temp_apr_config_file --help > /dev/null 2>&1 ; then - apr_found="yes" - apr_config="$apr_temp_apr_config_file" - break - else - dnl look in some standard places - for lookdir in /usr /usr/local /usr/local/apr /opt/apr; do - if $TEST_X "$lookdir/bin/$apr_temp_apr_config_file"; then - apr_found="yes" - apr_config="$lookdir/bin/$apr_temp_apr_config_file" - break 2 - fi - done - fi - done - fi - dnl if we have not found anything yet and have bundled source, use that - if test "$apr_found" = "no" && test -d "$1"; then - apr_temp_abs_srcdir="`cd $1 && pwd`" - apr_found="reconfig" - apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`" - case $apr_bundled_major in - "") - AC_MSG_ERROR([failed to find major version of bundled APR]) - ;; - 0) - apr_temp_apr_config_file="apr-config" - ;; - *) - apr_temp_apr_config_file="apr-$apr_bundled_major-config" - ;; - esac - if test -n "$2"; then - apr_config="$2/$apr_temp_apr_config_file" - else - apr_config="$1/$apr_temp_apr_config_file" - fi - fi - ]) - - AC_MSG_RESULT($apr_found) -]) diff --git a/libs/unimrcp/build/acmacros/find_apu.m4 b/libs/unimrcp/build/acmacros/find_apu.m4 deleted file mode 100644 index e29bc60923..0000000000 --- a/libs/unimrcp/build/acmacros/find_apu.m4 +++ /dev/null @@ -1,176 +0,0 @@ -dnl -------------------------------------------------------- -*- autoconf -*- -dnl Copyright 2002-2005 The Apache Software Foundation or its licensors, as -dnl applicable. -dnl -dnl Licensed under the Apache License, Version 2.0 (the "License"); -dnl you may not use this file except in compliance with the License. -dnl You may obtain a copy of the License at -dnl -dnl http://www.apache.org/licenses/LICENSE-2.0 -dnl -dnl Unless required by applicable law or agreed to in writing, software -dnl distributed under the License is distributed on an "AS IS" BASIS, -dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -dnl See the License for the specific language governing permissions and -dnl limitations under the License. - -dnl -dnl find_apu.m4 : locate the APR-util (APU) include files and libraries -dnl -dnl This macro file can be used by applications to find and use the APU -dnl library. It provides a standardized mechanism for using APU. It supports -dnl embedding APU into the application source, or locating an installed -dnl copy of APU. -dnl -dnl APR_FIND_APU(srcdir, builddir, implicit-install-check, acceptable-majors) -dnl -dnl where srcdir is the location of the bundled APU source directory, or -dnl empty if source is not bundled. -dnl -dnl where builddir is the location where the bundled APU will be built, -dnl or empty if the build will occur in the srcdir. -dnl -dnl where implicit-install-check set to 1 indicates if there is no -dnl --with-apr-util option specified, we will look for installed copies. -dnl -dnl where acceptable-majors is a space separated list of acceptable major -dnl version numbers. Often only a single major version will be acceptable. -dnl If multiple versions are specified, and --with-apr-util=PREFIX or the -dnl implicit installed search are used, then the first (leftmost) version -dnl in the list that is found will be used. Currently defaults to [0 1]. -dnl -dnl Sets the following variables on exit: -dnl -dnl apu_found : "yes", "no", "reconfig" -dnl -dnl apu_config : If the apu-config tool exists, this refers to it. If -dnl apu_found is "reconfig", then the bundled directory -dnl should be reconfigured *before* using apu_config. -dnl -dnl Note: this macro file assumes that apr-config has been installed; it -dnl is normally considered a required part of an APR installation. -dnl -dnl Note: At this time, we cannot find *both* a source dir and a build dir. -dnl If both are available, the build directory should be passed to -dnl the --with-apr-util switch. -dnl -dnl Note: the installation layout is presumed to follow the standard -dnl PREFIX/lib and PREFIX/include pattern. If the APU config file -dnl is available (and can be found), then non-standard layouts are -dnl possible, since it will be described in the config file. -dnl -dnl If a bundled source directory is available and needs to be (re)configured, -dnl then apu_found is set to "reconfig". The caller should reconfigure the -dnl (passed-in) source directory, placing the result in the build directory, -dnl as appropriate. -dnl -dnl If apu_found is "yes" or "reconfig", then the caller should use the -dnl value of apu_config to fetch any necessary build/link information. -dnl - -AC_DEFUN([APR_FIND_APU], [ - apu_found="no" - - if test "$target_os" = "os2-emx"; then - # Scripts don't pass test -x on OS/2 - TEST_X="test -f" - else - TEST_X="test -x" - fi - - ifelse([$4], [], - [ - ifdef(AC_WARNING,([$0: missing argument 4 (acceptable-majors): Defaulting to APU 0.x then APU 1.x])) - acceptable_majors="0 1" - ], [acceptable_majors="$4"]) - - apu_temp_acceptable_apu_config="" - for apu_temp_major in $acceptable_majors - do - case $apu_temp_major in - 0) - apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-config" - ;; - *) - apu_temp_acceptable_apu_config="$apu_temp_acceptable_apu_config apu-$apu_temp_major-config" - ;; - esac - done - - AC_MSG_CHECKING(for APR-util) - AC_ARG_WITH(apr-util, - [ --with-apr-util=PATH prefix for installed APU, path to APU build tree, - or the full path to apu-config], - [ - if test "$withval" = "no" || test "$withval" = "yes"; then - AC_MSG_ERROR([--with-apr-util requires a directory or file to be provided]) - fi - - for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config - do - for lookdir in "$withval/bin" "$withval" - do - if $TEST_X "$lookdir/$apu_temp_apu_config_file"; then - apu_found="yes" - apu_config="$lookdir/$apu_temp_apu_config_file" - break 2 - fi - done - done - - if test "$apu_found" != "yes" && $TEST_X "$withval" && $withval --help > /dev/null 2>&1 ; then - apu_found="yes" - apu_config="$withval" - fi - - dnl if --with-apr-util is used, it is a fatal error for its argument - dnl to be invalid - if test "$apu_found" != "yes"; then - AC_MSG_ERROR([the --with-apr-util parameter is incorrect. It must specify an install prefix, a build directory, or an apu-config file.]) - fi - ],[ - if test -n "$3" && test "$3" = "1"; then - for apu_temp_apu_config_file in $apu_temp_acceptable_apu_config - do - if $apu_temp_apu_config_file --help > /dev/null 2>&1 ; then - apu_found="yes" - apu_config="$apu_temp_apu_config_file" - break - else - dnl look in some standard places (apparently not in builtin/default) - for lookdir in /usr /usr/local /usr/local/apr /opt/apr /usr/local/apache2 ; do - if $TEST_X "$lookdir/bin/$apu_temp_apu_config_file"; then - apu_found="yes" - apu_config="$lookdir/bin/$apu_temp_apu_config_file" - break 2 - fi - done - fi - done - fi - dnl if we have not found anything yet and have bundled source, use that - if test "$apu_found" = "no" && test -d "$1"; then - apu_temp_abs_srcdir="`cd $1 && pwd`" - apu_found="reconfig" - apu_bundled_major="`sed -n '/#define.*APU_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apu_version.h\"`" - case $apu_bundled_major in - "") - AC_MSG_ERROR([failed to find major version of bundled APU]) - ;; - 0) - apu_temp_apu_config_file="apu-config" - ;; - *) - apu_temp_apu_config_file="apu-$apu_bundled_major-config" - ;; - esac - if test -n "$2"; then - apu_config="$2/$apu_temp_apu_config_file" - else - apu_config="$1/$apu_temp_apu_config_file" - fi - fi - ]) - - AC_MSG_RESULT($apu_found) -]) diff --git a/libs/unimrcp/build/acmacros/sofia-sip.m4 b/libs/unimrcp/build/acmacros/sofia-sip.m4 deleted file mode 100644 index ef1dfcb8d9..0000000000 --- a/libs/unimrcp/build/acmacros/sofia-sip.m4 +++ /dev/null @@ -1,85 +0,0 @@ -dnl -dnl UNIMRCP_CHECK_SOFIA -dnl -dnl This macro attempts to find the Sofia-SIP library and -dnl set corresponding variables on exit. -dnl -AC_DEFUN([UNIMRCP_CHECK_SOFIA], -[ - AC_MSG_NOTICE([Sofia SIP library configuration]) - - AC_MSG_CHECKING([for Sofia-SIP]) - AC_ARG_WITH(sofia-sip, - [ --with-sofia-sip=PATH prefix for installed Sofia-SIP, - path to Sofia-SIP source/build tree, - or the full path to Sofia-SIP pkg-config], - [sofia_path=$withval], - [sofia_path="/usr/local"] - ) - - found_sofia="no" - - if test -n "$PKG_CONFIG"; then - dnl Check for installed Sofia-SIP - for dir in $sofia_path ; do - sofia_config_path=$dir/lib/pkgconfig/sofia-sip-ua.pc - if test -f "$sofia_config_path" && $PKG_CONFIG $sofia_config_path > /dev/null 2>&1; then - found_sofia="yes" - break - fi - done - - dnl Check for installed Sofia-SIP in PKG_CONFIG_PATH - if test "$found_sofia" != "yes" && $PKG_CONFIG sofia-sip-ua > /dev/null 2>&1 ; then - found_sofia="yes" - sofia_config_path="sofia-sip-ua" - fi - - dnl Check for full path to Sofia-SIP pkg-config file - if test "$found_sofia" != "yes" && test -f "$sofia_path" && $PKG_CONFIG $sofia_path > /dev/null 2>&1 ; then - found_sofia="yes" - sofia_config_path=$sofia_path - fi - - if test "$found_sofia" = "yes" ; then - UNIMRCP_SOFIA_INCLUDES="`$PKG_CONFIG --cflags $sofia_config_path`" - UNIMRCP_SOFIA_LIBS="`$PKG_CONFIG --libs $sofia_config_path`" - sofia_version="`$PKG_CONFIG --modversion $sofia_config_path`" - fi - fi - - if test "$found_sofia" != "yes" ; then - dnl Check for path to Sofia-SIP source/build tree - for dir in $sofia_path ; do - sofia_uadir="$dir/libsofia-sip-ua" - if test -d "$sofia_uadir"; then - found_sofia="yes" - sofia_abs_uadir="`cd $sofia_uadir && pwd`" - UNIMRCP_SOFIA_INCLUDES="-I$sofia_abs_uadir -I$sofia_abs_uadir/bnf -I$sofia_abs_uadir/features -I$sofia_abs_uadir/http -I$sofia_abs_uadir/ipt -I$sofia_abs_uadir/iptsec -I$sofia_abs_uadir/msg -I$sofia_abs_uadir/nea -I$sofia_abs_uadir/nta -I$sofia_abs_uadir/nth -I$sofia_abs_uadir/nua -I$sofia_abs_uadir/sdp -I$sofia_abs_uadir/sip -I$sofia_abs_uadir/soa -I$sofia_abs_uadir/sresolv -I$sofia_abs_uadir/stun -I$sofia_abs_uadir/su -I$sofia_abs_uadir/tport -I$sofia_abs_uadir/url" - UNIMRCP_SOFIA_LIBS="$sofia_abs_uadir/libsofia-sip-ua.la" - sofia_version="`sed -n 's/#define SOFIA_SIP_VERSION.* "\(.*\)"/\1/p' $sofia_uadir/features/sofia-sip/sofia_features.h`" - break - fi - done - fi - - if test $found_sofia != "yes" ; then - if test -n "$PKG_CONFIG"; then - AC_MSG_ERROR(Cannot find Sofia-SIP - looked for sofia-config and libsofia-sip-ua in $sofia_path) - else - AC_MSG_ERROR(Cannot find Sofia-SIP - pkg-config not available, looked for libsofia-sip-ua in $sofia_path) - fi - else - AC_MSG_RESULT([$found_sofia]) - AC_MSG_RESULT([$sofia_version]) - -case "$host" in - *darwin*) - UNIMRCP_SOFIA_LIBS="$UNIMRCP_SOFIA_LIBS -framework CoreFoundation -framework SystemConfiguration" - ;; -esac - - AC_SUBST(UNIMRCP_SOFIA_INCLUDES) - AC_SUBST(UNIMRCP_SOFIA_LIBS) - fi -]) diff --git a/libs/unimrcp/build/acmacros/uni_plugin.m4 b/libs/unimrcp/build/acmacros/uni_plugin.m4 deleted file mode 100644 index 6a33b1b638..0000000000 --- a/libs/unimrcp/build/acmacros/uni_plugin.m4 +++ /dev/null @@ -1,45 +0,0 @@ -dnl -dnl UNI_PLUGIN_ENABLED(name) -dnl -dnl where name is the name of the plugin. -dnl -dnl This macro can be used for a plugin which must be enabled by default. -dnl -dnl Adds the following argument to the configure script: -dnl -dnl --disable-$1-plugin -dnl -dnl Sets the following variable on exit: -dnl -dnl enable_$1_plugin : "yes" or "no" -dnl -AC_DEFUN([UNI_PLUGIN_ENABLED],[ - AC_ARG_ENABLE( - [$1-plugin], - [AC_HELP_STRING([--disable-$1-plugin],[exclude $1 plugin from build])], - [enable_$1_plugin="$enableval"], - [enable_$1_plugin="yes"]) -]) - -dnl -dnl UNI_PLUGIN_DISABLED(name) -dnl -dnl where name is the name of the plugin. -dnl -dnl This macro can be used for a plugin which must be disabled by default. -dnl -dnl Adds the following argument to the configure script: -dnl -dnl --enable-$1-plugin -dnl -dnl Sets the following variable on exit: -dnl -dnl enable_$1_plugin : "yes" or "no" -dnl -AC_DEFUN([UNI_PLUGIN_DISABLED],[ - AC_ARG_ENABLE( - [$1-plugin], - [AC_HELP_STRING([--enable-$1-plugin],[include $1 plugin in build])], - [enable_$1_plugin="$enableval"], - [enable_$1_plugin="no"]) -]) diff --git a/libs/unimrcp/build/get-version.sh b/libs/unimrcp/build/get-version.sh deleted file mode 100755 index fd685b22a8..0000000000 --- a/libs/unimrcp/build/get-version.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# -# extract version numbers from a header file -# -# USAGE: get-version.sh CMD VERSION_HEADER PREFIX -# where CMD is one of: all, major, libtool -# where PREFIX is the prefix to {MAJOR|MINOR|PATCH}_VERSION defines -# -# get-version.sh all returns a dotted version number -# get-version.sh major returns just the major version number -# get-version.sh libtool returns a version "libtool -version-info" format -# - -if test $# != 3; then - echo "USAGE: $0 CMD VERSION_HEADER PREFIX" - echo " where CMD is one of: all, major, libtool" - exit 1 -fi - -major_sed="/#define.*$3_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" -minor_sed="/#define.*$3_MINOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" -patch_sed="/#define.*$3_PATCH_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p" -major="`sed -n $major_sed $2`" -minor="`sed -n $minor_sed $2`" -patch="`sed -n $patch_sed $2`" - -if test "$1" = "all"; then - echo ${major}.${minor}.${patch} -elif test "$1" = "major"; then - echo ${major} -elif test "$1" = "libtool"; then - # Yes, ${minor}:${patch}:${minor} is correct due to libtool idiocy. - echo ${minor}:${patch}:${minor} -else - echo "ERROR: unknown version CMD ($1)" - exit 1 -fi diff --git a/libs/unimrcp/build/init.d/unimrcp-server b/libs/unimrcp/build/init.d/unimrcp-server deleted file mode 100755 index 3518e23fa1..0000000000 --- a/libs/unimrcp/build/init.d/unimrcp-server +++ /dev/null @@ -1,270 +0,0 @@ -#!/bin/sh -# -# unimrcp-server This shell script takes care of starting and stopping the UniMRCP server. -# -# chkconfig: 2345 65 35 -# description: UniMRCP is an open source MRCP v1 & v2 server. - -# Some global variables - -# Application -APP_NAME="unimrcpserver" -APP_LONG_NAME="UniMRCP Server" -UNIMRCP_DIR="/usr/local/unimrcp/" -DAEMON_ARGS="-d -r ${UNIMRCP_DIR}" -APP_ARGS="-o 2" - -EXEC="${UNIMRCP_DIR}bin/${APP_NAME}" - -# sudo user -USERNAME=root - -# Priority at which to run the server. See "man nice" for valid priorities. -# nice is only used if a priority is specified. -PRIORITY= - -# Location of the pid file. -PIDDIR="/var/run/" -pid= - -if [ -e $PIDDIR ]; then - echo -else - mkdir $PIDDIR -fi - -# Allow configuration overrides in /etc/sysconfig/$APP_NAME -CONFIGFILE=/etc/sysconfig/$APP_NAME - -[ -x $CONFIGFILE ] && . $CONFIGFILE - -# Do not modify anything beyond this point -#----------------------------------------------------------------------------- - -# Get the fully qualified path to the script -case $0 in - /*) - SCRIPT="$0" - ;; - *) - PWD=`pwd` - SCRIPT="$PWD/$0" - ;; -esac - -# Change spaces to ":" so the tokens can be parsed. -SCRIPT=`echo $SCRIPT | sed -e 's; ;:;g'` -# Get the real path to this script, resolving any symbolic links -TOKENS=`echo $SCRIPT | sed -e 's;/; ;g'` -REALPATH= -for C in $TOKENS; do - REALPATH="$REALPATH/$C" - while [ -h "$REALPATH" ] ; do - LS="`ls -ld "$REALPATH"`" - LINK="`expr "$LS" : '.*-> \(.*\)$'`" - if expr "$LINK" : '/.*' > /dev/null; then - REALPATH="$LINK" - else - REALPATH="`dirname "$REALPATH"`""/$LINK" - fi - done -done -# Change ":" chars back to spaces. -REALPATH=`echo $REALPATH | sed -e 's;:; ;g'` - -# Change the current directory to the location of the script -cd "`dirname "$REALPATH"`" - -chown $USERNAME $PIDDIR - -# Process ID -PIDFILE="$PIDDIR/$APP_NAME.pid" - -# Resolve the location of the 'ps' command -PSEXE="/usr/bin/ps" -if [ ! -x $PSEXE ] -then - PSEXE="/bin/ps" - if [ ! -x $PSEXE ] - then - echo "Unable to locate 'ps'." - echo "Please report this with the location on your system." - exit 1 - fi -fi - -# Build the nice clause -if [ "X$PRIORITY" = "X" ] -then - CMDNICE="" -else - CMDNICE="nice -$PRIORITY" -fi - -getpid() { - if [ -f $PIDFILE ] - then - if [ -r $PIDFILE ] - then - pid=`cat $PIDFILE` - if [ "X$pid" != "X" ] - then - # Verify that a process with this pid is still running. - pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` - if [ "X$pid" = "X" ] - then - # This is a stale pid file. - rm -f $PIDFILE - echo "Removed stale pid file: $PIDFILE" - fi - fi - else - echo "Cannot read $PIDFILE." - exit 1 - fi - fi -} - -testpid() { - pid=`$PSEXE -p $pid | grep $pid | grep -v grep | awk '{print $1}' | tail -1` - if [ "X$pid" = "X" ] - then - # Process is gone so remove the pid file. - rm -f $PIDFILE - fi -} - -console() { - echo "Running $APP_LONG_NAME..." - getpid - if [ "X$pid" = "X" ] - then - exec sudo -u $USERNAME $CMDNICE $EXEC $APP_ARGS - echo $pid > $PIDFILE - else - echo "$APP_LONG_NAME is already running." - exit 1 - fi -} - -start() { - echo "Starting $APP_LONG_NAME..." - getpid - if [ "X$pid" = "X" ] - then - sudo -u $USERNAME $CMDNICE $EXEC $DAEMON_ARGS $APP_ARGS - pid=`$PSEXE -C $APP_NAME -o pid=` - echo $pid > $PIDFILE - else - echo "$APP_LONG_NAME is already running." - exit 1 - fi -} - -stopit() { - echo "Stopping $APP_LONG_NAME..." - getpid - if [ "X$pid" = "X" ] - then - echo "$APP_LONG_NAME was not running." - else - # Running so try to stop it. - sudo -u $USERNAME kill $pid - if [ $? -ne 0 ] - then - # An explanation for the failure should have been given - echo "Unable to stop $APP_LONG_NAME." - exit 1 - fi - - # We can not predict how long it will take for the wrapper to - # actually stop as it depends on settings in wrapper.conf. - # Loop until it does. - savepid=$pid - CNT=0 - TOTCNT=0 - while [ "X$pid" != "X" ] - do - # Loop for up to 5 minutes - if [ "$TOTCNT" -lt "300" ] - then - if [ "$CNT" -lt "5" ] - then - CNT=`expr $CNT + 1` - else - echo "Waiting for $APP_LONG_NAME to exit..." - CNT=0 - fi - TOTCNT=`expr $TOTCNT + 1` - - sleep 1 - - testpid - else - pid= - fi - done - - pid=$savepid - testpid - if [ "X$pid" != "X" ] - then - echo "Timed out waiting for $APP_LONG_NAME to exit." - echo " Attempting a forced exit..." - kill -9 $pid - fi - - pid=$savepid - testpid - if [ "X$pid" != "X" ] - then - echo "Failed to stop $APP_LONG_NAME." - exit 1 - else - echo "Stopped $APP_LONG_NAME." - fi - fi -} - -status() { - getpid - if [ "X$pid" = "X" ] - then - echo "$APP_LONG_NAME is not running." - exit 1 - else - echo "$APP_LONG_NAME is running ($pid)." - exit 0 - fi -} - -case "$1" in - - 'console') - console - ;; - - 'start') - start - ;; - - 'stop') - stopit - ;; - - 'restart') - stopit - start - ;; - - 'status') - status - ;; - - *) - echo "Usage: $0 { console | start | stop | restart | status }" - exit 1 - ;; -esac - -exit 0 diff --git a/libs/unimrcp/build/pkgconfig/Makefile.am b/libs/unimrcp/build/pkgconfig/Makefile.am deleted file mode 100644 index ce3a063c05..0000000000 --- a/libs/unimrcp/build/pkgconfig/Makefile.am +++ /dev/null @@ -1,4 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -pkgconfigdir = $(libdir)/pkgconfig -pkgconfig_DATA = unimrcpclient.pc unimrcpserver.pc unimrcpplugin.pc diff --git a/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in deleted file mode 100644 index 7fe3f1c130..0000000000 --- a/libs/unimrcp/build/pkgconfig/unimrcpclient.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ - -Name: unimrcpclient -Description: UniMRCP Client Stack -Requires: -Version: @UNI_DOTTED_VERSION@ -Libs: -L${libdir} -lunimrcpclient -Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir} diff --git a/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in deleted file mode 100644 index df78b8ea7f..0000000000 --- a/libs/unimrcp/build/pkgconfig/unimrcpplugin.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ - -Name: unimrcpplugin -Description: UniMRCP Server Plugin -Requires: -Version: @UNI_DOTTED_VERSION@ -Libs: -L${libdir} -lunimrcpserver -Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir} diff --git a/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in b/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in deleted file mode 100644 index 3ed91ecd02..0000000000 --- a/libs/unimrcp/build/pkgconfig/unimrcpserver.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ @UNIMRCP_APR_INCLUDES@ - -Name: unimrcpserver -Description: UniMRCP Server Stack -Requires: -Version: @UNI_DOTTED_VERSION@ -Libs: -L${libdir} -lunimrcpserver -Cflags: @CPPFLAGS@ @CFLAGS@ -I${includedir} diff --git a/libs/unimrcp/build/props/apr.props b/libs/unimrcp/build/props/apr.props deleted file mode 100644 index 8e3f475bb3..0000000000 --- a/libs/unimrcp/build/props/apr.props +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - $(LibRootDir)libs\apr - $(LibRootDir)libs\apr-util - $(LibRootDir)libs\apr-iconv - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(AprDir)\include;$(AprUtilDir)\include;%(AdditionalIncludeDirectories) - - - - - $(AprDir) - - - $(AprUtilDir) - - - $(AprIconvDir) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/apt.props b/libs/unimrcp/build/props/apt.props deleted file mode 100644 index 89c5547c33..0000000000 --- a/libs/unimrcp/build/props/apt.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(ProjectRootDir)libs\apr-toolkit\include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mpf.props b/libs/unimrcp/build/props/mpf.props deleted file mode 100644 index 8e46c5dd2a..0000000000 --- a/libs/unimrcp/build/props/mpf.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(ProjectRootDir)libs\mpf\include;%(AdditionalIncludeDirectories) - MPF_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcp.props b/libs/unimrcp/build/props/mrcp.props deleted file mode 100644 index 14f8a4683d..0000000000 --- a/libs/unimrcp/build/props/mrcp.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(ProjectRootDir)libs\mrcp\include;$(ProjectRootDir)libs\mrcp\message\include;$(ProjectRootDir)libs\mrcp\control\include;$(ProjectRootDir)libs\mrcp\resources\include;%(AdditionalIncludeDirectories) - MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpclient.props b/libs/unimrcp/build/props/mrcpclient.props deleted file mode 100644 index 4e552bd3fd..0000000000 --- a/libs/unimrcp/build/props/mrcpclient.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcp-client\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpengine.props b/libs/unimrcp/build/props/mrcpengine.props deleted file mode 100644 index 5b1ee1b5ca..0000000000 --- a/libs/unimrcp/build/props/mrcpengine.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcp-engine\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpserver.props b/libs/unimrcp/build/props/mrcpserver.props deleted file mode 100644 index 94e5e8aef2..0000000000 --- a/libs/unimrcp/build/props/mrcpserver.props +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcp-server\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpsignaling.props b/libs/unimrcp/build/props/mrcpsignaling.props deleted file mode 100644 index dbe9aa32cf..0000000000 --- a/libs/unimrcp/build/props/mrcpsignaling.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcp-signaling\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/mrcpv2transport.props b/libs/unimrcp/build/props/mrcpv2transport.props deleted file mode 100644 index 8b65c83982..0000000000 --- a/libs/unimrcp/build/props/mrcpv2transport.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\mrcpv2-transport\include;%(AdditionalIncludeDirectories) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sdk/unimrcpclient.props b/libs/unimrcp/build/props/sdk/unimrcpclient.props deleted file mode 100644 index b9e764ee52..0000000000 --- a/libs/unimrcp/build/props/sdk/unimrcpclient.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - libunimrcpclient.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpclient.lib mrcpv2transport.lib mrcpsignaling.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sdk/unimrcpplugin.props b/libs/unimrcp/build/props/sdk/unimrcpplugin.props deleted file mode 100644 index 6d69aea52b..0000000000 --- a/libs/unimrcp/build/props/sdk/unimrcpplugin.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - mrcpengine.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sdk/unimrcpsdk.props b/libs/unimrcp/build/props/sdk/unimrcpsdk.props deleted file mode 100644 index 0334d6a0fe..0000000000 --- a/libs/unimrcp/build/props/sdk/unimrcpsdk.props +++ /dev/null @@ -1,23 +0,0 @@ - - - - - C:\Program Files\UniMRCP - - - - - $(ProjectRootDir)\include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - $(ProjectRootDir)\lib;%(AdditionalLibraryDirectories) - mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - $(ProjectRootDir) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sdk/unimrcpserver.props b/libs/unimrcp/build/props/sdk/unimrcpserver.props deleted file mode 100644 index 979a32781e..0000000000 --- a/libs/unimrcp/build/props/sdk/unimrcpserver.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - libunimrcpserver.lib mrcpsofiasip.lib mrcpunirtsp.lib unirtsp.lib mrcpserver.lib mrcpv2transport.lib mrcpsignaling.lib mrcpengine.lib libsofia_sip_ua.lib ws2_32.lib winmm.lib;%(AdditionalDependencies) - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/sofiasip.props b/libs/unimrcp/build/props/sofiasip.props deleted file mode 100644 index 0620099b0c..0000000000 --- a/libs/unimrcp/build/props/sofiasip.props +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - $(LibRootDir)libs\sofia-sip - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - $(SofiaDir)\win32;$(SofiaDir)\libsofia-sip-ua\su;$(SofiaDir)\libsofia-sip-ua\nua;$(SofiaDir)\libsofia-sip-ua\url;$(SofiaDir)\libsofia-sip-ua\sip;$(SofiaDir)\libsofia-sip-ua\msg;$(SofiaDir)\libsofia-sip-ua\sdp;$(SofiaDir)\libsofia-sip-ua\nta;$(SofiaDir)\libsofia-sip-ua\nea;$(SofiaDir)\libsofia-sip-ua\soa;$(SofiaDir)\libsofia-sip-ua\iptsec;$(SofiaDir)\libsofia-sip-ua\bnf;$(SofiaDir)\libsofia-sip-ua\features;$(SofiaDir)\libsofia-sip-ua\tport;%(AdditionalIncludeDirectories) - - - - - $(SofiaDir) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unibase.props b/libs/unimrcp/build/props/unibase.props deleted file mode 100644 index 2573021220..0000000000 --- a/libs/unimrcp/build/props/unibase.props +++ /dev/null @@ -1,29 +0,0 @@ - - - - $(ProjectDir)..\..\ - $(SolutionDir) - - - <_ProjectFileVersion>10.0.30319.1 - - - true - - - - WIN32;%(PreprocessorDefinitions) - Level4 - true - 4100;%(DisableSpecificWarnings) - - - - - $(ProjectRootDir) - - - $(LibRootDir) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unibin-x64.props b/libs/unimrcp/build/props/unibin-x64.props deleted file mode 100644 index 0d5b4dda41..0000000000 --- a/libs/unimrcp/build/props/unibin-x64.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(PlatformName)\$(Configuration)\bin\ - $(PlatformName)\$(Configuration)\ - - - - _WIN64;%(PreprocessorDefinitions) - - - $(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;$(SolutionDir)$(Platform)\$(Configuration)\bin;%(AdditionalLibraryDirectories) - MachineX64 - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unibin.props b/libs/unimrcp/build/props/unibin.props deleted file mode 100644 index bb83b9ed65..0000000000 --- a/libs/unimrcp/build/props/unibin.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\bin\ - $(Configuration)\ - - - - $(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration);$(SolutionDir)$(Configuration)\lib;$(SolutionDir)$(Configuration)\bin;%(AdditionalLibraryDirectories) - MachineX86 - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unidebug.props b/libs/unimrcp/build/props/unidebug.props deleted file mode 100644 index 7c3d8d81fe..0000000000 --- a/libs/unimrcp/build/props/unidebug.props +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - true - - - - Disabled - _DEBUG;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - ProgramDatabase - - - true - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unilib-x64.props b/libs/unimrcp/build/props/unilib-x64.props deleted file mode 100644 index e5e25acc2e..0000000000 --- a/libs/unimrcp/build/props/unilib-x64.props +++ /dev/null @@ -1,13 +0,0 @@ - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(PlatformName)\$(Configuration)\lib\ - $(PlatformName)\$(Configuration)\ - - - - _WIN64;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unilib.props b/libs/unimrcp/build/props/unilib.props deleted file mode 100644 index c77e94699e..0000000000 --- a/libs/unimrcp/build/props/unilib.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\lib\ - $(Configuration)\ - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unimrcpclient.props b/libs/unimrcp/build/props/unimrcpclient.props deleted file mode 100644 index 78f2b87025..0000000000 --- a/libs/unimrcp/build/props/unimrcpclient.props +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - libunimrcpclient.lib;mrcpsofiasip.lib;mrcpunirtsp.lib;unirtsp.lib;mrcpclient.lib;mrcpv2transport.lib;mrcpsignaling.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;libsofia_sip_ua.lib;ws2_32.lib;winmm.lib - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)platforms\libunimrcp-client\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories) - - - - - $(UniMRCPClientLibs) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unimrcpserver.props b/libs/unimrcp/build/props/unimrcpserver.props deleted file mode 100644 index 97c0f9808f..0000000000 --- a/libs/unimrcp/build/props/unimrcpserver.props +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - libunimrcpserver.lib;mrcpsofiasip.lib;mrcpunirtsp.lib;unirtsp.lib;mrcpserver.lib;mrcpv2transport.lib;mrcpsignaling.lib;mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;libsofia_sip_ua.lib;ws2_32.lib;winmm.lib - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)platforms\libunimrcp-server\include;$(ProjectRootDir)build;%(AdditionalIncludeDirectories) - - - - - $(UniMRCPServerLibs) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/uniplugin-x64.props b/libs/unimrcp/build/props/uniplugin-x64.props deleted file mode 100644 index 7dc181ca94..0000000000 --- a/libs/unimrcp/build/props/uniplugin-x64.props +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(PlatformName)\$(Configuration)\plugin\ - $(PlatformName)\$(Configuration)\ - - - - _WIN64;%(PreprocessorDefinitions) - - - $(AprDir)\$(Platform)\$(Configuration);$(AprUtilDir)\$(Platform)\$(Configuration);$(SolutionDir)$(Platform)\$(Configuration)\lib;%(AdditionalLibraryDirectories) - mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies) - MachineX64 - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/uniplugin.props b/libs/unimrcp/build/props/uniplugin.props deleted file mode 100644 index 09dbe53c17..0000000000 --- a/libs/unimrcp/build/props/uniplugin.props +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\plugin\ - $(Configuration)\ - - - - $(AprDir)\$(Configuration);$(AprUtilDir)\$(Configuration);$(SolutionDir)$(Configuration)\lib;%(AdditionalLibraryDirectories) - mrcpengine.lib;mrcp.lib;mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;%(AdditionalDependencies) - MachineX86 - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unirelease.props b/libs/unimrcp/build/props/unirelease.props deleted file mode 100644 index a2a832025a..0000000000 --- a/libs/unimrcp/build/props/unirelease.props +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - NDEBUG;%(PreprocessorDefinitions) - MultiThreadedDLL - - - ProgramDatabase - - - \ No newline at end of file diff --git a/libs/unimrcp/build/props/unirtsp.props b/libs/unimrcp/build/props/unirtsp.props deleted file mode 100644 index c872838994..0000000000 --- a/libs/unimrcp/build/props/unirtsp.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(ProjectRootDir)libs\uni-rtsp\include;%(AdditionalIncludeDirectories) - RTSP_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/libs/unimrcp/build/rules/uniclientapp.am b/libs/unimrcp/build/rules/uniclientapp.am deleted file mode 100644 index 2b1b97d1c3..0000000000 --- a/libs/unimrcp/build/rules/uniclientapp.am +++ /dev/null @@ -1,24 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_CLIENTAPP_INCLUDES = -I$(top_srcdir)/platforms/libunimrcp-client/include \ - -I$(top_srcdir)/libs/mrcp-client/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - -I$(top_srcdir)/build \ - $(UNIMRCP_APR_INCLUDES) - -# Libraries (LDADD) -UNIMRCP_CLIENTAPP_LIBS = $(top_builddir)/platforms/libunimrcp-client/libunimrcpclient.la - -# Linker options (LDFLAGS) -UNIMRCP_CLIENTAPP_OPTS = -if ISMAC -UNIMRCP_CLIENTAPP_OPTS += -framework CoreFoundation -framework SystemConfiguration -endif diff --git a/libs/unimrcp/build/rules/uniclientlib.am b/libs/unimrcp/build/rules/uniclientlib.am deleted file mode 100644 index 89d173e61a..0000000000 --- a/libs/unimrcp/build/rules/uniclientlib.am +++ /dev/null @@ -1,30 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_CLIENTLIB_INCLUDES = -I$(top_srcdir)/modules/mrcp-sofiasip/include \ - -I$(top_srcdir)/modules/mrcp-unirtsp/include \ - -I$(top_srcdir)/libs/mrcp-client/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - -I$(top_srcdir)/build \ - $(UNIMRCP_APR_INCLUDES) - -# Libraries (LIBADD) -UNIMRCP_CLIENTLIB_LIBS = $(top_builddir)/modules/mrcp-sofiasip/libmrcpsofiasip.la \ - $(top_builddir)/modules/mrcp-unirtsp/libmrcpunirtsp.la \ - $(top_builddir)/libs/mrcpv2-transport/libmrcpv2transport.la \ - $(top_builddir)/libs/mrcp-client/libmrcpclient.la \ - $(top_builddir)/libs/mrcp-signaling/libmrcpsignaling.la \ - $(top_builddir)/libs/mrcp/libmrcp.la \ - $(top_builddir)/libs/mpf/libmpf.la \ - $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) $(UNIMRCP_SOFIA_LIBS) -lm - -# Linker options (LDFLAGS) -UNIMRCP_CLIENTLIB_OPTS = $(UNI_LT_VERSION) diff --git a/libs/unimrcp/build/rules/uniplugin.am b/libs/unimrcp/build/rules/uniplugin.am deleted file mode 100644 index caf0de48ad..0000000000 --- a/libs/unimrcp/build/rules/uniplugin.am +++ /dev/null @@ -1,14 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_PLUGIN_INCLUDES = -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -# Linker options (LDFLAGS) -UNIMRCP_PLUGIN_OPTS = -module $(PLUGIN_LT_VERSION) diff --git a/libs/unimrcp/build/rules/uniserverapp.am b/libs/unimrcp/build/rules/uniserverapp.am deleted file mode 100644 index 957b0e75cd..0000000000 --- a/libs/unimrcp/build/rules/uniserverapp.am +++ /dev/null @@ -1,25 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_SERVERAPP_INCLUDES = -I$(top_srcdir)/platforms/libunimrcp-server/include \ - -I$(top_srcdir)/libs/mrcp-server/include \ - -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - -I$(top_srcdir)/build \ - $(UNIMRCP_APR_INCLUDES) - -# Libraries (LDADD) -UNIMRCP_SERVERAPP_LIBS = $(top_builddir)/platforms/libunimrcp-server/libunimrcpserver.la - -# Linker options (LDFLAGS) -UNIMRCP_SERVERAPP_OPTS = -if ISMAC -UNIMRCP_SERVERAPP_OPTS += -framework CoreFoundation -framework SystemConfiguration -endif diff --git a/libs/unimrcp/build/rules/uniserverlib.am b/libs/unimrcp/build/rules/uniserverlib.am deleted file mode 100644 index b933796e42..0000000000 --- a/libs/unimrcp/build/rules/uniserverlib.am +++ /dev/null @@ -1,32 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -# Includes -UNIMRCP_SERVERLIB_INCLUDES = -I$(top_srcdir)/modules/mrcp-sofiasip/include \ - -I$(top_srcdir)/modules/mrcp-unirtsp/include \ - -I$(top_srcdir)/libs/mrcp-server/include \ - -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - -I$(top_srcdir)/build \ - $(UNIMRCP_APR_INCLUDES) - -# Libraries (LIBADD) -UNIMRCP_SERVERLIB_LIBS = $(top_builddir)/modules/mrcp-sofiasip/libmrcpsofiasip.la \ - $(top_builddir)/modules/mrcp-unirtsp/libmrcpunirtsp.la \ - $(top_builddir)/libs/mrcp-server/libmrcpserver.la \ - $(top_builddir)/libs/mrcp-signaling/libmrcpsignaling.la \ - $(top_builddir)/libs/mrcpv2-transport/libmrcpv2transport.la \ - $(top_builddir)/libs/mrcp-engine/libmrcpengine.la \ - $(top_builddir)/libs/mrcp/libmrcp.la \ - $(top_builddir)/libs/mpf/libmpf.la \ - $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) $(UNIMRCP_SOFIA_LIBS) -lm - -# Linker options (LDFLAGS) -UNIMRCP_SERVERLIB_OPTS = $(UNI_LT_VERSION) diff --git a/libs/unimrcp/build/tools/prepare.vcproj b/libs/unimrcp/build/tools/prepare.vcproj deleted file mode 100644 index 3b03c54a93..0000000000 --- a/libs/unimrcp/build/tools/prepare.vcproj +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/build/tools/prepare.vcxproj b/libs/unimrcp/build/tools/prepare.vcxproj deleted file mode 100644 index b9ab80fc50..0000000000 --- a/libs/unimrcp/build/tools/prepare.vcxproj +++ /dev/null @@ -1,205 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {01D63BF5-7798-4746-852A-4B45229BB735} - prepare - Win32Proj - - - - Utility - Unicode - true - - - Utility - Unicode - - - Utility - Unicode - true - - - Utility - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - true - $(SolutionDir)$(Configuration)\ - $(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\ - - - - xcopy "$(AprDir)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -xcopy "$(AprUtilDir)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y - -if exist "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" ( -xcopy "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -if exist "$(AprIconvDir)\$(Configuration)\iconv" ( -if not exist "$(SolutionDir)$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Configuration)\bin\iconv" -xcopy "$(AprIconvDir)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Configuration)\bin\iconv\" /Y -) -) - -xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -xcopy "$(SofiaDir)\win32\pthread\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Configuration)\bin\" /Y - -if not exist "$(SolutionDir)$(Configuration)\conf" ( -xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Configuration)\conf\client-profiles\" /Y -) - -if not exist "$(SolutionDir)$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Configuration)\data\" /Y -if not exist "$(SolutionDir)$(Configuration)\log" mkdir "$(SolutionDir)$(Configuration)\log\" -if not exist "$(SolutionDir)$(Configuration)\var" mkdir "$(SolutionDir)$(Configuration)\var\" - - - - - - xcopy "$(AprDir)\$(Platform)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -xcopy "$(AprUtilDir)\$(Platform)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y - -if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" ( -xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv" ( -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" -xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv\" /Y -) -) - -xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -xcopy "$(SofiaDir)\win32\pthread\$(Platform)\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y - -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\conf" ( -xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\client-profiles\" /Y -) - -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Platform)\$(Configuration)\data\" /Y -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\log" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\log\" -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\var" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\var\" - - - - X64 - - - - - xcopy "$(AprDir)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -xcopy "$(AprUtilDir)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y - -if exist "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" ( -xcopy "$(AprIconvDir)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -if exist "$(AprIconvDir)\$(Configuration)\iconv" ( -if not exist "$(SolutionDir)$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Configuration)\bin\iconv" -xcopy "$(AprIconvDir)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Configuration)\bin\iconv\" /Y -) -) - -xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Configuration)\bin\" /Y -xcopy "$(SofiaDir)\win32\pthread\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Configuration)\bin\" /Y - -if not exist "$(SolutionDir)$(Configuration)\conf" ( -xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Configuration)\conf\client-profiles\" /Y -) - -if not exist "$(SolutionDir)$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Configuration)\data\" /Y -if not exist "$(SolutionDir)$(Configuration)\log" mkdir "$(SolutionDir)$(Configuration)\log\" -if not exist "$(SolutionDir)$(Configuration)\var" mkdir "$(SolutionDir)$(Configuration)\var\" - - - - - - xcopy "$(AprDir)\$(Platform)\$(Configuration)\libapr-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -xcopy "$(AprUtilDir)\$(Platform)\$(Configuration)\libaprutil-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y - -if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" ( -xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\libapriconv-1.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -if exist "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv" ( -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv" -xcopy "$(AprIconvDir)\$(Platform)\$(Configuration)\iconv\*.so" "$(SolutionDir)$(Platform)\$(Configuration)\bin\iconv\" /Y -) -) - -xcopy "$(SofiaDir)\win32\libsofia-sip-ua\$(Platform)\$(Configuration)\libsofia_sip_ua.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y -xcopy "$(SofiaDir)\win32\pthread\$(Platform)\$(Configuration)\pthreadVC2.dll" "$(SolutionDir)$(Platform)\$(Configuration)\bin\" /Y - -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\conf" ( -xcopy "$(SolutionDir)conf\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\*.xsd" "$(SolutionDir)$(Platform)\$(Configuration)\conf\" /Y -xcopy "$(SolutionDir)conf\client-profiles\*.xml" "$(SolutionDir)$(Platform)\$(Configuration)\conf\client-profiles\" /Y -) - -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\data" xcopy "$(SolutionDir)data\*" "$(SolutionDir)$(Platform)\$(Configuration)\data\" /Y -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\log" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\log\" -if not exist "$(SolutionDir)$(Platform)\$(Configuration)\var" mkdir "$(SolutionDir)$(Platform)\$(Configuration)\var\" - - - - X64 - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/tools/unimrcp_service.c b/libs/unimrcp/build/tools/unimrcp_service.c deleted file mode 100644 index db2ed39bab..0000000000 --- a/libs/unimrcp/build/tools/unimrcp_service.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: unimrcp_service.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include -#include "apt.h" -#include "apt_pool.h" - -#define WIN_SERVICE_NAME "unimrcp" - -/** UniMRCP service register command enumeration */ -typedef enum uni_service_register_e { - USR_NONE, USR_REGISTER, USR_UNREGISTER -} uni_service_register_e; - -/** UniMRCP service control command enumeration */ -typedef enum uni_service_control_e { - USC_NONE, USC_START, USC_STOP -} uni_service_control_e; - - -/** Display error message with Windows error code and description */ -static void winerror(const char *msg) -{ - char buf[128]; - DWORD err = GetLastError(); - int ret = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - buf, sizeof(buf), NULL); - printf("%s: %lu %.*s\n", msg, err, ret, buf); -} - -/** Register/install service in SCM */ -static apt_bool_t uni_service_register(const char *root_dir_path, apr_pool_t *pool, - const char *name, - apt_bool_t autostart, - unsigned long recover, - int log_priority, - const char *disp_name, - const char *description) -{ - apr_status_t status; - char buf[4096]; - static const size_t len = sizeof(buf); - size_t pos = 0; - char *root_dir; - SERVICE_DESCRIPTION desc; - SC_HANDLE sch_service; - SC_HANDLE sch_manager; - - /* Normalize root directory path and make it absolute */ - status = apr_filepath_merge(&root_dir, NULL, root_dir_path, - APR_FILEPATH_NOTRELATIVE | APR_FILEPATH_NATIVE | APR_FILEPATH_TRUENAME, pool); - if (status != APR_SUCCESS) { - printf("Error making root directory absolute: %d %.512s\n", status, - apr_strerror(status, buf, 512)); - return FALSE; - } - buf[pos++] = '"'; - pos = apr_cpystrn(buf + pos, root_dir, len - pos) - buf; - if ((buf[pos - 1] != '\\') && (pos < len)) - /* Add trailing backslash */ - buf[pos++] = '\\'; - pos = apr_cpystrn(buf + pos, "bin\\unimrcpserver.exe\" --service -o 2", len - pos) - buf; - if (log_priority >= 0) { - pos = apr_cpystrn(buf + pos, " -l ", len - pos) - buf; - if (pos < len - 34) - pos += strlen(itoa(log_priority, buf + pos, 10)); - } - if (name) { - pos = apr_cpystrn(buf + pos, " --name \"", len - pos) - buf; - pos = apr_cpystrn(buf + pos, name, len - pos) - buf; - if ((buf[pos - 1] == '\\') && (pos < len)) - /* `\"' might be misinterpreted as escape, so replace `\' with `\\' */ - buf[pos++] = '\\'; - if (pos < len) - buf[pos++] = '"'; - } - pos = apr_cpystrn(buf + pos, " --root-dir \"", len - pos) - buf; - pos = apr_cpystrn(buf + pos, root_dir, len - pos) - buf; - if ((buf[pos - 1] == '\\') && (pos < len)) - /* `\"' might be misinterpreted as escape, so replace `\' with `\\' */ - buf[pos++] = '\\'; - if (pos < len) - buf[pos++] = '"'; - if (pos < len) - buf[pos] = 0; - else { - puts("Service Command Too Long"); - return FALSE; - } - if (!disp_name || !*disp_name) { - if (name) - disp_name = apr_pstrcat(pool, name, " ", "UniMRCP Server", NULL); - else - disp_name = "UniMRCP Server"; - } - if (!description || !*description) - description = "Launches UniMRCP Server"; - - sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); - if(!sch_manager) { - winerror("Failed to Open SCManager"); - return FALSE; - } - sch_service = CreateService( - sch_manager, - name ? name : WIN_SERVICE_NAME, - disp_name, - GENERIC_EXECUTE | SERVICE_CHANGE_CONFIG, - SERVICE_WIN32_OWN_PROCESS, - autostart ? SERVICE_AUTO_START : SERVICE_DEMAND_START, - SERVICE_ERROR_NORMAL, - buf,0,0,0,0,0); - if(!sch_service) { - winerror("Failed to Create Service"); - CloseServiceHandle(sch_manager); - return FALSE; - } - - desc.lpDescription = (char *) description; - if(!ChangeServiceConfig2(sch_service,SERVICE_CONFIG_DESCRIPTION,&desc)) { - winerror("Failed to Set Service Description"); - } - - if (recover) { - SERVICE_FAILURE_ACTIONS sfa; - SC_ACTION action; - sfa.dwResetPeriod = 0; - sfa.lpCommand = ""; - sfa.lpRebootMsg = ""; - sfa.cActions = 1; - sfa.lpsaActions = &action; - action.Delay = recover * 1000; - action.Type = SC_ACTION_RESTART; - if (!ChangeServiceConfig2(sch_service,SERVICE_CONFIG_FAILURE_ACTIONS,&sfa)) { - winerror("Failed to Set Service Restart on Failure"); - } - } - - CloseServiceHandle(sch_service); - CloseServiceHandle(sch_manager); - printf("UniMRCP service %s registered\n", name ? name : WIN_SERVICE_NAME); - return TRUE; -} - -/** Unregister/uninstall service from SCM */ -static apt_bool_t uni_service_unregister(const char *name) -{ - apt_bool_t status = TRUE; - SERVICE_STATUS ss_status; - SC_HANDLE sch_service; - SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); - if (!name) name = WIN_SERVICE_NAME; - if(!sch_manager) { - winerror("Failed to Open SCManager"); - return FALSE; - } - - sch_service = OpenService(sch_manager,name,DELETE|SERVICE_STOP); - if(!sch_service) { - winerror("Failed to Open Service"); - CloseServiceHandle(sch_manager); - return FALSE; - } - - ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status); - if(!DeleteService(sch_service)) { - winerror("Failed to Delete Service"); - status = FALSE; - } else - printf("UniMRCP service %s unregistered\n", name); - CloseServiceHandle(sch_service); - CloseServiceHandle(sch_manager); - return status; -} - -/** Start service */ -static apt_bool_t uni_service_start(const char *name) -{ - apt_bool_t status = TRUE; - SC_HANDLE sch_service; - SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); - if (!name) name = WIN_SERVICE_NAME; - if(!sch_manager) { - winerror("Failed to Open SCManager"); - return FALSE; - } - - sch_service = OpenService(sch_manager,name,SERVICE_START); - if(!sch_service) { - winerror("Failed to Open Service"); - CloseServiceHandle(sch_manager); - return FALSE; - } - - if(!StartService(sch_service,0,NULL)) { - winerror("Failed to Start Service"); - status = FALSE; - } else - printf("UniMRCP service %s started\n", name); - CloseServiceHandle(sch_service); - CloseServiceHandle(sch_manager); - return status; -} - -/** Stop service */ -static apt_bool_t uni_service_stop(const char *name) -{ - apt_bool_t status = TRUE; - SERVICE_STATUS ss_status; - SC_HANDLE sch_service; - SC_HANDLE sch_manager = OpenSCManager(0,0,SC_MANAGER_ALL_ACCESS); - if (!name) name = WIN_SERVICE_NAME; - if(!sch_manager) { - winerror("Failed to Open SCManager"); - return FALSE; - } - - sch_service = OpenService(sch_manager,name,SERVICE_STOP); - if(!sch_service) { - winerror("Failed to Open Service"); - CloseServiceHandle(sch_manager); - return FALSE; - } - - if(!ControlService(sch_service,SERVICE_CONTROL_STOP,&ss_status)) { - winerror("Failed to Stop Service"); - status = FALSE; - } else - printf("UniMRCP service %s stopped\n", name); - - CloseServiceHandle(sch_service); - CloseServiceHandle(sch_manager); - return status; -} - - -static void usage() -{ - static apt_bool_t written = FALSE; - if (written) return; - printf( - "\n" - "Usage:\n" - "\n" - " unimrcpservice [options]\n" - "\n" - " Available options:\n" - "\n" - " -r [--register] rootdir : Register the Windows service.\n" - "\n" - " -u [--unregister] : Unregister the Windows service.\n" - "\n" - " -s [--start] : Start the Windows service.\n" - "\n" - " -t [--stop] : Stop the Windows service.\n" - "\n" - " -n [--name] svcname : Service name (default: unimrcp)\n" - "\n" - " -a [--autostart] : Start service after boot-up\n" - "\n" - " -f [--fail-restart] n : If crashed, restart after n secs\n" - "\n" - " -l [--log-prio] priority: Set the log priority.\n" - " (0-emergency, ..., 7-debug)\n" - " -p [--disp-name] title : Set service display name\n" - " (default: [svcname] UniMRCP Server)\n" - " -c [--description] desc : Set service description\n" - " (default: Launches UniMRCP Server)\n" - " -h [--help] : Show the help.\n" - "\n"); - written = TRUE; -} - -int main(int argc, const char * const *argv) -{ - apr_pool_t *pool; - apr_status_t rv; - apr_getopt_t *opt; - apt_bool_t ret = TRUE; - uni_service_register_e reg = USR_NONE; - uni_service_control_e control = USC_NONE; - const char *root_dir = ".."; - const char *name = NULL; - apt_bool_t autostart = FALSE; - unsigned long recover = 0; - int log_priority = -1; - const char *disp_name = NULL; - const char *description = NULL; - - static const apr_getopt_option_t opt_option[] = { - /* long-option, short-option, has-arg flag, description */ - { "register", 'r', TRUE, "register service" }, /* -r or --register arg */ - { "unregister", 'u', FALSE, "unregister service" }, /* -u or --unregister */ - { "start", 's', FALSE, "start service" }, /* -s or --start */ - { "stop", 't', FALSE, "stop service" }, /* -t or --stop */ - { "name", 'n', TRUE, "service name" }, /* -n or --name arg */ - { "autostart", 'a', FALSE, "start automatically" },/* -a or --autostart */ - { "fail-restart",'f', TRUE, "restart if fails" }, /* -f or --fail-restart arg */ - { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */ - { "disp-name", 'p', TRUE, "display name" }, /* -p arg or --disp-name arg */ - { "description", 'c', TRUE, "description" }, /* -c arg or --description arg */ - { "help", 'h', FALSE, "show help" }, /* -h or --help */ - { NULL, 0, 0, NULL }, /* end */ - }; - - /* APR global initialization */ - if(apr_initialize() != APR_SUCCESS) { - apr_terminate(); - return 1; - } - - /* create APR pool */ - pool = apt_pool_create(); - if(!pool) { - apr_terminate(); - return 1; - } - - rv = apr_getopt_init(&opt, pool , argc, argv); - if(rv == APR_SUCCESS) { - int optch; - const char *optarg; - while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) { - switch(optch) { - case 'r': - if ((reg == USR_NONE) || (reg == USR_REGISTER)) { - reg = USR_REGISTER; - root_dir = optarg; - } else { - puts("Incosistent arguments"); - ret = FALSE; - } - break; - case 'u': - if ((reg == USR_NONE) || (reg == USR_UNREGISTER)) - reg = USR_UNREGISTER; - else { - puts("Incosistent arguments"); - ret = FALSE; - } - break; - case 's': - if ((control == USC_NONE) || (control == USC_START)) - control = USC_START; - else { - puts("Incosistent arguments"); - ret = FALSE; - } - break; - case 't': - if ((control == USC_NONE) || (control == USC_STOP)) - control = USC_STOP; - else { - puts("Incosistent arguments"); - ret = FALSE; - } - break; - case 'n': - name = optarg; - break; - case 'a': - autostart = TRUE; - break; - case 'f': - if (sscanf(optarg, "%lu", &recover) != 1) { - puts("Invalid value for param --fail-restart"); - ret = FALSE; - } - break; - case 'l': - if ((sscanf(optarg, "%d", &log_priority) != 1) || - (log_priority < 0) || (log_priority > 7)) - { - puts("Invalid value for param --log-prio"); - ret = FALSE; - } - break; - case 'p': - disp_name = optarg; - break; - case 'c': - description = optarg; - break; - case 'h': - usage(); - break; - } - if (!ret) break; - } - if (ret && - (((reg == USR_REGISTER) && (control == USC_STOP)) || - ((reg == USR_UNREGISTER) && (control == USC_START)))) { - ret = FALSE; - puts("Inconsistent arguments"); - } - if((rv != APR_EOF) || !ret || (!reg && !control)) { - ret = FALSE; - usage(); - } - } - - while (ret) { /* No problem so far */ - if (reg == USR_REGISTER) - ret = uni_service_register(root_dir, pool, name, autostart, recover, log_priority, disp_name, description); - if (!ret) break; - - if (control == USC_START) - ret = uni_service_start(name); - if (!ret) break; - - if (control == USC_STOP) - ret = uni_service_stop(name); - /* Do not break here, stop failure should not matter before unregistration */ - - if (reg == USR_UNREGISTER) - ret = uni_service_unregister(name); - break; - } - - /* destroy APR pool */ - apr_pool_destroy(pool); - /* APR global termination */ - apr_terminate(); - return ret ? 0 : 1; -} diff --git a/libs/unimrcp/build/tools/unimrcpservice.exe.manifest b/libs/unimrcp/build/tools/unimrcpservice.exe.manifest deleted file mode 100644 index 3a14ebfb75..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.exe.manifest +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/libs/unimrcp/build/tools/unimrcpservice.rc b/libs/unimrcp/build/tools/unimrcpservice.rc deleted file mode 100644 index a9cebe94dc..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include "uni_version.h" - -1 VERSIONINFO - FILEVERSION UNI_VERSION_STRING_CSV,0 - PRODUCTVERSION UNI_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", UNI_LICENSE "\0" - VALUE "CompanyName", "UniMRCP\0" - VALUE "FileDescription", "UniMRCP Service Manager\0" - VALUE "FileVersion", UNI_VERSION_STRING "\0" - VALUE "InternalName", "unimrcpservice" "\0" - VALUE "LegalCopyright", UNI_COPYRIGHT "\0" - VALUE "OriginalFilename", "unimrcpservice.exe" "\0" - VALUE "ProductName", "UniMRCP Project\0" - VALUE "ProductVersion", UNI_VERSION_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcproj b/libs/unimrcp/build/tools/unimrcpservice.vcproj deleted file mode 100644 index fec552b155..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.vcproj +++ /dev/null @@ -1,326 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcxproj b/libs/unimrcp/build/tools/unimrcpservice.vcxproj deleted file mode 100644 index 63e1324ba3..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.vcxproj +++ /dev/null @@ -1,136 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25} - unimrcpservice - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - RequireAdministrator - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - RequireAdministrator - - - - - X64 - - - ProgramDatabase - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - RequireAdministrator - - - - - X64 - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - RequireAdministrator - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters b/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters deleted file mode 100644 index 8a04533143..0000000000 --- a/libs/unimrcp/build/tools/unimrcpservice.vcxproj.filters +++ /dev/null @@ -1,17 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/build/uni_revision.h b/libs/unimrcp/build/uni_revision.h deleted file mode 100644 index b7680b88cf..0000000000 --- a/libs/unimrcp/build/uni_revision.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - */ - -#ifndef UNI_REVISION_H -#define UNI_REVISION_H - -/** - * @file uni_revision.h - * @brief UniMRCP Revision - * - * This file contains the revision base number and other relevant information. - */ - -/** Revision base number. */ -#define UNI_REVISION 2208 - -/** Revision base string. */ -#define UNI_REVISION_STRING "2208" - -/** Revision base date. */ -#define UNI_REVISION_DATE "2014-10-31" - -/** Revision base stamp. */ -#define UNI_REVISION_STAMP 20141031L - - -/** Check at compile time if the revision base number is at least a certain level. */ -#define UNI_REVISION_AT_LEAST(rev) ((rev) < UNI_REVISION) - -#endif /* UNI_REVISION_H */ diff --git a/libs/unimrcp/build/uni_version.h b/libs/unimrcp/build/uni_version.h deleted file mode 100644 index 2e0edb9c30..0000000000 --- a/libs/unimrcp/build/uni_version.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: uni_version.h 2139 2014-07-07 05:06:19Z achaloyan@gmail.com $ - */ - -#ifndef UNI_VERSION_H -#define UNI_VERSION_H - -/** - * @file uni_version.h - * @brief UniMRCP Version - * - * UniMRCP uses a version numbering scheme derived from the APR project. - * - * APR's Version Numbering - */ - -/** major version - * Major API changes that could cause compatibility problems for older - * programs such as structure size changes. No binary compatibility is - * possible across a change in the major version. - */ -#define UNI_MAJOR_VERSION 1 - -/** minor version - * Minor API changes that do not cause binary compatibility problems. - * Reset to 0 when upgrading UNI_MAJOR_VERSION. - */ -#define UNI_MINOR_VERSION 2 - -/** patch level - * The Patch Level never includes API changes, simply bug fixes. - * Reset to 0 when upgrading UNI_MINOR_VERSION. - */ -#define UNI_PATCH_VERSION 0 - - -/** Check at compile time if the version of UniMRCP is at least a certain level. */ -#define UNI_VERSION_AT_LEAST(major,minor,patch) \ -(((major) < UNI_MAJOR_VERSION) \ - || ((major) == UNI_MAJOR_VERSION && (minor) < UNI_MINOR_VERSION) \ - || ((major) == UNI_MAJOR_VERSION && (minor) == UNI_MINOR_VERSION && (patch) <= UNI_PATCH_VERSION)) - -/** Properly quote a value as a string in the C preprocessor. */ -#define UNI_STRINGIFY(n) UNI_STRINGIFY_HELPER(n) -/** Helper macro for UNI_STRINGIFY. */ -#define UNI_STRINGIFY_HELPER(n) #n - -/** The formatted string of UniMRCP's version. */ -#define UNI_VERSION_STRING \ - UNI_STRINGIFY(UNI_MAJOR_VERSION) "." \ - UNI_STRINGIFY(UNI_MINOR_VERSION) "." \ - UNI_STRINGIFY(UNI_PATCH_VERSION) - -/** An alternative formatted string of UniMRCP's version - macro for Win32 .rc files using numeric CSV representation. */ -#define UNI_VERSION_STRING_CSV UNI_MAJOR_VERSION ##, \ - ##UNI_MINOR_VERSION ##, \ - ##UNI_PATCH_VERSION - -/** The Copyright. */ -#define UNI_COPYRIGHT "Copyright 2008-2014 Arsen Chaloyan" - -/* - * Use the brief description of the license for Win32 .rc files; - * otherwise, use the full description. - */ -#if defined(APSTUDIO_INVOKED) || defined(RC_INVOKED) -/** The License (brief description). */ -#define UNI_LICENSE "The Apache License, Version 2.0" -#else -/** The License (full description). */ -#define UNI_LICENSE \ - " * Licensed under the Apache License, Version 2.0 (the ""License"");\n" \ - " * you may not use this file except in compliance with the License.\n" \ - " * You may obtain a copy of the License at\n" \ - " * \n" \ - " * http://www.apache.org/licenses/LICENSE-2.0 \n" \ - " * \n" \ - " * Unless required by applicable law or agreed to in writing, software\n" \ - " * distributed under the License is distributed on an ""AS IS"" BASIS,\n" \ - " * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n" \ - " * See the License for the specific language governing permissions and\n" \ - " * limitations under the License.\n" -#endif /* APSTUDIO_INVOKED || RC_INVOKED */ - -#endif /* UNI_VERSION_H */ diff --git a/libs/unimrcp/build/vsprops/apr.vsprops b/libs/unimrcp/build/vsprops/apr.vsprops deleted file mode 100644 index a37045dcd8..0000000000 --- a/libs/unimrcp/build/vsprops/apr.vsprops +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/libs/unimrcp/build/vsprops/apt.vsprops b/libs/unimrcp/build/vsprops/apt.vsprops deleted file mode 100644 index e5d8b57780..0000000000 --- a/libs/unimrcp/build/vsprops/apt.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mpf.vsprops b/libs/unimrcp/build/vsprops/mpf.vsprops deleted file mode 100644 index 6e051d8607..0000000000 --- a/libs/unimrcp/build/vsprops/mpf.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcp.vsprops b/libs/unimrcp/build/vsprops/mrcp.vsprops deleted file mode 100644 index c51b241a53..0000000000 --- a/libs/unimrcp/build/vsprops/mrcp.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpclient.vsprops b/libs/unimrcp/build/vsprops/mrcpclient.vsprops deleted file mode 100644 index 0a866442f2..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpclient.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpengine.vsprops b/libs/unimrcp/build/vsprops/mrcpengine.vsprops deleted file mode 100644 index 5108cf30d3..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpengine.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpserver.vsprops b/libs/unimrcp/build/vsprops/mrcpserver.vsprops deleted file mode 100644 index 11932f804c..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpserver.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops b/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops deleted file mode 100644 index 170a8ea14d..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpsignaling.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops b/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops deleted file mode 100644 index 88d046158d..0000000000 --- a/libs/unimrcp/build/vsprops/mrcpv2transport.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops deleted file mode 100644 index 09ca2cd194..0000000000 --- a/libs/unimrcp/build/vsprops/sdk/unimrcpclient.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops deleted file mode 100644 index 96fb0cfed1..0000000000 --- a/libs/unimrcp/build/vsprops/sdk/unimrcpplugin.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops deleted file mode 100644 index f5cd0d311a..0000000000 --- a/libs/unimrcp/build/vsprops/sdk/unimrcpsdk.vsprops +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - diff --git a/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops b/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops deleted file mode 100644 index df5df74f97..0000000000 --- a/libs/unimrcp/build/vsprops/sdk/unimrcpserver.vsprops +++ /dev/null @@ -1,12 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/sofiasip.vsprops b/libs/unimrcp/build/vsprops/sofiasip.vsprops deleted file mode 100644 index 2b5b65653b..0000000000 --- a/libs/unimrcp/build/vsprops/sofiasip.vsprops +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unibase.vsprops b/libs/unimrcp/build/vsprops/unibase.vsprops deleted file mode 100644 index 2d64884ea8..0000000000 --- a/libs/unimrcp/build/vsprops/unibase.vsprops +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - diff --git a/libs/unimrcp/build/vsprops/unibin-x64.vsprops b/libs/unimrcp/build/vsprops/unibin-x64.vsprops deleted file mode 100644 index 6348c8dac2..0000000000 --- a/libs/unimrcp/build/vsprops/unibin-x64.vsprops +++ /dev/null @@ -1,19 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unibin.vsprops b/libs/unimrcp/build/vsprops/unibin.vsprops deleted file mode 100644 index 016f9973db..0000000000 --- a/libs/unimrcp/build/vsprops/unibin.vsprops +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/unidebug.vsprops b/libs/unimrcp/build/vsprops/unidebug.vsprops deleted file mode 100644 index 0cbede51a2..0000000000 --- a/libs/unimrcp/build/vsprops/unidebug.vsprops +++ /dev/null @@ -1,23 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unilib-x64.vsprops b/libs/unimrcp/build/vsprops/unilib-x64.vsprops deleted file mode 100644 index ba029c0699..0000000000 --- a/libs/unimrcp/build/vsprops/unilib-x64.vsprops +++ /dev/null @@ -1,17 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unilib.vsprops b/libs/unimrcp/build/vsprops/unilib.vsprops deleted file mode 100644 index 32ea070327..0000000000 --- a/libs/unimrcp/build/vsprops/unilib.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/unimrcpclient.vsprops b/libs/unimrcp/build/vsprops/unimrcpclient.vsprops deleted file mode 100644 index 8f1edceebd..0000000000 --- a/libs/unimrcp/build/vsprops/unimrcpclient.vsprops +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/unimrcpserver.vsprops b/libs/unimrcp/build/vsprops/unimrcpserver.vsprops deleted file mode 100644 index 8f812676ea..0000000000 --- a/libs/unimrcp/build/vsprops/unimrcpserver.vsprops +++ /dev/null @@ -1,16 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops b/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops deleted file mode 100644 index 44f4057e3f..0000000000 --- a/libs/unimrcp/build/vsprops/uniplugin-x64.vsprops +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/libs/unimrcp/build/vsprops/uniplugin.vsprops b/libs/unimrcp/build/vsprops/uniplugin.vsprops deleted file mode 100644 index a794952a06..0000000000 --- a/libs/unimrcp/build/vsprops/uniplugin.vsprops +++ /dev/null @@ -1,16 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/unirelease.vsprops b/libs/unimrcp/build/vsprops/unirelease.vsprops deleted file mode 100644 index bb1f511e93..0000000000 --- a/libs/unimrcp/build/vsprops/unirelease.vsprops +++ /dev/null @@ -1,15 +0,0 @@ - - - - diff --git a/libs/unimrcp/build/vsprops/unirtsp.vsprops b/libs/unimrcp/build/vsprops/unirtsp.vsprops deleted file mode 100644 index b46259472a..0000000000 --- a/libs/unimrcp/build/vsprops/unirtsp.vsprops +++ /dev/null @@ -1,13 +0,0 @@ - - - - diff --git a/libs/unimrcp/conf/Makefile.am b/libs/unimrcp/conf/Makefile.am deleted file mode 100644 index ca84a04bca..0000000000 --- a/libs/unimrcp/conf/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -CONFFILES = logger.xml dirlayout.xml - -if UNIMRCP_CLIENT_LIB -CONFFILES += unimrcpclient.xml unimrcpclient.xsd -endif - -if UNIMRCP_SERVER_LIB -CONFFILES += unimrcpserver.xml unimrcpserver.xsd -endif - -if UMC -CONFFILES += umcscenarios.xml -endif - -def-conf: - test -d $(DESTDIR)$(sysconfdir) || $(mkinstalldirs) $(DESTDIR)$(sysconfdir) - for conffile in $(CONFFILES) ; do \ - $(INSTALL) -m 644 $(top_srcdir)/conf/$$conffile $(DESTDIR)$(sysconfdir); \ - done -if UNIMRCP_CLIENT_LIB - test -d $(DESTDIR)$(sysconfdir)/client-profiles || $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/client-profiles - for conffile in `find $(top_srcdir)/conf/client-profiles/ -maxdepth 1 -name \*.xml -o -name \*.xsd` ; do \ - filename=`echo $$conffile | sed -e 's|^.*/||'`; \ - $(INSTALL) -m 644 $(top_srcdir)/conf/client-profiles/$$filename $(DESTDIR)$(sysconfdir)/client-profiles; \ - done -endif - -install-data-local: - test -d $(DESTDIR)$(sysconfdir) || $(MAKE) def-conf diff --git a/libs/unimrcp/conf/client-profiles/lumenvox.xml b/libs/unimrcp/conf/client-profiles/lumenvox.xml deleted file mode 100644 index 4b592a5450..0000000000 --- a/libs/unimrcp/conf/client-profiles/lumenvox.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - 5060 - - - - - - - - 554 - - - - - - - - - - - - SIP-Agent-1 - MRCPv2-Agent-1 - Media-Engine-1 - RTP-Factory-1 - LumenVox-SIP-Settings - RTP-Settings-1 - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - LumenVox-RTSP-Settings - RTP-Settings-1 - - - - - diff --git a/libs/unimrcp/conf/client-profiles/nuance.xml b/libs/unimrcp/conf/client-profiles/nuance.xml deleted file mode 100644 index 8725703ab0..0000000000 --- a/libs/unimrcp/conf/client-profiles/nuance.xml +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - - - 5060 - - - - - - - - - 4900 - - media - - - - - - - - - - 1 - 50 - 600 - 1 - - 20 - PCMU PCMA L16/96/8000 telephone-event/101/8000 - - - - 2 - - 5000 - - 1000 - - - - - - - - - SIP-Agent-1 - MRCPv2-Agent-1 - Media-Engine-1 - RTP-Factory-1 - Nuance-SIP-Settings - Nuance-RTP-Settings - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - Nuance-RTSP-Settings - Nuance-RTP-Settings - - - - - diff --git a/libs/unimrcp/conf/client-profiles/speechpro.xml b/libs/unimrcp/conf/client-profiles/speechpro.xml deleted file mode 100644 index 9f765bef61..0000000000 --- a/libs/unimrcp/conf/client-profiles/speechpro.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - 8000 - - - - - - - - - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - SpeechPro-RTSP-Settings - RTP-Settings-1 - - - - - diff --git a/libs/unimrcp/conf/client-profiles/unimrcp.xml b/libs/unimrcp/conf/client-profiles/unimrcp.xml deleted file mode 100644 index e29d8784fd..0000000000 --- a/libs/unimrcp/conf/client-profiles/unimrcp.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - 8060 - - - - - - - - 1554 - - media - - - - - - - - - - - SIP-Agent-1 - MRCPv2-Agent-1 - Media-Engine-1 - RTP-Factory-1 - UniMRCP-SIP-Settings - RTP-Settings-1 - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - UniMRCP-RTSP-Settings - RTP-Settings-1 - - - - - diff --git a/libs/unimrcp/conf/dirlayout.xml b/libs/unimrcp/conf/dirlayout.xml deleted file mode 100644 index 45df55ba7e..0000000000 --- a/libs/unimrcp/conf/dirlayout.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - conf - plugin - log - data - var - diff --git a/libs/unimrcp/conf/logger.xml b/libs/unimrcp/conf/logger.xml deleted file mode 100644 index 73ae9b5cac..0000000000 --- a/libs/unimrcp/conf/logger.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - INFO - - - CONSOLE - - - DATE,TIME,PRIORITY - - - NONE - diff --git a/libs/unimrcp/conf/umcscenarios.xml b/libs/unimrcp/conf/umcscenarios.xml deleted file mode 100644 index d5c713e201..0000000000 --- a/libs/unimrcp/conf/umcscenarios.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/conf/unimrcpclient.xml b/libs/unimrcp/conf/unimrcpclient.xml deleted file mode 100644 index cc23b9bc03..0000000000 --- a/libs/unimrcp/conf/unimrcpclient.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8062 - udp - UniMRCP SofiaSIP - UniMRCPClient - - - - - - - - - - - 100 - - UniMRCPClient - - - - - 100 - false - 1024 - 1024 - - - - - - 1 - - - - - - - - 4000 - 5000 - - - - - - - - 1 - 50 - 600 - 1 - - 20 - PCMU PCMA L16/96/8000 telephone-event/101/8000 - - - - - 1 - - 5000 - - 1000 - - - - diff --git a/libs/unimrcp/conf/unimrcpclient.xsd b/libs/unimrcp/conf/unimrcpclient.xsd deleted file mode 100644 index b8e53bbf1f..0000000000 --- a/libs/unimrcp/conf/unimrcpclient.xsd +++ /dev/null @@ -1,277 +0,0 @@ - - - - - UniMRCP client document - - - - - - Generic properties - - - - - - - - - - - - - - - - - - - - - - - - Common components - - - - - - Factory of MRCP resources - - - - - - - - - - - - - - - SIP signaling agent - - - - - - - - - - - - - - - - - - - - - - - - RTSP signaling agent - - - - - - - - - - - - - - - MRCPv2 connection agent - - - - - - - - - - - - - - - - Media processing engine - - - - - - - - - - - - Factory of RTP terminations - - - - - - - - - - - - - - - - - - Settings - - - - - - SIP settings - - - - - - - - - - - - - - - RTSP settings - - - - - - - - - - - - - - - - - - - - - - - - - - - RTP settings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Profiles - - - - - - MRCPv2 profile - - - - - - - - - - - - - - - - - MRCPv1 profile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/conf/unimrcpserver.xml b/libs/unimrcp/conf/unimrcpserver.xml deleted file mode 100644 index b431acf313..0000000000 --- a/libs/unimrcp/conf/unimrcpserver.xml +++ /dev/null @@ -1,166 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 8060 - udp,tcp - - UniMRCP SofiaSIP - UniMRCPServer - - - - - - - - - - - - - - 1554 - - - - - - 100 - UniMRCPServer - - - - - - - 1544 - 100 - false - 1024 - 1024 - - - - - 1 - - - - - - - - 5000 - 6000 - - - - - - - - - - - - - - - - - - 1 - 50 - 600 - 1 - - 20 - PCMU PCMA L16/96/8000 telephone-event/101/8000 - - - - - 1 - - 5000 - - 1000 - - - - - - - - - SIP-Agent-1 - MRCPv2-Agent-1 - Media-Engine-1 - RTP-Factory-1 - RTP-Settings-1 - - - - - - - RTSP-Agent-1 - Media-Engine-1 - RTP-Factory-1 - RTP-Settings-1 - - - - - diff --git a/libs/unimrcp/conf/unimrcpserver.xsd b/libs/unimrcp/conf/unimrcpserver.xsd deleted file mode 100644 index f8222c84d5..0000000000 --- a/libs/unimrcp/conf/unimrcpserver.xsd +++ /dev/null @@ -1,277 +0,0 @@ - - - - - UniMRCP server document - - - - - - Generic properties - - - - - - - - - - - - - - - - - - - Common components - - - - - - Factory of MRCP resources - - - - - - - - - - - - - - - SIP signaling agent - - - - - - - - - - - - - - - - - - - - - - - - - RTSP signaling agent - - - - - - - - - - - - - - - - - - - - - - - - - - - - - MRCPv2 connection agent - - - - - - - - - - - - - - - - - Media processing engine - - - - - - - - - - - - Factory of RTP terminations - - - - - - - - - - - - - - - Factory of plugins (MRCP engines) - - - - - - - - - - - - - - - - - - - - - - - - - - - - Settings - - - - - - RTP settings - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Profiles - - - - - - MRCPv2 profile - - - - - - - - - - - - - - - - MRCPv1 profile - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/config.layout b/libs/unimrcp/config.layout deleted file mode 100644 index 1d3472c1e9..0000000000 --- a/libs/unimrcp/config.layout +++ /dev/null @@ -1,26 +0,0 @@ -## -## config.layout -- Pre-defined Installation Path Layouts -## -## Hints: -## - layouts can be loaded with configure's --enable-layout=ID option -## - when no --enable-layout option is given, the default layout is `classic' - -# Classical UniMRCP path layout. - - prefix: /usr/local/unimrcp - exec_prefix: ${prefix} - bindir: ${exec_prefix}/bin - sbindir: ${exec_prefix}/bin - libdir: ${exec_prefix}/lib - libexecdir: ${exec_prefix}/modules - mandir: ${prefix}/man - sysconfdir: ${prefix}/conf - confdir: ${prefix}/conf - datadir: ${prefix}/data - plugindir: ${exec_prefix}/plugin - logdir: ${exec_prefix}/log - vardir: ${exec_prefix}/var - installbuilddir: ${exec_prefix}/build - includedir: ${prefix}/include - localstatedir: ${prefix} - diff --git a/libs/unimrcp/configure.ac b/libs/unimrcp/configure.ac deleted file mode 100644 index 851f56d71b..0000000000 --- a/libs/unimrcp/configure.ac +++ /dev/null @@ -1,285 +0,0 @@ -dnl -dnl Autoconf configuration file for UniMRCP. -dnl -dnl Use ./bootstrap to produce a configure script. -dnl - -AC_PREREQ(2.59) - -AC_INIT([unimrcp],[1.2.0]) - -AC_CONFIG_AUX_DIR([build]) -AC_CONFIG_MACRO_DIR([build/acmacros]) - -dnl Set ac_macro_dir variable manually for autoconf 2.61 and above. -ac_macro_dir="build/acmacros" - -AC_SUBST(ac_aux_dir) -AC_SUBST(ac_macro_dir) - -dnl Include m4 macros for libtool 2. -sinclude(build/acmacros/libtool.m4) -sinclude(build/acmacros/ltoptions.m4) -sinclude(build/acmacros/ltsugar.m4) -sinclude(build/acmacros/ltversion.m4) -sinclude(build/acmacros/lt~obsolete.m4) - -AC_PREFIX_DEFAULT(/usr/local/unimrcp) - -dnl Define the directory layout. -APR_ENABLE_LAYOUT(classic, [plugindir logdir vardir]) -AC_SUBST(plugindir) -AC_SUBST(logdir) -AC_SUBST(vardir) - -dnl Reparse the configure arguments. -APR_PARSE_ARGUMENTS - -dnl Generate ./config.nice to reuse ./configure command-line. -APR_CONFIG_NICE(config.nice) - -AM_INIT_AUTOMAKE([no-define nostdinc foreign subdir-objects]) - -dnl Enable silent build rules available since automake 1.11. -m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) - -dnl Set default language. -AC_LANG_C - -AC_PROG_CC -AC_PROG_CXX -AM_PROG_CC_C_O -AC_PROG_INSTALL - -dnl Skip detection of Fortran. -m4_undefine([AC_PROG_F77]) -m4_defun([AC_PROG_F77],[]) -AC_PROG_LIBTOOL - -dnl Do not use autoconf generated compiler DEFS. -rm confdefs.h -touch confdefs.h - -dnl Check for C compiler vendor. -AX_COMPILER_VENDOR - -dnl Search for pkg-config. -AC_PATH_PROG(PKG_CONFIG, pkg-config) - -dnl Get version information. -get_version="$srcdir/build/get-version.sh" -version_hdr="$srcdir/build/uni_version.h" -plugin_version_hdr="$srcdir/libs/mrcp-engine/include/mrcp_engine_plugin.h" -UNI_DOTTED_VERSION="`$get_version all $version_hdr UNI`" -UNI_LT_VERSION="-version-info `$get_version libtool $version_hdr UNI`" -PLUGIN_LT_VERSION="-version-info `$get_version libtool $plugin_version_hdr PLUGIN`" - -AC_SUBST(UNI_DOTTED_VERSION) -AC_SUBST(UNI_LT_VERSION) -AC_SUBST(PLUGIN_LT_VERSION) - -echo "UniMRCP Version: ${UNI_DOTTED_VERSION}" - -dnl Check for the APR and APR-util libraries. -UNIMRCP_CHECK_APR -dnl Check for the Sofia-SIP library. -UNIMRCP_CHECK_SOFIA - -dnl Enable inter-library dependencies. -AC_ARG_ENABLE(interlib-deps, - [AC_HELP_STRING([--disable-interlib-deps ],[disable inter-library dependencies (might break builds)])], - [enable_interlib_deps="$enableval"], - [enable_interlib_deps="yes"]) - -AC_MSG_NOTICE([enable inter-library dependencies: $enable_interlib_deps]) -if test "${enable_interlib_deps}" = "yes"; then - link_all_deplibs=yes - link_all_deplibs_CXX=yes -else - link_all_deplibs=no - link_all_deplibs_CXX=no -fi - -dnl Enable maintainer mode. -AC_ARG_ENABLE(maintainer-mode, - [AC_HELP_STRING([--enable-maintainer-mode ],[turn on debugging and compile time warnings])], - [enable_maintainer_mode="$enableval"], - [enable_maintainer_mode="no"]) - -AC_MSG_NOTICE([enable maintainer mode: $enable_maintainer_mode]) -if test "${enable_maintainer_mode}" != "no"; then - APR_ADDTO(CFLAGS,-g) - if test "x${ax_cv_c_compiler_vendor}" = "xgnu" ; then - APR_ADDTO(CFLAGS,-Wall -Werror) - fi -fi - -dnl UniMRCP client library. -AC_ARG_ENABLE(client-lib, - [AC_HELP_STRING([--disable-client-lib ],[exclude unimrcpclient lib from build])], - [enable_client_lib="$enableval"], - [enable_client_lib="yes"]) - -AM_CONDITIONAL([UNIMRCP_CLIENT_LIB],[test "${enable_client_lib}" = "yes"]) - -dnl Sample UniMRCP client application in C. -AC_ARG_ENABLE(client-app, - [AC_HELP_STRING([--disable-client-app ],[exclude sample unimrcpclient app from build])], - [enable_client_app="$enableval"], - [enable_client_app="yes"]) - -AM_CONDITIONAL([UNIMRCP_CLIENT_APP],[test "${enable_client_lib}" = "yes" && test "${enable_client_app}" = "yes"]) - -dnl Sample UniMRCP client application in C++. -AC_ARG_ENABLE(umc, - [AC_HELP_STRING([--disable-umc ],[exclude sample unimrcpclient C++ app from build])], - [enable_umc="$enableval"], - [enable_umc="yes"]) - -AM_CONDITIONAL([UMC],[test "${enable_client_lib}" = "yes" && test "${enable_umc}" = "yes"]) - -dnl Miscellaneous ASR client library and application. -AC_ARG_ENABLE(asr-client, - [AC_HELP_STRING([--disable-asr-client ],[exclude misc ASR client lib and app from build])], - [enable_asr_client="$enableval"], - [enable_asr_client="yes"]) - -AM_CONDITIONAL([ASR_CLIENT],[test "${enable_client_lib}" = "yes" && test "${enable_asr_client}" = "yes"]) - -AM_CONDITIONAL([COMMON_CLIENT_DATA],[test "${enable_client_app}" = "yes" || test "${enable_umc}" = "yes" ||test "${enable_asr_client}" = "yes"]) - -dnl UniMRCP server library. -AC_ARG_ENABLE(server-lib, - [AC_HELP_STRING([--disable-server-lib ],[exclude unimrcpserver lib from build])], - [enable_server_lib="$enableval"], - [enable_server_lib="yes"]) - -AM_CONDITIONAL([UNIMRCP_SERVER_LIB],[test "${enable_server_lib}" = "yes"]) - -dnl UniMRCP server application. -AC_ARG_ENABLE(server-app, - [AC_HELP_STRING([--disable-server-app ],[exclude unimrcpserver app from build])], - [enable_server_app="$enableval"], - [enable_server_app="yes"]) - -AM_CONDITIONAL([UNIMRCP_SERVER_APP],[test "${enable_server_lib}" = "yes" && test "${enable_server_app}" = "yes"]) - -dnl Demo synthesizer plugin. -UNI_PLUGIN_ENABLED(demosynth) - -AM_CONDITIONAL([DEMOSYNTH_PLUGIN],[test "${enable_demosynth_plugin}" = "yes"]) - -dnl Demo recognizer plugin. -UNI_PLUGIN_ENABLED(demorecog) - -AM_CONDITIONAL([DEMORECOG_PLUGIN],[test "${enable_demorecog_plugin}" = "yes"]) - -dnl Demo verifier plugin. -UNI_PLUGIN_ENABLED(demoverifier) - -AM_CONDITIONAL([DEMOVERIFIER_PLUGIN],[test "${enable_demoverifier_plugin}" = "yes"]) - -dnl Recorder plugin. -UNI_PLUGIN_ENABLED(recorder) - -AM_CONDITIONAL([RECORDER_PLUGIN],[test "${enable_recorder_plugin}" = "yes"]) - -dnl Enable test suites. -AC_ARG_ENABLE(test-suites, - [AC_HELP_STRING([--enable-test-suites ],[build test suites])], - [enable_test_suites="$enableval"], - [enable_test_suites="no"]) - -# Enable clang address sanitizer bit build -AC_ARG_ENABLE(address_sanitizer, - [AC_HELP_STRING([--enable-address-sanitizer],[build with address sanitizer])], - [enable_address_sanitizer="$enable_address_sanitizer"], - [enable_address_sanitizer="no"]) - -if test "${enable_address_sanitizer}" = "yes"; then - APR_ADDTO(CFLAGS, -fsanitize=address -fno-omit-frame-pointer) - APR_ADDTO(CXXFLAGS, -fsanitize=address -fno-omit-frame-pointer) - APR_ADDTO(LDFLAGS, -fsanitize=address) -fi - -AM_CONDITIONAL([TEST_SUITES],[test "${enable_test_suites}" != "no"]) - -AM_CONDITIONAL(ISMAC, [test `uname -s` = Darwin]) - -AC_CONFIG_FILES([ - Makefile - libs/Makefile - libs/apr-toolkit/Makefile - libs/mpf/Makefile - libs/mrcp/Makefile - libs/mrcp-signaling/Makefile - libs/mrcpv2-transport/Makefile - libs/mrcp-engine/Makefile - libs/mrcp-server/Makefile - libs/mrcp-client/Makefile - libs/uni-rtsp/Makefile - modules/Makefile - modules/mrcp-sofiasip/Makefile - modules/mrcp-unirtsp/Makefile - plugins/Makefile - plugins/mrcp-recorder/Makefile - plugins/demo-synth/Makefile - plugins/demo-recog/Makefile - plugins/demo-verifier/Makefile - platforms/Makefile - platforms/libunimrcp-server/Makefile - platforms/libunimrcp-client/Makefile - platforms/unimrcp-server/Makefile - platforms/unimrcp-client/Makefile - platforms/libasr-client/Makefile - platforms/asr-client/Makefile - platforms/umc/Makefile - tests/Makefile - tests/apttest/Makefile - tests/mpftest/Makefile - tests/mrcptest/Makefile - tests/rtsptest/Makefile - tests/strtablegen/Makefile - build/Makefile - build/pkgconfig/Makefile - build/pkgconfig/unimrcpclient.pc - build/pkgconfig/unimrcpserver.pc - build/pkgconfig/unimrcpplugin.pc - conf/Makefile - data/Makefile - docs/doxygen.conf -]) - -AC_OUTPUT - -echo -echo '****************************** REPORT ******************************' -echo -echo UniMRCP version............... : $UNI_DOTTED_VERSION -echo -echo APR version................... : $apr_version -echo APR-util version.............. : $apu_version -echo Sofia-SIP version............. : $sofia_version -echo -echo Compiler...................... : $CC -echo Compiler flags................ : $CFLAGS -echo Preprocessor definitions...... : $CPPFLAGS -echo Linker flags.................. : $LDFLAGS -echo -echo UniMRCP client lib............ : $enable_client_lib -echo Sample UniMRCP client app..... : $enable_client_app -echo Sample UMC C++ client app..... : $enable_umc -echo Misc ASR client lib and app... : $enable_asr_client -echo -echo UniMRCP server lib............ : $enable_server_lib -echo UniMRCP server app............ : $enable_server_app -echo -echo Demo synthesizer plugin....... : $enable_demosynth_plugin -echo Demo recognizer plugin........ : $enable_demorecog_plugin -echo Demo verifier plugin.......... : $enable_demoverifier_plugin -echo Recorder plugin............... : $enable_recorder_plugin -echo -echo Installation layout........... : $layout_name -echo Installation directory........ : $prefix -echo -echo '********************************************************************' diff --git a/libs/unimrcp/configure.gnu b/libs/unimrcp/configure.gnu deleted file mode 100755 index eaca53b7f7..0000000000 --- a/libs/unimrcp/configure.gnu +++ /dev/null @@ -1,3 +0,0 @@ -#! /bin/sh -srcpath=$(dirname $0 2>/dev/null ) || srcpath="." -$srcpath/configure "$@" --with-apr=../apr --disable-shared --with-pic --with-apr-util=../apr-util --with-sofia-sip=/usr diff --git a/libs/unimrcp/data/Makefile.am b/libs/unimrcp/data/Makefile.am deleted file mode 100644 index 60b540646b..0000000000 --- a/libs/unimrcp/data/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -DATAFILES = - -if COMMON_CLIENT_DATA -DATAFILES += grammar.jsgf grammar.mixed grammar.srgs grammar.xml \ - speak.txt speak.xml \ - one-16kHz.pcm one-8kHz.pcm \ - johnsmith-16kHz.pcm johnsmith-8kHz.pcm -endif - -if DEMOSYNTH_PLUGIN -DATAFILES += demo-16kHz.pcm demo-8kHz.pcm -endif - -if DEMORECOG_PLUGIN -DATAFILES += result.xml -endif - -if DEMOVERIFIER_PLUGIN -DATAFILES += result-verification.xml -endif - -def-data: - test -d $(DESTDIR)$(datadir) || $(mkinstalldirs) $(DESTDIR)$(datadir) - for datafile in $(DATAFILES) ; do \ - $(INSTALL) -m 644 $(top_srcdir)/data/$$datafile $(DESTDIR)$(datadir); \ - done - -install-data-local: - test -d $(DESTDIR)$(datadir) || $(MAKE) def-data diff --git a/libs/unimrcp/data/demo-16kHz.pcm b/libs/unimrcp/data/demo-16kHz.pcm deleted file mode 100644 index 5341461c25df7f50f246e75e41748b576eea5431..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 70444 zcmZsD1#}#_vbLJ0dzj4ZFvEtKH=GS88)jx^<_&C^lg)-X8)jx^M#t>2Js#|7(qHYl zK6~H$-{?p!sX2d2j)6 zA{HQ&;VR`j87mlrS0E)rEEreQ3Z&J$K_}&>)lhv-%@2kmT!T64z2H~XQ1t>hwLI0U zr3SCTSl~Z-YO3Ig;Pe09QPcn455BF2>X+5p2Sc^2pi|2a)4b^(9zMvIq zd(~Vu4V-W{l4LPI*r~4mH4=H`VE67)KRHr_x zKCR7vUwxa+|C$;y|0#ol^2mHwP#v{?L9h0}zby??D@d`xe|lT(^#Z5n1$p4#oZxf8 zT$MXi+6S+}JT=AtCog!XpcJ(qf>c-OTtMGoje?v}z&SylQYjjYsbN7|{_m?wYXV%b z-D;@PT&2YSq`gZ0U>^kgLG6iu`$LmYPqkkP`lldP&||@83;K}F|5m{_>HJhdPpj8| z>ky2owff(A|NVUM3u^re>KOcXu#UmJ|E_<*lfkR{C6xzMUr>%(Vvr^(byW9%{Z#4( zX{_>z$|?Wt3i>8^Ef~4MK2&>A9nZnhQ80e~J5_M6ATOBy_bX~TcrO?WhX0PR;5bur zgX1um4%V-LuM6g*VC{n~_}`(LF5oCN9{d%Ii(s48ykL%6S}?Dm-}i zQ(S&Jn6L71fm1mr$bss&gZ!!T3(AlGTcdwt1vORMP(ZDJd!rzx-ci?vV4MH{u%Iss zXcBx+rDj1)eK*(xYD}GHgHFv;`%z7)wF>rXuzm$}3vxOMbPIa5ZU4^0!O@~pAUKZc zd}`47Gz(HPI5!7p12rtjRb#=o3TR%?6aUgt9eZj@4TIw_nEJN|gSAoX7^HV_ga*Ul zQ^ENwIBwMz6wGTVza2rIP5!)O7IoZ>%6ENIx~DQnY{vgR~Dm z6U1y)xDb!Aq-2gi}R zQUv7<^-jUMp+2L=Rj1|$r33YTAU_pc_tmF@@Ybp3rnWQqwAwqtF{-wxpxy3#u*ywBexIo2kx(ZRYM_M@&2Tj%12`+xD;%yiWCs@s z*9a5}J{rO(xD$n9Af@_fxEqNQAr=olGXHM;f8Gg$lm&$$Bcv_RdJB|dfbw)e9TvRW zW*G%p07F-{GG)8S+!`Te$xX?tRVA`3}2-?@;d~xMslnUWoDVgaBXmK)w^| zoC&Q?!vyrPA8S!6W>Gf898j_kzlSGY=9hXOzI+)!#Fy|pUATk!%s15d?0@L=2p z_s1P^Ydioqz`b#E+!pu2bs)bn?hdiucs3ph&#%IV@ELpxYW5JmodI7r0wqeIGN?ZK z9d$yJ(0H^6Z9{9&Idlx&K`+oNm>?01ZWhQFqh~wM11=Efj}}pb+3UEmC8LV+hjQ7mw9NmL$HgxWPk1JH1w z!cw#hokSY_$Ktn1^f@x{R}<^vGdTsxA6`94EXCc z{s?{L06ubq^8$ysfV0De>ScLObd}dzwHm z_D7@8Of(m*LMzZNXz@Ydl%wb>It{eC4ZZ#XJw_jZZ$6>7K${=vGtlTO%78Ep=#_-B z(L2a}g6^YBXdn6;O^2^_1iF_1PRs?09KrMOKwJe!VW)CO*{e)dx+xWu5XB+CkpGc4 z%d_PHa!0wITuF|XBW0bekwqyWiBgUvNG?f|NSTu(;>H$K18OrHZH2aEKrdG(IuJ96!^B-8 zKtzx&$SLF&@)em&{zA2(=2EAr7gPvcgziUAq5r1u(jRDsA(^sFai$?tkEy{lV@l+w zER2ix)A#77^g((xy_W7o521_Gzt9SmMt!B$P%nY(*v$SBbtbzMi1I zFjDs8-*LLKP)Ssd%N^t|(mW|lIxlt?72$-?Lx>XI2L1|+4m1fA3+Mw9p9jv*(}Bo9 zr9h{^^uWQur+`gpBdii$3o+sl@tmlYdP!#`vpihBFBex9DQQYm;1?DRLbp&nF_m~m z6eh=$*GQIXK`o_jP#&rf-JBjuFQ7Nkd+EdU5qclJnO;JVp*uhu40ICEVFA^ailTm! zhsZHx6;dFs6N`w}LXh=umSp3k7>+6YB2tcOQS=m2l0lu zKn|k1(H6x2>6htS=#BdAI-j5cGh^hNr&`eXPl zd`MtPz#r%%+!hLpv&Hvfd1;aKMXDyRk@Mt^%4MZE@C66l;74N#2Qi5JN_M2~P!)j= ze!4ZYmHEbmYZ_|?YNl!CYvyRiYPx8C(NLO)%u=QSvn0IaX!r;CWWd)ZbUThFDHouh0wr9|8?Ip zuk7jWdFNi_?&j|7p65|I)8Cum%kka!@8cH-dJE;mY;luRM&2)TN*iUmvRYZA z%vJg;wH1q!EMJzl$xGz9@=|%X{7g2$cs!>h;*B^IZ9zqdV?=fGDp`*@PnDoo&?$6z zW*D=9ImujM&NF{AvzQi)j=4e)rnU55sxI}G97Sr$gG5_Gff-{wstq%8CQ#xctZDo3 zZoCIL@d(URXJ8(@05jPsNc|1HAmiq!9ZE;jiG}1CY65N2M6!puV!G%02F5a`z2=dY zveseN>DH0fC6>qLd8TM%3w=xNC^m*kC;vplmBvz>@GC#g_r=rC{fn!5UN7g9+!48L zb9?0;&aL9ib$-e7xN3Q}dF}qKd|_d?sFT|&!*Dw!qY=bb;t!$`aSs(nz41cjZ~2zw z603`U3FU;0z{@~JpuDhCs46R znLEpk_+K{=s(RzhG^-vN?EX;_hV zqvyzlSXg8AgaGsDIkXtHMagIuF_~yUR;MWDq^3A`UiX_}qG_>Zt!;3~tq>xtQCM_X zozRE&GqzHeRAX^{CvGTHlst(4mXZQB{9cd6%{wROayfoSsAF-~$gCk*ud)_7c4qr> zmN}=omU^!GTzo09k(`LHAp*F+3H0D&GLN`~YU4lTi{g(!G(Xj6@}|2(+#6jJT!&rN z-65VT-i^M}d}`pDctqZVw-J9*6PYHgkDI4U(i@C|ai7UxE^g*cvrX5HHw=I1OX&`9 zVeD+iP0b?95?U06`zvYkUU{p0OAb?(E3x=G9)`k+%S1==BiW4FPQ9U=R1Woo`je_g z-6iXgy9f_((hPh-;pIB=D(IhKq9E)S#tPkpzQQ8mt`H}N%Pa6XRFp!R(z(Sc$7Ccom_?wjOW?jrC9KLb!NULMDepR-W6SQ6Sw8JU^1`H&Nq_u!kyI?Dcltd?v%I&y zR51-zV%l-tb;-KRx*6K}>`(eJv014kivCBQ(|NmcmS!zTUy|}PY2^2fUq^hgd^!H5 z>$k9^*D0ei59hY=Mu-nl1x<{8gxO>dgjR~UA9*jTPIRT{6H#X)>qN8-=c z$WR^75|D`ofW)~SoA5}5B6Haj+A>Cqby?W9*x%xp7tSi&qmU!f8Oz3O4gK3@vLxv! zZW1UWJj!@+FhA5~%k7!5J$2yEVc#2lFZ6x+&p%V;tUj)R{9`4O8p58^7T3?!x76+9 zzB5ZGCt9pjm-Ym7{&VgqXI9q8v}Z{*zgGR2_m+IK@%4{4&)=8$aw3UOKbYIacS@Q_ zPGXPh3!5ct*O0DZhKO;IGosAVrsytF?;_@h4Y&Veo~^IM7N-8hm!$i`v%r(UZlSzX zO<96GWEW-=dq}%l-_Dq48gF@FCGBqe@{p4uzlC(LU$8DUe>6PQ&efEnoY*6E6cYHp zz7X#(o+IuF?pf|@?uwqLo()$R)R|bDP;P%^~J3HI00P8%P0vXIEcGwUqu}weKTd z>7UsAuY!ZjaYp_D>qWiL?bsocBb6MM%kj`QE!jDGyBeq0r z2+s?>Vz*mOrsujTY)M*1MrEiN7pUex=iTYacJFW>b{jnxJqNt^e0sir;HqGd>d1|h zP>@Dt*t`4y`QQi0eNE&nYM8mGZGPzIi0GIziFadD|A>9tH z1U(zS8U74h#=ig&|^3`73@vlA8Y7dj^vw z%zh)(8@?rSR}_x=C+ccs`G}CPdG`61I>y)9UK)wKjh{=Egn+*StkSe+yL+$O?0M{Y z>ZSeN_^W{^v9B~=o}iS1JJ~ZPTwV^wkFl^*0wWzWOPj2@%VBH^W)#d7LGm_e%-#vTu&dvcBbrTo_tPx z0`lfYv9dfD4WAZNfH~EU>6)Djbc*!64 zZ}x5X-u6U!_PU3=N4Zb9%X$*Y_mS&jr$$bTNQ`k7ZV){$Hlk$pa<|K#D9)CBRD5rt zu92&?pV8~Q_wM?xTiKae-qcrVlfHy~=06iZ>Zg@RUzYd8yFwm7ZDzCdPjpp{UG&Rz zEVq+hL+FHwZhxjW`R(UxZ<;-y{P4rw^S9_*pKmq2yZ_@R08WR7&y%yvR#|OjOA=DKFVM-`UMM z(s{+%JnsYk79JK=KV-YDPWYFEW|1diP)SR<+%n6HPcApEBwu)O+2rVzJC*Us3>vdVrv>|Nxkm}>FO6Q32j zSXd~$vhbur7ZL`=t&DCOaU|ruCDq{O!kHn2B!3r*@-Mx)?isGhc^{lxoJXBh-pagM zF41+}J;PJjd(><9wej`xHS%Hadauqq)N|fVyF0p0<(102;hgCl=$!7n>HMTr4Lur~ zWFT(4F7Y^GKa>sVs zvdGli&{wyY>%dL|DSVWs6?=l4uRCdoH1D#O3i&H6Ey5ACEhaVgdR$CAANN~aq1dU> zeIv8NN`+Lj7Bd<3h_f&)$*Xv*JVHDZXvJ6Z5AuEUZt^aI-Q`wsh-toX+YdmFOFSf-!1y;vD-A~*GJkpYAscQPu-YjZ4OWHMDC)TWaOJAkFlO4zevOSqjex_oXZJNd$sk^J6 zWlS({vt(Ko+cSITkUv63g~;|g_G&h_WsW)BSko|9cb^MqCopN$1Tvm*;4g|7^feo$ zcE}DpnOsiZP;IbO|p&P9G;!7P1370xbeAely>Q&+{Mf5A|2~hxs*r)*lTt zobJEtFT}6r$C8CDtm(Lkh_EMAD0VYpS)#L0dQ5}JTHz}rPM8z)Q?#Av<>VK!n;7Tw z=BDR#$!?HSDNC2bJ6E{%JSkp7pGaDBhD+AY(p}|J*xht_qLjRmZ|q6TZJ)I)ZD#V% zAK$(``|A4=_4VLa=eLVLLXyj*?Z{l4^N&mLC5oalhHS!2WplV2T3&lxtJ4hyV|bT#o#r-I$-Xe!k!XuwoLIcb zgM`a*wis(vS<7a9W9=Y%Jh@!@OWf_B=(*}iaL2nsbNo5;b1OS*yPCPZJ~mKZE<;qL z4{Bz!FFA!hs?pP(P-AI^e}TJY?vgB9dgGK%KkxmZeoXw{|NH*$1AZJzs+Zh3^=bNx ztU9?Gx7KeE1!V`B#vI@t=;|9x#%4xr=xFGpZ>WpXlAMWct~t+iXTq3yOfgM0WR2C z&shgES7cVp>Xco?QOq&ZaVa;4HU$ArgRjf#lEk&VJXhTacp8nW7! zZN6aIYrJnLuK%E`sC&z8=Gtj5X)W67+9>Tl?I-PIZJc&Iw}8!LCNLN1-P8u+Jx;*m zl-F{iG+DeIxWI4cSHozi=Z*2~b~kV%_g{IX^V&O0I-{H&b0_A$%juQVCC8XEIA>ta z&g`by)3O8Ed$Nt$U9&f48*_-9X*m;eALdSQ_Ro9n8t%??pZ7Stl>fW0xBsob3O|JZ z$cF`L1lEDB&@b#1%Sa=ot&&q=K$ATOogwB@W9j$I7|m{0=1S_;>w6huj5gB_Q%lnr z(`(qnuQJv#OxBOqTl9OiL%0^)0WKE|XQr~7xF~Hc?Q8BYuDy0Wv{UA0awj-H_l|qX zwqxtC`!yb>2{VW8MOn!;#3wWfYXOkkEHxDe3C{z2_~QHt{~iA@FqN|UKfxZgqkp}B zvOmW+#DB=|^E-jdpZgQ}k^D~n0e_ai%vTEh5||&TAD{xe0_OvsfH%-pcp#J!--%De z4N_^)Tn$vlE4@L(`wg@@i-^JGb8-ju7uA$LPHUKD%w{H+`N&k(4AUIZ{G(Z`IiNYC z`JmaT`3O0kG|Mz2Aumc(OY^H{rRJh$zvgevM2&&9vrzyoacl!t*67&>nq!(v znm(Wle9jyOU6_%%LnqQaHJYkSy(Wv1JTZ-EPox4WG8b?M3pxRM(Y?4Yo`8$vrnoAg zHf1o0OJW{$YaEHOrKLhDMS(N!%hTlk@>sdLTuLV8BB1kjN#CVM zk|N1cD(J!ua!I+Z+z_6bE3cFHfiC5Zd{urZf07@_>GEgLh5vvnFFPQ_vJ88Ezl@YZ zia{x%gee`BUP?b@i!xvNq})?dL04Pe3p7$IKp%G)(3;QK1n62>R2C$(?x+{w z0rSxrzycnFmS02>1WS}6Y7xH^?TBu~IASg_8{8gZBe9QIMeHW_6MKn6!~*d1iM7N$ zVm$cYiAlt-L{Fj%yjKU%rfQ%8k0Jtqypib8;Z9;-xOYLh}Gi$%Z@? zaU%g+LC6DF5^yOFa6}`ZAS7TR;qZMEd_N4Xg#hI&ii)A)pb;z#VFgq!KUFRtNh<|d zQgu`r_O=yJRR~qIt2}Co>Y@gKFEvG7Q9aPywSroA2P~{Nw4f(oZ#@86>5c|Mx<49% z`T>441hk{W(MUjB#-qt_oebA$pi7^KrsU&kQy?`Nu#@R9PE|h*jfQX}8V1h|fNOvF zT3^%+^??$4p$-uK20ir~(5pGrssZ>)P|GsVe?`E>Knp{mou+)uSw%p-K#^>qT{57T z9{_234(H0XGvb#&hAjivST^ z2Jz+i4=8I5poE*C)a?*%%CCirckKo4JP6w4L;0B6F{tP1d`2)$nd`oBCX z1yrm6I{oUX8sJCO0V}Hq{oN2y)rR?DV+el*6r>UKe?tfxK-d88Hh?GVKu^>JR~6o? z3O(`*e5oQT4PPvt|MdhYB^FAH%E#7iP`(*ZIoQ7c$5uc^%~h)h^%t}lQSBB~n?XLm z6#?i;wKZOF9>`O@+BP*;fSBroZ>W|Y2zXva-hkHaQr^SI|O24b_xtfu!18kWe}SBQJ>k zt7y1t;SjV}5TV8@RvfIm55}#Eh~|M)Ep2n5*Ho)pCyZ^?{#NDPOc>RU{L!xB?iu-U zbq-KtsSsuWcc+6>X9)G025+cgDqPjOL6-`7nfWdwe+E%=)!8B^Kc$wC1777BC*-PD zz$&hvn_oMX;_CdOQd;c?FXRX5AIN`Fwb2N`69M=}PJTOFkjjJl1lyAZaTk2u1LgYx zIsOSxWx~B5kedS~WPx+T2vw~*R9giHd?^_REux$-Lt{XT%`m5l*a~!4ElLW3O@?YC z84BEokP~Zwm*SwWiU2p40}fN|0X~8CL;$O{8v(FJxDV(I3H)3fy?~UEk6DMqZ1n|3 zjD#D(_jlt3FjFmnnW_}-_sg(d1KMnmk54e32^ezu`(`99j(h)|?Kd_=) zfG_Bg579&xTCbc^NNDXh;Dk=Z3_v>mfzfGDW+@v0fq6$fQhK5GF!zkX?eP=hG6sAZ z)5LSs7uQC^@NrZF+mzdKMO*__gJ;5t7~-;07jH(7$r5Ox(nuMigpliqDP$i!86^^z zlqP684yU@yM}#%fX~jeAke>sZJ&WjvA`~~SDK{imk_s^yS5npyi_jQUo7~83qL1Qd zN+DthF;ZDAcf-ffI^rm?lJb+!uuZNc#^9l-0?`63gFc!okHgWpAJK!rcq?+qCjb|B zqqEp0CE|L@8PuHkh^CRNW z>V~@#XXT2-U3oH!m$xb7iP1QPC@WuwmA5`>On8-1WHp?K_al+e(X-GFG>15dKH&O_ zkyuA=AZCJo{({mUxE9bwxi4XdHD(IfReZxcr9Z%WVhN19DQFKl53yuLB7hGn%`i!q zp&AljARJNoA$70H2ZOz?ware2TqF z3t}4n9ke&YNEw|2JC63~6>beHUm0bUk|;kzf1q%jA!)@5%5CK~>H|_vJy`kb5Y_Nw zSSw6~jywrCdn=M6%Ofq3Lc~(#NHf$iocM-j;eXH+;{r9*F(7z#Q9FOAdP?sHYEhQKD*sHt( zDT$Cr%6STh0%!!tLtW(%v=$_qifEmpB@=NSz?sGoZnC8O238(3u?fdviqzqGsFA!} zX|KGI0z?(O6Up)+S%C>T3jLH8faJ6mAB4Vpqh!mSh`Pjim}Nx8PFBQqQ58Z*{E7Zn zHll6#Z{Wf(R0+RV+Q9lf2=Vd?3#1o0QlGbPY-;vBIZ`gbFYxGKa2bQG}UX+&}2v(gS^0|gg`RcI^8ptiUPUWtwo zQ_&tY5<3C!S%tC*mi&g6D8J$}1VbS-6?Y_h5q&VJEF}gJm+)IfQf9+!umx=f^gaP* zvD0Whb}P$qZ&;Cj;36Qi-p7T|JqUk8t8r~yMUj=Vz=suaZKVYkl)K6_<*__Vsj9e? zOUeV;D{qv$$W`TYa*Q%brsR*(RjI0+BMp^yNDLrcsge!i^`w4MWpOE(=hX)ZH&^T? zEf*h(cg3^fKhg^6f!r5%4tph&R9p^7y_CuFJ9#i5wJnup@+g=US+FTthTnpP3L;7p z!-+X$4iQS-go$t!{Wmq4?hbgh7G(NN%^J-c%{I++_9VNW-OFxglh{%0H8zy(&I+1l znhu(q%oEKb<{dqou18DMC{jZ;C%2MUh{J%-HiS72;a)J?w8x8(TdE<4%G+fE#ynQm zD}RCXeq5f0A1PCT?<4RbkQ6QvNzemZK$eXo`l63SQJ7l}!A$%SWV|ZG7La-$!Myq> z%+bq0o?8wxY$q5s-5{<*KCp5+3-Z?(u!dp)L#d&>kypu$fPx35PLfaDBsLaB;gRsS zus|3t^b)!Q5;|7+LpUpB3l+ra;$tyh8Y|tBB48KsOfIJ^Q<9WQAhF$sHK7^UKixwl zQ3H5t8}X3v6Gg~&Tn_duI`SUK`VB#px(2JkuOMZ9gqlwU{dW~666|PxQjh3Fj^j4!M;U(@ zBh9-_L#)5pCWkDx_ptpMvddm0G}k6t1D4vRP-6>SAKjnaElmP_3eCr*<@VATp>bdu z@A4)1PJ0e`8hRx6d3O)6bGYbEcW-dFb}O!_u0pQ8c?0v_IT>eG&e`naj(@U#WQJ#s z%y^aFH2r(pp0tx`eA>+Pni8>JBnC!bP7m~>4W zZk2YwZk@i1!DpCc{A#Rd8gJTXdTPosG3E$!NplTzYx5xU0`p$;UGq<~VAfhp7S7@| zzcTMMcQSiT(@mMi`o=ki!}^=Ld)mv~9(Jy#3saI7$>+oov=%H37Ru|Tvtp+3i?9-e zxcPiEf5$(^-_l>$&-nvBx6kK8{`$fVd9_qtULo7@9CAB3MAM2puI;N|sGkq$`VQ+c z%OP_`tH(0PKGyox@~63+F~(3|J6gM&U8xyJuOc=BdRR*7CH*E&7lsDP1xoY1c)$NX z=qz)6mHmbMef_*|D%g%Fp5HyQ-Je~qyfo*|+&Vc__Uo*-ncp%(GbW^K(qE=MPNUO@ zryDaeGfY`i9nm={xi|BUyZ3vK`L6_?if`rncq`G8dPmpO%x8CVyR_4FmGn>atqi9P zoUx^GzVWp2r_pMvXBrI}h36*HT-`j{yx;uE%vnlX>RXyvs$0S>Kg?^*<;*8ck*1-> zzYVwbFLlqfSGis63{88c7%h=+iE{|-43s_cWhq5W6h{j$0>1{H@`HH`{}41{1O0Kr z7&$@S0Cqip;8A2#@;iNtdC0ES{-Nt^>}h;$eqkzY>SDTUEM}Q*nqf*d9MWg$YH_dF zqD(D1f-Hub;OX)_`8AkFuL_LiS>Edtd@Vr}p6C<2WqhQsp6`u!q4&F|f#;4p!F|w` zl~*sXFIZNr%-NKE+mV@77Z8E|ne8(tWIoPpoRyJv+HoTLdro8L$GlDMDc;fkNr5@y zLU{^qPuQrlbY0D1R^&?Qs^}vOFAe>TPmSTG#-{G30jB<@o~Dkb7N)wUil)M*5EE;X zjXtBxm}|@eI=(WVGp;bUH`2!4hO&medab^@ZmaeYm&uA?STDf1{6ap45qJS#RvyV| zl3i*eZWRQ;>T-a~O7qG7WB$edQT~4ZKA^Xr=sy>j4QS*;WdnXplmnZmTbizHA?*QO zbHfHx6LXYpzHPF7j6KzM+g{9uY=bQq%+E~ijShoTS6&y+jn@1@w;_uVjd4#UNzzDF z#A?EUzy@B+hx*6(UU+MHU7l&48h}dK+^t;$@?w$#4EcF^|7>ag^%yaPSkpN7Bm7Ts>H54)Wi zPR}K6M0LDKP8RLLI{vz^rgx4zCvULxd(I!(@s5nl{TVCMm!xehHhEogiK?4Y$wBAdcK<@)L7=++tr z8FFCmJ#4yQ?qD8onQJ}ymy8b?vodRBg*uGc zg>yRR?t~5IXt&cd+ZWB>2#gS;UL)mgPhj%EcW2dpXI zlP`#8AS-`SoU&f7AoUfu3#oxRfnB_vUk9teP2U(_rmvQNmwy94j~^0P8b}Y65O;{< zK#P}zHN;5LO@C!ha5c2IbO-gc;i&Px@ryas(#49cF}8a4gSJ8T{Y8W&L)(CclCY1m+9NrIvC%*d;2&Rr)ZqiYuaBs#~dl ztUqDQG1jtNwotYdTe2-CWUM_RB*fmu*3x>;T*kc1SjYHXe^1w2JBzhx98^a#5fxFa zQXtTkU+Zh=J?(Db`p0R_-I5*Vc$2vzV|@DPv{gW@zA46(+sW&b$0rX@UY`6WxqXT+ z^QwuI(-Cj|@Zrheg0HNFu+|CpF`_MBN2_EwG&v%$2R} zY;Eo3LL4E>LbYMT!j6W$4*LQYV}FHp3ll@6_$2q76#G0k9^1EZ&3lG9A{+X8tw4Y;QO3N6!e41!l4So>!h0-X6Zn zzC!+5{%!u)!2UprxJx>rM8ZzF7hRF5$Q|cO=xXa{>W>lE7v`)~HGA@}U_ zfoivHpR6rG_8D#}X}V+Bp^wwi++Y>#_3fqzGiDkLDzA3}7OkYHIfosKnWyaB3YA?|Y zd6h%*FsZ6&6-3?(GgX}LH}6_cmb)w1I*oDv;ZF3tb?@}7^jN*|zJb1q`~<$Q&`W$H zH3gm4H`vWqVJc|+8mqQ~_O$-FezCEu>9MJk<%K!UTGi6ea@U+>dTSbIoM{Y!9&4}j zauioe6U!8(&JiBiKfRJ{;=4c@{++Lt_nCW~%jLY3+bgGjcAO(2t8wPIjF;&Z(l4a7 zP9xLar#?>2PA!?XIxQ^yTKbZVks#Nua@@}j&zxc1_>=xKgn>*$eThfkyaAsuZ8x6kewk+Xxq?vp<6;X!}x3+N{8+VDHpQGuCaHv zt+(E?`~7JYd!sv`{ixl>b>K#@Gc_52B7LD+kj;tjc(F22&JZ17fi#{k?Z66 zY0oD2b=N;&>w7X1*S#Po&SvE&c$3;iA?8n&?b86(8oT4+3 zXK+{W4DcTC@&1m1vqGG-M0P9P&^00stg>%08n!MsRJ%a8O25P~+StH^P5aF?E$1x> z*74R8)(_S!YbHow2Y@P3u>Lf%Tr-z8FEf2K#)IYMV*OFwBkfPl%hIex6U7vzD^PXG zHpBol8&I(J%5#w4FH3L0@-;##3MU{YNYBJq(h+H>JXIN|G)3R>LgEB5ggi>kqPjAl z=>D3;ngsS2?h{)@JAtdKeas!??g8dsowKthwzy_F!!nuFY^nq~hiC*+T{FcfSCt%s zLHGu;aJui4m+%Via_(PU3-ca3CVo9h$C0qjsPZTS@Jw!7^Smi5g@VV zy}_`^kYadX7-yu6i;Yc;O^wq*DyU%`XIKtL?>6hl>UZgO>aJ^7YelXvX9P>>bDEb- zA!Y@=jxtcOWPjp3dICCtHXzeGB`u)&%Y{zDumB1y;_vxy`n^7rf3r^A4w#sLCT8<3f$fYE#h?H&Q=R50k4XgJGJ30(t>Y8{N_MW`xq1vMl} zfI9;k0FvBFd?k{=qFy2f5~+X*t|oTDy)A?jv|69hUtsCZO ztEj2e5;(cilgWYEH-s(5(%f%c5;sbFPCHn4P*+jEQ=g_EY}jhZHq2)vR}F`K0i&78?4U#F=F}E44Nl07 zMeAU!Ml0>*1HhkUVK;gv5EkgpKl8_cB_8D)>7~8HJw-fw+ymXw?uV|kt{$#YuClIr zt_H3WuEDNmu05`!E|;smyN~;uTXIkK-1QXq?)GMQXZRlZy82(hj^YbnE$}YT1ndZ# ziPyye(gUeCV7fh&bfpvMp1Z;ct5#qwUya;NM#IS*Kh>5#M~5>bnHP*z(@XQ0CLK;s zv}FHa53{e?G}gq$bH%ypTn(-!SBxvc892;-W3RAVLF?5VM#^V+V>DPwJ!jT4RT!RL z59eBZ)Hd6a4M>yv*9nPkm1l;fqNJ@`R1<*V_(^BrN`T*j~G@9~d#kuL+g z`4xd90Vz;K7%$uqd_r$=rkEl|N`s{@}QTEDwl#Z$Owg5q}dGiEG3Y;xS+fui(T{8gSz$(55~lo&v?L5a;2n*WZ9v&m=|@ zqll42GdQVI7Le#NaL%zJ;RmcD9rVc#pl~LfdAkc|SZ<=HfP3FXr=YA8aH8#a{)xE5 za6;o0q|P81oiGkw<)0M%0kI535j=_poo@-ixD%j+YJhy#B03YD;H=pQsOMY)<~%?S zeg}_j1d9!j89;UtO9!f4w|%Rzy`Cx9`+RAuQTENXG3fO9qU^d z33~up7^O5(swwd>HU!|0C!ixgEbo+8!fBrA@+feFqDR!)OWK)S-f`Mh#)%CsjSxXVG8cN)$!eg;fR0gNaL zF!E}EYr+@=JbPF^l06=@?o+_xVG6jJ;Aa6sJsohB@qi@t1N5j1pb_l>7ynhoG5`r} z1UP7Az=>2>3eeCX3YrM`QY7G2F>oyedeS2KVR3k(95@v@tpZ4D4ZvROgATJ9Ali|FCaA|1=d)6PxtE4-mISYITLSP{ zH1L~Ro_f+f5|Gmns6$Bp8Fnk+r6%wy8Xx@cpx}R5sQ+T2o@ZCFZ&(xo(^L`ef`403 zPp}8kVD(?4+%RgKfKjMOat5?MCEx#mHT8Rb|9t_z_z0Zw9`yZhfl{i)!aJauYQ69h z;wlZF{fCn3nc>Gk*=K;+z5xFm{Nwy*-@)nD7y0kL1zLZ}|Dt+L1rGiRoRXGbc4mHE zvVrz4sG|VX57J+)x%xi_!4_$uy=rUKzEEvOL_iEefkt{jl+`;dT-EdZ7?9{RXaf(J zR8f#`9{~sCV)dT`ZUC=5hE|);Mduag{N&C?#JXEQR z&cI4{Rk}jh|^JZMxp8{8-=;@Lh=#y5Z@KsN(azldNBD>j)EcSMuP!4 z`3mUXDETNpP3|YV;mz_ptflIc_hDZ4C|!vRR2RnjaKP&XDN6C6pF~x>O`5LUL+J$A z#q|#ZbE2p9R^fjs-x*?{@Z^=D$EAp5SFK#C1 zP>&H7f69Acm1EFD*-V~Srh#pmP6?$a5b=1Ea2-3S7o?8(EM$UxmJe37f0VJ*Vq_y{ z$yVHw8UbkcLh%E^QFXDb^ppQYvt$uY`hx9?Qe7BIOi*A=#zy%Ud{u5omI3Tliz?tE z#7u>!eMA#dhvp~-b{f?Q?0k+>64jPGg3@Jz8bf_kKFX`f!Nh&Ju5u8EQT1^QNPyq) z9&$JFkI+Ya%8a5G;i;m4AHYf72-HeCO)plSkq3w#_z+>2&r==HFZ3F*tXzlIDb?zH@XUqdXW=1^XA*{ee_+Dc3l zp^CUe7BwvQ#9s}aAZn9S<)X?hY7^?hj0pr3C-DMTrh6z3d`;}ftS0`FBZyJrpX_2K zD?p>dY&Lbv57uu&4mFD2jwLk0_YV#70qF@8m5#9k#KO#bz8*SAGRkJMy?+H$7jK{! zNUiyjEQ$AO*7B5?1p2{H_N@23d>EPG)b<}jDDfKPjJtBBKojaQGmGrUx8#?wZOPAc zyl{a3!hFDqbe!-LeIV;24`KEWWWF;T=@vHg>lhv7pt}h7<$U=lh z8lxnlM%+E6l<&53UsH}~ut(PX8+V|w- zzixEDs(ipYT9H9pjYWa3(Q|`W-KTzp0_oI{FCKlTYLU3RrAl zmaMDf;H7|qpF{?%{>MQjuut(SJqVfEI>kz;bJ+uV1bR<5MopC_(p5BsIu4d5<&;w7TXGqqa4iMw^N33zOAZ1_ z!~*l*A80J@h#5qm>4rW7d;3V71_gB-EK2pxl5twgypzawxa(C#58OZ8g|w+LdxdIOvELlCz1k zBnh-AqFhDIsaG&36;_VHx%isoL_$z{1FGAZNF;b-9LxnfaSf#}iXz_;9QhGixEgGU z_0XbLL@BW2q=+zb64{#Aj^5#;fOS70~%>Y8dH3 z{fV|FqfXDj+4#FP{5a?scmEzvME?OJR`C}n*WR%fK^cmlmzyE z9bomHgFk>od=t*KcUOMOkL0rQIJuB)1!?%Ylq7u-D@yC6rP6Qmbih>;WXf4~X< zYj`2QhB1-Kx#gyj8S^PY8MNuR&zWa`2bZfPA#J9F=as`IF4Jzz1Hp4g&W!$ ztC|W~$^&j(&g?KZvb;4fwUjk?H}5u{gA;pmbn&`M+(338SR)Of?hrSS4*#O0N^#O~ zafe_QP@osT#oriq_RoALeVu#}zT@6u-iltq+k$PBy|9*Iw+51_pODHQpM6!JE;mhQliup2DP?qjuF zCvF*ch`YdD1iS7n+%(uzM{*z84eW0$$KKG)&{Wg7nd8iGrX-U_AAtXlCTI3XB4XTGfqcv0>=(#FthI3{usdecx z_07#MO-+F+t*xy>>e|oP?Y7O<%GUMf-z`5(XH1v%N4Wu-+muMwLu-|f;`G1>|5MK_ z_wc+r&iOgDvky9cag26|pxc@R8b6!kjl%@z9p2>r>iox9FE0n|;}^M0dX@t%EPziA z^3L$C_U`iD^Rl2lxd3{UA^tc1F?_>7GhvLlPx>lH;=br6QJcC0Gtfh}9H84r^|uX| zjcZJe%`eQ=EmJJ3EYkqndu488K55dJS{P>;_UNzbUT9Nbk6o1gU9*`<1>1>zR5Z1N ztUx{k+wk&)1FWdW!!AYvZkvnif+hG-r6=e>j>xU#O!$Y2BGN5!kZ2Mw31i?t2z-Hu z0VG|5|7}<-_md7QrO9VxGv>PHoc1r>DcvYzqWP<>zU{Cr&z>0CHKI!R-0<?-77pxyfuB-eY`KsAMXzZL(^NnnSh4seFk3z(136DeehL> za|V~;tWpg)`x~R|!nMG9>K462Gl8qB`>G#od}=aU;;gdufGyEJ*gnJF6A;;1w!79$ zi^uFRy)mAIQ%UW030fcfMf0A4HJI)|9R{uDcGwxGz^pwEY|6^Rt^k4U;eFW0OaPiG zFyeYE3jFg+0%%i9N{2xca|+JPyo7&Bi444eQ%2+Xo_u$HIRF1xItwVLuJ-FES8{LM zlkveR?oix|6fN$>y+F}IaRx71C|2Cv-Cc@1jQeEbo?OYd-~am7td_2>vPe(PJ@+}! zv-fYW4c`e9kzSFrk#+q4bdRgR-*_fnNGHkOurWoV=BehT=8^ty<8#Xyv&;O8wO1UU zurdB}{64G2GTl_DPc@|K)Y^DuXJ!UfTe>!uz?Vdx2X+1jo+hp`&gS-VrOQe-7SAl+ zTs*R5Q;8WW0Jlvn?c^X_gWP|6dU{3gW#4pv+rYa(E3DUK?6gKfHh3j441J;(Aa%U= z(}7lj^#L((B=~peQMgL<1lLl?6L&}^57YN%8@%IY0}h#RMnIb`E&LNvjv2LtCR=l>M5cQ@dA9CRyfJS;5>bmyoP4; z610Q!p-+#Kd_XUyTMNsubD`=l<&lyyvla|KjwPw5J59_)3 zDsgM#R$F|gw#I8ZL6@iTtA{Go%v`Fz^iXUDe>GYh`Zdtl_tu@~D(h_TC@D=Xjo1op z|CHV-?QUOc=k3oOPn}KNeLN$)Ztrm4Q(txeMZXratO0?Bfq?(8e~6#X`qZ##g>W@C@V|(iM)?n%B5lsw;q~Qi-UZK?;zyFx)6P#7+f2BBz;NErFG0k*-PdjbBQfdq$_r-5|t?`uWF83 z&`edcnl7qFsyj-b;;b@B!O71tL%@T0NFFB35=W%zvAyCPp$9KO%a9iRJ5o8475)cq zqiWE&90>grIv2{u+n`psX4n~e5ITr%@maWUc7#TTGJ;)#iBMcM2tL9p=lN&*v;2($ z^8;l9)11jkRY2aR(x_j_ zNn|p4f%Fjf;O8ko-^?gA5i3xCY9+Jr=I<&UE!i7eE4~xoivNm>W6#hdTq6YeKjD8- z#Ps37ZeOuT?@WUe>{|2z|Sl{T1Z%>dWtDm-Mh#Wv`G?Ejx$ zRBQ*z%NMAh2cWWe0)E5_aa7DBeifgJUxj?|bt=UE5No2-W)t_vH^dYLfF6a)fml`Ew@VPQ^H|&qTi5b6ZkmLob!2dDB z;5nDn!9?X9{=f3@oU5fGRMdar^xq4TPfsX@Gf@+&rJM0SZY=2l#jg#ufLS=h$wgayJe)SnCZ>HH@=(TxR0xBx2G3w|R!TB$-N zUlBEGcQGD6QQ;TyJ)W9vu~u-ttisAmrD~~Ha#wN?m3A5&WgUq%#5SS~*h-B_JCRQ~ zK;@`{MmWuN&^dSJ4{#H?irf(NGJ?_U=+@}D z=;>$^P{O)#W4WE&D*g>$4!z+I!ZEPY?tnyeQqmR`_F*D}m`hdz@vJ`GomR`X$lk~V zSu5rnL$hAyHsfH1vh`UzGl{9kbYp&C&dcn0YFT;<-rZBkCeU=ZgJPo}DjZp?4|e=` z;U#9B-|=?wM|GHIT*1`f7Pu>!rjKTs z=3mV|%?8axOo5zdXUtA^b0Jn?l0=-5;^afXn{{@qk1)M_YBs2phX>;uJ|CnLKIPx5IAE)Ry zW*kc?1}b<(fpVJavU)-%&naHX_d`orR+dQ(AZ^l#=rDB^ z&T#Fbcf#F6xq*fL_E;mm$Kr16n&y1uXyy29-(nw+x$tEB4tt^fXUv92J1wpZ*A@2x z&t6o75B;`4T&OF!Vh^JvriTl~YcZ!J8PCvAYBGGJqnV%CGV*-+7AQe)D;ub`sR}_e z`$^qT-3PkZICZ9KGbU{>m3@?N6fG17mkL$0-}0&dE^WiRkMcj7ei- zpxEyuJmr7k3%O;e@v_0<8W(LAO^i}d=lLU1yhqDKTSdo4x4;cba&5RY_(84wX#OHk zW3sthY!{m-PJ-9rxO6pwWM~8I;5PTxWm?F;^`krl~fm#3B^%I_){?Kr+jrh zlU$D-z3c(o^OCd04~oKt0}Aa0M+>$T>@WCKP^0ivVeg`pVnvD0R0f(cr#tr>K|vM`#p#B^gX)klpCBKqt4r{Bj=j8Uyjoe%4IUI<>#({?)zI73lJG z&ve^CH413cw1oCI%`>%C-4Cp|Yl?Jv6q3gunC7yc^jK;k?#;L1Mzz2Vuu05<4u3n( z@Jl#3Zj&vdb|`*+i?l|qr-~48)@maaB5fk$Biq0SQbfB%H%Bw0HMm9GN3I$a3*Y(r z!U0gzmWZRpDzR5m6}gi*M}!EHzEAgOCPH0x3OC$As)|r}uhDsRwG0yttxSKKDw(gE z6D_IM^_Jt7mr$5AG>zhJrm91nI-C3UgNcNN_#NP2MqJ6_;u+(?ibKZ5s z;VB(#%PQVdG_bI5!R-8(dHwVBd19_2uT9>+d6n|B^6wPfE6gmil#H{zFYWCpajti_ z@{+(G3fDCX8`dT2TAYF$j%ADYo?`uqCx z`c?W)darId)SG?e@J&@CQrrM!zWb2 zcja$kqW%c1MrrgyWEzxwrbswk9L@$--)tFO0ZL;9ZZ_2U<@ve% zdwz~M9{natJSyJ8r%WX)p?resO%LHQg7sXCyXsP3t`rrTv;pa@GcsV%)MWvvga zx;S%utGE_%sn!RUmX;3YHKv1xwt7)xQmd3ao6Ibxv_!SoF}_;#Mrdjv;JxbZj~ibD z+r;9$!WjiE^38d5bLYX=|1A4Kb~w9h&YPUsxjpj+=KocYU)Zbod&%t5Dh`+PiTk8? zn?Ef$Ej%FFf=>|xu{+Ya_SZ}C_sS?uQSre($lhQaz7IE$jF(&$T5;9Fe+K;CjqXj(vG%`h8;d^|wkr_w;`0XN7Uay$>6J4y=V(s- zTvu*U9-rT&aD9=iWUsA{y@FHXF7mwf-3got{To@sO%uAt;-w#m1(aE~9R!bG6?>GA zRIk-{G+VUYbuQg>{dfHjh5?4DhDnC*h6KZZ`f+-vZkXI{i~gHhPp*f{ZJ*>Sx?PmmR9M8nNk^LaOSi(3=>M0A5grY1Rrnn;z%mMFfeMr-$~1L`B{ zhPs}n7v`bXHD;M*pm~q^g(YZd5?99Z#MI01Oy||s&{);w6fWi?y7^6Gb$LUyX6Um2 zq{r|4(@xk-#YEw%e0kp2oVVG|tOZ#=W{t_ZkkutSA;+5AHE&;jgF;);%aX^X?;K8- z&fCI2KDaG>KU%=^q9}0^kExZiy6k;Nb{x;0eFVL50ZMtN$-kKY~DDFrcYyDteYMElG8>g`h zHg(cp(~MDTm2c%eWE)7mB$qEAeHonPS9mHoZMHteLkm0PAIV*p&1CJ)$VlIlz9Bs? zJtgCO#<0x!S<;+mxzF?O7Je=c*jhM_xhi?j_tzrYUUe#gqlTmBvPb&ELVIdyyCxdzG!lEK;&>(7M>fDhIYXdp$X;%UIZQnUIvN+ z+F(2I1>a-UR)t)lLC|uvh+K@+h#rlW<2=F;N!Qpwai(xj(vTWPZ(>dIPjZIc$u?I_ z)UGluG*va{8CDx!nAO%!2}|NTB@B!+THcv+P2DVKjW+#e%@(B-&*TYu9++d==&@iW ze`n81S6REi_~(MdxfODpSyQs=X4c8@ejoLH+xM>N`!fE^ESudi=W*`Q{O^T7m+UE( zIDd9u^41UB3jG*e%pVg^NKO%_sDrZEtVS_Wxl46T{aTZb-E~0U$?(Kb!BuGTT@d{T^W1K1J}iF)N|G8Qgo`ONSjLZs64;p zY5Wp(My!$E;lm+KXiYFV_%N_2&@)g!P%Qw}SYQ@Z@ZLb{;Eo^{90{dQJ8&%;M$Y~J zHQUAY7ek;0{1NLV>ZFaR^K?CVd<@LsY&}m7@LG)Xsd+=pgi7KKCb%35E z|E`#*zOSmIey&mIHk%rmA6aSZX6v4KHeQi9Fuq;F%s7wbl7%#Y@`kUO6(y$gqigl z=A?Y8vaI^5ro3*X{&&MrV;z&*wBD?@%(C3Hlv-%3&dOSgEGI0#Sn|w6LEb528fjc_ zIH2FBTcaJNsi7`}?zX1R~+zVI7gl?y?O_8MLRX|QGBA52HK_?r46 z-q+q+-h1BfUb(N6Z<{aV8}9$??-$4n3=3b4TDh`NTJ{v1flX4M8b^;{hshm^*6Jk9 zL;XAbbK^7P3{w#*u^;2|EkmrymY$|k;|zUAeH~3_Rb#marvfM+;s(@SUH!T4-p*E~ z8%ktF9SZvAJFS$c{{r54ifWC?6PP^~s7*Q#c#`)O)u!`h3w;qZKHFj$S7(H0wI+GToZ zdS`lSI%Jw)(wepzX=5M5TKy5-3GEim1a&p|Ko-dp+4HjY^cUQ+Sm`M!w-W^$_ab^P z@-plWRSV4z7Gs`71kU+q_`CQU`5VA*In2M>f6q_g{Ms8h6xxc}(Pt2M&-0VOjX5D* zPgv-tvM-ELK`EtwkhmXxTCO5kyvCXG1!`y4zurac%7Zy zS3DZuZ~nUhOK3v)a)gi8fI4ujI6IaGul@ljgD+B7=^L_}%uV(xZX>&t%T%M`*fD57 zqt>qig>s7FciiWmp_({lm~Kci9Mi|^e}k9uKh0P5d(~~_F2yu?OO|C`)7z=BWHTZ` zN=l-bGZ>&8p2S^@s!=`o!VAL*@N6!?94-z%%G}^*)DRg#d+?927^xKf3Vv5l{)Ny8 z6WISGS%jaQN-tnWv1Vmk_`$63@m(ouu)s)ZWB}@+f+%Cim zNe^)%SgUp5&{+ic#A?rAcQaRS=W9oON5sC-KF2=GzRxamOmkSB7oAgFmEAV?RnL5H zC(x}P`IiLR1{rugSB2X~gviC{Z(MCY3=j2w5gk3r2^>Wk1v7s5Rt8 zu^ zSCxN@|N4?p6-u6nv@_9|ve36=C)k;CxAGgj!WYzYG^x5mZ5#b4^yr)DmTMs`zC6q!NFblo_ ziu#FOD!a<$u!3Bsi4R^*& z@aumK*A6Q|%gYUAgqlX?M_)zPan+%V|4aB?oQ@vvDfBA+)J@r0hEe3pPebJ#R*lsR z&^$%2;;XhV+{&%A37XoP6)IMB1T5yi*+Q8{R+Xa20n)74HjxKO`#1Q5>x8R@+6J2i z{`9B$-g;T@NY4j1+^eo(E*V@E!?1P^$4kc<#|g&;$47_K+1Gi^S<7|DHPT(y6ZGVI z^LffIyMw2{wcPcmO+QdwoXGv0%L5oe_z zG4Zb&8zgQP-tqDL1nyz9N_0DJ-Mg?}Z$k4!4MPGd`i#)SuqN^t{fu?dI$SwEA`B4! zrzG1$45E(FE!Z~f3x!&lp_-uiqH*iS>L$Q9+Q|6T*veSl^u#d8*x2w0r^6a;8Euk! ztZJTukpIfGp)<%0Qj?@aF!ME{#_-@^E&nX_tK?bH*g|*ysl2(lLvyBN zug=QK?2wtCaU|nt#@CEmnKv^hX7$V-j5D9hODkwnq$!b?rZ~F0wxHtb6}%Vzkvk() zlx!tTwpc?r&NYa>gR8Y& zFfkzat9@0xLp>+m2KPqS53WltgZo#v&hym$!4v0g>&x}e59|oN2=$0w;Whcp9aMEql%+mY@hu>0t%n;E}Fpe;MMF(J(exd%V_LMdYUD~b6ukyR>CfO{y z8~IdP7;_1|v2we^tAm+-t*@u&wJX*6!v1rq0TtKXqIdAowJi8IzY(0RFY~_T$?`|% zm*np%m|8foXm#$B&bOMZ8!diwEAvd#7UMp{PW>|7FjV&* z+=qrLl=4f=5SffVOAdt>_hoFOI8f;V^Lxrhgy!0K?9qPz(=rp#MLajQk&Q^8RBx90$UAIQ}7_QcF zy7Sss+83G*>a8lhGF{O{u3~?Z{Yi}{pP+;OS?nyF=b9twVM(Y;aJj#kPX$ky%XQ!R z#PP~*vQI31W9wvlRkEUFU`g+ip(P7T?v?ytyJ?$L+Ss1xNN_fE4R;^%h~9Dj0=Uqb z$l+)w-Y#s2)s?;>#!-IycP5u@rT7b)h9b33Q=)yM`%B*hzUiNghmB5SlBuq#w#i~D zFz$xG^)-4s=k$!e3qJJ`kp2Hd5BH(sf_x`CpBXIskv39JbaPH(#_hm=!1p3<;*=UgQd`U&0uF|J$({qwH}swvUAgO zUS<2TR%Ok}nwd2)t4db+tnpdW?0eZ8a%SW%%KI!sKj*qT7-UI$*+`v=$ z^I~_YgIp*R*>TESY7UNhi>cJS-C8DoLBhGj%SmgK8>U=N(WJIWZJ$~(H9KW?iaoh) z^1P&Ni8~XP#}A52v_3VDG`S4F>9e&RHAhsUqPu(-Q-mJlBI2#2N^Awl_M@VO;n|^t z;2Z3@Q%|1z?Xk{)KZW!ll)#}Q+|4cu`ZA!YFJUQuEeA%S2 z<+fE=Tdq!WnZ%DtRmz+$dpUWa^{zf&*B^bo*4ln@FZ7=?V^75teqAWryU1PSn&F!4 zaFiS>jOBMM2o-EDxSTgWCn>u{cD0-WY}?Ot|x%8K~GiEqoPDn%>E%S=k{nnIVIRxTx_sdcr!nLgEc(Xd71 zmvJ#0_lO$<#(Q7?Cr7fadP#?pxME|$^PHkAL-v#GKeN*_%V)euCo^AVoz1SDot*V0 zlg*arp2};HZ^=*2kL0f_Y*ak6q^GTY=~??<&SmbNUK-PyAHjxC6T-13#7ZiTDU@GP zb<_T>KWsc{zGOWfKQi$}Qc?1=l=-Q#)HY>Wm!ZmRO^u~APwAXoIVn3~S$tyLVM|%_ zN@JeBscwgcQqNL4;3ap-7Gg^Olvp5bE@5Neg=_pC?yqPXJZYOk$AbUiB&_S7<9p?8 z;63eW?D^te?e6KW=`QE4?(XVd=6>U@<2mH1?tS2$;7jpm_>Tl;2fKwThsj7*Q- zOkSMaJ2{v%KIwGg0Rtj~o&YcMRcOI~hOV@n z@B`lxSwGt&-{E*q15IIAFaydp4qCtV=#$*?t@Vxb{o?EF>){*aTLC5x=lj`z+;0i2 z1I>FsC;}OwG_X?(BHN?0#LCdS)#8o>Y|bzC3IRnsSH%j6EJ zBg@oDA(Q7PS4wrIwoAUAuqSSMTr2BrQ$Y8#>I>Ukb{JjXxkA72|GGk41@ z<^+F2mBiYKbmFmul!Vb($+^}p77=f9lVPzg3q88U%GdI8?0i`s)er1|8R!HQ3itU- z+?{AnBrY;0{4~@e^cZ{>I(P#bz|Mhk0W#q5XZyeT)BT11kY5p68vckqoE`K<88H(x z*ekp;mLnZaiC{>5VwSU0l=VO_u54(jHyA?3Pv!}hkm)*lheu5JjfCL`-FkIYSzfV# z{Z20@TF0969itV(uLEzrd9F(it^KQQVo7{)X<^+$PeExxTw%w;>xI*bW)|-*xogWU z)jMW81y`D<$Xn4r5G4DYP-3J3NVi(JHD3xx#aXe2P$i#&GoUdkg<@tq{k!ZJrU9t) ze)&7a88~zMsV$oOnt|F(Z5Q1h-AA2Gm#Mp?o1~NB-JJ!pOn20?lawPB-Q;y}i*nHa zQD-qH+$7y1IU0K|3PNjW7^M7sPQe|4*Hj<<2KC%V@Pj8u#zaP=o}L!@GqM`KX)FIa zvL(`pV?|pmfaEA+EMF2JHc)M4GFeOJJ)^-);hCD%Hqdm|x^%q^e;cOgPlM8OR(~D$ z-XgU_`CbtxU(O`bgNR$P#=>fDQlv&`lHcV?cK_q-@Az7}#kQd2OYu4|h!z(g#H;^m z$sXIm(&P5~4!5(r`?jZ&Z;Jmw;Cs*-?iHCH{hjLtWrbU~fGMR4UeoIE`?ZHcYbaSt z&d1&I3O!I3lO17xVWslZ^1cc`?j%~(8jzm4zz2FkeGi14&6raQ@aB@L(U`uts@g0c?}sHAUJaeFuF%@I_|m zUg(}^muiNok1OveNcj?`7JZ56FHwlI&>1Kfo*Ss^TLdKL6=yAnw=~oCqb;-KXvyi4 zMc#3(e<#;S+>!!g{d*v_>7!J8cT@ zZcXT}Q_03zaQcA!OSIGD@l*nGuaR>u+q>H3}sMbBu$0*=MXiXQ>e`BwgFdNvq^4IbaieklJR$}6nN&lpkg<(1f!z|kO!qg?1}h^S97`H)*%;qe*1iV zyhA+W+@Dxo~R8XZ)K*`nla&C`ygz53@7oDASUC%C-VCJSuOh7^|4C zn5!73sHrHD|0ORgKM0liVkR5v^40M8*Pxb=--)Kgeq;@9fQ#%Tv}FPO856|@&^hIT zr+Hl1A}kfABQ>%glp;-pYC<)!uDBC9S6MB9DsuVth1wTcDGSIV8rA*wUV5@krSL7`R9pe>ZhO6khfULsYxA4;#se08pQpA7A;=SvgtBG3Bzw?B5*vl7$gIKRLVTLdPs+eqks$dldz(@GM-r#(A8s`Ymx z2lN<5&l=DVT`$)u+=_0>6fjK;%7$Rg@ zJ*<#N_=4SZPS}t2Stkgm%V{cje;w2>Q?FO(-$iN5xtBAM8%%EIpJuKq#dvF-?5IGu)`i+E9gHYM`cnl5dQ6nhmqJHxl4 zhL`1qv|xaGB)B~y><{t|^4`edtSgtwZ?R)pf?dyO znI%y9b%jPtMvWlv66J7m1>vxEK;x;2oe>8k!}SxsyFY~fNN=q!q=1g8MZSd+9Ebn? zARs`HfnF&QM5MVw41+vZk*5TWkcj`fwJ-?3bEj}muwh4bKq~AhF&Cc4u2867hOX5D z#_&XVj4nvjNGv%hSt0F7{6SuzT;xv5OPc8{*)FD-ox(Pk|AqHeI`nXL)i;$={PDj+ zeb!H9R4rFz$`7+k@oh|^t5X6rvd6^|eg^kAvMQVx93S}XTj71|so{C!ZsdOITI5P| z6}e`+>v=wS{_s}uvHtkLkHMap*j9>gk=N1P+(_K~P6-u2uXrKqK_%FTXSoOp)>L>+ z=SXgXXggSXQEDYtVaM(w>tn}`rA2zPtRi!csl)DLMYg?s4w4gg;nW)~uOxrXjs&}; zKXV5u1e1{yK~h~&lX<`jxCH<6VJK%`inE{@_TdCMD6ECTbT)qe#M!qN2>?5h3Uv@a z`-C0BhW|ScM<6At8PWsd@eN2oO$}kaNz5^R07G;%e$Q2*L`Z>xbtC*sa%3(qhI`io zzDF;3_YWbxw?I-KdAJ`WnNk^1nOs6$0smzoxtuDcSIgqqEsPaY029(r7AwXo-ExO~ zwLAx!KZpF9yc&{sbh7%$Mfj8KMGTe%#f3r@p5-ng>0(A`Xs~%;ERfz;e0xC1=!wkI ze|*XQm;Rlgssw`DLqjpOs2-Jar$K_f15)fEK_>PRmw>SPHwdfCL7$ik9#SFyRcATv&rxh33U96dHh~y0|o6XFS z{Z03yR*~^!7%Jh8u?iwk#HcS*kXg4oEDetiQMe`AgK?oIp|nssl$x30C6Ojj^8LPLMddy#L6-b5BWb0&Dd7D_t9 z9j^U9e}5b*ou6@LtOH5oHNGzaPl-}W;s4_k{>@@&n3dp>FGd!H3%dGINWyS{X|V5nHgg{MlkVBvW^R-=G_un^(z}Hk`ogLlFyz8U`%In5z3cz=!7iN@ilAsD<*qm8-y z+^@V5zi&U>0Uab(X|{A1(TU7O74(Wqp?lL)>FM+^x;`DkC;EkQldH+H*Mv-g!JBS4C?7Ylf7Q^6zmQIc8(v4O!;HBe-Itm! zYfZnWd&}0!&aelV7<*avKz4(9CHu|{qB~*oQ3IZr8PaLeX0hAicAV!Gg?QW(OQTxO z$TdS%Kaq2BGX5y4=Hp60150efufvN?Mp@}MmPjnuVVZFp@q)|74 z`^W_^=@+bV5Eh`Few{6u|nI(drBB3Y^;)qrXQim`^uBTtZ{NfUXE=nMbp61bv{ zfdG;PmVKRA5geQ|Q7zSgCSNOR@HQ(W)&XB-Flwk(;%@OA&Vv_F>VFbH!fWzeR1qVn zkaRrxfto6-h1D9RT!tIcG1Z@78*kG7r+cWWsF|y2rtYkHqId&c!T{N5`Xw=l_$GD| zR&XWAWX_6E(OmRq21jxtXQPWTqw2%;#o9fBtHgot%Y+?P!WBesM*4=!hd!e2?CT47 z_PeLJwmNyobxO9;t7pp9x+J&55+st4(2nvUzo8NTa` zx>?#uYPGhq@(=kSW|(X-T?QPYfZ*e@(Q()poeX{QxJVbc8G3QkLAu=teey|R1M0=? zF`L*FmF-tdHqVB0gKqz1U%uy{yS3|qqpMx8RkK|#xl>ZsmJ65OIPmhmxes_p`l|(L zbn{BMx57WMiqhFc8u>Hz0ymaa+Dr>nHg${IL=8ozy9d;PGvsBEvFlT3sh+e-_8I+z z8DMex<@*$^z&>uL+N1gk($pvD+$%x#l&R1w>dJq@J8_U~1o*ChfY^2sOo)2ms%vBW z#Lif|4@h;~gg5$BtlChlVK=;^>!L2=K|?#j&%ilD^3QNf9>&$-=Es(k*CiIBA#G-- z$`3IW)%!Gi)x$Iu4Hd1w8;=<+hAiC{?E%$&%@l=>Eu`zwC#b_9->m*WJwelO7jRjp zMVq5WY{Gwr8gwOy_(R~r_!XoLJKQ64gwfp7NI~d$V5zT{=e=v3bA;n3%r+mFTrU2( zxNmW&I9f8WRD}#_gD2Ie3%n0554Vic{5xSe*rcs6k$y+kq<*FvQVjK;JdN6CJO0{( zC-^e?m5it6!{K#>UL~6W_daQljt@?lsv{fSA0=bQ~aW;;#qo3uN8!XJ=^Z6{WfRjJq1a=H)PH!azp z@r2Mz;P}IQFYK@@+!W-`IdKNBfuEuq+_cT2ZK6G+}SEcS)qiE)yPVv3N@TcAH$6YUd9@_%qIaNf5+xAiJvitiWY6tyfKQ5*u{a$Zrl z;=7o>t#=G^89hh6Klu9xY9oVjNT`0eM`TO%7Iy#~>m$gw8iabS6?ivSC6C}iE=$#g z%eP2&l9|sAm3L7zg<~h6I-za^pU!2?In74RXiYtEEw8ADsokn^su#*cZsbKIGZKl!MQ_F)(hbP=w2SSjJgCW1`n5w07j%h+yQZP>?JN(>K|?j| zMNMbrPwF)JGTAuvKDse2s5Vq{uqj$0ExsyzX&1?haLfNf9V17OX_78tFLI7N8G#zX*}=oX zc%-b=jjY7#oktgd!j0>bSRHgIP_?9g5v52QZz_{BXPM4y5xWulPN&Sm+pWL)omvH_ z`v>(pkPH>-cd8w#ekv)>Ihk^ZVz2x=o6PJsXk~v3uRe*!*H!dBPeF8p0hI96q=QFWZqJ#^gfU{Jg9Qgp$Vnn1e`!B zahs}7JweVzG3b&J^d9SQPa>(|Pl2z#PoD9vYL14bqd^O;RjRj7vbVFpFTGfrS31q! z-Z8}a(zU`f&(|ifA=oOk1PP2x_sm@lY6lwAtwkkV?xh+e@ zQyWJgMz!*g>_|Q!8sWK3h2Fmo_?|Q2D}5x6L1niKE}oC*rq+gz|0cH{Zoc;5rcm52 z@c^+*TARE{m&H{70eeIF0$Gfy>dxAYhO@eF`ZKx(P&h1A1eJfVG}ze((GBl|THZ&r zmQITmi&a4~`5iac9bo2_BOVfErQKs@@TqqoXW~9QX*a^E(8)lY-|CHXS9AL9ZQ&Dh z*?)12bu@Q0c64!UbLgFSoflj|_XclE|D!-@@G|bp55prOKSb3?_K5HSp-{XG*X~{P zA%;lbNM{ip$U6AOr0^FmXUegMktw)RF39IAXyqzpP}xc~Ts2tL5bJdUelcFL4{XLP z`DA$s`wKKdqO2$S%^G?>6(DEA#W@##$k|dq6h2Y-D9gnjqQhksAEFLP#ZFtm*N58a zDmu@@xE5G1Bv&FSqadmhH{mwmBuc32OnrGfHV-p_f0Xl7eKkIC&QI&pbv?EJsclNF zx=8L}&dIWIFWW=6lnn=$x{9ObjNw;cUKe7Wp7pgqQHsZh0tk` zY0pG&a_@K#G9YS6nn)`VF1TBpP@l2G>d4%(E6f76r91#-RaNCNWxQ&kDhD;xzsL({ zq#29k#`&7zni`sX^=frl^(j>?BnIe|lNGnn(`f>(?hdHY0#qex5ITqdBfSig974`Z z2i%BgVH(_aqqx%OA5mTO6xa!|@Wt>nkQ-&;%+MV;#CO9ZzB_aR|C}C@h6hE~BKN(z zuuZ5JtBn0~noyDyeVyLI)P{%Y2pmFceRnXerx;1&JkuVd-89+s%+%hz)->N7Z)#%N zW$2)Xi4ydT6lHS-JdMmj`X;%E=pwl#F6Gxp_l0)^b%Bb$W1dV`N9SofTl#lNq-b|x z9e8pIbA36Da#m;SvkzxY$m*FjD(gg+HT!yYTF%nk(|KgU;=+{T^pcCE#~fE(*`5^t zgy5raMQ*j=ighQBQhr%IWNOS;r)lTte=+LJdo8-Sq48-6>k^UAoqRXBcFMezy(tG$ z7N#^#d70ci`LCo~iSH7g#UG8E4At*dQ!C?jeMQ|e%{Nt51 zxEHO8Gzp8r&w)q&7rr8IqIaz4h5IMy>e5^tU1eQ*m&H}fHQ4p9%jxRr-tIZl z&;Z`YC}@eUO23j`T3~$8s~uJk*7CZAhC*X4bAQWlYsWZE{Mq&c zIe|%78lM|iIj*O5q-ChNy(!N4O}|!G2hZ3LRgq$%+`&wddEi8m5}V-*doL{G+d_He z3}=KggWfwqQmk86ho8ZlcP`V(cq`1179#46RCDH^uOB01k zyes-Fasg@Rx8b$01cv+X`WpCdgHWsSe)OF6?Dp*Oob!D2D7@Xg`@B-5$rt*@`+dk$ zcLk;48j(nJ6Sq~ECGG%Cpc2$15?aGdV;{(GqaK~BE7e^y)G~E5O|aZHr&$fwf2r z$hE-XE^QBu){LS$h3W!6uS{OI+;chAb3SGt%|4L*COb7}PfnX$Z62AQR4@>X{hB5B zY*XwFoEkUp2_ZO88?Jy{pPnF8jVH!Xy=Cm8RE_sH7Y`V6G_N#>oVD{xC)(eKgC)ppWo)Gw4v6bui68LTNw>%v;@DBuZB|9WZt^ zcQR4tX{L9ewVyNmXnX|4U!qPcKGZK?dwX((!I8Bwu-o;NNjpcj_29l**cYeDP3;w>1YHJcn|ji z&ke84KPYe|7$2S=$%Ah2l%S1Gkld4M$==jj8jNZto&6}k4)tIcRYJp=9dG3{FIP;Dx*ccvr9<}Wp)o~8Pxtgl>-ZirFdgI&eklDX(Iba!eId7dZ+ zS8Ny@-!Amob|D^eBA?9-=N!=`;K{#^ERS@E7?An!EPMgPk^NxNTns;lLr)&52g3aJ z$ooiT{#SUC>k~bwzRVnjU-?0^Q)|@!tG}-I>Rs>;#_Mvm|7!KxPFk;8p{WXYkWYCT zlfLzsZ9J7Z=xUg}sHr~a!X3us<_PjRXvuf+tk8hJ4w}HD(2QWEfChTi=H7*#x9RFgXjHZ(J|kuRX85PkopD+XK^souDTVg+D;obcEZ% zZxmLDb7H?rK;!|%;a{vJO<$ykqfdRE8Obv8{qj1BbBYw@ERgVvm843AdAA2sw?oRQ z%DPIMVw<9=;=O!0?kGdik7>>vmZ@aZQD?V@o3;XpsSdG5%1T#)X0jRe;z`^dzJak& z2KCQkbP+@(s{M_6u?_mgGR_mti++P%;i6Dc`b|2GzA3+@cIwNTezew%>lgQr^_cl@ zBdL3_L59AARR0ph4V+cV5f%W-iNS$j;NH)UVVvaz1>^l}QEk5fSt@F2wSL zYh1m^ps5?404qwJ);&X1`$XTlH*^b^*px~X{OK4m*(J#ABTR!HEa9V^$!k3y+%mPuun$@1yeAo|Fu zIiwri)QEIBs-T15#NNS-`6DLTK4A?y`S1A^d^=vne}`^i9rqje3)dLcqaO7(+F2kD z>=##(r>M_tkw#^rO7SGyMD$}X>a;dY+&MCjX+=$e-3Hwdw zH02lxag`_FK0Oicj&9Z8Na}n@j-_wF$=^~oST+I~+yU8CW;9!ZTh>#y60?N5Bp>6V^*nHwy0*EpU6TF0HI&vPOR3hfO3W^#2CiUQAO$=RH{;n%6;SJt z?4$H3x8Ve2)vr|pR5y_JGe~hq-cp{$ZevHVwO9|c8*8>l7NCEmXP|RR!+GUFMs_oqd#xMY_)ozXBO? z@BI((>+!(u;QwRk9N^>F-Zy^6v$MzsP12^eZJW0?Zf)M$Ol|YlHdDK|wvDtg*BJhv z_V@36vO%+(*)wMj-uHRG&pp38;0&&o&p{WqBse`V*uTP8$~VH--)|1KP|~$Cq&IVp zTO!;Qhng0e8lq0NHL`9m1Q~pY2zYwzLaosavj>$bJI$q_iOC^tGF34-5pzB!t`&!g zg~W?OAyn3`hCb#tlMZIyX1FH4B|FJfL=Q^CyL-RU03M6Y_1ju~6qO%^^H*ko-siNs6rD%1LEHMuqLhPUUQ<%aWV#ub=ep$XuM% zD}K26#dZ!E87im@f<35GqDu&eAK_m+sPB{@pxYQrUtjFAB{wMI`@xoR&0yRc|p?^v5#0u zY$5It3nBa5P}(J3mo`Yn5LdY`n#3W3o4<@Bm9HR7Lu;KC=3w?3$S>nIvpcZzNTBLb z_u#tT7+H23NKPCET#{#W7afp6?je`3D0 zlbJIdqg?adMLn^ohn9T1{BMI3)be0-RYYF47PFbkZRA&N!S23+o@wse?#kZX{!4Oh zeK6IWUCM_el2^#&$GB8e3SaKfpun(ZhHv=(XJR(zDaZd)+|I|J3Y@Mr4 zR)?$I;Ov?os=uGgW91gw?W3Y8W!0g`Y9y(JwC>sjCfV9J+@9-XeorC2=%&IS@(;}Q zHFUSQ$5;?7?22@raz%J62ItHFsaw@HYKZa|=7ZUOS8xDm(O*nm?V}^R_0X+-Z36*0sAZ6*%zpL~ zJBukm>DmgpmH)IS#(l>X=YHXR8fc=z6Pww_jS*&upT!&KUp|cer=cTQAXYGagmQF= z)E^qCTqfM9LPxBEdU4&jZCnVyna?2%6J`p{gnPWmL*~yyOGU4P8^lSdLVA!U7{eG; zs!xEA!*1jkA0a9L8DU;ELW1VuzKf}|>wZvJ;RmoG&pC#YZ+r#U%HdbOM#0g@S zFi5Z?13yR*#24ZQQwga2YDov6Tst5v2c6Qz9%gT{rMPF@0=^XH$9v#Ghap?v7S)lB z!7e@xe)3Op9tz%-h~_m$o#ZZLwy)`}^>pl(hW^p{Rn;ov{pE(5=pCGa$D@r3z#rHO zHEu(!JC3M{YF?-%XF?Hk9Znb7T3+^-ZBdTndCY|)i}f$DvWO{vy{IeJ&rB^P=)IqP z#<9&kEKnIPLt!*aitC@`y4XFX`AmvLE(mKwW=6h@@#T)s^(nlDv_<#1YNjrUAM};` z^5pBD_=8C)>Cq0+ozLTUyIfzKQ=LU!)jVzeF-nS_hpxsxWgjz5sFT{p;7RXx*Bi%L z#}j8$&jx=3<&B<6wPSyBr{UOg2RW1e{5(FLUn_LOT)77ft>+luE{e(UCmx7<@*(cZ z9()$RTF58P6ZeaApb8l+{L9C2PvO^6i`ffm@+&9_+rp*h1@6#t82u+h2l!ZzMO-h3 zo&nv*F3bYWpaS{;Wy1itw}@({60an{4JaJB`2iTmuBj<%2->y_esdF4LZ38UJHTEF ziHfRUAf;H_lIKdzE7BydCp^;>Nv)8Z`%k;pdiw>ws4plx;?-NU*x(?~4Cfx_2lq|o zKSsB%j@*{}QohT1PDU3DX~B*UcrrUA)rk*&fAZtuuNKMc)5J_Ulggqpb7t&Fuaogt z)-Gq5@2T9%xI~|Vl4CQ->eIC+!O_02?g6fxE~o35hxpeA3!wVEJ4vKsm`K(M8rmj) zywFz6V|rq0DJ_#0OUxV(0xv|s4`-)9iGPcGvDUaM#)`S2X-nqI@c(cZ zSTm?~3G`6fk9Aoo>H!=?1UTGxM3(H5J_S@i(;sEqXvE!R^(rFCjnL12fT42`YH z7}Op=6jm*zcEalIu=)nNw&Gd`c(Ck;^KwwT$DR%88nBchxz5k zOwefNpye|3@6<-tpjwlY!D^lrS=ZC;naiAm)Oel>e;YG4zc>G;n8)Ey#di7(Px(wc zOeCHq*GTON75qD7Di)^}OioTHoe+~KrCiMz;OY^Wul1(-AiH0m{%PdZhRLdI`vTRhkp z=P*r~I{N zp=8+!l67r*8ubJ!lwWX;Sz%0p(^nCwQv2y&prUvJW~5F1g8p>@ZL|{vyuYz)G9gEs zBzxstN;~YTUMLoTv^jKLo=t_87OPi0A@7=~3g)i#Y~ul8g_h<)VKYOI+h+00 zgYO(i6Ziid{qtwi?yOtBQPd}4lI=ps30n#CI`*d_%YEb$Y7MH1(8v77vRvFuet3SS zgnTdi@$rWhUzYqjl-A1e!DV-m?AK}kCihH|lj~*t;~E=GGu-TdLKE>Yzk{)oM3qrK z%d^$-MiTv%n%24YU7gdBVv8_JBNtfVxw%~nt&OAu77K(TlTV_Y`0 zci%CGW`poP2(xNKjByRsElNP14AQP3MEgwWoPDK zR|W6-Kx$wte5*2*=SnS2*Sk<%gf-@~q2XYTZ4cQZip1?};@X&X+A-X{$!qZ^xHe|? zNG$TL|A(FL%6&}#IzH(_#zl9|KrQ*YdRJ`-WtN*7!Znu4g&H~Rc^vtk=kJrZT$IPw zi>qTaliw)se>(>Vdw7ODBoA|PDOG;X##;K4d$=Ag)eYMdQ6(Zgq_4TWuu2S=6T`~o zep}FAyiAFOMc?LqouiD!&4d$HFGR6yJd{3}Tybi0Al;djx-z+Naza{d*J^)7qa3vv zj62Cl&=$%y)GW0e)swp|{50Q_#+n}qFPR|up;T7-f?ZTTI49`9+JC7!Rpx_?{}4RQ z;+-o!E&PM!S$e85l|oij@2urhx1+9OAMIf&zO(R-d&+$RDKwm$h#DC9ma&AH4QGOJ zx&x!eOQ<71LOJ(V4p$=Or^-gXJb45La09jwy_noFdSXQVuC~-yLjCy>+Q%O1&)_lt zF7GnoGxoxh= zt^?qL{Bl2X7xZMiw|R1V1ERXO(~dMGD%Nd z531ty)N<+PGq|jp+4CIHE~}@XFEbFU1hi0Sf@d;6*-@ZUN0|nIggVobVd(@NN)Rd@ zpCyMa8Fa-dA(w6YZFj6E;R3(es@R^u1NA37-+@@QqUU0Ex$I%JhY74$pA5{GA>%`ON6NP9;Q$9@OxtmfS7oa-#<%H!JWGF&CG zd+p_k^EUQ<@;!i#BsJJu))c2&P*;peWDlHNH?onuU5GY~H{Fw#m}^*?S}%jdINYY& z+Jx*683*6phhT;_1;4(F^)f1=;>~r<`=l(B(^Lio&Pw84)cKs`HwvftK2YoyLv-&5 zbCCItTC_=YM?@Oq;Sr@lZNL_l<>CV-omu z*AUf<^xOSCLFwKMH@$O#r-7876bdv^!3$m3UTWN5a zYJ>`}p42<6&zgd9+zBM)itKa5S4Nfe2LF<0_%o)i!bpB2-p^5S8lTPQW3RLSic>fz_nkh>78d%m*O+Nkb$%QN z-$(i=b%|@rye9v^_oEZ{m|934Lct%->^0uPKd3AbxFK-EZ7}d zws*Pu)i9Tc+9$dx6z~O&f#4v2SM#y!;3PO+JI8e3#;A4KiR24EK#L-m#Gd*S{-KsY z&tWgJYq%5s^>9_3Pmcnrx1DJ_n}>NJcV-%yJ{xP8(Yl#l$l9n^tg0UZ8@)c;gsP~n z}94X@k|nFqDR6DFpa({mnKEor@Bw?VLYQZCP%2vKRy%4%Nr!J9i{4%|HfM;UZo@A4nsoU5vCcnB@ri3O! z7r5Nd2PLo|;%c{yGU9cvn=f9DwWQFqd=t2AxLB=YFM)?JLmNoREDzQmAm zZ5FkG>cY$cY3iQoyY@{TqD3+{*f~m5tvP*w72$=E4lkfP+J3GD-6+^XpD22b#d2qT zKHHB;R;(mM??twApu)?AamF+Bn4p`v0Y{e}>QG}m7pLykD$`ZP?%t>B8S7KIJNA5D z?lBt|ETtV`9`Jd5)3|k7GrA{p%qQ`Ss7yN1Z4yN;(_548q|D$9pYNR4Bo#0FlE$_mNI@jUUg;Oo(;Mj`#Q@`I05*HWML+E@z}R+pNp%Bjj4 zx*j{qpn{_q*?38tjb=(w)Tv#hnri_)pf2QDYPnpHuA=8>*OQIv1nnDlhf4B&!QSWq z@ydC%dRR^V3RYAL@Z(87ZJE-G&j%N*N@{82Z*jCbO5d+II2Yp&RM*q#S;8`}Y&>HM zup8Bp!JpDD-*tKtzb@EI$z)Fp{r&%8P1S`Tr{|KxSr#rv1?4K-dZUVVn^ZMgargZD z*!y~YDvs^%{2|7&i}fYSDfyzwpctdK2TNNaZ(u$X5sc!i&|bM58A>CXCN~wXY6Vq0 zdC6^~Cwny`UHVR9z4OQzYM3Y(>%4EsLgAs1?Q+ST_)q2trIcfbDW0!rOb*=AJxo)Y zp(e@)$tEUEOV(XN9+Ky(XPmb;vsz47Ysf!@Wr~lQqiiuv){nZUNL$&_S|v|wQyMopkOCi+ zd#FU+L+4Pd>1ElA)HL-bDTS}j)BpMEQU`>>)JpG9=;Kwkb8u;(pDhL+Ka+f+<^#+L zPYte&HeCGXt;$ydhiARDn&T?FfLvxjg1dW}OH$&bi>|&*4d$~-_+S1f%;ex)%Vb@0 zmEg13PU5I6FvxkYsf-emUM^ysZlSDd-@qO*FP+J3N`D(QB>sv6+ ze4BgjXlJ^igi}@_muI2*iuWkXLhJ9AYx<&c?M)lRx@ls}=D%b=u}%p5FgNog%MI-t zJqOKgvI?2r@}GQv^Y6W#&4zz1JB+U4f5Y_EuS&Y>6?CEXsTs@=Uw6H|@Y0s^S9L}T z8?HG6!#wtocq)kUuIG;F6>G$*;SnTE(Y0V3Bw}K(*vEaxg6{u(%Vzq z(qHR@DglOhz&vno6)!VQwW7Y9d?%@q->jUbE1Dh!1^EbDkv*ujR<<&$k-w;|A2f7k z3rM%cjiuthMuy`QNOj|>e$H3=F8giuE>@}@ORT;@Zb1wZ;QRPSaTg3PHDA*M4r@!j zm6G9kX*ppT=E$WC)Jf!B^+jTwSSm*zMM>#oJuK`}c9IE!FG7Fq6>j! z2iIl(67%!Q?47Pu#3`0(l?msuyd)=B+*n)`A7Wd>|n0xPvV6O~B+Z9YQMysOknOfmk8`bu@^PUyhzW%rO~a+lNszUf?k>sXhG z9pRsANfhEUbiJ!Z78_e}ay6Pn4zw z9zmHdsngj>+3lkX_?P-ta}$_Srd3J1L+Y}Ie+s=x-ej5W+pVS2(d;%RF6*Mm2-_65 zdRwc?RwEmjHvVnuDC=b7tGBl9VME07O8)?5Y?jtAUtL@1srnl8D7BI|iz>zz4B4F4 zSbrj3Vq?if*GP6N6&-TGdBIsLY#YB=?vv>;-Lmt6+0Jvuh$x4=GU>WhD%#_yowgvn zhh-M(XnQ&vH!(~TKp zZ5EjCY0X5LZj#N)>fk(zH;3taeY1=`qAIr+SA%bzVlPV8t4ZF=LJD1&;+V5(Kf{vP z+TOzS0=bWQhZ09Q{q1SHrLxN|?r`0=6=J%l?Fg+8ugXxT7S^9Bozf?yv-;Is*s(@= z9#+}AfE<#omXE&f@~yB}&bNA!7G{m2J|~Z`FkFhz)v?4I9@dIUQ0itKw_j6OrU4(9 zxZL*6d{2L!XgAlhzw)K%3o;kPJXeZ3*76ao#`etWX&wxBmn%>s9<$i}ue4@VtT+VB ze+!ppY>|#R7x-V=2bkKVZx4DJ%IN zVf)=5gPrM{=A*tiy|nPgF;i-8IuVe(F-q?|N7Ti?E-<$uCv)ug5XlsF&AVU!<>#$_ zwY8$L1GM+_T>lhP5i$t*jfMV6IavLBdT-`-_-I=WXW`RJ0=@v!8SE7UckYj~Fa`D@k4BRpkJ z|54d^kY`KK@7|boyI7Xvq4%ONDlj(UXa;BU2BL)6}6M=fGI@X67GmEW*RHq4puj9Oj;1uma8f^3|!P3*l+mHQ!^ax z#S%G3rEYUk(vyfdxircV*V}sPwrq#iD@PR<$0vB6Q8(=iTt~Ii!6lKc16=kX=@VOs zIp_Sv-loTLEdxZp5*qF3Pd~O4_2f|Q^JT=*{)+xQTysHX-(@snQtdx7`dI!_3hR$J z!(j_oH8_H2U(fXyzy4d#@F4-+J~epTIhM)ArH7tM$xV3z)x!;baMFLwGQC0gKk9DB zIIj`D!A7SY4g5t>Ij4Bd*~8g#QnD~SYdEREypY}m8Q%iaLv=UzQ#q&H;CeH*;83-U z)L1P+ZY#%(=3)nRp=L4KVO;*o%-0?&qquGQUwpE=7nNil6zmIU*lvtRiRS9jyZo{2 zJbfBF(CFxGD+I*$ak#sXQ_g^$bQ2<;b%DMV6H*E z6JMu)rILhwQk1Kzf0F%~T$XF$Ekl17R6k3V;3=b0_9NRDX@CRk1yW1uA`VIS2C7D? zRGRx}upIkU+(54Qo^no-<{``-l3I@8Sb1^5pgs(H9JsufsqGVt)byVrh=TaW&m8DvN z4*WPzGjj`ioo6+BT)q_=>RaU7$aLlzLCm_$KY-tN75W2tqAzfLu~z0P`^$T6mQKQ* zz*%Lg|7P^JfXnj_h($l8-X0HiG(hY{4JEU(r86lfNS^shd47O-t9&`-pU?tgKCPOw zfmS`V2y@n*;F=zupB)~I4^*LBm}q4Rm+cKuQ^ZlExpH0U%3sib2ru13sc24C_w&`g z4(^50k136QeV&#BtwTaQZndd?zgvgXJiX9A51{4=tI7+mXZC{e3gq}R(qQJ{YZZF$g9*3 zy=CbE1@1DjrF}}^lY1byoY~I&PzDA1)5V1CYz=oM)h8b0&jgRTCR^Hybpxk7i@BEe znf?(ToBkqX3wJQfN=<9Bd%`7=y;_j+xZaGT9b?f10Mdx1tVQ8l@8GlQ%g z{g=xdJZWvk7m$y8TN^>!6g{8+h1yN1&Y$y6*Jshk`5wwzbqzaF$;q-tTWYbofXbj^ z6CaOv6O?q$#sa(oj{SDQIDWD(F$H7tdsTQdpLv86?GDbTKP1HiN z9W~_h>2cIz=o))4Md(nysotD=569KzMq~XVHNtp=e92srrMxF=_{n-lIa)u-*P*i1 zFs&oSFh$4&{THtPDQ3B`QQn|c0ZB8$*r0?O6xE9!Or>CNT#?GlAJYZ|CQ*${@s#M> zE%z0QiCy(c{^EKe?gHId->AL?C+3&2O_`}x;g`{`v`ca|{V`XM`Jx?FT4S%;OM;AL zD>_S-kR#-pW+w|MfjmSF#!&dvZiU}hYcics;545mnW(vK3csxUWE$I&OjIUnE+&;} zp|??TlG^Nhqm15Fe@UC@n%XJN3JQKH{g-;e$cdWWWOamomNbXEHKh%q3$h)_F}c6K zoV`rj^q%Te(ua|#@`g{Z1drX3$lNt1nni#uy9uh94RBxE0#7X~9E7hL2T;kr4|RT%Nes2kC}S)l z5?zFp)n^&KsYY}nsHV$|2DrZ}7>XVbI@f2TtDcXvq7ETf(G9HLFQ`;600Lb%se+r80+*r_;S;8(=iu0F#S@dJv9t`2EkI z2w0#NyM#JquRaxZJNxx|dO!HPw>Qq|l0F;cq{~Kecqiq8SJ`l*kx>c0ZOI_Q6bF;H z45DuFMxw#OQEnHh4+_CH)Mbq&LDC+|4i|ZbXq}mMz!!ZklCqJYI1Qi#s7g!G!%(sF z6W(Afy_H&uDAj6kA=*&ms2WsjkS;!x+>{-eXNFpdJ}`u2B6FXO_N<3$|9AM?8;$L7 zIAe`>dSy^oo}!XI79@v4s7KF@qmVvWO9Fpo0jm8QYBx}?(*s|(#dl}aL0S|tse81e z>R2s9J)(6&9&r+WY;&mV(lJVch^l~zrkub+S)Umdv7)dXiIikeNeflJh6W&<;Xjpp`q zEBQ721}LruLCf%)t<+4q3&l(U^Dgr-sC38SafkV)d5F2B`HECex@)Rrs%dH^9)Z#! zk=wxaWA8HU;e-oYH~97$$V~NDH=y>YuKXx?FVG`!-#^Y@$N$7P&&T>aUeQ+snc5rP zyI$Vc##g{6`6~Gif{U>qb!YYcOZ`s274?LH;9mI(DjO=HQvM7$DF*6pPEZv<<}Jw; z;HE;g13jI|XSxn8)MT7r4a+F-%s!e+Lvy!F3YRK@0^dVu%P-`*v(*`%evSV6Ku^%# zsozoKT3lX=x~0LW^_l7~;}1d?_a7W!@B5N`Vg6SB75-Q7eViKj5@>?xb3yoS*^tK# zQ8%c0v_ok52XH}l;r_@&ou!)7pXm{d4^`+2JC2Lzn(#aM47dyTgN||sI8b|qRl;bY zzQCdOZ3G{}ALeRv57@TsE2cg3f^JPeq5gtKvI|_E#~Grr4=M%+^c>x_#(FB89k;6! z)$#f=R9qc_J7Hr|j2cBxL+<5wh5A+QyAS~_^=!oBYe+TBg5|1ty}7T{LUMpRrJ@@9 z2WMr?sOA_2dUzY;uMP!T`Y(G!JiT2P9CNaVWo^hjpOKZ`E!{{{(<0K_rf*1RGmd7= z&77095WZa(oetEv{p(eIodSo0n%qe}q`CAmq!-56oy-|f=uaT_KUQo2e#aGQ0Epr9 zEyOz7`ox+OZgF#LTi_PA(KglA+{W3CTN_#LTWZ4Z!68+VMuDh%UHHU1IR;GKf=p$) z1vP*yKvmgK=(tCyx1pWg3jedC!B)W_+D{+X2i@Q@p>ch%0p?axZWm=kngFtrXsiyR^BHIvfH8_@O%2r zw5zGUlyRsNZ;~<$yuPs1o2k3gj-+49NXX2aJS0)7qxc`X=dwaxh`E1 z|3=;5JSLLrq(gTjmkWr#tL}Nu!P$?&B?w7>1owk`$%T?XC!J5apA<|Q2tMw&luxPY zY56k7W+rBhaZs*J?y}w|zA=Fa`Lt3O^taMv4YCCl;ZU)J-z2OPXPdf8dCV`(;}Dpe zWlaOme~In7E#BtF@xyi*?N`edZ=GyaE&o{Fnah|bzvMkkhB|=p4rqS^%@cd@ui+T?Mo&{u z$=w6Hygt`qP}q|*il;A3{h2&IsdwVmgz^aqzwZ5d{wpeBXF|`!)=5K?&!j}BZA>qc zc{gj8qou2`NAo`MuK+V6s2<9q}a8Ja3j3oBLaep~`-WjSra{k{VLS zKGS~0eg|a68}?oH(e`5YXUGo!v~{$dwX)VGmdWPr(nTnE--1{FiF?n!VP2u~`4dTn zUv*x+xi(w9qeLoGpp+dRRM3)b0wIC#{_Ciu+>grQ-_?|CpmJbT-~?K=K8Tx1!MgGm z*(Y}b9W4y1wwKU0tN^#Ek-klL>PyIBDmSzbg!+OE@c_0u`;q;dKPVJ6bq9-Nmsyrp zSVo5g?GHnb+78mNjRMxaY>SHY(@*|`_ z92TUI9(F1;4z3h3DxQX-%66G`nx&3;fGJFz&fj6b(kj^uLL;j_48DUaMWW}RyNQc- zUduk2m6ACsvmz?7uAy@1WQLfzI5Th7)vU4E6&=yEin?&9;+;qnjBDIlbNjp(R6ek^) zRzRm(O!{hC0J7p~Fr-dHUB8m|a9xlyiD1Vwui;z0oib6=p{$<(uGI=Km+pZ>QV4sB zJ!qr)U_mL$PpFJ;LrH%DgwE^A1NcEEDnZ4L3~N(3Z7zh`@+Ej~g|K3qsU6e4fSFNG zp9imzCPuox&zMf-U~Zvy*~TO=N7(CJe}NT$ihqG;WtjSy4_Inpbu!mt$1E6O9c#^H z%|OLddGkR@2F*_p75*$nrjpEccrNxaD(F|$fl5WWV6bAKs=u#qmG_&cw&x;rCwZW~ zeBg?6U39&1(e9e=x$bAsNza3lwWId|Jhv|Ss`$_Ot6|J<9()%ZA_w86Q51^Xej1Gx zbPG5TuOU^a_ozt^V-7LZ*;`;d=>XV7ct>TnxfLDd2+b{Cv*L$TUlWpn^R?1z3#pP{$Gnpee& z_W}rEbF|@FXRLcmf|yrOs}3jOC@mChrE<`(j@DLcJF(7vp*cYj>k8i47bt`(!om6q zI2ShTFLz2b zh=4Pb9s0}MAiPwD>bJW(U0n&?^fQpnVzioI5G?~mFhdIiyJ@KYFF2c7U`f?B2ElLo zF!n~j3_@Z^RnnC7MeY84C=&L7J$9blCyziO`%1o%RFVSUCnsw8eZ)@`a2*tU_Tlj0 zrx`es$WQWve8xWWHFivo$Ze1&E|GKC;~gRgQLD0@Y$WS&EG5ga|DR7{!PJ|B3YKZm zfKSFT{?Eq*d>;GfV=NhkVe~SKk1DMj-Kc@ok%VaF`y>#7@61w#=}qhJ$Mw4;kxxsoX1?6#doNY6lcRSJzj&=jEBOHfgI$9x?EW_S#BYeDf zpzrQOyx=gXj^}U%E`c3z1IK@8&->UXKZ4uHL$vQxu;QNM^GmoXJ;!%X$zvQ(@PCi- zd-w3$x1n&k_U9U0B5`mwJ55fIleiKG(bIP0?`*|iTZ5{YW!Rf8B=c|<({U}vq3y?@ z&4;5W^hbO5LVI__(HcCtMt@qoF5X2|QVo5zJaqddNikB06ef9b#K1i*C&>XKZ77Z~ zaO>>&z!Lut=Z?i!JXTQxa{hW`194ZmZ@^KAeB908yI_jVI5P2dDn`GwKS#Qeg6Kdd9+PpT;D1u_ISId;_~*OdU#0!|X(l|IGVr|g z|9=e!=#ehGmJ6@``)_#g7rcKy{P?Rd*Tf@05`R7dI3ERH{eF~jUcb*zH8h+lLS%US z-&yPERlj={mL&#-kNRZ>!P^wxk*9XcLh;d zRT#(bucPr8gV&D0^@zg%N8zAxE)t#-fqKZ_=T4)lh{ON?z6Jqsk<-z>6!GExr~GN5 zWc;i!`p0I(nFy*+Wg{ov3q@`kZ_$>wQIRBpR=WU^s9fM5e=}Y|A?d`O2?u)IhXgbC zMq{kef}F!$-hsR{4k6a^+-O5SVf;x3IV3m6jSBet&v4J=Cm)SGxX<3>4%vq6u)D42)z#kj-Q;4}`Z;Mg%6}8FehWURanNFR@m{?s;MBb2K++;B}Ez`$?U|*NSQJ3{1 z7~zf@b@0x%kQn_eqF`f53_S-N(j=oW@?*t7xLmB)p)AHLjEmX0ejoHkWIy77YxTj1 zY#By6_1K6b63(+ADS&-O5P6H;pmZlu=Zz?0Gid!k_zHwl*Ad@&WVA3Ql6d`x(H5iM zTO$j8P{~-Q?#1&C7z2zB)Zb{;M|x+Hm)eHW{FJ_#v_X5_$B0piQjA_?ie4Y1{w&0| z5{x{Qmn372(**CVf>9r%P))QzPU@3!9<%#R{U@lkEzrtmiCb6ofS%uo!MKYWdH^*a=ly#W z@EN60^Qxhj)+BW>z9J@#cSjks$X$%m^RNzWiCE@nDDrktR_X?3zF$yE3K;t*Q8TdP zDMFRS2<1NY%{7DTk?|#$X~9OP?aCzlplW4g5|G&>X&iQ=hHHlj~GpsM`D!#od~-f| zfsuL!u2(LSkNTS)P7fgm^=H~d1F9&*`*%XU90Of%LA?}a$ErB5H~I@1fq%Ea)A=~y@pJwa>qx?9CpVcrcZNsxP_`nu3ior=uKn-k1 z;@6_Un=63X?TWFK>Vs>U$#lR88BhztGYi;+a-q6*@Ekic^)hB!7) z!Vvwn={2#Y3#TR;9o1|tXk4YI(v!(?El&Mx)CD){4fVum2eo!f!q5tR8d(Rw)(ZZd z2DO!12%dfsy@64kN^cMQV8p)NyTuzL1=zlF3ZmsRQ-b@KRyvA|U8cda_Q# zdCyIiAa_CF9|SH{B9x+(;Xq{Fg*fdfjH@M37uEp%d^}a2Jco0IQy)V`&_75AR3l2p zWvtH#3F4XzLrv!mu+3`YIXCnF($2ks0ikVig-U9V(cq1u1v!^vOdUgW~>xb5chu% z;&uZ5VjSW}zi_Xu!Ax)mua%3O)*nKZYXz03lCcM)eoxZQDD&ss_8W=%M68b;Q?zdOV5<#w}>;Q>ataKIA4Q=rxR|NIE@;qV@OZX6{g(RWLNZd?>|#v9BLCynBW z;l`kiOOkvTX$0J-!?AL8BTvzqEJC*G@b3ynkaz226wknD))QO?0sD|cSY?~3l2}1q zfR^?kT6_=YK&)ttj~IRXVy?M|oy$l)94o`?So3u|@8OuYyJH5v zgVAXmSxvl{N6#3QNg1qV$Dq>n9Ci=m$wl;S)F|K_4&i#PC+{(;qeg)=reS5Ix3wk>PcmS(gkreUb!momM4H!IUM}u zVRA2dj2tT;mY>PlsEul(%tdv(tW-xG@?|VBTY?-N4{wM``hRd<=!e-%#hPgoNyPm! zn|efrgTB0rPM{0JNn;E1jL|{fY{!lTlV>*~Ef?9#?0NPWyNz9dch{UPfQrj|%sQqQ zQ;)4?;q;FBP1_@(#e8wK4mKc90&%SgjNydbxwk{66m)PfvG0R}1F= z$I|Q%S!1%IvjUkfGhbyoGHYg?%Br0GI(venyi;+00*CB^=OhRQhx|taCxfTu;~;CQmdyaLRcM&LqT zlKz(5rs=4Y87{s;pIHVrWLa)HTq`1&{xnt%)L`U_D;fLseEMGW=!c;HM61tG+tytv z12VTm{w}|jUxQSWfT}kO$RRDjVcDeIQCy&ArR$0C4{)Q}tQ~!fZpYmF?ef8Y0?|uV=QiYvIq-0JMh7;$VbGR)Os_$^5|#XHNJ)_$;}s z_nJ7;(0_ZI6`~}d`*z!HON8`Y%rDI41m=rTOzSCc56tlO^Qg|P*%vaurmspX3-7vI$$gS6NpBLr zB*rI}Pr8+~C;4*9i`1+%b4K^fms!IdCS){nf~;u|tPO@M^VN8)UPh6<)I<6k6VJZq z{^Jh_Q_<&BO-qq)J!P(BIS9^5H|rMU(VSM^CfWklcOc>RvU1k#aMIXjW|8ANVRDJ3 zkZoCly8Mrz)D&h~)6-FZp8?AE9Q`A>qo>re>LrkT0`gIe9aUwU>;$RxE#iXTgAS;6 zi^wg&ao+(SCq}8Mj7RNdx>8adrVi9!86kQt)I<-W%CiNSB_NR-IL{A4QS&eJ3(FaE zd+X2;*za0>}?dwXLw=#x?a9mVgGnz;LR=<#&M- zz9Al`^I&#HX2p!Gv~{U-Qr0EAkOx|jG(Txk($A!o$#YWHqQ9+9-;?3V9GxvYX1EgF z&AbPEVSzcpM7fGOPTQ+LF;a<-a?$b3L-rWlidzW;^}4N0DW+KxZ=P*V0#9?5<&{OS zma^8tQOYV>-++@;6;7U=&CjG7(neE~SO(QU2l=mD2v?sS%j~DWVMH5<)xQ}|I-e1z z{Di2m8LZ&ZV5k!1BkCy+%RA-m@?J24Z_4jwH|qAPg7dRLIi-9>ZE78Lw7MG{YY7DK zNr(>r(sJn?Kvch}`*oQNr)!XkMi*4O?BVaR>Fgc^P0k4anD$t7%V_He+_}^2D?^Kc zYP}=O9zHkXY(zx(#jr#;#Pl)5Mu(iN#~e zTDB`37#bkz-dOz$G0!3D6x2iSLUi-78V~-1RZG-sk@Z?#6%`@$9fqeAa*nRcZe|@^ z8t7q>rW@i5shjnUb((FB^`OmSFBQ7MzR|YJw%1l6q>SyErGwccju3RzOx$H!Q9Jc2 zYLYxUnCXAw{qA1jTIf9KSdo1qi-NywT4uSd*;(7OQnKb{FL&H>zI9!8FZRs$9`hym zl|XXvio96q3VQPutuAKja6}M48u>_D>~41>hFXy7M{UC1)P}h84Z0As82tXO>;twI zcZ`eTr}6K=eV7QM#wWoIs)kqiCY%SIrL^#p9|pSARL;W=fs;gI<}4h0wqVb)0Wp_z z*cHlHxs24SLg$i-nD|Y^&*LzE-q0RlK23zv1_MWnZCKMb)N^XtdSSW&^BFP5A5;kt z$m7^JelVD2E%;=?35Lf~Db_SYN;E$Nzqpk&6*-eob4|$x53vj`gVmV%Ob8t`K5K>5 zzm-m?Z>{3L>iy+u=s5w8>{6glo^$%0&0MRHbFjNFy3cwpdRO}DLdp3y@G1Bf9HFMT zX0zdmbr37=F2-s^WLd2In!%}|HP)?D5Cc6167Clwf{nZ!arOfAc*N5yFq^>S@6MiO zB~V57ao;%!<9{tMuPXC7L8?2$jYQ4;O|~bS#Y~5L$ttX|_F;v27cpak)nqT!-G6~M z$viNB{?hAUHBkxeRR_eRPWZ`KC~sCGduYaPV7Ibe1HL!^6}yRgUVb$Ivtn)wOxn{qHk-mf%)kJ3i?9lXNc zavfHqMG%kOg}uQu^q~Ouc;#`obf894o6(mz)XGnyFVP&+4L%Ms)0ABW7H$mJnTv%= z=Nk8jdyL23++=XwDDL8)Y|Jjy!91dS!R=u-deITAKQj@}ZV4sQeSNJy1TG@Q^l+Wm z4Y+aitDgv!XS95LYob*6q%sHhnWCSzN@1}7(*&lQ=DP?4WUqaNTay4)n zet>9N-;>{6)3wN1!D(@N9oY`2ql)vSvztqIZFD#A$z%&5(>EXP5AWcXRgiDMcL8H$ z5UPqh@pbqZK8rh#^Dl*2au(M6amZYKqKAR!HXm(u0I`{m$O+_!T5BGn6|DXe6oyuQBN;38LVLFr8uRPfE1>4x$IiKtR#Pzo1O0#d`g$9B9=RqsJ2-Y` z*U9#0U4V;y<*a5|N3+UjU(W9AFgsJ7FI`vN$316}Y4!RoSSjhUQ^|lo_7D9McDDu4 z<7UuB(4O^hFXrQxfHv5M-wW)}(f3~SwGh~Mon%0X{61f0C9a1E*is>ow?FB~j}Bb(Jm zZK1YAUb`p0o1v~nZuKsl<0xo<8o-fk0W?-m;H?s&SBE-qE;Of)plJ*@su?|z%h`>c zYXU}@LWsNOq1}jSZl&Ha|FCDV2g{;+u`f8C|A^Y&6#f;zPi$fiwX8DVHI0!{%$2OI zt#d46puhOnoEu#7UQ%sS4e>J{0O!xb%%ZB0ZpK^91^11?@S|SuTk0+1dFwh2|GPtu zX^uu<8qd$3nEfQXtK)~GpEJ$5(bWxJcwt__$Ahbv6?g%MlMTuob%fSZxBrQF8009` z5qZKv@QbL$9$>?`DexdEfZn+e8P^!09Vkk>g)72i_=vt0o`a`;SXdx*0gLJrzm{*v zr*TW6bvwh>XP+=#m~ZqTIvtKfI$41j_hm$%RkTf4IJrCr#bz+PXL7<#BMIw}$Lc+_ z=mYGIKdH%>QzbZ+RfcQHKxhZIXy-7iWTO9;fYxjb$r)Wck{7Z9lb6F5% zdr7IF;5{;lrcm(?c<-&bhHQX-hWpLHPFT>Mg0)^(9vo~PXzuUi+vP3h{oy(2Y2}WOzh$sD#;XQ-#RHV;SLl9YggXm8inlI(ooPT*a@6^Mr3 zWODFiFbm$8^RZv80Cr|=)3=7=9lRL zOe3Z*GX=_%f1yD*1;>Xte4NDB+nF`YT;?Cd8=5j@v2PAww7iV`{v>4AOVd17>2X*? z^hdjdP>JLUB4Z;+W8|O|L|85$qB+gzjXXtJ=npuUP-u|nA|q0TEI~f_r}2|?q#pnF27~hP z5xjOUBjf*;?u_{HBY4I=VME#SAl($=W^;3)g>A)+fWmVkx0l<+jf1}YF?$HdD6n+i z;@#DQ)93%ybtb@7)OQ@;eJ{M1OUOYE2mvDs2`GW$1s0K!c8o9xB386oMT9}rYAeNd z&~b(eINEwu#ZgqK99k&isFi|9MbHKbh$4wd2v-u45OR~_y|?{*_s{mdsChfPZ}-3d z>v#T--|zq5=X}$AY51Vs#mxT}Easz_=ldt~LIas)eunvzVUecrd-(8t{H&M+?Zlr%$*Au6_e+&Qk2|55w)Vq0~(Ha2hS;Wb6Rfb4=oH3bS?7=||3VZs&WZ zbBXy7)|W@IAok+B4Nrol-!XSP7yCjsJ>EE*-Cpg-&{My#x7#;ElL)=b$KbQk?A5Dd zlK+18Z(Yt;c|P#3;;UG*;k0_3k1Svx zWTyKWW<-ma0dK?(^CtW?o$u!PnQ4AM@@(V*c4`|DNr|-ZP1w(n^4Iw$;S+djFTk_t zx10;;FDynPmWS8Sf8T|ks$rM0H2PxW_}1S%`lv6_&;JZxmuBWE^Y|Xz4a_Vr0!!=g zKKL5DY1m1jmAjn&+)Qg8e6ox=^8wYv& zC0+yDiTfU3#C!{HjTf15UxHO{Au!FgeuHggDzHt!o;Mo1|3%1=JS}8fmkqiNTd6!P zPP)Dphmf!X)afgHE=sUlj`2wdx6X>~PwkJP z?@IP8zSo{+UjtQgY}-DDmVXBu+CsQs0yB_7<~+W_2jmTBne!k#ehoCrast>dPDT!( zW&e%e%^JRK_A)ekDzcRJ?$7SAgkJB{*sNaW-D)WDVdN7u*8#LbU8IBWiKau7LOkXt zvs=|XxNr$NZ57@j+ptHoJ16*wIPq8^bFn^+vc^!CA~570uYl$CCDdvw^2)@D8~GUOmlR!xrXz_fpn;>rr@OqJ0~?4VGXV8Dam;-hfxs z9Hf4kz0Tgjmr{3fd_udq7rFi(%vYcXO6+a+R>HsJ++e?e=hfpJkKj2qiJS(q`(6-B z+!1E@{{d&Q*8vv4iP#V_WUYo zaj)h)g(j|}kJrq6NhsoD=C2QSn1NVp3XzKm=!Ton81tOp)BjtBgsgDZVm;Y{O=2%) z9izl%yexcJHd4XXAh>xL-Yl0vm2uEzBID5_YceC!8=%m%{~uF%oy| z+VvVN997OO@M|Ns=Q(KI2cf`N){TO1Gw;_yv5k2++4wE<8h4_+Pu zM-QW2xCG1=a>(PzI|>QA1bh!CMgj4LK*PbLI^Xq6ktb3XHtN1;s8l>rdSl%e4dPuY zu(cMpCQ(ANAte8L+aICBKF7}2i@kXdp+`%g$lU1l*(uAJ7}>7YV4q|x|JS_ybac4dwd6fg>{T$R=dXhP;r~{AMpLTQ%pYl$n79`mXq@d_)K1E4ak9fZo0sM1xEao&jcxQ zVf?n_A(X;l{JGM=X6&KRRQJ8SvE+9pPc30Oi5%o}6z^hOzFoaIgm+J(HQrw4s$j8{u*D*)&8Z~_yzs>~4iv?)$q1c^A+C%MySYZ>v@mVa(%faas z+N-B&S6-m?n#J=SuAkkV=)IZ9+wDm9)zGg9NuG$@4u$tGfOm|~Qrx);h49s?14}2c zZdTAIDRaK1J=+f!_tK*6i8)FL*#}4O=lwUddf&p^W#IV`smk#uIf}mFb1~#q4bJPp z`We?NOuk@efyndnQo-_)lJAy0;6w-cznO!r`eP0+)WfmCbC5KB(L4^^(}t~DJ*u#C zm~sPXqlodW%T@NQ_0B;Mls|11)D3-(sq7v!)6v|3M4uY$-v|u|qOW}r1v^X!r zt=oA1yYm#i=}=v%1vj*k`+nZlU?(3*j)%cKUpazDrvv2< zFff81*p1Z8M&2$XvT|ik!(RdN+dK$T{ zMhX~>q2;R4e4n!d^gXcOiVUoSCL56118~|KXwqWz>)W(2^TA9GQW+$z^ieiA$pfarz?cqKCXqujluCpi?Bm7zEOK-xIT0Ek z1(s%HJ{hVBBhBcXa;T93&7|8;Q$Mw{Z1cz1CL*WzP^Effo zItq^m;eb-4a4&uNV_>QQ{*^W?`h|3$Tlpdz`(voUNRTH%;iIgKh+w-Y! z6Zs~?$D@ENk$C;Uggn@L18X{vW&!Etyq8z)wcsy-c!P+M?xqW0NCzmkMRQ)q)q98R-0Y1q}Ca_)zE`+}epmriO&mnFuP-c==l*Wsd95Q*6K{`H* zLhK0THITnWj5tcus8qbJ9=9JH_Hxst5VxLpowO;5F2A-A%YpCZlO1%&Lz0XRU@`vN z9prNooT#_dz+DY+)WA(ltGjwoEqfz;6rlH5K`M*-*l<`YF(Qtst7bOZkvNSvL^*Mm zq&Gl4BV79eaRzmi9_geTB){fC99h8YhmY~sqi(4{o((S9GY;vJq&i?!nnyA#N*tjs zqChJ(s^#ezHBwKn8EBiyMY=zM{L~v$?@b=~5yI=C-YL>ZO6$Oc{O2>kusrV71B|DJ z8N^rrus1adP}5#KXF`=!aILexi;B(=Hn8geNpDOMg4;DAf^!~2q4)mAee zs_PlJx&~M(kcbm-rDm$Mj^iXUBB`k$v=Rt40+;4j|6RTKqrB00N&N_=)C!PVAl51l zvu328|5o=n>%wmMK{OG^Yqf>ALhD%6OV`*c*@eukTuB46zMNVwqxBa?BT6#Ufj5Ov zqa_tjyreO*##zcEg{#I|!h<(bFzaOWtkaAl)VGU=2h8Y8qdd(+hy%?iSYuzqjT#4Q zy-9?tLUjG%PaG>*)X$9OG_Dh@(tw(AlANe5(!V4|+QN*v6(UWbF#Swkk{{JUC!fUS zDo*Zj4~>!9InBRWGoyPGBA)Z^w2nmSy!A7JMLDWRBABFG1ec!89E_gy#)DG-s*51k z2-L(kZxz$TR~+w2IVlGnCPggPyp$$KUG>(aFsal=sb=P?x(jM^6+D7nR~_Optr*h3 z_hk4^VbY6cWs!LjW=y-F(Y?;DbM-X!H*kuA(hO$YDJpuSPf<^!c5#qo*POc79Ewg8 zZtlEiFVv(HH|UUlH8TJTH@U`MO{giuOJj2PuCe7SFFi-gjID!_vFO{_SkfBiS?RsH zn%qpTUg_OyXL#8_APkAu#m|PnO^B`rf99&E*h3ih4#WSFo#^SkGyf)bY#N2@IhwC2 zv3oib$BWzjomwuv_wv@iC~pqki4)A>$+zLzp02JKxcqGH%vI9i$%rR2hU;TvnLLez z7^&!~l%B%9JdMOfb24{cS<%#9cr@gv?~G>i-gSTSLVN!IaVcI+^xwU%CKr>U=N!En zn1Am{6pDs;_a@W}_ox~D7mW>_&7H>)9v2wSF&xsJdw%LE8qZ4~T6lF= uNNkOJ#zD_-JbcGuF&5)Lyf?brgvQ?gFkbAlp_<2~-An4ZW`ayV+xj0Weic|Uz;QC{{N)-~TJ^Y+3)5^M7*re@i%9(my2>c`jQr=zqpX zcF#rXmtD%wbN2WD+WfP&KY#zfpV{wcw=!GWk^FzwE;0&!)*$=yXaE2FjNHv0x&OES z|En(z*+#~}&pfkp|9Otw&u-Dr(z8D!cO!rQ^*ut7KFL03*EhQ*KU=~AQ&VK5@nUh`4f4%s#PCt7fyPp47l96ve8t}hbkX>s6C1#Ho z^~b2mK1a&Tu3_Z+&%f*zXUi(m6A?|p|Ii*0ZIb;hBKOG1i2P;CBGQV8h6s}oe1=I7 zj_h-`28rl~NF6ZA?q3e_k|3Fp30aXHQWSEaXcPlSG>U~3_2bG0cdhV@8Hw;lq}L;* zM%tr6X_1m5DfHvW{vP=SgB)mhmibZhNJ-fmFw&k#J5>^ZH+t5jL7rjGYQ98k+K$(jbtx5L++7x&@L6q zGlA4hKiV#W3~V6L{HP47kGi4}P=lT5Ji3GaMNi;(fUcqw=x?+bO+x)qN7M*aL&Z@X zyo;gKB=Qzo`GDLa*U2?FKOoP^2WV3k@j*E%NZ$vt`cB@%{d?pJIY&-FIzukP^LOCs zr{op<_8IcYgeT=6qre2U$qTiqiCRM|hoK2*7Sw4K+5+|3hYo=ZPN3819Mtg~Iu7@i zp)sf()JcIH|03;4EO~>s;QqKGHsD14wtiIKs;|*k=*#tW`fmN4{;!^Duv`i9iXJUh@t9HGpOs7fo?^wr$5t0nIX&`<~_r(`Pd3%#4=y$J@oIinLb3-qOPC{XcJLz2Yg63=)<&6YHw9l4l9$C9!fW5l(JcQ zr<7C|tFk&;3uv?SXnYVi1R0D+BDI=|rsvb?bWLUovzxg9X)iO2X~BrhMY=yNLH?~M zAB=&fApP@XI%!DCk{Zy*nA}Fssd#1@o6MCLY8yO;3S!Vu#}F<2$sJ+#QOn6peTDi? z9vTZ28evV(_J-9b6fGKRn z9q}_fg)~I@D2=*DPh~`QAiJ7f%(i9InBL4aIww7e%0S~#E|dtP?;JS|=j$-eF2M+s z&}_7Xs=<`wmI)zIHI6k)mi6W$rmNx!zACeh6xD3<6vO()uGOUzPhbK7koWdu*DqoG0nO$^esxBHy zRQv|Bq&xYS)PnK)FM5jZp&@7iDnS*c*Rsomb5b75eA_X5Z+jnWe$#!y!HmTQrBkr4 zuc+sZYlrBlALjCD|iWfk*CtvhHN?896iay1w}q%elzk49$nR zi_A@usYC_c9^zb_bv|p3>#ny==$tl3DYtrrY0@EvlM%qWVm8Kb(P7&$(>`H8y%+b;60{@weB@*53wDV&N#<13 zHe(U-AMP@BS}(0k59xvFf%stEkV8&XQnc~-8tDq!NF@*PPG+=t#`+?@T&^`askmvj zyHah|jOwcUeZI^ODI=0Arw{fn(z>v-4X+I^xhvFnJw?9nFX?=c-1SStkL^C!POjLMQcvp|$G_31V-`ohwSAXzu)}c|wV8TB?@N{EW*b@?FPPU`m)jDpeavPti8+p! zE9XM(gTVldn9z;zTjh}U5pO4(P%bipYH4g}Ulm_G*Qxjcj+as?@jaJHzRUSt9h2g} z6-)W(IjniO58@O<5B@N_mtKJX2#w7e^KH+&dvBh7sFJkIwLn&>c(JiHKKgR(pxD=r z^QJ4@8Iq`;R=%jW@ZYo~3^&fSPIS1V+C^QkO)<3)9CSbWrZw_CQO=_jZjNEIm|>{F zg|$Ra|CF>(W#2V@ckok6Qk3gYIgNQ^nh@oS{Std1s*@$JArHMo7gUd8&?TxMzs%U% z_AzR4j2^wk(ZkYK+`*i{os_+yqQM5iQK9yWv?DPJAOobYD`D_a-)&UOD@Yj zg0cR5{!jiwp@#BCwYi?IH^E1>Vwyu%!dn6ZL)dp-Zx!=3`g7d7_@?<674qcWpAb#I z4(|5`oG(*KCe}#1?k=rfV%vx(#Nonp`boHZX0ET@UVnVj=JANogf&0$zVi<8 z%?i8;R+o3m@03GwKe$8Cza zZWqlX4HUPY8N!Yho*F~8M={?L>f}0+%ax;2oW=3nc$!;BoXXc=mVddA^{?^!1JR)e zp@re|AvSzA&?s2MS257q(?+dj6U;G=MX}FwZ^>68U#o;+>_*J0!~LdAL)!CUQB=0^L^sCNtyAX!_;`GiS4=LtD}g$g5|pOmoSM7 zu-*9DVywA<{c`lgxNGs7iia^r+Av2X3QOsCo6sI2VpWw>9szx!3CC6&hgVz|anp*`vn|C_9@sSlEFeSeg+ zFLiR(A>RaLGb+U`6jFplz6JN13D8&QJWO78DK}BrEWR+FGqctSR-fgV`J8c`SV2hO z+;k0U1?i86>rb@>T50VUZNGY6eW-j^?#YyrLmngNmOIKGx||?5OgT5^*qdW(bT!jQ zwj8o4#X`nFA#YCKkib~EAsNjs=cD)+RBpAgzl8Hn+US%k$pur2r}fIL=&2OiqEBP) z3Js)D(oS)WP?lfM_F%iRyP+53gs{}y+}ge*=4pkI?~ievWo+R2EtUKhj2vLBGljyvCWu+CVOV{2o7(IFNUp759W4*V1$ncpD{6u$BaLLq)Kx0W?Bi>O%S zz$di2YO35*=H)YCi(FiGhNsH|~Yq_b>v!ceYpNyUale+#d+B-Tmx&nG)o7qb2O2$L?p?6Vv zsqLs1N&c_vxGT@nD6|*N^EhbdMg3i{o0j zE^dii;NQR!?+;J@fv4c*_yT^5MN*u!A$VZX`8}N<*>$eARMg+TM z5hq+na7qLt`T)sAaAO4RQh)_Hz?)XUnhEe;BozjPRuE80Q9xWJP$@_iP!(u-4X9at zz(h?@3)B*|LT#Y5E~qo=4)y&V?1f&aAAI&fJt1|4`<(!(v;ynB3A|Ms@LOe64v9M1n` zY9c*{e_-%z_A$Z$M0z&(1JMVdWj?^`Ug&ctw9^I2`6FckKFx%25JB{rKdvI5ke{*jU*zXc#y&yP~P@IC!U8E$wZ>&NeY$VotvnsC64 zaL|?*;G6P7J0hbk8YCQHN(jk`UPDWwpxrOwTLN+dE|tj=Ksn`59rOzBR0C;7!FVeP zrQHH%;UJoeO2ORg3uxmc+J#>dj`{{8;}w|;&u&Ji$gk*MoQe;Srhwb;l6h1V9*u@k z{Q%=MLmx>YEdgyM=_rl#z;~#U&~s(bB4!=sgt@R5zeX+SU#M@|67m_f2V9#A*{C99 z9n6So_!g;6@u(9%Lmr@Fcow;YE|Zclx}TC8_!BuxCSyM-0Qc$uX4ha;Mbiq}jm8j> z8cl7+?*KJ6fH9MYB;xy^i&D`>>J?s1J)t_|6yk;w+K>*UJpKT!Uq-g#UOpcIvd|N*abI+~!fe~E<`r!hwG7U(7=(U2VEnWmT zrYbpudypBpINCvW;b-VQvBCUa4RW4DJg63oV&Irab959BM=QuAbO9;&3gsd#sNLug z`9zgMYk)_YjHbZ6e@PCbvuG+g0UU-6IF|j?Ix-KHq#6PDaf;kSZae_ypPdW^Ij|^` z{0{T=2cv@5kW=J6?m&j%%h-i`V2>{AZSVm7fZk1y)7$FtdQj`3IkjK){n~OZMLVt! z&}sdiUINbnX%LXsMzRsTM8X0d}Swbs4na1+)?L^e>?Mx`DoH4I}&o za8ljL6kIW9_z12A987)~$w{a(HIuqWS?F%` zTKXf+1H;me8Nqa6nlaJL3*blM=trROMXD|8i+YhbsvonL)>(_8pz(>ZmF26oj&-Ij zU|C^mA^s_JU;|`|9;=R&$AvBhYX>=CKSF^)fusJs{yScudx)!&vqsjM%w3t|vW%|Q z9@=jOjQvdaq2o+EpTn?PTrE{M?lLABjizFz2Bt}-y{2cT=cbFM-lqG;&(cA$hG7AJ zi+w^%R4H;oFRc|*3o2{nSowYUY4})pgLX~dhD+1yxVeUMQWvw;e9U~!^2C%w8X%-{ z{pjuFivCL7tUQue$mwBs*b~kj&J11)^z?V}ws#+J_Rl(#c{;Ou)(t1^dGE^#7FWjW z%TYsSHrGx#Y}hL{mo7*KV|(M@#!O=a(|S{qiI{w*6(+@qrMqGs!!rIN`;s)cmL}V{7-^Dxr*K%n(kOE)>qKiQ>lt%?(*4FTrP$<|n*frqtRrOAB zdz`zo=439*5Hc!el*>%ZD&v0TeHdWnp4uL=mu|pK7Fvq8r9|UNQ)}}Lb8*W8%UesF zwTiW})nMIYVJ)%duf_q=8N*xt8~c&|h`hL%zEsVlxWcKS5~1nAF~N4B#^JfLQ`x93 zzz@+s%tHRP;j#3)X@z;5CBL<$=<5@lEbq}ClSKLnx4=LfE0`_T6}EHs*$$V3j=Jh7 z;b>ydZ@Xy8WA11iA`S$U(3An&hs@PqsGSu-4u(#L4B^S)D7k=gKpmi8Bg^R!dz&9@ z2#LjwF{VqVzf2R1n%K)QpP#~ZqeG;repu-oE)y)_@9n+q?&PZGT#!{Yt8UiutUsM+ zT=hMrd_4j;L!A{`KSG+(ciDKMl&DK{Oy|rSEG4Xit=&Olqb!@vD@+}YK5?|+4PTL) z$9$yfp!2v1Ec9=bZ*r78Eqph;SMIME)n-}+To=8k-*Nd23q&GaG+8aFmS)y9mS-lP zR9|c$yko1-)d|w_$QOeX{FS{0-A$dxGuLJ?8Mo43q_@jxl({!+vg@>`l0PN*K>k;I zMsCroxMGG0(sWaK%L3~RTMqkg_6GJuTUA>_YqaI4DVK4uxKX&oy<+@SUep)g)>^3s zB_nJLw+mGcnZiikCNEG1Yx{9-suC*-R}A^2I1_8BV0~rXW36myW4bNn6Yuhb38TIG z48^VCwP>MA0Y(YQJpFGG`d?ii?E?oKD|FyYVjVsZvtD6IvEb37CR|pl)kIlzd&0wOgb= z{Ri8Q?`fzb-7uz_TA1&fUKt-q)5V*@F&LdY5Yd;b)#P`#G;Jhr;_I(Db6lWn5)cZ1A8@#-A}(ldC3^PtTtN})Pu@?CAa!iHR*}?7%ES1XL4}E`TfFGLld!}xZ3bk zc)@Ss%Ce*B5nwHJ(E2G;!#jhY{MCIAJloy>xN^9zJFhu&xn8CfD#?Pi?^A1Z4%z2Hh2Ih*UAn@9D!xa7{TaKAacf+7DRUmI@+ z&suk!`-@9+4Re?G)c0-z&Vvsb=4?@+Bg&coG$|0%^5xi zUz01(2I*1G)~*6dUl_6l&jJs#)tlrQ>Z$JO;JN4-=^g6Z>(3K>5ZWoPSO30wlLWFv3&?bP(sFCooPXvdy?yK9xTt3^wEt&x#zc}12!R1sjVJR^J~jAR-XWfdos?%T>$@C0f%k{n>U)OL3N>qQe&x!)GTToHJs{C zb)$Zzic9E!6W{{o<3so{_TvOn8+=Oh0l_{3JjDR2ECYzUHCUDrWZmlrvhMN2&TI)N zzY3t!GGMnC25)8#z@QOtaRT7i2!bsP_e+6QUjUT#Y6Xa@ zA>>{S5N&b5W$}O%Xh2>r;IuygmU;yK#T$Ue&jTJm59uQKTO&yN9(Z0~fEV){_=+sH+=7?{a0)L(MKfd8)@YTL2ufg~G5OTZ;c>Fv_=M*^x-rGauAlVOy zJv;3q2Ou2;WO5Yn`zgTh=K;U}18>{_+!sOc|AJrj1?2Ss^85}G$^t|f0&I$ZAb1n_ z$YVfeIRQx(0DM^tFnol)CJR)KLFYlpGZF`Z0r4Oxm4_M_L4J-O<#TY4LCM4fb-P7Gz{dXo zKXe1+jzNYd|hJJkj64$}cdJcX;Fe={xkMbAVOPZj` zWF~4(FfL112IeUYm@$Zdp=P7UdLq*i_`GTC9IX(#LzUMS&Mde*nZ-2vx+T(K)KVK7?t5R_Is3 zBf4B4LBFToYhI=*zKYw?j9!Lf0bS3;O{m&vqP~SGj8*8XAR;J^oS;_Y%G54$01pG% z9s#yc0ZTm=-3J`Kn^a&9k)!lD>M1J5v?Imo3Zyz!4_Bb}VVVr3_GyzC9_Il4la9;L zMW9bdP+24em!+1&fSs!6#9qp(u>5QJ3vi#!!sS&s@eTsC#9P>=yMO}sngI;Jj-odogN~7;|2dx}!!vByQ z)L;5Xs;HiuE>4Exv&>axCwmZk_3QLL{WQH?ZNc`?XX9n;9%VRV!+WX1;K_f-R8VI! zHndqU&J@!Z(|7d)=mup|@AINkfmuyN+?K7U?BZ|98SFE?J?X<-ms!KYaDd4LZ5vM4 z)w;74)vnxY&@c1YKKcVn!8G8GRcHvs=-sIVYB6pLV<{G*FW!I@*AflpKn-LjXHj*k z7_LfX;2EGJzT<;nKQyD86CcRw8~#kWfxS3G^#C1o8(5S{fZ#WxgLoEdN#!7=K+g;S zz3G4z>l^SAqo`guCuMYhh`Py7CgKEKM^Dvg?V}o29GVl4 z)E%e~vyMM+=wy^FvDOBTH;y~D8J42vj^IIVjaq59LPvaF_cEt9b99#3InP<%{l>e; z|0qy1G%WlwoESb6t{>*Y)x)d8<>l?lB`uEZqn5H0!AsQ5WCQfM(%RcP*HYX(!+27> zA-I6O3DMuE0${f^gB8FHE7%_}W~XAGZqWy7b5*y}8R%HI{6U_s%u;USvt$(7!uo`9 z#v~JK-)HBdYQ?OG(rk4t7fpkNU+D(;fjl{2^FDX20IV3wTH>7PI_F{h9Rm}ByF*RF zt%1AP9?Bh}Lao48_Az`-DW=~eN9fz!X+wQuYx8-_1nUCu82w`|X6ho1H!SBrv16DX z^ja#4dI6C=`_N2a&Rt;fUBOtl>SeUw)lEue<(ll5KgkD_*Gev}hV}@rq5q}cu-}D2 zM%~oidcoey{yb_?)EfI>%N5ggaVXmtjnj67FZ+jh`?^cHdby15jqdxvo^%K}f|r5= zVDyl1)>MB}&#A?g+7qis5oIrF^CUH)CHL6^{5rq5|yHC zXewBiez3ZJL5+dWMbtzx62-!rw*$P|En%gtOjRa}Am-~Xo{xrsr(*{fxdwZ=|Qu_vz}iK>tP0re;%5se@n*KLb6V0_*K@@K5C?*Y!1Ey$;s%;nDi9 z`d593-c&CL_|L8H#$9kC-U)GjQNS+mLgT4Vz@Iju$I!pg9qB6cb!sZ*1pm(=QXV35 zj_Mut?ph_y4y@=^^%t!X#9{3P{1XF~%xzfdmeCuTimZ{F1*mNxUynb`$MH|Oh1`1f zF_XaL1dfVBIY^RzM1QIAT1kDkrfW;_bXY$|)4#J%Ij>MhTqn_{VZdANG10&q^bw~B z4Y^FZGrFu-RZoZe27CF}dh>WBcN>@28FqGp`C|9<^tybf1A9WJ zXYUMN@sZTcc))nXIL4?;&84y8Kto$W;$O2mKKdvruisZDg_{M(`qRCKJkQ*H z+^yVe-PJv1yu*D-{*}Q2;SNe`ttGCHiqM(NLQdw(8_J5A;!tUiv{ULQWr)9uLk;7E zo_r0CV_(rbsd?aSn2NXSpR{J$O<-&6N7XDIUwFjSw? z%V%gAb+f)ZKe%Ik3j%q=HJk>neT*|z`bjNsIS}N8u zJmGtAUzpLfk-AP+;<><%zgC;5j{v{*QN}BCl~+oFx>7~jd@WvItJfiiaBt|>0(4il z9G@YS5PKP?o3~h+*(~;)j{J_k_S3d%)+|#=sjJ{(N~6V^JN!qWsJDeHoN3KCmgY@; zn3_LLPwSgeGOLN}n5V5jD)e1Gt4$^O>GkY;{+(gDau%1lzj>``rSUh3 z78eR4KaIuoJgNjr!*}&(nxghlpDD|fR?2TmS7jIY_}i!#)fzB*8|dXh9~3|zVO~vU zRh||@;w)2HYmDu@{h;Ge)R?H=jw$w&)@0L0aU8#k?u5H5%Y%=-zqw{))=!_F+A9U6 zG)sw39i7%AV}Dj{ceF1@u&i8Dt3l%FD{NumSJ7^qW!hkFV>xCyYUyFQWPW8jW9%il z4PAvhTwZoPNb@*EA+&~hwF(%b`5?=DN_VB9@=>{|bkGO7Q2ssY}hFkGPN@2w`{Rov8=X4TRNFrni7mh#8QSOdH#XfAaIB-pTt@mZb@qoU6I_T%e+SKqDlMN#X`V zpLRFhGC#A-wZ6B0v@WuGEGCQFwAvUe4KbVmo;wHAl{!p{;fva8b(Zo_&MSWmuMeLC z??q+cM+<_~+N;y>bA1>d&bV10TUnTBj_gr0`Vgr|mc%BSSMN_F+V z+JlIs0&%dCP)v9$Y_zVJYo8zTOc|U0 ztJCNm5$GsS({G@O%t*epn9q3JR10jV7Pc%~Q+qRey#1){t#zNJq4|XIrnpxa4Kh=q zW{)&g87&tLR}D=LmJG7s^_mwf5V{%K5FRDBQrfCkZ56PA2T?&b%CJm&D($!AbG&l2 zhameR(YYNKd!qTR(2yBSmdW?Lan6b9?UM&2R{FN}tNmMz?_$b7Y16XmdDjGcD1-4I z^m*=2LyR%Oyv^dVX4(4NciA7=x7p41#5Sq0OYBt8H3_UqcO1HK*nejfTV$vM>bETpIw^q8T9mtuEQXUi+t zMDW~R-!aP3+d(;6*?Zc`Sx=iaBQK>1e{<~_9o@iNweyNqJ{sB=Objdzbb^|_3+xYC zLbS|i@3kVJcmCvB8~joS%O-10`!UBJM}B+IvdJ{nki;w^o0R5(Ep9#Yeprg}wmfzAR=_`)zqdTex@$E~-H8r1A_&icg(^zwR ztI2lM+8S!}O{~KIL#N_h%G_X-uZ;U?RLlYc(O}5Imt^bEqtHFvLbt%Es;JD8 z3(MESx5M+p!{m-I|0e1~$$08B)0@`}rKD@dEK`E{plO!zhKPhxY(2`UZ&fygYyslk z=K1Iz>>lP;+^HVHSI0jma5k74$}6{1CaJr$WW63ahnmspu&Ngn_8TOrgpo4MG955Y zHL1oj#@y0p!xX{HuVu?JFQ^T`*-XPbAiB7*c2;exCM(C4zDhr(km6Uo+AsPFd=IUo zU$AY3CE^*WIB4Zw=0~P$#yrwtp)j|QUPYE^U*x|+s{^_GR$pE3Eze2MH?T6+d2{Z@Ok`Vp?N74k&Ojcr*+1 zF7`CDfbI#N@`|J^uBZ3Xb_2p1t$5^X@*vr!JXV`%BlYE^57iNT9gLxs_*t@=hM1b0 z9vY9p8e3i{!=(YTuZ8n#Rh1>-n9!xb3jYq@H*bCK1J6`XN6$ddWlvXcZQpQza$sj@ zy?jPZ*9)Nz^e~8gi!rPa??OKgF}*QyX2o>IRNu7S_*TjkKO4>nKGs_iYwAhW`%y>{Y>{HLmS3_)Y zvww>3gje)k_f_!^4h#x)li#UPq zX|?4p!R@}{9*gmdnaP!~*|6wofx#xP} z%;Wr+<<9!eS=Tkso!d+Kiv;I~ZR%0IC9q{ZxP8JUaj`KLES%cb7uJHdoVKUd>el{X zPgqSmVWe~wW^vb;H&j6c?4(vp&64kff4)#?Sg=ztHP9tkJ{T1$9O@IE7p|bTN1e4; zrlLXPmYJ}1jrDm{xwz6%rDNL1ma&^{g5|N{Irowlbg$eeB>2j?i#dB{EKlp0x+|F^ zWhR|UDv;bEni^&6Y4E8Jk(FIu1myjLnQY8_y>^i7y$SGwx_i zD9UTUYHex$SBf?K!R@A5)LqX|wuKi2pZLrB%6SWVGTf8hL3ch+LGM>@asT+hiQtOx z5ILk~sl`~HUO-Q=?lUHvLoqjElVWP;5_61*sg%1l1J(Wk*}rICjL0zEmunV zxAaEo&ytno<0&(eQRb^H#gw55|hHrf)~F|Krc zv-k&bUt`zBq(||Nfc27jzOjPn=GU-;=r}~<52{bj9iA2}5=isa@=fwC_BQvLeXV>e z{mlY5gU(PrIY~LBhV{L=%q0KwT;rD#c~Vljlp|?>rv=mJXX(zyp3eTlp+^c2Jjq?YmND5< z)KNQTR$ONMg@g+U#)Ow~Z0v`qS#}k?(T~Kog2G;=kE3fi17bbb%QeCegSP_*{R#f@ zzTUphzDvGt{8yQ6+{Wlju?2I-##0IY z_!^GwwnOGQ>`gL3-{!CAnv``sbzqV;X>H=dMD=@}q$|l2((a~r$js-mdR}^a2fl_z zC}Z^L=sZ(Pm?dp8AGXzqDj%~ac52+>xNz))nD}VMvDPY>drD7*Upb0-g=mO1_^7T{ z#>h*@p%*M zaepQ>i9Hmx-+tVf$lZoW zeuKF*NPj|V&=1+Ju={6?NwAi;=ZabwJtF36%(R$o(G{Y)*iF{8rZ-|$VJ4fKzE8gD z#kJeYao{IwhnI#Hg*?Ijp*_Kg;Tz#cp?LiZtWRI)@!TAKpj6Z1H7DDK+FROc*tVOi zOOu2NObp(l>!(qieU z_`$G2_?17)HefDOf56&S3HQ}6X+1R=LN-sSHf@`ltUb_HYNts)h?Hx}oMf+Y^9(N} zWb9y`ZLVjIGDjOJaR**9p<$*-NoA$H(s7X$MZ-6K1y_oFM30~vqWq*YUI2dg zecEcRi#9^*u1(iA>65gn5a(8fT%ndR8`uJTCGn+L)_C7E#&pHB(fC~q2_3m>)G54O zeI6 zm}96To)fbm-$CL9@Oba%yKyn>1$q(H8+gGzSOPw%mR?Z*s0sR3*y&eLub>wu`|&k$ zl**uYGlY9CR5#c_%Ku7(q;?{2u=0Z;a-uoTr~UzP0SEn!eJ8!gy^QairavvZ5}XZztDA=R%~~!CtpSQDAY9!G*mS_6mkf4fd?tZMl&3p z1AOp*LuBF!+zMEK88+wM)8FX>fphqVhmv~02{xhyCYJq+&n@IPv=jdn=Zo77ry;`J zz>Wf+#lISsot%b z%nW7+b4`K0A1|C14hubnw-9kqhpP>d@{Q@C)EeOV`h(x?G#-!p;9|HAey{(D^Frjp zHi#lOpv}}Bx&~90`^4uGrW*vYl(^h*SXjXCX4}(YlBt(fo#FnW5%>OfVZ3o_9x&wb}M!tT9+!YHANa0U3Z23#k$ zCs;=_sQs{uv>yq^tMh)? zYw(L!P!H&r@o(V8?TvJ_hN?$fnPlcHJCAF`f8^^4qlH1xk1P1MoXl!WkoJLZy&xJu zo&Z~Ggb0VTAom@Rwn192Z-8B{8}!Zkd5E%?@UM6={)9_Hg!nyD1GwrsR8y)E)s^YY zoM-NGu|g(4-Oy8-D83eJNLE-|ZgQU?(y0zUtoD*W1i$);uY&Kkw}Wqpe`MfQaBH}f zGFSaq%K)uW2=WA7243`25Yh0O+6OGh+p`0+6-^FcVr!(E@=2R!N zfF$G55cN;vu#SP{h{bu}5OJ3NOh2h_0r{?l&o_Er7zy`q4%oB&f>cKX(Ji!{il$1^ z!x$qYuo+x^J~!XYu-33uC}&89T^E0{zcCJK0iLKWS1yP7P@^CUz6#U}_6W@muap&~ zDeOP==u2Q{<~#f^cvz3%GdK(*A{PoFOxc+nz^y*!TJf{_p}fcs;8wCbA!6kW^$9$> z+sLoPMs&=RoTMUf$&E-g;vk?4V25f>sQE1z7q|2by(k`zpFo{gLImr6^bP!UOX+X4 zpYF{*;QDbT_&Xr!mHb8i8kfxMpes{;Ttz>s4plnHSHlm(aq>QSk+NG|s&#`XkqLMK z9t4pQhxK}TNc#xUu~T3aS0g=uvARm%VV1L2t|k}H9bzT6Au|qk1k==X@Zk%vzo8t& z!)}78jW^(R*b4Cs9`Hj;WHXEd9)E^7i;&(9|BhF{Sb$(Ox-3(kDb0T2)^opb75KWG zoo&xVfvwBK%vz?o)VUC0azHH(5k%AUA`tt07hi%%;}?1feT?=}9jew>$Ef-b?N|fi zvma8Q>0?Y;*ojjUJP)my1GIsjNZF}pu%G%H?BE?louo1;o+i|7Y83F_1JO-V3%K;o z*n)#FB68vZcqulKOuP{FrZ~#N^kvtuWw_IPKK?Jx$F*TI>CaR>GyreYKWM62QX2^D z?PR???Bc!&sR3TApVyA5*OVCLsC+^$r1+FrZGxVLo5LQLk+jIPhgw;g!*m_`Bej;A zLd~PDP*!>p{Td>mJ2BmvGR$+}=Z``hO9zM*C`-OWPt1Ziq{VnIz7EktpF!Jh!vCO! zbT04)-V}O@=@6aT*VGtzy1s_v+%RSc3TPhSmm_T65r}2#06Smnu24NxGh?-vNI^NDu1{ya&z?wfbZtb(-D0^Q)!d_Lz zlc>T>kcnY^%sFN-69v0|s==CEj2pop6aInd<1$ibDN!VbQ$kJt44W4$gkESKu+$?k zg8kbse(271`aJ!$mPg;KZopljUq|v^3?^eAbDW*AZh;uhxx#$5ExiNxQAQ{Y)X(Z* zy$*&zHqhA<@fG#&aKXSZ?@{+rXVI*NSt-sno^Sq8=!CLJuZ1enzktN@Gik6#KaHlC z;Y>qzJ?u)HVOTDvxH$0|J)S3`@zzcGp&(<{q#V5;Z5 z^L$nnh#xl{3J;*t~R9e&^cJg2DJsSj1 zyOoZj#-ODTH9+AZ`U$Oy_5}7ScTi6NYu7?)i`z1*IKTM8c**?4nm?+fZMLzvG=~?s z$1Fwfg4mZ!v`!CV=2O=p3NTum5RUi%<2E~2W!-nKb=sVxT~5z7f9_Dz@ZPYb>8mRV1us@EUFP@Snn~GXL*rLoUC8uzab%U=oKb4ovK+mZ6^eARB z%CB$JcByy6;{wk-PAB84>z3U2T>IU_yp;kP*cGGYrAi|$4cN225TR6paxgd8F!zMt zDjYT36MvJ+Naw_|;w?jYLtmjPUzDrME&-2mm?{i5>TOs#4&W#HDE)%ARV%0E(Tu1k z-JVM@GdH-et{etiuV`y)O4r2 zqdl^FtY?vToxesXRz~n290o&=jw7QX7Vj9P(qq}n+*y9CP}*P+kBjLdL@J283>L6T zz=Op#VEZ$R=*JMDQ~~_~dJg{2g5Ftwq^;3%g4~v?({zf8VLI?`p_uqds%XA#o@P|V zHbPUb8yCx-q3p1~C!Mr~*p_<0RTY9Tu%Y2D!Lz=Wp0@7a-0gtnd*goK+3X7hqQlpK zCFJx+coj0z1z;Z3;im9Mg)@fPViCX?4UH>|%ZxRQ2PLl<3(>Sm{3fnBOTb6E3jUu$ z58MlO2V7AT)VYdHIU|*NWRs!z`nK2_0>_V0&n* zX&Y^chX3?1P~f=f^lma%YavexKJb~z-1w57LCjRU6ka}t$&IvJ;YNUNF2xC(jK z!tPIpo{V<0wG5k#7c5ilccXU2nBug!vGEh)x%hl>FJsC^|Kh;brDmU0$1s=s7ou^F z>b=y)@*km3f%X2aK9_g7_Ydz5ZxFnvZvyW_x8(O~GyEK#V)6(kDYxmmxuCU@&0zn_ z{)^pht!-&#$}2qQc}E%jY0O5c}pE32`) zfUi+-qiodYpiHKWP*L)ldRm9sqoP_z=ZcvUGZOZ~myE`a*}%WtFmEun23}(cTZT>| z7xnXMn%pKF4t|6k9OL}O{89e8{*C?$fi=P5;f6{9?H4=``Ds6wM?7XcX6|6!XFFh@ z?)dEZ&0z;0N_k*&>KVpy&4FE>qm~I{Kkseix{|pt{YvW4l(ostlb0lSO4*w_BmHsa z0@o&QC@@DZ1YV1#>@MMowA4)5ERMrb@1oble2O_AQ!=JTw9nDQKHECRT-}&tn9b*9 zZ&M4%P<@JeMXnWAAtI<|;Ie<7e~$mEzj)wIV0LgYAfJkAGrbG>lX}3I_+*36IQ;)< z?ybYCxY~E&S>xMc5C{zk5L`l`SSjxAl;V^Y*FbS8?(R|u?tvC59yGXniU&xL=-$b; zku~2v$&at^x!!aBIRBl@wIzGco>{YO)^k7ib3XxXgAN8S3Q{QjTlHXh)`U^MtVywam3I3NQly2$~#}5?Cp)Dv(9D z^@LnZ9Kqd!rT0nQ@1N_P=w6!r!Z{YvNS8By%NUYzAfr}hRMtQz$$ppP@)YrRQ`hJ> zjdYU3JrE{KU*y8pK-*PY1N$ud5_@mprwpVW71MWZa&!ZJSaIa*?15ND5+uJPBgO4=tJ6M6|X`G(v&a5UZ`Qf`_)*MHc3 z#nsv@-C?Wcmtz^Nqh{qmOTSbQX6n8U(u>`gI++trw!4DX&$wewm`k5 z2XP%N#X`mvJPYRjmB8+ws2IeCfbBLyv`kkzgO1>`Hs5cGCHRp$QTMN zXeM~|SDb6I+*v8EJ?<*L`-neDSB|Om^p!eyX;DlwZjew){36U1u7V#iUVdyDY0YPiz&*IObWl#H|#iVE0C#`ueQ9sc~<7+4pD zjGF8Z(q~&?$2R#nWwKj*_I_xeG9@*}xzSz58|f|J4fUn?N5LW)qMY}Y_5JOyukR+^ zgig{ztWuha^U$JK`U?EjtlEAo$L2GK-E^UxD zPOA(X!Vk|!syfX_vu@DPFvyc?mg;FRF)fo{0H%vR6|-P?hyM+UE~CL zl)OlagI-W$aU@DRRfs~lx}g780oOVnmgQ9XK(D2L)^2EdijmqvLusV+NL(R?N<>~McaS?trNuGA2;rSjT6`&7;ahWe z$!)~6=LgSvETZ@e0>vt-e*>#41uKLVsJB=xzaFY53NM3ae={j^M%b_RA#|}@bIVE% zt%)`Q5eajRdKPzZRK8G~UEi27GQ`u8r?VxYaswy@mfLUbyHQ$1K zXDw5d5^425Tvz#UgmLnyuNb!MUuohiKu__4t0O@Y)~tZRst1Yh;_u;Vt%Qh zJV@Ro6&J7a4WKtMS~Jk`6M5@S&d&1pqb2BQwW@!SR!i&@d^_}Fz&PWVOfLEQ`@kuMTSH2c!rPRA2XNP-)GKC2ilEmd;#GVsQgA3GJ{#l9>qWLpiZ~k}TTQOPK z4Vk-GatHAmzk=I8(|C%=-}m}O{j$CrB`bm`5|`%DR_iPEpXf9{ANJW0fn~* zJT-#dlX4nrb-ap5PSr#MskA~lk9A%)+^w-#E8@5FuL7NH8FD?cIr#EH^T z=+vdqWwZfxP-q{4i+ou-1KYl^{sYjhozTpQ*Nc-0flVS#MC}bfVe3HMp7y@EhLv5U z4R=Snml|gRCWnm_JW+Cy>{OpB^i?0Ik(cD{N=-NLBsTD?flxy%v1P1c=Z zd&1`1rYOFQa%piH7qZ06BB?2#mu1ZHo-%USbY_(n;m`JN^W{^vs2%m+jdJW${vYw9 zR81}?d!a27DIFFU13&VKnHV2qgzo%L+&pk#Bf&mDZbYHS^@YW}PA?1Hm4(_=tuIEy zLM>Fkpt+4hj$sj8@dX9@@M&ti5iF(&>Dn^qxzxSRhTO^g5n&5#{nWbd!C3i*`J8Dr zJ|w^Im|Duc3>d)_|4CmJ&Bv5yW2vcUGC^}QBe~I77rfvmh`lY(tsSjrLay>}Oqiltr4xt+Z={h!nY zuF-l2+>a)ZjoQyz7BfwVM4Uniund#9(qID~0QNXZ{%pGhrrm7INpX|#NO*u+yH2(t z0x8*80M6tgx&?7j|LDnjBfY8?qgGd^s%O=^YMgo*EH7u&GFEDaxi9u3H*8fTVLrfJ-&Re?6mzIG{x!_n%jRV)VLU5c(kJ|8Ed5S zMZ~>&Yv-BN3(m1x2gEww(^!2V`vq)2Cx4WJ1FgiXFSMHKJa4#rueX|h0xAw|^<`9J zdkdHN?c9BCIRA;Q!t_FHO#?&H$EY*(T_l2QLGA-z|AVH}VR{$kiYMBg>M0D|v8r;~ zXHmnM*We2ugXbcG-3;&4UEwXX zgLnZh_zI;HbO6@*hWUE=BK&WBE&Pf8mP&?F2^`NUT7vdY>j^acPhbhZfYn@<9miJT zD)I}tJ;HQ8S(q#=6}E_7gb(oHToI=WKB1vFi2qw$!%Y`{LCr4*Gp7bWok&~=kgd0D z0j58Y;0?@QOlM;y^Pc7yN%RBagyw>SKS%$OcAzeO8b;%KD(M^GFWU>&x2CnCy@9=s zL=4C=8m6y=$MFjN%a}{+g0=m((T~}Vv9gN%!ki?Jm})Eseab`ZV&*tM*f_%f#Vlw4 z=7NnOLZoq?&BSbJVaGA|$qQp6>5eEGJLzBy$6av^R3Z|Lc8H5;Zge;7;FT|;<)M_6 zP9HE?+GEzQmSacKQ#6$ArxoK|>LD&e>qp8W`hG028uQ6WdY7%DpW-I!F>GllaD;P{ z^?$hH^g0;}R{0t-%y1*VVK;Oql8o=j0Pv9(B7$lKGss9F!L&Eqi`F8?j8-UBvVM#` zsLv*6pqaCdJk__cgkHxzXgcC~zNaUM2)($Eh{#?-9?{*<_J}~NU>9b+aR!gNh~#;U z2#H7Z0a>ljVr#>$?*sPOGS;DgX6Ng5$w%O_FGx-OGCLHJMfZ)(v?|+NZ_OU3hoS2e zfGDF>V>y#VPcyZR?-1!zkXY#~l1*naF2wnbVyuRf^wImVEd2&2yOZP-Y7Oct^C)Es`Dx}OWC*NqG85_P)J zM~UVuKrh5gCTZdPWOV}1Xq(s(VE6~JOSId338lH1?eEB!0e62J*Hk$tR`9nGKPbz% zN;HDmMLudiZmHTuU=+77MY+!XL8EZb3Q~`XReTquF@6tMAO3>b{73&vG2WlTztL_p zM@btkjjyY^xQqH1)Mrf!{ZcK8d#%?bKBKQul_XHiNHm0PNNrZyi%uhz zsh2d-AG3BnnoXtSj7%~`8_#DbZ}?#CB{|5v*Dmq1lpFjY%}r7bkA8-Gsc=GwMuD+K z(VN^*)x|$o-K?9gGcJyE`VSd-!@g>z5evSS!lSs;ItA&kzDh4WJ z_yQ;=kQe2&INmp2I`2>820{h3DQ74lXqP&|X>Bn16*hQTc7}d{U8o<1FLs@AALrb` ze1g7H20Ze8peFO0E+q%)K}3^PG%Au`Xj@`~l2{F9xp5o{t%=a4`Odh;EM%6`kL+Bn z9sjKs&MAmwsKxbCcL@!YWkQ--nBB*m(HnA~w0rCs{UzB!XJZVsM`UAb)~D@eE$FGc znFG4Ql~eYJi~L=LiP}i`BfMG`zr#OSY@#gVGqi!|nF%zJ$h0-7gNWzm#`okb+JR`F z_{Yj1zLWmah~@+(LT==3B`@^1>5n;z|!bRjWcC zAf}}b+PelnMP0zH)eoa(iqXUDDs2R(Xuq)a>Ca>V-Aq=}9Mo4U9oD-)OB}33a-)nH zv@G|V`i>X028d#-O$W0T=w{5Z+x7n3b2W)usFh>C7!Bw&zK{|oo%L@Q0<^7Qd_~hI zTv0VzD53V@A8Je@(b0CTnN2n z>|kf9^@Tl3C%(Ft#P-y$lJl6&t>mEIk;_)U}GgLAF@Ad?b(k;M}0qkSh>${ z(@rvB+*aQ_Yi9NUEAQ_~{^aI)XIjJE#8S(@l*4G!Sw39dgVFPh?WOl+U+GnWas=Q= zInz@TZNfg5vB*X%3o8C@O~>@SAPRW$@nG9L+?j%om!8*3N)AHRP_XLJS|ap;AvA)2AKf8)%X6>f?ZpS z@mqq1fzBuWjx1A&_H@HohUlWYih{Elp z%#c)XFKM{Hx?pIdjlq0>-*n4rPkFh#@|JzcB&oZF!b%UpswQ$L^`(emjYVws6T`x; zQBMjNl>~lwHnNN?hj=J ze^2|Ht)Xv#p5OzmEbr8ok?}N?`>Y)&pGYt{k zXA#eR-S{0!Wf#a>-1mMaKj~52IDI&2Yiwms8C#4TFiY!UoEIR6Xft*MJi;9?BRypM z(oBX@p0s1e(jDX~+U8q$FJlw#Grkoos2HVHaZ<#g5rjsIuPHu z3L0&}h+KFJwTfipCnJVg32lmth)GXo`Z8t6I7AV*2WoW`3X7XbDY6p^4JFATC@eH0 z?ci0klFJN%$8az+53%u0nbYtbjxs73RpH%?gT~iT*!mT~KYFi!gnxJ!I10D*I7C2S z#3NbHM>WL#wW49rT&xBhr8)eeB31Q5^b=y(YQyK90*$l$P@(h$+$E&KphMg&tdeWb;y`;?XbLjGw!-5Y{P-%sAkQ2N;8 zi@|4-(gK=a`?aognQ@+>Y+?R4@XzbZFXWBjP*t*=1mCEfc#*dvE`F5p0eV%zY7wv` zp8IzBHu|plqWr7fng?b4qp zzxuAa>t=6o*2`*}StD~nW`nG?&idJQcS&zY|2TEMzQl)B#6*^QiIGM}V}rU#@? zNS~KcHcNMw$yw!b`?{+q;0tziP1HMTGgv9Z!E#}-mRSi4F@xR2yQEr{ zQkKQ`kB(7}j{)%kagKHNc(L#;Gl>m5*CCTASLA+p=sKwqv$>wzWXx_sL_VNbzr=T{lTr#$sI8 z&uBN*{O|#mQWXDZf2dMdIi%>yMzBu~X%XPDHHA)mfA~w|$s%SJ>*8fTpLj=3vSeGP zIC=$C4A>GlEbv-Dv}2_0iR>3FY!muc+2~0|`i9==!Kt6X5MT7U_m@|xpVFHHmrrn? z^37En(6>w-uCwsH^g{mL+Syja{>t9iG2GF^VR1~h{|VmzbW1ULFMJu3xI`$?JwjYp zN3921*X>{B?}FIf{{DEsA0Fe+${(s-yR0?A$eT%>Gy~pKmaV{#g~z;#+`;mrCCu^A zaRNGLEds9weCP1m7F(W)Rk=iCw>H=(yBoUJW>!lNNE;4Kvn#1u+MbM+Sr1*E+%LUN zmA|#1Tt9RYKS6vXi57?TwRNKHgY6r8sQsa>yKR>>9xT3o5-+YsoY!8gk$qrg+y)NQ zT73(j&|syjGF90Ru1qI&ms(Mqpp`&8YFQv!e}dh$$_U^R*{WQ+pa5kbV%ci{)waRD z#!=XjZcDSSuw>$>Q;BS(sCRu^JTr2Zxmr2jWKGM8%Np&R;EKyG;6CVS?7Qu62i90L z9c}ytwt<&rcna(GFZlE`rH=A^d9mDACh~acl9+`=E&|VTEE|Y8!@gijhS4>8Z9Nre z;AUXYYqagC#}_~btApznr&j@=tTpsR+8g&sFZM6CCSOf_DRz*KT3%Y}TGv`PS$&oR z@>NNLzsW@i<3;>YQDuv-kGH4imV1)BmwT@Jz58d68wl&KzOsJBpQxNipV|$E+n)w< zOpwFuI<6m|AG(MFlzBQM{?;ZQhX>^bSWbJnU~V$|ne-tqasPBdZ?hu2MJwS=F9KDY zCr}Es24q?YF=k zEkp;~v>@(%b)ma3nk>Y=7s(rg>>mkG-Mt1L-eu-I{y)kb!Z)!v(-LM56ez|sP!eSZG5vAhG8J!4 z-Nzo#82SlzQAey2S|WMku8n&x*wQScLf8hST3*Q}ug?JT8JI`@1&cqs;gEq}KP*kZ1USp$NC7(Xvl*KR; zpr$b!7X1ona&Ca-umuRl4n$$^!nPCdwlmvM`akg9TId5W!Jc!FUt}tjG)6&FV<4`= z)U9j}-I!)fLn!>#fQKd;$~h&Vj#C(#K>5L)3(VETL4Xsm5fOScd8)LgKCP)$%jJG* zs{dHALNc{;Y`L2q*KPlw_ZEC(=GqdlKY^N#sf_D~W=)=!PM(@hX08rxo+hoSNSg-x zCr^g$+U zaBL`905miLu_53To0(-NG*>~%)B*}cU5Do?1BK(AnS;lgTN4Dok)iCWHMDgK5R}a*>1C`olc4ak18TRkQ48hZ)!BgGv;=xJ8ur;B z^kEhnGIf~%s35O4zCoY!W7V(-C`_X9gl@(ftT}VSP{H{r&y*y;0;TW7tVX{d3qRir zXyg`yZt4%PR$pV)HWs=`mC@4op#XN=7zw4@Lcn5L7-2?nQj-*9UQz*l-~d))v!Ju| zJGh}wpm;D0^WO>MIrK|!8&#M~U1hcE5)8>OVlsdZ6b_Lp`m4`b=Zo zZSRsh&~P||vEK_i4s(gQ-kyOK@p6on_rN{oLnEvkbZ|Xj^j3psq$tx3_>^HP!;%K* zH|waAc|giTqpBBXi(^ol8H;*eLw) zStg9W0xD9LT1gpZG*&DV$xUz)g4p5E!(IcMb0%zoV6<8vWM>&mD?`WJs9YPOCesBPfG(pel5g3V!A2tH&un@G`o7PQ<)k{fPH#Z-Si|!qrVVV)G~k_3 z0EaqL6J|g2J!ZQrK&$qmC)G#K?0`CZ0xL&^0`w}(9<_mZ3TV%#Q0u6Ms6J$?0aDl< zWn`gBH5@Zk5c(qz-HUFpwx7Ts?;ypY6ZIB0%X!T7iNK9IVYW=cygC}K@E%xiDzKs; z%yAoVmQql%sSM=kd+4QIhc0h3tXiUQXSi$p1P!=5z;(@5?2r3cEIt`b_CRT)5-9>( zBnk8VDxE6i9sVA8a`T}J>?ba=f^2|p zTVssd7FZAT2hM!Z_}OTLRxM{7qZ?q~?AQD28QNH_f|jDjg4;X`+W|FMEeU_wTWGZ$ z*S|&Pp(ym_aNPUyK|NY0L!bf@$@SybBM;M6?h-OGP3CHGE~tfk&psdnkqXV!eST~# z#Aws$G4M)%rtN5T8jajj6=)3RhWf^A@Qfqaitv&Y6_cg0mJOEe);rc{M6q0#PmA$< zBI3?Q>!Io&z5$-SIVH0Tx?-K9ox7dgTy3()=KSOC;Z5@`R7z=oL;c}6QwT8?JNWZL zytrO!A>WrvSejcZThiqb@^#4tyT`-7f?o4hf_s~B8r+cf`U!0Scp*9JQ!rdv;f^#}eFo>kc^vxa6Q zrv;`t(q^R1PVbUA#JM!v>e+!PtDgE2U?nXO&s12fFV&VAORS}^b+~o8b*{C8^@F92 zWvaYXiV+(KF0ezokwUN|-s^U~j&@P4rxsSH0gW44(OQ#=z!`x(Jp_{3Q zSHN8yW&aqE8Sqn3@u1d$ivqUV!!6y#@!VN@Ls{j0mc14lu_M!dN)1Y_22at0^wpWW zoZsdg^w?pcCFqI9RWgIK31grKdO%)gX$ob>Fk5YC5#P1ex6ZUIm4B1IhXTS9t~C3e z*#sq@`T9*Q6mh$)P_}|;I! zwqSf@JeR~rir-3QWzMqCQrbGjy52e!{MOBu=W?d>5D^qT`B3gQdiOMA8t@=Dyr>rK z4OlSoP}^{-g|u$qvb=!8=TJQWnn|zeWI7C5HTR&1P@j+Et4k5q>DEU!DR4|czM%BL z?E&oqCfh?SWyM!q8RJKFjPH5QXXo9_(2P3i71LX$H_MQ-);ULHUvNM6#`_N-Qal3@ z`LoC$>|Sme;)|+5i)*D6A-(|;CJvcP8q}W%1k(0f$Zfjfg871Dr0j%&2*(>sm)@4XDuqX6yiCj(M$V5 z;k-|Cnq)tB4s)hBE4Zp;JKWPefj$q~^_&L9I64Arj&@kXaikkbAl+F%yNBzBSdKM7 z0NTJyUPF8*G#6I$7r2M4k6G0b!FHLtICvSey0FW;0Cq{+f`D0}5MmT0`%-uK3H-F-G^Yfc&W1ou);F<%4!0p&Zb5!6+~ z;ZMqd5`7)4d1qpc`Gx6D9wGvY=eBVr`K|mbo)^}{^Glq5h& zZ6YEJ<|FgPbwqRxV7Fx@HVWdB_ z?y**}-UaLadugPgvdx*rw3fQxm*1O&S$Cq#>N@Z2>Z+REH|M^)t2Z2$U~er;{|%~B zC&(ps4cCZI=0^xGg{tBNagTTckKdt_e@&=^7^ftzAlI0UA=`1^tBhGB6ww&J=%v6G z;qfS|H%AOlteyf@;GT38ygMIgb132;#acKN5oB+TC^nRPK`Qb|!ZIODTx^+yzIV?0 z+A_=%FQ+3$pb7Y~4~>=j2<5pi*sJH<%bt^+=6d5goIN9Fh5Nl{n9t`Qs6GOQG#A{4 z4P+joG~RP_cow-^5}+GZU2G)&fP6aFgg#KuYr?PMUa*DO?qm~~RGo}l(5uq)c&PA? z*Zb*X!Ccy^AJaeR0$}MLF#ON_(DXg&@uvnv^ z^m`mDir&C1i_`pAT{y6nqLneSM^ufS(1gp2}Rx%NT_ zp`vh1+$6?gdn#5E_X~|M-=5@lvB^MKLzza#a+;(^=sUII+BUVWnx<@rmQY=#oKi-q z4eaDE#i~w0bjCWZhWgY5+N z=4T+e!;!J(6V~1R;U7C3haNI+;*>b7B?af$EtJc2+rL!QVI8?{GJm>PgyP>4>T&oG*nL6@~M)`zDU7gGY5^KV#V z?IkCX74sUoLeAm}HXuvGFF+l>Auiwlo8YFLQVq%_rVghE=Jl^x`kdweos3ruP#_s zZh_790qgVPSlM=mwLcepfnB*O#;2LnxK0z<*afBI<@jbIGXiVt9}(YJ8;D48SW>16 zu9;cJ%odY`RrCw^RExvTivkA!7VF%T@WHM^ETn-5j5(;6p=2HT6XiZkPGLI@6n{7Q z11Nrf(giIq0;{4;;-Ti;95p`-N~GhVS~m^)p##VW z#57eQmB5cqg}Ut-T*XMVd^C>t5xRZ{fP;a-2ra(4u*S<_w}51=~m`ok7Ug@wh#@(9P3n3|W&h{0v`EK3oM>?&$3ofaWx3p5!W|a=_4%m@xDnQ`x#QiAKr4fl_B-q9QKwJ#6A# zSVhc4eKiI`l^=S~NkF7d0drc5F*z0ec7!nmnXUT6iW!3UW6+ak!PZ|3-}?br<`>c1 zpCJl66VN0D&lhxzbctE{%63@V}WE$<(DbkrfBpUBWX9Th7!vMp71F zC|>07xnMLzuRIN_@EY!A?O_qFz(|qEe%#G(p{MS|J$(;sv^_vhW4Ho?msG)Cwumz#~3|b)_`iCEI6)$r2 zqMxCTO$BLFH~KY3pQ#$1@;|E4X4a~_j7&PppO@d+#O3nzw@uw@6KOLa<|d$rcrj|C z&}S4VP_nSyIb6{N;3h0{2FR2jmiH;t&U2jmI?nkDSC)XY7hxWu)T*1O$61b4QtovTFET z2KGk4=H+pXKAbZRebvM(H9UCqIkW$IfU}qxy!{x*4)kh2>M|eBV4|cB9F50y0HMJV z%>EgI8a78kQCwLluABvOBI6iAD1m}wni<_3C{F==9*$>o%bTI`R4n&t|{%q_PJ`bgAB2+nKf{?>7PQ!QS>BLippi1v7czWxT|>lU6lf5| zGTP=NN}PlLGjr!TFUpgVJKH%>o@~@)5YFmAX+*SmKAhV`h4bUR*_Q%vM)O;<*Mky* z{Y8{qK^>b~?q)7>74yHDo6o?jd5`ttU3xCE{Rw3=^QoKT+l?|(yqe?G%#$bMEav_p zIEGn^CdOS5=kcRW1JNDq1_37Z$@y(vbUK6}U z4VjO;KXVWBZpYy_d5^q%UtVrP^VbY&+00<5<<_NwYc;bYm|h*zJM;BF(?ersIyASu zbD4Mkye;pH=9$g^^Zqkmzy5Fj=70BR?romge3iD^Eq$JYi;xSYy1D(DtUFE*CJ+}{rhL`o%i?Ozx(&Q zulxMF=hsjE*I(uRm-oA`-~3ye|NiyACH(g{=4W63{!j1C@4sI6*H^O!|Ian~buY8O koA3Yo@85EME&12i|6RGw&%XBXyzl>g{_kV|zxm1k2Qw#mQ~&?~ diff --git a/libs/unimrcp/data/grammar.jsgf b/libs/unimrcp/data/grammar.jsgf deleted file mode 100644 index 9257ecdca2..0000000000 --- a/libs/unimrcp/data/grammar.jsgf +++ /dev/null @@ -1,3 +0,0 @@ -#JSGF V1.0; -grammar digits; -public = (one | two | three); diff --git a/libs/unimrcp/data/grammar.mixed b/libs/unimrcp/data/grammar.mixed deleted file mode 100644 index dabe3a1c88..0000000000 --- a/libs/unimrcp/data/grammar.mixed +++ /dev/null @@ -1,19 +0,0 @@ - ---break -Content-Type:text/uri-list -Content-Length: 22 - -builtin:grammar/digits - ---break -Content-Type:application/srgs+xml -Content-Length: 230 - - - - - one two three four five - - ---break-- \ No newline at end of file diff --git a/libs/unimrcp/data/grammar.srgs b/libs/unimrcp/data/grammar.srgs deleted file mode 100644 index 6457d725d3..0000000000 --- a/libs/unimrcp/data/grammar.srgs +++ /dev/null @@ -1,4 +0,0 @@ -#ABNF 1.0; -language en-US; -mode voice; -public $digit = one | two | three; \ No newline at end of file diff --git a/libs/unimrcp/data/grammar.xml b/libs/unimrcp/data/grammar.xml deleted file mode 100644 index a6dbf88fa3..0000000000 --- a/libs/unimrcp/data/grammar.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - one - two - three - - - \ No newline at end of file diff --git a/libs/unimrcp/data/johnsmith-16kHz.pcm b/libs/unimrcp/data/johnsmith-16kHz.pcm deleted file mode 100644 index 235338077d8e1351bf6bab14ae6a3275d0271914..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 33214 zcmaI81(+PS(k?7D4=?lDj+vR6nH@7TGegXF%;P~@-<$rQAygg9< z^Bd}qoccds57Z%8pWvQAErSUv3ps=W$6&oFoc+Ik3|z#J0__ea7HAQmMBo@qJWz=L zL8st8K)2u)*h@do0{dY4-#Ot2wFCDD?hQO2I0kb6zLWcr|M|7R@!vZ9pShn`|NH*n z+kWl?-v}iB$Cm=fKrV3nc_mo(^Zvk_0z44dg6$6QL68@iAJhp@=>PT$P&Y{N0G|YM z|D6K86F3hZgMIdI-)YdFfh&RXAXf!*KhJ(%`*}z3{QrDQpgfoY*9g2T_|2bR4wMD! z@$WIn8~RJpaj2KN|U;mj1l53G~)ae&&AgGygw)9OMG-Kb#TdgaG#jIW)+%L0%5> z^iOUM@@tTTgM1Ts_9yoRB?bTBmLQh|Wa)qZf-)GaJ^ddF1*sLF#ZT(|Y~O#=AlQ5V z?gKRW@B0J!pJhRM1-=lZRv?E^@Qxtmg4`O=5dWKkKe;K& zu;kyfKxsg41nwrV1)dG&0#63Z1IJ)qg)t;>ci^7D6M+#WaOQ_&;7Jv7fwSOP6Zmpq z1PfdVJQ27acp^~qz*7Nk3hV>tLFxO+*8z(D_b*80;3yiD$Kdtg{{OE_;bs4M<4+m} z-}jSae^UJ4FZ}#k@ca0OEw$OaQ0t%`AwTLLXi=d4!7F6)2lynw1HoQ#QxA2*mIKL2vtge`(;=nOOvrtQW6Fu|ThRVWOX-H*I3Aj=S6-W7CUliVyA4Q=Acxx1FW@xJb z^R0js(H|6bKz(wchN(Z&7pVO^`h~ux@8S52ex^_82l|}8fb+*t{+ND(viH!km(cF7 zKnEA(3ABudcM3pF5o#U@-^>p+uZW7FTClH&8pE+AYJgfnt~F|g>Y}Eo2C5IWE)7>J zqf(IaL7fZ06Q$5EP?`tTgtpW`jo|sts0kW@dZS@z0vd^yqu^i0Z za}bxsXQ76dXbpOa)FwCd=K2e*ujW!0s`=FG$`B=5xhKz;o61pgy8o8{fPbTZ6{OAn zgZ|t841bi|Se`9klTAuz<)9*{{nVRkF>SR*v?2Oyy&*YC^3vrXg?-R%R2(nH-*GKw zCG&|X#13Kiupe0)SC#9*P2<*ZySby>Defe9h}+4n;3je1xawRKm&IOYm$Tj20&Es@ zjG4exW)yr5Ps24ahp(ggz=;v)3*Aqr(+1GT4sw(HO{S9}q&_K45(rON@=5=sKhW>% zkM(Q%L;ak77t#y;v;J1k)-!d6h$M#OA^Ax)Qj2thG@OhhbI1m=ksKoj$#rsC zEAfyVB7s^B|G`iBfx}7wPnDnrX%Sk6{sOr;nvW*_;5tGW>Lyw6++A{&93s2O8Zwy- zB&|qeQijA4E6LQq=}+~0P^Vpxmg=h@tX>H(5m-D zpq1$;x*nujrKQnWkeE~yiCf_L_$+3aBFqqG19P8Im?*X#JC@zWo@XDjS*(-I#pUNp zaTU2DTzRe}SDP!!#c@2B%`)5<_C0%&-NY_nN3gTlE^IwEg4GxwlgxZ!E&_+mV#YCJ zm~KparV3MtF*6L~!Qb#>d<1XCEATu#0rvp@$%Bnpz)o}r9R(?w1)Lwy3TDtzAL#?& z=XD^bgXloop4OwaKsFO-B+x392B{clVk(M7`T!j?$C%I28fEZ3$0E|L25{+ zfUGX2E9p{@j)$P#^ME7;WOX$AyMb*=J1P1Xj`rX*9<(p%o4l}2~y zAiakCO&*}%L=91FY9w3AE(S+0d!BM;~^ z9^GRipp9>6DCivyzhqQYoNdSKW2!Mn@mOvp+nDpC1U8*3!BywO*}<%ZY0q~N7IGt4 z9ak0xa@*Nk+$FXZ9|czgfU2omtV|9Foi)wEaYGD zzjI?r32iLRVjf7H*iikdf07<6=Hd6S59D%k78%F95RQ>0dL^Zu`T(_LN3l)SW~%J( zhz77lVC3rWe-E_0M_F`1txUG6R(eu*>C5ReeYQSWu1qRpAMl8%j!}l`aZFo$L;qV% zQ(mISs6R2%7wQGFiWb6q=mnL~b0isM&~o}6QWyFCUqj))ZhHgaB0&M;UL@6d&8HEPa7n26?#{8 zcuS)zhNnV5e!ud;cb0H$w&4g*l@9WFJ%<~|U&6QPJhd>4ap!SGj*>~V33)}ok{R?Z z$m4q$3Onm6X@c8xHSm0`gAz|Nh$41neplPcgZ!(dUEE_@N~s|K4!svEc$5^m0U1m~ z1Q*(@7uL$Cf9h2@!Y`r6)v^8vy|z$8m`=(n9(5aC$4x-<$$R`xD?xV?pFWtI!NlQV zs#7V6C$LSq1X2&U@hVAT^RWV5u1UIubudR@22qE+!Xh1tC*#3Ncj(!p_!_;YR-n~L zSH2~ehrU!fKhI_HrMXV1kY|B*junJP!fE}Ww~KO#yUBGI5Sj1o$uy$^b}-50B%pEEm^Ot2Phs*3k9MMI9)ogm++lX za^pIdZ@4YF@4qhpD*Bj#{0D6yv7njcBb&=#mx~o@GtHO?-$|lqZ~0Y1Bwo(c^yEdq z)1B;lBPLa}Zr)OO20u^|#MZtg@=5O?uCV#Icnml8YLqfc!4QQaUBxgBOgDWTq z!a{wqI>A?qPGWvH-;{Q_&%0YGPVS!V4ExOg*`H7D&J`6Rg&O2fZxT|pm+VvFvc}Ts z+Gp|!Rin-L^_bVksGHORLU*PX-a%ey6__#VdhS>K271R=@K4~n=&|~9+>DvYnQ3P< z$?Miu@;0e6H(ebJ^OJqB4BjJHNo!v(-LJnlJQKc>1->lb1AeJ=h85He3Qxb_F5D$f zRof`xv?;cWkD1SU1Mg}rjcdfWG2D=^$dVd?jZ!KzfZyt!>HkWj_)KGQyj|YsK94W( zO@#$Q6>lE@FG%9P2&LKl+717HeLp_IsbUjS)fb`_)w@Y04NK5st%|diwoRO693jn+ zO`drFVa5dXi=vsnPyWC4wcHWOz>cD~)H1$bNqKIBP()~?H<6cUPp}scWkmE{|Hu>| zh3N*GO}cW!VP+AI`_V@F3348Xv-N~kq?^CED$yLFyfhqd)7s0Q{AJN%DOH@#nzSbF zm+E2uyR?$uuV%}lrr=imR6dM-t+>@s+CsdTI}KWGt3E~-G=qMIyTaDzGSCuIPuroj zWyUg_`AtlUx>vhEn=^jqS0)2ysN41GBn5}E2e^eOQ7fkYii`29@gmfT%%(?aCs+wh zrd60)F#dS8$4F#$(pIQ|76#+bEgXxZ$Vbvq?@9NP?RWv>B!l%*>UEkM&4SrO6)g_t zJ#lnD2}Ojo*JV9gEu+U0GyRjc)-S0el@j_eeLvYl%-S#71m(L{g~)oEep#)oO@Qs7 z{x|tf9;hFb3hH9*8<|VCY7ew$+BmJeK3dzO&C$P-nIuKOL>{V-w3cIu^~w$6yS$ zkW(a-{*BVnb-IX_(tDwIn8(FoF+CXn!>nVjF>%aW_8+z{a9s+U!42TH@;3f0t8;re zEV_6*^O3E{?goWYomGrib&;icHoIL*}ET*zA2b|Um?=>4$fVednChc^k=!q%P07H`KS=_taO%|IYtJzMynh*TE{~ z7Z?d*)Tyebj?&I*POX%_Nv}#wu%31!%p}4HF^S(MoD{D~j}2dq9+S&_%hKC=)#|ny zY-Ss=zOc@CNo4Osc+M=A6m%;VbA zim+ZV!MflTIZ9@cW+a3>hM9kT-K*`?n!$=|3(NtQ(AxZT==%+{80sYwX}Gmw$hy$v zh$Z1uq83GzjMig5$2L#A9&0(`Oeq=0S*e2E&;`x%?G%y;TXZAAJ8G#+dCb50E zuUu#TB5xLI3N3~5LJmKLf6ZCAMApirpnbFlvFI1o$x1`HsK2!vK$%d4+-}0pXmi}wjRJ-Cj z}EJh;mU+qCGKNV{gPxjJ*_dB)Ut~oruuznxR8%dn}T9qp`nX zgmhA@B^t#@v5WXb94Qqt*bQfmQ%nWShs;Jx8B1=M z?W-SAW0k%BKE4*-VV=wGrf$*gafP`%x-Yrwdp>y)2|Un3WUS)z7F?})jZ*fn8op1%_6CQ5O$!hR2(BGodbi>>$? z9MW%V58NkR4|B$49mpP#F)n9Gb`R%n_k2$+{|oO@xsp6bt*cidv(aAK7Ih=fw1JA~ z>*OA0cV}g%ze)Z4?L~60ufHd)|9s~Y`IPy2?Uy_$THSFXwn1kGYR7bs#j#nDf5dHzuA0y`rg-%GFkP4qGv#%@QtnRn+s?Y# z&D=vAuUw;Czd4AzpR6vhZ-_C7g_cIsqC$J0lruRuFB9Mpr-}*{@irz!7tQ+-b+Ip>< zmPh-h9#BWC$FaVR%fh5O>Hli#4>gWsdol!9&~Xn;hdDuB_l?XcJ|P9iF)1mv;F=i^b;umhdscV!SDa zfSt#Jl8}jQNl)W@+5qjc-|1ZLs_Po2WRSUh5z`>+@8Me5;V^7HExlo%>lKw{p6|~6 zIma?breFI$@7tH;QOR?XSEs!B-YLCj*7Y2_W1MSv`XJ)_C@Ls(OF*DSlDypzoy*@J3eS+^~jl2^GXK;zcpHv{s5T{9!N|ha1luRby#W zKht{CBNJyXYi?!kV6J5r%|}f&O(%>o#!-gLl3D5?ZWA*2>iinc&kkh2GQ${x*Wof? zOX&{wl94b29!gU6A-Y@pT`QnHQs=7mRSQVxIc1x&M41C=v9d`yraV&YN`zWXjpi#x zeu|zHcQ{XUf!rku6snqVEi_)7$!^zn_}95QxigelJ&oDGPT`udo5&jdsEWyQI)>RS zE;2U@KN~qVaztnm(>%_s<#U(K9QQ5q>!&2{t0VdP_qyqmGV5ed$Qf+EZs#3!9d8{E zoG)BY-E%$ITg6-4`_fa%GueIFRo|7@HQv?0y~5MlH(Gw7wjsySb7l?qjlUx_7AK11 z#lB*1ah~{2>?sL`ONNQY+@^h|Fmq?~T=Qo0KJzj2X-EgmOU!M|ZqpdkL!;SP(eSG@ zR@@{!=kxHhIUhTXHL+WnGR!610AE8@VAPDDGfB4INB^kx)4b{$wYq9o4l5ItCQ1Rt zq^Po6_Q|Xgqm+Yr;bdipa$oU-&ZAtB$j8yUVoiCX3iygi1-r+Uw4D`daeIlRF7s;s zdgvs(6?*BuP?)Vux@p6eEHzdyfIo>gTUgYM=#Z#qA<@RJjL$FF4XJ&yXjvUtn&s6VaZ+UN)yPoT);}3f!`*!<%$4(da zp7PI83y{I6GP8zV4mO#?V9jnQY!<@B17dIK7ekU^t+9gXtSO&)jQODXlR3=N)H2U< z(UN5mtkm+*GSc$NoZsBY)WO)xFiKh}-WH;TX}psg%{keTz*#L|HW`A4pc`N>`<=M- zL3*+_5bRTP)Ohv0GC)aCKFSB>Me=xgm^>1+*K*KhH|6iLQ7Nr-0zNyYbmYtt&7;Od zI}(TFt5oE6-nUV+&7*}-{ug|j99JE5q-Zgnw9YUelv*$wv~fyp`H)grGcY#Oh=>C5 zA@M>qA5vecO5N@=8K#tkuV0djrDbLYTvA4(?k~Zbr+mz$qdu6Q5>EUYa zE#Tka@9Ep=mK^J{YGq7HZ*+7FFnB>Yq@udaEp`}Bg=SK5 z!#2ZJ!xc#H4S9@fj8#mm`Mr6UrM7iD%wrE&2U&H?M9XJ$UGr{}*)-nx-cZZ1RZ_(E z;$cA)dhutt2yQI*e{6T&Qbh;tm zm0!pyvLc5oWtEP~EM*n5$7T#AA;+UOCfv`{Cazp)jL|4mn$e?@xxOpZ^P%`6GA)@$YzVLM^MzBw0bzr1P|$@%Vl9a`+%^1Ww3)`4_Lz>EcAA!$CV~!Y zZYpGQ7kA;Rt zJ&!FE*))VRC5cX{t1;EQ-gv}x%u>UeX?v~=n{(G*#o5C3-eq%_c298|Juf{UyovtRa$)t5rs_U&m^MJ~(eJngQ=HAm zmE`LRO~tZOwlvG&H}o;yHkLH4GTBWH%}dSa&G*gc%!|zR%sHmDrmCh-#yQ3U#;b-7 zhL2Kb>9$x}TrGI{uKZQ5IJb^v+2PC!Tn+C8FXu#>PWqEHeFDrh_Gzs&RXwN+*4diZuJYjFO(LSi_Z;j&4q2BOf8H^>L%m^OVR24$%-im3_g!=lhFU(gQ}%5=*~q!xzIh!%M?y!y3a#LsLUugGah3O_hpBcf{`EH(@BOn#S=eHy74TtJx@a4P#?| z#}xdJGWf#`bQ9G5zCKhp>qoRs8n2y(nM65NR~{&TDYHS>wNh#*-SvK8iT#I}$Cl-< z3cvD~h3`UNvAER5*xS0nnk!_#t#8Qvkhj*&)-2N`(<|cw(+zVK^Br?T(`RF6!yNHC z?_v(%(%}1jLR-^2WUM|zJFWxlk?7JiNR{HkL-?IDLyEuotcX(z0 z5cRv>2R&f&@!iC!hFPX@mTtDHp`qb#BbG-MirEsI5f_?ZOH51LnX6XrE4hp08JA~U zp1<plIY#l6vO%n{W#ijfv_8`7V zlXbIJOPT3^>aFBC?)vOv+y++-m&dW+QPI)O{?W0?vBP=A+0nh!Yw=B%3&{@@qSRN3 zc3*o#K9jGg0OMv_aTD2kTvhO>m1O^h^P+*z-G2xCVP_`^w8z)W&)T+8uXgTl00q5{4L)ZhmXs9nw8a4j&tNH%g5*#`5l zzUfLcr9aF>TY!J2GTo1N;tX~#cZ^qr-mq@#Cdk4Hp_i~xILDV2YVeKuu3THT4YLtl zq@_q#y^t2G7F0g@vwf4iRXvAYwVe+8o}7c(JF{MA3Yo1lwx_43HBH->S~)fK`?K$k z@6}UJrZ!KL(%+=t%($DGkyR#Vi@lsP+jZM>)^|?6p+3`-Xcm@PUI>-qjEUw*t75wq zIyu}FIW6h|SX8WWDE@i;{Di2)S&26jzb3v;+>_Wg@l8UVghlbE;%>yAiCG!lD#{fx zD_jok8S;;nvD7zBHyjsJ_(-k+GYK6d4y~HHO7{CkdS&-NpfkI;y1U$tTaIM=O8Z4e zXU93`AgAie?fK{#;4kZ+s1#O)sb93F`X}(=wP1EIE;cX!m1`iBX*UVLWdT zTwF2!7p^}$k#PZ@;ur}9n|P+0sqB)E`YZTiyzAV}U4rwz{X@?4?C|WeS>rN~Ww_E? zrT?8)EiEbaYU=$|oYph#dD`&wn2fI(w=*ARDcMc!*Bm`uF`n<<8~#JeW^DzThh{Rr zaZ`m!(g#A#ubGCDZW4fb>)9)zmdgvVK&hLrvR)H1yVx_W@u5#e54+q@Lez2ep<$Az+ zpA#DjbH!9)BFveKikrms!dKxL;2oxNO+fF(;>joi}i#p!UVoNUym!z&SqFV0_h|l`Jnxw&Qg%< z^^Nv6@O*V`bWU)Tw^z*x&CZ`yD6>h%{Pf#tRnrcqc1n#()xS%rrBY|5rl-zGE1Pc2 z;4%}kI%glrDeO4o?CnnUrulBjf2*7HWppl{0<+CdVikkU^vpcpnm^<~XngqSh`%H6 zMBRzrA2Tf08n-;o9#<;9WqgbH;_(@AOXEV~CdOWgaYjqgVpLAVweUG%Wka9X`dZV> z{Y`HTO{5b-E`9;)#RE|i`0f7IwyADqvYc1G0QT$3zTRNX^?J(rE_-MC_WEo3dn#k( z#p)h)oz{Xl^u;g=S(&DciJipVV=wZjxj5k_|CaA9wCBqUpShZRGq9OAVl(hnTp8V> zlgUJVjuxf1Qf~Xd_-1?icpAAmSB&$u-IMb%Tgl3mRWEZ(#@F=0pm8>(^-XJ#)&?~4 z>9pwd9WVTdS&2EF>?a(>TzlM2y-we0d4XC-Z%7>|hq=y85LQV!24d=EA=bko z$3ka?7mC;v*)Yl$9UT)FQ!F+$W^`SDFO`bMn{wucewL-n)zUhStf(Qas|S|xooAZlupKZ#8K0KD03 z@PIVJp)l5ku({c%Y*nrgSA~z`Z9*E@1s)42!X~kq7$uz-D@$dhveI&}R~?Z`NF!kj zk)ox&;z6;B$cj6K_JYo@=PmpJj^!4xI@5@;gMa80`ULZ_CnSRvq)?SMne77dc1v%Jr2JFvD4`oK{%%qmm!&D+y{vRaA?q*TBj*U+JM# zho@f1&E<~rOaDv%V1H460sltdD_I?a|Vq*Uns&^2L^ z;U~gdM9hsS5?L&AdE~~()scTk){3kUc`l-V#QpHZ@XcXsLtlhEwSBTavP?ElGsPLx zq&Z@u!1KM?O3ZUK1^m(8aFLvU1b{OL$?baQTT)^MGGwdHkp8;{vL9xOL6d@KBU<=65qC70?``)IxN3;IA3 zLub%-fYED=x8mH)8s-@@lKq`!xp=NEx0*W$p6v^qol6Cz*?#Uk%sG2=39zQV!S-TX zv-g;-Oie%s?FZybKD-(Y0&L4VIvK2ndr3SAC+qcUxiq*4V?+Q~C zIZ56Emcnv!Z8;Cjh+g zdK;2X8Uk{&J-UdR0Vb&qvx2d*bJ&;c0B$j7;m7dHz$aW@m@6z4UJ0RM1gvds;skLn z@LE%`wb)b46d3WHuv3@;p6M`QKR=ug;h%CVISdH7&TK4uiYdsX0otq(UJFP@1DXTq zrL%y|DNpw4-Son`UE82l*Gg%x)syO<;JrzNHE|X70jxw6!Ma8SUgO!~@EumI` zZ8=ETa`m-Z66~gRwb|N7&8W8o#LQZN#ac*FGK{2>Dq?4PdeoxHn)I7ubc& zIBL-IatUlts*?H4URI;Ka2524X~1Ew z|DuF2cf>oWB&~<1vC+&D8iU`lr%(@4fn5))tWtO(>O@zvy|G=b&D3XxqX>fOIOy+M zXu9$OPhvv=P57Q7X1Cr|?|{z}UVjHx?ddSrY>y|ANooiRB~f~3G*aaNL)BVKrWXKp zu~?nP4OTkJn{fxg9L`ZT(lcrgdPaXH`_XIpFWeqr>z~ndGD&;nZ7wX*7kSEKE1=nA zPgCuvP>bC4Hd9(kWeMv)qt_v#_+2UPod>}N$t1`7P`?gq)Isk1@;g%sy5h5{M3~A< z)N9Fu(0*ex<+8eh%n<*eZB)!8D>V$Yaaq6;l`<_gM`UUGH)*o58|bh46m#Np0vGW4?*) zp3C|NAx6C`0t7O?GUvre;kD2D`cby(I-JtM0a-M6%QkGs;r+7X~FZi?a2(2G! zC$>_Tv&$4sEoZ7A`*C4)EBRZTOy?Ti1KlBN06UX`Q`Oiyj*+i|C&&glstElDmuk-*46C?bJnp-UIHnw*B}yeQjSOnGE}NukzX3 z(pH4a@a|MsvkgQ<>yuvq!Iu-#S{v&A!c64vNZVaK&^+cZE(xpN;f4+VRqPaDGF_q^ z@zjW($?VSVsvb0Nv9->g>$QVr?Vh^R-H5-1llT&NjdK^OVp+iN&+eei3O&Jo^R9Q- zGH$S>I^F)+;!Cl#?-#TmH&nkE`^bYp4-^*Lp!S|o;wg2uRL(mDEfLmwvW-*yVeBbCEY||`PWX+~#mnR?>;t|ldF=8_HLOLm8>nYY38vxp z9B=y&pHS4(*RwBV9y$Yd(#C8)af82{80v3GRv7*gN@kT+PsWY%y?3+PMB7Eq;#jNQ z=0Zab+4rk|v5T2*!YKC(;k>i8`Mjw~nnX()w%A6ee$|H=h6)R4vD5{j9r@-2Wt*j* zA!#{jFejQCb;&8)(+%OKX>{}Vil%+$Z{%!tIju?Td8MfRBQ0&%Ve({kQd2E0^{F&TF^sEXVOq~YJ2G@*6O>@91~li^*)dPopr95l`}4oDV5$tf9?y7o*KX`?-d(Gxe%`4gIihc1T;TuJ5VV z$=F`3>>lR3W0+yx?nrW;4jaR@^Q~2`;fJ=No_YTB%yH{>twCC+a3j|rRm(cTS>iUO zOKJ+56*bSDC;O>ouXuxb@VQw`DPzIxg4#W%T~v>ZFN%mCg{N!3C3OlvV_K;$PA_JB zWo{~O_7Z{CeXsl}i!I9P6fBG7*3k?fNSMO3l{Z=LYVw6s!J zt_M=vU0dkEXsGS6w#4_?6Bl||e4bg1>qF)kdA+9ZJYR(NWmYSF&3Qeeefz>j5F43l zKOrm+ouRuj%E_;DKU0?H{HmNaHL?xPzUp3Na~P^+-sX1m)95st}_T?i8j5 zpisNXr`?0B$GH*OimU;)Xf~dlC1pGx4I}i?p|{dEDOO`kb5rKchsTk1nelvk-vIw~ z$**6qElv01RMF4ZlneUy8?&`B!ggOGGXoIT1B_SvwUqnpI({BqDNiKt4b^B#xfR_i z&eg}z9q66I)DiC27M+I~zdIiHjwq?-vByx} z@FZkI_OqNk;jj2ey|3dH&pN_eX(y|sp7-jIbUE5y%CYvvSP>h~Bo zI~NBml=Cv@A~v4g zf~U~x>N`vT!`Mn+?bW7%PSPRV5 zSYuSi0P9s!hdb=f((6S3`K_8Y!FQFLCCznGk#p9IyWu?Vt|Jwf>YM7lo@ug6zN zZJO04p9kvo&-cmZ@UVHF+hl}2)Oy$0$a}`OO}lG5&u()T)HVw?As+lEJab+E$Be{v8z3mp?Gkt|WBl3;!lUUT7E$?Ewnp$$ZzHc>^p}Lgh zX@@5ugD-dV$JAQJtJ(zAht9&;#c(2+wm|mE;N=?A+%40}nOTwp{rdhVO{iLUy>OULM7FoSWZFyzx@aw^th{v|6ldbx7iNs=dwApo8M~L=Ue7J zM6->#4HdF$f)_FsuV_zgzf?H96*MHcL%|!&||%ommy~jPLpVH(X6aO3I9Dbm! zQzoa)XTyz`@Wt#Fuvd13dnr_X*vCIa02nMSo{}JEKnZ}MWR3m3-Zfztj#-8TV zw8frr5Cqdq9;vjU$W#KK^EcN@k%8tN?Btw#WR4VKEayGw-N79cOGy!#E=J+@uqTC1 z_N`QA7TYHJj(Ik)c6{81a~ORFV0dnE>CTGmIlZ#!6y5C3#WbSTtn2*)d_CDG+&OlF z2eHp+8@`2hNWLy1^%_@Rd#ZoHv*~c|h<`7)nruOTp#fSuF+>}O3+XjcXK4~xZ*p)x zp(yD~xN3?^AmBIVf5x|!Ro)#a|r2XI|}p(---v}I_Q9%UG-Z1G(e8la18Yo#!G zq|KGKvmd>u$QiksC6s&TH@a2&DeQ(eQ7+-?FCH-;)_bagyNhWoZ^MGWu{_DT6fM%9 z_^xnsB}wl>OzKVkE5AUytZd<~fDeB-viR;Wjiq`_w){okM1}}Y`QLr>@I}O9jyUN! zrYpI`=2bMb4$mSJnC>J7$-ws~Xr{glM{2!pnn0=RhQ+pm)MI@DT=)f!cY-O^$M%XnTD%)0eo|o_aW*4yc`QSe0BwQuku9_@U_zeIje2oF2j4*g*ewcx9iuRgBui;IIuv3p=Ys|7 z1i6ZO(h$I@-la{^pRn5Qh#KNh&>_!JCzxTkgxJPK;8PrcyW@UfOQ?k1aD4!t2=PbzQ59T=*h`B3F8$oo_ zFt9-!g(%jK5c9-CRMRwwAH4|CUoI4=Lqmv4>jE)O!@%#f5$^zN$tL^(Z^viwZaDw* zM_gD7JQ$b5MQ~j#BQr!z$>=h~er-oXAwH@F#FWK?2igq&Ixj?L`GEGfAck!j_-#AU zEf6U=0HRF?(76zUwF@HCmeRg-Eaa9$RPCP->v$2ORLeo+)mmu(Y%~?NcjzBf59@#m z?}%GLEgIqb5P@|QKf#Z1UgiO=3gPnwncQG&%FkTK9()Vmg}AbP5NS67?&}COZ44Hi zczg$_dH`Zfw*szs4bZtGstx_t3?f8_pl;AdGokbpx`Y_8`_uw!%Vc=RGaSRTW0o;z z!J_A5an0?1)vqp#mY|K>#BzZlq7(`pXVAI%x>>+j{TY+T&z4kZL59~Ib zna?-_w}qItLYRe`q(DsDbHw2iVC_2xJn;rE1ghQuD@09(;xT|os>L(_YgAjt2iBiI zAwI4oegm;dBOo636X4|Y(olmnioYtJ)r{zz(%3;QJ+r4tTEDf_TkD=nahyLeEfj zi1{-z!Z9w&hFkEdQL_ z!3}|UNjuPC5Sxd6$t+^3GuhxJZ-W_p9Aa_f&|`>2tPAmr7sw3K0HQhH=?5V)t1F-) z<8-8_Yj40Kd`-KoUD0l854E>ix~6GidNIABeqQIuNI>l5rgtC`YalY=v3N9~qF=MM zxjf+a+aqA93V8o#8K~i)G2NJMl1--oMe)TPWqD$@S$;PUFrP6MHf;gC&Sb#W8zq|< z3y>lo#PgOtILu_f-ABB!-nO3gfcWq3dg5&D{N$MHsN!H855ZEr z#=h2m46MfG9LpW5W2{qlu5eXy=eUo1=6JjLYWqupb*!LTNGq%tBKc@M3c~_;wBNI5 zxn+DOAxgY04wpE?VgqL!VZ3XMF?BL6G#vnhBv&QzMgTI&U0c1XRc^zXIW(t zt$Qr-)^?W4mLBH)rg-pcpE4|w-ie!qQG7%04OmVaqeQx2@2VxJ&*i)RHNJ)3_MVFF zL|2%zf}^YbP!7%+o$bh4m{liB%u3CCp7|=%o>?esPL`InHoG?brNBe`A;1Ofc3p6P z^4P$;vP6EXl+u0&`(!aR79V5M*ciU1&`Ink^)|EsG^yS6m$`xEv8ADPx7B4WVQX(2 zY#VCpY%6cmttYHqtuD(ni{CuZe9x30a9I}&x>QLTDsB{R@eZ)YH)O{$I{`~zMoqvz z`$8|I&(yxEt<_tA@_Q+dki+C_{#x>4h-I1qR`VFOiF#JOrsdW*LUhOi1W~a}8}2!G zMtCh`i-V+7(g(vULkW{^+-Evu8g05^@riPq<@;Pk=N@k>7EWglVtl$`HX=;x z0GT&Z5~U@=8GbeQfZfKv1dUZ0Vufc@8+omN(p2E|zF^5VYPvd99Rz)xsxayd!0nt; zh6CP}Q_jc*x7Sx41%9G2`~885F}rWo5Uuvb|wk;#J_ELrr`{#d zrY7<``7gPT?Dr4y7xKG(nZEwMecnT!-tGrr>uQm6CTl=u!;DVptJBg`CxXwqOzPs) z)@kF@lQaIvnwqo7anzONsqCMxJkmHCiT%tzF1OG{>@4Lm95aL)8yVXetAK901l*p- z@J8ApO_2slL!`OV2}zYY0D7{T@tm=`>69tId4~C_Io<5~|C%}v@TiKekI&q#+1(U+ z??ph0fPkPNy+{j$BGTa%X-Y5BlqOA3s-P4>iZn$KM3G`ZK}0%I1f&K+de3I>o%w#3 zygu)jeUj|ny=CUiIcH9r{{;RHd>LpFIOZ?mk0CER-aD8z8O2=B97m0{*mINgEVa@4 z%dBp$Wrfix>K}XLy-Kxhlf3JC0c$)4xXwEmHqUI&41ZGin8<=r%cHC)A9a}Jd~vRR z#;bCO>#*a3JY+S_(^&)3YNnk@8Io2dePu@9%tIN`SG*W~hncJack; ztj+6ID{Cn$u*O_hoRCvnf79Eoq17@aaAeM8px+?PTYmb}w>+dVmKivPDj@9@Flp736QH~lW(aPLz0 z8s{eCgeao-SSzt!MloBR3oSO+S($337;TJoE_AQ+F7dSsoC?p0xEVP*YIoGisPa)U zk@X{f4^;AZ4|~Tm-Zj^;Q>N&FN?3oh9_@|1hry%4E5Y*AgT4|<2^}Hswd-f+7S}{iCvQD}n*W}Eg15QDYsF?y%9xGykeHH{ye?@(!t(f9Pg_0>kB@)0 zCMhoUO6JMj`Q|u%N#1mvb{+NX2z%du7|j>UD!DSgUf${M1V~{hI&#z(JGjbdlhBe{(=)+!-?7I1*i|yHH{$ciEm2bSl8+tu!U)t7`VJT%((vu4&H%;8}Y;^q6_@&PdChkk=nz1D3U}&mtXw-Fn zPDM{y@7l1k{ucx91@`+Z`260Jt_6;Fy}g`$_JHx#x1{1oz~HfmIrTgz3wl3V0#2uQ#uW_l{buBIS2fQreeC@N$o|h`GPq#bbu=P z&A~RouwZg-W^VD|Thv^)6y4lqSrwnn3f6zzU$~0+3k71r_eW$?`8&k>ldqJkyBwxt z%@h%<){CAhA{3vqGGkok)Ql~;Z-tIpC-p|%#Q0h=2N^pYC!OtGt2{n$AZ(APf@`A$XS=2koj|ZCc6L2p0Ge zlr`=nf#Io2Z5AuHS?Mu9$DI-ttbUu=$zU&x%oF^fr+pV;o1F<=rDa zOT9C~8v9QBD*L1TZT$}a0^iLrgH=(|6Yo0b+~?TDoeql>&^LZioj{nmLtSsCRSmoT zq$BIPn&SD`xE>!Uq2^d&)@SBR=5^NO^$4{Qksp$N|p^Q$( zVtE>jsM+ARoS|mm8}&f71IK8!7%Tf5JssVgZC$UrYj`}~^WO2SWo+Xc>zn9{W|mzY z<_hcM{mk>5`-w}E$*AS%XiSpdfn_yHC#X59p2~xc=d3H%Gio84fWxy*-60mx0_2!E zdWBx47f}`QhAysesg-zLX;dzkacmVu91rBTMg`Z)j?JEXo$e8v2u!p{ccBbNjM z;a$SJ1SUr21lC5J2=qd_ms01y%n|DdioaPkG0a+TO$rqabqjt)ozJD5uwb2FGbac5;o>wP__X_GCt9J93W&r-rIpzo-`CD|y#==7@C;bKP`RX4UHecW-wS zx6ggnHQUv|mE`=^IU6LWLC#6et+W+@V@vNAZ>zAoVPkx0SjC6^S^gq{ zVpx&K{qOj*d?S3P!wOJ0H-Sp}J+70^+m4V?iTa6kB9V&h-&7ZB=+{_1tV;M*3FbX& zP9BS^~< zx2FbD&!^5$osoJwbx_)kw5+sp86RX!%9PaD*UlN6Q#JQVZV9UYujQQy6*Svh&8_KH zQ}ro&EJg^bmP&#}hwzO#=r$`$MC=iZ0^`p8q&yTkhf{`S7G z-C;R+LgjqpeKmbwhJ6usIjjRK3|Dzac*}Y>QgeEXRY=9$+g)8L0HWJ&kgwxg6O02VD1E zd9Ke~^=)q+nZzEuz`o$9QazpLs|snlHmgDzOd zoolf!W2F9A*I>odV%--+s9tE|aq#Xc&R#=&@i0dwflqXpb@x-zhiQ7IKBEhRg7ZG; zZWF{4B6L-$SE?Wm((=v356g=I#5%`|17N;&0EO-yzCA$2)MSxFY_TD_oC-v)EKdwB zAgdA|tjyZPkzg&IWyR=fe8By@Tg6qjg?1TSyYixuILwHZLY|ruhkYHMcndG57Ch+` zcfoaQAg+P&c3yW7Pjv^~g!t$udNYVm*O@^Mf|~UZ%&cBSN;gnR*Bg|&AN63+qTVJ7 z*%Q3D1yK4i5y(NT^q5HR*HXRrGMG{^Q2!q^+j!1dtPfD36{MPLBRF|qqDPydL61Nu zaMHNrTC{4kK1YP}L!y`k#dqB44s~H^Q0^g^YMDecuM#sDi~h~kgTz`i#A2}woV-WS z&nZ5m@-7ba!JYgc2m;k0FaZmT%b*s058723`qd9?JQsL@#fS*kCl+j@AsmJdHacKc zD7OSUJ=SN%U(Ak!z%!dAT7XJ*nR8}{?x6nt&KbKnHWunOhuVFpGo8*g8<6X}L|3

VrC9?dJ*v%-Ff*%XW5>)C95}CB-xZX=#)B$Q_HPM4;={fzaJ^Y@z?^r?-I$q0X6sOzMx)hM*6m56@8Js(ufNYnB?@NOgI6c1QBLj? zd9>aomP?l?t#^u8=>++#C_J(Y-rod&uO*}Lo8EzhR51pCO8L6%F5U;x?FV@cIUQ>p zp>7wHR`I8tO?Dt#|7!G+(4TtIQmm_)1TJ1*(b#xEyg8D0ugltED_D51fKm6WC}I@W zuaG5~Ozz`l@v_k#UM>g!8pfM?KY6UL#ag)@e4iLG5rm(TWG~{?M0p9Fa9g~m>(hcb zwM(0_lDKGvOTW0O2kHU(iCC$#82NGXM;)V5L2MeVH(~q#A%+s8CW}HlmZ)6qk}v6B zz{azE39Rosgs>YwdG>@i$031 z9~3=|(yADsfP2w0Qf!jtY4=<*T#ckt$H3`*#iz)BPq~SH?9m&@^E^{qzyaKd_WPB( z)xtUqw1Ww7&D)|2^`|5CC-8lUs_16&nW{mR`&xKqm|lnUFI1ZPxgz>gl@5P2q)&su z;+sOP_^2)AhqNbJy{1MRmvzwkL!XgfQav6km(!Z6`WLknbU{B^ zoj#(HDl8_;t?Z(kvKd!Li*JkyqMb?s&Cb&2X?q!wPSvMN?>0I}(2>Y< z{Hkipy%*RaE*c4b))>8=_0_GJb*jl>MoFrH&!Khp zh)$sUO@VrYR7scQ$~V=a<8LmWY;RYYHR6-#6n#(A?*OMhg& zBa0dpnQ>mkKPj(^F}H$4NWJQL9j$)E4>}E1|08$lDD|m4f&^A(ESk%QtYz?v{*DMe z()!BLotf?>W{7 zs-;vv(L+uH*)LsJR^RE_stlfE3-KFk#4Z8C{2f%?2)4@G$Y?EH$MK3;M!&?k^p+p0 zQDFN9j5$cyecF`=Wr`zxrFh;Ze63iacY@j-_0(YN!1KmFc#G+@+w5vhA%&{t|2@*5_CB-G$+E%qSN`vxQ zOs_>FA9bu1bD*mOZXSbi@{nA6FYKZ0L(TbJZmog-?Qqn!hdo}oq3r$3~6x|A_VYz>t+ zrjv(Ev8sqXdD}XnR*5x^Nouy$)HtZJ$v*#0hA4oJ*n^GoE`8~vg^qB{v6Ol!+vvlp zrg%h^)@L zlhdEv!8CEjyyrLt@>ECJit+Q1DRx>9>=^e%Zy~!#_Os$;m#5p&_dgP#{JDXPn{wE`;(b$RI?7q&*0cQvWS%;Z=rpz;;ol3!l;?P zp}I20jX@Z_ql#HJ@8^w@yNozcM!Fy9x) z`hQy-#=h<=Hc;nbFq>D<9b~N08-39TE*?fir?cFnqM79rWGvFL%o;E0Bl0c1O-7+RkI9wh4PDpqo?c;fbqo>Ztr3n&P*P)+zb{Yg0pdCp zR*j7fW@&K_ZTuBDoTgl4U6)6Q!;O&*)vKbHz91i4Df+HqnWvaRJcAtn{I(GZ^T7oxuYQS~;;QVaZpyku$+y6>t3$l9xD_Uu9;>9R7;0>=iiqosZ7bHX7m|tA6k~>dN97thYO^XRSBS=HypgLvgnM@C z(<&Ks+?#4N)^KNWN&KN#fHL_5US3tl4ZOPTtShK5Z&|+>Lq&V5h5Qsgo?#_Wk5SRO zDgUC1#f`>mgEo&cPAPgS%Bm&Us;zXYijlFpo7ykuh-=I;jnH5zqOhI8!e&{g8ps;h ziPQo!lP*%y2w~q9kZsj$W`l`hv8rf%DymbXQwB`i*;rrO#XV{Vo~izXWQ495FjumEo)!%r6J}N`o1YYJ};*|Ieth`aiYwD&h z2af1d{EFXIUDm~n){E@g679yC-eP?qQ{+};u^rYXtLNo%DsjhC|9ry6O0+u5<>CYt zGDT%sy-}3`rBcd^>b@>woB$tEk@-!uu7JPX&3tH>su z`rx5_uS>}43UqRnj6`2ojhF|M@x0$RmZ})mOs{ zCv_#?iZxKRYVI8&+#(wZ>TJQ;oT5BX-+P?6p3i z9Szr&jBu)T=D|VJWTKL~l~D>T*gH_a0c&U08GbWX4aMHv$ec10ull6g&odi~s#IwW zF#1{prN+-j>mFkhMWCXWi(0bx2Q; zGjuEErbeZ?ZZB6-!Sjv0qi?c$vMF|H32BOW>%38h@tK4E9&B7Uf0Zv#@w7m@bUEXi zdQ&7@6&)?WFLyX=S+B`|SkYMq{;g(oHotTfrdnx%@xEFsGE|&#fVpRZV>P<>OntXxVnh7?P3-wPFw?6Y!Qie>o1n6D@IR{%3Y2ds=q2nbbB^l zQzjCzRo*3zFyE+eehFf{Pw$qOtaq^J9{o z|DmE~I8lvck)T@Bv)b5NZ?Ss)4Xk#)6+h|9ay<6c7WoI>)iT)wiLtPfmceN$L^@81 zd1@zXrkabg`YW_;XZ5G74&LuLSpiEsiP^e`-fJcp9mNXuOm~&7 znYpu#h1PU9rmH?KGVwnn2~-OL2CRO z$=+b_S9bi)>bKX8Byk%qyMd0}4ZcNBP_PT>k!Z37##-w*`GTjWOTGvyYfXI-kN<(y z!qFEC_&i=iA7V38LG+|2sNN049dQev;Gx(>j|KI1!_gCMjDAEG?^6}HoYimzu&<_~MFyga z9jx#3Q6Vbmri~s*~vLh%pzi9f=eEh!)4O=$9I!bv^iH zoAnHxazF;qn5V@^{R5s~nw-r%@~6lVf9lHCdvdfGtJu*3y8occ8Y`?*Mjz2#y=HX4 z6ThNo$y3x&j+PC~zl^Qq3pT)&*YS#0h-0A`kicuHqoNgYoOaN5AFK2FVrL1X8CQDs z7lzZ0JmQn@)AvD?ud7;tQaeBom(&KyUiurN2OaTjE~-yJ9RJ(cqUIxcOF3hzZe+Ak zwZ&kWY)x>4soUCRSo(84U#&APTkqjPreQs$n3WBDYJ7z@#s}iC*~M4}xBMd0txZ^d zUr}#a1Zmj?f8PQhz7!f~8PSSD#CuyphcddRk$}&c$OxRrzq!l&S6MfZ@o3Vss+FUV zZm8A~6R1xG*ibC?HrNw*5)NtIQ!g9WEWhqT#Ih9ez+&=|4v6bkZKJ3B+|6gHNamJuh0RPIwB@_&w#+A=#5U(^=vZc^rH1jA_&|51J5jqBXVH>Ks(C`6P zS0{0V`R+~YFtNC2?AWk}-2+jfBw^Tcft{>(kIjvViQA%DGXH=WpVkd z@`%0iJtE>gh^HJ8YowvZi4Tn4VEzZ>6@68C$d#QSdYgx@&`bAL;qcD|Ynxaq2g2#I z#Rc^W_G)oG$FP0UNUXOH#3%SD_3$!2)pgNtz4WI%u>oGjb*$2WSf$$QMMiym%tdIi z;zSf4>le`1g;j6XJU0jbf2RVqkUHU$)*7@=b!v$2>;GT@tz;J!p(leo7s8ACiCqE~ zsB7r%TOPqbzSapv{JQ)^JQ zx{bCSLytFMzK|SShV4|CD8fT*^LykBmdVS+)ZP>q@YV+r*Pp~r6CH^7Cx|8ZIve>L zC2lb94M9`=Efy2Wt%~<_0sCPtYl<84t}g!gPPLQRa4&X>`H?8aKD7)AZ6a>?7M68M zQC@vbbgYUx$2izKGu+353K3JBMGNZ^4Q3A*Y|-*mU%xJd=C zYKmQYJbU15CWd~6^;3)Sa3_%)Fo|+i6b*?G&!hE4@k!c}K{=sg^y_k*cvofW6GYvP z6LCL6^!g>Nv`L^!Kh__y@52#&63e8Oh@~I7@VG_9{W?8ZMSZrPIDU{GEGK4?L{(`? zcIl~r249GeSx;=mzl(!AKf~_XNCiYZubs@!_lfy`!3;k|H$rwMQX`j59d=)lDmKIA zkD&R_YB2F?josJ3M5H)vHg;-WptDlEau z{|U?LtiA;*;V@>27g#TwrrTf@{>t6%VLcupK06%Sr!sb89riOggwCH0K7Jb4w_@DK z(&k*^TdY!-FEGDeq|*Huy68IIS_)CtIO3#x@qE6+ul(zFUrmJsJC^ zxERi;_dvHKv0ISE+#Us0KgSR11V_Chn(8S;`0cDr5#ss<@Im77@`V_!_A#UV&E7Hd ziSy5ATr!D7Z-ukxki)9Roi|aNe}HVnT(USPki5>sC|bj9STf8`zcccUusGhQ#^lKuP ztH0+S8|l%D?D~`gKflX75Ce5qvHQwX@_DyZ4Yb{3th`6$OPiN`1CW!OuRL_*&n;-OVlp7{zA^d}OM z3>OeJ#A^$obLyc3?qc_}qsHYzdXH~!heL(-3kbC$Zo%1oi`44Ef zaCGy1#&I+phz}1|Lne8*zp%Bgk)?bL*I$B`#ps_9`;hC8kiY$KT~m0r02n^&^eMFI zJM<_F&TPZHw~ujlVJ}xfFT4-Mp6F)i?sWYMD5#rtOZa;``Ik~q&qT)F5MLtg1G#c2 zKKoVjnj4{F1-y_6v^tll-bt+Fm1H|76H7m8?|cQO(p54JZE5vtMxY6;V0SIJXWb3HZt7*k7zWd^LqQbbH$R6WP1!tcsrp zzg=P!rqE-1oR;zb5p&8z@*MM#`x;HcR8{h$po>xXQZin0ZBJIn`IM!i|zScf6#Wgwd7&}|B?x-WN<8Z9H4vcQ5u7Mn8 z@wpa9UqL^m!xizgxvTgKTk-`)<1gl%b3DBZcUVj>dXQ&LWvz^cdm`aa!5#jh1$P*O zO7!ajcMUKv+j~l7koS#cylsg*&pA2p%L|NO8d|0~a%OR)4qn^~#OE_~bDriFzw!+1 zeJJB5rY4!&kE83d$pKe|(hZq!@36a(ARbT^-CL5DwjpyIfgHABw$t!pW1d%%mgUfQ z`#zO99tS;cF)m4rei1nNCbZ7tnd#VFsf<%3G^$K)CWlXg`?<((2t1$qj7Mecn{fJ8 z7X4QZ9L}O-XVduh7VS91eLeKfOV1CnA6^N@BMs~D5hHSs=b7C9AM$vbI)PMLWbYdI zn4<;hdp2zq%nWO3*)8t#5N)P8_dI9ZhUQPONN#d&30id*dOqO_d%wL$oM-Qy_>}v5 z_|Cpx9({QX|NF7Fs?dHPBW~-70?bRzpj09Bd{el#AyUwcvF}J0j#4ttsQ`7VqnmBb zYVkxDy(~_~Ig)GZ^G!PApUQLWmg8S?MjYJu3oUsFuid9rcd%;g9%s@Adq=|Gbbu^LJ0ZquY;v@Uuw}P}g zfvW_(L!O7vc|6kP`Z0=}NF35;x(-NDn zGoXM4T~E=vha3$;-8|ksdftO%+WLU=;-GK-IN#(`5`BrMe?k5S8F>$_wRyqj=`5m| zh2g%E@N7ByQiPE%2bUJ0t(D+LoA&mehXrX@QNF2(?(oy{ii~`DdRU70_TFf9xV|ua zT$CeK=v^WD68ZeRC}cb~OK)ux&){kgP7^8DhQRSb%S@og@0 zU|$#DTziLHC(>b81LZ!~byOS@N}Dc_mK2E(BK(#v85oB zvl5`rO+MK+Pa$~8ON-LEF7x@zN6QP-ekc8O@ayG$1$tDIzD4nC_tBPxlJvU*bScCc zk+irBy)Dbp0B01S{dT`?-n6eN0>y*ylzPtb_U@xB+Z?r9&jY3+di6tD6(?D<#(=tm*?XZJ9Y{@XjZ=I`KY zAGh~3w)>MWrS|>oxx{{kqJP=^wKZlQ?Fl{aaRzO(b^8C>n?!r_cXEw;E~$xpPUdAF zvw1h3&-NLBL~}oz2keoyuebMe&EKKc-l>;G7teJ^{w}r_Pqz2J{rA^=PAPkqv$@aS zOWFRR{06#&(Tn_@ukAj&p@zK|vwhUw9oFVP``5$Kd|tHoaJKJY)84+9P3e4IwvUA9 ztNm2_NAYX7#2#y#%j{it?f04d&ERh;<7G#qE9$R7)P#O(9)k9(hwpgm&$duM;Lf9<>2*Z*(F?f>nSZMX7&bh3M6 zkC*+*-M&VJzlncv48)4pa01|Kj*(MduM5T6z!LN RU;7#PPy7Fr%^wLv{2$A$1%?0s diff --git a/libs/unimrcp/data/johnsmith-8kHz.pcm b/libs/unimrcp/data/johnsmith-8kHz.pcm deleted file mode 100644 index 8332f4073271869feb40e757b8d2942c69648e5e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16000 zcmZ{L1(*~^*KSqY$j-Xq?(Pzt#a)715-hk|a19V3K(OEm?iyT!y9a_hEX(R>OI6)> z*pK`D_ul7jKhrbYQg!4#r%s=9S{DX3{mb4E=6^OzSb}}oxX9cD{y08_WPZN>B7}a~ zBof?YY|4K&72oRrvuQXIydt;{UK_k4bITmzf9}7Y$-MIGU76$mpZ90p6{O_r-&ZPw zbO$L9Zb6PR_nEw9@|el%e>u)P$NskjzW)E;5i&>n@BZuf!6X0u%lz-ZSACs1`2AJ7 zU%xZw_)6jb94AxWLB8mJBrJWA-&ZN9Bq-7Ud&@j4f4L)5D!~!H%H+Q^eU-;o+WvpM z2Cw_?mMPIpPQS`K69vH;GZ7G^C{ts>Utehq>RtPyZx#DYy!@XU5B?WC6XZ6N{>**w zc<@+op5UJRXCIvZtJdik4m0;bZiD;=sV2nwLTpewnVfvpfC)`lz%N%;VUIysr)Ljulfkm_m$SKRu%mIdNkASg4FRZRvMg5 z|1xKA)=bL{{>q#=^Xg0~$zP;xCl2Byq1ap`93K~cIfL@!Yka^(nPXI z!6!+4#+HQNso2s)hVTgAmw5^Fs$qn15=~-BHjAqB7%CPhe5Qk)d~vM){wVJkp# zk=(c@2G@pSP8nQT7$@V)3?IZB@k+eJ_8gxV;;s0AEfrJ*1jW^1Bp!DcCZ$M4QiW6_ zHAz)cnUwgl<;JY}aJB#`P0Ewnq&4Y4dXZsd44F)3k{Q^hk#S@w=}p>^2BZS63?Y8Z za#b7@>%=c&ocK|67A-|XQCHLwbwmTvTyzw@#VGN!SSj|13*w1L7aC|UNotXnq&w+P zMv(Dj3dWs=ImVMwWFYBDI+A8MUk-G{Lna)we*`E0h})RylK5NP1Xq5MmvkemNgC-$ zPt&T>38{>{Mb4@WS57K^B}|P_4dsk7SW%TJ@<*w*G>e`mOq3Nr^35#8s%Pym3z@g-_ED=A9*uggIDJj`8T{FZ^?V`5quh7&iC-s z{2!jg4IVCXh$5mQ#qmZ^SF}9Nfjjc^J>a z%koxyG~dDB@q&=;c@ag1kgFsQok$w2IgVN*9Q0qA1xRmWxz!2PhG+q_X5+a*gC5k4Ph$i-gk(^du=u zFA++6(gd=Fl%o$tIr1H8CC=gg(Y&YnGlq2MDrIWNsz9Y}2d*#~lH1blODmlb*Wf;xQma7_hX}(aq^8A*h zoaY-&S^6Y48!c!B@zk_L6~3L7;HAVRcG-%ih1p-$7V5DI@C~Ff`%~N#C3t-ziEqS2 zIHL!mouqJu?34QOb)va)ft}`Sv=VF-dtmQrov~&(Zd%Q)fUUO3W=_=Vk^Sakr6ZZj z7E%wXE);Qz7^DiTLdHujtClFHv^A=c@$xzSp>$9DV{Vlky=sf%UMgJdboA?*@_MK-#L=b`UNG|Ml2q)EnYxi6KCC^d@i)ZZ#= zNh?d09%9y#Oq2f+Dds(Or8QEllX|ml()a8y@=PA3UzdidOZ_R*Idz)+tUzTDd&8#N9le4o(o}s>C_ski#W+FB4P;I8(@r+O^ z+6Mbv(qUy1`(!+`trjGHY)REq0*~ItKRy-m6po8?;aA9{PK zhuS=FLE5ZL(Kphj$`G@LXsiBaO|v@KvT;vfmi-E${^eS2`9WX}jZmAg#b!HIr31|b zsT#avO{^cq>0hwP+G3nC+N#4EXv0K=kyB1r&jq@ZzFIdkT;x^b#7e81v{KH?7qS*| z8EH9FL@uSjNMl>1yW|reD_+TE_#!@7e#RrnCh>`E6GV)ocK!xdbej+0v&aqd#(F7k zliqA2pDhx31bfUjiF~ZTb&FFTVx_R}_$6zbwU0}%ke<8>FUpp%vTO!_%x|$t>^)IL z4&GC0Df)?5Qc2ob9Hw`qnW7VklXhT**i3GV`J9RAWG!DtngS^$BvpDPZI`>s)s)}m zB$+8or2%rhvP?QGrAfo(jZ!zcjq-==mhUO;m05B>xu{%RIzpz4+k8GRY}GN(o75a_Vox1U3(t9XoOhgWod2%A)mkbVODoh}_Jz*8q5p>c6t*M0VffL| zGNC;~o;s%5M`)?)Jf*MntEMZPXta&llC?i`#qIC|709b zO-de`GAQ+8>eaOU8J#^td~*W5b!rSY2U-;@W-hfFvW=`IUjeQ8qzB4!t-f7%Gzxha z65>h;85YvsY1t>(qP2xe9oa4wpyROa?H64|2cZfodhxdWCpMgwhJ`06w@D{Sb^aDQ zH6kT~L}$c~i1`%RENqVUjdX}N_LWY}_BrKK>%__*JALYqGCKXECpK_KuV`kmUK&*c z;l8yVn|n+8`}D`|hrWl#YB68wEWQ~XnX-NgchNyDALM})S0g8d z?NCRXLwwuPt9+iGI5x56r`(@o)0TP``j6|q%~!_dz(8LIcb(LeNk-y{#CM;rB{$1> z;4jP%Da)Lt!iPsSjF}ztV|2a9*Z(==N>`xr-4=OU-#ykozr{h*Ad zTlq6{z5c|1#n;a_!Pm^M21e-xjWy;W6HC6CpTvd?a@Gkg5?L_%YJ9mYa@>>9iuT*; zaT06f^L(2gm444X)!$5?X85h~A|I*D>lyLhdTARzZ%M53q1O9TA66#Cr04hht>#iz zn{c)by%BoS^~ibJ{y=M@)>FcjTgq5%q5ZIPglk=>BWz7*LsyKmv#p^rfF9%fEr(gj zxUPpAvy5WqO*5bMi&fX^Wz90Tm{W~1=3n|5K0NeE_?hT3vE!m<#4L(=6ERn=qL1*d zcGvKp@{aQU;|~|Hw#AOUS`m85>>g0Ot5UCjOnBS>ZR?Nolbso7ydQK`{39>Xu4oI@ z{)$h&DksRZr2f)U`Jwu)y`^(ONMD!VRWfv`t9VEbhgTCyBl#ljK$?n)h*7-kJ)6j? zv5VFyE81FQHZlJ)5{}9~rp?he zOIfs{+B$88ZN4^DM`>e0%Os3MQ zvZ)gLbNfU4PP@lG*YVb|*C9FD!>&5pe$j^DA?Jqlkd~s0$wN_E^udEvOXgq=t$1s; zxxpN5ZZ+?k_sumHwXQmO-16*Y@)V3NZ|fz!AZ2J{(a9X*of!y~MmX1m=L}6&PFt&d zSJF2pzx?zpaeGo?YMQ&BuZ90-|7ZWq!1{nAu+_gXP~5!ED@Z>ogVo1s2QA$8#5T_U z)Ly|c-ErS>$MLh{to@N~pZ2>tLitgiEghjH==bE2xWnu6TI`cm+KRAtn`_L&=0vlD z)ya%^Cd97JJ}cju$mYsCvy<ec^KS|$8)9Fj{0dZpv-jMCEe85^!bDVkK*lfNxT3NS@TjX@)_P9Wv{n?0p zEgh?St;T9IZ4HUG9ITRDHT+Dy;-su(7s${J4+5_VP6MUhb zk?xk>2z>&}MjOh#ly}M)wXe3?cErBG5$5dXJmCxtsTK0t8R}ePFJwEQZct9i8B%sB zlolj@NU9_|W?eGp!Sdf4dyQ*G7W1Q#Xg)9|Iod?;&DuZr(9o625s`-*GznwRKz{er+J5_#wLAC9`4DZpV6mzOQrczie@bLudy7WnK&-$ z(H(LTZJzC}?T)R1J;AZw`D@6Hkgg$for@ex?K^ENw5{r7WtlugT1rQf6=E4b$_%TR z_0%k2_BQt#!_9@pd$Y5#U95NA4u6&rK`hE8R|BnVUyIB3$T`^i3skBjBsDsrO z+6>!9do4#tM;S+);~#r>`wCF?r+QT3a-7^)szUpbk>UdPvF7Z!Ro2q1W#%2TwV7r% zGlyIC%(KGd%n@ouT?@aiRkY`D*qs+by4q^;uKcky#damMO2|rSBkO2hHL6=T^xN(x zY1>jOq!028^7ePHOD~gNB4dCjC;X)8s}rbWoVIRay}GdGo0GqdCnSYc4R8&12>i zslE2f-ZkW`Hchp(&9-$mQ!6VK77yrKd8^jnwneT&CW;I`hxcF)bn2h!OZOe|+X7E~ zx4h9lug?*<7w`re>-~)+vlpAnONeK}M;b^oi8;HbYIHm4z;sMkr;~Vd`$%%#iCYHI#=` zbi_L}=T3)YZ=+tMxyf-cjZd>?>rH)mJ#R9~rn^%reO{Xw_ObT|$A`P`ufFf}!TWJ= zQj?S#=}kPV{2k5KqLh4EvmDOQK=}SBE%sU5H(4rXeVR3Awxq13vPxO{#Lb9Fh&mnq z(e=S`Rog7DBD2^9Juzn)UG#(gh2H7z_vy#d-lo#j>?waF-%j3`;!T~E-oic0TRYIr+|1ulo0{ET zAVdyZ8gV45f6SrSjd3O7YsNo{Gh@%il!@*TSuFf-S1#xGwk661s)-iXBfYyn!+Xe^ z!&}NT!ZXkN+*eOuU)=UiG3-}#q#2f7cX zw@WLY8l93qdFSWHpO+_}OsSk^%V_C|@|QG*u%krC^=#vv(?Tmp%!(QulNK8ue3b2_ZSlo@cA#wX+m&D|bZXa1YJk2%K z`HwA+I#@a&a5ZHQs-H&jUw|k{0EKNvw2V*3<>+J=Lx5SHsjK zxwW)`FkYE8Hf!kx{Nz;<&f|CRotjIfn< z?r=Q~J04LlYEX2UnE5f&V{*iFicW}n5>Yz5UT6udwu`l*%5nOGaIh+7j9~_z`p5YX z`YQy+>bc<$Zn2f3EA>m?D;3qH>Q!~OT3l_XIOGBJv={$ia-{O) z^2v8Tzx>=eIU!|LYWMV?-FDxNzy~`j#{>pN-61-xX#L0Ym5&1{=neC*1#-%nX$_ZVZZZi96jcn-Bj=j-Gz5g__`M0Q2Yjb^y@gEiAyX0612h&9|AYt6Qf zTcL=m-?2eF44I{$NlO|h-IXTF1(fqjQ}w)BL>r{7&`w}mr47{zX$RGE>U!mkY?t#& ziP`bqt7*Jngy&ptQH?9Zjo}*Ho3HVNNZ-l+HX3{gsANP7=-It;WXYKy81tuZVYyhr6%2Pr1|GZ9Q*b%Uyic{FMW> z^m;}QJcUeUllUmn8o8OLbdqG3d&~Redvc0I#h7liF`5|7j8Vo;gBb(N*XATEp526(ZYUy=`&mTmA@{Tl^4o?S zTrYL2dQJVHzEE$d8`SUBXmztvML8rFl2=F`+L`V~u5*-l#XIt=m?_oTVYRn%T8j0r z`4$mgnkie=tUlIy%Wvgpi`aEm8o99NyrP&P9*SIK09i@i5J4&H^8p!4WTx|oio zb7?JFmqyVO$U`+oKG7{ciQUL#4MFazyfAqYae~(r2Y7<8iQHl~GIsApHxW&e#5ZIR z8I8=;D-uGhei?NU{fXY99q1!ur&i)f3EF@jKsKZ`@>3dlElwfks3!t^8DGqE^5-lC zYvRu=gn2EM4YD$<>eg;+g7uA+V!b!>vEn!q#eT9B-p}gFzhyplmhVTl<{N%n6hxNu zuBeYZXbaMowkGH3Y*JqOgY-i>If=fY8RV9fg~ZDVq^Q)E?jbg*2$@T#kp1L6vcGr8 zX%UY+ZnT(2_V7^h53*UsMNK|WY-e4?8MX`0QT&D@-{O-jmWrRq zS@DzDLWi+m!iQBGMtI#R?4mz0j&P%i5m*|2)ib>dszM;dL#LtfrshMRSe|1s;! z|FVvxIc>%|$+xZE5(W3?Xg+?L{wPk0Kj}O6NLt34N}Mksr^z(_P+DWvSH_r)l@``H zX)*67hDhDaVQK;6q*BYeLwkwm{4(vxQfO1|M8tX?^#DA5(vv$a9t)@~L zSWGLajP*gOW;|0~Sl^NNRI=tMf0;sx!3dRQmqnHAEGI2b2U<1Nyv9=Xv$=#$rxVSS zT6!S2w##fP6((KTDP@sSL0xXOr-R5g{(!dU*J*L_3u+M2$Qoxs&i*R2=@#Qi4sn-^ z5r2rv^bu<#{lSLQg5n16C{?ne6=80dw)4f}F=kt+JU6B)3#<}!J>k}$%0YdC*3IZD z?-ed~SN$_U?4$K;N-nXQbyg-CAC&6g$HOO*5@IfO@rF_YZ$NI*&ZbxE@9$!ljOxg7 z*VSLz>-Z&`Zg!@}=`&&pY!S=JMlM~V=-R=x=PY-S6`PFvED#;$(s(M<7wsjwN3^r;= z3(23>DU}5t*#-yxQBPZclA3g%l}Bl5u2Qa=ZKcY{x-L~d8jY3xtQT2H|F(qO$2vlf zk_(nYDaKlnoAe*6w!EHQru+B;+6a}UigY}WmAdh)lE<2;6gFqeM|pRCQJ!z!Rh}3- zl-gEFX_)9P%1eE$d}=;pw3@@ZLPsIXbc!xyTO}VXJkI(}Sz|U(+FQlti|}e0n&hqN zdg(c9yJ=>KZgK~Gn0>E*v{u+ULoHs8rm-6mVaarwn9RDXEBsd+NJ7{LngY3OpWkqF z@s+ckwQ`FDC7Y37U1W`?CV6R%QLdSzq^x8+yCSbL>!~%&Jn}M54H?OVKyV%fu^dxmrE2%yvruS-vMeST)oQ`a|ui-brm}DN+t{iFH%r z^jG%pyvH4q{!H3IkLqWfb2B=J|CTY>K1U4E?}U`jsOS3KA11G%9gPOI-}G8?T^et0 zv26>qS9QL_x@^1Y8SAR<(QS{dHP$ry19z*?i*C1r7`Y_%+MCQ0%#eWh()Kv&bOZv|7L0@04)f$K^-f5`@` zF?vngWaGLtmJCH!w}%xiXJh50Rs4xqMOup$WWJaK>tNC7giK?pMAU`y(4yr4x}p)Y_{~5^@hF@&#YbQq`+%+KbvZevAKM+ z?90s3iKaG|ew2i)yqlze|1)P00)K zJ?|wgWP61wDXb%{D7JAw$%;Bj7SsfPL1pO~CF}s6d#|#Kw3RprPu`lAB1?EHDI9s{ ze5eN&r8&eJdQY4dli+P_^fqd%b4j=;MlbSBWFPY2`^Zebg+z$5WF6vz_u>a}j4b0H z$w5&=jKMxd+(5l&I#$S@Bu%_V&1?jTq?}wQu{0|Ur|F0nQpg3=ASaS}Bnma%vREtr zLhW&*=p)u3ei$hdL;+Mb32Gu?A{3EBF4XP57c<2jk%)TaDDo#_AcJH<6{|iXh90y# zZH_8fVXDzIa*rHC^{XH1Yo$?N)5UAhvjr8jSz-iautdy56>2}KoKH}vu7>L90J4d^ zL*1$Xtw}qf%D9Yfr@Ik_Oryi;AledDH3KW*MpV!Skxr=Q7DZK{1Grj_s+tY=ETUf2 zMF&dzC7+Z>t|s@9hs%wTVem?OrJ9nU&*0y~=xfYz4Yjshptl+AOAnxicmWmFKM+OT zMU5^Rxrisc1HZ&7v2#{u>zz5(tZPP_pNxmbQzO}kF}s;3%)-_>s|34*I65b)w3A37 zdWHTVB}qNyD{?laoib5br2MLkRaz*~%4JkfUGf^KkhC4~)NZU9ClE!w^Bk@!{U2Uh8v}Lo$Ig%WIIA=OvI%LORwq4qDWu#m|I)Lm>cRr1kV0O09 zs%&xSVV5}+wfxQc6TPuf6xv}6K%e& zpuL*?gKePA!jt4h&1KtS>uj&=xaVl?Y~~b>JdV${j@mTkh;)K97r!H;yv0m0_ZvC+ zef5OAP|0PV6f!^58#2l9L7F5TlQvj=eEHmed$J>k_cLobXHPEz*0$x+iiX=tvK1QfjqwB89P%_lM+7XPJQpbA4p&(U80?H zoOG6O{$>~I3n@`-gH;W){$Q8IaVcCY=$I9f?CKc0!u8Nu!d^_ZOKn9qw$rpDPwPQ@ z(09C@XbTTMlWai8#W2>vDrdGdY8k8b4~l9ZC7n=PIs;*OLps@7iJgJAh+;u)1zUSIRgVN*j@6 zeuL$=#+liS%|;J>Gv8!SLr!F{ZJcYmYlJOKuC4FZoAV5#kNb6cDQk_~M(eHxly9|L zcDuc$xavKaF+0PT)*+=$%8vBu{sMfH7}W>>A=)>&&VJIDPZD?LRe=`XAvpTs=gihVY#nazyt zhF?!%JCwfYae1IEMJ|7%Jyd&vC%C#~3VY>u`C`o!ev0_$1}R#puHDrRNR5#pQ}o8Z z8txD2?K3)f_V~TVLROoUl%v!(>Lz8Ze1X0ZZTUBBpXFqAI68l%PD)?xz3qzK1rPR% z&7sv-ewIFwo#F~_kFJ)rytp_Znv>tj6S5BL^fnPL3h>G7f;Gr0k1mQs^oqP*Yv(BC zsO^Z=D#?nX<7wb0W1bOWov==_YTV?HNH_T>If`Zz7uiwsc_6`8&7-h z5R4B(FHZtisyoO^PZY~gZ|Ej^iB8;u2xcX{DveWIwi)(2&Uzuao%WFWAvYZ(wd~5@ zc)C-09cz&Bt3Jv2(R^brv5K=EtTDT9buo+Us$cQOx~Hd4PK!tzl6E`&ox7Rub6}6z zou4Pir5Mx~qmg|-p)^t+%Jbw|@-4ZaQb8@M6|&{EC)+1Db~z?Hy!I%&Pg|~*R}M-8 zXfcw2{Ef*ru&Hb|8_&*QMLo!?AX=$}{7(<5ja)+Qt#;9_*}B@7*hkyT+1=VGZL*qA zIV_E$eaUa=;o8At(KE0BRfu(#$Nbyaum2rb;;-Y&;cenM?w;%3<__^(_T2I&``QJ@ z>*tK~=6UN3Yrq5iJ0X!Sh^>~=%2H|hw)~GWM;)wvMpfn?o6BCoehM`Kx3*eKQ9G(< z6e>_)bDfznTDresqd$*bitvWy65j?`Gn zC2gfY)1ow$tS6HYV+ur#%MpY15^Y5#^kHQ|+*klvlnTfjC5U|JvnYzbwvx#ARKeM5 z=yV%~-mNLlM(uTA`CsiKO5dCjC(c>p0UiBiv4EFWi6lamC z+$}bX!(tKU8v{8k6RX6Zh$H{N?1#{6w@FMzwqu$26`z^t%$tG!yw&2U*af`aK$a;P z_e$g`qEp;=?B!y3|TiO8e0mIs#oq zW#~Rymfl8`y^GEP3a%nscY*#$HK`aqMn@r@-9$s^0BWbb(8-h=(e5pDgIyup$RFrc ztANozi9C>P5+rv4R5d{tSurse+U}1Iyt3%M_<&5ImlqZvd2M7wU5Ha1(0e5@0G)n| zMJwQC2JmtZ9ekG&#UFqkmO(qmkr&)7zD1QwKqJ}VU$%;d zjOa%OhzID;yat_|hkhQy_jMP&$T3k0&j87gR%Kveoj8Pks^ySPexOJtXGvDX_=U(x zvH_AVL5mu4X>*blUVbLzmr6`zHqXPSuEf4DI^!y!UvC|{ zH#^{Yq#wS2Lap5gD*r-fhbLhLEM`9`zs>)rmYnZv9(GdN|OZE?S~aog@a646#ImE3LCWKabqHw# z^sFTt`F-&_xdscVOFCedw}>O`=$rim&q1|-%XQ>uu>rc+104NEroy(9NSs&@8zP&n@Vm9h5ooXt@OJ=fR97Hp4)nMlIqXYBAQL+m zUgrXy`=iJ^=yIXxg5FFIJ_?wdGa(*HD!f#9!WH5R`eaPwNf(Ez1i;p8Y z!Pz8e?!iNjgWmc8i$!1q(}BzUq=wjv&e_>wKkR4$bdU=; zs|$pj6K~09_`LIEI5N=Z$W4(Am|F+>^MaaNVka!T7NBPbdZu3DE`fM_Fyf1Lp!_AYp#u-)puK0Hq86^W{bil;iTt3Z1oV4M zgrnZx05a-JW?@}x16lV##=j+wyn!!R1&*?UkD!dYkVH`owq6OSI4cTaT{#22T*F6) zr#uh2gus%r19uXxq~twj)zIHm3wfVqm?Ie;?J_*>VO)~{Iot-Op8-*gFlPelC&%IW zUWlinG*-R$u$V&765)w%As;mtT=W+U zv2K(B^#Yz-7enE7mXpbla~U!LGTw!eN`b;T&_y;x7&##i1GXrU-+_sb&}LWo`44!H zp%ICM*BbJ~#@czJktXpS*K#EZdLP}0}>jESde!V7e zTma|{$4CyWVDE6G3FdUezU~F>8W`ONpKua*t_pi<1PxWiug^d;!79-WHZl{DO9ZSh z707x6Jrx1Uj)Rg|oQr~d*9#eX>?f8$F1J9>2Utr4M%0BHbXJAT(?lHJCb*3L^;TpC z>>$W}cHnX>Y8E{p>xo#OpNL0TkLP23_Tb%*W3bo~km@(!SBGD12(IS9pX>mVoMakw zy#;H&3hA82`dJn^xFX0K%8+CevKew11#kZhIL;28w}eeih*d4zp=Q=vC%VI`rV20-Nz+-ZPc9UgQt z_}hhiTOq`q?;(v|ScMlNHoFL~5Jr|jCuL!8E=07u#0k)R6>+Wyl(&WcyF&tr&}||{ zqR`t@jPnWF$xa@_>*a@4Hz#X_9arrX?V&dT>at_zQCRmFXgdNfU7&vyuo8?d)*&XV zfi;uCI;X;m2w3AjT=OIBVh=2jzfk65PhXBNT=f-@+2AKpQsjz5&sP!1YhzyH>zE>+pn)VZS*c(SW!D zN?#!s3xS6T1xHTI`WX7lg9uB9cd~)zj)-61AVxd`lof)Gc45T4@C$um8y2ux3BIEU z?t6nZ{|Z*XqPUYl9v?*xAb{X1FML)(Nb)zV7iS>V1jHZbfS0_$RbxZ~3_6G+!K!dH zBC$ziC^TCXk|p?Pu<`boAvfrK4SF8nTsY_q#%EFR1yz9cq8K9wxDLbjCCKR_>em!w zeFoJ*Nk4+U1=q1USWn&qpCQ2cRp9Iu=+1(%D?sWoh(<2KDy|?S?*YYiFcSqQF*x%a zW4?v_vXQ&ck_4$<1kFVu^BVATcF>Uqf0GIeyn*YJA(bD2cRS`+5l!vDdgCI)kSg2#Ig>3f0R zcu*rlPX)0?Rf6tI!V~zh;s^a-IF5Y4dXxyA7KF6iKw32*GN?@%bUJbE2l$P5K%y7O zv;j#f#)-meBV$fKY(NGoJ-B8+p5U_KcMb5~2zNX{G=fSuIQS}p0Yy9epqxO zD9(cWgDb*wSWi%r!5Agzvn z;KG7$4I=#$B>Eb&J%vsZ;U7L?uKV~Ed}Gi9Ob7D{PRNo#UOMOszRMVV@6ihm!!WK4 zx*5E51f-mT>-iUof^Ri?Ag4sg)CVquE7?o@W*8^)l)?4WJ-!HU1z}}7jf|Brp?%+xiM3D=$aEz;g%RG><0zEi@=ZG&l z%mR6Y00}X$#~?Ss_c{Hb@HsdNYBUY=q=MSu=RHRK09glR?gqUQ#x*f=IM%5M&>92E z^I{*0nPP$e2uFy!5wyHd;(r0NP%O0o diff --git a/libs/unimrcp/data/one-16kHz.pcm b/libs/unimrcp/data/one-16kHz.pcm deleted file mode 100644 index 44e0b3431a17b81373af5eb6fc6df6ff7528b58a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 64508 zcmeFacbpVO^FKau!{wZh93_Jws0c`qEJ+a+B#Hq^5>!A0L=cgvfMh{HG9n0wARvMf z1eKfwm2lkMrpf8oZ9Vmy-NWab{{GCpcDlRjUGJ){o}HcP=>dj;jr~vQ7AT>m<1h@g zX$?2_KQe67(jgmSp>&*RCgcJcY7psKx}4zA_2t@tKSa6+DuEWp0#RXX|BV5euq=zC z_BQ!|9!uIIibOQ{ME^Fipm@|`NhK7CEM-e-1A4kgevlv^_6M=l0yZk48+ePhMwzSq z2l)Scpe=XAC>kTi5-kCR(SaS^m)*dQ#)S;j24gLYMjawh@7l-quxx)2M}0wT=oOf# z9!3P(poKlvp+C2zQa1}!PFpZ~&;o39ClA!DxmUOU%sSzgG*zgbXrs>P4%4bcBPf3eK8 z#$L<7UULK|Htzd9;13U(}TK zh<${y!v0f~TX$<{t)YOgDvg>4P2CmvH&)=MR9;aElB7d zB(WZViE6Rt#)n8M0j;Y83%aLUG}3MTuXGp-S^~Cg|6DDOeRKrTb=Q*GK*Uf|W;}w> z%YQ3rFR6XBU)rL7loLh+auJJ()&bIu!i@uKvE%Mu>tI~22k_|HQ3PnwqicgGl$1q) zE!aaZ-9Dg4$SKI7j#j|xT2S`b4f8~~sE&SI4yc!v#WG;es1(@B`iRD3tjLMJFb+3D zM1VE*g4k$2TE~2YMeI05$3pFa2boYp8K@oAMq8B41>mEl(dgKE^wEbAQv}G%MveW( z$iTvF(a6xR>nFAby#O263uOXpsL{P^hcd`NZGjipGe~HgT0sKP*f zYl?~9fRRd210~vlm8+#Sj0SknE}9kiKoX6<*EdF5mNynjndq_M`T~8~;|2Xf^fXdL zKo+PM^n?;><8H1L$I#W$8Zt*qF)r5@aBd$kZdU@4AS1BSRxBbm2FmZo4-v%nk7`{m z!~>GrMzf<7eFC$KfLgQ-Wk!G0+QmYh`okPV>!=la2R*O?-bK1KH@331SWI*@fCN4G zqY~;HeL@>!L^;?+?*R{Js7EtIXT-Il2-nV)L%;tCf*}6ehEY=n%1_%aTWp^x2gF`B z64wI!+-nDN+*3Sc5GzxhTC)j`A*?dB)C20ShswT+b_1H=V7%mZzq ztviny?F(WlJAP>IMv67mAS-Q0*J&FtRO)8etz-VE9n|S{7#=C;2U(yET;K`3p-(D9 zFCdF;q2IE+(fxor%}-fwL{V$1rQE=e65ypcYKwWq-ndZ$4)=hgE#w2=*aKj5b3pka z7B?b_jgEz~K@4b3CDC=z0z))1I$ElQSkM;yfD|&oQPn@b{;B*YGN{u%jfz^~hB2cI zN|Zt$z$eP6C8BBl-{n+_)_|uhR03D_phJ6?1GA6)1PzUuZpi9dBc3urRCJHMKpbsT z&(Ry`C@V_Q61;%ajSN|-yevPWzz-lOKg@1}546F&fDKxrH`)dyav{#u06*fulI~qD z^aVE9a*-Gj_`vMC9MldzZjEa3i3{eH%3yPG&~MBumAf10pbb$)NA30qb+Neu&R9mu z1<^#?fCq}io`S^naIXdsE(^7!8(LzC{(+rJqw@!C7lSplc1zIEJ=DM#_@j)Nxj^ zpeT&l#X}9*WAV`~7XjSZ1H^!5L{ZjzV*p=>j4mk)wkZd#LmQ$7FI0n(g9XLl7OkTw zi~;1)NYJ4d7`bR(myy4t4UAme{8T^z>lVv#F0M(~3&D5(s4 zhw(uh`a!=NlouJnYcz)|K_qCG}SB~*qy*b`)={le$A;2AYw ziF?3Bd&RMZ5_^TMXfBKzxiB`w((>QE(#WyDZqG3a=oPfUAJicamN4YVx;(3AJoF_3+k}Mo>6{kN#*##{Ge~ZKnv_4Qa5*K ziT=O>e9+?nqNmbmzu*~oaqmWgQGf)wfFqg(^kDDS@k)+n7B|Qd^Z+7>)=>%7Q5p6F z^-v<0n*)k;b!g?{(BAD8mCzP&U@SC3#L_zIDI>_~9&BNpC<TrZ;E`S|0E*GsKgNp!M-+OX*w_vG2vUlRjsts1OXx+}@t}6m zF(L!-x&E*}Zg1T_M(f-><}fQv2^{pqY%wQ>xgyZMhWyV8Uc0C12;wuGPI1f z0gr$LD;x*vlm10BqE~7Ky#jl;PMOdXmVkjhl~EQvpGNC2vS>S(4UyP4XveOu!xJ;m-IOshxL2je%5rZD0OFXI(kA0&U zltJde3uX~Bh!{Y-Ef)t7gT`gT7(n9MQ90VWeFt<|6ylHzEdfXO=o=&y@9L

meF} zxacuLB=j4PU+OU$4UvE>njPf0M{75Jv_J&qg^17t)u4oyP)7;aVT{^ZpP_gj>7sbOyt&k06t_E~ePg&sazi|T#V51q3 z74#4#)KNoazzw|w40=NpmN;f^MxaLb=!4qcySZL53c%48>d-5d;Rl$2A8~Gp79fEb zPz!#jJxYL!?lDHtAd4$UTg1^e_WfR6Gzzmxy|{ke8kOI>p&tBTE?pdYKu(AOtuR~o zt%Ek*!?_R97&)>aKd^&ukRdZ@VzZA3#Gn>^Q8~yk4)haULafL^eM59^9}rEsFpg*$ zj0b9v2@vSt#RGdR%GJ6V!CXLza*PcukPBm_tW*Z<(UuS+`f;scWT=(Pnx2$61&%36WO^$1ayl}1P6a=AXy&%J%77+{AQMbOQ)g^1{AU~DLf zM!78L3neg)RO)I_=Xxot1#UcY0Z08p95fc%0!djG^aUKQ7SIp{WkP){3reXSVqFf< zA_k&>7GCY+5RVxe{ux(U1*2wpm+Vd zZIneHQS^=rBBA#5LtEfAmXXRp0`W%kVqZ`ejf}2itP}@)D1nmlpoB((e9V|FPg<-ia609#}LDPU-l;i zDIe1Z>NE6h`XxQlXkkn;zA`l90dunXlbLG`wsu&o-Q8YkU$x6Q1DqAkFOKfiAU%7B z`GWb2$zz`)z0uhr-0xgZ{sKQ%$Q6%>BRu82$GtE6{Qi~x8gVP)xcJ`jv*S0#e-^(w zenfnQ_?>Ze;uiQX`wD!Wy!|~dh=YV@_zqkhwgQvq#M``;W-wJ1iYr+lTq_9ExWX``Le4BP_$5 zYG#_-jV?x!{*m5W&(zOqYqZJQV6C&(Olzn;qIJ=pB(0g+F73LOLNYjmWHzkVGF~#) z8mEk~k!e0+_BF?w@0(l9@65kU&Z=y6u!dRlt-aP?R<7OEo@Re(%XTB@HRo$bcB(T^ zGxL};Og7ts?awY?zbF0SxHPURSC^|v;_S#h$@SoRaznURx$)dMZVI=W+s~chG_Dap zn%~Zc_%_1F0w)d@e;2!ZzVcM?PW2XfTl;4Ee)J{y8~U63yZMLsU-m!gukTMLnP2RC z)EDs1@+NsFdjjIi;(4K!@F_3weYx-1N7)19c;4#NcaGWv?XWe|YGmCp-!&_mzZxGJ zy^RE8i{4kiUys*+(q@p1)Y4>itvW<~M14T5t@>0$xlbKSB!^X1eOmio%hB8Dll7B& zy3vgsT|11Rk#9a=K5RBIA2b`7lCjL_X=EB_^@+Nr&DXkWiP~}XP4x-2kJ?Y|s}5AB z5++7_NPAQJO>3$z(^dT`H+1bd_hWmIk$8!G z?#Azn?-0Kw?r*>DJL#S1@rxt*&Fl}(DeDL0wDzY`Rh}I2gpURTfpGzUU|;FN(hH?e z22KWA1g{0Z34IY>6PY5-mbWY0)Hk&bdUfLr`QDB+cbmoLC3CYm-JC#j6eeRf%;;mp z8;kUYx=+8M&C$wfr_|l*A~H%(tAo_(>Q?oN>eHHNSleNIn{2&{K;i>W+v@U zdM7zOB_pLM`FgUE{7LeUNxvk%Axd-QU8R9~Q*BJn3<2$TeVb9+ zTx8a;ZdFbPl>ak&dl&86`ecaK+d8s=xw5-Ls(+b4$ zGb;?O*r!rjS#E2=LwSkWAEehv`6FSk|5eW&ZkF?@*+^~yTmSZ zx;v+xC&+K;Q_O8=7&${f?L6viwI%CQtG9L7Y-5%)TNv}Tnp#)Am04m=v35D>!XLgj z6MjwJm_9G3LgBIs%`0!JdZl`!n%!!CSYuT6BUR5+Xr-k4j$*b`Ou1epjmKpP4hAx4C-aB=0%@+=NGy zGgAxGa?(d;oXI$!-aD;JYDsdv#LxX}JROCp>@};6UQ4a5WRmZ1{c!K_xX4ney6jix zsYCROM#%iop38LSp5q@7+KLA}X}+eu1>UOO;a z9XpAeDDLv!iMyEGF{@p{`U(rH46HGwHd}9gy~A}6)%l@TarL8>`VZd^4s^{dF6KL?I((_1p0@p@MeWE&)9nyA3xXgaNOq!D-+Kpy_?!G zL(OQJ@oL8XnO|hgPJ1q;XVRDCi<>K)be=TQlxpEeN?$0FZymh(+RZID8{EELR6npq z+M~;Mp>Q-VEoFY%iy1Yux!jsLm9m;=R84D?{C@mL-g*3s%p=wg?Upn>Yy@8mR4b`@ zcTdr@yF&4@yZ+*bOXc9~@b<_L@)&Kp(T4mk2h7Rjm*c9@O@B(u*2bxc%DW^piE?9k zh@?j}$&kbHM!A}DK{1uS$~3vY+)qxBe~M&BwnVN-{bj!#krI?6>N;(hHj8}Qo0wh9 zZ;juKM~y|=C3Te6Lm!~ev$uL8n@Gsy$h0QT~?n z!SQeM9jx+Np0qi5AkZgdM!u7Gs1wXF+;Y!AZ}FPTD4YB@Kyap;Mtz;ZMV6_&E6{&I)85VPQT6e<-Rk{Xw?@Ma4gGbFSB@{Jm(eR> ztMHLEL@~opM6O9Y)U)PIu803b(sOAiGuCJ4grY{PpKyBk&2P5$S09YVLp@*d@A%*#Ee{vOpvy! z@0ss9eVM9EOJ+G!p6PE7GM_QtFpjZ%<2z&w$gW?mVXgNY|8;+xdf9cy*Irm++u$^vgSuou2Zy@SX9Yx>|ZTc%#@UeOqck z#$_?LT^!}>6j$VXN$kN2_6)s)(n6{v?Uh-rrFout(epvv%7h0JMv(T4HS{MU`-2q%zQAK4P8ngYV^4U9 zhqxcfRnqUC@0c#yyAfY_L*Qg_Zt=*#tVp(+sh1kW6Dy>AkTg85ljjRI*R&(814SjL0;j@VwT;XI&#|~8Njd5B)7mE<5*??C zu|T>~dbTL}?*7t%w8U7(UiaEb;q=6;>lyc@txI|$uC4f(vsFK;ELJWlm9#I7BBv$) zn;??Af(xE>k>LiAqv5tuUcahbm+#kdjhg0jMsu8q zSU)^6GKO4Jh1K#}b$yuef;LzZr7zS!^~Tyo<$JBO`L3k_FSI*hk}!rkOwQuETTCaZB7;uYsN^PGN6>!~ML9oXqY z*fZOA&R^g6xe(8dVP3OlYdzE=?Jq+%TiS=29KM0jjz7y5Ik&8_#vtvgaz8m2^I8|Z zmC>DCNyizb+7h`Jxe84U<_Fl)L!~W3??m2}+Q|=*9QTxqBgeyiLYD%Y18ajL!&aoP z64bso+u8^0$L+D^9&MRaEtDJBTKZ+l3ne+h_0kvGUUF`1Y_)VMF@HHlRwXOb+D)$0 zGPMOtijt{TQGS;+wnJLqf+hLCRh@bNhGrA$4X%8t@M6~dgy-!OjIVtmV z7ghMa5?f_sg}Qm$Qm4mN7b;j^Xaki7TDIAh`&0bIm+N2V`^8h9f887vX%@Iq@?*)A zl1AZSMhot?__5!YR4?(aw-L9~o~Jz+?hrU1bfihzNA?fGrMRyX&m}&SFvXuKPIm6< zOVlj&E0tVpu(f=TBrZ?hnldQmVnUYpMW&yTr+g5Z8tyNx&`#O|c+=C*x6ix5vr3rf zRMBS1t(DqxdL&2cuJ^UqlbH|AS?GAI*VO}&heF*09ZPN&Czd7$H;2B7JgZdJhNvIP z*QKW=HGDAGE%uYITHkUP{0NdxvfRPyIlP3`0x&a5>!Yq`X$;!xOv4l@nXpbF~R-zLub0H$G&3^kl@_WR7J*{Coblg?#6{@u2>W z)<^GdlB;H>9oJl#FaE^Gu@kNL$$fNfW0yWjZ*ITF4d%b$rgJv8!r5kgtu&M;hYtsz z4_%IYENzr}DsO0?tAph?!gWIrhh7c+78n)S8yYK3SN5vS$oNqouLwAE^<5~t;nhbt2Q28 z`@@3YQ-rv^OfSQ)D%M2r+o|b!=PUHAvbVyuf`>ETNZ#hl@$?s8e9K$cQ_VA0=)oOxzOzcL$Lzt)w zk`*oql?&P7LGlgdL$#m&jyXmDQh8I_B+22~p<{t+!Fi!w;bY}x6U;Avi6=|;~E)esXgZ5eR&BV5;6LXTv z53e*fe|c6~`i+!5@hQGP;}*pI8duftP3-S45O{ll`Iz2Dmcu_qI;+RD(dJ?@hkU`_ zV5ZuP)sKwT6KXqSiB)7J+ozZr>=Ngc*}`7nEU-6N8`-Izs@^ouQ{D&s%RC;gpQG3p z%?!P&c2{3&{$~DSf6Lb3kFn453&q}^Lh%#vj3?VW&NGfb$R1;S%tiCGk!O8pjk8aY zYlr^AR`D-!i>H?-D15>nVTZGgoI!RsBTql09#YrHInwXa9J!IaM(Uw#QfDaZ<(H+A zQcC2($U|W#+#`HG6c<*)Q^OH*E|vmILSm$w^rl>_ex|R}7wH3yEyiZ8GMVAKqU}|u zDpj>HI;a1lR#E4X`L96aT%@8rQ0^`Np{SZq|61*%1+{m>wTgw%MfG>{WoLKhuhll! zK3(HUrmG_i&`VngqlSpQ%E*s~S_oOA^ETxWC)q2D^%GMKB^B0*ZWHxP@ zzEG32T<0u5-P6%OCw_gx7rw1RGWR{x&t7D7-8qaY%n5JwuE|aaqjpEPnACp<^ zMcjHP*|}@AvG(a{`f+mgU!5FVCb?6+9PviRORp*+d5W}4+9|&+4V1c(*_9>XiP8~y zlCo4ul&ecwQlXq7ca#swZ)i`LCYg1eVn>)|mS1~W=A@5|Ec6L{)xh1 zUnifMP&57UJgeZ*yri6uldHs^6$^dy;?5*hP7kJMWNFFo#1G&ea|-lqGH2e~AhQy7 zEoX#T-59Q34j&A333X8|onxvAJ-t=MK3poZ&TOThR36j))@&hd z|Kzx--p2l?{4)QClR)lm=h;`7Vy+giu)lGw#mB_@!XNDG{5QPA*AeD%s~yX@-(0GF zt8SEcDm=N8tEa4zE6YWZ=g5p#eQ9&}TKIgVnA~eUD`{jljFX?0nn{z${aDY)&d8V2 zcB!9IUah7d)Nh#EtQ=>nGt4@pdzISK58)4`gOOR0$?7z-ig7|YrgkIua=X-u%FIyJ zNF!~O`nQsi@F(-P^|kf0*~O~pc-ceDDrdN@7_Vy8)OG4wZ4bGE8erA6+gf?%R%5c!-I*?Q z@EV?(aX%z<@plzPp)KcS=5nnBncvTE5f%wqr1lPXm;IGJ#U0}R=5{mN?XmWw#yT}Y zsjKuR^Jat9SJc&V-^iQcmqV+AuLa}6Gb0K)_CHXUsr3}EJV%-<)r-6v)*?gX=JG@G z5%njnvVK8dX-{U>+H=h~(`Pi(R+0J0Xa8asavt#;v6ir$JIY-l z&j9b|e&$~mF7hk+dh8qaUVXQER2fV9@r%~L7-Zxa_4N<5Wc4kzkDhGCTXmg5>^SyM zCYhftCWy6#$=*3}@o|g%ec~GVAN8=Fh&V+U%byk|iXREz@_l%XO=ns-4V}mArdFOc z)jDD9*COPaq@!|MS}VU!?g*3R_3|kBaAZf=AIXf23V$75CjB5^mGhNVibq*4)s)sq zKS@(1pFBc+Kz~DjTkm0}lDqO|`s?JZURisW9NB-9vlwq&(?jYv%3pFwx+p!Z{;1z) zjMO{mC$-ti4XIJ&R;W|pZpjZ}TYHi9d$(s^s?fcBQFdwW=7Q=Ozo$&j^;CQ=w{q5v z{I~KKrv8~!khLtcSJLLh)U4{+gHvy$zLow;Vxiy@xB9AkC0_LMaTmppoeuUJR=V0G z{5`n_dP#aJ!l+%0rrIlVZKZ`KD{m^6zRgKtPT5_UtL#Cix>aP?VrwujJ59JV{1|dy zH<|s0ZA_j|u64RGDNY-wH@k-Y#yMa=<1Dn-nzPJi_G9Gi^ohCN8euYeK2I(@~N^y?XG>R zZP40i$H-H&gX$;hF>)_xE?ZwF*OCn^PYEtXS^_my~d0c zUrXqed@ku|azaWdc}eQhtjBY9WYx}UnOn2qL_yPX&y-6pD9v7%Js_tfJ3D)JcGK)7 z8G7m~DW!=E!I?YcY_ZE8wa-q zDh3kB-Er&SsNllTC*e?JowSX7UlrMs=PP?upHA-K%vZ_$-quF*gz=@`S+A{+)ix^c$S+BQB7?$Q z`1?@hkR2=y`a?^|vyJ(oMxlAZronN+^MUJuVZqD6TA|-UQn*~?r^s5VuRKLgRy=A2 zbr`wATV|9RCB_c3i6xo$Ssm>;_A%>qYoqlvxv$@6t|m`k4;rtTPn*?@+jKcAKTs88v^tpUS38}Zqv&fzL z6Xf^v8}kY4lvQYdW3O^{GEcJ_+nHP&)#TsikMWmzukf6ZAWjgch%>}V;sEhEu~h8q z>E~(h`NK2S`-k^w-%amI&rq?wIGKz|1&=HyiXr|NKEj_SPxvd7yNHTx3PVQPE;9R@ z50PJ+o8(FT8`=VOlai~quA9^4> zD*R}8KAAT*BGsk$B#F#T=gM>CKIGo27CGMFNZOdPAnmz~ zzL`H}?a6(hV02-tatq3DFJGhl)p94xjV?Tt|5M)8-0?ZLvPNfSq`#dqENNCkpSXFx zCf)($Ip$mJIcK&t!pI?aejh52$cv z4a8aG`_YeEz;<9W*c;?|U4T59SVo?D?zie%bIeq8w(+&@*N1D@)O__rB};i#E+x+f zhDhflPm|~BUBgF1@!>7u>)~I*SHma54~DbDd%`b9c17-!8pv1V>#|Rop{yZ)FO%mj zJ@jk(A@U5TlF5*9pKiWx9x;1cW36h|LsmcXB;!kCsL{mOsgKp~=pmia)3v?Y0{v;@ zJ@c5I#5}~Lu$lZd;gY9nT$@BLd2q_+G;&jr-6r>3{@B7Q<dL;VxHAB!va5$q_Zq4k$8t2@Y(wXITVq%cw^ z+&(lhcp=ayP%Ut`^fq~7f420;(o3ZUfk}af$Q`&CE(za=9F*qC!lOU~oY zd0Qc?gpQdj%^Kzp#`8uB`E{A7_s|o_e6B~ks?JcGs6pj~@`18J`9yg_k>pkK1bMQ2 zSiT@9DUFnu$PD7&%J1YCVyUv8oWr)O?X8|T=iwE##ag=F zSXZ>)HA9PNKWcAjg<3M%-_|s3wRT2rOlILnXqiSAtD5sZGnD;+Yb+FcCipz@D-+iy zuS#8*K04FRnw!%u@0%Y%SAIx^rz&JtC?Vt1wBW=16?sE*AIn*s6_?R6wQ{m2 z@kX4_ztDS7oWxIK*E?&iF~)6ek{XovO1#uMQYHLc=(k{#;6`#D`#VrBI4$^Ruu-Tm zR5jE(v?!#7=7uLlno6d$U!G2${e7gqPM%2}Ax~|y?bG%E=L@F^S^4xJS@ZNIH=dXH zX=HtoA~X=Ei?_u_o+)IOUH7OS*>l!2&(pwDOzy4gh{a^(Q4L`@U&@WSUssrhcZj(tgr7{bw?NG+f)PUDhsWo3xf>qy~@~ z@Lckps%yNaAJ;-!yirP?ikx8bxFENguO{~LGI2!-laeQ-degUMbj_-mqvY<&KUFZl z@U?P%%bVr9R=7}pWx0gHBl!pNZsuA!6SF5|=BIB<8J9FO;lsFJeA(VU;xhgVcBeDY z>TLAWij>3h0Wv3Og$u*&LhFO+!S&?3^G@LBfE;KV>=k??xFL97=%>&NVIw>uQbP($ zyX8SjmbyS?wI8&-`XXb7ImQ}fKjt)K{Ny+17j8cPl8_?4C4M0qVka^}k9ya8gJgZw zcixp`4b;ot^4@RA?8a?!Rdz-Y1cmFyDeSlGZ1xLwG;1;&nK#MWKaMFP-=W`}P0n8O zEy{F0vY)dj+V9)P$=~Z_jl@W+l~t2mr`5Bvt|uwC;MT-k*%s&-xtwgx5Jr?)aL2aGgoAH%Uzk*AwRL8d10S&*UIfIH-P*W z%_{gNzh-`=ylpw9S$}7oPurVvF6q~VD{(*i{_to*GT)4S!TG|vV)W22sqZUKlPjO~ zdRBYpct(2aczonqZMJ9% z!-Yg)EuYK3$<^R?vsK9*=r7D3veL2xS%(>MHj)*JY2+GBWX?NNoJ8lkU7M_0+(W*% z^PD=)*Y<4tJ-e5kVehgYw@mY_xyyXT6wI-Ps;|(;lXY!Rk`dWdi zb()qzR=|9$zf6vSk-FE|Weg%``c-5esVP~R`I33j>}1Wcc3PY5-<@vc3hrCJl5j?7 zU)>0L&@hvCYLJjI<-qJ<>vFgL{KV zgWm;r1Um(51$zg-304Tb8)_HkB6}kfrGezhUkl|IGAprB`%qtP%rq-m2dyRcET7FLGs&@9E$f>)GJh?OE&@;d#=N<2fa+5GRWD#7#nZ;a&bFH;Q|h zTh6W|&!as|A=8h1pKg$I+faM8J<$1ytbcsQIY(AruC=Q;dCs@?C-&#|uXaD88RzV= z^XA(OgX|hPt#eQ2r59`|c&gwC8LQ@bcXJQr#^o-_{vq>PdO}*q zl=Dd)6Gz35_V4uiJ+*``+{?^+_C)h2xrTj=tR8wmo+N!7ITvmpz7zU5G&J-^=#$VD z@~4KZkdIuqo(b=Xye-uxeW|W|sq|CpYjI@0sk@P2o+K-wI@sytm~X`VNWNDbSsBao zZTS&o-ryGBMVKK>BiD8tg!#favO@MbAx=2S&*iI;H4sC{ozhaa4!e)6W}f5toYnSc z_D%aiXSkE(w6wpsf>uvkC8Ji~*-h?GZrSfRx#W9Si{Y7v$!g#!>>l=6_A>eP`rgT8 zRuJEFnM%wkXPsTq_L5aw-&%{TC#@@H6?3v-=(EUuXJ1WHhpUCErF^CcN+0<*GLy4d z`b=6TwU$mtrbQM-Zbzy~50X2=F49b?7Fl!GhW6?W$IXJnJ~5cQkI2 zvq_OT%(_Fa%lFxeEjR_vVCTFOPtFM)nD5AOJDRMd4zc67uKZ8JL!MM`6Ytw(jk4)4 zj=!1MDp^XNm9jeZ;q-*em03?_FV5bd{bH8PVj)}|$- zwoQIJQHmcM_pL9*TVHI%zrdbxdf8{qxyA!JIYp9ZukFY+dIEW(upnGFoEB!uFIm%Y z%kcf-N5W&n#bov>NBUA4K(1_ikTd)&vQDJ3UaZeEYM2MjY1VMN9f`XRGlKbzd5x{g zeL~hB?BlPIzs6*Z??y6m!-W0@gMT#$lO^CE}pDpew5wLmdzWj|TPlS!UHeJBr- z>&g$v{pGRp^KxhTVfj&cs62<9G0&3w^A_al{We*@JyHEa6}3THJeim6W9&CXvzHk* z_glm4QoF#p-`VZF#-y=>*$3DFqceTjzu9(V4SWHY%+(^RwG;Vee5&w;@VFQh$B^^Q zInPdS$oFR4H}Q)S*u+VREt6hM-jgDyvgw=BYh*m0F+5{=hClOa#^j7G>A$7Dl>U0g z^BL9Bh19fUGx3ka0ST7>ao=dKEMDbJHj8=3o@7lllMPmXkUXEeAxlzIscU3Qcysvs z@PY7K;W6Q9;d9|Wkp$^DnH5hZ$7?@zCwXeIRGX$BHg1_Wt#|F~c4McbGu5d;R-}JI zR&YPYP33x%vC+wlzQZ14cd_e;{B5=wdCF4A%yh2V{p|zfxmgi=mpt2<%@&dK;~wT= z?kZQA-@t#%Payw%>>WlYJeSzpY;!I|W&p=C$H~>lW&0KKlyN>8?<@9UYlzu_tWUjS zWSbj|>tu!RL+TCF>5dltbi> zy|0$0J+AF0XTO13XZ@)0y!n_}(|Vtr?@Em!Ml16*YX|v8RkmB0^Yst(6UI677cT$k`&e7E?+ z@joSKi8m9=CzeZ?MBXNNCcYiHa?J1#iu)}tD{iAN;5jLZ#(u(1w4bm(Fux<~)^};s$!fh5S|a&H_UP$)b$z_{8M#C0q4zU9WVP-_^MG-N z+$(-gzK7SX9`32~2KHX7t(j*G()W^Cv|{y=`my?gT33Bdc}_k{<`~+_@v5He zi)@ONMBXBI9L4f^a>rGVoZ(g~>16({f&Pkdn*0f7W%DX|ub{ov!!a3$EoLU$L(DtI zH`c4nliau5Qm!I5i*5POYTcjh)=UBC<8QLP$&A`();Q}=vYK|ZwbIJ7e8RGlIyGPt4HuI)= z9q}f4R!~uFB6!HJ`}4whGIPAfv)=PF$^1v2BF`ajf8Q?eCNh)Ri`<1y6Pk&Sh~3HA z>ZrI+94AZ?u85NNqJLK09sd{pC*!uo$#J=HeSGbF&&G9)uN(KG?_1A%;x=);=ZdE~ znRTl!-Y;GfzUJ3+3&?lBJDD|_B|I(|Tn3qCFr7~JQtJ=$tNfDvv>hV9%Fmk(&H3gU z>xSKz+%GM(GwpaQ&YWRhmtjPpQ=67o=UphhCCx{ zCz0=md`YfA?sDgn=VcOU#gR8o^0YK^##^p;(QlDw>t6EaK_fGVyu~ridWl@+A2ZjP zr_EQbCv2NsWA-3-)e*ZL`Ifv-elcq~j5F4@$lR?&)>`wP4RW8pfEnS`bow|~oSV!I^6tRXYy)y+)nhBLFR~JQl$*hS#Ha8r zxOr?m`!~~t+|~5u`f^#MeU}-|++YlLEcYlm4qEd|xeDwkW<9fjz0Q3`th$ja-i*MsZbS0G$h>+>Evm%K-|(OK&BU?#FGx0v0^ zoFdl;o2(|*VyhAPHQ8=Yw{KZtGDf!Xpt+vBS#-es)x2&_A$PN%84{U2>uG4@7w|8# znvASS(cja{8w-rx#(BdwDx1y8oaZ~{&t_$7qV<)v!FtyEp1e7dPp;33%onYzWPb5A z`=Gtc9%qlYf405kckimbh^!_!Z`HS^kYAW(Yz{QCjs0#nG2B5&fPaMQRrGT%tn<#0LNB=%Qw zhMT}FWj4wCnL zHgPk#^<0Rnz!&n{xO!yNGub1|CNgL661ndgPTod)kf}iaByw;19hp6-#FUWV(p98& zg$VV@+Q$z)Z<8gh?Yo}AxG$lD8_k!x{s{;(ghpCy_(_5yMpIMi8B?y|O$_vccG zca3;l>CATCB3Bb*omWV%pCf;LNOl*I4E#y{t;JMwH~ks8Ci$5BEhLyePA}&vGH2M( z$#5((%bMnlCR`CRTeXhdADklh-M=~4h~$E^pKwed*Q4(^TSz`>e{VZ+Og6c8;TeIv zvDcBALwflNdHb#olgyMl#g4!{O2%sgvx|(`2xcs^j`^9n!W5AeC~0hYa({oEnMlwz z$Td(;q8&~0Q-vJQIZO}cW9AxDk6br?z<$WiW0$Zq*|F^F>>?tm#{R&}Cda{0rVq*B z5W=v6%nD513f z@e=8EE%K`5Y2xK0!rj|x0G`@8?re`UX9=s21v2!u$0u zf?7}};H52hLl$a-c7O&9jRSOaj~>tpeLx%RT^%w&`QPNg8f{CF_yIY@hOq#j8x6K8 z7V%W;)-eK%0ZPoSo6lGeXis|$+-OJnkPEqKegRchi%8(ZR#^u0hSt!A>{FS`?e+~Z zR8KdE6m0GtE5O9=X*B2q|3#B~GY8DkmeF=pPHoUHprN0x6#EU9(Oh7U@y2Rgdshxj zW&dvgGG+5mju01}PpDH5;N8ueYlHE{+EG2#pif|@7{pTv)~Wp8BBmIW0~#%`L6Za&c$dU3I?5A+r734MV*vcw|pZ6OZ4K#LxWbfaF74ROGLkzl_m z4lJl1Ywk#(1hg0_@FO#pt_NCkrQiYL1Pn$8EteIwASvs+tQAF5R_v486L zmTr{P8!&+k_P_*3B-nsQz)}e^xY41+#nT!c8I+(k`T#lZQ5zjGMaJ@?KQ}hOU^b8i ztXx~LbKB8gXavAQQBcFEpmfL5WpHbhi?+}=Wy88#1HBtJMF9s|Lrh>v_n@UH%pqEU z2V{tjgv$PXi0Yu4_?tXMn|u*vjT$tu-l&dlR0HX_4Pu}SU<3c=J+(m&EP)4F5OFjQ$^qqifg0Vr zIg0MDYX?Z$zLy<6MQeZ)HBeF+Wxx;Q9oyI^*QeWWz{IlAmKznGd8rhbFn2D-?IT6e z4SfB3?=f0HMz^qz)@~f&E84>S&VUqc;QNS7REPZsoEuxLoaPw4P>ox6Er2argPb%{ zkfRngv2EIdNa;RS2a;GBvOpQDi*30`%mkI77aE=0t7uPvcDb-0XbrqniWn&2D4<$b zL;WEiqCw)eVtIib_J9F$L_g8KP);=%Nwhw?PO+}F z%T^WxZI=)1qW3gBm5mY4zLXQ0s0Ff9d2D3J=Stlg)wy`Axq9${4AEHhM`J)d%G_w& z8srC8%IYv_ZP=m%vkE23$M+^CJ#LFO@X$h51Ejm?!K6Z(yf16x>9G{k`X zFqRk>Wx+9wwn00p2RR_oJ1wa^nkQD~9v2uX)kB}5hAoIJ8Wrmm(IAcXO6#s4#JMH* z88L`=qjtSwmcZJz#5QwB3j0Bpe7axEsPd8EKGfow1f{?TJiv+Ba}gjxJ}AKl#r#_>+BUi#J;rDUULgmunM4FI(4I&4 z7c+tUfTj$z7Hf+bNA`%l|+gQE&KXdNPiJ!TRx$Or#}3L=0R?I;g2QUs!~4nDz~8x#1U{Q^CDLL8K+ zjg`7B^aZ_gZKympK190X>!K+VEFfzb8Ts~ULx_kN*ocU)-?kj;(N&8Dl3 zMny{@m&lALY*Vf4jY_E(*ArzzHdh*Ljasw<`{FIq+%+j#h*TayZ!=~hj%Vw;^bC<#Ro{b2wyV79n9MS@1N;;RlwDSFqqUyz^ zBr31mMP6+xCi!B=xn5P5lZpz>#PokGWj|ao=$gRl_Gy-Os*3x0cWB4oNz`v=bE)FK zSXD7^`pZt`qD|HlwPW^h?dxhacLbr1K4zeoo{Br;B?TqkGcidDuU;vyuHL9{!P7I% zpYqRbXRd0Uo()yiRH*-sO9uAa`})%tC69Xwb<}vZ#83;(*bc(JC|B&JWd5!}{dU=E zqslm?VDGxu&Dkt5N~td@Ds3zg%5P7_>+Jl?n6nz|+hKh%x#(xo`Y$rQWdqmVO4j;5 zwY`t;vjICEx?a@EFo(K3nd?8sm@sl^hPIyRS#hs%P2j5ZW9b`zGMmEpVey2199`w{n#gR@k zaH7&=T{j*G``m}jmrB>PQ=tR0i*=|*F?P6f>C?=0+0gm{{gX^oH9NcCBXeNw38S9qyHn=VY<(sl-nb5@Ua8OwHS z-?`eVY#u8868s)tul3sj6;;se6Rynpr`9=yQ-wQ-sqFdC+l3=nl{>d)uM<^M_hrz{ zbxzc()VD%4NByW%xr!xXq*wo9(yte%x@)>!u~Q78Lfz1et6iP#z(1vv!SC`q!N#<7 zyc$dCj8kAXOo*=*nw?xdSt{)8LH3msG6%iB)$Le!(WY08`|C!9i)X*|qOJ-UU72ys zee?FPBx>FaWsj8$oIBUU3jE*QpBO($=#pnU*i0R<)4y1ImoXf!{$m1D)c=c9Elm4d z4zkvD^v^J={my2>?%~QEp1ST-LfPFO!Zf<0ua>D*LrJwXLo?p@rX;dM<4|XNFX_%T zd~P>`j$)fT!W#3Pt1!GdaF(&Xr*f4p&+ip6&Az^~?U8j#jd0{w0d+adRTkm7sa56b zT1#`Ps<5sHYtJCpy(4&Z#ha5j?*60N@G$!5__L9JPnp`1$OA8n4p$skR=CgecGRn@ z8msmWYu8p~(c4_$mg4QGXYHG?^PAJu=bc^^(fL^=cNxg)-;x*x4xd%vRb}R!yH~kc zS%vHO8CAkM-c|c76?i%B7_4i(=Ha^2z8Quz&w9CB%@i1~Q+3oznR1F>j(+YBEj40O z?~{_)R*aX;nxAG>$9&6W+9|&2Q$oXQeL0s&&t2&sr}1J_-tLyk-kjvCsYmSmT6an? zK%!})GK6@mbf+Jd(G+FN{UVsxx6bOThM#q2``ZI4c{Z}PtMo$A;isLzwZA!;wKT0% z!$%PuH}w5<*UZLk9oi~bDn~{*!6}FcgLjxrxUY#rAQ5DIANG=B?6sc#%3lD z4Og+#aHJ<9MMf@})2tT%2lV5TQ=THH&nygM=^CxT(oHOC`*pk;sBp`+nSC*NTFb30 zrM+*ayfkEdRj8)L=mn~bAsoZlZ3U}y&mn}E-WOJ72Jz;-diPvJF4Ht%;4D*I`qfNQ zm8@KO#cr(&D|mKau6k+Y&6>+@`$Zvqo$J*88`aqUt|GiXe!1yayX8?YfwAxkbp;KzSd2&uK&g!0K-0vuk1f-|i$5eVX&$;n? zKB}o9Ccip&43YDCu=IRuuIw_Oy6CM<7JGFo?iT;vJouo#JEG4urQW7j(^Wg^-=n@5 z9n&(u7#;Fy^r>zY^QN4KxH5n(l|1+AK2s8Pcc{wGrvKgbP4M#R)V&?~X@yxf5XJ`F(TrS7^EWXbvGB6XB8rse6v3jfeRL2($cak1eE>ZTU3rgQF9!?$R zBCobxbw!l;rnFYa94gnzg)z-);csGUxiYKg`(e_Q+V?kK{kV<#?(4eetZJyK(jQuv zWq18n>%yz=d^&em&Or?SJ4YUL>WXLOOoh7bq4OKAnMk;KS8j8ZG++W{-C9NWoFR4;e%s^6K+l=Vvu+`Vp=>OX=1 zc|UaA4wesed1UIrJ=NwZ)9F_S(WQHLVecY5g({sr{_Zo+5{ZPx6%VvEDtDh@RF(tg z;(w%mZn;$1pJ7kk9!NBoM=tmLZx;D*MKB8~Q$6degtGp93tGcUD z_0JNRakDJuPV{u%O3mP)E9nAe$DDj+UOTpe}tui6^_vE5@@ zcNOY4z78z9o`bX3`&})8_3LKEol*D6ZcSqOW_4G+87b3~Q{_!yVtvb?UMohq?Td=K z%)02_Q;bEwq|ReB>gQ?g4Vqdz7r!hzx~3OHjU^1BkM-58dP+m6?Y}dJEw4Qp?l_Ha zqB5xvs;ueV5#;-fW2w!G8Mr=XKt=59=4z~~t~0D$z=7Cv&_|?N>0dW9O+~!A!!dI; zq9=}v%31@QCU;pM{#ZUn!voXz!ua?Kl4EY_?HeDGR@omkD-KSl>HGM7^ za!tKC-OG|$pYE9ki>$T)1Xsk;a3rdRRx zDA9busxs%PGi$ZJSuV?YT2qHRTuQ0ZsfN1iTd8JuO009~>4{}^E2%M7caFxrUS=Jz zYQ(O?_E6l9rutsxuX@*;`_(I^9P4gRsW9H8-!nzyJxBNF?qQ4gV(!`;q)1H{ z&*LIZ!<|c>a~Z$A!l=^SboEpi_nqlPE&RNyQR!=0wjKRc@SLhRrdk!G*{F0P&iV-< zedzZIr%F$Ycggq3MAc*UCQxr@jpT67y{h{3yr^3X@!zpS`=qDB`YKI1FH`$xw{+(y z!v2dE720#9=4=@@^Yl}BM;%MasuLAAm3mcT$|Zr%MqbtHc9m80>{9F`mq8EjcG2aX z87GHouX9fT6rFryeMh}sjW0$W6XaUP#-)v&yNHX^t;*e*9q#;2#g4U|(Vh7g+`mhk zyU!=@QhOd?P*r(3)&)Vm9y8O>;d;4cq?0FeFTHph)L=bjFst~^^mhN&{c5Olab>$T zR9$Zuo57$<#dn&KT-?(UK{X|3_33bx$nQr}e)&_L)0C~H7vfg!b*D3ZsuxS=n^Hvk zRL8{BVmH$71jUL{dCnJ)1D9M`=2(`#T0^Y^erk6Xhdk;tGrOL8jkEPQ)l|zjj$k8W4hnOuLgbW@o~BJ9Ivb+^ae@X8(UD+)l@nL0kRn zvbj5o?Kq8QzkRESXr&h`EBJ_*BOY~qYOLy;+P-P*V8E)Tf5aZ+9z0#@3sAuDPjWW_tD6znEreeX(P7W*5oa(;e=2jxcC{ z+2wFo_0<5Inz&p#Dc3uf9H`r)(jH$mlye_8KUk}>dM}v%eA<3bqCOo|xEwtpt3S=3 ze(H9```x1o2o=)XS~hh)Y3ZTXU)AB@O%*KO_RE_NV@yVwVJ`}W*v(~t($77PWq#FA zUaI#r%$QoN)=QXjNm!f71f{SZdi?zRFCMIysu{j!R>vH4-~E-M1ak6dEQM!wl~or< zw+p8?Sslh#cdX4klTyhjt4gX*)%CkOYMzs4#QOEPneBn$5?cayLtTC-D!YC*{j=|Q z;{W1+6(uWW)XJEODZ}X(W;`?P3P@UEqT?{o8sQYoX2W^IppdIlxvD9 zP`PQhz6g19W8LcFQd%0B;(ae*`Zs}Nc9N~f`OeVS1Bb1`q0r8miKQC;BAxrI87$Eu z@+noLJEwaqoA-uUNfUK`^?X@375K8twbG7Rxo1$Vtf2e9E;U7Mx63zvDeUDG{~hDQ zu9MP#{s-p&*1(n9K9$lhPu^2Qm5&N=zgnr#rIZe1+* z@b&*5mlFOi9M)UinON|{Y=-x~4_i+iPV+jiy4CrcifSMEy zJHJ&xdtL80O^DLwYyD#1r?{+p(tkOp@7G@H7isNQ?tJ{s+P{_dwiCFgGOcj>u`_p< zu46m4J9b{M`Pgw+tW;N9EcgGm{`O?4UDm&qE|a-ynI(%!&h2yP`iyh?*~Sl}zKnL8 z2V=h9Gg<;s;!yTXRlILgu8jFI_GYcBf|#43%0;ShcP9$WaQlA+qPO~0U)5RXxw^`o z$h-O*&0gz-|9ixxPYBa}&+F~7(m@>e66egCx%F4ol`5d(=Ca+Ye7(ksa_u=^ip$ImB=x!7 ztZ-#*gu&JOP)FYN_vbN0?~b01)vmX0bj0XV6?HzXS;Cm(ycefu~(*3RNK9Bn!+`6USWw&h0 zd$0AaZ+&a+ZNsSkDg-J7Dg-J7Dg-J7Dg-J7Dg-J7Dg-J7Dg-J7Dg-J7Dg-J7Dg-J7 zDg-J7Dg-J7Dg-J7Dg-J7Dg^%jAW)WuA&=ej?#k5e?VkVL(|^2QmPNTO<(LDMoJM4~YN7e2Y!{&lx9%ohhie|2a63}7 z+$kR$wmCLC*3ep5omy0z>k-v@wW-y!#^w^AUSegt=;sqGi?{AJ+r&2`+qhVoVIQ-p zcHYH@Q9j9+dAArAi^414lqbf|Akx-&j9E)Cks-LSg4JSG$DZ3!9cvrTUa*%ig1tGf z=5?p;*qvI(>Y6_rFR-Iqj6i9mEeW+H?k2;dc%7}?O^7|byA82tsmJb4u~_bt5z4i` zXQ>9*+AW;&N8{Xb>dBsW=-pB$>aJ?5dyKp4ws-8cl4ekESxz}q@g`fP*Zx&{>F>r> zdhM>W%}h;;r^dqU)gpUdpEvM;C?v!oX(oH~`gv_+403nlU;CHo7ynE8ndc?5TxY9r zlWiroyZDcYH1^|Jcw@16#Vc?Yl>5bta%j!#MEI7vjg1e~SBz72U){mh!=Q0)^^0ud zub6$Ae)d17pZw3Pxb&~%b*NsH9XxgRuW;SaYxOmj z-cu*ZVbsWskhQ?^3l=icPhfHh9_on^*dTb|wY($jJM<2`X4DAmp_LlrqMZ}XHCA5x z44$zdTgSxI6)sAYS1A#~3%q7r`C#m-ZoVi2viqs=s{FNVmHlD>Uj^xIo)k{qI|R>D z>4ThD8}43T z`PVM-@00_ruAQ29q`tz!?=HSmUnQ-!$#<^ZZBPfZ+hqLV+;+Dy-ev3aa%n8k9#ADK z`$f+R$Zp5(noHF1%xKk;WKN_}?dw+FsM$rkCj_cas|A*WT1x zl1UP?R?XXom(8vTLaZ}3iSvoNoiryo-}szfwaS1R5j6(6f5q!h{!08B2|t#+;*M0% z!d})CZ4y+m(1)oZDi9lEGb3L9mAeJ6huGLr-+0FvQFhm@nlMy-_TSS_BZWR55!HfuKl|7CaG2am4i@BzyY?V?%+y`0i32k|x>XUi=MS-ipz) zxlIm#tsbh|a~mX9znAlRuou{|p!vyNcWTML*Blu{AM}SNIdc$^?cv(pp4UMB$ZIZh ze7u^e$POA#eZnm1Rk-%b_hnRI8|sTSS1}q62dEi7SsiPI^)F-b2))yp3HC9}h_`SH zKEly^@bf>_L+_CFFBcZE|3*3LcFUT9d|-PAQRA_ZF6}@4Wv5JfQQMgp*f*j3#iy#lU1md*($Q< zR6`<#wuIUfuZdTv+y$y0*nDR6=$YoVv2|v&^H4eEQzN2h%Bb@p^-=5uC&?U?(uK*s zaN-NLuUz~JRScdP*%iX!m`6qx$Tl&&6%VqtIzdMtt8cvh1^9ahWd7IcuD2i9V+-_} zj!h)sRlNR*+7Q@-0xZz6Q^TUmjY7xEF z%#cbg)zIChWD#i5CB$$M+eN)lCa$mHDwRFkx{`q~IiqXAQdGu;IVt)cuhlUYf2aPE z9G+XD>9tU+Q))fcJ0ZSKoi(s9UcV}PtVd^to~Yuv;gr%VPU#hb#=NG`T9@kc)R>ys zh%Z6?-1>le5AxR~cWLjsreqQppnLu*1V^#Om%1-QET^7u2fnzQkP&ZVD%Z}^5Y_OB zOi-%(cM##Z^P}#K+E>$^@$-J zWRKonx+i!~hc!pRq|bj_(p%StM8c=v?bUkL>vEaL*bQc4uUI76L><5bsjJdGYzO%T z`o}BL4Pgl#W~lVt=ze;Y9Khwr=6I?dZ;yRlBeu#24ro!h^QzLU8Gk|h`>1<7k!)8o*PT_F4G!}l{>Vt zcXyrYPB=!ZUzY8B_nx5SO1|p)>S9Z__7334x9UDsYF{0r7{^{Svb{sDPJ+6t;w?R% z>26c>EvBBJfOyf)iF+L+@k!X9?6s_RF`*}TW{h&s#536$xN2xRjfDC(WT(}towK(X zT7B|hXpYGOu!N^rCpDK|lPuNs1XiwG*wQN#bR4_kjE{1=!Z4}PD<3^qg;uyz@0KT> zLR;NUj^?b!^@-PfQNAc0aE3EfTK~Gso+%^GU31R6kBwQbdvA6#p|-74dtYXom=4N? zHSQ+f^z%n3QLDx*%63B1}-5ZlZfz$1+BHqcU?6m&H?H*ZzQrqkiF0y?HT(ZJx-FN zggs4QPt8u5Z8OO&y(=K2*ntsGv@X_s$WWVE?v>xOOKoB6*c{WjM|MD_MC?q1M#O*S z+LQlt7}YkvXD2e#eq_?cNkx*q2E!MXr*04(V&YeLvxQAw*5~2HCwbh+O`u9D@9@B%maB}B`_@Gyj-j@u|R$#LosY%{vk252K zdY0_x=e59=F(=cpy@4*-;!#vIq&s|$BYx04mmQQR}^o;e`JNO2s%@4 zB9al47#4+Cy;NP|vBaZxE^K3vH%rwkQ~C~PcOD>_{s2E7vg4Atw3Y0d_UCj6zZf%> z32st3cf1mA-LQ+5&=e5UQAUwuKX?-jiO8I5;-PcARU4xUL-QBoHJ!^l&P`sGW6+h} zB7^%GnUPUxLvkb53XoCtQ7r(@_5P$GS zM=8b!?nbX;i5FQU)pKd|EXVfPC+kSvB|f`65c^jDm+lY~aKWG3^>RAKw=DG2c_UOc5hhBQ+Z;TGUMJP2nE_*Mn zzs!gJ;sL(+nt?HOD8BJ47EdKY__WizrD}tUaAgdp0edDaZ=rH>?jT<66i&_{I6+C8 z^ZMB8l<-1Fir8p>#IJv8DcGq2I{KlchU#qEaZi{R!9A(=3(hQ8-7qtGwNpF%`)7r4H*}L~!uiySSWWS4isnT(qr)D9 z9gvwC@9EQ3aZxVtL7^#gwElad_SERpYktJ%n2s}{%5)1DseNNreDJlhqqw@8mrTxN z2uIMoC2J4CN=|E=oI$wefcilulL1K+-;Q+Dq^{m&+|m7xj#<#?)t<3~$hM%Qy%WFw zZPemD9O^^X(rwOP?7N)Z-L> z2KY6^uThTTYL@L{_V4kMn8m~lk5QFSEBq{1M8C-?_l(ua8mfDbGiTx^nuUMVs~s;n z%cCng@#Oz;(js>IPQ$S$oXC&^8&|6$@snzgZp8Q&!uWO`an5}~wHly!W5$qf$7j9w zWYKeKnB>^ffSE+m#sbdU%qG?94}3)9VWPxJq9oSig;rXS;}y7yLQ+RyA5jfeR4mAR z$%76N8|1V6Io|z1{AGV4r#`v zba;3oe50~Y7=vP9zAY!p)BC0_CxPc&ffC;AGHif$$O%Q49_cxKnP{){NjlT9R{Y%k z>Jibi2ESAMY&l09&RE=lw`YFGLosp$8#u+E;Z^+}O@q76**(Q4he8kFg ztHS_!o?F^O!DWQj{A7G@JmR;okNi&bhE?A2{U4e6M?Q;DfbW?zV0}4N6%7|#$Kc#$ z42j z?|n~<5!X-gNq)zZdjClO*4N~7Iten{hl`vEo6mXw3Ev#?{5vbYXV%xO_LB7j))ZTQ zXZ|z1_<=c3xJ&SS$2~nhmpgvt`VBar@#zPUJ7dlhRup@FX2lPD`hwX!hWPbHe?w3b z%*56VeB%keyl4J5Sn`{`Gtib?FvmMqIc4@=KzGEWiLdg&>FTdSphBQRphBQR zphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQR zphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQRphBQR XphBQRphBQRphBQRphDpP00RF5%|jb; diff --git a/libs/unimrcp/data/result-verification.xml b/libs/unimrcp/data/result-verification.xml deleted file mode 100644 index 8ab8a32fb6..0000000000 --- a/libs/unimrcp/data/result-verification.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - 500 - cellular-phone - male - accepted - 0.85 - - - 1500 - cellular-phone - male - accepted - 0.75 - - - - \ No newline at end of file diff --git a/libs/unimrcp/data/result.xml b/libs/unimrcp/data/result.xml deleted file mode 100644 index 74a1171e3c..0000000000 --- a/libs/unimrcp/data/result.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - one - one - - \ No newline at end of file diff --git a/libs/unimrcp/data/speak.txt b/libs/unimrcp/data/speak.txt deleted file mode 100644 index 894d43a75f..0000000000 --- a/libs/unimrcp/data/speak.txt +++ /dev/null @@ -1 +0,0 @@ -Welcome to Uni MRCP. \ No newline at end of file diff --git a/libs/unimrcp/data/speak.xml b/libs/unimrcp/data/speak.xml deleted file mode 100644 index 2a49ff048c..0000000000 --- a/libs/unimrcp/data/speak.xml +++ /dev/null @@ -1,6 +0,0 @@ - - -

- Welcome to Uni MRCP. -

-
\ No newline at end of file diff --git a/libs/unimrcp/docs/doxygen.conf.in b/libs/unimrcp/docs/doxygen.conf.in deleted file mode 100644 index b405be48f0..0000000000 --- a/libs/unimrcp/docs/doxygen.conf.in +++ /dev/null @@ -1,34 +0,0 @@ -PROJECT_NAME="UniMRCP" -PROJECT_NUMBER = @VERSION@ - -INPUT=. docs/mainpage.docs -QUIET=YES -RECURSIVE=YES -FILE_PATTERNS=*.h - -OUTPUT_DIRECTORY=docs/dox - -MACRO_EXPANSION=YES -EXPAND_ONLY_PREDEF=YES - -PREDEFINED="APT_DECLARE(x)=x" \ - "MPF_DECLARE(x)=x" \ - "MRCP_DECLARE(x)=x" \ - "RTSP_DECLARE(x)=x" - -OPTIMIZE_OUTPUT_FOR_C=YES -STRIP_CODE_COMMENTS=NO - -FULL_PATH_NAMES=NO -CASE_SENSE_NAMES=NO - -EXCLUDE=platforms/umc platforms/libasr-client platforms/asr-client -EXCLUDE_PATTERNS="*/acconfig.h" \ - "*/test/*" \ - "*/arch/*" - -GENERATE_HTML=YES -GENERATE_LATEX=NO -GENERATE_RTF=NO -GENERATE_MAN=NO -GENERATE_XML=NO diff --git a/libs/unimrcp/docs/mainpage.docs b/libs/unimrcp/docs/mainpage.docs deleted file mode 100644 index 7081702f57..0000000000 --- a/libs/unimrcp/docs/mainpage.docs +++ /dev/null @@ -1,71 +0,0 @@ -/** -@mainpage UniMRCP API Reference - -
-@section Introduction - -UniMRCP is an open source project compliant with the IETF RFC6787 (MRCPv2) and RFC4463 (MRCPv1) specifications. -The project encapsulates SIP, RTSP, SDP, MRCPv2, and RTP/RTCP stacks and provides integrators with a protocol version consistent interface. - -- Compliance: MRCPv1, MRCPv2 (client and server) -- Resources: Synthesizer (TTS), Recognizer (ASR), Verifier (SVI), Recorder -- License: Apache 2.0 -- OS: Cross-platform (Windows, Linux, ...) -- Language: C, C++ -
-
-@section _ Source Tree Structure - -
-@subsection Libraries - -- apr-toolkit - Set of utilities built on top of the APR and APR-util libraries (task abstraction, logging, etc). -- mpf - Media processing framework. -- mrcp - Implementation of MRCP basics (message, parser, resources). -- mrcpv2-transport - Implementation of the MRCPv2 transport layer. -- mrcp-signaling - Abstract MRCP signaling (session management) interface. -- mrcp-engine - Abstract resource engine interface. -- mrcp-client - Implementation of an MRCP client stack based on the abstract signaling interface. -- mrcp-server - Implementation of an MRCP server stack based on the abstract signaling and engine interfaces. -- uni-rtsp - Implementation of a minimal RTSP stack required for MRCPv1. - -
-@subsection Modules - -- mrcp-sofiasip - Implementation of the abstract signaling interface using the SofiaSIP library. -- mrcp-unirtsp - Implementation of the abstract signaling interface using the UniRTSP library. - -
-@subsection Plugins - -- demo-synth - Implementation of a TTS plugin which simulates synthesis. -- demo-recog - Implementation of an ASR plugin which simulates recognition. -- demo-verif - Implementation of an SVI plugin which simulates speaker verification. -- mrcp-recorder - Implementation of a recorder plugin. - -
-@subsection Platforms - -- libunimrcpclient - The UniMRCP client stack built on top of the underlying mrcp-client library using the mrcp-sofiasip and mrcp-unirtsp modules. -- libunimrcpserver - The UniMRCP server stack based on top of the underlying mrcp-server library using the mrcp-sofiasip and mrcp-unirtsp modules. -- unimrcpclient - Sample C application based on the UniMRCP client stack. -- umc - Sample C++ application based on the UniMRCP client stack. -- unimrcpserver - The UniMRCP server application. - -
-@section Dependencies - -- APR - Apache Portable Runtime Library -- Sofia-SIP - SIP User Agent Library - -
-@section Project Links - -- Website -- Downloads -- Documentation -- Issue Tracker -- Discussion Group -
- -*/ diff --git a/libs/unimrcp/libs/Makefile.am b/libs/unimrcp/libs/Makefile.am deleted file mode 100644 index ce33be3016..0000000000 --- a/libs/unimrcp/libs/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = apr-toolkit mpf mrcp mrcp-signaling mrcpv2-transport mrcp-engine mrcp-server mrcp-client uni-rtsp diff --git a/libs/unimrcp/libs/apr-toolkit/Makefile.am b/libs/unimrcp/libs/apr-toolkit/Makefile.am deleted file mode 100644 index aed07a7fb2..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/Makefile.am +++ /dev/null @@ -1,50 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libaprtoolkit.la - -include_HEADERS = include/apt.h \ - include/apt_obj_list.h \ - include/apt_cyclic_queue.h \ - include/apt_dir_layout.h \ - include/apt_task.h \ - include/apt_task_msg.h \ - include/apt_consumer_task.h \ - include/apt_pollset.h \ - include/apt_poller_task.h \ - include/apt_pool.h \ - include/apt_log.h \ - include/apt_pair.h \ - include/apt_string.h \ - include/apt_string_table.h \ - include/apt_header_field.h \ - include/apt_text_stream.h \ - include/apt_text_message.h \ - include/apt_net.h \ - include/apt_nlsml_doc.h \ - include/apt_multipart_content.h \ - include/apt_timer_queue.h \ - include/apt_test_suite.h - -libaprtoolkit_la_SOURCES = src/apt_obj_list.c \ - src/apt_cyclic_queue.c \ - src/apt_dir_layout.c \ - src/apt_task.c \ - src/apt_task_msg.c \ - src/apt_consumer_task.c \ - src/apt_pollset.c \ - src/apt_poller_task.c \ - src/apt_pool.c \ - src/apt_log.c \ - src/apt_pair.c \ - src/apt_string_table.c \ - src/apt_header_field.c \ - src/apt_text_stream.c \ - src/apt_text_message.c \ - src/apt_net.c \ - src/apt_nlsml_doc.c \ - src/apt_multipart_content.c \ - src/apt_timer_queue.c \ - src/apt_test_suite.c diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj deleted file mode 100644 index 804f4ee41e..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.2017.vcxproj +++ /dev/null @@ -1,167 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - aprtoolkit - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - aprtoolkit - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f057da7f-79e5-4b00-845c-ef446ef055e3} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj deleted file mode 100644 index bb2746e815..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcproj +++ /dev/null @@ -1,417 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj deleted file mode 100644 index 29980e1941..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj +++ /dev/null @@ -1,139 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - aprtoolkit - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters b/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters deleted file mode 100644 index 3a67d6084e..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/aprtoolkit.vcxproj.filters +++ /dev/null @@ -1,143 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4e9335ac-20e8-4284-ad77-20ad9190c94d} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt.h b/libs/unimrcp/libs/apr-toolkit/include/apt.h deleted file mode 100644 index a25a6e28f1..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_H -#define APT_H - -/** - * @file apt.h - * @brief APR Toolkit Definitions - */ - -#include -#include -#include - -#ifdef __cplusplus -/** Begin of extern "C" block */ -#define APT_BEGIN_EXTERN_C extern "C" { -/** End of extern "C" block */ -#define APT_END_EXTERN_C } -#else -/** Begin of extern "C" block */ -#define APT_BEGIN_EXTERN_C -/** End of extern "C" block */ -#define APT_END_EXTERN_C -#endif - -/** Lib export/import defines (win32) */ -#ifdef WIN32 -#ifdef APT_STATIC_LIB -#define APT_DECLARE(type) type __stdcall -#else -#ifdef APT_LIB_EXPORT -#define APT_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define APT_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define APT_DECLARE(type) type -#endif - -/** Boolean value */ -typedef int apt_bool_t; - -#endif /* APT_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h deleted file mode 100644 index 2f33426737..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_consumer_task.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_consumer_task.h 2175 2014-09-12 04:56:09Z achaloyan@gmail.com $ - */ - -#ifndef APT_CONSUMER_TASK_H -#define APT_CONSUMER_TASK_H - -/** - * @file apt_consumer_task.h - * @brief Consumer Task Definition - */ - -#include "apt_task.h" -#include "apt_timer_queue.h" - -APT_BEGIN_EXTERN_C - -/** Opaque consumer task declaration */ -typedef struct apt_consumer_task_t apt_consumer_task_t; - -/** - * Create consumer task. - * @param obj the external object to associate with the task - * @param msg_pool the pool of task messages - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_consumer_task_t*) apt_consumer_task_create( - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool); - -/** - * Get task base. - * @param task the consumer task to get base for - */ -APT_DECLARE(apt_task_t*) apt_consumer_task_base_get(const apt_consumer_task_t *task); - -/** - * Get task vtable. - * @param task the consumer task to get vtable for - */ -APT_DECLARE(apt_task_vtable_t*) apt_consumer_task_vtable_get(const apt_consumer_task_t *task); - -/** - * Get consumer task object. - * @param task the consumer task to get object from - */ -APT_DECLARE(void*) apt_consumer_task_object_get(const apt_consumer_task_t *task); - -/** - * Create timer. - * @param task the consumer task to create timer for - * @param proc the timer callback - * @param obj the object to pass to callback - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_timer_t*) apt_consumer_task_timer_create( - apt_consumer_task_t *task, - apt_timer_proc_f proc, - void *obj, - apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* APT_CONSUMER_TASK_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h b/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h deleted file mode 100644 index bf803e2dde..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_cyclic_queue.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_cyclic_queue.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_CYCLIC_QUEUE_H -#define APT_CYCLIC_QUEUE_H - -/** - * @file apt_cyclic_queue.h - * @brief Cyclic FIFO Queue of Opaque void* Objects - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Default size (number of elements) of cyclic queue */ -#define CYCLIC_QUEUE_DEFAULT_SIZE 100 - -/** Opaque cyclic queue declaration */ -typedef struct apt_cyclic_queue_t apt_cyclic_queue_t; - -/** - * Create cyclic queue. - * @param size the initial size of the queue - * @return the created queue - */ -APT_DECLARE(apt_cyclic_queue_t*) apt_cyclic_queue_create(apr_size_t size); - -/** - * Destroy cyclic queue. - * @param queue the queue to destroy - */ -APT_DECLARE(void) apt_cyclic_queue_destroy(apt_cyclic_queue_t *queue); - -/** - * Push object to the queue. - * @param queue the queue to push object to - * @param obj the object to push - */ -APT_DECLARE(apt_bool_t) apt_cyclic_queue_push(apt_cyclic_queue_t *queue, void *obj); - -/** - * Pop object from the queue. - * @param queue the queue to pop message from - */ -APT_DECLARE(void*) apt_cyclic_queue_pop(apt_cyclic_queue_t *queue); - -/** - * Clear the queue (remove all the elements from the queue). - * @param queue the queue to clear - */ -APT_DECLARE(void) apt_cyclic_queue_clear(apt_cyclic_queue_t *queue); - -/** - * Query whether the queue is empty. - * @param queue the queue to query - * @return TRUE if empty, otherwise FALSE - */ -APT_DECLARE(apt_bool_t) apt_cyclic_queue_is_empty(const apt_cyclic_queue_t *queue); - - -APT_END_EXTERN_C - -#endif /* APT_CYCLIC_QUEUE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h b/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h deleted file mode 100644 index ba2fa16421..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_dir_layout.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_dir_layout.h 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#ifndef APT_DIR_LAYOUT_H -#define APT_DIR_LAYOUT_H - -/** - * @file apt_dir_layout.h - * @brief Directories Layout - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/* - * This define allows user applications to support both the old interface, - * where members of apt_dir_layout_t structure were accessable to the - * application, and the new opaque interface, where OPAQUE_DIR_LAYOUT - * is defined. - */ -#define OPAQUE_DIR_LAYOUT - -/** Directories layout declaration */ -typedef struct apt_dir_layout_t apt_dir_layout_t; - -/** Enumeration of directories the layout is composed of */ -typedef enum { - APT_LAYOUT_CONF_DIR, /**< configuration directory */ - APT_LAYOUT_PLUGIN_DIR, /**< plugin directory */ - APT_LAYOUT_LOG_DIR, /**< log directory */ - APT_LAYOUT_DATA_DIR, /**< data directory */ - APT_LAYOUT_VAR_DIR, /**< var directory */ - - APT_LAYOUT_DIR_COUNT, /**< number of directories in the default layout */ - - APT_LAYOUT_EXT_DIR = APT_LAYOUT_DIR_COUNT -} apt_dir_entry_id; - -/** - * Create the default directories layout based on the specified root directory. - * @param root_dir_path the path to the root directory - * @param pool the memory pool to use - */ -APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool); - -/** - * Create a custom directories layout based on the specified individual directories. - * @param conf_dir_path the path to the config dir - * @param plugin_dir_path the path to the plugin dir - * @param log_dir_path the path to the log dir - * @param var_dir_path the path to the var dir - * @param pool the memory pool to use - */ -APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create( - const char *conf_dir_path, - const char *plugin_dir_path, - const char *log_dir_path, - const char *data_dir_path, - const char *var_dir_path, - apr_pool_t *pool); - -/** - * Create a bare directories layout. - * @param pool the memory pool to use - */ -APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create(apr_pool_t *pool); - -/** - * Create am extended bare directories layout. - * @param count the number of directories in the layout - * @param pool the memory pool to use - */ -APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create_ext(apr_size_t count, apr_pool_t *pool); - -/** - * Load directories layout from the specified configuration file. - * @param dir_layout the directory layout - * @param config_file the path to the configuration file - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_dir_layout_load(apt_dir_layout_t *dir_layout, const char *config_file, apr_pool_t *pool); - -/** - * Load directories layout from the specified configuration file using the provided labels. - * @param dir_layout the directory layout - * @param config_file the path to the configuration file - * @param labels the array of directory labels (configuration entries) - * @param count the number of labels (normally equals the number of directories in the layout) - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_dir_layout_load_ext(apt_dir_layout_t *dir_layout, const char *config_file, const char **labels, apr_size_t count, apr_pool_t *pool); - -/** - * Set the path to the individual directory in the layout. - * @param dir_layout the directory layout - * @param dir_entry_id the directory id (apt_dir_entry_id) - * @param path the directory path - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_dir_layout_path_set(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path, apr_pool_t *pool); - -/** - * Get the path to the individual directory in the layout. - * @param dir_layout the directory layout - * @param dir_entry_id the directory id (apt_dir_entry_id) - */ -APT_DECLARE(const char*) apt_dir_layout_path_get(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id); - -/** - * Compose a file path relative to the specified directory in the layout. - * @param dir_layout the directory layout - * @param dir_entry_id the directory id (apt_dir_entry_id) - * @param file_name the file name to append to the directory path - * @param pool the memory pool to use - */ -APT_DECLARE(char*) apt_dir_layout_path_compose(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *file_name, apr_pool_t *pool); - - -/** - * Compose a file path relative to config dir. - * @param dir_layout the directory layout - * @param file_name the file name - * @param pool the memory pool to use - */ -APT_DECLARE(char*) apt_confdir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool); - -/** - * Compose a file path relative to data dir. - * @param dir_layout the directory layout - * @param file_name the file name - * @param pool the memory pool to use - */ -APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool); - -/** - * Compose a file path relative to var dir. - * @param dir_layout the directory layout - * @param file_name the file name - * @param pool the memory pool to use - */ -APT_DECLARE(char*) apt_vardir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* APT_DIR_LAYOUT_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h b/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h deleted file mode 100644 index b2e7053748..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_header_field.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_header_field.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_HEADER_FIELD_H -#define APT_HEADER_FIELD_H - -/** - * @file apt_header_field.h - * @brief Header Field Declaration (RFC5322) - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - -/** Header field declaration */ -typedef struct apt_header_field_t apt_header_field_t; -/** Header section declaration */ -typedef struct apt_header_section_t apt_header_section_t; - -/** Header field */ -struct apt_header_field_t { - /** Ring entry */ - APR_RING_ENTRY(apt_header_field_t) link; - - /** Name of the header field */ - apt_str_t name; - /** Value of the header field */ - apt_str_t value; - - /** Numeric identifier associated with name */ - apr_size_t id; -}; - -/** - * Header section - * @remark The header section is a collection of header fields. - * The header fields are stored in both a ring and an array. - * The goal is to ensure efficient access and manipulation on the header fields. - */ -struct apt_header_section_t { - /** List of header fields (name-value pairs) */ - APR_RING_HEAD(apt_head_t, apt_header_field_t) ring; - /** Array of pointers to header fields */ - apt_header_field_t **arr; - /** Max number of header fields */ - apr_size_t arr_size; -}; - - -/** - * Allocate an empty header field. - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_alloc(apr_pool_t *pool); - -/** - * Create a header field using given name and value APT strings. - * @param name the name of the header field - * @param value the value of the header field - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create(const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool); - -/** - * Create a header field using given name and value C strings. - * @param name the name of the header field - * @param value the value of the header field - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create_c(const char *name, const char *value, apr_pool_t *pool); - -/** - * Create a header field from entire text line consisting of a name and value pair. - * @param line the text line, which consists of a name and value pair - * @param separator the name and value separator - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create_from_line(const apt_str_t *line, char separator, apr_pool_t *pool); - -/** - * Copy specified header field. - * @param src_header_field the header field to copy - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_header_field_t*) apt_header_field_copy(const apt_header_field_t *src_header_field, apr_pool_t *pool); - -/** - * Initialize header section (collection of header fields). - * @param header the header section to initialize - */ -APT_DECLARE(void) apt_header_section_init(apt_header_section_t *header); - -/** - * Allocate header section to set/get header fields by numeric identifiers. - * @param header the header section to allocate - * @param max_field_count the max number of header fields in the section (protocol dependent) - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_bool_t) apt_header_section_array_alloc(apt_header_section_t *header, apr_size_t max_field_count, apr_pool_t *pool); - -/** - * Add (append) header field to header section. - * @param header the header section to add field to - * @param header_field the header field to add - */ -APT_DECLARE(apt_bool_t) apt_header_section_field_add(apt_header_section_t *header, apt_header_field_t *header_field); - -/** - * Insert header field to header section based on numreic identifier if specified. - * @param header the header section to insert field into - * @param header_field the header field to insert - */ -APT_DECLARE(apt_bool_t) apt_header_section_field_insert(apt_header_section_t *header, apt_header_field_t *header_field); - -/** - * Set header field in the array of header fields using associated numeric identifier. - * @param header the header section to set field for - * @param header_field the header field to set - * @remark Typically, the header field should be already added to the header section using apt_header_section_field_add() - */ -APT_DECLARE(apt_bool_t) apt_header_section_field_set(apt_header_section_t *header, apt_header_field_t *header_field); - -/** - * Remove header field from header section. - * @param header the header section to remove field from - * @param header_field the header field to remove - */ -APT_DECLARE(apt_bool_t) apt_header_section_field_remove(apt_header_section_t *header, apt_header_field_t *header_field); - -/** - * Check whether specified header field is set. - * @param header the header section to use - * @param id the identifier associated with the header_field to check - */ -static APR_INLINE apt_bool_t apt_header_section_field_check(const apt_header_section_t *header, apr_size_t id) -{ - if(id < header->arr_size) { - return header->arr[id] ? TRUE : FALSE; - } - return FALSE; -} - -/** - * Get header field by specified identifier. - * @param header the header section to use - * @param id the identifier associated with the header_field - */ -static APR_INLINE apt_header_field_t* apt_header_section_field_get(const apt_header_section_t *header, apr_size_t id) -{ - if(id < header->arr_size) { - return header->arr[id]; - } - return NULL; -} - -APT_END_EXTERN_C - -#endif /* APT_HEADER_FIELD_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_log.h b/libs/unimrcp/libs/apr-toolkit/include/apt_log.h deleted file mode 100644 index 9e022c3163..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_log.h +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_log.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_LOG_H -#define APT_LOG_H - -/** - * @file apt_log.h - * @brief Basic Logger - */ - -#include -#include -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Default max size of the log file (8Mb) */ -#define MAX_LOG_FILE_SIZE (8 * 1024 * 1024) -/** Default max number of log files used in rotation */ -#define MAX_LOG_FILE_COUNT 100 - -/** File:line mark */ -#define APT_LOG_MARK __FILE__,__LINE__ - -/* - * Definition of common formats used with apt_log(). - * - * Note that the generic %p format can not be used for pointers - * since apr_vformatter doesn't accept it. The format %pp introduced - * by apr_vformatter can not be used either since it breaks compatibility - * with generic printf style loggers. - */ -#if defined(WIN32) && APR_SIZEOF_VOIDP == 8 -/** Format to log pointer values on Win x64 */ -#define APT_PTR_FMT "0x%I64x" -#else -/** Format to log pointer values */ -#define APT_PTR_FMT "0x%lx" -#endif -/** Format to log string identifiers */ -#define APT_SID_FMT "<%s>" -/** Format to log string identifiers and resources */ -#define APT_SIDRES_FMT "<%s@%s>" -/** Format to log pointers and identifiers */ -#define APT_PTRSID_FMT APT_PTR_FMT" " APT_SID_FMT -/** Format to log pointers and identifiers */ -#define APT_NAMESID_FMT "%s " APT_SID_FMT -/** Format to log names, identifiers and resources */ -#define APT_NAMESIDRES_FMT "%s " APT_SIDRES_FMT - -/** Priority of log messages ordered from highest priority to lowest (rfc3164) */ -typedef enum { - APT_PRIO_EMERGENCY, /**< system is unusable */ - APT_PRIO_ALERT, /**< action must be taken immediately */ - APT_PRIO_CRITICAL, /**< critical condition */ - APT_PRIO_ERROR, /**< error condition */ - APT_PRIO_WARNING, /**< warning condition */ - APT_PRIO_NOTICE, /**< normal, but significant condition */ - APT_PRIO_INFO, /**< informational message */ - APT_PRIO_DEBUG, /**< debug-level message */ - - APT_PRIO_COUNT /**< number of priorities */ -} apt_log_priority_e; - -/** Header (format) of log messages */ -typedef enum { - APT_LOG_HEADER_NONE = 0x00, /**< disable optional headers output */ - APT_LOG_HEADER_DATE = 0x01, /**< enable date output */ - APT_LOG_HEADER_TIME = 0x02, /**< enable time output */ - APT_LOG_HEADER_PRIORITY = 0x04, /**< enable priority name output */ - APT_LOG_HEADER_MARK = 0x08, /**< enable file:line mark output */ - APT_LOG_HEADER_THREAD = 0x10, /**< enable thread identifier output */ - - APT_LOG_HEADER_DEFAULT = APT_LOG_HEADER_DATE | APT_LOG_HEADER_TIME | APT_LOG_HEADER_PRIORITY -} apt_log_header_e; - -/** Mode of log output */ -typedef enum { - APT_LOG_OUTPUT_NONE = 0x00, /**< disable logging */ - APT_LOG_OUTPUT_CONSOLE = 0x01, /**< enable console output */ - APT_LOG_OUTPUT_FILE = 0x02 /**< enable log file output */ -} apt_log_output_e; - -/** Masking mode of private data */ -typedef enum { - APT_LOG_MASKING_NONE, /**< log everything as is */ - APT_LOG_MASKING_COMPLETE, /**< mask private data completely */ - APT_LOG_MASKING_ENCRYPTED /**< encrypt private data */ -} apt_log_masking_e; - -/** Opaque logger declaration */ -typedef struct apt_logger_t apt_logger_t; - -/** Prototype of extended log handler function */ -typedef apt_bool_t (*apt_log_ext_handler_f)(const char *file, int line, - const char *obj, apt_log_priority_e priority, - const char *format, va_list arg_ptr); - -/** - * Create the singleton instance of the logger. - * @param mode the log output mode - * @param priority the log priority level - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_log_instance_create(apt_log_output_e mode, apt_log_priority_e priority, apr_pool_t *pool); - -/** - * Create and load the singleton instance of the logger. - * @param config_file the path to configuration file to load settings from - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_log_instance_load(const char *config_file, apr_pool_t *pool); - -/** - * Destroy the singleton instance of the logger. - */ -APT_DECLARE(apt_bool_t) apt_log_instance_destroy(void); - -/** - * Get the singleton instance of the logger. - */ -APT_DECLARE(apt_logger_t*) apt_log_instance_get(void); - -/** - * Set the singleton instance of the logger. - */ -APT_DECLARE(apt_bool_t) apt_log_instance_set(apt_logger_t *logger); - -/** - * Open the log file. - * @param dir_path the path to the log directory - * @param file_name the name of the log file - * @param max_file_size the max size of the log file - * @param max_file_count the max number of files used in log rotation - * @param append whether to append or to truncate (start over) the log file - * @param pool the memory pool to use - */ -APT_DECLARE(apt_bool_t) apt_log_file_open( - const char *dir_path, - const char *file_name, - apr_size_t max_file_size, - apr_size_t max_file_count, - apt_bool_t append, - apr_pool_t *pool); - -/** - * Close the log file. - */ -APT_DECLARE(apt_bool_t) apt_log_file_close(void); - -/** - * Set the logging output mode. - * @param mode the mode to set - */ -APT_DECLARE(apt_bool_t) apt_log_output_mode_set(apt_log_output_e mode); - -/** - * Check the logging output mode to be enabled (set) or not. - * @param mode the mode to check - */ -APT_DECLARE(apt_bool_t) apt_log_output_mode_check(apt_log_output_e mode); - -/** - * Translate the output mode string to bitmask of apt_log_output_e values. - * @param str the string to translate - */ -APT_DECLARE(int) apt_log_output_mode_translate(char *str); - -/** - * Set the logging priority (log level). - * @param priority the priority to set - */ -APT_DECLARE(apt_bool_t) apt_log_priority_set(apt_log_priority_e priority); - -/** - * Translate the priority (log level) string to enum. - * @param str the string to translate - */ -APT_DECLARE(apt_log_priority_e) apt_log_priority_translate(const char *str); - -/** - * Set the header (format) for log messages. - * @param header the header to set (used as bitmask) - */ -APT_DECLARE(apt_bool_t) apt_log_header_set(int header); - -/** - * Translate the header string to bitmask of apt_log_header_e values. - * @param str the string to translate - */ -APT_DECLARE(int) apt_log_header_translate(char *str); - -/** - * Set the masking mode of private data. - * @param masking the masking mode to set - */ -APT_DECLARE(apt_bool_t) apt_log_masking_set(apt_log_masking_e masking); - -/** - * Get the current masking mode of private data. - */ -APT_DECLARE(apt_log_masking_e) apt_log_masking_get(void); - -/** - * Translate the masking mode string to enum. - * @param str the string to translate - */ -APT_DECLARE(apt_log_masking_e) apt_log_masking_translate(const char *str); - -/** - * Mask private data based on the masking mode - * @param data_in the data to mask - * @param length the length of the data to mask on input, the length of the masked data on output - * @param pool the memory pool to use if needed - * @return The masked data. - */ -APT_DECLARE(const char*) apt_log_data_mask(const char *data_in, apr_size_t *length, apr_pool_t *pool); - -/** - * Set the extended external log handler. - * @param handler the handler to pass log events to - * @remark default logger is used to output the logs to stdout and/or log file, - * if external log handler isn't set - */ -APT_DECLARE(apt_bool_t) apt_log_ext_handler_set(apt_log_ext_handler_f handler); - -/** - * Do logging. - * @param file the file name log entry is generated from - * @param line the line number log entry is generated from - * @param priority the priority of the entire log entry - * @param format the format of the entire log entry - */ -APT_DECLARE(apt_bool_t) apt_log(const char *file, int line, apt_log_priority_e priority, const char *format, ...); - -/** - * Do logging (this version uses an object externally associated with the logger). - * @param file the file name log entry is generated from - * @param line the line number log entry is generated from - * @param priority the priority of the entire log entry - * @param obj the associated object - * @param format the format of the entire log entry - */ -APT_DECLARE(apt_bool_t) apt_obj_log(const char *file, int line, apt_log_priority_e priority, void *obj, const char *format, ...); - -/** - * Do logging (this version accepts va_list argument). - * @param file the file name log entry is generated from - * @param line the line number log entry is generated from - * @param priority the priority of the entire log entry - * @param format the format of the entire log entry - * @param arg_ptr the arguments - */ -APT_DECLARE(apt_bool_t) apt_va_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr); - -APT_END_EXTERN_C - -#endif /* APT_LOG_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h b/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h deleted file mode 100644 index dd4c646d83..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_multipart_content.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_multipart_content.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_MULTIPART_CONTENT_H -#define APT_MULTIPART_CONTENT_H - -/** - * @file apt_multipart_content.h - * @brief Multipart Content Routine - */ - -#include "apt_header_field.h" - -APT_BEGIN_EXTERN_C - -/** Opaque multipart content declaration */ -typedef struct apt_multipart_content_t apt_multipart_content_t; - -/** Content part declaration */ -typedef struct apt_content_part_t apt_content_part_t; - -/** Content part */ -struct apt_content_part_t { - /** Header section */ - apt_header_section_t header; - /** Body */ - apt_str_t body; - - /** Pointer to parsed content-type header field */ - apt_str_t *type; - /** Pointer to parsed content-id header field */ - apt_str_t *id; - /** Pointer to parsed content-length header field */ - apt_str_t *length; -}; - -/** - * Create an empty multipart content - * @param max_content_size the max size of the content (body) - * @param boundary the boundary to separate content parts - * @param pool the pool to allocate memory from - * @return an empty multipart content - */ -APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_create(apr_size_t max_content_size, const apt_str_t *boundary, apr_pool_t *pool); - -/** - * Add content part to multipart content - * @param multipart_content the multipart content to add content part to - * @param content_part the content part to add - * @return TRUE on success - */ -APT_DECLARE(apt_bool_t) apt_multipart_content_add(apt_multipart_content_t *multipart_content, const apt_content_part_t *content_part); - -/** - * Add content part to multipart content by specified header fields and body - * @param multipart_content the multipart content to add content part to - * @param content_type the type of content part - * @param content_id the identifier of content part - * @param body the body of content part - * @return TRUE on success - */ -APT_DECLARE(apt_bool_t) apt_multipart_content_add2(apt_multipart_content_t *multipart_content, const apt_str_t *content_type, const apt_str_t *content_id, const apt_str_t *body); - -/** - * Finalize multipart content generation - * @param multipart_content the multipart content to finalize - * @return generated multipart content - */ -APT_DECLARE(apt_str_t*) apt_multipart_content_finalize(apt_multipart_content_t *multipart_content); - - -/** - * Assign body to multipart content to get (parse) each content part from - * @param body the body of multipart content to parse - * @param boundary the boundary to separate content parts - * @param pool the pool to allocate memory from - * @return multipart content with assigned body - */ -APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_assign(const apt_str_t *body, const apt_str_t *boundary, apr_pool_t *pool); - -/** - * Get the next content part - * @param multipart_content the multipart content to get the next content part from - * @param content_part the parsed content part - * @param is_final indicates the final boundary is reached - * @return TRUE on success - */ -APT_DECLARE(apt_bool_t) apt_multipart_content_get(apt_multipart_content_t *multipart_content, apt_content_part_t *content_part, apt_bool_t *is_final); - - -APT_END_EXTERN_C - -#endif /* APT_MULTIPART_CONTENT_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_net.h b/libs/unimrcp/libs/apr-toolkit/include/apt_net.h deleted file mode 100644 index 6527c8fc7d..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_net.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_net.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_NET_H -#define APT_NET_H - -/** - * @file apt_net.h - * @brief Network Utilities - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** - * Get the IP address (in numeric address string format) by hostname. - * @param addr the IP address to return - * @param pool the pool to allocate memory from - */ -apt_bool_t apt_ip_get(char **addr, apr_pool_t *pool); - -/** - * Get the IP address (in numeric address string format) by network interface name. - * @param iface_name the network interface name (eth0, Local Area Connection, etc) - * @param addr the IP address to return - * @param pool the pool to allocate memory from - */ -apt_bool_t apt_ip_get_by_iface(const char *iface_name, char **addr, apr_pool_t *pool); - -/** - * Get current NTP time - * @param sec the seconds of the NTP time to return - * @param frac the fractions of the NTP time to return - */ -void apt_ntp_time_get(apr_uint32_t *sec, apr_uint32_t *frac); - -APT_END_EXTERN_C - -#endif /* APT_NET_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h b/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h deleted file mode 100644 index d6b87c87d9..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_nlsml_doc.h +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_nlsml_doc.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_NLSML_DOC_H -#define APT_NLSML_DOC_H - -/** - * @file apt_nlsml_doc.h - * @brief NLSML Result Handling - * @remark This is an MRCP version independent and vendor consistent implementation - * of the NSLML parser. The interface reflects the NLSML schema defined in - * http://tools.ietf.org/html/rfc6787#section-16.1. - */ - -#include -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/* Forward declarations */ -typedef struct nlsml_result_t nlsml_result_t; -typedef struct nlsml_interpretation_t nlsml_interpretation_t; -typedef struct nlsml_enrollment_result_t nlsml_enrollment_result_t; -typedef struct nlsml_verification_result_t nlsml_verification_result_t; -typedef struct nlsml_instance_t nlsml_instance_t; -typedef struct nlsml_input_t nlsml_input_t; - -/** - * Parse NLSML result - * @param data the data to parse - * @param length the length of the data - * @param pool the memory pool to use - * @return the parsed NLSML result. - */ -APT_DECLARE(nlsml_result_t*) nlsml_result_parse(const char *data, apr_size_t length, apr_pool_t *pool); - -/** - * Trace parsed NLSML result (for debug purposes only) - * @param result the parsed result to output - * @param pool the memory pool to use - */ -APT_DECLARE(void) nlsml_result_trace(const nlsml_result_t *result, apr_pool_t *pool); - -/* - * Accessors of the NLSML element. - * Each element may contain one or more , , - * elements, and an optional attribute. - */ - -/** - * Get first interpretation - * @param result the parsed NLSML result which holds the list of interpretation elements - */ -APT_DECLARE(nlsml_interpretation_t*) nlsml_first_interpretation_get(const nlsml_result_t *result); - -/** - * Get next interpretation - * @param result the parsed NLSML result which holds the list of interpretation elements - * @param interpretation the current interpretation element - */ -APT_DECLARE(nlsml_interpretation_t*) nlsml_next_interpretation_get(const nlsml_result_t *result, const nlsml_interpretation_t *interpretation); - -/** - * Get first enrollment result - * @param result the parsed NLSML result which holds the list of enrollment-result elements - */ -APT_DECLARE(nlsml_enrollment_result_t*) nlsml_first_enrollment_result_get(const nlsml_result_t *result); - -/** - * Get next enrollment result - * @param result the parsed NLSML result which holds the list of enrollment-result elements - * @param enrollment_result the current enrollment-result element - */ -APT_DECLARE(nlsml_enrollment_result_t*) nlsml_next_enrollment_result_get(const nlsml_result_t *result, const nlsml_enrollment_result_t *enrollment_result); - -/** - * Get first verification result - * @param result the parsed NLSML result which holds the list of verification-result elements - */ -APT_DECLARE(nlsml_verification_result_t*) nlsml_first_verification_result_get(const nlsml_result_t *result); - -/** - * Get next verification result - * @param result the parsed NLSML result which holds the list of verification-result elements - * @param verification_result the current verification-result element - */ -APT_DECLARE(nlsml_verification_result_t*) nlsml_next_verification_result_get(const nlsml_result_t *result, const nlsml_verification_result_t *verification_result); - -/** - * Get the grammar attribute of the NLSML result - * @param result the parsed result - */ -APT_DECLARE(const char*) nlsml_result_grammar_get(const nlsml_result_t *result); - -/* - * Accessors of the element. - */ - -/** - * Get first instance - * @param interpretation the parsed interpretation element which holds the list of instance elements - */ -APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_first_instance_get(const nlsml_interpretation_t *interpretation); - -/** - * Get next instance - * @param interpretation the parsed interpretation element which holds the list of instance elements - * @param instance the current instance element - */ -APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_next_instance_get(const nlsml_interpretation_t *interpretation, const nlsml_instance_t *instance); - -/** - * Get input - * @param interpretation the parsed interpretation element which may have 0 or 1 input elements - */ -APT_DECLARE(nlsml_input_t*) nlsml_interpretation_input_get(const nlsml_interpretation_t *interpretation); - -/** - * Get interpretation confidence - * @param interpretation the parsed interpretation element - * @remark the confidence is stored and returned as a float value for both MRCPv2 and MRCPv1 - */ -APT_DECLARE(float) nlsml_interpretation_confidence_get(const nlsml_interpretation_t *interpretation); - -/** - * Get interpretation grammar - * @param interpretation the parsed interpretation element - */ -APT_DECLARE(const char*) nlsml_interpretation_grammar_get(const nlsml_interpretation_t *interpretation); - -/* - * Accessors of the and elements. - */ - -/** - * Get an XML representation of the instance element - * @param instance the parsed instance element - */ -APT_DECLARE(const apr_xml_elem*) nlsml_instance_elem_get(const nlsml_instance_t *instance); - -/** - * Suppress SWI elements (normalize instance) - * @param instance the parsed instance to suppress SWI sub-elements from - */ -APT_DECLARE(apt_bool_t) nlsml_instance_swi_suppress(nlsml_instance_t *instance); - -/** - * Generate a plain text content of the instance element - * @param instance the parsed instance to generate content of - * @param pool the memory pool to use - */ -APT_DECLARE(const char*) nlsml_instance_content_generate(const nlsml_instance_t *instance, apr_pool_t *pool); - -/** - * Get an XML representation of the input element - * @param input the parsed input element - */ -APT_DECLARE(const apr_xml_elem*) nlsml_input_elem_get(const nlsml_input_t *input); - -/** - * Generate a plain text content of the input element - * @param input the parsed input to generate content of - * @param pool the memory pool to use - */ -APT_DECLARE(const char*) nlsml_input_content_generate(const nlsml_input_t *input, apr_pool_t *pool); - -/** - * Get input mode - * @param input the parsed input element - * @remark the input mode is either "speech" or "dtmf" - */ -APT_DECLARE(const char*) nlsml_input_mode_get(const nlsml_input_t *input); - -/** - * Get input confidence - * @param input the parsed input element - * @remark the confidence is stored and returned as a float value for both MRCPv2 and MRCPv1 - */ -APT_DECLARE(float) nlsml_input_confidence_get(const nlsml_input_t *input); - -/** - * Get start of input timestamp - * @param input the parsed input element - */ -APT_DECLARE(const char*) nlsml_input_timestamp_start_get(const nlsml_input_t *input); - -/** - * Get end of input timestamp - * @param input the parsed input element - */ -APT_DECLARE(const char*) nlsml_input_timestamp_end_get(const nlsml_input_t *input); - -APT_END_EXTERN_C - -#endif /* APT_NLSML_DOC_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h b/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h deleted file mode 100644 index 56a88d0d4b..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_obj_list.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_obj_list.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_OBJ_LIST_H -#define APT_OBJ_LIST_H - -/** - * @file apt_obj_list.h - * @brief List of Opaque void* Objects - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - - -/** Opaque list declaration */ -typedef struct apt_obj_list_t apt_obj_list_t; -/** Opaque list element declaration */ -typedef struct apt_list_elem_t apt_list_elem_t; - -/** - * Create list. - * @param pool the pool to allocate list from - * @return the created list - */ -APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool); - -/** - * Destroy list. - * @param list the list to destroy - */ -APT_DECLARE(void) apt_list_destroy(apt_obj_list_t *list); - -/** - * Push object to the list as first in, first out. - * @param list the list to push object to - * @param obj the object to push - * @param pool the pool to allocate list element from - * @return the inserted element - */ -APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool); - -/** - * Pop object from the list as first in, first out. - * @param list the list to pop message from - * @return the popped object (if any) - */ -APT_DECLARE(void*) apt_list_pop_front(apt_obj_list_t *list); - -/** - * Retrieve object of the first element in the list. - * @param list the list to retrieve from - */ -APT_DECLARE(void*) apt_list_head(const apt_obj_list_t *list); - -/** - * Retrieve object of the last element in the list. - * @param list the list to retrieve from - */ -APT_DECLARE(void*) apt_obj_list_tail(const apt_obj_list_t *list); - - -/** - * Retrieve the first element of the list. - * @param list the list to retrieve from - */ -APT_DECLARE(apt_list_elem_t*) apt_list_first_elem_get(const apt_obj_list_t *list); - -/** - * Retrieve the last element of the list. - * @param list the list to retrieve from - */ -APT_DECLARE(apt_list_elem_t*) apt_list_last_elem_get(const apt_obj_list_t *list); - -/** - * Retrieve the next element of the list. - * @param list the list to retrieve from - * @param elem the element to retrieve next element from - */ -APT_DECLARE(apt_list_elem_t*) apt_list_next_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem); - -/** - * Retrieve the prev element of the list. - * @param list the list to retrieve from - * @param elem the element to retrieve prev element from - */ -APT_DECLARE(apt_list_elem_t*) apt_list_prev_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem); - -/** - * Insert element to the list. - * @param list the list to insert element to - * @param elem the element to insert before - * @param obj the object to insert - * @param pool the pool to allocate list element from - * @return the inserted element - */ -APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool); - -/** - * Remove element from the list. - * @param list the list to remove element from - * @param elem the element to remove - * @return the next element (if any) - */ -APT_DECLARE(apt_list_elem_t*) apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem); - -/** - * Query whether the list is empty. - * @param list the list to query - * @return TRUE if empty, otherwise FALSE - */ -APT_DECLARE(apt_bool_t) apt_list_is_empty(const apt_obj_list_t *list); - -/** - * Retrieve the object associated with element. - * @param elem the element to retrieve object from - */ -APT_DECLARE(void*) apt_list_elem_object_get(const apt_list_elem_t *elem); - - -APT_END_EXTERN_C - -#endif /* APT_OBJ_LIST_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h deleted file mode 100644 index 737cff2157..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_pair.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_pair.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_PAIR_H -#define APT_PAIR_H - -/** - * @file apt_pair.h - * @brief Generic Name-Value Pair - */ - -#include -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - -/** Name-value declaration */ -typedef struct apt_pair_t apt_pair_t; - -/** Generic name-value pair definition ("name:value") */ -struct apt_pair_t { - /** The name */ - apt_str_t name; - /** The value */ - apt_str_t value; -}; - -/** Dynamic array of name-value pairs */ -typedef apr_array_header_t apt_pair_arr_t; - -/** Initialize name-value pair */ -static APR_INLINE void apt_pair_init(apt_pair_t *pair) -{ - apt_string_reset(&pair->name); - apt_string_reset(&pair->value); -} - -/** Copy name-value pair */ -static APR_INLINE void apt_pair_copy(apt_pair_t *pair, const apt_pair_t *src_pair, apr_pool_t *pool) -{ - apt_string_copy(&pair->name,&src_pair->name,pool); - apt_string_copy(&pair->value,&src_pair->value,pool); -} - -/** Create array of name-value pairs */ -APT_DECLARE(apt_pair_arr_t*) apt_pair_array_create(apr_size_t initial_size, apr_pool_t *pool); -/** Copy array of name-value pairs */ -APT_DECLARE(apt_pair_arr_t*) apt_pair_array_copy(const apt_pair_arr_t *src, apr_pool_t *pool); -/** Append name-value pair */ -APT_DECLARE(apt_bool_t) apt_pair_array_append(apt_pair_arr_t *arr, const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool); -/** Find name-value pair by name */ -APT_DECLARE(const apt_pair_t*) apt_pair_array_find(const apt_pair_arr_t *arr, const apt_str_t *name); -/** Get size of pair array */ -APT_DECLARE(int) apt_pair_array_size_get(const apt_pair_arr_t *arr); -/** Get name-value pair by id */ -APT_DECLARE(const apt_pair_t*) apt_pair_array_get(const apt_pair_arr_t *arr, int id); - -APT_END_EXTERN_C - -#endif /* APT_PAIR_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h deleted file mode 100644 index 3bb6052744..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_poller_task.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_poller_task.h 2176 2014-09-12 05:00:23Z achaloyan@gmail.com $ - */ - -#ifndef APT_POLLER_TASK_H -#define APT_POLLER_TASK_H - -/** - * @file apt_poller_task.h - * @brief Poller Task - */ - -#include "apt_pollset.h" -#include "apt_task.h" -#include "apt_timer_queue.h" - -APT_BEGIN_EXTERN_C - -/** Opaque poller task declaration */ -typedef struct apt_poller_task_t apt_poller_task_t; - -/** Function prototype to handle signalled descripors */ -typedef apt_bool_t (*apt_poll_signal_f)(void *obj, const apr_pollfd_t *descriptor); - - -/** - * Create poller task. - * @param max_pollset_size the maximum number of descriptors pollset can hold - * @param signal_handler the handler of signalled descriptors - * @param obj the external object to pass to callback - * @param msg_pool the pool of task messages - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_poller_task_t*) apt_poller_task_create( - apr_size_t max_pollset_size, - apt_poll_signal_f signal_handler, - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool); - -/** - * Destroy poller task. - * @param task the task to destroy - */ -APT_DECLARE(apt_bool_t) apt_poller_task_destroy(apt_poller_task_t *task); - -/** - * Cleanup poller task. - * @param task the task to cleanup - * - * @remark This function should be considered in protected scope. - * It will be called on task destroy unless you override the behavior. - */ -APT_DECLARE(void) apt_poller_task_cleanup(apt_poller_task_t *task); - -/** - * Start poller task and wait for incoming messages. - * @param task the task to start - */ -APT_DECLARE(apt_bool_t) apt_poller_task_start(apt_poller_task_t *task); - -/** - * Terminate poller task. - * @param task the task to terminate - */ -APT_DECLARE(apt_bool_t) apt_poller_task_terminate(apt_poller_task_t *task); - -/** - * Get task base. - * @param task the poller task to get task base from - */ -APT_DECLARE(apt_task_t*) apt_poller_task_base_get(const apt_poller_task_t *task); - -/** - * Get task vtable. - * @param task the poller task to get vtable from - */ -APT_DECLARE(apt_task_vtable_t*) apt_poller_task_vtable_get(const apt_poller_task_t *task); - -/** - * Get external object. - * @param task the poller task to get object from - */ -APT_DECLARE(void*) apt_poller_task_object_get(const apt_poller_task_t *task); - -/** - * Add descriptor to pollset. - * @param task the task which holds the pollset - * @param descriptor the descriptor to add - */ -APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_add(const apt_poller_task_t *task, const apr_pollfd_t *descriptor); - -/** - * Remove descriptor from pollset. - * @param task the task which holds the pollset - * @param descriptor the descriptor to remove - */ -APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_remove(const apt_poller_task_t *task, const apr_pollfd_t *descriptor); - -/** - * Create timer. - * @param task the poller task to create timer in the scope of - * @param proc the timer callback - * @param obj the object to pass to callback - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_timer_t*) apt_poller_task_timer_create( - apt_poller_task_t *task, - apt_timer_proc_f proc, - void *obj, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* APT_POLLER_TASK_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h deleted file mode 100644 index 0d6a0ab356..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_pollset.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_pollset.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_POLLSET_H -#define APT_POLLSET_H - -/** - * @file apt_pollset.h - * @brief Interruptable APR-Pollset - */ - -/** - * Wakeup builtin API of the pollset is introduced only in APR-1.4 - * and it is not available for APR-1.2 and APR-1.3 versions. Thus - * apt_pollset_t is an extension of apr_pollset_t and provides - * pollset wakeup capabilities the similar way as it's implemented - * in APR-1.4 trunk - */ - -#include -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Opaque pollset declaration */ -typedef struct apt_pollset_t apt_pollset_t; - -/** - * Create interruptable pollset on top of APR pollset. - * @param size the maximum number of descriptors pollset can hold - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_pollset_t*) apt_pollset_create(apr_uint32_t size, apr_pool_t *pool); - -/** - * Destroy pollset. - * @param pollset the pollset to destroy - */ -APT_DECLARE(apt_bool_t) apt_pollset_destroy(apt_pollset_t *pollset); - -/** - * Add pollset descriptor to a pollset. - * @param pollset the pollset to add the descriptor to - * @param descriptor the descriptor to add - */ -APT_DECLARE(apt_bool_t) apt_pollset_add(apt_pollset_t *pollset, const apr_pollfd_t *descriptor); - -/** - * Remove pollset descriptor from a pollset. - * @param pollset the pollset to remove the descriptor from - * @param descriptor the descriptor to remove - */ -APT_DECLARE(apt_bool_t) apt_pollset_remove(apt_pollset_t *pollset, const apr_pollfd_t *descriptor); - -/** - * Block for activity on the descriptor(s) in a pollset. - * @param pollset the pollset to use - * @param timeout the timeout in microseconds - * @param num the number of signalled descriptors (output parameter) - * @param descriptors the array of signalled descriptors (output parameter) - */ -APT_DECLARE(apr_status_t) apt_pollset_poll( - apt_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors); - -/** - * Interrupt the blocked poll call. - * @param pollset the pollset to use - */ -APT_DECLARE(apt_bool_t) apt_pollset_wakeup(apt_pollset_t *pollset); - -/** - * Match against builtin wake up descriptor in a pollset. - * @param pollset the pollset to use - * @param descriptor the descriptor to match - */ -APT_DECLARE(apt_bool_t) apt_pollset_is_wakeup(apt_pollset_t *pollset, const apr_pollfd_t *descriptor); - -APT_END_EXTERN_C - -#endif /* APT_POLLSET_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h b/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h deleted file mode 100644 index 56f10d4429..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_pool.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_pool.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_POOL_H -#define APT_POOL_H - -/** - * @file apt_pool.h - * @brief APR pool management - */ - -/** - * Wrappers around APR pool creation - * allow to control memory allocation policy project uses - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** - * Create APR pool - */ -APT_DECLARE(apr_pool_t*) apt_pool_create(void); - -/** - * Create APR subpool pool - * @param parent the parent pool - */ -APT_DECLARE(apr_pool_t*) apt_subpool_create(apr_pool_t *parent); - -APT_END_EXTERN_C - -#endif /* APT_POOL_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_string.h b/libs/unimrcp/libs/apr-toolkit/include/apt_string.h deleted file mode 100644 index 4c919cedb6..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_string.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_string.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_STRING_H -#define APT_STRING_H - -/** - * @file apt_string.h - * @brief String Representation - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Empty string */ -#define APT_EMPTY_STRING "" - -/** String declaration */ -typedef struct apt_str_t apt_str_t; - -/** String representation */ -struct apt_str_t { - /** String buffer (might be not NULL terminated) */ - char *buf; - /** Length of the string (not counting terminating NULL character if exists) */ - apr_size_t length; -}; - -/** Reset string. */ -static APR_INLINE void apt_string_reset(apt_str_t *str) -{ - str->buf = NULL; - str->length = 0; -} - -/** Get string buffer. */ -static APR_INLINE const char* apt_string_buffer_get(const apt_str_t *str) -{ - if(str->buf) { - return str->buf; - } - return APT_EMPTY_STRING; -} - -/** Get string length. */ -static APR_INLINE apr_size_t apt_string_length_get(const apt_str_t *str) -{ - return str->length; -} - -/** Check whether string is empty. */ -static APR_INLINE apr_size_t apt_string_is_empty(const apt_str_t *str) -{ - return str->length ? FALSE : TRUE; -} - -/** - * Set NULL terminated string. - * @param str the destination string - * @param src the NULL terminated string to set - */ -static APR_INLINE void apt_string_set(apt_str_t *str, const char *src) -{ - str->buf = (char*)src; - str->length = src ? strlen(src) : 0; -} - -/** - * Assign (copy) NULL terminated string. - * @param str the destination string - * @param src the NULL terminated string to copy - * @param pool the pool to allocate memory from - */ -static APR_INLINE void apt_string_assign(apt_str_t *str, const char *src, apr_pool_t *pool) -{ - str->buf = NULL; - str->length = src ? strlen(src) : 0; - if(str->length) { - str->buf = apr_pstrmemdup(pool,src,str->length); - } -} - -/** - * Assign (copy) n characters from the src string. - * @param str the destination string - * @param src the NULL terminated string to copy - * @param pool the pool to allocate memory from - */ -static APR_INLINE void apt_string_assign_n(apt_str_t *str, const char *src, apr_size_t length, apr_pool_t *pool) -{ - str->buf = NULL; - str->length = length; - if(str->length) { - str->buf = apr_pstrmemdup(pool,src,str->length); - } -} - -/** - * Copy string. - * @param dest_str the destination string - * @param src_str the source string - * @param pool the pool to allocate memory from - */ -static APR_INLINE void apt_string_copy(apt_str_t *str, const apt_str_t *src_str, apr_pool_t *pool) -{ - str->buf = NULL; - str->length = src_str->length; - if(str->length) { - str->buf = apr_pstrmemdup(pool,src_str->buf,src_str->length); - } -} - -/** - * Compare two strings (case insensitive). - * @param str1 the string to compare - * @param str2 the string to compare - * @return TRUE if equal, FALSE otherwise - */ -static APR_INLINE apt_bool_t apt_string_compare(const apt_str_t *str1, const apt_str_t *str2) -{ - if(str1->length != str2->length || !str1->length) { - return FALSE; - } - return (strncasecmp(str1->buf,str2->buf,str1->length) == 0) ? TRUE : FALSE; -} - -/** - * Represent string as iovec. - * @param str the string to represent - * @param vec the iovec to set - */ -static APR_INLINE void apt_string_to_iovec(const apt_str_t *str, struct iovec *vec) -{ - vec->iov_base = str->buf; - vec->iov_len = str->length; -} - -APT_END_EXTERN_C - -#endif /* APT_STRING_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h b/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h deleted file mode 100644 index 53ecc6e5aa..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_string_table.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_string_table.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_STRING_TABLE_H -#define APT_STRING_TABLE_H - -/** - * @file apt_string_table.h - * @brief Generic String Table - */ - -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - - -/** String table item declaration */ -typedef struct apt_str_table_item_t apt_str_table_item_t; - -/** String table item definition */ -struct apt_str_table_item_t { - /** String value associated with id */ - apt_str_t value; - /** Index of the unique (key) character to compare */ - apr_size_t key; -}; - - -/** - * Get the string by a given id. - * @param table the table to get string from - * @param size the size of the table - * @param id the id to get string by - * @return the string associated with the id, or NULL if the id is invalid - */ -APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id); - -/** - * Find the id associated with a given string. - * @param table the table to search for the id - * @param size the size of the table - * @param value the string to search for - * @return the id associated with the string, or invalid id if string cannot be matched - */ -APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value); - - -APT_END_EXTERN_C - -#endif /* APT_STRING_TABLE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_task.h b/libs/unimrcp/libs/apr-toolkit/include/apt_task.h deleted file mode 100644 index 127529c95e..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_task.h +++ /dev/null @@ -1,262 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_task.h 2180 2014-09-13 21:17:24Z achaloyan@gmail.com $ - */ - -#ifndef APT_TASK_H -#define APT_TASK_H - -/** - * @file apt_task.h - * @brief Thread Execution Abstraction - */ - -#include "apt.h" -#include "apt_task_msg.h" - -APT_BEGIN_EXTERN_C - -/** Opaque task declaration */ -typedef struct apt_task_t apt_task_t; -/** Opaque task virtual table declaration */ -typedef struct apt_task_vtable_t apt_task_vtable_t; -/** Opaque task method declaration */ -typedef apt_bool_t (*apt_task_method_f)(apt_task_t *task); -/** Opaque task event declaration */ -typedef void (*apt_task_event_f)(apt_task_t *task); - - -/** - * Create task. - * @param obj the external object to associate with the task - * @param msg_pool the pool of task messages - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_task_t*) apt_task_create( - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool); - -/** - * Destroy task. - * @param task the task to destroy - */ -APT_DECLARE(apt_bool_t) apt_task_destroy(apt_task_t *task); - -/** - * Add child task. - * @param task the task to add child task to - * @param child_task the child task to add - */ -APT_DECLARE(apt_bool_t) apt_task_add(apt_task_t *task, apt_task_t *child_task); - -/** - * Start task. - * @param task the task to start - */ -APT_DECLARE(apt_bool_t) apt_task_start(apt_task_t *task); - -/** - * Take task offline. - * @param task the task to take offline - */ -APT_DECLARE(apt_bool_t) apt_task_offline(apt_task_t *task); - -/** - * Bring task online. - * @param task the task to bring online - */ -APT_DECLARE(apt_bool_t) apt_task_online(apt_task_t *task); - -/** - * Terminate task. - * @param task the task to terminate - * @param wait_till_complete whether to wait for task to complete or - * process termination asynchronously - */ -APT_DECLARE(apt_bool_t) apt_task_terminate(apt_task_t *task, apt_bool_t wait_till_complete); - -/** - * Wait for task till complete. - * @param task the task to wait for - */ -APT_DECLARE(apt_bool_t) apt_task_wait_till_complete(apt_task_t *task); - -/** - * Get (acquire) task message. - * @param task the task to get task message from - */ -APT_DECLARE(apt_task_msg_t*) apt_task_msg_get(apt_task_t *task); - -/** - * Signal (post) message to the task. - * @param task the task to signal message to - * @param msg the message to signal - */ -APT_DECLARE(apt_bool_t) apt_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg); - -/** - * Signal (post) message to the parent of the specified task. - * @param task the task to signal message to - * @param msg the message to signal - */ -APT_DECLARE(apt_bool_t) apt_task_msg_parent_signal(apt_task_t *task, apt_task_msg_t *msg); - -/** - * Process message signaled to the task. - * @param task the task to process message - * @param msg the message to process - */ -APT_DECLARE(apt_bool_t) apt_task_msg_process(apt_task_t *task, apt_task_msg_t *msg); - -/** - * Process task start request. - * @param task the task being started - */ -APT_DECLARE(apt_bool_t) apt_task_start_request_process(apt_task_t *task); - -/** - * Process task termination request. - * @param task the task being terminated - */ -APT_DECLARE(apt_bool_t) apt_task_terminate_request_process(apt_task_t *task); - - -/** - * Get parent (master) task. - * @param task the task to get parent from - */ -APT_DECLARE(apt_task_t*) apt_task_parent_get(const apt_task_t *task); - -/** - * Get memory pool associated with task. - * @param task the task to get pool from - */ -APT_DECLARE(apr_pool_t*) apt_task_pool_get(const apt_task_t *task); - -/** - * Get external object associated with the task. - * @param task the task to get object from - */ -APT_DECLARE(void*) apt_task_object_get(const apt_task_t *task); - -/** - * Get task vtable. - * @param task the task to get vtable from - */ -APT_DECLARE(apt_task_vtable_t*) apt_task_vtable_get(apt_task_t *task); - -/** - * Give a name to the task. - * @param task the task to give name for - * @param name the name to set - */ -APT_DECLARE(void) apt_task_name_set(apt_task_t *task, const char *name); - -/** - * Get task name. - * @param task the task to get name from - */ -APT_DECLARE(const char*) apt_task_name_get(const apt_task_t *task); - -/** - * Enable/disable auto ready mode. - * @param task the task to set mode for - * @param auto_ready the enabled/disabled auto ready mode - */ -APT_DECLARE(void) apt_task_auto_ready_set(apt_task_t *task, apt_bool_t auto_ready); - -/** - * Explicitly indicate task is ready to process messages. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_ready(apt_task_t *task); - -/** - * Get the running flag. - * @param task the task - */ -APT_DECLARE(apt_bool_t*) apt_task_running_flag_get(apt_task_t *task); - -/** - * Add start request. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_start_request_add(apt_task_t *task); - -/** - * Remove start request. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_start_request_remove(apt_task_t *task); - -/** - * Add termination request. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_terminate_request_add(apt_task_t *task); - -/** - * Remove termination request. - * @param task the task - */ -APT_DECLARE(apt_bool_t) apt_task_terminate_request_remove(apt_task_t *task); - -/** - * Hold task execution. - * @param msec the time to hold - */ -APT_DECLARE(void) apt_task_delay(apr_size_t msec); - - -/** Table of task virtual methods */ -struct apt_task_vtable_t { - /** Virtual destroy method */ - apt_task_method_f destroy; - /** Virtual start method*/ - apt_task_method_f start; - /** Virtual terminate method */ - apt_task_method_f terminate; - /** Virtual run method*/ - apt_task_method_f run; - - /** Virtual signal_msg method */ - apt_bool_t (*signal_msg)(apt_task_t *task, apt_task_msg_t *msg); - /** Virtual process_msg method */ - apt_bool_t (*process_msg)(apt_task_t *task, apt_task_msg_t *msg); - - /** Virtual process_start method */ - apt_bool_t (*process_start)(apt_task_t *task); - /** Virtual process_terminate method */ - apt_bool_t (*process_terminate)(apt_task_t *task); - - /** Virtual pre-run event handler */ - apt_task_event_f on_pre_run; - /** Virtual post-run event handler */ - apt_task_event_f on_post_run; - /** Virtual start-complete event handler */ - apt_task_event_f on_start_complete; - /** Virtual terminate-complete event handler */ - apt_task_event_f on_terminate_complete; - /** Virtual take-offline-complete event handler */ - apt_task_event_f on_offline_complete; - /** Virtual bring-online-complete event handler */ - apt_task_event_f on_online_complete; -}; - -APT_END_EXTERN_C - -#endif /* APT_TASK_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h b/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h deleted file mode 100644 index afb01d2cd6..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_task_msg.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_task_msg.h 2180 2014-09-13 21:17:24Z achaloyan@gmail.com $ - */ - -#ifndef APT_TASK_MSG_H -#define APT_TASK_MSG_H - -/** - * @file apt_task_msg.h - * @brief Task Message Base Definition - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Enumeration of task message types */ -typedef enum { - TASK_MSG_CORE, /**< core task message type */ - TASK_MSG_USER /**< user defined task messages start from here */ -} apt_task_msg_type_e; - -/** Enumeration of core task messages */ -typedef enum { - CORE_TASK_MSG_NONE, /**< indefinite message */ - CORE_TASK_MSG_START_COMPLETE, /**< start-complete message */ - CORE_TASK_MSG_TERMINATE_REQUEST, /**< terminate-request message */ - CORE_TASK_MSG_TERMINATE_COMPLETE, /**< terminate-complete message */ - CORE_TASK_MSG_TAKEOFFLINE_REQUEST, /**< take-offline-request message */ - CORE_TASK_MSG_TAKEOFFLINE_COMPLETE, /**< take-offline-complete message */ - CORE_TASK_MSG_BRINGONLINE_REQUEST, /**< bring-online-request message */ - CORE_TASK_MSG_BRINGONLINE_COMPLETE, /**< bring-online-complete message */ -} apt_core_task_msg_type_e; - -/** Opaque task message declaration */ -typedef struct apt_task_msg_t apt_task_msg_t; -/** Opaque task message pool declaration */ -typedef struct apt_task_msg_pool_t apt_task_msg_pool_t; - -/** Task message is used for inter task communication */ -struct apt_task_msg_t { - /** Message pool the task message is allocated from */ - apt_task_msg_pool_t *msg_pool; - /** Task msg type */ - int type; - /** Task msg sub type */ - int sub_type; - /** Context specific data */ - char data[1]; -}; - - -/** Create pool of task messages with dynamic allocation of messages (no actual pool is created) */ -APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool); - -/** Create pool of task messages with static allocation of messages */ -APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t msg_pool_size, apr_pool_t *pool); - -/** Destroy pool of task messages */ -APT_DECLARE(void) apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool); - - -/** Acquire task message from task message pool */ -APT_DECLARE(apt_task_msg_t*) apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool); - -/** Realese task message */ -APT_DECLARE(void) apt_task_msg_release(apt_task_msg_t *task_msg); - - -APT_END_EXTERN_C - -#endif /* APT_TASK_MSG_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h b/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h deleted file mode 100644 index 13e9003302..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_test_suite.h +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_test_suite.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_TEST_SUITE_H -#define APT_TEST_SUITE_H - -/** - * @file apt_test_suite.h - * @brief Test Suite and Framework Definitions - */ - -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - - -/** Opaque test suite declaration */ -typedef struct apt_test_suite_t apt_test_suite_t; - -/** Prototype of test function */ -typedef apt_bool_t (*apt_test_f)(apt_test_suite_t *suite, int argc, const char * const *argv); - -/** Test suite as a base for all kind of tests */ -struct apt_test_suite_t { - /** Memory pool to allocate memory from */ - apr_pool_t *pool; - /** Unique name of the test suite */ - apt_str_t name; - /** External object associated with the test suite */ - void *obj; - /** Test function to execute */ - apt_test_f tester; -}; - -/** - * Create test suite. - * @param pool the pool to allocate memory from - * @param name the unique name of the test suite - * @param obj the external object associated with the test suite - * @param tester the test function to execute - */ -APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name, - void *obj, apt_test_f tester); - - - - - -/** Opaque test framework declaration */ -typedef struct apt_test_framework_t apt_test_framework_t; - -/** - * Create test framework. - */ -APT_DECLARE(apt_test_framework_t*) apt_test_framework_create(void); - -/** - * Destroy test framework. - * @param framework the test framework to destroy - */ -APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework); - -/** - * Add test suite to framework. - * @param framework the test framework to add test suite to - * @param suite the test suite to add - */ -APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite); - -/** - * Run test suites. - * @param framework the test framework - * @param argc the number of arguments - * @param argv the array of arguments - */ -APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv); - -/** - * Retrieve the memory pool. - * @param framework the test framework to retrieve memory pool from - */ -APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(const apt_test_framework_t *framework); - -APT_END_EXTERN_C - -#endif /* APT_TEST_SUITE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h b/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h deleted file mode 100644 index 48e2f7c4c0..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_text_message.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_text_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_TEXT_MESSAGE_H -#define APT_TEXT_MESSAGE_H - -/** - * @file apt_text_message.h - * @brief Text Message Interface (RFC5322) - */ - -#include "apt_header_field.h" -#include "apt_text_stream.h" - -APT_BEGIN_EXTERN_C - -/** Status of text message processing (parsing/generation) */ -typedef enum { - APT_MESSAGE_STATUS_COMPLETE, - APT_MESSAGE_STATUS_INCOMPLETE, - APT_MESSAGE_STATUS_INVALID -} apt_message_status_e; - - -/** Opaque text message parser */ -typedef struct apt_message_parser_t apt_message_parser_t; -/** Vtable of text message parser */ -typedef struct apt_message_parser_vtable_t apt_message_parser_vtable_t; - -/** Opaque text message generator */ -typedef struct apt_message_generator_t apt_message_generator_t; -/** Vtable of text message generator */ -typedef struct apt_message_generator_vtable_t apt_message_generator_vtable_t; - -/** Temporary context associated with message and used for its parsing or generation */ -typedef struct apt_message_context_t apt_message_context_t; - -/** Create message parser */ -APT_DECLARE(apt_message_parser_t*) apt_message_parser_create(void *obj, const apt_message_parser_vtable_t *vtable, apr_pool_t *pool); - -/** Parse message by raising corresponding event handlers */ -APT_DECLARE(apt_message_status_e) apt_message_parser_run(apt_message_parser_t *parser, apt_text_stream_t *stream, void **message); - -/** Get external object associated with parser */ -APT_DECLARE(void*) apt_message_parser_object_get(apt_message_parser_t *parser); - -/** Set verbose mode for the parser */ -APT_DECLARE(void) apt_message_parser_verbose_set(apt_message_parser_t *parser, apt_bool_t verbose); - - -/** Create message generator */ -APT_DECLARE(apt_message_generator_t*) apt_message_generator_create(void *obj, const apt_message_generator_vtable_t *vtable, apr_pool_t *pool); - -/** Generate message */ -APT_DECLARE(apt_message_status_e) apt_message_generator_run(apt_message_generator_t *generator, void *message, apt_text_stream_t *stream); - -/** Get external object associated with generator */ -APT_DECLARE(void*) apt_message_generator_object_get(apt_message_generator_t *generator); - -/** Set verbose mode for the parser */ -APT_DECLARE(void) apt_message_generator_verbose_set(apt_message_generator_t *generator, apt_bool_t verbose); - - -/** Parse individual header field (name-value pair) */ -APT_DECLARE(apt_header_field_t*) apt_header_field_parse(apt_text_stream_t *stream, apr_pool_t *pool); - -/** Generate individual header field (name-value pair) */ -APT_DECLARE(apt_bool_t) apt_header_field_generate(const apt_header_field_t *header_field, apt_text_stream_t *stream); - -/** Parse header section */ -APT_DECLARE(apt_bool_t) apt_header_section_parse(apt_header_section_t *header, apt_text_stream_t *stream, apr_pool_t *pool); - -/** Generate header section */ -APT_DECLARE(apt_bool_t) apt_header_section_generate(const apt_header_section_t *header, apt_text_stream_t *stream); - - -/** Temporary context associated with message and used for its parsing or generation */ -struct apt_message_context_t { - /** Context or ptotocol specific message */ - void *message; - /** Header section of the message */ - apt_header_section_t *header; - /** Body or content of the message */ - apt_str_t *body; -}; - -/** Vtable of text message parser */ -struct apt_message_parser_vtable_t { - /** Start new message parsing by associating corresponding context and reading its start-line if applicable */ - apt_bool_t (*on_start)(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool); - /** Header section handler is invoked when entire header section has been read and parsed into header fields */ - apt_bool_t (*on_header_complete)(apt_message_parser_t *parser, apt_message_context_t *context); - /** Body handler is invoked when entire body has been read */ - apt_bool_t (*on_body_complete)(apt_message_parser_t *parser, apt_message_context_t *context); -}; - -/** Vtable of text message generator */ -struct apt_message_generator_vtable_t { - /** Start message generation by associating corresponding context and generating message start-line if applicable */ - apt_bool_t (*on_start)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); - /** Header section handler is invoked to notify header section has been generated */ - apt_bool_t (*on_header_complete)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); - /** Body handler is invoked to notify body has been generated */ - apt_bool_t (*on_body_complete)(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); -}; - - -APT_END_EXTERN_C - -#endif /* APT_TEXT_MESSAGE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h b/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h deleted file mode 100644 index 7510afd9bc..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_text_stream.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_text_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_TEXT_STREAM_H -#define APT_TEXT_STREAM_H - -/** - * @file apt_text_stream.h - * @brief Text Stream Parse/Generate Routine - */ - -#include "apt_string_table.h" -#include "apt_pair.h" - -APT_BEGIN_EXTERN_C - -/** Space */ -#define APT_TOKEN_SP 0x20 -/** Horizontal tab */ -#define APT_TOKEN_HTAB 0x09 -/** Carrige return */ -#define APT_TOKEN_CR 0x0D -/** Line feed */ -#define APT_TOKEN_LF 0x0A - -/** Text stream declaration */ -typedef struct apt_text_stream_t apt_text_stream_t; - -/** Text stream is used for message parsing and generation */ -struct apt_text_stream_t { - /** Text stream */ - apt_str_t text; - - /** Current position in the stream */ - char *pos; - /** End of stream pointer */ - const char *end; - /** Is end of stream reached */ - apt_bool_t is_eos; -}; - - -/** - * Read entire line of the text stream. - * @param stream the text stream to navigate on - * @param line the read line to return - * @return TRUE if the line is successfully read, otherwise FALSE - * @remark To be used to navigate through the lines of the text stream (message). - */ -APT_DECLARE(apt_bool_t) apt_text_line_read(apt_text_stream_t *stream, apt_str_t *line); - -/** - * Read header field (name-value pair) of the text stream by scanning entire line. - * @param stream the text stream to navigate - * @param pair the read pair to return - * @return TRUE if the header is successfully read, otherwise FALSE - * @remark To be used to navigate through the lines and read header fields - * (name:value pairs) of the text stream (message). - */ -APT_DECLARE(apt_bool_t) apt_text_header_read(apt_text_stream_t *stream, apt_pair_t *pair); - -/** - * Read the field terminated with specified separator. - * @param stream the text stream to navigate - * @param separator the field separator - * @param skip_spaces whether to skip spaces or not - * @param field the read field to return - * @return TRUE if the read field isn't empty, otherwise FALSE - * @remark To be used to navigate through the fields of the text stream (message). - */ -APT_DECLARE(apt_bool_t) apt_text_field_read(apt_text_stream_t *stream, char separator, apt_bool_t skip_spaces, apt_str_t *field); - -/** Generate name-value pair line */ -APT_DECLARE(apt_bool_t) apt_text_name_value_insert(apt_text_stream_t *stream, const apt_str_t *name, const apt_str_t *value); - -/** Generate only the name ("name:") of the header field */ -APT_DECLARE(apt_bool_t) apt_text_header_name_insert(apt_text_stream_t *stream, const apt_str_t *name); - -/** Parse array of name-value pairs */ -APT_DECLARE(apt_bool_t) apt_pair_array_parse(apt_pair_arr_t *arr, const apt_str_t *value, apr_pool_t *pool); -/** Generate array of name-value pairs */ -APT_DECLARE(apt_bool_t) apt_pair_array_generate(const apt_pair_arr_t *arr, apt_str_t *str, apr_pool_t *pool); - - -/** Parse boolean-value */ -APT_DECLARE(apt_bool_t) apt_boolean_value_parse(const apt_str_t *str, apt_bool_t *value); -/** Generate apr_size_t value from pool (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_boolean_value_generate(apt_bool_t value, apt_str_t *str, apr_pool_t *pool); - -/** Parse apr_size_t value */ -APT_DECLARE(apr_size_t) apt_size_value_parse(const apt_str_t *str); -/** Generate apr_size_t value from pool (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_size_value_generate(apr_size_t value, apt_str_t *str, apr_pool_t *pool); - -/** Insert apr_size_t value */ -APT_DECLARE(apt_bool_t) apt_text_size_value_insert(apt_text_stream_t *stream, apr_size_t value); - -/** Parse float value */ -APT_DECLARE(float) apt_float_value_parse(const apt_str_t *str); -/** Generate float value (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_float_value_generate(float value, apt_str_t *str, apr_pool_t *pool); - -/** Insert float value */ -APT_DECLARE(apt_bool_t) apt_text_float_value_insert(apt_text_stream_t *stream, float value); -/** Insert string value */ -APT_DECLARE(apt_bool_t) apt_text_string_insert(apt_text_stream_t *stream, const apt_str_t *str); - -/** Reset navigation related data of the text stream */ -static APR_INLINE void apt_text_stream_reset(apt_text_stream_t *stream) -{ - stream->pos = stream->text.buf; - stream->end = stream->text.buf + stream->text.length; - stream->is_eos = FALSE; -} - -/** Initialize text stream */ -static APR_INLINE void apt_text_stream_init(apt_text_stream_t *stream, char *buffer, apr_size_t size) -{ - stream->text.buf = buffer; - stream->text.length = size; - apt_text_stream_reset(stream); -} - -/** Insert end of the line symbol(s) */ -static APR_INLINE apt_bool_t apt_text_eol_insert(apt_text_stream_t *stream) -{ - if(stream->pos + 2 < stream->end) { - *stream->pos++ = APT_TOKEN_CR; - *stream->pos++ = APT_TOKEN_LF; - return TRUE; - } - return FALSE; -} - -/** Insert character */ -static APR_INLINE apt_bool_t apt_text_char_insert(apt_text_stream_t *stream, char ch) -{ - if(stream->pos + 1 < stream->end) { - *stream->pos++ = ch; - return TRUE; - } - return FALSE; -} - -/** Insert space */ -static APR_INLINE apt_bool_t apt_text_space_insert(apt_text_stream_t *stream) -{ - return apt_text_char_insert(stream,APT_TOKEN_SP); -} - -/** Insert space */ -static APR_INLINE apt_bool_t apt_text_htab_insert(apt_text_stream_t *stream) -{ - return apt_text_char_insert(stream,APT_TOKEN_HTAB); -} - -/** Check whether specified character is a white space (WSP = SP / HTAB) */ -static APR_INLINE apt_bool_t apt_text_is_wsp(char ch) -{ - return (ch == APT_TOKEN_SP || ch == APT_TOKEN_HTAB) ? TRUE : FALSE; -} - -/** Skip sequence of spaces */ -static APR_INLINE void apt_text_spaces_skip(apt_text_stream_t *stream) -{ - while(stream->pos < stream->end && *stream->pos == APT_TOKEN_SP) - stream->pos++; -} - -/** Skip sequence of white spaces (WSP = SP / HTAB) */ -static APR_INLINE void apt_text_white_spaces_skip(apt_text_stream_t *stream) -{ - while(stream->pos < stream->end && apt_text_is_wsp(*stream->pos) == TRUE) - stream->pos++; -} - -/** Skip specified character */ -static APR_INLINE void apt_text_char_skip(apt_text_stream_t *stream, char ch) -{ - if(stream->pos < stream->end && *stream->pos == ch) stream->pos++; -} - -/** Skip sequence of specified characters */ -static APR_INLINE void apt_text_chars_skip(apt_text_stream_t *stream, char ch) -{ - while(stream->pos < stream->end && *stream->pos == ch) stream->pos++; -} - -/** Skip to specified character */ -static APR_INLINE void apt_text_skip_to_char(apt_text_stream_t *stream, char ch) -{ - while(stream->pos < stream->end && *stream->pos != ch) stream->pos++; -} - -/** Check whether end of stream is reached */ -static APR_INLINE apt_bool_t apt_text_is_eos(const apt_text_stream_t *stream) -{ - return (stream->pos >= stream->end || stream->is_eos == TRUE) ? TRUE : FALSE; -} - -/** Scroll text stream */ -APT_DECLARE(apt_bool_t) apt_text_stream_scroll(apt_text_stream_t *stream); - -/** Parse id at resource string */ -APT_DECLARE(apt_bool_t) apt_id_resource_parse(const apt_str_t *str, char separator, apt_str_t *id, apt_str_t *resource, apr_pool_t *pool); -/** Generate id at resource string */ -APT_DECLARE(apt_bool_t) apt_id_resource_generate(const apt_str_t *id, const apt_str_t *resource, char separator, apt_str_t *str, apr_pool_t *pool); - -/** Generate value plus the length (number of digits) of the value itself */ -APT_DECLARE(apt_bool_t) apt_var_length_value_generate(apr_size_t *value, apr_size_t max_count, apt_str_t *str); - -/** Generate completion-cause */ -APT_DECLARE(apt_bool_t) apt_completion_cause_generate(const apt_str_table_item_t table[], apr_size_t size, apr_size_t cause, apt_str_t *str, apr_pool_t *pool); - -/** - * Generate unique identifier (hex string) - * @param id the id to generate - * @param length the length of hex string to generate - * @param pool the pool to allocate memory from - */ -APT_DECLARE(apt_bool_t) apt_unique_id_generate(apt_str_t *id, apr_size_t length, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* APT_TEXT_STREAM_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h b/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h deleted file mode 100644 index ed04dd6514..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/include/apt_timer_queue.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_timer_queue.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef APT_TIMER_QUEUE_H -#define APT_TIMER_QUEUE_H - -/** - * @file apt_timer_queue.h - * @brief Timer Queue - */ - -#include "apt.h" - -APT_BEGIN_EXTERN_C - -/** Opaque timer declaration */ -typedef struct apt_timer_t apt_timer_t; -/** Opaque timer queue declaration */ -typedef struct apt_timer_queue_t apt_timer_queue_t; - -/** Prototype of timer callback */ -typedef void (*apt_timer_proc_f)(apt_timer_t *timer, void *obj); - - -/** Create timer queue */ -APT_DECLARE(apt_timer_queue_t*) apt_timer_queue_create(apr_pool_t *pool); - -/** Destroy timer queue */ -APT_DECLARE(void) apt_timer_queue_destroy(apt_timer_queue_t *timer_queue); - -/** Advance scheduled timers */ -APT_DECLARE(void) apt_timer_queue_advance(apt_timer_queue_t *timer_queue, apr_uint32_t elapsed_time); - -/** Is timer queue empty */ -APT_DECLARE(apt_bool_t) apt_timer_queue_is_empty(const apt_timer_queue_t *timer_queue); - -/** Get current timeout */ -APT_DECLARE(apt_bool_t) apt_timer_queue_timeout_get(const apt_timer_queue_t *timer_queue, apr_uint32_t *timeout); - - -/** Create timer */ -APT_DECLARE(apt_timer_t*) apt_timer_create(apt_timer_queue_t *timer_queue, apt_timer_proc_f proc, void *obj, apr_pool_t *pool); - -/** Set one-shot timer */ -APT_DECLARE(apt_bool_t) apt_timer_set(apt_timer_t *timer, apr_uint32_t timeout); - -/** Kill timer */ -APT_DECLARE(apt_bool_t) apt_timer_kill(apt_timer_t *timer); - - -APT_END_EXTERN_C - -#endif /* APT_TIMER_QUEUE_H */ diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c deleted file mode 100644 index 67a9ea70dd..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_consumer_task.c +++ /dev/null @@ -1,164 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_consumer_task.c 2224 2014-11-12 00:41:45Z achaloyan@gmail.com $ - */ - -#include -#include -#include "apt_consumer_task.h" -#include "apt_log.h" - -struct apt_consumer_task_t { - void *obj; - apt_task_t *base; - apr_queue_t *msg_queue; -#if APR_HAS_QUEUE_TIMEOUT - apt_timer_queue_t *timer_queue; -#endif -}; - -static apt_bool_t apt_consumer_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t apt_consumer_task_run(apt_task_t *task); - -APT_DECLARE(apt_consumer_task_t*) apt_consumer_task_create( - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool) -{ - apt_task_vtable_t *vtable; - apt_consumer_task_t *consumer_task = apr_palloc(pool,sizeof(apt_consumer_task_t)); - consumer_task->obj = obj; - consumer_task->msg_queue = NULL; - if(apr_queue_create(&consumer_task->msg_queue,1024,pool) != APR_SUCCESS) { - return NULL; - } - - consumer_task->base = apt_task_create(consumer_task,msg_pool,pool); - if(!consumer_task->base) { - return NULL; - } - - vtable = apt_task_vtable_get(consumer_task->base); - if(vtable) { - vtable->run = apt_consumer_task_run; - vtable->signal_msg = apt_consumer_task_msg_signal; - } - -#if APR_HAS_QUEUE_TIMEOUT - consumer_task->timer_queue = apt_timer_queue_create(pool); -#endif - - return consumer_task; -} - -APT_DECLARE(apt_task_t*) apt_consumer_task_base_get(const apt_consumer_task_t *task) -{ - return task->base; -} - -APT_DECLARE(apt_task_vtable_t*) apt_consumer_task_vtable_get(const apt_consumer_task_t *task) -{ - return apt_task_vtable_get(task->base); -} - -APT_DECLARE(void*) apt_consumer_task_object_get(const apt_consumer_task_t *task) -{ - return task->obj; -} - -APT_DECLARE(apt_timer_t*) apt_consumer_task_timer_create( - apt_consumer_task_t *task, - apt_timer_proc_f proc, - void *obj, - apr_pool_t *pool) -{ -#if APR_HAS_QUEUE_TIMEOUT - return apt_timer_create(task->timer_queue,proc,obj,pool); -#else - return NULL; -#endif -} - -static apt_bool_t apt_consumer_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - return (apr_queue_push(consumer_task->msg_queue,msg) == APR_SUCCESS) ? TRUE : FALSE; -} - -static apt_bool_t apt_consumer_task_run(apt_task_t *task) -{ - apr_status_t rv; - void *msg; - apt_bool_t *running; - apt_consumer_task_t *consumer_task; -#if APR_HAS_QUEUE_TIMEOUT - apr_interval_time_t timeout; - apr_uint32_t queue_timeout; - apr_time_t time_now, time_last = 0; -#endif - const char *task_name; - - consumer_task = apt_task_object_get(task); - if(!consumer_task) { - return FALSE; - } - task_name = apt_task_name_get(consumer_task->base), - - running = apt_task_running_flag_get(task); - if(!running) { - return FALSE; - } - - while(*running) { -#if APR_HAS_QUEUE_TIMEOUT - if(apt_timer_queue_timeout_get(consumer_task->timer_queue,&queue_timeout) == TRUE) { - timeout = (apr_interval_time_t)queue_timeout * 1000; - time_last = apr_time_now(); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s] timeout [%u]", - task_name, queue_timeout); - rv = apr_queue_timedpop(consumer_task->msg_queue,timeout,&msg); - } - else - { - timeout = -1; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name); - rv = apr_queue_pop(consumer_task->msg_queue,&msg); - } -#else - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name); - rv = apr_queue_pop(consumer_task->msg_queue,&msg); -#endif - if(rv == APR_SUCCESS) { - if(msg) { - apt_task_msg_t *task_msg = msg; - apt_task_msg_process(consumer_task->base,task_msg); - } - } - else if(rv != APR_TIMEUP) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Pop Message [%s] status: %d",task_name,rv); - } - -#if APR_HAS_QUEUE_TIMEOUT - if(timeout != -1) { - time_now = apr_time_now(); - if(time_now > time_last) { - apt_timer_queue_advance(consumer_task->timer_queue,(apr_uint32_t)((time_now - time_last)/1000)); - } - } -#endif - } - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c b/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c deleted file mode 100644 index 896a9f66fb..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_cyclic_queue.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_cyclic_queue.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_cyclic_queue.h" - -struct apt_cyclic_queue_t { - void **data; - apr_size_t max_size; - apr_size_t actual_size; - apr_size_t head; - apr_size_t tail; -}; - -static apt_bool_t apt_cyclic_queue_resize(apt_cyclic_queue_t *queue); - - -APT_DECLARE(apt_cyclic_queue_t*) apt_cyclic_queue_create(apr_size_t size) -{ - apt_cyclic_queue_t *queue = malloc(sizeof(apt_cyclic_queue_t)); - queue->max_size = size; - queue->actual_size = 0; - queue->data = malloc(sizeof(void*) * queue->max_size); - queue->head = queue->tail = 0; - return queue; -} - -APT_DECLARE(void) apt_cyclic_queue_destroy(apt_cyclic_queue_t *queue) -{ - if(queue->data) { - free(queue->data); - queue->data = NULL; - } - free(queue); -} - -APT_DECLARE(apt_bool_t) apt_cyclic_queue_push(apt_cyclic_queue_t *queue, void *obj) -{ - if(queue->actual_size >= queue->max_size) { - if(apt_cyclic_queue_resize(queue) != TRUE) { - return FALSE; - } - } - - queue->data[queue->head] = obj; - queue->head = (queue->head + 1) % queue->max_size; - queue->actual_size++; - return TRUE; -} - -APT_DECLARE(void*) apt_cyclic_queue_pop(apt_cyclic_queue_t *queue) -{ - void *obj = NULL; - if(queue->actual_size) { - obj = queue->data[queue->tail]; - queue->tail = (queue->tail + 1) % queue->max_size; - queue->actual_size--; - } - return obj; -} - -APT_DECLARE(void) apt_cyclic_queue_clear(apt_cyclic_queue_t *queue) -{ - queue->actual_size = 0; - queue->head = queue->tail = 0; -} - -APT_DECLARE(apt_bool_t) apt_cyclic_queue_is_empty(const apt_cyclic_queue_t *queue) -{ - return queue->actual_size ? TRUE : FALSE; -} - -static apt_bool_t apt_cyclic_queue_resize(apt_cyclic_queue_t *queue) -{ - apr_size_t new_size = queue->max_size + queue->max_size/2; - void **new_data = malloc(sizeof(void*) * new_size); - apr_size_t offset; - - offset = queue->max_size - queue->head; - memcpy(new_data, queue->data + queue->head, sizeof(void*) * offset); - if(queue->head) { - memcpy(new_data + offset, queue->data, sizeof(void*) * queue->head); - } - - queue->tail = 0; - queue->head = queue->max_size; - queue->max_size = new_size; - free(queue->data); - queue->data = new_data; - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c b/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c deleted file mode 100644 index 4fe3f4a120..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_dir_layout.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_dir_layout.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include -#include -#include "apt_dir_layout.h" - -/** Directories layout */ -struct apt_dir_layout_t { - /** Array of the directory paths the layout is composed of */ - const char **paths; - /** Number of directories in the layout */ - apr_size_t count; -}; - -/** Default labels matching the entries in configuration */ -static const char *default_labels[APT_LAYOUT_DIR_COUNT] = { - "confdir", /* APT_LAYOUT_CONF_DIR */ - "plugindir", /* APT_LAYOUT_PLUGIN_DIR */ - "logdir", /* APT_LAYOUT_LOG_DIR */ - "datadir", /* APT_LAYOUT_DATA_DIR */ - "vardir", /* APT_LAYOUT_VAR_DIR */ -}; - -static const char* apt_default_root_dir_path_get(apr_pool_t *pool) -{ - char *root_dir_path; - char *cur_dir_path; - /* Get the current directory */ - if(apr_filepath_get(&cur_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) - return NULL; - - /* Root directory is supposed to be one level up by default */ - if(apr_filepath_merge(&root_dir_path,cur_dir_path,"../",APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) - return FALSE; - - return root_dir_path; -} - -static apt_bool_t apt_dir_layout_path_set_internal(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path) -{ - if(dir_entry_id >= dir_layout->count) - return FALSE; - - dir_layout->paths[dir_entry_id] = path; - return TRUE; -} - -APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create(apr_pool_t *pool) -{ - return apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool); -} - -APT_DECLARE(apt_dir_layout_t*) apt_dir_layout_create_ext(apr_size_t count, apr_pool_t *pool) -{ - apt_dir_layout_t *dir_layout = (apt_dir_layout_t*) apr_palloc(pool,sizeof(apt_dir_layout_t)); - dir_layout->count = count; - dir_layout->paths = apr_pcalloc(pool,count*sizeof(char*)); - return dir_layout; -} - -APT_DECLARE(apt_dir_layout_t*) apt_default_dir_layout_create(const char *root_dir_path, apr_pool_t *pool) -{ - apt_dir_layout_t *dir_layout = apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool); - - if(!root_dir_path) { - /* If root dir path is not specified, get the default one */ - root_dir_path = apt_default_root_dir_path_get(pool); - } - - if(root_dir_path) { - char *path; - - apr_filepath_merge(&path,root_dir_path,"conf",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_CONF_DIR,path); - - apr_filepath_merge(&path,root_dir_path,"plugin",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_PLUGIN_DIR,path); - - apr_filepath_merge(&path,root_dir_path,"log",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_LOG_DIR,path); - - apr_filepath_merge(&path,root_dir_path,"data",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_DATA_DIR,path); - - apr_filepath_merge(&path,root_dir_path,"var",APR_FILEPATH_NATIVE,pool); - apt_dir_layout_path_set_internal(dir_layout,APT_LAYOUT_VAR_DIR,path); - } - return dir_layout; -} - -APT_DECLARE(apt_dir_layout_t*) apt_custom_dir_layout_create( - const char *conf_dir_path, - const char *plugin_dir_path, - const char *log_dir_path, - const char *data_dir_path, - const char *var_dir_path, - apr_pool_t *pool) -{ - apt_dir_layout_t *dir_layout = apt_dir_layout_create_ext(APT_LAYOUT_DIR_COUNT,pool); - - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_CONF_DIR,conf_dir_path,pool); - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_PLUGIN_DIR,plugin_dir_path,pool); - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_LOG_DIR,log_dir_path,pool); - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_DATA_DIR,data_dir_path,pool); - apt_dir_layout_path_set(dir_layout,APT_LAYOUT_VAR_DIR,log_dir_path,pool); - - return dir_layout; -} - -static apt_bool_t apt_dir_entry_id_by_label(const char **labels, apr_size_t count, const char *name, apr_size_t *id) -{ - apr_size_t i; - for(i=0; ifirst_cdata.first || !elem->first_cdata.first->text) { - return NULL; - } - - path = apr_pstrdup(pool,elem->first_cdata.first->text); - apr_collapse_spaces(path,path); - - /* Check if path is absolute or relative */ - status = apt_dir_is_path_absolute(path,pool); - if(status == APR_SUCCESS) { - /* Absolute path specified */ - return path; - } - else if (status == APR_ERELATIVE) { - /* Relative path specified -> merge it with the root path */ - if(apr_filepath_merge(&full_path,root_dir_path,path,APR_FILEPATH_NATIVE,pool) == APR_SUCCESS) { - return full_path; - } - } - - /* WARNING: invalid path specified */ - return NULL; -} - -APT_DECLARE(apt_bool_t) apt_dir_layout_load(apt_dir_layout_t *dir_layout, const char *config_file, apr_pool_t *pool) -{ - return apt_dir_layout_load_ext(dir_layout,config_file,default_labels,APT_LAYOUT_DIR_COUNT,pool); -} - -APT_DECLARE(apt_bool_t) apt_dir_layout_load_ext(apt_dir_layout_t *dir_layout, const char *config_file, const char **labels, apr_size_t count, apr_pool_t *pool) -{ - apr_xml_doc *doc; - const apr_xml_elem *elem; - const apr_xml_elem *root; - const apr_xml_attr *xml_attr; - char *path; - const char *root_dir_path = NULL; - apr_size_t id; - - if(!dir_layout || !config_file || !labels || !count) { - return FALSE; - } - - /* Parse XML document */ - doc = apt_dir_layout_doc_parse(config_file,pool); - if(!doc) { - return FALSE; - } - - root = doc->root; - - /* Match document name */ - if(!root || strcasecmp(root->name,"dirlayout") != 0) { - /* Unknown document */ - return FALSE; - } - - /* Find rootdir attribute */ - for(xml_attr = root->attr; xml_attr; xml_attr = xml_attr->next) { - if(strcasecmp(xml_attr->name, "rootdir") == 0) { - root_dir_path = xml_attr->value; - break; - } - } - - if(root_dir_path) { - /* If root dir path is specified, check if it is absolute or relative */ - apr_status_t status = apt_dir_is_path_absolute(root_dir_path,pool); - if(status == APR_ERELATIVE) { - /* Relative path specified -> make it absolute */ - char *full_path; - char *cur_dir_path; - /* Get the current directory */ - if(apr_filepath_get(&cur_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) - return FALSE; - - /* Merge it with path specified */ - if(apr_filepath_merge(&full_path,cur_dir_path,root_dir_path,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) - return FALSE; - root_dir_path = full_path; - } - } - else { - /* If root dir path is not specified, get the default one */ - root_dir_path = apt_default_root_dir_path_get(pool); - } - - /* Navigate through document */ - for(elem = root->first_child; elem; elem = elem->next) { - if(apt_dir_entry_id_by_label(labels,dir_layout->count,elem->name,&id) == TRUE) { - path = apt_dir_layout_subdir_parse(root_dir_path,elem,pool); - if(path) { - apt_dir_layout_path_set_internal(dir_layout,id,path); - } - } - else { - /* Unknown element */ - } - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_dir_layout_path_set(apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *path, apr_pool_t *pool) -{ - if(!dir_layout || dir_entry_id >= dir_layout->count || !path) - return FALSE; - - dir_layout->paths[dir_entry_id] = apr_pstrdup(pool,path); - return TRUE; -} - -APT_DECLARE(const char*) apt_dir_layout_path_get(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id) -{ - if(!dir_layout || dir_entry_id >= dir_layout->count) - return NULL; - - return dir_layout->paths[dir_entry_id]; -} - -APT_DECLARE(char*) apt_dir_layout_path_compose(const apt_dir_layout_t *dir_layout, apr_size_t dir_entry_id, const char *file_name, apr_pool_t *pool) -{ - char *file_path; - if(!dir_layout || dir_entry_id >= dir_layout->count) - return NULL; - - if(apr_filepath_merge(&file_path,dir_layout->paths[dir_entry_id],file_name,APR_FILEPATH_NATIVE,pool) == APR_SUCCESS) { - return file_path; - } - return NULL; -} - -APT_DECLARE(char*) apt_confdir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool) -{ - return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_CONF_DIR,file_name,pool); -} - -APT_DECLARE(char*) apt_datadir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool) -{ - return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_DATA_DIR,file_name,pool); -} - -APT_DECLARE(char*) apt_vardir_filepath_get(const apt_dir_layout_t *dir_layout, const char *file_name, apr_pool_t *pool) -{ - return apt_dir_layout_path_compose(dir_layout,APT_LAYOUT_VAR_DIR,file_name,pool); -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c b/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c deleted file mode 100644 index a00fcb5ec5..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_header_field.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_header_field.c 2223 2014-11-12 00:37:40Z achaloyan@gmail.com $ - */ - -#include "apt_header_field.h" -#include "apt_text_stream.h" - -#define UNKNOWN_HEADER_FIELD_ID (apr_size_t)-1 - -/** Allocate an empty header field */ -APT_DECLARE(apt_header_field_t*) apt_header_field_alloc(apr_pool_t *pool) -{ - apt_header_field_t *header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - apt_string_reset(&header_field->name); - apt_string_reset(&header_field->value); - header_field->id = UNKNOWN_HEADER_FIELD_ID; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/** Create a header field using given name and value APT strings */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create(const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - if(!name || !value) { - return NULL; - } - header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - apt_string_copy(&header_field->name,name,pool); - apt_string_copy(&header_field->value,value,pool); - header_field->id = UNKNOWN_HEADER_FIELD_ID; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/** Create a header field using given name and value C strings */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create_c(const char *name, const char *value, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - if(!name || !value) { - return NULL; - } - header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - apt_string_assign(&header_field->name,name,pool); - apt_string_assign(&header_field->value,value,pool); - header_field->id = UNKNOWN_HEADER_FIELD_ID; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/* Create a header field from entire text line consisting of a name and value pair */ -APT_DECLARE(apt_header_field_t*) apt_header_field_create_from_line(const apt_str_t *line, char separator, apr_pool_t *pool) -{ - apt_str_t item; - apt_text_stream_t stream; - apt_header_field_t *header_field; - if(!line) { - return NULL; - } - - header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - stream.text = *line; - apt_text_stream_reset(&stream); - - /* read name */ - if(apt_text_field_read(&stream,separator,TRUE,&item) == FALSE) { - return NULL; - } - apt_string_copy(&header_field->name,&item,pool); - - /* read value */ - if(apt_text_field_read(&stream,0,TRUE,&item) == TRUE) { - apt_string_copy(&header_field->value,&item,pool); - } - else { - apt_string_reset(&header_field->value); - } - - header_field->id = UNKNOWN_HEADER_FIELD_ID; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/** Copy specified header field */ -APT_DECLARE(apt_header_field_t*) apt_header_field_copy(const apt_header_field_t *src_header_field, apr_pool_t *pool) -{ - apt_header_field_t *header_field = apr_palloc(pool,sizeof(apt_header_field_t)); - apt_string_copy(&header_field->name,&src_header_field->name,pool); - apt_string_copy(&header_field->value,&src_header_field->value,pool); - header_field->id = src_header_field->id; - APR_RING_ELEM_INIT(header_field,link); - return header_field; -} - -/** Initialize header section (collection of header fields) */ -APT_DECLARE(void) apt_header_section_init(apt_header_section_t *header) -{ - APR_RING_INIT(&header->ring, apt_header_field_t, link); - header->arr = NULL; - header->arr_size = 0; -} - -/** Allocate header section to set/get header fields by numeric identifiers */ -APT_DECLARE(apt_bool_t) apt_header_section_array_alloc(apt_header_section_t *header, apr_size_t max_field_count, apr_pool_t *pool) -{ - if(!max_field_count) { - return FALSE; - } - - header->arr = (apt_header_field_t**)apr_pcalloc(pool,sizeof(apt_header_field_t*) * max_field_count); - header->arr_size = max_field_count; - return TRUE; -} - -/** Add (append) header field to header section */ -APT_DECLARE(apt_bool_t) apt_header_section_field_add(apt_header_section_t *header, apt_header_field_t *header_field) -{ - if(header_field->id < header->arr_size) { - if(header->arr[header_field->id]) { - return FALSE; - } - header->arr[header_field->id] = header_field; - } - APR_RING_INSERT_TAIL(&header->ring,header_field,apt_header_field_t,link); - return TRUE; -} - -/** Insert header field to header section based on numreic identifier if specified */ -APT_DECLARE(apt_bool_t) apt_header_section_field_insert(apt_header_section_t *header, apt_header_field_t *header_field) -{ - apt_header_field_t *it; - if(header_field->id < header->arr_size) { - if(header->arr[header_field->id]) { - return FALSE; - } - header->arr[header_field->id] = header_field; - - for(it = APR_RING_FIRST(&header->ring); - it != APR_RING_SENTINEL(&header->ring, apt_header_field_t, link); - it = APR_RING_NEXT(it, link)) { - if(header_field->id < it->id) { - APR_RING_INSERT_BEFORE(it,header_field,link); - return TRUE; - } - } - } - - APR_RING_INSERT_TAIL(&header->ring,header_field,apt_header_field_t,link); - return TRUE; -} - -/** Set header field in the array of header fields using associated numeric identifier */ -APT_DECLARE(apt_bool_t) apt_header_section_field_set(apt_header_section_t *header, apt_header_field_t *header_field) -{ - if(header_field->id >= header->arr_size) { - return FALSE; - } - if(header->arr[header_field->id]) { - return FALSE; - } - header->arr[header_field->id] = header_field; - return TRUE; -} - -/** Remove header field from header section */ -APT_DECLARE(apt_bool_t) apt_header_section_field_remove(apt_header_section_t *header, apt_header_field_t *header_field) -{ - if(header_field->id < header->arr_size) { - header->arr[header_field->id] = NULL; - } - APR_RING_REMOVE(header_field,link); - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_log.c b/libs/unimrcp/libs/apr-toolkit/src/apt_log.c deleted file mode 100644 index 844946cf46..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_log.c +++ /dev/null @@ -1,627 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_log.c 2198 2014-10-16 01:41:19Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include -#include "apt_log.h" - -#define MAX_LOG_ENTRY_SIZE 4096 -#define MAX_PRIORITY_NAME_LENGTH 9 - -static const char priority_snames[APT_PRIO_COUNT][MAX_PRIORITY_NAME_LENGTH+1] = -{ - "[EMERG] ", - "[ALERT] ", - "[CRITIC] ", - "[ERROR] ", - "[WARN] ", - "[NOTICE] ", - "[INFO] ", - "[DEBUG] " -}; - -typedef struct apt_log_file_data_t apt_log_file_data_t; - -struct apt_log_file_data_t { - const char *log_dir_path; - const char *log_file_name; - FILE *file; - apr_size_t cur_size; - apr_size_t max_size; - apr_size_t cur_file_index; - apr_size_t max_file_count; - apt_bool_t append; - apr_thread_mutex_t *mutex; - apr_pool_t *pool; -}; - -struct apt_logger_t { - apt_log_output_e mode; - apt_log_priority_e priority; - int header; - apt_log_ext_handler_f ext_handler; - apt_log_file_data_t *file_data; - apt_log_masking_e masking; -}; - -static apt_logger_t *apt_logger = NULL; - -static apt_bool_t apt_do_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr); - -static const char* apt_log_file_path_make(apt_log_file_data_t *file_data); -static apt_bool_t apt_log_file_dump(apt_log_file_data_t *file_data, const char *log_entry, apr_size_t size); -static apr_xml_doc* apt_log_doc_parse(const char *file_path, apr_pool_t *pool); -static apr_size_t apt_log_file_get_size(apt_log_file_data_t *file_data); -static apr_byte_t apt_log_file_exist(apt_log_file_data_t *file_data); - -static apt_logger_t* apt_log_instance_alloc(apr_pool_t *pool) -{ - apt_logger_t *logger = apr_palloc(pool,sizeof(apt_logger_t)); - logger->mode = APT_LOG_OUTPUT_CONSOLE; - logger->priority = APT_PRIO_INFO; - logger->header = APT_LOG_HEADER_DEFAULT; - logger->ext_handler = NULL; - logger->file_data = NULL; - logger->masking = APT_LOG_MASKING_NONE; - return logger; -} - -APT_DECLARE(apt_bool_t) apt_log_instance_create(apt_log_output_e mode, apt_log_priority_e priority, apr_pool_t *pool) -{ - if(apt_logger) { - return FALSE; - } - apt_logger = apt_log_instance_alloc(pool); - apt_logger->mode = mode; - apt_logger->priority = priority; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_instance_load(const char *config_file, apr_pool_t *pool) -{ - apr_xml_doc *doc; - const apr_xml_elem *elem; - const apr_xml_elem *root; - char *text; - - if(apt_logger) { - return FALSE; - } - apt_logger = apt_log_instance_alloc(pool); - - /* Parse XML document */ - doc = apt_log_doc_parse(config_file,pool); - if(!doc) { - return FALSE; - } - - root = doc->root; - - /* Match document name */ - if(!root || strcasecmp(root->name,"aptlogger") != 0) { - /* Unknown document */ - return FALSE; - } - - /* Navigate through document */ - for(elem = root->first_child; elem; elem = elem->next) { - if(!elem->first_cdata.first || !elem->first_cdata.first->text) - continue; - - text = apr_pstrdup(pool,elem->first_cdata.first->text); - apr_collapse_spaces(text,text); - - if(strcasecmp(elem->name,"priority") == 0) { - apt_logger->priority = apt_log_priority_translate(text); - } - else if(strcasecmp(elem->name,"output") == 0) { - apt_logger->mode = apt_log_output_mode_translate(text); - } - else if(strcasecmp(elem->name,"headers") == 0) { - apt_logger->header = apt_log_header_translate(text); - } - else if(strcasecmp(elem->name,"masking") == 0) { - apt_logger->masking = apt_log_masking_translate(text); - } - else { - /* Unknown element */ - } - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_instance_destroy() -{ - if(!apt_logger) { - return FALSE; - } - - if(apt_logger->file_data) { - apt_log_file_close(); - } - apt_logger = NULL; - return TRUE; -} - -APT_DECLARE(apt_logger_t*) apt_log_instance_get() -{ - return apt_logger; -} - -APT_DECLARE(apt_bool_t) apt_log_instance_set(apt_logger_t *logger) -{ - if(apt_logger){ - return FALSE; - } - apt_logger = logger; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_file_open( - const char *dir_path, - const char *file_name, - apr_size_t max_file_size, - apr_size_t max_file_count, - apt_bool_t append, - apr_pool_t *pool) -{ - const char *log_file_path; - apt_log_file_data_t *file_data; - if(!apt_logger || !dir_path || !file_name) { - return FALSE; - } - - if(apt_logger->file_data) { - return FALSE; - } - - file_data = apr_palloc(pool,sizeof(apt_log_file_data_t)); - file_data->log_dir_path = apr_pstrdup(pool,dir_path); - file_data->log_file_name = apr_pstrdup(pool,file_name); - file_data->cur_file_index = 0; - file_data->cur_size = 0; - file_data->max_file_count = max_file_count; - file_data->max_size = max_file_size; - file_data->append = append; - file_data->mutex = NULL; - file_data->pool = pool; - - if(!file_data->max_size) { - file_data->max_size = MAX_LOG_FILE_SIZE; - } - if(!file_data->max_file_count) { - file_data->max_file_count = MAX_LOG_FILE_COUNT; - } - - if(file_data->append == TRUE) { - /* iteratively find the last created file */ - while(file_data->cur_file_indexmax_file_count) - { - if(apt_log_file_exist(file_data) == 0) - { - if(file_data->cur_file_index > 0) - file_data->cur_file_index--; - file_data->cur_size = apt_log_file_get_size(file_data); - break; - } - file_data->cur_file_index++; - } - - /* if all the files have been created start rewriting from beginning */ - if(file_data->cur_file_index>=file_data->max_file_count) - { - file_data->cur_file_index=0; - file_data->cur_size=0; - log_file_path = apt_log_file_path_make(file_data); - file_data->file = fopen(log_file_path,"wb"); /* truncate the first file to zero length */ - fclose(file_data->file); - } - } - - /* create mutex */ - if(apr_thread_mutex_create(&file_data->mutex,APR_THREAD_MUTEX_DEFAULT,pool) != APR_SUCCESS) { - return FALSE; - } - /* open log file */ - log_file_path = apt_log_file_path_make(file_data); - file_data->file = fopen(log_file_path,file_data->append == TRUE ? "ab" : "wb"); - if(!file_data->file) { - apr_thread_mutex_destroy(file_data->mutex); - return FALSE; - } - - apt_logger->file_data = file_data; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_file_close() -{ - apt_log_file_data_t *file_data; - if(!apt_logger || !apt_logger->file_data) { - return FALSE; - } - file_data = apt_logger->file_data; - if(file_data->file) { - /* close log file */ - fclose(file_data->file); - file_data->file = NULL; - /* destroy mutex */ - apr_thread_mutex_destroy(file_data->mutex); - file_data->mutex = NULL; - } - apt_logger->file_data = NULL; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_output_mode_set(apt_log_output_e mode) -{ - if(!apt_logger) { - return FALSE; - } - apt_logger->mode = mode; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log_output_mode_check(apt_log_output_e mode) -{ - if(!apt_logger) { - return FALSE; - } - return (apt_logger->mode & mode) ? TRUE : FALSE; -} - -APT_DECLARE(int) apt_log_output_mode_translate(char *str) -{ - int mode = APT_LOG_OUTPUT_NONE; - char *name; - char *last; - name = apr_strtok(str, ",", &last); - while(name) { - if(strcasecmp(name, "CONSOLE") == 0) - mode |= APT_LOG_OUTPUT_CONSOLE; - else if(strcasecmp(name, "FILE") == 0) - mode |= APT_LOG_OUTPUT_FILE; - - name = apr_strtok(NULL, ",", &last); - } - return mode; -} - -APT_DECLARE(apt_bool_t) apt_log_priority_set(apt_log_priority_e priority) -{ - if(!apt_logger || priority >= APT_PRIO_COUNT) { - return FALSE; - } - apt_logger->priority = priority; - return TRUE; -} - -APT_DECLARE(apt_log_priority_e) apt_log_priority_translate(const char *str) -{ - if(strcasecmp(str, "EMERGENCY") == 0) - return APT_PRIO_EMERGENCY; - else if(strcasecmp(str, "ALERT") == 0) - return APT_PRIO_ALERT; - else if(strcasecmp(str, "CRITICAL") == 0) - return APT_PRIO_CRITICAL; - else if(strcasecmp(str, "ERROR") == 0) - return APT_PRIO_ERROR; - else if(strcasecmp(str, "WARNING") == 0) - return APT_PRIO_WARNING; - else if(strcasecmp(str, "NOTICE") == 0) - return APT_PRIO_NOTICE; - else if(strcasecmp(str, "INFO") == 0) - return APT_PRIO_INFO; - else if(strcasecmp(str, "DEBUG") == 0) - return APT_PRIO_DEBUG; - - return APT_PRIO_DEBUG; -} - -APT_DECLARE(apt_bool_t) apt_log_header_set(int header) -{ - if(!apt_logger) { - return FALSE; - } - apt_logger->header = header; - return TRUE; -} - -APT_DECLARE(int) apt_log_header_translate(char *str) -{ - int header = APT_LOG_OUTPUT_NONE; - char *name; - char *last; - name = apr_strtok(str, ",", &last); - while(name) { - if(strcasecmp(name, "DATE") == 0) - header |= APT_LOG_HEADER_DATE; - else if(strcasecmp(name, "TIME") == 0) - header |= APT_LOG_HEADER_TIME; - else if(strcasecmp(name, "PRIORITY") == 0) - header |= APT_LOG_HEADER_PRIORITY; - else if(strcasecmp(name, "MARK") == 0) - header |= APT_LOG_HEADER_MARK; - else if(strcasecmp(name, "THREAD") == 0) - header |= APT_LOG_HEADER_THREAD; - - name = apr_strtok(NULL, ",", &last); - } - return header; -} - -APT_DECLARE(apt_bool_t) apt_log_masking_set(apt_log_masking_e masking) -{ - if(!apt_logger) { - return FALSE; - } - apt_logger->masking = masking; - return TRUE; -} - -APT_DECLARE(apt_log_masking_e) apt_log_masking_get(void) -{ - if(!apt_logger) { - return APT_LOG_MASKING_NONE; - } - return apt_logger->masking; -} - -APT_DECLARE(apt_log_masking_e) apt_log_masking_translate(const char *str) -{ - if(strcasecmp(str, "COMPLETE") == 0) - return APT_LOG_MASKING_COMPLETE; - else if(strcasecmp(str, "ENCRYPTED") == 0) - return APT_LOG_MASKING_ENCRYPTED; - return APT_LOG_MASKING_NONE; -} - -#define APT_MASKED_CONTENT "*** masked ***" - -APT_DECLARE(const char*) apt_log_data_mask(const char *data_in, apr_size_t *length, apr_pool_t *pool) -{ - if(!apt_logger) { - return NULL; - } - if(apt_logger->masking == APT_LOG_MASKING_COMPLETE) { - *length = sizeof(APT_MASKED_CONTENT) - 1; - return APT_MASKED_CONTENT; - } - return data_in; -} - -APT_DECLARE(apt_bool_t) apt_log_ext_handler_set(apt_log_ext_handler_f handler) -{ - if(!apt_logger) { - return FALSE; - } - apt_logger->ext_handler = handler; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_log(const char *file, int line, apt_log_priority_e priority, const char *format, ...) -{ - apt_bool_t status = TRUE; - if(!apt_logger) { - return FALSE; - } - if(priority <= apt_logger->priority) { - va_list arg_ptr; - va_start(arg_ptr, format); - if(apt_logger->ext_handler) { - status = apt_logger->ext_handler(file,line,NULL,priority,format,arg_ptr); - } - else { - status = apt_do_log(file,line,priority,format,arg_ptr); - } - va_end(arg_ptr); - } - return status; -} - -APT_DECLARE(apt_bool_t) apt_obj_log(const char *file, int line, apt_log_priority_e priority, void *obj, const char *format, ...) -{ - apt_bool_t status = TRUE; - if(!apt_logger) { - return FALSE; - } - if(priority <= apt_logger->priority) { - va_list arg_ptr; - va_start(arg_ptr, format); - if(apt_logger->ext_handler) { - status = apt_logger->ext_handler(file,line,obj,priority,format,arg_ptr); - } - else { - status = apt_do_log(file,line,priority,format,arg_ptr); - } - va_end(arg_ptr); - } - return status; -} - -APT_DECLARE(apt_bool_t) apt_va_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr) -{ - apt_bool_t status = TRUE; - if(!apt_logger) { - return FALSE; - } - if(priority <= apt_logger->priority) { - if(apt_logger->ext_handler) { - status = apt_logger->ext_handler(file,line,NULL,priority,format,arg_ptr); - } - else { - status = apt_do_log(file,line,priority,format,arg_ptr); - } - } - return status; -} - -static APR_INLINE unsigned long apt_thread_id_get(void) -{ -#ifdef WIN32 - return (unsigned long) GetCurrentThreadId(); -#else - return (unsigned long) apr_os_thread_current(); -#endif -} - -static apt_bool_t apt_do_log(const char *file, int line, apt_log_priority_e priority, const char *format, va_list arg_ptr) -{ - char log_entry[MAX_LOG_ENTRY_SIZE]; - apr_size_t max_size = MAX_LOG_ENTRY_SIZE - 2; - apr_size_t offset = 0; - apr_time_exp_t result; - apr_time_t now = apr_time_now(); - apr_time_exp_lt(&result,now); - - if(apt_logger->header & APT_LOG_HEADER_DATE) { - offset += apr_snprintf(log_entry+offset,max_size-offset,"%4d-%02d-%02d ", - result.tm_year+1900, - result.tm_mon+1, - result.tm_mday); - } - if(apt_logger->header & APT_LOG_HEADER_TIME) { - offset += apr_snprintf(log_entry+offset,max_size-offset,"%02d:%02d:%02d:%06d ", - result.tm_hour, - result.tm_min, - result.tm_sec, - result.tm_usec); - } - if(apt_logger->header & APT_LOG_HEADER_MARK) { - offset += apr_snprintf(log_entry+offset,max_size-offset,"%s:%03d ",file,line); - } - if(apt_logger->header & APT_LOG_HEADER_THREAD) { - offset += apr_snprintf(log_entry+offset,max_size-offset,"%05lu ",apt_thread_id_get()); - } - if(apt_logger->header & APT_LOG_HEADER_PRIORITY) { - memcpy(log_entry+offset,priority_snames[priority],MAX_PRIORITY_NAME_LENGTH); - offset += MAX_PRIORITY_NAME_LENGTH; - } - - offset += apr_vsnprintf(log_entry+offset,max_size-offset,format,arg_ptr); - log_entry[offset++] = '\n'; - log_entry[offset] = '\0'; - if((apt_logger->mode & APT_LOG_OUTPUT_CONSOLE) == APT_LOG_OUTPUT_CONSOLE) { - fwrite(log_entry,offset,1,stdout); - } - - if((apt_logger->mode & APT_LOG_OUTPUT_FILE) == APT_LOG_OUTPUT_FILE && apt_logger->file_data) { - apt_log_file_dump(apt_logger->file_data,log_entry,offset); - } - return TRUE; -} - -static const char* apt_log_file_path_make(apt_log_file_data_t *file_data) -{ - char *log_file_path = NULL; - const char *log_file_name = apr_psprintf(file_data->pool,"%s-%.2"APR_SIZE_T_FMT".log", - file_data->log_file_name, - file_data->cur_file_index); - apr_filepath_merge(&log_file_path, - file_data->log_dir_path, - log_file_name, - APR_FILEPATH_NATIVE, - file_data->pool); - return log_file_path; -} - -static apr_size_t apt_log_file_get_size(apt_log_file_data_t *file_data) -{ - FILE* fp; - const char *log_file_path; - apr_size_t ret; - - log_file_path = apt_log_file_path_make(file_data); - fp = fopen(log_file_path,"rb"); - - if(!fp) return 0; - - fseek(fp,0,SEEK_END); - ret = ftell(fp); - - fclose(fp); - - return ret; -} - -static apr_byte_t apt_log_file_exist(apt_log_file_data_t *file_data) -{ - FILE* fp; - const char *log_file_path; - - log_file_path = apt_log_file_path_make(file_data); - fp = fopen(log_file_path,"rb"); - - if(!fp) return 0; - - fclose(fp); - - return 1; -} - -static apt_bool_t apt_log_file_dump(apt_log_file_data_t *file_data, const char *log_entry, apr_size_t size) -{ - apr_thread_mutex_lock(file_data->mutex); - - file_data->cur_size += size; - if(file_data->cur_size > file_data->max_size) { - const char *log_file_path; - /* close current log file */ - fclose(file_data->file); - /* roll over the next log file */ - file_data->cur_file_index++; - file_data->cur_file_index %= file_data->max_file_count; - /* open log file */ - log_file_path = apt_log_file_path_make(file_data); - file_data->file = fopen(log_file_path,"wb"); - if(!file_data->file) { - return FALSE; - } - - file_data->cur_size = size; - } - /* write to log file */ - fwrite(log_entry,1,size,file_data->file); - fflush(file_data->file); - - apr_thread_mutex_unlock(file_data->mutex); - return TRUE; -} - -static apr_xml_doc* apt_log_doc_parse(const char *file_path, apr_pool_t *pool) -{ - apr_xml_parser *parser = NULL; - apr_xml_doc *xml_doc = NULL; - apr_file_t *fd = NULL; - apr_status_t rv; - - rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool); - if(rv != APR_SUCCESS) { - return NULL; - } - - rv = apr_xml_parse_file(pool,&parser,&xml_doc,fd,2000); - if(rv != APR_SUCCESS) { - xml_doc = NULL; - } - - apr_file_close(fd); - return xml_doc; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c b/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c deleted file mode 100644 index 46254723ab..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_multipart_content.c +++ /dev/null @@ -1,312 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_multipart_content.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_multipart_content.h" -#include "apt_text_stream.h" -#include "apt_text_message.h" - -#define CONTENT_LENGTH_HEADER "Content-Length" -#define CONTENT_TYPE_HEADER "Content-Type" -#define CONTENT_ID_HEADER "Content-Id" - -#define DEFAULT_BOUNDARY "break" -#define DEFAULT_HYPHENS "--" - -#define DEFAULT_MULTIPART_CONTENT_SIZE 4096 - -/** Multipart content */ -struct apt_multipart_content_t { - apr_pool_t *pool; - apt_text_stream_t stream; - - apt_str_t boundary; - apt_str_t hyphens; -}; - -/** Create an empty multipart content */ -APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_create(apr_size_t max_content_size, const apt_str_t *boundary, apr_pool_t *pool) -{ - char *buffer; - apt_multipart_content_t *multipart_content = apr_palloc(pool,sizeof(apt_multipart_content_t)); - multipart_content->pool = pool; - - if(max_content_size == 0) { - max_content_size = DEFAULT_MULTIPART_CONTENT_SIZE; - } - - if(boundary) { - multipart_content->boundary = *boundary; - } - else { - multipart_content->boundary.buf = DEFAULT_BOUNDARY; - multipart_content->boundary.length = sizeof(DEFAULT_BOUNDARY)-1; - } - - multipart_content->hyphens.buf = DEFAULT_HYPHENS; - multipart_content->hyphens.length = sizeof(DEFAULT_HYPHENS)-1; - - buffer = apr_palloc(pool,max_content_size+1); - apt_text_stream_init(&multipart_content->stream,buffer,max_content_size); - return multipart_content; -} - -/** Initialize content part generation */ -static apt_bool_t apt_multipart_content_initialize(apt_multipart_content_t *multipart_content) -{ - /* insert preceding end-of-line */ - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return FALSE; - } - /* insert hyphens */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) { - return FALSE; - } - /* insert boundary */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->boundary) == FALSE) { - return FALSE; - } - return apt_text_eol_insert(&multipart_content->stream); -} - -/** Add content part to multipart content */ -APT_DECLARE(apt_bool_t) apt_multipart_content_add(apt_multipart_content_t *multipart_content, const apt_content_part_t *content_part) -{ - if(!content_part) { - return FALSE; - } - - /* insert preceding eol, hyppens and boudnary */ - if(apt_multipart_content_initialize(multipart_content) == FALSE) { - return FALSE; - } - - /* insert header fields */ - if(apt_header_section_generate(&content_part->header,&multipart_content->stream) == FALSE) { - return FALSE; - } - - /* insert body */ - return apt_text_string_insert(&multipart_content->stream,&content_part->body); -} - -/** Add content part to multipart content by specified header fields and body */ -APT_DECLARE(apt_bool_t) apt_multipart_content_add2(apt_multipart_content_t *multipart_content, const apt_str_t *content_type, const apt_str_t *content_id, const apt_str_t *body) -{ - /* insert preceding eol, hyppens and boudnary */ - if(apt_multipart_content_initialize(multipart_content) == FALSE) { - return FALSE; - } - - /* insert content-type */ - if(content_type) { - apt_str_t name = {CONTENT_TYPE_HEADER,sizeof(CONTENT_TYPE_HEADER)-1}; - if(apt_text_name_value_insert(&multipart_content->stream,&name,content_type) == FALSE) { - return FALSE; - } - } - - /* insert content-id */ - if(content_id) { - apt_str_t name = {CONTENT_ID_HEADER,sizeof(CONTENT_ID_HEADER)-1}; - if(apt_text_name_value_insert(&multipart_content->stream,&name,content_id) == FALSE) { - return FALSE; - } - } - - /* insert content-length */ - if(body) { - apt_str_t name = {CONTENT_LENGTH_HEADER,sizeof(CONTENT_LENGTH_HEADER)-1}; - if(apt_text_header_name_insert(&multipart_content->stream,&name) == FALSE) { - return FALSE; - } - if(apt_text_size_value_insert(&multipart_content->stream,body->length) == FALSE) { - return FALSE; - } - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return FALSE; - } - } - - /* insert empty line */ - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return FALSE; - } - - /* insert body */ - if(body) { - if(apt_text_string_insert(&multipart_content->stream,body) == FALSE) { - return FALSE; - } - } - return TRUE; -} - -/** Finalize multipart content generation */ -APT_DECLARE(apt_str_t*) apt_multipart_content_finalize(apt_multipart_content_t *multipart_content) -{ - apt_text_stream_t *stream = &multipart_content->stream; - /* insert preceding end-of-line */ - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return NULL; - } - /* insert hyphens */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) { - return NULL; - } - /* insert boundary */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->boundary) == FALSE) { - return NULL; - } - /* insert final hyphens */ - if(apt_text_string_insert(&multipart_content->stream,&multipart_content->hyphens) == FALSE) { - return NULL; - } - if(apt_text_eol_insert(&multipart_content->stream) == FALSE) { - return NULL; - } - - stream->text.length = stream->pos - stream->text.buf; - stream->text.buf[stream->text.length] = '\0'; - return &stream->text; -} - - -/** Assign body to multipart content to get (parse) each content part from */ -APT_DECLARE(apt_multipart_content_t*) apt_multipart_content_assign(const apt_str_t *body, const apt_str_t *boundary, apr_pool_t *pool) -{ - apt_multipart_content_t *multipart_content = apr_palloc(pool,sizeof(apt_multipart_content_t)); - multipart_content->pool = pool; - - if(!body) { - return FALSE; - } - - if(boundary) { - multipart_content->boundary = *boundary; - } - else { - apt_string_reset(&multipart_content->boundary); - } - - apt_string_reset(&multipart_content->hyphens); - apt_text_stream_init(&multipart_content->stream,body->buf,body->length); - return multipart_content; -} - -static APR_INLINE void apt_content_part_reset(apt_content_part_t *content_part) -{ - apt_header_section_init(&content_part->header); - apt_string_reset(&content_part->body); - content_part->type = NULL; - content_part->id = NULL; - content_part->length = NULL; -} - -/** Get the next content part */ -APT_DECLARE(apt_bool_t) apt_multipart_content_get(apt_multipart_content_t *multipart_content, apt_content_part_t *content_part, apt_bool_t *is_final) -{ - apt_str_t boundary; - apt_header_field_t *header_field; - apt_text_stream_t *stream = &multipart_content->stream; - - if(!content_part || !is_final) { - return FALSE; - } - *is_final = FALSE; - apt_content_part_reset(content_part); - - /* skip preamble */ - apt_text_skip_to_char(stream,'-'); - if(apt_text_is_eos(stream) == TRUE) { - return FALSE; - } - - /* skip initial hyphens */ - apt_text_chars_skip(stream,'-'); - if(apt_text_is_eos(stream) == TRUE) { - return FALSE; - } - - /* read line and the boundary */ - if(apt_text_line_read(stream,&boundary) == FALSE) { - return FALSE; - } - - /* remove optional trailing spaces */ - while(boundary.length && boundary.buf[boundary.length-1] == APT_TOKEN_SP) boundary.length--; - - /* check whether this is the final boundary */ - if(boundary.length >= 2) { - if(boundary.buf[boundary.length-1] == '-' && boundary.buf[boundary.length-2] == '-') { - /* final boundary */ - boundary.length -= 2; - *is_final = TRUE; - } - } - - /* compare boundaries */ - if(apt_string_is_empty(&multipart_content->boundary) == TRUE) { - /* no boundary was specified from user space, - learn boundary from the content */ - multipart_content->boundary = boundary; - } - else { - if(apt_string_compare(&multipart_content->boundary,&boundary) == FALSE) { - /* invalid boundary */ - return FALSE; - } - } - - if(*is_final == TRUE) { - /* final boundary => return TRUE, content remains empty */ - return TRUE; - } - - /* read header fields */ - if(apt_header_section_parse(&content_part->header,stream,multipart_content->pool) == FALSE) { - return FALSE; - } - - for(header_field = APR_RING_FIRST(&content_part->header.ring); - header_field != APR_RING_SENTINEL(&content_part->header.ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - if(strncmp(header_field->name.buf,CONTENT_LENGTH_HEADER,header_field->name.length) == 0) { - content_part->length = &header_field->value; - } - else if(strncmp(header_field->name.buf,CONTENT_TYPE_HEADER,header_field->name.length) == 0) { - content_part->type = &header_field->value; - } - else if(strncmp(header_field->name.buf,CONTENT_ID_HEADER,header_field->name.length) == 0) { - content_part->id = &header_field->value; - } - } - - if(content_part->length && apt_string_is_empty(content_part->length) == FALSE) { - apr_size_t length = atoi(content_part->length->buf); - if(length + stream->pos > stream->end) { - return FALSE; - } - - /* read content */ - apt_string_assign_n(&content_part->body,stream->pos,length,multipart_content->pool); - stream->pos += length; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_net.c b/libs/unimrcp/libs/apr-toolkit/src/apt_net.c deleted file mode 100644 index 398c71a99c..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_net.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_net.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_net.h" -#include "apt_log.h" - -/** Get the IP address (in numeric address string format) by hostname */ -apt_bool_t apt_ip_get(char **addr, apr_pool_t *pool) -{ - apr_sockaddr_t *sockaddr = NULL; - char hostname[APRMAXHOSTLEN+1]; - if(apr_gethostname(hostname,sizeof(hostname),pool) != APR_SUCCESS) { - return FALSE; - } - if(apr_sockaddr_info_get(&sockaddr,hostname,APR_INET,0,0,pool) != APR_SUCCESS) { - return FALSE; - } - if(apr_sockaddr_ip_get(addr,sockaddr) != APR_SUCCESS) { - return FALSE; - } - return TRUE; -} - -#ifdef WIN32 -#include -#pragma comment(lib, "IPHLPAPI.lib") -#else -#include -#include -#endif - -/** Get the IP address (in numeric address string format) by network interface name */ -apt_bool_t apt_ip_get_by_iface(const char *iface_name, char **addr, apr_pool_t *pool) -{ - apt_bool_t status = FALSE; -#ifdef WIN32 - /* See the usage of GetAdaptersInfo(). - * http://msdn.microsoft.com/en-us/library/windows/desktop/aa366314%28v=vs.85%29.aspx - */ - IP_ADAPTER_INFO *pAdapterInfo; - PIP_ADAPTER_INFO pAdapter; - ULONG ulOutBufLen; - DWORD dwRetVal; - - pAdapterInfo = (IP_ADAPTER_INFO *) malloc(sizeof(IP_ADAPTER_INFO)); - ulOutBufLen = sizeof(IP_ADAPTER_INFO); - - /* Make an initial call to GetAdaptersInfo to get the size needed into the ulOutBufLen variable. */ - if(GetAdaptersInfo(pAdapterInfo, &ulOutBufLen) != ERROR_SUCCESS) { - free(pAdapterInfo); - pAdapterInfo = (IP_ADAPTER_INFO *) malloc(ulOutBufLen); - } - - /* Make a second call to GetAdaptersInfo, passing pAdapterInfo and ulOutBufLen as parameters. */ - if((dwRetVal = GetAdaptersInfo(pAdapterInfo, &ulOutBufLen)) != ERROR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Adapters Info %d", dwRetVal); - return FALSE; - } - - /* Walk through linked list, maintaining head pointer. */ - pAdapter = pAdapterInfo; - while(pAdapter) { - /* Match human readable description with specified name. */ - if(strcasecmp(pAdapter->Description,iface_name) == 0) { - *addr = apr_pstrdup(pool,pAdapter->IpAddressList.IpAddress.String); - status = TRUE; - break; - } - - pAdapter = pAdapter->Next; - } - - if (pAdapterInfo) - free(pAdapterInfo); - -#else - - struct ifaddrs *ifaddr, *ifa; - int family, n; - char host[NI_MAXHOST]; - - if(getifaddrs(&ifaddr) == -1) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Interfaces"); - return FALSE; - } - - /* Walk through linked list, maintaining head pointer. */ - for(ifa = ifaddr, n = 0; ifa != NULL; ifa = ifa->ifa_next, n++) { - if(ifa->ifa_addr == NULL) continue; - - family = ifa->ifa_addr->sa_family; - if(family == AF_INET || family == AF_INET6) { - if(strcasecmp(ifa->ifa_name,iface_name) == 0) { - if(getnameinfo(ifa->ifa_addr, - (family == AF_INET) ? sizeof(struct sockaddr_in) : - sizeof(struct sockaddr_in6), - host, NI_MAXHOST, - NULL, 0, NI_NUMERICHOST) == 0) { - *addr = apr_pstrdup(pool,host); - status = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Name Info"); - } - break; - } - } - } - - freeifaddrs(ifaddr); -#endif - - if(status == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Found Address %s by Interface [%s]", *addr, iface_name); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Interface Found [%s]", iface_name); - } - return status; -} - -/** Seconds from Jan 1 1900 to Jan 1 1970 */ -#define NTP_TIME_OFFSET 2208988800UL - -/** Get current NTP time */ -void apt_ntp_time_get(apr_uint32_t *sec, apr_uint32_t *frac) -{ - apr_uint32_t t; - apr_uint32_t usec; - - apr_time_t now = apr_time_now(); - *sec = (apr_uint32_t)apr_time_sec(now) + NTP_TIME_OFFSET; - - usec = (apr_uint32_t) apr_time_usec(now); - t = (usec * 1825) >> 5; - *frac = ((usec << 12) + (usec << 8) - t); -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c b/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c deleted file mode 100644 index d6c866c0b6..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_nlsml_doc.c +++ /dev/null @@ -1,569 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_nlsml_doc.c 2177 2014-09-12 05:36:20Z achaloyan@gmail.com $ - */ - -#include -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include - -#include "apt_nlsml_doc.h" -#include "apt_log.h" - -/** NLSML result */ -struct nlsml_result_t -{ - /** List of interpretations */ - APR_RING_HEAD(apt_ir_head_t, nlsml_interpretation_t) interpretations; - /** List of enrollment results */ - APR_RING_HEAD(apt_er_head_t, nlsml_enrollment_result_t) enrollment_results; - /** List of verification results */ - APR_RING_HEAD(apt_vr_head_t, nlsml_verification_result_t) verification_results; - - /** Optional grammar attribute */ - const char *grammar; -}; - -/** NLSML instance */ -struct nlsml_instance_t -{ - /** Ring entry */ - APR_RING_ENTRY(nlsml_instance_t) link; - - /** Instance element */ - apr_xml_elem *elem; -}; - -/** NLSML input */ -struct nlsml_input_t -{ - /** Input element */ - apr_xml_elem *elem; - /** Input mode attribute [default: "speech"] */ - const char *mode; - /** Confidence attribute [default: 1.0] */ - float confidence; - /** Timestamp-start attribute */ - const char *timestamp_start; - /** Timestamp-end attribute */ - const char *timestamp_end; -}; - -/** NLSML interpretation */ -struct nlsml_interpretation_t -{ - /** Ring entry */ - APR_RING_ENTRY(nlsml_interpretation_t) link; - - /** List of instances */ - APR_RING_HEAD(apt_head_t, nlsml_instance_t) instances; - /** Input [0..1] */ - nlsml_input_t *input; - - /** Confidence attribute [default: 1.0] */ - float confidence; - /** Optional grammar attribute */ - const char *grammar; -}; - -struct nlsml_enrollment_result_t -{ - /** Ring entry */ - APR_RING_ENTRY(nlsml_enrollment_result_t) link; -}; - -struct nlsml_verification_result_t -{ - /** Ring entry */ - APR_RING_ENTRY(nlsml_verification_result_t) link; -}; - -/** Load NLSML document */ -static apr_xml_doc* nlsml_doc_load(const char *data, apr_size_t length, apr_pool_t *pool) -{ - apr_xml_parser *parser; - apr_xml_doc *doc = NULL; - const apr_xml_elem *root; - - if(!data || !length) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No NLSML data available"); - return NULL; - } - - /* create XML parser */ - parser = apr_xml_parser_create(pool); - if(apr_xml_parser_feed(parser,data,length) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to feed NLSML input to the parser"); - return NULL; - } - - /* done with XML tree creation */ - if(apr_xml_parser_done(parser,&doc) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to terminate NLSML parsing"); - return NULL; - } - - if(!doc || !doc->root) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No NLSML root element"); - return NULL; - } - root = doc->root; - - /* NLSML validity check: root element must be */ - if(strcmp(root->name,"result") != 0) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unexpected NLSML root element <%s>",root->name); - return NULL; - } - - return doc; -} - -/** Parse confidence value */ -static float nlsml_confidence_parse(const char *str) -{ - float confidence = (float) atof(str); - if(confidence > 1.0) - confidence /= 100; - - return confidence; -} - -/** Parse element */ -static nlsml_instance_t* nlsml_instance_parse(apr_xml_elem *elem, apr_pool_t *pool) -{ - /* Initialize instance */ - nlsml_instance_t *instance = apr_palloc(pool, sizeof(*instance)); - APR_RING_ELEM_INIT(instance,link); - instance->elem = elem; - - return instance; -} - -/** Parse element */ -static nlsml_input_t* nlsml_input_parse(apr_xml_elem *elem, apr_pool_t *pool) -{ - const apr_xml_attr *xml_attr; - /* Initialize input */ - nlsml_input_t *input = apr_palloc(pool, sizeof(*input)); - input->elem = elem; - input->mode = "speech"; - input->confidence = 1.0; - input->timestamp_start = NULL; - input->timestamp_end = NULL; - - /* Find input attributes */ - for(xml_attr = elem->attr; xml_attr; xml_attr = xml_attr->next) { - if(strcasecmp(xml_attr->name, "mode") == 0) { - input->mode = xml_attr->value; - } - else if(strcasecmp(xml_attr->name, "confidence") == 0) { - input->confidence = nlsml_confidence_parse(xml_attr->value); - } - else if(strcasecmp(xml_attr->name, "timestamp-start") == 0) { - input->timestamp_start = xml_attr->value; - } - else if(strcasecmp(xml_attr->name, "timestamp-end") == 0) { - input->timestamp_end = xml_attr->value; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, elem->name); - } - } - - return input; -} - -/** Parse element */ -static nlsml_interpretation_t* nlsml_interpretation_parse(apr_xml_elem *elem, apr_pool_t *pool) -{ - apr_xml_elem *child_elem; - const apr_xml_attr *xml_attr; - nlsml_instance_t *instance; - nlsml_input_t *input; - - /* Initialize interpretation */ - nlsml_interpretation_t *interpretation = apr_palloc(pool, sizeof(*interpretation)); - APR_RING_ELEM_INIT(interpretation,link); - interpretation->grammar = NULL; - interpretation->confidence = 1.0; - interpretation->input = NULL; - APR_RING_INIT(&interpretation->instances, nlsml_instance_t, link); - - /* Find optional grammar and confidence attributes */ - for(xml_attr = elem->attr; xml_attr; xml_attr = xml_attr->next) { - if(strcasecmp(xml_attr->name, "grammar") == 0) { - interpretation->grammar = xml_attr->value; - } - else if(strcasecmp(xml_attr->name, "confidence") == 0) { - interpretation->confidence = nlsml_confidence_parse(xml_attr->value); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, elem->name); - } - } - - /* Find input and instance elements */ - for(child_elem = elem->first_child; child_elem; child_elem = child_elem->next) { - if(strcasecmp(child_elem->name, "input") == 0) { - input = nlsml_input_parse(child_elem, pool); - if(input) { - interpretation->input = input; - } - } - else if(strcasecmp(child_elem->name, "instance") == 0) { - instance = nlsml_instance_parse(child_elem, pool); - if(instance) { - APR_RING_INSERT_TAIL(&interpretation->instances, instance, nlsml_instance_t, link); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown child element <%s> for <%s>", child_elem->name, elem->name); - } - } - - return interpretation; -} - -/** Parse element */ -static nlsml_enrollment_result_t* nlsml_enrollment_result_parse(const apr_xml_elem *elem, apr_pool_t *pool) -{ - /* To be done */ - return NULL; -} - -/** Parse element */ -static nlsml_verification_result_t* nlsml_verification_result_parse(const apr_xml_elem *elem, apr_pool_t *pool) -{ - /* To be done */ - return NULL; -} - -/** Parse NLSML result */ -APT_DECLARE(nlsml_result_t*) nlsml_result_parse(const char *data, apr_size_t length, apr_pool_t *pool) -{ - nlsml_result_t *result; - apr_xml_elem *root; - apr_xml_elem *child_elem; - const apr_xml_attr *xml_attr; - nlsml_interpretation_t *interpretation; - nlsml_enrollment_result_t *enrollment_result; - nlsml_verification_result_t *verification_result; - apr_xml_doc *doc; - /* Load XML document */ - doc = nlsml_doc_load(data, length, pool); - if(!doc) - return NULL; - - root = doc->root; - - /* Initialize result */ - result = apr_palloc(pool, sizeof(*result)); - APR_RING_INIT(&result->interpretations, nlsml_interpretation_t, link); - APR_RING_INIT(&result->enrollment_results, nlsml_enrollment_result_t, link); - APR_RING_INIT(&result->verification_results, nlsml_verification_result_t, link); - result->grammar = NULL; - - /* Find optional grammar attribute */ - for(xml_attr = root->attr; xml_attr; xml_attr = xml_attr->next) { - if(strcasecmp(xml_attr->name, "grammar") == 0) { - result->grammar = xml_attr->value; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown attribute '%s' for <%s>", xml_attr->name, root->name); - } - } - - /* Find interpretation, enrollment-result, or verification-result elements */ - for(child_elem = root->first_child; child_elem; child_elem = child_elem->next) { - if(strcasecmp(child_elem->name, "interpretation") == 0) { - interpretation = nlsml_interpretation_parse(child_elem, pool); - if(interpretation) { - APR_RING_INSERT_TAIL(&result->interpretations, interpretation, nlsml_interpretation_t, link); - } - } - else if(strcasecmp(child_elem->name, "enrollment-result") == 0) { - enrollment_result = nlsml_enrollment_result_parse(child_elem, pool); - if(enrollment_result) { - APR_RING_INSERT_TAIL(&result->enrollment_results, enrollment_result, nlsml_enrollment_result_t, link); - } - } - else if(strcasecmp(child_elem->name, "verification-result") == 0) { - verification_result = nlsml_verification_result_parse(child_elem, pool); - if(verification_result) { - APR_RING_INSERT_TAIL(&result->verification_results, verification_result, nlsml_verification_result_t, link); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown child element <%s> for <%s>", child_elem->name, root->name); - } - } - - if(APR_RING_EMPTY(&result->interpretations, nlsml_interpretation_t, link) && - APR_RING_EMPTY(&result->enrollment_results, nlsml_enrollment_result_t, link) && - APR_RING_EMPTY(&result->verification_results, nlsml_verification_result_t, link)) { - /* at least one of , , MUST be specified */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid NLSML document: at least one child element MUST be specified for <%s>", root->name); - } - - return result; -} - -/** Trace NLSML result (for debug purposes only) */ -APT_DECLARE(void) nlsml_result_trace(const nlsml_result_t *result, apr_pool_t *pool) -{ - int interpretation_count; - nlsml_interpretation_t *interpretation; - int instance_count; - nlsml_instance_t *instance; - nlsml_input_t *input; - const char *instance_data; - const char *input_data; - const char *timestamp_start; - const char *timestamp_end; - - if(result->grammar) - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Result.grammar: %s", result->grammar); - - interpretation_count = 0; - interpretation = nlsml_first_interpretation_get(result); - while(interpretation) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].confidence: %.2f", interpretation_count, nlsml_interpretation_confidence_get(interpretation)); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].grammar: %s", interpretation_count, nlsml_interpretation_grammar_get(interpretation)); - - instance_count = 0; - instance = nlsml_interpretation_first_instance_get(interpretation); - while(instance) { - nlsml_instance_swi_suppress(instance); - instance_data = nlsml_instance_content_generate(instance,pool); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].instance[%d]: %s", interpretation_count, instance_count, instance_data); - - instance_count++; - instance = nlsml_interpretation_next_instance_get(interpretation, instance); - } - - input = nlsml_interpretation_input_get(interpretation); - if(input) { - input_data = nlsml_input_content_generate(input,pool); - timestamp_start = nlsml_input_timestamp_start_get(input); - timestamp_end = nlsml_input_timestamp_end_get(input); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input: %s", interpretation_count, input_data); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.mode: %s", interpretation_count, nlsml_input_mode_get(input)); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.confidence: %.2f", interpretation_count, nlsml_input_confidence_get(input)); - if(timestamp_start) - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.timestamp-start: %s", interpretation_count, timestamp_start); - if(timestamp_end) - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Interpretation[%d].input.timestamp-end: %s", interpretation_count, timestamp_end); - } - - interpretation_count++; - interpretation = nlsml_next_interpretation_get(result, interpretation); - } -} - -/** Get first interpretation */ -APT_DECLARE(nlsml_interpretation_t*) nlsml_first_interpretation_get(const nlsml_result_t *result) -{ - nlsml_interpretation_t *first_interpretation = APR_RING_FIRST(&result->interpretations); - if(first_interpretation == APR_RING_SENTINEL(&result->interpretations, nlsml_interpretation_t, link)) - return NULL; - return first_interpretation; -} - -/** Get next interpretation */ -APT_DECLARE(nlsml_interpretation_t*) nlsml_next_interpretation_get(const nlsml_result_t *result, const nlsml_interpretation_t *interpretation) -{ - nlsml_interpretation_t *next_interpretation = APR_RING_NEXT(interpretation, link); - if(next_interpretation == APR_RING_SENTINEL(&result->interpretations, nlsml_interpretation_t, link)) - return NULL; - return next_interpretation; -} - -/** Get first enrollment result */ -APT_DECLARE(nlsml_enrollment_result_t*) nlsml_first_enrollment_result_get(const nlsml_result_t *result) -{ - nlsml_enrollment_result_t *first_enrollment_result = APR_RING_FIRST(&result->enrollment_results); - if(first_enrollment_result == APR_RING_SENTINEL(&result->enrollment_results, nlsml_enrollment_result_t, link)) - return NULL; - return first_enrollment_result; -} - -/** Get next enrollment result */ -APT_DECLARE(nlsml_enrollment_result_t*) nlsml_next_enrollment_result_get(const nlsml_result_t *result, const nlsml_enrollment_result_t *enrollment_result) -{ - nlsml_enrollment_result_t *next_enrollment_result = APR_RING_NEXT(enrollment_result, link); - if(next_enrollment_result == APR_RING_SENTINEL(&result->enrollment_results, nlsml_enrollment_result_t, link)) - return NULL; - return next_enrollment_result; -} - -/** Get first verification result */ -APT_DECLARE(nlsml_verification_result_t*) nlsml_first_verification_result_get(const nlsml_result_t *result) -{ - nlsml_verification_result_t *first_verification_result = APR_RING_FIRST(&result->verification_results); - if(first_verification_result == APR_RING_SENTINEL(&result->verification_results, nlsml_verification_result_t, link)) - return NULL; - return first_verification_result; -} - -/** Get next verification result */ -APT_DECLARE(nlsml_verification_result_t*) nlsml_next_verification_result_get(const nlsml_result_t *result, const nlsml_verification_result_t *verification_result) -{ - nlsml_verification_result_t *next_verification_result = APR_RING_NEXT(verification_result, link); - if(next_verification_result == APR_RING_SENTINEL(&result->verification_results, nlsml_verification_result_t, link)) - return NULL; - return next_verification_result; -} - -/** Get grammar attribute of NLSML result */ -APT_DECLARE(const char*) nlsml_result_grammar_get(const nlsml_result_t *result) -{ - return result->grammar; -} - -/** Get first instance */ -APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_first_instance_get(const nlsml_interpretation_t *interpretation) -{ - nlsml_instance_t *first_instance = APR_RING_FIRST(&interpretation->instances); - if(first_instance == APR_RING_SENTINEL(&interpretation->instances, nlsml_instance_t, link)) - return NULL; - return first_instance; -} - -/** Get next instance */ -APT_DECLARE(nlsml_instance_t*) nlsml_interpretation_next_instance_get(const nlsml_interpretation_t *interpretation, const nlsml_instance_t *instance) -{ - nlsml_instance_t *next_instance = APR_RING_NEXT(instance, link); - if(next_instance == APR_RING_SENTINEL(&interpretation->instances, nlsml_instance_t, link)) - return NULL; - return next_instance; -} - -/** Get input */ -APT_DECLARE(nlsml_input_t*) nlsml_interpretation_input_get(const nlsml_interpretation_t *interpretation) -{ - return interpretation->input; -} - -/** Get interpretation confidence */ -APT_DECLARE(float) nlsml_interpretation_confidence_get(const nlsml_interpretation_t *interpretation) -{ - return interpretation->confidence; -} - -/** Get interpretation grammar */ -APT_DECLARE(const char*) nlsml_interpretation_grammar_get(const nlsml_interpretation_t *interpretation) -{ - return interpretation->grammar; -} - -/** Get instance element */ -APT_DECLARE(const apr_xml_elem*) nlsml_instance_elem_get(const nlsml_instance_t *instance) -{ - return instance->elem; -} - -/** Suppress SWI elements (normalize instance) */ -APT_DECLARE(apt_bool_t) nlsml_instance_swi_suppress(nlsml_instance_t *instance) -{ - apr_xml_elem *child_elem; - apr_xml_elem *prev_elem = NULL; - apr_xml_elem *swi_literal = NULL; - apt_bool_t remove; - if(!instance->elem) - return FALSE; - - for(child_elem = instance->elem->first_child; child_elem; child_elem = child_elem->next) { - remove = FALSE; - if(strcasecmp(child_elem->name,"SWI_literal") == 0) { - swi_literal = child_elem; - remove = TRUE; - } - else if(strcasecmp(child_elem->name,"SWI_meaning") == 0) { - remove = TRUE; - } - - if(remove == TRUE) { - if(child_elem == instance->elem->first_child) { - instance->elem->first_child = child_elem->next; - } - else if(prev_elem) { - prev_elem->next = child_elem->next; - } - } - - prev_elem = child_elem; - } - - if(APR_XML_ELEM_IS_EMPTY(instance->elem) && swi_literal) { - instance->elem->first_cdata = swi_literal->first_cdata; - } - - return TRUE; -} - -/** Generate a plain text content of the instance element */ -APT_DECLARE(const char*) nlsml_instance_content_generate(const nlsml_instance_t *instance, apr_pool_t *pool) -{ - const char *buf = NULL; - if(instance->elem) { - apr_size_t size; - apr_xml_to_text(pool, instance->elem, APR_XML_X2T_INNER, NULL, NULL, &buf, &size); - } - return buf; -} - -/** Get input element */ -APT_DECLARE(const apr_xml_elem*) nlsml_input_elem_get(const nlsml_input_t *input) -{ - return input->elem; -} - -/** Generate a plain text content of the input element */ -APT_DECLARE(const char*) nlsml_input_content_generate(const nlsml_input_t *input, apr_pool_t *pool) -{ - const char *buf = NULL; - if(input->elem) { - apr_size_t size; - apr_xml_to_text(pool, input->elem, APR_XML_X2T_INNER, NULL, NULL, &buf, &size); - } - return buf; -} - -/** Get input mode */ -APT_DECLARE(const char*) nlsml_input_mode_get(const nlsml_input_t *input) -{ - return input->mode; -} - -/** Get input confidence */ -APT_DECLARE(float) nlsml_input_confidence_get(const nlsml_input_t *input) -{ - return input->confidence; -} - -/** Get start of input timestamp */ -APT_DECLARE(const char*) nlsml_input_timestamp_start_get(const nlsml_input_t *input) -{ - return input->timestamp_start; -} - -/** Get end of input timestamp */ -APT_DECLARE(const char*) nlsml_input_timestamp_end_get(const nlsml_input_t *input) -{ - return input->timestamp_end; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c b/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c deleted file mode 100644 index 83f64b0c71..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_obj_list.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_obj_list.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "apt_obj_list.h" - -struct apt_list_elem_t { - APR_RING_ENTRY(apt_list_elem_t) link; - void *obj; -}; - -struct apt_obj_list_t { - APR_RING_HEAD(apt_list_head_t, apt_list_elem_t) head; - apr_pool_t *pool; -}; - - - -APT_DECLARE(apt_obj_list_t*) apt_list_create(apr_pool_t *pool) -{ - apt_obj_list_t *list = apr_palloc(pool, sizeof(apt_obj_list_t)); - list->pool = pool; - APR_RING_INIT(&list->head, apt_list_elem_t, link); - return list; -} - -APT_DECLARE(void) apt_list_destroy(apt_obj_list_t *list) -{ - /* nothing to do, the list is allocated from the pool */ -} - -APT_DECLARE(apt_list_elem_t*) apt_list_push_back(apt_obj_list_t *list, void *obj, apr_pool_t *pool) -{ - apt_list_elem_t *elem = apr_palloc(pool,sizeof(apt_list_elem_t)); - elem->obj = obj; - - APR_RING_INSERT_TAIL(&list->head,elem,apt_list_elem_t,link); - return elem; -} - -APT_DECLARE(void*) apt_list_pop_front(apt_obj_list_t *list) -{ - apt_list_elem_t *elem; - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - elem = APR_RING_FIRST(&list->head); - APR_RING_REMOVE(elem,link); - return elem->obj; -} - -APT_DECLARE(void*) apt_list_head(const apt_obj_list_t *list) -{ - apt_list_elem_t *elem; - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - elem = APR_RING_FIRST(&list->head); - return elem->obj; -} - -APT_DECLARE(void*) apt_obj_list_tail(const apt_obj_list_t *list) -{ - apt_list_elem_t *elem; - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - elem = APR_RING_LAST(&list->head); - return elem->obj; -} - -APT_DECLARE(apt_list_elem_t*) apt_list_first_elem_get(const apt_obj_list_t *list) -{ - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - return APR_RING_FIRST(&list->head); -} - -APT_DECLARE(apt_list_elem_t*) apt_list_last_elem_get(const apt_obj_list_t *list) -{ - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return NULL; - } - return APR_RING_LAST(&list->head); -} - -APT_DECLARE(apt_list_elem_t*) apt_list_next_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem) -{ - apt_list_elem_t *next_elem = APR_RING_NEXT(elem,link); - if(next_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) { - next_elem = NULL; - } - return next_elem; -} - -APT_DECLARE(apt_list_elem_t*) apt_list_prev_elem_get(const apt_obj_list_t *list, apt_list_elem_t *elem) -{ - apt_list_elem_t *prev_elem = APR_RING_PREV(elem,link); - if(prev_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) { - prev_elem = NULL; - } - return prev_elem; -} - -APT_DECLARE(apt_list_elem_t*) apt_list_elem_insert(apt_obj_list_t *list, apt_list_elem_t *elem, void *obj, apr_pool_t *pool) -{ - apt_list_elem_t *new_elem = apr_palloc(pool,sizeof(apt_list_elem_t)); - new_elem->obj = obj; - APR_RING_INSERT_BEFORE(elem,new_elem,link); - return new_elem; -} - -APT_DECLARE(apt_list_elem_t*) apt_list_elem_remove(apt_obj_list_t *list, apt_list_elem_t *elem) -{ - apt_list_elem_t *next_elem = APR_RING_NEXT(elem,link); - APR_RING_REMOVE(elem,link); - if(next_elem == APR_RING_SENTINEL(&list->head,apt_list_elem_t,link)) { - next_elem = NULL; - } - return next_elem; -} - -APT_DECLARE(apt_bool_t) apt_list_is_empty(const apt_obj_list_t *list) -{ - if(APR_RING_EMPTY(&list->head,apt_list_elem_t,link)) { - return TRUE; - } - return FALSE; -} - -APT_DECLARE(void*) apt_list_elem_object_get(const apt_list_elem_t *elem) -{ - return elem->obj; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c deleted file mode 100644 index d14ef5be98..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_pair.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_pair.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_pair.h" - -/** Create array of name-value pairs */ -APT_DECLARE(apt_pair_arr_t*) apt_pair_array_create(apr_size_t initial_size, apr_pool_t *pool) -{ - return apr_array_make(pool,(int)initial_size,sizeof(apt_pair_t)); -} - -/** Copy array of name-value pairs */ -APT_DECLARE(apt_pair_arr_t*) apt_pair_array_copy(const apt_pair_arr_t *src_arr, apr_pool_t *pool) -{ - int i; - const apt_pair_t *src_pair; - apt_pair_t *pair; - apt_pair_arr_t *arr; - if(!src_arr) { - return NULL; - } - arr = apr_array_copy(pool,src_arr); - for(i=0; inelts; i++) { - pair = &APR_ARRAY_IDX(arr,i,apt_pair_t); - src_pair = &APR_ARRAY_IDX(src_arr,i,const apt_pair_t); - apt_pair_copy(pair,src_pair,pool); - } - return arr; -} - - -/** Append name-value pair */ -APT_DECLARE(apt_bool_t) apt_pair_array_append(apt_pair_arr_t *arr, const apt_str_t *name, const apt_str_t *value, apr_pool_t *pool) -{ - apt_pair_t *pair = apr_array_push(arr); - apt_pair_init(pair); - if(name) { - apt_string_copy(&pair->name,name,pool); - } - if(value) { - apt_string_copy(&pair->value,value,pool); - } - return TRUE; -} - -/** Find name-value pair by name */ -APT_DECLARE(const apt_pair_t*) apt_pair_array_find(const apt_pair_arr_t *arr, const apt_str_t *name) -{ - int i; - apt_pair_t *pair; - for(i=0; inelts; i++) { - pair = &APR_ARRAY_IDX(arr,i,apt_pair_t); - if(apt_string_compare(&pair->name,name) == TRUE) { - return pair; - } - } - return NULL; -} - -/** Get size of pair array */ -APT_DECLARE(int) apt_pair_array_size_get(const apt_pair_arr_t *arr) -{ - return arr->nelts; -} - -/** Get name-value pair by id */ -APT_DECLARE(const apt_pair_t*) apt_pair_array_get(const apt_pair_arr_t *arr, int id) -{ - if(id < arr->nelts) { - return &APR_ARRAY_IDX(arr,id,apt_pair_t); - } - return NULL; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c deleted file mode 100644 index 3a20231d20..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_poller_task.c +++ /dev/null @@ -1,296 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_poller_task.c 2224 2014-11-12 00:41:45Z achaloyan@gmail.com $ - */ - -#include "apt_poller_task.h" -#include "apt_task.h" -#include "apt_pool.h" -#include "apt_cyclic_queue.h" -#include "apt_log.h" - - -/** Poller task */ -struct apt_poller_task_t { - apr_pool_t *pool; - apt_task_t *base; - - void *obj; - apt_poll_signal_f signal_handler; - - apr_thread_mutex_t *guard; - apt_cyclic_queue_t *msg_queue; - apt_pollset_t *pollset; - apt_timer_queue_t *timer_queue; - - apr_pollfd_t *desc_arr; - apr_int32_t desc_count; - apr_int32_t desc_index; - -}; - -static apt_bool_t apt_poller_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t apt_poller_task_run(apt_task_t *task); -static apt_bool_t apt_poller_task_on_destroy(apt_task_t *task); - - -/** Create poller task */ -APT_DECLARE(apt_poller_task_t*) apt_poller_task_create( - apr_size_t max_pollset_size, - apt_poll_signal_f signal_handler, - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool) -{ - apt_task_vtable_t *vtable; - apt_poller_task_t *task; - - if(!signal_handler) { - return NULL; - } - - task = apr_palloc(pool,sizeof(apt_poller_task_t)); - task->pool = pool; - task->obj = obj; - task->pollset = NULL; - task->signal_handler = signal_handler; - - task->pollset = apt_pollset_create((apr_uint32_t)max_pollset_size,pool); - if(!task->pollset) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Pollset"); - return NULL; - } - - task->base = apt_task_create(task,msg_pool,pool); - if(!task->base) { - apt_pollset_destroy(task->pollset); - return NULL; - } - - vtable = apt_task_vtable_get(task->base); - if(vtable) { - vtable->run = apt_poller_task_run; - vtable->destroy = apt_poller_task_on_destroy; - vtable->signal_msg = apt_poller_task_msg_signal; - } - apt_task_auto_ready_set(task->base,FALSE); - - task->msg_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE); - apr_thread_mutex_create(&task->guard,APR_THREAD_MUTEX_UNNESTED,pool); - - task->timer_queue = apt_timer_queue_create(pool); - task->desc_arr = NULL; - task->desc_count = 0; - task->desc_index = 0; - return task; -} - -/** Destroy poller task */ -APT_DECLARE(apt_bool_t) apt_poller_task_destroy(apt_poller_task_t *task) -{ - return apt_task_destroy(task->base); -} - -/** Cleanup poller task */ -APT_DECLARE(void) apt_poller_task_cleanup(apt_poller_task_t *task) -{ - if(task->pollset) { - apt_pollset_destroy(task->pollset); - task->pollset = NULL; - } - if(task->guard) { - apr_thread_mutex_destroy(task->guard); - task->guard = NULL; - } - if(task->msg_queue) { - apt_cyclic_queue_destroy(task->msg_queue); - task->msg_queue = NULL; - } -} - -/** Virtual destroy handler */ -static apt_bool_t apt_poller_task_on_destroy(apt_task_t *base) -{ - apt_poller_task_t *task = apt_task_object_get(base); - apt_poller_task_cleanup(task); - return TRUE; -} - - -/** Start poller task */ -APT_DECLARE(apt_bool_t) apt_poller_task_start(apt_poller_task_t *task) -{ - return apt_task_start(task->base); -} - -/** Terminate poller task */ -APT_DECLARE(apt_bool_t) apt_poller_task_terminate(apt_poller_task_t *task) -{ - return apt_task_terminate(task->base,TRUE); -} - -/** Get task */ -APT_DECLARE(apt_task_t*) apt_poller_task_base_get(const apt_poller_task_t *task) -{ - return task->base; -} - -/** Get task vtable */ -APT_DECLARE(apt_task_vtable_t*) apt_poller_task_vtable_get(const apt_poller_task_t *task) -{ - return apt_task_vtable_get(task->base); -} - -/** Get external object */ -APT_DECLARE(void*) apt_poller_task_object_get(const apt_poller_task_t *task) -{ - return task->obj; -} - -/** Add descriptor to pollset */ -APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_add(const apt_poller_task_t *task, const apr_pollfd_t *descriptor) -{ - if(task->pollset) { - return apt_pollset_add(task->pollset,descriptor); - } - return FALSE; -} - -/** Remove descriptor from pollset */ -APT_DECLARE(apt_bool_t) apt_poller_task_descriptor_remove(const apt_poller_task_t *task, const apr_pollfd_t *descriptor) -{ - if(task->pollset) { - apr_int32_t i = task->desc_index + 1; - for(; i < task->desc_count; i++) { - apr_pollfd_t *cur_descriptor = &task->desc_arr[i]; - if(cur_descriptor->client_data == descriptor->client_data) { - cur_descriptor->client_data = NULL; - } - } - return apt_pollset_remove(task->pollset,descriptor); - } - return FALSE; -} - -/** Create timer */ -APT_DECLARE(apt_timer_t*) apt_poller_task_timer_create( - apt_poller_task_t *task, - apt_timer_proc_f proc, - void *obj, - apr_pool_t *pool) -{ - return apt_timer_create(task->timer_queue,proc,obj,pool); -} - -static apt_bool_t apt_poller_task_wakeup_process(apt_poller_task_t *task) -{ - apt_bool_t running = TRUE; - apt_task_msg_t *msg; - - do { - apr_thread_mutex_lock(task->guard); - msg = apt_cyclic_queue_pop(task->msg_queue); - apr_thread_mutex_unlock(task->guard); - if(msg) { - apt_task_msg_process(task->base,msg); - } - else { - running = FALSE; - } - } - while(running == TRUE); - return TRUE; -} - -static apt_bool_t apt_poller_task_run(apt_task_t *base) -{ - apt_poller_task_t *task = apt_task_object_get(base); - apt_bool_t *running; - apr_status_t status; - apr_interval_time_t timeout; - apr_uint32_t queue_timeout; - apr_time_t time_now, time_last = 0; - const char *task_name; - - if(!task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Poller Task"); - return FALSE; - } - task_name = apt_task_name_get(task->base); - - running = apt_task_running_flag_get(task->base); - if(!running) { - return FALSE; - } - - /* explicitly indicate task is ready to process messages */ - apt_task_ready(task->base); - - while(*running) { - if(apt_timer_queue_timeout_get(task->timer_queue,&queue_timeout) == TRUE) { - timeout = (apr_interval_time_t)queue_timeout * 1000; - time_last = apr_time_now(); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s] timeout [%u]", - task_name, queue_timeout); - } - else { - timeout = -1; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Wait for Messages [%s]",task_name); - } - status = apt_pollset_poll(task->pollset, timeout, &task->desc_count, (const apr_pollfd_t **) &task->desc_arr); - if(status != APR_SUCCESS && status != APR_TIMEUP) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Poll [%s] status: %d",task_name,status); - continue; - } - for(task->desc_index = 0; task->desc_index < task->desc_count; task->desc_index++) { - const apr_pollfd_t *descriptor = &task->desc_arr[task->desc_index]; - if(apt_pollset_is_wakeup(task->pollset,descriptor)) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Poller Wakeup [%s]",task_name); - apt_poller_task_wakeup_process(task); - if(*running == FALSE) { - break; - } - continue; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Signalled Descriptor [%s]",task_name); - task->signal_handler(task->obj,descriptor); - } - - if(timeout != -1) { - time_now = apr_time_now(); - if(time_now > time_last) { - apt_timer_queue_advance(task->timer_queue,(apr_uint32_t)((time_now - time_last)/1000)); - } - } - } - - return TRUE; -} - -static apt_bool_t apt_poller_task_msg_signal(apt_task_t *base, apt_task_msg_t *msg) -{ - apt_bool_t status; - apt_poller_task_t *task = apt_task_object_get(base); - apr_thread_mutex_lock(task->guard); - status = apt_cyclic_queue_push(task->msg_queue,msg); - apr_thread_mutex_unlock(task->guard); - if(apt_pollset_wakeup(task->pollset) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Control Message"); - status = FALSE; - } - return status; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c deleted file mode 100644 index b7d8358d36..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_pollset.c +++ /dev/null @@ -1,325 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_pollset.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_pollset.h" -#include "apt_log.h" - -struct apt_pollset_t { - /** APR pollset */ - apr_pollset_t *base; -#ifdef WIN32 - /** Socket descriptors used for wakeup */ - apr_socket_t *wakeup_pipe[2]; -#else - /** Pipe descriptors used for wakeup */ - apr_file_t *wakeup_pipe[2]; -#endif - /** Builtin wakeup poll descriptor */ - apr_pollfd_t wakeup_pfd; - - /** Pool to allocate memory from */ - apr_pool_t *pool; -}; - -static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset); -static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset); - -/** Create interruptable pollset on top of APR pollset */ -APT_DECLARE(apt_pollset_t*) apt_pollset_create(apr_uint32_t size, apr_pool_t *pool) -{ - apt_pollset_t *pollset = apr_palloc(pool,sizeof(apt_pollset_t)); - pollset->pool = pool; - memset(&pollset->wakeup_pfd,0,sizeof(pollset->wakeup_pfd)); - - /* create pollset with max number of descriptors size+1, - where +1 is builtin wakeup descriptor */ - if(apr_pollset_create(&pollset->base,size+1,pool,0) != APR_SUCCESS) { - return NULL; - } - - /* create wakeup pipe */ - if(apt_wakeup_pipe_create(pollset) != TRUE) { - apr_pollset_destroy(pollset->base); - return NULL; - } - - /* add wakeup pipe to pollset */ - if(apr_pollset_add(pollset->base,&pollset->wakeup_pfd) != APR_SUCCESS) { - apt_wakeup_pipe_destroy(pollset); - apr_pollset_destroy(pollset->base); - return NULL; - } - return pollset; -} - -/** Destroy pollset */ -APT_DECLARE(apt_bool_t) apt_pollset_destroy(apt_pollset_t *pollset) -{ - /* remove wakeup pipe from pollset */ - apr_pollset_remove(pollset->base,&pollset->wakeup_pfd); - /* destroy wakeup pipe */ - apt_wakeup_pipe_destroy(pollset); - /* destroy pollset */ - apr_pollset_destroy(pollset->base); - return TRUE; -} - -/** Add pollset descriptor to a pollset */ -APT_DECLARE(apt_bool_t) apt_pollset_add(apt_pollset_t *pollset, const apr_pollfd_t *descriptor) -{ - return (apr_pollset_add(pollset->base,descriptor) == APR_SUCCESS) ? TRUE : FALSE; -} - -/** Remove pollset descriptor from a pollset */ -APT_DECLARE(apt_bool_t) apt_pollset_remove(apt_pollset_t *pollset, const apr_pollfd_t *descriptor) -{ - return (apr_pollset_remove(pollset->base,descriptor) == APR_SUCCESS) ? TRUE : FALSE; -} - -/** Block for activity on the descriptor(s) in a pollset */ -APT_DECLARE(apr_status_t) apt_pollset_poll( - apt_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors) -{ - return apr_pollset_poll(pollset->base,timeout,num,descriptors); -} - -/** Interrupt the blocked poll call */ -APT_DECLARE(apt_bool_t) apt_pollset_wakeup(apt_pollset_t *pollset) -{ - apt_bool_t status = TRUE; -#ifdef WIN32 - char tmp = 0; - apr_size_t len = sizeof(tmp); - if(apr_socket_send(pollset->wakeup_pipe[1],&tmp,&len) != APR_SUCCESS) { - status = FALSE; - } -#else - if(apr_file_putc(1, pollset->wakeup_pipe[1]) != APR_SUCCESS) { - status = FALSE; - } -#endif - return status; -} - -/** Match against builtin wake up descriptor in a pollset */ -APT_DECLARE(apt_bool_t) apt_pollset_is_wakeup(apt_pollset_t *pollset, const apr_pollfd_t *descriptor) -{ - apt_bool_t status = FALSE; -#ifdef WIN32 - if(descriptor->desc.s == pollset->wakeup_pipe[0]) { - char rb[512]; - apr_size_t nr = sizeof(rb); - - /* simply read out from the input side of the pipe all the data. */ - while(apr_socket_recv(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) { - if(nr != sizeof(rb)) { - break; - } - } - status = TRUE; - } -#else - if(descriptor->desc.f == pollset->wakeup_pipe[0]) { - char rb[512]; - apr_size_t nr = sizeof(rb); - - /* simply read out from the input side of the pipe all the data. */ - while(apr_file_read(pollset->wakeup_pipe[0], rb, &nr) == APR_SUCCESS) { - if(nr != sizeof(rb)) { - break; - } - } - status = TRUE; - } -#endif - return status; -} - -#ifdef WIN32 -static apr_status_t socket_pipe_create(apr_socket_t **rd, apr_socket_t **wr, apr_pool_t *pool) -{ - static int id = 0; - - apr_socket_t *ls = NULL; - apr_sockaddr_t *pa = NULL; - apr_sockaddr_t *ca = NULL; - apr_size_t nrd; - int uid[2]; - int iid[2]; - - /* Create the unique socket identifier - * so that we know the connection originated - * from us. - */ - uid[0] = getpid(); - uid[1] = id++; - if(apr_socket_create(&ls, AF_INET, SOCK_STREAM, APR_PROTO_TCP, pool) != APR_SUCCESS) { - return apr_get_netos_error(); - } - apr_socket_opt_set(ls, APR_SO_REUSEADDR, 1); - - if(apr_sockaddr_info_get(&pa,"127.0.0.1",APR_INET,0,0,pool) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - - if(apr_socket_bind(ls, pa) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - - if(apr_socket_addr_get(&ca,APR_LOCAL,ls) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - - if(apr_socket_listen(ls,1) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - - if(apr_socket_create(wr, AF_INET, SOCK_STREAM, APR_PROTO_TCP, pool) != APR_SUCCESS) { - apr_socket_close(ls); - return apr_get_netos_error(); - } - apr_socket_opt_set(*wr, APR_SO_REUSEADDR, 1); - - if(apr_socket_connect(*wr, ca) != APR_SUCCESS) { - apr_socket_close(ls); - apr_socket_close(*wr); - return apr_get_netos_error(); - } - nrd = sizeof(uid); - if(apr_socket_send(*wr, (char *)uid, &nrd) != APR_SUCCESS) { - apr_socket_close(ls); - apr_socket_close(*wr); - return apr_get_netos_error(); - } - - apr_socket_opt_set(ls, APR_SO_NONBLOCK, 0); - /* Listening socket is blocking by now. The accept should - * return immediatelly because we connected already. - */ - if(apr_socket_accept(rd, ls, pool) != APR_SUCCESS) { - apr_socket_close(ls); - apr_socket_close(*wr); - return apr_get_netos_error(); - } - - /* Put read side of the pipe to the blocking mode */ - apr_socket_opt_set(*rd, APR_SO_NONBLOCK, 0); - - for (;;) { - /* Verify the connection by reading the sent identification */ - nrd = sizeof(iid); - if(apr_socket_recv(*rd, (char *)iid, &nrd) != APR_SUCCESS) { - apr_socket_close(ls); - apr_socket_close(*wr); - apr_socket_close(*rd); - return apr_get_netos_error(); - } - if(nrd == sizeof(iid)) { - if(memcmp(uid, iid, sizeof(uid)) == 0) { - /* Wow, we recived what we sent */ - break; - } - } - } - - /* We don't need the listening socket any more */ - apr_socket_close(ls); - return APR_SUCCESS; -} - -/** Create a dummy wakeup pipe for interrupting the poller */ -static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset) -{ - apr_socket_t *rd = NULL; - apr_socket_t *wr = NULL; - apr_status_t rv; - rv = socket_pipe_create(&rd,&wr,pollset->pool); - if(rv != APR_SUCCESS) { - char err_str[256]; - apr_strerror(rv,err_str,sizeof(err_str)); - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Wakeup Pipe: %s",err_str); - return FALSE; - } - pollset->wakeup_pfd.reqevents = APR_POLLIN; - pollset->wakeup_pfd.desc_type = APR_POLL_SOCKET; - pollset->wakeup_pfd.desc.s = rd; - - pollset->wakeup_pipe[0] = rd; - pollset->wakeup_pipe[1] = wr; - return TRUE; -} - -/** Destroy wakeup pipe */ -static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset) -{ - /* Close both sides of the wakeup pipe */ - if(pollset->wakeup_pipe[0]) { - apr_socket_close(pollset->wakeup_pipe[0]); - pollset->wakeup_pipe[0] = NULL; - } - if(pollset->wakeup_pipe[1]) { - apr_socket_close(pollset->wakeup_pipe[1]); - pollset->wakeup_pipe[1] = NULL; - } - return TRUE; -} - -#else - -/** Create a dummy wakeup pipe for interrupting the poller */ -static apt_bool_t apt_wakeup_pipe_create(apt_pollset_t *pollset) -{ - apr_file_t *file_in = NULL; - apr_file_t *file_out = NULL; - - if(apr_file_pipe_create(&file_in,&file_out,pollset->pool) != APR_SUCCESS) { - return FALSE; - } - pollset->wakeup_pfd.reqevents = APR_POLLIN; - pollset->wakeup_pfd.desc_type = APR_POLL_FILE; - pollset->wakeup_pfd.desc.f = file_in; - - pollset->wakeup_pipe[0] = file_in; - pollset->wakeup_pipe[1] = file_out; - return TRUE; -} - -/** Destroy wakeup pipe */ -static apt_bool_t apt_wakeup_pipe_destroy(apt_pollset_t *pollset) -{ - /* Close both sides of the wakeup pipe */ - if(pollset->wakeup_pipe[0]) { - apr_file_close(pollset->wakeup_pipe[0]); - pollset->wakeup_pipe[0] = NULL; - } - if(pollset->wakeup_pipe[1]) { - apr_file_close(pollset->wakeup_pipe[1]); - pollset->wakeup_pipe[1] = NULL; - } - return TRUE; -} - -#endif diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c b/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c deleted file mode 100644 index 48ce662903..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_pool.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_pool.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_pool.h" -#include "apt_log.h" - -#define OWN_ALLOCATOR_PER_POOL - -static int apt_abort_fn(int retcode) -{ - apt_log(APT_LOG_MARK,APT_PRIO_CRITICAL,"APR Abort Called [%d]", retcode); - return 0; -} - -APT_DECLARE(apr_pool_t*) apt_pool_create() -{ - apr_pool_t *pool = NULL; - -#ifdef OWN_ALLOCATOR_PER_POOL - apr_allocator_t *allocator = NULL; - apr_thread_mutex_t *mutex = NULL; - - if(apr_allocator_create(&allocator) == APR_SUCCESS) { - if(apr_pool_create_ex(&pool,NULL,apt_abort_fn,allocator) == APR_SUCCESS) { - apr_allocator_owner_set(allocator,pool); - apr_thread_mutex_create(&mutex,APR_THREAD_MUTEX_NESTED,pool); - apr_allocator_mutex_set(allocator,mutex); - apr_pool_mutex_set(pool,mutex); - } - } -#else - apr_pool_create(&pool,NULL); -#endif - return pool; -} - -APT_DECLARE(apr_pool_t*) apt_subpool_create(apr_pool_t *parent) -{ - apr_pool_t *pool = NULL; - apr_pool_create(&pool,parent); - return pool; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c b/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c deleted file mode 100644 index 5928e38c13..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_string_table.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_string_table.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_string_table.h" - -/* Get the string by a given id. */ -APT_DECLARE(const apt_str_t*) apt_string_table_str_get(const apt_str_table_item_t table[], apr_size_t size, apr_size_t id) -{ - if(id < size) { - return &table[id].value; - } - return NULL; -} - -/* Find the id associated with a given string from the table */ -APT_DECLARE(apr_size_t) apt_string_table_id_find(const apt_str_table_item_t table[], apr_size_t size, const apt_str_t *value) -{ - /* Key character is stored within each apt_string_table_item. - At first, key characters must be matched in a loop crossing the items. - Then whole strings should be compared only for the matched item. - Key characters should be automatically generated once for a given string table. */ - - apr_size_t i; - const apt_str_table_item_t *item; - for(i=0; ivalue.length != value->length) { - /* lengths of th strings differ, just contninue */ - continue; - } - /* check whether key is available */ - if(item->key < value->length) { - /* check whether values are matched by key (using no case compare) */ - if(value->length == item->value.length && - tolower(item->value.buf[item->key]) == tolower(value->buf[item->key])) { - /* whole strings must be compared to ensure, should be done only once for each lookup */ - if(apt_string_compare(&item->value,value) == TRUE) { - return i; - } - } - } - else { - /* no key available, just compare whole strings */ - if(apt_string_compare(&item->value,value) == TRUE) { - return i; - } - } - } - - /* no match found, return invalid id */ - return size; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_task.c b/libs/unimrcp/libs/apr-toolkit/src/apt_task.c deleted file mode 100644 index 83e04c963c..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_task.c +++ /dev/null @@ -1,623 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_task.c 2219 2014-11-11 02:35:14Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include -#include -#include -#include "apt_task.h" -#include "apt_log.h" - -/** Internal states of the task */ -typedef enum { - TASK_STATE_IDLE, /**< no task activity */ - TASK_STATE_START_REQUESTED, /**< start of the task has been requested, but it's not running yet */ - TASK_STATE_RUNNING, /**< task is running */ - TASK_STATE_TERMINATE_REQUESTED /**< termination of the task has been requested, but it's still running */ -} apt_task_state_e; - -struct apt_task_t { - APR_RING_ENTRY(apt_task_t) link; /* entry to parent task ring */ - APR_RING_HEAD(apt_task_head_t, apt_task_t) head; /* head of child tasks ring */ - - const char *name; /* name of the task */ - void *obj; /* external object associated with the task */ - apr_pool_t *pool; /* memory pool to allocate task data from */ - apt_task_msg_pool_t *msg_pool; /* message pool to allocate task messages from */ - apr_thread_mutex_t *data_guard; /* mutex to protect task data */ - apr_thread_t *thread_handle; /* thread handle */ - apt_task_state_e state; /* current task state */ - apt_task_vtable_t vtable; /* table of virtual methods */ - apt_task_t *parent_task; /* parent (master) task */ - apr_size_t pending_start; /* number of pending start requests */ - apr_size_t pending_term; /* number of pending terminate requests */ - apr_size_t pending_off; /* number of pending taking-offline requests */ - apr_size_t pending_on; /* number of pending bringing-online requests */ - apt_bool_t running; /* task is running (TRUE if even terminate has already been requested) */ - apt_bool_t auto_ready; /* if TRUE, task is implicitly ready to process messages */ -}; - -static void* APR_THREAD_FUNC apt_task_run(apr_thread_t *thread_handle, void *data); -static APR_INLINE void apt_task_vtable_reset(apt_task_vtable_t *vtable); - -static apt_bool_t apt_task_core_msg_signal(apt_task_t *task, apt_task_msg_pool_t *msg_pool, apt_core_task_msg_type_e type); - -static apt_bool_t apt_task_terminate_request(apt_task_t *task); - -static apt_bool_t apt_task_start_process_internal(apt_task_t *task); -static apt_bool_t apt_task_terminate_process_internal(apt_task_t *task); -static apt_bool_t apt_task_offline_request_process(apt_task_t *task); -static apt_bool_t apt_task_online_request_process(apt_task_t *task); - -static apt_bool_t apt_task_offline_request_complete(apt_task_t *task); -static apt_bool_t apt_task_online_request_complete(apt_task_t *task); - -static void apt_task_start_complete_raise(apt_task_t *task); -static void apt_task_terminate_complete_raise(apt_task_t *task); -static void apt_task_offline_complete_raise(apt_task_t *task); -static void apt_task_online_complete_raise(apt_task_t *task); - - -APT_DECLARE(apt_task_t*) apt_task_create( - void *obj, - apt_task_msg_pool_t *msg_pool, - apr_pool_t *pool) -{ - apt_task_t *task = apr_palloc(pool,sizeof(apt_task_t)); - task->obj = obj; - task->pool = pool; - task->msg_pool = msg_pool; - - if(!task->msg_pool) { - task->msg_pool = apt_task_msg_pool_create_dynamic(0,pool); - } - - task->state = TASK_STATE_IDLE; - task->thread_handle = NULL; - if(apr_thread_mutex_create(&task->data_guard, APR_THREAD_MUTEX_DEFAULT, task->pool) != APR_SUCCESS) { - return NULL; - } - - /* reset vtable */ - apt_task_vtable_reset(&task->vtable); - task->vtable.terminate = apt_task_terminate_request; - task->vtable.process_start = apt_task_start_process_internal; - task->vtable.process_terminate = apt_task_terminate_process_internal; - - APR_RING_ELEM_INIT(task, link); - APR_RING_INIT(&task->head, apt_task_t, link); - - task->parent_task = NULL; - task->pending_start = 0; - task->pending_term = 0; - task->pending_off = 0; - task->pending_on = 0; - task->auto_ready = TRUE; - task->name = "Task"; - return task; -} - -APT_DECLARE(apt_bool_t) apt_task_destroy(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { - apt_task_destroy(child_task); - } - - if(task->state != TASK_STATE_IDLE) { - apt_task_wait_till_complete(task); - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy Task [%s]",task->name); - if(task->vtable.destroy) { - task->vtable.destroy(task); - } - - apr_thread_mutex_destroy(task->data_guard); - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_add(apt_task_t *task, apt_task_t *child_task) -{ - if(!child_task) - return FALSE; - - child_task->parent_task = task; - APR_RING_INSERT_TAIL(&task->head,child_task,apt_task_t,link); - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_start(apt_task_t *task) -{ - apt_bool_t status = TRUE; - apr_thread_mutex_lock(task->data_guard); - if(task->state == TASK_STATE_IDLE) { - apr_status_t rv; - task->state = TASK_STATE_START_REQUESTED; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task [%s]",task->name); - if(task->vtable.start) { - /* invoke virtual start method */ - task->vtable.start(task); - } - else { - /* start new thread by default */ - rv = apr_thread_create(&task->thread_handle,NULL,apt_task_run,task,task->pool); - if(rv != APR_SUCCESS) { - task->state = TASK_STATE_IDLE; - status = FALSE; - } - } - } - else { - status = FALSE; - } - apr_thread_mutex_unlock(task->data_guard); - return status; -} - -APT_DECLARE(apt_bool_t) apt_task_offline(apt_task_t *task) -{ - return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_TAKEOFFLINE_REQUEST); -} - -APT_DECLARE(apt_bool_t) apt_task_online(apt_task_t *task) -{ - return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_BRINGONLINE_REQUEST); -} - -APT_DECLARE(apt_bool_t) apt_task_terminate(apt_task_t *task, apt_bool_t wait_till_complete) -{ - apt_bool_t status = FALSE; - apr_thread_mutex_lock(task->data_guard); - if(task->state == TASK_STATE_START_REQUESTED || task->state == TASK_STATE_RUNNING) { - task->state = TASK_STATE_TERMINATE_REQUESTED; - } - apr_thread_mutex_unlock(task->data_guard); - - if(task->state == TASK_STATE_TERMINATE_REQUESTED) { - /* invoke virtual terminate method */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [%s]",task->name); - if(task->vtable.terminate) { - status = task->vtable.terminate(task); - } - - if(wait_till_complete == TRUE && status == TRUE) { - apt_task_wait_till_complete(task); - } - } - - return status; -} - -APT_DECLARE(apt_bool_t) apt_task_wait_till_complete(apt_task_t *task) -{ - if(task->thread_handle) { - apr_status_t s; - apr_thread_join(&s,task->thread_handle); - task->thread_handle = NULL; - } - return TRUE; -} - -APT_DECLARE(void) apt_task_delay(apr_size_t msec) -{ - apr_sleep(1000*msec); -} - -APT_DECLARE(apt_task_t*) apt_task_parent_get(const apt_task_t *task) -{ - return task->parent_task; -} - -APT_DECLARE(apr_pool_t*) apt_task_pool_get(const apt_task_t *task) -{ - return task->pool; -} - -APT_DECLARE(void*) apt_task_object_get(const apt_task_t *task) -{ - return task->obj; -} - -APT_DECLARE(apt_task_vtable_t*) apt_task_vtable_get(apt_task_t *task) -{ - return &task->vtable; -} - -APT_DECLARE(void) apt_task_name_set(apt_task_t *task, const char *name) -{ - task->name = name; -} - -APT_DECLARE(const char*) apt_task_name_get(const apt_task_t *task) -{ - return task->name; -} - -APT_DECLARE(apt_task_msg_t*) apt_task_msg_get(apt_task_t *task) -{ - if(task->msg_pool) { - return apt_task_msg_acquire(task->msg_pool); - } - return NULL; -} - -APT_DECLARE(apt_bool_t) apt_task_msg_signal(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Message to [%s] ["APT_PTR_FMT";%d;%d]", - task->name, msg, msg->type, msg->sub_type); - if(task->vtable.signal_msg) { - if(task->vtable.signal_msg(task,msg) == TRUE) { - return TRUE; - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Signal Task Message [%s] [0x%x;%d;%d]", - task->name, msg, msg->type, msg->sub_type); - apt_task_msg_release(msg); - return FALSE; -} - -APT_DECLARE(apt_bool_t) apt_task_msg_parent_signal(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_task_t *parent_task = task->parent_task; - if(parent_task) { - return apt_task_msg_signal(parent_task,msg); - } - - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Null Parent Task [%s]",task->name); - apt_task_msg_release(msg); - return FALSE; -} - -static apt_bool_t apt_task_core_msg_signal(apt_task_t *task, apt_task_msg_pool_t *msg_pool, apt_core_task_msg_type_e type) -{ - if(task && msg_pool) { - apt_task_msg_t *msg = apt_task_msg_acquire(msg_pool); - /* signal core task message */ - msg->type = TASK_MSG_CORE; - msg->sub_type = type; - return apt_task_msg_signal(task,msg); - } - return FALSE; -} - -static apt_bool_t apt_core_task_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - switch(msg->sub_type) { - case CORE_TASK_MSG_START_COMPLETE: - apt_task_start_request_remove(task); - break; - case CORE_TASK_MSG_TERMINATE_REQUEST: - if(task->vtable.process_terminate) { - task->vtable.process_terminate(task); - } - break; - case CORE_TASK_MSG_TERMINATE_COMPLETE: - apt_task_terminate_request_remove(task); - break; - case CORE_TASK_MSG_TAKEOFFLINE_REQUEST: - apt_task_offline_request_process(task); - break; - case CORE_TASK_MSG_TAKEOFFLINE_COMPLETE: - apt_task_offline_request_complete(task); - break; - case CORE_TASK_MSG_BRINGONLINE_REQUEST: - apt_task_online_request_process(task); - break; - case CORE_TASK_MSG_BRINGONLINE_COMPLETE: - apt_task_online_request_complete(task); - break; - default: break; - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_bool_t status = FALSE; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message [%s] ["APT_PTR_FMT";%d;%d]", - task->name, msg, msg->type, msg->sub_type); - if(msg->type == TASK_MSG_CORE) { - status = apt_core_task_msg_process(task,msg); - } - else { - if(task->vtable.process_msg) { - status = task->vtable.process_msg(task,msg); - } - } - - apt_task_msg_release(msg); - return status; -} - -static apt_bool_t apt_task_terminate_request(apt_task_t *task) -{ - return apt_task_core_msg_signal(task,task->msg_pool,CORE_TASK_MSG_TERMINATE_REQUEST); -} - -APT_DECLARE(apt_bool_t) apt_task_start_request_process(apt_task_t *task) -{ - return apt_task_start_process_internal(task); -} - -static apt_bool_t apt_task_start_process_internal(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { - if(apt_task_start(child_task) == TRUE) { - task->pending_start++; - } - } - - if(!task->pending_start) { - /* no child task to start, just raise start-complete event */ - apt_task_start_complete_raise(task); - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_terminate_request_process(apt_task_t *task) -{ - return apt_task_terminate_process_internal(task); -} - -static apt_bool_t apt_task_terminate_process_internal(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { -#ifdef ENABLE_SIMULT_TASK_TERMINATION - if(child_task->thread_handle) { - apr_thread_detach(child_task->thread_handle); - child_task->thread_handle = NULL; - } - if(apt_task_terminate(child_task,FALSE) == TRUE) { - task->pending_term++; - } -#else - apt_task_terminate(child_task,TRUE); -#endif - } - - if(!task->pending_term) { - /* no child task to terminate, just raise terminate-complete event */ - apt_task_terminate_complete_raise(task); - task->running = FALSE; - } - return TRUE; -} - -static apt_bool_t apt_task_offline_request_process(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { - if(apt_task_offline(child_task) == TRUE) { - task->pending_off++; - } - } - - if(!task->pending_off) { - /* no child task, just raise offline-complete event */ - apt_task_offline_complete_raise(task); - } - return TRUE; -} - -static apt_bool_t apt_task_online_request_process(apt_task_t *task) -{ - apt_task_t *child_task; - APR_RING_FOREACH(child_task, &task->head, apt_task_t, link) { - if(apt_task_online(child_task) == TRUE) { - task->pending_on++; - } - } - - if(!task->pending_on) { - /* no child task, just raise online-complete event */ - apt_task_online_complete_raise(task); - } - return TRUE; -} - -APT_DECLARE(void) apt_task_auto_ready_set(apt_task_t *task, apt_bool_t auto_ready) -{ - task->auto_ready = auto_ready; -} - -APT_DECLARE(apt_bool_t) apt_task_ready(apt_task_t *task) -{ - if(task->auto_ready == TRUE) { - return FALSE; - } - - /* start child tasks (if any) */ - if(task->vtable.process_start) { - task->vtable.process_start(task); - } - return TRUE; -} - -APT_DECLARE(apt_bool_t*) apt_task_running_flag_get(apt_task_t *task) -{ - return &task->running; -} - -APT_DECLARE(apt_bool_t) apt_task_start_request_add(apt_task_t *task) -{ - task->pending_start++; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_start_request_remove(apt_task_t *task) -{ - if(!task->pending_start) { - /* error case, no pending start */ - return FALSE; - } - task->pending_start--; - if(!task->pending_start) { - apt_task_start_complete_raise(task); - } - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_terminate_request_add(apt_task_t *task) -{ - task->pending_term++; - return TRUE; -} - -APT_DECLARE(apt_bool_t) apt_task_terminate_request_remove(apt_task_t *task) -{ - if(!task->pending_term) { - /* error case, no pending terminate */ - return FALSE; - } - task->pending_term--; - if(!task->pending_term) { - apt_task_terminate_complete_raise(task); - task->running = FALSE; - } - return TRUE; -} - -static apt_bool_t apt_task_offline_request_complete(apt_task_t *task) -{ - if(!task->pending_off) { - /* error case, no pending request */ - return FALSE; - } - task->pending_off--; - if(!task->pending_off) { - apt_task_offline_complete_raise(task); - } - return TRUE; -} - -static apt_bool_t apt_task_online_request_complete(apt_task_t *task) -{ - if(!task->pending_on) { - /* error case, no pending request */ - return FALSE; - } - task->pending_on--; - if(!task->pending_on) { - apt_task_online_complete_raise(task); - } - return TRUE; -} - -static void apt_task_start_complete_raise(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Started [%s]",task->name); - if(task->vtable.on_start_complete) { - task->vtable.on_start_complete(task); - } - apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_START_COMPLETE); -} - -static void apt_task_terminate_complete_raise(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Terminated [%s]",task->name); - if(task->vtable.on_terminate_complete) { - task->vtable.on_terminate_complete(task); - } -#ifdef ENABLE_SIMULT_TASK_TERMINATION - apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_TERMINATE_COMPLETE); -#endif -} - -static void apt_task_offline_complete_raise(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Taken Offline [%s]",task->name); - if(task->vtable.on_offline_complete) { - task->vtable.on_offline_complete(task); - } - apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_TAKEOFFLINE_COMPLETE); -} - -static void apt_task_online_complete_raise(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Task Brought Online [%s]",task->name); - if(task->vtable.on_online_complete) { - task->vtable.on_online_complete(task); - } - apt_task_core_msg_signal(task->parent_task,task->msg_pool,CORE_TASK_MSG_BRINGONLINE_COMPLETE); -} - -static void* APR_THREAD_FUNC apt_task_run(apr_thread_t *thread_handle, void *data) -{ - apt_task_t *task = data; - -#if APR_HAS_SETTHREADNAME - apr_thread_name_set(task->name); -#endif - /* raise pre-run event */ - if(task->vtable.on_pre_run) { - task->vtable.on_pre_run(task); - } - apr_thread_mutex_lock(task->data_guard); - task->state = TASK_STATE_RUNNING; - task->running = TRUE; - apr_thread_mutex_unlock(task->data_guard); - - if(task->auto_ready == TRUE) { - /* start child tasks (if any) */ - if(task->vtable.process_start) { - task->vtable.process_start(task); - } - } - - /* run task */ - if(task->vtable.run) { - task->vtable.run(task); - } - - apr_thread_mutex_lock(task->data_guard); - task->state = TASK_STATE_IDLE; - task->running = FALSE; - apr_thread_mutex_unlock(task->data_guard); - /* raise post-run event */ - if(task->vtable.on_post_run) { - task->vtable.on_post_run(task); - } - - apr_thread_exit(thread_handle,APR_SUCCESS); - return NULL; -} - -static APR_INLINE void apt_task_vtable_reset(apt_task_vtable_t *vtable) -{ - vtable->destroy = NULL; - vtable->start = NULL; - vtable->terminate = NULL; - vtable->run = NULL; - vtable->signal_msg = NULL; - vtable->process_msg = NULL; - vtable->process_start = NULL; - vtable->process_terminate = NULL; - vtable->on_pre_run = NULL; - vtable->on_post_run = NULL; - vtable->on_start_complete = NULL; - vtable->on_terminate_complete = NULL; - vtable->on_offline_complete = NULL; - vtable->on_online_complete = NULL; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c b/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c deleted file mode 100644 index d593e26eb0..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_task_msg.c +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_task_msg.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_task_msg.h" - -/** Abstract pool of task messages to allocate task messages from */ -struct apt_task_msg_pool_t { - void (*destroy)(apt_task_msg_pool_t *pool); - - apt_task_msg_t* (*acquire_msg)(apt_task_msg_pool_t *pool); - void (*release_msg)(apt_task_msg_t *task_msg); - - void *obj; - apr_pool_t *pool; -}; - - -/** Dynamic allocation of messages (no actual pool exist)*/ -typedef struct apt_msg_pool_dynamic_t apt_msg_pool_dynamic_t; - -struct apt_msg_pool_dynamic_t { - apr_size_t size; -}; - -static apt_task_msg_t* dynamic_pool_acquire_msg(apt_task_msg_pool_t *task_msg_pool) -{ - apt_msg_pool_dynamic_t *dynamic_pool = task_msg_pool->obj; - apt_task_msg_t *task_msg = malloc(dynamic_pool->size); - task_msg->msg_pool = task_msg_pool; - task_msg->type = TASK_MSG_USER; - task_msg->sub_type = 0; - return task_msg; -} - -static void dynamic_pool_release_msg(apt_task_msg_t *task_msg) -{ - if(task_msg) { - free(task_msg); - } -} - -static void dynamic_pool_destroy(apt_task_msg_pool_t *task_msg_pool) -{ - /* nothing to do */ -} - -APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_dynamic(apr_size_t msg_size, apr_pool_t *pool) -{ - apt_task_msg_pool_t *task_msg_pool = apr_palloc(pool,sizeof(apt_task_msg_pool_t)); - apt_msg_pool_dynamic_t *dynamic_pool = apr_palloc(pool,sizeof(apt_msg_pool_dynamic_t)); - dynamic_pool->size = msg_size + sizeof(apt_task_msg_t) - 1; - - task_msg_pool->pool = pool; - task_msg_pool->obj = dynamic_pool; - task_msg_pool->acquire_msg = dynamic_pool_acquire_msg; - task_msg_pool->release_msg = dynamic_pool_release_msg; - task_msg_pool->destroy = dynamic_pool_destroy; - return task_msg_pool; -} - - -/** Static allocation of messages from message pool (not implemented yet) */ -APT_DECLARE(apt_task_msg_pool_t*) apt_task_msg_pool_create_static(apr_size_t msg_size, apr_size_t pool_size, apr_pool_t *pool) -{ - return NULL; -} - - - -APT_DECLARE(void) apt_task_msg_pool_destroy(apt_task_msg_pool_t *msg_pool) -{ - if(msg_pool->destroy) { - msg_pool->destroy(msg_pool); - } -} - -APT_DECLARE(apt_task_msg_t*) apt_task_msg_acquire(apt_task_msg_pool_t *task_msg_pool) -{ - if(!task_msg_pool->acquire_msg) - return NULL; - return task_msg_pool->acquire_msg(task_msg_pool); -} - -APT_DECLARE(void) apt_task_msg_release(apt_task_msg_t *task_msg) -{ - apt_task_msg_pool_t *task_msg_pool = task_msg->msg_pool; - if(task_msg_pool->release_msg) - task_msg_pool->release_msg(task_msg); -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c b/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c deleted file mode 100644 index 4704235079..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_test_suite.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_test_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_pool.h" -#include "apt_obj_list.h" -#include "apt_test_suite.h" -#include "apt_log.h" - -struct apt_test_framework_t{ - apr_pool_t *pool; - apt_obj_list_t *suites; -}; - -APT_DECLARE(apt_test_suite_t*) apt_test_suite_create(apr_pool_t *pool, const char *name, - void *obj, apt_test_f tester) -{ - apt_test_suite_t *suite = apr_palloc(pool,sizeof(apt_test_suite_t)); - suite->pool = pool; - apt_string_assign(&suite->name,name,pool); - suite->obj = obj; - suite->tester = tester; - return suite; -} - -APT_DECLARE(apt_test_framework_t*) apt_test_framework_create() -{ - apt_test_framework_t *framework; - apr_pool_t* pool = apt_pool_create(); - framework = apr_palloc(pool,sizeof(apt_test_framework_t)); - framework->pool = pool; - framework->suites = apt_list_create(pool); - - apt_log_instance_create(APT_LOG_OUTPUT_CONSOLE,APT_PRIO_INFO,pool); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Test Framework"); - return framework; -} - -APT_DECLARE(void) apt_test_framework_destroy(apt_test_framework_t *framework) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Test Framework"); - apt_log_instance_destroy(); - apr_pool_destroy(framework->pool); -} - -APT_DECLARE(apt_bool_t) apt_test_framework_suite_add(apt_test_framework_t *framework, apt_test_suite_t *suite) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Test Suite [%s]",suite->name.buf); - return (apt_list_push_back(framework->suites,suite,suite->pool) ? TRUE : FALSE); -} - -APT_DECLARE(apr_pool_t*) apt_test_framework_pool_get(const apt_test_framework_t *framework) -{ - return framework->pool; -} - -static apt_bool_t apt_test_framework_suite_run(apt_test_framework_t *framework, apt_test_suite_t *suite, - int argc, const char * const *argv) -{ - apt_bool_t status = FALSE; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"----- Run Test Suite [%s] -----",suite->name.buf); - if(suite->tester) { - status = suite->tester(suite,argc,argv); - } - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"---- Status [%s] ----\n",(status == TRUE) ? "OK" : "Failure"); - return status; -} - -APT_DECLARE(apt_bool_t) apt_test_framework_run(apt_test_framework_t *framework, int argc, const char * const *argv) -{ - apt_test_suite_t *suite = NULL; - apt_list_elem_t *elem = apt_list_first_elem_get(framework->suites); - if(argc == 1) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run All Test Suites"); - /* walk through the list of test suites and run all of them */ - while(elem) { - suite = apt_list_elem_object_get(elem); - if(suite) { - /* run test suite with the default arguments */ - apt_test_framework_suite_run(framework,suite,0,NULL); - } - elem = apt_list_next_elem_get(framework->suites,elem); - } - } - else { - /* walk through the list of test suites find appropriate one and run it */ - apt_bool_t found = FALSE; - apt_str_t name; - apt_string_set(&name,argv[1]); - while(elem) { - suite = apt_list_elem_object_get(elem); - if(suite && apt_string_compare(&suite->name,&name) == TRUE) { - found = TRUE; - break; - } - elem = apt_list_next_elem_get(framework->suites,elem); - } - if(found == TRUE) { - /* run test suite with remaining arguments */ - apt_test_framework_suite_run(framework,suite,argc-2,&argv[2]); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Test Suite [%s] to Run", argv[1]); - } - } - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c b/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c deleted file mode 100644 index 4a9db353df..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_text_message.c +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_text_message.c 2218 2014-11-11 02:28:58Z achaloyan@gmail.com $ - */ - -#include "apt_text_message.h" -#include "apt_log.h" - -/** Stage of text message processing (parsing/generation) */ -typedef enum { - APT_MESSAGE_STAGE_START_LINE, - APT_MESSAGE_STAGE_HEADER, - APT_MESSAGE_STAGE_BODY -} apt_message_stage_e; - - -/** Text message parser */ -struct apt_message_parser_t { - const apt_message_parser_vtable_t *vtable; - void *obj; - apr_pool_t *pool; - apt_message_context_t context; - apr_size_t content_length; - apt_message_stage_e stage; - apt_bool_t skip_lf; - apt_bool_t verbose; -}; - -/** Text message generator */ -struct apt_message_generator_t { - const apt_message_generator_vtable_t *vtable; - void *obj; - apr_pool_t *pool; - apt_message_context_t context; - apr_size_t content_length; - apt_message_stage_e stage; - apt_bool_t verbose; -}; - -/** Parse individual header field (name-value pair) */ -APT_DECLARE(apt_header_field_t*) apt_header_field_parse(apt_text_stream_t *stream, apr_pool_t *pool) -{ - apr_size_t folding_length = 0; - apr_array_header_t *folded_lines = NULL; - apt_header_field_t *header_field; - apt_str_t temp_line; - apt_str_t *line; - apt_pair_t pair; - /* read name-value pair */ - if(apt_text_header_read(stream,&pair) == FALSE) { - return NULL; - } - - /* check folding lines (value spanning multiple lines) */ - while(stream->pos < stream->end) { - if(apt_text_is_wsp(*stream->pos) == FALSE) { - break; - } - - stream->pos++; - - /* skip further white spaces (if any) */ - apt_text_white_spaces_skip(stream); - - if(!folded_lines) { - folded_lines = apr_array_make(pool,1,sizeof(apt_str_t)); - } - if(apt_text_line_read(stream,&temp_line) == TRUE) { - line = apr_array_push(folded_lines); - *line = temp_line; - folding_length += line->length; - } - }; - - header_field = apt_header_field_alloc(pool); - /* copy parsed name of the header field */ - header_field->name.length = pair.name.length; - header_field->name.buf = apr_palloc(pool, pair.name.length + 1); - if(pair.name.length) { - memcpy(header_field->name.buf, pair.name.buf, pair.name.length); - } - header_field->name.buf[header_field->name.length] = '\0'; - - /* copy parsed value of the header field */ - header_field->value.length = pair.value.length + folding_length; - header_field->value.buf = apr_palloc(pool, header_field->value.length + 1); - if(pair.value.length) { - memcpy(header_field->value.buf, pair.value.buf, pair.value.length); - } - - if(folding_length) { - int i; - char *pos = header_field->value.buf + pair.value.length; - /* copy parsed folding lines */ - for(i=0; inelts; i++) { - line = &APR_ARRAY_IDX(folded_lines,i,apt_str_t); - - memcpy(pos,line->buf,line->length); - pos += line->length; - } - } - header_field->value.buf[header_field->value.length] = '\0'; - - return header_field; -} - -/** Generate individual header field (name-value pair) */ -APT_DECLARE(apt_bool_t) apt_header_field_generate(const apt_header_field_t *header_field, apt_text_stream_t *stream) -{ - return apt_text_name_value_insert(stream,&header_field->name,&header_field->value); -} - -/** Parse header section */ -APT_DECLARE(apt_bool_t) apt_header_section_parse(apt_header_section_t *header, apt_text_stream_t *stream, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - apt_bool_t result = FALSE; - - do { - header_field = apt_header_field_parse(stream,pool); - if(header_field) { - if(apt_string_is_empty(&header_field->name) == FALSE) { - /* normal header */ - apt_header_section_field_add(header,header_field); - } - else { - /* empty header => exit */ - result = TRUE; - break; - } - } - else { - /* malformed header => skip to the next one */ - } - } - while(apt_text_is_eos(stream) == FALSE); - - return result; -} - -/** Generate header section */ -APT_DECLARE(apt_bool_t) apt_header_section_generate(const apt_header_section_t *header, apt_text_stream_t *stream) -{ - apt_header_field_t *header_field; - for(header_field = APR_RING_FIRST(&header->ring); - header_field != APR_RING_SENTINEL(&header->ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - apt_header_field_generate(header_field,stream); - } - - return apt_text_eol_insert(stream); -} - -static apt_bool_t apt_message_body_read(apt_message_parser_t *parser, apt_text_stream_t *stream) -{ - apt_bool_t status = TRUE; - apt_str_t *body = parser->context.body; - if(body->buf) { - /* stream length available to read */ - apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf); - /* required/remaining length to read */ - apr_size_t required_length = parser->content_length - body->length; - if(required_length > stream_length) { - required_length = stream_length; - /* incomplete */ - status = FALSE; - } - memcpy(body->buf + body->length, stream->pos, required_length); - body->length += required_length; - stream->pos += required_length; - if(parser->verbose == TRUE) { - apr_size_t length = required_length; - const char *masked_data = apt_log_data_mask(stream->pos,&length,parser->pool); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parsed Message Body [%"APR_SIZE_T_FMT" bytes]\n%.*s", - required_length, length, masked_data); - } - } - - return status; -} - -static apt_bool_t apt_message_body_write(apt_message_generator_t *generator, apt_text_stream_t *stream) -{ - apt_bool_t status = TRUE; - apt_str_t *body = generator->context.body; - if(body && body->length < generator->content_length) { - /* stream length available to write */ - apr_size_t stream_length = stream->text.length - (stream->pos - stream->text.buf); - /* required/remaining length to write */ - apr_size_t required_length = generator->content_length - body->length; - if(required_length > stream_length) { - required_length = stream_length; - /* incomplete */ - status = FALSE; - } - - memcpy(stream->pos, body->buf + body->length, required_length); - - if(generator->verbose == TRUE) { - apr_size_t length = required_length; - const char *masked_data = apt_log_data_mask(stream->pos,&length,generator->pool); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generated Message Body [%"APR_SIZE_T_FMT" bytes]\n%.*s", - required_length, length, masked_data); - } - - body->length += required_length; - stream->pos += required_length; - } - - return status; -} - - -/** Create message parser */ -APT_DECLARE(apt_message_parser_t*) apt_message_parser_create(void *obj, const apt_message_parser_vtable_t *vtable, apr_pool_t *pool) -{ - apt_message_parser_t *parser = apr_palloc(pool,sizeof(apt_message_parser_t)); - parser->obj = obj; - parser->vtable = vtable; - parser->pool = pool; - parser->context.message = NULL; - parser->context.body = NULL; - parser->context.header = NULL; - parser->content_length = 0; - parser->stage = APT_MESSAGE_STAGE_START_LINE; - parser->skip_lf = FALSE; - parser->verbose = FALSE; - return parser; -} - -static APR_INLINE void apt_crlf_segmentation_test(apt_message_parser_t *parser, apt_text_stream_t *stream) -{ - /* in the worst case message segmentation may occur between and */ - if(stream->pos == stream->end && *(stream->pos-1)== APT_TOKEN_CR) { - /* if this is the case be prepared to skip with the next attempt */ - parser->skip_lf = TRUE; - } -} - -/** Parse message by raising corresponding event handlers */ -APT_DECLARE(apt_message_status_e) apt_message_parser_run(apt_message_parser_t *parser, apt_text_stream_t *stream, void **message) -{ - const char *pos; - apt_message_status_e status = APT_MESSAGE_STATUS_INCOMPLETE; - if(parser->skip_lf == TRUE) { - /* skip occurred as a result of message segmentation between and */ - apt_text_char_skip(stream,APT_TOKEN_LF); - parser->skip_lf = FALSE; - } - if(message) { - *message = NULL; - } - - do { - pos = stream->pos; - if(parser->stage == APT_MESSAGE_STAGE_START_LINE) { - if(parser->vtable->on_start(parser,&parser->context,stream,parser->pool) == FALSE) { - if(apt_text_is_eos(stream) == FALSE) { - status = APT_MESSAGE_STATUS_INVALID; - } - break; - } - - apt_crlf_segmentation_test(parser,stream); - - parser->stage = APT_MESSAGE_STAGE_HEADER; - } - - if(parser->stage == APT_MESSAGE_STAGE_HEADER) { - /* read header section */ - apt_bool_t res = apt_header_section_parse(parser->context.header,stream,parser->pool); - if(parser->verbose == TRUE) { - apr_size_t length = stream->pos - pos; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parsed Message Header [%"APR_SIZE_T_FMT" bytes]\n%.*s", - length, length, pos); - } - - apt_crlf_segmentation_test(parser,stream); - - if(res == FALSE) { - break; - } - - if(parser->vtable->on_header_complete) { - if(parser->vtable->on_header_complete(parser,&parser->context) == FALSE) { - status = APT_MESSAGE_STATUS_INVALID; - break; - } - } - - if(parser->context.body && parser->context.body->length) { - apt_str_t *body = parser->context.body; - parser->content_length = body->length; - body->buf = apr_palloc(parser->pool,parser->content_length+1); - body->buf[parser->content_length] = '\0'; - body->length = 0; - parser->stage = APT_MESSAGE_STAGE_BODY; - } - else { - status = APT_MESSAGE_STATUS_COMPLETE; - if(message) { - *message = parser->context.message; - } - parser->stage = APT_MESSAGE_STAGE_START_LINE; - break; - } - } - - if(parser->stage == APT_MESSAGE_STAGE_BODY) { - if(apt_message_body_read(parser,stream) == FALSE) { - break; - } - - if(parser->vtable->on_body_complete) { - parser->vtable->on_body_complete(parser,&parser->context); - } - status = APT_MESSAGE_STATUS_COMPLETE; - if(message) { - *message = parser->context.message; - } - parser->stage = APT_MESSAGE_STAGE_START_LINE; - break; - } - } - while(apt_text_is_eos(stream) == FALSE); - - return status; -} - -/** Get external object associated with parser */ -APT_DECLARE(void*) apt_message_parser_object_get(apt_message_parser_t *parser) -{ - return parser->obj; -} - -/** Set verbose mode for the parser */ -APT_DECLARE(void) apt_message_parser_verbose_set(apt_message_parser_t *parser, apt_bool_t verbose) -{ - parser->verbose = verbose; -} - - -/** Create message generator */ -APT_DECLARE(apt_message_generator_t*) apt_message_generator_create(void *obj, const apt_message_generator_vtable_t *vtable, apr_pool_t *pool) -{ - apt_message_generator_t *generator = apr_palloc(pool,sizeof(apt_message_generator_t)); - generator->obj = obj; - generator->vtable = vtable; - generator->pool = pool; - generator->context.message = NULL; - generator->context.header = NULL; - generator->context.body = NULL; - generator->content_length = 0; - generator->stage = APT_MESSAGE_STAGE_START_LINE; - generator->verbose = FALSE; - return generator; -} - -static apt_message_status_e apt_message_generator_break(apt_message_generator_t *generator, apt_text_stream_t *stream) -{ - /* failed to generate message */ - if(apt_text_is_eos(stream) == TRUE) { - /* end of stream reached */ - return APT_MESSAGE_STATUS_INCOMPLETE; - } - - /* error case */ - return APT_MESSAGE_STATUS_INVALID; -} - -/** Generate message */ -APT_DECLARE(apt_message_status_e) apt_message_generator_run(apt_message_generator_t *generator, void *message, apt_text_stream_t *stream) -{ - if(!message) { - return APT_MESSAGE_STATUS_INVALID; - } - - if(message != generator->context.message) { - generator->stage = APT_MESSAGE_STAGE_START_LINE; - generator->context.message = message; - generator->context.header = NULL; - generator->context.body = NULL; - } - - if(generator->stage == APT_MESSAGE_STAGE_START_LINE) { - /* generate start-line */ - if(generator->vtable->on_start(generator,&generator->context,stream) == FALSE) { - return apt_message_generator_break(generator,stream); - } - - if(!generator->context.header || !generator->context.body) { - return APT_MESSAGE_STATUS_INVALID; - } - - /* generate header */ - if(apt_header_section_generate(generator->context.header,stream) == FALSE) { - return apt_message_generator_break(generator,stream); - } - - if(generator->vtable->on_header_complete) { - generator->vtable->on_header_complete(generator,&generator->context,stream); - } - if(generator->verbose == TRUE) { - apr_size_t length = stream->pos - stream->text.buf; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generated Message Header [%"APR_SIZE_T_FMT" bytes]\n%.*s", - length, length, stream->text.buf); - } - - generator->stage = APT_MESSAGE_STAGE_START_LINE; - generator->content_length = generator->context.body->length; - if(generator->content_length) { - generator->context.body->length = 0; - generator->stage = APT_MESSAGE_STAGE_BODY; - } - } - - if(generator->stage == APT_MESSAGE_STAGE_BODY) { - if(apt_message_body_write(generator,stream) == FALSE) { - return apt_message_generator_break(generator,stream); - } - - generator->stage = APT_MESSAGE_STAGE_START_LINE; - } - - return APT_MESSAGE_STATUS_COMPLETE; -} - -/** Get external object associated with generator */ -APT_DECLARE(void*) apt_message_generator_object_get(apt_message_generator_t *generator) -{ - return generator->obj; -} - -/** Set verbose mode for the parser */ -APT_DECLARE(void) apt_message_generator_verbose_set(apt_message_generator_t *generator, apt_bool_t verbose) -{ - generator->verbose = verbose; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c b/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c deleted file mode 100644 index 1df0509ef2..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_text_stream.c +++ /dev/null @@ -1,554 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_text_stream.c 2223 2014-11-12 00:37:40Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "apt_text_stream.h" - -#define TOKEN_TRUE "true" -#define TOKEN_FALSE "false" -#define TOKEN_TRUE_LENGTH (sizeof(TOKEN_TRUE)-1) -#define TOKEN_FALSE_LENGTH (sizeof(TOKEN_FALSE)-1) - -#if _MSC_VER >= 1900 -#pragma warning(disable: 4477) -// 'sprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' apt_text_stream.c 495 -// 'sprintf' : format string '%03d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' apt_text_stream.c 515 -#endif - - -/** Navigate through the lines of the text stream (message) */ -APT_DECLARE(apt_bool_t) apt_text_line_read(apt_text_stream_t *stream, apt_str_t *line) -{ - char *pos = stream->pos; - apt_bool_t status = FALSE; - line->length = 0; - line->buf = pos; - /* while not end of stream */ - while(pos < stream->end) { - if(*pos == APT_TOKEN_CR) { - /* end of line detected */ - line->length = pos - line->buf; - pos++; - if(pos < stream->end && *pos == APT_TOKEN_LF) { - pos++; - } - status = TRUE; - break; - } - else if(*pos == APT_TOKEN_LF) { - /* end of line detected */ - line->length = pos - line->buf; - pos++; - status = TRUE; - break; - } - pos++; - } - - if(status == TRUE) { - /* advance stream pos */ - stream->pos = pos; - } - else { - /* end of stream is reached, do not advance stream pos, but set is_eos flag */ - stream->is_eos = TRUE; - line->length = pos - line->buf; - } - return status; -} - -/** To be used to navigate through the header fields (name:value pairs) of the text stream (message) - Valid header fields are: - name:value - name: value - name: value - name: value - name: (only name, no value) - (empty header) - Malformed header fields are: - name:value (missing end of line ) - name (missing separator ':') -*/ -APT_DECLARE(apt_bool_t) apt_text_header_read(apt_text_stream_t *stream, apt_pair_t *pair) -{ - char *pos = stream->pos; - apt_bool_t status = FALSE; - apt_string_reset(&pair->name); - apt_string_reset(&pair->value); - /* while not end of stream */ - while(pos < stream->end) { - if(*pos == APT_TOKEN_CR) { - /* end of line detected */ - if(pair->value.buf) { - /* set length of the value */ - pair->value.length = pos - pair->value.buf; - } - pos++; - if(pos < stream->end && *pos == APT_TOKEN_LF) { - pos++; - } - status = TRUE; - break; - } - else if(*pos == APT_TOKEN_LF) { - /* end of line detected */ - if(pair->value.buf) { - /* set length of the value */ - pair->value.length = pos - pair->value.buf; - } - pos++; - status = TRUE; - break; - } - else if(!pair->name.length) { - /* skip preceding white spaces (SHOULD NOT be any WSP, though) and read name */ - if(!pair->name.buf && apt_text_is_wsp(*pos) == FALSE) { - pair->name.buf = pos; - } - if(*pos == ':') { - /* set length of the name */ - pair->name.length = pos - pair->name.buf; - } - } - else if(!pair->value.length) { - /* skip preceding white spaces and read value */ - if(!pair->value.buf && apt_text_is_wsp(*pos) == FALSE) { - pair->value.buf = pos; - } - } - pos++; - } - - if(status == TRUE) { - /* advance stream pos regardless it's a valid header or not */ - stream->pos = pos; - - /* if length == 0 && buf => header is malformed */ - if(!pair->name.length && pair->name.buf) { - status = FALSE; - } - } - else { - /* end of stream is reached, do not advance stream pos, but set is_eos flag */ - stream->is_eos = TRUE; - } - - return status; -} - - -/** Navigate through the fields of the line */ -APT_DECLARE(apt_bool_t) apt_text_field_read(apt_text_stream_t *stream, char separator, apt_bool_t skip_spaces, apt_str_t *field) -{ - char *pos = stream->pos; - if(skip_spaces == TRUE) { - while(pos < stream->end && *pos == APT_TOKEN_SP) pos++; - } - - field->buf = pos; - field->length = 0; - while(pos < stream->end && *pos != separator) pos++; - - field->length = pos - field->buf; - if(pos < stream->end) { - /* skip the separator */ - pos++; - } - - stream->pos = pos; - return field->length ? TRUE : FALSE; -} - -/** Scroll text stream */ -APT_DECLARE(apt_bool_t) apt_text_stream_scroll(apt_text_stream_t *stream) -{ - if(stream->pos == stream->end) { - stream->pos = stream->text.buf; - } - else { - apr_size_t remaining_length = stream->text.buf + stream->text.length - stream->pos; - if(!remaining_length || remaining_length == stream->text.length) { - stream->pos = stream->text.buf + remaining_length; - return FALSE; - } - memmove(stream->text.buf,stream->pos,remaining_length); - stream->pos = stream->text.buf + remaining_length; - stream->text.length = remaining_length; - } - *stream->pos = '\0'; - return TRUE; -} - -/** Parse id@resource string */ -APT_DECLARE(apt_bool_t) apt_id_resource_parse(const apt_str_t *str, char separator, apt_str_t *id, apt_str_t *resource, apr_pool_t *pool) -{ - apt_str_t field = *str; - const char *pos = strchr(str->buf,separator); - if(!pos) { - return FALSE; - } - - field.length = pos - field.buf; - if(field.length >= str->length) { - return FALSE; - } - apt_string_copy(id,&field,pool); - field.buf += field.length + 1; - field.length = str->length - (field.length + 1); - apt_string_copy(resource,&field,pool); - return TRUE; -} - -/** Generate id@resource string */ -APT_DECLARE(apt_bool_t) apt_id_resource_generate(const apt_str_t *id, const apt_str_t *resource, char separator, apt_str_t *str, apr_pool_t *pool) -{ - apr_size_t length = id->length+resource->length+1; - char *buf = apr_palloc(pool,length+1); - memcpy(buf,id->buf,id->length); - buf[id->length] = separator; - memcpy(buf+id->length+1,resource->buf,resource->length); - buf[length] = '\0'; - str->buf = buf; - str->length = length; - return TRUE; -} - -/** Generate name-value pair line */ -APT_DECLARE(apt_bool_t) apt_text_name_value_insert(apt_text_stream_t *stream, const apt_str_t *name, const apt_str_t *value) -{ - char *pos = stream->pos; - if(pos + name->length + value->length + 2 >= stream->end) { - return FALSE; - } - memcpy(pos,name->buf,name->length); - pos += name->length; - *pos++ = ':'; - *pos++ = APT_TOKEN_SP; - if(apt_string_is_empty(value) == FALSE) { - memcpy(pos,value->buf,value->length); - pos += value->length; - } - stream->pos = pos; - return apt_text_eol_insert(stream); -} - -/** Generate only the name ("name":) of the header field */ -APT_DECLARE(apt_bool_t) apt_text_header_name_insert(apt_text_stream_t *stream, const apt_str_t *name) -{ - char *pos = stream->pos; - if(pos + name->length + 2 >= stream->end) { - return FALSE; - } - memcpy(pos,name->buf,name->length); - pos += name->length; - *pos++ = ':'; - *pos++ = APT_TOKEN_SP; - stream->pos = pos; - return TRUE; -} - -/** Parse name=value pair */ -static apt_bool_t apt_pair_parse(apt_pair_t *pair, const apt_str_t *field, apr_pool_t *pool) -{ - apt_text_stream_t stream; - apt_str_t item; - stream.text = *field; - apt_text_stream_reset(&stream); - - /* read name */ - if(apt_text_field_read(&stream,'=',TRUE,&item) == FALSE) { - return FALSE; - } - apt_string_copy(&pair->name,&item,pool); - - /* read value */ - if(apt_text_field_read(&stream,';',TRUE,&item) == TRUE) { - apt_string_copy(&pair->value,&item,pool); - } - else { - apt_string_reset(&pair->value); - } - return TRUE; -} - -/** Parse array of name-value pairs */ -APT_DECLARE(apt_bool_t) apt_pair_array_parse(apt_pair_arr_t *arr, const apt_str_t *value, apr_pool_t *pool) -{ - apt_str_t field; - apt_pair_t *pair; - apt_text_stream_t stream; - if(!arr || !value) { - return FALSE; - } - - stream.text = *value; - apt_text_stream_reset(&stream); - /* read name-value pairs */ - while(apt_text_field_read(&stream,';',TRUE,&field) == TRUE) { - pair = apr_array_push(arr); - apt_pair_parse(pair,&field,pool); - } - return TRUE; -} - -/** Generate array of name-value pairs */ -APT_DECLARE(apt_bool_t) apt_pair_array_generate(const apt_pair_arr_t *arr, apt_str_t *str, apr_pool_t *pool) -{ - int i; - char *pos; - apt_pair_t *pair; - if(!arr || !str) { - return FALSE; - } - - /* Compute length of string being generated */ - str->length = 0; - for(i=0; inelts; i++) { - pair = (apt_pair_t*)arr->elts + i; - /* name */ - str->length += pair->name.length; - if(pair->value.length) { - /* =value */ - str->length += 1 + pair->value.length; - } - } - if(arr->nelts) { - /* ; */ - str->length += arr->nelts - 1; - } - - /* Allocate required string */ - str->buf = apr_palloc(pool, str->length + 1); - - /* Copy pairs into allocated string */ - pos = str->buf; - for(i=0; inelts; i++) { - pair = (apt_pair_t*)arr->elts + i; - if(i != 0) { - *pos++ = ';'; - } - if(pair->name.length) { - memcpy(pos,pair->name.buf,pair->name.length); - pos += pair->name.length; - if(pair->value.length) { - *pos++ = '='; - memcpy(pos,pair->value.buf,pair->value.length); - pos += pair->value.length; - } - } - } - *pos = '\0'; - return TRUE; -} - -/** Parse boolean-value */ -APT_DECLARE(apt_bool_t) apt_boolean_value_parse(const apt_str_t *str, apt_bool_t *value) -{ - if(!str->buf) { - return FALSE; - } - if(strncasecmp(str->buf,TOKEN_TRUE,TOKEN_TRUE_LENGTH) == 0) { - *value = TRUE; - return TRUE; - } - if(strncasecmp(str->buf,TOKEN_FALSE,TOKEN_FALSE_LENGTH) == 0) { - *value = FALSE; - return TRUE; - } - return FALSE; -} - -/** Generate apr_size_t value from pool (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_boolean_value_generate(apt_bool_t value, apt_str_t *str, apr_pool_t *pool) -{ - if(value == TRUE) { - str->length = TOKEN_TRUE_LENGTH; - str->buf = apr_palloc(pool,str->length); - memcpy(str->buf,TOKEN_TRUE,str->length); - } - else { - str->length = TOKEN_FALSE_LENGTH; - str->buf = apr_palloc(pool,str->length); - memcpy(str->buf,TOKEN_FALSE,str->length); - } - return TRUE; -} - - -/** Parse size_t value */ -APT_DECLARE(apr_size_t) apt_size_value_parse(const apt_str_t *str) -{ - return str->buf ? atol(str->buf) : 0; -} - -/** Generate apr_size_t value (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_size_value_generate(apr_size_t value, apt_str_t *str, apr_pool_t *pool) -{ - str->buf = apr_psprintf(pool, "%"APR_SIZE_T_FMT, value); - str->length = strlen(str->buf); - return TRUE; -} - -/** Insert apr_size_t value */ -APT_DECLARE(apt_bool_t) apt_text_size_value_insert(apt_text_stream_t *stream, apr_size_t value) -{ - int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%"APR_SIZE_T_FMT, value); - if(length <= 0) { - return FALSE; - } - stream->pos += length; - return TRUE; -} - - -/** Parse float value */ -APT_DECLARE(float) apt_float_value_parse(const apt_str_t *str) -{ - return str->buf ? (float)atof(str->buf) : 0; -} - -/** Generate float value (buffer is allocated from pool) */ -APT_DECLARE(apt_bool_t) apt_float_value_generate(float value, apt_str_t *str, apr_pool_t *pool) -{ - char *end; - str->buf = apr_psprintf(pool,"%f",value); - str->length = strlen(str->buf); - - /* remove trailing 0s (if any) */ - end = str->buf + str->length - 1; - while(*end == 0x30 && end != str->buf && *(end - 1) != '.') end--; - - str->length = end - str->buf + 1; - return TRUE; -} - -/** Generate float value */ -APT_DECLARE(apt_bool_t) apt_text_float_value_insert(apt_text_stream_t *stream, float value) -{ - char *end; - int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%f", value); - if(length <= 0) { - return FALSE; - } - - /* remove trailing 0s (if any) */ - end = stream->pos + length - 1; - while(*end == 0x30 && end != stream->pos && *(end - 1) != '.') end--; - - stream->pos = end + 1; - return TRUE; -} - -/** Insert string value */ -APT_DECLARE(apt_bool_t) apt_text_string_insert(apt_text_stream_t *stream, const apt_str_t *str) -{ - if(stream->pos + str->length >= stream->end) { - return FALSE; - } - if(str->length) { - memcpy(stream->pos,str->buf,str->length); - stream->pos += str->length; - } - return TRUE; -} - -/** Generate value plus the length (number of digits) of the value itself. */ -APT_DECLARE(apt_bool_t) apt_var_length_value_generate(apr_size_t *value, apr_size_t max_count, apt_str_t *str) -{ - /* (N >= (10^M-M)) ? N+M+1 : N+M */ - apr_size_t temp; - apr_size_t count; /* M */ - apr_size_t bounds; /* 10^M */ - int length; - - /* calculate count */ - temp = *value; - count = 0; - do{count++; temp /= 10;} while(temp); - - /* calculate bounds */ - temp = count; - bounds = 1; - do{bounds *= 10; temp--;} while(temp); - - if(*value >= bounds - count) { - count++; - } - - *value += count; - if(count > max_count) { - return FALSE; - } - - str->length = 0; - length = sprintf(str->buf, "%"APR_SIZE_T_FMT, *value); - if(length <= 0) { - return FALSE; - } - str->length = length; - return TRUE; -} - -/** Generate completion-cause */ -APT_DECLARE(apt_bool_t) apt_completion_cause_generate(const apt_str_table_item_t table[], apr_size_t size, apr_size_t cause, apt_str_t *str, apr_pool_t *pool) -{ - const apt_str_t *name = apt_string_table_str_get(table,size,cause); - if(!name) { - return FALSE; - } - - /* 3 digits + 1 space + name->length */ - str->length = 4 + name->length; - str->buf = apr_palloc(pool,str->length + 1); - - if(sprintf(str->buf,"%03"APR_SIZE_T_FMT" ",cause) != 4) { - return FALSE; - } - - memcpy(str->buf+4,name->buf,name->length); - str->buf[str->length] = '\0'; - return TRUE; -} - - -/** Generate unique identifier (hex string) */ -APT_DECLARE(apt_bool_t) apt_unique_id_generate(apt_str_t *id, apr_size_t length, apr_pool_t *pool) -{ - char *hex_str; - apr_size_t i; - apr_size_t count; - apr_uuid_t uuid; - apr_uuid_get(&uuid); - - hex_str = apr_palloc(pool,length+1); - - count = length / 2; - if(count > sizeof(uuid)) { - count = sizeof(uuid); - } - for(i=0; ibuf = hex_str; - id->length = length; - return TRUE; -} diff --git a/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c b/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c deleted file mode 100644 index 05638260b9..0000000000 --- a/libs/unimrcp/libs/apr-toolkit/src/apt_timer_queue.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_timer_queue.c 2174 2014-09-12 03:33:16Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "apt_timer_queue.h" -#include "apt_log.h" - -/** Timer queue */ -struct apt_timer_queue_t { - /** Ring head */ - APR_RING_HEAD(apt_timer_head_t, apt_timer_t) head; - - /** Elapsed time */ - apr_uint32_t elapsed_time; -}; - -/** Timer */ -struct apt_timer_t { - /** Ring entry */ - APR_RING_ENTRY(apt_timer_t) link; - - /** Back pointer to queue */ - apt_timer_queue_t *queue; - /** Time next report is scheduled at */ - apr_uint32_t scheduled_time; - - /** Timer proc */ - apt_timer_proc_f proc; - /** Timer object */ - void *obj; -}; - -static apt_bool_t apt_timer_insert(apt_timer_queue_t *timer_queue, apt_timer_t *timer); -static apt_bool_t apt_timer_remove(apt_timer_queue_t *timer_queue, apt_timer_t *timer); -static void apt_timers_reschedule(apt_timer_queue_t *timer_queue); - -/** Create timer queue */ -APT_DECLARE(apt_timer_queue_t*) apt_timer_queue_create(apr_pool_t *pool) -{ - apt_timer_queue_t *timer_queue = apr_palloc(pool,sizeof(apt_timer_queue_t)); - APR_RING_INIT(&timer_queue->head, apt_timer_t, link); - timer_queue->elapsed_time = 0; - return timer_queue; -} - -/** Destroy timer queue */ -APT_DECLARE(void) apt_timer_queue_destroy(apt_timer_queue_t *timer_queue) -{ - /* nothing to destroy */ -} - -/** Advance scheduled timers */ -APT_DECLARE(void) apt_timer_queue_advance(apt_timer_queue_t *timer_queue, apr_uint32_t elapsed_time) -{ - apt_timer_t *timer; - - if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) { - /* just return, nothing to do */ - return; - } - - /* increment elapsed time */ - timer_queue->elapsed_time += elapsed_time; - if(timer_queue->elapsed_time >= 0xFFFF) { -#ifdef APT_TIMER_DEBUG - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Reschedule Timers [%u]",timer_queue->elapsed_time); -#endif - apt_timers_reschedule(timer_queue); - } - - /* process timers */ - do { - /* get first node (timer) */ - timer = APR_RING_FIRST(&timer_queue->head); - - if(timer->scheduled_time > timer_queue->elapsed_time) { - /* scheduled time is not elapsed yet */ - break; - } - -#ifdef APT_TIMER_DEBUG - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Timer Elapsed 0x%x [%u]",timer,timer->scheduled_time); -#endif - /* remove the elapsed timer from the list */ - APR_RING_REMOVE(timer, link); - timer->scheduled_time = 0; - /* process the elapsed timer */ - timer->proc(timer,timer->obj); - } - while(!APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)); -} - -/** Is timer queue empty */ -APT_DECLARE(apt_bool_t) apt_timer_queue_is_empty(const apt_timer_queue_t *timer_queue) -{ - return APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link) ? TRUE : FALSE; -} - -/** Get current timeout */ -APT_DECLARE(apt_bool_t) apt_timer_queue_timeout_get(const apt_timer_queue_t *timer_queue, apr_uint32_t *timeout) -{ - apt_timer_t *timer; - /* is queue empty */ - if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) { - return FALSE; - } - - /* get first node (timer) */ - timer = APR_RING_FIRST(&timer_queue->head); - if(!timer) { - return FALSE; - } - - *timeout = timer->scheduled_time - timer_queue->elapsed_time; - return TRUE; -} - -/** Create timer */ -APT_DECLARE(apt_timer_t*) apt_timer_create(apt_timer_queue_t *timer_queue, apt_timer_proc_f proc, void *obj, apr_pool_t *pool) -{ - apt_timer_t *timer = apr_palloc(pool,sizeof(apt_timer_t)); - APR_RING_ELEM_INIT(timer,link); - timer->queue = timer_queue; - timer->scheduled_time = 0; - timer->proc = proc; - timer->obj = obj; - return timer; -} - -/** Set one-shot timer */ -APT_DECLARE(apt_bool_t) apt_timer_set(apt_timer_t *timer, apr_uint32_t timeout) - -{ - apt_timer_queue_t *queue = timer->queue; - - if(timeout <= 0 || !timer->proc) { - return FALSE; - } - - if(timer->scheduled_time) { - /* remove timer first */ - apt_timer_remove(queue,timer); - } - - /* calculate time to elapse */ - timer->scheduled_time = queue->elapsed_time + timeout; -#ifdef APT_TIMER_DEBUG - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Set Timer 0x%x [%u]",timer,timer->scheduled_time); -#endif - if(APR_RING_EMPTY(&queue->head, apt_timer_t, link)) { - APR_RING_INSERT_TAIL(&queue->head,timer,apt_timer_t,link); - return TRUE; - } - - /* insert new node (timer) to sorted by scheduled time list */ - return apt_timer_insert(queue,timer); -} - -/** Kill timer */ -APT_DECLARE(apt_bool_t) apt_timer_kill(apt_timer_t *timer) -{ - if(!timer->scheduled_time) { - return FALSE; - } - -#ifdef APT_TIMER_DEBUG - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Kill Timer 0x%x [%u]",timer,timer->scheduled_time); -#endif - return apt_timer_remove(timer->queue,timer); -} - -static apt_bool_t apt_timer_insert(apt_timer_queue_t *timer_queue, apt_timer_t *timer) -{ - apt_timer_t *it; - for(it = APR_RING_LAST(&timer_queue->head); - it != APR_RING_SENTINEL(&timer_queue->head, apt_timer_t, link); - it = APR_RING_PREV(it, link)) { - - if(it->scheduled_time <= timer->scheduled_time) { - APR_RING_INSERT_AFTER(it,timer,link); - return TRUE; - } - } - APR_RING_INSERT_HEAD(&timer_queue->head,timer,apt_timer_t,link); - return TRUE; -} - -static apt_bool_t apt_timer_remove(apt_timer_queue_t *timer_queue, apt_timer_t *timer) -{ - /* remove node (timer) from the list */ - APR_RING_REMOVE(timer,link); - timer->scheduled_time = 0; - - if(APR_RING_EMPTY(&timer_queue->head, apt_timer_t, link)) { - /* reset elapsed time if no timers set */ - timer_queue->elapsed_time = 0; - } - return TRUE; -} - -static void apt_timers_reschedule(apt_timer_queue_t *timer_queue) -{ - apt_timer_t *it; - for(it = APR_RING_LAST(&timer_queue->head); - it != APR_RING_SENTINEL(&timer_queue->head, apt_timer_t, link); - it = APR_RING_PREV(it, link)) { - - it->scheduled_time -= timer_queue->elapsed_time; - } - timer_queue->elapsed_time = 0; -} diff --git a/libs/unimrcp/libs/mpf/Makefile.am b/libs/unimrcp/libs/mpf/Makefile.am deleted file mode 100644 index f877596a41..0000000000 --- a/libs/unimrcp/libs/mpf/Makefile.am +++ /dev/null @@ -1,82 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mpf/codecs \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmpf.la - -include_HEADERS = codecs/g711/g711.h \ - include/mpf.h \ - include/mpf_activity_detector.h \ - include/mpf_audio_file_descriptor.h \ - include/mpf_audio_file_stream.h \ - include/mpf_bridge.h \ - include/mpf_buffer.h \ - include/mpf_codec.h \ - include/mpf_codec_descriptor.h \ - include/mpf_codec_manager.h \ - include/mpf_context.h \ - include/mpf_dtmf_detector.h \ - include/mpf_dtmf_generator.h \ - include/mpf_engine.h \ - include/mpf_engine_factory.h \ - include/mpf_frame.h \ - include/mpf_frame_buffer.h \ - include/mpf_message.h \ - include/mpf_mixer.h \ - include/mpf_multiplier.h \ - include/mpf_named_event.h \ - include/mpf_object.h \ - include/mpf_stream.h \ - include/mpf_stream_descriptor.h \ - include/mpf_termination.h \ - include/mpf_termination_factory.h \ - include/mpf_rtp_termination_factory.h \ - include/mpf_file_termination_factory.h \ - include/mpf_scheduler.h \ - include/mpf_types.h \ - include/mpf_encoder.h \ - include/mpf_decoder.h \ - include/mpf_jitter_buffer.h \ - include/mpf_rtp_header.h \ - include/mpf_rtp_descriptor.h \ - include/mpf_rtp_stream.h \ - include/mpf_rtp_stat.h \ - include/mpf_rtp_defs.h \ - include/mpf_rtp_attribs.h \ - include/mpf_rtp_pt.h \ - include/mpf_rtcp_packet.h \ - include/mpf_resampler.h - -libmpf_la_SOURCES = codecs/g711/g711.c \ - src/mpf_activity_detector.c \ - src/mpf_audio_file_stream.c \ - src/mpf_bridge.c \ - src/mpf_buffer.c \ - src/mpf_codec_descriptor.c \ - src/mpf_codec_g711.c \ - src/mpf_codec_linear.c \ - src/mpf_codec_manager.c \ - src/mpf_context.c \ - src/mpf_dtmf_detector.c \ - src/mpf_dtmf_generator.c \ - src/mpf_engine.c \ - src/mpf_engine_factory.c \ - src/mpf_mixer.c \ - src/mpf_multiplier.c \ - src/mpf_named_event.c \ - src/mpf_termination.c \ - src/mpf_termination_factory.c \ - src/mpf_rtp_termination_factory.c \ - src/mpf_file_termination_factory.c \ - src/mpf_frame_buffer.c \ - src/mpf_scheduler.c \ - src/mpf_encoder.c \ - src/mpf_decoder.c \ - src/mpf_jitter_buffer.c \ - src/mpf_rtp_stream.c \ - src/mpf_rtp_attribs.c \ - src/mpf_resampler.c \ - src/mpf_stream.c diff --git a/libs/unimrcp/libs/mpf/codecs/g711/g711.c b/libs/unimrcp/libs/mpf/codecs/g711/g711.c deleted file mode 100644 index 1d2a079152..0000000000 --- a/libs/unimrcp/libs/mpf/codecs/g711/g711.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * g711.c - A-law and u-law transcoding routines - * - * Written by Steve Underwood - * - * Copyright (C) 2006 Steve Underwood - * - * Despite my general liking of the GPL, I place this code in the - * public domain for the benefit of all mankind - even the slimy - * ones who might try to proprietize my work and use it to my - * detriment. - * - */ - -#include "g711.h" - -/* Copied from the CCITT G.711 specification */ -static const apr_byte_t ulaw_to_alaw_table[256] = -{ - 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, - 58, 59, 56, 57, 62, 63, 60, 61, 50, 51, 48, 49, 54, 55, 52, 53, - 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 26, - 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, 106, - 104, 105, 110, 111, 108, 109, 98, 99, 96, 97, 102, 103, 100, 101, 122, 120, - 126, 127, 124, 125, 114, 115, 112, 113, 118, 119, 116, 117, 75, 73, 79, 77, - 66, 67, 64, 65, 70, 71, 68, 69, 90, 91, 88, 89, 94, 95, 92, 93, - 82, 82, 83, 83, 80, 80, 81, 81, 86, 86, 87, 87, 84, 84, 85, 85, - 170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165, - 186, 187, 184, 185, 190, 191, 188, 189, 178, 179, 176, 177, 182, 183, 180, 181, - 138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 154, - 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, 234, - 232, 233, 238, 239, 236, 237, 226, 227, 224, 225, 230, 231, 228, 229, 250, 248, - 254, 255, 252, 253, 242, 243, 240, 241, 246, 247, 244, 245, 203, 201, 207, 205, - 194, 195, 192, 193, 198, 199, 196, 197, 218, 219, 216, 217, 222, 223, 220, 221, - 210, 210, 211, 211, 208, 208, 209, 209, 214, 214, 215, 215, 212, 212, 213, 213 -}; - -/* These transcoding tables are copied from the CCITT G.711 specification. To achieve - optimal results, do not change them. */ -static const apr_byte_t alaw_to_ulaw_table[256] = -{ - 42, 43, 40, 41, 46, 47, 44, 45, 34, 35, 32, 33, 38, 39, 36, 37, - 57, 58, 55, 56, 61, 62, 59, 60, 49, 50, 47, 48, 53, 54, 51, 52, - 10, 11, 8, 9, 14, 15, 12, 13, 2, 3, 0, 1, 6, 7, 4, 5, - 26, 27, 24, 25, 30, 31, 28, 29, 18, 19, 16, 17, 22, 23, 20, 21, - 98, 99, 96, 97, 102, 103, 100, 101, 93, 93, 92, 92, 95, 95, 94, 94, - 116, 118, 112, 114, 124, 126, 120, 122, 106, 107, 104, 105, 110, 111, 108, 109, - 72, 73, 70, 71, 76, 77, 74, 75, 64, 65, 63, 63, 68, 69, 66, 67, - 86, 87, 84, 85, 90, 91, 88, 89, 79, 79, 78, 78, 82, 83, 80, 81, - 170, 171, 168, 169, 174, 175, 172, 173, 162, 163, 160, 161, 166, 167, 164, 165, - 185, 186, 183, 184, 189, 190, 187, 188, 177, 178, 175, 176, 181, 182, 179, 180, - 138, 139, 136, 137, 142, 143, 140, 141, 130, 131, 128, 129, 134, 135, 132, 133, - 154, 155, 152, 153, 158, 159, 156, 157, 146, 147, 144, 145, 150, 151, 148, 149, - 226, 227, 224, 225, 230, 231, 228, 229, 221, 221, 220, 220, 223, 223, 222, 222, - 244, 246, 240, 242, 252, 254, 248, 250, 234, 235, 232, 233, 238, 239, 236, 237, - 200, 201, 198, 199, 204, 205, 202, 203, 192, 193, 191, 191, 196, 197, 194, 195, - 214, 215, 212, 213, 218, 219, 216, 217, 207, 207, 206, 206, 210, 211, 208, 209 -}; - -apr_byte_t alaw_to_ulaw(apr_byte_t alaw) -{ - return alaw_to_ulaw_table[alaw]; -} -/*- End of function --------------------------------------------------------*/ - -apr_byte_t ulaw_to_alaw(apr_byte_t ulaw) -{ - return ulaw_to_alaw_table[ulaw]; -} -/*- End of function --------------------------------------------------------*/ -/*- End of file ------------------------------------------------------------*/ diff --git a/libs/unimrcp/libs/mpf/codecs/g711/g711.h b/libs/unimrcp/libs/mpf/codecs/g711/g711.h deleted file mode 100644 index 3814dd79dc..0000000000 --- a/libs/unimrcp/libs/mpf/codecs/g711/g711.h +++ /dev/null @@ -1,374 +0,0 @@ -/* - * SpanDSP - a series of DSP components for telephony - * - * g711.h - In line A-law and u-law conversion routines - * - * Written by Steve Underwood - * - * Copyright (C) 2001 Steve Underwood - * - * Despite my general liking of the GPL, I place this code in the - * public domain for the benefit of all mankind - even the slimy - * ones who might try to proprietize my work and use it to my - * detriment. - * - */ - -/* g711_page A-law and mu-law handling -Lookup tables for A-law and u-law look attractive, until you consider the impact -on the CPU cache. If it causes a substantial area of your processor cache to get -hit too often, cache sloshing will severely slow things down. The main reason -these routines are slow in C, is the lack of direct access to the CPU's "find -the first 1" instruction. A little in-line assembler fixes that, and the -conversion routines can be faster than lookup tables, in most real world usage. -A "find the first 1" instruction is available on most modern CPUs, and is a -much underused feature. - -If an assembly language method of bit searching is not available, these routines -revert to a method that can be a little slow, so the cache thrashing might not -seem so bad :( - -Feel free to submit patches to add fast "find the first 1" support for your own -favourite processor. - -Look up tables are used for transcoding between A-law and u-law, since it is -difficult to achieve the precise transcoding procedure laid down in the G.711 -specification by other means. -*/ - -#ifndef MPF_G711_H -#define MPF_G711_H - -/** - * @file g711.h - * @brief A-law and u-law conversion routines - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -#if defined(__i386__) -/*! \brief Find the bit position of the highest set bit in a word - \param bits The word to be searched - \return The bit number of the highest set bit, or -1 if the word is zero. */ -static APR_INLINE int top_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movl $-1,%%edx;\n" - " bsrl %%eax,%%edx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Find the bit position of the lowest set bit in a word - \param bits The word to be searched - \return The bit number of the lowest set bit, or -1 if the word is zero. */ -static APR_INLINE int bottom_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movl $-1,%%edx;\n" - " bsfl %%eax,%%edx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ -#elif defined(__x86_64__) -static APR_INLINE int top_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movq $-1,%%rdx;\n" - " bsrq %%rax,%%rdx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ - -static APR_INLINE int bottom_bit(unsigned int bits) -{ - int res; - - __asm__ __volatile__(" movq $-1,%%rdx;\n" - " bsfq %%rax,%%rdx;\n" - : "=d" (res) - : "a" (bits)); - return res; -} -/*- End of function --------------------------------------------------------*/ -#else -static APR_INLINE int top_bit(unsigned int bits) -{ - int i; - - if (bits == 0) - return -1; - i = 0; - if (bits & 0xFFFF0000) - { - bits &= 0xFFFF0000; - i += 16; - } - if (bits & 0xFF00FF00) - { - bits &= 0xFF00FF00; - i += 8; - } - if (bits & 0xF0F0F0F0) - { - bits &= 0xF0F0F0F0; - i += 4; - } - if (bits & 0xCCCCCCCC) - { - bits &= 0xCCCCCCCC; - i += 2; - } - if (bits & 0xAAAAAAAA) - { - bits &= 0xAAAAAAAA; - i += 1; - } - return i; -} -/*- End of function --------------------------------------------------------*/ - -static APR_INLINE int bottom_bit(unsigned int bits) -{ - int i; - - if (bits == 0) - return -1; - i = 32; - if (bits & 0x0000FFFF) - { - bits &= 0x0000FFFF; - i -= 16; - } - if (bits & 0x00FF00FF) - { - bits &= 0x00FF00FF; - i -= 8; - } - if (bits & 0x0F0F0F0F) - { - bits &= 0x0F0F0F0F; - i -= 4; - } - if (bits & 0x33333333) - { - bits &= 0x33333333; - i -= 2; - } - if (bits & 0x55555555) - { - bits &= 0x55555555; - i -= 1; - } - return i; -} -/*- End of function --------------------------------------------------------*/ -#endif - -/* N.B. It is tempting to use look-up tables for A-law and u-law conversion. - * However, you should consider the cache footprint. - * - * A 64K byte table for linear to x-law and a 512 byte table for x-law to - * linear sound like peanuts these days, and shouldn't an array lookup be - * real fast? No! When the cache sloshes as badly as this one will, a tight - * calculation may be better. The messiest part is normally finding the - * segment, but a little inline assembly can fix that on an i386, x86_64 and - * many other modern processors. - */ - -/* - * Mu-law is basically as follows: - * - * Biased Linear Input Code Compressed Code - * ------------------------ --------------- - * 00000001wxyza 000wxyz - * 0000001wxyzab 001wxyz - * 000001wxyzabc 010wxyz - * 00001wxyzabcd 011wxyz - * 0001wxyzabcde 100wxyz - * 001wxyzabcdef 101wxyz - * 01wxyzabcdefg 110wxyz - * 1wxyzabcdefgh 111wxyz - * - * Each biased linear code has a leading 1 which identifies the segment - * number. The value of the segment number is equal to 7 minus the number - * of leading 0's. The quantization interval is directly available as the - * four bits wxyz. * The trailing bits (a - h) are ignored. - * - * Ordinarily the complement of the resulting code word is used for - * transmission, and so the code word is complemented before it is returned. - * - * For further information see John C. Bellamy's Digital Telephony, 1982, - * John Wiley & Sons, pps 98-111 and 472-476. - */ - -//#define ULAW_ZEROTRAP /* turn on the trap as per the MIL-STD */ -#define ULAW_BIAS 0x84 /* Bias for linear code. */ - -/*! \brief Encode a linear sample to u-law - \param linear The sample to encode. - \return The u-law value. -*/ -static APR_INLINE apr_byte_t linear_to_ulaw(int linear) -{ - apr_byte_t u_val; - int mask; - int seg; - - /* Get the sign and the magnitude of the value. */ - if (linear < 0) - { - linear = ULAW_BIAS - linear - 1; - mask = 0x7F; - } - else - { - linear = ULAW_BIAS + linear; - mask = 0xFF; - } - - seg = top_bit(linear | 0xFF) - 7; - - /* - * Combine the sign, segment, quantization bits, - * and complement the code word. - */ - if (seg >= 8) - u_val = (apr_byte_t) (0x7F ^ mask); - else - u_val = (apr_byte_t) (((seg << 4) | ((linear >> (seg + 3)) & 0xF)) ^ mask); -#ifdef ULAW_ZEROTRAP - /* Optional ITU trap */ - if (u_val == 0) - u_val = 0x02; -#endif - return u_val; -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Decode an u-law sample to a linear value. - \param ulaw The u-law sample to decode. - \return The linear value. -*/ -static APR_INLINE apr_int16_t ulaw_to_linear(apr_byte_t ulaw) -{ - int t; - - /* Complement to obtain normal u-law value. */ - ulaw = ~ulaw; - /* - * Extract and bias the quantization bits. Then - * shift up by the segment number and subtract out the bias. - */ - t = (((ulaw & 0x0F) << 3) + ULAW_BIAS) << (((int) ulaw & 0x70) >> 4); - return (apr_int16_t) ((ulaw & 0x80) ? (ULAW_BIAS - t) : (t - ULAW_BIAS)); -} -/*- End of function --------------------------------------------------------*/ - -/* - * A-law is basically as follows: - * - * Linear Input Code Compressed Code - * ----------------- --------------- - * 0000000wxyza 000wxyz - * 0000001wxyza 001wxyz - * 000001wxyzab 010wxyz - * 00001wxyzabc 011wxyz - * 0001wxyzabcd 100wxyz - * 001wxyzabcde 101wxyz - * 01wxyzabcdef 110wxyz - * 1wxyzabcdefg 111wxyz - * - * For further information see John C. Bellamy's Digital Telephony, 1982, - * John Wiley & Sons, pps 98-111 and 472-476. - */ - -#define ALAW_AMI_MASK 0x55 - -/*! \brief Encode a linear sample to A-law - \param linear The sample to encode. - \return The A-law value. -*/ -static APR_INLINE apr_byte_t linear_to_alaw(int linear) -{ - int mask; - int seg; - - if (linear >= 0) - { - /* Sign (bit 7) bit = 1 */ - mask = ALAW_AMI_MASK | 0x80; - } - else - { - /* Sign (bit 7) bit = 0 */ - mask = ALAW_AMI_MASK; - linear = -linear - 1; - } - - /* Convert the scaled magnitude to segment number. */ - seg = top_bit(linear | 0xFF) - 7; - if (seg >= 8) - { - if (linear >= 0) - { - /* Out of range. Return maximum value. */ - return (apr_byte_t) (0x7F ^ mask); - } -#if 0 /* This code is no longer reachable, since linear must be at least 0. */ - /* We must be just a tiny step below zero */ - return (apr_byte_t) (0x00 ^ mask); -#endif - } - /* Combine the sign, segment, and quantization bits. */ - return (apr_byte_t) (((seg << 4) | ((linear >> ((seg) ? (seg + 3) : 4)) & 0x0F)) ^ mask); -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Decode an A-law sample to a linear value. - \param alaw The A-law sample to decode. - \return The linear value. -*/ -static APR_INLINE apr_int16_t alaw_to_linear(apr_byte_t alaw) -{ - int i; - int seg; - - alaw ^= ALAW_AMI_MASK; - i = ((alaw & 0x0F) << 4); - seg = (((int) alaw & 0x70) >> 4); - if (seg) - i = (i + 0x108) << (seg - 1); - else - i += 8; - return (apr_int16_t) ((alaw & 0x80) ? i : -i); -} -/*- End of function --------------------------------------------------------*/ - -/*! \brief Transcode from A-law to u-law, using the procedure defined in G.711. - \param alaw The A-law sample to transcode. - \return The best matching u-law value. -*/ -apr_byte_t alaw_to_ulaw(apr_byte_t alaw); - -/*! \brief Transcode from u-law to A-law, using the procedure defined in G.711. - \param alaw The u-law sample to transcode. - \return The best matching A-law value. -*/ -apr_byte_t ulaw_to_alaw(apr_byte_t ulaw); - -APT_END_EXTERN_C - -#endif /* MPF_G711_H */ -/*- End of file ------------------------------------------------------------*/ diff --git a/libs/unimrcp/libs/mpf/include/mpf.h b/libs/unimrcp/libs/mpf/include/mpf.h deleted file mode 100644 index a435893595..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_H -#define MPF_H - -/** - * @file mpf.h - * @brief Media Processing Framework Definitions - */ - -#include - -/** lib export/import defines (win32) */ -#ifdef WIN32 -#ifdef MPF_STATIC_LIB -#define MPF_DECLARE(type) type __stdcall -#else -#ifdef MPF_LIB_EXPORT -#define MPF_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define MPF_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define MPF_DECLARE(type) type -#endif - -#endif /* MPF_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h b/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h deleted file mode 100644 index fe2f15cec0..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_activity_detector.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_activity_detector.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_ACTIVITY_DETECTOR_H -#define MPF_ACTIVITY_DETECTOR_H - -/** - * @file mpf_activity_detector.h - * @brief MPF Voice Activity Detector - */ - -#include "mpf_frame.h" -#include "mpf_codec_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Opaque (voice) activity detector */ -typedef struct mpf_activity_detector_t mpf_activity_detector_t; - -/** Events of activity detector */ -typedef enum { - MPF_DETECTOR_EVENT_NONE, /**< no event occurred */ - MPF_DETECTOR_EVENT_ACTIVITY, /**< voice activity (transition to activity from inactivity state) */ - MPF_DETECTOR_EVENT_INACTIVITY, /**< voice inactivity (transition to inactivity from activity state) */ - MPF_DETECTOR_EVENT_NOINPUT /**< noinput event occurred */ -} mpf_detector_event_e; - - -/** Create activity detector */ -MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool); - -/** Reset activity detector */ -MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector); - -/** Set threshold of voice activity (silence) level */ -MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold); - -/** Set noinput timeout */ -MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout); - -/** Set timeout required to trigger speech (transition from inactive to active state) */ -MPF_DECLARE(void) mpf_activity_detector_speech_timeout_set(mpf_activity_detector_t *detector, apr_size_t speech_timeout); - -/** Set timeout required to trigger silence (transition from active to inactive state) */ -MPF_DECLARE(void) mpf_activity_detector_silence_timeout_set(mpf_activity_detector_t *detector, apr_size_t silence_timeout); - -/** Process current frame, return detected event if any */ -MPF_DECLARE(mpf_detector_event_e) mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame); - - -APT_END_EXTERN_C - -#endif /* MPF_ACTIVITY_DETECTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h deleted file mode 100644 index d7673004ea..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_audio_file_descriptor.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_audio_file_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_AUDIO_FILE_DESCRIPTOR_H -#define MPF_AUDIO_FILE_DESCRIPTOR_H - -/** - * @file mpf_audio_file_descriptor.h - * @brief MPF Audio File Descriptor - */ - -#include -#include "mpf_stream_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** FILE_READER defined as a stream source */ -#define FILE_READER STREAM_DIRECTION_RECEIVE -/** FILE_WRITER defined as a stream sink */ -#define FILE_WRITER STREAM_DIRECTION_SEND - -/** Audio file descriptor declaration */ -typedef struct mpf_audio_file_descriptor_t mpf_audio_file_descriptor_t; - -/** Audio file descriptor */ -struct mpf_audio_file_descriptor_t { - /** Indicate descriptor type (reader and/or writer) */ - mpf_stream_direction_e mask; - /** Codec descriptor to use for audio file read/write */ - mpf_codec_descriptor_t *codec_descriptor; - /** File handle to read audio stream */ - FILE *read_handle; - /** File handle to write audio stream */ - FILE *write_handle; - /** Max size of file */ - apr_size_t max_write_size; -}; - -APT_END_EXTERN_C - -#endif /* MPF_AUDIO_FILE_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h b/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h deleted file mode 100644 index 92da4bead0..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_audio_file_stream.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_audio_file_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_AUDIO_FILE_STREAM_H -#define MPF_AUDIO_FILE_STREAM_H - -/** - * @file mpf_audio_file_stream.h - * @brief MPF Audio FIle Stream - */ - -#include "mpf_stream.h" -#include "mpf_audio_file_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** - * Create file stream. - * @param termination the back pointer to hold - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_file_stream_create(mpf_termination_t *termination, apr_pool_t *pool); - -/** - * Modify file stream. - * @param stream file stream to modify - * @param descriptor the descriptor to modify stream according - */ -MPF_DECLARE(apt_bool_t) mpf_file_stream_modify(mpf_audio_stream_t *stream, mpf_audio_file_descriptor_t *descriptor); - -APT_END_EXTERN_C - -#endif /* MPF_AUDIO_FILE_STREAM_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_bridge.h b/libs/unimrcp/libs/mpf/include/mpf_bridge.h deleted file mode 100644 index 2cde68194d..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_bridge.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_bridge.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_BRIDGE_H -#define MPF_BRIDGE_H - -/** - * @file mpf_bridge.h - * @brief MPF Stream Bridge - */ - -#include "mpf_object.h" - -APT_BEGIN_EXTERN_C - -/** - * Create bridge of audio streams. - * @param source the source audio stream - * @param sink the sink audio stream - * @param codec_manager the codec manager - * @param name the informative name used for debugging - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_object_t*) mpf_bridge_create( - mpf_audio_stream_t *source, - mpf_audio_stream_t *sink, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_BRIDGE_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_buffer.h deleted file mode 100644 index bb82f24ade..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_buffer.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_BUFFER_H -#define MPF_BUFFER_H - -/** - * @file mpf_buffer.h - * @brief Buffer of Media Chunks - */ - -#include "mpf_frame.h" - -APT_BEGIN_EXTERN_C - -/** Opaque media buffer declaration */ -typedef struct mpf_buffer_t mpf_buffer_t; - - -/** Create buffer */ -mpf_buffer_t* mpf_buffer_create(apr_pool_t *pool); - -/** Destroy buffer */ -void mpf_buffer_destroy(mpf_buffer_t *buffer); - -/** Restart buffer */ -apt_bool_t mpf_buffer_restart(mpf_buffer_t *buffer); - -/** Write audio chunk to buffer */ -apt_bool_t mpf_buffer_audio_write(mpf_buffer_t *buffer, void *data, apr_size_t size); - -/** Write event to buffer */ -apt_bool_t mpf_buffer_event_write(mpf_buffer_t *buffer, mpf_frame_type_e event_type); - -/** Read media frame from buffer */ -apt_bool_t mpf_buffer_frame_read(mpf_buffer_t *buffer, mpf_frame_t *media_frame); - -/** Get size of buffer **/ -apr_size_t mpf_buffer_get_size(const mpf_buffer_t *buffer); - -APT_END_EXTERN_C - -#endif /* MPF_BUFFER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec.h b/libs/unimrcp/libs/mpf/include/mpf_codec.h deleted file mode 100644 index b34a53aaa0..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_codec.h +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_codec.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_CODEC_H -#define MPF_CODEC_H - -/** - * @file mpf_codec.h - * @brief MPF Codec - */ - -#include "mpf_codec_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Codec virtual table declaration */ -typedef struct mpf_codec_vtable_t mpf_codec_vtable_t; -/** Codec declaration*/ -typedef struct mpf_codec_t mpf_codec_t; - -/** Codec */ -struct mpf_codec_t { - /** Codec manipulators (encode, decode, dissect) */ - const mpf_codec_vtable_t *vtable; - /** Codec attributes (capabilities) */ - const mpf_codec_attribs_t *attribs; - /** Optional static codec descriptor (pt < 96) */ - const mpf_codec_descriptor_t *static_descriptor; -}; - -/** Table of codec virtual methods */ -struct mpf_codec_vtable_t { - /** Virtual open method */ - apt_bool_t (*open)(mpf_codec_t *codec); - /** Virtual close method */ - apt_bool_t (*close)(mpf_codec_t *codec); - - /** Virtual encode method */ - apt_bool_t (*encode)(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out); - /** Virtual decode method */ - apt_bool_t (*decode)(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out); - - /** Virtual dissect method */ - apt_bool_t (*dissect)(mpf_codec_t *codec, void **buffer, apr_size_t *size, mpf_codec_frame_t *frame); - - /** Virtual initialize method */ - apt_bool_t (*initialize)(mpf_codec_t *codec, mpf_codec_frame_t *frame_out); -}; - -/** - * Create codec. - * @param vtable the table of virtual mthods - * @param attribs the codec attributes - * @param descriptor the codec descriptor - * @param pool the pool to allocate memory from - */ -static APR_INLINE mpf_codec_t* mpf_codec_create( - const mpf_codec_vtable_t *vtable, - const mpf_codec_attribs_t *attribs, - const mpf_codec_descriptor_t *descriptor, - apr_pool_t *pool) -{ - mpf_codec_t *codec = (mpf_codec_t*)apr_palloc(pool,sizeof(mpf_codec_t)); - codec->vtable = vtable; - codec->attribs = attribs; - codec->static_descriptor = descriptor; - return codec; -} - -/** - * Clone codec. - * @param src_codec the source (original) codec to clone - * @param pool the pool to allocate memory from - */ -static APR_INLINE mpf_codec_t* mpf_codec_clone(mpf_codec_t *src_codec, apr_pool_t *pool) -{ - mpf_codec_t *codec = (mpf_codec_t*)apr_palloc(pool,sizeof(mpf_codec_t)); - codec->vtable = src_codec->vtable; - codec->attribs = src_codec->attribs; - codec->static_descriptor = src_codec->static_descriptor; - return codec; -} - -/** Open codec */ -static APR_INLINE apt_bool_t mpf_codec_open(mpf_codec_t *codec) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->open) { - rv = codec->vtable->open(codec); - } - return rv; -} - -/** Close codec */ -static APR_INLINE apt_bool_t mpf_codec_close(mpf_codec_t *codec) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->close) { - rv = codec->vtable->close(codec); - } - return rv; -} - -/** Encode codec frame */ -static APR_INLINE apt_bool_t mpf_codec_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->encode) { - rv = codec->vtable->encode(codec,frame_in,frame_out); - } - return rv; -} - -/** Decode codec frame */ -static APR_INLINE apt_bool_t mpf_codec_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->decode) { - rv = codec->vtable->decode(codec,frame_in,frame_out); - } - return rv; -} - -/** Dissect codec frame (navigate through codec frames in a buffer, which may contain multiple frames) */ -static APR_INLINE apt_bool_t mpf_codec_dissect(mpf_codec_t *codec, void **buffer, apr_size_t *size, mpf_codec_frame_t *frame) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->dissect) { - /* custom dissector for codecs like G.729, G.723 */ - rv = codec->vtable->dissect(codec,buffer,size,frame); - } - else { - /* default dissector */ - if(*size >= frame->size && frame->size) { - memcpy(frame->buffer,*buffer,frame->size); - - *buffer = (apr_byte_t*)*buffer + frame->size; - *size = *size - frame->size; - } - else { - rv = FALSE; - } - } - return rv; -} - -/** Initialize (fill) codec frame with silence */ -static APR_INLINE apt_bool_t mpf_codec_initialize(mpf_codec_t *codec, mpf_codec_frame_t *frame_out) -{ - apt_bool_t rv = TRUE; - if(codec->vtable->initialize) { - rv = codec->vtable->initialize(codec,frame_out); - } - else { - memset(frame_out->buffer,0,frame_out->size); - } - return rv; -} - -APT_END_EXTERN_C - -#endif /* MPF_CODEC_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h deleted file mode 100644 index f4ed54e322..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_codec_descriptor.h +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_codec_descriptor.h 2239 2014-11-12 01:52:59Z achaloyan@gmail.com $ - */ - -#ifndef MPF_CODEC_DESCRIPTOR_H -#define MPF_CODEC_DESCRIPTOR_H - -/** - * @file mpf_codec_descriptor.h - * @brief MPF Codec Descriptor - */ - -#include -#include "apt_string.h" -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** Codec frame time base in msec */ -#define CODEC_FRAME_TIME_BASE 10 -/** Bytes per sample for linear pcm */ -#define BYTES_PER_SAMPLE 2 -/** Bits per sample for linear pcm */ -#define BITS_PER_SAMPLE 16 - -/** Supported sampling rates */ -typedef enum { - MPF_SAMPLE_RATE_NONE = 0x00, - MPF_SAMPLE_RATE_8000 = 0x01, - MPF_SAMPLE_RATE_16000 = 0x02, - MPF_SAMPLE_RATE_32000 = 0x04, - MPF_SAMPLE_RATE_48000 = 0x08, - - MPF_SAMPLE_RATE_SUPPORTED = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | - MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 -} mpf_sample_rates_e; - -/** Codec descriptor declaration */ -typedef struct mpf_codec_descriptor_t mpf_codec_descriptor_t; -/** Codec attributes declaration */ -typedef struct mpf_codec_attribs_t mpf_codec_attribs_t; -/** Codec list declaration */ -typedef struct mpf_codec_list_t mpf_codec_list_t; -/** Codec capabilities declaration */ -typedef struct mpf_codec_capabilities_t mpf_codec_capabilities_t; -/** Codec frame declaration */ -typedef struct mpf_codec_frame_t mpf_codec_frame_t; - - -/** Codec descriptor */ -struct mpf_codec_descriptor_t { - /** Payload type used in RTP packet */ - apr_byte_t payload_type; - /** Codec name */ - apt_str_t name; - /** Sampling rate */ - apr_uint16_t sampling_rate; - /** Channel count */ - apr_byte_t channel_count; - /** Codec dependent additional format */ - apt_str_t format; - /** Enabled/disabled state */ - apt_bool_t enabled; -}; - -/** List of codec descriptors */ -struct mpf_codec_list_t { - /** Dynamic array of codec descriptors (mpf_codec_descriptor_t) */ - apr_array_header_t *descriptor_arr; - /** Preffered primary (audio/video codec) descriptor from descriptor_arr */ - mpf_codec_descriptor_t *primary_descriptor; - /** Preffered named event (telephone-event) descriptor from descriptor_arr */ - mpf_codec_descriptor_t *event_descriptor; -}; - -/** Codec attributes */ -struct mpf_codec_attribs_t { - /** Codec name */ - apt_str_t name; - /** Bits per sample */ - apr_byte_t bits_per_sample; - /** Supported sampling rates (mpf_sample_rates_e) */ - int sample_rates; -}; - -/** List of codec attributes (capabilities) */ -struct mpf_codec_capabilities_t { - /** Dynamic array of codec attributes (mpf_codec_attrribs_t) */ - apr_array_header_t *attrib_arr; - /** Allow/support named events */ - apt_bool_t allow_named_events; -}; - -/** Codec frame */ -struct mpf_codec_frame_t { - /** Raw buffer, which may contain encoded or decoded data */ - void *buffer; - /** Buffer size */ - apr_size_t size; -}; - - -/** Initialize codec descriptor */ -static APR_INLINE void mpf_codec_descriptor_init(mpf_codec_descriptor_t *descriptor) -{ - descriptor->payload_type = 0; - apt_string_reset(&descriptor->name); - descriptor->sampling_rate = 0; - descriptor->channel_count = 0; - apt_string_reset(&descriptor->format); - descriptor->enabled = TRUE; -} - -/** Initialize codec descriptor */ -static APR_INLINE mpf_codec_descriptor_t* mpf_codec_descriptor_create(apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor = (mpf_codec_descriptor_t*) apr_palloc(pool,sizeof(mpf_codec_descriptor_t)); - mpf_codec_descriptor_init(descriptor); - return descriptor; -} - -/** Calculate encoded frame size in bytes */ -static APR_INLINE apr_size_t mpf_codec_frame_size_calculate(const mpf_codec_descriptor_t *descriptor, const mpf_codec_attribs_t *attribs) -{ - return (size_t) descriptor->channel_count * attribs->bits_per_sample * CODEC_FRAME_TIME_BASE * - descriptor->sampling_rate / 1000 / 8; /* 1000 - msec per sec, 8 - bits per byte */ -} - -/** Calculate samples of the frame (ts) */ -static APR_INLINE apr_size_t mpf_codec_frame_samples_calculate(const mpf_codec_descriptor_t *descriptor) -{ - return (size_t) descriptor->channel_count * CODEC_FRAME_TIME_BASE * descriptor->sampling_rate / 1000; -} - -/** Calculate linear frame size in bytes */ -static APR_INLINE apr_size_t mpf_codec_linear_frame_size_calculate(apr_uint16_t sampling_rate, apr_byte_t channel_count) -{ - return (size_t) channel_count * BYTES_PER_SAMPLE * CODEC_FRAME_TIME_BASE * sampling_rate / 1000; -} - - - -/** Reset list of codec descriptors */ -static APR_INLINE void mpf_codec_list_reset(mpf_codec_list_t *codec_list) -{ - codec_list->descriptor_arr = NULL; - codec_list->primary_descriptor = NULL; - codec_list->event_descriptor = NULL; -} - -/** Initialize list of codec descriptors */ -static APR_INLINE void mpf_codec_list_init(mpf_codec_list_t *codec_list, apr_size_t initial_count, apr_pool_t *pool) -{ - codec_list->descriptor_arr = apr_array_make(pool,(int)initial_count, sizeof(mpf_codec_descriptor_t)); - codec_list->primary_descriptor = NULL; - codec_list->event_descriptor = NULL; -} - -/** Copy list of codec descriptors */ -static APR_INLINE void mpf_codec_list_copy(mpf_codec_list_t *codec_list, const mpf_codec_list_t *src_codec_list, apr_pool_t *pool) -{ - codec_list->descriptor_arr = apr_array_copy(pool,src_codec_list->descriptor_arr); -} - -/** Increment number of codec descriptors in the list and return the descriptor to fill */ -static APR_INLINE mpf_codec_descriptor_t* mpf_codec_list_add(mpf_codec_list_t *codec_list) -{ - mpf_codec_descriptor_t *descriptor = (mpf_codec_descriptor_t*)apr_array_push(codec_list->descriptor_arr); - mpf_codec_descriptor_init(descriptor); - return descriptor; -} - -/** Determine if codec list is empty */ -static APR_INLINE apt_bool_t mpf_codec_list_is_empty(const mpf_codec_list_t *codec_list) -{ - return apr_is_empty_array(codec_list->descriptor_arr); -} - -/** Get codec descriptor by index */ -static APR_INLINE mpf_codec_descriptor_t* mpf_codec_list_descriptor_get(const mpf_codec_list_t *codec_list, apr_size_t id) -{ - if(id >= (apr_size_t)codec_list->descriptor_arr->nelts) { - return NULL; - } - return &APR_ARRAY_IDX(codec_list->descriptor_arr,id,mpf_codec_descriptor_t); -} - -/** Create linear PCM descriptor */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool); - -/** Create codec descriptor by capabilities */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_descriptor_create_by_capabilities(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *peer, apr_pool_t *pool); - -/** Match two codec descriptors */ -MPF_DECLARE(apt_bool_t) mpf_codec_descriptors_match(const mpf_codec_descriptor_t *descriptor1, const mpf_codec_descriptor_t *descriptor2); - -/** Match specified codec descriptor and the default lpcm one */ -MPF_DECLARE(apt_bool_t) mpf_codec_lpcm_descriptor_match(const mpf_codec_descriptor_t *descriptor); - -/** Match codec descriptor by attribs specified */ -MPF_DECLARE(apt_bool_t) mpf_codec_descriptor_match_by_attribs(mpf_codec_descriptor_t *descriptor, const mpf_codec_descriptor_t *static_descriptor, const mpf_codec_attribs_t *attribs); - - - -/** Initialize codec capabilities */ -static APR_INLINE void mpf_codec_capabilities_init(mpf_codec_capabilities_t *capabilities, apr_size_t initial_count, apr_pool_t *pool) -{ - capabilities->attrib_arr = apr_array_make(pool,(int)initial_count, sizeof(mpf_codec_attribs_t)); - capabilities->allow_named_events = TRUE; -} - -/** Clone codec capabilities */ -static APR_INLINE void mpf_codec_capabilities_clone(mpf_codec_capabilities_t *capabilities, const mpf_codec_capabilities_t *src_capabilities, apr_pool_t *pool) -{ - capabilities->attrib_arr = apr_array_copy(pool,src_capabilities->attrib_arr); - capabilities->allow_named_events = src_capabilities->allow_named_events; -} - -/** Merge codec capabilities */ -static APR_INLINE apt_bool_t mpf_codec_capabilities_merge(mpf_codec_capabilities_t *capabilities, const mpf_codec_capabilities_t *src_capabilities, apr_pool_t *pool) -{ - if(capabilities->allow_named_events == FALSE && src_capabilities->allow_named_events == TRUE) { - capabilities->allow_named_events = src_capabilities->allow_named_events; - } - capabilities->attrib_arr = apr_array_append(pool,capabilities->attrib_arr,src_capabilities->attrib_arr); - return TRUE; -} - -/** Add codec capabilities */ -static APR_INLINE apt_bool_t mpf_codec_capabilities_add(mpf_codec_capabilities_t *capabilities, int sample_rates, const char *codec_name) -{ - mpf_codec_attribs_t *attribs = (mpf_codec_attribs_t*)apr_array_push(capabilities->attrib_arr); - apt_string_assign(&attribs->name,codec_name,capabilities->attrib_arr->pool); - attribs->sample_rates = sample_rates; - attribs->bits_per_sample = 0; - return TRUE; -} - -/** Add default (linear PCM) capabilities */ -MPF_DECLARE(apt_bool_t) mpf_codec_default_capabilities_add(mpf_codec_capabilities_t *capabilities); - -/** Validate codec capabilities */ -static APR_INLINE apt_bool_t mpf_codec_capabilities_validate(mpf_codec_capabilities_t *capabilities) -{ - if(apr_is_empty_array(capabilities->attrib_arr) == TRUE) { - mpf_codec_default_capabilities_add(capabilities); - } - return TRUE; -} - - - -/** Find matched descriptor in codec list */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_list_descriptor_find(const mpf_codec_list_t *codec_list, const mpf_codec_descriptor_t *descriptor); - -/** Match codec list with specified capabilities */ -MPF_DECLARE(apt_bool_t) mpf_codec_list_match(mpf_codec_list_t *codec_list, const mpf_codec_capabilities_t *capabilities); - -/** Intersect two codec lists */ -MPF_DECLARE(apt_bool_t) mpf_codec_lists_intersect(mpf_codec_list_t *codec_list1, mpf_codec_list_t *codec_list2); - - -/** Get sampling rate mask (mpf_sample_rate_e) by integer value */ -MPF_DECLARE(int) mpf_sample_rate_mask_get(apr_uint16_t sampling_rate); - - -APT_END_EXTERN_C - -#endif /* MPF_CODEC_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h b/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h deleted file mode 100644 index 919d5112bb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_codec_manager.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_codec_manager.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_CODEC_MANAGER_H -#define MPF_CODEC_MANAGER_H - -/** - * @file mpf_codec_manager.h - * @brief MPF Codec Manager - */ - -#include "mpf_types.h" -#include "mpf_codec.h" - -APT_BEGIN_EXTERN_C - -/** Create codec manager */ -MPF_DECLARE(mpf_codec_manager_t*) mpf_codec_manager_create(apr_size_t codec_count, apr_pool_t *pool); - -/** Destroy codec manager */ -MPF_DECLARE(void) mpf_codec_manager_destroy(mpf_codec_manager_t *codec_manager); - -/** Register codec in codec manager */ -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_register(mpf_codec_manager_t *codec_manager, mpf_codec_t *codec); - -/** Get (allocate) codec by codec descriptor */ -MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_codec_get(const mpf_codec_manager_t *codec_manager, mpf_codec_descriptor_t *descriptor, apr_pool_t *pool); - -/** Get (allocate) list of available codecs */ -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_get(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, apr_pool_t *pool); - -/** Load (allocate) list of codecs */ -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_load(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, const char *str, apr_pool_t *pool); - -/** Find codec by name */ -MPF_DECLARE(const mpf_codec_t*) mpf_codec_manager_codec_find(const mpf_codec_manager_t *codec_manager, const apt_str_t *codec_name); - -APT_END_EXTERN_C - -#endif /* MPF_CODEC_MANAGER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_context.h b/libs/unimrcp/libs/mpf/include/mpf_context.h deleted file mode 100644 index 24e519ab81..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_context.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_context.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_CONTEXT_H -#define MPF_CONTEXT_H - -/** - * @file mpf_context.h - * @brief MPF Context - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque factory of media contexts */ -typedef struct mpf_context_factory_t mpf_context_factory_t; - -/** - * Create factory of media contexts. - */ -MPF_DECLARE(mpf_context_factory_t*) mpf_context_factory_create(apr_pool_t *pool); - -/** - * Destroy factory of media contexts. - */ -MPF_DECLARE(void) mpf_context_factory_destroy(mpf_context_factory_t *factory); - -/** - * Process factory of media contexts. - */ -MPF_DECLARE(apt_bool_t) mpf_context_factory_process(mpf_context_factory_t *factory); - -/** - * Create MPF context. - * @param factory the factory context belongs to - * @param name the informative name of the context - * @param obj the external object associated with context - * @param max_termination_count the max number of terminations in context - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_context_t*) mpf_context_create( - mpf_context_factory_t *factory, - const char *name, - void *obj, - apr_size_t max_termination_count, - apr_pool_t *pool); - -/** - * Destroy MPF context. - * @param context the context to destroy - */ -MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context); - -/** - * Get external object associated with MPF context. - * @param context the context to get object from - */ -MPF_DECLARE(void*) mpf_context_object_get(const mpf_context_t *context); - -/** - * Add termination to context. - * @param context the context to add termination to - * @param termination the termination to add - */ -MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination); - -/** - * Subtract termination from context. - * @param context the context to subtract termination from - * @param termination the termination to subtract - */ -MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination); - -/** - * Add association between specified terminations. - * @param context the context to add association in the scope of - * @param termination1 the first termination to associate - * @param termination2 the second termination to associate - */ -MPF_DECLARE(apt_bool_t) mpf_context_association_add(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2); - -/** - * Remove association between specified terminations. - * @param context the context to remove association in the scope of - * @param termination1 the first termination - * @param termination2 the second termination - */ -MPF_DECLARE(apt_bool_t) mpf_context_association_remove(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2); - -/** - * Reset assigned associations and destroy applied topology. - * @param context the context to reset associations for - */ -MPF_DECLARE(apt_bool_t) mpf_context_associations_reset(mpf_context_t *context); - -/** - * Apply topology. - * @param context the context to apply topology for - */ -MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context); - -/** - * Destroy topology. - * @param context the context to destroy topology for - */ -MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context); - -/** - * Process context. - * @param context the context to process - */ -MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context); - - -APT_END_EXTERN_C - -#endif /* MPF_CONTEXT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_decoder.h b/libs/unimrcp/libs/mpf/include/mpf_decoder.h deleted file mode 100644 index 930b1dcb6b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_decoder.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_decoder.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_DECODER_H -#define MPF_DECODER_H - -/** - * @file mpf_decoder.h - * @brief MPF Stream Decoder - */ - -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream decoder. - * @param source the source to get encoded stream from - * @param codec the codec to use for decode - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_decoder_create(mpf_audio_stream_t *source, mpf_codec_t *codec, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_ENCODER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h b/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h deleted file mode 100644 index 4108e3bd9b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_dtmf_detector.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan - * - * 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. - * - * $Id: mpf_dtmf_detector.h 1474 2010-02-07 20:51:47Z achaloyan $ - */ - -#ifndef MPF_DTMF_DETECTOR_H -#define MPF_DTMF_DETECTOR_H - -/** - * @file mpf_dtmf_detector.h - * @brief DTMF detector - * - * Detector of DTMF tones sent both out-of-band (RFC4733) and in-band (audio). - */ - -#include "apr.h" -#include "apr_pools.h" -#include "apt.h" -#include "mpf_frame.h" -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** DTMF detector band */ -typedef enum mpf_dtmf_detector_band_e { - /** Detect tones in-band */ - MPF_DTMF_DETECTOR_INBAND = 0x1, - /** Detect named events out-of-band */ - MPF_DTMF_DETECTOR_OUTBAND = 0x2, - /** Detect both in-band and out-of-band digits */ - MPF_DTMF_DETECTOR_BOTH = MPF_DTMF_DETECTOR_INBAND | MPF_DTMF_DETECTOR_OUTBAND -} mpf_dtmf_detector_band_e; - -/** Opaque MPF DTMF detector structure definition */ -typedef struct mpf_dtmf_detector_t mpf_dtmf_detector_t; - - -/** - * Create MPF DTMF detector (advanced). - * @param stream A stream to get digits from. - * @param band One of: - * - MPF_DTMF_DETECTOR_INBAND: detect audible tones only - * - MPF_DTMF_DETECTOR_OUTBAND: detect out-of-band named-events only - * - MPF_DTMF_DETECTOR_BOTH: detect digits in both bands if supported by - * stream. When out-of-band digit arrives, in-band detection is turned off. - * @param pool Memory pool to allocate DTMF detector from. - * @return The object or NULL on error. - * @see mpf_dtmf_detector_create - */ -MPF_DECLARE(struct mpf_dtmf_detector_t *) mpf_dtmf_detector_create_ex( - const struct mpf_audio_stream_t *stream, - enum mpf_dtmf_detector_band_e band, - struct apr_pool_t *pool); - -/** - * Create MPF DTMF detector (simple). Calls mpf_dtmf_detector_create_ex - * with band = MPF_DTMF_DETECTOR_BOTH if out-of-band supported by the stream, - * MPF_DTMF_DETECTOR_INBAND otherwise. - * @param stream A stream to get digits from. - * @param pool Memory pool to allocate DTMF detector from. - * @return The object or NULL on error. - * @see mpf_dtmf_detector_create_ex - */ -static APR_INLINE struct mpf_dtmf_detector_t *mpf_dtmf_detector_create( - const struct mpf_audio_stream_t *stream, - struct apr_pool_t *pool) -{ - return mpf_dtmf_detector_create_ex(stream, - stream->tx_event_descriptor ? MPF_DTMF_DETECTOR_BOTH : MPF_DTMF_DETECTOR_INBAND, - pool); -} - -/** - * Get DTMF digit from buffer of digits detected so far and remove it. - * @param detector The detector. - * @return DTMF character [0-9*#A-D] or NUL if the buffer is empty. - */ -MPF_DECLARE(char) mpf_dtmf_detector_digit_get(struct mpf_dtmf_detector_t *detector); - -/** - * Retrieve how many digits was lost due to full buffer. - * @param detector The detector. - * @return Number of lost digits. - */ -MPF_DECLARE(apr_size_t) mpf_dtmf_detector_digits_lost(const struct mpf_dtmf_detector_t *detector); - -/** - * Empty the buffer and reset detection states. - * @param detector The detector. - */ -MPF_DECLARE(void) mpf_dtmf_detector_reset(struct mpf_dtmf_detector_t *detector); - -/** - * Detect DTMF digits in the frame. - * @param detector The detector. - * @param frame Frame object passed in stream_write(). - */ -MPF_DECLARE(void) mpf_dtmf_detector_get_frame( - struct mpf_dtmf_detector_t *detector, - const struct mpf_frame_t *frame); - -/** - * Free all resources associated with the detector. - * @param detector The detector. - */ -MPF_DECLARE(void) mpf_dtmf_detector_destroy(struct mpf_dtmf_detector_t *detector); - -APT_END_EXTERN_C - -#endif /* MPF_DTMF_DETECTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h b/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h deleted file mode 100644 index ea28bba432..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_dtmf_generator.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan - * - * 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. - */ - -#ifndef MPF_DTMF_GENERATOR_H -#define MPF_DTMF_GENERATOR_H - -/** - * @file mpf_dtmf_generator.h - * @brief DTMF generator - * - * Generator used to send DTMF tones. Capable to send digits - * either in-band as audible tones or out-of-band according - * to RFC4733. - */ - -#include "apr_pools.h" -#include "apt.h" -#include "mpf_frame.h" -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** DTMF generator band */ -typedef enum mpf_dtmf_generator_band_e { - /** Generate tones in-band */ - MPF_DTMF_GENERATOR_INBAND = 0x1, - /** Generate named events out-of-band */ - MPF_DTMF_GENERATOR_OUTBAND = 0x2, - /** Generate both tones and named events */ - MPF_DTMF_GENERATOR_BOTH = MPF_DTMF_GENERATOR_INBAND | MPF_DTMF_GENERATOR_OUTBAND -} mpf_dtmf_generator_band_e; - -/** Opaque MPF DTMF generator structure definition */ -typedef struct mpf_dtmf_generator_t mpf_dtmf_generator_t; - - -/** - * Create MPF DTMF generator (advanced). - * @param stream A stream to transport digits via. - * @param band MPF_DTMF_GENERATOR_INBAND or MPF_DTMF_GENERATOR_OUTBAND - * @param tone_ms Tone duration in milliseconds. - * @param silence_ms Inter-digit silence in milliseconds. - * @param pool Memory pool to allocate DTMF generator from. - * @return The object or NULL on error. - * @see mpf_dtmf_generator_create - */ -MPF_DECLARE(struct mpf_dtmf_generator_t *) mpf_dtmf_generator_create_ex( - const struct mpf_audio_stream_t *stream, - enum mpf_dtmf_generator_band_e band, - apr_uint32_t tone_ms, - apr_uint32_t silence_ms, - struct apr_pool_t *pool); - -/** - * Create MPF DTMF generator (simple). Calls mpf_dtmf_generator_create_ex - * with band = MPF_DTMF_GENERATOR_OUTBAND if supported by the stream or - * MPF_DTMF_GENERATOR_INBAND otherwise, tone_ms = 70, silence_ms = 50. - * @param stream A stream to transport digits via. - * @param pool Memory pool to allocate DTMF generator from. - * @return The object or NULL on error. - * @see mpf_dtmf_generator_create_ex - */ -static APR_INLINE struct mpf_dtmf_generator_t *mpf_dtmf_generator_create( - const struct mpf_audio_stream_t *stream, - struct apr_pool_t *pool) -{ - return mpf_dtmf_generator_create_ex(stream, - stream->rx_event_descriptor ? MPF_DTMF_GENERATOR_OUTBAND : MPF_DTMF_GENERATOR_INBAND, - 70, 50, pool); -} - -/** - * Add DTMF digits to the queue. - * @param generator The generator. - * @param digits DTMF character sequence [0-9*#A-D]. - * @return TRUE if ok, FALSE if there are too many digits. - */ -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_enqueue( - struct mpf_dtmf_generator_t *generator, - const char *digits); - -/** - * Empty the queue and immediately stop generating. - * @param generator The generator. - */ -MPF_DECLARE(void) mpf_dtmf_generator_reset(struct mpf_dtmf_generator_t *generator); - -/** - * Check state of the generator. - * @param generator The generator. - * @return TRUE if generating a digit or there are digits waiting in queue. - * FALSE if the queue is empty or generating silence after the last digit. - */ -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_sending(const struct mpf_dtmf_generator_t *generator); - -/** - * Put frame into the stream. - * @param generator The generator. - * @param frame Frame object passed in stream_read(). - * @return TRUE if frame with tone (both in-band and out-of-band) was generated, - * FALSE otherwise. In contrast to mpf_dtmf_generator_sending, returns FALSE even - * if generating inter-digit silence. In other words returns TRUE iff the frame - * object was filled with data. This method MUST be called for each frame for - * proper timing. - */ -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_put_frame( - struct mpf_dtmf_generator_t *generator, - struct mpf_frame_t *frame); - -/** - * Free all resources associated with the generator. - * @param generator The generator. - */ -MPF_DECLARE(void) mpf_dtmf_generator_destroy(struct mpf_dtmf_generator_t *generator); - -APT_END_EXTERN_C - -#endif /* MPF_DTMF_GENERATOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_encoder.h b/libs/unimrcp/libs/mpf/include/mpf_encoder.h deleted file mode 100644 index 21e49120db..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_encoder.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_encoder.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_ENCODER_H -#define MPF_ENCODER_H - -/** - * @file mpf_encoder.h - * @brief MPF Stream Encoder - */ - -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream encoder. - * @param sink the sink to write encoded stream to - * @param codec the codec to use for encode - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_encoder_create(mpf_audio_stream_t *sink, mpf_codec_t *codec, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_ENCODER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_engine.h b/libs/unimrcp/libs/mpf/include/mpf_engine.h deleted file mode 100644 index 4192ccf33b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_engine.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_ENGINE_H -#define MPF_ENGINE_H - -/** - * @file mpf_engine.h - * @brief Media Processing Framework Engine - */ - -#include "apt_task.h" -#include "mpf_message.h" - -APT_BEGIN_EXTERN_C - -/** MPF task message definition */ -typedef apt_task_msg_t mpf_task_msg_t; - -/** - * Create MPF engine. - * @param id the identifier of the engine - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_engine_t*) mpf_engine_create(const char *id, apr_pool_t *pool); - -/** - * Create MPF codec manager. - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_codec_manager_t*) mpf_engine_codec_manager_create(apr_pool_t *pool); - -/** - * Register MPF codec manager. - * @param engine the engine to register codec manager for - * @param codec_manager the codec manager to register - */ -MPF_DECLARE(apt_bool_t) mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager); - -/** - * Create MPF context. - * @param engine the engine to create context for - * @param name the informative name of the context - * @param obj the external object associated with context - * @param max_termination_count the max number of terminations in context - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_context_t*) mpf_engine_context_create( - mpf_engine_t *engine, - const char *name, - void *obj, - apr_size_t max_termination_count, - apr_pool_t *pool); - -/** - * Destroy MPF context. - * @param context the context to destroy - */ -MPF_DECLARE(apt_bool_t) mpf_engine_context_destroy(mpf_context_t *context); - -/** - * Get external object associated with MPF context. - * @param context the context to get object from - */ -MPF_DECLARE(void*) mpf_engine_context_object_get(const mpf_context_t *context); - -/** - * Get task. - * @param engine the engine to get task from - */ -MPF_DECLARE(apt_task_t*) mpf_task_get(const mpf_engine_t *engine); - -/** - * Set task msg type to send responses and events with. - * @param engine the engine to set task msg type for - * @param type the type to set - */ -MPF_DECLARE(void) mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type); - -/** - * Create task message(if not created) and add MPF termination message to it. - * @param engine the engine task message belongs to - * @param command_id the MPF command identifier - * @param context the context to add termination to - * @param termination the termination to add - * @param descriptor the termination dependent descriptor - * @param task_msg the task message to create and add constructed MPF message to - */ -MPF_DECLARE(apt_bool_t) mpf_engine_termination_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_termination_t *termination, - void *descriptor, - mpf_task_msg_t **task_msg); - -/** - * Create task message(if not created) and add MPF association message to it. - * @param engine the engine task message belongs to - * @param command_id the MPF command identifier - * @param context the context to add association of terminations for - * @param termination the termination to associate - * @param assoc_termination the termination to associate - * @param task_msg the task message to create and add constructed MPF message to - */ -MPF_DECLARE(apt_bool_t) mpf_engine_assoc_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_termination_t *termination, - mpf_termination_t *assoc_termination, - mpf_task_msg_t **task_msg); - -/** - * Create task message(if not created) and add MPF topology message to it. - * @param engine the engine task message belongs to - * @param command_id the MPF command identifier - * @param context the context to modify topology for - * @param task_msg the task message to create and add constructed MPF message to - */ -MPF_DECLARE(apt_bool_t) mpf_engine_topology_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_task_msg_t **task_msg); - -/** - * Send MPF task message. - * @param engine the engine to send task message to - * @param task_msg the task message to send - */ -MPF_DECLARE(apt_bool_t) mpf_engine_message_send(mpf_engine_t *engine, mpf_task_msg_t **task_msg); - -/** - * Set scheduler rate. - * @param engine the engine to set rate for - * @param rate the rate (n times faster than real-time) - */ -MPF_DECLARE(apt_bool_t) mpf_engine_scheduler_rate_set(mpf_engine_t *engine, unsigned long rate); - -/** - * Get the identifier of the engine . - * @param engine the engine to get name of - */ -MPF_DECLARE(const char*) mpf_engine_id_get(const mpf_engine_t *engine); - - -APT_END_EXTERN_C - -#endif /* MPF_ENGINE_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h b/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h deleted file mode 100644 index d53607e2a4..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_engine_factory.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_engine_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_ENGINE_FACTORY_H -#define MPF_ENGINE_FACTORY_H - -/** - * @file mpf_engine.h - * @brief Factory of Media Processing Engines - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Create factory of media engines. */ -MPF_DECLARE(mpf_engine_factory_t*) mpf_engine_factory_create(apr_pool_t *pool); - -/** Add media engine to factory. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_engine_add(mpf_engine_factory_t *mpf_factory, mpf_engine_t *media_engine); - -/** Determine whether factory is empty. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_is_empty(const mpf_engine_factory_t *mpf_factory); - -/** Select next available media engine. */ -MPF_DECLARE(mpf_engine_t*) mpf_engine_factory_engine_select(mpf_engine_factory_t *mpf_factory); - -/** Associate media engines with RTP termination factory. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_rtp_factory_assign(mpf_engine_factory_t *mpf_factory, mpf_termination_factory_t *rtp_factory); - -APT_END_EXTERN_C - -#endif /* MPF_ENGINE_FACTORY_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h deleted file mode 100644 index f1c9cbe99b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_file_termination_factory.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_file_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_FILE_TERMINATION_FACTORY_H -#define MPF_FILE_TERMINATION_FACTORY_H - -/** - * @file mpf_file_termination_factory.h - * @brief MPF File Termination Factory - */ - -#include "mpf_termination_factory.h" - -APT_BEGIN_EXTERN_C - -/** - * Create file termination factory. - */ -MPF_DECLARE(mpf_termination_factory_t*) mpf_file_termination_factory_create(apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_RTP_TERMINATION_FACTORY_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_frame.h b/libs/unimrcp/libs/mpf/include/mpf_frame.h deleted file mode 100644 index af37459962..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_frame.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_frame.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_FRAME_H -#define MPF_FRAME_H - -/** - * @file mpf_frame.h - * @brief MPF Audio/Video/Named-event Frame - */ - -#include "mpf_codec_descriptor.h" -#include "mpf_named_event.h" - -APT_BEGIN_EXTERN_C - -/** Media frame types */ -typedef enum { - MEDIA_FRAME_TYPE_NONE = 0x0, /**< none */ - MEDIA_FRAME_TYPE_AUDIO = 0x1, /**< audio frame */ - MEDIA_FRAME_TYPE_VIDEO = 0x2, /**< video frame */ - MEDIA_FRAME_TYPE_EVENT = 0x4 /**< named event frame (RFC4733/RFC2833) */ -} mpf_frame_type_e; - -/** Media frame marker */ -typedef enum { - MPF_MARKER_NONE, /**< none */ - MPF_MARKER_START_OF_EVENT, /**< start of event */ - MPF_MARKER_END_OF_EVENT, /**< end of event */ - MPF_MARKER_NEW_SEGMENT /**< start of new segment (long-lasting events) */ -} mpf_frame_marker_e; - -/** Media frame declaration */ -typedef struct mpf_frame_t mpf_frame_t; - -/** Media frame */ -struct mpf_frame_t { - /** frame type (audio/video/named-event) mpf_frame_type_e */ - int type; - /** frame marker (start-of-event,end-of-event) mpf_frame_marker_e */ - int marker; - /** codec frame */ - mpf_codec_frame_t codec_frame; - /** named-event frame */ - mpf_named_event_frame_t event_frame; -}; - - -APT_END_EXTERN_C - -#endif /* MPF_FRAME_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h deleted file mode 100644 index 749479fe22..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_frame_buffer.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_frame_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_FRAME_BUFFER_H -#define MPF_FRAME_BUFFER_H - -/** - * @file mpf_frame_buffer.h - * @brief Buffer of Media Frames - */ - -#include "mpf_frame.h" - -APT_BEGIN_EXTERN_C - -/** Opaque frame buffer declaration */ -typedef struct mpf_frame_buffer_t mpf_frame_buffer_t; - - -/** Create frame buffer */ -mpf_frame_buffer_t* mpf_frame_buffer_create(apr_size_t frame_size, apr_size_t frame_count, apr_pool_t *pool); - -/** Destroy frame buffer */ -void mpf_frame_buffer_destroy(mpf_frame_buffer_t *buffer); - -/** Restart frame buffer */ -apt_bool_t mpf_frame_buffer_restart(mpf_frame_buffer_t *buffer); - -/** Write frame to buffer */ -apt_bool_t mpf_frame_buffer_write(mpf_frame_buffer_t *buffer, const mpf_frame_t *frame); - -/** Read frame from buffer */ -apt_bool_t mpf_frame_buffer_read(mpf_frame_buffer_t *buffer, mpf_frame_t *frame); - -#ifdef MPF_FRAME_BUFFER_DEBUG -apt_bool_t mpf_frame_buffer_file_open(mpf_frame_buffer_t *buffer, const char *utt_file_in, const char *utt_file_out); -#endif - -APT_END_EXTERN_C - -#endif /* MPF_FRAME_BUFFER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h b/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h deleted file mode 100644 index 5b483607fb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_jitter_buffer.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_jitter_buffer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_JITTER_BUFFER_H -#define MPF_JITTER_BUFFER_H - -/** - * @file mpf_jitter_buffer.h - * @brief Jitter Buffer - */ - -#include "mpf_frame.h" -#include "mpf_codec.h" -#include "mpf_rtp_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Jitter buffer write result */ -typedef enum { - JB_OK, /**< successful write */ - JB_DISCARD_NOT_ALLIGNED, /**< discarded write (frame isn't alligned to CODEC_FRAME_TIME_BASE) */ - JB_DISCARD_TOO_LATE, /**< discarded write (frame is arrived too late) */ - JB_DISCARD_TOO_EARLY, /**< discarded write (frame is arrived too early, buffer is full) */ -} jb_result_t; - -/** Opaque jitter buffer declaration */ -typedef struct mpf_jitter_buffer_t mpf_jitter_buffer_t; - - -/** Create jitter buffer */ -mpf_jitter_buffer_t* mpf_jitter_buffer_create(mpf_jb_config_t *jb_config, mpf_codec_descriptor_t *descriptor, mpf_codec_t *codec, apr_pool_t *pool); - -/** Destroy jitter buffer */ -void mpf_jitter_buffer_destroy(mpf_jitter_buffer_t *jb); - -/** Restart jitter buffer */ -apt_bool_t mpf_jitter_buffer_restart(mpf_jitter_buffer_t *jb); - -/** Write audio data to jitter buffer */ -jb_result_t mpf_jitter_buffer_write(mpf_jitter_buffer_t *jb, void *buffer, apr_size_t size, apr_uint32_t ts, apr_byte_t marker); - -/** Write named event to jitter buffer */ -jb_result_t mpf_jitter_buffer_event_write(mpf_jitter_buffer_t *jb, const mpf_named_event_frame_t *named_event, apr_uint32_t ts, apr_byte_t marker); - -/** Read media frame from jitter buffer */ -apt_bool_t mpf_jitter_buffer_read(mpf_jitter_buffer_t *jb, mpf_frame_t *media_frame); - -/** Get current playout delay */ -apr_uint32_t mpf_jitter_buffer_playout_delay_get(const mpf_jitter_buffer_t *jb); - -APT_END_EXTERN_C - -#endif /* MPF_JITTER_BUFFER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_message.h b/libs/unimrcp/libs/mpf/include/mpf_message.h deleted file mode 100644 index 91db7f0946..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_message.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_MESSAGE_H -#define MPF_MESSAGE_H - -/** - * @file mpf_message.h - * @brief Media Processing Framework Message Definitions - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Max number of messages grouped in a container */ -#define MAX_MPF_MESSAGE_COUNT 5 - -/** Enumeration of MPF message types */ -typedef enum { - MPF_MESSAGE_TYPE_REQUEST, /**< request message */ - MPF_MESSAGE_TYPE_RESPONSE, /**< response message */ - MPF_MESSAGE_TYPE_EVENT /**< event message */ -} mpf_message_type_e; - -/** Enumeration of MPF status codes */ -typedef enum { - MPF_STATUS_CODE_SUCCESS, /**< indicates success */ - MPF_STATUS_CODE_FAILURE /**< indicates failure */ -} mpf_status_code_e; - - -/** Enumeration of MPF commands */ -typedef enum { - MPF_ADD_TERMINATION, /**< add termination to context */ - MPF_MODIFY_TERMINATION, /**< modify termination properties */ - MPF_SUBTRACT_TERMINATION,/**< subtract termination from context */ - MPF_ADD_ASSOCIATION, /**< add association between terminations */ - MPF_REMOVE_ASSOCIATION, /**< remove association between terminations */ - MPF_RESET_ASSOCIATIONS, /**< reset associations among terminations (also destroy topology) */ - MPF_APPLY_TOPOLOGY, /**< apply topology based on assigned associations */ - MPF_DESTROY_TOPOLOGY /**< destroy applied topology */ -} mpf_command_type_e; - -/** MPF message declaration */ -typedef struct mpf_message_t mpf_message_t; -/** MPF message container declaration */ -typedef struct mpf_message_container_t mpf_message_container_t; - -/** MPF message definition */ -struct mpf_message_t { - /** Message type (request/response/event) */ - mpf_message_type_e message_type; - /** Command identifier (add, modify, subtract, ...) */ - mpf_command_type_e command_id; - /** Status code used in responses */ - mpf_status_code_e status_code; - - /** Context */ - mpf_context_t *context; - /** Termination */ - mpf_termination_t *termination; - /** Associated termination */ - mpf_termination_t *assoc_termination; - /** Termination type dependent descriptor */ - void *descriptor; -}; - -/** MPF message container definition */ -struct mpf_message_container_t { - /** Number of actual messages */ - apr_size_t count; - /** Array of messages */ - mpf_message_t messages[MAX_MPF_MESSAGE_COUNT]; -}; - -APT_END_EXTERN_C - -#endif /* MPF_MESSAGE_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_mixer.h b/libs/unimrcp/libs/mpf/include/mpf_mixer.h deleted file mode 100644 index c4e66542d2..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_mixer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_mixer.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_MIXER_H -#define MPF_MIXER_H - -/** - * @file mpf_mixer.h - * @brief MPF Stream Mixer (n-sources, 1-sink) - */ - -#include "mpf_object.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream mixer. - * @param source_arr the array of audio sources - * @param source_count the number of audio sources - * @param sink the audio sink - * @param codec_manager the codec manager - * @param name the informative name used for debugging - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_object_t*) mpf_mixer_create( - mpf_audio_stream_t **source_arr, - apr_size_t source_count, - mpf_audio_stream_t *sink, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_MIXER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_multiplier.h b/libs/unimrcp/libs/mpf/include/mpf_multiplier.h deleted file mode 100644 index 04d36469eb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_multiplier.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_multiplier.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_MULTIPLIER_H -#define MPF_MULTIPLIER_H - -/** - * @file mpf_multiplier.h - * @brief MPF Stream Multiplier (1-source, n-sinks) - */ - -#include "mpf_object.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream multiplier. - * @param source the audio source - * @param sink_arr the array of audio sinks - * @param sink_count the number of audio sinks - * @param codec_manager the codec manager - * @param name the informative name used for debugging - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_object_t*) mpf_multiplier_create( - mpf_audio_stream_t *source, - mpf_audio_stream_t **sink_arr, - apr_size_t sink_count, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_MULTIPLIER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_named_event.h b/libs/unimrcp/libs/mpf/include/mpf_named_event.h deleted file mode 100644 index 1ffc71fc2b..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_named_event.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_named_event.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_NAMED_EVENT_H -#define MPF_NAMED_EVENT_H - -/** - * @file mpf_named_event.h - * @brief MPF Named Events (RFC4733/RFC2833) - */ - -#include "mpf_codec_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Named event declaration */ -typedef struct mpf_named_event_frame_t mpf_named_event_frame_t; - - -/** Named event (RFC4733/RFC2833, out-of-band DTMF) */ -struct mpf_named_event_frame_t { - /** event (DTMF, tone) identifier */ - apr_uint32_t event_id: 8; -#if (APR_IS_BIGENDIAN == 1) - /** end of event */ - apr_uint32_t edge: 1; - /** reserved */ - apr_uint32_t reserved: 1; - /** tone volume */ - apr_uint32_t volume: 6; -#else - /** tone volume */ - apr_uint32_t volume: 6; - /** reserved */ - apr_uint32_t reserved: 1; - /** end of event */ - apr_uint32_t edge: 1; -#endif - /** event duration */ - apr_uint32_t duration: 16; -}; - -/** Create named event descriptor */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_event_descriptor_create(apr_uint16_t sampling_rate, apr_pool_t *pool); - -/** Check whether the specified descriptor is named event one */ -MPF_DECLARE(apt_bool_t) mpf_event_descriptor_check(const mpf_codec_descriptor_t *descriptor); - -/** Convert DTMF character to event identifier */ -MPF_DECLARE(apr_uint32_t) mpf_dtmf_char_to_event_id(const char dtmf_char); - -/** Convert event identifier to DTMF character */ -MPF_DECLARE(char) mpf_event_id_to_dtmf_char(const apr_uint32_t event_id); - - -APT_END_EXTERN_C - -#endif /* MPF_NAMED_EVENT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_object.h b/libs/unimrcp/libs/mpf/include/mpf_object.h deleted file mode 100644 index 2e8db829b5..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_object.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_object.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_OBJECT_H -#define MPF_OBJECT_H - -/** - * @file mpf_object.h - * @brief Media Processing Object Base (bridge, multiplexor, mixer, ...) - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** MPF object declaration */ -typedef struct mpf_object_t mpf_object_t; - -/** Media processing objects base */ -struct mpf_object_t { - /** Informative name used for debugging */ - const char *name; - /** Virtual destroy */ - apt_bool_t (*destroy)(mpf_object_t *object); - /** Virtual process */ - apt_bool_t (*process)(mpf_object_t *object); - /** Virtual trace of media path */ - void (*trace)(mpf_object_t *object); -}; - -/** Initialize object */ -static APR_INLINE void mpf_object_init(mpf_object_t *object, const char *name) -{ - object->name = name; - object->destroy = NULL; - object->process = NULL; - object->trace = NULL; -} - -/** Destroy object */ -static APR_INLINE void mpf_object_destroy(mpf_object_t *object) -{ - if(object->destroy) - object->destroy(object); -} - -/** Process object */ -static APR_INLINE void mpf_object_process(mpf_object_t *object) -{ - if(object->process) - object->process(object); -} - -/** Trace media path */ -static APR_INLINE void mpf_object_trace(mpf_object_t *object) -{ - if(object->trace) - object->trace(object); -} - - -APT_END_EXTERN_C - -#endif /* MPF_OBJECT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_resampler.h b/libs/unimrcp/libs/mpf/include/mpf_resampler.h deleted file mode 100644 index 13e0e59143..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_resampler.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_resampler.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RESAMPLER_H -#define MPF_RESAMPLER_H - -/** - * @file mpf_resampler.h - * @brief MPF Stream Resampler - */ - -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** - * Create audio stream resampler. - * @param source the source stream to resample - * @param sink the sink stream to resample to - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_resampler_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_RESAMPLER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h b/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h deleted file mode 100644 index 7afa55ede1..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtcp_packet.h +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtcp_packet.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTCP_PACKET_H -#define MPF_RTCP_PACKET_H - -/** - * @file mpf_rtcp_packet.h - * @brief RTCP Packet Definition - */ - -#include "mpf_rtp_stat.h" - -APT_BEGIN_EXTERN_C - - -/** RTCP payload (packet) types */ -typedef enum { - RTCP_SR = 200, - RTCP_RR = 201, - RTCP_SDES = 202, - RTCP_BYE = 203, - RTCP_APP = 204 -} rtcp_type_e; - -/** RTCP SDES types */ -typedef enum { - RTCP_SDES_END = 0, - RTCP_SDES_CNAME = 1, - RTCP_SDES_NAME = 2, - RTCP_SDES_EMAIL = 3, - RTCP_SDES_PHONE = 4, - RTCP_SDES_LOC = 5, - RTCP_SDES_TOOL = 6, - RTCP_SDES_NOTE = 7, - RTCP_SDES_PRIV = 8 -} rtcp_sdes_type_e; - -/** RTCP header declaration */ -typedef struct rtcp_header_t rtcp_header_t; -/** RTCP packet declaration */ -typedef struct rtcp_packet_t rtcp_packet_t; -/** SDES item declaration*/ -typedef struct rtcp_sdes_item_t rtcp_sdes_item_t; - - -/** RTCP header */ -struct rtcp_header_t { -#if (APR_IS_BIGENDIAN == 1) - /** protocol version */ - unsigned int version: 2; - /** padding flag */ - unsigned int padding: 1; - /** varies by packet type */ - unsigned int count: 5; - /** packet type */ - unsigned int pt: 8; -#else - /** varies by packet type */ - unsigned int count: 5; - /** padding flag */ - unsigned int padding: 1; - /** protocol version */ - unsigned int version: 2; - /** packet type */ - unsigned int pt: 8; -#endif - - /** packet length in words, w/o this word */ - unsigned int length: 16; -}; - -/** SDES item */ -struct rtcp_sdes_item_t { - /** type of item (rtcp_sdes_type_t) */ - apr_byte_t type; - /** length of item (in octets) */ - apr_byte_t length; - /** text, not null-terminated */ - char data[1]; -}; - -/** RTCP packet */ -struct rtcp_packet_t { - /** common header */ - rtcp_header_t header; - /** union of RTCP reports */ - union { - /** sender report (SR) */ - struct { - /** sr stat */ - rtcp_sr_stat_t sr_stat; - /** variable-length list rr stats */ - rtcp_rr_stat_t rr_stat[1]; - } sr; - - /** reception report (RR) */ - struct { - /** receiver generating this report */ - apr_uint32_t ssrc; - /** variable-length list rr stats */ - rtcp_rr_stat_t rr_stat[1]; - } rr; - - /** source description (SDES) */ - struct { - /** first SSRC/CSRC */ - apr_uint32_t ssrc; - /** list of SDES items */ - rtcp_sdes_item_t item[1]; - } sdes; - - /** BYE */ - struct { - /** list of sources */ - apr_uint32_t ssrc[1]; - /* optional length of reason string (in octets) */ - apr_byte_t length; - /* optional reason string, not null-terminated */ - char data[1]; - } bye; - } r; -}; - -/** Initialize RTCP header */ -static APR_INLINE void rtcp_header_init(rtcp_header_t *header, rtcp_type_e pt) -{ - header->version = RTP_VERSION; - header->padding = 0; - header->count = 0; - header->pt = pt; - header->length = 0; -} - -static APR_INLINE void rtcp_header_length_set(rtcp_header_t *header, apr_size_t length) -{ - header->length = htons((apr_uint16_t)length / 4 - 1); -} - -static APR_INLINE void rtcp_sr_hton(rtcp_sr_stat_t *sr_stat) -{ - sr_stat->ssrc = htonl(sr_stat->ssrc); - sr_stat->ntp_sec = htonl(sr_stat->ntp_sec); - sr_stat->ntp_frac = htonl(sr_stat->ntp_frac); - sr_stat->rtp_ts = htonl(sr_stat->rtp_ts); - sr_stat->sent_packets = htonl(sr_stat->sent_packets); - sr_stat->sent_octets = htonl(sr_stat->sent_octets); -} - -static APR_INLINE void rtcp_sr_ntoh(rtcp_sr_stat_t *sr_stat) -{ - sr_stat->ssrc = ntohl(sr_stat->ssrc); - sr_stat->ntp_sec = ntohl(sr_stat->ntp_sec); - sr_stat->ntp_frac = ntohl(sr_stat->ntp_frac); - sr_stat->rtp_ts = ntohl(sr_stat->rtp_ts); - sr_stat->sent_packets = ntohl(sr_stat->sent_packets); - sr_stat->sent_octets = ntohl(sr_stat->sent_octets); -} - -static APR_INLINE void rtcp_rr_hton(rtcp_rr_stat_t *rr_stat) -{ - rr_stat->ssrc = htonl(rr_stat->ssrc); - rr_stat->last_seq = htonl(rr_stat->last_seq); - rr_stat->jitter = htonl(rr_stat->jitter); - -#if (APR_IS_BIGENDIAN == 0) - rr_stat->lost = ((rr_stat->lost >> 16) & 0x000000ff) | - (rr_stat->lost & 0x0000ff00) | - ((rr_stat->lost << 16) & 0x00ff0000); -#endif -} - -static APR_INLINE void rtcp_rr_ntoh(rtcp_rr_stat_t *rr_stat) -{ - rr_stat->ssrc = ntohl(rr_stat->ssrc); - rr_stat->last_seq = ntohl(rr_stat->last_seq); - rr_stat->jitter = ntohl(rr_stat->jitter); - -#if (APR_IS_BIGENDIAN == 0) - rr_stat->lost = ((rr_stat->lost >> 16) & 0x000000ff) | - (rr_stat->lost & 0x0000ff00) | - ((rr_stat->lost << 16) & 0x00ff0000); -#endif -} - -APT_END_EXTERN_C - -#endif /* MPF_RTCP_PACKET_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h deleted file mode 100644 index 033e198851..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_attribs.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_attribs.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_ATTRIBS_H -#define MPF_RTP_ATTRIBS_H - -/** - * @file mpf_rtp_attribs.h - * @brief RTP Attributes (SDP) - */ - -#include "mpf_rtp_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** RTP attributes */ -typedef enum { - RTP_ATTRIB_RTPMAP, - RTP_ATTRIB_SENDONLY, - RTP_ATTRIB_RECVONLY, - RTP_ATTRIB_SENDRECV, - RTP_ATTRIB_MID, - RTP_ATTRIB_PTIME, - - RTP_ATTRIB_COUNT, - RTP_ATTRIB_UNKNOWN = RTP_ATTRIB_COUNT -} mpf_rtp_attrib_e; - - -/** Get audio media attribute name by attribute identifier */ -MPF_DECLARE(const apt_str_t*) mpf_rtp_attrib_str_get(mpf_rtp_attrib_e attrib_id); - -/** Find audio media attribute identifier by attribute name */ -MPF_DECLARE(mpf_rtp_attrib_e) mpf_rtp_attrib_id_find(const apt_str_t *attrib); - -/** Get string by RTP direction (send/receive) */ -MPF_DECLARE(const apt_str_t*) mpf_rtp_direction_str_get(mpf_stream_direction_e direction); - -APT_END_EXTERN_C - -#endif /* MPF_RTP_ATTRIBS_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h deleted file mode 100644 index 6ea541862a..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_defs.h +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_defs.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_DEFS_H -#define MPF_RTP_DEFS_H - -/** - * @file mpf_rtp_defs.h - * @brief Internal RTP Definitions - */ - -#include "mpf_rtp_stat.h" -#include "mpf_jitter_buffer.h" - -APT_BEGIN_EXTERN_C - -/** Used to calculate actual number of received packets (32bit) in - * case seq number (16bit) wrapped around */ -#define RTP_SEQ_MOD (1 << 16) -/** Number of max dropout packets (seq numbers) is used to trigger - * either a drift in the seq numbers or a misorder packet */ -#define MAX_DROPOUT 3000 -/** Number of max misorder packets (seq numbers) is used to - * differentiate a drift in the seq numbers from a misorder packet */ -#define MAX_MISORDER 100 -/** Restart receiver if threshold is reached */ -#define DISCARDED_TO_RECEIVED_RATIO_THRESHOLD 30 /* 30% */ -/** Deviation threshold is used to trigger a drift in timestamps */ -#define DEVIATION_THRESHOLD 4000 -/** This threshold is used to detect a new talkspurt */ -#define INTER_TALKSPURT_GAP 1000 /* msec */ - -/** RTP receiver history declaration */ -typedef struct rtp_rx_history_t rtp_rx_history_t; -/** RTP receiver periodic history declaration */ -typedef struct rtp_rx_periodic_history_t rtp_rx_periodic_history_t; -/** RTP receiver declaration */ -typedef struct rtp_receiver_t rtp_receiver_t; -/** RTP transmitter declaration */ -typedef struct rtp_transmitter_t rtp_transmitter_t; - -/** History of RTP receiver */ -struct rtp_rx_history_t { - /** Updated on every seq num wrap around */ - apr_uint32_t seq_cycles; - - /** First seq num received */ - apr_uint16_t seq_num_base; - /** Max seq num received */ - apr_uint16_t seq_num_max; - - /** Last timestamp received */ - apr_uint32_t ts_last; - /** Local time measured on last packet received */ - apr_time_t time_last; - - /** New ssrc, which is in probation */ - apr_uint32_t ssrc_new; - /** Period of ssrc probation */ - apr_byte_t ssrc_probation; -}; - -/** Periodic history of RTP receiver (initialized after every N packets) */ -struct rtp_rx_periodic_history_t { - /** Number of packets received */ - apr_uint32_t received_prior; - /** Number of packets expected */ - apr_uint32_t expected_prior; - /** Number of packets discarded */ - apr_uint32_t discarded_prior; - - /** Min jitter */ - apr_uint32_t jitter_min; - /** Max jitter */ - apr_uint32_t jitter_max; -}; - -/** Reset RTP receiver history */ -static APR_INLINE void mpf_rtp_rx_history_reset(rtp_rx_history_t *rx_history) -{ - memset(rx_history,0,sizeof(rtp_rx_history_t)); -} - -/** Reset RTP receiver periodic history */ -static APR_INLINE void mpf_rtp_rx_periodic_history_reset(rtp_rx_periodic_history_t *rx_periodic_history) -{ - memset(rx_periodic_history,0,sizeof(rtp_rx_periodic_history_t)); -} - -/** RTP receiver */ -struct rtp_receiver_t { - /** Jitter buffer */ - mpf_jitter_buffer_t *jb; - - /** RTCP statistics used in RR */ - rtcp_rr_stat_t rr_stat; - /** RTP receiver statistics */ - rtp_rx_stat_t stat; - /** RTP history */ - rtp_rx_history_t history; - /** RTP periodic history */ - rtp_rx_periodic_history_t periodic_history; -}; - - -/** RTP transmitter */ -struct rtp_transmitter_t { - /** Packetization time in msec */ - apr_uint16_t ptime; - - /** Number of frames in a packet */ - apr_uint16_t packet_frames; - /** Current number of frames */ - apr_uint16_t current_frames; - /** Samples in frames in timestamp units */ - apr_uint32_t samples_per_frame; - - /** Indicate silence period among the talkspurts */ - apr_byte_t inactivity; - /** Last seq number sent */ - apr_uint16_t last_seq_num; - /** Current timestamp (samples processed) */ - apr_uint32_t timestamp; - /** Event timestamp base */ - apr_uint32_t timestamp_base; - - /** RTP packet payload */ - char *packet_data; - /** RTP packet payload size */ - apr_size_t packet_size; - - /** RTCP statistics used in SR */ - rtcp_sr_stat_t sr_stat; -}; - - -/** Initialize RTP receiver */ -static APR_INLINE void rtp_receiver_init(rtp_receiver_t *receiver) -{ - receiver->jb = NULL; - - mpf_rtcp_rr_stat_reset(&receiver->rr_stat); - mpf_rtp_rx_stat_reset(&receiver->stat); - mpf_rtp_rx_history_reset(&receiver->history); - mpf_rtp_rx_periodic_history_reset(&receiver->periodic_history); -} - -/** Initialize RTP transmitter */ -static APR_INLINE void rtp_transmitter_init(rtp_transmitter_t *transmitter) -{ - transmitter->ptime = 0; - - transmitter->packet_frames = 0; - transmitter->current_frames = 0; - transmitter->samples_per_frame = 0; - - transmitter->inactivity = 0; - transmitter->last_seq_num = 0; - transmitter->timestamp = 0; - transmitter->timestamp_base = 0; - - transmitter->packet_data = NULL; - transmitter->packet_size = 0; - - mpf_rtcp_sr_stat_reset(&transmitter->sr_stat); -} - -APT_END_EXTERN_C - -#endif /* MPF_RTP_DEFS_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h deleted file mode 100644 index 60fac7aefa..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_descriptor.h +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_DESCRIPTOR_H -#define MPF_RTP_DESCRIPTOR_H - -/** - * @file mpf_rtp_descriptor.h - * @brief MPF RTP Stream Descriptor - */ - -#include -#include "apt_string.h" -#include "mpf_stream_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** RTP media descriptor declaration */ -typedef struct mpf_rtp_media_descriptor_t mpf_rtp_media_descriptor_t; -/** RTP stream descriptor declaration */ -typedef struct mpf_rtp_stream_descriptor_t mpf_rtp_stream_descriptor_t; -/** RTP termination descriptor declaration */ -typedef struct mpf_rtp_termination_descriptor_t mpf_rtp_termination_descriptor_t; -/** RTP configuration declaration */ -typedef struct mpf_rtp_config_t mpf_rtp_config_t; -/** RTP settings declaration */ -typedef struct mpf_rtp_settings_t mpf_rtp_settings_t; -/** Jitter buffer configuration declaration */ -typedef struct mpf_jb_config_t mpf_jb_config_t; - -/** MPF media state */ -typedef enum { - MPF_MEDIA_DISABLED, /**< disabled media */ - MPF_MEDIA_ENABLED /**< enabled media */ -} mpf_media_state_e; - -/** RTP media (local/remote) descriptor */ -struct mpf_rtp_media_descriptor_t { - /** Media state (disabled/enabled)*/ - mpf_media_state_e state; - /** Ip address */ - apt_str_t ip; - /** External (NAT) Ip address */ - apt_str_t ext_ip; - /** Port */ - apr_port_t port; - /** Stream mode (send/receive) */ - mpf_stream_direction_e direction; - /** Packetization time */ - apr_uint16_t ptime; - /** Codec list */ - mpf_codec_list_t codec_list; - /** Media identifier */ - apr_size_t mid; - /** Position, order in SDP message (0,1,...) */ - apr_size_t id; -}; - -/** RTP stream descriptor */ -struct mpf_rtp_stream_descriptor_t { - /** Stream capabilities */ - mpf_stream_capabilities_t *capabilities; - /** Local media descriptor */ - mpf_rtp_media_descriptor_t *local; - /** Remote media descriptor */ - mpf_rtp_media_descriptor_t *remote; - /** Settings loaded from config */ - mpf_rtp_settings_t *settings; -}; - -/** RTP termination descriptor */ -struct mpf_rtp_termination_descriptor_t { - /** Audio stream descriptor */ - mpf_rtp_stream_descriptor_t audio; - /** Video stream descriptor */ - mpf_rtp_stream_descriptor_t video; -}; - -/** Jitter buffer configuration */ -struct mpf_jb_config_t { - /** Min playout delay in msec */ - apr_uint32_t min_playout_delay; - /** Initial playout delay in msec */ - apr_uint32_t initial_playout_delay; - /** Max playout delay in msec */ - apr_uint32_t max_playout_delay; - /** Mode of operation of the jitter buffer: static - 0, adaptive - 1 */ - apr_byte_t adaptive; - /** Enable/disable time skew detection */ - apr_byte_t time_skew_detection; -}; - -/** RTCP BYE transmission policy */ -typedef enum { - RTCP_BYE_DISABLE, /**< disable RTCP BYE transmission */ - RTCP_BYE_PER_SESSION, /**< transmit RTCP BYE at the end of session */ - RTCP_BYE_PER_TALKSPURT /**< transmit RTCP BYE at the end of each talkspurt (input) */ -} rtcp_bye_policy_e; - -/** RTP factory config */ -struct mpf_rtp_config_t { - /** Local IP address to bind to */ - apt_str_t ip; - /** External (NAT) IP address */ - apt_str_t ext_ip; - /** Min RTP port */ - apr_port_t rtp_port_min; - /** Max RTP port */ - apr_port_t rtp_port_max; - /** Current RTP port */ - apr_port_t rtp_port_cur; -}; - -/** RTP settings */ -struct mpf_rtp_settings_t { - /** Packetization time */ - apr_uint16_t ptime; - /** Codec list */ - mpf_codec_list_t codec_list; - /** Preference in offer/anwser: 1 - own(local) preference, 0 - remote preference */ - apt_bool_t own_preferrence; - /** Enable/disable RTCP support */ - apt_bool_t rtcp; - /** RTCP BYE policy */ - rtcp_bye_policy_e rtcp_bye_policy; - /** RTCP report transmission interval */ - apr_uint16_t rtcp_tx_interval; - /** RTCP rx resolution (timeout to check for a new RTCP message) */ - apr_uint16_t rtcp_rx_resolution; - /** Jitter buffer config */ - mpf_jb_config_t jb_config; -}; - -/** Initialize media descriptor */ -static APR_INLINE void mpf_rtp_media_descriptor_init(mpf_rtp_media_descriptor_t *media) -{ - media->state = MPF_MEDIA_DISABLED; - apt_string_reset(&media->ip); - apt_string_reset(&media->ext_ip); - media->port = 0; - media->direction = STREAM_DIRECTION_NONE; - media->ptime = 0; - mpf_codec_list_reset(&media->codec_list); - media->mid = 0; - media->id = 0; -} - -/** Initialize stream descriptor */ -static APR_INLINE void mpf_rtp_stream_descriptor_init(mpf_rtp_stream_descriptor_t *descriptor) -{ - descriptor->capabilities = NULL; - descriptor->local = NULL; - descriptor->remote = NULL; - descriptor->settings = NULL; -} - -/** Initialize RTP termination descriptor */ -static APR_INLINE void mpf_rtp_termination_descriptor_init(mpf_rtp_termination_descriptor_t *rtp_descriptor) -{ - mpf_rtp_stream_descriptor_init(&rtp_descriptor->audio); - mpf_rtp_stream_descriptor_init(&rtp_descriptor->video); -} - -/** Initialize JB config */ -static APR_INLINE void mpf_jb_config_init(mpf_jb_config_t *jb_config) -{ - jb_config->adaptive = 0; - jb_config->initial_playout_delay = 0; - jb_config->min_playout_delay = 0; - jb_config->max_playout_delay = 0; - jb_config->time_skew_detection = 1; -} - -/** Allocate RTP config */ -static APR_INLINE mpf_rtp_config_t* mpf_rtp_config_alloc(apr_pool_t *pool) -{ - mpf_rtp_config_t *rtp_config = (mpf_rtp_config_t*)apr_palloc(pool,sizeof(mpf_rtp_config_t)); - apt_string_reset(&rtp_config->ip); - apt_string_reset(&rtp_config->ext_ip); - rtp_config->rtp_port_cur = 0; - rtp_config->rtp_port_min = 0; - rtp_config->rtp_port_max = 0; - return rtp_config; -} - -/** Allocate RTP settings */ -static APR_INLINE mpf_rtp_settings_t* mpf_rtp_settings_alloc(apr_pool_t *pool) -{ - mpf_rtp_settings_t *rtp_settings = (mpf_rtp_settings_t*)apr_palloc(pool,sizeof(mpf_rtp_settings_t)); - rtp_settings->ptime = 0; - mpf_codec_list_init(&rtp_settings->codec_list,0,pool); - rtp_settings->own_preferrence = FALSE; - rtp_settings->rtcp = FALSE; - rtp_settings->rtcp_bye_policy = RTCP_BYE_DISABLE; - rtp_settings->rtcp_tx_interval = 0; - rtp_settings->rtcp_rx_resolution = 0; - mpf_jb_config_init(&rtp_settings->jb_config); - return rtp_settings; -} - - -APT_END_EXTERN_C - -#endif /* MPF_RTP_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h deleted file mode 100644 index 36c50c0b42..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_header.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_HEADER_H -#define MPF_RTP_HEADER_H - -/** - * @file mpf_rtp_header.h - * @brief RTP Header Definition - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** Protocol version */ -#define RTP_VERSION 2 - -/** RTP header declaration */ -typedef struct rtp_header_t rtp_header_t; -/** RTP extension header declaration */ -typedef struct rtp_extension_header_t rtp_extension_header_t; - - -/** RTP header */ -struct rtp_header_t { -#if (APR_IS_BIGENDIAN == 1) - /** protocol version */ - apr_uint32_t version: 2; - /** padding flag */ - apr_uint32_t padding: 1; - /** header extension flag */ - apr_uint32_t extension: 1; - /** CSRC count */ - apr_uint32_t count: 4; - /** marker bit */ - apr_uint32_t marker: 1; - /** payload type */ - apr_uint32_t type: 7; -#else - /** CSRC count */ - apr_uint32_t count: 4; - /** header extension flag */ - apr_uint32_t extension: 1; - /** padding flag */ - apr_uint32_t padding: 1; - /** protocol version */ - apr_uint32_t version: 2; - /** payload type */ - apr_uint32_t type: 7; - /** marker bit */ - apr_uint32_t marker: 1; -#endif - - /** sequence number */ - apr_uint32_t sequence: 16; - /** timestamp */ - apr_uint32_t timestamp; - /** synchronization source */ - apr_uint32_t ssrc; -}; - -/** RTP extension header */ -struct rtp_extension_header_t { - /** profile */ - apr_uint16_t profile; - /** length */ - apr_uint16_t length; -}; - -APT_END_EXTERN_C - -#endif /* MPF_RTP_HEADER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h deleted file mode 100644 index 2d01346308..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_pt.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_pt.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_PT_H -#define MPF_RTP_PT_H - -/** - * @file mpf_rtp_pt.h - * @brief RTP Payload Types (RFC3551) - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** RTP payload types */ -typedef enum { - RTP_PT_PCMU = 0, /**< PCMU Audio 8kHz 1 */ - RTP_PT_PCMA = 8, /**< PCMA Audio 8kHz 1 */ - - RTP_PT_CN = 13, /**< Comfort Noise Audio 8kHz 1 */ - - RTP_PT_RESERVED = 19, /**< Not used for any particular codec */ - - RTP_PT_DYNAMIC = 96, /**< Start of dynamic payload types */ - RTP_PT_DYNAMIC_MAX = 127, /**< End of dynamic payload types */ - - RTP_PT_UNKNOWN = 128 /**< Unknown (invalid) payload type */ -} mpf_rtp_pt_e; - -APT_END_EXTERN_C - -#endif /* MPF_RTP_PT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h deleted file mode 100644 index d312e75be5..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_stat.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_stat.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_STAT_H -#define MPF_RTP_STAT_H - -/** - * @file mpf_rtp_stat.h - * @brief RTP/RTCP Statistics - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** RTP receiver statistics */ -typedef struct rtp_rx_stat_t rtp_rx_stat_t; - -/** RTCP statistics used in Sender Report (SR) */ -typedef struct rtcp_sr_stat_t rtcp_sr_stat_t; -/** RTCP statistics used in Receiver Report (RR) */ -typedef struct rtcp_rr_stat_t rtcp_rr_stat_t; - - -/** RTP receiver statistics */ -struct rtp_rx_stat_t { - /** number of valid RTP packets received */ - apr_uint32_t received_packets; - /** number of invalid RTP packets received */ - apr_uint32_t invalid_packets; - - /** number of discarded in jitter buffer packets */ - apr_uint32_t discarded_packets; - /** number of ignored packets */ - apr_uint32_t ignored_packets; - - /** number of lost in network packets */ - apr_uint32_t lost_packets; - - /** number of restarts */ - apr_byte_t restarts; -}; - -/** RTCP statistics used in Sender Report (SR) */ -struct rtcp_sr_stat_t { - /** sender source identifier */ - apr_uint32_t ssrc; - /** NTP timestamp (seconds) */ - apr_uint32_t ntp_sec; - /** NTP timestamp (fractions) */ - apr_uint32_t ntp_frac; - /** RTP timestamp */ - apr_uint32_t rtp_ts; - /** packets sent */ - apr_uint32_t sent_packets; - /** octets (bytes) sent */ - apr_uint32_t sent_octets; -}; - -/** RTCP statistics used in Receiver Report (RR) */ -struct rtcp_rr_stat_t { - /** source identifier of RTP stream being received */ - apr_uint32_t ssrc; - /** fraction lost since last SR/RR */ - apr_uint32_t fraction:8; - /** cumulative number of packets lost (signed!) */ - apr_int32_t lost:24; - /** extended last sequence number received */ - apr_uint32_t last_seq; - /** interarrival jitter (RFC3550) */ - apr_uint32_t jitter; - /** last SR packet from this source */ - apr_uint32_t lsr; - /** delay since last SR packet */ - apr_uint32_t dlsr; -}; - - - -/** Reset RTCP SR statistics */ -static APR_INLINE void mpf_rtcp_sr_stat_reset(rtcp_sr_stat_t *sr_stat) -{ - memset(sr_stat,0,sizeof(rtcp_sr_stat_t)); -} - -/** Reset RTCP RR statistics */ -static APR_INLINE void mpf_rtcp_rr_stat_reset(rtcp_rr_stat_t *rr_stat) -{ - memset(rr_stat,0,sizeof(rtcp_rr_stat_t)); -} - -/** Reset RTP receiver statistics */ -static APR_INLINE void mpf_rtp_rx_stat_reset(rtp_rx_stat_t *rx_stat) -{ - memset(rx_stat,0,sizeof(rtp_rx_stat_t)); -} - -APT_END_EXTERN_C - -#endif /* MPF_RTP_STAT_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h deleted file mode 100644 index 00e6baf557..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_stream.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_STREAM_H -#define MPF_RTP_STREAM_H - -/** - * @file mpf_rtp_stream.h - * @brief MPF RTP Stream - */ - -#include "mpf_stream.h" -#include "mpf_rtp_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** - * Create RTP stream. - * @param termination the back pointer to hold - * @param config the configuration of RTP factory - * @param settings the settings to use - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, mpf_rtp_settings_t *settings, apr_pool_t *pool); - -/** - * Add/enable RTP stream. - * @param stream RTP stream to add - */ -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_add(mpf_audio_stream_t *stream); - -/** - * Subtract/disable RTP stream. - * @param stream RTP stream to subtract - */ -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_remove(mpf_audio_stream_t *stream); - -/** - * Modify RTP stream. - * @param stream RTP stream to modify - * @param descriptor the descriptor to modify stream according - */ -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_modify(mpf_audio_stream_t *stream, mpf_rtp_stream_descriptor_t *descriptor); - -APT_END_EXTERN_C - -#endif /* MPF_RTP_STREAM_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h deleted file mode 100644 index f639f261b9..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_rtp_termination_factory.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_RTP_TERMINATION_FACTORY_H -#define MPF_RTP_TERMINATION_FACTORY_H - -/** - * @file mpf_rtp_termination_factory.h - * @brief MPF RTP Termination Factory - */ - -#include "mpf_termination_factory.h" -#include "mpf_rtp_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** - * Create RTP termination factory. - */ -MPF_DECLARE(mpf_termination_factory_t*) mpf_rtp_termination_factory_create( - mpf_rtp_config_t *rtp_config, - apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MPF_RTP_TERMINATION_FACTORY_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_scheduler.h b/libs/unimrcp/libs/mpf/include/mpf_scheduler.h deleted file mode 100644 index fe8e79af46..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_scheduler.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_scheduler.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_SCHEDULER_H -#define MPF_SCHEDULER_H - -/** - * @file mpf_scheduler.h - * @brief MPF Scheduler (High Resolution Clock for Media Processing and Timer) - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Prototype of scheduler callback */ -typedef void (*mpf_scheduler_proc_f)(mpf_scheduler_t *scheduler, void *obj); - -/** Create scheduler */ -MPF_DECLARE(mpf_scheduler_t*) mpf_scheduler_create(apr_pool_t *pool); - -/** Destroy scheduler */ -MPF_DECLARE(void) mpf_scheduler_destroy(mpf_scheduler_t *scheduler); - -/** Set media processing clock */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_media_clock_set( - mpf_scheduler_t *scheduler, - unsigned long resolution, - mpf_scheduler_proc_f proc, - void *obj); - -/** Set timer clock */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_timer_clock_set( - mpf_scheduler_t *scheduler, - unsigned long resolution, - mpf_scheduler_proc_f proc, - void *obj); - -/** Set scheduler rate (n times faster than real-time) */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_rate_set( - mpf_scheduler_t *scheduler, - unsigned long rate); - -/** Start scheduler */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler); - -/** Stop scheduler */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler); - - -APT_END_EXTERN_C - -#endif /* MPF_SCHEDULER_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_stream.h b/libs/unimrcp/libs/mpf/include/mpf_stream.h deleted file mode 100644 index 33276aa7b7..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_stream.h +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_STREAM_H -#define MPF_STREAM_H - -/** - * @file mpf_stream.h - * @brief MPF Bidirectional Stream - */ - -#include "mpf_types.h" -#include "mpf_frame.h" -#include "mpf_stream_descriptor.h" -#include "mpf_codec.h" -#include "apt_text_stream.h" - -APT_BEGIN_EXTERN_C - -/** Declaration of virtual table of audio stream */ -typedef struct mpf_audio_stream_vtable_t mpf_audio_stream_vtable_t; - -/** Audio stream */ -struct mpf_audio_stream_t { - /** External object */ - void *obj; - /** Table of virtual methods */ - const mpf_audio_stream_vtable_t *vtable; - /** Back pointer */ - mpf_termination_t *termination; - - /** Stream capabilities */ - const mpf_stream_capabilities_t *capabilities; - - /** Stream direction send/receive (bitmask of mpf_stream_direction_e) */ - mpf_stream_direction_e direction; - /** Rx codec descriptor */ - mpf_codec_descriptor_t *rx_descriptor; - /** Rx event descriptor */ - mpf_codec_descriptor_t *rx_event_descriptor; - /** Tx codec descriptor */ - mpf_codec_descriptor_t *tx_descriptor; - /** Tx event descriptor */ - mpf_codec_descriptor_t *tx_event_descriptor; -}; - -/** Video stream */ -struct mpf_video_stream_t { - /** Back pointer */ - mpf_termination_t *termination; - /** Stream direction send/receive (bitmask of mpf_stream_direction_e) */ - mpf_stream_direction_e direction; -}; - -/** Table of audio stream virtual methods */ -struct mpf_audio_stream_vtable_t { - /** Virtual destroy method */ - apt_bool_t (*destroy)(mpf_audio_stream_t *stream); - - /** Virtual open receiver method */ - apt_bool_t (*open_rx)(mpf_audio_stream_t *stream, mpf_codec_t *codec); - /** Virtual close receiver method */ - apt_bool_t (*close_rx)(mpf_audio_stream_t *stream); - /** Virtual read frame method */ - apt_bool_t (*read_frame)(mpf_audio_stream_t *stream, mpf_frame_t *frame); - - /** Virtual open transmitter method */ - apt_bool_t (*open_tx)(mpf_audio_stream_t *stream, mpf_codec_t *codec); - /** Virtual close transmitter method */ - apt_bool_t (*close_tx)(mpf_audio_stream_t *stream); - /** Virtual write frame method */ - apt_bool_t (*write_frame)(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - - /** Virtual trace method */ - void (*trace)(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output); -}; - -/** Create audio stream */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_audio_stream_create(void *obj, const mpf_audio_stream_vtable_t *vtable, const mpf_stream_capabilities_t *capabilities, apr_pool_t *pool); - -/** Validate audio stream receiver */ -MPF_DECLARE(apt_bool_t) mpf_audio_stream_rx_validate( - mpf_audio_stream_t *stream, - const mpf_codec_descriptor_t *descriptor, - const mpf_codec_descriptor_t *event_descriptor, - apr_pool_t *pool); - -/** Validate audio stream transmitter */ -MPF_DECLARE(apt_bool_t) mpf_audio_stream_tx_validate( - mpf_audio_stream_t *stream, - const mpf_codec_descriptor_t *descriptor, - const mpf_codec_descriptor_t *event_descriptor, - apr_pool_t *pool); - -/** Destroy audio stream */ -static APR_INLINE apt_bool_t mpf_audio_stream_destroy(mpf_audio_stream_t *stream) -{ - if(stream->vtable->destroy) - return stream->vtable->destroy(stream); - return TRUE; -} - -/** Open audio stream receiver */ -static APR_INLINE apt_bool_t mpf_audio_stream_rx_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - if(stream->vtable->open_rx) - return stream->vtable->open_rx(stream,codec); - return TRUE; -} - -/** Close audio stream receiver */ -static APR_INLINE apt_bool_t mpf_audio_stream_rx_close(mpf_audio_stream_t *stream) -{ - if(stream->vtable->close_rx) - return stream->vtable->close_rx(stream); - return TRUE; -} - -/** Read frame */ -static APR_INLINE apt_bool_t mpf_audio_stream_frame_read(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - if(stream->vtable->read_frame) - return stream->vtable->read_frame(stream,frame); - return TRUE; -} - -/** Open audio stream transmitter */ -static APR_INLINE apt_bool_t mpf_audio_stream_tx_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - if(stream->vtable->open_tx) - return stream->vtable->open_tx(stream,codec); - return TRUE; -} - -/** Close audio stream transmitter */ -static APR_INLINE apt_bool_t mpf_audio_stream_tx_close(mpf_audio_stream_t *stream) -{ - if(stream->vtable->close_tx) - return stream->vtable->close_tx(stream); - return TRUE; -} - -/** Write frame */ -static APR_INLINE apt_bool_t mpf_audio_stream_frame_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - if(stream->vtable->write_frame) - return stream->vtable->write_frame(stream,frame); - return TRUE; -} - -/** Trace media path */ -MPF_DECLARE(void) mpf_audio_stream_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output); - -APT_END_EXTERN_C - -#endif /* MPF_STREAM_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h b/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h deleted file mode 100644 index d91f5166eb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_stream_descriptor.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_stream_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_STREAM_DESCRIPTOR_H -#define MPF_STREAM_DESCRIPTOR_H - -/** - * @file mpf_stream_descriptor.h - * @brief MPF Stream Descriptor - */ - -#include "mpf_codec_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Stream capabilities declaration */ -typedef struct mpf_stream_capabilities_t mpf_stream_capabilities_t; - -/** Stream directions (none, send, receive, duplex) */ -typedef enum { - STREAM_DIRECTION_NONE = 0x0, /**< none */ - STREAM_DIRECTION_SEND = 0x1, /**< send (sink) */ - STREAM_DIRECTION_RECEIVE = 0x2, /**< receive (source) */ - - STREAM_DIRECTION_DUPLEX = STREAM_DIRECTION_SEND | STREAM_DIRECTION_RECEIVE /**< duplex */ -} mpf_stream_direction_e; - - -/** Stream capabilities */ -struct mpf_stream_capabilities_t { - /** Supported directions either send, receive or bidirectional stream (bitmask of mpf_stream_direction_e) */ - mpf_stream_direction_e direction; - /** Codec capabilities (supported codecs and named events) */ - mpf_codec_capabilities_t codecs; -}; - -/** Create stream capabilities */ -MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_create(mpf_stream_direction_e directions, apr_pool_t *pool); - -/** Create source stream capabilities */ -static APR_INLINE mpf_stream_capabilities_t* mpf_source_stream_capabilities_create(apr_pool_t *pool) -{ - return mpf_stream_capabilities_create(STREAM_DIRECTION_RECEIVE,pool); -} - -/** Create sink stream capabilities */ -static APR_INLINE mpf_stream_capabilities_t* mpf_sink_stream_capabilities_create(apr_pool_t *pool) -{ - return mpf_stream_capabilities_create(STREAM_DIRECTION_SEND,pool); -} - -/** Clone stream capabilities */ -MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_clone(const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool); - -/** Merge stream capabilities */ -MPF_DECLARE(apt_bool_t) mpf_stream_capabilities_merge(mpf_stream_capabilities_t *capabilities, const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool); - - -/** Get reverse direction */ -static APR_INLINE mpf_stream_direction_e mpf_stream_reverse_direction_get(mpf_stream_direction_e direction) -{ - mpf_stream_direction_e rev_direction = direction; - if(rev_direction == STREAM_DIRECTION_SEND) { - rev_direction = STREAM_DIRECTION_RECEIVE; - } - else if(rev_direction == STREAM_DIRECTION_RECEIVE) { - rev_direction = STREAM_DIRECTION_SEND; - } - return rev_direction; -} - - -APT_END_EXTERN_C - -#endif /* MPF_STREAM_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_termination.h b/libs/unimrcp/libs/mpf/include/mpf_termination.h deleted file mode 100644 index 6d45aeeddb..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_termination.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_termination.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_TERMINATION_H -#define MPF_TERMINATION_H - -/** - * @file mpf_termination.h - * @brief MPF Termination - */ - -#include "mpf_types.h" -#include "apt_timer_queue.h" - -APT_BEGIN_EXTERN_C - -/** Prototype of termination event handler */ -typedef apt_bool_t (*mpf_termination_event_handler_f)(mpf_termination_t *termination, int event_id, void *descriptor); - -/** Termination vtable declaration */ -typedef struct mpf_termination_vtable_t mpf_termination_vtable_t; - -/** Table of termination virtual methods */ -struct mpf_termination_vtable_t { - /** Virtual termination destroy method */ - apt_bool_t (*destroy)(mpf_termination_t *termination); - - /** Virtual termination add method */ - apt_bool_t (*add)(mpf_termination_t *termination, void *descriptor); - /** Virtual termination modify method */ - apt_bool_t (*modify)(mpf_termination_t *termination, void *descriptor); - /** Virtual termination subtract method */ - apt_bool_t (*subtract)(mpf_termination_t *termination); -}; - - -/** MPF Termination */ -struct mpf_termination_t { - /** Pool to allocate memory from */ - apr_pool_t *pool; - /** Informative name used for debugging */ - const char *name; - /** External object */ - void *obj; - /** Media engine to send events to */ - void *media_engine; - /** Event handler */ - mpf_termination_event_handler_f event_handler; - /** Codec manager */ - const mpf_codec_manager_t *codec_manager; - /** Timer queue */ - apt_timer_queue_t *timer_queue; - /** Termination factory entire termination created by */ - mpf_termination_factory_t *termination_factory; - /** Table of virtual methods */ - const mpf_termination_vtable_t *vtable; - /** Slot in context */ - apr_size_t slot; - - /** Audio stream */ - mpf_audio_stream_t *audio_stream; - /** Video stream */ - mpf_video_stream_t *video_stream; -}; - -/** - * Create MPF termination base. - * @param termination_factory the termination factory - * @param obj the external object associated with termination - * @param vtable the table of virtual functions of termination - * @param audio_stream the audio stream - * @param video_stream the video stream - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_termination_t*) mpf_termination_base_create( - mpf_termination_factory_t *termination_factory, - void *obj, - const mpf_termination_vtable_t *vtable, - mpf_audio_stream_t *audio_stream, - mpf_video_stream_t *video_stream, - apr_pool_t *pool); - -/** - * Add MPF termination. - * @param termination the termination to add - * @param descriptor the termination specific descriptor - */ -MPF_DECLARE(apt_bool_t) mpf_termination_add(mpf_termination_t *termination, void *descriptor); - -/** - * Modify MPF termination. - * @param termination the termination to modify - * @param descriptor the termination specific descriptor - */ -MPF_DECLARE(apt_bool_t) mpf_termination_modify(mpf_termination_t *termination, void *descriptor); - -/** - * Subtract MPF termination. - * @param termination the termination to subtract - */ -MPF_DECLARE(apt_bool_t) mpf_termination_subtract(mpf_termination_t *termination); - - -APT_END_EXTERN_C - -#endif /* MPF_TERMINATION_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h b/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h deleted file mode 100644 index 08d46fc64f..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_termination_factory.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_termination_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_TERMINATION_FACTORY_H -#define MPF_TERMINATION_FACTORY_H - -/** - * @file mpf_termination_factory.h - * @brief MPF Termination Factory - */ - -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** MPF termination factory */ -struct mpf_termination_factory_t { - /** Virtual create */ - mpf_termination_t* (*create_termination)(mpf_termination_factory_t *factory, void *obj, apr_pool_t *pool); - /** Virtual assign engine */ - apt_bool_t (*assign_engine)(mpf_termination_factory_t *factory, mpf_engine_t *media_engine); -}; - -/** - * Assign media engine to termination factory. - * @param termination_factory the termination factory to assign media engine to - * @param media_engine the media engine to assign - */ -MPF_DECLARE(apt_bool_t) mpf_termination_factory_engine_assign( - mpf_termination_factory_t *termination_factory, - mpf_engine_t *media_engine); - -/** - * Create MPF termination from termination factory. - * @param termination_factory the termination factory to create termination from - * @param obj the external object associated with termination - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_termination_t*) mpf_termination_create( - mpf_termination_factory_t *termination_factory, - void *obj, - apr_pool_t *pool); - -/** - * Create raw MPF termination. - * @param obj the external object associated with termination - * @param audio_stream the audio stream of the termination - * @param video_stream the video stream of the termination - * @param pool the pool to allocate memory from - */ -MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create( - void *obj, - mpf_audio_stream_t *audio_stream, - mpf_video_stream_t *video_stream, - apr_pool_t *pool); - -/** - * Destroy MPF termination. - * @param termination the termination to destroy - */ -MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination); - -/** - * Get termination name. - * @param termination the termination to get name of - */ -MPF_DECLARE(const char*) mpf_termination_name_get(const mpf_termination_t *termination); - -/** - * Get associated object. - * @param termination the termination to get object from - */ -MPF_DECLARE(void*) mpf_termination_object_get(const mpf_termination_t *termination); - -/** - * Get audio stream. - * @param termination the termination to get audio stream from - */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_termination_audio_stream_get(const mpf_termination_t *termination); - -/** - * Get video stream. - * @param termination the termination to get video stream from - */ -MPF_DECLARE(mpf_video_stream_t*) mpf_termination_video_stream_get(const mpf_termination_t *termination); - - -APT_END_EXTERN_C - -#endif /* MPF_TERMINATION_FACTORY_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_trace.h b/libs/unimrcp/libs/mpf/include/mpf_trace.h deleted file mode 100644 index 323cc034ba..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_trace.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: apt_log.h 1792 2011-01-10 21:08:52Z achaloyan $ - */ - -#ifndef MPF_TRACE_H -#define MPF_TRACE_H - -/** - * @file mpf_trace.h - * @brief MPF Tracer - */ - -#include -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -#ifdef WIN32 -static void mpf_debug_output_trace(const char* format, ...) -{ - char buf[1024]; - va_list arg; - va_start(arg, format); - apr_vsnprintf(buf, sizeof(buf), format, arg); - va_end(arg); - - OutputDebugStringA(buf); -} -#else -static APR_INLINE void mpf_debug_output_trace() {} -#endif - -static APR_INLINE void mpf_null_trace() {} - -APT_END_EXTERN_C - -#endif /* MPF_TRACE_H */ diff --git a/libs/unimrcp/libs/mpf/include/mpf_types.h b/libs/unimrcp/libs/mpf/include/mpf_types.h deleted file mode 100644 index 3b8637eaba..0000000000 --- a/libs/unimrcp/libs/mpf/include/mpf_types.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MPF_TYPES_H -#define MPF_TYPES_H - -/** - * @file mpf_types.h - * @brief MPF Types Declarations - */ - -#include "mpf.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MPF engine declaration */ -typedef struct mpf_engine_t mpf_engine_t; - -/** Opaque MPF engine factory declaration */ -typedef struct mpf_engine_factory_t mpf_engine_factory_t; - -/** Opaque MPF scheduler declaration */ -typedef struct mpf_scheduler_t mpf_scheduler_t; - -/** Opaque codec manager declaration */ -typedef struct mpf_codec_manager_t mpf_codec_manager_t; - -/** Opaque MPF context declaration */ -typedef struct mpf_context_t mpf_context_t; - -/** Opaque MPF termination declaration */ -typedef struct mpf_termination_t mpf_termination_t; - -/** Opaque MPF termination factory declaration */ -typedef struct mpf_termination_factory_t mpf_termination_factory_t; - -/** Opaque MPF audio stream declaration */ -typedef struct mpf_audio_stream_t mpf_audio_stream_t; - -/** Opaque MPF video stream declaration */ -typedef struct mpf_video_stream_t mpf_video_stream_t; - - -APT_END_EXTERN_C - -#endif /* MPF_TYPES_H */ diff --git a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters deleted file mode 100644 index d79e3f31a4..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.2010.vcxproj.filters +++ /dev/null @@ -1,236 +0,0 @@ - - - - - {3d69fc35-a195-4376-9508-ef77d7b27e71} - - - {81e2eace-c57a-4135-92cd-cc3575dfb088} - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {6fc3533a-b688-477d-914d-e0ffb15aa9a9} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - codecs\g711 - - - 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 - - - src - - - src - - - src - - - src - - - - - codecs\g711 - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.2017.vcxproj b/libs/unimrcp/libs/mpf/mpf.2017.vcxproj deleted file mode 100644 index 4cd900b2df..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.2017.vcxproj +++ /dev/null @@ -1,201 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mpf - {B5A00BFA-6083-4FAE-A097-71642D6473B5} - mpf - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) - false - ProgramDatabase - - - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;%(PreprocessorDefinitions) - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.vcproj b/libs/unimrcp/libs/mpf/mpf.vcproj deleted file mode 100644 index 043486d580..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.vcproj +++ /dev/null @@ -1,552 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mpf/mpf.vcxproj b/libs/unimrcp/libs/mpf/mpf.vcxproj deleted file mode 100644 index 6bbb3f5371..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.vcxproj +++ /dev/null @@ -1,200 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {B5A00BFA-6083-4FAE-A097-71642D6473B5} - mpf - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - codecs;%(AdditionalIncludeDirectories) - - - - - codecs;%(AdditionalIncludeDirectories) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/mpf.vcxproj.filters b/libs/unimrcp/libs/mpf/mpf.vcxproj.filters deleted file mode 100644 index 16ecf0e62f..0000000000 --- a/libs/unimrcp/libs/mpf/mpf.vcxproj.filters +++ /dev/null @@ -1,239 +0,0 @@ - - - - - {33a3a10a-4697-4720-8c24-20340757326e} - - - {148f1b8f-859b-4dd9-96b0-0474d7bb875b} - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {35011b8a-6a42-4e9f-b55b-a84db1d929a8} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - codecs\g711 - - - 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 - - - src - - - src - - - src - - - src - - - - - codecs\g711 - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c b/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c deleted file mode 100644 index 09b1a813a3..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_activity_detector.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_activity_detector.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_activity_detector.h" -#include "apt_log.h" - -/** Detector states */ -typedef enum { - DETECTOR_STATE_INACTIVITY, /**< inactivity detected */ - DETECTOR_STATE_ACTIVITY_TRANSITION, /**< activity detection is in-progress */ - DETECTOR_STATE_ACTIVITY, /**< activity detected */ - DETECTOR_STATE_INACTIVITY_TRANSITION /**< inactivity detection is in-progress */ -} mpf_detector_state_e; - -/** Activity detector */ -struct mpf_activity_detector_t { - /* voice activity (silence) level threshold */ - apr_size_t level_threshold; - - /* period of activity required to complete transition to active state */ - apr_size_t speech_timeout; - /* period of inactivity required to complete transition to inactive state */ - apr_size_t silence_timeout; - /* noinput timeout */ - apr_size_t noinput_timeout; - - /* current state */ - mpf_detector_state_e state; - /* duration spent in current state */ - apr_size_t duration; -}; - -/** Create activity detector */ -MPF_DECLARE(mpf_activity_detector_t*) mpf_activity_detector_create(apr_pool_t *pool) -{ - mpf_activity_detector_t *detector = apr_palloc(pool,sizeof(mpf_activity_detector_t)); - detector->level_threshold = 2; /* 0 .. 255 */ - detector->speech_timeout = 300; /* 0.3 s */ - detector->silence_timeout = 300; /* 0.3 s */ - detector->noinput_timeout = 5000; /* 5 s */ - detector->duration = 0; - detector->state = DETECTOR_STATE_INACTIVITY; - return detector; -} - -/** Reset activity detector */ -MPF_DECLARE(void) mpf_activity_detector_reset(mpf_activity_detector_t *detector) -{ - detector->duration = 0; - detector->state = DETECTOR_STATE_INACTIVITY; -} - -/** Set threshold of voice activity (silence) level */ -MPF_DECLARE(void) mpf_activity_detector_level_set(mpf_activity_detector_t *detector, apr_size_t level_threshold) -{ - detector->level_threshold = level_threshold; -} - -/** Set noinput timeout */ -MPF_DECLARE(void) mpf_activity_detector_noinput_timeout_set(mpf_activity_detector_t *detector, apr_size_t noinput_timeout) -{ - detector->noinput_timeout = noinput_timeout; -} - -/** Set timeout required to trigger speech (transition from inactive to active state) */ -MPF_DECLARE(void) mpf_activity_detector_speech_timeout_set(mpf_activity_detector_t *detector, apr_size_t speech_timeout) -{ - detector->speech_timeout = speech_timeout; -} - -/** Set timeout required to trigger silence (transition from active to inactive state) */ -MPF_DECLARE(void) mpf_activity_detector_silence_timeout_set(mpf_activity_detector_t *detector, apr_size_t silence_timeout) -{ - detector->silence_timeout = silence_timeout; -} - - -static APR_INLINE void mpf_activity_detector_state_change(mpf_activity_detector_t *detector, mpf_detector_state_e state) -{ - detector->duration = 0; - detector->state = state; -} - -static apr_size_t mpf_activity_detector_level_calculate(const mpf_frame_t *frame) -{ - apr_size_t sum = 0; - apr_size_t count = frame->codec_frame.size/2; - const apr_int16_t *cur = frame->codec_frame.buffer; - const apr_int16_t *end = cur + count; - - for(; cur < end; cur++) { - if(*cur < 0) { - sum -= *cur; - } - else { - sum += *cur; - } - } - - return sum / count; -} - -/** Process current frame */ -MPF_DECLARE(mpf_detector_event_e) mpf_activity_detector_process(mpf_activity_detector_t *detector, const mpf_frame_t *frame) -{ - mpf_detector_event_e det_event = MPF_DETECTOR_EVENT_NONE; - apr_size_t level = 0; - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) { - /* first, calculate current activity level of processed frame */ - level = mpf_activity_detector_level_calculate(frame); -#if 0 - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Activity Detector [%"APR_SIZE_T_FMT"]",level); -#endif - } - - if(detector->state == DETECTOR_STATE_INACTIVITY) { - if(level >= detector->level_threshold) { - /* start to detect activity */ - mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY_TRANSITION); - } - else { - detector->duration += CODEC_FRAME_TIME_BASE; - if(detector->duration >= detector->noinput_timeout) { - /* detected noinput */ - det_event = MPF_DETECTOR_EVENT_NOINPUT; - } - } - } - else if(detector->state == DETECTOR_STATE_ACTIVITY_TRANSITION) { - if(level >= detector->level_threshold) { - detector->duration += CODEC_FRAME_TIME_BASE; - if(detector->duration >= detector->speech_timeout) { - /* finally detected activity */ - det_event = MPF_DETECTOR_EVENT_ACTIVITY; - mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY); - } - } - else { - /* fallback to inactivity */ - mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY); - } - } - else if(detector->state == DETECTOR_STATE_ACTIVITY) { - if(level >= detector->level_threshold) { - detector->duration += CODEC_FRAME_TIME_BASE; - } - else { - /* start to detect inactivity */ - mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY_TRANSITION); - } - } - else if(detector->state == DETECTOR_STATE_INACTIVITY_TRANSITION) { - if(level >= detector->level_threshold) { - /* fallback to activity */ - mpf_activity_detector_state_change(detector,DETECTOR_STATE_ACTIVITY); - } - else { - detector->duration += CODEC_FRAME_TIME_BASE; - if(detector->duration >= detector->silence_timeout) { - /* detected inactivity */ - det_event = MPF_DETECTOR_EVENT_INACTIVITY; - mpf_activity_detector_state_change(detector,DETECTOR_STATE_INACTIVITY); - } - } - } - - return det_event; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c b/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c deleted file mode 100644 index 5c168ebf00..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_audio_file_stream.c +++ /dev/null @@ -1,171 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_audio_file_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_audio_file_stream.h" -#include "mpf_termination.h" -#include "mpf_frame.h" -#include "mpf_codec_manager.h" -#include "apt_log.h" - -/** Audio file stream */ -typedef struct mpf_audio_file_stream_t mpf_audio_file_stream_t; -struct mpf_audio_file_stream_t { - mpf_audio_stream_t *audio_stream; - - FILE *read_handle; - FILE *write_handle; - - apt_bool_t eof; - apr_size_t max_write_size; - apr_size_t cur_write_size; -}; - -static APR_INLINE void mpf_audio_file_event_raise(mpf_audio_stream_t *stream, int event_id, void *descriptor); - - -static apt_bool_t mpf_audio_file_destroy(mpf_audio_stream_t *stream) -{ - mpf_audio_file_stream_t *file_stream = stream->obj; - if(file_stream->read_handle) { - fclose(file_stream->read_handle); - file_stream->read_handle = NULL; - } - if(file_stream->write_handle) { - fclose(file_stream->write_handle); - file_stream->write_handle = NULL; - } - return TRUE; -} - -static apt_bool_t mpf_audio_file_reader_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t mpf_audio_file_reader_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -static apt_bool_t mpf_audio_file_frame_read(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - mpf_audio_file_stream_t *file_stream = stream->obj; - if(file_stream->read_handle && file_stream->eof == FALSE) { - if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,file_stream->read_handle) == frame->codec_frame.size) { - frame->type = MEDIA_FRAME_TYPE_AUDIO; - } - else { - file_stream->eof = TRUE; - mpf_audio_file_event_raise(stream,0,NULL); - } - } - return TRUE; -} - - -static apt_bool_t mpf_audio_file_writer_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t mpf_audio_file_writer_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -static apt_bool_t mpf_audio_file_frame_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - mpf_audio_file_stream_t *file_stream = stream->obj; - if(file_stream->write_handle && - (!file_stream->max_write_size || file_stream->cur_write_size < file_stream->max_write_size)) { - file_stream->cur_write_size += fwrite( - frame->codec_frame.buffer, - 1, - frame->codec_frame.size, - file_stream->write_handle); - if(file_stream->cur_write_size >= file_stream->max_write_size) { - mpf_audio_file_event_raise(stream,0,NULL); - } - } - return TRUE; -} - -static const mpf_audio_stream_vtable_t vtable = { - mpf_audio_file_destroy, - mpf_audio_file_reader_open, - mpf_audio_file_reader_close, - mpf_audio_file_frame_read, - mpf_audio_file_writer_open, - mpf_audio_file_writer_close, - mpf_audio_file_frame_write, - NULL /* mpf_audio_file_trace */ -}; - -MPF_DECLARE(mpf_audio_stream_t*) mpf_file_stream_create(mpf_termination_t *termination, apr_pool_t *pool) -{ - mpf_audio_file_stream_t *file_stream = apr_palloc(pool,sizeof(mpf_audio_file_stream_t)); - mpf_stream_capabilities_t *capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_DUPLEX,pool); - mpf_audio_stream_t *audio_stream = mpf_audio_stream_create(file_stream,&vtable,capabilities,pool); - if(!audio_stream) { - return NULL; - } - audio_stream->termination = termination; - - file_stream->audio_stream = audio_stream; - file_stream->write_handle = NULL; - file_stream->read_handle = NULL; - file_stream->eof = FALSE; - file_stream->max_write_size = 0; - file_stream->cur_write_size = 0; - - return audio_stream; -} - -MPF_DECLARE(apt_bool_t) mpf_file_stream_modify(mpf_audio_stream_t *stream, mpf_audio_file_descriptor_t *descriptor) -{ - mpf_audio_file_stream_t *file_stream = stream->obj; - if(descriptor->mask & FILE_READER) { - if(file_stream->read_handle) { - fclose(file_stream->read_handle); - } - file_stream->read_handle = descriptor->read_handle; - file_stream->eof = FALSE; - stream->direction |= FILE_READER; - - stream->rx_descriptor = descriptor->codec_descriptor; - } - if(descriptor->mask & FILE_WRITER) { - if(file_stream->write_handle) { - fclose(file_stream->write_handle); - } - file_stream->write_handle = descriptor->write_handle; - file_stream->max_write_size = descriptor->max_write_size; - file_stream->cur_write_size = 0; - stream->direction |= FILE_WRITER; - - stream->tx_descriptor = descriptor->codec_descriptor; - } - return TRUE; -} - -static APR_INLINE void mpf_audio_file_event_raise(mpf_audio_stream_t *stream, int event_id, void *descriptor) -{ - if(stream->termination->event_handler) { - stream->termination->event_handler(stream->termination,event_id,descriptor); - } -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_bridge.c b/libs/unimrcp/libs/mpf/src/mpf_bridge.c deleted file mode 100644 index 0daf11caee..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_bridge.c +++ /dev/null @@ -1,230 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_bridge.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_bridge.h" -#include "mpf_encoder.h" -#include "mpf_decoder.h" -#include "mpf_resampler.h" -#include "mpf_codec_manager.h" -#include "apt_log.h" - -typedef struct mpf_bridge_t mpf_bridge_t; - -/** MPF bridge derived from MPF object */ -struct mpf_bridge_t { - /** MPF bridge base */ - mpf_object_t base; - /** Audio stream source */ - mpf_audio_stream_t *source; - /** Audio stream sink */ - mpf_audio_stream_t *sink; - /** Codec used in case of null bridge */ - mpf_codec_t *codec; - /** Media frame used to read data from source and write it to sink */ - mpf_frame_t frame; -}; - -static apt_bool_t mpf_bridge_process(mpf_object_t *object) -{ - mpf_bridge_t *bridge = (mpf_bridge_t*) object; - bridge->frame.type = MEDIA_FRAME_TYPE_NONE; - bridge->frame.marker = MPF_MARKER_NONE; - bridge->source->vtable->read_frame(bridge->source,&bridge->frame); - - if((bridge->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) { - memset( bridge->frame.codec_frame.buffer, - 0, - bridge->frame.codec_frame.size); - } - - bridge->sink->vtable->write_frame(bridge->sink,&bridge->frame); - return TRUE; -} - -static apt_bool_t mpf_null_bridge_process(mpf_object_t *object) -{ - mpf_bridge_t *bridge = (mpf_bridge_t*) object; - bridge->frame.type = MEDIA_FRAME_TYPE_NONE; - bridge->frame.marker = MPF_MARKER_NONE; - bridge->source->vtable->read_frame(bridge->source,&bridge->frame); - - if((bridge->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) { - /* generate silence frame */ - mpf_codec_initialize(bridge->codec,&bridge->frame.codec_frame); - } - - bridge->sink->vtable->write_frame(bridge->sink,&bridge->frame); - return TRUE; -} - -static void mpf_bridge_trace(mpf_object_t *object) -{ - mpf_bridge_t *bridge = (mpf_bridge_t*) object; - char buf[1024]; - apr_size_t offset; - - apt_text_stream_t output; - apt_text_stream_init(&output,buf,sizeof(buf)-1); - - mpf_audio_stream_trace(bridge->source,STREAM_DIRECTION_RECEIVE,&output); - - offset = output.pos - output.text.buf; - output.pos += apr_snprintf(output.pos, output.text.length - offset, - "->Bridge->"); - - mpf_audio_stream_trace(bridge->sink,STREAM_DIRECTION_SEND,&output); - - *output.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s",object->name,output.text.buf); -} - - -static apt_bool_t mpf_bridge_destroy(mpf_object_t *object) -{ - mpf_bridge_t *bridge = (mpf_bridge_t*) object; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Audio Bridge %s",object->name); - mpf_audio_stream_rx_close(bridge->source); - mpf_audio_stream_tx_close(bridge->sink); - return TRUE; -} - -static mpf_bridge_t* mpf_bridge_base_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const char *name, apr_pool_t *pool) -{ - mpf_bridge_t *bridge; - if(!source || !sink) { - return NULL; - } - - bridge = apr_palloc(pool,sizeof(mpf_bridge_t)); - bridge->source = source; - bridge->sink = sink; - bridge->codec = NULL; - mpf_object_init(&bridge->base,name); - bridge->base.destroy = mpf_bridge_destroy; - bridge->base.process = mpf_bridge_process; - bridge->base.trace = mpf_bridge_trace; - return bridge; -} - -static mpf_object_t* mpf_linear_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const mpf_codec_manager_t *codec_manager, const char *name, apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor; - apr_size_t frame_size; - mpf_bridge_t *bridge; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Linear Audio Bridge %s",name); - bridge = mpf_bridge_base_create(source,sink,name,pool); - if(!bridge) { - return NULL; - } - - descriptor = source->rx_descriptor; - frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count); - bridge->frame.codec_frame.size = frame_size; - bridge->frame.codec_frame.buffer = apr_palloc(pool,frame_size); - - if(mpf_audio_stream_rx_open(source,NULL) == FALSE) { - return NULL; - } - if(mpf_audio_stream_tx_open(sink,NULL) == FALSE) { - mpf_audio_stream_rx_close(source); - return NULL; - } - return &bridge->base; -} - -static mpf_object_t* mpf_null_bridge_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, const mpf_codec_manager_t *codec_manager, const char *name, apr_pool_t *pool) -{ - mpf_codec_t *codec; - apr_size_t frame_size; - mpf_bridge_t *bridge; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Null Audio Bridge %s",name); - bridge = mpf_bridge_base_create(source,sink,name,pool); - if(!bridge) { - return NULL; - } - bridge->base.process = mpf_null_bridge_process; - - codec = mpf_codec_manager_codec_get(codec_manager,source->rx_descriptor,pool); - if(!codec) { - return NULL; - } - - frame_size = mpf_codec_frame_size_calculate(source->rx_descriptor,codec->attribs); - bridge->codec = codec; - bridge->frame.codec_frame.size = frame_size; - bridge->frame.codec_frame.buffer = apr_palloc(pool,frame_size); - - if(mpf_audio_stream_rx_open(source,codec) == FALSE) { - return NULL; - } - if(mpf_audio_stream_tx_open(sink,codec) == FALSE) { - mpf_audio_stream_rx_close(source); - return NULL; - } - return &bridge->base; -} - -MPF_DECLARE(mpf_object_t*) mpf_bridge_create( - mpf_audio_stream_t *source, - mpf_audio_stream_t *sink, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool) -{ - if(!source || !sink) { - return NULL; - } - - if(mpf_audio_stream_rx_validate(source,sink->tx_descriptor,sink->tx_event_descriptor,pool) == FALSE || - mpf_audio_stream_tx_validate(sink,source->rx_descriptor,source->rx_event_descriptor,pool) == FALSE) { - return NULL; - } - - if(mpf_codec_descriptors_match(source->rx_descriptor,sink->tx_descriptor) == TRUE) { - return mpf_null_bridge_create(source,sink,codec_manager,name,pool); - } - - if(mpf_codec_lpcm_descriptor_match(source->rx_descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,source->rx_descriptor,pool); - if(codec) { - /* set decoder before bridge */ - mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool); - source = decoder; - } - } - - if(mpf_codec_lpcm_descriptor_match(sink->tx_descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,sink->tx_descriptor,pool); - if(codec) { - /* set encoder after bridge */ - mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool); - sink = encoder; - } - } - - if(source->rx_descriptor->sampling_rate != sink->tx_descriptor->sampling_rate) { - /* set resampler before bridge */ - mpf_audio_stream_t *resampler = mpf_resampler_create(source,sink,pool); - if(!resampler) { - return NULL; - } - source = resampler; - } - - return mpf_linear_bridge_create(source,sink,codec_manager,name,pool); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_buffer.c deleted file mode 100644 index 8db46d0a91..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_buffer.c +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_buffer.c 2181 2014-09-14 04:29:38Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "mpf_buffer.h" - -typedef struct mpf_chunk_t mpf_chunk_t; - -struct mpf_chunk_t { - APR_RING_ENTRY(mpf_chunk_t) link; - mpf_frame_t frame; -}; - -struct mpf_buffer_t { - APR_RING_HEAD(mpf_chunk_head_t, mpf_chunk_t) head; - mpf_chunk_t *cur_chunk; - apr_size_t remaining_chunk_size; - apr_thread_mutex_t *guard; - apr_pool_t *pool; - apr_size_t size; /* total size */ -}; - -mpf_buffer_t* mpf_buffer_create(apr_pool_t *pool) -{ - mpf_buffer_t *buffer = apr_palloc(pool,sizeof(mpf_buffer_t)); - buffer->pool = pool; - buffer->cur_chunk = NULL; - buffer->remaining_chunk_size = 0; - buffer->size = 0; - APR_RING_INIT(&buffer->head, mpf_chunk_t, link); - apr_thread_mutex_create(&buffer->guard,APR_THREAD_MUTEX_UNNESTED,pool); - return buffer; -} - -void mpf_buffer_destroy(mpf_buffer_t *buffer) -{ - if(buffer->guard) { - apr_thread_mutex_destroy(buffer->guard); - buffer->guard = NULL; - } -} - -apt_bool_t mpf_buffer_restart(mpf_buffer_t *buffer) -{ - apr_thread_mutex_lock(buffer->guard); - APR_RING_INIT(&buffer->head, mpf_chunk_t, link); - apr_thread_mutex_unlock(buffer->guard); - return TRUE; -} - -static APR_INLINE apt_bool_t mpf_buffer_chunk_write(mpf_buffer_t *buffer, mpf_chunk_t *chunk) -{ - APR_RING_INSERT_TAIL(&buffer->head,chunk,mpf_chunk_t,link); - return TRUE; -} - -static APR_INLINE mpf_chunk_t* mpf_buffer_chunk_read(mpf_buffer_t *buffer) -{ - mpf_chunk_t *chunk = NULL; - if(!APR_RING_EMPTY(&buffer->head,mpf_chunk_t,link)) { - chunk = APR_RING_FIRST(&buffer->head); - APR_RING_REMOVE(chunk,link); - } - return chunk; -} - -apt_bool_t mpf_buffer_audio_write(mpf_buffer_t *buffer, void *data, apr_size_t size) -{ - mpf_chunk_t *chunk; - apt_bool_t status; - apr_thread_mutex_lock(buffer->guard); - - chunk = apr_palloc(buffer->pool,sizeof(mpf_chunk_t)); - APR_RING_ELEM_INIT(chunk,link); - chunk->frame.codec_frame.buffer = apr_palloc(buffer->pool,size); - memcpy(chunk->frame.codec_frame.buffer,data,size); - chunk->frame.codec_frame.size = size; - chunk->frame.type = MEDIA_FRAME_TYPE_AUDIO; - status = mpf_buffer_chunk_write(buffer,chunk); - - buffer->size += size; - apr_thread_mutex_unlock(buffer->guard); - return status; -} - -apt_bool_t mpf_buffer_event_write(mpf_buffer_t *buffer, mpf_frame_type_e event_type) -{ - mpf_chunk_t *chunk; - apt_bool_t status; - apr_thread_mutex_lock(buffer->guard); - - chunk = apr_palloc(buffer->pool,sizeof(mpf_chunk_t)); - APR_RING_ELEM_INIT(chunk,link); - chunk->frame.codec_frame.buffer = NULL; - chunk->frame.codec_frame.size = 0; - chunk->frame.type = event_type; - status = mpf_buffer_chunk_write(buffer,chunk); - - apr_thread_mutex_unlock(buffer->guard); - return status; -} - -apt_bool_t mpf_buffer_frame_read(mpf_buffer_t *buffer, mpf_frame_t *media_frame) -{ - mpf_codec_frame_t *dest; - mpf_codec_frame_t *src; - apr_size_t remaining_frame_size = media_frame->codec_frame.size; - apr_thread_mutex_lock(buffer->guard); - do { - if(!buffer->cur_chunk) { - buffer->cur_chunk = mpf_buffer_chunk_read(buffer); - if(!buffer->cur_chunk) { - /* buffer is empty */ - break; - } - buffer->remaining_chunk_size = buffer->cur_chunk->frame.codec_frame.size; - } - - dest = &media_frame->codec_frame; - src = &buffer->cur_chunk->frame.codec_frame; - media_frame->type |= buffer->cur_chunk->frame.type; - if(remaining_frame_size < buffer->remaining_chunk_size) { - /* copy remaining_frame_size */ - memcpy( - (char*)dest->buffer + dest->size - remaining_frame_size, - (char*)src->buffer + src->size - buffer->remaining_chunk_size, - remaining_frame_size); - buffer->remaining_chunk_size -= remaining_frame_size; - buffer->size -= remaining_frame_size; - remaining_frame_size = 0; - } - else { - /* copy remaining_chunk_size and proceed to the next chunk */ - memcpy( - (char*)dest->buffer + dest->size - remaining_frame_size, - (char*)src->buffer + src->size - buffer->remaining_chunk_size, - buffer->remaining_chunk_size); - remaining_frame_size -= buffer->remaining_chunk_size; - buffer->size -= buffer->remaining_chunk_size; - buffer->remaining_chunk_size = 0; - buffer->cur_chunk = NULL; - } - } - while(remaining_frame_size); - - if(remaining_frame_size) { - apr_size_t offset = media_frame->codec_frame.size - remaining_frame_size; - memset((char*)media_frame->codec_frame.buffer + offset, 0, remaining_frame_size); - } - apr_thread_mutex_unlock(buffer->guard); - return TRUE; -} - -apr_size_t mpf_buffer_get_size(const mpf_buffer_t *buffer) -{ - return buffer->size; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c b/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c deleted file mode 100644 index ca9b903d26..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_codec_descriptor.c +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_codec_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_codec_descriptor.h" -#include "mpf_named_event.h" -#include "mpf_rtp_pt.h" - -/* linear PCM (host horder) */ -#define LPCM_CODEC_NAME "LPCM" -#define LPCM_CODEC_NAME_LENGTH (sizeof(LPCM_CODEC_NAME)-1) - -/* linear PCM atrributes */ -static const mpf_codec_attribs_t lpcm_attribs = { - {LPCM_CODEC_NAME, LPCM_CODEC_NAME_LENGTH}, /* codec name */ - 16, /* bits per sample */ - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | - MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */ -}; - -/** Find matched attribs in codec capabilities by descriptor specified */ -static mpf_codec_attribs_t* mpf_codec_capabilities_attribs_find(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *descriptor); - - -/** Get sampling rate mask (mpf_sample_rate_e) by integer value */ -MPF_DECLARE(int) mpf_sample_rate_mask_get(apr_uint16_t sampling_rate) -{ - switch(sampling_rate) { - case 8000: - return MPF_SAMPLE_RATE_8000; - case 16000: - return MPF_SAMPLE_RATE_16000; - case 32000: - return MPF_SAMPLE_RATE_32000; - case 48000: - return MPF_SAMPLE_RATE_48000; - } - return MPF_SAMPLE_RATE_NONE; -} - -static APR_INLINE apt_bool_t mpf_sampling_rate_check(apr_uint16_t sampling_rate, int mask) -{ - return (mpf_sample_rate_mask_get(sampling_rate) & mask) ? TRUE : FALSE; -} - -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_lpcm_descriptor_create(apr_uint16_t sampling_rate, apr_byte_t channel_count, apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor = mpf_codec_descriptor_create(pool); - descriptor->payload_type = RTP_PT_UNKNOWN; - descriptor->name = lpcm_attribs.name; - descriptor->sampling_rate = sampling_rate; - descriptor->channel_count = channel_count; - return descriptor; -} - -/** Create codec descriptor by capabilities */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_descriptor_create_by_capabilities(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *peer, apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor; - mpf_codec_attribs_t *attribs = NULL; - if(capabilities && peer) { - attribs = mpf_codec_capabilities_attribs_find(capabilities,peer); - } - - if(!attribs) { - return mpf_codec_lpcm_descriptor_create(8000,1,pool); - } - - descriptor = mpf_codec_descriptor_create(pool); - *descriptor = *peer; - if(apt_string_compare(&peer->name,&attribs->name) == FALSE) { - descriptor->payload_type = RTP_PT_UNKNOWN; - descriptor->name = attribs->name; - } - return descriptor; -} - -/** Match two codec descriptors */ -MPF_DECLARE(apt_bool_t) mpf_codec_descriptors_match(const mpf_codec_descriptor_t *descriptor1, const mpf_codec_descriptor_t *descriptor2) -{ - apt_bool_t match = FALSE; - if(descriptor1->payload_type < RTP_PT_DYNAMIC && descriptor2->payload_type < RTP_PT_DYNAMIC) { - if(descriptor1->payload_type == descriptor2->payload_type) { - match = TRUE; - } - } - else { - if(apt_string_compare(&descriptor1->name,&descriptor2->name) == TRUE) { - if(descriptor1->sampling_rate == descriptor2->sampling_rate && - descriptor1->channel_count == descriptor2->channel_count) { - match = TRUE; - } - } - } - return match; -} - -/** Match specified codec descriptor and the default lpcm one */ -MPF_DECLARE(apt_bool_t) mpf_codec_lpcm_descriptor_match(const mpf_codec_descriptor_t *descriptor) -{ - return apt_string_compare(&descriptor->name,&lpcm_attribs.name); -} - -/** Add default (linear PCM) capabilities */ -MPF_DECLARE(apt_bool_t) mpf_codec_default_capabilities_add(mpf_codec_capabilities_t *capabilities) -{ - return mpf_codec_capabilities_add(capabilities,MPF_SAMPLE_RATE_8000,lpcm_attribs.name.buf); -} - -/** Match codec descriptors by attribs specified */ -MPF_DECLARE(apt_bool_t) mpf_codec_descriptor_match_by_attribs(mpf_codec_descriptor_t *descriptor, const mpf_codec_descriptor_t *static_descriptor, const mpf_codec_attribs_t *attribs) -{ - apt_bool_t match = FALSE; - if(descriptor->payload_type < RTP_PT_DYNAMIC) { - if(static_descriptor && static_descriptor->payload_type == descriptor->payload_type) { - descriptor->name = static_descriptor->name; - descriptor->sampling_rate = static_descriptor->sampling_rate; - descriptor->channel_count = static_descriptor->channel_count; - match = TRUE; - } - } - else { - if(apt_string_compare(&attribs->name,&descriptor->name) == TRUE) { - if(mpf_sampling_rate_check(descriptor->sampling_rate,attribs->sample_rates) == TRUE) { - match = TRUE; - } - } - } - return match; -} - -/** Find matched descriptor in codec list */ -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_codec_list_descriptor_find(const mpf_codec_list_t *codec_list, const mpf_codec_descriptor_t *descriptor) -{ - int i; - mpf_codec_descriptor_t *matched_descriptor; - for(i=0; idescriptor_arr->nelts; i++) { - matched_descriptor = &APR_ARRAY_IDX(codec_list->descriptor_arr,i,mpf_codec_descriptor_t); - if(mpf_codec_descriptors_match(descriptor,matched_descriptor) == TRUE) { - return matched_descriptor; - } - } - return NULL; -} - -/** Find matched attribs in codec capabilities by descriptor specified */ -static mpf_codec_attribs_t* mpf_codec_capabilities_attribs_find(const mpf_codec_capabilities_t *capabilities, const mpf_codec_descriptor_t *descriptor) -{ - int i; - mpf_codec_attribs_t *attribs; - for(i=0; iattrib_arr->nelts; i++) { - attribs = &APR_ARRAY_IDX(capabilities->attrib_arr,i,mpf_codec_attribs_t); - if(mpf_sampling_rate_check(descriptor->sampling_rate,attribs->sample_rates) == TRUE) { - return attribs; - } - } - return NULL; -} - -/** Match codec list with specified capabilities */ -MPF_DECLARE(apt_bool_t) mpf_codec_list_match(mpf_codec_list_t *codec_list, const mpf_codec_capabilities_t *capabilities) -{ - int i; - mpf_codec_descriptor_t *descriptor; - apt_bool_t status = FALSE; - if(!capabilities) { - return FALSE; - } - - for(i=0; idescriptor_arr->nelts; i++) { - descriptor = &APR_ARRAY_IDX(codec_list->descriptor_arr,i,mpf_codec_descriptor_t); - if(descriptor->enabled == FALSE) continue; - - /* match capabilities */ - if(mpf_codec_capabilities_attribs_find(capabilities,descriptor)) { - /* at least one codec descriptor matches */ - status = TRUE; - } - else { - descriptor->enabled = FALSE; - } - } - - return status; -} - -/** Intersect two codec lists */ -MPF_DECLARE(apt_bool_t) mpf_codec_lists_intersect(mpf_codec_list_t *codec_list1, mpf_codec_list_t *codec_list2) -{ - int i; - mpf_codec_descriptor_t *descriptor1; - mpf_codec_descriptor_t *descriptor2; - codec_list1->primary_descriptor = NULL; - codec_list1->event_descriptor = NULL; - codec_list2->primary_descriptor = NULL; - codec_list2->event_descriptor = NULL; - /* find only one match for primary and named event descriptors, - set the matched descriptors as preffered, disable the others */ - for(i=0; idescriptor_arr->nelts; i++) { - descriptor1 = &APR_ARRAY_IDX(codec_list1->descriptor_arr,i,mpf_codec_descriptor_t); - if(descriptor1->enabled == FALSE) { - /* this descriptor has been already disabled, process only enabled ones */ - continue; - } - - /* check whether this is a named event descriptor */ - if(mpf_event_descriptor_check(descriptor1) == TRUE) { - /* named event descriptor */ - if(codec_list1->event_descriptor) { - /* named event descriptor has been already set, disable this one */ - descriptor1->enabled = FALSE; - } - else { - /* find if there is a match */ - descriptor2 = mpf_codec_list_descriptor_find(codec_list2,descriptor1); - if(descriptor2 && descriptor2->enabled == TRUE) { - descriptor1->enabled = TRUE; - codec_list1->event_descriptor = descriptor1; - codec_list2->event_descriptor = descriptor2; - } - else { - /* no match found, disable this descriptor */ - descriptor1->enabled = FALSE; - } - } - } - else { - /* primary descriptor */ - if(codec_list1->primary_descriptor) { - /* primary descriptor has been already set, disable this one */ - descriptor1->enabled = FALSE; - } - else { - /* find if there is a match */ - descriptor2 = mpf_codec_list_descriptor_find(codec_list2,descriptor1); - if(descriptor2 && descriptor2->enabled == TRUE) { - descriptor1->enabled = TRUE; - codec_list1->primary_descriptor = descriptor1; - codec_list2->primary_descriptor = descriptor2; - } - else { - /* no match found, disable this descriptor */ - descriptor1->enabled = FALSE; - } - } - } - } - - for(i=0; idescriptor_arr->nelts; i++) { - descriptor2 = &APR_ARRAY_IDX(codec_list2->descriptor_arr,i,mpf_codec_descriptor_t); - if(descriptor2 == codec_list2->primary_descriptor || descriptor2 == codec_list2->event_descriptor) { - descriptor2->enabled = TRUE; - } - else { - descriptor2->enabled = FALSE; - } - } - - /* if primary descriptor is disabled or not set, return FALSE */ - if(!codec_list1->primary_descriptor || codec_list1->primary_descriptor->enabled == FALSE) { - return FALSE; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c b/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c deleted file mode 100644 index 0a3bda25dc..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_codec_g711.c +++ /dev/null @@ -1,191 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_codec_g711.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_codec.h" -#include "mpf_rtp_pt.h" -#include "g711/g711.h" - -#define G711u_CODEC_NAME "PCMU" -#define G711u_CODEC_NAME_LENGTH (sizeof(G711u_CODEC_NAME)-1) - -#define G711a_CODEC_NAME "PCMA" -#define G711a_CODEC_NAME_LENGTH (sizeof(G711a_CODEC_NAME)-1) - -static apt_bool_t g711_open(mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t g711_close(mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t g711u_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - const apr_int16_t *decode_buf; - unsigned char *encode_buf; - apr_size_t i; - - decode_buf = frame_in->buffer; - encode_buf = frame_out->buffer; - - frame_out->size = frame_in->size / sizeof(apr_int16_t); - - for(i=0; isize; i++) { - encode_buf[i] = linear_to_ulaw(decode_buf[i]); - } - - return TRUE; -} - -static apt_bool_t g711u_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apr_int16_t *decode_buf; - const unsigned char *encode_buf; - apr_size_t i; - - decode_buf = frame_out->buffer; - encode_buf = frame_in->buffer; - - frame_out->size = frame_in->size * sizeof(apr_int16_t); - - for(i=0; isize; i++) { - decode_buf[i] = ulaw_to_linear(encode_buf[i]); - } - - return TRUE; -} - -static apt_bool_t g711u_init(mpf_codec_t *codec, mpf_codec_frame_t *frame_out) -{ - apr_size_t i; - unsigned char *encode_buf = frame_out->buffer; - for(i=0; isize; i++) { - encode_buf[i] = linear_to_ulaw(0); - } - - return TRUE; -} - -static apt_bool_t g711a_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - const apr_int16_t *decode_buf; - unsigned char *encode_buf; - apr_size_t i; - - decode_buf = frame_in->buffer; - encode_buf = frame_out->buffer; - - frame_out->size = frame_in->size / sizeof(apr_int16_t); - - for(i=0; isize; i++) { - encode_buf[i] = linear_to_alaw(decode_buf[i]); - } - - return TRUE; -} - -static apt_bool_t g711a_decode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apr_int16_t *decode_buf; - const unsigned char *encode_buf; - apr_size_t i; - - decode_buf = frame_out->buffer; - encode_buf = frame_in->buffer; - - frame_out->size = frame_in->size * sizeof(apr_int16_t); - - for(i=0; isize; i++) { - decode_buf[i] = alaw_to_linear(encode_buf[i]); - } - - return TRUE; -} - -static apt_bool_t g711a_init(mpf_codec_t *codec, mpf_codec_frame_t *frame_out) -{ - apr_size_t i; - unsigned char *encode_buf = frame_out->buffer; - for(i=0; isize; i++) { - encode_buf[i] = linear_to_alaw(0); - } - - return TRUE; -} - -static const mpf_codec_vtable_t g711u_vtable = { - g711_open, - g711_close, - g711u_encode, - g711u_decode, - NULL, - g711u_init -}; - -static const mpf_codec_vtable_t g711a_vtable = { - g711_open, - g711_close, - g711a_encode, - g711a_decode, - NULL, - g711a_init -}; - -static const mpf_codec_descriptor_t g711u_descriptor = { - RTP_PT_PCMU, - {G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH}, - 8000, - 1, - {NULL, 0}, - TRUE -}; - -static const mpf_codec_descriptor_t g711a_descriptor = { - RTP_PT_PCMA, - {G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH}, - 8000, - 1, - {NULL,0}, - TRUE -}; - -static const mpf_codec_attribs_t g711u_attribs = { - {G711u_CODEC_NAME, G711u_CODEC_NAME_LENGTH}, /* codec name */ - 8, /* bits per sample */ - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | - MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */ -}; - -static const mpf_codec_attribs_t g711a_attribs = { - {G711a_CODEC_NAME, G711a_CODEC_NAME_LENGTH}, /* codec name */ - 8, /* bits per sample */ - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | - MPF_SAMPLE_RATE_32000 | MPF_SAMPLE_RATE_48000 /* supported sampling rates */ -}; - -mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool) -{ - return mpf_codec_create(&g711u_vtable,&g711u_attribs,&g711u_descriptor,pool); -} - -mpf_codec_t* mpf_codec_g711a_create(apr_pool_t *pool) -{ - return mpf_codec_create(&g711a_vtable,&g711a_attribs,&g711a_descriptor,pool); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c b/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c deleted file mode 100644 index 78a817df03..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_codec_linear.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_codec_linear.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#define APR_WANT_BYTEFUNC -#include -#include "mpf_codec.h" -#include "mpf_rtp_pt.h" - -/* linear 16-bit PCM (RFC3551) */ -#define L16_CODEC_NAME "L16" -#define L16_CODEC_NAME_LENGTH (sizeof(L16_CODEC_NAME)-1) - - -static apt_bool_t l16_open(mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t l16_close(mpf_codec_t *codec) -{ - return TRUE; -} - -static apt_bool_t l16_encode(mpf_codec_t *codec, const mpf_codec_frame_t *frame_in, mpf_codec_frame_t *frame_out) -{ - apr_uint32_t i; - const apr_int16_t *buf_in = frame_in->buffer; - apr_int16_t *buf_out = frame_out->buffer; - apr_size_t samples = frame_in->size / sizeof(apr_int16_t); - - frame_out->size = frame_in->size; - - for(i=0; ibuffer; - apr_int16_t *buf_out = frame_out->buffer; - apr_size_t samples = frame_in->size / sizeof(apr_int16_t); - - frame_out->size = frame_in->size; - - for(i=0; i -#include "mpf_codec_manager.h" -#include "mpf_rtp_pt.h" -#include "mpf_named_event.h" -#include "apt_log.h" - - -struct mpf_codec_manager_t { - /** Memory pool */ - apr_pool_t *pool; - - /** Dynamic (resizable) array of codecs (mpf_codec_t*) */ - apr_array_header_t *codec_arr; - /** Default named event descriptor */ - mpf_codec_descriptor_t *event_descriptor; -}; - - -MPF_DECLARE(mpf_codec_manager_t*) mpf_codec_manager_create(apr_size_t codec_count, apr_pool_t *pool) -{ - mpf_codec_manager_t *codec_manager = apr_palloc(pool,sizeof(mpf_codec_manager_t)); - codec_manager->pool = pool; - codec_manager->codec_arr = apr_array_make(pool,(int)codec_count,sizeof(mpf_codec_t*)); - codec_manager->event_descriptor = mpf_event_descriptor_create(8000,pool); - return codec_manager; -} - -MPF_DECLARE(void) mpf_codec_manager_destroy(mpf_codec_manager_t *codec_manager) -{ - /* nothing to do */ -} - -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_register(mpf_codec_manager_t *codec_manager, mpf_codec_t *codec) -{ - if(!codec || !codec->attribs || !codec->attribs->name.buf) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Codec [%s]",codec->attribs->name.buf); - - APR_ARRAY_PUSH(codec_manager->codec_arr,mpf_codec_t*) = codec; - return TRUE; -} - -MPF_DECLARE(mpf_codec_t*) mpf_codec_manager_codec_get(const mpf_codec_manager_t *codec_manager, mpf_codec_descriptor_t *descriptor, apr_pool_t *pool) -{ - int i; - mpf_codec_t *codec; - if(!descriptor) { - return NULL; - } - - for(i=0; icodec_arr->nelts; i++) { - codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*); - if(mpf_codec_descriptor_match_by_attribs(descriptor,codec->static_descriptor,codec->attribs) == TRUE) { - return mpf_codec_clone(codec,pool); - } - } - - return NULL; -} - -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_get(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, apr_pool_t *pool) -{ - const mpf_codec_descriptor_t *static_descriptor; - mpf_codec_descriptor_t *descriptor; - int i; - mpf_codec_t *codec; - - mpf_codec_list_init(codec_list,codec_manager->codec_arr->nelts,pool); - for(i=0; icodec_arr->nelts; i++) { - codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*); - static_descriptor = codec->static_descriptor; - if(static_descriptor) { - descriptor = mpf_codec_list_add(codec_list); - if(descriptor) { - *descriptor = *static_descriptor; - } - } - } - if(codec_manager->event_descriptor) { - descriptor = mpf_codec_list_add(codec_list); - if(descriptor) { - *descriptor = *codec_manager->event_descriptor; - } - } - return TRUE; -} - -static apt_bool_t mpf_codec_manager_codec_parse(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, char *codec_desc_str, apr_pool_t *pool) -{ - const mpf_codec_t *codec; - mpf_codec_descriptor_t *descriptor; - const char *separator = "/"; - char *state; - /* parse codec name */ - char *str = apr_strtok(codec_desc_str, separator, &state); - codec_desc_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - if(str) { - apt_str_t name; - apt_string_assign(&name,str,pool); - /* find codec by name */ - codec = mpf_codec_manager_codec_find(codec_manager,&name); - if(codec) { - descriptor = mpf_codec_list_add(codec_list); - descriptor->name = name; - - /* set default attributes */ - if(codec->static_descriptor) { - descriptor->payload_type = codec->static_descriptor->payload_type; - descriptor->sampling_rate = codec->static_descriptor->sampling_rate; - descriptor->channel_count = codec->static_descriptor->channel_count; - } - else { - descriptor->payload_type = RTP_PT_DYNAMIC; - descriptor->sampling_rate = 8000; - descriptor->channel_count = 1; - } - } - else { - mpf_codec_descriptor_t *event_descriptor = codec_manager->event_descriptor; - if(event_descriptor && apt_string_compare(&event_descriptor->name,&name) == TRUE) { - descriptor = mpf_codec_list_add(codec_list); - *descriptor = *event_descriptor; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Codec [%s]",str); - return FALSE; - } - } - - - /* parse optional payload type */ - str = apr_strtok(codec_desc_str, separator, &state); - if(str) { - descriptor->payload_type = (apr_byte_t)atol(str); - - /* parse optional sampling rate */ - str = apr_strtok(codec_desc_str, separator, &state); - if(str) { - descriptor->sampling_rate = (apr_uint16_t)atol(str); - - /* parse optional channel count */ - str = apr_strtok(codec_desc_str, separator, &state); - if(str) { - descriptor->channel_count = (apr_byte_t)atol(str); - } - } - } - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_codec_manager_codec_list_load(const mpf_codec_manager_t *codec_manager, mpf_codec_list_t *codec_list, const char *str, apr_pool_t *pool) -{ - char *codec_desc_str; - char *state; - char *codec_list_str = apr_pstrdup(pool,str); - do { - codec_desc_str = apr_strtok(codec_list_str, " ", &state); - if(codec_desc_str) { - mpf_codec_manager_codec_parse(codec_manager,codec_list,codec_desc_str,pool); - } - codec_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - } - while(codec_desc_str); - return TRUE; -} - -MPF_DECLARE(const mpf_codec_t*) mpf_codec_manager_codec_find(const mpf_codec_manager_t *codec_manager, const apt_str_t *codec_name) -{ - int i; - mpf_codec_t *codec; - for(i=0; icodec_arr->nelts; i++) { - codec = APR_ARRAY_IDX(codec_manager->codec_arr,i,mpf_codec_t*); - if(apt_string_compare(&codec->attribs->name,codec_name) == TRUE) { - return codec; - } - } - return NULL; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_context.c b/libs/unimrcp/libs/mpf/src/mpf_context.c deleted file mode 100644 index e0c35cce81..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_context.c +++ /dev/null @@ -1,548 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_context.c 2181 2014-09-14 04:29:38Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "mpf_context.h" -#include "mpf_termination.h" -#include "mpf_stream.h" -#include "mpf_bridge.h" -#include "mpf_multiplier.h" -#include "mpf_mixer.h" -#include "apt_log.h" - -/** Item of the association matrix */ -typedef struct { - unsigned char on; -} matrix_item_t; - -/** Item of the association matrix header */ -typedef struct { - mpf_termination_t *termination; - unsigned char tx_count; - unsigned char rx_count; -} header_item_t; - -/** Media processing context */ -struct mpf_context_t { - /** Ring entry */ - APR_RING_ENTRY(mpf_context_t) link; - /** Back pointer to the context factory */ - mpf_context_factory_t *factory; - /** Pool to allocate memory from */ - apr_pool_t *pool; - /** Informative name of the context used for debugging */ - const char *name; - /** External object */ - void *obj; - - /** Max number of terminations in the context */ - apr_size_t capacity; - /** Current number of terminations in the context */ - apr_size_t count; - /** Header of the association matrix */ - header_item_t *header; - /** Association matrix, which represents the topology */ - matrix_item_t **matrix; - - /** Array of media processing objects constructed while - applying topology based on association matrix */ - apr_array_header_t *mpf_objects; -}; - -/** Factory of media contexts */ -struct mpf_context_factory_t { - /** Ring head */ - APR_RING_HEAD(mpf_context_head_t, mpf_context_t) head; -}; - - -static APR_INLINE apt_bool_t stream_direction_compatibility_check(mpf_termination_t *termination1, mpf_termination_t *termination2); -static mpf_object_t* mpf_context_bridge_create(mpf_context_t *context, apr_size_t i); -static mpf_object_t* mpf_context_multiplier_create(mpf_context_t *context, apr_size_t i); -static mpf_object_t* mpf_context_mixer_create(mpf_context_t *context, apr_size_t j); - - -MPF_DECLARE(mpf_context_factory_t*) mpf_context_factory_create(apr_pool_t *pool) -{ - mpf_context_factory_t *factory = apr_palloc(pool, sizeof(mpf_context_factory_t)); - APR_RING_INIT(&factory->head, mpf_context_t, link); - return factory; -} - -MPF_DECLARE(void) mpf_context_factory_destroy(mpf_context_factory_t *factory) -{ - mpf_context_t *context; - while(!APR_RING_EMPTY(&factory->head, mpf_context_t, link)) { - context = APR_RING_FIRST(&factory->head); - mpf_context_destroy(context); - APR_RING_REMOVE(context, link); - } -} - -MPF_DECLARE(apt_bool_t) mpf_context_factory_process(mpf_context_factory_t *factory) -{ - mpf_context_t *context; - for(context = APR_RING_FIRST(&factory->head); - context != APR_RING_SENTINEL(&factory->head, mpf_context_t, link); - context = APR_RING_NEXT(context, link)) { - - mpf_context_process(context); - } - - return TRUE; -} - - -MPF_DECLARE(mpf_context_t*) mpf_context_create( - mpf_context_factory_t *factory, - const char *name, - void *obj, - apr_size_t max_termination_count, - apr_pool_t *pool) -{ - apr_size_t i,j; - matrix_item_t *matrix_item; - header_item_t *header_item; - mpf_context_t *context = apr_palloc(pool,sizeof(mpf_context_t)); - APR_RING_ELEM_INIT(context,link); - context->factory = factory; - context->obj = obj; - context->pool = pool; - context->name = name; - if(!context->name) { - context->name = apr_psprintf(pool,"0x%pp",context); - } - context->capacity = max_termination_count; - context->count = 0; - context->mpf_objects = apr_array_make(pool,1,sizeof(mpf_object_t*)); - context->header = apr_palloc(pool,context->capacity * sizeof(header_item_t)); - context->matrix = apr_palloc(pool,context->capacity * sizeof(matrix_item_t*)); - for(i=0; icapacity; i++) { - header_item = &context->header[i]; - header_item->termination = NULL; - header_item->tx_count = 0; - header_item->rx_count = 0; - context->matrix[i] = apr_palloc(pool,context->capacity * sizeof(matrix_item_t)); - for(j=0; jcapacity; j++) { - matrix_item = &context->matrix[i][j]; - matrix_item->on = 0; - } - } - - return context; -} - -MPF_DECLARE(apt_bool_t) mpf_context_destroy(mpf_context_t *context) -{ - apr_size_t i; - mpf_termination_t *termination; - for(i=0; icapacity; i++){ - termination = context->header[i].termination; - if(termination) { - mpf_context_termination_subtract(context,termination); - mpf_termination_subtract(termination); - } - } - return TRUE; -} - -MPF_DECLARE(void*) mpf_context_object_get(const mpf_context_t *context) -{ - return context->obj; -} - -MPF_DECLARE(apt_bool_t) mpf_context_termination_add(mpf_context_t *context, mpf_termination_t *termination) -{ - apr_size_t i; - header_item_t *header_item; - for(i=0; icapacity; i++) { - header_item = &context->header[i]; - if(header_item->termination) { - continue; - } - if(!context->count) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Media Context %s",context->name); - APR_RING_INSERT_TAIL(&context->factory->head,context,mpf_context_t,link); - } - - header_item->termination = termination; - header_item->tx_count = 0; - header_item->rx_count = 0; - - termination->slot = i; - context->count++; - return TRUE; - } - return FALSE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_termination_subtract(mpf_context_t *context, mpf_termination_t *termination) -{ - header_item_t *header_item1; - header_item_t *header_item2; - matrix_item_t *item; - apr_size_t j,k; - apr_size_t i = termination->slot; - if(i >= context->capacity) { - return FALSE; - } - header_item1 = &context->header[i]; - if(header_item1->termination != termination) { - return FALSE; - } - - for(j=0,k=0; jcapacity && kcount; j++) { - header_item2 = &context->header[j]; - if(!header_item2->termination) { - continue; - } - k++; - - item = &context->matrix[i][j]; - if(item->on) { - item->on = 0; - header_item1->tx_count--; - header_item2->rx_count--; - } - - item = &context->matrix[j][i]; - if(item->on) { - item->on = 0; - header_item2->tx_count--; - header_item1->rx_count--; - } - } - header_item1->termination = NULL; - - termination->slot = (apr_size_t)-1; - context->count--; - if(!context->count) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Media Context %s",context->name); - APR_RING_REMOVE(context,link); - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_association_add(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2) -{ - header_item_t *header_item1; - matrix_item_t *matrix_item1; - header_item_t *header_item2; - matrix_item_t *matrix_item2; - apr_size_t i = termination1->slot; - apr_size_t j = termination2->slot; - if(i >= context->capacity || j >= context->capacity) { - return FALSE; - } - - header_item1 = &context->header[i]; - header_item2 = &context->header[j]; - - if(header_item1->termination != termination1 || header_item2->termination != termination2) { - return FALSE; - } - - matrix_item1 = &context->matrix[i][j]; - matrix_item2 = &context->matrix[j][i]; - - /* 1 -> 2 */ - if(!matrix_item1->on) { - if(stream_direction_compatibility_check(header_item1->termination,header_item2->termination) == TRUE) { - matrix_item1->on = 1; - header_item1->tx_count ++; - header_item2->rx_count ++; - } - } - - /* 2 -> 1 */ - if(!matrix_item2->on) { - if(stream_direction_compatibility_check(header_item2->termination,header_item1->termination) == TRUE) { - matrix_item2->on = 1; - header_item2->tx_count ++; - header_item1->rx_count ++; - } - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_association_remove(mpf_context_t *context, mpf_termination_t *termination1, mpf_termination_t *termination2) -{ - header_item_t *header_item1; - matrix_item_t *matrix_item1; - header_item_t *header_item2; - matrix_item_t *matrix_item2; - apr_size_t i = termination1->slot; - apr_size_t j = termination2->slot; - if(i >= context->capacity || j >= context->capacity) { - return FALSE; - } - - header_item1 = &context->header[i]; - header_item2 = &context->header[j]; - - if(header_item1->termination != termination1 || header_item2->termination != termination2) { - return FALSE; - } - - matrix_item1 = &context->matrix[i][j]; - matrix_item2 = &context->matrix[j][i]; - - /* 1 -> 2 */ - if(matrix_item1->on == 1) { - matrix_item1->on = 0; - header_item1->tx_count --; - header_item2->rx_count --; - } - - /* 2 -> 1 */ - if(matrix_item2->on == 1) { - matrix_item2->on = 0; - header_item2->tx_count --; - header_item1->rx_count --; - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_associations_reset(mpf_context_t *context) -{ - apr_size_t i,j,k; - header_item_t *header_item1; - header_item_t *header_item2; - matrix_item_t *item; - - /* destroy existing topology / if any */ - mpf_context_topology_destroy(context); - - /* reset assigned associations */ - for(i=0,k=0; icapacity && kcount; i++) { - header_item1 = &context->header[i]; - if(!header_item1->termination) { - continue; - } - k++; - - if(!header_item1->tx_count && !header_item1->rx_count) { - continue; - } - - for(j=i; jcapacity; j++) { - header_item2 = &context->header[j]; - if(!header_item2->termination) { - continue; - } - - item = &context->matrix[i][j]; - if(item->on) { - item->on = 0; - header_item1->tx_count--; - header_item2->rx_count--; - } - - item = &context->matrix[j][i]; - if(item->on) { - item->on = 0; - header_item2->tx_count--; - header_item1->rx_count--; - } - } - } - return TRUE; -} - -static apt_bool_t mpf_context_object_add(mpf_context_t *context, mpf_object_t *object) -{ - if(!object) { - return FALSE; - } - - APR_ARRAY_PUSH(context->mpf_objects, mpf_object_t*) = object; -#if 1 - mpf_object_trace(object); -#endif - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_topology_apply(mpf_context_t *context) -{ - apr_size_t i,k; - header_item_t *header_item; - mpf_object_t *object; - - /* first destroy existing topology / if any */ - mpf_context_topology_destroy(context); - - for(i=0,k=0; icapacity && kcount; i++) { - header_item = &context->header[i]; - if(!header_item->termination) { - continue; - } - k++; - - if(header_item->tx_count > 0) { - object = NULL; - if(header_item->tx_count == 1) { - object = mpf_context_bridge_create(context,i); - } - else { /* tx_count > 1 */ - object = mpf_context_multiplier_create(context,i); - } - - mpf_context_object_add(context,object); - } - if(header_item->rx_count > 1) { - object = mpf_context_mixer_create(context,i); - mpf_context_object_add(context,object); - } - } - - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_topology_destroy(mpf_context_t *context) -{ - if(context->mpf_objects->nelts) { - int i; - mpf_object_t *object; - for(i=0; impf_objects->nelts; i++) { - object = APR_ARRAY_IDX(context->mpf_objects,i,mpf_object_t*); - mpf_object_destroy(object); - } - apr_array_clear(context->mpf_objects); - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_context_process(mpf_context_t *context) -{ - int i; - mpf_object_t *object; - for(i=0; impf_objects->nelts; i++) { - object = APR_ARRAY_IDX(context->mpf_objects,i,mpf_object_t*); - if(object && object->process) { - object->process(object); - } - } - return TRUE; -} - - -static mpf_object_t* mpf_context_bridge_create(mpf_context_t *context, apr_size_t i) -{ - header_item_t *header_item1 = &context->header[i]; - header_item_t *header_item2; - matrix_item_t *item; - apr_size_t j; - for(j=0; jcapacity; j++) { - header_item2 = &context->header[j]; - if(!header_item2->termination) { - continue; - } - item = &context->matrix[i][j]; - if(!item->on) { - continue; - } - - if(header_item2->rx_count > 1) { - /* mixer will be created instead */ - return NULL; - } - - /* create bridge i -> j */ - if(header_item1->termination && header_item2->termination) { - return mpf_bridge_create( - header_item1->termination->audio_stream, - header_item2->termination->audio_stream, - header_item1->termination->codec_manager, - context->name, - context->pool); - } - } - return NULL; -} - -static mpf_object_t* mpf_context_multiplier_create(mpf_context_t *context, apr_size_t i) -{ - mpf_audio_stream_t **sink_arr; - header_item_t *header_item1 = &context->header[i]; - header_item_t *header_item2; - matrix_item_t *item; - apr_size_t j,k; - sink_arr = apr_palloc(context->pool,header_item1->tx_count * sizeof(mpf_audio_stream_t*)); - for(j=0,k=0; jcapacity && ktx_count; j++) { - header_item2 = &context->header[j]; - if(!header_item2->termination) { - continue; - } - item = &context->matrix[i][j]; - if(!item->on) { - continue; - } - sink_arr[k] = header_item2->termination->audio_stream; - k++; - } - return mpf_multiplier_create( - header_item1->termination->audio_stream, - sink_arr, - header_item1->tx_count, - header_item1->termination->codec_manager, - context->name, - context->pool); -} - -static mpf_object_t* mpf_context_mixer_create(mpf_context_t *context, apr_size_t j) -{ - mpf_audio_stream_t **source_arr; - header_item_t *header_item1 = &context->header[j]; - header_item_t *header_item2; - matrix_item_t *item; - apr_size_t i,k; - source_arr = apr_palloc(context->pool,header_item1->rx_count * sizeof(mpf_audio_stream_t*)); - for(i=0,k=0; icapacity && krx_count; i++) { - header_item2 = &context->header[i]; - if(!header_item2->termination) { - continue; - } - item = &context->matrix[i][j]; - if(!item->on) { - continue; - } - source_arr[k] = header_item2->termination->audio_stream; - k++; - } - return mpf_mixer_create( - source_arr, - header_item1->rx_count, - header_item1->termination->audio_stream, - header_item1->termination->codec_manager, - context->name, - context->pool); -} - -static APR_INLINE apt_bool_t stream_direction_compatibility_check(mpf_termination_t *termination1, mpf_termination_t *termination2) -{ - mpf_audio_stream_t *source = termination1->audio_stream; - mpf_audio_stream_t *sink = termination2->audio_stream; - if(source && (source->direction & STREAM_DIRECTION_RECEIVE) == STREAM_DIRECTION_RECEIVE && - sink && (sink->direction & STREAM_DIRECTION_SEND) == STREAM_DIRECTION_SEND) { - return TRUE; - } - return FALSE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_decoder.c b/libs/unimrcp/libs/mpf/src/mpf_decoder.c deleted file mode 100644 index f27467101f..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_decoder.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_decoder.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_decoder.h" -#include "apt_log.h" - -typedef struct mpf_decoder_t mpf_decoder_t; - -struct mpf_decoder_t { - mpf_audio_stream_t *base; - mpf_audio_stream_t *source; - mpf_codec_t *codec; - mpf_frame_t frame_in; -}; - - -static apt_bool_t mpf_decoder_destroy(mpf_audio_stream_t *stream) -{ - mpf_decoder_t *decoder = stream->obj; - return mpf_audio_stream_destroy(decoder->source); -} - -static apt_bool_t mpf_decoder_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - mpf_decoder_t *decoder = stream->obj; - mpf_codec_open(decoder->codec); - return mpf_audio_stream_rx_open(decoder->source,decoder->codec); -} - -static apt_bool_t mpf_decoder_close(mpf_audio_stream_t *stream) -{ - mpf_decoder_t *decoder = stream->obj; - mpf_codec_close(decoder->codec); - return mpf_audio_stream_rx_close(decoder->source); -} - -static apt_bool_t mpf_decoder_process(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - mpf_decoder_t *decoder = stream->obj; - decoder->frame_in.type = MEDIA_FRAME_TYPE_NONE; - decoder->frame_in.marker = MPF_MARKER_NONE; - if(mpf_audio_stream_frame_read(decoder->source,&decoder->frame_in) != TRUE) { - return FALSE; - } - - frame->type = decoder->frame_in.type; - frame->marker = decoder->frame_in.marker; - if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) { - frame->event_frame = decoder->frame_in.event_frame; - } - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) { - mpf_codec_decode(decoder->codec,&decoder->frame_in.codec_frame,&frame->codec_frame); - } - return TRUE; -} - -static void mpf_decoder_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output) -{ - apr_size_t offset; - mpf_codec_descriptor_t *descriptor; - mpf_decoder_t *decoder = stream->obj; - - mpf_audio_stream_trace(decoder->source,direction,output); - - descriptor = decoder->base->rx_descriptor; - if(descriptor) { - offset = output->pos - output->text.buf; - output->pos += apr_snprintf(output->pos, output->text.length - offset, - "->Decoder->[%s/%d/%d]", - descriptor->name.buf, - descriptor->sampling_rate, - descriptor->channel_count); - } -} - -static const mpf_audio_stream_vtable_t vtable = { - mpf_decoder_destroy, - mpf_decoder_open, - mpf_decoder_close, - mpf_decoder_process, - NULL, - NULL, - NULL, - mpf_decoder_trace -}; - -MPF_DECLARE(mpf_audio_stream_t*) mpf_decoder_create(mpf_audio_stream_t *source, mpf_codec_t *codec, apr_pool_t *pool) -{ - apr_size_t frame_size; - mpf_decoder_t *decoder; - mpf_stream_capabilities_t *capabilities; - if(!source || !codec) { - return NULL; - } - decoder = apr_palloc(pool,sizeof(mpf_decoder_t)); - capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_RECEIVE,pool); - decoder->base = mpf_audio_stream_create(decoder,&vtable,capabilities,pool); - if(!decoder->base) { - return NULL; - } - decoder->base->rx_descriptor = mpf_codec_lpcm_descriptor_create( - source->rx_descriptor->sampling_rate, - source->rx_descriptor->channel_count, - pool); - decoder->base->rx_event_descriptor = source->rx_event_descriptor; - - decoder->source = source; - decoder->codec = codec; - - frame_size = mpf_codec_frame_size_calculate(source->rx_descriptor,codec->attribs); - decoder->frame_in.codec_frame.size = frame_size; - decoder->frame_in.codec_frame.buffer = apr_palloc(pool,frame_size); - return decoder->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c b/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c deleted file mode 100644 index 58ca1916fd..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_dtmf_detector.c +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan - * - * 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. - * - * $Id: mpf_dtmf_detector.c 2227 2014-11-12 01:10:18Z achaloyan@gmail.com $ - */ - -#include "mpf_dtmf_detector.h" -#include "apr_thread_mutex.h" -#include "apt_log.h" -#include "mpf_named_event.h" -#include - -#ifndef M_PI -# define M_PI 3.141592653589793238462643 -#endif - -/** Max detected DTMF digits buffer length */ -#define MPF_DTMFDET_BUFFER_LEN 32 - -/** Number of DTMF frequencies */ -#define DTMF_FREQUENCIES 8 - -/** Window length in samples (at 8kHz) for Goertzel's frequency analysis */ -#define GOERTZEL_SAMPLES_8K 102 - -/** See RFC4733 */ -#define DTMF_EVENT_ID_MAX 15 /* 0123456789*#ABCD */ - -/** - * Goertzel frequency detector (second-order IIR filter) state: - * - * s(t) = x(t) + coef * s(t-1) - s(t-2), where s(0)=0; s(1) = 0; - * x(t) is the input signal - * - * Then energy of frequency f in the signal is: - * X(f)X'(f) = s(t-2)^2 + s(t-1)^2 - coef*s(t-2)*s(t-1) - */ -typedef struct goertzel_state_t { - /** coef = cos(2*pi*f_tone/f_sampling) */ - double coef; - /** s(t-2) or resulting energy @see goertzel_state_t */ - double s1; - /** s(t-1) @see goertzel_state_t */ - double s2; -} goertzel_state_t; - -/** DTMF frequencies */ -static const double dtmf_freqs[DTMF_FREQUENCIES] = { - 697, 770, 852, 941, /* Row frequencies */ - 1209, 1336, 1477, 1633}; /* Col frequencies */ - -/** [row, col] major frequency to digit mapping */ -static const char freq2digits[DTMF_FREQUENCIES/2][DTMF_FREQUENCIES/2] = - { { '1', '2', '3', 'A' }, - { '4', '5', '6', 'B' }, - { '7', '8', '9', 'C' }, - { '*', '0', '#', 'D' } }; - -/** Media Processing Framework's Dual Tone Multiple Frequncy detector */ -struct mpf_dtmf_detector_t { - /** Mutex to guard the buffer */ - struct apr_thread_mutex_t *mutex; - /** Recognizer band */ - enum mpf_dtmf_detector_band_e band; - /** Detected digits buffer */ - char buf[MPF_DTMFDET_BUFFER_LEN+1]; - /** Number of digits in the buffer */ - apr_size_t digits; - /** Number of lost digits due to full buffer */ - apr_size_t lost_digits; - /** Frequency analyzators */ - struct goertzel_state_t energies[DTMF_FREQUENCIES]; - /** Total energy of signal */ - double totenergy; - /** Number of samples in a window */ - apr_size_t wsamples; - /** Number of samples processed */ - apr_size_t nsamples; - /** Previously detected and last reported digits */ - char last1, last2, curr; -}; - - -MPF_DECLARE(struct mpf_dtmf_detector_t *) mpf_dtmf_detector_create_ex( - const struct mpf_audio_stream_t *stream, - enum mpf_dtmf_detector_band_e band, - struct apr_pool_t *pool) -{ - apr_status_t status; - struct mpf_dtmf_detector_t *det; - int flg_band = band; - - if (!stream->tx_descriptor) flg_band &= ~MPF_DTMF_DETECTOR_INBAND; -/* - Event descriptor is not important actually - if (!stream->tx_event_descriptor) flg_band &= ~MPF_DTMF_DETECTOR_OUTBAND; -*/ - if (!flg_band) return NULL; - - det = apr_palloc(pool, sizeof(mpf_dtmf_detector_t)); - if (!det) return NULL; - status = apr_thread_mutex_create(&det->mutex, APR_THREAD_MUTEX_DEFAULT, pool); - if (status != APR_SUCCESS) return NULL; - - det->band = (enum mpf_dtmf_detector_band_e) flg_band; - det->buf[0] = 0; - det->digits = 0; - det->lost_digits = 0; - - if (det->band & MPF_DTMF_DETECTOR_INBAND) { - apr_size_t i; - for (i = 0; i < DTMF_FREQUENCIES; i++) { - det->energies[i].coef = 2 * cos(2 * M_PI * dtmf_freqs[i] / - stream->tx_descriptor->sampling_rate); - det->energies[i].s1 = 0; - det->energies[i].s2 = 0; - } - det->nsamples = 0; - det->wsamples = GOERTZEL_SAMPLES_8K * (stream->tx_descriptor->sampling_rate / 8000); - det->last1 = det->last2 = det->curr = 0; - det->totenergy = 0; - } - - return det; -} - -MPF_DECLARE(char) mpf_dtmf_detector_digit_get(struct mpf_dtmf_detector_t *detector) -{ - char digit; - apr_thread_mutex_lock(detector->mutex); - digit = detector->buf[0]; - if (digit) { - memmove(detector->buf, detector->buf + 1, strlen(detector->buf)); - detector->digits--; - } - apr_thread_mutex_unlock(detector->mutex); - return digit; -} - -MPF_DECLARE(apr_size_t) mpf_dtmf_detector_digits_lost(const struct mpf_dtmf_detector_t *detector) -{ - return detector->lost_digits; -} - -MPF_DECLARE(void) mpf_dtmf_detector_reset(struct mpf_dtmf_detector_t *detector) -{ - apr_thread_mutex_lock(detector->mutex); - detector->buf[0] = 0; - detector->lost_digits = 0; - detector->digits = 0; - detector->curr = detector->last1 = detector->last2 = 0; - detector->nsamples = 0; - detector->totenergy = 0; - apr_thread_mutex_unlock(detector->mutex); -} - -static APR_INLINE void mpf_dtmf_detector_add_digit( - struct mpf_dtmf_detector_t *detector, - char digit) -{ - if (!digit) return; - apr_thread_mutex_lock(detector->mutex); - if (detector->digits < MPF_DTMFDET_BUFFER_LEN) { - detector->buf[detector->digits++] = digit; - detector->buf[detector->digits] = 0; - } else - detector->lost_digits++; - apr_thread_mutex_unlock(detector->mutex); -} - -static APR_INLINE void goertzel_sample( - struct mpf_dtmf_detector_t *detector, - apr_int16_t sample) -{ - apr_size_t i; - double s; - for (i = 0; i < DTMF_FREQUENCIES; i++) { - s = detector->energies[i].s1; - detector->energies[i].s1 = detector->energies[i].s2; - detector->energies[i].s2 = sample + - detector->energies[i].coef * detector->energies[i].s1 - s; - } - detector->totenergy += sample * sample; -} - -static void goertzel_energies_digit(struct mpf_dtmf_detector_t *detector) -{ - apr_size_t i, rmax = 0, cmax = 0; - double reng = 0, ceng = 0; - char digit = 0; - - /* Calculate energies and maxims */ - for (i = 0; i < DTMF_FREQUENCIES; i++) { - double eng = detector->energies[i].s1 * detector->energies[i].s1 + - detector->energies[i].s2 * detector->energies[i].s2 - - detector->energies[i].coef * detector->energies[i].s1 * detector->energies[i].s2; - if (i < DTMF_FREQUENCIES/2) { - if (eng > reng) { - rmax = i; - reng = eng; - } - } else { - if (eng > ceng) { - cmax = i; - ceng = eng; - } - } - } - - if ((reng < 8.0e10 * detector->wsamples / GOERTZEL_SAMPLES_8K) || - (ceng < 8.0e10 * detector->wsamples / GOERTZEL_SAMPLES_8K)) - { - /* energy not high enough */ - } else if ((ceng > reng) && (reng < ceng * 0.398)) { /* twist > 4dB, error */ - /* Twist check - * CEPT => twist < 6dB - * AT&T => forward twist < 4dB and reverse twist < 8dB - * -ndB < 10 log10( v1 / v2 ), where v1 < v2 - * -4dB < 10 log10( v1 / v2 ) - * -0.4 < log10( v1 / v2 ) - * 0.398 < v1 / v2 - * 0.398 * v2 < v1 - */ - } else if ((ceng < reng) && (ceng < reng * 0.158)) { /* twist > 8db, error */ - /* Reverse twist check failed */ - } else if (0.25 * detector->totenergy > (reng + ceng)) { /* 16db */ - /* Signal energy to total energy ratio test failed */ - } else { - if (cmax >= DTMF_FREQUENCIES/2 && cmax < DTMF_FREQUENCIES) - digit = freq2digits[rmax][cmax - DTMF_FREQUENCIES/2]; - } - - /* Three successive detections will trigger the detection */ - if (digit != detector->curr) { - if (digit && ((detector->last1 == digit) && (detector->last2 == digit))) { - detector->curr = digit; - mpf_dtmf_detector_add_digit(detector, digit); - } else if ((detector->last1 != detector->curr) && (detector->last2 != detector->curr)) { - detector->curr = 0; - } - } - detector->last1 = detector->last2; - detector->last2 = digit; - - /* Reset Goertzel's detectors */ - for (i = 0; i < DTMF_FREQUENCIES; i++) { - detector->energies[i].s1 = 0; - detector->energies[i].s2 = 0; - } - detector->totenergy = 0; -} - -MPF_DECLARE(void) mpf_dtmf_detector_get_frame( - struct mpf_dtmf_detector_t *detector, - const struct mpf_frame_t *frame) -{ - if ((detector->band & MPF_DTMF_DETECTOR_OUTBAND) && - (frame->type & MEDIA_FRAME_TYPE_EVENT) && - (frame->event_frame.event_id <= DTMF_EVENT_ID_MAX) && - (frame->marker == MPF_MARKER_START_OF_EVENT)) - { - if (detector->band & MPF_DTMF_DETECTOR_INBAND) { - detector->band &= ~MPF_DTMF_DETECTOR_INBAND; - apt_log(APT_LOG_MARK, APT_PRIO_INFO, "Out-of-band digit arrived, turning " - "in-band DTMF detector off"); - } - mpf_dtmf_detector_add_digit(detector, mpf_event_id_to_dtmf_char( - frame->event_frame.event_id)); - return; - } - - if ((detector->band & MPF_DTMF_DETECTOR_INBAND) && (frame->type & MEDIA_FRAME_TYPE_AUDIO)) { - apr_int16_t *samples = frame->codec_frame.buffer; - apr_size_t i; - - for (i = 0; i < frame->codec_frame.size / 2; i++) { - goertzel_sample(detector, samples[i]); - if (++detector->nsamples >= detector->wsamples) { - goertzel_energies_digit(detector); - detector->nsamples = 0; - } - } - } -} - -MPF_DECLARE(void) mpf_dtmf_detector_destroy(struct mpf_dtmf_detector_t *detector) -{ - apr_thread_mutex_destroy(detector->mutex); - detector->mutex = NULL; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c b/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c deleted file mode 100644 index b4671adaf1..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_dtmf_generator.c +++ /dev/null @@ -1,349 +0,0 @@ -/* - * Copyright 2009-2010 Tomas Valenta, Arsen Chaloyan - * - * 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. - * - * $Id: mpf_dtmf_generator.c 2227 2014-11-12 01:10:18Z achaloyan@gmail.com $ - */ - -#include "mpf_dtmf_generator.h" -#include "apr.h" -#include "apr_thread_mutex.h" -#include "apt_log.h" -#include "mpf_named_event.h" -#include - -#ifndef M_PI -# define M_PI 3.141592653589793238462643 -#endif - -/** Max DTMF digits waiting to be sent */ -#define MPF_DTMFGEN_QUEUE_LEN 32 - -/** See RFC4733 */ -#define DTMF_EVENT_ID_MAX 15 /* 0123456789*#ABCD */ - -/** See RFC4733 */ -#define DTMF_EVENT_VOLUME 10 - -/** Amplitude of single sine wave from tone generator */ -#define DTMF_SINE_AMPLITUDE 12288 - -/** State of the DTMF generator */ -typedef enum mpf_dtmf_generator_state_e { - /** Ready to generate next digit in queue */ - DTMF_GEN_STATE_IDLE, - /** Generating tone */ - DTMF_GEN_STATE_TONE, - /** Retransmitting final RTP packet */ - DTMF_GEN_STATE_ENDING, - /** Generating silence between tones */ - DTMF_GEN_STATE_SILENCE -} mpf_dtmf_generator_state_e; - -/** - * Sine wave generator (second-order IIR filter) state: - * - * s(t) = Amp*sin(2*pi*f_tone/f_sampling*t) - * - * s(t) = coef * s(t-1) - s(t-2); s(0)=0; s(1)=Amp*sin(2*pi*f_tone/f_sampling) - */ -typedef struct sine_state_t { - /** coef = cos(2*pi*f_tone/f_sampling) */ - double coef; - /** s(t-2) @see sine_state_t */ - double s1; - /** s(t-1) @see sine_state_t */ - double s2; -} sine_state_t; - -/** Mapping event_id to frequency pair */ -static const double dtmf_freq[DTMF_EVENT_ID_MAX+1][2] = { - {941, 1336}, /* 0 */ - {697, 1209}, /* 1 */ - {697, 1336}, /* 2 */ - {697, 1477}, /* 3 */ - {770, 1209}, /* 4 */ - {770, 1336}, /* 5 */ - {770, 1477}, /* 6 */ - {852, 1209}, /* 7 */ - {852, 1336}, /* 8 */ - {852, 1477}, /* 9 */ - {941, 1209}, /* * */ - {941, 1477}, /* # */ - {697, 1633}, /* A */ - {770, 1633}, /* B */ - {852, 1633}, /* C */ - {941, 1633} /* D */ -}; - -/** Media Processing Framework's Dual Tone Multiple Frequncy generator */ -struct mpf_dtmf_generator_t { - /** Generator state */ - enum mpf_dtmf_generator_state_e state; - /** In-band or out-of-band */ - enum mpf_dtmf_generator_band_e band; - /** Mutex to guard the queue */ - struct apr_thread_mutex_t *mutex; - /** Queue of digits to generate */ - char queue[MPF_DTMFGEN_QUEUE_LEN+1]; - /** DTMF event_id according to RFC4733 */ - apr_byte_t event_id; - /** Duration in RTP units: (sample_rate / 1000) * milliseconds */ - apr_uint32_t tone_duration; - /** Duration of inter-digit silence @see tone_duration */ - apr_uint32_t silence_duration; - /** Multipurpose counter; mostly in RTP time units */ - apr_uint32_t counter; - /** Frame duration in RTP units */ - apr_uint32_t frame_duration; - /** RTP named event duration (0..0xFFFF) */ - apr_uint32_t event_duration; - /** Set MPF_MARKER_NEW_SEGMENT in the next event frame */ - apt_bool_t new_segment; - /** Lower frequency generator */ - struct sine_state_t sine1; - /** Higher frequency generator */ - struct sine_state_t sine2; - /** Sampling rate of audio in Hz; used in tone generator */ - apr_uint32_t sample_rate_audio; - /** Sampling rate of telephone-events in Hz; used for timing */ - apr_uint32_t sample_rate_events; - /** How often to issue event packet */ - apr_uint32_t events_ptime; - /** Milliseconds elapsed since last event packet */ - apr_uint32_t since_last_event; -}; - - -MPF_DECLARE(struct mpf_dtmf_generator_t *) mpf_dtmf_generator_create_ex( - const struct mpf_audio_stream_t *stream, - enum mpf_dtmf_generator_band_e band, - apr_uint32_t tone_ms, - apr_uint32_t silence_ms, - struct apr_pool_t *pool) -{ - struct mpf_dtmf_generator_t *gen; - apr_status_t status; - int flg_band = band; - - if (!stream->rx_descriptor) flg_band &= ~MPF_DTMF_GENERATOR_INBAND; - if (!stream->rx_event_descriptor) flg_band &= ~MPF_DTMF_GENERATOR_OUTBAND; - if (!flg_band) return NULL; - - gen = apr_palloc(pool, sizeof(struct mpf_dtmf_generator_t)); - if (!gen) return NULL; - status = apr_thread_mutex_create(&gen->mutex, APR_THREAD_MUTEX_DEFAULT, pool); - if (status != APR_SUCCESS) return NULL; - gen->band = (enum mpf_dtmf_generator_band_e) flg_band; - gen->queue[0] = 0; - gen->state = DTMF_GEN_STATE_IDLE; - if (stream->rx_descriptor) - gen->sample_rate_audio = stream->rx_descriptor->sampling_rate; - gen->sample_rate_events = stream->rx_event_descriptor ? - stream->rx_event_descriptor->sampling_rate : gen->sample_rate_audio; - gen->frame_duration = gen->sample_rate_events / 1000 * CODEC_FRAME_TIME_BASE; - gen->tone_duration = gen->sample_rate_events / 1000 * tone_ms; - gen->silence_duration = gen->sample_rate_events / 1000 * silence_ms; - gen->events_ptime = CODEC_FRAME_TIME_BASE; /* Should be got from event_descriptor */ - return gen; -} - - -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_enqueue( - struct mpf_dtmf_generator_t *generator, - const char *digits) -{ - apr_size_t qlen, dlen; - apt_bool_t ret; - - dlen = strlen(digits); - apr_thread_mutex_lock(generator->mutex); - qlen = strlen(generator->queue); - if (qlen + dlen > MPF_DTMFGEN_QUEUE_LEN) { - ret = FALSE; - apt_log(APT_LOG_MARK, APT_PRIO_WARNING, "DTMF queue too short (%d), " - "cannot add %"APR_SIZE_T_FMT" digit%s, already has %"APR_SIZE_T_FMT, - MPF_DTMFGEN_QUEUE_LEN, dlen, dlen > 1 ? "s" : "", qlen); - } else { - strcpy(generator->queue + qlen, digits); - ret = TRUE; - } - apr_thread_mutex_unlock(generator->mutex); - return ret; -} - - -MPF_DECLARE(void) mpf_dtmf_generator_reset(struct mpf_dtmf_generator_t *generator) -{ - apr_thread_mutex_lock(generator->mutex); - generator->state = DTMF_GEN_STATE_IDLE; - generator->queue[0] = 0; - apr_thread_mutex_unlock(generator->mutex); -} - - -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_sending(const struct mpf_dtmf_generator_t *generator) -{ - return *generator->queue || ((generator->state != DTMF_GEN_STATE_IDLE) && - (generator->state != DTMF_GEN_STATE_SILENCE)); -} - - -MPF_DECLARE(apt_bool_t) mpf_dtmf_generator_put_frame( - struct mpf_dtmf_generator_t *generator, - struct mpf_frame_t *frame) -{ - apr_thread_mutex_lock(generator->mutex); - if ((generator->state == DTMF_GEN_STATE_IDLE) && *generator->queue) { - /* Get next valid digit from queue */ - do { - generator->event_id = (apr_byte_t) mpf_dtmf_char_to_event_id(*generator->queue); - memmove(generator->queue, generator->queue + 1, strlen(generator->queue)); - } while (*generator->queue && (generator->event_id > DTMF_EVENT_ID_MAX)); - /* Reset state */ - if (generator->event_id <= DTMF_EVENT_ID_MAX) { - generator->state = DTMF_GEN_STATE_TONE; - generator->counter = 0; - generator->event_duration = 0; - generator->since_last_event = generator->events_ptime; - generator->new_segment = FALSE; - /* Initialize tone generator */ - if (generator->band & MPF_DTMF_GENERATOR_INBAND) { - double omega; - - omega = 2 * M_PI * dtmf_freq[generator->event_id][0] / generator->sample_rate_audio; - generator->sine1.s1 = 0; - generator->sine1.s2 = DTMF_SINE_AMPLITUDE * sin(omega); - generator->sine1.coef = 2 * cos(omega); - - omega = 2 * M_PI * dtmf_freq[generator->event_id][1] / generator->sample_rate_audio; - generator->sine2.s1 = 0; - generator->sine2.s2 = DTMF_SINE_AMPLITUDE * sin(omega); - generator->sine2.coef = 2 * cos(omega); - } - } - } - apr_thread_mutex_unlock(generator->mutex); - if (generator->state == DTMF_GEN_STATE_IDLE) return FALSE; - - if (generator->state == DTMF_GEN_STATE_TONE) { - generator->counter += generator->frame_duration; - generator->event_duration += generator->frame_duration; - if (generator->band & MPF_DTMF_GENERATOR_INBAND) { - apr_size_t i; - apr_int16_t *samples = (apr_int16_t *) frame->codec_frame.buffer; - double s; - - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - /* Tone generator */ - for (i = 0; i < frame->codec_frame.size / 2; i++) { - s = generator->sine1.s1; - generator->sine1.s1 = generator->sine1.s2; - generator->sine1.s2 = generator->sine1.coef * generator->sine1.s1 - s; - samples[i] = (apr_int16_t) (s + generator->sine2.s1); - s = generator->sine2.s1; - generator->sine2.s1 = generator->sine2.s2; - generator->sine2.s2 = generator->sine2.coef * generator->sine2.s1 - s; - } - } - if (generator->band & MPF_DTMF_GENERATOR_OUTBAND) { - generator->since_last_event += CODEC_FRAME_TIME_BASE; - if (generator->since_last_event >= generator->events_ptime) - generator->since_last_event = 0; - else - return TRUE; - frame->type |= MEDIA_FRAME_TYPE_EVENT; - frame->event_frame.reserved = 0; - frame->event_frame.event_id = generator->event_id; - frame->event_frame.volume = DTMF_EVENT_VOLUME; - if (generator->counter >= generator->tone_duration) { - generator->state = DTMF_GEN_STATE_ENDING; - generator->counter = 0; - frame->event_frame.edge = 1; - frame->marker = MPF_MARKER_END_OF_EVENT; - if (generator->event_duration > 0xFFFF) { - /* Shorten the tone a bit instead of lenghtening */ - generator->new_segment = TRUE; - frame->event_frame.duration = 0xFFFF; - generator->event_duration = 0; - } else - frame->event_frame.duration = generator->event_duration; - } else { - frame->event_frame.edge = 0; - if (generator->counter == generator->frame_duration) /* First chunk of event */ - frame->marker = MPF_MARKER_START_OF_EVENT; - else if (generator->new_segment) { - frame->marker = MPF_MARKER_NEW_SEGMENT; - generator->new_segment = FALSE; - } else - frame->marker = MPF_MARKER_NONE; - if (generator->event_duration > 0xFFFF) { - frame->event_frame.duration = 0xFFFF; - generator->event_duration = 0; - generator->new_segment = TRUE; - } else - frame->event_frame.duration = generator->event_duration; - } - return TRUE; - } /* MPF_DTMF_GENERATOR_OUTBAND */ - if (generator->counter >= generator->tone_duration) { - generator->state = DTMF_GEN_STATE_SILENCE; - generator->counter = 0; - } - return TRUE; - } - else if (generator->state == DTMF_GEN_STATE_ENDING) { - generator->since_last_event += CODEC_FRAME_TIME_BASE; - if (generator->since_last_event >= generator->events_ptime) - generator->since_last_event = 0; - else - return TRUE; - generator->counter++; - frame->type |= MEDIA_FRAME_TYPE_EVENT; - frame->marker = MPF_MARKER_END_OF_EVENT; - frame->event_frame.event_id = generator->event_id; - frame->event_frame.volume = DTMF_EVENT_VOLUME; - frame->event_frame.reserved = 0; - frame->event_frame.edge = 1; - if (generator->new_segment) - /* Tone was shortened a little bit */ - frame->event_frame.duration = 0xFFFF; - else - frame->event_frame.duration = generator->event_duration; - if (generator->counter >= 2) { - generator->state = DTMF_GEN_STATE_SILENCE; - generator->counter *= generator->frame_duration; - } - if (generator->band & MPF_DTMF_GENERATOR_INBAND) { - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - memset(frame->codec_frame.buffer, 0, frame->codec_frame.size); - } - return TRUE; - } - else if (generator->state == DTMF_GEN_STATE_SILENCE) { - generator->counter += generator->frame_duration; - if (generator->counter >= generator->silence_duration) - generator->state = DTMF_GEN_STATE_IDLE; - } - - return FALSE; -} - - -MPF_DECLARE(void) mpf_dtmf_generator_destroy(struct mpf_dtmf_generator_t *generator) -{ - mpf_dtmf_generator_reset(generator); - apr_thread_mutex_destroy(generator->mutex); - generator->mutex = NULL; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_encoder.c b/libs/unimrcp/libs/mpf/src/mpf_encoder.c deleted file mode 100644 index cd5837725e..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_encoder.c +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_encoder.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_encoder.h" -#include "apt_log.h" - -typedef struct mpf_encoder_t mpf_encoder_t; - -struct mpf_encoder_t { - mpf_audio_stream_t *base; - mpf_audio_stream_t *sink; - mpf_codec_t *codec; - mpf_frame_t frame_out; -}; - - -static apt_bool_t mpf_encoder_destroy(mpf_audio_stream_t *stream) -{ - mpf_encoder_t *encoder = stream->obj; - return mpf_audio_stream_destroy(encoder->sink); -} - -static apt_bool_t mpf_encoder_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - mpf_encoder_t *encoder = stream->obj; - mpf_codec_open(encoder->codec); - return mpf_audio_stream_tx_open(encoder->sink,encoder->codec); -} - -static apt_bool_t mpf_encoder_close(mpf_audio_stream_t *stream) -{ - mpf_encoder_t *encoder = stream->obj; - mpf_codec_close(encoder->codec); - return mpf_audio_stream_tx_close(encoder->sink); -} - -static apt_bool_t mpf_encoder_process(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - mpf_encoder_t *encoder = stream->obj; - - encoder->frame_out.type = frame->type; - encoder->frame_out.marker = frame->marker; - if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) { - encoder->frame_out.event_frame = frame->event_frame; - } - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) { - mpf_codec_encode(encoder->codec,&frame->codec_frame,&encoder->frame_out.codec_frame); - } - return mpf_audio_stream_frame_write(encoder->sink,&encoder->frame_out); -} - -static void mpf_encoder_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output) -{ - apr_size_t offset; - mpf_codec_descriptor_t *descriptor; - mpf_encoder_t *encoder = stream->obj; - - descriptor = encoder->base->tx_descriptor; - if(descriptor) { - offset = output->pos - output->text.buf; - output->pos += apr_snprintf(output->pos, output->text.length - offset, - "[%s/%d/%d]->Encoder->", - descriptor->name.buf, - descriptor->sampling_rate, - descriptor->channel_count); - } - - mpf_audio_stream_trace(encoder->sink,direction,output); -} - - -static const mpf_audio_stream_vtable_t vtable = { - mpf_encoder_destroy, - NULL, - NULL, - NULL, - mpf_encoder_open, - mpf_encoder_close, - mpf_encoder_process, - mpf_encoder_trace -}; - -MPF_DECLARE(mpf_audio_stream_t*) mpf_encoder_create(mpf_audio_stream_t *sink, mpf_codec_t *codec, apr_pool_t *pool) -{ - apr_size_t frame_size; - mpf_encoder_t *encoder; - mpf_stream_capabilities_t *capabilities; - if(!sink || !codec) { - return NULL; - } - encoder = apr_palloc(pool,sizeof(mpf_encoder_t)); - capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_SEND,pool); - encoder->base = mpf_audio_stream_create(encoder,&vtable,capabilities,pool); - if(!encoder->base) { - return NULL; - } - encoder->base->tx_descriptor = mpf_codec_lpcm_descriptor_create( - sink->tx_descriptor->sampling_rate, - sink->tx_descriptor->channel_count, - pool); - encoder->base->tx_event_descriptor = sink->tx_event_descriptor; - - encoder->sink = sink; - encoder->codec = codec; - - frame_size = mpf_codec_frame_size_calculate(sink->tx_descriptor,codec->attribs); - encoder->frame_out.codec_frame.size = frame_size; - encoder->frame_out.codec_frame.buffer = apr_palloc(pool,frame_size); - return encoder->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_engine.c b/libs/unimrcp/libs/mpf/src/mpf_engine.c deleted file mode 100644 index 60240cb9bb..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_engine.c +++ /dev/null @@ -1,453 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_engine.c 2226 2014-11-12 00:47:40Z achaloyan@gmail.com $ - */ - -#include "mpf_engine.h" -#include "mpf_context.h" -#include "mpf_termination.h" -#include "mpf_stream.h" -#include "mpf_scheduler.h" -#include "mpf_codec_descriptor.h" -#include "mpf_codec_manager.h" -#include "apt_obj_list.h" -#include "apt_cyclic_queue.h" -#include "apt_log.h" - -#define MPF_TIMER_RESOLUTION 100 /* 100 ms */ - -struct mpf_engine_t { - apr_pool_t *pool; - apt_task_t *task; - apt_task_msg_type_e task_msg_type; - apr_thread_mutex_t *request_queue_guard; - apt_cyclic_queue_t *request_queue; - mpf_context_factory_t *context_factory; - mpf_scheduler_t *scheduler; - apt_timer_queue_t *timer_queue; - const mpf_codec_manager_t *codec_manager; -}; - -static void mpf_engine_main(mpf_scheduler_t *scheduler, void *obj); -static void mpf_engine_timer_proc(mpf_scheduler_t *scheduler, void *obj); -static apt_bool_t mpf_engine_destroy(apt_task_t *task); -static apt_bool_t mpf_engine_start(apt_task_t *task); -static apt_bool_t mpf_engine_terminate(apt_task_t *task); -static apt_bool_t mpf_engine_msg_signal(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t mpf_engine_msg_process(apt_task_t *task, apt_task_msg_t *msg); - - -mpf_codec_t* mpf_codec_l16_create(apr_pool_t *pool); -mpf_codec_t* mpf_codec_g711u_create(apr_pool_t *pool); -mpf_codec_t* mpf_codec_g711a_create(apr_pool_t *pool); - -MPF_DECLARE(mpf_engine_t*) mpf_engine_create(const char *id, apr_pool_t *pool) -{ - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - mpf_engine_t *engine = apr_palloc(pool,sizeof(mpf_engine_t)); - engine->pool = pool; - engine->request_queue = NULL; - engine->context_factory = NULL; - engine->codec_manager = NULL; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mpf_message_container_t),pool); - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Media Engine [%s]",id); - engine->task = apt_task_create(engine,msg_pool,pool); - if(!engine->task) { - return NULL; - } - - apt_task_name_set(engine->task,id); - - vtable = apt_task_vtable_get(engine->task); - if(vtable) { - vtable->destroy = mpf_engine_destroy; - vtable->start = mpf_engine_start; - vtable->terminate = mpf_engine_terminate; - vtable->signal_msg = mpf_engine_msg_signal; - vtable->process_msg = mpf_engine_msg_process; - } - - engine->task_msg_type = TASK_MSG_USER; - - engine->context_factory = mpf_context_factory_create(engine->pool); - engine->request_queue = apt_cyclic_queue_create(CYCLIC_QUEUE_DEFAULT_SIZE); - apr_thread_mutex_create(&engine->request_queue_guard,APR_THREAD_MUTEX_UNNESTED,engine->pool); - - engine->scheduler = mpf_scheduler_create(engine->pool); - mpf_scheduler_media_clock_set(engine->scheduler,CODEC_FRAME_TIME_BASE,mpf_engine_main,engine); - - engine->timer_queue = apt_timer_queue_create(engine->pool); - mpf_scheduler_timer_clock_set(engine->scheduler,MPF_TIMER_RESOLUTION,mpf_engine_timer_proc,engine); - return engine; -} - -MPF_DECLARE(mpf_context_t*) mpf_engine_context_create( - mpf_engine_t *engine, - const char *name, - void *obj, - apr_size_t max_termination_count, - apr_pool_t *pool) -{ - return mpf_context_create(engine->context_factory,name,obj,max_termination_count,pool); -} - -MPF_DECLARE(apt_bool_t) mpf_engine_context_destroy(mpf_context_t *context) -{ - return mpf_context_destroy(context); -} - -MPF_DECLARE(void*) mpf_engine_context_object_get(const mpf_context_t *context) -{ - return mpf_context_object_get(context); -} - -MPF_DECLARE(apt_task_t*) mpf_task_get(const mpf_engine_t *engine) -{ - return engine->task; -} - -MPF_DECLARE(void) mpf_engine_task_msg_type_set(mpf_engine_t *engine, apt_task_msg_type_e type) -{ - engine->task_msg_type = type; -} - -static mpf_message_t* mpf_engine_message_get(mpf_engine_t *engine, mpf_task_msg_t **task_msg) -{ - mpf_message_container_t *container; - mpf_message_t *mpf_message; - if(*task_msg) { - container = (mpf_message_container_t*) (*task_msg)->data; - if(container->count >= MAX_MPF_MESSAGE_COUNT) { - /* container has been already filled, - implicitly send the requests and get new task message */ - mpf_engine_message_send(engine,task_msg); - return mpf_engine_message_get(engine,task_msg); - } - } - else { - *task_msg = apt_task_msg_get(engine->task); - container = (mpf_message_container_t*) (*task_msg)->data; - container->count = 0; - } - - mpf_message = &container->messages[container->count]; - container->count++; - return mpf_message; -} - - -MPF_DECLARE(apt_bool_t) mpf_engine_termination_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_termination_t *termination, - void *descriptor, - mpf_task_msg_t **task_msg) -{ - mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg); - if(!mpf_message) { - return FALSE; - } - mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST; - mpf_message->command_id = command_id; - mpf_message->context = context; - mpf_message->termination = termination; - mpf_message->assoc_termination = NULL; - mpf_message->descriptor = descriptor; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_assoc_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_termination_t *termination, - mpf_termination_t *assoc_termination, - mpf_task_msg_t **task_msg) -{ - mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg); - if(!mpf_message) { - return FALSE; - } - mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST; - mpf_message->command_id = command_id; - mpf_message->context = context; - mpf_message->termination = termination; - mpf_message->assoc_termination = assoc_termination; - mpf_message->descriptor = NULL; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_topology_message_add( - mpf_engine_t *engine, - mpf_command_type_e command_id, - mpf_context_t *context, - mpf_task_msg_t **task_msg) -{ - mpf_message_t *mpf_message = mpf_engine_message_get(engine,task_msg); - if(!mpf_message) { - return FALSE; - } - mpf_message->message_type = MPF_MESSAGE_TYPE_REQUEST; - mpf_message->command_id = command_id; - mpf_message->context = context; - mpf_message->termination = NULL; - mpf_message->assoc_termination = NULL; - mpf_message->descriptor = NULL; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_message_send(mpf_engine_t *engine, mpf_task_msg_t **task_msg) -{ - apt_bool_t status = FALSE; - if(*task_msg) { - status = apt_task_msg_signal(engine->task,*task_msg); - *task_msg = NULL; - } - return status; -} - -static apt_bool_t mpf_engine_destroy(apt_task_t *task) -{ - mpf_engine_t *engine = apt_task_object_get(task); - - apt_timer_queue_destroy(engine->timer_queue); - mpf_scheduler_destroy(engine->scheduler); - mpf_context_factory_destroy(engine->context_factory); - apt_cyclic_queue_destroy(engine->request_queue); - apr_thread_mutex_destroy(engine->request_queue_guard); - return TRUE; -} - -static apt_bool_t mpf_engine_start(apt_task_t *task) -{ - mpf_engine_t *engine = apt_task_object_get(task); - - mpf_scheduler_start(engine->scheduler); - apt_task_start_request_process(task); - return TRUE; -} - -static apt_bool_t mpf_engine_terminate(apt_task_t *task) -{ - mpf_engine_t *engine = apt_task_object_get(task); - - mpf_scheduler_stop(engine->scheduler); - apt_task_terminate_request_process(task); - return TRUE; -} - -static apt_bool_t mpf_engine_event_raise(mpf_termination_t *termination, int event_id, void *descriptor) -{ - apt_task_msg_t *task_msg; - mpf_message_container_t *event_msg; - mpf_message_t *mpf_message; - mpf_engine_t *engine; - engine = termination->media_engine; - if(!engine) { - return FALSE; - } - - task_msg = apt_task_msg_get(engine->task); - if(!task_msg) { - return FALSE; - } - task_msg->type = engine->task_msg_type; - event_msg = (mpf_message_container_t*) task_msg->data; - mpf_message = event_msg->messages; - event_msg->count = 1; - - mpf_message->command_id = event_id; - mpf_message->message_type = MPF_MESSAGE_TYPE_EVENT; - mpf_message->status_code = MPF_STATUS_CODE_SUCCESS; - mpf_message->context = NULL; - mpf_message->termination = termination; - mpf_message->descriptor = descriptor; - - return apt_task_msg_parent_signal(engine->task,task_msg); -} - -static apt_bool_t mpf_engine_msg_signal(apt_task_t *task, apt_task_msg_t *msg) -{ - mpf_engine_t *engine = apt_task_object_get(task); - - apr_thread_mutex_lock(engine->request_queue_guard); - if(apt_cyclic_queue_push(engine->request_queue,msg) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_ERROR,"MPF Request Queue is Full [%s]",apt_task_name_get(task)); - } - apr_thread_mutex_unlock(engine->request_queue_guard); - return TRUE; -} - -static apt_bool_t mpf_engine_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - apr_size_t i; - mpf_engine_t *engine = apt_task_object_get(task); - apt_task_msg_t *response_msg; - mpf_message_container_t *response; - mpf_message_t *mpf_response; - mpf_context_t *context; - mpf_termination_t *termination; - const mpf_message_t *mpf_request; - const mpf_message_container_t *request = (const mpf_message_container_t*) msg->data; - - response_msg = apt_task_msg_get(engine->task); - if(!response_msg) { - return FALSE; - } - response_msg->type = engine->task_msg_type; - response = (mpf_message_container_t*) response_msg->data; - *response = *request; - for(i=0; icount; i++) { - mpf_request = &request->messages[i]; - mpf_response = &response->messages[i]; - - if(mpf_request->message_type != MPF_MESSAGE_TYPE_REQUEST) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid MPF Message Type [%d]",mpf_request->message_type); - continue; - } - - mpf_response->message_type = MPF_MESSAGE_TYPE_RESPONSE; - mpf_response->status_code = MPF_STATUS_CODE_SUCCESS; - context = mpf_request->context; - termination = mpf_request->termination; - switch(mpf_request->command_id) { - case MPF_ADD_TERMINATION: - { - termination->media_engine = engine; - termination->event_handler = mpf_engine_event_raise; - termination->codec_manager = engine->codec_manager; - termination->timer_queue = engine->timer_queue; - - mpf_termination_add(termination,mpf_request->descriptor); - if(mpf_context_termination_add(context,termination) == FALSE) { - mpf_termination_subtract(termination); - mpf_response->status_code = MPF_STATUS_CODE_FAILURE; - break; - } - break; - } - case MPF_MODIFY_TERMINATION: - { - mpf_termination_modify(termination,mpf_request->descriptor); - break; - } - case MPF_SUBTRACT_TERMINATION: - { - if(mpf_context_termination_subtract(context,termination) == FALSE) { - mpf_response->status_code = MPF_STATUS_CODE_FAILURE; - break; - } - mpf_termination_subtract(termination); - break; - } - case MPF_ADD_ASSOCIATION: - { - mpf_context_association_add(context,termination,mpf_request->assoc_termination); - break; - } - case MPF_REMOVE_ASSOCIATION: - { - mpf_context_association_remove(context,termination,mpf_request->assoc_termination); - break; - } - case MPF_RESET_ASSOCIATIONS: - { - mpf_context_associations_reset(context); - break; - } - case MPF_APPLY_TOPOLOGY: - { - mpf_context_topology_apply(context); - break; - } - case MPF_DESTROY_TOPOLOGY: - { - mpf_context_topology_destroy(context); - break; - } - default: - { - mpf_response->status_code = MPF_STATUS_CODE_FAILURE; - } - } - } - - return apt_task_msg_parent_signal(engine->task,response_msg); -} - -static void mpf_engine_main(mpf_scheduler_t *scheduler, void *obj) -{ - mpf_engine_t *engine = obj; - apt_task_msg_t *msg; - - /* process request queue */ - apr_thread_mutex_lock(engine->request_queue_guard); - msg = apt_cyclic_queue_pop(engine->request_queue); - while(msg) { - apr_thread_mutex_unlock(engine->request_queue_guard); - apt_task_msg_process(engine->task,msg); - apr_thread_mutex_lock(engine->request_queue_guard); - msg = apt_cyclic_queue_pop(engine->request_queue); - } - apr_thread_mutex_unlock(engine->request_queue_guard); - - /* process factory of media contexts */ - mpf_context_factory_process(engine->context_factory); -} - -static void mpf_engine_timer_proc(mpf_scheduler_t *scheduler, void *obj) -{ - mpf_engine_t *engine = obj; - apt_timer_queue_advance(engine->timer_queue,MPF_TIMER_RESOLUTION); -} - -MPF_DECLARE(mpf_codec_manager_t*) mpf_engine_codec_manager_create(apr_pool_t *pool) -{ - mpf_codec_manager_t *codec_manager = mpf_codec_manager_create(4,pool); - if(codec_manager) { - mpf_codec_t *codec; - - codec = mpf_codec_g711u_create(pool); - mpf_codec_manager_codec_register(codec_manager,codec); - - codec = mpf_codec_g711a_create(pool); - mpf_codec_manager_codec_register(codec_manager,codec); - - codec = mpf_codec_l16_create(pool); - mpf_codec_manager_codec_register(codec_manager,codec); - } - return codec_manager; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_codec_manager_register(mpf_engine_t *engine, const mpf_codec_manager_t *codec_manager) -{ - engine->codec_manager = codec_manager; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_engine_scheduler_rate_set(mpf_engine_t *engine, unsigned long rate) -{ - return mpf_scheduler_rate_set(engine->scheduler,rate); -} - -MPF_DECLARE(const char*) mpf_engine_id_get(const mpf_engine_t *engine) -{ - return apt_task_name_get(engine->task); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c b/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c deleted file mode 100644 index 91174dce94..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_engine_factory.c +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_engine_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mpf_engine_factory.h" -#include "mpf_termination_factory.h" - -/** Factory of media engines */ -struct mpf_engine_factory_t { - /** Array of pointers to media engines */ - apr_array_header_t *engines_arr; - /** Index of the current engine */ - int index; -}; - -/** Create factory of media engines. */ -MPF_DECLARE(mpf_engine_factory_t*) mpf_engine_factory_create(apr_pool_t *pool) -{ - mpf_engine_factory_t *mpf_factory = apr_palloc(pool,sizeof(mpf_engine_factory_t)); - mpf_factory->engines_arr = apr_array_make(pool,1,sizeof(mpf_engine_t*)); - mpf_factory->index = 0; - return mpf_factory; -} - -/** Add media engine to factory. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_engine_add(mpf_engine_factory_t *mpf_factory, mpf_engine_t *media_engine) -{ - mpf_engine_t **slot; - if(!media_engine) - return FALSE; - - slot = apr_array_push(mpf_factory->engines_arr); - *slot = media_engine; - return TRUE; -} - -/** Determine whether factory is empty. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_is_empty(const mpf_engine_factory_t *mpf_factory) -{ - return apr_is_empty_array(mpf_factory->engines_arr); -} - -/** Select next available media engine. */ -MPF_DECLARE(mpf_engine_t*) mpf_engine_factory_engine_select(mpf_engine_factory_t *mpf_factory) -{ - mpf_engine_t *media_engine = APR_ARRAY_IDX(mpf_factory->engines_arr, mpf_factory->index, mpf_engine_t*); - if(++mpf_factory->index == mpf_factory->engines_arr->nelts) { - mpf_factory->index = 0; - } - return media_engine; -} - -/** Associate media engines with RTP termination factory. */ -MPF_DECLARE(apt_bool_t) mpf_engine_factory_rtp_factory_assign(mpf_engine_factory_t *mpf_factory, mpf_termination_factory_t *rtp_factory) -{ - int i; - mpf_engine_t *media_engine; - for(i=0; iengines_arr->nelts; i++) { - media_engine = APR_ARRAY_IDX(mpf_factory->engines_arr, i, mpf_engine_t*); - mpf_termination_factory_engine_assign(rtp_factory,media_engine); - } - return TRUE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c deleted file mode 100644 index e6170a6aa8..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_file_termination_factory.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_file_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_termination.h" -#include "mpf_file_termination_factory.h" -#include "mpf_audio_file_stream.h" - -static apt_bool_t mpf_file_termination_destroy(mpf_termination_t *termination) -{ - return TRUE; -} - -static apt_bool_t mpf_file_termination_add(mpf_termination_t *termination, void *descriptor) -{ - apt_bool_t status = TRUE; - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - audio_stream = mpf_file_stream_create(termination,termination->pool); - if(!audio_stream) { - return FALSE; - } - termination->audio_stream = audio_stream; - } - - if(descriptor) { - status = mpf_file_stream_modify(audio_stream,descriptor); - } - return status; -} - -static apt_bool_t mpf_file_termination_modify(mpf_termination_t *termination, void *descriptor) -{ - apt_bool_t status = TRUE; - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - return FALSE; - } - - if(descriptor) { - status = mpf_file_stream_modify(audio_stream,descriptor); - } - return status; -} - -static apt_bool_t mpf_file_termination_subtract(mpf_termination_t *termination) -{ - return TRUE; -} - -static const mpf_termination_vtable_t file_vtable = { - mpf_file_termination_destroy, - mpf_file_termination_add, - mpf_file_termination_modify, - mpf_file_termination_subtract -}; - -static mpf_termination_t* mpf_file_termination_create( - mpf_termination_factory_t *termination_factory, - void *obj, - apr_pool_t *pool) -{ - return mpf_termination_base_create(termination_factory,obj,&file_vtable,NULL,NULL,pool); -} - -MPF_DECLARE(mpf_termination_factory_t*) mpf_file_termination_factory_create(apr_pool_t *pool) -{ - mpf_termination_factory_t *file_termination_factory = apr_palloc(pool,sizeof(mpf_termination_factory_t)); - file_termination_factory->create_termination = mpf_file_termination_create; - file_termination_factory->assign_engine = NULL; - return file_termination_factory; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c deleted file mode 100644 index 3669db37c2..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_frame_buffer.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_frame_buffer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_frame_buffer.h" - -struct mpf_frame_buffer_t { - apr_byte_t *raw_data; - mpf_frame_t *frames; - apr_size_t frame_count; - apr_size_t frame_size; - - apr_size_t write_pos; - apr_size_t read_pos; - - apr_thread_mutex_t *guard; - apr_pool_t *pool; - -#ifdef MPF_FRAME_BUFFER_DEBUG - FILE *utt_in; - FILE *utt_out; -#endif -}; - - -mpf_frame_buffer_t* mpf_frame_buffer_create(apr_size_t frame_size, apr_size_t frame_count, apr_pool_t *pool) -{ - apr_size_t i; - mpf_frame_t *frame; - mpf_frame_buffer_t *buffer = apr_palloc(pool,sizeof(mpf_frame_buffer_t)); - buffer->pool = pool; - - buffer->frame_size = frame_size; - buffer->frame_count = frame_count; - buffer->raw_data = apr_palloc(pool,buffer->frame_size*buffer->frame_count); - buffer->frames = apr_palloc(pool,sizeof(mpf_frame_t)*buffer->frame_count); - for(i=0; iframe_count; i++) { - frame = &buffer->frames[i]; - frame->type = MEDIA_FRAME_TYPE_NONE; - frame->marker = MPF_MARKER_NONE; - frame->codec_frame.buffer = buffer->raw_data + i*buffer->frame_size; - } - - buffer->write_pos = buffer->read_pos = 0; - apr_thread_mutex_create(&buffer->guard,APR_THREAD_MUTEX_UNNESTED,pool); - -#ifdef MPF_FRAME_BUFFER_DEBUG - buffer->utt_in = NULL; - buffer->utt_out = NULL; -#endif - return buffer; -} - -#ifdef MPF_FRAME_BUFFER_DEBUG -static apr_status_t mpf_frame_buffer_file_close(void *obj) -{ - mpf_frame_buffer_t *buffer = obj; - if(buffer->utt_out) { - fclose(buffer->utt_out); - buffer->utt_out = NULL; - } - if(buffer->utt_in) { - fclose(buffer->utt_in); - buffer->utt_in = NULL; - } - return APR_SUCCESS; -} - -apt_bool_t mpf_frame_buffer_file_open(mpf_frame_buffer_t *buffer, const char *utt_file_in, const char *utt_file_out) -{ - buffer->utt_in = fopen(utt_file_in,"wb"); - if(!buffer->utt_in) - return FALSE; - - buffer->utt_out = fopen(utt_file_out,"wb"); - if(!buffer->utt_out) - return FALSE; - - apr_pool_cleanup_register(buffer->pool,buffer,mpf_frame_buffer_file_close,NULL); - return TRUE; -} -#endif - -void mpf_frame_buffer_destroy(mpf_frame_buffer_t *buffer) -{ - if(buffer->guard) { - apr_thread_mutex_destroy(buffer->guard); - buffer->guard = NULL; - } -} - -apt_bool_t mpf_frame_buffer_restart(mpf_frame_buffer_t *buffer) -{ - buffer->write_pos = buffer->read_pos; - return TRUE; -} - -static APR_INLINE mpf_frame_t* mpf_frame_buffer_frame_get(mpf_frame_buffer_t *buffer, apr_size_t pos) -{ - apr_size_t index = pos % buffer->frame_count; - return &buffer->frames[index]; -} - -apt_bool_t mpf_frame_buffer_write(mpf_frame_buffer_t *buffer, const mpf_frame_t *frame) -{ - mpf_frame_t *write_frame; - void *data = frame->codec_frame.buffer; - apr_size_t size = frame->codec_frame.size; - -#ifdef MPF_FRAME_BUFFER_DEBUG - if(buffer->utt_in) { - fwrite(data,1,size,buffer->utt_in); - } -#endif - - apr_thread_mutex_lock(buffer->guard); - while(buffer->write_pos - buffer->read_pos < buffer->frame_count && size >= buffer->frame_size) { - write_frame = mpf_frame_buffer_frame_get(buffer,buffer->write_pos); - write_frame->type = frame->type; - write_frame->codec_frame.size = buffer->frame_size; - memcpy( - write_frame->codec_frame.buffer, - data, - write_frame->codec_frame.size); - - data = (char*)data + buffer->frame_size; - size -= buffer->frame_size; - buffer->write_pos ++; - } - - apr_thread_mutex_unlock(buffer->guard); - /* if size != 0 => non frame alligned or buffer is full */ - return size == 0 ? TRUE : FALSE; -} - -apt_bool_t mpf_frame_buffer_read(mpf_frame_buffer_t *buffer, mpf_frame_t *media_frame) -{ - apr_thread_mutex_lock(buffer->guard); - if(buffer->write_pos > buffer->read_pos) { - /* normal read */ - mpf_frame_t *src_media_frame = mpf_frame_buffer_frame_get(buffer,buffer->read_pos); - media_frame->type = src_media_frame->type; - media_frame->marker = src_media_frame->marker; - if(media_frame->type & MEDIA_FRAME_TYPE_AUDIO) { - media_frame->codec_frame.size = src_media_frame->codec_frame.size; - memcpy( - media_frame->codec_frame.buffer, - src_media_frame->codec_frame.buffer, - media_frame->codec_frame.size); -#ifdef MPF_FRAME_BUFFER_DEBUG - if(buffer->utt_out) { - fwrite(media_frame->codec_frame.buffer,1,media_frame->codec_frame.size,buffer->utt_out); - } -#endif - } - if(media_frame->type & MEDIA_FRAME_TYPE_EVENT) { - media_frame->event_frame = src_media_frame->event_frame; - } - src_media_frame->type = MEDIA_FRAME_TYPE_NONE; - src_media_frame->marker = MPF_MARKER_NONE; - buffer->read_pos ++; - } - else { - /* underflow */ - media_frame->type = MEDIA_FRAME_TYPE_NONE; - media_frame->marker = MPF_MARKER_NONE; - } - apr_thread_mutex_unlock(buffer->guard); - return TRUE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c b/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c deleted file mode 100644 index f84521a336..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_jitter_buffer.c +++ /dev/null @@ -1,510 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_jitter_buffer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_jitter_buffer.h" -#include "mpf_trace.h" - -#if ENABLE_JB_TRACE == 1 -#define JB_TRACE printf -#elif ENABLE_JB_TRACE == 2 -#define JB_TRACE mpf_debug_output_trace -#else -#define JB_TRACE mpf_null_trace -#endif - -struct mpf_jitter_buffer_t { - /* jitter buffer config */ - mpf_jb_config_t *config; - /* codec to be used to dissect payload */ - mpf_codec_t *codec; - - /* cyclic raw data */ - apr_byte_t *raw_data; - /* frames (out of raw data) */ - mpf_frame_t *frames; - /* number of frames */ - apr_size_t frame_count; - /* frame timestamp units (samples) */ - apr_uint32_t frame_ts; - /* frame size in bytes */ - apr_size_t frame_size; - - /* playout delay in timetsamp units */ - apr_uint32_t playout_delay_ts; - /* max playout delay in timetsamp units */ - apr_uint32_t max_playout_delay_ts; - - /* write should be synchronized (offset calculated) */ - apr_byte_t write_sync; - /* write timestamp offset */ - apr_int32_t write_ts_offset; - - /* write pointer in timestamp units */ - apr_uint32_t write_ts; - /* read pointer in timestamp units */ - apr_uint32_t read_ts; - - /* min length of the buffer in timestamp units */ - apr_int32_t min_length_ts; - /* max length of the buffer in timestamp units */ - apr_int32_t max_length_ts; - /* number of statistical measurements made */ - apr_uint32_t measurment_count; - - /* timestamp event starts at */ - apr_uint32_t event_write_base_ts; - /* the first (base) frame of the event */ - mpf_named_event_frame_t event_write_base; - /* the last received update for the event */ - const mpf_named_event_frame_t *event_write_update; -}; - - -mpf_jitter_buffer_t* mpf_jitter_buffer_create(mpf_jb_config_t *jb_config, mpf_codec_descriptor_t *descriptor, mpf_codec_t *codec, apr_pool_t *pool) -{ - size_t i; - mpf_frame_t *frame; - mpf_jitter_buffer_t *jb = apr_palloc(pool,sizeof(mpf_jitter_buffer_t)); - if(!jb_config) { - /* create default jb config */ - jb_config = apr_palloc(pool,sizeof(mpf_jb_config_t)); - mpf_jb_config_init(jb_config); - } - /* validate jb config */ - if(jb_config->min_playout_delay > jb_config->initial_playout_delay) { - jb_config->min_playout_delay = jb_config->initial_playout_delay; - } - if(jb_config->max_playout_delay < jb_config->initial_playout_delay) { - jb_config->max_playout_delay = 2 * jb_config->initial_playout_delay; - } - if(jb_config->max_playout_delay == 0) { - jb_config->max_playout_delay = 600; /* ms */ - } - - jb->config = jb_config; - jb->codec = codec; - - /* calculate and allocate frame related data */ - jb->frame_ts = (apr_uint32_t)mpf_codec_frame_samples_calculate(descriptor); - jb->frame_size = mpf_codec_frame_size_calculate(descriptor,codec->attribs); - jb->frame_count = jb->config->max_playout_delay / CODEC_FRAME_TIME_BASE; - jb->raw_data = apr_palloc(pool,jb->frame_size*jb->frame_count); - jb->frames = apr_palloc(pool,sizeof(mpf_frame_t)*jb->frame_count); - for(i=0; iframe_count; i++) { - frame = &jb->frames[i]; - frame->type = MEDIA_FRAME_TYPE_NONE; - frame->marker = MPF_MARKER_NONE; - frame->codec_frame.buffer = jb->raw_data + i*jb->frame_size; - } - - if(jb->config->initial_playout_delay % CODEC_FRAME_TIME_BASE != 0) { - jb->config->initial_playout_delay += CODEC_FRAME_TIME_BASE - jb->config->initial_playout_delay % CODEC_FRAME_TIME_BASE; - } - - /* calculate playout delay in timestamp units */ - jb->playout_delay_ts = jb->frame_ts * jb->config->initial_playout_delay / CODEC_FRAME_TIME_BASE; - jb->max_playout_delay_ts = jb->frame_ts * jb->config->max_playout_delay / CODEC_FRAME_TIME_BASE; - - jb->write_sync = 1; - jb->write_ts_offset = 0; - jb->write_ts = jb->read_ts = 0; - - jb->min_length_ts = jb->max_length_ts = 0; - jb->measurment_count = 0; - - jb->event_write_base_ts = 0; - memset(&jb->event_write_base,0,sizeof(mpf_named_event_frame_t)); - jb->event_write_update = NULL; - - return jb; -} - -void mpf_jitter_buffer_destroy(mpf_jitter_buffer_t *jb) -{ -} - -apt_bool_t mpf_jitter_buffer_restart(mpf_jitter_buffer_t *jb) -{ - jb->write_sync = 1; - jb->write_ts_offset = 0; - jb->write_ts = jb->read_ts; - - jb->event_write_base_ts = 0; - memset(&jb->event_write_base,0,sizeof(mpf_named_event_frame_t)); - jb->event_write_update = NULL; - - if(jb->config->adaptive && jb->playout_delay_ts == jb->max_playout_delay_ts) { - jb->playout_delay_ts = jb->frame_ts * jb->config->initial_playout_delay / CODEC_FRAME_TIME_BASE; - } - - JB_TRACE("JB restart\n"); - return TRUE; -} - -static APR_INLINE mpf_frame_t* mpf_jitter_buffer_frame_get(mpf_jitter_buffer_t *jb, apr_size_t ts) -{ - apr_size_t index = (ts / jb->frame_ts) % jb->frame_count; - return &jb->frames[index]; -} - -static APR_INLINE void mpf_jitter_buffer_stat_update(mpf_jitter_buffer_t *jb) -{ - apr_int32_t length_ts; - - if(jb->measurment_count == 50) { - /* start over after every N measurements */ - apr_int32_t mean_length_ts = jb->min_length_ts + (jb->max_length_ts - jb->min_length_ts) / 2; - JB_TRACE("JB stat length [%d : %d] playout delay=%u\n", - jb->min_length_ts,jb->max_length_ts,jb->playout_delay_ts); - jb->min_length_ts = jb->max_length_ts = mean_length_ts; - jb->measurment_count = 0; - } - - /* calculate current length of the buffer */ - length_ts = jb->write_ts - jb->read_ts; - if(length_ts > jb->max_length_ts) { - /* update max length */ - jb->max_length_ts = length_ts; - } - else if(length_ts < jb->min_length_ts) { - /* update min length */ - jb->min_length_ts = length_ts; - } - /* increment the counter after every stat update */ - jb->measurment_count++; -} - -static APR_INLINE void mpf_jitter_buffer_frame_allign(mpf_jitter_buffer_t *jb, apr_uint32_t *ts) -{ - if(*ts % jb->frame_ts != 0) - *ts -= *ts % jb->frame_ts; -} - -static APR_INLINE jb_result_t mpf_jitter_buffer_write_prepare(mpf_jitter_buffer_t *jb, apr_uint32_t ts, apr_uint32_t *write_ts) -{ - if(jb->write_sync) { - JB_TRACE("JB write sync playout delay=%u\n",jb->playout_delay_ts); - /* calculate the offset */ - jb->write_ts_offset = ts - jb->read_ts; - jb->write_sync = 0; - - if(jb->config->time_skew_detection) { - /* reset the statistics */ - jb->min_length_ts = jb->max_length_ts = jb->playout_delay_ts; - jb->measurment_count = 0; - } - } - - /* calculate the write pos taking into account current offset and playout delay */ - *write_ts = ts - jb->write_ts_offset + jb->playout_delay_ts; - if(*write_ts % jb->frame_ts != 0) { - /* allign with frame_ts */ - apr_uint32_t delta_ts = *write_ts % jb->frame_ts; - JB_TRACE("JB write allign ts=%u delta_ts=-%u\n",*write_ts,delta_ts); - *write_ts -= delta_ts; - } - return JB_OK; -} - -jb_result_t mpf_jitter_buffer_write(mpf_jitter_buffer_t *jb, void *buffer, apr_size_t size, apr_uint32_t ts, apr_byte_t marker) -{ - mpf_frame_t *media_frame; - apr_uint32_t write_ts; - apr_size_t available_frame_count; - jb_result_t result; - - if(marker) { - JB_TRACE("JB marker\n"); - /* new talkspurt detected => test whether the buffer is empty */ - if(jb->write_ts <= jb->read_ts) { - /* resync */ - jb->write_sync = 1; - } - } - - /* calculate write_ts */ - result = mpf_jitter_buffer_write_prepare(jb,ts,&write_ts); - if(result != JB_OK) { - return result; - } - - if(write_ts >= jb->read_ts) { - if(write_ts >= jb->write_ts) { - /* normal order */ - } - else { - /* out of order */ - } - } - else { - apr_uint32_t delta_ts; - /* packet arrived too late */ - if(write_ts < jb->write_ts) { - /* out of order => discard */ - JB_TRACE("JB write ts=%u out of order, too late => discard\n",write_ts); - return JB_DISCARD_TOO_LATE; - } - - /* calculate a minimal adjustment needed in order to place the packet into the buffer */ - delta_ts = jb->read_ts - write_ts; - - if(jb->config->time_skew_detection) { - JB_TRACE("JB stat length [%d : %d] playout delay=%u delta=%u\n", - jb->min_length_ts,jb->max_length_ts,jb->playout_delay_ts,delta_ts); - - if((apr_uint32_t)(jb->max_length_ts - jb->min_length_ts) > jb->playout_delay_ts + delta_ts) { - /* update the adjustment based on the collected statistics */ - delta_ts = (apr_uint32_t)(jb->max_length_ts - jb->min_length_ts) - jb->playout_delay_ts; - mpf_jitter_buffer_frame_allign(jb,&delta_ts); - } - - /* determine if there might be a time skew or not */ - if(jb->max_length_ts > 0 && (apr_uint32_t)jb->max_length_ts < jb->playout_delay_ts) { - /* calculate the time skew */ - apr_uint32_t skew_ts = jb->playout_delay_ts - jb->max_length_ts; - mpf_jitter_buffer_frame_allign(jb,&skew_ts); - JB_TRACE("JB time skew detected offset=%u\n",skew_ts); - - /* adjust the offset and write pos */ - jb->write_ts_offset -= skew_ts; - write_ts = ts - jb->write_ts_offset + jb->playout_delay_ts; - - /* adjust the statistics */ - jb->min_length_ts += skew_ts; - jb->max_length_ts += skew_ts; - - if(skew_ts < delta_ts) { - delta_ts -= skew_ts; - } - else { - delta_ts = 0; - } - } - } - - if(delta_ts) { - if(jb->config->adaptive == 0) { - /* jitter buffer is not adaptive => discard the packet */ - JB_TRACE("JB write ts=%u too late => discard\n",write_ts); - return JB_DISCARD_TOO_LATE; - } - - if(jb->playout_delay_ts + delta_ts > jb->max_playout_delay_ts) { - /* max playout delay will be reached => discard the packet */ - JB_TRACE("JB write ts=%u max playout delay reached => discard\n",write_ts); - return JB_DISCARD_TOO_LATE; - } - - /* adjust the playout delay */ - jb->playout_delay_ts += delta_ts; - write_ts += delta_ts; - JB_TRACE("JB adjust playout delay=%u delta=%u\n",jb->playout_delay_ts,delta_ts); - - if(jb->config->time_skew_detection) { - /* adjust the statistics */ - jb->min_length_ts += delta_ts; - jb->max_length_ts += delta_ts; - } - } - } - - /* get number of frames available to write */ - available_frame_count = jb->frame_count - (write_ts - jb->read_ts)/jb->frame_ts; - if(available_frame_count <= 0) { - /* too early */ - JB_TRACE("JB write ts=%u too early => discard\n",write_ts); - return JB_DISCARD_TOO_EARLY; - } - - JB_TRACE("JB write ts=%u size=%"APR_SIZE_T_FMT"\n",write_ts,size); - while(available_frame_count && size) { - media_frame = mpf_jitter_buffer_frame_get(jb,write_ts); - media_frame->codec_frame.size = jb->frame_size; - if(mpf_codec_dissect(jb->codec,&buffer,&size,&media_frame->codec_frame) == FALSE) { - break; - } - - media_frame->type |= MEDIA_FRAME_TYPE_AUDIO; - write_ts += jb->frame_ts; - available_frame_count--; - } - - if(size) { - /* no frame available to write, but some data remains in buffer (partialy too early) */ - } - - if(write_ts > jb->write_ts) { - /* advance write pos */ - jb->write_ts = write_ts; - } - return result; -} - -jb_result_t mpf_jitter_buffer_event_write(mpf_jitter_buffer_t *jb, const mpf_named_event_frame_t *named_event, apr_uint32_t ts, apr_byte_t marker) -{ - mpf_frame_t *media_frame; - apr_uint32_t write_ts; - jb_result_t result = mpf_jitter_buffer_write_prepare(jb,ts,&write_ts); - if(result != JB_OK) { - return result; - } - - /* new event detection */ - if(!marker) { - if(jb->event_write_base.event_id != named_event->event_id || !jb->event_write_update) { - /* new event detected, marker is missing though */ - marker = 1; - } - else if(jb->event_write_base_ts != write_ts) { - /* detect whether this is a new segment of the same event or new event with missing marker - assuming a threshold which equals to 4 frames */ - if(write_ts > jb->event_write_base_ts + jb->event_write_update->duration + 4*jb->frame_ts) { - /* new event detected, marker is missing though */ - marker = 1; - } - else { - /* new segment of the same long-lasting event detected */ - jb->event_write_base = *named_event; - jb->event_write_update = &jb->event_write_base; - jb->event_write_base_ts = write_ts; - } - } - } - if(marker) { - /* new event */ - jb->event_write_base = *named_event; - jb->event_write_update = &jb->event_write_base; - jb->event_write_base_ts = write_ts; - } - else { - /* an update */ - if(named_event->duration < jb->event_write_update->duration) { - /* ignore this update, it's something from the past, which makes no sense now */ - return JB_OK; - } - else if(named_event->duration == jb->event_write_update->duration) { - /* this should be a retransmission, let it go through only if it contains new data */ - if(jb->event_write_update->edge == 1 || jb->event_write_update->edge == named_event->edge) { - /* ignore this update since either the end of event marker has already been set, - or the current event provides no updates */ - return JB_OK; - } - } - - /* calculate position in jitter buffer considering the last received event (update) */ - write_ts += jb->event_write_update->duration; - } - - if(write_ts < jb->read_ts) { - /* too late */ - apr_uint32_t delta_ts; - if(jb->config->adaptive == 0) { - /* jitter buffer is not adaptive => discard the packet */ - JB_TRACE("JB write ts=%u event=%d duration=%d too late => discard\n", - write_ts,named_event->event_id,named_event->duration); - return JB_DISCARD_TOO_LATE; - } - - /* calculate a minimal adjustment needed in order to place the packet into the buffer */ - delta_ts = jb->read_ts - write_ts; - - if(jb->playout_delay_ts + delta_ts > jb->max_playout_delay_ts) { - /* max playout delay will be reached => discard the packet */ - JB_TRACE("JB write ts=%u event=%d duration=%d max playout delay reached => discard\n", - write_ts,named_event->event_id,named_event->duration); - return JB_DISCARD_TOO_LATE; - } - - /* adjust the playout delay */ - jb->playout_delay_ts += delta_ts; - write_ts += delta_ts; - if(marker) { - jb->event_write_base_ts = write_ts; - } - JB_TRACE("JB adjust playout delay=%u delta=%u\n",jb->playout_delay_ts,delta_ts); - } - else if( (write_ts - jb->read_ts)/jb->frame_ts >= jb->frame_count) { - /* too early */ - JB_TRACE("JB write ts=%u event=%d duration=%d too early => discard\n", - write_ts,named_event->event_id,named_event->duration); - return JB_DISCARD_TOO_EARLY; - } - - media_frame = mpf_jitter_buffer_frame_get(jb,write_ts); - media_frame->event_frame = *named_event; - media_frame->type |= MEDIA_FRAME_TYPE_EVENT; - if(marker) { - media_frame->marker = MPF_MARKER_START_OF_EVENT; - } - else if(named_event->edge == 1) { - media_frame->marker = MPF_MARKER_END_OF_EVENT; - } - JB_TRACE("JB write ts=%u event=%d duration=%d marker=%d\n", - write_ts,named_event->event_id,named_event->duration,media_frame->marker); - jb->event_write_update = &media_frame->event_frame; - - write_ts += jb->frame_ts; - if(write_ts > jb->write_ts) { - /* advance write pos */ - jb->write_ts = write_ts; - } - return result; -} - -apt_bool_t mpf_jitter_buffer_read(mpf_jitter_buffer_t *jb, mpf_frame_t *media_frame) -{ - mpf_frame_t *src_media_frame = mpf_jitter_buffer_frame_get(jb,jb->read_ts); - if(jb->write_ts > jb->read_ts) { - /* normal read */ - JB_TRACE("JB read ts=%u\n", jb->read_ts); - media_frame->type = src_media_frame->type; - media_frame->marker = src_media_frame->marker; - if(media_frame->type & MEDIA_FRAME_TYPE_AUDIO) { - media_frame->codec_frame.size = src_media_frame->codec_frame.size; - memcpy(media_frame->codec_frame.buffer,src_media_frame->codec_frame.buffer,media_frame->codec_frame.size); - } - if(media_frame->type & MEDIA_FRAME_TYPE_EVENT) { - media_frame->event_frame = src_media_frame->event_frame; - } - } - else { - /* underflow */ - JB_TRACE("JB read ts=%u underflow\n", jb->read_ts); - media_frame->type = MEDIA_FRAME_TYPE_NONE; - media_frame->marker = MPF_MARKER_NONE; - } - src_media_frame->type = MEDIA_FRAME_TYPE_NONE; - src_media_frame->marker = MPF_MARKER_NONE; - /* advance read pos */ - jb->read_ts += jb->frame_ts; - - if(jb->config->time_skew_detection) { - /* update statistics after every read */ - mpf_jitter_buffer_stat_update(jb); - } - return TRUE; -} - -apr_uint32_t mpf_jitter_buffer_playout_delay_get(const mpf_jitter_buffer_t *jb) -{ - if(jb->config->adaptive == 0) { - return jb->config->initial_playout_delay; - } - - return jb->playout_delay_ts * CODEC_FRAME_TIME_BASE / jb->frame_ts; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_mixer.c b/libs/unimrcp/libs/mpf/src/mpf_mixer.c deleted file mode 100644 index d4c5b3029d..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_mixer.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_mixer.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_mixer.h" -#include "mpf_encoder.h" -#include "mpf_decoder.h" -#include "mpf_resampler.h" -#include "mpf_codec_manager.h" -#include "apt_log.h" - -typedef struct mpf_mixer_t mpf_mixer_t; - -/** MPF mixer derived from MPF object */ -struct mpf_mixer_t { - /** MPF mixer base */ - mpf_object_t base; - /** Array of audio sources */ - mpf_audio_stream_t **source_arr; - /** Number of audio sources */ - apr_size_t source_count; - /** Audio sink */ - mpf_audio_stream_t *sink; - - /** Frame to read from audio source */ - mpf_frame_t frame; - /** Mixed frame to write to audio sink */ - mpf_frame_t mix_frame; -}; - -static apt_bool_t mpf_frames_mix(mpf_frame_t *mix_frame, const mpf_frame_t *frame) -{ - apr_size_t i; - apr_int16_t *mix_buf = mix_frame->codec_frame.buffer; - const apr_int16_t *buf = frame->codec_frame.buffer; - apr_size_t samples = frame->codec_frame.size / sizeof(apr_int16_t); - - if(mix_frame->codec_frame.size != frame->codec_frame.size) { - return FALSE; - } - - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO) { - for(i=0; itype |= MEDIA_FRAME_TYPE_AUDIO; - } - - return TRUE; -} - -static apt_bool_t mpf_mixer_process(mpf_object_t *object) -{ - apr_size_t i; - mpf_audio_stream_t *source; - mpf_mixer_t *mixer = (mpf_mixer_t*) object; - - mixer->mix_frame.type = MEDIA_FRAME_TYPE_NONE; - mixer->mix_frame.marker = MPF_MARKER_NONE; - memset(mixer->mix_frame.codec_frame.buffer,0,mixer->mix_frame.codec_frame.size); - for(i=0; isource_count; i++) { - source = mixer->source_arr[i]; - if(source) { - mixer->frame.type = MEDIA_FRAME_TYPE_NONE; - mixer->frame.marker = MPF_MARKER_NONE; - source->vtable->read_frame(source,&mixer->frame); - mpf_frames_mix(&mixer->mix_frame,&mixer->frame); - } - } - mixer->sink->vtable->write_frame(mixer->sink,&mixer->mix_frame); - return TRUE; -} - -static apt_bool_t mpf_mixer_destroy(mpf_object_t *object) -{ - apr_size_t i; - mpf_audio_stream_t *source; - mpf_mixer_t *mixer = (mpf_mixer_t*) object; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Mixer %s",object->name); - for(i=0; isource_count; i++) { - source = mixer->source_arr[i]; - if(source) { - mpf_audio_stream_rx_close(source); - } - } - mpf_audio_stream_tx_close(mixer->sink); - return TRUE; -} - -static void mpf_mixer_trace(mpf_object_t *object) -{ - mpf_mixer_t *mixer = (mpf_mixer_t*) object; - apr_size_t i; - mpf_audio_stream_t *source; - char buf[2048]; - apr_size_t offset; - - apt_text_stream_t output; - apt_text_stream_init(&output,buf,sizeof(buf)-1); - - for(i=0; isource_count; i++) { - source = mixer->source_arr[i]; - if(source) { - mpf_audio_stream_trace(source,STREAM_DIRECTION_RECEIVE,&output); - apt_text_char_insert(&output,';'); - } - } - - offset = output.pos - output.text.buf; - output.pos += apr_snprintf(output.pos, output.text.length - offset, - "->Mixer->"); - - mpf_audio_stream_trace(mixer->sink,STREAM_DIRECTION_SEND,&output); - - *output.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s", - object->name, - output.text.buf); -} - -MPF_DECLARE(mpf_object_t*) mpf_mixer_create( - mpf_audio_stream_t **source_arr, - apr_size_t source_count, - mpf_audio_stream_t *sink, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool) -{ - apr_size_t i; - apr_size_t frame_size; - mpf_codec_descriptor_t *descriptor; - mpf_audio_stream_t *source; - mpf_mixer_t *mixer; - if(!source_arr || !source_count || !sink) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Mixer %s",name); - mixer = apr_palloc(pool,sizeof(mpf_mixer_t)); - mixer->source_arr = NULL; - mixer->source_count = 0; - mixer->sink = NULL; - mpf_object_init(&mixer->base,name); - mixer->base.process = mpf_mixer_process; - mixer->base.destroy = mpf_mixer_destroy; - mixer->base.trace = mpf_mixer_trace; - - if(mpf_audio_stream_tx_validate(sink,NULL,NULL,pool) == FALSE) { - return NULL; - } - - descriptor = sink->tx_descriptor; - if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool); - if(codec) { - /* set encoder after mixer */ - mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool); - sink = encoder; - } - } - mixer->sink = sink; - mpf_audio_stream_tx_open(sink,NULL); - - for(i=0; irx_descriptor; - if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool); - if(codec) { - /* set decoder before mixer */ - mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool); - source = decoder; - } - } - source_arr[i] = source; - mpf_audio_stream_rx_open(source,NULL); - } - mixer->source_arr = source_arr; - mixer->source_count = source_count; - - descriptor = sink->tx_descriptor; - frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count); - mixer->frame.codec_frame.size = frame_size; - mixer->frame.codec_frame.buffer = apr_palloc(pool,frame_size); - mixer->mix_frame.codec_frame.size = frame_size; - mixer->mix_frame.codec_frame.buffer = apr_palloc(pool,frame_size); - return &mixer->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_multiplier.c b/libs/unimrcp/libs/mpf/src/mpf_multiplier.c deleted file mode 100644 index 153c6cda9b..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_multiplier.c +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_multiplier.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_multiplier.h" -#include "mpf_encoder.h" -#include "mpf_decoder.h" -#include "mpf_resampler.h" -#include "mpf_codec_manager.h" -#include "apt_log.h" - -typedef struct mpf_multiplier_t mpf_multiplier_t; - -/** MPF multiplier derived from MPF object */ -struct mpf_multiplier_t { - /** MPF multiplier base */ - mpf_object_t base; - /** Audio source */ - mpf_audio_stream_t *source; - /** Array of audio sinks */ - mpf_audio_stream_t **sink_arr; - /** Number of audio sinks */ - apr_size_t sink_count; - - /** Media frame used to read data from source and write it to sinks */ - mpf_frame_t frame; -}; - -static apt_bool_t mpf_multiplier_process(mpf_object_t *object) -{ - apr_size_t i; - mpf_audio_stream_t *sink; - mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object; - - multiplier->frame.type = MEDIA_FRAME_TYPE_NONE; - multiplier->frame.marker = MPF_MARKER_NONE; - multiplier->source->vtable->read_frame(multiplier->source,&multiplier->frame); - - if((multiplier->frame.type & MEDIA_FRAME_TYPE_AUDIO) == 0) { - memset( multiplier->frame.codec_frame.buffer, - 0, - multiplier->frame.codec_frame.size); - } - - for(i=0; isink_count; i++) { - sink = multiplier->sink_arr[i]; - if(sink) { - sink->vtable->write_frame(sink,&multiplier->frame); - } - } - return TRUE; -} - -static apt_bool_t mpf_multiplier_destroy(mpf_object_t *object) -{ - apr_size_t i; - mpf_audio_stream_t *sink; - mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Destroy Multiplier %s",object->name); - mpf_audio_stream_rx_close(multiplier->source); - for(i=0; isink_count; i++) { - sink = multiplier->sink_arr[i]; - if(sink) { - mpf_audio_stream_tx_close(sink); - } - } - return TRUE; -} - -static void mpf_multiplier_trace(mpf_object_t *object) -{ - mpf_multiplier_t *multiplier = (mpf_multiplier_t*) object; - apr_size_t i; - mpf_audio_stream_t *sink; - char buf[2048]; - apr_size_t offset; - - apt_text_stream_t output; - apt_text_stream_init(&output,buf,sizeof(buf)-1); - - mpf_audio_stream_trace(multiplier->source,STREAM_DIRECTION_RECEIVE,&output); - - offset = output.pos - output.text.buf; - output.pos += apr_snprintf(output.pos, output.text.length - offset, - "->Multiplier->"); - - for(i=0; isink_count; i++) { - sink = multiplier->sink_arr[i]; - if(sink) { - mpf_audio_stream_trace(sink,STREAM_DIRECTION_SEND,&output); - apt_text_char_insert(&output,';'); - } - } - - *output.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Path %s %s", - object->name, - output.text.buf); -} - -MPF_DECLARE(mpf_object_t*) mpf_multiplier_create( - mpf_audio_stream_t *source, - mpf_audio_stream_t **sink_arr, - apr_size_t sink_count, - const mpf_codec_manager_t *codec_manager, - const char *name, - apr_pool_t *pool) -{ - apr_size_t i; - apr_size_t frame_size; - mpf_codec_descriptor_t *descriptor; - mpf_audio_stream_t *sink; - mpf_multiplier_t *multiplier; - if(!source || !sink_arr || !sink_count) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Create Multiplier %s",name); - multiplier = apr_palloc(pool,sizeof(mpf_multiplier_t)); - multiplier->source = NULL; - multiplier->sink_arr = NULL; - multiplier->sink_count = 0; - mpf_object_init(&multiplier->base,name); - multiplier->base.process = mpf_multiplier_process; - multiplier->base.destroy = mpf_multiplier_destroy; - multiplier->base.trace = mpf_multiplier_trace; - - if(mpf_audio_stream_rx_validate(source,NULL,NULL,pool) == FALSE) { - return NULL; - } - - descriptor = source->rx_descriptor; - if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool); - if(codec) { - /* set decoder before bridge */ - mpf_audio_stream_t *decoder = mpf_decoder_create(source,codec,pool); - source = decoder; - } - } - multiplier->source = source; - mpf_audio_stream_rx_open(source,NULL); - - for(i=0; itx_descriptor; - if(descriptor && mpf_codec_lpcm_descriptor_match(descriptor) == FALSE) { - mpf_codec_t *codec = mpf_codec_manager_codec_get(codec_manager,descriptor,pool); - if(codec) { - /* set encoder after bridge */ - mpf_audio_stream_t *encoder = mpf_encoder_create(sink,codec,pool); - sink = encoder; - } - } - sink_arr[i] = sink; - mpf_audio_stream_tx_open(sink,NULL); - } - multiplier->sink_arr = sink_arr; - multiplier->sink_count = sink_count; - - descriptor = source->rx_descriptor; - frame_size = mpf_codec_linear_frame_size_calculate(descriptor->sampling_rate,descriptor->channel_count); - multiplier->frame.codec_frame.size = frame_size; - multiplier->frame.codec_frame.buffer = apr_palloc(pool,frame_size); - return &multiplier->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_named_event.c b/libs/unimrcp/libs/mpf/src/mpf_named_event.c deleted file mode 100644 index 22df9b07c2..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_named_event.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_named_event.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_named_event.h" - -#define TEL_EVENT_NAME "telephone-event" -#define TEL_EVENT_NAME_LENGTH (sizeof(TEL_EVENT_NAME)-1) - -#define TEL_EVENT_FMTP "0-15" -#define TEL_EVENT_FMTP_LENGTH (sizeof(TEL_EVENT_FMTP)-1) - - -MPF_DECLARE(mpf_codec_descriptor_t*) mpf_event_descriptor_create(apr_uint16_t sampling_rate, apr_pool_t *pool) -{ - mpf_codec_descriptor_t *descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t)); - mpf_codec_descriptor_init(descriptor); - descriptor->payload_type = 101; - descriptor->name.buf = TEL_EVENT_NAME; - descriptor->name.length = TEL_EVENT_NAME_LENGTH; - descriptor->sampling_rate = sampling_rate; - descriptor->channel_count = 1; - descriptor->format.buf = TEL_EVENT_FMTP; - descriptor->format.length = TEL_EVENT_FMTP_LENGTH; - return descriptor; -} - -MPF_DECLARE(apt_bool_t) mpf_event_descriptor_check(const mpf_codec_descriptor_t *descriptor) -{ - apt_str_t name; - name.buf = TEL_EVENT_NAME; - name.length = TEL_EVENT_NAME_LENGTH; - return apt_string_compare(&descriptor->name,&name); -} - -MPF_DECLARE(apr_uint32_t) mpf_dtmf_char_to_event_id(const char dtmf_char) -{ - if ((dtmf_char >= '0') && (dtmf_char <= '9')) - return dtmf_char - '0'; - else if (dtmf_char == '*') - return 10; - else if (dtmf_char == '#') - return 11; - else if ((dtmf_char >= 'A') && (dtmf_char <= 'D')) - return 12 + dtmf_char - 'A'; - - return 255; /* Invalid DTMF event */ -} - -MPF_DECLARE(char) mpf_event_id_to_dtmf_char(const apr_uint32_t event_id) -{ - if (event_id <= 9) - return '0' + (char)event_id; - else if (event_id == 10) - return '*'; - else if (event_id == 11) - return '#'; - else if (event_id <= 15) - return 'A' + (char)event_id - 12; - - return 0; /* Not a DTMF event */ -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_resampler.c b/libs/unimrcp/libs/mpf/src/mpf_resampler.c deleted file mode 100644 index bcd802245f..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_resampler.c +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_resampler.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_resampler.h" -#include "apt_log.h" - -MPF_DECLARE(mpf_audio_stream_t*) mpf_resampler_create(mpf_audio_stream_t *source, mpf_audio_stream_t *sink, apr_pool_t *pool) -{ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING, - "Currently resampling is not supported. " - "Try to configure and use the same sampling rate on both ends"); - return NULL; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c deleted file mode 100644 index f6f84174e2..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_rtp_attribs.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_attribs.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_string_table.h" -#include "mpf_rtp_attribs.h" - -/** String table of RTP attributes (mpf_rtp_attrib_e) */ -static const apt_str_table_item_t mpf_rtp_attrib_table[] = { - {{"rtpmap", 6},1}, - {{"sendonly", 8},8}, - {{"recvonly", 8},2}, - {{"sendrecv", 8},4}, - {{"mid", 3},0}, - {{"ptime", 5},0} -}; - - -MPF_DECLARE(const apt_str_t*) mpf_rtp_attrib_str_get(mpf_rtp_attrib_e attrib_id) -{ - return apt_string_table_str_get(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib_id); -} - -MPF_DECLARE(mpf_rtp_attrib_e) mpf_rtp_attrib_id_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib); -} - -MPF_DECLARE(const apt_str_t*) mpf_rtp_direction_str_get(mpf_stream_direction_e direction) -{ - mpf_rtp_attrib_e attrib_id = RTP_ATTRIB_UNKNOWN; - switch(direction) { - case STREAM_DIRECTION_SEND: - attrib_id = RTP_ATTRIB_SENDONLY; - break; - case STREAM_DIRECTION_RECEIVE: - attrib_id = RTP_ATTRIB_RECVONLY; - break; - case STREAM_DIRECTION_DUPLEX: - attrib_id = RTP_ATTRIB_SENDRECV; - break; - default: - break; - } - return apt_string_table_str_get(mpf_rtp_attrib_table,RTP_ATTRIB_COUNT,attrib_id); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c deleted file mode 100644 index 9f47521489..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_rtp_stream.c +++ /dev/null @@ -1,1507 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_net.h" -#include "apt_timer_queue.h" -#include "mpf_rtp_stream.h" -#include "mpf_termination.h" -#include "mpf_codec_manager.h" -#include "mpf_rtp_header.h" -#include "mpf_rtcp_packet.h" -#include "mpf_rtp_defs.h" -#include "mpf_rtp_pt.h" -#include "mpf_trace.h" -#include "apt_log.h" - -/** Max size of RTP packet */ -#define MAX_RTP_PACKET_SIZE 1500 -/** Max size of RTCP packet */ -#define MAX_RTCP_PACKET_SIZE 1500 - -/* Reason strings used in RTCP BYE messages (informative only) */ -#define RTCP_BYE_SESSION_ENDED "Session ended" -#define RTCP_BYE_TALKSPURT_ENDED "Talskpurt ended" - -#if ENABLE_RTP_PACKET_TRACE == 1 -#define RTP_TRACE printf -#elif ENABLE_RTP_PACKET_TRACE == 2 -#define RTP_TRACE mpf_debug_output_trace -#else -#define RTP_TRACE mpf_null_trace -#endif - -/** RTP stream */ -typedef struct mpf_rtp_stream_t mpf_rtp_stream_t; -struct mpf_rtp_stream_t { - mpf_audio_stream_t *base; - - mpf_rtp_media_descriptor_t *local_media; - mpf_rtp_media_descriptor_t *remote_media; - mpf_media_state_e state; - - rtp_transmitter_t transmitter; - rtp_receiver_t receiver; - - mpf_rtp_config_t *config; - mpf_rtp_settings_t *settings; - - apr_socket_t *rtp_socket; - apr_socket_t *rtcp_socket; - apr_sockaddr_t *rtp_l_sockaddr; - apr_sockaddr_t *rtp_r_sockaddr; - apr_sockaddr_t *rtcp_l_sockaddr; - apr_sockaddr_t *rtcp_r_sockaddr; - - apt_timer_t *rtcp_tx_timer; - apt_timer_t *rtcp_rx_timer; - - apr_pool_t *pool; -}; - -static apt_bool_t mpf_rtp_stream_destroy(mpf_audio_stream_t *stream); -static apt_bool_t mpf_rtp_rx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t mpf_rtp_rx_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t mpf_rtp_stream_receive(mpf_audio_stream_t *stream, mpf_frame_t *frame); -static apt_bool_t mpf_rtp_tx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t mpf_rtp_tx_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t mpf_rtp_stream_transmit(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t vtable = { - mpf_rtp_stream_destroy, - mpf_rtp_rx_stream_open, - mpf_rtp_rx_stream_close, - mpf_rtp_stream_receive, - mpf_rtp_tx_stream_open, - mpf_rtp_tx_stream_close, - mpf_rtp_stream_transmit, - NULL /* mpf_rtp_stream_trace */ -}; - -static apt_bool_t mpf_rtp_socket_pair_create(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media, apt_bool_t bind); -static apt_bool_t mpf_rtp_socket_pair_bind(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media); -static void mpf_rtp_socket_pair_close(mpf_rtp_stream_t *stream); - -static apt_bool_t mpf_rtcp_report_send(mpf_rtp_stream_t *stream); -static apt_bool_t mpf_rtcp_bye_send(mpf_rtp_stream_t *stream, apt_str_t *reason); -static void mpf_rtcp_tx_timer_proc(apt_timer_t *timer, void *obj); -static void mpf_rtcp_rx_timer_proc(apt_timer_t *timer, void *obj); - - -MPF_DECLARE(mpf_audio_stream_t*) mpf_rtp_stream_create(mpf_termination_t *termination, mpf_rtp_config_t *config, mpf_rtp_settings_t *settings, apr_pool_t *pool) -{ - mpf_rtp_stream_t *rtp_stream = apr_palloc(pool,sizeof(mpf_rtp_stream_t)); - mpf_stream_capabilities_t *capabilities = mpf_stream_capabilities_create(STREAM_DIRECTION_DUPLEX,pool); - mpf_audio_stream_t *audio_stream = mpf_audio_stream_create(rtp_stream,&vtable,capabilities,pool); - if(!audio_stream) { - return NULL; - } - - audio_stream->direction = STREAM_DIRECTION_NONE; - audio_stream->termination = termination; - - rtp_stream->base = audio_stream; - rtp_stream->pool = pool; - rtp_stream->config = config; - rtp_stream->settings = settings; - rtp_stream->local_media = NULL; - rtp_stream->remote_media = NULL; - rtp_stream->rtp_socket = NULL; - rtp_stream->rtcp_socket = NULL; - rtp_stream->rtp_l_sockaddr = NULL; - rtp_stream->rtp_r_sockaddr = NULL; - rtp_stream->rtcp_l_sockaddr = NULL; - rtp_stream->rtcp_r_sockaddr = NULL; - rtp_stream->rtcp_tx_timer = NULL; - rtp_stream->rtcp_rx_timer = NULL; - rtp_stream->state = MPF_MEDIA_DISABLED; - rtp_receiver_init(&rtp_stream->receiver); - rtp_transmitter_init(&rtp_stream->transmitter); - rtp_stream->transmitter.sr_stat.ssrc = (apr_uint32_t)apr_time_now(); - - if(settings->rtcp == TRUE) { - if(settings->rtcp_tx_interval) { - rtp_stream->rtcp_tx_timer = apt_timer_create( - termination->timer_queue, - mpf_rtcp_tx_timer_proc, - rtp_stream, pool); - } - if(settings->rtcp_rx_resolution) { - rtp_stream->rtcp_rx_timer = apt_timer_create( - termination->timer_queue, - mpf_rtcp_rx_timer_proc, - rtp_stream, pool); - } - } - - return audio_stream; -} - -static apt_bool_t mpf_rtp_stream_local_media_create(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *local_media, mpf_rtp_media_descriptor_t *remote_media, mpf_stream_capabilities_t *capabilities) -{ - apt_bool_t status = TRUE; - if(!local_media) { - /* local media is not specified, create the default one */ - local_media = apr_palloc(rtp_stream->pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(local_media); - local_media->state = MPF_MEDIA_ENABLED; - local_media->direction = STREAM_DIRECTION_DUPLEX; - } - if(remote_media) { - local_media->id = remote_media->id; - } - if(local_media->ip.length == 0) { - local_media->ip = rtp_stream->config->ip; - local_media->ext_ip = rtp_stream->config->ext_ip; - } - if(local_media->port == 0) { - if(mpf_rtp_socket_pair_create(rtp_stream,local_media,FALSE) == TRUE) { - /* RTP port management */ - mpf_rtp_config_t *rtp_config = rtp_stream->config; - apr_port_t first_port_in_search = rtp_config->rtp_port_cur; - apt_bool_t is_port_ok = FALSE; - do { - local_media->port = rtp_config->rtp_port_cur; - rtp_config->rtp_port_cur += 2; - if(rtp_config->rtp_port_cur == rtp_config->rtp_port_max) { - rtp_config->rtp_port_cur = rtp_config->rtp_port_min; - } - - if(mpf_rtp_socket_pair_bind(rtp_stream,local_media) == TRUE) { - is_port_ok = TRUE; - break; - } - } while(first_port_in_search != rtp_config->rtp_port_cur); - - if(is_port_ok == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Free RTP Port %s:[%hu,%hu]", - rtp_config->ip.buf, - rtp_config->rtp_port_min, - rtp_config->rtp_port_max); - mpf_rtp_socket_pair_close(rtp_stream); - status = FALSE; - } - } - else { - status = FALSE; - } - } - else if(mpf_rtp_socket_pair_create(rtp_stream,local_media,TRUE) == FALSE) { - status = FALSE; - } - - if(status == FALSE) { - local_media->state = MPF_MEDIA_DISABLED; - } - - if(rtp_stream->settings->ptime) { - local_media->ptime = rtp_stream->settings->ptime; - } - - if(mpf_codec_list_is_empty(&local_media->codec_list) == TRUE) { - if(mpf_codec_list_is_empty(&rtp_stream->settings->codec_list) == TRUE) { - mpf_codec_manager_codec_list_get( - rtp_stream->base->termination->codec_manager, - &local_media->codec_list, - rtp_stream->pool); - } - else { - mpf_codec_list_copy(&local_media->codec_list, - &rtp_stream->settings->codec_list, - rtp_stream->pool); - } - } - - if(capabilities) { - if(mpf_codec_list_match(&local_media->codec_list,&capabilities->codecs) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Match Codec List %s:%hu", - local_media->ip.buf, - local_media->port); - local_media->state = MPF_MEDIA_DISABLED; - status = FALSE; - } - } - - rtp_stream->local_media = local_media; - return status; -} - -static apt_bool_t mpf_rtp_stream_local_media_update(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *media, mpf_stream_capabilities_t *capabilities) -{ - apt_bool_t status = TRUE; - if(apt_string_compare(&rtp_stream->local_media->ip,&media->ip) == FALSE || - rtp_stream->local_media->port != media->port) { - - mpf_rtp_socket_pair_close(rtp_stream); - - if(mpf_rtp_socket_pair_create(rtp_stream,media,TRUE) == FALSE) { - media->state = MPF_MEDIA_DISABLED; - status = FALSE; - } - } - if(mpf_codec_list_is_empty(&media->codec_list) == TRUE) { - mpf_codec_manager_codec_list_get( - rtp_stream->base->termination->codec_manager, - &media->codec_list, - rtp_stream->pool); - } - - if(capabilities) { - if(mpf_codec_list_match(&media->codec_list,&capabilities->codecs) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Match Codec List %s:%hu", - media->ip.buf, - media->port); - media->state = MPF_MEDIA_DISABLED; - status = FALSE; - } - } - - rtp_stream->local_media = media; - return status; -} - -static apt_bool_t mpf_rtp_stream_remote_media_update(mpf_rtp_stream_t *rtp_stream, mpf_rtp_media_descriptor_t *media) -{ - apt_bool_t status = TRUE; - if(media->state == MPF_MEDIA_ENABLED) { - if(!rtp_stream->remote_media || - apt_string_compare(&rtp_stream->remote_media->ip,&media->ip) == FALSE || - rtp_stream->remote_media->port != media->port) { - - /* update RTP port */ - rtp_stream->rtp_r_sockaddr = NULL; - apr_sockaddr_info_get( - &rtp_stream->rtp_r_sockaddr, - media->ip.buf, - APR_INET, - media->port, - 0, - rtp_stream->pool); - if(!rtp_stream->rtp_r_sockaddr) { - status = FALSE; - } - - /* update RTCP port */ - rtp_stream->rtcp_r_sockaddr = NULL; - apr_sockaddr_info_get( - &rtp_stream->rtcp_r_sockaddr, - media->ip.buf, - APR_INET, - media->port+1, - 0, - rtp_stream->pool); - } - } - - rtp_stream->remote_media = media; - return status; -} - -static apt_bool_t mpf_rtp_stream_media_negotiate(mpf_rtp_stream_t *rtp_stream) -{ - mpf_rtp_media_descriptor_t *local_media = rtp_stream->local_media; - mpf_rtp_media_descriptor_t *remote_media = rtp_stream->remote_media; - if(!local_media || !remote_media) { - return FALSE; - } - - local_media->id = remote_media->id; - local_media->mid = remote_media->mid; - local_media->ptime = remote_media->ptime; - - if(rtp_stream->state == MPF_MEDIA_DISABLED && remote_media->state == MPF_MEDIA_ENABLED) { - /* enable RTP/RTCP session */ - rtp_stream->state = MPF_MEDIA_ENABLED; - if(rtp_stream->rtp_l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Enable RTP Session %s:%hu", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port); - } - - if(rtp_stream->rtcp_tx_timer) { - apt_timer_set(rtp_stream->rtcp_tx_timer,rtp_stream->settings->rtcp_tx_interval); - } - if(rtp_stream->rtcp_rx_timer) { - apt_timer_set(rtp_stream->rtcp_rx_timer,rtp_stream->settings->rtcp_rx_resolution); - } - } - else if(rtp_stream->state == MPF_MEDIA_ENABLED && remote_media->state == MPF_MEDIA_DISABLED) { - /* disable RTP/RTCP session */ - rtp_stream->state = MPF_MEDIA_DISABLED; - if(rtp_stream->rtp_l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Disable RTP Session %s:%hu", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port); - } - - if(rtp_stream->rtcp_tx_timer) { - apt_timer_kill(rtp_stream->rtcp_tx_timer); - } - if(rtp_stream->rtcp_rx_timer) { - apt_timer_kill(rtp_stream->rtcp_rx_timer); - } - if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy != RTCP_BYE_DISABLE) { - apt_str_t reason = {RTCP_BYE_SESSION_ENDED, sizeof(RTCP_BYE_SESSION_ENDED)-1}; - mpf_rtcp_bye_send(rtp_stream,&reason); - } - } - - local_media->state = remote_media->state; - local_media->direction = mpf_stream_reverse_direction_get(remote_media->direction); - - if(remote_media->state == MPF_MEDIA_ENABLED) { - mpf_codec_list_t *codec_list1 = NULL; - mpf_codec_list_t *codec_list2 = NULL; - - /* intersect local and remote codecs */ - if(rtp_stream->settings->own_preferrence == TRUE) { - codec_list1 = &local_media->codec_list; - codec_list2 = &remote_media->codec_list; - } - else { - codec_list2 = &local_media->codec_list; - codec_list1 = &remote_media->codec_list; - } - - if(mpf_codec_lists_intersect(codec_list1,codec_list2) == FALSE) { - /* reject RTP/RTCP session */ - rtp_stream->state = MPF_MEDIA_DISABLED; - local_media->direction = STREAM_DIRECTION_NONE; - local_media->state = MPF_MEDIA_DISABLED; - if(rtp_stream->rtp_l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Reject RTP Session %s:%hu no codecs matched", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port); - } - - if(rtp_stream->rtcp_tx_timer) { - apt_timer_kill(rtp_stream->rtcp_tx_timer); - } - if(rtp_stream->rtcp_rx_timer) { - apt_timer_kill(rtp_stream->rtcp_rx_timer); - } - } - } - - rtp_stream->base->direction = local_media->direction; - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_add(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_remove(mpf_audio_stream_t *stream) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - - if(rtp_stream->state == MPF_MEDIA_ENABLED) { - /* disable RTP/RTCP session */ - rtp_stream->state = MPF_MEDIA_DISABLED; - if(rtp_stream->rtp_l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTP Session %s:%hu", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port); - } - - if(rtp_stream->rtcp_tx_timer) { - apt_timer_kill(rtp_stream->rtcp_tx_timer); - } - if(rtp_stream->rtcp_rx_timer) { - apt_timer_kill(rtp_stream->rtcp_rx_timer); - } - if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy != RTCP_BYE_DISABLE) { - apt_str_t reason = {RTCP_BYE_SESSION_ENDED, sizeof(RTCP_BYE_SESSION_ENDED)-1}; - mpf_rtcp_bye_send(rtp_stream,&reason); - } - } - - mpf_rtp_socket_pair_close(rtp_stream); - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_rtp_stream_modify(mpf_audio_stream_t *stream, mpf_rtp_stream_descriptor_t *descriptor) -{ - apt_bool_t status = TRUE; - mpf_rtp_stream_t *rtp_stream = stream->obj; - if(!rtp_stream) { - return FALSE; - } - - if(!rtp_stream->local_media) { - /* create local media */ - status = mpf_rtp_stream_local_media_create(rtp_stream,descriptor->local,descriptor->remote,descriptor->capabilities); - } - else if(descriptor->local) { - /* update local media */ - status = mpf_rtp_stream_local_media_update(rtp_stream,descriptor->local,descriptor->capabilities); - } - - if(descriptor->remote && status == TRUE) { - /* update remote media */ - mpf_rtp_stream_remote_media_update(rtp_stream,descriptor->remote); - - /* negotiate local and remote media */ - mpf_rtp_stream_media_negotiate(rtp_stream); - } - - if((rtp_stream->base->direction & STREAM_DIRECTION_SEND) == STREAM_DIRECTION_SEND) { - mpf_codec_list_t *codec_list = &rtp_stream->remote_media->codec_list; - rtp_stream->base->tx_descriptor = codec_list->primary_descriptor; - if(rtp_stream->base->tx_descriptor) { - rtp_stream->transmitter.samples_per_frame = - (apr_uint32_t)mpf_codec_frame_samples_calculate(rtp_stream->base->tx_descriptor); - } - if(codec_list->event_descriptor) { - rtp_stream->base->tx_event_descriptor = codec_list->event_descriptor; - } - } - if((rtp_stream->base->direction & STREAM_DIRECTION_RECEIVE) == STREAM_DIRECTION_RECEIVE) { - mpf_codec_list_t *codec_list = &rtp_stream->local_media->codec_list; - rtp_stream->base->rx_descriptor = codec_list->primary_descriptor; - if(codec_list->event_descriptor) { - rtp_stream->base->rx_event_descriptor = codec_list->event_descriptor; - } - } - - if(!descriptor->local) { - descriptor->local = rtp_stream->local_media; - } - return status; -} - -static apt_bool_t mpf_rtp_stream_destroy(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -static apt_bool_t mpf_rtp_rx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_receiver_t *receiver = &rtp_stream->receiver; - mpf_jb_config_t *jb_config = &rtp_stream->settings->jb_config; - if(!rtp_stream->rtp_socket || !rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) { - return FALSE; - } - - receiver->jb = mpf_jitter_buffer_create( - jb_config, - stream->rx_descriptor, - codec, - rtp_stream->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO, - "Open RTP Receiver %s:%hu <- %s:%hu playout [%u ms] bounds [%u - %u ms] adaptive [%d] skew detection [%d]", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port, - rtp_stream->rtp_r_sockaddr->hostname, - rtp_stream->rtp_r_sockaddr->port, - jb_config->initial_playout_delay, - jb_config->min_playout_delay, - jb_config->max_playout_delay, - jb_config->adaptive, - jb_config->time_skew_detection); - return TRUE; -} - -static apt_bool_t mpf_rtp_rx_stream_close(mpf_audio_stream_t *stream) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_receiver_t *receiver = &rtp_stream->receiver; - - if(!rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) { - return FALSE; - } - - receiver->stat.lost_packets = 0; - if(receiver->stat.received_packets) { - apr_uint32_t expected_packets = receiver->history.seq_cycles + - receiver->history.seq_num_max - receiver->history.seq_num_base + 1; - if(expected_packets > receiver->stat.received_packets) { - receiver->stat.lost_packets = expected_packets - receiver->stat.received_packets; - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTP Receiver %s:%hu <- %s:%hu [r:%u l:%u j:%u p:%u d:%u i:%u]", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port, - rtp_stream->rtp_r_sockaddr->hostname, - rtp_stream->rtp_r_sockaddr->port, - receiver->stat.received_packets, - receiver->stat.lost_packets, - receiver->rr_stat.jitter, - mpf_jitter_buffer_playout_delay_get(receiver->jb), - receiver->stat.discarded_packets, - receiver->stat.ignored_packets); - mpf_jitter_buffer_destroy(receiver->jb); - return TRUE; -} - - -static APR_INLINE void rtp_rx_overall_stat_reset(rtp_receiver_t *receiver) -{ - memset(&receiver->stat,0,sizeof(receiver->stat)); - memset(&receiver->history,0,sizeof(receiver->history)); - memset(&receiver->periodic_history,0,sizeof(receiver->periodic_history)); -} - -static APR_INLINE void rtp_rx_stat_init(rtp_receiver_t *receiver, rtp_header_t *header, apr_time_t *time) -{ - receiver->rr_stat.ssrc = header->ssrc; - receiver->history.seq_num_base = receiver->history.seq_num_max = (apr_uint16_t)header->sequence; - receiver->history.ts_last = header->timestamp; - receiver->history.time_last = *time; -} - -static APR_INLINE void rtp_rx_restart(rtp_receiver_t *receiver) -{ - apr_byte_t restarts = ++receiver->stat.restarts; - rtp_rx_overall_stat_reset(receiver); - mpf_jitter_buffer_restart(receiver->jb); - receiver->stat.restarts = restarts; -} - -static rtp_header_t* rtp_rx_header_skip(void **buffer, apr_size_t *size) -{ - apr_size_t offset = 0; - rtp_header_t *header = (rtp_header_t*)*buffer; - - /* RTP header validity check */ - if(header->version != RTP_VERSION) { - return NULL; - } - - /* calculate payload offset */ - offset = sizeof(rtp_header_t) + (header->count * sizeof(apr_uint32_t)); - - /* additional offset in case of RTP extension */ - if(header->extension) { - rtp_extension_header_t *ext_header = (rtp_extension_header_t*)(((apr_byte_t*)*buffer)+offset); - offset += (ntohs(ext_header->length) * sizeof(apr_uint32_t)); - } - - if (offset >= *size) { - return NULL; - } - - /* skip to payload */ - *buffer = (apr_byte_t*)*buffer + offset; - *size = *size - offset; - - return header; -} - -static APR_INLINE void rtp_periodic_history_update(rtp_receiver_t *receiver) -{ - apr_uint32_t expected_packets; - apr_uint32_t expected_interval; - apr_uint32_t received_interval; - apr_uint32_t lost_interval; - - /* calculate expected packets */ - if(receiver->stat.received_packets) { - expected_packets = receiver->history.seq_cycles + - receiver->history.seq_num_max - receiver->history.seq_num_base + 1; - } - else { - expected_packets = 0; - } - - /* calculate expected interval */ - expected_interval = expected_packets - receiver->periodic_history.expected_prior; - /* update expected prior */ - receiver->periodic_history.expected_prior = expected_packets; - - /* calculate received interval */ - received_interval = receiver->stat.received_packets - receiver->periodic_history.received_prior; - /* update received prior */ - receiver->periodic_history.received_prior = receiver->stat.received_packets; - /* calculate lost interval */ - if(expected_interval > received_interval) { - lost_interval = expected_interval - received_interval; - } - else { - lost_interval = 0; - } - - /* update lost fraction */ - if(expected_interval == 0 || lost_interval == 0) { - receiver->rr_stat.fraction = 0; - } - else { - receiver->rr_stat.fraction = (lost_interval << 8) / expected_interval; - } - - if(expected_packets > receiver->stat.received_packets) { - receiver->rr_stat.lost = expected_packets - receiver->stat.received_packets; - } - else { - receiver->rr_stat.lost = 0; - } - - receiver->periodic_history.discarded_prior = receiver->stat.discarded_packets; - receiver->periodic_history.jitter_min = receiver->rr_stat.jitter; - receiver->periodic_history.jitter_max = receiver->rr_stat.jitter; -} - -typedef enum { - RTP_SSRC_UPDATE, - RTP_SSRC_PROBATION, - RTP_SSRC_RESTART -} rtp_ssrc_result_e; - -static APR_INLINE rtp_ssrc_result_e rtp_rx_ssrc_update(rtp_receiver_t *receiver, apr_uint32_t ssrc) -{ - if(receiver->rr_stat.ssrc == ssrc) { - /* known ssrc */ - if(receiver->history.ssrc_probation) { - /* reset the probation for new ssrc */ - receiver->history.ssrc_probation = 0; - receiver->history.ssrc_new = 0; - } - } - else { - if(receiver->history.ssrc_new == ssrc) { - if(--receiver->history.ssrc_probation == 0) { - /* restart with new ssrc */ - receiver->rr_stat.ssrc = ssrc; - return RTP_SSRC_RESTART; - } - else { - return RTP_SSRC_PROBATION; - } - } - else { - /* start probation for new ssrc */ - receiver->history.ssrc_new = ssrc; - receiver->history.ssrc_probation = 5; - return RTP_SSRC_PROBATION; - } - } - return RTP_SSRC_UPDATE; -} - -typedef enum { - RTP_SEQ_UPDATE, - RTP_SEQ_MISORDER, - RTP_SEQ_DRIFT -} rtp_seq_result_e; - -static APR_INLINE rtp_seq_result_e rtp_rx_seq_update(rtp_receiver_t *receiver, apr_uint16_t seq_num) -{ - rtp_seq_result_e result = RTP_SEQ_UPDATE; - apr_uint16_t seq_delta = seq_num - receiver->history.seq_num_max; - if(seq_delta < MAX_DROPOUT) { - if(seq_num < receiver->history.seq_num_max) { - /* sequence number wrapped */ - receiver->history.seq_cycles += RTP_SEQ_MOD; - } - receiver->history.seq_num_max = seq_num; - } - else if(seq_delta <= RTP_SEQ_MOD - MAX_MISORDER) { - /* sequence number made a very large jump */ - result = RTP_SEQ_DRIFT; - } - else { - /* duplicate or misordered packet */ - result = RTP_SEQ_MISORDER; - } - receiver->stat.received_packets++; - - return result; -} - -typedef enum { - RTP_TS_UPDATE, - RTP_TS_DRIFT -} rtp_ts_result_e; - -static APR_INLINE rtp_ts_result_e rtp_rx_ts_update(rtp_receiver_t *receiver, mpf_codec_descriptor_t *descriptor, apr_time_t *time, apr_uint32_t ts, apr_byte_t *marker) -{ - apr_int32_t deviation; - apr_int32_t time_diff; - - /* arrival time diff in msec */ - time_diff = (apr_int32_t)apr_time_as_msec(*time - receiver->history.time_last); - - /* if the time difference is more than the threshold (INTER_TALKSPURT_GAP), - and the marker is not set, then this might be a beginning of a - new malformed talkspurt */ - if(!*marker && time_diff > INTER_TALKSPURT_GAP) { - /* set the missing marker */ - *marker = 1; - } - - /* arrival time diff in samples */ - deviation = time_diff * descriptor->channel_count * descriptor->sampling_rate / 1000; - /* arrival timestamp diff */ - deviation -= ts - receiver->history.ts_last; - - if(deviation < 0) { - deviation = -deviation; - } - - if(deviation > DEVIATION_THRESHOLD) { - return RTP_TS_DRIFT; - } - - receiver->rr_stat.jitter += deviation - ((receiver->rr_stat.jitter + 8) >> 4); - RTP_TRACE("jitter=%u deviation=%d\n",receiver->rr_stat.jitter,deviation); - receiver->history.time_last = *time; - receiver->history.ts_last = ts; - - if(receiver->rr_stat.jitter < receiver->periodic_history.jitter_min) { - receiver->periodic_history.jitter_min = receiver->rr_stat.jitter; - } - if(receiver->rr_stat.jitter > receiver->periodic_history.jitter_max) { - receiver->periodic_history.jitter_max = receiver->rr_stat.jitter; - } - return RTP_TS_UPDATE; -} - -static APR_INLINE void rtp_rx_failure_threshold_check(rtp_receiver_t *receiver) -{ - apr_uint32_t received; - apr_uint32_t discarded; - received = receiver->stat.received_packets - receiver->periodic_history.received_prior; - discarded = receiver->stat.discarded_packets - receiver->periodic_history.discarded_prior; - - if(discarded * 100 > received * DISCARDED_TO_RECEIVED_RATIO_THRESHOLD) { - /* failure threshold reached -> restart */ - rtp_rx_restart(receiver); - } -} - -static apt_bool_t rtp_rx_packet_receive(mpf_rtp_stream_t *rtp_stream, void *buffer, apr_size_t size) -{ - rtp_receiver_t *receiver = &rtp_stream->receiver; - mpf_codec_descriptor_t *descriptor = rtp_stream->base->rx_descriptor; - apr_time_t time; - rtp_ssrc_result_e ssrc_result; - rtp_header_t *header = rtp_rx_header_skip(&buffer,&size); - if(!header) { - /* invalid RTP packet */ - receiver->stat.invalid_packets++; - return FALSE; - } - - header->sequence = ntohs((apr_uint16_t)header->sequence); - header->timestamp = ntohl(header->timestamp); - header->ssrc = ntohl(header->ssrc); - - time = apr_time_now(); - - RTP_TRACE("RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%5u size=%"APR_SIZE_T_FMT"\n", - (apr_uint32_t)apr_time_usec(time), - header->ssrc, header->type, (header->marker == 1) ? '*' : ' ', - header->timestamp, header->sequence, size); - if(!receiver->stat.received_packets) { - /* initialization */ - rtp_rx_stat_init(receiver,header,&time); - } - - ssrc_result = rtp_rx_ssrc_update(receiver,header->ssrc); - if(ssrc_result == RTP_SSRC_PROBATION) { - receiver->stat.invalid_packets++; - return FALSE; - } - else if(ssrc_result == RTP_SSRC_RESTART) { - rtp_rx_restart(receiver); - rtp_rx_stat_init(receiver,header,&time); - } - - rtp_rx_seq_update(receiver,(apr_uint16_t)header->sequence); - - if(header->type == descriptor->payload_type) { - /* codec */ - apr_byte_t marker = (apr_byte_t)header->marker; - if(rtp_rx_ts_update(receiver,descriptor,&time,header->timestamp,&marker) == RTP_TS_DRIFT) { - rtp_rx_restart(receiver); - return FALSE; - } - - if(mpf_jitter_buffer_write(receiver->jb,buffer,size,header->timestamp,marker) != JB_OK) { - receiver->stat.discarded_packets++; - rtp_rx_failure_threshold_check(receiver); - } - } - else if(rtp_stream->base->rx_event_descriptor && - header->type == rtp_stream->base->rx_event_descriptor->payload_type) { - /* named event */ - mpf_named_event_frame_t *named_event = (mpf_named_event_frame_t *)buffer; - named_event->duration = ntohs((apr_uint16_t)named_event->duration); - if(mpf_jitter_buffer_event_write(receiver->jb,named_event,header->timestamp,(apr_byte_t)header->marker) != JB_OK) { - receiver->stat.discarded_packets++; - } - } - else if(header->type == RTP_PT_CN) { - /* CN packet */ - receiver->stat.ignored_packets++; - } - else { - /* invalid payload type */ - receiver->stat.ignored_packets++; - } - - return TRUE; -} - -static apt_bool_t rtp_rx_process(mpf_rtp_stream_t *rtp_stream) -{ - char buffer[MAX_RTP_PACKET_SIZE]; - apr_size_t size = sizeof(buffer); - apr_size_t max_count = 5; - while(max_count && apr_socket_recv(rtp_stream->rtp_socket,buffer,&size) == APR_SUCCESS) { - rtp_rx_packet_receive(rtp_stream,buffer,size); - - size = sizeof(buffer); - max_count--; - } - return TRUE; -} - -static apt_bool_t mpf_rtp_stream_receive(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_rx_process(rtp_stream); - - return mpf_jitter_buffer_read(rtp_stream->receiver.jb,frame); -} - - -static apt_bool_t mpf_rtp_tx_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - apr_size_t frame_size; - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_transmitter_t *transmitter = &rtp_stream->transmitter; - - if(!rtp_stream->rtp_socket || !rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) { - return FALSE; - } - - if(!codec) { - return FALSE; - } - - if(!transmitter->ptime) { - if(rtp_stream->settings && rtp_stream->settings->ptime) { - transmitter->ptime = rtp_stream->settings->ptime; - } - else { - transmitter->ptime = 20; - } - } - transmitter->packet_frames = transmitter->ptime / CODEC_FRAME_TIME_BASE; - transmitter->current_frames = 0; - - frame_size = mpf_codec_frame_size_calculate( - stream->tx_descriptor, - codec->attribs); - transmitter->packet_data = apr_palloc( - rtp_stream->pool, - sizeof(rtp_header_t) + transmitter->packet_frames * frame_size); - - transmitter->inactivity = 1; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open RTP Transmitter %s:%hu -> %s:%hu", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port, - rtp_stream->rtp_r_sockaddr->hostname, - rtp_stream->rtp_r_sockaddr->port); - return TRUE; -} - -static apt_bool_t mpf_rtp_tx_stream_close(mpf_audio_stream_t *stream) -{ - mpf_rtp_stream_t *rtp_stream = stream->obj; - if(!rtp_stream->rtp_l_sockaddr || !rtp_stream->rtp_r_sockaddr) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTP Transmitter %s:%hu -> %s:%hu [s:%u o:%u]", - rtp_stream->rtp_l_sockaddr->hostname, - rtp_stream->rtp_l_sockaddr->port, - rtp_stream->rtp_r_sockaddr->hostname, - rtp_stream->rtp_r_sockaddr->port, - rtp_stream->transmitter.sr_stat.sent_packets, - rtp_stream->transmitter.sr_stat.sent_octets); - return TRUE; -} - - -static APR_INLINE void rtp_header_prepare( - rtp_transmitter_t *transmitter, - rtp_header_t *header, - apr_byte_t payload_type, - apr_byte_t marker, - apr_uint32_t timestamp) -{ - header->version = RTP_VERSION; - header->padding = 0; - header->extension = 0; - header->count = 0; - header->marker = marker; - header->type = payload_type; - header->timestamp = timestamp; - header->ssrc = htonl(transmitter->sr_stat.ssrc); -} - -static APR_INLINE apt_bool_t mpf_rtp_data_send(mpf_rtp_stream_t *rtp_stream, rtp_transmitter_t *transmitter, const mpf_frame_t *frame) -{ - apt_bool_t status = TRUE; - memcpy( - transmitter->packet_data + transmitter->packet_size, - frame->codec_frame.buffer, - frame->codec_frame.size); - transmitter->packet_size += frame->codec_frame.size; - - if(++transmitter->current_frames == transmitter->packet_frames) { - rtp_header_t *header = (rtp_header_t*)transmitter->packet_data; - header->sequence = htons(++transmitter->last_seq_num); - RTP_TRACE("> RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%5hu\n", - (apr_uint32_t)apr_time_usec(apr_time_now()), - transmitter->sr_stat.ssrc, header->type, - (header->marker == 1) ? '*' : ' ', - header->timestamp, transmitter->last_seq_num); - header->timestamp = htonl(header->timestamp); - if(apr_socket_sendto( - rtp_stream->rtp_socket, - rtp_stream->rtp_r_sockaddr, - 0, - transmitter->packet_data, - &transmitter->packet_size) == APR_SUCCESS) { - transmitter->sr_stat.sent_packets++; - transmitter->sr_stat.sent_octets += (apr_uint32_t)transmitter->packet_size - sizeof(rtp_header_t); - } - else { - status = FALSE; - } - transmitter->current_frames = 0; - } - return status; -} - -static APR_INLINE apt_bool_t mpf_rtp_event_send(mpf_rtp_stream_t *rtp_stream, rtp_transmitter_t *transmitter, const mpf_frame_t *frame) -{ - char packet_data[20]; - apr_size_t packet_size = sizeof(rtp_header_t) + sizeof(mpf_named_event_frame_t); - rtp_header_t *header = (rtp_header_t*) packet_data; - mpf_named_event_frame_t *named_event = (mpf_named_event_frame_t*)(header+1); - rtp_header_prepare( - transmitter, - header, - rtp_stream->base->tx_event_descriptor->payload_type, - (frame->marker == MPF_MARKER_START_OF_EVENT) ? 1 : 0, - transmitter->timestamp_base); - - *named_event = frame->event_frame; - named_event->edge = (frame->marker == MPF_MARKER_END_OF_EVENT) ? 1 : 0; - - header->sequence = htons(++transmitter->last_seq_num); - RTP_TRACE("> RTP time=%6u ssrc=%8x pt=%3u %cts=%9u seq=%hu event=%2u dur=%3u %c\n", - (apr_uint32_t)apr_time_usec(apr_time_now()), - transmitter->sr_stat.ssrc, - header->type, (header->marker == 1) ? '*' : ' ', - header->timestamp, transmitter->last_seq_num, - named_event->event_id, named_event->duration, - (named_event->edge == 1) ? '*' : ' '); - header->timestamp = htonl(header->timestamp); - named_event->duration = htons((apr_uint16_t)named_event->duration); - if(apr_socket_sendto( - rtp_stream->rtp_socket, - rtp_stream->rtp_r_sockaddr, - 0, - packet_data, - &packet_size) != APR_SUCCESS) { - return FALSE; - } - transmitter->sr_stat.sent_packets++; - transmitter->sr_stat.sent_octets += sizeof(mpf_named_event_frame_t); - return TRUE; -} - -static apt_bool_t mpf_rtp_stream_transmit(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - apt_bool_t status = TRUE; - mpf_rtp_stream_t *rtp_stream = stream->obj; - rtp_transmitter_t *transmitter = &rtp_stream->transmitter; - - transmitter->timestamp += transmitter->samples_per_frame; - - if(frame->type == MEDIA_FRAME_TYPE_NONE) { - if(!transmitter->inactivity) { - if(transmitter->current_frames == 0) { - /* set inactivity (ptime alligned) */ - transmitter->inactivity = 1; - if(rtp_stream->settings->rtcp == TRUE && rtp_stream->settings->rtcp_bye_policy == RTCP_BYE_PER_TALKSPURT) { - apt_str_t reason = {RTCP_BYE_TALKSPURT_ENDED, sizeof(RTCP_BYE_TALKSPURT_ENDED)-1}; - mpf_rtcp_bye_send(rtp_stream,&reason); - } - } - else { - /* ptime allignment */ - status = mpf_rtp_data_send(rtp_stream,transmitter,frame); - } - } - return status; - } - - if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT){ - /* transmit event as soon as received */ - if(stream->tx_event_descriptor) { - if(frame->marker == MPF_MARKER_START_OF_EVENT) { - /* store start time (base) of the event */ - transmitter->timestamp_base = transmitter->timestamp; - } - else if(frame->marker == MPF_MARKER_NEW_SEGMENT) { - /* update base in case of long-lasting events */ - transmitter->timestamp_base = transmitter->timestamp; - } - - status = mpf_rtp_event_send(rtp_stream,transmitter,frame); - } - } - - if((frame->type & MEDIA_FRAME_TYPE_AUDIO) == MEDIA_FRAME_TYPE_AUDIO){ - if(transmitter->current_frames == 0) { - rtp_header_t *header = (rtp_header_t*)transmitter->packet_data; - rtp_header_prepare( - transmitter, - header, - stream->tx_descriptor->payload_type, - transmitter->inactivity, - transmitter->timestamp); - transmitter->packet_size = sizeof(rtp_header_t); - if(transmitter->inactivity) { - transmitter->inactivity = 0; - } - } - status = mpf_rtp_data_send(rtp_stream,transmitter,frame); - } - - return status; -} - -static apt_bool_t mpf_socket_create(apr_pool_t *pool, apr_socket_t **socket) -{ - if(!socket) - return FALSE; - - if(apr_socket_create(socket,APR_INET,SOCK_DGRAM,0,pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Socket"); - *socket = NULL; - return FALSE; - } - - apr_socket_opt_set(*socket,APR_SO_NONBLOCK,1); - apr_socket_timeout_set(*socket,0); - return TRUE; -} - -static apt_bool_t mpf_socket_bind(apr_socket_t *socket, const char *ip, apr_port_t port, apr_pool_t *pool, apr_sockaddr_t **l_sockaddr) -{ - if(!socket || !l_sockaddr) - return FALSE; - - *l_sockaddr = NULL; - apr_sockaddr_info_get( - l_sockaddr, - ip, - APR_INET, - port, - 0, - pool); - if(!*l_sockaddr) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Sockaddr %s:%hu",ip,port); - return FALSE; - } - - if(apr_socket_bind(socket,*l_sockaddr) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Failed to Bind Socket to %s:%hu", ip,port); - return FALSE; - } - return TRUE; -} - -/* Create RTP/RTCP sockets */ -static apt_bool_t mpf_rtp_socket_pair_create(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media, apt_bool_t bind) -{ - /* Create and optionally bind RTP socket. Return FALSE in case of an error. */ - if(mpf_socket_create(stream->pool,&stream->rtp_socket) == FALSE) { - return FALSE; - } - if(bind == TRUE) { - if(mpf_socket_bind(stream->rtp_socket,local_media->ip.buf,local_media->port,stream->pool,&stream->rtp_l_sockaddr) == FALSE) { - apr_socket_close(stream->rtp_socket); - stream->rtp_socket = NULL; - return FALSE; - } - } - - /* Create and optionally bind RCTP socket. Continue in either way. */ - if(mpf_socket_create(stream->pool,&stream->rtcp_socket) == TRUE && bind == TRUE) { - if(mpf_socket_bind(stream->rtcp_socket,local_media->ip.buf,local_media->port+1,stream->pool,&stream->rtcp_l_sockaddr) == FALSE) { - apr_socket_close(stream->rtcp_socket); - stream->rtcp_socket = NULL; - } - } - return TRUE; -} - -/* Bind RTP/RTCP sockets */ -static apt_bool_t mpf_rtp_socket_pair_bind(mpf_rtp_stream_t *stream, mpf_rtp_media_descriptor_t *local_media) -{ - /* Bind RTP socket. Return FALSE in case of an error. */ - if(mpf_socket_bind(stream->rtp_socket,local_media->ip.buf,local_media->port,stream->pool,&stream->rtp_l_sockaddr) == FALSE) { - return FALSE; - } - - /* Try to bind RTCP socket. Continue in either way. */ - mpf_socket_bind(stream->rtcp_socket,local_media->ip.buf,local_media->port+1,stream->pool,&stream->rtcp_l_sockaddr); - return TRUE; -} - -/* Close RTP/RTCP sockets */ -static void mpf_rtp_socket_pair_close(mpf_rtp_stream_t *stream) -{ - if(stream->rtp_socket) { - apr_socket_close(stream->rtp_socket); - stream->rtp_socket = NULL; - } - if(stream->rtcp_socket) { - apr_socket_close(stream->rtcp_socket); - stream->rtcp_socket = NULL; - } -} - - - -static APR_INLINE void rtcp_sr_generate(mpf_rtp_stream_t *rtp_stream, rtcp_sr_stat_t *sr_stat) -{ - *sr_stat = rtp_stream->transmitter.sr_stat; - apt_ntp_time_get(&sr_stat->ntp_sec, &sr_stat->ntp_frac); - sr_stat->rtp_ts = rtp_stream->transmitter.timestamp; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generate RTCP SR [ssrc:%u s:%u o:%u ts:%u]", - sr_stat->ssrc, - sr_stat->sent_packets, - sr_stat->sent_octets, - sr_stat->rtp_ts); - rtcp_sr_hton(sr_stat); -} - -static APR_INLINE void rtcp_rr_generate(mpf_rtp_stream_t *rtp_stream, rtcp_rr_stat_t *rr_stat) -{ - *rr_stat = rtp_stream->receiver.rr_stat; - rr_stat->last_seq = rtp_stream->receiver.history.seq_num_max; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Generate RTCP RR [ssrc:%u last_seq:%u j:%u lost:%u frac:%d]", - rr_stat->ssrc, - rr_stat->last_seq, - rr_stat->jitter, - rr_stat->lost, - rr_stat->fraction); - rtcp_rr_hton(rr_stat); -} - -/* Generate either RTCP SR or RTCP RR packet */ -static APR_INLINE apr_size_t rtcp_report_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length) -{ - apr_size_t offset = 0; - rtcp_header_init(&rtcp_packet->header,RTCP_RR); - if(rtp_stream->base->direction & STREAM_DIRECTION_SEND) { - rtcp_packet->header.pt = RTCP_SR; - } - if(rtp_stream->base->direction & STREAM_DIRECTION_RECEIVE) { - rtcp_packet->header.count = 1; - } - offset += sizeof(rtcp_header_t); - - if(rtcp_packet->header.pt == RTCP_SR) { - rtcp_sr_generate(rtp_stream,&rtcp_packet->r.sr.sr_stat); - offset += sizeof(rtcp_sr_stat_t); - if(rtcp_packet->header.count) { - rtcp_rr_generate(rtp_stream,rtcp_packet->r.sr.rr_stat); - offset += sizeof(rtcp_rr_stat_t); - } - } - else if(rtcp_packet->header.pt == RTCP_RR) { - rtcp_packet->r.rr.ssrc = htonl(rtp_stream->transmitter.sr_stat.ssrc); - rtcp_rr_generate(rtp_stream,rtcp_packet->r.rr.rr_stat); - offset += sizeof(rtcp_packet->r.rr); - } - rtcp_header_length_set(&rtcp_packet->header,offset); - return offset; -} - -/* Generate RTCP SDES packet */ -static APR_INLINE apr_size_t rtcp_sdes_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length) -{ - rtcp_sdes_item_t *item; - apr_size_t offset = 0; - apr_size_t padding; - rtcp_header_init(&rtcp_packet->header,RTCP_SDES); - offset += sizeof(rtcp_header_t); - - rtcp_packet->header.count ++; - rtcp_packet->r.sdes.ssrc = htonl(rtp_stream->transmitter.sr_stat.ssrc); - offset += sizeof(apr_uint32_t); - - /* insert SDES CNAME item */ - item = &rtcp_packet->r.sdes.item[0]; - item->type = RTCP_SDES_CNAME; - item->length = (apr_byte_t)rtp_stream->local_media->ip.length; - memcpy(item->data,rtp_stream->local_media->ip.buf,item->length); - offset += sizeof(rtcp_sdes_item_t) - 1 + item->length; - - /* terminate with end marker and pad to next 4-octet boundary */ - padding = 4 - (offset & 0x3); - while(padding--) { - item = (rtcp_sdes_item_t*) ((char*)rtcp_packet + offset); - item->type = RTCP_SDES_END; - offset++; - } - - rtcp_header_length_set(&rtcp_packet->header,offset); - return offset; -} - -/* Generate RTCP BYE packet */ -static APR_INLINE apr_size_t rtcp_bye_generate(mpf_rtp_stream_t *rtp_stream, rtcp_packet_t *rtcp_packet, apr_size_t length, apt_str_t *reason) -{ - apr_size_t offset = 0; - rtcp_header_init(&rtcp_packet->header,RTCP_BYE); - offset += sizeof(rtcp_header_t); - - rtcp_packet->r.bye.ssrc[0] = htonl(rtp_stream->transmitter.sr_stat.ssrc); - rtcp_packet->header.count++; - offset += rtcp_packet->header.count * sizeof(apr_uint32_t); - - if(reason->length) { - apr_size_t padding; - - memcpy(rtcp_packet->r.bye.data,reason->buf,reason->length); - rtcp_packet->r.bye.length = (apr_byte_t)reason->length; - offset += rtcp_packet->r.bye.length; - - /* terminate with end marker and pad to next 4-octet boundary */ - padding = 4 - (reason->length & 0x3); - if(padding) { - char *end = rtcp_packet->r.bye.data + reason->length; - memset(end,0,padding); - offset += padding; - } - } - - rtcp_header_length_set(&rtcp_packet->header,offset); - return offset; -} - -/* Send compound RTCP packet (SR/RR + SDES) */ -static apt_bool_t mpf_rtcp_report_send(mpf_rtp_stream_t *rtp_stream) -{ - char buffer[MAX_RTCP_PACKET_SIZE]; - apr_size_t length = 0; - rtcp_packet_t *rtcp_packet; - - if(!rtp_stream->rtcp_socket || !rtp_stream->rtcp_l_sockaddr || !rtp_stream->rtcp_r_sockaddr) { - /* session is not initialized */ - return FALSE; - } - - if(rtp_stream->base->direction != STREAM_DIRECTION_NONE) { - /* update periodic (prior) history */ - rtp_periodic_history_update(&rtp_stream->receiver); - } - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_report_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length); - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_sdes_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - if(apr_socket_sendto( - rtp_stream->rtcp_socket, - rtp_stream->rtcp_r_sockaddr, - 0, - buffer, - &length) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - return FALSE; - } - return TRUE; -} - -/* Send compound RTCP packet (SR/RR + SDES + BYE) */ -static apt_bool_t mpf_rtcp_bye_send(mpf_rtp_stream_t *rtp_stream, apt_str_t *reason) -{ - char buffer[MAX_RTCP_PACKET_SIZE]; - apr_size_t length = 0; - rtcp_packet_t *rtcp_packet; - - if(!rtp_stream->rtcp_socket || !rtp_stream->rtcp_l_sockaddr || !rtp_stream->rtcp_r_sockaddr) { - /* session is not initialized */ - return FALSE; - } - - if(rtp_stream->base->direction != STREAM_DIRECTION_NONE) { - /* update periodic (prior) history */ - rtp_periodic_history_update(&rtp_stream->receiver); - } - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_report_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length); - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_sdes_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length); - - rtcp_packet = (rtcp_packet_t*) (buffer + length); - length += rtcp_bye_generate(rtp_stream,rtcp_packet,sizeof(buffer)-length,reason); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Compound RTCP Packet [BYE] [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - if(apr_socket_sendto( - rtp_stream->rtcp_socket, - rtp_stream->rtcp_r_sockaddr, - 0, - buffer, - &length) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send Compound RTCP Packet [BYE] [%"APR_SIZE_T_FMT" bytes] %s:%hu -> %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - return FALSE; - } - return TRUE; -} - -static APR_INLINE void rtcp_sr_get(mpf_rtp_stream_t *rtp_stream, rtcp_sr_stat_t *sr_stat) -{ - rtcp_sr_ntoh(sr_stat); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get RTCP SR [ssrc:%u s:%u o:%u ts:%u]", - sr_stat->ssrc, - sr_stat->sent_packets, - sr_stat->sent_octets, - sr_stat->rtp_ts); -} - -static APR_INLINE void rtcp_rr_get(mpf_rtp_stream_t *rtp_stream, rtcp_rr_stat_t *rr_stat) -{ - rtcp_rr_ntoh(rr_stat); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get RTCP RR [ssrc:%u last_seq:%u j:%u lost:%u frac:%d]", - rr_stat->ssrc, - rr_stat->last_seq, - rr_stat->jitter, - rr_stat->lost, - rr_stat->fraction); -} - -static apt_bool_t mpf_rtcp_compound_packet_receive(mpf_rtp_stream_t *rtp_stream, char *buffer, apr_size_t length) -{ - rtcp_packet_t *rtcp_packet = (rtcp_packet_t*) buffer; - rtcp_packet_t *rtcp_packet_end; - - rtcp_packet_end = (rtcp_packet_t*)(buffer + length); - - while(rtcp_packet < rtcp_packet_end && rtcp_packet->header.version == RTP_VERSION) { - rtcp_packet->header.length = ntohs((apr_uint16_t)rtcp_packet->header.length); - - if(rtcp_packet->header.pt == RTCP_SR) { - /* RTCP SR */ - rtcp_sr_get(rtp_stream,&rtcp_packet->r.sr.sr_stat); - if(rtcp_packet->header.count) { - rtcp_rr_get(rtp_stream,rtcp_packet->r.sr.rr_stat); - } - } - else if(rtcp_packet->header.pt == RTCP_RR) { - /* RTCP RR */ - rtcp_packet->r.rr.ssrc = ntohl(rtcp_packet->r.rr.ssrc); - if(rtcp_packet->header.count) { - rtcp_rr_get(rtp_stream,rtcp_packet->r.rr.rr_stat); - } - } - else if(rtcp_packet->header.pt == RTCP_SDES) { - /* RTCP SDES */ - } - else if(rtcp_packet->header.pt == RTCP_BYE) { - /* RTCP BYE */ - } - else { - /* unknown RTCP packet */ - } - - /* get next RTCP packet */ - rtcp_packet = (rtcp_packet_t*)((apr_uint32_t*)rtcp_packet + rtcp_packet->header.length + 1); - } - - if(rtcp_packet != rtcp_packet_end) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Malformed Compound RTCP Packet"); - return FALSE; - } - - return TRUE; -} - -static void mpf_rtcp_tx_timer_proc(apt_timer_t *timer, void *obj) -{ - mpf_rtp_stream_t *rtp_stream = obj; - - /* generate and send RTCP compound report (SR/RR + SDES) */ - mpf_rtcp_report_send(rtp_stream); - - /* re-schedule timer */ - apt_timer_set(timer,rtp_stream->settings->rtcp_tx_interval); -} - -static void mpf_rtcp_rx_timer_proc(apt_timer_t *timer, void *obj) -{ - mpf_rtp_stream_t *rtp_stream = obj; - if(rtp_stream->rtcp_socket && rtp_stream->rtcp_l_sockaddr && rtp_stream->rtcp_r_sockaddr) { - char buffer[MAX_RTCP_PACKET_SIZE]; - apr_size_t length = sizeof(buffer); - - if(apr_socket_recv(rtp_stream->rtcp_socket,buffer,&length) == APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Compound RTCP Packet [%"APR_SIZE_T_FMT" bytes] %s:%hu <- %s:%hu", - length, - rtp_stream->rtcp_l_sockaddr->hostname, - rtp_stream->rtcp_l_sockaddr->port, - rtp_stream->rtcp_r_sockaddr->hostname, - rtp_stream->rtcp_r_sockaddr->port); - mpf_rtcp_compound_packet_receive(rtp_stream,buffer,length); - } - } - - /* re-schedule timer */ - apt_timer_set(timer,rtp_stream->settings->rtcp_rx_resolution); -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c deleted file mode 100644 index 497c33da41..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_rtp_termination_factory.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_rtp_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mpf_termination.h" -#include "mpf_rtp_termination_factory.h" -#include "mpf_rtp_stream.h" -#include "apt_log.h" - -typedef struct media_engine_slot_t media_engine_slot_t; -typedef struct rtp_termination_factory_t rtp_termination_factory_t; - -struct media_engine_slot_t { - mpf_engine_t *media_engine; - mpf_rtp_config_t *rtp_config; -}; - -struct rtp_termination_factory_t { - mpf_termination_factory_t base; - - mpf_rtp_config_t *config; - apr_array_header_t *media_engine_slots; - apr_pool_t *pool; -}; - -static apt_bool_t mpf_rtp_termination_destroy(mpf_termination_t *termination) -{ - return TRUE; -} - -static apt_bool_t mpf_rtp_termination_add(mpf_termination_t *termination, void *descriptor) -{ - apt_bool_t status = TRUE; - mpf_rtp_termination_descriptor_t *rtp_descriptor = descriptor; - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - int i; - media_engine_slot_t *slot; - rtp_termination_factory_t *rtp_termination_factory = (rtp_termination_factory_t*)termination->termination_factory; - mpf_rtp_config_t *rtp_config = rtp_termination_factory->config; - for(i=0; imedia_engine_slots->nelts; i++) { - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t); - if(slot->media_engine == termination->media_engine) { - rtp_config = slot->rtp_config; - break; - } - } - audio_stream = mpf_rtp_stream_create( - termination, - rtp_config, - rtp_descriptor->audio.settings, - termination->pool); - if(!audio_stream) { - return FALSE; - } - termination->audio_stream = audio_stream; - } - - status = mpf_rtp_stream_add(audio_stream); - if(rtp_descriptor) { - status = mpf_rtp_stream_modify(audio_stream,&rtp_descriptor->audio); - } - return status; -} - -static apt_bool_t mpf_rtp_termination_modify(mpf_termination_t *termination, void *descriptor) -{ - apt_bool_t status = TRUE; - mpf_rtp_termination_descriptor_t *rtp_descriptor = descriptor; - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - return FALSE; - } - - if(rtp_descriptor) { - status = mpf_rtp_stream_modify(audio_stream,&rtp_descriptor->audio); - } - return status; -} - -static apt_bool_t mpf_rtp_termination_subtract(mpf_termination_t *termination) -{ - mpf_audio_stream_t *audio_stream = termination->audio_stream; - if(!audio_stream) { - return FALSE; - } - - return mpf_rtp_stream_remove(audio_stream); -} - -static const mpf_termination_vtable_t rtp_vtable = { - mpf_rtp_termination_destroy, - mpf_rtp_termination_add, - mpf_rtp_termination_modify, - mpf_rtp_termination_subtract -}; - -static mpf_termination_t* mpf_rtp_termination_create(mpf_termination_factory_t *termination_factory, void *obj, apr_pool_t *pool) -{ - mpf_termination_t *termination = mpf_termination_base_create(termination_factory,obj,&rtp_vtable,NULL,NULL,pool); - if(termination) { - termination->name = "rtp-tm"; - } - return termination; -} - -static apt_bool_t mpf_rtp_factory_engine_assign(mpf_termination_factory_t *termination_factory, mpf_engine_t *media_engine) -{ - int i; - media_engine_slot_t *slot; - mpf_rtp_config_t *rtp_config; - rtp_termination_factory_t *rtp_termination_factory; - if(!termination_factory || !media_engine) { - return FALSE; - } - - rtp_termination_factory = (rtp_termination_factory_t *) termination_factory; - for(i=0; imedia_engine_slots->nelts; i++) { - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t); - if(slot->media_engine == media_engine) { - /* already exists, just return true */ - return TRUE; - } - } - - slot = apr_array_push(rtp_termination_factory->media_engine_slots); - slot->media_engine = media_engine; - rtp_config = mpf_rtp_config_alloc(rtp_termination_factory->pool); - *rtp_config = *rtp_termination_factory->config; - slot->rtp_config = rtp_config; - - if(rtp_termination_factory->media_engine_slots->nelts > 1) { - mpf_rtp_config_t *rtp_config_prev; - - /* split RTP port range evenly among assigned media engines */ - apr_uint16_t ports_per_engine = (apr_uint16_t)((rtp_termination_factory->config->rtp_port_max - rtp_termination_factory->config->rtp_port_min) / - rtp_termination_factory->media_engine_slots->nelts); - if(ports_per_engine % 2 != 0) { - /* number of ports per engine should be even (RTP/RTCP pair)*/ - ports_per_engine--; - } - /* rewrite max RTP port for the first slot */ - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,0,media_engine_slot_t); - rtp_config_prev = slot->rtp_config; - rtp_config_prev->rtp_port_max = rtp_config_prev->rtp_port_min + ports_per_engine; - - /* rewrite cur, min and max RTP ports for the slots between first and last, if any */ - for(i=1; imedia_engine_slots->nelts-1; i++) { - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots,i,media_engine_slot_t); - rtp_config = slot->rtp_config; - rtp_config->rtp_port_min = rtp_config_prev->rtp_port_max; - rtp_config->rtp_port_max = rtp_config->rtp_port_min + ports_per_engine; - - rtp_config->rtp_port_cur = rtp_config->rtp_port_min; - - rtp_config_prev = rtp_config; - } - - /* rewrite cur and min but leave max RTP port for the last slot */ - slot = &APR_ARRAY_IDX(rtp_termination_factory->media_engine_slots, - rtp_termination_factory->media_engine_slots->nelts-1,media_engine_slot_t); - rtp_config = slot->rtp_config; - rtp_config->rtp_port_min = rtp_config_prev->rtp_port_max; - rtp_config->rtp_port_cur = rtp_config->rtp_port_min; - } - return TRUE; -} - -MPF_DECLARE(mpf_termination_factory_t*) mpf_rtp_termination_factory_create( - mpf_rtp_config_t *rtp_config, - apr_pool_t *pool) -{ - rtp_termination_factory_t *rtp_termination_factory; - if(!rtp_config) { - return NULL; - } - rtp_config->rtp_port_cur = rtp_config->rtp_port_min; - rtp_termination_factory = apr_palloc(pool,sizeof(rtp_termination_factory_t)); - rtp_termination_factory->base.create_termination = mpf_rtp_termination_create; - rtp_termination_factory->base.assign_engine = mpf_rtp_factory_engine_assign; - rtp_termination_factory->pool = pool; - rtp_termination_factory->config = rtp_config; - rtp_termination_factory->media_engine_slots = apr_array_make(pool,1,sizeof(media_engine_slot_t)); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTP Termination Factory %s:[%hu,%hu]", - rtp_config->ip.buf, - rtp_config->rtp_port_min, - rtp_config->rtp_port_max); - return &rtp_termination_factory->base; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_scheduler.c b/libs/unimrcp/libs/mpf/src/mpf_scheduler.c deleted file mode 100644 index dab8e6b067..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_scheduler.c +++ /dev/null @@ -1,267 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_scheduler.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_scheduler.h" - -#ifdef WIN32 -#define ENABLE_MULTIMEDIA_TIMERS -#endif - -#ifdef ENABLE_MULTIMEDIA_TIMERS - -#pragma warning(disable:4201) -#include -#include - -#ifndef TIME_KILL_SYNCHRONOUS -#define TIME_KILL_SYNCHRONOUS 0x0100 -#endif - -#else -#include -#endif - - -struct mpf_scheduler_t { - apr_pool_t *pool; - unsigned long resolution; /* scheduler resolution */ - - unsigned long media_resolution; - mpf_scheduler_proc_f media_proc; - void *media_obj; - - unsigned long timer_resolution; - unsigned long timer_elapsed_time; - mpf_scheduler_proc_f timer_proc; - void *timer_obj; - -#ifdef ENABLE_MULTIMEDIA_TIMERS - unsigned int timer_id; -#else - apr_thread_t *thread; - apt_bool_t running; -#endif -}; - -static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler); - -/** Create scheduler */ -MPF_DECLARE(mpf_scheduler_t*) mpf_scheduler_create(apr_pool_t *pool) -{ - mpf_scheduler_t *scheduler = apr_palloc(pool,sizeof(mpf_scheduler_t)); - mpf_scheduler_init(scheduler); - scheduler->pool = pool; - scheduler->resolution = 0; - - scheduler->media_resolution = 0; - scheduler->media_obj = NULL; - scheduler->media_proc = NULL; - - scheduler->timer_resolution = 0; - scheduler->timer_elapsed_time = 0; - scheduler->timer_obj = NULL; - scheduler->timer_proc = NULL; - return scheduler; -} - -/** Destroy scheduler */ -MPF_DECLARE(void) mpf_scheduler_destroy(mpf_scheduler_t *scheduler) -{ - /* nothing to destroy */ -} - -/** Set media processing clock */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_media_clock_set( - mpf_scheduler_t *scheduler, - unsigned long resolution, - mpf_scheduler_proc_f proc, - void *obj) -{ - scheduler->media_resolution = resolution; - scheduler->media_proc = proc; - scheduler->media_obj = obj; - return TRUE; -} - -/** Set timer clock */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_timer_clock_set( - mpf_scheduler_t *scheduler, - unsigned long resolution, - mpf_scheduler_proc_f proc, - void *obj) -{ - scheduler->timer_resolution = resolution; - scheduler->timer_elapsed_time = 0; - scheduler->timer_proc = proc; - scheduler->timer_obj = obj; - return TRUE; -} - -/** Set scheduler rate (n times faster than real-time) */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_rate_set( - mpf_scheduler_t *scheduler, - unsigned long rate) -{ - if(rate == 0 || rate > 10) { - /* rate shows how many times scheduler should be faster than real-time, - 1 is the defualt and probably the only reasonable value, - however, the rates up to 10 times faster should be acceptable */ - rate = 1; - } - - scheduler->media_resolution /= rate; - scheduler->timer_resolution /= rate; - return TRUE; -} - -static APR_INLINE void mpf_scheduler_resolution_set(mpf_scheduler_t *scheduler) -{ - if(scheduler->media_resolution) { - scheduler->resolution = scheduler->media_resolution; - } - else if(scheduler->timer_resolution) { - scheduler->resolution = scheduler->timer_resolution; - } -} - - - -#ifdef ENABLE_MULTIMEDIA_TIMERS - -static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler) -{ - scheduler->timer_id = 0; -} - -static void CALLBACK mm_timer_proc(UINT uID, UINT uMsg, DWORD_PTR dwUser, DWORD_PTR dw1, DWORD_PTR dw2) -{ - mpf_scheduler_t *scheduler = (mpf_scheduler_t*) dwUser; - if(scheduler->media_proc) { - scheduler->media_proc(scheduler,scheduler->media_obj); - } - - if(scheduler->timer_proc) { - scheduler->timer_elapsed_time += scheduler->resolution; - if(scheduler->timer_elapsed_time >= scheduler->timer_resolution) { - scheduler->timer_elapsed_time = 0; - scheduler->timer_proc(scheduler,scheduler->timer_obj); - } - } -} - -/** Start scheduler */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler) -{ - mpf_scheduler_resolution_set(scheduler); - scheduler->timer_id = timeSetEvent( - scheduler->resolution, 0, mm_timer_proc, (DWORD_PTR) scheduler, - TIME_PERIODIC | TIME_CALLBACK_FUNCTION | TIME_KILL_SYNCHRONOUS); - return scheduler->timer_id ? TRUE : FALSE; -} - -/** Stop scheduler */ -MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler) -{ - if(!scheduler) { - return FALSE; - } - - timeKillEvent(scheduler->timer_id); - scheduler->timer_id = 0; - return TRUE; -} - -#else - -#include "apt_task.h" - -static APR_INLINE void mpf_scheduler_init(mpf_scheduler_t *scheduler) -{ - scheduler->thread = NULL; - scheduler->running = FALSE; -} - -static void* APR_THREAD_FUNC timer_thread_proc(apr_thread_t *thread, void *data) -{ - mpf_scheduler_t *scheduler = data; - apr_interval_time_t timeout = scheduler->resolution * 1000; - apr_interval_time_t time_drift = 0; - apr_time_t time_now, time_last; - -#if APR_HAS_SETTHREADNAME - apr_thread_name_set("MPF Scheduler"); -#endif - time_now = apr_time_now(); - while(scheduler->running == TRUE) { - time_last = time_now; - - if(scheduler->media_proc) { - scheduler->media_proc(scheduler,scheduler->media_obj); - } - - if(scheduler->timer_proc) { - scheduler->timer_elapsed_time += scheduler->resolution; - if(scheduler->timer_elapsed_time >= scheduler->timer_resolution) { - scheduler->timer_elapsed_time = 0; - scheduler->timer_proc(scheduler,scheduler->timer_obj); - } - } - - if(timeout > time_drift) { - apr_sleep(timeout - time_drift); - } - - time_now = apr_time_now(); - time_drift += time_now - time_last - timeout; -#if 0 - printf("time_drift=%d\n",time_drift); -#endif - } - - apr_thread_exit(thread,APR_SUCCESS); - return NULL; -} - -MPF_DECLARE(apt_bool_t) mpf_scheduler_start(mpf_scheduler_t *scheduler) -{ - mpf_scheduler_resolution_set(scheduler); - - scheduler->running = TRUE; - if(apr_thread_create(&scheduler->thread,NULL,timer_thread_proc,scheduler,scheduler->pool) != APR_SUCCESS) { - scheduler->running = FALSE; - return FALSE; - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_scheduler_stop(mpf_scheduler_t *scheduler) -{ - if(!scheduler) { - return FALSE; - } - - scheduler->running = FALSE; - if(scheduler->thread) { - apr_status_t s; - apr_thread_join(&s,scheduler->thread); - scheduler->thread = NULL; - } - return TRUE; -} - -#endif diff --git a/libs/unimrcp/libs/mpf/src/mpf_stream.c b/libs/unimrcp/libs/mpf/src/mpf_stream.c deleted file mode 100644 index 2c0c890aa2..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_stream.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_stream.h" - -/** Create stream capabilities */ -MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_create(mpf_stream_direction_e direction, apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities = (mpf_stream_capabilities_t*)apr_palloc(pool,sizeof(mpf_stream_capabilities_t)); - capabilities->direction = direction; - mpf_codec_capabilities_init(&capabilities->codecs,1,pool); - return capabilities; -} - -/** Clone stream capabilities */ -MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_clone(const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities = (mpf_stream_capabilities_t*)apr_palloc(pool,sizeof(mpf_stream_capabilities_t)); - capabilities->direction = src_capabilities->direction; - mpf_codec_capabilities_clone(&capabilities->codecs,&src_capabilities->codecs,pool); - return capabilities; -} - -/** Merge stream capabilities */ -MPF_DECLARE(apt_bool_t) mpf_stream_capabilities_merge(mpf_stream_capabilities_t *capabilities, const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool) -{ - capabilities->direction |= src_capabilities->direction; - return mpf_codec_capabilities_merge(&capabilities->codecs,&src_capabilities->codecs,pool); -} - - - -/** Create audio stream */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_audio_stream_create(void *obj, const mpf_audio_stream_vtable_t *vtable, const mpf_stream_capabilities_t *capabilities, apr_pool_t *pool) -{ - mpf_audio_stream_t *stream; - if(!vtable || !capabilities) { - return NULL; - } - - /* validate required fields */ - if(capabilities->direction & STREAM_DIRECTION_SEND) { - /* validate sink */ - if(!vtable->write_frame) { - return NULL; - } - } - if(capabilities->direction & STREAM_DIRECTION_RECEIVE) { - /* validate source */ - if(!vtable->read_frame) { - return NULL; - } - } - - stream = (mpf_audio_stream_t*)apr_palloc(pool,sizeof(mpf_audio_stream_t)); - stream->obj = obj; - stream->vtable = vtable; - stream->termination = NULL; - stream->capabilities = capabilities; - stream->direction = capabilities->direction; - stream->rx_descriptor = NULL; - stream->rx_event_descriptor = NULL; - stream->tx_descriptor = NULL; - stream->tx_event_descriptor = NULL; - return stream; -} - -/** Validate audio stream receiver */ -MPF_DECLARE(apt_bool_t) mpf_audio_stream_rx_validate( - mpf_audio_stream_t *stream, - const mpf_codec_descriptor_t *descriptor, - const mpf_codec_descriptor_t *event_descriptor, - apr_pool_t *pool) -{ - if(!stream->capabilities) { - return FALSE; - } - - if(!stream->rx_descriptor) { - stream->rx_descriptor = mpf_codec_descriptor_create_by_capabilities(&stream->capabilities->codecs,descriptor,pool); - } - if(!stream->rx_event_descriptor) { - if(stream->capabilities->codecs.allow_named_events == TRUE && event_descriptor) { - stream->rx_event_descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t)); - *stream->rx_event_descriptor = *event_descriptor; - } - } - - return stream->rx_descriptor ? TRUE : FALSE; -} - -/** Validate audio stream transmitter */ -MPF_DECLARE(apt_bool_t) mpf_audio_stream_tx_validate( - mpf_audio_stream_t *stream, - const mpf_codec_descriptor_t *descriptor, - const mpf_codec_descriptor_t *event_descriptor, - apr_pool_t *pool) -{ - if(!stream->capabilities) { - return FALSE; - } - - if(!stream->tx_descriptor) { - stream->tx_descriptor = mpf_codec_descriptor_create_by_capabilities(&stream->capabilities->codecs,descriptor,pool); - } - if(!stream->tx_event_descriptor) { - if(stream->capabilities->codecs.allow_named_events == TRUE && event_descriptor) { - stream->tx_event_descriptor = apr_palloc(pool,sizeof(mpf_codec_descriptor_t)); - *stream->tx_event_descriptor = *event_descriptor; - } - } - return stream->tx_descriptor ? TRUE : FALSE; -} - -/** Trace media path */ -MPF_DECLARE(void) mpf_audio_stream_trace(mpf_audio_stream_t *stream, mpf_stream_direction_e direction, apt_text_stream_t *output) -{ - if(stream->vtable->trace) { - stream->vtable->trace(stream,direction,output); - return; - } - - if(direction & STREAM_DIRECTION_SEND) { - mpf_codec_descriptor_t *descriptor = stream->tx_descriptor; - if(descriptor) { - apr_size_t offset = output->pos - output->text.buf; - output->pos += apr_snprintf(output->pos, output->text.length - offset, - "[%s/%d/%d]->Sink", - descriptor->name.buf, - descriptor->sampling_rate, - descriptor->channel_count); - } - } - if(direction & STREAM_DIRECTION_RECEIVE) { - mpf_codec_descriptor_t *descriptor = stream->rx_descriptor; - if(descriptor) { - apr_size_t offset = output->pos - output->text.buf; - output->pos += apr_snprintf(output->pos, output->text.length - offset, - "Source->[%s/%d/%d]", - descriptor->name.buf, - descriptor->sampling_rate, - descriptor->channel_count); - } - } -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_termination.c b/libs/unimrcp/libs/mpf/src/mpf_termination.c deleted file mode 100644 index 23e7a3aaaa..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_termination.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_termination.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_termination.h" -#include "mpf_stream.h" -#include "mpf_codec_manager.h" - -MPF_DECLARE(mpf_termination_t*) mpf_termination_base_create( - mpf_termination_factory_t *termination_factory, - void *obj, - const mpf_termination_vtable_t *vtable, - mpf_audio_stream_t *audio_stream, - mpf_video_stream_t *video_stream, - apr_pool_t *pool) -{ - mpf_termination_t *termination = apr_palloc(pool,sizeof(mpf_termination_t)); - termination->pool = pool; - termination->name = "media-tm"; - termination->obj = obj; - termination->media_engine = NULL; - termination->event_handler = NULL; - termination->codec_manager = NULL; - termination->timer_queue = NULL; - termination->termination_factory = termination_factory; - termination->vtable = vtable; - termination->slot = 0; - if(audio_stream) { - audio_stream->termination = termination; - } - if(video_stream) { - video_stream->termination = termination; - } - termination->audio_stream = audio_stream; - termination->video_stream = video_stream; - return termination; -} - -MPF_DECLARE(apt_bool_t) mpf_termination_add(mpf_termination_t *termination, void *descriptor) -{ - if(termination->vtable && termination->vtable->add) { - termination->vtable->add(termination,descriptor); - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_termination_modify(mpf_termination_t *termination, void *descriptor) -{ - if(termination->vtable && termination->vtable->modify) { - termination->vtable->modify(termination,descriptor); - } - return TRUE; -} - -MPF_DECLARE(apt_bool_t) mpf_termination_subtract(mpf_termination_t *termination) -{ - if(termination->vtable && termination->vtable->subtract) { - termination->vtable->subtract(termination); - } - return TRUE; -} diff --git a/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c b/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c deleted file mode 100644 index f8d0034c8b..0000000000 --- a/libs/unimrcp/libs/mpf/src/mpf_termination_factory.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_termination_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mpf_termination_factory.h" -#include "mpf_termination.h" - -/** Assign media engine to termination factory */ -MPF_DECLARE(apt_bool_t) mpf_termination_factory_engine_assign( - mpf_termination_factory_t *termination_factory, - mpf_engine_t *media_engine) -{ - if(termination_factory && termination_factory->assign_engine && media_engine) { - return termination_factory->assign_engine(termination_factory,media_engine); - } - return FALSE; -} - -/** Create MPF termination from termination factory */ -MPF_DECLARE(mpf_termination_t*) mpf_termination_create( - mpf_termination_factory_t *termination_factory, - void *obj, - apr_pool_t *pool) -{ - if(termination_factory && termination_factory->create_termination) { - return termination_factory->create_termination(termination_factory,obj,pool); - } - return NULL; -} - -/** Create raw MPF termination. */ -MPF_DECLARE(mpf_termination_t*) mpf_raw_termination_create( - void *obj, - mpf_audio_stream_t *audio_stream, - mpf_video_stream_t *video_stream, - apr_pool_t *pool) -{ - return mpf_termination_base_create(NULL,obj,NULL,audio_stream,video_stream,pool); -} - -MPF_DECLARE(apt_bool_t) mpf_termination_destroy(mpf_termination_t *termination) -{ - if(termination->vtable && termination->vtable->destroy) { - termination->vtable->destroy(termination); - } - return TRUE; -} - -/** Get termination name */ -MPF_DECLARE(const char*) mpf_termination_name_get(const mpf_termination_t *termination) -{ - return termination->name; -} - -/** Get associated object. */ -MPF_DECLARE(void*) mpf_termination_object_get(const mpf_termination_t *termination) -{ - return termination->obj; -} - -/** Get audio stream. */ -MPF_DECLARE(mpf_audio_stream_t*) mpf_termination_audio_stream_get(const mpf_termination_t *termination) -{ - return termination->audio_stream; -} - -/** Get video stream. */ -MPF_DECLARE(mpf_video_stream_t*) mpf_termination_video_stream_get(const mpf_termination_t *termination) -{ - return termination->video_stream; -} diff --git a/libs/unimrcp/libs/mrcp-client/Makefile.am b/libs/unimrcp/libs/mrcp-client/Makefile.am deleted file mode 100644 index dfbacdcb77..0000000000 --- a/libs/unimrcp/libs/mrcp-client/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-client/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpclient.la - -include_HEADERS = include/mrcp_client_types.h \ - include/mrcp_client.h \ - include/mrcp_client_session.h \ - include/mrcp_application.h - -libmrcpclient_la_SOURCES = src/mrcp_client.c \ - src/mrcp_client_session.c \ - src/mrcp_application.c diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h deleted file mode 100644 index 3770e77ece..0000000000 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_application.h +++ /dev/null @@ -1,360 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_application.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_APPLICATION_H -#define MRCP_APPLICATION_H - -/** - * @file mrcp_application.h - * @brief MRCP User Level Application Interface - */ - -#include "mrcp_client_types.h" -#include "mpf_rtp_descriptor.h" -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** MRCP application message declaration */ -typedef struct mrcp_app_message_t mrcp_app_message_t; - -/** MRCP signaling message declaration */ -typedef struct mrcp_sig_message_t mrcp_sig_message_t; - -/** MRCP application message dispatcher declaration */ -typedef struct mrcp_app_message_dispatcher_t mrcp_app_message_dispatcher_t; - -/** MRCP application message handler */ -typedef apt_bool_t (*mrcp_app_message_handler_f)(const mrcp_app_message_t *app_message); - -/** Enumeration of MRCP signaling message types */ -typedef enum { - MRCP_SIG_MESSAGE_TYPE_REQUEST, /**< request message */ - MRCP_SIG_MESSAGE_TYPE_RESPONSE, /**< response message */ - MRCP_SIG_MESSAGE_TYPE_EVENT /**< event message */ -} mrcp_sig_message_type_e; - -/** Enumeration of MRCP signaling status codes */ -typedef enum { - MRCP_SIG_STATUS_CODE_SUCCESS, /**< indicates success */ - MRCP_SIG_STATUS_CODE_FAILURE, /**< request failed */ - MRCP_SIG_STATUS_CODE_TERMINATE, /**< request failed, session/channel/connection unexpectedly terminated */ - MRCP_SIG_STATUS_CODE_CANCEL /**< request cancelled */ -} mrcp_sig_status_code_e; - - -/** Enumeration of MRCP signaling commands (requests/responses) */ -typedef enum { - MRCP_SIG_COMMAND_SESSION_UPDATE, - MRCP_SIG_COMMAND_SESSION_TERMINATE, - MRCP_SIG_COMMAND_CHANNEL_ADD, - MRCP_SIG_COMMAND_CHANNEL_REMOVE, - MRCP_SIG_COMMAND_RESOURCE_DISCOVER -} mrcp_sig_command_e; - -/** Enumeration of MRCP signaling events */ -typedef enum { - MRCP_SIG_EVENT_TERMINATE -} mrcp_sig_event_e; - - -/** Enumeration of MRCP application message types */ -typedef enum { - MRCP_APP_MESSAGE_TYPE_SIGNALING, /**< signaling message type */ - MRCP_APP_MESSAGE_TYPE_CONTROL /**< control message type */ -} mrcp_app_message_type_e; - -/** MRCP signaling message definition */ -struct mrcp_sig_message_t { - /** Message type (request/response/event) */ - mrcp_sig_message_type_e message_type; - /** Command (request/response) identifier */ - mrcp_sig_command_e command_id; - /** Event identifier */ - mrcp_sig_event_e event_id; - /** Status code used in response */ - mrcp_sig_status_code_e status; -}; - - -/** MRCP application message definition */ -struct mrcp_app_message_t { - /** Message type (signaling/control) */ - mrcp_app_message_type_e message_type; - - /** Application */ - mrcp_application_t *application; - /** Session */ - mrcp_session_t *session; - /** Channel */ - mrcp_channel_t *channel; - /** Session/resource descriptor */ - mrcp_session_descriptor_t *descriptor; - - /** MRCP signaling message (used if message_type == MRCP_APP_MESSAGE_SIGNALING) */ - mrcp_sig_message_t sig_message; - /** MRCP control message (used if message_type == MRCP_APP_MESSAGE_CONTROL) */ - mrcp_message_t *control_message; -}; - -/** MRCP application message dispatcher interface */ -struct mrcp_app_message_dispatcher_t { - /** Response to mrcp_application_session_update()request */ - apt_bool_t (*on_session_update)(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); - /** Response to mrcp_application_session_terminate()request */ - apt_bool_t (*on_session_terminate)(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); - - /** Response to mrcp_application_channel_add() request */ - apt_bool_t (*on_channel_add)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); - /** Response to mrcp_application_channel_remove() request */ - apt_bool_t (*on_channel_remove)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); - - /** Response (event) to mrcp_application_message_send() request */ - apt_bool_t (*on_message_receive)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - - /** Event indicating unexpected session/channel termination */ - apt_bool_t (*on_terminate_event)(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel); - - /** Response to mrcp_application_resource_discover() request */ - apt_bool_t (*on_resource_discover)(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status); -}; - - - -/** - * Create application instance. - * @param handler the event handler - * @param obj the external object - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool); - -/** - * Destroy application instance. - * @param application the application to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_destroy(mrcp_application_t *application); - -/** - * Get external object associated with the application. - * @param application the application to get object from - */ -MRCP_DECLARE(void*) mrcp_application_object_get(const mrcp_application_t *application); - -/** - * Get dir layout structure. - * @param application the application to get dir layout from - */ -MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(const mrcp_application_t *application); - -/** - * Create session. - * @param application the entire application - * @param profile the name of the profile to use - * @param obj the external object - * @return the created session instance - */ -MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile, void *obj); - -/** - * Get memory pool the session object is created out of. - * @param session the session to get pool from - */ -MRCP_DECLARE(apr_pool_t*) mrcp_application_session_pool_get(const mrcp_session_t *session); - -/** - * Get session identifier. - * @param session the session to get identifier of - */ -MRCP_DECLARE(const apt_str_t*) mrcp_application_session_id_get(const mrcp_session_t *session); - -/** - * Get SIP or RTSP response code. - * @param session the session to use - */ -MRCP_DECLARE(int) mrcp_application_session_response_code_get(const mrcp_session_t *session); - -/** - * Get external object associated with the session. - * @param session the session to get object from - */ -MRCP_DECLARE(void*) mrcp_application_session_object_get(const mrcp_session_t *session); - -/** - * Set (associate) external object to the session. - * @param session the session to set object for - * @param obj the object to set - */ -MRCP_DECLARE(void) mrcp_application_session_object_set(mrcp_session_t *session, void *obj); - -/** - * Set name of the session (informative only used for debugging). - * @param session the session to set name for - * @param name the name to set - */ -MRCP_DECLARE(void) mrcp_application_session_name_set(mrcp_session_t *session, const char *name); - -/** - * Send session update request. - * @param session the session to update - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_update(mrcp_session_t *session); - -/** - * Send session termination request. - * @param session the session to terminate - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_terminate(mrcp_session_t *session); - -/** - * Destroy client session (session must be terminated prior to destroy). - * @param session the session to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_destroy(mrcp_session_t *session); - - -/** - * Create control channel. - * @param session the session to create channel for - * @param resource_id the resource identifier of the channel - * @param termination the media termination - * @param rtp_descriptor the RTP termination descriptor (NULL by default) - * @param obj the external object - */ -MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create( - mrcp_session_t *session, - mrcp_resource_id resource_id, - mpf_termination_t *termination, - mpf_rtp_termination_descriptor_t *rtp_descriptor, - void *obj); - -/** - * Get external object associated with the channel. - * @param channel the channel to get object from - */ -MRCP_DECLARE(void*) mrcp_application_channel_object_get(const mrcp_channel_t *channel); - -/** - * Get RTP termination descriptor. - * @param channel the channel to get descriptor from - */ -MRCP_DECLARE(mpf_rtp_termination_descriptor_t*) mrcp_application_rtp_descriptor_get(const mrcp_channel_t *channel); - -/** - * Get codec descriptor of source stream. - * @param channel the channel to get descriptor from - */ -MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_source_descriptor_get(const mrcp_channel_t *channel); - -/** - * Get codec descriptor of sink stream. - * @param channel the channel to get descriptor from - */ -MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_sink_descriptor_get(const mrcp_channel_t *channel); - -/** - * Get associated audio stream. - * @param channel the channel to get associated stream from - */ -MRCP_DECLARE(const mpf_audio_stream_t*) mrcp_application_audio_stream_get(const mrcp_channel_t *channel); - -/** - * Send channel add request. - * @param session the session to create channel for - * @param channel the control channel - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_channel_add(mrcp_session_t *session, mrcp_channel_t *channel); - -/** - * Create MRCP message. - * @param session the session - * @param channel the control channel - * @param method_id the method identifier of MRCP message - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id); - -/** - * Send MRCP message. - * @param session the session - * @param channel the control channel - * @param message the MRCP message to send - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_message_send(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - -/** - * Remove channel. - * @param session the session to remove channel from - * @param channel the control channel to remove - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_channel_remove(mrcp_session_t *session, mrcp_channel_t *channel); - -/** - * Discover resources. - * @param session the session to use as communication object - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *session); - -/** - * Dispatch application message. - * @param dispatcher the dispatcher inteface - * @param app_message the message to dispatch - */ -MRCP_DECLARE(apt_bool_t) mrcp_application_message_dispatch(const mrcp_app_message_dispatcher_t *dispatcher, const mrcp_app_message_t *app_message); - -/** - * Create audio termination - * @param session the session to create termination for - * @param stream_vtable the virtual table of audio stream - * @param capabilities the capabilities of the stream - * @param obj the external object - */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_audio_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_stream_capabilities_t *capabilities, - void *obj); -/** - * Create source media termination - * @param session the session to create termination for - * @param stream_vtable the virtual table of audio stream - * @param codec_descriptor the descriptor of audio stream (NULL by default) - * @param obj the external object - * @deprecated @see mrcp_application_audio_termination_create() - */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_source_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_codec_descriptor_t *codec_descriptor, - void *obj); -/** - * Create sink media termination - * @param session the session to create termination for - * @param stream_vtable the virtual table of audio stream - * @param codec_descriptor the descriptor of audio stream (NULL by default) - * @param obj the external object - * @deprecated @see mrcp_application_audio_termination_create() - */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_sink_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_codec_descriptor_t *codec_descriptor, - void *obj); - -APT_END_EXTERN_C - -#endif /* MRCP_APPLICATION_H */ diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h deleted file mode 100644 index 87d36e21fe..0000000000 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_client.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CLIENT_H -#define MRCP_CLIENT_H - -/** - * @file mrcp_client.h - * @brief MRCP Client - */ - -#include "mrcp_client_types.h" -#include "mpf_rtp_descriptor.h" -#include "apt_task.h" - -APT_BEGIN_EXTERN_C - -/** Event handler used in case of asynchronous start */ -typedef void (*mrcp_client_handler_f)(apt_bool_t status); - -/** - * Create MRCP client instance. - * @return the created client instance - */ -MRCP_DECLARE(mrcp_client_t*) mrcp_client_create(apt_dir_layout_t *dir_layout); - -/** - * Set asynchronous start mode. - * @param client the MRCP client to set mode for - * @param handler the event handler to signal start completion - */ -MRCP_DECLARE(void) mrcp_client_async_start_set(mrcp_client_t *client, mrcp_client_handler_f handler); - - -/** - * Start message processing loop. - * @param client the MRCP client to start - * @return the created client instance - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_start(mrcp_client_t *client); - -/** - * Shutdown message processing loop. - * @param client the MRCP client to shutdown - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_shutdown(mrcp_client_t *client); - -/** - * Destroy MRCP client. - * @param client the MRCP client to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_destroy(mrcp_client_t *client); - - -/** - * Register MRCP resource factory. - * @param client the MRCP client to set resource factory for - * @param resource_factory the resource factory to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_resource_factory_register(mrcp_client_t *client, mrcp_resource_factory_t *resource_factory); - -/** - * Register codec manager. - * @param client the MRCP client to set codec manager for - * @param codec_manager the codec manager to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_codec_manager_register(mrcp_client_t *client, mpf_codec_manager_t *codec_manager); - -/** - * Get registered codec manager. - * @param client the MRCP client to get codec manager from - */ -MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_client_codec_manager_get(const mrcp_client_t *client); - -/** - * Register media engine. - * @param client the MRCP client to set media engine for - * @param media_engine the media engine to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_media_engine_register(mrcp_client_t *client, mpf_engine_t *media_engine); - -/** - * Register RTP termination factory. - * @param client the MRCP client to set termination factory for - * @param rtp_termination_factory the termination factory - * @param name the name of the factory - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_factory_register(mrcp_client_t *client, mpf_termination_factory_t *rtp_termination_factory, const char *name); - -/** - * Register RTP settings. - * @param client the MRCP client to set RTP settings for - * @param rtp_settings the settings to set - * @param name the name of the settings - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_settings_register(mrcp_client_t *client, mpf_rtp_settings_t *rtp_settings, const char *name); - -/** - * Register MRCP signaling agent. - * @param client the MRCP client to set signaling agent for - * @param signaling_agent the signaling agent to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_agent_register(mrcp_client_t *client, mrcp_sig_agent_t *signaling_agent); - -/** - * Register MRCP signaling settings. - * @param client the MRCP client to set signaling settings for - * @param signaling_settings the signaling settings to set - * @param name the name of the agent - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_settings_register(mrcp_client_t *client, mrcp_sig_settings_t *signaling_settings, const char *name); - -/** - * Register MRCP connection agent (MRCPv2 only). - * @param client the MRCP client to set connection agent for - * @param connection_agent the connection agent to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent); - -/** Create MRCP profile */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create( - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool); - -/** Create MRCP profile (extended version) */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create_ex( - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sa_factory_t *sa_factory, - mrcp_ca_factory_t *ca_factory, - mpf_engine_factory_t *mpf_factory, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool); - -/** - * Set a tag to the profile. - * @param profile the profile to set a tag for - * @param tag the tag to set - */ -MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_client_profile_t *profile, const char *tag); - -/** - * Register MRCP profile. - * @param client the MRCP client to set profile for - * @param profile the profile to set - * @param name the name of the profile - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_client_profile_t *profile, const char *name); - -/** - * Register MRCP application. - * @param client the MRCP client to set application for - * @param application the application to set - * @param name the name of the application - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_application_register(mrcp_client_t *client, mrcp_application_t *application, const char *name); - -/** - * Get memory pool. - * @param client the MRCP client to get memory pool from - */ -MRCP_DECLARE(apr_pool_t*) mrcp_client_memory_pool_get(const mrcp_client_t *client); - -/** - * Get media engine by name. - * @param client the MRCP client to get media engine from - * @param name the name of the media engine to lookup - */ -MRCP_DECLARE(mpf_engine_t*) mrcp_client_media_engine_get(const mrcp_client_t *client, const char *name); - -/** - * Get RTP termination factory by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mpf_termination_factory_t*) mrcp_client_rtp_factory_get(const mrcp_client_t *client, const char *name); - -/** - * Get RTP settings by name - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_client_rtp_settings_get(const mrcp_client_t *client, const char *name); - -/** - * Get signaling agent by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_client_signaling_agent_get(const mrcp_client_t *client, const char *name); - -/** - * Get signaling settings by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_client_signaling_settings_get(const mrcp_client_t *client, const char *name); - -/** - * Get connection agent by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(const mrcp_client_t *client, const char *name); - -/** - * Get profile by name. - * @param client the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name); - -/** - * Get available profiles. - * @param client the MRCP client to get the profile from - * @param profiles the array of profiles to be filled in - * @param count the max number of profiles on entry; and the number of profiles filled in on exit - * @param tag the tag to be used as a filter (no filter is specified if tag is NULL) - * @return FALSE if the provided max number of profiles is less than the actual number of profiles - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_client_profile_t *profiles[], apr_size_t *count, const char *tag); - -/** - * Get directory layout. - * @param client the MRCP client to get from - */ -MRCP_DECLARE(apt_dir_layout_t*) mrcp_client_dir_layout_get(const mrcp_client_t *client); - -APT_END_EXTERN_C - -#endif /* MRCP_CLIENT_H */ diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h deleted file mode 100644 index f6a3c645ee..0000000000 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_session.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_client_session.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CLIENT_SESSION_H -#define MRCP_CLIENT_SESSION_H - -/** - * @file mrcp_client_session.h - * @brief MRCP Client Session - */ - -#include "mrcp_client_types.h" -#include "mrcp_application.h" -#include "mrcp_session.h" -#include "mpf_engine.h" -#include "apt_task_msg.h" -#include "apt_obj_list.h" - -APT_BEGIN_EXTERN_C - -/** RTP termination slot declaration */ -typedef struct rtp_termination_slot_t rtp_termination_slot_t; - -/** MRCP client session declaration */ -typedef struct mrcp_client_session_t mrcp_client_session_t; - -/** Client session states */ -typedef enum { - SESSION_STATE_NONE, - SESSION_STATE_GENERATING_OFFER, - SESSION_STATE_PROCESSING_ANSWER, - SESSION_STATE_TERMINATING, - SESSION_STATE_DISCOVERING -} mrcp_client_session_state_e; - -/** MRCP client session */ -struct mrcp_client_session_t { - /** Session base */ - mrcp_session_t base; - /** Application session belongs to */ - mrcp_application_t *application; - /** External object associated with session */ - void *app_obj; - /** Profile to use */ - mrcp_client_profile_t *profile; - - /** Media context */ - mpf_context_t *context; - /** Codec manager */ - const mpf_codec_manager_t *codec_manager; - - /** RTP termination array (mrcp_termination_slot_t) */ - apr_array_header_t *terminations; - /** MRCP control channel array (mrcp_channel_t*) */ - apr_array_header_t *channels; - - /** Indicates whether session is already added to session table */ - apt_bool_t registered; - - /** In-progress offer */ - mrcp_session_descriptor_t *offer; - /** In-progress answer */ - mrcp_session_descriptor_t *answer; - - /** MRCP application active request */ - const mrcp_app_message_t *active_request; - /** MRCP application request queue */ - apt_obj_list_t *request_queue; - - /** MPF task message, which construction is in progress */ - mpf_task_msg_t *mpf_task_msg; - - /** Session state */ - mrcp_client_session_state_e state; - /** Status code of the app response to be generated */ - mrcp_sig_status_code_e status; - /** Number of in-progress sub requests */ - apr_size_t subrequest_count; - /** True, if server unexpectedly closed session/connection */ - apt_bool_t disconnected; -}; - -/** MRCP channel */ -struct mrcp_channel_t { - /** Memory pool */ - apr_pool_t *pool; - /** External object associated with channel */ - void *obj; - /** MRCP resource */ - mrcp_resource_t *resource; - /** MRCP session entire channel belongs to */ - mrcp_session_t *session; - /** MRCP control channel */ - mrcp_control_channel_t *control_channel; - /** Media termination */ - mpf_termination_t *termination; - /** Associated RTP termination slot */ - rtp_termination_slot_t *rtp_termination_slot; - - /** waiting state of control channel */ - apt_bool_t waiting_for_channel; - /** waiting state of media termination */ - apt_bool_t waiting_for_termination; -}; - -/** RTP termination slot */ -struct rtp_termination_slot_t { - /** waiting state */ - apt_bool_t waiting; - /** RTP termination */ - mpf_termination_t *termination; - /** RTP termination descriptor */ - mpf_rtp_termination_descriptor_t *descriptor; - /** Associated MRCP channel */ - mrcp_channel_t *channel; - /** media descriptor id (index of media in session descriptor) */ - apr_size_t id; -}; - -/** MRCP client profile */ -struct mrcp_client_profile_t { - /** Unique profile name */ - const char *name; - /** Arbitrary tag set/used by user application */ - const char *tag; - /** MRCP version */ - mrcp_version_e mrcp_version; - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** Media engine factory */ - mpf_engine_factory_t *mpf_factory; - /** RTP termination factory */ - mpf_termination_factory_t *rtp_termination_factory; - /** Signaling agent factory */ - mrcp_sa_factory_t *sa_factory; - /** Connection agent factory */ - mrcp_ca_factory_t *ca_factory; - /** Signaling settings */ - mrcp_sig_settings_t *signaling_settings; - /** RTP settings */ - mpf_rtp_settings_t *rtp_settings; -}; - -/** MRCP application */ -struct mrcp_application_t { - /** External object associated with the application */ - void *obj; - /** Application message handler */ - mrcp_app_message_handler_f handler; - /** MRCP client */ - mrcp_client_t *client; - /** Application task message pool */ - apt_task_msg_pool_t *msg_pool; -}; - -/** Create channel */ -mrcp_channel_t* mrcp_client_channel_create( - mrcp_client_session_t *session, - mrcp_resource_t *resource, - mpf_termination_t *termination, - mpf_rtp_termination_descriptor_t *rtp_descriptor, - void *obj); - -/** Create signaling app_message_t request */ -mrcp_app_message_t* mrcp_client_app_signaling_request_create(mrcp_sig_command_e command_id, apr_pool_t *pool); -/** Create signaling app_message_t event */ -mrcp_app_message_t* mrcp_client_app_signaling_event_create(mrcp_sig_event_e event_id, apr_pool_t *pool); -/** Create control app_message_t */ -mrcp_app_message_t* mrcp_client_app_control_message_create(apr_pool_t *pool); - -/** Process application message */ -apt_bool_t mrcp_client_app_message_process(mrcp_app_message_t *app_message); -/** Process MPF message */ -apt_bool_t mrcp_client_mpf_message_process(mpf_message_container_t *mpf_message_container); - -/** Process session answer */ -apt_bool_t mrcp_client_session_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); -/** Process session termination response */ -apt_bool_t mrcp_client_session_terminate_response_process(mrcp_client_session_t *session); -/** Process session control response */ -apt_bool_t mrcp_client_session_control_response_process(mrcp_client_session_t *session, mrcp_message_t *message); -/** Process resource discovery response */ -apt_bool_t mrcp_client_session_discover_response_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); -/** Process session termination event */ -apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session); - -/** Process channel add event */ -apt_bool_t mrcp_client_on_channel_add(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -/** Process channel modify event */ -apt_bool_t mrcp_client_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -/** Process channel remove event */ -apt_bool_t mrcp_client_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status); -/** Process message receive event */ -apt_bool_t mrcp_client_on_message_receive(mrcp_channel_t *channel, mrcp_message_t *message); -/** Process disconnect event */ -apt_bool_t mrcp_client_on_disconnect(mrcp_channel_t *channel); - -APT_END_EXTERN_C - -#endif /* MRCP_CLIENT_SESSION_H */ diff --git a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h b/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h deleted file mode 100644 index 61a555bcbe..0000000000 --- a/libs/unimrcp/libs/mrcp-client/include/mrcp_client_types.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_client_types.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CLIENT_TYPES_H -#define MRCP_CLIENT_TYPES_H - -/** - * @file mrcp_client_types.h - * @brief MRCP Client Types - */ - -#include "mrcp_sig_types.h" -#include "mrcp_connection_types.h" -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MRCP client declaration */ -typedef struct mrcp_client_t mrcp_client_t; - -/** Opaque MRCP client profile declaration */ -typedef struct mrcp_client_profile_t mrcp_client_profile_t; -/** Backward compatible declaration of MRCP profile */ -typedef mrcp_client_profile_t mrcp_profile_t; - -/** Opaque MRCP application declaration */ -typedef struct mrcp_application_t mrcp_application_t; - -/** Opaque MRCP channel declaration */ -typedef struct mrcp_channel_t mrcp_channel_t; - - -APT_END_EXTERN_C - -#endif /* MRCP_CLIENT_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj deleted file mode 100644 index e5cfaa0b33..0000000000 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.2017.vcxproj +++ /dev/null @@ -1,131 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpclient - {72782932-37CC-46AE-8C7F-9A7B1A6EE108} - mrcpclient - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj deleted file mode 100644 index 046c3e4695..0000000000 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcproj +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj deleted file mode 100644 index 3447a31724..0000000000 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {72782932-37CC-46AE-8C7F-9A7B1A6EE108} - mrcpclient - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters b/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters deleted file mode 100644 index 789830de35..0000000000 --- a/libs/unimrcp/libs/mrcp-client/mrcpclient.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {dc4325fe-8e7a-4a40-ab63-4173d85cf131} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c deleted file mode 100644 index 849847720b..0000000000 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_application.c +++ /dev/null @@ -1,549 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_application.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#include "mrcp_application.h" -#include "mrcp_client.h" -#include "mrcp_client_session.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_message.h" -#include "mrcp_sig_agent.h" -#include "mrcp_resource_factory.h" -#include "mpf_termination_factory.h" -#include "apt_dir_layout.h" -#include "apt_log.h" - -mrcp_client_session_t* mrcp_client_session_create(mrcp_client_t *client); - -apt_bool_t mrcp_app_signaling_task_msg_signal(mrcp_sig_command_e command_id, mrcp_session_t *session, mrcp_channel_t *channel); -apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - - -/** Create application instance */ -MRCP_DECLARE(mrcp_application_t*) mrcp_application_create(const mrcp_app_message_handler_f handler, void *obj, apr_pool_t *pool) -{ - mrcp_application_t *application; - if(!handler) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Application"); - application = apr_palloc(pool,sizeof(mrcp_application_t)); - application->obj = obj; - application->handler = handler; - application->client = NULL; - return application; -} - -/** Destroy application instance */ -MRCP_DECLARE(apt_bool_t) mrcp_application_destroy(mrcp_application_t *application) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Application"); - return TRUE; -} - -/** Get external object associated with the application */ -MRCP_DECLARE(void*) mrcp_application_object_get(const mrcp_application_t *application) -{ - return application->obj; -} - -/** Get dir layout structure */ -MRCP_DECLARE(const apt_dir_layout_t*) mrcp_application_dir_layout_get(const mrcp_application_t *application) -{ - return mrcp_client_dir_layout_get(application->client); -} - - - -/** Create client session */ -MRCP_DECLARE(mrcp_session_t*) mrcp_application_session_create(mrcp_application_t *application, const char *profile_name, void *obj) -{ - mrcp_client_profile_t *profile; - mrcp_client_session_t *session; - if(!application || !application->client || !profile_name) { - return NULL; - } - - profile = mrcp_client_profile_get(application->client,profile_name); - if(!profile) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Profile [%s]",profile_name); - return NULL; - } - - session = mrcp_client_session_create(application->client); - if(!session) { - return NULL; - } - session->application = application; - session->app_obj = obj; - session->base.log_obj = obj; - session->profile = profile; - - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Create MRCP Handle "APT_PTR_FMT" [%s]", - MRCP_SESSION_PTR(session), - profile_name); - return &session->base; -} - -/** Get memory pool the session object is created out of */ -MRCP_DECLARE(apr_pool_t*) mrcp_application_session_pool_get(const mrcp_session_t *session) -{ - if(!session) { - return NULL; - } - return session->pool; -} - -/** Get session identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_application_session_id_get(const mrcp_session_t *session) -{ - if(!session) { - return NULL; - } - return &session->id; -} - -/** Get SIP or RTSP response code */ -MRCP_DECLARE(int) mrcp_application_session_response_code_get(const mrcp_session_t *session) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(!client_session || !client_session->answer) { - return 0; - } - return client_session->answer->response_code; -} - -/** Get external object associated with the session */ -MRCP_DECLARE(void*) mrcp_application_session_object_get(const mrcp_session_t *session) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(!client_session) { - return NULL; - } - return client_session->app_obj; -} - -/** Set (associate) external object to the session */ -MRCP_DECLARE(void) mrcp_application_session_object_set(mrcp_session_t *session, void *obj) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(client_session) { - client_session->app_obj = obj; - } -} - -/** Set name of the session (informative only used for debugging) */ -MRCP_DECLARE(void) mrcp_application_session_name_set(mrcp_session_t *session, const char *name) -{ - if(session && name) { - session->name = apr_pstrdup(session->pool,name); - } -} - - -/** Send session update request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_update(mrcp_session_t *session) -{ - if(!session) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_SESSION_UPDATE,session,NULL); -} - -/** Send session termination request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_terminate(mrcp_session_t *session) -{ - if(!session) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_SESSION_TERMINATE,session,NULL); -} - -/** Destroy client session (session must be terminated prior to destroy) */ -MRCP_DECLARE(apt_bool_t) mrcp_application_session_destroy(mrcp_session_t *session) -{ - if(!session) { - return FALSE; - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->log_obj,"Destroy MRCP Handle %s",session->name); - mrcp_session_destroy(session); - return TRUE; -} - - -/** Create control channel */ -MRCP_DECLARE(mrcp_channel_t*) mrcp_application_channel_create( - mrcp_session_t *session, - mrcp_resource_id resource_id, - mpf_termination_t *termination, - mpf_rtp_termination_descriptor_t *rtp_descriptor, - void *obj) -{ - mrcp_resource_t *resource; - mrcp_client_profile_t *profile; - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(!client_session || !client_session->profile) { - /* Invalid params */ - return FALSE; - } - profile = client_session->profile; - - if(!profile->resource_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: invalid profile"); - return FALSE; - } - resource = mrcp_resource_get(profile->resource_factory,resource_id); - if(!resource) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: no such resource"); - return FALSE; - } - - if(termination) { - /* Media engine and RTP factory must be specified in this case */ - if(!profile->mpf_factory || !profile->rtp_termination_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: invalid profile"); - return FALSE; - } - } - else { - /* Either termination or rtp_descriptor must be specified */ - if(!rtp_descriptor) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Channel: missing both termination and RTP descriptor"); - return FALSE; - } - } - - return mrcp_client_channel_create(client_session,resource,termination,rtp_descriptor,obj); -} - -/** Get external object associated with the channel */ -MRCP_DECLARE(void*) mrcp_application_channel_object_get(const mrcp_channel_t *channel) -{ - if(!channel) { - return FALSE; - } - return channel->obj; -} - -/** Get RTP termination descriptor */ -MRCP_DECLARE(mpf_rtp_termination_descriptor_t*) mrcp_application_rtp_descriptor_get(const mrcp_channel_t *channel) -{ - if(!channel || !channel->rtp_termination_slot) { - return NULL; - } - return channel->rtp_termination_slot->descriptor; -} - -/** Get codec descriptor of source stream */ -MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_source_descriptor_get(const mrcp_channel_t *channel) -{ - mpf_audio_stream_t *audio_stream; - if(!channel || !channel->termination) { - return NULL; - } - audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(!audio_stream) { - return NULL; - } - return audio_stream->rx_descriptor; -} - -/** Get codec descriptor of sink stream */ -MRCP_DECLARE(const mpf_codec_descriptor_t*) mrcp_application_sink_descriptor_get(const mrcp_channel_t *channel) -{ - mpf_audio_stream_t *audio_stream; - if(!channel || !channel->termination) { - return NULL; - } - audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(!audio_stream) { - return NULL; - } - return audio_stream->tx_descriptor; -} - -/** Get associated audio stream */ -MRCP_DECLARE(const mpf_audio_stream_t*) mrcp_application_audio_stream_get(const mrcp_channel_t *channel) -{ - if(!channel || !channel->termination) { - return NULL; - } - - return mpf_termination_audio_stream_get(channel->termination); -} - -/** Send channel add request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_channel_add(mrcp_session_t *session, mrcp_channel_t *channel) -{ - if(!session || !channel) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_CHANNEL_ADD,session,channel); -} - -/** Send channel removal request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_channel_remove(mrcp_session_t *session, mrcp_channel_t *channel) -{ - if(!session || !channel) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_CHANNEL_REMOVE,session,channel); -} - -/** Send resource discovery request */ -MRCP_DECLARE(apt_bool_t) mrcp_application_resource_discover(mrcp_session_t *session) -{ - if(!session) { - return FALSE; - } - return mrcp_app_signaling_task_msg_signal(MRCP_SIG_COMMAND_RESOURCE_DISCOVER,session,NULL); -} - -/** Create MRCP message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_application_message_create(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_method_id method_id) -{ - mrcp_message_t *mrcp_message; - mrcp_client_profile_t *profile; - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - if(!client_session || !channel || !channel->resource) { - return NULL; - } - profile = client_session->profile; - if(!profile || !profile->resource_factory) { - return NULL; - } - mrcp_message = mrcp_request_create( - channel->resource, - profile->mrcp_version, - method_id, - session->pool); - return mrcp_message; -} - -/** Send MRCP message */ -MRCP_DECLARE(apt_bool_t) mrcp_application_message_send(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!session || !channel || !message) { - return FALSE; - } - return mrcp_app_control_task_msg_signal(session,channel,message); -} - -/** Create audio termination */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_audio_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_stream_capabilities_t *capabilities, - void *obj) -{ - mpf_audio_stream_t *audio_stream; - - if(!capabilities) { - return NULL; - } - - if(mpf_codec_capabilities_validate(&capabilities->codecs) == FALSE) { - return NULL; - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - session->pool); /* memory pool to allocate memory from */ - if(!audio_stream) { - return NULL; - } - - /* create raw termination */ - return mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - session->pool); /* memory pool to allocate memory from */ -} - -/** Create source media termination */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_source_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_codec_descriptor_t *codec_descriptor, - void *obj) -{ - mpf_stream_capabilities_t *capabilities; - mpf_audio_stream_t *audio_stream; - - capabilities = mpf_source_stream_capabilities_create(session->pool); - if(codec_descriptor) { - mpf_codec_capabilities_add( - &capabilities->codecs, - mpf_sample_rate_mask_get(codec_descriptor->sampling_rate), - codec_descriptor->name.buf); - } - else { - mpf_codec_default_capabilities_add(&capabilities->codecs); - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - session->pool); /* memory pool to allocate memory from */ - - if(!audio_stream) { - return NULL; - } - - audio_stream->rx_descriptor = codec_descriptor; - - /* create raw termination */ - return mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - session->pool); /* memory pool to allocate memory from */ -} - -/** Create sink media termination */ -MRCP_DECLARE(mpf_termination_t*) mrcp_application_sink_termination_create( - mrcp_session_t *session, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_codec_descriptor_t *codec_descriptor, - void *obj) -{ - mpf_stream_capabilities_t *capabilities; - mpf_audio_stream_t *audio_stream; - - capabilities = mpf_sink_stream_capabilities_create(session->pool); - if(codec_descriptor) { - mpf_codec_capabilities_add( - &capabilities->codecs, - mpf_sample_rate_mask_get(codec_descriptor->sampling_rate), - codec_descriptor->name.buf); - } - else { - mpf_codec_default_capabilities_add(&capabilities->codecs); - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - session->pool); /* memory pool to allocate memory from */ - if(!audio_stream) { - return NULL; - } - - audio_stream->tx_descriptor = codec_descriptor; - - /* create raw termination */ - return mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - session->pool); /* memory pool to allocate memory from */ -} - -/** Dispatch application message */ -MRCP_DECLARE(apt_bool_t) mrcp_application_message_dispatch(const mrcp_app_message_dispatcher_t *dispatcher, const mrcp_app_message_t *app_message) -{ - apt_bool_t status = FALSE; - switch(app_message->message_type) { - case MRCP_APP_MESSAGE_TYPE_SIGNALING: - { - if(app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_RESPONSE) { - switch(app_message->sig_message.command_id) { - case MRCP_SIG_COMMAND_SESSION_UPDATE: - if(dispatcher->on_session_update) { - status = dispatcher->on_session_update( - app_message->application, - app_message->session, - app_message->sig_message.status); - } - break; - case MRCP_SIG_COMMAND_SESSION_TERMINATE: - if(dispatcher->on_session_terminate) { - status = dispatcher->on_session_terminate( - app_message->application, - app_message->session, - app_message->sig_message.status); - } - break; - case MRCP_SIG_COMMAND_CHANNEL_ADD: - if(dispatcher->on_channel_add) { - status = dispatcher->on_channel_add( - app_message->application, - app_message->session, - app_message->channel, - app_message->sig_message.status); - } - break; - case MRCP_SIG_COMMAND_CHANNEL_REMOVE: - if(dispatcher->on_channel_remove) { - status = dispatcher->on_channel_remove( - app_message->application, - app_message->session, - app_message->channel, - app_message->sig_message.status); - } - break; - case MRCP_SIG_COMMAND_RESOURCE_DISCOVER: - if(dispatcher->on_resource_discover) { - status = dispatcher->on_resource_discover( - app_message->application, - app_message->session, - app_message->descriptor, - app_message->sig_message.status); - } - break; - default: - break; - } - } - else if(app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_EVENT) { - switch(app_message->sig_message.event_id) { - case MRCP_SIG_EVENT_TERMINATE: - if(dispatcher->on_terminate_event) { - status = dispatcher->on_terminate_event( - app_message->application, - app_message->session, - app_message->channel); - } - break; - default: - break; - } - } - break; - } - case MRCP_APP_MESSAGE_TYPE_CONTROL: - { - if(dispatcher->on_message_receive) { - status = dispatcher->on_message_receive( - app_message->application, - app_message->session, - app_message->channel, - app_message->control_message); - } - break; - } - } - return status; -} diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c deleted file mode 100644 index 0212ff8a86..0000000000 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_client.c +++ /dev/null @@ -1,989 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_client.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#include -#include -#include "mrcp_client.h" -#include "mrcp_sig_agent.h" -#include "mrcp_client_session.h" -#include "mrcp_client_connection.h" -#include "mrcp_ca_factory.h" -#include "mpf_engine_factory.h" -#include "apt_consumer_task.h" -#include "apt_pool.h" -#include "apt_log.h" - -#define CLIENT_TASK_NAME "MRCP Client" - -/** MRCP client */ -struct mrcp_client_t { - /** Main message processing task */ - apt_consumer_task_t *task; - - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** Codec manager */ - mpf_codec_manager_t *codec_manager; - /** Table of media processing engines (mpf_engine_t*) */ - apr_hash_t *media_engine_table; - /** Table of RTP termination factories (mpf_termination_factory_t*) */ - apr_hash_t *rtp_factory_table; - /** Table of signaling agents (mrcp_sig_agent_t*) */ - apr_hash_t *sig_agent_table; - /** Table of signaling settings (mrcp_sig_settings_t*) */ - apr_hash_t *sig_settings_table; - /** Table of connection agents (mrcp_connection_agent_t*) */ - apr_hash_t *cnt_agent_table; - /** Table of RTP settings (mpf_rtp_settings_t*) */ - apr_hash_t *rtp_settings_table; - /** Table of profiles (mrcp_client_profile_t*) */ - apr_hash_t *profile_table; - - /** Table of applications (mrcp_application_t*) */ - apr_hash_t *app_table; - - /** Table of sessions/handles */ - apr_hash_t *session_table; - - /** Connection task message pool */ - apt_task_msg_pool_t *cnt_msg_pool; - - /** Event handler used in case of async start */ - mrcp_client_handler_f on_start_complete; - /** Wait object used in case of synch start */ - apr_thread_cond_t *sync_start_object; - /** Mutex to protect sync start routine */ - apr_thread_mutex_t *sync_start_mutex; - - /** Dir layout structure */ - apt_dir_layout_t *dir_layout; - /** Memory pool */ - apr_pool_t *pool; -}; - - -typedef enum { - MRCP_CLIENT_SIGNALING_TASK_MSG = TASK_MSG_USER, - MRCP_CLIENT_CONNECTION_TASK_MSG, - MRCP_CLIENT_MEDIA_TASK_MSG, - MRCP_CLIENT_APPLICATION_TASK_MSG -} mrcp_client_task_msg_type_e; - -/* Signaling agent interface */ -typedef enum { - SIG_AGENT_TASK_MSG_ANSWER, - SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE, - SIG_AGENT_TASK_MSG_CONTROL_RESPONSE, - SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE, - SIG_AGENT_TASK_MSG_TERMINATE_EVENT -} sig_agent_task_msg_type_e; - -typedef struct sig_agent_task_msg_data_t sig_agent_task_msg_data_t; -struct sig_agent_task_msg_data_t { - mrcp_client_session_t *session; - mrcp_session_descriptor_t *descriptor; - mrcp_message_t *message; -}; - -static apt_bool_t mrcp_client_answer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_client_terminate_response_signal(mrcp_session_t *session); -static apt_bool_t mrcp_client_control_response_signal(mrcp_session_t *session, mrcp_message_t *message); -static apt_bool_t mrcp_client_discover_response_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); - -static apt_bool_t mrcp_client_terminate_event_signal(mrcp_session_t *session); - -static const mrcp_session_response_vtable_t session_response_vtable = { - mrcp_client_answer_signal, - mrcp_client_terminate_response_signal, - mrcp_client_control_response_signal, - mrcp_client_discover_response_signal -}; - -static const mrcp_session_event_vtable_t session_event_vtable = { - mrcp_client_terminate_event_signal -}; - -/* Connection agent interface */ -typedef enum { - CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL, - CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL, - CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL, - CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE, - CONNECTION_AGENT_TASK_MSG_DISCONNECT -} connection_agent_task_msg_type_e ; - -typedef struct connection_agent_task_msg_data_t connection_agent_task_msg_data_t; -struct connection_agent_task_msg_data_t { - mrcp_channel_t *channel; - mrcp_control_descriptor_t *descriptor; - mrcp_message_t *message; - apt_bool_t status; -}; - -static apt_bool_t mrcp_client_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -static apt_bool_t mrcp_client_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -static apt_bool_t mrcp_client_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status); -static apt_bool_t mrcp_client_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message); -static apt_bool_t mrcp_client_disconnect_signal(mrcp_control_channel_t *channel); - -static const mrcp_connection_event_vtable_t connection_method_vtable = { - mrcp_client_channel_add_signal, - mrcp_client_channel_modify_signal, - mrcp_client_channel_remove_signal, - mrcp_client_message_signal, - mrcp_client_disconnect_signal -}; - -/* Task interface */ -static void mrcp_client_on_start_complete(apt_task_t *task); -static void mrcp_client_on_terminate_complete(apt_task_t *task); -static apt_bool_t mrcp_client_msg_process(apt_task_t *task, apt_task_msg_t *msg); - - -/** Create MRCP client instance */ -MRCP_DECLARE(mrcp_client_t*) mrcp_client_create(apt_dir_layout_t *dir_layout) -{ - mrcp_client_t *client; - apr_pool_t *pool; - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - pool = apt_pool_create(); - if(!pool) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "CLIENT_TASK_NAME); - client = apr_palloc(pool,sizeof(mrcp_client_t)); - client->pool = pool; - client->dir_layout = dir_layout; - client->resource_factory = NULL; - client->media_engine_table = NULL; - client->rtp_factory_table = NULL; - client->sig_agent_table = NULL; - client->sig_settings_table = NULL; - client->cnt_agent_table = NULL; - client->rtp_settings_table = NULL; - client->profile_table = NULL; - client->app_table = NULL; - client->session_table = NULL; - client->cnt_msg_pool = NULL; - - msg_pool = apt_task_msg_pool_create_dynamic(0,pool); - client->task = apt_consumer_task_create(client,msg_pool,pool); - if(!client->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Client Task"); - return NULL; - } - task = apt_consumer_task_base_get(client->task); - apt_task_name_set(task,CLIENT_TASK_NAME); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = mrcp_client_msg_process; - vtable->on_start_complete = mrcp_client_on_start_complete; - vtable->on_terminate_complete = mrcp_client_on_terminate_complete; - } - - client->media_engine_table = apr_hash_make(client->pool); - client->rtp_factory_table = apr_hash_make(client->pool); - client->sig_agent_table = apr_hash_make(client->pool); - client->sig_settings_table = apr_hash_make(client->pool); - client->cnt_agent_table = apr_hash_make(client->pool); - client->rtp_settings_table = apr_hash_make(client->pool); - client->profile_table = apr_hash_make(client->pool); - client->app_table = apr_hash_make(client->pool); - - client->session_table = apr_hash_make(client->pool); - - client->on_start_complete = NULL; - client->sync_start_object = NULL; - client->sync_start_mutex = NULL; - return client; -} - -/** Set asynchronous start mode */ -MRCP_DECLARE(void) mrcp_client_async_start_set(mrcp_client_t *client, mrcp_client_handler_f handler) -{ - if(client) { - client->on_start_complete = handler; - } -} - -/** Start message processing loop */ -MRCP_DECLARE(apt_bool_t) mrcp_client_start(mrcp_client_t *client) -{ - apt_bool_t sync_start = TRUE; - apt_task_t *task; - if(!client || !client->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client"); - return FALSE; - } - task = apt_consumer_task_base_get(client->task); - - if(client->on_start_complete) { - sync_start = FALSE; - } - - if(sync_start == TRUE) { - /* get prepared to start stack synchronously */ - apr_thread_mutex_create(&client->sync_start_mutex,APR_THREAD_MUTEX_DEFAULT,client->pool); - apr_thread_cond_create(&client->sync_start_object,client->pool); - - apr_thread_mutex_lock(client->sync_start_mutex); - } - - if(apt_task_start(task) == FALSE) { - if(sync_start == TRUE) { - apr_thread_mutex_unlock(client->sync_start_mutex); - } - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Client Task"); - return FALSE; - } - - if(sync_start == TRUE) { - /* wait for start complete */ - apr_thread_cond_wait(client->sync_start_object,client->sync_start_mutex); - apr_thread_mutex_unlock(client->sync_start_mutex); - } - - return TRUE; -} - -/** Shutdown message processing loop */ -MRCP_DECLARE(apt_bool_t) mrcp_client_shutdown(mrcp_client_t *client) -{ - apt_task_t *task; - if(!client || !client->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client"); - return FALSE; - } - task = apt_consumer_task_base_get(client->task); - if(apt_task_terminate(task,TRUE) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Shutdown Client Task"); - return FALSE; - } - client->session_table = NULL; - - if(client->sync_start_object) { - apr_thread_cond_destroy(client->sync_start_object); - client->sync_start_object = NULL; - } - if(client->sync_start_mutex) { - apr_thread_mutex_destroy(client->sync_start_mutex); - client->sync_start_mutex = NULL; - } - - return TRUE; -} - -/** Destroy MRCP client */ -MRCP_DECLARE(apt_bool_t) mrcp_client_destroy(mrcp_client_t *client) -{ - apt_task_t *task; - if(!client || !client->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Client"); - return FALSE; - } - task = apt_consumer_task_base_get(client->task); - apt_task_destroy(task); - - apr_pool_destroy(client->pool); - return TRUE; -} - - -/** Register MRCP resource factory */ -MRCP_DECLARE(apt_bool_t) mrcp_client_resource_factory_register(mrcp_client_t *client, mrcp_resource_factory_t *resource_factory) -{ - if(!resource_factory) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Factory"); - client->resource_factory = resource_factory; - return TRUE; -} - -/** Register codec manager */ -MRCP_DECLARE(apt_bool_t) mrcp_client_codec_manager_register(mrcp_client_t *client, mpf_codec_manager_t *codec_manager) -{ - if(!codec_manager) { - return FALSE; - } - client->codec_manager = codec_manager; - return TRUE; -} - -/** Get registered codec manager */ -MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_client_codec_manager_get(const mrcp_client_t *client) -{ - return client->codec_manager; -} - -/** Register media engine */ -MRCP_DECLARE(apt_bool_t) mrcp_client_media_engine_register(mrcp_client_t *client, mpf_engine_t *media_engine) -{ - const char *id; - if(!media_engine) { - return FALSE; - } - id = mpf_engine_id_get(media_engine); - if(!id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Media Engine [%s]",id); - mpf_engine_codec_manager_register(media_engine,client->codec_manager); - apr_hash_set(client->media_engine_table,id,APR_HASH_KEY_STRING,media_engine); - mpf_engine_task_msg_type_set(media_engine,MRCP_CLIENT_MEDIA_TASK_MSG); - if(client->task) { - apt_task_t *media_task = mpf_task_get(media_engine); - apt_task_t *task = apt_consumer_task_base_get(client->task); - apt_task_add(task,media_task); - } - return TRUE; -} - -/** Get media engine by name */ -MRCP_DECLARE(mpf_engine_t*) mrcp_client_media_engine_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->media_engine_table,name,APR_HASH_KEY_STRING); -} - -/** Register RTP termination factory */ -MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_factory_register(mrcp_client_t *client, mpf_termination_factory_t *rtp_termination_factory, const char *name) -{ - if(!rtp_termination_factory || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Termination Factory [%s]",name); - apr_hash_set(client->rtp_factory_table,name,APR_HASH_KEY_STRING,rtp_termination_factory); - return TRUE; -} - -/** Get RTP termination factory by name */ -MRCP_DECLARE(mpf_termination_factory_t*) mrcp_client_rtp_factory_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->rtp_factory_table,name,APR_HASH_KEY_STRING); -} - -/** Register RTP settings */ -MRCP_DECLARE(apt_bool_t) mrcp_client_rtp_settings_register(mrcp_client_t *client, mpf_rtp_settings_t *rtp_settings, const char *name) -{ - if(!rtp_settings || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Settings [%s]",name); - apr_hash_set(client->rtp_settings_table,name,APR_HASH_KEY_STRING,rtp_settings); - return TRUE; -} - -/** Get RTP settings by name */ -MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_client_rtp_settings_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->rtp_settings_table,name,APR_HASH_KEY_STRING); -} - -/** Register MRCP signaling agent */ -MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_agent_register(mrcp_client_t *client, mrcp_sig_agent_t *signaling_agent) -{ - if(!signaling_agent || !signaling_agent->id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Agent [%s]",signaling_agent->id); - signaling_agent->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sig_agent_task_msg_data_t),client->pool); - signaling_agent->parent = client; - signaling_agent->resource_factory = client->resource_factory; - apr_hash_set(client->sig_agent_table,signaling_agent->id,APR_HASH_KEY_STRING,signaling_agent); - if(client->task) { - apt_task_t *task = apt_consumer_task_base_get(client->task); - apt_task_add(task,signaling_agent->task); - } - return TRUE; -} - -/** Get signaling agent by name */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_client_signaling_agent_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->sig_agent_table,name,APR_HASH_KEY_STRING); -} - -/** Register MRCP signaling settings */ -MRCP_DECLARE(apt_bool_t) mrcp_client_signaling_settings_register(mrcp_client_t *client, mrcp_sig_settings_t *signaling_settings, const char *name) -{ - if(!signaling_settings || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Settings [%s]",name); - apr_hash_set(client->sig_settings_table,name,APR_HASH_KEY_STRING,signaling_settings); - return TRUE; -} - -/** Get signaling settings by name */ -MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_client_signaling_settings_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->sig_settings_table,name,APR_HASH_KEY_STRING); -} - - -/** Register MRCP connection agent (MRCPv2 only) */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_register(mrcp_client_t *client, mrcp_connection_agent_t *connection_agent) -{ - const char *id; - if(!connection_agent) { - return FALSE; - } - id = mrcp_client_connection_agent_id_get(connection_agent); - if(!id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Connection Agent [%s]",id); - mrcp_client_connection_resource_factory_set(connection_agent,client->resource_factory); - mrcp_client_connection_agent_handler_set(connection_agent,client,&connection_method_vtable); - client->cnt_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_agent_task_msg_data_t),client->pool); - apr_hash_set(client->cnt_agent_table,id,APR_HASH_KEY_STRING,connection_agent); - if(client->task) { - apt_task_t *task = apt_consumer_task_base_get(client->task); - apt_task_t *connection_task = mrcp_client_connection_agent_task_get(connection_agent); - apt_task_add(task,connection_task); - } - return TRUE; -} - -/** Get connection agent by name */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->cnt_agent_table,name,APR_HASH_KEY_STRING); -} - -/** Create MRCP profile */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create( - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool) -{ - mrcp_sa_factory_t *sa_factory = NULL; - mrcp_ca_factory_t *ca_factory = NULL; - mpf_engine_factory_t *mpf_factory = NULL; - mrcp_version_e mrcp_version = MRCP_VERSION_2; - if(!connection_agent) - mrcp_version = MRCP_VERSION_1; - - if(signaling_agent) { - sa_factory = mrcp_sa_factory_create(pool); - mrcp_sa_factory_agent_add(sa_factory,signaling_agent); - } - - if(connection_agent) { - ca_factory = mrcp_ca_factory_create(pool); - mrcp_ca_factory_agent_add(ca_factory,connection_agent); - } - - if(media_engine) { - mpf_factory = mpf_engine_factory_create(pool); - mpf_engine_factory_engine_add(mpf_factory,media_engine); - } - - return mrcp_client_profile_create_ex( - mrcp_version, - resource_factory, - sa_factory, - ca_factory, - mpf_factory, - rtp_factory, - rtp_settings, - signaling_settings, - pool); -} - -/** Create MRCP profile (extended version) */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_create_ex( - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sa_factory_t *sa_factory, - mrcp_ca_factory_t *ca_factory, - mpf_engine_factory_t *mpf_factory, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - mrcp_sig_settings_t *signaling_settings, - apr_pool_t *pool) -{ - mrcp_client_profile_t *profile = apr_palloc(pool,sizeof(mrcp_client_profile_t)); - profile->name = NULL; - profile->tag = NULL; - profile->mrcp_version = mrcp_version; - profile->resource_factory = resource_factory; - profile->mpf_factory = mpf_factory; - profile->rtp_termination_factory = rtp_factory; - profile->rtp_settings = rtp_settings; - profile->sa_factory = sa_factory; - profile->ca_factory = ca_factory; - profile->signaling_settings = signaling_settings; - - if(mpf_factory && rtp_factory) - mpf_engine_factory_rtp_factory_assign(mpf_factory,rtp_factory); - return profile; -} - -/** Set a tag to the profile */ -MRCP_DECLARE(void) mrcp_client_profile_tag_set(mrcp_client_profile_t *profile, const char *tag) -{ - if(profile) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Profile Tag [%s]",tag); - profile->tag = tag; - } -} - -/** Register MRCP profile */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profile_register(mrcp_client_t *client, mrcp_client_profile_t *profile, const char *name) -{ - if(!profile || !name) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name"); - return FALSE; - } - if(!profile->resource_factory) { - profile->resource_factory = client->resource_factory; - } - if(!profile->sa_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling agent factory",name); - return FALSE; - } - if(mrcp_sa_factory_is_empty(profile->sa_factory) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty signaling agent factory",name); - return FALSE; - } - if(profile->mrcp_version == MRCP_VERSION_2) { - if(!profile->ca_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing connection agent factory",name); - return FALSE; - } - if(mrcp_ca_factory_is_empty(profile->ca_factory) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty connection agent factory",name); - return FALSE; - } - } - - /* mpf_factory may not be specified; but if it is specified, it must not be empty */ - if(profile->mpf_factory) { - if(mpf_engine_factory_is_empty(profile->mpf_factory) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: empty media engine factory",name); - return FALSE; - } - } - - if(!profile->signaling_settings) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling settings",name); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Profile [%s]",name); - apr_hash_set(client->profile_table,name,APR_HASH_KEY_STRING,profile); - profile->name = name; - return TRUE; -} - -/** Get profile by name */ -MRCP_DECLARE(mrcp_client_profile_t*) mrcp_client_profile_get(const mrcp_client_t *client, const char *name) -{ - return apr_hash_get(client->profile_table,name,APR_HASH_KEY_STRING); -} - -/** Get available profiles */ -MRCP_DECLARE(apt_bool_t) mrcp_client_profiles_get(const mrcp_client_t *client, mrcp_client_profile_t *profiles[], apr_size_t *count, const char *tag) -{ - apr_hash_index_t *it; - void *val; - mrcp_client_profile_t *profile; - apr_size_t i = 0; - apt_bool_t status = TRUE; - - if(!profiles || !count) { - return FALSE; - } - - for(it = apr_hash_first(client->pool, client->profile_table); it; it = apr_hash_next(it)) { - apr_hash_this(it, NULL, NULL, &val); - if(!val) continue; - - if(i >= *count) { - status = FALSE; - break; - } - - profile = val; - if(!tag || (profile->tag && strcasecmp(tag,profile->tag) == 0)) { - profiles[i] = profile; - i++; - } - } - *count = i; - return status; -} - -/** Register MRCP application */ -MRCP_DECLARE(apt_bool_t) mrcp_client_application_register(mrcp_client_t *client, mrcp_application_t *application, const char *name) -{ - if(!application || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Application [%s]",name); - application->client = client; - application->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mrcp_app_message_t*),client->pool); - apr_hash_set(client->app_table,name,APR_HASH_KEY_STRING,application); - return TRUE; -} - -/** Get memory pool */ -MRCP_DECLARE(apr_pool_t*) mrcp_client_memory_pool_get(const mrcp_client_t *client) -{ - return client->pool; -} - -/** Get directory layout */ -MRCP_DECLARE(apt_dir_layout_t*) mrcp_client_dir_layout_get(const mrcp_client_t *client) -{ - return client->dir_layout; -} - -mrcp_client_session_t* mrcp_client_session_create(mrcp_client_t *client) -{ - apr_pool_t *pool; - mrcp_client_session_t *session = (mrcp_client_session_t*) mrcp_session_create(sizeof(mrcp_client_session_t)-sizeof(mrcp_session_t)); - - pool = session->base.pool; - session->base.name = apr_psprintf(pool,"0x%pp",session); - session->base.response_vtable = &session_response_vtable; - session->base.event_vtable = &session_event_vtable; - - session->application = NULL; - session->app_obj = NULL; - session->profile = NULL; - session->context = NULL; - session->codec_manager = client->codec_manager; - session->terminations = apr_array_make(pool,2,sizeof(rtp_termination_slot_t)); - session->channels = apr_array_make(pool,2,sizeof(mrcp_channel_t*)); - session->registered = FALSE; - session->offer = NULL; - session->answer = NULL; - session->active_request = NULL; - session->request_queue = apt_list_create(pool); - session->mpf_task_msg = NULL; - session->subrequest_count = 0; - session->disconnected = FALSE; - session->state = SESSION_STATE_NONE; - session->status = MRCP_SIG_STATUS_CODE_SUCCESS; - return session; -} - -void mrcp_client_session_add(mrcp_client_t *client, mrcp_client_session_t *session) -{ - if(session) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Add MRCP Handle "APT_NAMESID_FMT, - session->base.name, - MRCP_SESSION_SID(&session->base)); - apr_hash_set(client->session_table,session,sizeof(void*),session); - } -} - -void mrcp_client_session_remove(mrcp_client_t *client, mrcp_client_session_t *session) -{ - if(session) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Remove MRCP Handle "APT_NAMESID_FMT, - session->base.name, - MRCP_SESSION_SID(&session->base)); - apr_hash_set(client->session_table,session,sizeof(void*),NULL); - } -} - -static void mrcp_client_on_start_complete(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_client_t *client = apt_consumer_task_object_get(consumer_task); - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,CLIENT_TASK_NAME" Started"); - if(client->on_start_complete) { - /* async start */ - client->on_start_complete(TRUE); - } - else { - /* sync start */ - apr_thread_mutex_lock(client->sync_start_mutex); - apr_thread_cond_signal(client->sync_start_object); - apr_thread_mutex_unlock(client->sync_start_mutex); - } -} - -static void mrcp_client_on_terminate_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,CLIENT_TASK_NAME" Terminated"); -} - - -static apt_bool_t mrcp_client_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_client_t *client = apt_consumer_task_object_get(consumer_task); - if(!client) { - return FALSE; - } - switch(msg->type) { - case MRCP_CLIENT_SIGNALING_TASK_MSG: - { - const sig_agent_task_msg_data_t *sig_message = (const sig_agent_task_msg_data_t*)msg->data; - switch(msg->sub_type) { - case SIG_AGENT_TASK_MSG_ANSWER: - mrcp_client_session_answer_process(sig_message->session,sig_message->descriptor); - break; - case SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE: - mrcp_client_session_terminate_response_process(sig_message->session); - break; - case SIG_AGENT_TASK_MSG_CONTROL_RESPONSE: - mrcp_client_session_control_response_process(sig_message->session,sig_message->message); - break; - case SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE: - mrcp_client_session_discover_response_process(sig_message->session,sig_message->descriptor); - break; - case SIG_AGENT_TASK_MSG_TERMINATE_EVENT: - mrcp_client_session_terminate_event_process(sig_message->session); - break; - default: - break; - } - break; - } - case MRCP_CLIENT_CONNECTION_TASK_MSG: - { - const connection_agent_task_msg_data_t *data = (const connection_agent_task_msg_data_t*)msg->data; - switch(msg->sub_type) { - case CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL: - mrcp_client_on_channel_add(data->channel,data->descriptor,data->status); - break; - case CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL: - mrcp_client_on_channel_modify(data->channel,data->descriptor,data->status); - break; - case CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL: - mrcp_client_on_channel_remove(data->channel,data->status); - break; - case CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE: - mrcp_client_on_message_receive(data->channel,data->message); - break; - case CONNECTION_AGENT_TASK_MSG_DISCONNECT: - mrcp_client_on_disconnect(data->channel); - break; - default: - break; - } - break; - } - case MRCP_CLIENT_MEDIA_TASK_MSG: - { - mpf_message_container_t *container = (mpf_message_container_t*) msg->data; - mrcp_client_mpf_message_process(container); - break; - } - case MRCP_CLIENT_APPLICATION_TASK_MSG: - { - mrcp_app_message_t **app_message = (mrcp_app_message_t**) msg->data; - mrcp_client_app_message_process(*app_message); - break; - } - default: - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Task Message Received [%d;%d]", msg->type,msg->sub_type); - break; - } - } - return TRUE; -} - -apt_bool_t mrcp_app_signaling_task_msg_signal(mrcp_sig_command_e command_id, mrcp_session_t *session, mrcp_channel_t *channel) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - mrcp_application_t *application = client_session->application; - apt_task_t *task = apt_consumer_task_base_get(application->client->task); - apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool); - if(task_msg) { - mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data); - mrcp_app_message_t *app_message; - task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG; - - app_message = mrcp_client_app_signaling_request_create(command_id,session->pool); - app_message->application = client_session->application; - app_message->session = session; - app_message->channel = channel; - app_message->control_message = NULL; - app_message->descriptor = NULL; - *slot = app_message; - return apt_task_msg_signal(task,task_msg); - } - return FALSE; -} - -apt_bool_t mrcp_app_control_task_msg_signal(mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - mrcp_client_session_t *client_session = (mrcp_client_session_t*)session; - mrcp_application_t *application = client_session->application; - apt_task_t *task = apt_consumer_task_base_get(application->client->task); - apt_task_msg_t *task_msg = apt_task_msg_acquire(application->msg_pool); - if(task_msg) { - mrcp_app_message_t **slot = ((mrcp_app_message_t**)task_msg->data); - mrcp_app_message_t *app_message; - task_msg->type = MRCP_CLIENT_APPLICATION_TASK_MSG; - - app_message = mrcp_client_app_control_message_create(session->pool); - app_message->application = client_session->application; - app_message->session = session; - app_message->channel = channel; - app_message->control_message = message; - *slot = app_message; - return apt_task_msg_signal(task,task_msg); - } - return FALSE; -} - -static apt_bool_t mrcp_client_signaling_task_msg_signal(sig_agent_task_msg_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message) -{ - sig_agent_task_msg_data_t *data; - apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool); - if(task_msg) { - task_msg->type = MRCP_CLIENT_SIGNALING_TASK_MSG; - task_msg->sub_type = type; - data = (sig_agent_task_msg_data_t*) task_msg->data; - data->session = (mrcp_client_session_t*)session; - data->descriptor = descriptor; - data->message = message; - return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg); - } - return FALSE; -} - -static apt_bool_t mrcp_client_connection_task_msg_signal( - connection_agent_task_msg_type_e type, - mrcp_connection_agent_t *agent, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - mrcp_message_t *message, - apt_bool_t status) -{ - apt_task_t *task; - apt_task_msg_t *task_msg; - connection_agent_task_msg_data_t *data; - mrcp_client_t *client = mrcp_client_connection_agent_object_get(agent); - if(!client || !client->cnt_msg_pool) { - return FALSE; - } - task = apt_consumer_task_base_get(client->task); - task_msg = apt_task_msg_acquire(client->cnt_msg_pool); - if(task_msg) { - task_msg->type = MRCP_CLIENT_CONNECTION_TASK_MSG; - task_msg->sub_type = type; - data = (connection_agent_task_msg_data_t*) task_msg->data; - data->channel = channel ? channel->obj : NULL; - data->descriptor = descriptor; - data->message = message; - data->status = status; - return apt_task_msg_signal(task,task_msg); - } - return FALSE; -} - - -static apt_bool_t mrcp_client_answer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_ANSWER,session,descriptor,NULL); -} - -static apt_bool_t mrcp_client_terminate_response_signal(mrcp_session_t *session) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_TERMINATE_RESPONSE,session,NULL,NULL); -} - -static apt_bool_t mrcp_client_control_response_signal(mrcp_session_t *session, mrcp_message_t *message) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_CONTROL_RESPONSE,session,NULL,message); -} - -static apt_bool_t mrcp_client_discover_response_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_DISCOVER_RESPONSE,session,descriptor,NULL); -} - -static apt_bool_t mrcp_client_terminate_event_signal(mrcp_session_t *session) -{ - return mrcp_client_signaling_task_msg_signal(SIG_AGENT_TASK_MSG_TERMINATE_EVENT,session,NULL,NULL); -} - - -static apt_bool_t mrcp_client_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL, - channel->agent, - channel, - descriptor, - NULL, - status); -} - -static apt_bool_t mrcp_client_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL, - channel->agent, - channel, - descriptor, - NULL, - status); -} - -static apt_bool_t mrcp_client_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL, - channel->agent, - channel, - NULL, - NULL, - status); -} - -static apt_bool_t mrcp_client_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *mrcp_message) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE, - channel->agent, - channel, - NULL, - mrcp_message, - TRUE); -} - -static apt_bool_t mrcp_client_disconnect_signal(mrcp_control_channel_t *channel) -{ - return mrcp_client_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_DISCONNECT, - channel->agent, - channel, - NULL, - NULL, - TRUE); -} diff --git a/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c b/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c deleted file mode 100644 index 851e7ffcba..0000000000 --- a/libs/unimrcp/libs/mrcp-client/src/mrcp_client_session.c +++ /dev/null @@ -1,1314 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_client_session.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#include "mrcp_client_session.h" -#include "mrcp_resource_factory.h" -#include "mrcp_resource.h" -#include "mrcp_sig_agent.h" -#include "mrcp_client_connection.h" -#include "mrcp_session.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_control_descriptor.h" -#include "mrcp_message.h" -#include "mrcp_ca_factory.h" -#include "mpf_engine_factory.h" -#include "mpf_termination_factory.h" -#include "mpf_stream.h" -#include "apt_consumer_task.h" -#include "apt_obj_list.h" -#include "apt_log.h" - -/** Macro to log session name and identifier */ -#define MRCP_SESSION_NAMESID(session) \ - session->base.name, MRCP_SESSION_SID(&session->base) - -#define IS_SESSION_TERMINATE(app_message) \ - (app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING && \ - app_message->sig_message.command_id == MRCP_SIG_COMMAND_SESSION_TERMINATE) - -void mrcp_client_session_add(mrcp_client_t *client, mrcp_client_session_t *session); -void mrcp_client_session_remove(mrcp_client_t *client, mrcp_client_session_t *session); - -static apt_bool_t mrcp_client_session_offer_send(mrcp_client_session_t *session); - -static apt_bool_t mrcp_app_session_terminate_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, apt_bool_t process_pending_requests); -static apt_bool_t mrcp_app_sig_event_raise(mrcp_client_session_t *session, mrcp_channel_t *channel); -static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message); -static apt_bool_t mrcp_app_failure_message_raise(mrcp_client_session_t *session); -static apt_bool_t mrcp_app_request_dispatch(mrcp_client_session_t *session, const mrcp_app_message_t *app_message); - -static apt_bool_t mrcp_client_resource_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_client_control_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor); - -static mrcp_channel_t* mrcp_client_channel_find_by_name(mrcp_client_session_t *session, const apt_str_t *resource_name); - -static APR_INLINE mrcp_version_e mrcp_session_version_get(mrcp_client_session_t *session) -{ - return session->profile->mrcp_version; -} - -static APR_INLINE void mrcp_client_session_state_set(mrcp_client_session_t *session, mrcp_client_session_state_e state) -{ - if(session->subrequest_count != 0) { - /* error case */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_ERROR,session->base.log_obj,"Unexpected State Change [%d] pending subrequests [%d] "APT_NAMESID_FMT, - state, - session->subrequest_count, - MRCP_SESSION_NAMESID(session)); - session->subrequest_count = 0; - } - session->state = state; -} - -static APR_INLINE void mrcp_client_session_subrequest_add(mrcp_client_session_t *session) -{ - session->subrequest_count++; -} - -static APR_INLINE apt_bool_t mrcp_client_session_subrequest_remove(mrcp_client_session_t *session) -{ - if(!session->subrequest_count) { - /* error case */ - return FALSE; - } - - session->subrequest_count--; - return (session->subrequest_count ? FALSE : TRUE); -} - -static mrcp_app_message_t* mrcp_client_app_response_create(const mrcp_app_message_t *app_request, mrcp_sig_status_code_e status, apr_pool_t *pool) -{ - mrcp_app_message_t *app_response = apr_palloc(pool,sizeof(mrcp_app_message_t)); - *app_response = *app_request; - app_response->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_RESPONSE; - app_response->sig_message.status = status; - return app_response; -} - - -mrcp_channel_t* mrcp_client_channel_create( - mrcp_client_session_t *session, - mrcp_resource_t *resource, - mpf_termination_t *termination, - mpf_rtp_termination_descriptor_t *rtp_descriptor, - void *obj) -{ - mrcp_channel_t *channel = apr_palloc(session->base.pool,sizeof(mrcp_channel_t)); - channel->pool = session->base.pool; - channel->obj = obj; - channel->session = &session->base; - channel->control_channel = NULL; - channel->termination = termination; - channel->rtp_termination_slot = NULL; - channel->resource = resource; - channel->waiting_for_channel = FALSE; - channel->waiting_for_termination = FALSE; - - if(rtp_descriptor) { - rtp_termination_slot_t *termination_slot = apr_palloc(channel->pool,sizeof(rtp_termination_slot_t)); - termination_slot->descriptor = rtp_descriptor; - termination_slot->termination = NULL; - termination_slot->waiting = FALSE; - termination_slot->channel = channel; - termination_slot->id = 0; - channel->rtp_termination_slot = termination_slot; - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Create Channel "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - return channel; -} - -apt_bool_t mrcp_client_session_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(!session->offer) { - return FALSE; - } - if(!descriptor) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive Answer "APT_NAMESID_FMT" [null descriptor]", - MRCP_SESSION_NAMESID(session)); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - /* raise app response */ - return mrcp_app_sig_response_raise(session,TRUE); - } - - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive Answer "APT_NAMESID_FMT" [c:%d a:%d v:%d] Status %d", - MRCP_SESSION_NAMESID(session), - descriptor->control_media_arr->nelts, - descriptor->audio_media_arr->nelts, - descriptor->video_media_arr->nelts, - descriptor->response_code); - - if(descriptor->response_code >=200 && descriptor->response_code < 300) { - mrcp_client_session_state_set(session,SESSION_STATE_PROCESSING_ANSWER); - if(session->context) { - /* first, reset/destroy existing associations and topology */ - if(mpf_engine_topology_message_add( - session->base.media_engine, - MPF_RESET_ASSOCIATIONS,session->context, - &session->mpf_task_msg) == TRUE){ - mrcp_client_session_subrequest_add(session); - } - } - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - if(mrcp_client_resource_answer_process(session,descriptor) != TRUE) { - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - } - else { - mrcp_client_control_media_answer_process(session,descriptor); - mrcp_client_av_media_answer_process(session,descriptor); - } - - if(session->context) { - /* apply topology based on assigned associations */ - if(mpf_engine_topology_message_add( - session->base.media_engine, - MPF_APPLY_TOPOLOGY,session->context, - &session->mpf_task_msg) == TRUE) { - mrcp_client_session_subrequest_add(session); - } - - mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg); - } - } - else { - session->status = MRCP_SIG_STATUS_CODE_TERMINATE; - } - - /* store received answer */ - session->answer = descriptor; - - if(!session->subrequest_count) { - /* raise app response */ - mrcp_app_sig_response_raise(session,TRUE); - } - - return TRUE; -} - -apt_bool_t mrcp_client_session_terminate_response_process(mrcp_client_session_t *session) -{ - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Session Terminated "APT_NAMESID_FMT, MRCP_SESSION_NAMESID(session)); - - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS); - } - return TRUE; -} - -apt_bool_t mrcp_client_session_terminate_event_process(mrcp_client_session_t *session) -{ - if(session->state == SESSION_STATE_TERMINATING) { - /* session termination request has been sent, still waiting for the response, - all the events must be ignored at this stage */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Unexpected Event! "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - return FALSE; - } - - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Mark Session as Disconnected "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - session->disconnected = TRUE; - if(!session->active_request) { - /* raise app event */ - mrcp_app_sig_event_raise(session,NULL); - } - - return TRUE; -} - -apt_bool_t mrcp_client_session_control_response_process(mrcp_client_session_t *session, mrcp_message_t *message) -{ - mrcp_channel_t *channel = mrcp_client_channel_find_by_name(session,&message->channel_id.resource_name); - if(!channel) { - return FALSE; - } - return mrcp_app_control_message_raise(session,channel,message); -} - -apt_bool_t mrcp_client_session_discover_response_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Resources Discovered %s", session->base.name); - if(!session->active_request) { - return FALSE; - } - - if(!descriptor) { - /* raise app response */ - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - return mrcp_app_sig_response_raise(session,TRUE); - } - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - if(descriptor->resource_state == TRUE) { - mrcp_control_descriptor_t *control_media; - if(!session->answer) { - session->answer = descriptor; - } - control_media = mrcp_control_descriptor_create(session->base.pool); - control_media->id = mrcp_session_control_media_add(session->answer,control_media); - control_media->resource_name = descriptor->resource_name; - } - } - else { - session->answer = descriptor; - } - - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - mrcp_app_message_t *response; - response = mrcp_client_app_response_create(session->active_request,MRCP_SIG_STATUS_CODE_SUCCESS,session->base.pool); - response->descriptor = session->answer; - session->answer = NULL; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Raise App Resource Discovery Response %s", session->base.name); - session->application->handler(response); - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_app_request_dispatch(session,session->active_request); - } - } - return TRUE; -} - -apt_bool_t mrcp_client_on_channel_add(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Added "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - return TRUE; -} - -apt_bool_t mrcp_client_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Modified "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* raise app response */ - if(status != TRUE) { - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - mrcp_app_sig_response_raise(session,TRUE); - } - return TRUE; -} - -apt_bool_t mrcp_client_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Control Channel Removed "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - mrcp_app_session_terminate_raise( - session, - status == TRUE ? MRCP_SIG_STATUS_CODE_SUCCESS : MRCP_SIG_STATUS_CODE_FAILURE); - } - return TRUE; -} - -apt_bool_t mrcp_client_on_message_receive(mrcp_channel_t *channel, mrcp_message_t *message) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - return mrcp_app_control_message_raise(session,channel,message); -} - -apt_bool_t mrcp_client_on_disconnect(mrcp_channel_t *channel) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)channel->session; - return mrcp_client_session_terminate_event_process(session); -} - -mrcp_app_message_t* mrcp_client_app_signaling_request_create(mrcp_sig_command_e command_id, apr_pool_t *pool) -{ - mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t)); - app_message->message_type = MRCP_APP_MESSAGE_TYPE_SIGNALING; - app_message->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_REQUEST; - app_message->sig_message.command_id = command_id; - return app_message; -} - -mrcp_app_message_t* mrcp_client_app_signaling_event_create(mrcp_sig_event_e event_id, apr_pool_t *pool) -{ - mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t)); - app_message->message_type = MRCP_APP_MESSAGE_TYPE_SIGNALING; - app_message->sig_message.message_type = MRCP_SIG_MESSAGE_TYPE_EVENT; - app_message->sig_message.event_id = event_id; - return app_message; -} - -mrcp_app_message_t* mrcp_client_app_control_message_create(apr_pool_t *pool) -{ - mrcp_app_message_t *app_message = apr_palloc(pool,sizeof(mrcp_app_message_t)); - app_message->message_type = MRCP_APP_MESSAGE_TYPE_CONTROL; - return app_message; -} - -apt_bool_t mrcp_client_app_message_process(mrcp_app_message_t *app_message) -{ - mrcp_client_session_t *session = (mrcp_client_session_t*)app_message->session; - if(app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive App Request "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - } - else { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Receive App MRCP Request "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - } - - if(session->active_request) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Push Request to Queue "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - apt_list_push_back(session->request_queue,app_message,session->base.pool); - return TRUE; - } - - session->active_request = app_message; - mrcp_app_request_dispatch(session,app_message); - return TRUE; -} - -static apt_bool_t mrcp_client_session_offer_send(mrcp_client_session_t *session) -{ - mrcp_session_descriptor_t *descriptor = session->offer; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Send Offer "APT_NAMESID_FMT" [c:%d a:%d v:%d] to %s:%hu", - MRCP_SESSION_NAMESID(session), - descriptor->control_media_arr->nelts, - descriptor->audio_media_arr->nelts, - descriptor->video_media_arr->nelts, - session->profile->signaling_settings->server_ip, - session->profile->signaling_settings->server_port); - return mrcp_session_offer(&session->base,descriptor); -} - -static apt_bool_t mrcp_app_session_terminate_raise(mrcp_client_session_t *session, mrcp_sig_status_code_e status) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->control_channel) { - mrcp_client_control_channel_destroy(channel->control_channel); - channel->control_channel = NULL; - } - } - - mrcp_client_session_remove(session->application->client,session); - /* raise app response */ - if(status != MRCP_SIG_STATUS_CODE_SUCCESS) { - session->status = status; - } - return mrcp_app_sig_response_raise(session,FALSE); -} - -static apt_bool_t mrcp_app_sig_response_raise(mrcp_client_session_t *session, apt_bool_t process_pending_requests) -{ - mrcp_app_message_t *response; - const mrcp_app_message_t *request = session->active_request; - if(!request) { - return FALSE; - } - session->active_request = NULL; - if(session->disconnected == TRUE) { - session->status = MRCP_SIG_STATUS_CODE_TERMINATE; - } - response = mrcp_client_app_response_create(request,session->status,session->base.pool); - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Response "APT_NAMESID_FMT" [%d] %s [%d]", - MRCP_SESSION_NAMESID(session), - response->sig_message.command_id, - session->status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE", - session->status); - session->application->handler(response); - - if(process_pending_requests) { - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_app_request_dispatch(session,session->active_request); - } - } - return TRUE; -} - -static apt_bool_t mrcp_app_sig_event_raise(mrcp_client_session_t *session, mrcp_channel_t *channel) -{ - mrcp_app_message_t *app_event; - if(!session) { - return FALSE; - } - app_event = mrcp_client_app_signaling_event_create(MRCP_SIG_EVENT_TERMINATE,session->base.pool); - app_event->application = session->application; - app_event->session = &session->base; - app_event->channel = channel; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Event "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_event->sig_message.event_id); - return session->application->handler(app_event); -} - -static apt_bool_t mrcp_app_control_message_raise(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *mrcp_message) -{ - if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - mrcp_app_message_t *response; - mrcp_message_t *mrcp_request; - if(!session->active_request || !session->active_request->control_message) { - return FALSE; - } - response = mrcp_client_app_response_create(session->active_request,0,session->base.pool); - mrcp_request = session->active_request->control_message; - mrcp_message->start_line.method_id = mrcp_request->start_line.method_id; - mrcp_message->start_line.method_name = mrcp_request->start_line.method_name; - response->control_message = mrcp_message; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Response "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - session->application->handler(response); - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_app_request_dispatch(session,session->active_request); - } - } - else if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - mrcp_app_message_t *app_message; - app_message = mrcp_client_app_control_message_create(session->base.pool); - app_message->control_message = mrcp_message; - app_message->application = session->application; - app_message->session = &session->base; - app_message->channel = channel; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Event "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - session->application->handler(app_message); - } - return TRUE; -} - -static apt_bool_t mrcp_app_failure_message_raise(mrcp_client_session_t *session) -{ - mrcp_app_message_t *response; - const mrcp_app_message_t *request = session->active_request; - if(!request) { - return FALSE; - } - session->active_request = NULL; - response = mrcp_client_app_response_create(request,session->status,session->base.pool); - if(response->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App Response "APT_NAMESID_FMT" [%d] %s [%d]", - MRCP_SESSION_NAMESID(session), - response->sig_message.command_id, - session->status == MRCP_SIG_STATUS_CODE_SUCCESS ? "SUCCESS" : "FAILURE", - session->status); - } - else if(response->control_message){ - mrcp_message_t *mrcp_response = mrcp_response_create(response->control_message,response->control_message->pool); - mrcp_response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - response->control_message = mrcp_response; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Raise App MRCP Response "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - } - session->application->handler(response); - return TRUE; -} - -static apt_bool_t mrcp_client_channel_find(mrcp_client_session_t *session, mrcp_channel_t *channel, int *index) -{ - int i; - mrcp_channel_t *existing_channel; - for(i=0; ichannels->nelts; i++) { - existing_channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(existing_channel == channel) { - if(index) { - *index = i; - } - return TRUE; - } - } - return FALSE; -} - -static rtp_termination_slot_t* mrcp_client_rtp_termination_find(mrcp_client_session_t *session, mpf_termination_t *termination) -{ - int i; - rtp_termination_slot_t *slot; - for(i=0; iterminations->nelts; i++) { - slot = &APR_ARRAY_IDX(session->terminations,i,rtp_termination_slot_t); - if(slot->termination == termination) { - return slot; - } - } - return NULL; -} - -static mrcp_channel_t* mrcp_client_channel_termination_find(mrcp_client_session_t *session, mpf_termination_t *termination) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->termination == termination) { - return channel; - } - } - return NULL; -} - -static mrcp_channel_t* mrcp_client_channel_find_by_name(mrcp_client_session_t *session, const apt_str_t *resource_name) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel || !channel->resource) continue; - - if(apt_string_compare(&channel->resource->name,resource_name) == TRUE) { - return channel; - } - } - return NULL; -} - -static apt_bool_t mrcp_client_message_send(mrcp_client_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!session->base.id.length) { - mrcp_message_t *response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Raise App Failure MRCP Response "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - mrcp_app_control_message_raise(session,channel,response); - return TRUE; - } - - message->channel_id.session_id = session->base.id; - message->start_line.request_id = ++session->base.last_request_id; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Send MRCP Request "APT_NAMESIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - message->start_line.request_id); - - if(channel->control_channel) { - /* MRCPv2 */ - mrcp_client_control_message_send(channel->control_channel,message); - } - else { - /* MRCPv1 */ - mrcp_session_control_request(channel->session,message); - } - - return TRUE; -} - -static apt_bool_t mrcp_client_channel_modify(mrcp_client_session_t *session, mrcp_channel_t *channel, apt_bool_t enable) -{ - int index; - if(!session->offer) { - return FALSE; - } - if(!channel->resource) { - return FALSE; - } - - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Modify Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - enable); - if(mrcp_client_channel_find(session,channel,&index) == TRUE) { - mrcp_control_descriptor_t *control_media = mrcp_session_control_media_get(session->offer,(apr_size_t)index); - if(control_media) { - control_media->port = (enable == TRUE) ? TCP_DISCARD_PORT : 0; - } - if(channel->termination && channel->rtp_termination_slot) { - mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get( - channel->termination); - mpf_rtp_media_descriptor_t *audio_media = mrcp_session_audio_media_get( - session->offer, - channel->rtp_termination_slot->id); - if(audio_media && audio_stream) { - mpf_stream_direction_e direction = mpf_stream_reverse_direction_get(audio_stream->direction); - if(enable == TRUE) { - audio_media->direction |= direction; - } - else { - audio_media->direction &= ~direction; - } - audio_media->state = (audio_media->direction != STREAM_DIRECTION_NONE) ? MPF_MEDIA_ENABLED : MPF_MEDIA_DISABLED; - } - } - } - - session->offer->resource_name = channel->resource->name; - session->offer->resource_state = enable; - return mrcp_client_session_offer_send(session); -} - -static apt_bool_t mrcp_client_channel_add(mrcp_client_session_t *session, mrcp_channel_t *channel) -{ - mpf_rtp_termination_descriptor_t *rtp_descriptor = NULL; - rtp_termination_slot_t *slot; - apr_pool_t *pool = session->base.pool; - mrcp_client_profile_t *profile = session->profile; - if(mrcp_client_channel_find(session,channel,NULL) == TRUE) { - /* update */ - return mrcp_client_channel_modify(session,channel,TRUE); - } - - if(!session->offer) { - session->offer = mrcp_session_descriptor_create(pool); - } - - mrcp_client_session_state_set(session,SESSION_STATE_GENERATING_OFFER); - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - session->offer->resource_name = channel->resource->name; - session->offer->resource_state = TRUE; - } - else { - mrcp_control_descriptor_t *control_media; - if(!channel->control_channel) { - channel->control_channel = mrcp_client_control_channel_create(session->base.connection_agent,channel,pool); - mrcp_client_control_channel_log_obj_set(channel->control_channel,session->base.log_obj); - } - control_media = mrcp_control_offer_create(pool); - control_media->id = mrcp_session_control_media_add(session->offer,control_media); - mrcp_cmid_add(control_media->cmid_arr,session->offer->control_media_arr->nelts); - control_media->resource_name = channel->resource->name; - if(mrcp_client_control_channel_add(channel->control_channel,control_media) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,session->base.log_obj,"Add Control Channel "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - /* add control channel */ - APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel; - - /* add rtp termination slot */ - slot = apr_array_push(session->terminations); - slot->waiting = FALSE; - slot->termination = NULL; - slot->descriptor = NULL; - slot->channel = channel; - slot->id = 0; - - if(channel->termination) { - /* media termination mode */ - mpf_termination_t *termination; - mpf_audio_stream_t *audio_stream; - - if(!session->context) { - /* create media context first */ - session->context = mpf_engine_context_create( - session->base.media_engine, - session->base.name, - session,5,pool); - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Add Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(channel->termination)); - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_ADD_TERMINATION,session->context,channel->termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_client_session_subrequest_add(session); - } - - /* initialize rtp descriptor */ - rtp_descriptor = apr_palloc(pool,sizeof(mpf_rtp_termination_descriptor_t)); - mpf_rtp_termination_descriptor_init(rtp_descriptor); - rtp_descriptor->audio.settings = profile->rtp_settings; - audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(audio_stream) { - mpf_rtp_media_descriptor_t *media; - media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->state = MPF_MEDIA_ENABLED; - media->direction = mpf_stream_reverse_direction_get(audio_stream->direction); - rtp_descriptor->audio.local = media; - if(audio_stream->capabilities) { - rtp_descriptor->audio.capabilities = mpf_stream_capabilities_clone(audio_stream->capabilities,pool); - rtp_descriptor->audio.capabilities->direction = media->direction; - } - } - - /* create rtp termination */ - termination = mpf_termination_create(session->base.rtp_factory,session,pool); - slot->termination = termination; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Add Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(termination)); - - /* send add termination request (add to media context) */ - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_ADD_TERMINATION,session->context,termination,rtp_descriptor, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_client_session_subrequest_add(session); - } - mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg); - } - else { - /* bypass media mode */ - if(channel->rtp_termination_slot) { - rtp_descriptor = channel->rtp_termination_slot->descriptor; - if(rtp_descriptor) { - if(rtp_descriptor->audio.local) { - session->offer->ip = rtp_descriptor->audio.local->ip; - session->offer->ext_ip = rtp_descriptor->audio.local->ext_ip; - rtp_descriptor->audio.local->id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local); - rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts; - slot->id = session->offer->audio_media_arr->nelts - 1; - } - } - } - } - - slot->descriptor = rtp_descriptor; - channel->rtp_termination_slot = slot; - - if(!session->subrequest_count) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - return TRUE; -} - -static apt_bool_t mrcp_client_session_update(mrcp_client_session_t *session) -{ - if(!session->offer) { - return FALSE; - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Update Session "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - return mrcp_client_session_offer_send(session); -} - -static apt_bool_t mrcp_client_session_terminate(mrcp_client_session_t *session) -{ - mrcp_channel_t *channel; - rtp_termination_slot_t *slot; - int i; - - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->base.log_obj,"Terminate Session "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - - mrcp_client_session_state_set(session,SESSION_STATE_TERMINATING); - if(session->context) { - /* first destroy existing topology */ - if(mpf_engine_topology_message_add( - session->base.media_engine, - MPF_DESTROY_TOPOLOGY,session->context, - &session->mpf_task_msg) == TRUE){ - mrcp_client_session_subrequest_add(session); - } - } - /* remove existing control channels */ - for(i=0; ichannels->nelts; i++) { - /* get existing channel */ - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->control_channel) { - /* remove channel */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Remove Control Channel "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - if(mrcp_client_control_channel_remove(channel->control_channel) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - - /* send subtract termination request */ - if(channel->termination) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Subtract Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(channel->termination)); - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_SUBTRACT_TERMINATION,session->context,channel->termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - } - - if(session->context) { - /* subtract existing terminations */ - for(i=0; iterminations->nelts; i++) { - /* get existing termination */ - slot = &APR_ARRAY_IDX(session->terminations,i,rtp_termination_slot_t); - if(!slot->termination) continue; - - /* send subtract termination request */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Subtract Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(slot->termination)); - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_SUBTRACT_TERMINATION,session->context,slot->termination,NULL, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - - mpf_engine_message_send(session->base.media_engine,&session->mpf_task_msg); - } - - mrcp_client_session_subrequest_add(session); - mrcp_session_terminate_request(&session->base); - return TRUE; -} - -static apt_bool_t mrcp_client_resource_discover(mrcp_client_session_t *session) -{ - mrcp_session_descriptor_t *descriptor = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Discover Resources "APT_PTR_FMT, MRCP_SESSION_PTR(&session->base)); - session->answer = NULL; - mrcp_client_session_state_set(session,SESSION_STATE_DISCOVERING); - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - mrcp_resource_t *resource; - mrcp_resource_id i; - - for(i=0; iprofile->resource_factory,i); - if(!resource) continue; - - descriptor = mrcp_session_descriptor_create(session->base.pool); - apt_string_copy(&descriptor->resource_name,&resource->name,session->base.pool); - if(mrcp_session_discover_request(&session->base,descriptor) == TRUE) { - mrcp_client_session_subrequest_add(session); - } - } - } - else { - if(mrcp_session_discover_request(&session->base,descriptor) == TRUE) { - mrcp_client_session_subrequest_add(session); - } - } - - if(session->subrequest_count == 0) { - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - mrcp_app_sig_response_raise(session,TRUE); - } - return TRUE; -} - -static apt_bool_t mrcp_client_on_termination_add(mrcp_client_session_t *session, const mpf_message_t *mpf_message) -{ - rtp_termination_slot_t *termination_slot; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Added "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - mpf_rtp_termination_descriptor_t *rtp_descriptor; - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - rtp_descriptor = mpf_message->descriptor; - if(rtp_descriptor->audio.local) { - session->offer->ip = rtp_descriptor->audio.local->ip; - session->offer->ext_ip = rtp_descriptor->audio.local->ext_ip; - rtp_descriptor->audio.local->id = mrcp_session_audio_media_add(session->offer,rtp_descriptor->audio.local); - rtp_descriptor->audio.local->mid = session->offer->audio_media_arr->nelts; - termination_slot->id = session->offer->audio_media_arr->nelts - 1; - } - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - } - else { - /* channel termination */ - mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination); - if(channel && channel->waiting_for_termination == TRUE) { - channel->waiting_for_termination = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_on_termination_modify(mrcp_client_session_t *session, const mpf_message_t *mpf_message) -{ - rtp_termination_slot_t *termination_slot; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Modified "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - termination_slot->descriptor = mpf_message->descriptor;; - - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - if(session->state == SESSION_STATE_GENERATING_OFFER) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - else if(session->state == SESSION_STATE_PROCESSING_ANSWER) { - /* raise app response */ - mrcp_app_sig_response_raise(session,TRUE); - } - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_on_termination_subtract(mrcp_client_session_t *session, const mpf_message_t *mpf_message) -{ - rtp_termination_slot_t *termination_slot; - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Media Termination Subtracted "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_client_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - mrcp_app_session_terminate_raise(session,MRCP_SIG_STATUS_CODE_SUCCESS); - } - } - else { - /* channel termination */ - mrcp_channel_t *channel = mrcp_client_channel_termination_find(session,mpf_message->termination); - if(channel && channel->waiting_for_termination == TRUE) { - channel->waiting_for_termination = FALSE; - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - /* raise app response */ - mrcp_app_sig_response_raise(session,TRUE); - } - } - } - return TRUE; -} - -apt_bool_t mrcp_client_mpf_message_process(mpf_message_container_t *mpf_message_container) -{ - apr_size_t i; - mrcp_client_session_t *session; - const mpf_message_t *mpf_message; - for(i=0; icount; i++) { - mpf_message = &mpf_message_container->messages[i]; - if(mpf_message->context) { - session = mpf_engine_context_object_get(mpf_message->context); - } - else { - session = NULL; - } - if(!session) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Received MPF Message: NULL session"); - continue; - } - if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) { - switch(mpf_message->command_id) { - case MPF_ADD_TERMINATION: - mrcp_client_on_termination_add(session,mpf_message); - break; - case MPF_MODIFY_TERMINATION: - mrcp_client_on_termination_modify(session,mpf_message); - break; - case MPF_SUBTRACT_TERMINATION: - mrcp_client_on_termination_subtract(session,mpf_message); - break; - case MPF_ADD_ASSOCIATION: - case MPF_REMOVE_ASSOCIATION: - case MPF_RESET_ASSOCIATIONS: - case MPF_APPLY_TOPOLOGY: - case MPF_DESTROY_TOPOLOGY: - if(mrcp_client_session_subrequest_remove(session) == TRUE) { - if(session->state == SESSION_STATE_GENERATING_OFFER) { - /* send offer to server */ - mrcp_client_session_offer_send(session); - } - else if(session->state == SESSION_STATE_PROCESSING_ANSWER) { - /* raise app response */ - mrcp_app_sig_response_raise(session,TRUE); - } - } - break; - default: - break; - } - } - else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Process MPF Event "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_resource_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - apt_bool_t status = TRUE; - if(session->offer->resource_state == TRUE) { - if(descriptor->resource_state == TRUE) { - mrcp_client_av_media_answer_process(session,descriptor); - } - else { - status = FALSE; - } - } - return status; -} - -static apt_bool_t mrcp_client_control_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - mrcp_channel_t *channel; - mrcp_control_descriptor_t *control_descriptor; - int i; - int count = session->channels->nelts; - if(count != descriptor->control_media_arr->nelts) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of control channels [%d] != Number of control media in answer [%d]", - count,descriptor->control_media_arr->nelts); - count = descriptor->control_media_arr->nelts; - } - - if(!session->base.id.length) { - /* initial answer received, store session id and add to session's table */ - control_descriptor = mrcp_session_control_media_get(descriptor,0); - if(control_descriptor) { - session->base.id = control_descriptor->session_id; - } - } - - /* update existing control channels */ - for(i=0; ichannels,i,mrcp_channel_t*); - if(!channel) continue; - - /* get control descriptor */ - control_descriptor = mrcp_session_control_media_get(descriptor,i); - /* modify channel */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Modify Control Channel "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - if(mrcp_client_control_channel_modify(channel->control_channel,control_descriptor) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_client_session_subrequest_add(session); - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_av_media_answer_process(mrcp_client_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - rtp_termination_slot_t *slot; - int i; - int count = session->terminations->nelts; - if(count != descriptor->audio_media_arr->nelts) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of terminations [%d] != Number of audio media in answer [%d]", - count,descriptor->audio_media_arr->nelts); - count = descriptor->audio_media_arr->nelts; - } - - /* update existing terminations */ - for(i=0; iterminations,i,rtp_termination_slot_t); - remote_media = mrcp_session_audio_media_get(descriptor,i); - if(slot->descriptor) { - slot->descriptor->audio.remote = remote_media; - } - if(slot->termination) { - /* construct termination descriptor */ - rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t)); - mpf_rtp_termination_descriptor_init(rtp_descriptor); - rtp_descriptor->audio.local = NULL; - rtp_descriptor->audio.remote = remote_media; - - /* send modify termination request */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Modify Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(slot->termination)); - if(mpf_engine_termination_message_add( - session->base.media_engine, - MPF_MODIFY_TERMINATION,session->context,slot->termination,rtp_descriptor, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_client_session_subrequest_add(session); - } - if(slot->channel && slot->channel->termination) { - if(mpf_engine_assoc_message_add( - session->base.media_engine, - MPF_ADD_ASSOCIATION,session->context,slot->termination,slot->channel->termination, - &session->mpf_task_msg) == TRUE) { - mrcp_client_session_subrequest_add(session); - } - } - } - } - return TRUE; -} - -static apt_bool_t mrcp_app_request_dispatch(mrcp_client_session_t *session, const mrcp_app_message_t *app_message) -{ - if(session->state == SESSION_STATE_TERMINATING) { - /* no more requests are allowed, as session is being terminated! - just return, it is horribly wrong and can crash anytime here */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_ERROR,session->base.log_obj,"Inappropriate Application Request "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - return FALSE; - } - - if(session->disconnected == TRUE) { - /* cancel all the requests besides session termination one */ - if(!IS_SESSION_TERMINATE(app_message)) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Cancel App Request "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_CANCEL; - return mrcp_app_failure_message_raise(session); - } - } - - if(session->registered == FALSE) { - if(IS_SESSION_TERMINATE(app_message)) { - /* if session is not registered, nothing to terminate, just respond with success */ - session->status = MRCP_SIG_STATUS_CODE_SUCCESS; - return mrcp_app_sig_response_raise(session,FALSE); - } - - /* select signaling agent */ - session->base.signaling_agent = mrcp_sa_factory_agent_select(session->profile->sa_factory); - if(!session->base.signaling_agent) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Signaling Agent "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - if(session->profile->mrcp_version == MRCP_VERSION_2) { - /* select connection agent */ - session->base.connection_agent = mrcp_ca_factory_agent_select(session->profile->ca_factory); - if(!session->base.connection_agent) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Connection Agent "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - } - if(session->profile->mpf_factory) { - /* select media engine */ - session->base.media_engine = mpf_engine_factory_engine_select(session->profile->mpf_factory); - if(!session->base.media_engine) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Select Media Engine "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - } - } - /* set rtp termination factory */ - session->base.rtp_factory = session->profile->rtp_termination_factory; - - if(session->status == MRCP_SIG_STATUS_CODE_FAILURE) { - /* raise app response in case of failure */ - return mrcp_app_failure_message_raise(session); - } - - if(session->base.signaling_agent->create_client_session(&session->base,session->profile->signaling_settings) != TRUE) { - /* raise app response */ - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,session->base.log_obj,"Failed to Create Session "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - session->status = MRCP_SIG_STATUS_CODE_FAILURE; - return mrcp_app_failure_message_raise(session); - } - - mrcp_client_session_add(session->application->client,session); - session->registered = TRUE; - } - session->status = MRCP_SIG_STATUS_CODE_SUCCESS; - switch(app_message->message_type) { - case MRCP_APP_MESSAGE_TYPE_SIGNALING: - { - apt_obj_log(APT_LOG_MARK,APT_PRIO_DEBUG,session->base.log_obj,"Dispatch App Request "APT_NAMESID_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - app_message->sig_message.command_id); - switch(app_message->sig_message.command_id) { - case MRCP_SIG_COMMAND_SESSION_UPDATE: - mrcp_client_session_update(session); - break; - case MRCP_SIG_COMMAND_SESSION_TERMINATE: - mrcp_client_session_terminate(session); - break; - case MRCP_SIG_COMMAND_CHANNEL_ADD: - mrcp_client_channel_add(session,app_message->channel); - break; - case MRCP_SIG_COMMAND_CHANNEL_REMOVE: - mrcp_client_channel_modify(session,app_message->channel,FALSE); - break; - case MRCP_SIG_COMMAND_RESOURCE_DISCOVER: - mrcp_client_resource_discover(session); - break; - default: - break; - } - break; - } - case MRCP_APP_MESSAGE_TYPE_CONTROL: - { - mrcp_client_message_send(session,app_message->channel,app_message->control_message); - break; - } - } - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp-engine/Makefile.am b/libs/unimrcp/libs/mrcp-engine/Makefile.am deleted file mode 100644 index a67c910526..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/Makefile.am +++ /dev/null @@ -1,38 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpengine.la - -include_HEADERS = include/mrcp_engine_types.h \ - include/mrcp_engine_plugin.h \ - include/mrcp_engine_iface.h \ - include/mrcp_engine_impl.h \ - include/mrcp_synth_engine.h \ - include/mrcp_recog_engine.h \ - include/mrcp_recorder_engine.h \ - include/mrcp_verifier_engine.h \ - include/mrcp_resource_engine.h \ - include/mrcp_engine_factory.h \ - include/mrcp_engine_loader.h \ - include/mrcp_state_machine.h \ - include/mrcp_synth_state_machine.h \ - include/mrcp_recog_state_machine.h \ - include/mrcp_recorder_state_machine.h \ - include/mrcp_verifier_state_machine.h - -libmrcpengine_la_SOURCES = src/mrcp_engine_iface.c \ - src/mrcp_engine_impl.c \ - src/mrcp_engine_factory.c \ - src/mrcp_engine_loader.c \ - src/mrcp_synth_state_machine.c \ - src/mrcp_recog_state_machine.c \ - src/mrcp_recorder_state_machine.c \ - src/mrcp_verifier_state_machine.c diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h deleted file mode 100644 index d769a0a937..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_factory.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_FACTORY_H -#define MRCP_ENGINE_FACTORY_H - -/** - * @file mrcp_engine_factory.h - * @brief Factory of MRCP Engines - */ - -#include "mrcp_engine_iface.h" - -APT_BEGIN_EXTERN_C - -/** Opaque engine factory declaration */ -typedef struct mrcp_engine_factory_t mrcp_engine_factory_t; - -/** Create engine factory */ -MRCP_DECLARE(mrcp_engine_factory_t*) mrcp_engine_factory_create(apr_pool_t *pool); - -/** Destroy registered engines and the factory */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_destroy(mrcp_engine_factory_t *factory); - -/** Open registered engines */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_open(mrcp_engine_factory_t *factory); - -/** Close registered engines */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_close(mrcp_engine_factory_t *factory); - - -/** Register engine */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_engine_register(mrcp_engine_factory_t *factory, mrcp_engine_t *engine); - -/** Get engine by name */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_get(const mrcp_engine_factory_t *factory, const char *name); - -/** Find engine by resource identifier */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_find(const mrcp_engine_factory_t *factory, mrcp_resource_id resource_id); - -/** Start iterating over the engines in a factory */ -MRCP_DECLARE(apr_hash_index_t*) mrcp_engine_factory_engine_first(const mrcp_engine_factory_t *factory); - - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_FACTORY_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h deleted file mode 100644 index 2e70c80dec..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_iface.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_iface.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_IFACE_H -#define MRCP_ENGINE_IFACE_H - -/** - * @file mrcp_engine_iface.h - * @brief MRCP Engine User Interface (typically user is an MRCP server) - */ - -#include "mrcp_engine_types.h" - -APT_BEGIN_EXTERN_C - -/** Destroy engine */ -apt_bool_t mrcp_engine_virtual_destroy(mrcp_engine_t *engine); - -/** Open engine */ -apt_bool_t mrcp_engine_virtual_open(mrcp_engine_t *engine); - -/** Response to open engine request */ -void mrcp_engine_on_open(mrcp_engine_t *engine, apt_bool_t status); - -/** Close engine */ -apt_bool_t mrcp_engine_virtual_close(mrcp_engine_t *engine); - -/** Response to close engine request */ -void mrcp_engine_on_close(mrcp_engine_t *engine); - - -/** Create engine channel */ -mrcp_engine_channel_t* mrcp_engine_channel_virtual_create(mrcp_engine_t *engine, mrcp_version_e mrcp_version, apr_pool_t *pool); - -/** Destroy engine channel */ -apt_bool_t mrcp_engine_channel_virtual_destroy(mrcp_engine_channel_t *channel); - -/** Open engine channel */ -static APR_INLINE apt_bool_t mrcp_engine_channel_virtual_open(mrcp_engine_channel_t *channel) -{ - if(channel->is_open == FALSE) { - channel->is_open = channel->method_vtable->open(channel); - return channel->is_open; - } - return FALSE; -} - -/** Close engine channel */ -static APR_INLINE apt_bool_t mrcp_engine_channel_virtual_close(mrcp_engine_channel_t *channel) -{ - if(channel->is_open == TRUE) { - channel->is_open = FALSE; - return channel->method_vtable->close(channel); - } - return FALSE; -} - -/** Process request */ -static APR_INLINE apt_bool_t mrcp_engine_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *message) -{ - return channel->method_vtable->process_request(channel,message); -} - -/** Allocate engine config */ -mrcp_engine_config_t* mrcp_engine_config_alloc(apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_IFACE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h deleted file mode 100644 index 6900b6abe0..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_impl.h +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_impl.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_IMPL_H -#define MRCP_ENGINE_IMPL_H - -/** - * @file mrcp_engine_impl.h - * @brief MRCP Engine Realization Interface (typically should be implemented in plugins) - */ - -#include "mrcp_engine_types.h" -#include "mpf_stream.h" - -APT_BEGIN_EXTERN_C - -/** Create engine */ -mrcp_engine_t* mrcp_engine_create( - mrcp_resource_id resource_id, - void *obj, - const mrcp_engine_method_vtable_t *vtable, - apr_pool_t *pool); - -/** Send engine open response */ -static APR_INLINE apt_bool_t mrcp_engine_open_respond(mrcp_engine_t *engine, apt_bool_t status) -{ - return engine->event_vtable->on_open(engine,status); -} - -/** Send engine close response */ -static APR_INLINE apt_bool_t mrcp_engine_close_respond(mrcp_engine_t *engine) -{ - return engine->event_vtable->on_close(engine); -} - - -/** Get engine config */ -const mrcp_engine_config_t* mrcp_engine_config_get(const mrcp_engine_t *engine); - -/** Get engine param by name */ -const char* mrcp_engine_param_get(const mrcp_engine_t *engine, const char *name); - - -/** Create engine channel */ -mrcp_engine_channel_t* mrcp_engine_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *method_vtable, - void *method_obj, - mpf_termination_t *termination, - apr_pool_t *pool); - -/** Create audio termination */ -mpf_termination_t* mrcp_engine_audio_termination_create( - void *obj, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_stream_capabilities_t *capabilities, - apr_pool_t *pool); - -/** Create engine channel and source media termination - * @deprecated @see mrcp_engine_channel_create() and mrcp_engine_audio_termination_create() - */ -mrcp_engine_channel_t* mrcp_engine_source_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *channel_vtable, - const mpf_audio_stream_vtable_t *stream_vtable, - void *method_obj, - mpf_codec_descriptor_t *codec_descriptor, - apr_pool_t *pool); - -/** Create engine channel and sink media termination - * @deprecated @see mrcp_engine_channel_create() and mrcp_engine_audio_termination_create() - */ -mrcp_engine_channel_t* mrcp_engine_sink_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *channel_vtable, - const mpf_audio_stream_vtable_t *stream_vtable, - void *method_obj, - mpf_codec_descriptor_t *codec_descriptor, - apr_pool_t *pool); - -/** Send channel open response */ -static APR_INLINE apt_bool_t mrcp_engine_channel_open_respond(mrcp_engine_channel_t *channel, apt_bool_t status) -{ - return channel->event_vtable->on_open(channel,status); -} - -/** Send channel close response */ -static APR_INLINE apt_bool_t mrcp_engine_channel_close_respond(mrcp_engine_channel_t *channel) -{ - return channel->event_vtable->on_close(channel); -} - -/** Send response/event message */ -static APR_INLINE apt_bool_t mrcp_engine_channel_message_send(mrcp_engine_channel_t *channel, mrcp_message_t *message) -{ - return channel->event_vtable->on_message(channel,message); -} - -/** Get channel identifier */ -static APR_INLINE const char* mrcp_engine_channel_id_get(mrcp_engine_channel_t *channel) -{ - return channel->id.buf; -} - -/** Get MRCP version channel is created in the scope of */ -static APR_INLINE mrcp_version_e mrcp_engine_channel_version_get(const mrcp_engine_channel_t *channel) -{ - return channel->mrcp_version; -} - -/** Get codec descriptor of the audio source stream */ -const mpf_codec_descriptor_t* mrcp_engine_source_stream_codec_get(const mrcp_engine_channel_t *channel); - -/** Get codec descriptor of the audio sink stream */ -const mpf_codec_descriptor_t* mrcp_engine_sink_stream_codec_get(const mrcp_engine_channel_t *channel); - - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_IMPL_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h deleted file mode 100644 index a408497266..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_loader.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_loader.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_LOADER_H -#define MRCP_ENGINE_LOADER_H - -/** - * @file mrcp_engine_loader.h - * @brief Loader of plugins for MRCP engines - */ - -#include "mrcp_engine_iface.h" - -APT_BEGIN_EXTERN_C - -/** Opaque engine loader declaration */ -typedef struct mrcp_engine_loader_t mrcp_engine_loader_t; - -/** Create engine loader */ -MRCP_DECLARE(mrcp_engine_loader_t*) mrcp_engine_loader_create(apr_pool_t *pool); - -/** Destroy engine loader */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_destroy(mrcp_engine_loader_t *loader); - -/** Unload loaded plugins */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_plugins_unload(mrcp_engine_loader_t *loader); - - -/** Load engine plugin */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_loader_plugin_load( - mrcp_engine_loader_t *loader, - const char *id, - const char *path, - mrcp_engine_config_t *config); - - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_LOADER_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h deleted file mode 100644 index e9cdb6da9b..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_plugin.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_plugin.h 2139 2014-07-07 05:06:19Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_PLUGIN_H -#define MRCP_ENGINE_PLUGIN_H - -/** - * @file mrcp_engine_plugin.h - * @brief MRCP Engine Plugin - */ - -#include "apr_version.h" -#include "apt_log.h" -#include "mrcp_engine_types.h" - -APT_BEGIN_EXTERN_C - -/** Let the plugin symbols be always exported as C functions */ -#ifdef __cplusplus -#define MRCP_PLUGIN_EXTERN_C extern "C" -#else -#define MRCP_PLUGIN_EXTERN_C extern -#endif - -/** Plugin export defines */ -#ifdef WIN32 -#define MRCP_PLUGIN_DECLARE(type) MRCP_PLUGIN_EXTERN_C __declspec(dllexport) type -#else -#define MRCP_PLUGIN_DECLARE(type) MRCP_PLUGIN_EXTERN_C type -#endif - -/** [REQUIRED] Symbol name of the main entry point in plugin DSO */ -#define MRCP_PLUGIN_ENGINE_SYM_NAME "mrcp_plugin_create" -/** [REQUIRED] Symbol name of the vesrion number entry point in plugin DSO */ -#define MRCP_PLUGIN_VERSION_SYM_NAME "mrcp_plugin_version" -/** [IMPLIED] Symbol name of the log accessor entry point in plugin DSO */ -#define MRCP_PLUGIN_LOGGER_SYM_NAME "mrcp_plugin_logger_set" - -/** Prototype of engine creator (entry point of plugin DSO) */ -typedef mrcp_engine_t* (*mrcp_plugin_creator_f)(apr_pool_t *pool); - -/** Prototype of log accessor (entry point of plugin DSO) */ -typedef apt_bool_t (*mrcp_plugin_log_accessor_f)(apt_logger_t *logger); - -/** Declare this macro in plugins to use log routine of the server */ -#define MRCP_PLUGIN_LOGGER_IMPLEMENT \ - MRCP_PLUGIN_DECLARE(apt_bool_t) mrcp_plugin_logger_set(apt_logger_t *logger) \ - { return apt_log_instance_set(logger); } - -/** Declare this macro in plugins to set plugin version */ -#define MRCP_PLUGIN_VERSION_DECLARE \ - MRCP_PLUGIN_DECLARE(mrcp_plugin_version_t) mrcp_plugin_version; \ - mrcp_plugin_version_t mrcp_plugin_version = \ - {PLUGIN_MAJOR_VERSION, PLUGIN_MINOR_VERSION, PLUGIN_PATCH_VERSION}; - - -/** major version - * Major API changes that could cause compatibility problems for older - * plugins such as structure size changes. No binary compatibility is - * possible across a change in the major version. - */ -#define PLUGIN_MAJOR_VERSION 1 - -/** minor version - * Minor API changes that do not cause binary compatibility problems. - * Reset to 0 when upgrading PLUGIN_MAJOR_VERSION - */ -#define PLUGIN_MINOR_VERSION 2 - -/** patch level - * The Patch Level never includes API changes, simply bug fixes. - * Reset to 0 when upgrading PLUGIN_MINOR_VERSION - */ -#define PLUGIN_PATCH_VERSION 0 - - -/** - * Check at compile time if the plugin version is at least a certain - * level. - */ -#define PLUGIN_VERSION_AT_LEAST(major,minor,patch) \ -(((major) < PLUGIN_MAJOR_VERSION) \ - || ((major) == PLUGIN_MAJOR_VERSION && (minor) < PLUGIN_MINOR_VERSION) \ - || ((major) == PLUGIN_MAJOR_VERSION && (minor) == PLUGIN_MINOR_VERSION && (patch) <= PLUGIN_PATCH_VERSION)) - -/** The formatted string of plugin's version */ -#define PLUGIN_VERSION_STRING \ - APR_STRINGIFY(PLUGIN_MAJOR_VERSION) "." \ - APR_STRINGIFY(PLUGIN_MINOR_VERSION) "." \ - APR_STRINGIFY(PLUGIN_PATCH_VERSION) - -/** Plugin version */ -typedef apr_version_t mrcp_plugin_version_t; - -/** Get plugin version */ -static APR_INLINE void mrcp_plugin_version_get(mrcp_plugin_version_t *version) -{ - version->major = PLUGIN_MAJOR_VERSION; - version->minor = PLUGIN_MINOR_VERSION; - version->patch = PLUGIN_PATCH_VERSION; -} - -/** Check plugin version */ -static APR_INLINE int mrcp_plugin_version_check(mrcp_plugin_version_t *version) -{ - return PLUGIN_VERSION_AT_LEAST(version->major,version->minor,version->patch); -} - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_PLUGIN_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h deleted file mode 100644 index ee2390c255..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_engine_types.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_ENGINE_TYPES_H -#define MRCP_ENGINE_TYPES_H - -/** - * @file mrcp_engine_types.h - * @brief MRCP Engine Types - */ - -#include -#include "mrcp_state_machine.h" -#include "mpf_types.h" -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - -/** MRCP engine declaration */ -typedef struct mrcp_engine_t mrcp_engine_t; -/** MRCP engine config declaration */ -typedef struct mrcp_engine_config_t mrcp_engine_config_t; -/** MRCP engine vtable declaration */ -typedef struct mrcp_engine_method_vtable_t mrcp_engine_method_vtable_t; -/** MRCP engine event vtable declaration */ -typedef struct mrcp_engine_event_vtable_t mrcp_engine_event_vtable_t; -/** MRCP engine channel declaration */ -typedef struct mrcp_engine_channel_t mrcp_engine_channel_t; -/** MRCP engine channel virtual method table declaration */ -typedef struct mrcp_engine_channel_method_vtable_t mrcp_engine_channel_method_vtable_t; -/** MRCP engine channel virtual event table declaration */ -typedef struct mrcp_engine_channel_event_vtable_t mrcp_engine_channel_event_vtable_t; - -/** Table of channel virtual methods */ -struct mrcp_engine_channel_method_vtable_t { - /** Virtual destroy */ - apt_bool_t (*destroy)(mrcp_engine_channel_t *channel); - /** Virtual open */ - apt_bool_t (*open)(mrcp_engine_channel_t *channel); - /** Virtual close */ - apt_bool_t (*close)(mrcp_engine_channel_t *channel); - /** Virtual process_request */ - apt_bool_t (*process_request)(mrcp_engine_channel_t *channel, mrcp_message_t *request); -}; - -/** Table of channel virtual event handlers */ -struct mrcp_engine_channel_event_vtable_t { - /** Open event handler */ - apt_bool_t (*on_open)(mrcp_engine_channel_t *channel, apt_bool_t status); - /** Close event handler */ - apt_bool_t (*on_close)(mrcp_engine_channel_t *channel); - /** Message event handler */ - apt_bool_t (*on_message)(mrcp_engine_channel_t *channel, mrcp_message_t *message); -}; - -/** MRCP engine channel declaration */ -struct mrcp_engine_channel_t { - /** Table of virtual methods */ - const mrcp_engine_channel_method_vtable_t *method_vtable; - /** External object used with virtual methods */ - void *method_obj; - /** Table of virtual event handlers */ - const mrcp_engine_channel_event_vtable_t *event_vtable; - /** External object used with event handlers */ - void *event_obj; - /** Media termination */ - mpf_termination_t *termination; - /** Back pointer to engine */ - mrcp_engine_t *engine; - /** Unique identifier to be used in traces */ - apt_str_t id; - /** MRCP version */ - mrcp_version_e mrcp_version; - /** Is channel successfully opened */ - apt_bool_t is_open; - /** Pool to allocate memory from */ - apr_pool_t *pool; -}; - -/** Table of MRCP engine virtual methods */ -struct mrcp_engine_method_vtable_t { - /** Virtual destroy */ - apt_bool_t (*destroy)(mrcp_engine_t *engine); - /** Virtual open */ - apt_bool_t (*open)(mrcp_engine_t *engine); - /** Virtual close */ - apt_bool_t (*close)(mrcp_engine_t *engine); - /** Virtual channel create */ - mrcp_engine_channel_t* (*create_channel)(mrcp_engine_t *engine, apr_pool_t *pool); -}; - -/** Table of MRCP engine virtual event handlers */ -struct mrcp_engine_event_vtable_t { - /** Open event handler */ - apt_bool_t (*on_open)(mrcp_engine_t *channel, apt_bool_t status); - /** Close event handler */ - apt_bool_t (*on_close)(mrcp_engine_t *channel); -}; - -/** MRCP engine */ -struct mrcp_engine_t { - /** Identifier of the engine */ - const char *id; - /** Resource identifier */ - mrcp_resource_id resource_id; - /** External object associated with engine */ - void *obj; - /** Table of virtual methods */ - const mrcp_engine_method_vtable_t *method_vtable; - /** Table of virtual event handlers */ - const mrcp_engine_event_vtable_t *event_vtable; - /** External object used with event handlers */ - void *event_obj; - /** Codec manager */ - const mpf_codec_manager_t *codec_manager; - /** Dir layout structure */ - const apt_dir_layout_t *dir_layout; - /** Config of engine */ - mrcp_engine_config_t *config; - /** Number of simultaneous channels currently in use */ - apr_size_t cur_channel_count; - /** Is engine successfully opened */ - apt_bool_t is_open; - /** Pool to allocate memory from */ - apr_pool_t *pool; - - /** Create state machine */ - mrcp_state_machine_t* (*create_state_machine)(void *obj, mrcp_version_e version, apr_pool_t *pool); -}; - -/** MRCP engine config */ -struct mrcp_engine_config_t { - /** Max number of simultaneous channels */ - apr_size_t max_channel_count; - /** Table of name/value string params */ - apr_table_t *params; -}; - -APT_END_EXTERN_C - -#endif /* MRCP_ENGINE_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h deleted file mode 100644 index d9fce1bd97..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_engine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recog_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECOG_ENGINE_H -#define MRCP_RECOG_ENGINE_H - -/** - * @file mrcp_recog_engine.h - * @brief Recognizer Engine Includes - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -#include "mrcp_recog_resource.h" -#include "mrcp_recog_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_message.h" - -#endif /* MRCP_RECOG_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h deleted file mode 100644 index 9be07b6bec..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recog_state_machine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recog_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECOG_STATE_MACHINE_H -#define MRCP_RECOG_STATE_MACHINE_H - -/** - * @file mrcp_recog_state_machine.h - * @brief MRCP Recognizer State Machine - */ - -#include "mrcp_state_machine.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP recognizer state machine */ -mrcp_state_machine_t* mrcp_recog_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_RECOG_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h deleted file mode 100644 index 90fa022725..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_engine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recorder_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECORDER_ENGINE_H -#define MRCP_RECORDER_ENGINE_H - -/** - * @file mrcp_recorder_engine.h - * @brief Recorder Engine Includes - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -#include "mrcp_recorder_resource.h" -#include "mrcp_recorder_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_message.h" - -#endif /* MRCP_RECORDER_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h deleted file mode 100644 index 242440a42f..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_recorder_state_machine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recorder_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECORDER_STATE_MACHINE_H -#define MRCP_RECORDER_STATE_MACHINE_H - -/** - * @file mrcp_recorder_state_machine.h - * @brief MRCP Recorder State Machine - */ - -#include "mrcp_state_machine.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP recorder state machine */ -mrcp_state_machine_t* mrcp_recorder_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_RECORDER_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h deleted file mode 100644 index 3743af9ab0..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_resource_engine.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_resource_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RESOURCE_ENGINE_H -#define MRCP_RESOURCE_ENGINE_H - -/** - * @file mrcp_resource_engine.h - * @brief Legacy MRCP Resource Engine - * @deprecated @see mrcp_engine_plugin.h and mrcp_engine_impl.h - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -APT_BEGIN_EXTERN_C - -/** Termorary define legacy mrcp_resource_engine_t as mrcp_engine_t */ -typedef mrcp_engine_t mrcp_resource_engine_t; - -/** - * Create resource engine - * @deprecated @see mrcp_engine_create - */ -static APR_INLINE mrcp_engine_t* mrcp_resource_engine_create( - mrcp_resource_id resource_id, - void *obj, - const mrcp_engine_method_vtable_t *vtable, - apr_pool_t *pool) -{ - return mrcp_engine_create(resource_id,obj,vtable,pool); -} - -APT_END_EXTERN_C - -#endif /* MRCP_RESOURCE_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h deleted file mode 100644 index acec6fa8bc..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_state_machine.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_STATE_MACHINE_H -#define MRCP_STATE_MACHINE_H - -/** - * @file mrcp_state_machine.h - * @brief MRCP State Machine - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP state machine declaration */ -typedef struct mrcp_state_machine_t mrcp_state_machine_t; - - -/** MRCP state machine */ -struct mrcp_state_machine_t { - /** External object associated with state machine */ - void *obj; - /** State either active or deactivating */ - apt_bool_t active; - - /** Virtual update */ - apt_bool_t (*update)(mrcp_state_machine_t *state_machine, mrcp_message_t *message); - /** Deactivate */ - apt_bool_t (*deactivate)(mrcp_state_machine_t *state_machine); - - - /** Message dispatcher */ - apt_bool_t (*on_dispatch)(mrcp_state_machine_t *state_machine, mrcp_message_t *message); - /** Deactivated */ - apt_bool_t (*on_deactivate)(mrcp_state_machine_t *state_machine); -}; - -/** Initialize MRCP state machine */ -static APR_INLINE void mrcp_state_machine_init(mrcp_state_machine_t *state_machine, void *obj) -{ - state_machine->obj = obj; - state_machine->active = TRUE; - state_machine->on_dispatch = NULL; - state_machine->on_deactivate = NULL; - state_machine->update = NULL; - state_machine->deactivate = NULL; -} - -/** Update MRCP state machine */ -static APR_INLINE apt_bool_t mrcp_state_machine_update(mrcp_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->update) { - return state_machine->update(state_machine,message); - } - return FALSE; -} - -/** Deactivate MRCP state machine */ -static APR_INLINE apt_bool_t mrcp_state_machine_deactivate(mrcp_state_machine_t *state_machine) -{ - if(state_machine->deactivate) { - state_machine->active = FALSE; - return state_machine->deactivate(state_machine); - } - return FALSE; -} - -APT_END_EXTERN_C - -#endif /* MRCP_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h deleted file mode 100644 index 0536ef4b4b..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_engine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_synth_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SYNTH_ENGINE_H -#define MRCP_SYNTH_ENGINE_H - -/** - * @file mrcp_synth_engine.h - * @brief Synthesizer Engine Includes - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -#include "mrcp_synth_resource.h" -#include "mrcp_synth_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_message.h" - -#endif /* MRCP_SYNTH_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h deleted file mode 100644 index 2ddc1ac069..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_synth_state_machine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_synth_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SYNTH_STATE_MACHINE_H -#define MRCP_SYNTH_STATE_MACHINE_H - -/** - * @file mrcp_synth_state_machine.h - * @brief MRCP Synthesizer State Machine - */ - -#include "mrcp_state_machine.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP synthesizer state machine */ -mrcp_state_machine_t* mrcp_synth_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_SYNTH_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h deleted file mode 100644 index e741209c27..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_engine.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_verifier_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_VERIFIER_ENGINE_H -#define MRCP_VERIFIER_ENGINE_H - -/** - * @file mrcp_verifier_engine.h - * @brief Verifier Engine Includes - */ - -#include "mrcp_engine_plugin.h" -#include "mrcp_engine_impl.h" - -#include "mrcp_verifier_resource.h" -#include "mrcp_verifier_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_message.h" - -#endif /* MRCP_VERIFIER_ENGINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h b/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h deleted file mode 100644 index a4b320a87d..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/include/mrcp_verifier_state_machine.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_verifier_state_machine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_VERIFIER_STATE_MACHINE_H -#define MRCP_VERIFIER_STATE_MACHINE_H - -/** - * @file mrcp_verifier_state_machine.h - * @brief MRCP Verifier State Machine - */ - -#include "mrcp_state_machine.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP verifier state machine */ -mrcp_state_machine_t* mrcp_verifier_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_VERIFIER_STATE_MACHINE_H */ diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj deleted file mode 100644 index 8966705a4e..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcproj +++ /dev/null @@ -1,348 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj deleted file mode 100644 index 1288995027..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj +++ /dev/null @@ -1,142 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} - mrcpengine - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {b5a00bfa-6083-4fae-a097-71642d6473b5} - false - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters b/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters deleted file mode 100644 index 33be90e794..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/mrcpengine.vcxproj.filters +++ /dev/null @@ -1,89 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {dd062ad2-9a06-4efc-8e17-328567b52854} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c deleted file mode 100644 index 5c20286fff..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_factory.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mrcp_engine_factory.h" -#include "mrcp_synth_state_machine.h" -#include "mrcp_recog_state_machine.h" -#include "mrcp_recorder_state_machine.h" -#include "mrcp_verifier_state_machine.h" -#include "apt_log.h" - -/** Engine factory declaration */ -struct mrcp_engine_factory_t { - apr_hash_t *engines; - apr_pool_t *pool; -}; - - -MRCP_DECLARE(mrcp_engine_factory_t*) mrcp_engine_factory_create(apr_pool_t *pool) -{ - mrcp_engine_factory_t *factory = apr_palloc(pool,sizeof(mrcp_engine_factory_t)); - factory->pool = pool; - factory->engines = apr_hash_make(pool); - return factory; -} - -/** Destroy registered engines and the factory */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_destroy(mrcp_engine_factory_t *factory) -{ - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy MRCP Engines"); - it=apr_hash_first(factory->pool,factory->engines); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - mrcp_engine_virtual_destroy(engine); - } - } - apr_hash_clear(factory->engines); - return TRUE; -} - -/** Open registered engines */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_open(mrcp_engine_factory_t *factory) -{ - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - it = apr_hash_first(factory->pool,factory->engines); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - mrcp_engine_virtual_open(engine); - } - } - return TRUE; -} - -/** Close registered engines */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_close(mrcp_engine_factory_t *factory) -{ - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - it=apr_hash_first(factory->pool,factory->engines); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - mrcp_engine_virtual_close(engine); - } - } - return TRUE; -} - -/** Register new engine */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_factory_engine_register(mrcp_engine_factory_t *factory, mrcp_engine_t *engine) -{ - if(!engine || !engine->id) { - return FALSE; - } - - switch(engine->resource_id) { - case MRCP_SYNTHESIZER_RESOURCE: - engine->create_state_machine = mrcp_synth_state_machine_create; - break; - case MRCP_RECOGNIZER_RESOURCE: - engine->create_state_machine = mrcp_recog_state_machine_create; - break; - case MRCP_RECORDER_RESOURCE: - engine->create_state_machine = mrcp_recorder_state_machine_create; - break; - case MRCP_VERIFIER_RESOURCE: - engine->create_state_machine = mrcp_verifier_state_machine_create; - break; - default: - break; - } - - if(!engine->create_state_machine) { - return FALSE; - } - - apr_hash_set(factory->engines,engine->id,APR_HASH_KEY_STRING,engine); - return TRUE; -} - -/** Get engine by name */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_get(const mrcp_engine_factory_t *factory, const char *name) -{ - if(!name) { - return NULL; - } - return apr_hash_get(factory->engines,name,APR_HASH_KEY_STRING); -} - -/** Find engine by resource identifier */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_factory_engine_find(const mrcp_engine_factory_t *factory, mrcp_resource_id resource_id) -{ - mrcp_engine_t *engine; - void *val; - apr_hash_index_t *it = apr_hash_first(factory->pool,factory->engines); - /* walk through the engines */ - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine && engine->resource_id == resource_id) { - return engine; - } - } - return NULL; -} - -/** Start iterating over the engines in a factory */ -MRCP_DECLARE(apr_hash_index_t*) mrcp_engine_factory_engine_first(const mrcp_engine_factory_t *factory) -{ - return apr_hash_first(factory->pool,factory->engines); -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c deleted file mode 100644 index daea6039c8..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_iface.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_iface.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_engine_iface.h" -#include "apt_log.h" - -/** Destroy engine */ -apt_bool_t mrcp_engine_virtual_destroy(mrcp_engine_t *engine) -{ - return engine->method_vtable->destroy(engine); -} - -/** Open engine */ -apt_bool_t mrcp_engine_virtual_open(mrcp_engine_t *engine) -{ - if(engine->is_open == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Engine [%s]",engine->id); - return engine->method_vtable->open(engine); - } - return FALSE; -} - -/** Response to open engine request */ -void mrcp_engine_on_open(mrcp_engine_t *engine, apt_bool_t status) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Opened [%s] status [%s]", - engine->id, - status == TRUE ? "success" : "failure"); - engine->is_open = status; -} - -/** Close engine */ -apt_bool_t mrcp_engine_virtual_close(mrcp_engine_t *engine) -{ - if(engine->is_open == TRUE) { - engine->is_open = FALSE; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Engine [%s]",engine->id); - return engine->method_vtable->close(engine); - } - return FALSE; -} - -/** Response to close engine request */ -void mrcp_engine_on_close(mrcp_engine_t *engine) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Closed [%s]",engine->id); - engine->is_open = FALSE; -} - -/** Create engine channel */ -mrcp_engine_channel_t* mrcp_engine_channel_virtual_create(mrcp_engine_t *engine, mrcp_version_e mrcp_version, apr_pool_t *pool) -{ - mrcp_engine_channel_t *channel; - if(engine->is_open != TRUE) { - return NULL; - } - if(engine->config->max_channel_count && engine->cur_channel_count >= engine->config->max_channel_count) { - apt_log(APT_LOG_MARK, APT_PRIO_NOTICE, "Maximum channel count %"APR_SIZE_T_FMT" exceeded for engine [%s]", - engine->config->max_channel_count, engine->id); - return NULL; - } - channel = engine->method_vtable->create_channel(engine,pool); - if(channel) { - channel->mrcp_version = mrcp_version; - engine->cur_channel_count++; - } - return channel; -} - -/** Destroy engine channel */ -apt_bool_t mrcp_engine_channel_virtual_destroy(mrcp_engine_channel_t *channel) -{ - mrcp_engine_t *engine = channel->engine; - if(engine->cur_channel_count) { - engine->cur_channel_count--; - } - return channel->method_vtable->destroy(channel); -} - -/** Allocate engine config */ -mrcp_engine_config_t* mrcp_engine_config_alloc(apr_pool_t *pool) -{ - mrcp_engine_config_t *config = apr_palloc(pool,sizeof(mrcp_engine_config_t)); - config->max_channel_count = 0; - config->params = NULL; - return config; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c deleted file mode 100644 index 2e536e18b4..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_impl.c +++ /dev/null @@ -1,246 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_impl.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_engine_impl.h" -#include "mpf_termination_factory.h" - -/** Create engine */ -mrcp_engine_t* mrcp_engine_create( - mrcp_resource_id resource_id, - void *obj, - const mrcp_engine_method_vtable_t *vtable, - apr_pool_t *pool) -{ - mrcp_engine_t *engine = apr_palloc(pool,sizeof(mrcp_engine_t)); - engine->id = NULL; - engine->resource_id = resource_id; - engine->obj = obj; - engine->method_vtable =vtable; - engine->event_vtable = NULL; - engine->event_obj = NULL; - engine->config = NULL; - engine->codec_manager = NULL; - engine->dir_layout = NULL; - engine->cur_channel_count = 0; - engine->is_open = FALSE; - engine->pool = pool; - engine->create_state_machine = NULL; - return engine; -} - -/** Get engine config */ -const mrcp_engine_config_t* mrcp_engine_config_get(const mrcp_engine_t *engine) -{ - return engine->config; -} - -/** Get engine param by name */ -const char* mrcp_engine_param_get(const mrcp_engine_t *engine, const char *name) -{ - if(!engine->config || !engine->config->params) { - return NULL; - } - return apr_table_get(engine->config->params,name); -} - -/** Create engine channel */ -mrcp_engine_channel_t* mrcp_engine_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *method_vtable, - void *method_obj, - mpf_termination_t *termination, - apr_pool_t *pool) -{ - mrcp_engine_channel_t *channel = apr_palloc(pool,sizeof(mrcp_engine_channel_t)); - channel->method_vtable = method_vtable; - channel->method_obj = method_obj; - channel->event_vtable = NULL; - channel->event_obj = NULL; - channel->termination = termination; - channel->engine = engine; - channel->is_open = FALSE; - channel->pool = pool; - apt_string_reset(&channel->id); - return channel; -} - -/** Create audio termination */ -mpf_termination_t* mrcp_engine_audio_termination_create( - void *obj, - const mpf_audio_stream_vtable_t *stream_vtable, - mpf_stream_capabilities_t *capabilities, - apr_pool_t *pool) -{ - mpf_audio_stream_t *audio_stream; - if(!capabilities) { - return NULL; - } - - if(mpf_codec_capabilities_validate(&capabilities->codecs) == FALSE) { - return NULL; - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - if(!audio_stream) { - return NULL; - } - - /* create media termination */ - return mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - pool); /* pool to allocate memory from */ -} - - -/** Create engine channel and source media termination */ -mrcp_engine_channel_t* mrcp_engine_source_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *channel_vtable, - const mpf_audio_stream_vtable_t *stream_vtable, - void *method_obj, - mpf_codec_descriptor_t *codec_descriptor, - apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities; - mpf_audio_stream_t *audio_stream; - mpf_termination_t *termination; - - capabilities = mpf_source_stream_capabilities_create(pool); - if(codec_descriptor) { - mpf_codec_capabilities_add( - &capabilities->codecs, - mpf_sample_rate_mask_get(codec_descriptor->sampling_rate), - codec_descriptor->name.buf); - } - else { - mpf_codec_default_capabilities_add(&capabilities->codecs); - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - method_obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - if(!audio_stream) { - return NULL; - } - - audio_stream->rx_descriptor = codec_descriptor; - - /* create media termination */ - termination = mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - pool); /* pool to allocate memory from */ - - /* create engine channel base */ - return mrcp_engine_channel_create( - engine, /* engine */ - channel_vtable, /* virtual methods table of engine channel */ - method_obj, /* object to associate */ - termination, /* media termination, used to terminate audio stream */ - pool); /* pool to allocate memory from */ -} - -/** Create engine channel and sink media termination */ -mrcp_engine_channel_t* mrcp_engine_sink_channel_create( - mrcp_engine_t *engine, - const mrcp_engine_channel_method_vtable_t *channel_vtable, - const mpf_audio_stream_vtable_t *stream_vtable, - void *method_obj, - mpf_codec_descriptor_t *codec_descriptor, - apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities; - mpf_audio_stream_t *audio_stream; - mpf_termination_t *termination; - - capabilities = mpf_sink_stream_capabilities_create(pool); - if(codec_descriptor) { - mpf_codec_capabilities_add( - &capabilities->codecs, - mpf_sample_rate_mask_get(codec_descriptor->sampling_rate), - codec_descriptor->name.buf); - } - else { - mpf_codec_default_capabilities_add(&capabilities->codecs); - } - - /* create audio stream */ - audio_stream = mpf_audio_stream_create( - method_obj, /* object to associate */ - stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - if(!audio_stream) { - return NULL; - } - - audio_stream->tx_descriptor = codec_descriptor; - - /* create media termination */ - termination = mpf_raw_termination_create( - NULL, /* no object to associate */ - audio_stream, /* audio stream */ - NULL, /* no video stream */ - pool); /* pool to allocate memory from */ - - /* create engine channel base */ - return mrcp_engine_channel_create( - engine, /* engine */ - channel_vtable, /* virtual methods table of engine channel */ - method_obj, /* object to associate */ - termination, /* media termination, used to terminate audio stream */ - pool); /* pool to allocate memory from */ -} - -/** Get codec descriptor of the audio source stream */ -const mpf_codec_descriptor_t* mrcp_engine_source_stream_codec_get(const mrcp_engine_channel_t *channel) -{ - if(channel && channel->termination) { - mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(audio_stream) { - return audio_stream->rx_descriptor; - } - } - return NULL; -} - -/** Get codec descriptor of the audio sink stream */ -const mpf_codec_descriptor_t* mrcp_engine_sink_stream_codec_get(const mrcp_engine_channel_t *channel) -{ - if(channel && channel->termination) { - mpf_audio_stream_t *audio_stream = mpf_termination_audio_stream_get(channel->termination); - if(audio_stream) { - return audio_stream->tx_descriptor; - } - } - return NULL; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c deleted file mode 100644 index 45996cce7e..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_engine_loader.c +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_engine_loader.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include "mrcp_engine_loader.h" -#include "mrcp_engine_plugin.h" -#include "apt_log.h" - -/** Engine loader declaration */ -struct mrcp_engine_loader_t { - /** Table of plugins (apr_dso_handle_t*) */ - apr_hash_t *plugins; - apr_pool_t *pool; -}; - - -/** Create engine loader */ -MRCP_DECLARE(mrcp_engine_loader_t*) mrcp_engine_loader_create(apr_pool_t *pool) -{ - mrcp_engine_loader_t *loader = apr_palloc(pool,sizeof(mrcp_engine_loader_t)); - loader->pool = pool; - loader->plugins = apr_hash_make(pool); - return loader; -} - -/** Destroy engine loader */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_destroy(mrcp_engine_loader_t *loader) -{ - return mrcp_engine_loader_plugins_unload(loader); -} - -/** Unload loaded plugins */ -MRCP_DECLARE(apt_bool_t) mrcp_engine_loader_plugins_unload(mrcp_engine_loader_t *loader) -{ - apr_hash_index_t *it; - void *val; - apr_dso_handle_t *plugin; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unload Plugins"); - it=apr_hash_first(loader->pool,loader->plugins); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - plugin = val; - if(plugin) { - apr_dso_unload(plugin); - } - } - apr_hash_clear(loader->plugins); - return TRUE; -} - -static apt_bool_t plugin_version_load(apr_dso_handle_t *plugin) -{ - apr_dso_handle_sym_t version_handle = NULL; - if(apr_dso_sym(&version_handle,plugin,MRCP_PLUGIN_VERSION_SYM_NAME) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Version Info Found: %s", MRCP_PLUGIN_VERSION_SYM_NAME); - return FALSE; - } - - if(version_handle) { - mrcp_plugin_version_t *version = (mrcp_plugin_version_t*)version_handle; - if(mrcp_plugin_version_check(version)) { - return TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Incompatible Plugin Version Found [%d.%d.%d] < ["PLUGIN_VERSION_STRING"]", - version->major, - version->minor, - version->patch); - } - } - return FALSE; -} - -static mrcp_plugin_creator_f plugin_creator_load(apr_dso_handle_t *plugin) -{ - apr_dso_handle_sym_t func_handle = NULL; - mrcp_plugin_creator_f plugin_creator = NULL; - - if(apr_dso_sym(&func_handle,plugin,MRCP_PLUGIN_ENGINE_SYM_NAME) == APR_SUCCESS) { - if(func_handle) { - plugin_creator = (mrcp_plugin_creator_f)(intptr_t)func_handle; - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load DSO Symbol: "MRCP_PLUGIN_ENGINE_SYM_NAME); - return NULL; - } - - return plugin_creator; -} - -static apt_bool_t plugin_logger_load(apr_dso_handle_t *plugin) -{ - apr_dso_handle_sym_t func_handle = NULL; - if(apr_dso_sym(&func_handle,plugin,MRCP_PLUGIN_LOGGER_SYM_NAME) != APR_SUCCESS) { - return FALSE; - } - - if(func_handle) { - apt_logger_t *logger = apt_log_instance_get(); - mrcp_plugin_log_accessor_f log_accessor; - log_accessor = (mrcp_plugin_log_accessor_f)(intptr_t)func_handle; - log_accessor(logger); - } - return TRUE; -} - - -/** Load engine plugin */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_engine_loader_plugin_load(mrcp_engine_loader_t *loader, const char *id, const char *path, mrcp_engine_config_t *config) -{ - apr_dso_handle_t *plugin = NULL; - mrcp_plugin_creator_f plugin_creator = NULL; - mrcp_engine_t *engine = NULL; - if(!path || !id) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load Plugin: invalid params"); - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Load Plugin [%s] [%s]",id,path); - if(apr_dso_load(&plugin,path,loader->pool) != APR_SUCCESS) { - char derr[512] = ""; - apr_dso_error(plugin,derr,sizeof(derr)); - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load DSO: %s", derr); - return NULL; - } - - if(plugin_version_load(plugin) != TRUE) { - apr_dso_unload(plugin); - return NULL; - } - - plugin_creator = plugin_creator_load(plugin); - if(!plugin_creator) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Entry Point Found for Plugin"); - apr_dso_unload(plugin); - return NULL; - } - - plugin_logger_load(plugin); - - apr_hash_set(loader->plugins,id,APR_HASH_KEY_STRING,plugin); - - engine = plugin_creator(loader->pool); - if(!engine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create MRCP Engine"); - return NULL; - } - - engine->id = id; - engine->config = config; - return engine; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c deleted file mode 100644 index f205d2ea78..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recog_state_machine.c +++ /dev/null @@ -1,553 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recog_state_machine.c 2228 2014-11-12 01:18:27Z achaloyan@gmail.com $ - */ - -#include "apt_obj_list.h" -#include "apt_log.h" -#include "mrcp_state_machine.h" -#include "mrcp_recog_state_machine.h" -#include "mrcp_recog_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_recog_resource.h" -#include "mrcp_message.h" - -/** MRCP recognizer states */ -typedef enum { - RECOGNIZER_STATE_IDLE, - RECOGNIZER_STATE_RECOGNIZING, - RECOGNIZER_STATE_RECOGNIZED, - - RECOGNIZER_STATE_COUNT -} mrcp_recog_state_e; - -static const char * state_names[RECOGNIZER_STATE_COUNT] = { - "IDLE", - "RECOGNIZING", - "RECOGNIZED" -}; - -typedef struct mrcp_recog_state_machine_t mrcp_recog_state_machine_t; -struct mrcp_recog_state_machine_t { - /** state machine base */ - mrcp_state_machine_t base; - /** recognizer state */ - mrcp_recog_state_e state; - /** indicate whether active_request was processed from pending request queue */ - apt_bool_t is_pending; - /** request sent to recognition engine and waiting for the response to be received */ - mrcp_message_t *active_request; - /** in-progress recognize request */ - mrcp_message_t *recog; - /** queue of pending recognition requests */ - apt_obj_list_t *queue; - /** properties used in set/get params */ - mrcp_message_header_t *properties; -}; - -typedef apt_bool_t (*recog_method_f)(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message); - -static APR_INLINE apt_bool_t recog_request_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = message; - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t recog_response_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = NULL; - if(state_machine->base.active == FALSE) { - /* this is the response to deactivation (STOP) request */ - return state_machine->base.on_deactivate(&state_machine->base); - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t recog_event_dispatch(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->base.active == FALSE) { - /* do nothing, state machine has already been deactivated */ - return FALSE; - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE void recog_state_change(mrcp_recog_state_machine_t *state_machine, mrcp_recog_state_e state, mrcp_message_t *message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT, - state_names[state_machine->state], - state_names[state], - MRCP_MESSAGE_SIDRES(message)); - state_machine->state = state; - if(state == RECOGNIZER_STATE_IDLE) { - state_machine->recog = NULL; - } -} - - -static apt_bool_t recog_request_set_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_set(state_machine->properties,&message->header,message->pool); - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_set_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_get_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_get_params(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool); - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_define_grammar(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recog_response_dispatch(state_machine,response_message); - } - else if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) { - recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message); - } - - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_define_grammar(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message); - recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS; - mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE); - } - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_recognize(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool); - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) { - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Queue Up RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - message->start_line.request_state = MRCP_REQUEST_STATE_PENDING; - apt_list_push_back(state_machine->queue,message,message->pool); - - response = mrcp_response_create(message,message->pool); - response->start_line.request_state = MRCP_REQUEST_STATE_PENDING; - return recog_response_dispatch(state_machine,response); - } - - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_recognize(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - state_machine->recog = state_machine->active_request; - recog_state_change(state_machine,RECOGNIZER_STATE_RECOGNIZING,message); - } - if(state_machine->is_pending == TRUE) { - state_machine->is_pending = FALSE; - /* not to send the response for pending request */ - return TRUE; - } - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_interpret(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool); - return recog_request_dispatch(state_machine,message); -} - -static apt_bool_t recog_response_interpret(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_get_result(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) { - /* found recognized request */ - return recog_request_dispatch(state_machine,message); - } - - /* found no recognized request */ - response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recog_response_dispatch(state_machine,response_message); -} - -static apt_bool_t recog_response_get_result(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_request_recognition_start_timers(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) { - /* found in-progress request */ - return recog_request_dispatch(state_machine,message); - } - - /* found no in-progress request */ - response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recog_response_dispatch(state_machine,response_message); -} - -static apt_bool_t recog_response_recognition_start_timers(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recog_response_dispatch(state_machine,message); -} - -static apt_bool_t recog_pending_requests_remove(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *request_message, mrcp_message_t *response_message) -{ - apt_list_elem_t *elem; - mrcp_message_t *pending_message; - mrcp_request_id_list_t *request_id_list = NULL; - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request_message); - mrcp_generic_header_t *response_generic_header = mrcp_generic_header_prepare(response_message); - if(generic_header && mrcp_generic_header_property_check(request_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) { - if(generic_header->active_request_id_list.count) { - /* selective STOP request */ - request_id_list = &generic_header->active_request_id_list; - } - } - - elem = apt_list_first_elem_get(state_machine->queue); - while(elem) { - pending_message = apt_list_elem_object_get(elem); - if(!request_id_list || active_request_id_list_find(generic_header,pending_message->start_line.request_id) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_message), - pending_message->start_line.request_id); - elem = apt_list_elem_remove(state_machine->queue,elem); - /* append active id list */ - active_request_id_list_append(response_generic_header,pending_message->start_line.request_id); - } - else { - /* speak request remains in the queue, just proceed to the next one */ - elem = apt_list_next_elem_get(state_machine->queue,elem); - } - } - if(response_generic_header->active_request_id_list.count) { - mrcp_generic_header_property_add(response_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - } - return TRUE; -} - -static apt_bool_t recog_request_stop(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == RECOGNIZER_STATE_RECOGNIZING) { - mrcp_request_id_list_t *request_id_list = NULL; - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message); - if(generic_header && mrcp_generic_header_property_check(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) { - if(generic_header->active_request_id_list.count) { - /* selective STOP request */ - request_id_list = &generic_header->active_request_id_list; - } - } - - if(!request_id_list || active_request_id_list_find(generic_header,state_machine->recog->start_line.request_id) == TRUE) { - /* found in-progress RECOGNIZE request, stop it */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Found IN-PROGRESS RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return recog_request_dispatch(state_machine,message); - } - } - else if(state_machine->state == RECOGNIZER_STATE_RECOGNIZED) { - recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message); - } - - /* found no in-progress RECOGNIZE request, sending immediate response */ - response_message = mrcp_response_create(message,message->pool); - recog_pending_requests_remove(state_machine,message,response_message); - return recog_response_dispatch(state_machine,response_message); -} - -static apt_bool_t recog_response_stop(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *pending_request; - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->recog->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - recog_pending_requests_remove(state_machine,state_machine->active_request,message); - recog_state_change(state_machine,RECOGNIZER_STATE_IDLE,message); - pending_request = apt_list_pop_front(state_machine->queue); - recog_response_dispatch(state_machine,message); - - /* process pending RECOGNIZE requests / if any */ - if(pending_request) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_request), - pending_request->start_line.request_id); - state_machine->is_pending = TRUE; - recog_request_dispatch(state_machine,pending_request); - } - return TRUE; -} - -static apt_bool_t recog_event_start_of_input(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->recog) { - /* unexpected event, no in-progress recognition request */ - return FALSE; - } - - if(state_machine->recog->start_line.request_id != message->start_line.request_id) { - /* unexpected event */ - return FALSE; - } - - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - return recog_event_dispatch(state_machine,message); -} - -static apt_bool_t recog_event_recognition_complete(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *pending_request; - if(!state_machine->recog) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->recog->start_line.request_id != message->start_line.request_id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->active_request && state_machine->active_request->start_line.method_id == RECOGNIZER_STOP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore RECOGNITION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message); - recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS; - mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE); - } - recog_state_change(state_machine,RECOGNIZER_STATE_RECOGNIZED,message); - recog_event_dispatch(state_machine,message); - - /* process pending RECOGNIZE requests */ - pending_request = apt_list_pop_front(state_machine->queue); - if(pending_request) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending RECOGNIZE Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_request), - pending_request->start_line.request_id); - state_machine->is_pending = TRUE; - recog_request_dispatch(state_machine,pending_request); - } - return TRUE; -} - -static apt_bool_t recog_event_interpretation_complete(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(mrcp_resource_header_property_check(message,RECOGNIZER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_recog_header_t *recog_header = mrcp_resource_header_prepare(message); - recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS; - mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE); - } - return recog_event_dispatch(state_machine,message); -} - -static recog_method_f recog_request_method_array[RECOGNIZER_METHOD_COUNT] = { - recog_request_set_params, - recog_request_get_params, - recog_request_define_grammar, - recog_request_recognize, - recog_request_interpret, - recog_request_get_result, - recog_request_recognition_start_timers, - recog_request_stop -}; - -static recog_method_f recog_response_method_array[RECOGNIZER_METHOD_COUNT] = { - recog_response_set_params, - recog_response_get_params, - recog_response_define_grammar, - recog_response_recognize, - recog_response_interpret, - recog_response_get_result, - recog_response_recognition_start_timers, - recog_response_stop -}; - -static recog_method_f recog_event_method_array[RECOGNIZER_EVENT_COUNT] = { - recog_event_start_of_input, - recog_event_recognition_complete, - recog_event_interpretation_complete -}; - -/** Update state according to received incoming request from MRCP client */ -static apt_bool_t recog_request_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - recog_method_f method; - if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recog_request_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recog_request_dispatch(state_machine,message); -} - -/** Update state according to received outgoing response from recognition engine */ -static apt_bool_t recog_response_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - recog_method_f method; - if(!state_machine->active_request) { - /* unexpected response, no active request waiting for response */ - return FALSE; - } - if(state_machine->active_request->start_line.request_id != message->start_line.request_id) { - /* unexpected response, request id doesn't match */ - return FALSE; - } - - if(message->start_line.method_id >= RECOGNIZER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recog_response_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recog_response_dispatch(state_machine,message); -} - -/** Update state according to received outgoing event from recognition engine */ -static apt_bool_t recog_event_state_update(mrcp_recog_state_machine_t *state_machine, mrcp_message_t *message) -{ - recog_method_f method; - if(message->start_line.method_id >= RECOGNIZER_EVENT_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recog_event_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recog_event_dispatch(state_machine,message); -} - -/** Update state according to request received from MRCP client or response/event received from recognition engine */ -static apt_bool_t recog_state_update(mrcp_state_machine_t *base, mrcp_message_t *message) -{ - mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base; - apt_bool_t status = TRUE; - switch(message->start_line.message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = recog_request_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = recog_response_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = recog_event_state_update(state_machine,message); - break; - default: - status = FALSE; - break; - } - return status; -} - -/** Deactivate state machine */ -static apt_bool_t recog_state_deactivate(mrcp_state_machine_t *base) -{ - mrcp_recog_state_machine_t *state_machine = (mrcp_recog_state_machine_t*)base; - mrcp_message_t *message; - mrcp_message_t *source; - if(state_machine->state != RECOGNIZER_STATE_RECOGNIZING) { - /* no in-progress RECOGNIZE request to deactivate */ - return FALSE; - } - source = state_machine->recog; - if(!source) { - return FALSE; - } - - /* create internal STOP request */ - message = mrcp_request_create( - source->resource, - source->start_line.version, - RECOGNIZER_STOP, - source->pool); - message->channel_id = source->channel_id; - message->start_line.request_id = source->start_line.request_id + 1; - apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */ - message->header = source->header; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return recog_request_dispatch(state_machine,message); -} - -/** Create MRCP recognizer state machine */ -mrcp_state_machine_t* mrcp_recog_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool) -{ - mrcp_recog_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_recog_state_machine_t)); - mrcp_state_machine_init(&state_machine->base,obj); - state_machine->base.update = recog_state_update; - state_machine->base.deactivate = recog_state_deactivate; - state_machine->state = RECOGNIZER_STATE_IDLE; - state_machine->is_pending = FALSE; - state_machine->active_request = NULL; - state_machine->recog = NULL; - state_machine->queue = apt_list_create(pool); - state_machine->properties = mrcp_message_header_create( - mrcp_generic_header_vtable_get(version), - mrcp_recog_header_vtable_get(version), - pool); - return &state_machine->base; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c deleted file mode 100644 index ad7bd7b1b6..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_recorder_state_machine.c +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recorder_state_machine.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_obj_list.h" -#include "apt_log.h" -#include "mrcp_recorder_state_machine.h" -#include "mrcp_generic_header.h" -#include "mrcp_recorder_header.h" -#include "mrcp_recorder_resource.h" -#include "mrcp_message.h" - -/** MRCP recorder states */ -typedef enum { - RECORDER_STATE_IDLE, - RECORDER_STATE_RECORDING, - - RECORDER_STATE_COUNT -} mrcp_recorder_state_e; - -static const char * state_names[RECORDER_STATE_COUNT] = { - "IDLE", - "RECORDING", -}; - -typedef struct mrcp_recorder_state_machine_t mrcp_recorder_state_machine_t; - -struct mrcp_recorder_state_machine_t { - /** state machine base */ - mrcp_state_machine_t base; - /** recorder state */ - mrcp_recorder_state_e state; - /** request sent to recorder engine and waiting for the response to be received */ - mrcp_message_t *active_request; - /** in-progress record request */ - mrcp_message_t *record; - /** properties used in set/get params */ - mrcp_message_header_t *properties; -}; - -typedef apt_bool_t (*recorder_method_f)(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message); - -static APR_INLINE apt_bool_t recorder_request_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = message; - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t recorder_response_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = NULL; - if(state_machine->base.active == FALSE) { - /* this is the response to deactivation (STOP) request */ - return state_machine->base.on_deactivate(&state_machine->base); - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t recorder_event_dispatch(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->base.active == FALSE) { - /* do nothing, state machine has already been deactivated */ - return FALSE; - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE void recorder_state_change(mrcp_recorder_state_machine_t *state_machine, mrcp_recorder_state_e state, mrcp_message_t *message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT, - state_names[state_machine->state], - state_names[state], - MRCP_MESSAGE_SIDRES(message)); - state_machine->state = state; - if(state == RECORDER_STATE_IDLE) { - state_machine->record = NULL; - } -} - - -static apt_bool_t recorder_request_set_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_set(state_machine->properties,&message->header,message->pool); - return recorder_request_dispatch(state_machine,message); -} - -static apt_bool_t recorder_response_set_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_request_get_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recorder_request_dispatch(state_machine,message); -} - -static apt_bool_t recorder_response_get_params(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool); - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_request_record(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool); - if(state_machine->state == RECORDER_STATE_RECORDING) { - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Reject RECORD Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - - /* there is in-progress request, reject this one */ - response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recorder_response_dispatch(state_machine,response); - } - - return recorder_request_dispatch(state_machine,message); -} - -static apt_bool_t recorder_response_record(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - state_machine->record = state_machine->active_request; - recorder_state_change(state_machine,RECORDER_STATE_RECORDING,message); - } - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_request_stop(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response; - if(state_machine->state == RECORDER_STATE_RECORDING) { - /* found in-progress RECORDER request, stop it */ - return recorder_request_dispatch(state_machine,message); - } - - /* found no in-progress RECORDER request, sending immediate response */ - response = mrcp_response_create(message,message->pool); - return recorder_response_dispatch(state_machine,response); -} - -static apt_bool_t recorder_response_stop(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->record->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - recorder_state_change(state_machine,RECORDER_STATE_IDLE,message); - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_request_start_timers(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response; - if(state_machine->state == RECORDER_STATE_RECORDING) { - /* found in-progress request */ - return recorder_request_dispatch(state_machine,message); - } - - /* found no in-progress request */ - response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return recorder_response_dispatch(state_machine,response); -} - -static apt_bool_t recorder_response_start_timers(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - return recorder_response_dispatch(state_machine,message); -} - -static apt_bool_t recorder_event_start_of_input(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->record) { - /* unexpected event, no in-progress record request */ - return FALSE; - } - - if(state_machine->record->start_line.request_id != message->start_line.request_id) { - /* unexpected event */ - return FALSE; - } - - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - return recorder_event_dispatch(state_machine,message); -} - -static apt_bool_t recorder_event_record_complete(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->record) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->record->start_line.request_id != message->start_line.request_id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->active_request && state_machine->active_request->start_line.method_id == RECORDER_STOP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore RECORD-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(mrcp_resource_header_property_check(message,RECORDER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_recorder_header_t *recorder_header = mrcp_resource_header_prepare(message); - recorder_header->completion_cause = RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE; - mrcp_resource_header_property_add(message,RECORDER_HEADER_COMPLETION_CAUSE); - } - recorder_state_change(state_machine,RECORDER_STATE_IDLE,message); - return recorder_event_dispatch(state_machine,message); -} - -static recorder_method_f recorder_request_method_array[RECORDER_METHOD_COUNT] = { - recorder_request_set_params, - recorder_request_get_params, - recorder_request_record, - recorder_request_stop, - recorder_request_start_timers -}; - -static recorder_method_f recorder_response_method_array[RECORDER_METHOD_COUNT] = { - recorder_response_set_params, - recorder_response_get_params, - recorder_response_record, - recorder_response_stop, - recorder_response_start_timers -}; - -static recorder_method_f recorder_event_method_array[RECORDER_EVENT_COUNT] = { - recorder_event_start_of_input, - recorder_event_record_complete -}; - -/** Update state according to received incoming request from MRCP client */ -static apt_bool_t recorder_request_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - recorder_method_f method; - if(message->start_line.method_id >= RECORDER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recorder_request_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recorder_request_dispatch(state_machine,message); -} - -/** Update state according to received outgoing response from recorder engine */ -static apt_bool_t recorder_response_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - recorder_method_f method; - if(!state_machine->active_request) { - /* unexpected response, no active request waiting for response */ - return FALSE; - } - if(state_machine->active_request->start_line.request_id != message->start_line.request_id) { - /* unexpected response, request id doesn't match */ - return FALSE; - } - - if(message->start_line.method_id >= RECORDER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recorder_response_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recorder_response_dispatch(state_machine,message); -} - -/** Update state according to received outgoing event from recorder engine */ -static apt_bool_t recorder_event_state_update(mrcp_recorder_state_machine_t *state_machine, mrcp_message_t *message) -{ - recorder_method_f method; - if(message->start_line.method_id >= RECORDER_EVENT_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = recorder_event_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return recorder_event_dispatch(state_machine,message); -} - -/** Update state according to request received from MRCP client or response/event received from recorder engine */ -static apt_bool_t recorder_state_update(mrcp_state_machine_t *base, mrcp_message_t *message) -{ - mrcp_recorder_state_machine_t *state_machine = (mrcp_recorder_state_machine_t*)base; - apt_bool_t status = TRUE; - switch(message->start_line.message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = recorder_request_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = recorder_response_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = recorder_event_state_update(state_machine,message); - break; - default: - status = FALSE; - break; - } - return status; -} - -/** Deactivate state machine */ -static apt_bool_t recorder_state_deactivate(mrcp_state_machine_t *base) -{ - mrcp_recorder_state_machine_t *state_machine = (mrcp_recorder_state_machine_t*)base; - mrcp_message_t *message; - mrcp_message_t *source; - if(state_machine->state != RECORDER_STATE_RECORDING) { - /* no in-progress RECORD request to deactivate */ - return FALSE; - } - source = state_machine->record; - if(!source) { - return FALSE; - } - - /* create internal STOP request */ - message = mrcp_request_create( - source->resource, - source->start_line.version, - RECORDER_STOP, - source->pool); - message->channel_id = source->channel_id; - message->start_line.request_id = source->start_line.request_id + 1; - apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */ - message->header = source->header; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return recorder_request_dispatch(state_machine,message); -} - -/** Create MRCP recorder state machine */ -mrcp_state_machine_t* mrcp_recorder_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool) -{ - mrcp_recorder_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_recorder_state_machine_t)); - mrcp_state_machine_init(&state_machine->base,obj); - state_machine->base.update = recorder_state_update; - state_machine->base.deactivate = recorder_state_deactivate; - state_machine->state = RECORDER_STATE_IDLE; - state_machine->active_request = NULL; - state_machine->record = NULL; - state_machine->properties = mrcp_message_header_create( - mrcp_generic_header_vtable_get(version), - mrcp_recorder_header_vtable_get(version), - pool); - return &state_machine->base; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c deleted file mode 100644 index 205f39c0bf..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_synth_state_machine.c +++ /dev/null @@ -1,612 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_synth_state_machine.c 2228 2014-11-12 01:18:27Z achaloyan@gmail.com $ - */ - -#include "apt_obj_list.h" -#include "apt_log.h" -#include "mrcp_state_machine.h" -#include "mrcp_synth_state_machine.h" -#include "mrcp_synth_header.h" -#include "mrcp_generic_header.h" -#include "mrcp_synth_resource.h" -#include "mrcp_message.h" - -/** MRCP synthesizer states */ -typedef enum { - SYNTHESIZER_STATE_IDLE, - SYNTHESIZER_STATE_SPEAKING, - SYNTHESIZER_STATE_PAUSED, - - SYNTHESIZER_STATE_COUNT -} mrcp_synth_state_e; - -static const char * state_names[SYNTHESIZER_STATE_COUNT] = { - "IDLE", - "SPEAKING", - "PAUSED" -}; - -typedef struct mrcp_synth_state_machine_t mrcp_synth_state_machine_t; -struct mrcp_synth_state_machine_t { - /** state machine base */ - mrcp_state_machine_t base; - /** synthesizer state */ - mrcp_synth_state_e state; - /** indicate whether active_request was processed from pending request queue */ - apt_bool_t is_pending; - /** request sent to synthesizer engine and waiting for the response to be received */ - mrcp_message_t *active_request; - /** in-progress speak request */ - mrcp_message_t *speaker; - /** queue of pending speak requests */ - apt_obj_list_t *queue; - /** properties used in set/get params */ - mrcp_message_header_t *properties; -}; - -typedef apt_bool_t (*synth_method_f)(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message); - -static APR_INLINE apt_bool_t synth_request_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = message; - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t synth_response_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = NULL; - if(state_machine->base.active == FALSE) { - /* this is the response to deactivation (STOP) request */ - return state_machine->base.on_deactivate(&state_machine->base); - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t synth_event_dispatch(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->base.active == FALSE) { - /* do nothing, state machine has already been deactivated */ - return FALSE; - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE void synth_state_change(mrcp_synth_state_machine_t *state_machine, mrcp_synth_state_e state, mrcp_message_t *message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"State Transition %s -> %s "APT_SIDRES_FMT, - state_names[state_machine->state], - state_names[state], - MRCP_MESSAGE_SIDRES(message)); - state_machine->state = state; - if(state == SYNTHESIZER_STATE_IDLE) { - state_machine->speaker = NULL; - } -} - - -static apt_bool_t synth_request_set_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_set(state_machine->properties,&message->header,message->pool); - return synth_request_dispatch(state_machine,message); -} - -static apt_bool_t synth_response_set_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_request_get_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - return synth_request_dispatch(state_machine,message); -} - -static apt_bool_t synth_response_get_params(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool); - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_request_speak(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_inherit(&message->header,state_machine->properties,message->pool); - if(state_machine->speaker) { - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Queue Up SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - message->start_line.request_state = MRCP_REQUEST_STATE_PENDING; - apt_list_push_back(state_machine->queue,message,message->pool); - - response = mrcp_response_create(message,message->pool); - response->start_line.request_state = MRCP_REQUEST_STATE_PENDING; - return synth_response_dispatch(state_machine,response); - } - - return synth_request_dispatch(state_machine,message); -} - -static apt_bool_t synth_response_speak(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - state_machine->speaker = state_machine->active_request; - synth_state_change(state_machine,SYNTHESIZER_STATE_SPEAKING,message); - } - if(state_machine->is_pending == TRUE) { - mrcp_message_t *event_message = mrcp_event_create( - state_machine->active_request, - SYNTHESIZER_SPEECH_MARKER, - state_machine->active_request->pool); - event_message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - state_machine->is_pending = FALSE; - /* not to send the response for pending request, instead send SPEECH-MARKER event */ - return synth_event_dispatch(state_machine,event_message); - } - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_pending_requests_remove(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *request_message, mrcp_message_t *response_message) -{ - apt_list_elem_t *elem; - mrcp_message_t *pending_message; - mrcp_request_id_list_t *request_id_list = NULL; - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request_message); - mrcp_generic_header_t *response_generic_header = mrcp_generic_header_prepare(response_message); - if(generic_header && mrcp_generic_header_property_check(request_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) { - if(generic_header->active_request_id_list.count) { - /* selective STOP request */ - request_id_list = &generic_header->active_request_id_list; - } - } - - elem = apt_list_first_elem_get(state_machine->queue); - while(elem) { - pending_message = apt_list_elem_object_get(elem); - if(!request_id_list || active_request_id_list_find(generic_header,pending_message->start_line.request_id) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_message), - pending_message->start_line.request_id); - elem = apt_list_elem_remove(state_machine->queue,elem); - /* append active id list */ - active_request_id_list_append(response_generic_header,pending_message->start_line.request_id); - } - else { - /* speak request remains in the queue, just proceed to the next one */ - elem = apt_list_next_elem_get(state_machine->queue,elem); - } - } - if(response_generic_header->active_request_id_list.count) { - mrcp_generic_header_property_add(response_message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - } - return TRUE; -} - -static apt_bool_t synth_request_stop(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->speaker) { - mrcp_request_id_list_t *request_id_list = NULL; - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(message); - if(generic_header && mrcp_generic_header_property_check(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST) == TRUE) { - if(generic_header->active_request_id_list.count) { - /* selective STOP request */ - request_id_list = &generic_header->active_request_id_list; - } - } - - if(!request_id_list || active_request_id_list_find(generic_header,state_machine->speaker->start_line.request_id) == TRUE) { - /* found in-progress SPEAK request, stop it */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Found IN-PROGRESS SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return synth_request_dispatch(state_machine,message); - } - } - - /* found no in-progress SPEAK request, sending immediate response */ - response_message = mrcp_response_create(message,message->pool); - synth_pending_requests_remove(state_machine,message,response_message); - return synth_response_dispatch(state_machine,response_message); -} - -static apt_bool_t synth_response_stop(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *pending_request; - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - synth_pending_requests_remove(state_machine,state_machine->active_request,message); - synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message); - pending_request = apt_list_pop_front(state_machine->queue); - synth_response_dispatch(state_machine,message); - - /* process pending SPEAK requests / if any */ - if(pending_request) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - pending_request->start_line.request_id); - state_machine->is_pending = TRUE; - synth_request_dispatch(state_machine,pending_request); - } - return TRUE; -} - -static apt_bool_t synth_request_pause(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->speaker) { - /* speaking or paused state */ - if(state_machine->state == SYNTHESIZER_STATE_SPEAKING) { - synth_request_dispatch(state_machine,message); - } - else { - /* paused state */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - synth_response_dispatch(state_machine,response_message); - } - } - else { - /* idle state */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - synth_response_dispatch(state_machine,response_message); - } - return TRUE; -} - -static apt_bool_t synth_response_pause(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.status_code == MRCP_STATUS_CODE_SUCCESS) { - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - synth_state_change(state_machine,SYNTHESIZER_STATE_PAUSED,message); - } - synth_response_dispatch(state_machine,message); - return TRUE; -} - -static apt_bool_t synth_request_resume(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->speaker) { - /* speaking or paused state */ - if(state_machine->state == SYNTHESIZER_STATE_PAUSED) { - synth_request_dispatch(state_machine,message); - } - else { - /* speaking state */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - synth_response_dispatch(state_machine,response_message); - } - } - else { - /* idle state */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - synth_response_dispatch(state_machine,response_message); - } - return TRUE; -} - -static apt_bool_t synth_response_resume(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(message->start_line.status_code == MRCP_STATUS_CODE_SUCCESS) { - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - synth_state_change(state_machine,SYNTHESIZER_STATE_SPEAKING,message); - } - synth_response_dispatch(state_machine,message); - return TRUE; -} - -static apt_bool_t synth_request_barge_in_occurred(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->speaker) { - apt_bool_t kill_on_barge_in = TRUE; - mrcp_synth_header_t *synth_header = mrcp_resource_header_get(message); - if(synth_header) { - if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_KILL_ON_BARGE_IN) == TRUE) { - kill_on_barge_in = synth_header->kill_on_barge_in; - } - } - - if(kill_on_barge_in == TRUE) { - return synth_request_dispatch(state_machine,message); - } - } - - /* found no kill-on-bargein enabled in-progress SPEAK request, sending immediate response */ - response_message = mrcp_response_create(message,message->pool); - return synth_response_dispatch(state_machine,response_message); -} - -static apt_bool_t synth_response_barge_in_occurred(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - synth_pending_requests_remove(state_machine,state_machine->active_request,message); - synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message); - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_request_control(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == SYNTHESIZER_STATE_SPEAKING) { - return synth_request_dispatch(state_machine,message); - } - - /* found no in-progress SPEAK request, sending immediate response */ - response_message = mrcp_response_create(message,message->pool); - return synth_response_dispatch(state_machine,response_message); -} - -static apt_bool_t synth_response_control(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->speaker->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_request_define_lexicon(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *response_message; - if(state_machine->state == SYNTHESIZER_STATE_IDLE) { - return synth_request_dispatch(state_machine,message); - } - - /* sending failure response */ - response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return synth_response_dispatch(state_machine,response_message); -} - -static apt_bool_t synth_response_define_lexicon(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - return synth_response_dispatch(state_machine,message); -} - -static apt_bool_t synth_event_speech_marker(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->speaker) { - /* unexpected event, no in-progress speak request */ - return FALSE; - } - - if(state_machine->speaker->start_line.request_id != message->start_line.request_id) { - /* unexpected event */ - return FALSE; - } - - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - return synth_event_dispatch(state_machine,message); -} - -static apt_bool_t synth_event_speak_complete(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_message_t *pending_request; - if(!state_machine->speaker) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->speaker->start_line.request_id != message->start_line.request_id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->active_request && state_machine->active_request->start_line.method_id == SYNTHESIZER_STOP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore SPEAK-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(message); - synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL; - mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE); - } - synth_state_change(state_machine,SYNTHESIZER_STATE_IDLE,message); - synth_event_dispatch(state_machine,message); - - /* process pending SPEAK requests */ - pending_request = apt_list_pop_front(state_machine->queue); - if(pending_request) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process Pending SPEAK Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(pending_request), - pending_request->start_line.request_id); - state_machine->is_pending = TRUE; - synth_request_dispatch(state_machine,pending_request); - } - return TRUE; -} - -static synth_method_f synth_request_method_array[SYNTHESIZER_METHOD_COUNT] = { - synth_request_set_params, - synth_request_get_params, - synth_request_speak, - synth_request_stop, - synth_request_pause, - synth_request_resume, - synth_request_barge_in_occurred, - synth_request_control, - synth_request_define_lexicon -}; - -static synth_method_f synth_response_method_array[SYNTHESIZER_METHOD_COUNT] = { - synth_response_set_params, - synth_response_get_params, - synth_response_speak, - synth_response_stop, - synth_response_pause, - synth_response_resume, - synth_response_barge_in_occurred, - synth_response_control, - synth_response_define_lexicon, -}; - -static synth_method_f synth_event_method_array[SYNTHESIZER_EVENT_COUNT] = { - synth_event_speech_marker, - synth_event_speak_complete -}; - -/** Update state according to received incoming request from MRCP client */ -static apt_bool_t synth_request_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - synth_method_f method; - if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = synth_request_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return synth_request_dispatch(state_machine,message); -} - -/** Update state according to received outgoing response from synthesizer engine */ -static apt_bool_t synth_response_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - synth_method_f method; - if(!state_machine->active_request) { - /* unexpected response, no active request waiting for response */ - return FALSE; - } - if(state_machine->active_request->start_line.request_id != message->start_line.request_id) { - /* unexpected response, request id doesn't match */ - return FALSE; - } - - if(message->start_line.method_id >= SYNTHESIZER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = synth_response_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return synth_response_dispatch(state_machine,message); -} - -/** Update state according to received outgoing event from synthesizer engine */ -static apt_bool_t synth_event_state_update(mrcp_synth_state_machine_t *state_machine, mrcp_message_t *message) -{ - synth_method_f method; - if(message->start_line.method_id >= SYNTHESIZER_EVENT_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = synth_event_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return synth_event_dispatch(state_machine,message); -} - -/** Update state according to request received from MRCP client or response/event received from synthesizer engine */ -static apt_bool_t synth_state_update(mrcp_state_machine_t *base, mrcp_message_t *message) -{ - mrcp_synth_state_machine_t *synth_state_machine = (mrcp_synth_state_machine_t*)base; - apt_bool_t status = TRUE; - switch(message->start_line.message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = synth_request_state_update(synth_state_machine,message); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = synth_response_state_update(synth_state_machine,message); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = synth_event_state_update(synth_state_machine,message); - break; - default: - status = FALSE; - break; - } - return status; -} - -/** Deactivate state machine */ -static apt_bool_t synth_state_deactivate(mrcp_state_machine_t *base) -{ - mrcp_synth_state_machine_t *state_machine = (mrcp_synth_state_machine_t*)base; - mrcp_message_t *message; - mrcp_message_t *source; - if(!state_machine->speaker) { - /* no in-progress SPEAK request to deactivate */ - return FALSE; - } - source = state_machine->speaker; - - /* create internal STOP request */ - message = mrcp_request_create( - source->resource, - source->start_line.version, - SYNTHESIZER_STOP, - source->pool); - message->channel_id = source->channel_id; - message->start_line.request_id = source->start_line.request_id + 1; - apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */ - message->header = source->header; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return synth_request_dispatch(state_machine,message); -} - -/** Create MRCP synthesizer state machine */ -mrcp_state_machine_t* mrcp_synth_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool) -{ - mrcp_synth_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_synth_state_machine_t)); - mrcp_state_machine_init(&state_machine->base,obj); - state_machine->base.update = synth_state_update; - state_machine->base.deactivate = synth_state_deactivate; - state_machine->state = SYNTHESIZER_STATE_IDLE; - state_machine->is_pending = FALSE; - state_machine->active_request = NULL; - state_machine->speaker = NULL; - state_machine->queue = apt_list_create(pool); - state_machine->properties = mrcp_message_header_create( - mrcp_generic_header_vtable_get(version), - mrcp_synth_header_vtable_get(version), - pool); - return &state_machine->base; -} diff --git a/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c b/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c deleted file mode 100644 index 6ca313e51c..0000000000 --- a/libs/unimrcp/libs/mrcp-engine/src/mrcp_verifier_state_machine.c +++ /dev/null @@ -1,524 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_verifier_state_machine.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_obj_list.h" -#include "apt_log.h" -#include "mrcp_verifier_state_machine.h" -#include "mrcp_generic_header.h" -#include "mrcp_verifier_header.h" -#include "mrcp_verifier_resource.h" -#include "mrcp_message.h" - -/** MRCP verifier states */ -typedef enum { - VERIFIER_STATE_IDLE, - VERIFIER_STATE_OPENED, - VERIFIER_STATE_VERIFYING, - - VERIFIER_STATE_COUNT -} mrcp_verifier_state_e; - -static const char * state_names[VERIFIER_STATE_COUNT] = { - "IDLE", - "OPENED", - "VERIFYING" -}; - -typedef struct mrcp_verifier_state_machine_t mrcp_verifier_state_machine_t; - -struct mrcp_verifier_state_machine_t { - /** state machine base */ - mrcp_state_machine_t base; - /** verifier state */ - mrcp_verifier_state_e state; - /** request sent to verification engine and waiting for the response to be received */ - mrcp_message_t *active_request; - /** in-progress verify request */ - mrcp_message_t *verify; - /** properties used in set/get params */ - mrcp_message_header_t *properties; -}; - -typedef apt_bool_t (*verifier_method_f)(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message); - -static APR_INLINE apt_bool_t verifier_request_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = message; - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t verifier_response_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - state_machine->active_request = NULL; - if(state_machine->base.active == FALSE) { - /* this is the response to deactivation (STOP) request */ - return state_machine->base.on_deactivate(&state_machine->base); - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE apt_bool_t verifier_event_dispatch(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->base.active == FALSE) { - /* do nothing, state machine has already been deactivated */ - return FALSE; - } - return state_machine->base.on_dispatch(&state_machine->base,message); -} - -static APR_INLINE void verifier_state_change(mrcp_verifier_state_machine_t *state_machine, mrcp_verifier_state_e state, mrcp_message_t *message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"State Transition %s -> %s "APT_SIDRES_FMT, - state_names[state_machine->state], - state_names[state], - MRCP_MESSAGE_SIDRES(message)); - state_machine->state = state; - if(state == VERIFIER_STATE_IDLE) { - state_machine->verify = NULL; - } -} - - -static apt_bool_t verifier_request_set_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_set(state_machine->properties,&message->header,message->pool); - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_set_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_get_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_get_params(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_header_fields_get(&message->header,state_machine->properties,&state_machine->active_request->header,message->pool); - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_start_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_start_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message); - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_end_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_end_session(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_state_change(state_machine,VERIFIER_STATE_IDLE,message); - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_query_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_query_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_delete_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_delete_voiceprint(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_verify(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - state_machine->verify = message; - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_verify(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_state_change(state_machine,VERIFIER_STATE_VERIFYING,message); - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_verify_from_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - state_machine->verify = message; - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_verify_from_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_state_change(state_machine,VERIFIER_STATE_VERIFYING,message); - - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_verify_rollback(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_verify_rollback(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_stop(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - if(state_machine->state == VERIFIER_STATE_OPENED) { - /* no in-progress VERIFY request, sending immediate response */ - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_stop(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - /* append active id list */ - active_request_id_list_append(generic_header,state_machine->verify->start_line.request_id); - mrcp_generic_header_property_add(message,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message); - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_clear_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_clear_buffer(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_start_input_timers(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state == VERIFIER_STATE_IDLE || state_machine->state == VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_start_input_timers(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - -static apt_bool_t verifier_request_get_intermidiate_result(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(state_machine->state != VERIFIER_STATE_VERIFYING) { - mrcp_message_t *response_message = mrcp_response_create(message,message->pool); - response_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_NOT_VALID; - return verifier_response_dispatch(state_machine,response_message); - } - return verifier_request_dispatch(state_machine,message); -} - -static apt_bool_t verifier_response_get_intermidiate_result(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - return verifier_response_dispatch(state_machine,message); -} - - -static apt_bool_t verifier_event_start_of_input(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->verify) { - /* unexpected event, no in-progress verify request */ - return FALSE; - } - - if(state_machine->verify->start_line.request_id != message->start_line.request_id) { - /* unexpected event */ - return FALSE; - } - - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - return verifier_event_dispatch(state_machine,message); -} - -static apt_bool_t verifier_event_verification_complete(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - if(!state_machine->verify) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->verify->start_line.request_id != message->start_line.request_id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Unexpected VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(state_machine->active_request && state_machine->active_request->start_line.method_id == VERIFIER_STOP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Ignore VERIFICATION-COMPLETE Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]: waiting for STOP response", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - - if(mrcp_resource_header_property_check(message,VERIFIER_HEADER_COMPLETION_CAUSE) != TRUE) { - mrcp_verifier_header_t *verifier_header = mrcp_resource_header_prepare(message); - verifier_header->completion_cause = VERIFIER_COMPLETION_CAUSE_SUCCESS; - mrcp_resource_header_property_add(message,VERIFIER_HEADER_COMPLETION_CAUSE); - } - verifier_state_change(state_machine,VERIFIER_STATE_OPENED,message); - return verifier_event_dispatch(state_machine,message); -} - -static verifier_method_f verifier_request_method_array[VERIFIER_METHOD_COUNT] = { - verifier_request_set_params, - verifier_request_get_params, - verifier_request_start_session, - verifier_request_end_session, - verifier_request_query_voiceprint, - verifier_request_delete_voiceprint, - verifier_request_verify, - verifier_request_verify_from_buffer, - verifier_request_verify_rollback, - verifier_request_stop, - verifier_request_clear_buffer, - verifier_request_start_input_timers, - verifier_request_get_intermidiate_result -}; - -static verifier_method_f verifier_response_method_array[VERIFIER_METHOD_COUNT] = { - verifier_response_set_params, - verifier_response_get_params, - verifier_response_start_session, - verifier_response_end_session, - verifier_response_query_voiceprint, - verifier_response_delete_voiceprint, - verifier_response_verify, - verifier_response_verify_from_buffer, - verifier_response_verify_rollback, - verifier_response_stop, - verifier_response_clear_buffer, - verifier_response_start_input_timers, - verifier_response_get_intermidiate_result -}; - -static verifier_method_f verifier_event_method_array[VERIFIER_EVENT_COUNT] = { - verifier_event_start_of_input, - verifier_event_verification_complete -}; - -/** Update state according to received incoming request from MRCP client */ -static apt_bool_t verifier_request_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_method_f method; - if(message->start_line.method_id >= VERIFIER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = verifier_request_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return verifier_request_dispatch(state_machine,message); -} - -/** Update state according to received outgoing response from verification engine */ -static apt_bool_t verifier_response_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_method_f method; - if(!state_machine->active_request) { - /* unexpected response, no active request waiting for response */ - return FALSE; - } - if(state_machine->active_request->start_line.request_id != message->start_line.request_id) { - /* unexpected response, request id doesn't match */ - return FALSE; - } - - if(message->start_line.method_id >= VERIFIER_METHOD_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Response "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = verifier_response_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return verifier_response_dispatch(state_machine,message); -} - -/** Update state according to received outgoing event from verification engine */ -static apt_bool_t verifier_event_state_update(mrcp_verifier_state_machine_t *state_machine, mrcp_message_t *message) -{ - verifier_method_f method; - if(message->start_line.method_id >= VERIFIER_EVENT_COUNT) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Process %s Event "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - message->start_line.method_name.buf, - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - method = verifier_event_method_array[message->start_line.method_id]; - if(method) { - return method(state_machine,message); - } - return verifier_event_dispatch(state_machine,message); -} - -/** Update state according to request received from MRCP client or response/event received from verification engine */ -static apt_bool_t verifier_state_update(mrcp_state_machine_t *base, mrcp_message_t *message) -{ - mrcp_verifier_state_machine_t *state_machine = (mrcp_verifier_state_machine_t*)base; - apt_bool_t status = TRUE; - switch(message->start_line.message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = verifier_request_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = verifier_response_state_update(state_machine,message); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = verifier_event_state_update(state_machine,message); - break; - default: - status = FALSE; - break; - } - return status; -} - -/** Deactivate state machine */ -static apt_bool_t verifier_state_deactivate(mrcp_state_machine_t *base) -{ - mrcp_verifier_state_machine_t *state_machine = (mrcp_verifier_state_machine_t*)base; - mrcp_message_t *message; - mrcp_message_t *source; - if(state_machine->state != VERIFIER_STATE_VERIFYING) { - /* no in-progress VERIFY request to deactivate */ - return FALSE; - } - source = state_machine->verify; - if(!source) { - return FALSE; - } - - /* create internal STOP request */ - message = mrcp_request_create( - source->resource, - source->start_line.version, - VERIFIER_STOP, - source->pool); - message->channel_id = source->channel_id; - message->start_line.request_id = source->start_line.request_id + 1; - apt_string_set(&message->start_line.method_name,"DEACTIVATE"); /* informative only */ - message->header = source->header; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create and Process STOP Request "APT_SIDRES_FMT" [%"MRCP_REQUEST_ID_FMT"]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return verifier_request_dispatch(state_machine,message); -} - -/** Create MRCP verification state machine */ -mrcp_state_machine_t* mrcp_verifier_state_machine_create(void *obj, mrcp_version_e version, apr_pool_t *pool) -{ - mrcp_verifier_state_machine_t *state_machine = apr_palloc(pool,sizeof(mrcp_verifier_state_machine_t)); - mrcp_state_machine_init(&state_machine->base,obj); - state_machine->base.update = verifier_state_update; - state_machine->base.deactivate = verifier_state_deactivate; - state_machine->state = VERIFIER_STATE_IDLE; - state_machine->active_request = NULL; - state_machine->verify = NULL; - state_machine->properties = mrcp_message_header_create( - mrcp_generic_header_vtable_get(version), - mrcp_verifier_header_vtable_get(version), - pool); - return &state_machine->base; -} diff --git a/libs/unimrcp/libs/mrcp-server/Makefile.am b/libs/unimrcp/libs/mrcp-server/Makefile.am deleted file mode 100644 index 0ebf90cab0..0000000000 --- a/libs/unimrcp/libs/mrcp-server/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-server/include \ - -I$(top_srcdir)/libs/mrcp-engine/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpserver.la - -include_HEADERS = include/mrcp_server_types.h \ - include/mrcp_server.h \ - include/mrcp_server_session.h - -libmrcpserver_la_SOURCES = src/mrcp_server.c \ - src/mrcp_server_session.c diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h deleted file mode 100644 index a51186dd88..0000000000 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_server.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SERVER_H -#define MRCP_SERVER_H - -/** - * @file mrcp_server.h - * @brief MRCP Server - */ - -#include "mrcp_server_types.h" -#include "mrcp_engine_iface.h" -#include "mpf_rtp_descriptor.h" -#include "apt_task.h" - -APT_BEGIN_EXTERN_C - -/** - * Create MRCP server instance. - * @return the created server instance - */ -MRCP_DECLARE(mrcp_server_t*) mrcp_server_create(apt_dir_layout_t *dir_layout); - -/** - * Start message processing loop. - * @param server the MRCP server to start - * @return the created server instance - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_start(mrcp_server_t *server); - -/** - * Shutdown message processing loop. - * @param server the MRCP server to shutdown - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_shutdown(mrcp_server_t *server); - -/** - * Destroy MRCP server. - * @param server the MRCP server to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_destroy(mrcp_server_t *server); - - -/** - * Register MRCP resource factory. - * @param server the MRCP server to set resource factory for - * @param resource_factory the resource factory to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_resource_factory_register( - mrcp_server_t *server, - mrcp_resource_factory_t *resource_factory); - -/** - * Register MRCP engine. - * @param server the MRCP server to set engine for - * @param engine the engine to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_engine_register( - mrcp_server_t *server, - mrcp_engine_t *engine); - -/** - * Register codec manager. - * @param server the MRCP server to set codec manager for - * @param codec_manager the codec manager to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_codec_manager_register(mrcp_server_t *server, mpf_codec_manager_t *codec_manager); - -/** - * Get registered codec manager. - * @param server the MRCP server to get codec manager from - */ -MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_server_codec_manager_get(const mrcp_server_t *server); - -/** - * Register media engine. - * @param server the MRCP server to set media engine for - * @param media_engine the media engine to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_media_engine_register( - mrcp_server_t *server, - mpf_engine_t *media_engine); - -/** - * Register RTP termination factory. - * @param server the MRCP server to set termination factory for - * @param rtp_termination_factory the termination factory - * @param name the name of the factory - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_factory_register( - mrcp_server_t *server, - mpf_termination_factory_t *rtp_termination_factory, - const char *name); - -/** - * Register RTP settings. - * @param server the MRCP server to set RTP settings for - * @param rtp_settings the settings to set - * @param name the name of the settings - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_settings_register( - mrcp_server_t *server, - mpf_rtp_settings_t *rtp_settings, - const char *name); - -/** - * Register MRCP signaling agent. - * @param server the MRCP server to set signaling agent for - * @param signaling_agent the signaling agent to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_signaling_agent_register( - mrcp_server_t *server, - mrcp_sig_agent_t *signaling_agent); - -/** - * Register MRCP connection agent (MRCPv2 only). - * @param server the MRCP server to set connection agent for - * @param connection_agent the connection agent to set - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register( - mrcp_server_t *server, - mrcp_connection_agent_t *connection_agent); - -/** Create MRCP profile */ -MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_create( - const char *id, - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - apr_pool_t *pool); - -/** - * Register MRCP profile. - * @param server the MRCP server to set profile for - * @param profile the profile to set - * @param plugin_map the map of engines (plugins) - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register( - mrcp_server_t *server, - mrcp_server_profile_t *profile, - apr_table_t *plugin_map); - -/** - * Load MRCP engine as a plugin. - * @param server the MRCP server to use - * @param id the identifier of the plugin - * @param path the path to the plugin to load - * @param config the config of the engine - */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_server_engine_load( - mrcp_server_t *server, - const char *id, - const char *path, - mrcp_engine_config_t *config); - -/** - * Get memory pool. - * @param server the MRCP server to get memory pool from - */ -MRCP_DECLARE(apr_pool_t*) mrcp_server_memory_pool_get(const mrcp_server_t *server); - -/** - * Get media engine by name. - * @param server the MRCP server to get media engine from - * @param name the name of the media engine to lookup - */ -MRCP_DECLARE(mpf_engine_t*) mrcp_server_media_engine_get(const mrcp_server_t *server, const char *name); - -/** - * Get RTP termination factory by name. - * @param server the MRCP server to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mpf_termination_factory_t*) mrcp_server_rtp_factory_get(const mrcp_server_t *server, const char *name); - -/** - * Get RTP settings by name - * @param server the MRCP server to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_server_rtp_settings_get(const mrcp_server_t *server, const char *name); - -/** - * Get signaling agent by name. - * @param server the MRCP server to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_server_signaling_agent_get(const mrcp_server_t *server, const char *name); - -/** - * Get connection agent by name. - * @param server the MRCP server to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(const mrcp_server_t *server, const char *name); - -/** - * Get profile by name. - * @param server the MRCP client to get from - * @param name the name to lookup - */ -MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name); - -APT_END_EXTERN_C - -#endif /* MRCP_SERVER_H */ diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h deleted file mode 100644 index af456a021a..0000000000 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_session.h +++ /dev/null @@ -1,163 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_server_session.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SERVER_SESSION_H -#define MRCP_SERVER_SESSION_H - -/** - * @file mrcp_server_session.h - * @brief MRCP Server Session - */ - -#include -#include "mrcp_session.h" -#include "mpf_engine.h" -#include "apt_task.h" -#include "apt_obj_list.h" - - -APT_BEGIN_EXTERN_C - -/** Opaque MRCP channel declaration */ -typedef struct mrcp_channel_t mrcp_channel_t; -/** MRCP server session declaration */ -typedef struct mrcp_server_session_t mrcp_server_session_t; -/** MRCP signaling message declaration */ -typedef struct mrcp_signaling_message_t mrcp_signaling_message_t; - -/** Enumeration of signaling task messages */ -typedef enum { - SIGNALING_MESSAGE_OFFER, - SIGNALING_MESSAGE_CONTROL, - SIGNALING_MESSAGE_TERMINATE, -} mrcp_signaling_message_type_e; - -/** MRCP signaling message */ -struct mrcp_signaling_message_t { - /** Signaling message type */ - mrcp_signaling_message_type_e type; - - /** Session */ - mrcp_server_session_t *session; - /** Descriptor */ - mrcp_session_descriptor_t *descriptor; - - /** Channel */ - mrcp_channel_t *channel; - /** MRCP message */ - mrcp_message_t *message; -}; - -/** Server session states */ -typedef enum { - SESSION_STATE_NONE, /**< initial state */ - SESSION_STATE_GENERATING_ANSWER, /**< received offer, generating answer now */ - SESSION_STATE_INITIALIZING, /**< answer is ready, finally initializing channels now */ - SESSION_STATE_DEACTIVATING, /**< received session termination request, deinitializing channels now */ - SESSION_STATE_TERMINATING /**< finally terminating session */ -} mrcp_server_session_state_e; - - -/** MRCP server session */ -struct mrcp_server_session_t { - /** Session base */ - mrcp_session_t base; - /** MRCP server */ - mrcp_server_t *server; - /** MRCP profile */ - mrcp_server_profile_t *profile; - - /** Media context */ - mpf_context_t *context; - - /** Media termination array */ - apr_array_header_t *terminations; - /** MRCP control channel array */ - apr_array_header_t *channels; - - /** In-progress signaling request */ - mrcp_signaling_message_t *active_request; - /** Signaling request queue */ - apt_obj_list_t *request_queue; - - /** In-progress offer */ - mrcp_session_descriptor_t *offer; - /** In-progres answer */ - mrcp_session_descriptor_t *answer; - - /** MPF task message, which construction is in progress */ - mpf_task_msg_t *mpf_task_msg; - - /** Session state */ - mrcp_server_session_state_e state; - /** Number of in-progress sub requests */ - apr_size_t subrequest_count; -}; - -/** MRCP server profile */ -struct mrcp_server_profile_t { - /** Identifier of the profile */ - const char *id; - /** MRCP version */ - mrcp_version_e mrcp_version; - /** Table of engines (mrcp_engine_t*) */ - apr_hash_t *engine_table; - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** Media processing engine */ - mpf_engine_t *media_engine; - /** RTP termination factory */ - mpf_termination_factory_t *rtp_termination_factory; - /** RTP settings */ - mpf_rtp_settings_t *rtp_settings; - /** Signaling agent */ - mrcp_sig_agent_t *signaling_agent; - /** Connection agent */ - mrcp_connection_agent_t *connection_agent; -}; - -/** Create server session */ -mrcp_server_session_t* mrcp_server_session_create(void); - -/** Process signaling message */ -apt_bool_t mrcp_server_signaling_message_process(mrcp_signaling_message_t *signaling_message); -/** Process MPF message */ -apt_bool_t mrcp_server_mpf_message_process(mpf_message_container_t *mpf_message_container); - -/** Process channel modify event */ -apt_bool_t mrcp_server_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *answer, apt_bool_t status); -/** Process channel remove event */ -apt_bool_t mrcp_server_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status); -/** Process channel message receive */ -apt_bool_t mrcp_server_on_channel_message(mrcp_channel_t *channel, mrcp_message_t *message); -/** Process connection disconnect event */ -apt_bool_t mrcp_server_on_disconnect(mrcp_channel_t *channel); - -/** Process channel open event */ -apt_bool_t mrcp_server_on_engine_channel_open(mrcp_channel_t *channel, apt_bool_t status); -/** Process channel close event */ -apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel); -/** Process message receive event */ -apt_bool_t mrcp_server_on_engine_channel_message(mrcp_channel_t *channel, mrcp_message_t *message); - -/** Get session by channel */ -mrcp_session_t* mrcp_server_channel_session_get(mrcp_channel_t *channel); - -APT_END_EXTERN_C - -#endif /* MRCP_SERVER_SESSION_H */ diff --git a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h b/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h deleted file mode 100644 index 99c0b615ae..0000000000 --- a/libs/unimrcp/libs/mrcp-server/include/mrcp_server_types.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_server_types.h 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SERVER_TYPES_H -#define MRCP_SERVER_TYPES_H - -/** - * @file mrcp_server_types.h - * @brief MRCP Server Types - */ - -#include "mrcp_sig_types.h" -#include "mrcp_connection_types.h" -#include "mpf_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MRCP server declaration */ -typedef struct mrcp_server_t mrcp_server_t; - -/** Opaque MRCP server profile declaration */ -typedef struct mrcp_server_profile_t mrcp_server_profile_t; - - -APT_END_EXTERN_C - -#endif /* MRCP_SERVER_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj deleted file mode 100644 index da47c522b9..0000000000 --- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj deleted file mode 100644 index 1d3fff21bc..0000000000 --- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {18B1F35A-10F8-4287-9B37-2D10501B0B38} - mrcpserver - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters b/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters deleted file mode 100644 index 866a6dfbbc..0000000000 --- a/libs/unimrcp/libs/mrcp-server/mrcpserver.vcxproj.filters +++ /dev/null @@ -1,32 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4557fd27-79b0-442d-809b-82996c7da820} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c b/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c deleted file mode 100644 index d37528917e..0000000000 --- a/libs/unimrcp/libs/mrcp-server/src/mrcp_server.c +++ /dev/null @@ -1,999 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_server.c 2251 2014-11-21 02:36:44Z achaloyan@gmail.com $ - */ - -#include "mrcp_server.h" -#include "mrcp_server_session.h" -#include "mrcp_message.h" -#include "mrcp_resource_factory.h" -#include "mrcp_resource.h" -#include "mrcp_engine_factory.h" -#include "mrcp_engine_loader.h" -#include "mrcp_sig_agent.h" -#include "mrcp_server_connection.h" -#include "mpf_termination_factory.h" -#include "apt_pool.h" -#include "apt_consumer_task.h" -#include "apt_obj_list.h" -#include "apt_log.h" - -#define SERVER_TASK_NAME "MRCP Server" - -/** MRCP server */ -struct mrcp_server_t { - /** Main message processing task */ - apt_consumer_task_t *task; - - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** MRCP engine factory */ - mrcp_engine_factory_t *engine_factory; - /** Loader of plugins for MRCP engines */ - mrcp_engine_loader_t *engine_loader; - - /** Codec manager */ - mpf_codec_manager_t *codec_manager; - /** Table of media processing engines (mpf_engine_t*) */ - apr_hash_t *media_engine_table; - /** Table of RTP termination factories (mpf_termination_factory_t*) */ - apr_hash_t *rtp_factory_table; - /** Table of signaling agents (mrcp_sig_agent_t*) */ - apr_hash_t *sig_agent_table; - /** Table of connection agents (mrcp_connection_agent_t*) */ - apr_hash_t *cnt_agent_table; - /** Table of RTP settings (mpf_rtp_settings_t*) */ - apr_hash_t *rtp_settings_table; - /** Table of profiles (mrcp_server_profile_t*) */ - apr_hash_t *profile_table; - - /** Table of sessions */ - apr_hash_t *session_table; - - /** Connection task message pool */ - apt_task_msg_pool_t *connection_msg_pool; - /** Engine task message pool */ - apt_task_msg_pool_t *engine_msg_pool; - - /** Dir layout structure */ - apt_dir_layout_t *dir_layout; - /** Time server started at */ - apr_time_t start_time; - /** Memory pool */ - apr_pool_t *pool; -}; - - -typedef enum { - MRCP_SERVER_SIGNALING_TASK_MSG = TASK_MSG_USER, - MRCP_SERVER_CONNECTION_TASK_MSG, - MRCP_SERVER_ENGINE_TASK_MSG, - MRCP_SERVER_MEDIA_TASK_MSG -} mrcp_server_task_msg_type_e; - - -static apt_bool_t mrcp_server_offer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_server_terminate_signal(mrcp_session_t *session); -static apt_bool_t mrcp_server_control_signal(mrcp_session_t *session, mrcp_message_t *message); - -static const mrcp_session_request_vtable_t session_request_vtable = { - mrcp_server_offer_signal, - mrcp_server_terminate_signal, - mrcp_server_control_signal, - NULL /* mrcp_server_discover_signal */ -}; - - -/* Connection agent interface */ -typedef enum { - CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL, - CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL, - CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL, - CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE, - CONNECTION_AGENT_TASK_MSG_DISCONNECT -} connection_agent_task_msg_type_e; - -typedef struct connection_agent_task_msg_data_t connection_agent_task_msg_data_t; -struct connection_agent_task_msg_data_t { - mrcp_channel_t *channel; - mrcp_control_descriptor_t *descriptor; - mrcp_message_t *message; - apt_bool_t status; -}; - -static apt_bool_t mrcp_server_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -static apt_bool_t mrcp_server_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); -static apt_bool_t mrcp_server_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status); -static apt_bool_t mrcp_server_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message); -static apt_bool_t mrcp_server_disconnect_signal(mrcp_control_channel_t *channel); - -static const mrcp_connection_event_vtable_t connection_method_vtable = { - mrcp_server_channel_add_signal, - mrcp_server_channel_modify_signal, - mrcp_server_channel_remove_signal, - mrcp_server_message_signal, - mrcp_server_disconnect_signal -}; - - -/* MRCP engine interface */ -typedef enum { - ENGINE_TASK_MSG_OPEN_ENGINE, - ENGINE_TASK_MSG_CLOSE_ENGINE, - ENGINE_TASK_MSG_OPEN_CHANNEL, - ENGINE_TASK_MSG_CLOSE_CHANNEL, - ENGINE_TASK_MSG_MESSAGE -} engine_task_msg_type_e; - -typedef struct engine_task_msg_data_t engine_task_msg_data_t; -struct engine_task_msg_data_t { - mrcp_engine_t *engine; - mrcp_channel_t *channel; - apt_bool_t status; - mrcp_message_t *mrcp_message; -}; - -static apt_bool_t mrcp_server_engine_open_signal(mrcp_engine_t *engine, apt_bool_t status); -static apt_bool_t mrcp_server_engine_close_signal(mrcp_engine_t *engine); - -const mrcp_engine_event_vtable_t engine_vtable = { - mrcp_server_engine_open_signal, - mrcp_server_engine_close_signal, -}; - -static apt_bool_t mrcp_server_channel_open_signal(mrcp_engine_channel_t *channel, apt_bool_t status); -static apt_bool_t mrcp_server_channel_close_signal(mrcp_engine_channel_t *channel); -static apt_bool_t mrcp_server_channel_message_signal(mrcp_engine_channel_t *channel, mrcp_message_t *message); - -const mrcp_engine_channel_event_vtable_t engine_channel_vtable = { - mrcp_server_channel_open_signal, - mrcp_server_channel_close_signal, - mrcp_server_channel_message_signal -}; - -/* Task interface */ -static apt_bool_t mrcp_server_msg_process(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t mrcp_server_start_request_process(apt_task_t *task); -static apt_bool_t mrcp_server_terminate_request_process(apt_task_t *task); -static void mrcp_server_on_start_complete(apt_task_t *task); -static void mrcp_server_on_terminate_complete(apt_task_t *task); - -static mrcp_session_t* mrcp_server_sig_agent_session_create(mrcp_sig_agent_t *signaling_agent); - - -/** Create MRCP server instance */ -MRCP_DECLARE(mrcp_server_t*) mrcp_server_create(apt_dir_layout_t *dir_layout) -{ - mrcp_server_t *server; - apr_pool_t *pool; - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - pool = apt_pool_create(); - if(!pool) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create "SERVER_TASK_NAME); - server = apr_palloc(pool,sizeof(mrcp_server_t)); - server->pool = pool; - server->dir_layout = dir_layout; - server->resource_factory = NULL; - server->engine_factory = NULL; - server->engine_loader = NULL; - server->media_engine_table = NULL; - server->rtp_factory_table = NULL; - server->sig_agent_table = NULL; - server->cnt_agent_table = NULL; - server->rtp_settings_table = NULL; - server->profile_table = NULL; - server->session_table = NULL; - server->connection_msg_pool = NULL; - server->engine_msg_pool = NULL; - - msg_pool = apt_task_msg_pool_create_dynamic(0,pool); - - server->task = apt_consumer_task_create(server,msg_pool,pool); - if(!server->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Server Task"); - return NULL; - } - task = apt_consumer_task_base_get(server->task); - apt_task_name_set(task,SERVER_TASK_NAME); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = mrcp_server_msg_process; - vtable->process_start = mrcp_server_start_request_process; - vtable->process_terminate = mrcp_server_terminate_request_process; - vtable->on_start_complete = mrcp_server_on_start_complete; - vtable->on_terminate_complete = mrcp_server_on_terminate_complete; - } - - server->engine_factory = mrcp_engine_factory_create(server->pool); - server->engine_loader = mrcp_engine_loader_create(server->pool); - - server->media_engine_table = apr_hash_make(server->pool); - server->rtp_factory_table = apr_hash_make(server->pool); - server->rtp_settings_table = apr_hash_make(server->pool); - server->sig_agent_table = apr_hash_make(server->pool); - server->cnt_agent_table = apr_hash_make(server->pool); - - server->profile_table = apr_hash_make(server->pool); - - server->session_table = apr_hash_make(server->pool); - return server; -} - -/** Start message processing loop */ -MRCP_DECLARE(apt_bool_t) mrcp_server_start(mrcp_server_t *server) -{ - apt_task_t *task; - if(!server || !server->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server"); - return FALSE; - } - server->start_time = apr_time_now(); - task = apt_consumer_task_base_get(server->task); - if(apt_task_start(task) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Server Task"); - return FALSE; - } - return TRUE; -} - -/** Shutdown message processing loop */ -MRCP_DECLARE(apt_bool_t) mrcp_server_shutdown(mrcp_server_t *server) -{ - apt_task_t *task; - apr_time_t uptime; - if(!server || !server->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server"); - return FALSE; - } - task = apt_consumer_task_base_get(server->task); - if(apt_task_terminate(task,TRUE) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Shutdown Server Task"); - return FALSE; - } - server->session_table = NULL; - uptime = apr_time_now() - server->start_time; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Server Uptime [%"APR_TIME_T_FMT" sec]", apr_time_sec(uptime)); - return TRUE; -} - -/** Destroy MRCP server */ -MRCP_DECLARE(apt_bool_t) mrcp_server_destroy(mrcp_server_t *server) -{ - apt_task_t *task; - if(!server || !server->task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Server"); - return FALSE; - } - - mrcp_engine_factory_destroy(server->engine_factory); - mrcp_engine_loader_destroy(server->engine_loader); - - task = apt_consumer_task_base_get(server->task); - apt_task_destroy(task); - - apr_pool_destroy(server->pool); - return TRUE; -} - -/** Register MRCP resource factory */ -MRCP_DECLARE(apt_bool_t) mrcp_server_resource_factory_register(mrcp_server_t *server, mrcp_resource_factory_t *resource_factory) -{ - if(!resource_factory) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Resource Factory"); - server->resource_factory = resource_factory; - return TRUE; -} - -/** Register MRCP engine */ -MRCP_DECLARE(apt_bool_t) mrcp_server_engine_register(mrcp_server_t *server, mrcp_engine_t *engine) -{ - if(!engine || !engine->id) { - return FALSE; - } - - if(!server->engine_msg_pool) { - server->engine_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(engine_task_msg_data_t),server->pool); - } - engine->codec_manager = server->codec_manager; - engine->dir_layout = server->dir_layout; - engine->event_vtable = &engine_vtable; - engine->event_obj = server; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register MRCP Engine [%s]",engine->id); - return mrcp_engine_factory_engine_register(server->engine_factory,engine); -} - -/** Register codec manager */ -MRCP_DECLARE(apt_bool_t) mrcp_server_codec_manager_register(mrcp_server_t *server, mpf_codec_manager_t *codec_manager) -{ - if(!codec_manager) { - return FALSE; - } - server->codec_manager = codec_manager; - return TRUE; -} - -/** Get registered codec manager */ -MRCP_DECLARE(const mpf_codec_manager_t*) mrcp_server_codec_manager_get(const mrcp_server_t *server) -{ - return server->codec_manager; -} - -/** Register media engine */ -MRCP_DECLARE(apt_bool_t) mrcp_server_media_engine_register(mrcp_server_t *server, mpf_engine_t *media_engine) -{ - const char *id; - if(!media_engine) { - return FALSE; - } - id = mpf_engine_id_get(media_engine); - if(!id) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Media Engine [%s]",id); - mpf_engine_codec_manager_register(media_engine,server->codec_manager); - apr_hash_set(server->media_engine_table,id,APR_HASH_KEY_STRING,media_engine); - mpf_engine_task_msg_type_set(media_engine,MRCP_SERVER_MEDIA_TASK_MSG); - if(server->task) { - apt_task_t *media_task = mpf_task_get(media_engine); - apt_task_t *task = apt_consumer_task_base_get(server->task); - apt_task_add(task,media_task); - } - return TRUE; -} - -/** Get media engine by name */ -MRCP_DECLARE(mpf_engine_t*) mrcp_server_media_engine_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->media_engine_table,name,APR_HASH_KEY_STRING); -} - -/** Register RTP termination factory */ -MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_factory_register(mrcp_server_t *server, mpf_termination_factory_t *rtp_termination_factory, const char *name) -{ - if(!rtp_termination_factory || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Termination Factory [%s]",name); - apr_hash_set(server->rtp_factory_table,name,APR_HASH_KEY_STRING,rtp_termination_factory); - return TRUE; -} - -/** Get RTP termination factory by name */ -MRCP_DECLARE(mpf_termination_factory_t*) mrcp_server_rtp_factory_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->rtp_factory_table,name,APR_HASH_KEY_STRING); -} - -/** Register RTP settings */ -MRCP_DECLARE(apt_bool_t) mrcp_server_rtp_settings_register(mrcp_server_t *server, mpf_rtp_settings_t *rtp_settings, const char *name) -{ - if(!rtp_settings || !name) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register RTP Settings [%s]",name); - apr_hash_set(server->rtp_settings_table,name,APR_HASH_KEY_STRING,rtp_settings); - return TRUE; -} - -/** Get RTP settings by name */ -MRCP_DECLARE(mpf_rtp_settings_t*) mrcp_server_rtp_settings_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->rtp_settings_table,name,APR_HASH_KEY_STRING); -} - -/** Register MRCP signaling agent */ -MRCP_DECLARE(apt_bool_t) mrcp_server_signaling_agent_register(mrcp_server_t *server, mrcp_sig_agent_t *signaling_agent) -{ - if(!signaling_agent || !signaling_agent->id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Signaling Agent [%s]",signaling_agent->id); - signaling_agent->parent = server; - signaling_agent->resource_factory = server->resource_factory; - signaling_agent->create_server_session = mrcp_server_sig_agent_session_create; - signaling_agent->msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mrcp_signaling_message_t*),server->pool); - apr_hash_set(server->sig_agent_table,signaling_agent->id,APR_HASH_KEY_STRING,signaling_agent); - if(server->task) { - apt_task_t *task = apt_consumer_task_base_get(server->task); - apt_task_add(task,signaling_agent->task); - } - return TRUE; -} - -/** Get signaling agent by name */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_server_signaling_agent_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->sig_agent_table,name,APR_HASH_KEY_STRING); -} - -/** Register MRCP connection agent (MRCPv2 only) */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_register(mrcp_server_t *server, mrcp_connection_agent_t *connection_agent) -{ - const char *id; - if(!connection_agent) { - return FALSE; - } - id = mrcp_server_connection_agent_id_get(connection_agent); - if(!id) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Connection Agent [%s]",id); - mrcp_server_connection_resource_factory_set(connection_agent,server->resource_factory); - mrcp_server_connection_agent_handler_set(connection_agent,server,&connection_method_vtable); - server->connection_msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_agent_task_msg_data_t),server->pool); - apr_hash_set(server->cnt_agent_table,id,APR_HASH_KEY_STRING,connection_agent); - if(server->task) { - apt_task_t *task = apt_consumer_task_base_get(server->task); - apt_task_t *connection_task = mrcp_server_connection_agent_task_get(connection_agent); - apt_task_add(task,connection_task); - } - return TRUE; -} - -/** Get connection agent by name */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->cnt_agent_table,name,APR_HASH_KEY_STRING); -} - -/** Create MRCP profile */ -MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_create( - const char *id, - mrcp_version_e mrcp_version, - mrcp_resource_factory_t *resource_factory, - mrcp_sig_agent_t *signaling_agent, - mrcp_connection_agent_t *connection_agent, - mpf_engine_t *media_engine, - mpf_termination_factory_t *rtp_factory, - mpf_rtp_settings_t *rtp_settings, - apr_pool_t *pool) -{ - mrcp_server_profile_t *profile = apr_palloc(pool,sizeof(mrcp_server_profile_t)); - profile->id = id; - profile->mrcp_version = mrcp_version; - profile->resource_factory = resource_factory; - profile->engine_table = NULL; - profile->media_engine = media_engine; - profile->rtp_termination_factory = rtp_factory; - profile->rtp_settings = rtp_settings; - profile->signaling_agent = signaling_agent; - profile->connection_agent = connection_agent; - - mpf_termination_factory_engine_assign(rtp_factory,media_engine); - return profile; -} - -static apt_bool_t mrcp_server_engine_table_make(mrcp_server_t *server, mrcp_server_profile_t *profile, apr_table_t *plugin_map) -{ - int i; - mrcp_resource_t *resource; - const char *plugin_name = NULL; - mrcp_engine_t *engine; - - profile->engine_table = apr_hash_make(server->pool); - for(i=0; iresource_factory,i); - if(!resource) continue; - - engine = NULL; - /* first, try to find engine by name specified in plugin map (if available) */ - if(plugin_map) { - plugin_name = apr_table_get(plugin_map,resource->name.buf); - if(plugin_name) { - engine = mrcp_engine_factory_engine_get(server->engine_factory,plugin_name); - } - } - - /* next, if no engine found or specified, try to find the first available one */ - if(!engine) { - engine = mrcp_engine_factory_engine_find(server->engine_factory,i); - } - - if(engine) { - if(engine->id) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Assign MRCP Engine [%s] [%s]",resource->name.buf,engine->id); - } - apr_hash_set(profile->engine_table,resource->name.buf,resource->name.length,engine); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No MRCP Engine Available [%s]",resource->name.buf); - } - } - - return TRUE; -} - -/** Register MRCP profile */ -MRCP_DECLARE(apt_bool_t) mrcp_server_profile_register( - mrcp_server_t *server, - mrcp_server_profile_t *profile, - apr_table_t *plugin_map) -{ - if(!profile || !profile->id) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile: no name"); - return FALSE; - } - if(!profile->resource_factory) { - if(!server->resource_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing resource factory",profile->id); - return FALSE; - } - profile->resource_factory = server->resource_factory; - } - mrcp_server_engine_table_make(server,profile,plugin_map); - - if(!profile->signaling_agent) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing signaling agent",profile->id); - return FALSE; - } - if(profile->mrcp_version == MRCP_VERSION_2 && - !profile->connection_agent) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing connection agent",profile->id); - return FALSE; - } - if(!profile->media_engine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing media engine",profile->id); - return FALSE; - } - if(!profile->rtp_termination_factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Register Profile [%s]: missing RTP factory",profile->id); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Register Profile [%s]",profile->id); - apr_hash_set(server->profile_table,profile->id,APR_HASH_KEY_STRING,profile); - return TRUE; -} - -/** Get profile by name */ -MRCP_DECLARE(mrcp_server_profile_t*) mrcp_server_profile_get(const mrcp_server_t *server, const char *name) -{ - return apr_hash_get(server->profile_table,name,APR_HASH_KEY_STRING); -} - -/** Load MRCP engine */ -MRCP_DECLARE(mrcp_engine_t*) mrcp_server_engine_load( - mrcp_server_t *server, - const char *id, - const char *path, - mrcp_engine_config_t *config) -{ - mrcp_engine_t *engine; - if(!id || !path || !config) { - return FALSE; - } - - engine = mrcp_engine_loader_plugin_load(server->engine_loader,id,path,config); - if(!engine) { - return FALSE; - } - - return engine; -} - -MRCP_DECLARE(apr_pool_t*) mrcp_server_memory_pool_get(const mrcp_server_t *server) -{ - return server->pool; -} - -void mrcp_server_session_add(mrcp_server_session_t *session) -{ - if(session->base.id.buf) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Add Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base)); - apr_hash_set(session->server->session_table,session->base.id.buf,session->base.id.length,session); - } -} - -void mrcp_server_session_remove(mrcp_server_session_t *session) -{ - if(session->base.id.buf) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Remove Session "APT_SID_FMT,MRCP_SESSION_SID(&session->base)); - apr_hash_set(session->server->session_table,session->base.id.buf,session->base.id.length,NULL); - } -} - -static APR_INLINE mrcp_server_session_t* mrcp_server_session_find(mrcp_server_t *server, const apt_str_t *session_id) -{ - return apr_hash_get(server->session_table,session_id->buf,session_id->length); -} - -static apt_bool_t mrcp_server_start_request_process(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_server_t *server = apt_consumer_task_object_get(consumer_task); - - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - it = mrcp_engine_factory_engine_first(server->engine_factory); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - if(mrcp_engine_virtual_open(engine) == TRUE) { - apt_task_start_request_add(task); - } - } - } - - return apt_task_start_request_process(task); -} - -static apt_bool_t mrcp_server_terminate_request_process(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_server_t *server = apt_consumer_task_object_get(consumer_task); - - mrcp_engine_t *engine; - apr_hash_index_t *it; - void *val; - it = mrcp_engine_factory_engine_first(server->engine_factory); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - engine = val; - if(engine) { - if(mrcp_engine_virtual_close(engine) == TRUE) { - apt_task_terminate_request_add(task); - } - } - } - - return apt_task_terminate_request_process(task); -} - -static void mrcp_server_on_start_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,SERVER_TASK_NAME" Started"); -} - -static void mrcp_server_on_terminate_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,SERVER_TASK_NAME" Terminated"); -} - -static apt_bool_t mrcp_server_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - switch(msg->type) { - case MRCP_SERVER_SIGNALING_TASK_MSG: - { - mrcp_signaling_message_t **signaling_message = (mrcp_signaling_message_t**) msg->data; - mrcp_server_signaling_message_process(*signaling_message); - break; - } - case MRCP_SERVER_CONNECTION_TASK_MSG: - { - const connection_agent_task_msg_data_t *connection_message = (const connection_agent_task_msg_data_t*)msg->data; - switch(msg->sub_type) { - case CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL: - { - mrcp_server_on_channel_modify(connection_message->channel,connection_message->descriptor,connection_message->status); - break; - } - case CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL: - { - mrcp_server_on_channel_modify(connection_message->channel,connection_message->descriptor,connection_message->status); - break; - } - case CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL: - { - mrcp_server_on_channel_remove(connection_message->channel,connection_message->status); - break; - } - case CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE: - { - mrcp_server_on_channel_message(connection_message->channel, connection_message->message); - break; - } - case CONNECTION_AGENT_TASK_MSG_DISCONNECT: - { - mrcp_server_on_channel_message(connection_message->channel, connection_message->message); - break; - } - default: - break; - } - break; - } - case MRCP_SERVER_ENGINE_TASK_MSG: - { - engine_task_msg_data_t *data = (engine_task_msg_data_t*)msg->data; - switch(msg->sub_type) { - case ENGINE_TASK_MSG_OPEN_ENGINE: - mrcp_engine_on_open(data->engine,data->status); - apt_task_start_request_remove(task); - break; - case ENGINE_TASK_MSG_CLOSE_ENGINE: - mrcp_engine_on_close(data->engine); - apt_task_terminate_request_remove(task); - break; - case ENGINE_TASK_MSG_OPEN_CHANNEL: - mrcp_server_on_engine_channel_open(data->channel,data->status); - break; - case ENGINE_TASK_MSG_CLOSE_CHANNEL: - mrcp_server_on_engine_channel_close(data->channel); - break; - case ENGINE_TASK_MSG_MESSAGE: - mrcp_server_on_engine_channel_message(data->channel,data->mrcp_message); - break; - default: - break; - } - break; - } - case MRCP_SERVER_MEDIA_TASK_MSG: - { - mpf_message_container_t *mpf_message_container = (mpf_message_container_t*) msg->data; - mrcp_server_mpf_message_process(mpf_message_container); - break; - } - default: - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Task Message Received [%d;%d]", msg->type,msg->sub_type); - break; - } - } - return TRUE; -} - -static apt_bool_t mrcp_server_signaling_task_msg_signal(mrcp_signaling_message_type_e type, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_message_t *message) -{ - mrcp_signaling_message_t *signaling_message; - apt_task_msg_t *task_msg = apt_task_msg_acquire(session->signaling_agent->msg_pool); - mrcp_signaling_message_t **slot = ((mrcp_signaling_message_t**)task_msg->data); - task_msg->type = MRCP_SERVER_SIGNALING_TASK_MSG; - task_msg->sub_type = type; - - signaling_message = apr_palloc(session->pool,sizeof(mrcp_signaling_message_t)); - signaling_message->type = type; - signaling_message->session = (mrcp_server_session_t*)session; - signaling_message->descriptor = descriptor; - signaling_message->channel = NULL; - signaling_message->message = message; - *slot = signaling_message; - - return apt_task_msg_parent_signal(session->signaling_agent->task,task_msg); -} - -static apt_bool_t mrcp_server_connection_task_msg_signal( - connection_agent_task_msg_type_e type, - mrcp_connection_agent_t *agent, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - mrcp_message_t *message, - apt_bool_t status) -{ - mrcp_server_t *server = mrcp_server_connection_agent_object_get(agent); - apt_task_t *task = apt_consumer_task_base_get(server->task); - connection_agent_task_msg_data_t *data; - apt_task_msg_t *task_msg = apt_task_msg_acquire(server->connection_msg_pool); - task_msg->type = MRCP_SERVER_CONNECTION_TASK_MSG; - task_msg->sub_type = type; - data = (connection_agent_task_msg_data_t*) task_msg->data; - data->channel = channel ? channel->obj : NULL; - data->descriptor = descriptor; - data->message = message; - data->status = status; - - return apt_task_msg_signal(task,task_msg); -} - -static apt_bool_t mrcp_server_engine_task_msg_signal( - engine_task_msg_type_e type, - mrcp_engine_t *engine, - apt_bool_t status) -{ - mrcp_server_t *server = engine->event_obj; - apt_task_t *task = apt_consumer_task_base_get(server->task); - engine_task_msg_data_t *data; - apt_task_msg_t *task_msg = apt_task_msg_acquire(server->engine_msg_pool); - task_msg->type = MRCP_SERVER_ENGINE_TASK_MSG; - task_msg->sub_type = type; - data = (engine_task_msg_data_t*) task_msg->data; - data->engine = engine; - data->channel = NULL; - data->status = status; - data->mrcp_message = NULL; - - return apt_task_msg_signal(task,task_msg); -} - -static apt_bool_t mrcp_server_channel_task_msg_signal( - engine_task_msg_type_e type, - mrcp_engine_channel_t *engine_channel, - apt_bool_t status, - mrcp_message_t *message) -{ - mrcp_channel_t *channel = engine_channel->event_obj; - mrcp_session_t *session = mrcp_server_channel_session_get(channel); - mrcp_server_t *server = session->signaling_agent->parent; - apt_task_t *task = apt_consumer_task_base_get(server->task); - engine_task_msg_data_t *data; - apt_task_msg_t *task_msg = apt_task_msg_acquire(server->engine_msg_pool); - task_msg->type = MRCP_SERVER_ENGINE_TASK_MSG; - task_msg->sub_type = type; - data = (engine_task_msg_data_t*) task_msg->data; - data->engine = engine_channel->engine; - data->channel = channel; - data->status = status; - data->mrcp_message = message; - - return apt_task_msg_signal(task,task_msg); -} - -static mrcp_server_profile_t* mrcp_server_profile_get_by_agent(mrcp_server_t *server, mrcp_server_session_t *session, const mrcp_sig_agent_t *signaling_agent) -{ - mrcp_server_profile_t *profile; - apr_hash_index_t *it; - void *val; - it = apr_hash_first(session->base.pool,server->profile_table); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - profile = val; - if(profile && profile->signaling_agent == signaling_agent) { - return profile; - } - } - return NULL; -} - -static mrcp_session_t* mrcp_server_sig_agent_session_create(mrcp_sig_agent_t *signaling_agent) -{ - mrcp_server_t *server = signaling_agent->parent; - mrcp_server_session_t *session = mrcp_server_session_create(); - session->server = server; - session->profile = mrcp_server_profile_get_by_agent(server,session,signaling_agent); - if(!session->profile) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Find Profile by Agent "APT_NAMESID_FMT, - session->base.name, - MRCP_SESSION_SID(&session->base)); - mrcp_session_destroy(&session->base); - return NULL; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Session "APT_NAMESID_FMT" [%s]", - session->base.name, - MRCP_SESSION_SID(&session->base), - session->profile->id); - session->base.signaling_agent = signaling_agent; - session->base.request_vtable = &session_request_vtable; - return &session->base; -} - -static apt_bool_t mrcp_server_offer_signal(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_OFFER,session,descriptor,NULL); -} - -static apt_bool_t mrcp_server_terminate_signal(mrcp_session_t *session) -{ - return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_TERMINATE,session,NULL,NULL); -} - -static apt_bool_t mrcp_server_control_signal(mrcp_session_t *session, mrcp_message_t *message) -{ - return mrcp_server_signaling_task_msg_signal(SIGNALING_MESSAGE_CONTROL,session,NULL,message); -} - -static apt_bool_t mrcp_server_channel_add_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_ADD_CHANNEL, - agent, - channel, - descriptor, - NULL, - status); -} - -static apt_bool_t mrcp_server_channel_modify_signal(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_MODIFY_CHANNEL, - agent, - channel, - descriptor, - NULL, - status); -} - -static apt_bool_t mrcp_server_channel_remove_signal(mrcp_control_channel_t *channel, apt_bool_t status) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_REMOVE_CHANNEL, - agent, - channel, - NULL, - NULL, - status); -} - -static apt_bool_t mrcp_server_message_signal(mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_RECEIVE_MESSAGE, - agent, - channel, - NULL, - message, - TRUE); -} - -static apt_bool_t mrcp_server_disconnect_signal(mrcp_control_channel_t *channel) -{ - mrcp_connection_agent_t *agent = channel->agent; - return mrcp_server_connection_task_msg_signal( - CONNECTION_AGENT_TASK_MSG_DISCONNECT, - agent, - channel, - NULL, - NULL, - TRUE); -} - -static apt_bool_t mrcp_server_engine_open_signal(mrcp_engine_t *engine, apt_bool_t status) -{ - return mrcp_server_engine_task_msg_signal( - ENGINE_TASK_MSG_OPEN_ENGINE, - engine, - status); -} - -static apt_bool_t mrcp_server_engine_close_signal(mrcp_engine_t *engine) -{ - return mrcp_server_engine_task_msg_signal( - ENGINE_TASK_MSG_CLOSE_ENGINE, - engine, - TRUE); -} - -static apt_bool_t mrcp_server_channel_open_signal(mrcp_engine_channel_t *channel, apt_bool_t status) -{ - return mrcp_server_channel_task_msg_signal( - ENGINE_TASK_MSG_OPEN_CHANNEL, - channel, - status, - NULL); -} - -static apt_bool_t mrcp_server_channel_close_signal(mrcp_engine_channel_t *channel) -{ - return mrcp_server_channel_task_msg_signal( - ENGINE_TASK_MSG_CLOSE_CHANNEL, - channel, - TRUE, - NULL); -} - -static apt_bool_t mrcp_server_channel_message_signal(mrcp_engine_channel_t *channel, mrcp_message_t *message) -{ - return mrcp_server_channel_task_msg_signal( - ENGINE_TASK_MSG_MESSAGE, - channel, - TRUE, - message); -} diff --git a/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c b/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c deleted file mode 100644 index c2dfb0b98f..0000000000 --- a/libs/unimrcp/libs/mrcp-server/src/mrcp_server_session.c +++ /dev/null @@ -1,1191 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_server_session.c 2237 2014-11-12 01:48:46Z achaloyan@gmail.com $ - */ - -#include "mrcp_server.h" -#include "mrcp_server_session.h" -#include "mrcp_resource.h" -#include "mrcp_resource_factory.h" -#include "mrcp_engine_iface.h" -#include "mrcp_sig_agent.h" -#include "mrcp_server_connection.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_control_descriptor.h" -#include "mrcp_state_machine.h" -#include "mrcp_message.h" -#include "mpf_termination_factory.h" -#include "mpf_stream.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - -/** Macro to log session name and identifier */ -#define MRCP_SESSION_NAMESID(session) \ - session->base.name, MRCP_SESSION_SID(&session->base) - -#define MRCP_SESSION_ID_HEX_STRING_LENGTH 16 - -struct mrcp_channel_t { - /** Memory pool */ - apr_pool_t *pool; - /** MRCP resource */ - mrcp_resource_t *resource; - /** MRCP session entire channel belongs to */ - mrcp_session_t *session; - /** MRCP control channel */ - mrcp_control_channel_t *control_channel; - /** MRCP engine channel */ - mrcp_engine_channel_t *engine_channel; - /** MRCP resource state machine */ - mrcp_state_machine_t *state_machine; - /** media descriptor id (position in session descriptor) */ - apr_size_t id; - /** array of cmid attributes (used for resource grouping) */ - apr_array_header_t *cmid_arr; - /** waiting state of control media */ - apt_bool_t waiting_for_channel; - /** waiting state of media termination */ - apt_bool_t waiting_for_termination; -}; - -typedef struct mrcp_termination_slot_t mrcp_termination_slot_t; - -struct mrcp_termination_slot_t { - /** RTP termination */ - mpf_termination_t *termination; - /** media descriptor id (position in SDP message) */ - apr_size_t id; - /** media id (used for resource grouping) */ - apr_size_t mid; - /** Array of associated MRCP channels (mrcp_channel_t*) */ - apr_array_header_t *channels; - - /** waiting state */ - apt_bool_t waiting; -}; - -extern const mrcp_engine_channel_event_vtable_t engine_channel_vtable; - -void mrcp_server_session_add(mrcp_server_session_t *session); -void mrcp_server_session_remove(mrcp_server_session_t *session); - -static apt_bool_t mrcp_server_signaling_message_dispatch(mrcp_server_session_t *session, mrcp_signaling_message_t *signaling_message); - -static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_server_control_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_server_av_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor); - -static apt_bool_t mrcp_server_engine_channels_update(mrcp_server_session_t *session); -static apt_bool_t mrcp_server_session_answer_send(mrcp_server_session_t *session); -static apt_bool_t mrcp_server_session_terminate_process(mrcp_server_session_t *session); -static apt_bool_t mrcp_server_session_terminate_send(mrcp_server_session_t *session); - -static mrcp_channel_t* mrcp_server_channel_find(mrcp_server_session_t *session, const apt_str_t *resource_name); - -static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message); -static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine); - - -mrcp_server_session_t* mrcp_server_session_create() -{ - mrcp_server_session_t *session = (mrcp_server_session_t*) mrcp_session_create(sizeof(mrcp_server_session_t)-sizeof(mrcp_session_t)); - session->context = NULL; - session->terminations = apr_array_make(session->base.pool,2,sizeof(mrcp_termination_slot_t)); - session->channels = apr_array_make(session->base.pool,2,sizeof(mrcp_channel_t*)); - session->active_request = NULL; - session->request_queue = apt_list_create(session->base.pool); - session->offer = NULL; - session->answer = NULL; - session->mpf_task_msg = NULL; - session->subrequest_count = 0; - session->state = SESSION_STATE_NONE; - session->base.name = apr_psprintf(session->base.pool,"0x%pp",session); - return session; -} - -static APR_INLINE mrcp_version_e mrcp_session_version_get(mrcp_server_session_t *session) -{ - return session->profile->mrcp_version; -} - -static mrcp_engine_channel_t* mrcp_server_engine_channel_create( - mrcp_server_session_t *session, - mrcp_channel_t *channel, - const apt_str_t *resource_name) -{ - mrcp_engine_t *engine = apr_hash_get( - session->profile->engine_table, - resource_name->buf, - resource_name->length); - if(!engine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find MRCP Engine "APT_NAMESID_FMT" [%s]", - MRCP_SESSION_NAMESID(session), - resource_name->buf); - return NULL; - } - - channel->state_machine = engine->create_state_machine( - channel, - mrcp_session_version_get(session), - channel->pool); - if(channel->state_machine) { - channel->state_machine->on_dispatch = state_machine_on_message_dispatch; - channel->state_machine->on_deactivate = state_machine_on_deactivate; - } - - return mrcp_engine_channel_virtual_create(engine,mrcp_session_version_get(session),session->base.pool); -} - -static mrcp_channel_t* mrcp_server_channel_create(mrcp_server_session_t *session, const apt_str_t *resource_name, apr_size_t id, apr_array_header_t *cmid_arr) -{ - mrcp_channel_t *channel; - apr_pool_t *pool = session->base.pool; - - channel = apr_palloc(pool,sizeof(mrcp_channel_t)); - channel->pool = pool; - channel->session = &session->base; - channel->resource = NULL; - channel->control_channel = NULL; - channel->state_machine = NULL; - channel->engine_channel = NULL; - channel->id = id; - channel->cmid_arr = cmid_arr; - channel->waiting_for_channel = FALSE; - channel->waiting_for_termination = FALSE; - - if(resource_name && resource_name->buf) { - mrcp_resource_t *resource; - mrcp_engine_channel_t *engine_channel; - resource = mrcp_resource_find(session->profile->resource_factory,resource_name); - if(resource) { - channel->resource = resource; - if(mrcp_session_version_get(session) == MRCP_VERSION_2) { - channel->control_channel = mrcp_server_control_channel_create( - session->profile->connection_agent, - channel, - pool); - } - engine_channel = mrcp_server_engine_channel_create(session,channel,resource_name); - if(engine_channel) { - engine_channel->id = session->base.id; - engine_channel->event_obj = channel; - engine_channel->event_vtable = &engine_channel_vtable; - channel->engine_channel = engine_channel; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Engine Channel "APT_NAMESID_FMT" [%s]", - MRCP_SESSION_NAMESID(session), - resource_name->buf); - session->answer->status = MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE; - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Resource "APT_NAMESID_FMT" [%s]", - MRCP_SESSION_NAMESID(session), - resource_name->buf); - session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE; - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid Resource Identifier "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - session->answer->status = MRCP_SESSION_STATUS_NO_SUCH_RESOURCE; - } - - return channel; -} - -static APR_INLINE void mrcp_server_session_state_set(mrcp_server_session_t *session, mrcp_server_session_state_e state) -{ - if(session->subrequest_count != 0) { - /* error case */ - session->subrequest_count = 0; - } - session->state = state; -} - -static APR_INLINE void mrcp_server_session_subrequest_add(mrcp_server_session_t *session) -{ - session->subrequest_count++; -} - -static void mrcp_server_session_subrequest_remove(mrcp_server_session_t *session) -{ - if(!session->subrequest_count) { - /* error case */ - return; - } - session->subrequest_count--; - if(!session->subrequest_count) { - switch(session->state) { - case SESSION_STATE_GENERATING_ANSWER: - mrcp_server_engine_channels_update(session); - break; - case SESSION_STATE_INITIALIZING: - /* send answer to client */ - mrcp_server_session_answer_send(session); - break; - case SESSION_STATE_DEACTIVATING: - mrcp_server_session_terminate_process(session); - break; - case SESSION_STATE_TERMINATING: - mrcp_server_session_terminate_send(session); - break; - default: - break; - } - } -} - -mrcp_session_t* mrcp_server_channel_session_get(mrcp_channel_t *channel) -{ - return channel->session; -} - -apt_bool_t mrcp_server_signaling_message_process(mrcp_signaling_message_t *signaling_message) -{ - mrcp_server_session_t *session = signaling_message->session; - if(session->active_request) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push Request to Queue "APT_NAMESID_FMT, - MRCP_SESSION_NAMESID(session)); - apt_list_push_back(session->request_queue,signaling_message,session->base.pool); - } - else { - session->active_request = signaling_message; - mrcp_server_signaling_message_dispatch(session,signaling_message); - } - return TRUE; -} - -apt_bool_t mrcp_server_on_channel_modify(mrcp_channel_t *channel, mrcp_control_descriptor_t *answer, apt_bool_t status) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Control Channel Modified "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!answer) { - return FALSE; - } - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - answer->session_id = session->base.id; - mrcp_session_control_media_set(session->answer,channel->id,answer); - mrcp_server_session_subrequest_remove(session); - return TRUE; -} - -apt_bool_t mrcp_server_on_channel_remove(mrcp_channel_t *channel, apt_bool_t status) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Control Channel Removed "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - if(!channel->waiting_for_channel) { - return FALSE; - } - channel->waiting_for_channel = FALSE; - mrcp_server_session_subrequest_remove(session); - return TRUE; -} - -apt_bool_t mrcp_server_on_channel_message(mrcp_channel_t *channel, mrcp_message_t *message) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - mrcp_signaling_message_t *signaling_message; - signaling_message = apr_palloc(session->base.pool,sizeof(mrcp_signaling_message_t)); - signaling_message->type = SIGNALING_MESSAGE_CONTROL; - signaling_message->session = session; - signaling_message->descriptor = NULL; - signaling_message->channel = channel; - signaling_message->message = message; - return mrcp_server_signaling_message_process(signaling_message); -} - -apt_bool_t mrcp_server_on_disconnect(mrcp_channel_t *channel) -{ - /* to be processed */ - return TRUE; -} - -apt_bool_t mrcp_server_on_engine_channel_open(mrcp_channel_t *channel, apt_bool_t status) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Channel Opened "APT_NAMESIDRES_FMT" [%s]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - status == TRUE ? "OK" : "Failed"); - if(status == FALSE) { - session->answer->status = MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE; - } - mrcp_server_session_subrequest_remove(session); - return TRUE; -} - -apt_bool_t mrcp_server_on_engine_channel_close(mrcp_channel_t *channel) -{ - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Engine Channel Closed "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf); - mrcp_server_session_subrequest_remove(session); - return TRUE; -} - -apt_bool_t mrcp_server_on_engine_channel_message(mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!channel->state_machine) { - return FALSE; - } - /* update state machine */ - return mrcp_state_machine_update(channel->state_machine,message); -} - - -static mrcp_session_descriptor_t* mrcp_session_answer_create(mrcp_session_descriptor_t *offer, apr_pool_t *pool) -{ - int i; - mrcp_session_descriptor_t *answer = apr_palloc(pool,sizeof(mrcp_session_descriptor_t)); - apt_string_reset(&answer->origin); - apt_string_reset(&answer->ip); - apt_string_reset(&answer->ext_ip); - answer->resource_name = offer->resource_name; - answer->resource_state = offer->resource_state; - answer->status = offer->status; - answer->control_media_arr = apr_array_make(pool,offer->control_media_arr->nelts,sizeof(void*)); - for(i=0; icontrol_media_arr->nelts; i++) { - APR_ARRAY_PUSH(answer->control_media_arr,void*) = NULL; - } - answer->audio_media_arr = apr_array_make(pool,offer->audio_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*)); - for(i=0; iaudio_media_arr->nelts; i++) { - APR_ARRAY_PUSH(answer->audio_media_arr,mpf_rtp_media_descriptor_t*) = NULL; - } - answer->video_media_arr = apr_array_make(pool,offer->video_media_arr->nelts,sizeof(mpf_rtp_media_descriptor_t*)); - for(i=0; ivideo_media_arr->nelts; i++) { - APR_ARRAY_PUSH(answer->video_media_arr,mpf_rtp_media_descriptor_t*) = NULL; - } - return answer; -} - -static apt_bool_t mrcp_server_session_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(!session->context) { - /* initial offer received, generate session id and add to session's table */ - if(!session->base.id.length) { - apt_unique_id_generate(&session->base.id,MRCP_SESSION_ID_HEX_STRING_LENGTH,session->base.pool); - } - mrcp_server_session_add(session); - - session->context = mpf_engine_context_create( - session->profile->media_engine, - session->base.name, - session,5,session->base.pool); - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive Offer "APT_NAMESID_FMT" [c:%d a:%d v:%d]", - MRCP_SESSION_NAMESID(session), - descriptor->control_media_arr->nelts, - descriptor->audio_media_arr->nelts, - descriptor->video_media_arr->nelts); - - /* store received offer */ - session->offer = descriptor; - session->answer = mrcp_session_answer_create(descriptor,session->base.pool); - - mrcp_server_session_state_set(session,SESSION_STATE_GENERATING_ANSWER); - - /* first, reset/destroy existing associations and topology */ - if(mpf_engine_topology_message_add( - session->profile->media_engine, - MPF_RESET_ASSOCIATIONS,session->context, - &session->mpf_task_msg) == TRUE){ - mrcp_server_session_subrequest_add(session); - } - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - if(mrcp_server_resource_offer_process(session,descriptor) == TRUE) { - mrcp_server_av_media_offer_process(session,descriptor); - } - else { - session->answer->resource_state = FALSE; - } - } - else { - mrcp_server_control_media_offer_process(session,descriptor); - mrcp_server_av_media_offer_process(session,descriptor); - } - - /* apply topology based on assigned associations */ - if(mpf_engine_topology_message_add( - session->profile->media_engine, - MPF_APPLY_TOPOLOGY,session->context, - &session->mpf_task_msg) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - mpf_engine_message_send(session->profile->media_engine,&session->mpf_task_msg); - - if(!session->subrequest_count) { - /* send answer to client */ - mrcp_server_session_answer_send(session); - } - return TRUE; -} - -static apt_bool_t mrcp_server_session_terminate_process(mrcp_server_session_t *session) -{ - mrcp_channel_t *channel; - mrcp_termination_slot_t *slot; - int i; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Session "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session)); - - mrcp_server_session_state_set(session,SESSION_STATE_TERMINATING); - - if(session->context) { - /* first, destroy existing topology */ - if(mpf_engine_topology_message_add( - session->profile->media_engine, - MPF_RESET_ASSOCIATIONS,session->context, - &session->mpf_task_msg) == TRUE){ - mrcp_server_session_subrequest_add(session); - } - } - - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - /* send remove channel request */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Remove Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - i); - if(channel->control_channel) { - if(mrcp_server_control_channel_remove(channel->control_channel) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - if(channel->engine_channel) { - mpf_termination_t *termination = channel->engine_channel->termination; - /* send subtract termination request */ - if(termination) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(termination)); - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_SUBTRACT_TERMINATION,session->context,termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - /* close engine channel */ - if(mrcp_engine_channel_virtual_close(channel->engine_channel) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - } - for(i=0; iterminations->nelts; i++) { - /* get existing termination */ - slot = &APR_ARRAY_IDX(session->terminations,i,mrcp_termination_slot_t); - if(!slot->termination) continue; - - /* send subtract termination request */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Subtract Media Termination "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(slot->termination)); - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_SUBTRACT_TERMINATION,session->context,slot->termination,NULL, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - if(session->context) { - mpf_engine_message_send(session->profile->media_engine,&session->mpf_task_msg); - } - - mrcp_server_session_remove(session); - - if(!session->subrequest_count) { - mrcp_server_session_terminate_send(session); - } - - return TRUE; -} - -static apt_bool_t mrcp_server_session_deactivate(mrcp_server_session_t *session) -{ - mrcp_channel_t *channel; - int i; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Deactivate Session "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session)); - mrcp_server_session_state_set(session,SESSION_STATE_DEACTIVATING); - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel || !channel->state_machine) continue; - - if(mrcp_state_machine_deactivate(channel->state_machine) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - - if(!session->subrequest_count) { - mrcp_server_session_terminate_process(session); - } - - return TRUE; -} - -static apt_bool_t mrcp_server_on_message_receive(mrcp_server_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!channel) { - channel = mrcp_server_channel_find(session,&message->channel_id.resource_name); - if(!channel) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Channel "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - message->channel_id.resource_name.buf); - return FALSE; - } - } - if(!channel->resource || !channel->state_machine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Resource "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - message->channel_id.resource_name.buf); - return FALSE; - } - - /* update state machine */ - return mrcp_state_machine_update(channel->state_machine,message); -} - -static apt_bool_t mrcp_server_signaling_message_dispatch(mrcp_server_session_t *session, mrcp_signaling_message_t *signaling_message) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Dispatch Signaling Message [%d]",signaling_message->type); - switch(signaling_message->type) { - case SIGNALING_MESSAGE_OFFER: - mrcp_server_session_offer_process(signaling_message->session,signaling_message->descriptor); - break; - case SIGNALING_MESSAGE_CONTROL: - mrcp_server_on_message_receive(signaling_message->session,signaling_message->channel,signaling_message->message); - break; - case SIGNALING_MESSAGE_TERMINATE: - mrcp_server_session_deactivate(signaling_message->session); - break; - default: - break; - } - return TRUE; -} - -static apt_bool_t mrcp_server_engine_channels_update(mrcp_server_session_t *session) -{ - mrcp_channel_t *channel; - mrcp_session_descriptor_t *descriptor = session->offer; - if(!descriptor) { - return FALSE; - } - - mrcp_server_session_state_set(session,SESSION_STATE_INITIALIZING); - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - if(session->offer) { - channel = mrcp_server_channel_find(session,&descriptor->resource_name); - if(channel && channel->engine_channel) { - /* open engine channel */ - if(mrcp_engine_channel_virtual_open(channel->engine_channel) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - } - } - else { - int i; - mrcp_control_descriptor_t *control_descriptor; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel || !channel->engine_channel) continue; - - control_descriptor = mrcp_session_control_media_get(descriptor,i); - if(!control_descriptor) continue; - - if(control_descriptor->port) { - /* open engine channel */ - if(mrcp_engine_channel_virtual_open(channel->engine_channel) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - else { - /* close engine channel */ - if(mrcp_engine_channel_virtual_close(channel->engine_channel) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - } - } - - if(!session->subrequest_count) { - mrcp_server_session_answer_send(session); - } - return TRUE; -} - -static apt_bool_t mrcp_server_resource_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(descriptor->resource_state == TRUE) { - /* setup */ - mrcp_channel_t *channel; - int count = session->channels->nelts; - channel = mrcp_server_channel_find(session,&descriptor->resource_name); - if(channel) { - /* channel already exists */ - return TRUE; - } - /* create new MRCP channel instance */ - channel = mrcp_server_channel_create(session,&descriptor->resource_name,count,NULL); - if(!channel || !channel->resource) { - return FALSE; - } - /* add to channel array */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - count); - APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel; - if(channel->engine_channel && channel->engine_channel->termination) { - mpf_termination_t *termination = channel->engine_channel->termination; - /* send add termination request (add to media context) */ - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_ADD_TERMINATION,session->context,termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - } - else { - /* teardown */ - } - return TRUE; -} - -static apt_bool_t mrcp_server_control_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - mrcp_channel_t *channel; - mrcp_control_descriptor_t *control_descriptor; - int i; - int count = session->channels->nelts; - if(count > descriptor->control_media_arr->nelts) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of Control Channels [%d] > Number of Control Media in Offer [%d]", - count,descriptor->control_media_arr->nelts); - count = descriptor->control_media_arr->nelts; - } - - /* update existing control channels */ - for(i=0; ichannels,i,mrcp_channel_t*); - if(!channel) continue; - - channel->waiting_for_channel = FALSE; - /* get control descriptor */ - control_descriptor = mrcp_session_control_media_get(descriptor,i); - if(!control_descriptor) continue; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - i); - if(channel->control_channel) { - /* send offer */ - if(mrcp_server_control_channel_modify(channel->control_channel,control_descriptor) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - if(channel->waiting_for_channel == FALSE) { - mrcp_control_descriptor_t *answer = mrcp_control_answer_create(control_descriptor,channel->pool); - answer->port = 0; - answer->session_id = session->base.id; - mrcp_session_control_media_set(session->answer,channel->id,answer); - } - } - - /* add new control channels */ - for(; icontrol_media_arr->nelts; i++) { - /* get control descriptor */ - control_descriptor = mrcp_session_control_media_get(descriptor,i); - if(!control_descriptor) continue; - - /* create new MRCP channel instance */ - channel = mrcp_server_channel_create(session,&control_descriptor->resource_name,i,control_descriptor->cmid_arr); - if(!channel || !channel->resource) continue; - - control_descriptor->session_id = session->base.id; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Control Channel "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - channel->resource->name.buf, - i); - APR_ARRAY_PUSH(session->channels,mrcp_channel_t*) = channel; - - if(channel->control_channel) { - /* send modify connection request */ - if(mrcp_server_control_channel_add(channel->control_channel,control_descriptor) == TRUE) { - channel->waiting_for_channel = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - - if(channel->waiting_for_channel == FALSE) { - mrcp_control_descriptor_t *answer = mrcp_control_answer_create(control_descriptor,channel->pool); - answer->port = 0; - answer->session_id = session->base.id; - mrcp_session_control_media_set(session->answer,channel->id,answer); - } - - if(channel->engine_channel && channel->engine_channel->termination) { - mpf_termination_t *termination = channel->engine_channel->termination; - /* send add termination request (add to media context) */ - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_ADD_TERMINATION,session->context,termination,NULL, - &session->mpf_task_msg) == TRUE) { - channel->waiting_for_termination = TRUE; - mrcp_server_session_subrequest_add(session); - } - } - } - - return TRUE; -} - -static mpf_rtp_termination_descriptor_t* mrcp_server_associations_build(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_termination_slot_t *slot) -{ - int i; - mrcp_channel_t *channel; - mpf_audio_stream_t *audio_stream; - mpf_stream_capabilities_t *capabilities = NULL; - mpf_rtp_termination_descriptor_t *rtp_descriptor; - mpf_rtp_media_descriptor_t *media_descriptor = mrcp_session_audio_media_get(descriptor,slot->id); - if(!media_descriptor) { - return NULL; - } - /* construct termination descriptor */ - rtp_descriptor = apr_palloc(session->base.pool,sizeof(mpf_rtp_termination_descriptor_t)); - mpf_rtp_termination_descriptor_init(rtp_descriptor); - rtp_descriptor->audio.local = NULL; - rtp_descriptor->audio.remote = media_descriptor; - rtp_descriptor->audio.settings = session->profile->rtp_settings; - - slot->mid = media_descriptor->mid; - slot->channels = apr_array_make(session->base.pool,1,sizeof(mrcp_channel_t*)); - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(session->terminations->nelts == 1 || (!channel->cmid_arr || mrcp_cmid_find(channel->cmid_arr,slot->mid) == TRUE)) { - APR_ARRAY_PUSH(slot->channels, mrcp_channel_t*) = channel; - - audio_stream = NULL; - if(channel->engine_channel && channel->engine_channel->termination) { - audio_stream = mpf_termination_audio_stream_get(channel->engine_channel->termination); - } - if(!audio_stream) continue; - - if(audio_stream->capabilities) { - /* set descriptor according to media termination(s) - of associated control channel(s) */ - if(capabilities) { - mpf_stream_capabilities_merge( - capabilities, - audio_stream->capabilities, - session->base.pool); - } - else { - capabilities = mpf_stream_capabilities_clone( - audio_stream->capabilities, - session->base.pool); - } - } - - if(mrcp_session_version_get(session) == MRCP_VERSION_1) { - mpf_stream_direction_e direction = audio_stream->direction; - /* implicitly modify the descriptor, if needed */ - if(media_descriptor->direction == STREAM_DIRECTION_NONE && mpf_codec_list_is_empty(&media_descriptor->codec_list) == TRUE) { - /* this is the case when SETUP contains no SDP, assume all the available codecs are offered */ - if(mpf_codec_list_is_empty(&session->profile->rtp_settings->codec_list) == FALSE) { - mpf_codec_list_copy(&media_descriptor->codec_list, - &session->profile->rtp_settings->codec_list, - session->base.pool); - } - } - - media_descriptor->direction |= direction; - if(media_descriptor->state == MPF_MEDIA_DISABLED) { - media_descriptor->state = MPF_MEDIA_ENABLED; - } - } - } - } - if(capabilities) { - capabilities->direction = mpf_stream_reverse_direction_get(capabilities->direction); - rtp_descriptor->audio.capabilities = capabilities; - } - return rtp_descriptor; -} - -static apt_bool_t mrcp_server_associations_set(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_termination_slot_t *slot) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = ((mrcp_channel_t**)slot->channels->elts)[i]; - if(!channel || !channel->engine_channel) continue; - - if(mpf_engine_assoc_message_add( - session->profile->media_engine, - MPF_ADD_ASSOCIATION,session->context,slot->termination,channel->engine_channel->termination, - &session->mpf_task_msg) == TRUE) { - mrcp_server_session_subrequest_add(session); - } - } - return TRUE; -} - -static apt_bool_t mrcp_server_av_media_offer_process(mrcp_server_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - mpf_rtp_termination_descriptor_t *rtp_descriptor; - mrcp_termination_slot_t *slot; - int i; - int count = session->terminations->nelts; - if(!descriptor->audio_media_arr->nelts) { - /* no media to process */ - return TRUE; - } - if(count > descriptor->audio_media_arr->nelts) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Number of Terminations [%d] > Number of Audio Media in Offer [%d]", - count,descriptor->audio_media_arr->nelts); - count = descriptor->audio_media_arr->nelts; - } - - /* update existing terminations */ - for(i=0; iterminations,i,mrcp_termination_slot_t); - if(!slot->termination) continue; - - /* build associations between specified RTP termination and control channels */ - rtp_descriptor = mrcp_server_associations_build(session,descriptor,slot); - if(!rtp_descriptor) continue; - - /* send modify termination request */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Modify Media Termination "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(slot->termination), - i); - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_MODIFY_TERMINATION,session->context,slot->termination,rtp_descriptor, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_server_session_subrequest_add(session); - } - - /* set built associations */ - mrcp_server_associations_set(session,descriptor,slot); - } - - /* add new terminations */ - for(; iaudio_media_arr->nelts; i++) { - mpf_termination_t *termination; - /* create new RTP termination instance */ - termination = mpf_termination_create(session->profile->rtp_termination_factory,session,session->base.pool); - /* add to termination array */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Add Media Termination "APT_NAMESIDRES_FMT" [%d]", - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(termination), - i); - slot = apr_array_push(session->terminations); - slot->id = i; - slot->mid = 0; - slot->waiting = FALSE; - slot->termination = termination; - slot->channels = NULL; - - /* build associations between specified RTP termination and control channels */ - rtp_descriptor = mrcp_server_associations_build(session,descriptor,slot); - if(!rtp_descriptor) continue; - - /* send add termination request (add to media context) */ - if(mpf_engine_termination_message_add( - session->profile->media_engine, - MPF_ADD_TERMINATION,session->context,termination,rtp_descriptor, - &session->mpf_task_msg) == TRUE) { - slot->waiting = TRUE; - mrcp_server_session_subrequest_add(session); - } - - /* set built associations */ - mrcp_server_associations_set(session,descriptor,slot); - } - return TRUE; -} - -static apt_bool_t mrcp_server_session_answer_send(mrcp_server_session_t *session) -{ - apt_bool_t status; - mrcp_session_descriptor_t *descriptor = session->answer; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send Answer "APT_NAMESID_FMT" [c:%d a:%d v:%d] Status %s", - MRCP_SESSION_NAMESID(session), - descriptor->control_media_arr->nelts, - descriptor->audio_media_arr->nelts, - descriptor->video_media_arr->nelts, - mrcp_session_status_phrase_get(descriptor->status)); - status = mrcp_session_answer(&session->base,descriptor); - session->offer = NULL; - session->answer = NULL; - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_server_signaling_message_dispatch(session,session->active_request); - } - return status; -} - -static apt_bool_t mrcp_server_session_terminate_send(mrcp_server_session_t *session) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->control_channel) { - mrcp_server_control_channel_destroy(channel->control_channel); - channel->control_channel = NULL; - } - if(channel->engine_channel) { - mrcp_engine_channel_virtual_destroy(channel->engine_channel); - channel->engine_channel = NULL; - } - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Session Terminated "APT_NAMESID_FMT,MRCP_SESSION_NAMESID(session)); - mrcp_session_terminate_response(&session->base); - return TRUE; -} - - -static mrcp_termination_slot_t* mrcp_server_rtp_termination_find(mrcp_server_session_t *session, mpf_termination_t *termination) -{ - int i; - mrcp_termination_slot_t *slot; - for(i=0; iterminations->nelts; i++) { - slot = &APR_ARRAY_IDX(session->terminations,i,mrcp_termination_slot_t); - if(slot->termination == termination) { - return slot; - } - } - return NULL; -} - -static mrcp_channel_t* mrcp_server_channel_termination_find(mrcp_server_session_t *session, mpf_termination_t *termination) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(channel->engine_channel && channel->engine_channel->termination == termination) { - return channel; - } - } - return NULL; -} - -static mrcp_channel_t* mrcp_server_channel_find(mrcp_server_session_t *session, const apt_str_t *resource_name) -{ - int i; - mrcp_channel_t *channel; - for(i=0; ichannels->nelts; i++) { - channel = APR_ARRAY_IDX(session->channels,i,mrcp_channel_t*); - if(!channel) continue; - - if(apt_string_compare(&channel->resource->name,resource_name) == TRUE) { - return channel; - } - } - return NULL; -} - -static apt_bool_t mrcp_server_on_termination_modify(mrcp_server_session_t *session, const mpf_message_t *mpf_message) -{ - mrcp_termination_slot_t *termination_slot; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Media Termination Modified "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_server_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - mpf_rtp_termination_descriptor_t *rtp_descriptor; - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - rtp_descriptor = mpf_message->descriptor; - if(rtp_descriptor->audio.local) { - session->answer->ip = rtp_descriptor->audio.local->ip; - session->answer->ext_ip = rtp_descriptor->audio.local->ext_ip; - mrcp_session_audio_media_set(session->answer,termination_slot->id,rtp_descriptor->audio.local); - } - mrcp_server_session_subrequest_remove(session); - } - else { - /* engine channel termination */ - mrcp_channel_t *channel = mrcp_server_channel_termination_find(session,mpf_message->termination); - if(channel && channel->waiting_for_termination == TRUE) { - channel->waiting_for_termination = FALSE; - mrcp_server_session_subrequest_remove(session); - } - } - return TRUE; -} - -static apt_bool_t mrcp_server_on_termination_subtract(mrcp_server_session_t *session, const mpf_message_t *mpf_message) -{ - mrcp_termination_slot_t *termination_slot; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Media Termination Subtracted "APT_NAMESIDRES_FMT, - MRCP_SESSION_NAMESID(session), - mpf_termination_name_get(mpf_message->termination)); - termination_slot = mrcp_server_rtp_termination_find(session,mpf_message->termination); - if(termination_slot) { - /* rtp termination */ - if(termination_slot->waiting == FALSE) { - return FALSE; - } - termination_slot->waiting = FALSE; - mrcp_server_session_subrequest_remove(session); - } - else { - /* engine channel termination */ - mrcp_channel_t *channel = mrcp_server_channel_termination_find(session,mpf_message->termination); - if(channel && channel->waiting_for_termination == TRUE) { - channel->waiting_for_termination = FALSE; - mrcp_server_session_subrequest_remove(session); - } - } - return TRUE; -} - -apt_bool_t mrcp_server_mpf_message_process(mpf_message_container_t *mpf_message_container) -{ - apr_size_t i; - mrcp_server_session_t *session; - const mpf_message_t *mpf_message; - for(i=0; icount; i++) { - mpf_message = &mpf_message_container->messages[i]; - if(mpf_message->context) { - session = mpf_engine_context_object_get(mpf_message->context); - } - else { - session = NULL; - } - if(!session) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Received MPF Message: NULL session"); - continue; - } - if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) { - switch(mpf_message->command_id) { - case MPF_ADD_TERMINATION: - mrcp_server_on_termination_modify(session,mpf_message); - break; - case MPF_MODIFY_TERMINATION: - mrcp_server_on_termination_modify(session,mpf_message); - break; - case MPF_SUBTRACT_TERMINATION: - mrcp_server_on_termination_subtract(session,mpf_message); - break; - case MPF_ADD_ASSOCIATION: - case MPF_REMOVE_ASSOCIATION: - case MPF_RESET_ASSOCIATIONS: - case MPF_APPLY_TOPOLOGY: - case MPF_DESTROY_TOPOLOGY: - mrcp_server_session_subrequest_remove(session); - break; - default: - break; - } - } - else if(mpf_message->message_type == MPF_MESSAGE_TYPE_EVENT) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event"); - } - } - return TRUE; -} - -static apt_bool_t state_machine_on_message_dispatch(mrcp_state_machine_t *state_machine, mrcp_message_t *message) -{ - mrcp_channel_t *channel = state_machine->obj; - - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) { - /* send request message to engine for actual processing */ - if(channel->engine_channel) { - mrcp_engine_channel_request_process(channel->engine_channel,message); - } - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - /* send response message to client */ - if(channel->control_channel) { - /* MRCPv2 */ - mrcp_server_control_message_send(channel->control_channel,message); - } - else { - /* MRCPv1 */ - mrcp_session_control_response(channel->session,message); - } - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - mrcp_server_signaling_message_dispatch(session,session->active_request); - } - } - else { - /* send event message to client */ - if(channel->control_channel) { - /* MRCPv2 */ - mrcp_server_control_message_send(channel->control_channel,message); - } - else { - /* MRCPv1 */ - mrcp_session_control_response(channel->session,message); - } - } - return TRUE; -} - -static apt_bool_t state_machine_on_deactivate(mrcp_state_machine_t *state_machine) -{ - mrcp_channel_t *channel = state_machine->obj; - mrcp_server_session_t *session = (mrcp_server_session_t*)channel->session; - mrcp_server_session_subrequest_remove(session); - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp-signaling/Makefile.am b/libs/unimrcp/libs/mrcp-signaling/Makefile.am deleted file mode 100644 index e274f1ce83..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpsignaling.la - -include_HEADERS = include/mrcp_sig_types.h \ - include/mrcp_sig_agent.h \ - include/mrcp_session.h \ - include/mrcp_session_descriptor.h - -libmrcpsignaling_la_SOURCES = src/mrcp_sig_agent.c \ - src/mrcp_session_descriptor.c \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h deleted file mode 100644 index f4b9ebcc96..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session.h +++ /dev/null @@ -1,206 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_session.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SESSION_H -#define MRCP_SESSION_H - -/** - * @file mrcp_session.h - * @brief Abstract MRCP Session - */ - -#include "mrcp_sig_types.h" -#include "mpf_types.h" -#include "apt_string.h" - -APT_BEGIN_EXTERN_C - -/** Macro to log session pointers */ -#define MRCP_SESSION_PTR(session) (session) -/** Macro to log session string identifiers */ -#define MRCP_SESSION_SID(session) \ - (session)->id.buf ? (session)->id.buf : "new" - -/** Macro to log session pointers and string identifiers */ -#define MRCP_SESSION_PTRSID(session) \ - MRCP_SESSION_PTR(session), MRCP_SESSION_SID(session) - -/** MRCP session request vtable declaration */ -typedef struct mrcp_session_request_vtable_t mrcp_session_request_vtable_t; -/** MRCP session response vtable declaration */ -typedef struct mrcp_session_response_vtable_t mrcp_session_response_vtable_t; -/** MRCP session event vtable declaration */ -typedef struct mrcp_session_event_vtable_t mrcp_session_event_vtable_t; - - -/** MRCP session */ -struct mrcp_session_t { - /** Memory pool to allocate memory from */ - apr_pool_t *pool; - /** External object associated with session */ - void *obj; - /** External logger object associated with session */ - void *log_obj; - /** Informative name of the session used for debugging */ - const char *name; - - /** Signaling (session managment) agent */ - mrcp_sig_agent_t *signaling_agent; - /** MRCPv2 connection agent, if any */ - void *connection_agent; - /** Media processing engine */ - mpf_engine_t *media_engine; - /** RTP termination factory */ - mpf_termination_factory_t *rtp_factory; - - /** Session identifier */ - apt_str_t id; - /** Last request identifier sent for client, received for server */ - mrcp_request_id last_request_id; - - /** Virtual request methods */ - const mrcp_session_request_vtable_t *request_vtable; - /** Virtual response methods */ - const mrcp_session_response_vtable_t *response_vtable; - /** Virtual event methods */ - const mrcp_session_event_vtable_t *event_vtable; -}; - - -/** MRCP session request vtable */ -struct mrcp_session_request_vtable_t { - /** Offer session descriptor */ - apt_bool_t (*offer)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); - /** Terminate session */ - apt_bool_t (*terminate)(mrcp_session_t *session); - /** Control session (MRCPv1 only) */ - apt_bool_t (*control)(mrcp_session_t *session, mrcp_message_t *message); - /** Discover resources */ - apt_bool_t (*discover)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -}; - -/** MRCP session response vtable */ -struct mrcp_session_response_vtable_t { - /** Answer with remote session descriptor */ - apt_bool_t (*on_answer)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); - /** Session terminated */ - apt_bool_t (*on_terminate)(mrcp_session_t *session); - /** Control session (MRCPv1 only) */ - apt_bool_t (*on_control)(mrcp_session_t *session, mrcp_message_t *message); - /** Response to resource discovery request */ - apt_bool_t (*on_discover)(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -}; - -/** MRCP session event vtable */ -struct mrcp_session_event_vtable_t { - /** Received session termination event without appropriate request */ - apt_bool_t (*on_terminate)(mrcp_session_t *session); -}; - - -/** Create new memory pool and allocate session object from the pool. */ -MRCP_DECLARE(mrcp_session_t*) mrcp_session_create(apr_size_t padding); - -/** Destroy session and assosiated memory pool. */ -MRCP_DECLARE(void) mrcp_session_destroy(mrcp_session_t *session); - - -/** Offer */ -static APR_INLINE apt_bool_t mrcp_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(session->request_vtable->offer) { - return session->request_vtable->offer(session,descriptor); - } - return FALSE; -} - -/** Terminate */ -static APR_INLINE apt_bool_t mrcp_session_terminate_request(mrcp_session_t *session) -{ - if(session->request_vtable->terminate) { - return session->request_vtable->terminate(session); - } - return FALSE; -} - -/** Answer */ -static APR_INLINE apt_bool_t mrcp_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(session->response_vtable->on_answer) { - return session->response_vtable->on_answer(session,descriptor); - } - return FALSE; -} - -/** On terminate response */ -static APR_INLINE apt_bool_t mrcp_session_terminate_response(mrcp_session_t *session) -{ - if(session->response_vtable->on_terminate) { - return session->response_vtable->on_terminate(session); - } - return FALSE; -} - -/** On terminate event */ -static APR_INLINE apt_bool_t mrcp_session_terminate_event(mrcp_session_t *session) -{ - if(session->event_vtable->on_terminate) { - return session->event_vtable->on_terminate(session); - } - return FALSE; -} - -/** Control request */ -static APR_INLINE apt_bool_t mrcp_session_control_request(mrcp_session_t *session, mrcp_message_t *message) -{ - if(session->request_vtable->control) { - return session->request_vtable->control(session,message); - } - return FALSE; -} - -/** On control response/event */ -static APR_INLINE apt_bool_t mrcp_session_control_response(mrcp_session_t *session, mrcp_message_t *message) -{ - if(session->response_vtable->on_control) { - return session->response_vtable->on_control(session,message); - } - return FALSE; -} - -/** Resource discovery request */ -static APR_INLINE apt_bool_t mrcp_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(session->request_vtable->discover) { - return session->request_vtable->discover(session,descriptor); - } - return FALSE; -} - -/** On resource discovery response */ -static APR_INLINE apt_bool_t mrcp_session_discover_response(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - if(session->response_vtable->on_discover) { - return session->response_vtable->on_discover(session,descriptor); - } - return FALSE; -} - -APT_END_EXTERN_C - -#endif /* MRCP_SESSION_H */ diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h deleted file mode 100644 index e1e9b48448..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_session_descriptor.h +++ /dev/null @@ -1,150 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_session_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SESSION_DESCRIPTOR_H -#define MRCP_SESSION_DESCRIPTOR_H - -/** - * @file mrcp_session_descriptor.h - * @brief MRCP Session Descriptor - */ - -#include "mpf_rtp_descriptor.h" -#include "mrcp_sig_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP session status */ -typedef enum { - MRCP_SESSION_STATUS_OK, /**< OK */ - MRCP_SESSION_STATUS_NO_SUCH_RESOURCE, /**< no such resource found */ - MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE,/**< resource exists, but no implementation (plugin) found */ - MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE, /**< resource exists, but is temporary unavailable */ - MRCP_SESSION_STATUS_ERROR /**< internal error occurred */ -} mrcp_session_status_e; - -/** MRCP session descriptor */ -struct mrcp_session_descriptor_t { - /** SDP origin */ - apt_str_t origin; - /** Session level IP address */ - apt_str_t ip; - /** Session level external (NAT) IP address */ - apt_str_t ext_ip; - /** Session level resource name (MRCPv1 only) */ - apt_str_t resource_name; - /** Resource state (MRCPv1 only) */ - apt_bool_t resource_state; - /** Session status */ - mrcp_session_status_e status; - /** Response code (SIP for MRCPv2 and RTSP for MRCPv1) */ - int response_code; - - /** MRCP control media array (mrcp_control_descriptor_t) */ - apr_array_header_t *control_media_arr; - /** Audio media array (mpf_rtp_media_descriptor_t) */ - apr_array_header_t *audio_media_arr; - /** Video media array (mpf_rtp_media_descriptor_t) */ - apr_array_header_t *video_media_arr; -}; - -/** Create session descriptor */ -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool); - -static APR_INLINE apr_size_t mrcp_session_media_count_get(const mrcp_session_descriptor_t *descriptor) -{ - return descriptor->control_media_arr->nelts + descriptor->audio_media_arr->nelts + descriptor->video_media_arr->nelts; -} - -static APR_INLINE apr_size_t mrcp_session_control_media_add(mrcp_session_descriptor_t *descriptor, void *media) -{ - APR_ARRAY_PUSH(descriptor->control_media_arr,void*) = media; - return mrcp_session_media_count_get(descriptor) - 1; -} - -static APR_INLINE void* mrcp_session_control_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id) -{ - if((int)id >= descriptor->control_media_arr->nelts) { - return NULL; - } - return APR_ARRAY_IDX(descriptor->control_media_arr,id,void*); -} - -static APR_INLINE apt_bool_t mrcp_session_control_media_set(mrcp_session_descriptor_t *descriptor, apr_size_t id, void *media) -{ - if((int)id >= descriptor->control_media_arr->nelts) { - return FALSE; - } - APR_ARRAY_IDX(descriptor->control_media_arr,id,void*) = media; - return TRUE; -} - - -static APR_INLINE apr_size_t mrcp_session_audio_media_add(mrcp_session_descriptor_t *descriptor, mpf_rtp_media_descriptor_t *media) -{ - APR_ARRAY_PUSH(descriptor->audio_media_arr,mpf_rtp_media_descriptor_t*) = media; - return mrcp_session_media_count_get(descriptor) - 1; -} - -static APR_INLINE mpf_rtp_media_descriptor_t* mrcp_session_audio_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id) -{ - if((int)id >= descriptor->audio_media_arr->nelts) { - return NULL; - } - return APR_ARRAY_IDX(descriptor->audio_media_arr,id,mpf_rtp_media_descriptor_t*); -} - -static APR_INLINE apt_bool_t mrcp_session_audio_media_set(const mrcp_session_descriptor_t *descriptor, apr_size_t id, mpf_rtp_media_descriptor_t* media) -{ - if((int)id >= descriptor->audio_media_arr->nelts) { - return FALSE; - } - APR_ARRAY_IDX(descriptor->audio_media_arr,id,mpf_rtp_media_descriptor_t*) = media; - return TRUE; -} - - -static APR_INLINE apr_size_t mrcp_session_video_media_add(mrcp_session_descriptor_t *descriptor, mpf_rtp_media_descriptor_t *media) -{ - APR_ARRAY_PUSH(descriptor->video_media_arr,mpf_rtp_media_descriptor_t*) = media; - return mrcp_session_media_count_get(descriptor) - 1; -} - -static APR_INLINE mpf_rtp_media_descriptor_t* mrcp_session_video_media_get(const mrcp_session_descriptor_t *descriptor, apr_size_t id) -{ - if((int)id >= descriptor->video_media_arr->nelts) { - return NULL; - } - return APR_ARRAY_IDX(descriptor->video_media_arr,id,mpf_rtp_media_descriptor_t*); -} - -static APR_INLINE apt_bool_t mrcp_session_video_media_set(mrcp_session_descriptor_t *descriptor, apr_size_t id, mpf_rtp_media_descriptor_t* media) -{ - if((int)id >= descriptor->video_media_arr->nelts) { - return FALSE; - } - APR_ARRAY_IDX(descriptor->video_media_arr,id,mpf_rtp_media_descriptor_t*) = media; - return TRUE; -} - -/** Get session status phrase */ -MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status); - -APT_END_EXTERN_C - -#endif /* MRCP_SESSION_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h deleted file mode 100644 index a7595066d5..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_agent.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sig_agent.h 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SIG_AGENT_H -#define MRCP_SIG_AGENT_H - -/** - * @file mrcp_sig_agent.h - * @brief Abstract MRCP Signaling Agent - */ - -#include -#include -#include "mrcp_sig_types.h" -#include "apt_task.h" - -APT_BEGIN_EXTERN_C - -/** Signaling settings */ -struct mrcp_sig_settings_t { - /** Server IP address */ - char *server_ip; - /** Server port */ - apr_port_t server_port; - /** Server SIP user name (v2 only) */ - char *user_name; - /** Resource location (v1 only) */ - char *resource_location; - /** Map of the MRCP resource names (v1 only) */ - apr_table_t *resource_map; - /** Force destination IP address. Should be used only in case - SDP contains incorrect connection address (local IP address behind NAT) */ - apt_bool_t force_destination; - /** Optional feature tags */ - char *feature_tags; -}; - -/** MRCP signaling agent */ -struct mrcp_sig_agent_t { - /** Agent identifier */ - const char *id; - /** Memory pool to allocate memory from */ - apr_pool_t *pool; - /** External object associated with agent */ - void *obj; - /** Parent object (client/server) */ - void *parent; - /** MRCP resource factory */ - mrcp_resource_factory_t *resource_factory; - /** Task interface */ - apt_task_t *task; - /** Task message pool used to allocate signaling agent messages */ - apt_task_msg_pool_t *msg_pool; - - /** Virtual create_server_session */ - mrcp_session_t* (*create_server_session)(mrcp_sig_agent_t *signaling_agent); - /** Virtual create_client_session */ - apt_bool_t (*create_client_session)(mrcp_session_t *session, const mrcp_sig_settings_t *settings); -}; - -/** Create signaling agent. */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(const char *id, void *obj, apr_pool_t *pool); - -/** Create factory of signaling agents. */ -MRCP_DECLARE(mrcp_sa_factory_t*) mrcp_sa_factory_create(apr_pool_t *pool); - -/** Add signaling agent to factory. */ -MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_agent_add(mrcp_sa_factory_t *sa_factory, mrcp_sig_agent_t *sig_agent); - -/** Determine whether factory is empty. */ -MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_is_empty(const mrcp_sa_factory_t *sa_factory); - -/** Select next available signaling agent. */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sa_factory_agent_select(mrcp_sa_factory_t *sa_factory); - -/** Allocate MRCP signaling settings. */ -MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_signaling_settings_alloc(apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MRCP_SIG_AGENT_H */ diff --git a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h b/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h deleted file mode 100644 index 6dc589036e..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/include/mrcp_sig_types.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sig_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SIG_TYPES_H -#define MRCP_SIG_TYPES_H - -/** - * @file mrcp_sig_types.h - * @brief MRCP Signaling Types Declaration - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MRCP signaling settings declaration */ -typedef struct mrcp_sig_settings_t mrcp_sig_settings_t; - -/** Opaque MRCP signaling agent declaration */ -typedef struct mrcp_sig_agent_t mrcp_sig_agent_t; - -/** Opaque MRCP signaling agent factory declaration */ -typedef struct mrcp_sa_factory_t mrcp_sa_factory_t; - -/** Opaque MRCP session declaration */ -typedef struct mrcp_session_t mrcp_session_t; - -/** Opaque MRCP session descriptor declaration */ -typedef struct mrcp_session_descriptor_t mrcp_session_descriptor_t; - -APT_END_EXTERN_C - -#endif /* MRCP_SIG_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters deleted file mode 100644 index 4e5d30c3da..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2010.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {f3dc550f-1a0f-4b9e-b077-3b6940dc5531} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj deleted file mode 100644 index d8f8525d72..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.2017.vcxproj +++ /dev/null @@ -1,130 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpsignaling - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} - mrcpsignaling - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj deleted file mode 100644 index 6aa8163acc..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcproj +++ /dev/null @@ -1,276 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj deleted file mode 100644 index 13a3708693..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} - mrcpsignaling - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - {b5a00bfa-6083-4fae-a097-71642d6473b5} - false - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters b/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters deleted file mode 100644 index 7b9d1aa49b..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/mrcpsignaling.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {38ec7b90-673c-4c54-9c3a-13d5270556a0} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c b/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c deleted file mode 100644 index a14545708b..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_session_descriptor.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_session_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_session_descriptor.h" - -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_session_descriptor_create(apr_pool_t *pool) -{ - mrcp_session_descriptor_t *descriptor = apr_palloc(pool,sizeof(mrcp_session_descriptor_t)); - apt_string_reset(&descriptor->origin); - apt_string_reset(&descriptor->ip); - apt_string_reset(&descriptor->ext_ip); - apt_string_reset(&descriptor->resource_name); - descriptor->resource_state = FALSE; - descriptor->status = MRCP_SESSION_STATUS_OK; - descriptor->response_code = 0; - descriptor->control_media_arr = apr_array_make(pool,1,sizeof(void*)); - descriptor->audio_media_arr = apr_array_make(pool,1,sizeof(mpf_rtp_media_descriptor_t*)); - descriptor->video_media_arr = apr_array_make(pool,0,sizeof(mpf_rtp_media_descriptor_t*)); - return descriptor; -} - -MRCP_DECLARE(const char*) mrcp_session_status_phrase_get(mrcp_session_status_e status) -{ - switch(status) { - case MRCP_SESSION_STATUS_OK: - return "OK"; - case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE: - return "Not Found"; - case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE: - return "Not Acceptable"; - case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE: - return "Unavailable"; - case MRCP_SESSION_STATUS_ERROR: - return "Error"; - } - return "Unknown"; -} diff --git a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c b/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c deleted file mode 100644 index dca8de94c3..0000000000 --- a/libs/unimrcp/libs/mrcp-signaling/src/mrcp_sig_agent.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sig_agent.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_sig_agent.h" -#include "mrcp_session.h" -#include "apt_pool.h" - -/** Factory of MRCP signaling agents */ -struct mrcp_sa_factory_t { - /** Array of pointers to signaling agents */ - apr_array_header_t *agents_arr; - /** Index of the current agent */ - int index; -}; - -/** Create signaling agent */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_signaling_agent_create(const char *id, void *obj, apr_pool_t *pool) -{ - mrcp_sig_agent_t *sig_agent = apr_palloc(pool,sizeof(mrcp_sig_agent_t)); - sig_agent->id = id; - sig_agent->pool = pool; - sig_agent->obj = obj; - sig_agent->resource_factory = NULL; - sig_agent->parent = NULL; - sig_agent->task = NULL; - sig_agent->msg_pool = NULL; - sig_agent->create_server_session = NULL; - sig_agent->create_client_session = NULL; - return sig_agent; -} - -/** Create factory of signaling agents */ -MRCP_DECLARE(mrcp_sa_factory_t*) mrcp_sa_factory_create(apr_pool_t *pool) -{ - mrcp_sa_factory_t *sa_factory = apr_palloc(pool,sizeof(mrcp_sa_factory_t)); - sa_factory->agents_arr = apr_array_make(pool,1,sizeof(mrcp_sig_agent_t*)); - sa_factory->index = 0; - return sa_factory; -} - -/** Add signaling agent to pool */ -MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_agent_add(mrcp_sa_factory_t *sa_factory, mrcp_sig_agent_t *sig_agent) -{ - mrcp_sig_agent_t **slot; - if(!sig_agent) - return FALSE; - - slot = apr_array_push(sa_factory->agents_arr); - *slot = sig_agent; - return TRUE; -} - -/** Determine whether factory is empty. */ -MRCP_DECLARE(apt_bool_t) mrcp_sa_factory_is_empty(const mrcp_sa_factory_t *sa_factory) -{ - return apr_is_empty_array(sa_factory->agents_arr); -} - -/** Select next available signaling agent */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sa_factory_agent_select(mrcp_sa_factory_t *sa_factory) -{ - mrcp_sig_agent_t *sig_agent = APR_ARRAY_IDX(sa_factory->agents_arr, sa_factory->index, mrcp_sig_agent_t*); - if(++sa_factory->index == sa_factory->agents_arr->nelts) { - sa_factory->index = 0; - } - return sig_agent; -} - -/** Allocate MRCP signaling settings */ -MRCP_DECLARE(mrcp_sig_settings_t*) mrcp_signaling_settings_alloc(apr_pool_t *pool) -{ - mrcp_sig_settings_t *settings = apr_palloc(pool,sizeof(mrcp_sig_settings_t)); - settings->server_ip = NULL; - settings->server_port = 0; - settings->user_name = NULL; - settings->resource_location = NULL; - settings->resource_map = apr_table_make(pool,2); - settings->force_destination = FALSE; - settings->feature_tags = NULL; - return settings; -} - - -MRCP_DECLARE(mrcp_session_t*) mrcp_session_create(apr_size_t padding) -{ - mrcp_session_t *session; - apr_pool_t *pool = apt_pool_create(); - if(!pool) { - return NULL; - } - session = apr_palloc(pool,sizeof(mrcp_session_t)+padding); - session->pool = pool; - session->obj = NULL; - session->log_obj = NULL; - session->name = NULL; - session->signaling_agent = NULL; - session->connection_agent = NULL; - session->media_engine = NULL; - session->rtp_factory = NULL; - session->request_vtable = NULL; - session->response_vtable = NULL; - session->event_vtable = NULL; - apt_string_reset(&session->id); - session->last_request_id = 0; - return session; -} - -MRCP_DECLARE(void) mrcp_session_destroy(mrcp_session_t *session) -{ - if(session->pool) { - apr_pool_destroy(session->pool); - } -} diff --git a/libs/unimrcp/libs/mrcp/Makefile.am b/libs/unimrcp/libs/mrcp/Makefile.am deleted file mode 100644 index 7c893f8dd9..0000000000 --- a/libs/unimrcp/libs/mrcp/Makefile.am +++ /dev/null @@ -1,47 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcp.la - -include_HEADERS = include/mrcp.h \ - include/mrcp_types.h \ - message/include/mrcp_start_line.h \ - message/include/mrcp_header_accessor.h \ - message/include/mrcp_generic_header.h \ - message/include/mrcp_header.h \ - message/include/mrcp_message.h \ - control/include/mrcp_resource.h \ - control/include/mrcp_resource_factory.h \ - control/include/mrcp_resource_loader.h \ - control/include/mrcp_stream.h \ - resources/include/mrcp_synth_header.h \ - resources/include/mrcp_synth_resource.h \ - resources/include/mrcp_recog_header.h \ - resources/include/mrcp_recog_resource.h \ - resources/include/mrcp_recorder_header.h \ - resources/include/mrcp_recorder_resource.h \ - resources/include/mrcp_verifier_header.h \ - resources/include/mrcp_verifier_resource.h - -libmrcp_la_SOURCES = message/src/mrcp_start_line.c \ - message/src/mrcp_header_accessor.c \ - message/src/mrcp_generic_header.c \ - message/src/mrcp_header.c \ - message/src/mrcp_message.c \ - control/src/mrcp_resource_factory.c \ - control/src/mrcp_resource_loader.c \ - control/src/mrcp_stream.c \ - resources/src/mrcp_synth_header.c \ - resources/src/mrcp_synth_resource.c \ - resources/src/mrcp_recog_header.c \ - resources/src/mrcp_recog_resource.c \ - resources/src/mrcp_recorder_header.c \ - resources/src/mrcp_recorder_resource.c \ - resources/src/mrcp_verifier_header.c \ - resources/src/mrcp_verifier_resource.c diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h deleted file mode 100644 index 9c2910903a..0000000000 --- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RESOURCE_H -#define MRCP_RESOURCE_H - -/** - * @file mrcp_resource.h - * @brief Abstract MRCP Resource - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - - -/** MRCP resource definition */ -struct mrcp_resource_t { - /** MRCP resource identifier */ - mrcp_resource_id id; - /** MRCP resource name */ - apt_str_t name; - - /** Get string table of methods */ - const apt_str_table_item_t* (*get_method_str_table)(mrcp_version_e version); - /** Number of methods */ - apr_size_t method_count; - - /** Get string table of events */ - const apt_str_table_item_t* (*get_event_str_table)(mrcp_version_e version); - /** Number of events */ - apr_size_t event_count; - - /** Get vtable of resource header */ - const mrcp_header_vtable_t* (*get_resource_header_vtable)(mrcp_version_e version); -}; - -/** Initialize MRCP resource */ -static APR_INLINE mrcp_resource_t* mrcp_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = (mrcp_resource_t*) apr_palloc(pool, sizeof(mrcp_resource_t)); - resource->id = 0; - apt_string_reset(&resource->name); - resource->method_count = 0; - resource->event_count = 0; - resource->get_method_str_table = NULL; - resource->get_event_str_table = NULL; - resource->get_resource_header_vtable = NULL; - return resource; -} - -/** Validate MRCP resource */ -static APR_INLINE apt_bool_t mrcp_resource_validate(mrcp_resource_t *resource) -{ - if(resource->method_count && resource->event_count && - resource->get_method_str_table && resource->get_event_str_table && - resource->get_resource_header_vtable && - resource->name.buf && resource->name.length) { - return TRUE; - } - return FALSE; -} - -APT_END_EXTERN_C - -#endif /* MRCP_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h deleted file mode 100644 index 0f3c2f6e09..0000000000 --- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_factory.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_resource_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RESOURCE_FACTORY_H -#define MRCP_RESOURCE_FACTORY_H - -/** - * @file mrcp_resource_factory.h - * @brief Aggregation of MRCP Resources - */ - -#include "apt_text_stream.h" -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Create MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_create(apr_size_t resource_count, apr_pool_t *pool); - -/** Destroy MRCP resource factory */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_factory_destroy(mrcp_resource_factory_t *resource_factory); - -/** Register MRCP resource */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_register(mrcp_resource_factory_t *resource_factory, mrcp_resource_t *resource); - -/** Get MRCP resource by resource id */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_get(const mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id); - -/** Find MRCP resource by resource name */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_find(const mrcp_resource_factory_t *resource_factory, const apt_str_t *name); - - -APT_END_EXTERN_C - -#endif /* MRCP_RESOURCE_FACTORY_H */ diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h deleted file mode 100644 index 555b580a6d..0000000000 --- a/libs/unimrcp/libs/mrcp/control/include/mrcp_resource_loader.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_resource_loader.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RESOURCE_LOADER_H -#define MRCP_RESOURCE_LOADER_H - -/** - * @file mrcp_resource_loader.h - * @brief MRCP Resource Loader - */ - -#include "apt_string.h" -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque resource loader declaration */ -typedef struct mrcp_resource_loader_t mrcp_resource_loader_t; - - -/** Create MRCP resource loader */ -MRCP_DECLARE(mrcp_resource_loader_t*) mrcp_resource_loader_create(apt_bool_t load_all_resources, apr_pool_t *pool); - -/** Load all MRCP resources */ -MRCP_DECLARE(apt_bool_t) mrcp_resources_load(mrcp_resource_loader_t *loader); - -/** Load MRCP resource by resource name */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_load(mrcp_resource_loader_t *loader, const apt_str_t *name); - -/** Load MRCP resource by resource identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_load_by_id(mrcp_resource_loader_t *loader, mrcp_resource_id id); - -/** Get MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_get(const mrcp_resource_loader_t *loader); - -APT_END_EXTERN_C - -#endif /* MRCP_RESOURCE_LOADER_H */ diff --git a/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h b/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h deleted file mode 100644 index 1389effb42..0000000000 --- a/libs/unimrcp/libs/mrcp/control/include/mrcp_stream.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_STREAM_H -#define MRCP_STREAM_H - -/** - * @file mrcp_stream.h - * @brief MRCP Stream Parser and Generator - */ - -#include "apt_text_message.h" -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - - -/** Opaque MRCP parser declaration */ -typedef struct mrcp_parser_t mrcp_parser_t; -/** Opaque MRCP generator declaration */ -typedef struct mrcp_generator_t mrcp_generator_t; - - -/** Create MRCP stream parser */ -MRCP_DECLARE(mrcp_parser_t*) mrcp_parser_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool); - -/** Set resource by name to be used for parsing of MRCPv1 messages */ -MRCP_DECLARE(void) mrcp_parser_resource_set(mrcp_parser_t *parser, const apt_str_t *resource_name); - -/** Set verbose mode for the parser */ -MRCP_DECLARE(void) mrcp_parser_verbose_set(mrcp_parser_t *parser, apt_bool_t verbose); - -/** Parse MRCP stream */ -MRCP_DECLARE(apt_message_status_e) mrcp_parser_run(mrcp_parser_t *parser, apt_text_stream_t *stream, mrcp_message_t **message); - - - -/** Create MRCP stream generator */ -MRCP_DECLARE(mrcp_generator_t*) mrcp_generator_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool); - -/** Set verbose mode for the generator */ -MRCP_DECLARE(void) mrcp_generator_verbose_set(mrcp_generator_t *generator, apt_bool_t verbose); - -/** Generate MRCP stream */ -MRCP_DECLARE(apt_message_status_e) mrcp_generator_run(mrcp_generator_t *generator, mrcp_message_t *message, apt_text_stream_t *stream); - - -/** Generate MRCP message (excluding message body) */ -MRCP_DECLARE(apt_bool_t) mrcp_message_generate(const mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream); - - -APT_END_EXTERN_C - -#endif /* MRCP_STREAM_H */ diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c deleted file mode 100644 index e0a1124075..0000000000 --- a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_factory.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_resource_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -#include "mrcp_resource.h" -#include "mrcp_generic_header.h" - -/** Resource factory definition (aggregation of resources) */ -struct mrcp_resource_factory_t { - /** Array of MRCP resources (reference by id) */ - mrcp_resource_t **resource_array; - /** Number of MRCP resources */ - apr_size_t resource_count; - /** Hash of MRCP resources (reference by name) */ - apr_hash_t *resource_hash; -}; - -/** Create MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_create(apr_size_t resource_count, apr_pool_t *pool) -{ - apr_size_t i; - mrcp_resource_factory_t *resource_factory; - if(resource_count == 0) { - return NULL; - } - - resource_factory = apr_palloc(pool,sizeof(mrcp_resource_factory_t)); - resource_factory->resource_count = resource_count; - resource_factory->resource_array = apr_palloc(pool,sizeof(mrcp_resource_t*)*resource_count); - for(i=0; iresource_array[i] = NULL; - } - resource_factory->resource_hash = apr_hash_make(pool); - return resource_factory; -} - -/** Destroy MRCP resource container */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_factory_destroy(mrcp_resource_factory_t *resource_factory) -{ - if(resource_factory->resource_array) { - resource_factory->resource_array = NULL; - } - resource_factory->resource_count = 0; - return TRUE; -} - -/** Register MRCP resource */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_register(mrcp_resource_factory_t *resource_factory, mrcp_resource_t *resource) -{ - if(!resource || resource->id >= resource_factory->resource_count) { - /* invalid params */ - return FALSE; - } - if(resource_factory->resource_array[resource->id]) { - /* resource with specified id already exists */ - return FALSE; - } - if(mrcp_resource_validate(resource) != TRUE) { - /* invalid resource */ - return FALSE; - } - resource_factory->resource_array[resource->id] = resource; - apr_hash_set(resource_factory->resource_hash,resource->name.buf,resource->name.length,resource); - return TRUE; -} - -/** Get MRCP resource by resource id */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_get(const mrcp_resource_factory_t *resource_factory, mrcp_resource_id resource_id) -{ - if(resource_id >= resource_factory->resource_count) { - return NULL; - } - return resource_factory->resource_array[resource_id]; -} - -/** Find MRCP resource by resource name */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_resource_find(const mrcp_resource_factory_t *resource_factory, const apt_str_t *name) -{ - if(!name->buf || !name->length) { - return NULL; - } - - return apr_hash_get(resource_factory->resource_hash,name->buf,name->length); -} diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c deleted file mode 100644 index d172bdddb4..0000000000 --- a/libs/unimrcp/libs/mrcp/control/src/mrcp_resource_loader.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_resource_loader.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_resource_loader.h" -#include "mrcp_resource_factory.h" -#include "mrcp_resource.h" -#include "mrcp_synth_resource.h" -#include "mrcp_recog_resource.h" -#include "mrcp_recorder_resource.h" -#include "mrcp_verifier_resource.h" -#include "apt_log.h" - -/** Resource loader */ -struct mrcp_resource_loader_t { - mrcp_resource_factory_t *factory; - apr_pool_t *pool; -}; - -/** String table of MRCPv2 resources (mrcp_resource_type_e) */ -static const apt_str_table_item_t mrcp_resource_string_table[] = { - {{"speechsynth",11},6}, - {{"speechrecog",11},6}, - {{"recorder", 8},0}, - {{"speakverify",11},3} -}; - -static mrcp_resource_t* mrcp_resource_create_by_id(mrcp_resource_id id, apr_pool_t *pool); - -/** Create default MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_loader_t*) mrcp_resource_loader_create(apt_bool_t load_all_resources, apr_pool_t *pool) -{ - mrcp_resource_loader_t *loader; - mrcp_resource_factory_t *resource_factory; - resource_factory = mrcp_resource_factory_create(MRCP_RESOURCE_TYPE_COUNT,pool); - if(!resource_factory) { - return NULL; - } - - loader = apr_palloc(pool,sizeof(mrcp_resource_loader_t)); - loader->factory = resource_factory; - loader->pool = pool; - - if(load_all_resources == TRUE) { - mrcp_resources_load(loader); - } - - return loader; -} - -/** Load all MRCP resources */ -MRCP_DECLARE(apt_bool_t) mrcp_resources_load(mrcp_resource_loader_t *loader) -{ - mrcp_resource_id id; - for(id=0; idpool); - if(!resource) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Failed to Load Resource [%d]",id); - return FALSE; - } - - apt_string_copy(&resource->name,name,loader->pool); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Register Resource [%s]",name->buf); - return mrcp_resource_register(loader->factory,resource); -} - -/** Load MRCP resource by resource identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_load_by_id(mrcp_resource_loader_t *loader, mrcp_resource_id id) -{ - const apt_str_t *name = apt_string_table_str_get( - mrcp_resource_string_table, - MRCP_RESOURCE_TYPE_COUNT, - id); - mrcp_resource_t *resource = mrcp_resource_create_by_id(id,loader->pool); - if(!resource || !name) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Failed to Load Resource [%d]",id); - return FALSE; - } - - resource->name = *name; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Register Resource [%s]",resource->name.buf); - return mrcp_resource_register(loader->factory,resource); -} - -/** Get MRCP resource factory */ -MRCP_DECLARE(mrcp_resource_factory_t*) mrcp_resource_factory_get(const mrcp_resource_loader_t *loader) -{ - return loader->factory; -} - -static mrcp_resource_t* mrcp_resource_create_by_id(mrcp_resource_id id, apr_pool_t *pool) -{ - mrcp_resource_t *resource = NULL; - switch(id) { - case MRCP_SYNTHESIZER_RESOURCE: - resource = mrcp_synth_resource_create(pool); - break; - case MRCP_RECOGNIZER_RESOURCE: - resource = mrcp_recog_resource_create(pool); - break; - case MRCP_RECORDER_RESOURCE: - resource = mrcp_recorder_resource_create(pool); - break; - case MRCP_VERIFIER_RESOURCE: - resource = mrcp_verifier_resource_create(pool); - break; - } - - if(resource) { - resource->id = id; - } - return resource; -} diff --git a/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c b/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c deleted file mode 100644 index 7791764722..0000000000 --- a/libs/unimrcp/libs/mrcp/control/src/mrcp_stream.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_stream.h" -#include "mrcp_message.h" -#include "mrcp_resource_factory.h" -#include "mrcp_resource.h" -#include "apt_log.h" - - -/** MRCP parser */ -struct mrcp_parser_t { - apt_message_parser_t *base; - const mrcp_resource_factory_t *resource_factory; - mrcp_resource_t *resource; -}; - -/** MRCP generator */ -struct mrcp_generator_t { - apt_message_generator_t *base; - const mrcp_resource_factory_t *resource_factory; -}; - -/** Create message and read start line */ -static apt_bool_t mrcp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool); -/** Header section handler */ -static apt_bool_t mrcp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context); - -static const apt_message_parser_vtable_t parser_vtable = { - mrcp_parser_on_start, - mrcp_parser_on_header_complete, - NULL -}; - -/** Start message generation */ -apt_bool_t mrcp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); -/** Finalize by setting overall message length in start line */ -apt_bool_t mrcp_generator_on_header_complete(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); - -static const apt_message_generator_vtable_t generator_vtable = { - mrcp_generator_on_start, - mrcp_generator_on_header_complete, - NULL -}; - - -/** Create MRCP stream parser */ -MRCP_DECLARE(mrcp_parser_t*) mrcp_parser_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool) -{ - mrcp_parser_t *parser = apr_palloc(pool,sizeof(mrcp_parser_t)); - parser->base = apt_message_parser_create(parser,&parser_vtable,pool); - parser->resource_factory = resource_factory; - parser->resource = NULL; - return parser; -} - -/** Set resource by name to be used for parsing of MRCPv1 messages */ -MRCP_DECLARE(void) mrcp_parser_resource_set(mrcp_parser_t *parser, const apt_str_t *resource_name) -{ - if(resource_name) { - parser->resource = mrcp_resource_find(parser->resource_factory,resource_name); - } -} - -/** Set verbose mode for the parser */ -MRCP_DECLARE(void) mrcp_parser_verbose_set(mrcp_parser_t *parser, apt_bool_t verbose) -{ - apt_message_parser_verbose_set(parser->base,verbose); -} - -/** Parse MRCP stream */ -MRCP_DECLARE(apt_message_status_e) mrcp_parser_run(mrcp_parser_t *parser, apt_text_stream_t *stream, mrcp_message_t **message) -{ - return apt_message_parser_run(parser->base,stream,(void**)message); -} - -/** Create message and read start line */ -static apt_bool_t mrcp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool) -{ - mrcp_message_t *mrcp_message; - apt_str_t start_line; - /* read start line */ - if(apt_text_line_read(stream,&start_line) == FALSE) { - return FALSE; - } - - /* create new MRCP message */ - mrcp_message = mrcp_message_create(pool); - /* parse start-line */ - if(mrcp_start_line_parse(&mrcp_message->start_line,&start_line,mrcp_message->pool) == FALSE) { - return FALSE; - } - - if(mrcp_message->start_line.version == MRCP_VERSION_1) { - mrcp_parser_t *mrcp_parser = apt_message_parser_object_get(parser); - if(!mrcp_parser->resource) { - return FALSE; - } - apt_string_copy( - &mrcp_message->channel_id.resource_name, - &mrcp_parser->resource->name, - pool); - - if(mrcp_message_resource_set(mrcp_message,mrcp_parser->resource) == FALSE) { - return FALSE; - } - } - - context->message = mrcp_message; - context->header = &mrcp_message->header.header_section; - context->body = &mrcp_message->body; - return TRUE; -} - -/** Header section handler */ -static apt_bool_t mrcp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context) -{ - mrcp_message_t *mrcp_message = context->message; - if(mrcp_message->start_line.version == MRCP_VERSION_2) { - mrcp_resource_t *resource; - mrcp_parser_t *mrcp_parser; - if(mrcp_channel_id_parse(&mrcp_message->channel_id,&mrcp_message->header,mrcp_message->pool) == FALSE) { - return FALSE; - } - mrcp_parser = apt_message_parser_object_get(parser); - /* find resource */ - resource = mrcp_resource_find(mrcp_parser->resource_factory,&mrcp_message->channel_id.resource_name); - if(!resource) { - return FALSE; - } - - if(mrcp_message_resource_set(mrcp_message,resource) == FALSE) { - return FALSE; - } - } - - if(mrcp_header_fields_parse(&mrcp_message->header,mrcp_message->pool) == FALSE) { - return FALSE; - } - - if(context->body && mrcp_generic_header_property_check(mrcp_message,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) { - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(mrcp_message); - if(generic_header && generic_header->content_length) { - context->body->length = generic_header->content_length; - } - } - return TRUE; -} - - -/** Create MRCP stream generator */ -MRCP_DECLARE(mrcp_generator_t*) mrcp_generator_create(const mrcp_resource_factory_t *resource_factory, apr_pool_t *pool) -{ - mrcp_generator_t *generator = apr_palloc(pool,sizeof(mrcp_generator_t)); - generator->base = apt_message_generator_create(generator,&generator_vtable,pool); - generator->resource_factory = resource_factory; - return generator; -} - -/** Set verbose mode for the generator */ -MRCP_DECLARE(void) mrcp_generator_verbose_set(mrcp_generator_t *generator, apt_bool_t verbose) -{ - apt_message_generator_verbose_set(generator->base,verbose); -} - -/** Generate MRCP stream */ -MRCP_DECLARE(apt_message_status_e) mrcp_generator_run(mrcp_generator_t *generator, mrcp_message_t *message, apt_text_stream_t *stream) -{ - return apt_message_generator_run(generator->base,message,stream); -} - -/** Initialize by generating message start line and return header section and body */ -apt_bool_t mrcp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream) -{ - mrcp_message_t *mrcp_message = context->message; - /* validate message */ - if(mrcp_message_validate(mrcp_message) == FALSE) { - return FALSE; - } - /* generate start-line */ - if(mrcp_start_line_generate(&mrcp_message->start_line,stream) == FALSE) { - return FALSE; - } - - if(mrcp_message->start_line.version == MRCP_VERSION_2) { - mrcp_channel_id_generate(&mrcp_message->channel_id,stream); - } - - context->header = &mrcp_message->header.header_section; - context->body = &mrcp_message->body; - return TRUE; -} - -/** Finalize by setting overall message length in start line */ -apt_bool_t mrcp_generator_on_header_complete(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream) -{ - mrcp_message_t *mrcp_message = context->message; - /* finalize start-line generation */ - return mrcp_start_line_finalize(&mrcp_message->start_line,mrcp_message->body.length,stream); -} - -/** Generate MRCP message (excluding message body) */ -MRCP_DECLARE(apt_bool_t) mrcp_message_generate(const mrcp_resource_factory_t *resource_factory, mrcp_message_t *message, apt_text_stream_t *stream) -{ - /* validate message */ - if(mrcp_message_validate(message) == FALSE) { - return FALSE; - } - - /* generate start-line */ - if(mrcp_start_line_generate(&message->start_line,stream) == FALSE) { - return FALSE; - } - - if(message->start_line.version == MRCP_VERSION_2) { - mrcp_channel_id_generate(&message->channel_id,stream); - } - - /* generate header section */ - if(apt_header_section_generate(&message->header.header_section,stream) == FALSE) { - return FALSE; - } - - /* finalize start-line generation */ - if(mrcp_start_line_finalize(&message->start_line,message->body.length,stream) == FALSE) { - return FALSE; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp/include/mrcp.h b/libs/unimrcp/libs/mrcp/include/mrcp.h deleted file mode 100644 index 995443e7ee..0000000000 --- a/libs/unimrcp/libs/mrcp/include/mrcp.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_H -#define MRCP_H - -/** - * @file mrcp.h - * @brief MRCP Core Definitions - */ - -#include -#include - -/** Library export/import defines */ -#ifdef WIN32 -#ifdef MRCP_STATIC_LIB -#define MRCP_DECLARE(type) type __stdcall -#else -#ifdef MRCP_LIB_EXPORT -#define MRCP_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define MRCP_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define MRCP_DECLARE(type) type -#endif - -#endif /* MRCP_H */ diff --git a/libs/unimrcp/libs/mrcp/include/mrcp_types.h b/libs/unimrcp/libs/mrcp/include/mrcp_types.h deleted file mode 100644 index 3f37cb6cfe..0000000000 --- a/libs/unimrcp/libs/mrcp/include/mrcp_types.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_TYPES_H -#define MRCP_TYPES_H - -/** - * @file mrcp_types.h - * @brief Basic MRCP Types - */ - -#include "mrcp.h" - -APT_BEGIN_EXTERN_C - -/** Protocol version */ -typedef enum { - - MRCP_VERSION_UNKNOWN = 0, /**< Unknown version */ - MRCP_VERSION_1 = 1, /**< MRCPv1 (RFC4463) */ - MRCP_VERSION_2 = 2 /**< MRCPv2 (draft-ietf-speechsc-mrcpv2-20) */ -} mrcp_version_e; - -/** Enumeration of MRCP resource types */ -typedef enum { - MRCP_SYNTHESIZER_RESOURCE, /**< Synthesizer resource */ - MRCP_RECOGNIZER_RESOURCE, /**< Recognizer resource */ - MRCP_RECORDER_RESOURCE, /**< Recorder resource */ - MRCP_VERIFIER_RESOURCE, /**< Verifier resource */ - - MRCP_RESOURCE_TYPE_COUNT /**< Number of resources */ -} mrcp_resource_type_e; - -/* MRCPv2 specifies request-id as 32bit unsigned integer, - * while MRCPv1 doesn't limit this value (1 * DIGIT). - * Some MRCPv1 clients use too long request-id. - * To support them #define TOO_LONG_MRCP_REQUEST_ID - */ -#ifdef TOO_LONG_MRCP_REQUEST_ID -/** MRCP request identifier */ -typedef apr_uint64_t mrcp_request_id; -/** Format to log MRCP request identifier */ -#define MRCP_REQUEST_ID_FMT APR_UINT64_T_FMT -#else -/** MRCP request identifier */ -typedef apr_uint32_t mrcp_request_id; -/** Format to log MRCP request identifier */ -#define MRCP_REQUEST_ID_FMT "d" -#endif - - -/** Method identifier associated with method name */ -typedef apr_size_t mrcp_method_id; -/** Resource identifier associated with resource name */ -typedef apr_size_t mrcp_resource_id; - - -/** Opaque MRCP message declaration */ -typedef struct mrcp_message_t mrcp_message_t; -/** Opaque MRCP resource declaration */ -typedef struct mrcp_resource_t mrcp_resource_t; -/** Opaque MRCP resource factory declaration */ -typedef struct mrcp_resource_factory_t mrcp_resource_factory_t; - - -APT_END_EXTERN_C - -#endif /* MRCP_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h deleted file mode 100644 index af84350da4..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_generic_header.h +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_generic_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_GENERIC_HEADER_H -#define MRCP_GENERIC_HEADER_H - -/** - * @file mrcp_generic_header.h - * @brief MRCP Generic Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** Enumeration of MRCP generic header fields */ -typedef enum { - GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST, - GENERIC_HEADER_PROXY_SYNC_ID, - GENERIC_HEADER_ACCEPT_CHARSET, - GENERIC_HEADER_CONTENT_TYPE, - GENERIC_HEADER_CONTENT_ID, - GENERIC_HEADER_CONTENT_BASE, - GENERIC_HEADER_CONTENT_ENCODING, - GENERIC_HEADER_CONTENT_LOCATION, - GENERIC_HEADER_CONTENT_LENGTH, - GENERIC_HEADER_CACHE_CONTROL, - GENERIC_HEADER_LOGGING_TAG, - GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS, - - /** Additional header fields for MRCP v2 */ - GENERIC_HEADER_ACCEPT, - GENERIC_HEADER_FETCH_TIMEOUT, - GENERIC_HEADER_SET_COOKIE, - GENERIC_HEADER_SET_COOKIE2, - - GENERIC_HEADER_COUNT -} mrcp_generic_header_id; - -/** MRCP request identifiers list declaration */ -typedef struct mrcp_request_id_list_t mrcp_request_id_list_t; -/** MRCP vendor specific parameter list of pairs */ -typedef struct mrcp_vendor_specific_params_list_t mrcp_vendor_specific_params_list_t; -/** MRCP generic header declaration */ -typedef struct mrcp_generic_header_t mrcp_generic_header_t; - -/** Max number of request ids in active request id list */ -#define MAX_ACTIVE_REQUEST_ID_COUNT 5 -/** List (array) of MRCP request identifiers */ -struct mrcp_request_id_list_t { - /** Array of request identifiers */ - mrcp_request_id ids[MAX_ACTIVE_REQUEST_ID_COUNT]; - /** Number of request identifiers */ - apr_size_t count; -}; - - -/** MRCP generic header */ -struct mrcp_generic_header_t { - /** Indicates the list of request-ids to which it should apply */ - mrcp_request_id_list_t active_request_id_list; - /** Helps the resource receiving the event, proxied by the client, - to decide if this event has been processed through a direct interaction of the resources */ - apt_str_t proxy_sync_id; - /** Specifies the acceptable character set for entities returned in the response or events associated with this request */ - apt_str_t accept_charset; - /** Restricted to speech markup, grammar, recognition results, etc. */ - apt_str_t content_type; - /** Contains an ID or name for the content, by which it can be referred to */ - apt_str_t content_id; - /** May be used to specify the base URI for resolving relative URLs within the entity */ - apt_str_t content_base; - /** Indicates what additional content coding has been applied to the entity-body */ - apt_str_t content_encoding; - /** Statement of the location of the resource corresponding to this particular entity at the time of the request */ - apt_str_t content_location; - /** Contains the length of the content of the message body */ - size_t content_length; - /** Defines the default caching algorithms on the media server for the session or request */ - apt_str_t cache_control; - /** Sets the logging tag for logs generated by the media server */ - apt_str_t logging_tag; - /** Specifies the vendor specific parameters used by the media server */ - apt_pair_arr_t *vendor_specific_params; - - /** Additional header fields for MRCP v2 */ - /** Specifies the acceptable media types set for entities returned in the response or events associated with this request */ - apt_str_t accept; - /** Defines the timeout for content that the server may need to fetch over the network */ - apr_size_t fetch_timeout; - /** Enables to synchronize the cookie store of MRCP v2 client and server */ - apt_str_t set_cookie; - /** Enables to synchronize the cookie store of MRCP v2 client and server */ - apt_str_t set_cookie2; -}; - -/** Get generic header vtable */ -MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version); - - -/** Append active request id list */ -MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id); -/** Find request id in active request id list */ -MRCP_DECLARE(apt_bool_t) active_request_id_list_find(const mrcp_generic_header_t *generic_header, mrcp_request_id request_id); - - -APT_END_EXTERN_C - -#endif /* MRCP_GENERIC_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h deleted file mode 100644 index 9c9c0d5dee..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_header.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_HEADER_H -#define MRCP_HEADER_H - -/** - * @file mrcp_header.h - * @brief MRCP Message Header Definition - */ - -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** - * Allows external applications to trigger whether - * transaprent header fields are supported or not - */ -#define TRANSPARENT_HEADER_FIELDS_SUPPORT - -/** MRCP message header declaration */ -typedef struct mrcp_message_header_t mrcp_message_header_t; -/** MRCP channel-id declaration */ -typedef struct mrcp_channel_id mrcp_channel_id; - - -/** MRCP message-header */ -struct mrcp_message_header_t { - /** MRCP generic-header */ - mrcp_header_accessor_t generic_header_accessor; - /** MRCP resource specific header */ - mrcp_header_accessor_t resource_header_accessor; - - /** Header section (collection of header fields)*/ - apt_header_section_t header_section; -}; - -/** MRCP channel-identifier */ -struct mrcp_channel_id { - /** Unambiguous string identifying the MRCP session */ - apt_str_t session_id; - /** MRCP resource name */ - apt_str_t resource_name; -}; - - -/** Initialize MRCP message-header */ -static APR_INLINE void mrcp_message_header_init(mrcp_message_header_t *header) -{ - mrcp_header_accessor_init(&header->generic_header_accessor); - mrcp_header_accessor_init(&header->resource_header_accessor); - apt_header_section_init(&header->header_section); -} - -/** Allocate MRCP message-header data */ -MRCP_DECLARE(apt_bool_t) mrcp_message_header_data_alloc( - mrcp_message_header_t *header, - const mrcp_header_vtable_t *generic_header_vtable, - const mrcp_header_vtable_t *resource_header_vtable, - apr_pool_t *pool); - -/** Create MRCP message-header */ -MRCP_DECLARE(mrcp_message_header_t*) mrcp_message_header_create( - const mrcp_header_vtable_t *generic_header_vtable, - const mrcp_header_vtable_t *resource_header_vtable, - apr_pool_t *pool); - -/** Destroy MRCP message-header */ -static APR_INLINE void mrcp_message_header_destroy(mrcp_message_header_t *header) -{ - mrcp_header_destroy(&header->generic_header_accessor); - mrcp_header_destroy(&header->resource_header_accessor); -} - -/** Add MRCP header field */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_add(mrcp_message_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool); - - -/** Set (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_set(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool); - -/** Get (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_get(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, const mrcp_message_header_t *mask_header, apr_pool_t *pool); - -/** Inherit (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_inherit(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool); - -/** Parse MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_parse(mrcp_message_header_t *header, apr_pool_t *pool); - - -/** Initialize MRCP channel-identifier */ -MRCP_DECLARE(void) mrcp_channel_id_init(mrcp_channel_id *channel_id); - -/** Parse MRCP channel-identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_channel_id_parse(mrcp_channel_id *channel_id, mrcp_message_header_t *header, apr_pool_t *pool); - -/** Generate MRCP channel-identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_channel_id_generate(mrcp_channel_id *channel_id, apt_text_stream_t *text_stream); - - - -APT_END_EXTERN_C - -#endif /* MRCP_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h deleted file mode 100644 index 217b7bb2cd..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_header_accessor.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_header_accessor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_HEADER_ACCESSOR_H -#define MRCP_HEADER_ACCESSOR_H - -/** - * @file mrcp_header_accessor.h - * @brief Abstract MRCP Header Accessor - */ - -#include "apt_text_stream.h" -#include "apt_header_field.h" -#include "mrcp.h" - -APT_BEGIN_EXTERN_C - -/** MRCP header accessor declaration */ -typedef struct mrcp_header_accessor_t mrcp_header_accessor_t; -/** MRCP header vtable declaration */ -typedef struct mrcp_header_vtable_t mrcp_header_vtable_t; - -/** MRCP header accessor interface */ -struct mrcp_header_vtable_t { - /** Allocate actual header data */ - void* (*allocate)(mrcp_header_accessor_t *accessor, apr_pool_t *pool); - /** Destroy header data */ - void (*destroy)(mrcp_header_accessor_t *accessor); - - /** Parse header field value */ - apt_bool_t (*parse_field)(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool); - /** Generate header field value */ - apt_bool_t (*generate_field)(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool); - /** Duplicate header field value */ - apt_bool_t (*duplicate_field)(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool); - - /** Table of fields */ - const apt_str_table_item_t *field_table; - /** Number of fields */ - apr_size_t field_count; -}; - -/** MRCP header accessor */ -struct mrcp_header_accessor_t { - /** Actual header data allocated by accessor */ - void *data; - /** Header accessor interface */ - const mrcp_header_vtable_t *vtable; -}; - - - -/** Initialize header vtable */ -static APR_INLINE void mrcp_header_vtable_init(mrcp_header_vtable_t *vtable) -{ - vtable->allocate = NULL; - vtable->destroy = NULL; - vtable->parse_field = NULL; - vtable->generate_field = NULL; - vtable->duplicate_field = NULL; - vtable->field_table = NULL; - vtable->field_count = 0; -} - -/** Validate header vtable */ -static APR_INLINE apt_bool_t mrcp_header_vtable_validate(const mrcp_header_vtable_t *vtable) -{ - return (vtable->allocate && vtable->destroy && - vtable->parse_field && vtable->generate_field && - vtable->duplicate_field && vtable->field_table && - vtable->field_count) ? TRUE : FALSE; -} - - -/** Initialize header accessor */ -static APR_INLINE void mrcp_header_accessor_init(mrcp_header_accessor_t *accessor) -{ - accessor->data = NULL; - accessor->vtable = NULL; -} - -/** Allocate header data */ -static APR_INLINE void* mrcp_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - if(accessor->data) { - return accessor->data; - } - if(!accessor->vtable || !accessor->vtable->allocate) { - return NULL; - } - return accessor->vtable->allocate(accessor,pool); -} - -/** Destroy header data */ -static APR_INLINE void mrcp_header_destroy(mrcp_header_accessor_t *accessor) -{ - if(!accessor->vtable || !accessor->vtable->destroy) { - return; - } - accessor->vtable->destroy(accessor); -} - - -/** Parse header field value */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_parse(mrcp_header_accessor_t *accessor, apt_header_field_t *header_field, apr_pool_t *pool); - -/** Generate header field value */ -MRCP_DECLARE(apt_header_field_t*) mrcp_header_field_value_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_bool_t empty_value, apr_pool_t *pool); - -/** Duplicate header field value */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src_accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MRCP_HEADER_ACCESSOR_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h deleted file mode 100644 index 569a91b4bf..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_message.h +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_MESSAGE_H -#define MRCP_MESSAGE_H - -/** - * @file mrcp_message.h - * @brief MRCP Message Definition - */ - -#include "mrcp_types.h" -#include "mrcp_start_line.h" -#include "mrcp_header.h" -#include "mrcp_generic_header.h" - -APT_BEGIN_EXTERN_C - -/** Macro to log channel identifier of the message */ -#define MRCP_MESSAGE_SIDRES(message) \ - (message)->channel_id.session_id.buf, (message)->channel_id.resource_name.buf - -/** MRCP message */ -struct mrcp_message_t { - /** Start-line of MRCP message */ - mrcp_start_line_t start_line; - /** Channel-identifier of MRCP message */ - mrcp_channel_id channel_id; - /** Header of MRCP message */ - mrcp_message_header_t header; - /** Body of MRCP message */ - apt_str_t body; - - /** Associated MRCP resource */ - const mrcp_resource_t *resource; - /** Memory pool to allocate memory from */ - apr_pool_t *pool; -}; - -/** - * Create an MRCP message. - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_message_create(apr_pool_t *pool); - -/** - * Create an MRCP request message. - * @param resource the MRCP resource to use - * @param version the MRCP version to use - * @param method_id the MRCP resource specific method identifier - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_request_create( - const mrcp_resource_t *resource, - mrcp_version_e version, - mrcp_method_id method_id, - apr_pool_t *pool); - -/** - * Create an MRCP response message based on given request message. - * @param request_message the MRCP request message to create a response for - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_response_create(const mrcp_message_t *request_message, apr_pool_t *pool); - -/** - * Create an MRCP event message based on given requuest message. - * @param request_message the MRCP request message to create an event for - * @param event_id the MRCP resource specific event identifier - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_message_t*) mrcp_event_create( - const mrcp_message_t *request_message, - mrcp_method_id event_id, - apr_pool_t *pool); - -/** - * Associate MRCP resource with message. - * @param message the message to associate resource with - * @param resource the resource to associate - */ -MRCP_DECLARE(apt_bool_t) mrcp_message_resource_set(mrcp_message_t *message, const mrcp_resource_t *resource); - -/** - * Validate MRCP message. - * @param message the message to validate - */ -MRCP_DECLARE(apt_bool_t) mrcp_message_validate(mrcp_message_t *message); - -/** - * Destroy MRCP message. - * @param message the message to destroy - */ -MRCP_DECLARE(void) mrcp_message_destroy(mrcp_message_t *message); - - -/** - * Get MRCP generic header. - * @param message the message to get generic header from - */ -static APR_INLINE mrcp_generic_header_t* mrcp_generic_header_get(const mrcp_message_t *message) -{ - return (mrcp_generic_header_t*) message->header.generic_header_accessor.data; -} - -/** - * Allocate (if not allocated) and get MRCP generic header. - * @param message the message to prepare generic header for - */ -static APR_INLINE mrcp_generic_header_t* mrcp_generic_header_prepare(mrcp_message_t *message) -{ - return (mrcp_generic_header_t*) mrcp_header_allocate(&message->header.generic_header_accessor,message->pool); -} - -/** - * Add MRCP generic header field by specified property (numeric identifier). - * @param message the message to add property for - * @param id the numeric identifier to add - */ -MRCP_DECLARE(apt_bool_t) mrcp_generic_header_property_add(mrcp_message_t *message, apr_size_t id); - -/** - * Add only the name of MRCP generic header field specified by property (numeric identifier). - * @param message the message to add property for - * @param id the numeric identifier to add - * @remark Should be used to construct empty header fiedls for GET-PARAMS requests - */ -MRCP_DECLARE(apt_bool_t) mrcp_generic_header_name_property_add(mrcp_message_t *message, apr_size_t id); - -/** - * Remove MRCP generic header field by specified property (numeric identifier). - * @param message the message to remove property from - * @param id the numeric identifier to remove - */ -static APR_INLINE apt_bool_t mrcp_generic_header_property_remove(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = apt_header_section_field_get(&message->header.header_section,id); - if(header_field) { - return apt_header_section_field_remove(&message->header.header_section,header_field); - } - return FALSE; -} - -/** - * Check whether specified by property (numeric identifier) MRCP generic header field is set or not. - * @param message the message to use - * @param id the numeric identifier to check - */ -static APR_INLINE apt_bool_t mrcp_generic_header_property_check(const mrcp_message_t *message, apr_size_t id) -{ - return apt_header_section_field_check(&message->header.header_section,id); -} - - -/** - * Get MRCP resource header. - * @param message the message to get resource header from - */ -static APR_INLINE void* mrcp_resource_header_get(const mrcp_message_t *message) -{ - return message->header.resource_header_accessor.data; -} - -/** - * Allocate (if not allocated) and get MRCP resource header. - * @param message the message to prepare resource header for - */ -static APR_INLINE void* mrcp_resource_header_prepare(mrcp_message_t *mrcp_message) -{ - return mrcp_header_allocate(&mrcp_message->header.resource_header_accessor,mrcp_message->pool); -} - -/** - * Add MRCP resource header field by specified property (numeric identifier). - * @param message the message to add property for - * @param id the numeric identifier to add - */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_header_property_add(mrcp_message_t *message, apr_size_t id); - -/** - * Add only the name of MRCP resource header field specified by property (numeric identifier). - * @param message the message to add property for - * @param id the numeric identifier to add - * @remark Should be used to construct empty header fiedls for GET-PARAMS requests - */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_header_name_property_add(mrcp_message_t *message, apr_size_t id); - -/** - * Remove MRCP resource header field by specified property (numeric identifier). - * @param message the message to remove property from - * @param id the numeric identifier to remove - */ -static APR_INLINE apt_bool_t mrcp_resource_header_property_remove(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = apt_header_section_field_get(&message->header.header_section,id + GENERIC_HEADER_COUNT); - if(header_field) { - return apt_header_section_field_remove(&message->header.header_section,header_field); - } - return FALSE; -} - -/** - * Check whether specified by property (numeric identifier) MRCP resource header field is set or not. - * @param message the message to use - * @param id the numeric identifier to check - */ -static APR_INLINE apt_bool_t mrcp_resource_header_property_check(const mrcp_message_t *message, apr_size_t id) -{ - return apt_header_section_field_check(&message->header.header_section,id + GENERIC_HEADER_COUNT); -} - -/** - * Add MRCP header field. - * @param message the message to add header field for - * @param header_field the header field to add - */ -static APR_INLINE apt_bool_t mrcp_message_header_field_add(mrcp_message_t *message, apt_header_field_t *header_field) -{ - return mrcp_header_field_add(&message->header,header_field,message->pool); -} - -/** - * Get the next MRCP header field. - * @param message the message to use - * @param header_field current header field - * @remark Should be used to iterate on header fields - * - * apt_header_field_t *header_field = NULL; - * while( (header_field = mrcp_message_next_header_field_get(message,header_field)) != NULL ) { - * } - */ -MRCP_DECLARE(apt_header_field_t*) mrcp_message_next_header_field_get( - const mrcp_message_t *message, - apt_header_field_t *header_field); - -APT_END_EXTERN_C - -#endif /* MRCP_MESSAGE_H */ diff --git a/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h b/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h deleted file mode 100644 index 8b739a259f..0000000000 --- a/libs/unimrcp/libs/mrcp/message/include/mrcp_start_line.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_start_line.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_START_LINE_H -#define MRCP_START_LINE_H - -/** - * @file mrcp_start_line.h - * @brief MRCP Start Line Definition - */ - -#include "mrcp_types.h" -#include "apt_text_stream.h" - -APT_BEGIN_EXTERN_C - -/** Request-states used in MRCP response message */ -typedef enum { - /** The request was processed to completion and there will be no - more events from that resource to the client with that request-id */ - MRCP_REQUEST_STATE_COMPLETE, - /** Indicate that further event messages will be delivered with that request-id */ - MRCP_REQUEST_STATE_INPROGRESS, - /** The job has been placed on a queue and will be processed in first-in-first-out order */ - MRCP_REQUEST_STATE_PENDING, - - /** Number of request states */ - MRCP_REQUEST_STATE_COUNT, - /** Unknown request state */ - MRCP_REQUEST_STATE_UNKNOWN = MRCP_REQUEST_STATE_COUNT -} mrcp_request_state_e; - -/** Status codes */ -typedef enum { - MRCP_STATUS_CODE_UNKNOWN = 0, - /* success codes (2xx) */ - MRCP_STATUS_CODE_SUCCESS = 200, - MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE = 201, - /* failure codes (4xx) */ - MRCP_STATUS_CODE_METHOD_NOT_ALLOWED = 401, - MRCP_STATUS_CODE_METHOD_NOT_VALID = 402, - MRCP_STATUS_CODE_UNSUPPORTED_PARAM = 403, - MRCP_STATUS_CODE_ILLEGAL_PARAM_VALUE = 404, - MRCP_STATUS_CODE_NOT_FOUND = 405, - MRCP_STATUS_CODE_MISSING_PARAM = 406, - MRCP_STATUS_CODE_METHOD_FAILED = 407, - MRCP_STATUS_CODE_UNRECOGNIZED_MESSAGE = 408, - MRCP_STATUS_CODE_UNSUPPORTED_PARAM_VALUE = 409, - MRCP_STATUS_CODE_OUT_OF_ORDER = 410, - MRCP_STATUS_CODE_RESOURCE_SPECIFIC_FAILURE = 421 -} mrcp_status_code_e; - -/** MRCP message types */ -typedef enum { - MRCP_MESSAGE_TYPE_UNKNOWN, - MRCP_MESSAGE_TYPE_REQUEST, - MRCP_MESSAGE_TYPE_RESPONSE, - MRCP_MESSAGE_TYPE_EVENT -} mrcp_message_type_e; - - -/** MRCP start-line declaration */ -typedef struct mrcp_start_line_t mrcp_start_line_t; - -/** Start-line of MRCP message */ -struct mrcp_start_line_t { - /** MRCP message type */ - mrcp_message_type_e message_type; - /** Version of protocol in use */ - mrcp_version_e version; - /** Specify the length of the message, including the start-line (v2) */ - apr_size_t length; - /** Unique identifier among client and server */ - mrcp_request_id request_id; - /** MRCP method name */ - apt_str_t method_name; - /** MRCP method id (associated with method name) */ - mrcp_method_id method_id; - /** Success or failure or other status of the request */ - mrcp_status_code_e status_code; - /** The state of the job initiated by the request */ - mrcp_request_state_e request_state; -}; - -/** Initialize MRCP start-line */ -MRCP_DECLARE(void) mrcp_start_line_init(mrcp_start_line_t *start_line); -/** Parse MRCP start-line */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_parse(mrcp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool); -/** Generate MRCP start-line */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream); -/** Finalize MRCP start-line generation */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_finalize(mrcp_start_line_t *start_line, apr_size_t content_length, apt_text_stream_t *text_stream); - -/** Parse MRCP request-id */ -MRCP_DECLARE(mrcp_request_id) mrcp_request_id_parse(const apt_str_t *field); -/** Generate MRCP request-id */ -MRCP_DECLARE(apt_bool_t) mrcp_request_id_generate(mrcp_request_id request_id, apt_text_stream_t *stream); - - -APT_END_EXTERN_C - -#endif /* MRCP_START_LINE_H */ diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c deleted file mode 100644 index 858a76f802..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_generic_header.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_generic_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_generic_header.h" -#include "mrcp_start_line.h" - -/** String table of mrcp generic-header fields (mrcp_generic_header_id) */ -static const apt_str_table_item_t generic_header_string_table[] = { - {{"Active-Request-Id-List", 22},3}, - {{"Proxy-Sync-Id", 13},0}, - {{"Accept-Charset", 14},7}, - {{"Content-Type", 12},9}, - {{"Content-Id", 10},9}, - {{"Content-Base", 12},8}, - {{"Content-Encoding", 16},9}, - {{"Content-Location", 16},9}, - {{"Content-Length", 14},10}, - {{"Cache-Control", 13},1}, - {{"Logging-Tag", 11},0}, - {{"Vendor-Specific-Parameters",26},0}, - {{"Accept", 6},6}, - {{"Fetch-Timeout", 13},0}, - {{"Set-Cookie", 10},10}, - {{"Set-Cookie2", 11},10} -}; - -/** Parse mrcp request-id list */ -static apt_bool_t mrcp_request_id_list_parse(mrcp_request_id_list_t *request_id_list, const apt_str_t *value) -{ - apt_str_t field; - apt_text_stream_t stream; - stream.text = *value; - apt_text_stream_reset(&stream); - request_id_list->count = 0; - while(request_id_list->count < MAX_ACTIVE_REQUEST_ID_COUNT) { - if(apt_text_field_read(&stream,',',TRUE,&field) == FALSE) { - break; - } - request_id_list->ids[request_id_list->count] = mrcp_request_id_parse(&field); - request_id_list->count++; - } - return TRUE; -} - -/** Generate mrcp request-id list */ -static apt_bool_t mrcp_request_id_list_generate(const mrcp_request_id_list_t *request_id_list, apt_str_t *str, apr_pool_t *pool) -{ - apr_size_t i; - int length; - char *pos; - - /* compute estimated length, assuming request-ids consist of upto 10 digits */ - str->length = 10 * request_id_list->count; - if(request_id_list->count > 1) { - /* , */ - str->length += request_id_list->count - 1; - } - - str->buf = apr_palloc(pool,str->length + 1); - - pos = str->buf; - for(i=0; icount; i++) { - if(i != 0) { - *pos++ = ','; - } - - length = apr_snprintf(pos, str->length - (pos - str->buf), "%"MRCP_REQUEST_ID_FMT, request_id_list->ids[i]); - if(length < 0) - return FALSE; - pos += length; - } - *pos = '\0'; - return TRUE; -} - - -/** Initialize generic-header */ -static void mrcp_generic_header_init(mrcp_generic_header_t *generic_header) -{ - generic_header->active_request_id_list.count = 0; - apt_string_reset(&generic_header->proxy_sync_id); - apt_string_reset(&generic_header->accept_charset); - apt_string_reset(&generic_header->content_type); - apt_string_reset(&generic_header->content_id); - apt_string_reset(&generic_header->content_base); - apt_string_reset(&generic_header->content_encoding); - apt_string_reset(&generic_header->content_location); - generic_header->content_length = 0; - apt_string_reset(&generic_header->cache_control); - apt_string_reset(&generic_header->logging_tag); - generic_header->vendor_specific_params = NULL; - /* initializes additionnal MRCP v2 generic header fields */ - apt_string_reset(&generic_header->accept); - generic_header->fetch_timeout = 0; - apt_string_reset(&generic_header->set_cookie); - apt_string_reset(&generic_header->set_cookie2); -} - - -/** Allocate generic-header */ -static void* mrcp_generic_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_generic_header_t *generic_header = apr_palloc(pool,sizeof(mrcp_generic_header_t)); - mrcp_generic_header_init(generic_header); - accessor->data = generic_header; - return accessor->data; -} - -/** Parse generic-header */ -static apt_bool_t mrcp_generic_header_parse(mrcp_header_accessor_t *accessor, size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - mrcp_generic_header_t *generic_header = accessor->data; - switch(id) { - case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST: - mrcp_request_id_list_parse(&generic_header->active_request_id_list,value); - break; - case GENERIC_HEADER_PROXY_SYNC_ID: - generic_header->proxy_sync_id = *value; - break; - case GENERIC_HEADER_ACCEPT_CHARSET: - generic_header->accept_charset = *value; - break; - case GENERIC_HEADER_CONTENT_TYPE: - generic_header->content_type = *value; - break; - case GENERIC_HEADER_CONTENT_ID: - generic_header->content_id = *value; - break; - case GENERIC_HEADER_CONTENT_BASE: - generic_header->content_base = *value; - break; - case GENERIC_HEADER_CONTENT_ENCODING: - generic_header->content_encoding = *value; - break; - case GENERIC_HEADER_CONTENT_LOCATION: - generic_header->content_location = *value; - break; - case GENERIC_HEADER_CONTENT_LENGTH: - generic_header->content_length = apt_size_value_parse(value); - break; - case GENERIC_HEADER_CACHE_CONTROL: - generic_header->cache_control = *value; - break; - case GENERIC_HEADER_LOGGING_TAG: - generic_header->logging_tag = *value; - break; - case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS: - if(!generic_header->vendor_specific_params) { - generic_header->vendor_specific_params = apt_pair_array_create(1,pool); - } - apt_pair_array_parse(generic_header->vendor_specific_params,value,pool); - break; - case GENERIC_HEADER_ACCEPT: - generic_header->accept = *value; - break; - case GENERIC_HEADER_FETCH_TIMEOUT: - generic_header->fetch_timeout = apt_size_value_parse(value); - break; - case GENERIC_HEADER_SET_COOKIE: - generic_header->set_cookie = *value; - break; - case GENERIC_HEADER_SET_COOKIE2: - generic_header->set_cookie2 = *value; - break; - default: - status = FALSE; - } - return status; -} - -/** Generate generic-header */ -static apt_bool_t mrcp_generic_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_generic_header_t *generic_header = accessor->data; - switch(id) { - case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST: - mrcp_request_id_list_generate(&generic_header->active_request_id_list,value,pool); - break; - case GENERIC_HEADER_PROXY_SYNC_ID: - *value = generic_header->proxy_sync_id; - break; - case GENERIC_HEADER_ACCEPT_CHARSET: - *value = generic_header->accept_charset; - break; - case GENERIC_HEADER_CONTENT_TYPE: - *value = generic_header->content_type; - break; - case GENERIC_HEADER_CONTENT_ID: - *value = generic_header->content_id; - break; - case GENERIC_HEADER_CONTENT_BASE: - *value = generic_header->content_base; - break; - case GENERIC_HEADER_CONTENT_ENCODING: - *value = generic_header->content_encoding; - break; - case GENERIC_HEADER_CONTENT_LOCATION: - *value = generic_header->content_location; - break; - case GENERIC_HEADER_CONTENT_LENGTH: - apt_size_value_generate(generic_header->content_length,value,pool); - break; - case GENERIC_HEADER_CACHE_CONTROL: - *value = generic_header->cache_control; - break; - case GENERIC_HEADER_LOGGING_TAG: - *value = generic_header->logging_tag; - break; - case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS: - apt_pair_array_generate(generic_header->vendor_specific_params,value,pool); - break; - case GENERIC_HEADER_ACCEPT: - *value = generic_header->accept; - break; - case GENERIC_HEADER_FETCH_TIMEOUT: - apt_size_value_generate(generic_header->fetch_timeout,value,pool); - break; - case GENERIC_HEADER_SET_COOKIE: - *value = generic_header->set_cookie; - break; - case GENERIC_HEADER_SET_COOKIE2: - *value = generic_header->set_cookie2; - break; - default: - break; - } - return TRUE; -} - -/** Duplicate generic-header */ -static apt_bool_t mrcp_generic_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_generic_header_t *generic_header = accessor->data; - const mrcp_generic_header_t *src_generic_header = src->data; - apt_bool_t status = TRUE; - - if(!generic_header || !src_generic_header) { - return FALSE; - } - - switch(id) { - case GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST: - break; - case GENERIC_HEADER_PROXY_SYNC_ID: - generic_header->proxy_sync_id = *value; - break; - case GENERIC_HEADER_ACCEPT_CHARSET: - generic_header->accept_charset = *value; - break; - case GENERIC_HEADER_CONTENT_TYPE: - generic_header->content_type = *value; - break; - case GENERIC_HEADER_CONTENT_ID: - generic_header->content_id = *value; - break; - case GENERIC_HEADER_CONTENT_BASE: - generic_header->content_base = *value; - break; - case GENERIC_HEADER_CONTENT_ENCODING: - generic_header->content_encoding = *value; - break; - case GENERIC_HEADER_CONTENT_LOCATION: - generic_header->content_location = *value; - break; - case GENERIC_HEADER_CONTENT_LENGTH: - generic_header->content_length = src_generic_header->content_length; - break; - case GENERIC_HEADER_CACHE_CONTROL: - generic_header->cache_control = *value; - break; - case GENERIC_HEADER_LOGGING_TAG: - generic_header->logging_tag = *value; - break; - case GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS: - generic_header->vendor_specific_params = apt_pair_array_copy(src_generic_header->vendor_specific_params,pool); - break; - case GENERIC_HEADER_ACCEPT: - generic_header->accept = *value; - break; - case GENERIC_HEADER_FETCH_TIMEOUT: - generic_header->fetch_timeout = src_generic_header->fetch_timeout; - break; - case GENERIC_HEADER_SET_COOKIE: - generic_header->set_cookie = *value; - break; - case GENERIC_HEADER_SET_COOKIE2: - generic_header->set_cookie2 = *value; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t vtable = { - mrcp_generic_header_allocate, - NULL, /* nothing to destroy */ - mrcp_generic_header_parse, - mrcp_generic_header_generate, - mrcp_generic_header_duplicate, - generic_header_string_table, - GENERIC_HEADER_COUNT -}; - - -MRCP_DECLARE(const mrcp_header_vtable_t*) mrcp_generic_header_vtable_get(mrcp_version_e version) -{ - return &vtable; -} - - -/** Append active request id list */ -MRCP_DECLARE(apt_bool_t) active_request_id_list_append(mrcp_generic_header_t *generic_header, mrcp_request_id request_id) -{ - mrcp_request_id_list_t *request_id_list = &generic_header->active_request_id_list; - if(request_id_list->count >= MAX_ACTIVE_REQUEST_ID_COUNT) { - return FALSE; - } - request_id_list->ids[request_id_list->count++] = request_id; - return TRUE; -} - -/** Find request id in active request id list */ -MRCP_DECLARE(apt_bool_t) active_request_id_list_find(const mrcp_generic_header_t *generic_header, mrcp_request_id request_id) -{ - size_t i; - const mrcp_request_id_list_t *request_id_list = &generic_header->active_request_id_list; - for(i=0; icount; i++) { - if(request_id_list->ids[i] == request_id) { - return TRUE; - } - } - return FALSE; -} diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c deleted file mode 100644 index 22d02692e1..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_header.c +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_header.c 2238 2014-11-12 01:50:43Z achaloyan@gmail.com $ - */ - -#include "mrcp_header.h" -#include "mrcp_generic_header.h" -#include "apt_text_message.h" -#include "apt_log.h" - -#define MRCP_CHANNEL_ID "Channel-Identifier" -#define MRCP_CHANNEL_ID_LENGTH (sizeof(MRCP_CHANNEL_ID)-1) - - -/** Allocate MRCP message-header data */ -MRCP_DECLARE(apt_bool_t) mrcp_message_header_data_alloc( - mrcp_message_header_t *header, - const mrcp_header_vtable_t *generic_header_vtable, - const mrcp_header_vtable_t *resource_header_vtable, - apr_pool_t *pool) -{ - if(!generic_header_vtable || !resource_header_vtable) { - return FALSE; - } - - header->generic_header_accessor.data = NULL; - header->generic_header_accessor.vtable = generic_header_vtable; - - header->resource_header_accessor.data = NULL; - header->resource_header_accessor.vtable = resource_header_vtable; - - apt_header_section_array_alloc( - &header->header_section, - header->generic_header_accessor.vtable->field_count + - header->resource_header_accessor.vtable->field_count, - pool); - - mrcp_header_allocate(&header->generic_header_accessor,pool); - mrcp_header_allocate(&header->resource_header_accessor,pool); - return TRUE; -} - -MRCP_DECLARE(mrcp_message_header_t*) mrcp_message_header_create( - const mrcp_header_vtable_t *generic_header_vtable, - const mrcp_header_vtable_t *resource_header_vtable, - apr_pool_t *pool) -{ - mrcp_message_header_t *header = apr_palloc(pool,sizeof(mrcp_message_header_t)); - apt_header_section_init(&header->header_section); - mrcp_message_header_data_alloc(header,generic_header_vtable,resource_header_vtable,pool); - return header; -} - -/** Add MRCP header field */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_add(mrcp_message_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool) -{ - apt_bool_t status = FALSE; - if(apt_string_is_empty(&header_field->name) == FALSE) { - /* normal header */ - if(mrcp_header_field_value_parse(&header->resource_header_accessor,header_field,pool) == TRUE) { - header_field->id += GENERIC_HEADER_COUNT; - } - else if(mrcp_header_field_value_parse(&header->generic_header_accessor,header_field,pool) == TRUE) { - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Unknown MRCP header field: %s",header_field->name.buf); - } - status = apt_header_section_field_add(&header->header_section,header_field); - } - return status; -} - -/** Parse MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_parse(mrcp_message_header_t *header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - for(header_field = APR_RING_FIRST(&header->header_section.ring); - header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - - if(mrcp_header_field_value_parse(&header->resource_header_accessor,header_field,pool) == TRUE) { - header_field->id += GENERIC_HEADER_COUNT; - apt_header_section_field_set(&header->header_section,header_field); - } - else if(mrcp_header_field_value_parse(&header->generic_header_accessor,header_field,pool) == TRUE) { - apt_header_section_field_set(&header->header_section,header_field); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCP header field: %s",header_field->name.buf); - } - } - - return TRUE; -} - -static apt_bool_t mrcp_header_accessor_value_duplicate(mrcp_message_header_t *header, apt_header_field_t *header_field, - const mrcp_message_header_t *src_header, const apt_header_field_t *src_header_field, - apr_pool_t *pool) -{ - apt_bool_t status = FALSE; - if(header_field->id < GENERIC_HEADER_COUNT) { - status = mrcp_header_field_value_duplicate( - &header->generic_header_accessor, - &src_header->generic_header_accessor, - header_field->id, - &header_field->value, - pool); - } - else { - status = mrcp_header_field_value_duplicate( - &header->resource_header_accessor, - &src_header->resource_header_accessor, - header_field->id - GENERIC_HEADER_COUNT, - &header_field->value, - pool); - } - return status; -} - -/** Set (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_set(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - const apt_header_field_t *src_header_field; - for(src_header_field = APR_RING_FIRST(&src_header->header_section.ring); - src_header_field != APR_RING_SENTINEL(&src_header->header_section.ring, apt_header_field_t, link); - src_header_field = APR_RING_NEXT(src_header_field, link)) { - - header_field = apt_header_section_field_get(&header->header_section,src_header_field->id); - if(header_field) { - /* this header field has already been set, just copy its value */ - apt_string_copy(&header_field->value,&src_header_field->value,pool); - } - else { - /* copy the entire header field and add it to the header section */ - header_field = apt_header_field_copy(src_header_field,pool); - apt_header_section_field_add(&header->header_section,header_field); - } - - mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool); - } - - return TRUE; -} - -/** Get (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_get(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, const mrcp_message_header_t *mask_header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - const apt_header_field_t *src_header_field; - const apt_header_field_t *mask_header_field; - for(mask_header_field = APR_RING_FIRST(&mask_header->header_section.ring); - mask_header_field != APR_RING_SENTINEL(&mask_header->header_section.ring, apt_header_field_t, link); - mask_header_field = APR_RING_NEXT(mask_header_field, link)) { - - header_field = apt_header_section_field_get(&header->header_section,mask_header_field->id); - if(header_field) { - /* this header field has already been set, skip to the next one */ - continue; - } - - src_header_field = apt_header_section_field_get(&src_header->header_section,mask_header_field->id); - if(src_header_field) { - /* copy the entire header field */ - header_field = apt_header_field_copy(src_header_field,pool); - mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool); - } - else { - /* copy only the name of the header field */ - header_field = apt_header_field_copy(mask_header_field,pool); - } - /* add the header field to the header section */ - apt_header_section_field_add(&header->header_section,header_field); - } - - return TRUE; -} - -/** Inherit (copy) MRCP header fields */ -MRCP_DECLARE(apt_bool_t) mrcp_header_fields_inherit(mrcp_message_header_t *header, const mrcp_message_header_t *src_header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - const apt_header_field_t *src_header_field; - for(src_header_field = APR_RING_FIRST(&src_header->header_section.ring); - src_header_field != APR_RING_SENTINEL(&src_header->header_section.ring, apt_header_field_t, link); - src_header_field = APR_RING_NEXT(src_header_field, link)) { - - header_field = apt_header_section_field_get(&header->header_section,src_header_field->id); - if(header_field) { - /* this header field has already been set, skip to the next one */ - continue; - } - - /* copy the entire header field and add it to the header section */ - header_field = apt_header_field_copy(src_header_field,pool); - mrcp_header_accessor_value_duplicate(header,header_field,src_header,src_header_field,pool); - apt_header_section_field_add(&header->header_section,header_field); - } - return TRUE; -} - - -/** Initialize MRCP channel-identifier */ -MRCP_DECLARE(void) mrcp_channel_id_init(mrcp_channel_id *channel_id) -{ - apt_string_reset(&channel_id->session_id); - apt_string_reset(&channel_id->resource_name); -} - -/** Parse MRCP channel-identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_channel_id_parse(mrcp_channel_id *channel_id, mrcp_message_header_t *header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - for(header_field = APR_RING_FIRST(&header->header_section.ring); - header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - - if(header_field->value.length && strncasecmp(header_field->name.buf,MRCP_CHANNEL_ID,MRCP_CHANNEL_ID_LENGTH) == 0) { - apt_id_resource_parse(&header_field->value,'@',&channel_id->session_id,&channel_id->resource_name,pool); - apt_header_section_field_remove(&header->header_section,header_field); - return TRUE; - } - } - return FALSE; -} - -/** Generate MRCP channel-identifier */ -MRCP_DECLARE(apt_bool_t) mrcp_channel_id_generate(mrcp_channel_id *channel_id, apt_text_stream_t *stream) -{ - apt_str_t *str; - char *pos = stream->pos; - if(pos + MRCP_CHANNEL_ID_LENGTH + 2 + channel_id->session_id.length + 1 + - channel_id->resource_name.length >= stream->end) { - return FALSE; - } - memcpy(pos,MRCP_CHANNEL_ID,MRCP_CHANNEL_ID_LENGTH); - pos += MRCP_CHANNEL_ID_LENGTH; - *pos++ = ':'; - *pos++ = APT_TOKEN_SP; - - str = &channel_id->session_id; - memcpy(pos,str->buf,str->length); - pos += str->length; - *pos++ = '@'; - - str = &channel_id->resource_name; - memcpy(pos,str->buf,str->length); - pos += str->length; - - stream->pos = pos; - return apt_text_eol_insert(stream); -} diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c deleted file mode 100644 index ffc113e457..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_header_accessor.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_header_accessor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_header_accessor.h" - - -/** Parse header field value */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_parse(mrcp_header_accessor_t *accessor, apt_header_field_t *header_field, apr_pool_t *pool) -{ - apr_size_t id; - if(!accessor->vtable) { - return FALSE; - } - - id = apt_string_table_id_find(accessor->vtable->field_table,accessor->vtable->field_count,&header_field->name); - if(id >= accessor->vtable->field_count) { - return FALSE; - } - header_field->id = id; - - if(header_field->value.length) { - if(accessor->vtable->parse_field(accessor,header_field->id,&header_field->value,pool) == FALSE) { - return FALSE; - } - } - - return TRUE; -} - -/** Generate header field value */ -MRCP_DECLARE(apt_header_field_t*) mrcp_header_field_value_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_bool_t empty_value, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - const apt_str_t *name; - - if(!accessor->vtable) { - return NULL; - } - - header_field = apt_header_field_alloc(pool); - name = apt_string_table_str_get(accessor->vtable->field_table,accessor->vtable->field_count,id); - if(name) { - header_field->name = *name; - } - - if(empty_value == FALSE) { - if(accessor->vtable->generate_field(accessor,id,&header_field->value,pool) == FALSE) { - return NULL; - } - } - - return header_field; -} - -/** Duplicate header field value */ -MRCP_DECLARE(apt_bool_t) mrcp_header_field_value_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src_accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - if(!accessor->vtable) { - return FALSE; - } - - if(value->length) { - if(accessor->vtable->duplicate_field(accessor,src_accessor,id,value,pool) == FALSE) { - return FALSE; - } - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c deleted file mode 100644 index e12aac85b6..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_message.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_message.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_resource.h" -#include "apt_text_message.h" -#include "apt_log.h" - -/** Associate MRCP resource with message */ -static apt_bool_t mrcp_message_resource_set_by_id(mrcp_message_t *message, const mrcp_resource_t *resource) -{ - if(!resource) { - return FALSE; - } - message->resource = resource; - message->channel_id.resource_name = resource->name; - mrcp_message_header_data_alloc( - &message->header, - mrcp_generic_header_vtable_get(message->start_line.version), - resource->get_resource_header_vtable(message->start_line.version), - message->pool); - - /* associate method_name and method_id */ - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) { - const apt_str_t *name = apt_string_table_str_get( - resource->get_method_str_table(message->start_line.version), - resource->method_count, - message->start_line.method_id); - if(!name) { - return FALSE; - } - message->start_line.method_name = *name; - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - const apt_str_t *name = apt_string_table_str_get( - resource->get_event_str_table(message->start_line.version), - resource->event_count, - message->start_line.method_id); - if(!name) { - return FALSE; - } - message->start_line.method_name = *name; - } - - return TRUE; -} - -/** Associate MRCP resource specific data by resource name */ -MRCP_DECLARE(apt_bool_t) mrcp_message_resource_set(mrcp_message_t *message, const mrcp_resource_t *resource) -{ - if(!resource) { - return FALSE; - } - message->resource = resource; - mrcp_message_header_data_alloc( - &message->header, - mrcp_generic_header_vtable_get(message->start_line.version), - resource->get_resource_header_vtable(message->start_line.version), - message->pool); - - /* associate method_name and method_id */ - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_REQUEST) { - message->start_line.method_id = apt_string_table_id_find( - resource->get_method_str_table(message->start_line.version), - resource->method_count, - &message->start_line.method_name); - if(message->start_line.method_id >= resource->method_count) { - return FALSE; - } - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - message->start_line.method_id = apt_string_table_id_find( - resource->get_event_str_table(message->start_line.version), - resource->event_count, - &message->start_line.method_name); - if(message->start_line.method_id >= resource->event_count) { - return FALSE; - } - } - - return TRUE; -} - -/** Create an MRCP message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_message_create(apr_pool_t *pool) -{ - mrcp_message_t *message = apr_palloc(pool,sizeof(mrcp_message_t)); - mrcp_start_line_init(&message->start_line); - mrcp_channel_id_init(&message->channel_id); - mrcp_message_header_init(&message->header); - apt_string_reset(&message->body); - message->resource = NULL; - message->pool = pool; - return message; -} - -/** Create an MRCP request message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_request_create(const mrcp_resource_t *resource, mrcp_version_e version, mrcp_method_id method_id, apr_pool_t *pool) -{ - mrcp_message_t *request_message = mrcp_message_create(pool); - request_message->start_line.message_type = MRCP_MESSAGE_TYPE_REQUEST; - request_message->start_line.version = version; - request_message->start_line.method_id = method_id; - mrcp_message_resource_set_by_id(request_message,resource); - return request_message; -} - -/** Create an MRCP response message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_response_create(const mrcp_message_t *request_message, apr_pool_t *pool) -{ - mrcp_message_t *response_message = mrcp_message_create(pool); - response_message->start_line.message_type = MRCP_MESSAGE_TYPE_RESPONSE; - response_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - response_message->start_line.status_code = MRCP_STATUS_CODE_SUCCESS; - if(request_message) { - response_message->channel_id = request_message->channel_id; - response_message->start_line.request_id = request_message->start_line.request_id; - response_message->start_line.version = request_message->start_line.version; - response_message->start_line.method_id = request_message->start_line.method_id; - response_message->start_line.method_name = request_message->start_line.method_name; - mrcp_message_resource_set_by_id(response_message,request_message->resource); - } - return response_message; -} - -/** Create an MRCP event message */ -MRCP_DECLARE(mrcp_message_t*) mrcp_event_create(const mrcp_message_t *request_message, mrcp_method_id event_id, apr_pool_t *pool) -{ - mrcp_message_t *event_message = mrcp_message_create(pool); - event_message->start_line.message_type = MRCP_MESSAGE_TYPE_EVENT; - event_message->start_line.method_id = event_id; - if(request_message) { - event_message->channel_id = request_message->channel_id; - event_message->start_line.request_id = request_message->start_line.request_id; - event_message->start_line.version = request_message->start_line.version; - mrcp_message_resource_set_by_id(event_message,request_message->resource); - } - return event_message; -} - -/** Destroy MRCP message */ -MRCP_DECLARE(void) mrcp_message_destroy(mrcp_message_t *message) -{ - apt_string_reset(&message->body); - mrcp_message_header_destroy(&message->header); -} - -/** Validate MRCP message */ -MRCP_DECLARE(apt_bool_t) mrcp_message_validate(mrcp_message_t *message) -{ - if(message->body.length) { - /* content length must be specified */ - mrcp_generic_header_t *generic_header = mrcp_generic_header_prepare(message); - if(!generic_header) { - return FALSE; - } - if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_LENGTH) != TRUE || - !generic_header->content_length) { - generic_header->content_length = message->body.length; - mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_LENGTH); - } - } - - return TRUE; -} - -/** Add MRCP generic header field by specified property (numeric identifier) */ -MRCP_DECLARE(apt_bool_t) mrcp_generic_header_property_add(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = mrcp_header_field_value_generate( - &message->header.generic_header_accessor, - id, - FALSE, - message->pool); - if(!header_field) { - return FALSE; - } - header_field->id = id; - return apt_header_section_field_add(&message->header.header_section,header_field); -} - -/** Add only the name of MRCP generic header field specified by property (numeric identifier) */ -MRCP_DECLARE(apt_bool_t) mrcp_generic_header_name_property_add(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = mrcp_header_field_value_generate( - &message->header.generic_header_accessor, - id, - TRUE, - message->pool); - if(!header_field) { - return FALSE; - } - header_field->id = id; - return apt_header_section_field_add(&message->header.header_section,header_field); -} - -/** Add MRCP resource header field by specified property (numeric identifier) */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_header_property_add(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = mrcp_header_field_value_generate( - &message->header.resource_header_accessor, - id, - FALSE, - message->pool); - if(!header_field) { - return FALSE; - } - header_field->id = id + GENERIC_HEADER_COUNT; - return apt_header_section_field_add(&message->header.header_section,header_field); -} - -/** Add only the name of MRCP resource header field specified by property (numeric identifier) */ -MRCP_DECLARE(apt_bool_t) mrcp_resource_header_name_property_add(mrcp_message_t *message, apr_size_t id) -{ - apt_header_field_t *header_field = mrcp_header_field_value_generate( - &message->header.resource_header_accessor, - id, - TRUE, - message->pool); - if(!header_field) { - return FALSE; - } - header_field->id = id + GENERIC_HEADER_COUNT; - return apt_header_section_field_add(&message->header.header_section,header_field); -} - -/** Get the next MRCP header field */ -MRCP_DECLARE(apt_header_field_t*) mrcp_message_next_header_field_get(const mrcp_message_t *message, apt_header_field_t *header_field) -{ - const apt_header_section_t *header_section = &message->header.header_section; - if(header_field) { - apt_header_field_t *next = APR_RING_NEXT(header_field,link); - if(next == APR_RING_SENTINEL(&header_section->ring,apt_header_field_t,link)) { - return NULL; - } - return next; - } - - if(APR_RING_EMPTY(&header_section->ring,apt_header_field_t,link)) { - return NULL; - } - return APR_RING_FIRST(&header_section->ring); -} diff --git a/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c b/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c deleted file mode 100644 index be20150d1d..0000000000 --- a/libs/unimrcp/libs/mrcp/message/src/mrcp_start_line.c +++ /dev/null @@ -1,452 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_start_line.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include "mrcp_start_line.h" -#include "apt_string_table.h" -#include "apt_log.h" - -/** Protocol name used in version string */ -#define MRCP_NAME "MRCP" -#define MRCP_NAME_LENGTH (sizeof(MRCP_NAME)-1) - -/** Separators used in MRCP version string parse/generate */ -#define MRCP_NAME_VERSION_SEPARATOR '/' -#define MRCP_VERSION_MAJOR_MINOR_SEPARATOR '.' - -/** Max number of digits message length consists of */ -#define MAX_DIGIT_COUNT 6 - - -/** String table of MRCP request-states (mrcp_request_state_t) */ -static const apt_str_table_item_t mrcp_request_state_string_table[] = { - {{"COMPLETE", 8},0}, - {{"IN-PROGRESS",11},0}, - {{"PENDING", 7},0} -}; - - -/** Parse MRCP version */ -static mrcp_version_e mrcp_version_parse(const apt_str_t *field) -{ - mrcp_version_e version = MRCP_VERSION_UNKNOWN; - const char *pos; - if(field->length <= MRCP_NAME_LENGTH || strncasecmp(field->buf,MRCP_NAME,MRCP_NAME_LENGTH) != 0) { - /* unexpected protocol name */ - return version; - } - - pos = field->buf + MRCP_NAME_LENGTH; - if(*pos == MRCP_NAME_VERSION_SEPARATOR) { - pos++; - switch(*pos) { - case '1': version = MRCP_VERSION_1; break; - case '2': version = MRCP_VERSION_2; break; - default: ; - } - } - return version; -} - -/** Generate MRCP version */ -static apt_bool_t mrcp_version_generate(mrcp_version_e version, apt_text_stream_t *stream) -{ - if(stream->pos + MRCP_NAME_LENGTH + 1 >= stream->end) { - return FALSE; - } - memcpy(stream->pos,MRCP_NAME,MRCP_NAME_LENGTH); - stream->pos += MRCP_NAME_LENGTH; - *stream->pos++ = MRCP_NAME_VERSION_SEPARATOR; - - if(apt_text_size_value_insert(stream,version) == FALSE) { - return FALSE; - } - - if(stream->pos + 2 >= stream->end) { - return FALSE; - } - *stream->pos++ = MRCP_VERSION_MAJOR_MINOR_SEPARATOR; - *stream->pos++ = '0'; - return TRUE; -} - -/** Parse MRCP request-state used in MRCP response and event */ -static APR_INLINE mrcp_request_state_e mrcp_request_state_parse(const apt_str_t *request_state_str) -{ - return apt_string_table_id_find(mrcp_request_state_string_table,MRCP_REQUEST_STATE_COUNT,request_state_str); -} - -/** Generate MRCP request-state used in MRCP response and event */ -static apt_bool_t mrcp_request_state_generate(mrcp_request_state_e request_state, apt_text_stream_t *stream) -{ - const apt_str_t *name; - name = apt_string_table_str_get(mrcp_request_state_string_table,MRCP_REQUEST_STATE_COUNT,request_state); - if(request_state < MRCP_REQUEST_STATE_COUNT) { - memcpy(stream->pos,name->buf,name->length); - stream->pos += name->length; - } - return TRUE; -} - - -/** Parse MRCP status-code */ -static APR_INLINE mrcp_status_code_e mrcp_status_code_parse(const apt_str_t *field) -{ - return apt_size_value_parse(field); -} - -/** Generate MRCP status-code */ -static APR_INLINE size_t mrcp_status_code_generate(mrcp_status_code_e status_code, apt_text_stream_t *stream) -{ - return apt_text_size_value_insert(stream,status_code); -} - - -/** Parse MRCP request-line */ -static apt_bool_t mrcp_request_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - apt_str_t field; - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in request-line"); - return FALSE; - } - start_line->request_id = mrcp_request_id_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse mrcp-version in request-line"); - return FALSE; - } - - start_line->request_state = mrcp_request_state_parse(&field); - if(start_line->request_state == MRCP_REQUEST_STATE_UNKNOWN) { - /* request-line */ - start_line->message_type = MRCP_MESSAGE_TYPE_REQUEST; - } - else { - /* event line */ - start_line->message_type = MRCP_MESSAGE_TYPE_EVENT; - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse mrcp-version in request-line"); - return FALSE; - } - } - - start_line->version = mrcp_version_parse(&field); - if(start_line->version == MRCP_VERSION_UNKNOWN) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown mrcp-version"); - return FALSE; - } - return TRUE; -} - -/** Generate MRCP request-line */ -static apt_bool_t mrcp_request_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - memcpy(stream->pos,start_line->method_name.buf,start_line->method_name.length); - stream->pos += start_line->method_name.length; - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_id_generate(start_line->request_id,stream); - *stream->pos++ = APT_TOKEN_SP; - - if(start_line->message_type == MRCP_MESSAGE_TYPE_REQUEST) { - if(start_line->status_code != MRCP_STATUS_CODE_UNKNOWN) { - mrcp_status_code_generate(start_line->status_code,stream); - *stream->pos++ = APT_TOKEN_SP; - } - } - else if(start_line->message_type == MRCP_MESSAGE_TYPE_EVENT) { - mrcp_request_state_generate(start_line->request_state,stream); - *stream->pos++ = APT_TOKEN_SP; - } - - mrcp_version_generate(start_line->version,stream); - return TRUE; -} - -/** Parse MRCP response-line */ -static apt_bool_t mrcp_response_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - apt_str_t field; - start_line->length = 0; - if(start_line->version == MRCP_VERSION_2) { - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse message-length in response-line"); - return FALSE; - } - start_line->length = apt_size_value_parse(&field); - } - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in response-line"); - return FALSE; - } - start_line->request_id = mrcp_request_id_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in response-line"); - return FALSE; - } - start_line->status_code = mrcp_status_code_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-state in response-line"); - return FALSE; - } - start_line->request_state = mrcp_request_state_parse(&field); - return TRUE; -} - -/** Generate MRCP response-line */ -static apt_bool_t mrcp_response_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - mrcp_version_generate(start_line->version,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_id_generate(start_line->request_id,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_status_code_generate(start_line->status_code,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_state_generate(start_line->request_state,stream); - return TRUE; -} - -/** Parse MRCP v2 start-line */ -static apt_bool_t mrcp_v2_start_line_parse(mrcp_start_line_t *start_line, apt_text_stream_t *stream, apr_pool_t *pool) -{ - apt_str_t field; - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse message-length in v2 start-line"); - return FALSE; - } - start_line->length = apt_size_value_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in v2 start-line"); - return FALSE; - } - start_line->request_id = mrcp_request_id_parse(&field); - if(start_line->request_id == 0 && *field.buf != '0') { - /* parsing MRCP v2 request or event */ - start_line->message_type = MRCP_MESSAGE_TYPE_REQUEST; - apt_string_copy(&start_line->method_name,&field,pool); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-id in v2 start-line"); - return FALSE; - } - start_line->request_id = mrcp_request_id_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == TRUE) { - /* parsing MRCP v2 event */ - start_line->request_state = mrcp_request_state_parse(&field); - start_line->message_type = MRCP_MESSAGE_TYPE_EVENT; - } - } - else { - /* parsing MRCP v2 response */ - start_line->message_type = MRCP_MESSAGE_TYPE_RESPONSE; - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in v2 start-line"); - return FALSE; - } - start_line->status_code = mrcp_status_code_parse(&field); - - if(apt_text_field_read(stream,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse request-state in v2 start-line"); - return FALSE; - } - start_line->request_state = mrcp_request_state_parse(&field); - } - - return TRUE; -} - -/** Generate MRCP v2 start-line */ -static apt_bool_t mrcp_v2_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *stream) -{ - char *pos = stream->pos; - mrcp_version_generate(start_line->version,stream); - *stream->pos++ = APT_TOKEN_SP; - - start_line->length = stream->pos - pos; /* length is temporary used to store offset */ - /* reserving MAX_DIGIT_COUNT space for start_line->length */ - memset(stream->pos,APT_TOKEN_SP,MAX_DIGIT_COUNT+1); - stream->pos += MAX_DIGIT_COUNT+1; - - if(start_line->message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - mrcp_request_id_generate(start_line->request_id,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_status_code_generate(start_line->status_code,stream); - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_state_generate(start_line->request_state,stream); - } - else { - memcpy(stream->pos,start_line->method_name.buf,start_line->method_name.length); - stream->pos += start_line->method_name.length; - *stream->pos++ = APT_TOKEN_SP; - - mrcp_request_id_generate(start_line->request_id,stream); - if(start_line->message_type == MRCP_MESSAGE_TYPE_EVENT) { - *stream->pos++ = APT_TOKEN_SP; - mrcp_request_state_generate(start_line->request_state,stream); - } - } - return TRUE; -} - -/** Initialize MRCP start-line */ -MRCP_DECLARE(void) mrcp_start_line_init(mrcp_start_line_t *start_line) -{ - start_line->message_type = MRCP_MESSAGE_TYPE_UNKNOWN; - start_line->version = MRCP_VERSION_UNKNOWN; - start_line->length = 0; - start_line->request_id = 0; - apt_string_reset(&start_line->method_name); - start_line->status_code = MRCP_STATUS_CODE_UNKNOWN; - start_line->request_state = MRCP_REQUEST_STATE_UNKNOWN; -} - -/** Parse MRCP start-line */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_parse(mrcp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool) -{ - apt_text_stream_t line; - apt_str_t field; - apt_bool_t status = TRUE; - - start_line->message_type = MRCP_MESSAGE_TYPE_UNKNOWN; - apt_text_stream_init(&line,str->buf,str->length); - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot read the first field in start-line"); - return FALSE; - } - - if(field.buf == strstr(field.buf,MRCP_NAME)) { - start_line->version = mrcp_version_parse(&field); - - if(start_line->version == MRCP_VERSION_1) { - /* parsing MRCP v1 response */ - start_line->message_type = MRCP_MESSAGE_TYPE_RESPONSE; - status = mrcp_response_line_parse(start_line,&line); - } - else if(start_line->version == MRCP_VERSION_2) { - /* parsing MRCP v2 start-line (request/response/event) */ - status = mrcp_v2_start_line_parse(start_line,&line,pool); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCP version"); - return FALSE; - } - } - else { - /* parsing MRCP v1 request or event */ - apt_string_copy(&start_line->method_name,&field,pool); - status = mrcp_request_line_parse(start_line,&line); - } - return status; -} - -/** Generate MRCP start-line */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_generate(mrcp_start_line_t *start_line, apt_text_stream_t *text_stream) -{ - apt_bool_t status = FALSE; - if(start_line->version == MRCP_VERSION_1) { - switch(start_line->message_type) { - case MRCP_MESSAGE_TYPE_REQUEST: - status = mrcp_request_line_generate(start_line,text_stream); - break; - case MRCP_MESSAGE_TYPE_RESPONSE: - status = mrcp_response_line_generate(start_line,text_stream); - break; - case MRCP_MESSAGE_TYPE_EVENT: - status = mrcp_request_line_generate(start_line,text_stream); - break; - default: - break; - } - } - else if(start_line->version == MRCP_VERSION_2) { - status = mrcp_v2_start_line_generate(start_line,text_stream); - } - - if(status == FALSE) { - return FALSE; - } - - return apt_text_eol_insert(text_stream); -} - -/** Finalize MRCP start-line generation */ -MRCP_DECLARE(apt_bool_t) mrcp_start_line_finalize(mrcp_start_line_t *start_line, apr_size_t content_length, apt_text_stream_t *text_stream) -{ - apr_size_t length = text_stream->pos - text_stream->text.buf + content_length; - if(start_line->version == MRCP_VERSION_2) { - /* message-length includes the number of bytes that specify the message-length in the header */ - /* too comlex to generate!!! see the discussion */ - /* http://www1.ietf.org/mail-archive/web/speechsc/current/msg01734.html */ - apt_str_t field; - field.buf = text_stream->text.buf + start_line->length; /* length is temporary used to store offset */ - length -= MAX_DIGIT_COUNT; - if(apt_var_length_value_generate(&length,MAX_DIGIT_COUNT,&field) == FALSE) { - return FALSE; - } - field.buf[field.length] = APT_TOKEN_SP; - start_line->length += field.length; - - field.length = MAX_DIGIT_COUNT - field.length; - if(field.length) { - memmove(text_stream->text.buf+field.length,text_stream->text.buf,start_line->length); - text_stream->text.buf += field.length; - text_stream->text.length -= field.length; - } - } - - start_line->length = length; - return TRUE; -} - -/** Parse MRCP request-id */ -MRCP_DECLARE(mrcp_request_id) mrcp_request_id_parse(const apt_str_t *field) -{ - if(field->buf) { -#ifdef TOO_LONG_MRCP_REQUEST_ID - return apr_atoi64(field->buf); -#else - return atol(field->buf); -#endif - } - return 0; -} - -/** Generate MRCP request-id */ -MRCP_DECLARE(apt_bool_t) mrcp_request_id_generate(mrcp_request_id request_id, apt_text_stream_t *stream) -{ - int length = apr_snprintf(stream->pos, stream->end - stream->pos, "%"MRCP_REQUEST_ID_FMT, request_id); - if(length <= 0) { - return FALSE; - } - stream->pos += length; - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters deleted file mode 100644 index 119921b34b..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.2010.vcxproj.filters +++ /dev/null @@ -1,133 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {19ad4bde-c4f4-4937-9073-ca2780341d76} - - - {8ec996ac-8a0a-4bf0-9b3c-535616585109} - h;hpp;hxx;hm;inl;inc;xsd - - - {5ba77874-7c17-4748-b5ba-b07b7f0a2169} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {f30fd049-a10d-4aea-b4bb-3eb674690fdd} - - - {7e71717b-6f22-4c59-ba50-7b5a15516b2f} - h;hpp;hxx;hm;inl;inc;xsd - - - {c66dbb84-ce9d-4408-b54d-4d0ec51069fb} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {f20cfd62-4bb9-42de-bf1c-d578c8cd1a18} - - - {039a4834-7ddb-40e7-9177-55d11ef1e733} - h;hpp;hxx;hm;inl;inc;xsd - - - {dc087d31-8ecf-473c-baa1-f3091e16014d} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - message\include - - - message\include - - - message\include - - - message\include - - - control\include - - - control\include - - - control\include - - - control\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - - - message\src - - - message\src - - - message\src - - - message\src - - - control\src - - - control\src - - - control\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj deleted file mode 100644 index d2420fde7c..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.2017.vcxproj +++ /dev/null @@ -1,163 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcp - {1C320193-46A6-4B34-9C56-8AB584FC1B56} - mrcp - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - %(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - %(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - %(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - %(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcproj b/libs/unimrcp/libs/mrcp/mrcp.vcproj deleted file mode 100644 index dc421663c7..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.vcproj +++ /dev/null @@ -1,433 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcxproj b/libs/unimrcp/libs/mrcp/mrcp.vcxproj deleted file mode 100644 index b2e453c4e8..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.vcxproj +++ /dev/null @@ -1,157 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {1C320193-46A6-4B34-9C56-8AB584FC1B56} - mrcp - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - %(AdditionalIncludeDirectories) - - - - - %(AdditionalIncludeDirectories) - - - - - X64 - - - %(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - %(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters b/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters deleted file mode 100644 index 300f13fdf6..0000000000 --- a/libs/unimrcp/libs/mrcp/mrcp.vcxproj.filters +++ /dev/null @@ -1,151 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {235b9544-2004-49c6-96de-a5830544296e} - - - {64717899-118b-46de-8646-d7312b19ce00} - h;hpp;hxx;hm;inl;inc;xsd - - - {1b656d42-e8f0-4126-85da-9bb8a470cfaa} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {39545f85-6811-4878-af3f-26d813012ea3} - - - {e165b2a9-81db-4030-9e72-7189ee45182b} - h;hpp;hxx;hm;inl;inc;xsd - - - {a4e3b1a7-762d-4fcf-83e8-f52675aab2ff} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {35e8458d-fc25-4066-b4be-ab452a6da8a9} - - - {8bbdedd2-2c1e-4474-8dbb-fcecf1f9a869} - h;hpp;hxx;hm;inl;inc;xsd - - - {1d167695-a5d2-4f87-8bd3-ea21cea5a368} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - message\include - - - message\include - - - message\include - - - message\include - - - message\include - - - control\include - - - control\include - - - control\include - - - control\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - resources\include - - - - - message\src - - - message\src - - - message\src - - - message\src - - - message\src - - - control\src - - - control\src - - - control\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - resources\src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h deleted file mode 100644 index a9f71c5a7e..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_header.h +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recog_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECOG_HEADER_H -#define MRCP_RECOG_HEADER_H - -/** - * @file mrcp_recog_header.h - * @brief MRCP Recognizer Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** MRCP recognizer header fields */ -typedef enum { - RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD, - RECOGNIZER_HEADER_SENSITIVITY_LEVEL, - RECOGNIZER_HEADER_SPEED_VS_ACCURACY, - RECOGNIZER_HEADER_N_BEST_LIST_LENGTH, - RECOGNIZER_HEADER_NO_INPUT_TIMEOUT, - RECOGNIZER_HEADER_RECOGNITION_TIMEOUT, - RECOGNIZER_HEADER_WAVEFORM_URI, - RECOGNIZER_HEADER_COMPLETION_CAUSE, - RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK, - RECOGNIZER_HEADER_START_INPUT_TIMERS, - RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT, - RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT, - RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT, - RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT, - RECOGNIZER_HEADER_DTMF_TERM_CHAR, - RECOGNIZER_HEADER_FAILED_URI, - RECOGNIZER_HEADER_FAILED_URI_CAUSE, - RECOGNIZER_HEADER_SAVE_WAVEFORM, - RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL, - RECOGNIZER_HEADER_SPEECH_LANGUAGE, - - /** Additional header fields for MRCP v2 */ - RECOGNIZER_HEADER_INPUT_TYPE, - RECOGNIZER_HEADER_INPUT_WAVEFORM_URI, - RECOGNIZER_HEADER_COMPLETION_REASON, - RECOGNIZER_HEADER_MEDIA_TYPE, - RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE, - RECOGNIZER_HEADER_RECOGNITION_MODE, - RECOGNIZER_HEADER_CANCEL_IF_QUEUE, - RECOGNIZER_HEADER_HOTWORD_MAX_DURATION, - RECOGNIZER_HEADER_HOTWORD_MIN_DURATION, - RECOGNIZER_HEADER_INTERPRET_TEXT, - RECOGNIZER_HEADER_DTMF_BUFFER_TIME, - RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER, - RECOGNIZER_HEADER_EARLY_NO_MATCH, - RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS, - RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD, - RECOGNIZER_HEADER_CLASH_THRESHOLD, - RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI, - RECOGNIZER_HEADER_ENROLL_UTTERANCE, - RECOGNIZER_HEADER_PHRASE_ID, - RECOGNIZER_HEADER_PHRASE_NL, - RECOGNIZER_HEADER_WEIGHT, - RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM, - RECOGNIZER_HEADER_NEW_PHRASE_ID, - RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI, - RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT, - - RECOGNIZER_HEADER_COUNT -} mrcp_recognizer_header_id; - - -/** MRCP recognizer completion-cause */ -typedef enum { - RECOGNIZER_COMPLETION_CAUSE_SUCCESS = 0, - RECOGNIZER_COMPLETION_CAUSE_NO_MATCH = 1, - RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2, - RECOGNIZER_COMPLETION_CAUSE_RECOGNITION_TIMEOUT = 3, - RECOGNIZER_COMPLETION_CAUSE_GRAM_LOAD_FAILURE = 4, - RECOGNIZER_COMPLETION_CAUSE_GRAM_COMP_FAILURE = 5, - RECOGNIZER_COMPLETION_CAUSE_ERROR = 6, - RECOGNIZER_COMPLETION_CAUSE_SPEECH_TOO_EARLY = 7, - RECOGNIZER_COMPLETION_CAUSE_TOO_MUCH_SPEECH_TIMEOUT = 8, - RECOGNIZER_COMPLETION_CAUSE_URI_FAILURE = 9, - RECOGNIZER_COMPLETION_CAUSE_LANGUAGE_UNSUPPORTED = 10, - - /** Additional completion-cause for MRCP v2 */ - RECOGNIZER_COMPLETION_CAUSE_CANCELLED = 11, - RECOGNIZER_COMPLETION_CAUSE_SEMANTICS_FAILURE = 12, - RECOGNIZER_COMPLETION_CAUSE_PARTIAL_MATCH = 13, - RECOGNIZER_COMPLETION_CAUSE_PARTIAL_MATCH_MAXTIME = 14, - RECOGNIZER_COMPLETION_CAUSE_NO_MATCH_MAXTIME = 15, - RECOGNIZER_COMPLETION_CAUSE_GRAM_DEFINITION_FAILURE = 16, - - RECOGNIZER_COMPLETION_CAUSE_COUNT = 17, - RECOGNIZER_COMPLETION_CAUSE_UNKNOWN = RECOGNIZER_COMPLETION_CAUSE_COUNT -} mrcp_recog_completion_cause_e; - - - -/** MRCP recognizer-header declaration */ -typedef struct mrcp_recog_header_t mrcp_recog_header_t; - -/** MRCP recognizer-header */ -struct mrcp_recog_header_t { - /** Tells the recognizer resource what confidence level the client considers a - successful match */ - float confidence_threshold; - /** To filter out background noise and not mistake it for speech */ - float sensitivity_level; - /** Tunable towards Performance or Accuracy */ - float speed_vs_accuracy; - /** The client, by setting this header, can ask the recognition resource - to send it more than 1 alternative */ - apr_size_t n_best_list_length; - /** The client can use the no-input-timeout header to set this timeout */ - apr_size_t no_input_timeout; - /** The client can use the recognition-timeout header to set this timeout */ - apr_size_t recognition_timeout; - /** MUST be present in the RECOGNITION-COMPLETE event if the Save-Waveform - header was set to true */ - apt_str_t waveform_uri; - /** MUST be part of a RECOGNITION-COMPLETE, event coming from - the recognizer resource to the client */ - mrcp_recog_completion_cause_e completion_cause; - /** MAY be sent as part of the SET-PARAMS or GET-PARAMS request */ - apt_str_t recognizer_context_block; - /** MAY be sent as part of the RECOGNIZE request. A value of false tells - the recognizer to start recognition, but not to start the no-input timer yet */ - apt_bool_t start_input_timers; - /** Specifies the length of silence required following user - speech before the speech recognizer finalizes a result */ - apr_size_t speech_complete_timeout; - /** Specifies the required length of silence following user - speech after which a recognizer finalizes a result */ - apr_size_t speech_incomplete_timeout; - /** Specifies the inter-digit timeout value to use when - recognizing DTMF input */ - apr_size_t dtmf_interdigit_timeout; - /** Specifies the terminating timeout to use when - recognizing DTMF input*/ - apr_size_t dtmf_term_timeout; - /** Specifies the terminating DTMF character for DTMF input - recognition */ - char dtmf_term_char; - /** When a recognizer needs to fetch or access a URI and the access fails - the server SHOULD provide the failed URI in this header in the method response*/ - apt_str_t failed_uri; - /** When a recognizer method needs a recognizer to fetch or access a URI - and the access fails the server MUST provide the URI specific or - protocol specific response code for the URI in the Failed-URI header */ - apt_str_t failed_uri_cause; - /** Allows the client to request the recognizer resource to - save the audio input to the recognizer */ - apt_bool_t save_waveform; - /** MAY be specified in a RECOGNIZE request and allows the - client to tell the server that, from this point on, further input - audio comes from a different audio source */ - apt_bool_t new_audio_channel; - /** Specifies the language of recognition grammar data within - a session or request, if it is not specified within the data */ - apt_str_t speech_language; - - /** Additional header fields for MRCP v2 */ - /** Specifies if the input that caused a barge-in was DTMF or speech */ - apt_str_t input_type; - /** Optional header specifies a URI pointing to audio content to be - processed by the RECOGNIZE operation */ - apt_str_t input_waveform_uri; - /** MAY be specified in a RECOGNITION-COMPLETE event coming from - the recognizer resource to the client */ - apt_str_t completion_reason; - /** Tells the server resource the Media Type in which to store captured - audio such as the one captured and returned by the Waveform-URI header */ - apt_str_t media_type; - /** Lets the client request the server to buffer the - utterance associated with this recognition request into a buffer - available to a co-resident verification resource */ - apt_bool_t ver_buffer_utterance; - /** Specifies what mode the RECOGNIZE method will operate in */ - apt_str_t recognition_mode; - /** Specifies what will happen if the client attempts to - invoke another RECOGNIZE method when this RECOGNIZE request is - already in progress for the resource*/ - apt_bool_t cancel_if_queue; - /** Specifies the maximum length of an utterance (in seconds) that will - be considered for Hotword recognition */ - apr_size_t hotword_max_duration; - /** Specifies the minimum length of an utterance (in seconds) that will - be considered for Hotword recognition */ - apr_size_t hotword_min_duration; - /** Provides a pointer to the text for which a natural language interpretation is desired */ - apt_str_t interpret_text; - /** MAY be specified in a GET-PARAMS or SET-PARAMS method and - is used to specify the size in time, in milliseconds, of the - typeahead buffer for the recognizer */ - apr_size_t dtmf_buffer_time; - /** MAY be specified in a RECOGNIZE method and is used to - tell the recognizer to clear the DTMF type-ahead buffer before - starting the recognize */ - apt_bool_t clear_dtmf_buffer; - /** MAY be specified in a RECOGNIZE method and is used to - tell the recognizer that it MUST not wait for the end of speech - before processing the collected speech to match active grammars */ - apt_bool_t early_no_match; - /** MAY be specified in a START-PHRASE-ENROLLMENT, "SET-PARAMS", or - "GET-PARAMS" method and is used to specify the minimum number of - consistent pronunciations that must be obtained to voice enroll a new phrase */ - apr_size_t num_min_consistent_pronunciations; - /** MAY be sent as part of the START-PHRASE-ENROLLMENT,"SET-PARAMS", or - "GET-PARAMS" method and is used during voice-enrollment to specify how similar - to a previously enrolled pronunciation of the same phrase an utterance needs - to be in order to be considered "consistent" */ - float consistency_threshold; - /** MAY be sent as part of the START-PHRASE-ENROLLMENT, SET-PARAMS, or - "GET-PARAMS" method and is used during voice-enrollment to specify - how similar the pronunciations of two different phrases can be - before they are considered to be clashing */ - float clash_threshold; - /** Specifies the speaker-trained grammar to be used or - referenced during enrollment operations */ - apt_str_t personal_grammar_uri; - /** MAY be specified in the RECOGNIZE method. If this header - is set to "true" and an Enrollment is active, the RECOGNIZE command - MUST add the collected utterance to the personal grammar that is - being enrolled */ - apt_bool_t enroll_utterance; - /** Identifies a phrase in an existing personal grammar for which - enrollment is desired. It is also returned to the client in the - RECOGNIZE complete event */ - apt_str_t phrase_id; - /** Specifies the interpreted text to be returned when the - phrase is recognized */ - apt_str_t phrase_nl; - /** Represents the occurrence likelihood of a phrase in an enrolled grammar */ - float weight; - /** Allows the client to request the recognizer resource to - save the audio stream for the best repetition of the phrase that was - used during the enrollment session */ - apt_bool_t save_best_waveform; - /** Replaces the id used to identify the phrase in a personal grammar */ - apt_str_t new_phrase_id; - /** Specifies a grammar that defines invalid phrases for enrollment */ - apt_str_t confusable_phrases_uri; - /** Can optionally be specified in the END-PHRASE-ENROLLMENT - method to abort the phrase enrollment, rather than committing the - phrase to the personal grammar */ - apt_bool_t abort_phrase_enrollment; -}; - - -/** Get recognizer header vtable */ -const mrcp_header_vtable_t* mrcp_recog_header_vtable_get(mrcp_version_e version); - -/** Get recognizer completion cause string */ -MRCP_DECLARE(const apt_str_t*) mrcp_recog_completion_cause_get(mrcp_recog_completion_cause_e completion_cause, mrcp_version_e version); - -APT_END_EXTERN_C - -#endif /* MRCP_RECOG_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h deleted file mode 100644 index 93e2f1ba9e..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recog_resource.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recog_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECOG_RESOURCE_H -#define MRCP_RECOG_RESOURCE_H - -/** - * @file mrcp_recog_resource.h - * @brief MRCP Recognizer Resource - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP recognizer methods */ -typedef enum { - RECOGNIZER_SET_PARAMS, - RECOGNIZER_GET_PARAMS, - RECOGNIZER_DEFINE_GRAMMAR, - RECOGNIZER_RECOGNIZE, - RECOGNIZER_INTERPRET, - RECOGNIZER_GET_RESULT, - RECOGNIZER_START_INPUT_TIMERS, - RECOGNIZER_STOP, - RECOGNIZER_START_PHRASE_ENROLLMENT, - RECOGNIZER_ENROLLMENT_ROLLBACK, - RECOGNIZER_END_PHRASE_ENROLLMENT, - RECOGNIZER_MODIFY_PHRASE, - RECOGNIZER_DELETE_PHRASE, - - RECOGNIZER_METHOD_COUNT -} mrcp_recognizer_method_id; - -/** MRCP recognizer events */ -typedef enum { - RECOGNIZER_START_OF_INPUT, - RECOGNIZER_RECOGNITION_COMPLETE, - RECOGNIZER_INTERPRETATION_COMPLETE, - - RECOGNIZER_EVENT_COUNT -} mrcp_recognizer_event_id; - -/** Create MRCP recognizer resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_recog_resource_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_RECOG_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h deleted file mode 100644 index 77569a00b0..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_header.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recorder_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECORDER_HEADER_H -#define MRCP_RECORDER_HEADER_H - -/** - * @file mrcp_recorder_header.h - * @brief MRCP Recorder Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** MRCP recorder header fields */ -typedef enum { - RECORDER_HEADER_SENSITIVITY_LEVEL, - RECORDER_HEADER_NO_INPUT_TIMEOUT, - RECORDER_HEADER_COMPLETION_CAUSE, - RECORDER_HEADER_COMPLETION_REASON, - RECORDER_HEADER_FAILED_URI, - RECORDER_HEADER_FAILED_URI_CAUSE, - RECORDER_HEADER_RECORD_URI, - RECORDER_HEADER_MEDIA_TYPE, - RECORDER_HEADER_MAX_TIME, - RECORDER_HEADER_TRIM_LENGTH, - RECORDER_HEADER_FINAL_SILENCE, - RECORDER_HEADER_CAPTURE_ON_SPEECH, - RECORDER_HEADER_VER_BUFFER_UTTERANCE, - RECORDER_HEADER_START_INPUT_TIMERS, - RECORDER_HEADER_NEW_AUDIO_CHANNEL, - - RECORDER_HEADER_COUNT -} mrcp_recorder_header_id; - - -/** MRCP recorder completion-cause */ -typedef enum { - RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE = 0, - RECORDER_COMPLETION_CAUSE_SUCCESS_MAXTIME = 1, - RECORDER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2, - RECORDER_COMPLETION_CAUSE_URI_FAILURE = 3, - RECORDER_COMPLETION_CAUSE_ERROR = 4, - - RECORDER_COMPLETION_CAUSE_COUNT = 5, - RECORDER_COMPLETION_CAUSE_UNKNOWN = RECORDER_COMPLETION_CAUSE_COUNT -} mrcp_recorder_completion_cause_e; - - - -/** MRCP recorder-header declaration */ -typedef struct mrcp_recorder_header_t mrcp_recorder_header_t; - -/** MRCP recorder-header */ -struct mrcp_recorder_header_t { - /** To filter out background noise and not mistake it for speech */ - float sensitivity_level; - /** When recording is started and there is no speech detected for a - certain period of time, the recorder can send a RECORD-COMPLETE event */ - apr_size_t no_input_timeout; - /** MUST be part of a RECORD-COMPLETE event coming from the - recorder resource to the client */ - mrcp_recorder_completion_cause_e completion_cause; - /** MAY be specified in a RECORD-COMPLETE event coming from - the recorder resource to the client */ - apt_str_t completion_reason; - /** When a recorder method needs to post the audio to a URI and access to - the URI fails, the server MUST provide the failed URI in this header - in the method response */ - apt_str_t failed_uri; - /** When a recorder method needs to post the audio to a URI and access to - the URI fails, the server MUST provide the URI specific or protocol - specific response code through this header in the method response */ - apt_str_t failed_uri_cause; - /** When a recorder method contains this header the server must capture - the audio and store it */ - apt_str_t record_uri; - /** A RECORD method MUST contain this header, which specifies to the - server the Media Type of the captured audio or video */ - apt_str_t media_type; - /** When recording is started this specifies the maximum length of the - recording in milliseconds, calculated from the time the actual - capture and store begins and is not necessarily the time the RECORD - method is received */ - apr_size_t max_time; - /** This header MAY be sent on a STOP method and specifies the length of - audio to be trimmed from the end of the recording after the stop */ - apr_size_t trim_length; - /** When recorder is started and the actual capture begins, this header - specifies the length of silence in the audio that is to be - interpreted as the end of the recording*/ - apr_size_t final_silence; - /** f false, the recorder MUST start capturing immediately when started. - If true, the recorder MUST wait for the endpointing functionality to - detect speech before it starts capturing */ - apt_bool_t capture_on_speech; - /** Tells the server to buffer the utterance associated with this - recording request into the verification buffer */ - apt_bool_t ver_buffer_utterance; - /** MAY be sent as part of the RECORD request. A value of false tells the - recorder resource to start the operation, but not to start the no-input - timer until the client sends a START-INPUT-TIMERS */ - apt_bool_t start_input_timers; - /** MAY be specified in a RECORD request and allows the - client to tell the server that, from this point on, further input - audio comes from a different audio source */ - apt_bool_t new_audio_channel; -}; - - -/** Get recorder header vtable */ -const mrcp_header_vtable_t* mrcp_recorder_header_vtable_get(mrcp_version_e version); - -/** Get recorder completion cause string */ -MRCP_DECLARE(const apt_str_t*) mrcp_recorder_completion_cause_get( - mrcp_recorder_completion_cause_e completion_cause, - mrcp_version_e version); - -APT_END_EXTERN_C - -#endif /* MRCP_RECORDER_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h deleted file mode 100644 index 86100030a1..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_recorder_resource.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recorder_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_RECORDER_RESOURCE_H -#define MRCP_RECORDER_RESOURCE_H - -/** - * @file mrcp_recorder_resource.h - * @brief MRCP Recorder Resource - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP recorder methods */ -typedef enum { - RECORDER_SET_PARAMS, - RECORDER_GET_PARAMS, - RECORDER_RECORD, - RECORDER_STOP, - RECORDER_START_INPUT_TIMERS, - - RECORDER_METHOD_COUNT -} mrcp_recorder_method_id; - -/** MRCP recorder events */ -typedef enum { - RECORDER_START_OF_INPUT, - RECORDER_RECORD_COMPLETE, - - RECORDER_EVENT_COUNT -} mrcp_recorder_event_id; - -/** Create MRCP recorder resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_recorder_resource_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_RECORDER_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h deleted file mode 100644 index 9a9fc6eb6b..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_header.h +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_synth_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SYNTH_HEADER_H -#define MRCP_SYNTH_HEADER_H - -/** - * @file mrcp_synth_header.h - * @brief MRCP Synthesizer Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** MRCP synthesizer header fields */ -typedef enum { - SYNTHESIZER_HEADER_JUMP_SIZE, - SYNTHESIZER_HEADER_KILL_ON_BARGE_IN, - SYNTHESIZER_HEADER_SPEAKER_PROFILE, - SYNTHESIZER_HEADER_COMPLETION_CAUSE, - SYNTHESIZER_HEADER_COMPLETION_REASON, - SYNTHESIZER_HEADER_VOICE_GENDER, - SYNTHESIZER_HEADER_VOICE_AGE, - SYNTHESIZER_HEADER_VOICE_VARIANT, - SYNTHESIZER_HEADER_VOICE_NAME, - SYNTHESIZER_HEADER_PROSODY_VOLUME, - SYNTHESIZER_HEADER_PROSODY_RATE, - SYNTHESIZER_HEADER_SPEECH_MARKER, - SYNTHESIZER_HEADER_SPEECH_LANGUAGE, - SYNTHESIZER_HEADER_FETCH_HINT, - SYNTHESIZER_HEADER_AUDIO_FETCH_HINT, - SYNTHESIZER_HEADER_FAILED_URI, - SYNTHESIZER_HEADER_FAILED_URI_CAUSE, - SYNTHESIZER_HEADER_SPEAK_RESTART, - SYNTHESIZER_HEADER_SPEAK_LENGTH, - SYNTHESIZER_HEADER_LOAD_LEXICON, - SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER, - - SYNTHESIZER_HEADER_COUNT -} mrcp_synthesizer_header_id; - - -/** Speech-units */ -typedef enum { - SPEECH_UNIT_SECOND, - SPEECH_UNIT_WORD, - SPEECH_UNIT_SENTENCE, - SPEECH_UNIT_PARAGRAPH, - - SPEECH_UNIT_COUNT -} mrcp_speech_unit_e; - -/** Speech-length types */ -typedef enum { - SPEECH_LENGTH_TYPE_TEXT, - SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE, - SPEECH_LENGTH_TYPE_NUMERIC_NEGATIVE, - - SPEECH_LENGTH_TYPE_UNKNOWN -} mrcp_speech_length_type_e; - -/** MRCP voice-gender */ -typedef enum { - VOICE_GENDER_MALE, - VOICE_GENDER_FEMALE, - VOICE_GENDER_NEUTRAL, - - VOICE_GENDER_COUNT, - VOICE_GENDER_UNKNOWN = VOICE_GENDER_COUNT -} mrcp_voice_gender_e; - -/** Prosody-volume type */ -typedef enum { - PROSODY_VOLUME_TYPE_LABEL, - PROSODY_VOLUME_TYPE_NUMERIC, - PROSODY_VOLUME_TYPE_RELATIVE_CHANGE, - - PROSODY_VOLUME_TYPE_UNKNOWN -} mrcp_prosody_volume_type_e; - -/** Prosody-rate type */ -typedef enum { - PROSODY_RATE_TYPE_LABEL, - PROSODY_RATE_TYPE_RELATIVE_CHANGE, - - PROSODY_RATE_TYPE_UNKNOWN -} mrcp_prosody_rate_type_e; - -/** Prosody-volume */ -typedef enum { - PROSODY_VOLUME_SILENT, - PROSODY_VOLUME_XSOFT, - PROSODY_VOLUME_SOFT, - PROSODY_VOLUME_MEDIUM, - PROSODY_VOLUME_LOUD, - PROSODY_VOLUME_XLOUD, - PROSODY_VOLUME_DEFAULT, - - PROSODY_VOLUME_COUNT, - PROSODY_VOLUME_UNKNOWN = PROSODY_VOLUME_COUNT -} mrcp_prosody_volume_label_e; - -/** Prosody-rate */ -typedef enum { - PROSODY_RATE_XSLOW, - PROSODY_RATE_SLOW, - PROSODY_RATE_MEDIUM, - PROSODY_RATE_FAST, - PROSODY_RATE_XFAST, - PROSODY_RATE_DEFAULT, - - PROSODY_RATE_COUNT, - PROSODY_RATE_UNKNOWN = PROSODY_RATE_COUNT -} mrcp_prosody_rate_label_e; - -/** Synthesizer completion-cause specified in SPEAK-COMPLETE event */ -typedef enum { - SYNTHESIZER_COMPLETION_CAUSE_NORMAL = 0, - SYNTHESIZER_COMPLETION_CAUSE_BARGE_IN = 1, - SYNTHESIZER_COMPLETION_CAUSE_PARSE_FAILURE = 2, - SYNTHESIZER_COMPLETION_CAUSE_URI_FAILURE = 3, - SYNTHESIZER_COMPLETION_CAUSE_ERROR = 4, - SYNTHESIZER_COMPLETION_CAUSE_LANGUAGE_UNSUPPORTED = 5, - SYNTHESIZER_COMPLETION_CAUSE_LEXICON_LOAD_FAILURE = 6, - SYNTHESIZER_COMPLETION_CAUSE_CANCELLED = 7, - - SYNTHESIZER_COMPLETION_CAUSE_COUNT = 8, - SYNTHESIZER_COMPLETION_CAUSE_UNKNOWN = SYNTHESIZER_COMPLETION_CAUSE_COUNT -} mrcp_synth_completion_cause_e; - - -/** Speech-length value declaration */ -typedef struct mrcp_speech_length_value_t mrcp_speech_length_value_t; -/** Numeric speech-length declaration */ -typedef struct mrcp_numeric_speech_length_t mrcp_numeric_speech_length_t; -/** Prosody-param declaration */ -typedef struct mrcp_prosody_param_t mrcp_prosody_param_t; -/** Voice-param declaration */ -typedef struct mrcp_voice_param_t mrcp_voice_param_t; -/**Prosody-rate declaration*/ -typedef struct mrcp_prosody_rate_t mrcp_prosody_rate_t; -/**Prosody-volume declaration*/ -typedef struct mrcp_prosody_volume_t mrcp_prosody_volume_t; -/** MRCP synthesizer-header declaration */ -typedef struct mrcp_synth_header_t mrcp_synth_header_t; - -/** Numeric speech-length */ -struct mrcp_numeric_speech_length_t { - /** The length */ - apr_size_t length; - /** The unit (second/word/sentence/paragraph) */ - mrcp_speech_unit_e unit; -}; - -/** Definition of speech-length value */ -struct mrcp_speech_length_value_t { - /** Speech-length type (numeric/text)*/ - mrcp_speech_length_type_e type; - /** Speech-length value (either numeric or text) */ - union { - /** Text speech-length */ - apt_str_t tag; - /** Numeric speech-length */ - mrcp_numeric_speech_length_t numeric; - } value; -}; - -/** MRCP voice-param */ -struct mrcp_voice_param_t { - /** Voice gender (male/femaile/neutral)*/ - mrcp_voice_gender_e gender; - /** Voice age */ - apr_size_t age; - /** Voice variant */ - apr_size_t variant; - /** Voice name */ - apt_str_t name; -}; - -/** MRCP prosody-volume */ -struct mrcp_prosody_volume_t { - /** prosody-volume type (one of label,numeric,relative change) */ - mrcp_prosody_volume_type_e type; - - /** prosody-volume value */ - union { - /** one of "silent", "x-soft", ... */ - mrcp_prosody_volume_label_e label; - /** numeric value */ - float numeric; - /** relative change */ - float relative; - } value; -}; - -/** MRCP prosody-rate */ -struct mrcp_prosody_rate_t { - /** prosody-rate type (one of label, relative change) */ - mrcp_prosody_rate_type_e type; - - /** prosody-rate value */ - union { - /** one of "x-slow", "slow", ... */ - mrcp_prosody_rate_label_e label; - /** relative change */ - float relative; - } value; -}; - -/** MRCP prosody-param */ -struct mrcp_prosody_param_t { - /** Prosofy volume */ - mrcp_prosody_volume_t volume; - /** Prosofy rate */ - mrcp_prosody_rate_t rate; -}; - -/** MRCP synthesizer-header */ -struct mrcp_synth_header_t { - /** MAY be specified in a CONTROL method and controls the - amount to jump forward or backward in an active "SPEAK" request */ - mrcp_speech_length_value_t jump_size; - /** MAY be sent as part of the "SPEAK" method to enable kill- - on-barge-in support */ - apt_bool_t kill_on_barge_in; - /** MAY be part of the "SET-PARAMS"/"GET-PARAMS" or "SPEAK" - request from the client to the server and specifies a URI which - references the profile of the speaker */ - apt_str_t speaker_profile; - /** MUST be specified in a "SPEAK-COMPLETE" event coming from - the synthesizer resource to the client */ - mrcp_synth_completion_cause_e completion_cause; - /** MAY be specified in a "SPEAK-COMPLETE" event coming from - the synthesizer resource to the client */ - apt_str_t completion_reason; - /** This set of header fields defines the voice of the speaker */ - mrcp_voice_param_t voice_param; - /** This set of header fields defines the prosody of the speech */ - mrcp_prosody_param_t prosody_param; - /** Contains timestamp information in a "timestamp" field */ - apt_str_t speech_marker; - /** specifies the default language of the speech data if the - language is not specified in the markup */ - apt_str_t speech_language; - /** When the synthesizer needs to fetch documents or other resources like - speech markup or audio files, this header controls the corresponding - URI access properties */ - apt_str_t fetch_hint; - /** When the synthesizer needs to fetch documents or other resources like - speech audio files, this header controls the corresponding URI access - properties */ - apt_str_t audio_fetch_hint; - /** When a synthesizer method needs a synthesizer to fetch or access a - URI and the access fails, the server SHOULD provide the failed URI in - this header in the method response */ - apt_str_t failed_uri; - /** When a synthesizer method needs a synthesizer to fetch or access a - URI and the access fails the server MUST provide the URI specific or - protocol specific response code for the URI in the Failed-URI header - in the method response through this header */ - apt_str_t failed_uri_cause; - /** When a CONTROL request to jump backward is issued to a currently - speaking synthesizer resource, and the target jump point is before - the start of the current "SPEAK" request, the current "SPEAK" request - MUST restart */ - apt_bool_t speak_restart; - /** MAY be specified in a CONTROL method to control the - length of speech to speak, relative to the current speaking point in - the currently active "SPEAK" request */ - mrcp_speech_length_value_t speak_length; - /** Used to indicate whether a lexicon has to be loaded or unloaded */ - apt_bool_t load_lexicon; - /** Used to specify a list of active Lexicon URIs and the - search order among the active lexicons */ - apt_str_t lexicon_search_order; -}; - -/** Get synthesizer header vtable */ -const mrcp_header_vtable_t* mrcp_synth_header_vtable_get(mrcp_version_e version); - -/** Get synthesizer completion cause string */ -MRCP_DECLARE(const apt_str_t*) mrcp_synth_completion_cause_get(mrcp_synth_completion_cause_e completion_cause, mrcp_version_e version); - - -APT_END_EXTERN_C - -#endif /* MRCP_SYNTH_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h deleted file mode 100644 index a03cc53e55..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_synth_resource.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_synth_resource.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SYNTH_RESOURCE_H -#define MRCP_SYNTH_RESOURCE_H - -/** - * @file mrcp_synth_resource.h - * @brief MRCP Synthesizer Resource - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP synthesizer methods */ -typedef enum { - SYNTHESIZER_SET_PARAMS, - SYNTHESIZER_GET_PARAMS, - SYNTHESIZER_SPEAK, - SYNTHESIZER_STOP, - SYNTHESIZER_PAUSE, - SYNTHESIZER_RESUME, - SYNTHESIZER_BARGE_IN_OCCURRED, - SYNTHESIZER_CONTROL, - SYNTHESIZER_DEFINE_LEXICON, - - SYNTHESIZER_METHOD_COUNT -} mrcp_synthesizer_method_id; - -/** MRCP synthesizer events */ -typedef enum { - SYNTHESIZER_SPEECH_MARKER, - SYNTHESIZER_SPEAK_COMPLETE, - - SYNTHESIZER_EVENT_COUNT -} mrcp_synthesizer_event_id; - - -/** Create MRCP synthesizer resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_synth_resource_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_SYNTH_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h deleted file mode 100644 index 7a7e94419a..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_header.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: - */ - -#ifndef MRCP_VERIFIER_HEADER_H -#define MRCP_VERIFIER_HEADER_H - -/** - * @file mrcp_verifier_header.h - * @brief MRCP Verifier Header - */ - -#include "mrcp_types.h" -#include "mrcp_header_accessor.h" - -APT_BEGIN_EXTERN_C - -/** MRCP verifier header fields */ -typedef enum { - VERIFIER_HEADER_REPOSITORY_URI, - VERIFIER_HEADER_VOICEPRINT_IDENTIFIER, - VERIFIER_HEADER_VERIFICATION_MODE, - VERIFIER_HEADER_ADAPT_MODEL, - VERIFIER_HEADER_ABORT_MODEL, - VERIFIER_HEADER_MIN_VERIFICATION_SCORE, - VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES, - VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES, - VERIFIER_HEADER_NO_INPUT_TIMEOUT, - VERIFIER_HEADER_SAVE_WAVEFORM, - VERIFIER_HEADER_MEDIA_TYPE, - VERIFIER_HEADER_WAVEFORM_URI, - VERIFIER_HEADER_VOICEPRINT_EXISTS, - VERIFIER_HEADER_VER_BUFFER_UTTERANCE, - VERIFIER_HEADER_INPUT_WAVEFORM_URI, - VERIFIER_HEADER_COMPLETION_CAUSE, - VERIFIER_HEADER_COMPLETION_REASON, - VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT, - VERIFIER_HEADER_NEW_AUDIO_CHANNEL, - VERIFIER_HEADER_ABORT_VERIFICATION, - VERIFIER_HEADER_START_INPUT_TIMERS, - - VERIFIER_HEADER_COUNT -} mrcp_verifier_header_id; - - -/** MRCP verifier completion-cause */ -typedef enum { - VERIFIER_COMPLETION_CAUSE_SUCCESS = 0, - VERIFIER_COMPLETION_CAUSE_ERROR = 1, - VERIFIER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2, - VERIFIER_COMPLETION_CAUSE_TOO_MUCH_SPEECH_TIMEOUT = 3, - VERIFIER_COMPLETION_CAUSE_SPEECH_TOO_EARLY = 4, - VERIFIER_COMPLETION_CAUSE_BUFFER_EMPTY = 5, - VERIFIER_COMPLETION_CAUSE_OUT_OF_SEQUENCE = 6, - VERIFIER_COMPLETION_CAUSE_REPOSITORY_URI_FAILURE = 7, - VERIFIER_COMPLETION_CAUSE_REPOSITORY_URI_MISSING = 8, - VERIFIER_COMPLETION_CAUSE_VOICEPRINT_ID_MISSING = 9, - VERIFIER_COMPLETION_CAUSE_VOICEPRINT_ID_NOT_EXIST = 10, - VERIFIER_COMPLETION_CAUSE_SPEECH_NOT_USABLE = 11, - - VERIFIER_COMPLETION_CAUSE_COUNT = 12, - VERIFIER_COMPLETION_CAUSE_UNKNOWN = VERIFIER_COMPLETION_CAUSE_COUNT -} mrcp_verifier_completion_cause_e; - - - -/** MRCP verifier-header declaration */ -typedef struct mrcp_verifier_header_t mrcp_verifier_header_t; - -/** MRCP verifier-header */ -struct mrcp_verifier_header_t { - /** Specifies the voiceprint repository to be used or referenced during - speaker verification or identification operations */ - apt_str_t repository_uri; - /** Specifies the claimed identity for verification applications */ - apt_str_t voiceprint_identifier; - /** Specifies the mode of the verification resource */ - apt_str_t verification_mode; - /** Indicates the desired behavior of the verification resource - after a successful verification operation */ - apt_bool_t adapt_model; - /** Indicates the desired behavior of the verification resource - upon session termination */ - apt_bool_t abort_model; - /** Determines the minimum verification score for which a verification - decision of "accepted" may be declared by the server */ - float min_verification_score; - /** Specifies the minimum number of valid utterances - before a positive decision is given for verification */ - apr_size_t num_min_verification_phrases; - /** Specifies the number of valid utterances required - before a decision is forced for verification */ - apr_size_t num_max_verification_phrases; - /** Sets the length of time from the start of the verification timers - (see START-INPUT-TIMERS) until the declaration of a no-input event - in the VERIFICATION-COMPLETE server event message */ - apr_size_t no_input_timeout; - /** Allows the client to request the verification resource to save - the audio stream that was used for verification/identification */ - apt_bool_t save_waveform; - /** Tells the server resource the Media Type of the captured audio or video - such as the one captured and returned by the Waveform-URI header field */ - apt_str_t media_type; - /** If the Save-Waveform header field is set to true, the verification resource - MUST attempt to record the incoming audio stream of the verification into - a file and provide a URI for the client to access it */ - apt_str_t waveform_uri; - /** Shows the status of the voiceprint specified - in the QUERY-VOICEPRINT method */ - apt_bool_t voiceprint_exists; - /** Indicates that this utterance could be - later considered for Speaker Verification */ - apt_bool_t ver_buffer_utterance; - /** Specifies stored audio content that the client requests the server - to fetch and process according to the current verification mode, - either to train the voiceprint or verify a claimed identity */ - apt_str_t input_waveform_uri; - /** Indicates the cause of VERIFY or VERIFY-FROM-BUFFER method completion */ - mrcp_verifier_completion_cause_e completion_cause; - /** MAY be specified in a VERIFICATION-COMPLETE event - coming from the verifier resource to the client */ - apt_str_t completion_reason; - /** Specifies the length of silence required following user - speech before the speech verifier finalizes a result */ - apr_size_t speech_complete_timeout; - /** MAY be specified in a VERIFIER request and allows the - client to tell the server that, from this point on, further input - audio comes from a different audio source */ - apt_bool_t new_audio_channel; - /** MUST be sent in a STOP request to indicate - whether or not to abort a VERIFY method in progress */ - apt_bool_t abort_verification; - /** MAY be sent as part of a VERIFY request. A value of false - tells the verification resource to start the VERIFY operation, - but not to start the no-input timer yet */ - apt_bool_t start_input_timers; -}; - - -/** Get verifier header vtable */ -const mrcp_header_vtable_t* mrcp_verifier_header_vtable_get(mrcp_version_e version); - -/** Get verifier completion cause string */ -MRCP_DECLARE(const apt_str_t*) mrcp_verifier_completion_cause_get(mrcp_verifier_completion_cause_e completion_cause, mrcp_version_e version); - -APT_END_EXTERN_C - -#endif /* MRCP_VERIFIER_HEADER_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h b/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h deleted file mode 100644 index f3022513eb..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/include/mrcp_verifier_resource.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: - */ - -#ifndef MRCP_VERIFIER_RESOURCE_H -#define MRCP_VERIFIER_RESOURCE_H - -/** - * @file mrcp_verifier_resource.h - * @brief MRCP Verifier Resource - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** MRCP verifier methods */ -typedef enum { - VERIFIER_SET_PARAMS, - VERIFIER_GET_PARAMS, - VERIFIER_START_SESSION, - VERIFIER_END_SESSION, - VERIFIER_QUERY_VOICEPRINT, - VERIFIER_DELETE_VOICEPRINT, - VERIFIER_VERIFY, - VERIFIER_VERIFY_FROM_BUFFER, - VERIFIER_VERIFY_ROLLBACK, - VERIFIER_STOP, - VERIFIER_CLEAR_BUFFER, - VERIFIER_START_INPUT_TIMERS, - VERIFIER_GET_INTERMIDIATE_RESULT, - - VERIFIER_METHOD_COUNT -} mrcp_verifier_method_id; - -/** MRCP verifier events */ -typedef enum { - VERIFIER_START_OF_INPUT, - VERIFIER_VERIFICATION_COMPLETE, - - VERIFIER_EVENT_COUNT -} mrcp_verifier_event_id; - -/** Create MRCP verifier resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_verifier_resource_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_VERIFIER_RESOURCE_H */ diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c deleted file mode 100644 index 527476c303..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_header.c +++ /dev/null @@ -1,781 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recog_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_recog_header.h" - -/** String table of MRCPv1 recognizer header fields (mrcp_recog_header_id) */ -static const apt_str_table_item_t v1_recog_header_string_table[] = { - {{"Confidence-Threshold", 20},16}, - {{"Sensitivity-Level", 17},14}, - {{"Speed-Vs-Accuracy", 17},4}, - {{"N-Best-List-Length", 18},1}, - {{"No-Input-Timeout", 16},2}, - {{"Recognition-Timeout", 19},19}, - {{"Waveform-Url", 12},4}, - {{"Completion-Cause", 16},16}, - {{"Recognizer-Context-Block", 24},16}, - {{"Recognizer-Start-Timers", 23},18}, - {{"Speech-Complete-Timeout", 23},7}, - {{"Speech-Incomplete-Timeout", 25},12}, - {{"DTMF-Interdigit-Timeout", 23},10}, - {{"DTMF-Term-Timeout", 17},14}, - {{"DTMF-Term-Char", 14},14}, - {{"Failed-Uri", 10},10}, - {{"Failed-Uri-Cause", 16},16}, - {{"Save-Waveform", 13},5}, - {{"New-Audio-Channel", 17},17}, - {{"Speech-Language", 15},8}, - {{"Input-Type", 10},10}, - {{"Input-Waveform-Uri", 18},6}, - {{"Completion-Reason", 17},17}, - {{"Media-Type", 10},0}, - {{"Ver-Buffer-Utterance", 20},0}, - {{"Recognition-Mode", 16},16}, - {{"Cancel-If-Queue", 15},3}, - {{"Hotword-Max-Duration", 20},10}, - {{"Hotword-Min-Duration", 20},20}, - {{"Interpret-Text", 14},12}, - {{"DTMF-Buffer-Time", 16},16}, - {{"Clear-DTMF-Buffer", 17},11}, - {{"Early-No-Match", 14},4}, - {{"Num-Min-Consistent-Pronunciations",33},1}, - {{"Consistency-Threshold", 21},16}, - {{"Clash-Threshold", 15},2}, - {{"Personal-Grammar-URI", 20},9}, - {{"Enroll-Utterance", 16},10}, - {{"Phrase-ID", 9},8}, - {{"Phrase-NL", 9},9}, - {{"Weight", 6},3}, - {{"Save-Best-Waveform", 18},10}, - {{"New-Phrase-ID", 13},4}, - {{"Confusable-Phrases-URI", 22},4}, - {{"Abort-Phrase-Enrollment", 23},0} -}; - -/** String table of MRCPv2 recognizer header fields (mrcp_recog_header_id) */ -static const apt_str_table_item_t v2_recog_header_string_table[] = { - {{"Confidence-Threshold", 20},16}, - {{"Sensitivity-Level", 17},14}, - {{"Speed-Vs-Accuracy", 17},4}, - {{"N-Best-List-Length", 18},1}, - {{"No-Input-Timeout", 16},2}, - {{"Recognition-Timeout", 19},19}, - {{"Waveform-Uri", 12},4}, - {{"Completion-Cause", 16},16}, - {{"Recognizer-Context-Block", 24},7}, - {{"Start-Input-Timers", 18},18}, - {{"Speech-Complete-Timeout", 23},7}, - {{"Speech-Incomplete-Timeout", 25},12}, - {{"DTMF-Interdigit-Timeout", 23},10}, - {{"DTMF-Term-Timeout", 17},14}, - {{"DTMF-Term-Char", 14},14}, - {{"Failed-Uri", 10},10}, - {{"Failed-Uri-Cause", 16},16}, - {{"Save-Waveform", 13},5}, - {{"New-Audio-Channel", 17},17}, - {{"Speech-Language", 15},8}, - {{"Input-Type", 10},10}, - {{"Input-Waveform-Uri", 18},6}, - {{"Completion-Reason", 17},13}, - {{"Media-Type", 10},0}, - {{"Ver-Buffer-Utterance", 20},0}, - {{"Recognition-Mode", 16},16}, - {{"Cancel-If-Queue", 15},3}, - {{"Hotword-Max-Duration", 20},10}, - {{"Hotword-Min-Duration", 20},20}, - {{"Interpret-Text", 14},12}, - {{"DTMF-Buffer-Time", 16},16}, - {{"Clear-DTMF-Buffer", 17},11}, - {{"Early-No-Match", 14},4}, - {{"Num-Min-Consistent-Pronunciations",33},1}, - {{"Consistency-Threshold", 21},16}, - {{"Clash-Threshold", 15},15}, - {{"Personal-Grammar-URI", 20},9}, - {{"Enroll-Utterance", 16},10}, - {{"Phrase-ID", 9},8}, - {{"Phrase-NL", 9},9}, - {{"Weight", 6},3}, - {{"Save-Best-Waveform", 18},10}, - {{"New-Phrase-ID", 13},4}, - {{"Confusable-Phrases-URI", 22},4}, - {{"Abort-Phrase-Enrollment", 23},0} -}; - -/** String table of MRCPv1 recognizer completion-cause fields (mrcp_recog_completion_cause_e) */ -static const apt_str_table_item_t v1_completion_cause_string_table[] = { - {{"success", 7},1}, - {{"no-match", 8},8}, - {{"no-input-timeout", 16},3}, - {{"recognition-timeout", 19},0}, - {{"gram-load-failure", 17},7}, - {{"gram-comp-failure", 17},5}, - {{"error", 5},0}, - {{"speech-too-early", 16},1}, - {{"too-much-speech-timeout", 23},0}, - {{"uri-failure", 11},0}, - {{"language-unsupported", 20},0}, - {{"cancelled", 9},0}, - {{"semantics-failure", 17},2}, - {{"partial-match", 13},13}, - {{"partial-match-maxtime", 21},13}, - {{"no-match-maxtime", 16},9}, - {{"gram-definition-failure", 23},5} -}; - - -/** String table of MRCPv2 recognizer completion-cause fields (mrcp_recog_completion_cause_e) */ -static const apt_str_table_item_t v2_completion_cause_string_table[] = { - {{"success", 7},7}, - {{"no-match", 8},4}, - {{"no-input-timeout", 16},3}, - {{"hotword-maxtime", 15},0}, - {{"grammar-load-failure", 20},8}, - {{"grammar-compilation-failure",27},8}, - {{"recognizer-error", 16},0}, - {{"speech-too-early", 16},1}, - {{"success-maxtime", 15},15}, - {{"uri-failure", 11},0}, - {{"language-unsupported", 20},0}, - {{"cancelled", 9},0}, - {{"semantics-failure", 17},2}, - {{"partial-match", 13},13}, - {{"partial-match-maxtime", 21},13}, - {{"no-match-maxtime", 16},9}, - {{"grammar-definition-failure", 26},9} -}; - -/** Initialize recognizer header */ -static void mrcp_recog_header_init(mrcp_recog_header_t *recog_header) -{ - recog_header->confidence_threshold = 0.0; - recog_header->sensitivity_level = 0.0; - recog_header->speed_vs_accuracy = 0.0; - recog_header->n_best_list_length = 0; - recog_header->no_input_timeout = 0; - recog_header->recognition_timeout = 0; - apt_string_reset(&recog_header->waveform_uri); - recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_COUNT; - apt_string_reset(&recog_header->recognizer_context_block); - recog_header->start_input_timers = FALSE; - recog_header->speech_complete_timeout = 0; - recog_header->speech_incomplete_timeout = 0; - recog_header->dtmf_interdigit_timeout = 0; - recog_header->dtmf_term_timeout = 0; - recog_header->dtmf_term_char = 0; - apt_string_reset(&recog_header->failed_uri); - apt_string_reset(&recog_header->failed_uri_cause); - recog_header->save_waveform = FALSE; - recog_header->new_audio_channel = FALSE; - apt_string_reset(&recog_header->speech_language); - /* initializes additionnal MRCPV2 recog header fields */ - apt_string_reset(&recog_header->input_type); - apt_string_reset(&recog_header->input_waveform_uri); - apt_string_reset(&recog_header->completion_reason); - apt_string_reset(&recog_header->media_type); - recog_header->ver_buffer_utterance = FALSE; - apt_string_reset(&recog_header->recognition_mode); - recog_header->cancel_if_queue = FALSE; - recog_header->hotword_max_duration = 0; - recog_header->hotword_min_duration = 0; - apt_string_reset(&recog_header->interpret_text); - recog_header->dtmf_buffer_time = 0; - recog_header->clear_dtmf_buffer = FALSE; - recog_header->early_no_match = FALSE; - recog_header->num_min_consistent_pronunciations = 0; - recog_header->consistency_threshold = 0.0; - recog_header->clash_threshold = 0.0; - apt_string_reset(&recog_header->personal_grammar_uri); - recog_header->enroll_utterance = FALSE; - apt_string_reset(&recog_header->phrase_id); - apt_string_reset(&recog_header->phrase_nl); - recog_header->weight = 0.0; - recog_header->save_best_waveform = FALSE; - apt_string_reset(&recog_header->new_phrase_id); - apt_string_reset(&recog_header->confusable_phrases_uri); - recog_header->abort_phrase_enrollment = FALSE; -} - -/** Allocate MRCP recognizer header */ -static void* mrcp_recog_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = apr_palloc(pool,sizeof(mrcp_recog_header_t)); - mrcp_recog_header_init(recog_header); - accessor->data = recog_header; - return accessor->data; -} - -/** Parse MRCP recognizer header */ -static apt_bool_t mrcp_recog_header_parse(mrcp_recog_header_t *recog_header, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - switch(id) { - case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH: - recog_header->n_best_list_length = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT: - recog_header->no_input_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT: - recog_header->recognition_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_WAVEFORM_URI: - recog_header->waveform_uri = *value; - break; - case RECOGNIZER_HEADER_COMPLETION_CAUSE: - recog_header->completion_cause = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK: - recog_header->recognizer_context_block = *value; - break; - case RECOGNIZER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_parse(value,&recog_header->start_input_timers); - break; - case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT: - recog_header->speech_complete_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT: - recog_header->speech_incomplete_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT: - recog_header->dtmf_interdigit_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT: - recog_header->dtmf_term_timeout = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_DTMF_TERM_CHAR: - recog_header->dtmf_term_char = *value->buf; - break; - case RECOGNIZER_HEADER_FAILED_URI: - recog_header->failed_uri = *value; - break; - case RECOGNIZER_HEADER_FAILED_URI_CAUSE: - recog_header->failed_uri_cause = *value; - break; - case RECOGNIZER_HEADER_SAVE_WAVEFORM: - apt_boolean_value_parse(value,&recog_header->save_waveform); - break; - case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_parse(value,&recog_header->new_audio_channel); - break; - case RECOGNIZER_HEADER_SPEECH_LANGUAGE: - recog_header->speech_language = *value; - break; - case RECOGNIZER_HEADER_INPUT_TYPE: - recog_header->input_type = *value; - break; - case RECOGNIZER_HEADER_MEDIA_TYPE: - recog_header->media_type = *value; - break; - case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI: - recog_header->input_waveform_uri = *value; - break; - case RECOGNIZER_HEADER_COMPLETION_REASON: - recog_header->completion_reason = *value; - break; - case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_parse(value,&recog_header->ver_buffer_utterance); - break; - case RECOGNIZER_HEADER_RECOGNITION_MODE: - recog_header->recognition_mode = *value; - break; - case RECOGNIZER_HEADER_CANCEL_IF_QUEUE: - apt_boolean_value_parse(value,&recog_header->cancel_if_queue); - break; - case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION: - recog_header->hotword_max_duration = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION: - recog_header->hotword_min_duration = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_INTERPRET_TEXT: - recog_header->interpret_text = *value; - break; - case RECOGNIZER_HEADER_DTMF_BUFFER_TIME: - recog_header->dtmf_buffer_time = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER: - apt_boolean_value_parse(value,&recog_header->clear_dtmf_buffer); - break; - case RECOGNIZER_HEADER_EARLY_NO_MATCH: - apt_boolean_value_parse(value,&recog_header->early_no_match); - break; - case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS: - recog_header->num_min_consistent_pronunciations = apt_size_value_parse(value); - break; - case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD: - recog_header->consistency_threshold = apt_float_value_parse(value); - break; - case RECOGNIZER_HEADER_CLASH_THRESHOLD: - recog_header->clash_threshold = apt_float_value_parse(value); - break; - case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI: - recog_header->personal_grammar_uri = *value; - break; - case RECOGNIZER_HEADER_ENROLL_UTTERANCE: - apt_boolean_value_parse(value,&recog_header->enroll_utterance); - break; - case RECOGNIZER_HEADER_PHRASE_ID: - recog_header->phrase_id = *value; - break; - case RECOGNIZER_HEADER_PHRASE_NL: - recog_header->phrase_nl = *value; - break; - case RECOGNIZER_HEADER_WEIGHT: - recog_header->weight = apt_float_value_parse(value); - break; - case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM: - apt_boolean_value_parse(value,&recog_header->save_best_waveform); - break; - case RECOGNIZER_HEADER_NEW_PHRASE_ID: - recog_header->new_phrase_id = *value; - break; - case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI: - recog_header->confusable_phrases_uri = *value; - break; - case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT: - apt_boolean_value_parse(value,&recog_header->abort_phrase_enrollment); - break; - default: - status = FALSE; - } - return status; -} - -static APR_INLINE float apt_size_value_parse_as_float(const apt_str_t *value) -{ - float f = (float)apt_size_value_parse(value); - return f / 100; -} - -static APR_INLINE apt_bool_t apt_size_value_generate_from_float(float value, apt_str_t *str, apr_pool_t *pool) -{ - apr_size_t s = (apr_size_t)((value + 0.001f) * 100); - return apt_size_value_generate(s,str,pool); -} - -/** Parse MRCPv1 recognizer header */ -static apt_bool_t mrcp_v1_recog_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) { - recog_header->confidence_threshold = apt_size_value_parse_as_float(value); - return TRUE; - } - else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) { - recog_header->sensitivity_level = apt_size_value_parse_as_float(value); - return TRUE; - } - else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) { - recog_header->speed_vs_accuracy = apt_size_value_parse_as_float(value); - return TRUE; - } - return mrcp_recog_header_parse(recog_header,id,value,pool); -} - -/** Parse MRCPv2 recognizer header */ -static apt_bool_t mrcp_v2_recog_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) { - recog_header->confidence_threshold = apt_float_value_parse(value); - return TRUE; - } - else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) { - recog_header->sensitivity_level = apt_float_value_parse(value); - return TRUE; - } - else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) { - recog_header->speed_vs_accuracy = apt_float_value_parse(value); - return TRUE; - } - return mrcp_recog_header_parse(recog_header,id,value,pool); -} - -/** Generate MRCP recognizer header */ -static apt_bool_t mrcp_recog_header_generate(const mrcp_recog_header_t *recog_header, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - switch(id) { - case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH: - apt_size_value_generate(recog_header->n_best_list_length,value,pool); - break; - case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT: - apt_size_value_generate(recog_header->no_input_timeout,value,pool); - break; - case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT: - apt_size_value_generate(recog_header->recognition_timeout,value,pool); - break; - case RECOGNIZER_HEADER_WAVEFORM_URI: - *value = recog_header->waveform_uri; - break; - case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK: - *value = recog_header->recognizer_context_block; - break; - case RECOGNIZER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_generate(recog_header->start_input_timers,value,pool); - break; - case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT: - apt_size_value_generate(recog_header->speech_complete_timeout,value,pool); - break; - case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT: - apt_size_value_generate(recog_header->speech_incomplete_timeout,value,pool); - break; - case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT: - apt_size_value_generate(recog_header->dtmf_interdigit_timeout,value,pool); - break; - case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT: - apt_size_value_generate(recog_header->dtmf_term_timeout,value,pool); - break; - case RECOGNIZER_HEADER_DTMF_TERM_CHAR: - value->length = 1; - value->buf = apr_palloc(pool,value->length); - *value->buf = recog_header->dtmf_term_char; - break; - case RECOGNIZER_HEADER_FAILED_URI: - *value = recog_header->failed_uri; - break; - case RECOGNIZER_HEADER_FAILED_URI_CAUSE: - *value = recog_header->failed_uri_cause; - break; - case RECOGNIZER_HEADER_SAVE_WAVEFORM: - apt_boolean_value_generate(recog_header->save_waveform,value,pool); - break; - case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_generate(recog_header->new_audio_channel,value,pool); - break; - case RECOGNIZER_HEADER_SPEECH_LANGUAGE: - *value = recog_header->speech_language; - break; - case RECOGNIZER_HEADER_INPUT_TYPE: - *value = recog_header->input_type; - break; - case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI: - *value = recog_header->input_waveform_uri; - break; - case RECOGNIZER_HEADER_COMPLETION_REASON: - *value = recog_header->completion_reason; - break; - case RECOGNIZER_HEADER_MEDIA_TYPE: - *value = recog_header->media_type; - break; - case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_generate(recog_header->ver_buffer_utterance,value,pool); - break; - case RECOGNIZER_HEADER_RECOGNITION_MODE: - *value = recog_header->recognition_mode; - break; - case RECOGNIZER_HEADER_CANCEL_IF_QUEUE: - apt_boolean_value_generate(recog_header->cancel_if_queue,value,pool); - break; - case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION: - apt_size_value_generate(recog_header->hotword_max_duration,value,pool); - break; - case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION: - apt_size_value_generate(recog_header->hotword_min_duration,value,pool); - break; - case RECOGNIZER_HEADER_INTERPRET_TEXT: - *value = recog_header->interpret_text; - break; - case RECOGNIZER_HEADER_DTMF_BUFFER_TIME: - apt_size_value_generate(recog_header->dtmf_buffer_time,value,pool); - break; - case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER: - apt_boolean_value_generate(recog_header->clear_dtmf_buffer,value,pool); - break; - case RECOGNIZER_HEADER_EARLY_NO_MATCH: - apt_boolean_value_generate(recog_header->early_no_match,value,pool); - break; - case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS: - apt_size_value_generate(recog_header->num_min_consistent_pronunciations,value,pool); - break; - case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD: - apt_float_value_generate(recog_header->consistency_threshold,value,pool); - break; - case RECOGNIZER_HEADER_CLASH_THRESHOLD: - apt_float_value_generate(recog_header->clash_threshold,value,pool); - break; - case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI: - *value = recog_header->personal_grammar_uri; - break; - case RECOGNIZER_HEADER_ENROLL_UTTERANCE: - apt_boolean_value_generate(recog_header->enroll_utterance,value,pool); - break; - case RECOGNIZER_HEADER_PHRASE_ID: - *value = recog_header->phrase_id; - break; - case RECOGNIZER_HEADER_PHRASE_NL: - *value = recog_header->phrase_nl; - break; - case RECOGNIZER_HEADER_WEIGHT: - apt_float_value_generate(recog_header->weight,value,pool); - break; - case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM: - apt_boolean_value_generate(recog_header->save_best_waveform,value,pool); - break; - case RECOGNIZER_HEADER_NEW_PHRASE_ID: - *value = recog_header->new_phrase_id; - break; - case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI: - *value = recog_header->confusable_phrases_uri; - break; - case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT: - apt_boolean_value_generate(recog_header->abort_phrase_enrollment,value,pool); - break; - default: - break; - } - return TRUE; -} - -/** Generate MRCPv1 recognizer header */ -static apt_bool_t mrcp_v1_recog_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) { - return apt_size_value_generate_from_float(recog_header->confidence_threshold,value,pool); - } - else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) { - return apt_size_value_generate_from_float(recog_header->sensitivity_level,value,pool); - } - else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) { - return apt_size_value_generate_from_float(recog_header->speed_vs_accuracy,value,pool); - } - else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) { - return apt_completion_cause_generate( - v1_completion_cause_string_table, - RECOGNIZER_COMPLETION_CAUSE_COUNT, - recog_header->completion_cause, - value, - pool); - } - return mrcp_recog_header_generate(recog_header,id,value,pool); -} - -/** Generate MRCPv2 recognizer header */ -static apt_bool_t mrcp_v2_recog_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) { - return apt_float_value_generate(recog_header->confidence_threshold,value,pool); - } - else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) { - return apt_float_value_generate(recog_header->sensitivity_level,value,pool); - } - else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) { - return apt_float_value_generate(recog_header->speed_vs_accuracy,value,pool); - } - else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) { - return apt_completion_cause_generate( - v2_completion_cause_string_table, - RECOGNIZER_COMPLETION_CAUSE_COUNT, - recog_header->completion_cause, - value, - pool); - } - return mrcp_recog_header_generate(recog_header,id,value,pool); -} - -/** Duplicate MRCP recognizer header */ -static apt_bool_t mrcp_recog_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recog_header_t *recog_header = accessor->data; - const mrcp_recog_header_t *src_recog_header = src->data; - apt_bool_t status = TRUE; - - if(!recog_header || !src_recog_header) { - return FALSE; - } - - switch(id) { - case RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD: - recog_header->confidence_threshold = src_recog_header->confidence_threshold; - break; - case RECOGNIZER_HEADER_SENSITIVITY_LEVEL: - recog_header->sensitivity_level = src_recog_header->sensitivity_level; - break; - case RECOGNIZER_HEADER_SPEED_VS_ACCURACY: - recog_header->speed_vs_accuracy = src_recog_header->speed_vs_accuracy; - break; - case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH: - recog_header->n_best_list_length = src_recog_header->n_best_list_length; - break; - case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT: - recog_header->no_input_timeout = src_recog_header->no_input_timeout; - break; - case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT: - recog_header->recognition_timeout = src_recog_header->recognition_timeout; - break; - case RECOGNIZER_HEADER_WAVEFORM_URI: - recog_header->waveform_uri = *value; - break; - case RECOGNIZER_HEADER_COMPLETION_CAUSE: - recog_header->completion_cause = src_recog_header->completion_cause; - break; - case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK: - recog_header->recognizer_context_block = *value; - break; - case RECOGNIZER_HEADER_START_INPUT_TIMERS: - recog_header->start_input_timers = src_recog_header->start_input_timers; - break; - case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT: - recog_header->speech_complete_timeout = src_recog_header->speech_complete_timeout; - break; - case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT: - recog_header->speech_incomplete_timeout = src_recog_header->speech_incomplete_timeout; - break; - case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT: - recog_header->dtmf_interdigit_timeout = src_recog_header->dtmf_interdigit_timeout; - break; - case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT: - recog_header->dtmf_term_timeout = src_recog_header->dtmf_term_timeout; - break; - case RECOGNIZER_HEADER_DTMF_TERM_CHAR: - recog_header->dtmf_term_char = src_recog_header->dtmf_term_char; - break; - case RECOGNIZER_HEADER_FAILED_URI: - recog_header->failed_uri = *value; - break; - case RECOGNIZER_HEADER_FAILED_URI_CAUSE: - recog_header->failed_uri_cause = *value; - break; - case RECOGNIZER_HEADER_SAVE_WAVEFORM: - recog_header->save_waveform = src_recog_header->save_waveform; - break; - case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL: - recog_header->new_audio_channel = src_recog_header->new_audio_channel; - break; - case RECOGNIZER_HEADER_SPEECH_LANGUAGE: - recog_header->speech_language = *value; - break; - case RECOGNIZER_HEADER_INPUT_TYPE: - recog_header->input_type = *value; - break; - case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI: - recog_header->input_waveform_uri = *value; - break; - case RECOGNIZER_HEADER_COMPLETION_REASON: - recog_header->completion_reason = *value; - break; - case RECOGNIZER_HEADER_MEDIA_TYPE: - recog_header->media_type = *value; - break; - case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE: - recog_header->ver_buffer_utterance = src_recog_header->ver_buffer_utterance; - break; - case RECOGNIZER_HEADER_RECOGNITION_MODE: - recog_header->recognition_mode = *value; - break; - case RECOGNIZER_HEADER_CANCEL_IF_QUEUE: - recog_header->cancel_if_queue = src_recog_header->cancel_if_queue; - break; - case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION: - recog_header->hotword_max_duration = src_recog_header->hotword_max_duration; - break; - case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION: - recog_header->hotword_min_duration = src_recog_header->hotword_min_duration; - break; - case RECOGNIZER_HEADER_INTERPRET_TEXT: - recog_header->interpret_text = *value; - break; - case RECOGNIZER_HEADER_DTMF_BUFFER_TIME: - recog_header->dtmf_buffer_time = src_recog_header->dtmf_buffer_time; - break; - case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER: - recog_header->clear_dtmf_buffer = src_recog_header->clear_dtmf_buffer; - break; - case RECOGNIZER_HEADER_EARLY_NO_MATCH: - recog_header->early_no_match = src_recog_header->early_no_match; - break; - case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS: - recog_header->num_min_consistent_pronunciations = src_recog_header->num_min_consistent_pronunciations; - break; - case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD: - recog_header->consistency_threshold = src_recog_header->consistency_threshold; - break; - case RECOGNIZER_HEADER_CLASH_THRESHOLD: - recog_header->clash_threshold = src_recog_header->clash_threshold; - break; - case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI: - recog_header->personal_grammar_uri = *value; - break; - case RECOGNIZER_HEADER_ENROLL_UTTERANCE: - recog_header->enroll_utterance = src_recog_header->enroll_utterance; - break; - case RECOGNIZER_HEADER_PHRASE_ID: - recog_header->phrase_id = *value; - break; - case RECOGNIZER_HEADER_PHRASE_NL: - recog_header->phrase_nl = *value; - break; - case RECOGNIZER_HEADER_WEIGHT: - recog_header->weight = src_recog_header->weight; - break; - case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM: - recog_header->save_best_waveform = src_recog_header->save_best_waveform; - break; - case RECOGNIZER_HEADER_NEW_PHRASE_ID: - recog_header->new_phrase_id = *value; - break; - case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI: - recog_header->confusable_phrases_uri = *value; - break; - case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT: - recog_header->abort_phrase_enrollment = src_recog_header->abort_phrase_enrollment; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t v1_vtable = { - mrcp_recog_header_allocate, - NULL, /* nothing to destroy */ - mrcp_v1_recog_header_parse, - mrcp_v1_recog_header_generate, - mrcp_recog_header_duplicate, - v1_recog_header_string_table, - RECOGNIZER_HEADER_COUNT -}; - -static const mrcp_header_vtable_t v2_vtable = { - mrcp_recog_header_allocate, - NULL, /* nothing to destroy */ - mrcp_v2_recog_header_parse, - mrcp_v2_recog_header_generate, - mrcp_recog_header_duplicate, - v2_recog_header_string_table, - RECOGNIZER_HEADER_COUNT -}; - -const mrcp_header_vtable_t* mrcp_recog_header_vtable_get(mrcp_version_e version) -{ - if(version == MRCP_VERSION_1) { - return &v1_vtable; - } - return &v2_vtable; -} - -MRCP_DECLARE(const apt_str_t*) mrcp_recog_completion_cause_get(mrcp_recog_completion_cause_e completion_cause, mrcp_version_e version) -{ - const apt_str_table_item_t *table = v2_completion_cause_string_table; - if(version == MRCP_VERSION_1) { - table = v1_completion_cause_string_table; - } - - return apt_string_table_str_get(table,RECOGNIZER_COMPLETION_CAUSE_COUNT,completion_cause); -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c deleted file mode 100644 index 83a1a4e83e..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recog_resource.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recog_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_recog_resource.h" -#include "mrcp_recog_header.h" -#include "mrcp_resource.h" - -/** String table of MRCP recognizer methods (mrcp_recognizer_method_id) */ -static const apt_str_table_item_t v1_recog_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},10}, - {{"DEFINE-GRAMMAR", 14},2}, - {{"RECOGNIZE", 9},7}, - {{"INTERPRET", 9},0}, - {{"GET-RESULT", 10},6}, - {{"RECOGNITION-START-TIMERS", 24},7}, - {{"STOP", 4},2}, - {{"START-PHRASE-ENROLLMENT", 23},2}, - {{"ENROLLMENT-ROLLBACK", 19},2}, - {{"END-PHRASE-ENROLLMENT", 21},5}, - {{"MODIFY-PHRASE", 13},0}, - {{"DELETE-PHRASE", 13},2} -}; - -/** String table of MRCPv2 recognizer methods (mrcp_recognizer_method_id) */ -static const apt_str_table_item_t v2_recog_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},10}, - {{"DEFINE-GRAMMAR", 14},2}, - {{"RECOGNIZE", 9},0}, - {{"INTERPRET", 9},0}, - {{"GET-RESULT", 10},6}, - {{"START-INPUT-TIMERS", 18},7}, - {{"STOP", 4},2}, - {{"START-PHRASE-ENROLLMENT", 23},6}, - {{"ENROLLMENT-ROLLBACK", 19},2}, - {{"END-PHRASE-ENROLLMENT", 21},5}, - {{"MODIFY-PHRASE", 13},0}, - {{"DELETE-PHRASE", 13},2} -}; - -/** String table of MRCP recognizer events (mrcp_recognizer_event_id) */ -static const apt_str_table_item_t v1_recog_event_string_table[] = { - {{"START-OF-SPEECH", 15},0}, - {{"RECOGNITION-COMPLETE", 20},0}, - {{"INTERPRETATION-COMPLETE", 23},0} -}; - -/** String table of MRCPv2 recognizer events (mrcp_recognizer_event_id) */ -static const apt_str_table_item_t v2_recog_event_string_table[] = { - {{"START-OF-INPUT", 14},0}, - {{"RECOGNITION-COMPLETE", 20},0}, - {{"INTERPRETATION-COMPLETE", 23},0} -}; - - -static APR_INLINE const apt_str_table_item_t* recog_method_string_table_get(mrcp_version_e version) -{ - if(version == MRCP_VERSION_1) { - return v1_recog_method_string_table; - } - return v2_recog_method_string_table; -} - -static APR_INLINE const apt_str_table_item_t* recog_event_string_table_get(mrcp_version_e version) -{ - if(version == MRCP_VERSION_1) { - return v1_recog_event_string_table; - } - return v2_recog_event_string_table; -} - -/** Create MRCP recognizer resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_recog_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = mrcp_resource_create(pool); - - resource->method_count = RECOGNIZER_METHOD_COUNT; - resource->event_count = RECOGNIZER_EVENT_COUNT; - resource->get_method_str_table = recog_method_string_table_get; - resource->get_event_str_table = recog_event_string_table_get; - resource->get_resource_header_vtable = mrcp_recog_header_vtable_get; - return resource; -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c deleted file mode 100644 index 85f619524a..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_header.c +++ /dev/null @@ -1,282 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recorder_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_recorder_header.h" - -/** String table of recorder header fields (mrcp_recorder_header_id) */ -static const apt_str_table_item_t recorder_header_string_table[] = { - {{"Sensitivity-Level", 17},3}, - {{"No-Input-Timeout", 16},2}, - {{"Completion-Cause", 16},16}, - {{"Completion-Reason", 17},11}, - {{"Failed-Uri", 10},10}, - {{"Failed-Uri-Cause", 16},16}, - {{"Record-Uri", 10},0}, - {{"Media-Type", 10},2}, - {{"Max-Time", 8},2}, - {{"Trim-Length", 11},0}, - {{"Final-Silence", 13},1}, - {{"Capture-On-Speech", 17},2}, - {{"Ver-Buffer-Utterance", 20},0}, - {{"Start-Input-Timers", 18},1}, - {{"New-Audio-Channel", 17},2} -}; - -/** String table of recorder completion-cause fields (mrcp_recorder_completion_cause_e) */ -static const apt_str_table_item_t completion_cause_string_table[] = { - {{"success-silence", 15},8}, - {{"success-maxtime", 15},8}, - {{"no-input-timeout", 16},0}, - {{"uri-failure", 11},0}, - {{"error", 5},0} -}; - - -/** Initialize recorder header */ -static void mrcp_recorder_header_init(mrcp_recorder_header_t *recorder_header) -{ - recorder_header->sensitivity_level = 0.0; - recorder_header->no_input_timeout = 0; - recorder_header->completion_cause = RECORDER_COMPLETION_CAUSE_COUNT; - apt_string_reset(&recorder_header->completion_reason); - apt_string_reset(&recorder_header->failed_uri); - apt_string_reset(&recorder_header->failed_uri_cause); - apt_string_reset(&recorder_header->record_uri); - apt_string_reset(&recorder_header->media_type); - recorder_header->max_time = 0; - recorder_header->trim_length = 0; - recorder_header->final_silence = 0; - recorder_header->capture_on_speech = FALSE; - recorder_header->ver_buffer_utterance = FALSE; - recorder_header->start_input_timers = FALSE; - recorder_header->new_audio_channel = FALSE; -} - -/** Allocate MRCP recorder header */ -static void* mrcp_recorder_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_recorder_header_t *recorder_header = apr_palloc(pool,sizeof(mrcp_recorder_header_t)); - mrcp_recorder_header_init(recorder_header); - accessor->data = recorder_header; - return accessor->data; -} - -/** Parse MRCP recorder header */ -static apt_bool_t mrcp_recorder_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - mrcp_recorder_header_t *recorder_header = accessor->data; - switch(id) { - case RECORDER_HEADER_SENSITIVITY_LEVEL: - recorder_header->sensitivity_level = apt_float_value_parse(value); - break; - case RECORDER_HEADER_NO_INPUT_TIMEOUT: - recorder_header->no_input_timeout = apt_size_value_parse(value); - break; - case RECORDER_HEADER_COMPLETION_CAUSE: - recorder_header->completion_cause = apt_size_value_parse(value); - break; - case RECORDER_HEADER_COMPLETION_REASON: - recorder_header->completion_reason = *value; - break; - case RECORDER_HEADER_FAILED_URI: - recorder_header->failed_uri = *value; - break; - case RECORDER_HEADER_FAILED_URI_CAUSE: - recorder_header->failed_uri_cause = *value; - break; - case RECORDER_HEADER_RECORD_URI: - recorder_header->record_uri = *value; - break; - case RECORDER_HEADER_MEDIA_TYPE: - recorder_header->media_type = *value; - break; - case RECORDER_HEADER_MAX_TIME: - recorder_header->max_time = apt_size_value_parse(value); - break; - case RECORDER_HEADER_TRIM_LENGTH: - recorder_header->trim_length = apt_size_value_parse(value); - break; - case RECORDER_HEADER_FINAL_SILENCE: - recorder_header->final_silence = apt_size_value_parse(value); - break; - case RECORDER_HEADER_CAPTURE_ON_SPEECH: - apt_boolean_value_parse(value,&recorder_header->capture_on_speech); - break; - case RECORDER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_parse(value,&recorder_header->ver_buffer_utterance); - break; - case RECORDER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_parse(value,&recorder_header->start_input_timers); - break; - case RECORDER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_parse(value,&recorder_header->new_audio_channel); - break; - default: - status = FALSE; - } - return status; -} - -/** Generate MRCP recorder header */ -static apt_bool_t mrcp_recorder_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recorder_header_t *recorder_header = accessor->data; - switch(id) { - case RECORDER_HEADER_SENSITIVITY_LEVEL: - apt_float_value_generate(recorder_header->sensitivity_level,value,pool); - break; - case RECORDER_HEADER_NO_INPUT_TIMEOUT: - apt_size_value_generate(recorder_header->no_input_timeout,value,pool); - break; - case RECORDER_HEADER_COMPLETION_CAUSE: - { - apt_completion_cause_generate( - completion_cause_string_table, - RECORDER_COMPLETION_CAUSE_COUNT, - recorder_header->completion_cause, - value, - pool); - break; - } - case RECORDER_HEADER_COMPLETION_REASON: - *value = recorder_header->completion_reason; - break; - case RECORDER_HEADER_FAILED_URI: - *value = recorder_header->failed_uri; - break; - case RECORDER_HEADER_FAILED_URI_CAUSE: - *value = recorder_header->failed_uri_cause; - break; - case RECORDER_HEADER_RECORD_URI: - *value = recorder_header->record_uri; - break; - case RECORDER_HEADER_MEDIA_TYPE: - *value = recorder_header->media_type; - break; - case RECORDER_HEADER_MAX_TIME: - apt_size_value_generate(recorder_header->max_time,value,pool); - break; - case RECORDER_HEADER_TRIM_LENGTH: - apt_size_value_generate(recorder_header->trim_length,value,pool); - break; - case RECORDER_HEADER_FINAL_SILENCE: - apt_size_value_generate(recorder_header->final_silence,value,pool); - break; - case RECORDER_HEADER_CAPTURE_ON_SPEECH: - apt_boolean_value_generate(recorder_header->capture_on_speech,value,pool); - break; - case RECORDER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_generate(recorder_header->ver_buffer_utterance,value,pool); - break; - case RECORDER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_generate(recorder_header->start_input_timers,value,pool); - break; - case RECORDER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_generate(recorder_header->new_audio_channel,value,pool); - break; - default: - break; - } - return TRUE; -} - -/** Duplicate MRCP recorder header */ -static apt_bool_t mrcp_recorder_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_recorder_header_t *recorder_header = accessor->data; - const mrcp_recorder_header_t *src_recorder_header = src->data; - apt_bool_t status = TRUE; - - if(!recorder_header || !src_recorder_header) { - return FALSE; - } - - switch(id) { - case RECORDER_HEADER_SENSITIVITY_LEVEL: - recorder_header->sensitivity_level = src_recorder_header->sensitivity_level; - break; - case RECORDER_HEADER_NO_INPUT_TIMEOUT: - recorder_header->no_input_timeout = src_recorder_header->no_input_timeout; - break; - case RECORDER_HEADER_COMPLETION_CAUSE: - recorder_header->completion_cause = src_recorder_header->completion_cause; - break; - case RECORDER_HEADER_COMPLETION_REASON: - recorder_header->completion_reason = *value; - break; - case RECORDER_HEADER_FAILED_URI: - recorder_header->failed_uri = *value; - break; - case RECORDER_HEADER_FAILED_URI_CAUSE: - recorder_header->failed_uri_cause = *value; - break; - case RECORDER_HEADER_RECORD_URI: - recorder_header->record_uri = *value; - break; - case RECORDER_HEADER_MEDIA_TYPE: - recorder_header->media_type = *value; - break; - case RECORDER_HEADER_MAX_TIME: - recorder_header->max_time = src_recorder_header->max_time; - break; - case RECORDER_HEADER_TRIM_LENGTH: - recorder_header->trim_length = src_recorder_header->trim_length; - break; - case RECORDER_HEADER_FINAL_SILENCE: - recorder_header->final_silence = src_recorder_header->final_silence; - break; - case RECORDER_HEADER_CAPTURE_ON_SPEECH: - recorder_header->capture_on_speech = src_recorder_header->capture_on_speech; - break; - case RECORDER_HEADER_VER_BUFFER_UTTERANCE: - recorder_header->ver_buffer_utterance = src_recorder_header->ver_buffer_utterance; - break; - case RECORDER_HEADER_START_INPUT_TIMERS: - recorder_header->start_input_timers = src_recorder_header->start_input_timers; - break; - case RECORDER_HEADER_NEW_AUDIO_CHANNEL: - recorder_header->new_audio_channel = src_recorder_header->new_audio_channel; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t vtable = { - mrcp_recorder_header_allocate, - NULL, /* nothing to destroy */ - mrcp_recorder_header_parse, - mrcp_recorder_header_generate, - mrcp_recorder_header_duplicate, - recorder_header_string_table, - RECORDER_HEADER_COUNT -}; - -const mrcp_header_vtable_t* mrcp_recorder_header_vtable_get(mrcp_version_e version) -{ - return &vtable; -} - -MRCP_DECLARE(const apt_str_t*) mrcp_recorder_completion_cause_get( - mrcp_recorder_completion_cause_e completion_cause, - mrcp_version_e version) -{ - return apt_string_table_str_get(completion_cause_string_table,RECORDER_COMPLETION_CAUSE_COUNT,completion_cause); -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c deleted file mode 100644 index 28f4844f4e..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_recorder_resource.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recorder_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_recorder_resource.h" -#include "mrcp_recorder_header.h" -#include "mrcp_resource.h" - -/** String table of MRCP recorder methods (mrcp_recorder_method_id) */ -static const apt_str_table_item_t recorder_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},0}, - {{"RECORD", 6},0}, - {{"STOP", 4},2}, - {{"START-INPUT-TIMERS", 18},2} -}; - -/** String table of MRCP recorder events (mrcp_recorder_event_id) */ -static const apt_str_table_item_t recorder_event_string_table[] = { - {{"START-OF-INPUT", 14},0}, - {{"RECORD-COMPLETE", 15},0} -}; - -static APR_INLINE const apt_str_table_item_t* recorder_method_string_table_get(mrcp_version_e version) -{ - return recorder_method_string_table; -} - -static APR_INLINE const apt_str_table_item_t* recorder_event_string_table_get(mrcp_version_e version) -{ - return recorder_event_string_table; -} - -/** Create MRCP recorder resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_recorder_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = mrcp_resource_create(pool); - - resource->method_count = RECORDER_METHOD_COUNT; - resource->event_count = RECORDER_EVENT_COUNT; - resource->get_method_str_table = recorder_method_string_table_get; - resource->get_event_str_table = recorder_event_string_table_get; - resource->get_resource_header_vtable = mrcp_recorder_header_vtable_get; - return resource; -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c deleted file mode 100644 index 49e8c29ef3..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_header.c +++ /dev/null @@ -1,563 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_synth_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_synth_header.h" - -/** String table of MRCP synthesizer header fields (mrcp_synthesizer_header_id) */ -static const apt_str_table_item_t synth_header_string_table[] = { - {{"Jump-Size", 9},0}, - {{"Kill-On-Barge-In", 16},0}, - {{"Speaker-Profile", 15},8}, - {{"Completion-Cause", 16},16}, - {{"Completion-Reason", 17},13}, - {{"Voice-Gender", 12},6}, - {{"Voice-Age", 9},6}, - {{"Voice-Variant", 13},6}, - {{"Voice-Name", 10},8}, - {{"Prosody-Volume", 14},8}, - {{"Prosody-Rate", 12},12}, - {{"Speech-Marker", 13},7}, - {{"Speech-Language", 15},7}, - {{"Fetch-Hint", 10},2}, - {{"Audio-Fetch-Hint", 16},0}, - {{"Failed-Uri", 10},10}, - {{"Failed-Uri_Cause", 16},10}, - {{"Speak-Restart", 13},13}, - {{"Speak-Length", 12},6}, - {{"Load-Lexicon", 12},2}, - {{"Lexicon-Search-Order",20},2} -}; - -/** String table of MRCP speech-unit fields (mrcp_speech_unit_t) */ -static const apt_str_table_item_t speech_unit_string_table[] = { - {{"Second", 6},2}, - {{"Word", 4},0}, - {{"Sentence", 8},2}, - {{"Paragraph",9},0} -}; - -/** String table of MRCP voice-gender fields (mrcp_voice_gender_t) */ -static const apt_str_table_item_t voice_gender_string_table[] = { - {{"male", 4},0}, - {{"female", 6},0}, - {{"neutral",7},0} -}; - -/** String table of MRCP prosody-volume fields (mrcp_prosody_volume_t) */ -static const apt_str_table_item_t prosody_volume_string_table[] = { - {{"silent", 6},1}, - {{"x-soft", 6},2}, - {{"soft", 4},3}, - {{"medium", 6},0}, - {{"loud", 4},0}, - {{"x-loud", 6},5}, - {{"default",7},0} -}; - -/** String table of MRCP prosody-rate fields (mrcp_prosody_rate_t) */ -static const apt_str_table_item_t prosody_rate_string_table[] = { - {{"x-slow", 6},3}, - {{"slow", 4},0}, - {{"medium", 6},0}, - {{"fast", 4},0}, - {{"x-fast", 6},4}, - {{"default",7},0} -}; - -/** String table of MRCP synthesizer completion-cause fields (mrcp_synthesizer_completion_cause_t) */ -static const apt_str_table_item_t completion_cause_string_table[] = { - {{"normal", 6},0}, - {{"barge-in", 8},0}, - {{"parse-failure", 13},0}, - {{"uri-failure", 11},0}, - {{"error", 5},0}, - {{"language-unsupported",20},4}, - {{"lexicon-load-failure",20},1}, - {{"cancelled", 9},0} -}; - - -static APR_INLINE apr_size_t apt_string_table_value_parse(const apt_str_table_item_t *string_table, size_t count, const apt_str_t *value) -{ - return apt_string_table_id_find(string_table,count,value); -} - -static apt_bool_t apt_string_table_value_pgenerate(const apt_str_table_item_t *string_table, apr_size_t count, apr_size_t id, apt_str_t *str, apr_pool_t *pool) -{ - const apt_str_t *name = apt_string_table_str_get(string_table,count,id); - if(!name) { - return FALSE; - } - - apt_string_copy(str,name,pool); - return TRUE; -} - -/** Parse MRCP prosody-rate value */ -static apt_bool_t mrcp_prosody_param_rate_parse(mrcp_prosody_rate_t *prosody_rate, const apt_str_t *value, apr_pool_t *pool) -{ - if(!value->length) { - return FALSE; - } - - /** For the rate attribute, relative changes are a number. (not preceded by a "+" or "-")(w3c ssml)*/ - if('0'<=value->buf[0] && value->buf[0]<='9') { - prosody_rate->type = PROSODY_RATE_TYPE_RELATIVE_CHANGE; - } - else { - prosody_rate->type = PROSODY_RATE_TYPE_LABEL; - } - - if(prosody_rate->type == PROSODY_RATE_TYPE_RELATIVE_CHANGE) { - prosody_rate->value.relative = apt_float_value_parse(value); - } - else { - prosody_rate->value.label = apt_string_table_value_parse(prosody_rate_string_table,PROSODY_RATE_COUNT,value); - } - - return TRUE; -} - -/** Generate MRCP prosody-rate value */ -static apt_bool_t mrcp_prosody_rate_generate(mrcp_prosody_rate_t *prosody_rate, apt_str_t *str, apr_pool_t *pool) -{ - if(prosody_rate->type == PROSODY_RATE_TYPE_LABEL) { - apt_string_table_value_pgenerate( - prosody_rate_string_table, - PROSODY_RATE_COUNT, - prosody_rate->value.label, - str, - pool); - } - else { - apt_float_value_generate(prosody_rate->value.relative,str,pool); - } - - return TRUE; -} - -/** Parse MRCP prosody-volume value */ -static apt_bool_t mrcp_prosody_param_volume_parse(mrcp_prosody_volume_t *prosody_volume, const apt_str_t *value, apr_pool_t *pool) -{ - if(!value->length) { - return FALSE; - } - - /** For the volume attribute, relative changes are a number preceded by "+" or "-" (w3c ssml)*/ - if(value->buf[0]=='+' || value->buf[0]=='-') { - prosody_volume->type = PROSODY_VOLUME_TYPE_RELATIVE_CHANGE; - } - else if('0'<=value->buf[0] && value->buf[0]<='9') { - prosody_volume->type = PROSODY_VOLUME_TYPE_NUMERIC; - } - else { - prosody_volume->type = PROSODY_VOLUME_TYPE_LABEL; - } - - if(prosody_volume->type == PROSODY_VOLUME_TYPE_RELATIVE_CHANGE) { - prosody_volume->value.relative = apt_float_value_parse(value); - } - else if(prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) { - prosody_volume->value.numeric = apt_float_value_parse(value); - } - else { - prosody_volume->value.label = apt_string_table_value_parse(prosody_volume_string_table,PROSODY_VOLUME_COUNT,value); - } - - return TRUE; -} - -/** Generate MRCP prosody-volume value */ -static apt_bool_t mrcp_prosody_volume_generate(mrcp_prosody_volume_t *prosody_volume, apt_str_t *str, apr_pool_t *pool) -{ - if(prosody_volume->type == PROSODY_VOLUME_TYPE_LABEL) { - apt_string_table_value_pgenerate( - prosody_volume_string_table, - PROSODY_VOLUME_COUNT, - prosody_volume->value.label, - str, - pool); - } - else if (prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) { - apt_float_value_generate(prosody_volume->value.numeric,str,pool); - } - else { - apt_float_value_generate(prosody_volume->value.relative,str,pool); - } - - return TRUE; -} - -/** Parse MRCP speech-length value */ -static apt_bool_t mrcp_speech_length_value_parse(mrcp_speech_length_value_t *speech_length, const apt_str_t *value, apr_pool_t *pool) -{ - if(!value->length) { - return FALSE; - } - - switch(*value->buf) { - case '+': speech_length->type = SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE; break; - case '-': speech_length->type = SPEECH_LENGTH_TYPE_NUMERIC_NEGATIVE; break; - default : speech_length->type = SPEECH_LENGTH_TYPE_TEXT; - } - - if(speech_length->type == SPEECH_LENGTH_TYPE_TEXT) { - apt_string_copy(&speech_length->value.tag,value,pool); - } - else { - mrcp_numeric_speech_length_t *numeric = &speech_length->value.numeric; - apt_str_t str; - apt_text_stream_t stream; - stream.text = *value; - apt_text_stream_reset(&stream); - stream.pos++; - if(apt_text_field_read(&stream,APT_TOKEN_SP,TRUE,&str) == FALSE) { - return FALSE; - } - numeric->length = apt_size_value_parse(&str); - - if(apt_text_field_read(&stream,APT_TOKEN_SP,TRUE,&str) == FALSE) { - return FALSE; - } - numeric->unit = apt_string_table_value_parse(speech_unit_string_table,SPEECH_UNIT_COUNT,&str); - } - return TRUE; -} - -/** Generate MRCP speech-length value */ -static apt_bool_t mrcp_speech_length_generate(mrcp_speech_length_value_t *speech_length, apt_str_t *str, apr_pool_t *pool) -{ - if(speech_length->type == SPEECH_LENGTH_TYPE_TEXT) { - apt_str_t *tag = &speech_length->value.tag; - if(tag->length) { - apt_string_copy(str,tag,pool); - } - } - else { - const apt_str_t *unit_name = apt_string_table_str_get( - speech_unit_string_table, - SPEECH_UNIT_COUNT, - speech_length->value.numeric.unit); - if(!unit_name) { - return FALSE; - } - - str->buf = apr_psprintf(pool, "%c%"APR_SIZE_T_FMT" %s", - speech_length->type == SPEECH_LENGTH_TYPE_NUMERIC_POSITIVE ? '+' : '-', - speech_length->value.numeric.length, - unit_name->buf); - str->length = strlen(str->buf); - } - return TRUE; -} - -/** Initialize synthesizer header */ -static void mrcp_synth_header_init(mrcp_synth_header_t *synth_header) -{ - synth_header->jump_size.type = SPEECH_LENGTH_TYPE_UNKNOWN; - synth_header->kill_on_barge_in = FALSE; - apt_string_reset(&synth_header->speaker_profile); - synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_UNKNOWN; - apt_string_reset(&synth_header->completion_reason); - synth_header->voice_param.gender = VOICE_GENDER_UNKNOWN; - synth_header->voice_param.age = 0; - synth_header->voice_param.variant = 0; - apt_string_reset(&synth_header->voice_param.name); - synth_header->prosody_param.volume.type = PROSODY_VOLUME_TYPE_UNKNOWN; - synth_header->prosody_param.rate.type = PROSODY_RATE_TYPE_UNKNOWN; - apt_string_reset(&synth_header->speech_marker); - apt_string_reset(&synth_header->speech_language); - apt_string_reset(&synth_header->fetch_hint); - apt_string_reset(&synth_header->audio_fetch_hint); - apt_string_reset(&synth_header->failed_uri); - apt_string_reset(&synth_header->failed_uri_cause); - synth_header->speak_restart = FALSE; - synth_header->speak_length.type = SPEECH_LENGTH_TYPE_UNKNOWN; - synth_header->load_lexicon = FALSE; - apt_string_reset(&synth_header->lexicon_search_order); -} - - -/** Allocate MRCP synthesizer header */ -static void* mrcp_synth_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_synth_header_t *synth_header = apr_palloc(pool,sizeof(mrcp_synth_header_t)); - mrcp_synth_header_init(synth_header); - accessor->data = synth_header; - return accessor->data; -} - -/** Parse MRCP synthesizer header */ -static apt_bool_t mrcp_synth_header_parse(mrcp_header_accessor_t *accessor, size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - mrcp_synth_header_t *synth_header = accessor->data; - switch(id) { - case SYNTHESIZER_HEADER_JUMP_SIZE: - mrcp_speech_length_value_parse(&synth_header->jump_size,value,pool); - break; - case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN: - apt_boolean_value_parse(value,&synth_header->kill_on_barge_in); - break; - case SYNTHESIZER_HEADER_SPEAKER_PROFILE: - synth_header->speaker_profile = *value; - break; - case SYNTHESIZER_HEADER_COMPLETION_CAUSE: - synth_header->completion_cause = apt_size_value_parse(value); - break; - case SYNTHESIZER_HEADER_COMPLETION_REASON: - synth_header->completion_reason = *value; - break; - case SYNTHESIZER_HEADER_VOICE_GENDER: - synth_header->voice_param.gender = apt_string_table_value_parse(voice_gender_string_table,VOICE_GENDER_COUNT,value); - break; - case SYNTHESIZER_HEADER_VOICE_AGE: - synth_header->voice_param.age = apt_size_value_parse(value); - break; - case SYNTHESIZER_HEADER_VOICE_VARIANT: - synth_header->voice_param.variant = apt_size_value_parse(value); - break; - case SYNTHESIZER_HEADER_VOICE_NAME: - synth_header->voice_param.name = *value; - break; - case SYNTHESIZER_HEADER_PROSODY_VOLUME: - mrcp_prosody_param_volume_parse(&synth_header->prosody_param.volume,value,pool); - break; - case SYNTHESIZER_HEADER_PROSODY_RATE: - mrcp_prosody_param_rate_parse(&synth_header->prosody_param.rate,value,pool); - break; - case SYNTHESIZER_HEADER_SPEECH_MARKER: - synth_header->speech_marker = *value; - break; - case SYNTHESIZER_HEADER_SPEECH_LANGUAGE: - synth_header->speech_language = *value; - break; - case SYNTHESIZER_HEADER_FETCH_HINT: - synth_header->fetch_hint = *value; - break; - case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT: - synth_header->audio_fetch_hint = *value; - break; - case SYNTHESIZER_HEADER_FAILED_URI: - synth_header->failed_uri = *value; - break; - case SYNTHESIZER_HEADER_FAILED_URI_CAUSE: - synth_header->failed_uri_cause = *value; - break; - case SYNTHESIZER_HEADER_SPEAK_RESTART: - apt_boolean_value_parse(value,&synth_header->speak_restart); - break; - case SYNTHESIZER_HEADER_SPEAK_LENGTH: - mrcp_speech_length_value_parse(&synth_header->speak_length,value,pool); - break; - case SYNTHESIZER_HEADER_LOAD_LEXICON: - apt_boolean_value_parse(value,&synth_header->load_lexicon); - break; - case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER: - synth_header->lexicon_search_order = *value; - break; - default: - status = FALSE; - } - return status; -} - -/** Generate MRCP synthesizer header */ -static apt_bool_t mrcp_synth_header_generate(const mrcp_header_accessor_t *accessor, size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_synth_header_t *synth_header = accessor->data; - switch(id) { - case SYNTHESIZER_HEADER_JUMP_SIZE: - mrcp_speech_length_generate(&synth_header->jump_size,value,pool); - break; - case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN: - apt_boolean_value_generate(synth_header->kill_on_barge_in,value,pool); - break; - case SYNTHESIZER_HEADER_SPEAKER_PROFILE: - *value = synth_header->speaker_profile,value; - break; - case SYNTHESIZER_HEADER_COMPLETION_CAUSE: - apt_completion_cause_generate( - completion_cause_string_table, - SYNTHESIZER_COMPLETION_CAUSE_COUNT, - synth_header->completion_cause, - value, - pool); - break; - case SYNTHESIZER_HEADER_COMPLETION_REASON: - *value = synth_header->completion_reason; - break; - case SYNTHESIZER_HEADER_VOICE_GENDER: - apt_string_table_value_pgenerate( - voice_gender_string_table, - VOICE_GENDER_COUNT, - synth_header->voice_param.gender, - value, - pool); - break; - case SYNTHESIZER_HEADER_VOICE_AGE: - apt_size_value_generate(synth_header->voice_param.age,value,pool); - break; - case SYNTHESIZER_HEADER_VOICE_VARIANT: - apt_size_value_generate(synth_header->voice_param.variant,value,pool); - break; - case SYNTHESIZER_HEADER_VOICE_NAME: - *value = synth_header->voice_param.name,value; - break; - case SYNTHESIZER_HEADER_PROSODY_VOLUME: - mrcp_prosody_volume_generate(&synth_header->prosody_param.volume,value,pool); - break; - case SYNTHESIZER_HEADER_PROSODY_RATE: - mrcp_prosody_rate_generate(&synth_header->prosody_param.rate,value,pool); - break; - case SYNTHESIZER_HEADER_SPEECH_MARKER: - *value = synth_header->speech_marker; - break; - case SYNTHESIZER_HEADER_SPEECH_LANGUAGE: - *value = synth_header->speech_language; - break; - case SYNTHESIZER_HEADER_FETCH_HINT: - *value = synth_header->fetch_hint; - break; - case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT: - *value = synth_header->audio_fetch_hint; - break; - case SYNTHESIZER_HEADER_FAILED_URI: - *value = synth_header->failed_uri; - break; - case SYNTHESIZER_HEADER_FAILED_URI_CAUSE: - *value = synth_header->failed_uri_cause; - break; - case SYNTHESIZER_HEADER_SPEAK_RESTART: - apt_boolean_value_generate(synth_header->speak_restart,value,pool); - break; - case SYNTHESIZER_HEADER_SPEAK_LENGTH: - mrcp_speech_length_generate(&synth_header->speak_length,value,pool); - break; - case SYNTHESIZER_HEADER_LOAD_LEXICON: - apt_boolean_value_generate(synth_header->load_lexicon,value,pool); - break; - case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER: - *value = synth_header->lexicon_search_order; - break; - default: - break; - } - return TRUE; -} - -/** Duplicate MRCP synthesizer header */ -static apt_bool_t mrcp_synth_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_synth_header_t *synth_header = accessor->data; - const mrcp_synth_header_t *src_synth_header = src->data; - apt_bool_t status = TRUE; - - if(!synth_header || !src_synth_header) { - return FALSE; - } - - switch(id) { - case SYNTHESIZER_HEADER_JUMP_SIZE: - synth_header->jump_size = src_synth_header->jump_size; - break; - case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN: - synth_header->kill_on_barge_in = src_synth_header->kill_on_barge_in; - break; - case SYNTHESIZER_HEADER_SPEAKER_PROFILE: - synth_header->speaker_profile = *value; - break; - case SYNTHESIZER_HEADER_COMPLETION_CAUSE: - synth_header->completion_cause = src_synth_header->completion_cause; - break; - case SYNTHESIZER_HEADER_COMPLETION_REASON: - synth_header->completion_reason = *value; - break; - case SYNTHESIZER_HEADER_VOICE_GENDER: - synth_header->voice_param.gender = src_synth_header->voice_param.gender; - break; - case SYNTHESIZER_HEADER_VOICE_AGE: - synth_header->voice_param.age = src_synth_header->voice_param.age; - break; - case SYNTHESIZER_HEADER_VOICE_VARIANT: - synth_header->voice_param.variant = src_synth_header->voice_param.variant; - break; - case SYNTHESIZER_HEADER_VOICE_NAME: - synth_header->voice_param.name = *value; - break; - case SYNTHESIZER_HEADER_PROSODY_VOLUME: - synth_header->prosody_param.volume = src_synth_header->prosody_param.volume; - break; - case SYNTHESIZER_HEADER_PROSODY_RATE: - synth_header->prosody_param.rate = src_synth_header->prosody_param.rate; - break; - case SYNTHESIZER_HEADER_SPEECH_MARKER: - synth_header->speech_marker = *value; - break; - case SYNTHESIZER_HEADER_SPEECH_LANGUAGE: - synth_header->speech_language = *value; - break; - case SYNTHESIZER_HEADER_FETCH_HINT: - synth_header->fetch_hint = *value; - break; - case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT: - synth_header->audio_fetch_hint = *value; - break; - case SYNTHESIZER_HEADER_FAILED_URI: - synth_header->failed_uri = *value; - break; - case SYNTHESIZER_HEADER_FAILED_URI_CAUSE: - synth_header->failed_uri_cause = *value; - break; - case SYNTHESIZER_HEADER_SPEAK_RESTART: - synth_header->speak_restart = src_synth_header->speak_restart; - break; - case SYNTHESIZER_HEADER_SPEAK_LENGTH: - synth_header->speak_length = src_synth_header->speak_length; - break; - case SYNTHESIZER_HEADER_LOAD_LEXICON: - synth_header->load_lexicon = src_synth_header->load_lexicon; - break; - case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER: - synth_header->lexicon_search_order = *value; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t vtable = { - mrcp_synth_header_allocate, - NULL, /* nothing to destroy */ - mrcp_synth_header_parse, - mrcp_synth_header_generate, - mrcp_synth_header_duplicate, - synth_header_string_table, - SYNTHESIZER_HEADER_COUNT -}; - -const mrcp_header_vtable_t* mrcp_synth_header_vtable_get(mrcp_version_e version) -{ - return &vtable; -} - -MRCP_DECLARE(const apt_str_t*) mrcp_synth_completion_cause_get(mrcp_synth_completion_cause_e completion_cause, mrcp_version_e version) -{ - return apt_string_table_str_get(completion_cause_string_table,SYNTHESIZER_COMPLETION_CAUSE_COUNT,completion_cause); -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c deleted file mode 100644 index 795672043c..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_synth_resource.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_synth_resource.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "mrcp_synth_resource.h" -#include "mrcp_synth_header.h" -#include "mrcp_resource.h" - -/** String table of MRCP synthesizer methods (mrcp_synthesizer_method_id) */ -static const apt_str_table_item_t synth_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},0}, - {{"SPEAK", 5},1}, - {{"STOP", 4},1}, - {{"PAUSE", 5},0}, - {{"RESUME", 6},0}, - {{"BARGE-IN-OCCURRED",17},0}, - {{"CONTROL", 7},0}, - {{"DEFINE-LEXICON", 14},0} -}; - -/** String table of MRCP synthesizer events (mrcp_synthesizer_event_id) */ -static const apt_str_table_item_t synth_event_string_table[] = { - {{"SPEECH-MARKER", 13},3}, - {{"SPEAK-COMPLETE",14},3} -}; - -static APR_INLINE const apt_str_table_item_t* synth_method_string_table_get(mrcp_version_e version) -{ - return synth_method_string_table; -} - -static APR_INLINE const apt_str_table_item_t* synth_event_string_table_get(mrcp_version_e version) -{ - return synth_event_string_table; -} - -/** Create MRCP synthesizer resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_synth_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = mrcp_resource_create(pool); - - resource->method_count = SYNTHESIZER_METHOD_COUNT; - resource->event_count = SYNTHESIZER_EVENT_COUNT; - resource->get_method_str_table = synth_method_string_table_get; - resource->get_event_str_table = synth_event_string_table_get; - resource->get_resource_header_vtable = mrcp_synth_header_vtable_get; - return resource; -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c deleted file mode 100644 index a0c32d0424..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_header.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: - */ - -#include "mrcp_verifier_header.h" - -/** String table of MRCP verifier header fields (mrcp_verifier_header_id) */ -static const apt_str_table_item_t verifier_header_string_table[] = { - {{"Repository-URI", 14},0}, - {{"Voiceprint-Identifier", 21},12}, - {{"Verification-Mode", 17},6}, - {{"Adapt-Model", 11},1}, - {{"Abort-Model", 11},11}, - {{"Min-Verification-Score", 22},1}, - {{"Num-Min-Verification-Phrases",28},6}, - {{"Num-Max-Verification-Phrases",28},5}, - {{"No-Input-Timeout", 16},2}, - {{"Save-Waveform", 13},4}, - {{"Media-Type", 10},2}, - {{"Waveform-URI", 12},0}, - {{"Voiceprint-Exists", 17},11}, - {{"Ver-Buffer-Utterance", 20},4}, - {{"Input-Waveform-URI", 18},0}, - {{"Completion-Cause", 16},11}, - {{"Completion-Reason", 17},15}, - {{"Speech-Complete-Timeout", 23},1}, - {{"New-Audio-Channel", 17},2}, - {{"Abort-Verification", 18},6}, - {{"Start-Input-Timers", 18},1} -}; - -/** String table of MRCP verifier completion-cause fields (mrcp_verifier_completion_cause_e) */ -static const apt_str_table_item_t completion_cause_string_table[] = { - {{"success", 7},2}, - {{"error", 5},0}, - {{"no-input-timeout", 16},0}, - {{"too-much-speech-timeout",23},0}, - {{"speech-too-early", 16},9}, - {{"buffer-empty", 12},0}, - {{"out-of-sequence", 15},0}, - {{"repository-uri-failure", 22},15}, - {{"repository-uri-missing", 22},15}, - {{"voiceprint-id-missing", 21},14}, - {{"voiceprint-id-not-exist",23},14}, - {{"speech-not-usable", 17},7} -}; - - -/** Initialize verifier header */ -static void mrcp_verifier_header_init(mrcp_verifier_header_t *verifier_header) -{ - apt_string_reset(&verifier_header->repository_uri); - apt_string_reset(&verifier_header->voiceprint_identifier); - apt_string_reset(&verifier_header->verification_mode); - verifier_header->adapt_model = FALSE; - verifier_header->abort_model = FALSE; - verifier_header->min_verification_score = 0.0; - verifier_header->num_min_verification_phrases = 0; - verifier_header->num_max_verification_phrases = 0; - verifier_header->no_input_timeout = 0; - verifier_header->save_waveform = FALSE; - apt_string_reset(&verifier_header->media_type); - apt_string_reset(&verifier_header->waveform_uri); - verifier_header->voiceprint_exists = FALSE; - verifier_header->ver_buffer_utterance = FALSE; - apt_string_reset(&verifier_header->input_waveform_uri); - verifier_header->completion_cause = VERIFIER_COMPLETION_CAUSE_UNKNOWN; - apt_string_reset(&verifier_header->completion_reason); - verifier_header->speech_complete_timeout = 0; - verifier_header->new_audio_channel = FALSE; - verifier_header->abort_verification = FALSE; - verifier_header->start_input_timers = FALSE; -} - -/** Allocate MRCP verifier header */ -static void* mrcp_verifier_header_allocate(mrcp_header_accessor_t *accessor, apr_pool_t *pool) -{ - mrcp_verifier_header_t *verifier_header = apr_palloc(pool,sizeof(mrcp_verifier_header_t)); - mrcp_verifier_header_init(verifier_header); - accessor->data = verifier_header; - return accessor->data; -} - -/** Parse MRCP verifier header */ -static apt_bool_t mrcp_verifier_header_parse(mrcp_header_accessor_t *accessor, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_verifier_header_t *verifier_header = accessor->data; - apt_bool_t status = TRUE; - switch(id) { - case VERIFIER_HEADER_REPOSITORY_URI: - verifier_header->repository_uri = *value; - break; - case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER: - verifier_header->voiceprint_identifier = *value; - break; - case VERIFIER_HEADER_VERIFICATION_MODE: - verifier_header->verification_mode = *value; - break; - case VERIFIER_HEADER_ADAPT_MODEL: - apt_boolean_value_parse(value,&verifier_header->adapt_model); - break; - case VERIFIER_HEADER_ABORT_MODEL: - apt_boolean_value_parse(value,&verifier_header->abort_model); - break; - case VERIFIER_HEADER_MIN_VERIFICATION_SCORE: - verifier_header->min_verification_score = apt_float_value_parse(value); - break; - case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES: - verifier_header->num_min_verification_phrases = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES: - verifier_header->num_max_verification_phrases = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_NO_INPUT_TIMEOUT: - verifier_header->no_input_timeout = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_SAVE_WAVEFORM: - apt_boolean_value_parse(value,&verifier_header->save_waveform); - break; - case VERIFIER_HEADER_MEDIA_TYPE: - verifier_header->media_type = *value; - break; - case VERIFIER_HEADER_WAVEFORM_URI: - verifier_header->waveform_uri = *value; - break; - case VERIFIER_HEADER_VOICEPRINT_EXISTS: - apt_boolean_value_parse(value,&verifier_header->voiceprint_exists); - break; - case VERIFIER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_parse(value,&verifier_header->ver_buffer_utterance); - break; - case VERIFIER_HEADER_INPUT_WAVEFORM_URI: - verifier_header->input_waveform_uri = *value; - break; - case VERIFIER_HEADER_COMPLETION_CAUSE: - verifier_header->completion_cause = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_COMPLETION_REASON: - verifier_header->completion_reason = *value; - break; - case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT: - verifier_header->speech_complete_timeout = apt_size_value_parse(value); - break; - case VERIFIER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_parse(value,&verifier_header->new_audio_channel); - break; - case VERIFIER_HEADER_ABORT_VERIFICATION: - apt_boolean_value_parse(value,&verifier_header->abort_verification); - break; - case VERIFIER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_parse(value,&verifier_header->start_input_timers); - break; - default: - status = FALSE; - } - return status; -} - -/** Generate MRCP verifier header */ -static apt_bool_t mrcp_verifier_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool) -{ - mrcp_verifier_header_t *verifier_header = accessor->data; - switch(id) { - case VERIFIER_HEADER_REPOSITORY_URI: - *value = verifier_header->repository_uri; - break; - case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER: - *value = verifier_header->voiceprint_identifier; - break; - case VERIFIER_HEADER_VERIFICATION_MODE: - *value = verifier_header->verification_mode; - break; - case VERIFIER_HEADER_ADAPT_MODEL: - apt_boolean_value_generate(verifier_header->adapt_model,value,pool); - break; - case VERIFIER_HEADER_ABORT_MODEL: - apt_boolean_value_generate(verifier_header->abort_model,value,pool); - break; - case VERIFIER_HEADER_MIN_VERIFICATION_SCORE: - apt_float_value_generate(verifier_header->min_verification_score,value,pool); - break; - case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES: - apt_size_value_generate(verifier_header->num_min_verification_phrases,value,pool); - break; - case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES: - apt_size_value_generate(verifier_header->num_max_verification_phrases,value,pool); - break; - case VERIFIER_HEADER_NO_INPUT_TIMEOUT: - apt_size_value_generate(verifier_header->no_input_timeout,value,pool); - break; - case VERIFIER_HEADER_SAVE_WAVEFORM: - apt_boolean_value_generate(verifier_header->save_waveform,value,pool); - break; - case VERIFIER_HEADER_MEDIA_TYPE: - *value = verifier_header->media_type; - break; - case VERIFIER_HEADER_WAVEFORM_URI: - *value = verifier_header->waveform_uri; - break; - case VERIFIER_HEADER_VOICEPRINT_EXISTS: - apt_boolean_value_generate(verifier_header->voiceprint_exists,value,pool); - break; - case VERIFIER_HEADER_VER_BUFFER_UTTERANCE: - apt_boolean_value_generate(verifier_header->ver_buffer_utterance,value,pool); - break; - case VERIFIER_HEADER_INPUT_WAVEFORM_URI: - *value = verifier_header->input_waveform_uri; - break; - case VERIFIER_HEADER_COMPLETION_CAUSE: - apt_completion_cause_generate( - completion_cause_string_table, - VERIFIER_COMPLETION_CAUSE_COUNT, - verifier_header->completion_cause, - value, - pool); - break; - case VERIFIER_HEADER_COMPLETION_REASON: - *value = verifier_header->completion_reason; - break; - case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT: - apt_size_value_generate(verifier_header->speech_complete_timeout,value,pool); - break; - case VERIFIER_HEADER_NEW_AUDIO_CHANNEL: - apt_boolean_value_generate(verifier_header->new_audio_channel,value,pool); - break; - case VERIFIER_HEADER_ABORT_VERIFICATION: - apt_boolean_value_generate(verifier_header->abort_verification,value,pool); - break; - case VERIFIER_HEADER_START_INPUT_TIMERS: - apt_boolean_value_generate(verifier_header->start_input_timers,value,pool); - break; - default: - break; - } - return TRUE; -} - -/** Duplicate MRCP verifier header */ -static apt_bool_t mrcp_verifier_header_duplicate(mrcp_header_accessor_t *accessor, const mrcp_header_accessor_t *src, apr_size_t id, const apt_str_t *value, apr_pool_t *pool) -{ - mrcp_verifier_header_t *verifier_header = accessor->data; - const mrcp_verifier_header_t *src_verifier_header = src->data; - apt_bool_t status = TRUE; - - if(!verifier_header || !src_verifier_header) { - return FALSE; - } - - switch(id) { - case VERIFIER_HEADER_REPOSITORY_URI: - verifier_header->repository_uri = *value; - break; - case VERIFIER_HEADER_VOICEPRINT_IDENTIFIER: - verifier_header->voiceprint_identifier = *value; - break; - case VERIFIER_HEADER_VERIFICATION_MODE: - verifier_header->verification_mode = *value; - break; - case VERIFIER_HEADER_ADAPT_MODEL: - verifier_header->adapt_model = src_verifier_header->adapt_model; - break; - case VERIFIER_HEADER_ABORT_MODEL: - verifier_header->abort_model = src_verifier_header->abort_model; - break; - case VERIFIER_HEADER_MIN_VERIFICATION_SCORE: - verifier_header->min_verification_score = src_verifier_header->min_verification_score; - break; - case VERIFIER_HEADER_NUM_MIN_VERIFICATION_PHRASES: - verifier_header->num_min_verification_phrases = src_verifier_header->num_min_verification_phrases; - break; - case VERIFIER_HEADER_NUM_MAX_VERIFICATION_PHRASES: - verifier_header->num_max_verification_phrases = src_verifier_header->num_max_verification_phrases; - break; - case VERIFIER_HEADER_NO_INPUT_TIMEOUT: - verifier_header->no_input_timeout = src_verifier_header->no_input_timeout; - break; - case VERIFIER_HEADER_SAVE_WAVEFORM: - verifier_header->save_waveform = src_verifier_header->save_waveform; - break; - case VERIFIER_HEADER_MEDIA_TYPE: - verifier_header->media_type = *value; - break; - case VERIFIER_HEADER_WAVEFORM_URI: - verifier_header->waveform_uri = *value; - break; - case VERIFIER_HEADER_VOICEPRINT_EXISTS: - verifier_header->voiceprint_exists = src_verifier_header->voiceprint_exists; - break; - case VERIFIER_HEADER_VER_BUFFER_UTTERANCE: - verifier_header->ver_buffer_utterance = src_verifier_header->ver_buffer_utterance; - break; - case VERIFIER_HEADER_INPUT_WAVEFORM_URI: - verifier_header->input_waveform_uri = *value; - break; - case VERIFIER_HEADER_COMPLETION_CAUSE: - verifier_header->completion_cause = src_verifier_header->completion_cause; - break; - case VERIFIER_HEADER_COMPLETION_REASON: - verifier_header->completion_reason = *value; - break; - case VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT: - verifier_header->speech_complete_timeout = src_verifier_header->speech_complete_timeout; - break; - case VERIFIER_HEADER_NEW_AUDIO_CHANNEL: - verifier_header->new_audio_channel = src_verifier_header->new_audio_channel; - break; - case VERIFIER_HEADER_ABORT_VERIFICATION: - verifier_header->abort_verification = src_verifier_header->abort_verification; - break; - case VERIFIER_HEADER_START_INPUT_TIMERS: - verifier_header->start_input_timers = src_verifier_header->start_input_timers; - break; - default: - status = FALSE; - } - return status; -} - -static const mrcp_header_vtable_t header_vtable = { - mrcp_verifier_header_allocate, - NULL, /* nothing to destroy */ - mrcp_verifier_header_parse, - mrcp_verifier_header_generate, - mrcp_verifier_header_duplicate, - verifier_header_string_table, - VERIFIER_HEADER_COUNT -}; - -const mrcp_header_vtable_t* mrcp_verifier_header_vtable_get(mrcp_version_e version) -{ - return &header_vtable; -} - -MRCP_DECLARE(const apt_str_t*) mrcp_verifier_completion_cause_get(mrcp_verifier_completion_cause_e completion_cause, mrcp_version_e version) -{ - const apt_str_table_item_t *table = completion_cause_string_table; - return apt_string_table_str_get(table,VERIFIER_COMPLETION_CAUSE_COUNT,completion_cause); -} diff --git a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c b/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c deleted file mode 100644 index 6f430a6619..0000000000 --- a/libs/unimrcp/libs/mrcp/resources/src/mrcp_verifier_resource.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: - */ - -#include "mrcp_verifier_resource.h" -#include "mrcp_verifier_header.h" -#include "mrcp_resource.h" - -/** String table of MRCP verifier methods (mrcp_verifier_method_id) */ -static const apt_str_table_item_t verifier_method_string_table[] = { - {{"SET-PARAMS", 10},10}, - {{"GET-PARAMS", 10},10}, - {{"START-SESSION", 13},8}, - {{"END-SESSION", 11},0}, - {{"QUERY-VOICEPRINT", 16},0}, - {{"DELETE-VOICEPRINT", 17},0}, - {{"VERIFY", 6},6}, - {{"VERIFY-FROM-BUFFER", 18},7}, - {{"VERIFY-ROLLBACK", 15},7}, - {{"STOP", 4},2}, - {{"CLEAR-BUFFER", 12},0}, - {{"START-INPUT-TIMERS", 18},6}, - {{"GET-INTERMEDIATE-RESULT",23},4}, -}; - -/** String table of MRCP verifier events (mrcp_verifier_event_id) */ -static const apt_str_table_item_t verifier_event_string_table[] = { - {{"START-OF-INPUT", 14},0}, - {{"VERIFICATION-COMPLETE",21},0}, -}; - -static APR_INLINE const apt_str_table_item_t* verifier_method_string_table_get(mrcp_version_e version) -{ - return verifier_method_string_table; -} - -static APR_INLINE const apt_str_table_item_t* verifier_event_string_table_get(mrcp_version_e version) -{ - return verifier_event_string_table; -} - - -/** Create MRCP verifier resource */ -MRCP_DECLARE(mrcp_resource_t*) mrcp_verifier_resource_create(apr_pool_t *pool) -{ - mrcp_resource_t *resource = mrcp_resource_create(pool); - - resource->method_count = VERIFIER_METHOD_COUNT; - resource->event_count = VERIFIER_EVENT_COUNT; - resource->get_method_str_table = verifier_method_string_table_get; - resource->get_event_str_table = verifier_event_string_table_get; - resource->get_resource_header_vtable = mrcp_verifier_header_vtable_get; - return resource; -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/Makefile.am b/libs/unimrcp/libs/mrcpv2-transport/Makefile.am deleted file mode 100644 index c2ffac4ef0..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libmrcpv2transport.la - -include_HEADERS = include/mrcp_connection_types.h \ - include/mrcp_control_descriptor.h \ - include/mrcp_connection.h \ - include/mrcp_client_connection.h \ - include/mrcp_server_connection.h \ - include/mrcp_ca_factory.h - -libmrcpv2transport_la_SOURCES = src/mrcp_control_descriptor.c \ - src/mrcp_connection.c \ - src/mrcp_client_connection.c \ - src/mrcp_server_connection.c \ - src/mrcp_ca_factory.c diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h deleted file mode 100644 index 599a4e60b7..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_ca_factory.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_ca_factory.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CA_FACTORY_H -#define MRCP_CA_FACTORY_H - -/** - * @file mrcp_ca_factory.h - * @brief Factory of MRCPv2 Connection Agents - */ - -#include "mrcp_connection_types.h" - -APT_BEGIN_EXTERN_C - -/** Create factory of connection agents. */ -MRCP_DECLARE(mrcp_ca_factory_t*) mrcp_ca_factory_create(apr_pool_t *pool); - -/** Add connection agent to factory. */ -MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_agent_add(mrcp_ca_factory_t *mpf_factory, mrcp_connection_agent_t *agent); - -/** Determine whether factory is empty. */ -MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_is_empty(const mrcp_ca_factory_t *factory); - -/** Select next available agent. */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_ca_factory_agent_select(mrcp_ca_factory_t *factory); - -APT_END_EXTERN_C - -#endif /* MRCP_CA_FACTORY_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h deleted file mode 100644 index fd762bb1f9..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_client_connection.h +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_client_connection.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CLIENT_CONNECTION_H -#define MRCP_CLIENT_CONNECTION_H - -/** - * @file mrcp_client_connection.h - * @brief MRCPv2 Client Connection - */ - -#include "apt_task.h" -#include "mrcp_connection_types.h" - -APT_BEGIN_EXTERN_C - -/** - * Create connection agent. - * @param id the identifier of the agent - * @param max_connection_count the number of max MRCPv2 connections - * @param offer_new_connection the connection establishment policy in o/a - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_create( - const char *id, - apr_size_t max_connection_count, - apt_bool_t offer_new_connection, - apr_pool_t *pool); - -/** - * Destroy connection agent. - * @param agent the agent to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_destroy(mrcp_connection_agent_t *agent); - -/** - * Start connection agent and wait for incoming requests. - * @param agent the agent to start - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_start(mrcp_connection_agent_t *agent); - -/** - * Terminate connection agent. - * @param agent the agent to terminate - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_terminate(mrcp_connection_agent_t *agent); - - -/** - * Set connection event handler. - * @param agent the agent to set event hadler for - * @param obj the external object to associate with the agent - * @param vtable the event handler virtual methods - */ -MRCP_DECLARE(void) mrcp_client_connection_agent_handler_set( - mrcp_connection_agent_t *agent, - void *obj, - const mrcp_connection_event_vtable_t *vtable); - -/** - * Set MRCP resource factory. - * @param agent the agent to set resource factory for - * @param resource_factory the MRCP resource factory to set - */ -MRCP_DECLARE(void) mrcp_client_connection_resource_factory_set( - mrcp_connection_agent_t *agent, - const mrcp_resource_factory_t *resource_factory); -/** - * Set rx buffer size. - * @param agent the agent to set buffer size for - * @param size the size of rx buffer to set - */ -MRCP_DECLARE(void) mrcp_client_connection_rx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size); - -/** - * Set tx buffer size. - * @param agent the agent to set buffer size for - * @param size the size of the rx buffer to set - */ -MRCP_DECLARE(void) mrcp_client_connection_tx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size); -/** - * Set request timeout. - * @param agent the agent to set timeout for - * @param timeout the timeout to set - */ -MRCP_DECLARE(void) mrcp_client_connection_timeout_set( - mrcp_connection_agent_t *agent, - apr_size_t timeout); - -/** - * Get task. - * @param agent the agent to get task from - */ -MRCP_DECLARE(apt_task_t*) mrcp_client_connection_agent_task_get(const mrcp_connection_agent_t *agent); - -/** - * Get external object. - * @param agent the agent to get object from - */ -MRCP_DECLARE(void*) mrcp_client_connection_agent_object_get(const mrcp_connection_agent_t *agent); - -/** - * Get string identifier. - * @param agent the agent to get identifier of - */ -MRCP_DECLARE(const char*) mrcp_client_connection_agent_id_get(const mrcp_connection_agent_t *agent); - - -/** - * Create control channel. - * @param agent the agent to create channel for - * @param obj the external object to associate with the control channel - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_control_channel_t*) mrcp_client_control_channel_create( - mrcp_connection_agent_t *agent, - void *obj, - apr_pool_t *pool); - -/** - * Add MRCPv2 control channel. - * @param channel the control channel to add - * @param descriptor the control descriptor - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_add( - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor); - -/** - * Modify MRCPv2 control channel. - * @param channel the control channel to modify - * @param descriptor the control descriptor - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_modify( - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor); - -/** - * Remove MRCPv2 control channel. - * @param channel the control channel to remove - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_remove(mrcp_control_channel_t *channel); - -/** - * Destroy MRCPv2 control channel. - * @param channel the control channel to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_destroy(mrcp_control_channel_t *channel); - -/** - * Send MRCPv2 message. - * @param channel the control channel to send message through - * @param message the message to send - */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message); - -/** - * Set the logger object. - * @param channel the control channel to set the object for - * @param log_obj the object to set - */ -MRCP_DECLARE(void) mrcp_client_control_channel_log_obj_set(mrcp_control_channel_t *channel, void *log_obj); - - -APT_END_EXTERN_C - -#endif /* MRCP_CLIENT_CONNECTION_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h deleted file mode 100644 index fd2f39dca0..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_connection.h 2170 2014-09-09 05:19:48Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CONNECTION_H -#define MRCP_CONNECTION_H - -/** - * @file mrcp_connection.h - * @brief MRCP Connection - */ - -#include -#include -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include "mrcp_connection_types.h" -#include "mrcp_stream.h" - -APT_BEGIN_EXTERN_C - -/** Size of the buffer used for MRCP rx/tx stream */ -#define MRCP_STREAM_BUFFER_SIZE 1024 - -/** MRCPv2 connection */ -struct mrcp_connection_t { - /** Ring entry */ - APR_RING_ENTRY(mrcp_connection_t) link; - - /** Memory pool */ - apr_pool_t *pool; - - /** Accepted/Connected socket */ - apr_socket_t *sock; - /** Socket poll descriptor */ - apr_pollfd_t sock_pfd; - /** Local sockaddr */ - apr_sockaddr_t *l_sockaddr; - /** Remote sockaddr */ - apr_sockaddr_t *r_sockaddr; - /** Remote IP */ - apt_str_t remote_ip; - /** String identifier used for traces */ - const char *id; - /** Transparently dump whatever received/sent on transport layer, - if verbose is set to TRUE (default) */ - apt_bool_t verbose; - - /** Reference count */ - apr_size_t access_count; - /** Opaque agent */ - void *agent; - - /** Table of control channels */ - apr_hash_t *channel_table; - - /** Rx buffer */ - char *rx_buffer; - /** Rx buffer size */ - apr_size_t rx_buffer_size; - /** Rx stream */ - apt_text_stream_t rx_stream; - /** MRCP parser to parser MRCP messages out of rx stream */ - mrcp_parser_t *parser; - - /** Tx buffer */ - char *tx_buffer; - /** Tx buffer size */ - apr_size_t tx_buffer_size; - /** MRCP generator to generate MRCP messages into tx stream */ - mrcp_generator_t *generator; -}; - -/** Create MRCP connection. */ -mrcp_connection_t* mrcp_connection_create(void); - -/** Destroy MRCP connection. */ -void mrcp_connection_destroy(mrcp_connection_t *connection); - -/** Add Control Channel to MRCP connection. */ -apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel); - -/** Find Control Channel by Channel Identifier. */ -mrcp_control_channel_t* mrcp_connection_channel_find(const mrcp_connection_t *connection, const apt_str_t *identifier); - -/** Remove Control Channel from MRCP connection. */ -apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel); - -/** Raise disconnect event for each channel from the specified connection. */ -apt_bool_t mrcp_connection_disconnect_raise(mrcp_connection_t *connection, const mrcp_connection_event_vtable_t *vtable); - -APT_END_EXTERN_C - -#endif /* MRCP_CONNECTION_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h deleted file mode 100644 index 6f98564dbd..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_connection_types.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_connection_types.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CONNECTION_TYPES_H -#define MRCP_CONNECTION_TYPES_H - -/** - * @file mrcp_connection_types.h - * @brief MRCP Connection Types Declaration - */ - -#include -#include "apt_string.h" -#include "apt_timer_queue.h" -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque MRCPv2 control descriptor declaration */ -typedef struct mrcp_control_descriptor_t mrcp_control_descriptor_t; - -/** Opaque MRCPv2 connection declaration */ -typedef struct mrcp_connection_t mrcp_connection_t; - -/** Opaque MRCPv2 control channel declaration */ -typedef struct mrcp_control_channel_t mrcp_control_channel_t; - -/** Opaque MRCPv2 connection agent declaration */ -typedef struct mrcp_connection_agent_t mrcp_connection_agent_t; - -/** Opaque MRCPv2 connection agent factory declaration */ -typedef struct mrcp_ca_factory_t mrcp_ca_factory_t; - -/** MRCPv2 connection event vtable declaration */ -typedef struct mrcp_connection_event_vtable_t mrcp_connection_event_vtable_t; - -/** MRCPv2 connection event vtable */ -struct mrcp_connection_event_vtable_t { - /** Channel add event handler */ - apt_bool_t (*on_add)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); - /** Channel modify event handler */ - apt_bool_t (*on_modify)(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor, apt_bool_t status); - /** Channel remove event handler */ - apt_bool_t (*on_remove)(mrcp_control_channel_t *channel, apt_bool_t status); - /** Message receive event handler */ - apt_bool_t (*on_receive)(mrcp_control_channel_t *channel, mrcp_message_t *message); - /** Disconnect event handler */ - apt_bool_t (*on_disconnect)(mrcp_control_channel_t *channel); -}; - -/** MRCPv2 control channel */ -struct mrcp_control_channel_t { - /** MRCPv2 Connection agent */ - mrcp_connection_agent_t *agent; - /** MRCPv2 (shared) connection */ - mrcp_connection_t *connection; - /** Request sent to the server and waiting for a response */ - mrcp_message_t *active_request; - /** Timer used for request timeouts */ - apt_timer_t *request_timer; - /** Indicate removed connection (safe to destroy) */ - apt_bool_t removed; - /** External object associated with the channel */ - void *obj; - /** External logger object associated with the channel */ - void *log_obj; - /** Pool to allocate memory from */ - apr_pool_t *pool; - /** Channel identifier (id at resource) */ - apt_str_t identifier; -}; - -/** Send channel add response */ -static APR_INLINE apt_bool_t mrcp_control_channel_add_respond( - const mrcp_connection_event_vtable_t *vtable, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - apt_bool_t status) -{ - if(vtable && vtable->on_add) { - return vtable->on_add(channel,descriptor,status); - } - return FALSE; -} - -/** Send channel modify response */ -static APR_INLINE apt_bool_t mrcp_control_channel_modify_respond( - const mrcp_connection_event_vtable_t *vtable, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - apt_bool_t status) -{ - if(vtable && vtable->on_modify) { - return vtable->on_modify(channel,descriptor,status); - } - return FALSE; -} - -/** Send channel remove response */ -static APR_INLINE apt_bool_t mrcp_control_channel_remove_respond( - const mrcp_connection_event_vtable_t *vtable, - mrcp_control_channel_t *channel, - apt_bool_t status) -{ - if(vtable && vtable->on_remove) { - return vtable->on_remove(channel,status); - } - return FALSE; -} - -/** Send MRCP message receive event */ -static APR_INLINE apt_bool_t mrcp_connection_message_receive( - const mrcp_connection_event_vtable_t *vtable, - mrcp_control_channel_t *channel, - mrcp_message_t *message) -{ - if(vtable && vtable->on_receive) { - return vtable->on_receive(channel,message); - } - return FALSE; -} - -APT_END_EXTERN_C - -#endif /* MRCP_CONNECTION_TYPES_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h deleted file mode 100644 index 9597970ddf..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_control_descriptor.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_control_descriptor.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_CONTROL_DESCRIPTOR_H -#define MRCP_CONTROL_DESCRIPTOR_H - -/** - * @file mrcp_control_descriptor.h - * @brief MRCPv2 Control Descriptor - */ - -#include -#include "apt_string.h" -#include "mrcp_connection_types.h" - -APT_BEGIN_EXTERN_C - -/** TCP discard port used in offer/answer */ -#define TCP_DISCARD_PORT 9 - - -/** MRCPv2 proto transport */ -typedef enum { - MRCP_PROTO_TCP, - MRCP_PROTO_TLS, - - MRCP_PROTO_COUNT, - MRCP_PROTO_UNKNOWN = MRCP_PROTO_COUNT -}mrcp_proto_type_e; - - -/** MRCPv2 attributes */ -typedef enum { - MRCP_ATTRIB_SETUP, - MRCP_ATTRIB_CONNECTION, - MRCP_ATTRIB_RESOURCE, - MRCP_ATTRIB_CHANNEL, - MRCP_ATTRIB_CMID, - - MRCP_ATTRIB_COUNT, - MRCP_ATTRIB_UNKNOWN = MRCP_ATTRIB_COUNT -}mrcp_attrib_e; - - -/** MRCPv2 setup attributes */ -typedef enum { - MRCP_SETUP_TYPE_ACTIVE, - MRCP_SETUP_TYPE_PASSIVE, - - MRCP_SETUP_TYPE_COUNT, - MRCP_SETUP_TYPE_UNKNOWN = MRCP_SETUP_TYPE_COUNT -} mrcp_setup_type_e; - -/** MRCPv2 connection attributes */ -typedef enum { - MRCP_CONNECTION_TYPE_NEW, - MRCP_CONNECTION_TYPE_EXISTING, - - MRCP_CONNECTION_TYPE_COUNT, - MRCP_CONNECTION_TYPE_UNKNOWN = MRCP_CONNECTION_TYPE_COUNT -} mrcp_connection_type_e; - - -/** MRCPv2 control descriptor */ -struct mrcp_control_descriptor_t { - /** IP address */ - apt_str_t ip; - /** Port */ - apr_port_t port; - /** Protocol type */ - mrcp_proto_type_e proto; - /** Setup type */ - mrcp_setup_type_e setup_type; - /** Connection type */ - mrcp_connection_type_e connection_type; - /** Resource name */ - apt_str_t resource_name; - /** Session identifier */ - apt_str_t session_id; - /** Array of cmid attributes */ - apr_array_header_t *cmid_arr; - /** Base identifier */ - apr_size_t id; -}; - - -/** Create MRCP control descriptor */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_descriptor_create(apr_pool_t *pool); - -/** Create MRCP control offer */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_offer_create(apr_pool_t *pool); - -/** Create MRCP control answer */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_answer_create(mrcp_control_descriptor_t *offer, apr_pool_t *pool); - -/** Add cmid to cmid_arr */ -MRCP_DECLARE(void) mrcp_cmid_add(apr_array_header_t *cmid_arr, apr_size_t cmid); - -/** Find cmid in cmid_arr */ -MRCP_DECLARE(apt_bool_t) mrcp_cmid_find(const apr_array_header_t *cmid_arr, apr_size_t cmid); - -/** Get MRCP protocol transport name by identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_proto_get(mrcp_proto_type_e proto); - -/** Find MRCP protocol transport identifier by name */ -MRCP_DECLARE(mrcp_proto_type_e) mrcp_proto_find(const apt_str_t *attrib); - - -/** Get MRCP attribute name by identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_attrib_str_get(mrcp_attrib_e attrib_id); - -/** Find MRCP attribute identifier by name */ -MRCP_DECLARE(mrcp_attrib_e) mrcp_attrib_id_find(const apt_str_t *attrib); - - -/** Get MRCP setup type name by identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_setup_type_get(mrcp_setup_type_e setup_type); - -/** Find MRCP setup type identifier by name */ -MRCP_DECLARE(mrcp_setup_type_e) mrcp_setup_type_find(const apt_str_t *attrib); - - -/** Get MRCP connection type name by identifier */ -MRCP_DECLARE(const apt_str_t*) mrcp_connection_type_get(mrcp_connection_type_e connection_type); - -/** Find MRCP connection type identifier by name */ -MRCP_DECLARE(mrcp_connection_type_e) mrcp_connection_type_find(const apt_str_t *attrib); - - -APT_END_EXTERN_C - -#endif /* MRCP_CONTROL_DESCRIPTOR_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h b/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h deleted file mode 100644 index df99cc1a40..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/include/mrcp_server_connection.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_server_connection.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SERVER_CONNECTION_H -#define MRCP_SERVER_CONNECTION_H - -/** - * @file mrcp_server_connection.h - * @brief MRCPv2 Server Connection - */ - -#include "apt_task.h" -#include "mrcp_connection_types.h" - -APT_BEGIN_EXTERN_C - -/** - * Create connection agent. - * @param id the identifier of the engine - * @param listen_ip the IP address to listen on - * @param listen_port the port to listen on - * @param max_connection_count the number of max MRCPv2 connections - * @param force_new_connection the policy used in o/a for connection establishment - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_create( - const char *id, - const char *listen_ip, - apr_port_t listen_port, - apr_size_t max_connection_count, - apt_bool_t force_new_connection, - apr_pool_t *pool); - -/** - * Destroy connection agent. - * @param agent the agent to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_destroy(mrcp_connection_agent_t *agent); - -/** - * Start connection agent and wait for incoming requests. - * @param agent the agent to start - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_start(mrcp_connection_agent_t *agent); - -/** - * Terminate connection agent. - * @param agent the agent to terminate - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_terminate(mrcp_connection_agent_t *agent); - -/** - * Set connection event handler. - * @param agent the agent to set event hadler for - * @param obj the external object to associate with the agent - * @param vtable the event handler virtual methods - */ -MRCP_DECLARE(void) mrcp_server_connection_agent_handler_set( - mrcp_connection_agent_t *agent, - void *obj, - const mrcp_connection_event_vtable_t *vtable); - -/** - * Set MRCP resource factory. - * @param agent the agent to set resource factory for - * @param resource_factory the MRCP resource factory to set - */ -MRCP_DECLARE(void) mrcp_server_connection_resource_factory_set( - mrcp_connection_agent_t *agent, - const mrcp_resource_factory_t *resource_factory); - -/** - * Set rx buffer size. - * @param agent the agent to set buffer size for - * @param size the size of rx buffer to set - */ -MRCP_DECLARE(void) mrcp_server_connection_rx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size); - -/** - * Set tx buffer size. - * @param agent the agent to set buffer size for - * @param size the size of the rx buffer to set - */ -MRCP_DECLARE(void) mrcp_server_connection_tx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size); - -/** - * Get task. - * @param agent the agent to get task from - */ -MRCP_DECLARE(apt_task_t*) mrcp_server_connection_agent_task_get(const mrcp_connection_agent_t *agent); - -/** - * Get external object. - * @param agent the agent to get object from - */ -MRCP_DECLARE(void*) mrcp_server_connection_agent_object_get(const mrcp_connection_agent_t *agent); - -/** - * Get string identifier. - * @param agent the agent to get identifier of - */ -MRCP_DECLARE(const char*) mrcp_server_connection_agent_id_get(const mrcp_connection_agent_t *agent); - - -/** - * Create control channel. - * @param agent the agent to create channel for - * @param obj the external object to associate with the control channel - * @param pool the pool to allocate memory from - */ -MRCP_DECLARE(mrcp_control_channel_t*) mrcp_server_control_channel_create( - mrcp_connection_agent_t *agent, - void *obj, - apr_pool_t *pool); - -/** - * Add MRCPv2 control channel. - * @param channel the control channel to add - * @param descriptor the control descriptor - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_add( - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor); - -/** - * Modify MRCPv2 control channel. - * @param channel the control channel to modify - * @param descriptor the control descriptor - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_modify( - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor); - -/** - * Remove MRCPv2 control channel. - * @param channel the control channel to remove - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_remove(mrcp_control_channel_t *channel); - -/** - * Destroy MRCPv2 control channel. - * @param channel the control channel to destroy - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_destroy(mrcp_control_channel_t *channel); - -/** - * Send MRCPv2 message. - * @param channel the control channel to send message through - * @param message the message to send - */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message); - - -APT_END_EXTERN_C - -#endif /* MRCP_SERVER_CONNECTION_H */ diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters deleted file mode 100644 index 576ef8ae7e..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2010.vcxproj.filters +++ /dev/null @@ -1,47 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {a92d3b8c-d54d-416c-b458-dc57ac24d2e9} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj deleted file mode 100644 index 40a20105bf..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.2017.vcxproj +++ /dev/null @@ -1,134 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpv2transport - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} - mrcpv2transport - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj deleted file mode 100644 index 526f1e36a3..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj deleted file mode 100644 index 4d99d355c3..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} - mrcpv2transport - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - - - - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters b/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters deleted file mode 100644 index d573ce6367..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/mrcpv2transport.vcxproj.filters +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {119450fa-653a-4fdc-9017-a4350ff3066c} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c deleted file mode 100644 index b588ee200c..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_ca_factory.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_ca_factory.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "mrcp_ca_factory.h" - -/** Factory of MRCPv2 connection agents */ -struct mrcp_ca_factory_t { - /** Array of pointers to agents */ - apr_array_header_t *agent_arr; - /** Index of the current agent */ - int index; -}; - -/** Create factory of connection agents. */ -MRCP_DECLARE(mrcp_ca_factory_t*) mrcp_ca_factory_create(apr_pool_t *pool) -{ - mrcp_ca_factory_t *factory = apr_palloc(pool,sizeof(mrcp_ca_factory_t)); - factory->agent_arr = apr_array_make(pool,1,sizeof(mrcp_connection_agent_t*)); - factory->index = 0; - return factory; -} - -/** Add connection agent to factory. */ -MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_agent_add(mrcp_ca_factory_t *factory, mrcp_connection_agent_t *agent) -{ - mrcp_connection_agent_t **slot; - if(!agent) - return FALSE; - - slot = apr_array_push(factory->agent_arr); - *slot = agent; - return TRUE; -} - -/** Determine whether factory is empty. */ -MRCP_DECLARE(apt_bool_t) mrcp_ca_factory_is_empty(const mrcp_ca_factory_t *factory) -{ - return apr_is_empty_array(factory->agent_arr); -} - -/** Select next available agent. */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_ca_factory_agent_select(mrcp_ca_factory_t *factory) -{ - mrcp_connection_agent_t *agent = APR_ARRAY_IDX(factory->agent_arr, factory->index, mrcp_connection_agent_t*); - if(++factory->index == factory->agent_arr->nelts) { - factory->index = 0; - } - return agent; -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c deleted file mode 100644 index 359df52f47..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_client_connection.c +++ /dev/null @@ -1,696 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_client_connection.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#include "mrcp_connection.h" -#include "mrcp_client_connection.h" -#include "mrcp_control_descriptor.h" -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -#include "apt_text_stream.h" -#include "apt_poller_task.h" -#include "apt_log.h" - - -struct mrcp_connection_agent_t { - /** List (ring) of MRCP connections */ - APR_RING_HEAD(mrcp_connection_head_t, mrcp_connection_t) connection_list; - - apr_pool_t *pool; - apt_poller_task_t *task; - const mrcp_resource_factory_t *resource_factory; - - apr_uint32_t request_timeout; - apt_bool_t offer_new_connection; - apr_size_t tx_buffer_size; - apr_size_t rx_buffer_size; - - void *obj; - const mrcp_connection_event_vtable_t *vtable; -}; - -typedef enum { - CONNECTION_TASK_MSG_ADD_CHANNEL, - CONNECTION_TASK_MSG_MODIFY_CHANNEL, - CONNECTION_TASK_MSG_REMOVE_CHANNEL, - CONNECTION_TASK_MSG_SEND_MESSAGE -} connection_task_msg_type_e; - -typedef struct connection_task_msg_t connection_task_msg_t; -struct connection_task_msg_t { - connection_task_msg_type_e type; - mrcp_connection_agent_t *agent; - mrcp_control_channel_t *channel; - mrcp_control_descriptor_t *descriptor; - mrcp_message_t *message; -}; - - -static apt_bool_t mrcp_client_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg); -static apt_bool_t mrcp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor); -static void mrcp_client_timer_proc(apt_timer_t *timer, void *obj); - -/** Create connection agent. */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_client_connection_agent_create( - const char *id, - apr_size_t max_connection_count, - apt_bool_t offer_new_connection, - apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - mrcp_connection_agent_t *agent; - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Agent [%s] [%"APR_SIZE_T_FMT"]", - id, max_connection_count); - agent = apr_palloc(pool,sizeof(mrcp_connection_agent_t)); - agent->pool = pool; - agent->request_timeout = 0; - agent->offer_new_connection = offer_new_connection; - agent->rx_buffer_size = MRCP_STREAM_BUFFER_SIZE; - agent->tx_buffer_size = MRCP_STREAM_BUFFER_SIZE; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_task_msg_t),pool); - - agent->task = apt_poller_task_create( - max_connection_count, - mrcp_client_poller_signal_process, - agent, - msg_pool, - pool); - if(!agent->task) { - return NULL; - } - - task = apt_poller_task_base_get(agent->task); - if(task) { - apt_task_name_set(task,id); - } - - vtable = apt_poller_task_vtable_get(agent->task); - if(vtable) { - vtable->process_msg = mrcp_client_agent_msg_process; - } - - APR_RING_INIT(&agent->connection_list, mrcp_connection_t, link); - return agent; -} - -/** Destroy connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_destroy(mrcp_connection_agent_t *agent) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCPv2 Agent [%s]", - mrcp_client_connection_agent_id_get(agent)); - return apt_poller_task_destroy(agent->task); -} - -/** Start connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_start(mrcp_connection_agent_t *agent) -{ - return apt_poller_task_start(agent->task); -} - -/** Terminate connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_client_connection_agent_terminate(mrcp_connection_agent_t *agent) -{ - return apt_poller_task_terminate(agent->task); -} - -/** Set connection event handler. */ -MRCP_DECLARE(void) mrcp_client_connection_agent_handler_set( - mrcp_connection_agent_t *agent, - void *obj, - const mrcp_connection_event_vtable_t *vtable) -{ - agent->obj = obj; - agent->vtable = vtable; -} - -/** Set MRCP resource factory */ -MRCP_DECLARE(void) mrcp_client_connection_resource_factory_set( - mrcp_connection_agent_t *agent, - const mrcp_resource_factory_t *resource_factroy) -{ - agent->resource_factory = resource_factroy; -} - -/** Set rx buffer size */ -MRCP_DECLARE(void) mrcp_client_connection_rx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size) -{ - if(size < MRCP_STREAM_BUFFER_SIZE) { - size = MRCP_STREAM_BUFFER_SIZE; - } - agent->rx_buffer_size = size; -} - -/** Set tx buffer size */ -MRCP_DECLARE(void) mrcp_client_connection_tx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size) -{ - if(size < MRCP_STREAM_BUFFER_SIZE) { - size = MRCP_STREAM_BUFFER_SIZE; - } - agent->tx_buffer_size = size; -} - -/** Set request timeout */ -MRCP_DECLARE(void) mrcp_client_connection_timeout_set( - mrcp_connection_agent_t *agent, - apr_size_t timeout) -{ - agent->request_timeout = (apr_uint32_t)timeout; -} - -/** Get task */ -MRCP_DECLARE(apt_task_t*) mrcp_client_connection_agent_task_get(const mrcp_connection_agent_t *agent) -{ - return apt_poller_task_base_get(agent->task); -} - -/** Get external object */ -MRCP_DECLARE(void*) mrcp_client_connection_agent_object_get(const mrcp_connection_agent_t *agent) -{ - return agent->obj; -} - -/** Get string identifier */ -MRCP_DECLARE(const char*) mrcp_client_connection_agent_id_get(const mrcp_connection_agent_t *agent) -{ - apt_task_t *task = apt_poller_task_base_get(agent->task); - return apt_task_name_get(task); -} - - -/** Create control channel */ -MRCP_DECLARE(mrcp_control_channel_t*) mrcp_client_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool) -{ - mrcp_control_channel_t *channel = apr_palloc(pool,sizeof(mrcp_control_channel_t)); - channel->agent = agent; - channel->connection = NULL; - channel->active_request = NULL; - channel->request_timer = NULL; - channel->removed = FALSE; - channel->obj = obj; - channel->log_obj = NULL; - channel->pool = pool; - - channel->request_timer = apt_poller_task_timer_create( - agent->task, - mrcp_client_timer_proc, - channel, - pool); - return channel; -} - -/** Set the logger object */ -MRCP_DECLARE(void) mrcp_client_control_channel_log_obj_set(mrcp_control_channel_t *channel, void *log_obj) -{ - channel->log_obj = log_obj; -} - -/** Destroy MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_destroy(mrcp_control_channel_t *channel) -{ - if(channel && channel->connection && channel->removed == TRUE) { - mrcp_connection_t *connection = channel->connection; - channel->connection = NULL; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id); - mrcp_connection_destroy(connection); - } - return TRUE; -} - -/** Signal task message */ -static apt_bool_t mrcp_client_control_message_signal( - connection_task_msg_type_e type, - mrcp_connection_agent_t *agent, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - mrcp_message_t *message) -{ - apt_task_t *task = apt_poller_task_base_get(agent->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - connection_task_msg_t *msg = (connection_task_msg_t*)task_msg->data; - msg->type = type; - msg->agent = agent; - msg->channel = channel; - msg->descriptor = descriptor; - msg->message = message; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Add MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_ADD_CHANNEL,channel->agent,channel,descriptor,NULL); -} - -/** Modify MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_MODIFY_CHANNEL,channel->agent,channel,descriptor,NULL); -} - -/** Remove MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_channel_remove(mrcp_control_channel_t *channel) -{ - return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_REMOVE_CHANNEL,channel->agent,channel,NULL,NULL); -} - -/** Send MRCPv2 message */ -MRCP_DECLARE(apt_bool_t) mrcp_client_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - return mrcp_client_control_message_signal(CONNECTION_TASK_MSG_SEND_MESSAGE,channel->agent,channel,NULL,message); -} - -static mrcp_connection_t* mrcp_client_agent_connection_create(mrcp_connection_agent_t *agent, mrcp_control_descriptor_t *descriptor) -{ - char *local_ip = NULL; - char *remote_ip = NULL; - mrcp_connection_t *connection = mrcp_connection_create(); - - apr_sockaddr_info_get(&connection->r_sockaddr,descriptor->ip.buf,APR_INET,descriptor->port,0,connection->pool); - if(!connection->r_sockaddr) { - mrcp_connection_destroy(connection); - return NULL; - } - - if(apr_socket_create(&connection->sock,connection->r_sockaddr->family,SOCK_STREAM,APR_PROTO_TCP,connection->pool) != APR_SUCCESS) { - mrcp_connection_destroy(connection); - return NULL; - } - - apr_socket_opt_set(connection->sock, APR_SO_NONBLOCK, 0); - apr_socket_timeout_set(connection->sock, -1); - apr_socket_opt_set(connection->sock, APR_SO_REUSEADDR, 1); - - if(apr_socket_connect(connection->sock, connection->r_sockaddr) != APR_SUCCESS) { - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return NULL; - } - - if(apr_socket_addr_get(&connection->l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) { - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return NULL; - } - - apr_sockaddr_ip_get(&local_ip,connection->l_sockaddr); - apr_sockaddr_ip_get(&remote_ip,connection->r_sockaddr); - connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu", - local_ip,connection->l_sockaddr->port, - remote_ip,connection->r_sockaddr->port); - - memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t)); - connection->sock_pfd.desc_type = APR_POLL_SOCKET; - connection->sock_pfd.reqevents = APR_POLLIN; - connection->sock_pfd.desc.s = connection->sock; - connection->sock_pfd.client_data = connection; - if(apt_poller_task_descriptor_add(agent->task, &connection->sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id); - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Established TCP/MRCPv2 Connection %s",connection->id); - connection->agent = agent; - APR_RING_INSERT_TAIL(&agent->connection_list,connection,mrcp_connection_t,link); - - connection->parser = mrcp_parser_create(agent->resource_factory,connection->pool); - connection->generator = mrcp_generator_create(agent->resource_factory,connection->pool); - - connection->tx_buffer_size = agent->tx_buffer_size; - connection->tx_buffer = apr_palloc(connection->pool,connection->tx_buffer_size+1); - - connection->rx_buffer_size = agent->rx_buffer_size; - connection->rx_buffer = apr_palloc(connection->pool,connection->rx_buffer_size+1); - apt_text_stream_init(&connection->rx_stream,connection->rx_buffer,connection->rx_buffer_size); - - if(apt_log_masking_get() != APT_LOG_MASKING_NONE) { - connection->verbose = FALSE; - mrcp_parser_verbose_set(connection->parser,TRUE); - mrcp_generator_verbose_set(connection->generator,TRUE); - } - - return connection; -} - -static mrcp_connection_t* mrcp_client_agent_connection_find(mrcp_connection_agent_t *agent, mrcp_control_descriptor_t *descriptor) -{ - apr_sockaddr_t *sockaddr; - mrcp_connection_t *connection; - - for(connection = APR_RING_FIRST(&agent->connection_list); - connection != APR_RING_SENTINEL(&agent->connection_list, mrcp_connection_t, link); - connection = APR_RING_NEXT(connection, link)) { - if(apr_sockaddr_info_get(&sockaddr,descriptor->ip.buf,APR_INET,descriptor->port,0,connection->pool) == APR_SUCCESS) { - if(apr_sockaddr_equal(sockaddr,connection->r_sockaddr) != 0 && - descriptor->port == connection->r_sockaddr->port) { - return connection; - } - } - } - - return NULL; -} - -static apt_bool_t mrcp_client_agent_connection_remove(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) -{ - /* remove from the list */ - APR_RING_REMOVE(connection,link); - - if(connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close TCP/MRCPv2 Connection %s",connection->id); - apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd); - apr_socket_close(connection->sock); - connection->sock = NULL; - } - return TRUE; -} - -static apt_bool_t mrcp_client_agent_channel_add(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - if(agent->offer_new_connection == TRUE) { - descriptor->connection_type = MRCP_CONNECTION_TYPE_NEW; - } - else { - descriptor->connection_type = MRCP_CONNECTION_TYPE_EXISTING; - if(APR_RING_EMPTY(&agent->connection_list, mrcp_connection_t, link)) { - /* offer new connection if there is no established connection yet */ - descriptor->connection_type = MRCP_CONNECTION_TYPE_NEW; - } - } - /* send response */ - return mrcp_control_channel_add_respond(agent->vtable,channel,descriptor,TRUE); -} - -static apt_bool_t mrcp_client_agent_channel_modify(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - apt_bool_t status = TRUE; - if(descriptor->port) { - if(!channel->connection) { - mrcp_connection_t *connection = NULL; - apt_id_resource_generate(&descriptor->session_id,&descriptor->resource_name,'@',&channel->identifier,channel->pool); - /* no connection yet */ - if(descriptor->connection_type == MRCP_CONNECTION_TYPE_EXISTING) { - /* try to find existing connection */ - connection = mrcp_client_agent_connection_find(agent,descriptor); - if(!connection) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Found No Existing TCP/MRCPv2 Connection"); - } - } - if(!connection) { - /* create new connection */ - connection = mrcp_client_agent_connection_create(agent,descriptor); - if(!connection) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Establish TCP/MRCPv2 Connection"); - } - } - - if(connection) { - mrcp_connection_channel_add(connection,channel); - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Add Control Channel <%s> %s [%d]", - channel->identifier.buf, - connection->id, - apr_hash_count(connection->channel_table)); - if(descriptor->connection_type == MRCP_CONNECTION_TYPE_NEW) { - /* set connection type to existing for the next offers / if any */ - descriptor->connection_type = MRCP_CONNECTION_TYPE_EXISTING; - } - } - else { - descriptor->port = 0; - status = FALSE; - } - } - } - /* send response */ - return mrcp_control_channel_modify_respond(agent->vtable,channel,descriptor,status); -} - -static apt_bool_t mrcp_client_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) -{ - if(channel->connection) { - mrcp_connection_t *connection = channel->connection; - mrcp_connection_channel_remove(connection,channel); - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Remove Control Channel <%s> [%d]", - channel->identifier.buf, - apr_hash_count(connection->channel_table)); - if(!connection->access_count) { - mrcp_client_agent_connection_remove(agent,connection); - /* set connection to be destroyed on channel destroy */ - channel->connection = connection; - channel->removed = TRUE; - } - } - - /* send response */ - return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE); -} - -static apt_bool_t mrcp_client_agent_request_cancel(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - mrcp_message_t *response; - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Cancel MRCP Request <%s@%s> [%d]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - return mrcp_connection_message_receive(agent->vtable,channel,response); -} - -static apt_bool_t mrcp_client_agent_disconnect_raise(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) -{ - mrcp_control_channel_t *channel; - void *val; - apr_hash_index_t *it = apr_hash_first(connection->pool,connection->channel_table); - /* walk through the list of channels and raise disconnect event for them */ - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - channel = val; - if(!channel) continue; - - if(channel->active_request) { - mrcp_client_agent_request_cancel(channel->agent,channel,channel->active_request); - channel->active_request = NULL; - if(channel->request_timer) { - apt_timer_kill(channel->request_timer); - } - } - else if(agent->vtable->on_disconnect){ - agent->vtable->on_disconnect(channel); - } - } - return TRUE; -} - -static apt_bool_t mrcp_client_agent_messsage_send(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - apt_bool_t status = FALSE; - mrcp_connection_t *connection = channel->connection; - apt_text_stream_t stream; - apt_message_status_e result; - - if(!connection || !connection->sock) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Null MRCPv2 Connection "APT_SIDRES_FMT,MRCP_MESSAGE_SIDRES(message)); - mrcp_client_agent_request_cancel(agent,channel,message); - return FALSE; - } - - do { - apt_text_stream_init(&stream,connection->tx_buffer,connection->tx_buffer_size); - result = mrcp_generator_run(connection->generator,message,&stream); - if(result != APT_MESSAGE_STATUS_INVALID) { - stream.text.length = stream.pos - stream.text.buf; - *stream.pos = '\0'; - - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,channel->log_obj,"Send MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", - connection->id, - stream.text.length, - connection->verbose == TRUE ? stream.text.length : 0, - stream.text.buf); - - if(apr_socket_send(connection->sock,stream.text.buf,&stream.text.length) == APR_SUCCESS) { - status = TRUE; - } - else { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Send MRCPv2 Data %s", - connection->id); - } - } - else { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Failed to Generate MRCPv2 Data %s", - connection->id); - } - } - while(result == APT_MESSAGE_STATUS_INCOMPLETE); - - if(status == TRUE) { - channel->active_request = message; - if(channel->request_timer && agent->request_timeout) { - apt_timer_set(channel->request_timer,agent->request_timeout); - } - } - else { - mrcp_client_agent_request_cancel(agent,channel,message); - } - return status; -} - -static apt_bool_t mrcp_client_message_handler(mrcp_connection_t *connection, mrcp_message_t *message, apt_message_status_e status) -{ - if(status == APT_MESSAGE_STATUS_COMPLETE) { - /* message is completely parsed */ - mrcp_control_channel_t *channel; - apt_str_t identifier; - apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,message->pool); - channel = mrcp_connection_channel_find(connection,&identifier); - if(channel) { - mrcp_connection_agent_t *agent = connection->agent; - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - if(!channel->active_request || - channel->active_request->start_line.request_id != message->start_line.request_id) { - apt_obj_log(APT_LOG_MARK,APT_PRIO_WARNING,channel->log_obj,"Unexpected MRCP Response "APT_SIDRES_FMT" [%d]", - MRCP_MESSAGE_SIDRES(message), - message->start_line.request_id); - return FALSE; - } - if(channel->request_timer) { - apt_timer_kill(channel->request_timer); - } - channel->active_request = NULL; - } - - mrcp_connection_message_receive(agent->vtable,channel,message); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Channel "APT_SIDRES_FMT" in Connection %s [%d]", - MRCP_MESSAGE_SIDRES(message), - connection->id, - apr_hash_count(connection->channel_table)); - } - } - return TRUE; -} - -/* Receive MRCP message through TCP/MRCPv2 connection */ -static apt_bool_t mrcp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor) -{ - mrcp_connection_agent_t *agent = obj; - mrcp_connection_t *connection = descriptor->client_data; - apr_status_t status; - apr_size_t offset; - apr_size_t length; - apt_text_stream_t *stream; - mrcp_message_t *message; - apt_message_status_e msg_status; - - if(!connection || !connection->sock) { - return FALSE; - } - stream = &connection->rx_stream; - - /* calculate offset remaining from the previous receive / if any */ - offset = stream->pos - stream->text.buf; - /* calculate available length */ - length = connection->rx_buffer_size - offset; - - status = apr_socket_recv(connection->sock,stream->pos,&length); - if(status == APR_EOF || length == 0) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id); - apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd); - apr_socket_close(connection->sock); - connection->sock = NULL; - - mrcp_client_agent_disconnect_raise(agent,connection); - return TRUE; - } - - /* calculate actual length of the stream */ - stream->text.length = offset + length; - stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", - connection->id, - length, - connection->verbose == TRUE ? length : 0, - stream->pos); - - /* reset pos */ - apt_text_stream_reset(stream); - - do { - msg_status = mrcp_parser_run(connection->parser,stream,&message); - if(mrcp_client_message_handler(connection,message,msg_status) == FALSE) { - return FALSE; - } - } - while(apt_text_is_eos(stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(stream); - return TRUE; -} - -/* Process task message */ -static apt_bool_t mrcp_client_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task); - connection_task_msg_t *msg = (connection_task_msg_t*) task_msg->data; - - switch(msg->type) { - case CONNECTION_TASK_MSG_ADD_CHANNEL: - mrcp_client_agent_channel_add(agent,msg->channel,msg->descriptor); - break; - case CONNECTION_TASK_MSG_MODIFY_CHANNEL: - mrcp_client_agent_channel_modify(agent,msg->channel,msg->descriptor); - break; - case CONNECTION_TASK_MSG_REMOVE_CHANNEL: - mrcp_client_agent_channel_remove(agent,msg->channel); - break; - case CONNECTION_TASK_MSG_SEND_MESSAGE: - mrcp_client_agent_messsage_send(agent,msg->channel,msg->message); - break; - } - - return TRUE; -} - -/* Timer callback */ -static void mrcp_client_timer_proc(apt_timer_t *timer, void *obj) -{ - mrcp_control_channel_t *channel = obj; - if(!channel) { - return; - } - - if(channel->request_timer == timer) { - if(channel->active_request) { - mrcp_client_agent_request_cancel(channel->agent,channel,channel->active_request); - channel->active_request = NULL; - } - } -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c deleted file mode 100644 index bf9dc75d2c..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_connection.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_connection.c 2170 2014-09-09 05:19:48Z achaloyan@gmail.com $ - */ - -#include "mrcp_connection.h" -#include "apt_pool.h" - -mrcp_connection_t* mrcp_connection_create(void) -{ - mrcp_connection_t *connection; - apr_pool_t *pool = apt_pool_create(); - if(!pool) { - return NULL; - } - - connection = apr_palloc(pool,sizeof(mrcp_connection_t)); - connection->pool = pool; - apt_string_reset(&connection->remote_ip); - connection->l_sockaddr = NULL; - connection->r_sockaddr = NULL; - connection->sock = NULL; - connection->id = NULL; - connection->verbose = TRUE; - connection->access_count = 0; - APR_RING_ELEM_INIT(connection,link); - connection->channel_table = apr_hash_make(pool); - connection->parser = NULL; - connection->generator = NULL; - connection->rx_buffer = NULL; - connection->rx_buffer_size = 0; - connection->tx_buffer = NULL; - connection->tx_buffer_size = 0; - - return connection; -} - -void mrcp_connection_destroy(mrcp_connection_t *connection) -{ - if(connection && connection->pool) { - apr_pool_destroy(connection->pool); - } -} - -apt_bool_t mrcp_connection_channel_add(mrcp_connection_t *connection, mrcp_control_channel_t *channel) -{ - if(!connection || !channel) { - return FALSE; - } - apr_hash_set(connection->channel_table,channel->identifier.buf,channel->identifier.length,channel); - channel->connection = connection; - connection->access_count++; - return TRUE; -} - -mrcp_control_channel_t* mrcp_connection_channel_find(const mrcp_connection_t *connection, const apt_str_t *identifier) -{ - if(!connection || !identifier) { - return NULL; - } - return apr_hash_get(connection->channel_table,identifier->buf,identifier->length); -} - -apt_bool_t mrcp_connection_channel_remove(mrcp_connection_t *connection, mrcp_control_channel_t *channel) -{ - if(!connection || !channel) { - return FALSE; - } - apr_hash_set(connection->channel_table,channel->identifier.buf,channel->identifier.length,NULL); - channel->connection = NULL; - connection->access_count--; - return TRUE; -} - -apt_bool_t mrcp_connection_disconnect_raise(mrcp_connection_t *connection, const mrcp_connection_event_vtable_t *vtable) -{ - if(vtable && vtable->on_disconnect) { - mrcp_control_channel_t *channel; - void *val; - apr_hash_index_t *it = apr_hash_first(connection->pool,connection->channel_table); - /* walk through the list of channels and raise disconnect event for them */ - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - channel = val; - if(channel) { - vtable->on_disconnect(channel); - } - } - } - return TRUE; -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c deleted file mode 100644 index 2339e8fb56..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_control_descriptor.c +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_control_descriptor.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_string_table.h" -#include "mrcp_control_descriptor.h" - -/** String table of mrcp proto types (mrcp_proto_type_e) */ -static const apt_str_table_item_t mrcp_proto_type_table[] = { - {{"TCP/MRCPv2", 10},4}, - {{"TCP/TLS/MRCPv2",14},4} -}; - -/** String table of mrcp attributes (mrcp_attrib_e) */ -static const apt_str_table_item_t mrcp_attrib_table[] = { - {{"setup", 5},0}, - {{"connection",10},1}, - {{"resource", 8},0}, - {{"channel", 7},1}, - {{"cmid", 4},1} -}; - -/** String table of mrcp setup attribute values (mrcp_setup_type_e) */ -static const apt_str_table_item_t mrcp_setup_value_table[] = { - {{"active", 6},0}, - {{"passive", 7},0} -}; - -/** String table of mrcp connection attribute values (mrcp_connection_type_e) */ -static const apt_str_table_item_t mrcp_connection_value_table[] = { - {{"new", 3},0}, - {{"existing", 8},0} -}; - - -MRCP_DECLARE(const apt_str_t*) mrcp_proto_get(mrcp_proto_type_e proto) -{ - return apt_string_table_str_get(mrcp_proto_type_table,MRCP_PROTO_COUNT,proto); -} - -MRCP_DECLARE(mrcp_proto_type_e) mrcp_proto_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mrcp_proto_type_table,MRCP_PROTO_COUNT,attrib); -} - -MRCP_DECLARE(const apt_str_t*) mrcp_attrib_str_get(mrcp_attrib_e attrib_id) -{ - return apt_string_table_str_get(mrcp_attrib_table,MRCP_ATTRIB_COUNT,attrib_id); -} - -MRCP_DECLARE(mrcp_attrib_e) mrcp_attrib_id_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mrcp_attrib_table,MRCP_ATTRIB_COUNT,attrib); -} - -MRCP_DECLARE(const apt_str_t*) mrcp_setup_type_get(mrcp_setup_type_e setup_type) -{ - return apt_string_table_str_get(mrcp_setup_value_table,MRCP_SETUP_TYPE_COUNT,setup_type); -} - -MRCP_DECLARE(mrcp_setup_type_e) mrcp_setup_type_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mrcp_setup_value_table,MRCP_SETUP_TYPE_COUNT,attrib); -} - -MRCP_DECLARE(const apt_str_t*) mrcp_connection_type_get(mrcp_connection_type_e connection_type) -{ - return apt_string_table_str_get(mrcp_connection_value_table,MRCP_CONNECTION_TYPE_COUNT,connection_type); -} - -MRCP_DECLARE(mrcp_connection_type_e) mrcp_connection_type_find(const apt_str_t *attrib) -{ - return apt_string_table_id_find(mrcp_connection_value_table,MRCP_CONNECTION_TYPE_COUNT,attrib); -} - -/** Create MRCP control descriptor */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_descriptor_create(apr_pool_t *pool) -{ - mrcp_control_descriptor_t *descriptor; - descriptor = apr_palloc(pool,sizeof(mrcp_control_descriptor_t)); - - apt_string_reset(&descriptor->ip); - descriptor->port = 0; - descriptor->proto = MRCP_PROTO_UNKNOWN; - descriptor->setup_type = MRCP_SETUP_TYPE_UNKNOWN; - descriptor->connection_type = MRCP_CONNECTION_TYPE_UNKNOWN; - apt_string_reset(&descriptor->resource_name); - apt_string_reset(&descriptor->session_id); - descriptor->cmid_arr = apr_array_make(pool,1,sizeof(apr_size_t)); - descriptor->id = 0; - return descriptor; -} - -/** Create MRCP control offer */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_offer_create(apr_pool_t *pool) -{ - mrcp_control_descriptor_t *offer = mrcp_control_descriptor_create(pool); - offer->proto = MRCP_PROTO_TCP; - offer->port = TCP_DISCARD_PORT; - offer->setup_type = MRCP_SETUP_TYPE_ACTIVE; - offer->connection_type = MRCP_CONNECTION_TYPE_EXISTING; - return offer; -} - -/** Create MRCP control answer */ -MRCP_DECLARE(mrcp_control_descriptor_t*) mrcp_control_answer_create(mrcp_control_descriptor_t *offer, apr_pool_t *pool) -{ - mrcp_control_descriptor_t *answer = mrcp_control_descriptor_create(pool); - if(offer) { - *answer = *offer; - answer->cmid_arr = apr_array_copy(pool,offer->cmid_arr); - } - answer->setup_type = MRCP_SETUP_TYPE_PASSIVE; - return answer; -} - -/** Add cmid to cmid_arr */ -MRCP_DECLARE(void) mrcp_cmid_add(apr_array_header_t *cmid_arr, apr_size_t cmid) -{ - APR_ARRAY_PUSH(cmid_arr, apr_size_t) = cmid; -} - -/** Find cmid in cmid_arr */ -MRCP_DECLARE(apt_bool_t) mrcp_cmid_find(const apr_array_header_t *cmid_arr, apr_size_t cmid) -{ - int i; - for(i=0; inelts; i++) { - if(APR_ARRAY_IDX(cmid_arr,i,apr_size_t) == cmid) { - return TRUE; - } - } - return FALSE; -} diff --git a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c b/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c deleted file mode 100644 index 3a77ff23d4..0000000000 --- a/libs/unimrcp/libs/mrcpv2-transport/src/mrcp_server_connection.c +++ /dev/null @@ -1,715 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_server_connection.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#include "mrcp_connection.h" -#include "mrcp_server_connection.h" -#include "mrcp_control_descriptor.h" -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -#include "apt_text_stream.h" -#include "apt_poller_task.h" -#include "apt_pool.h" -#include "apt_log.h" - - -struct mrcp_connection_agent_t { - apr_pool_t *pool; - apt_poller_task_t *task; - const mrcp_resource_factory_t *resource_factory; - - /** List (ring) of MRCP connections */ - APR_RING_HEAD(mrcp_connection_head_t, mrcp_connection_t) connection_list; - /** Table of pending control channels */ - apr_hash_t *pending_channel_table; - - apt_bool_t force_new_connection; - apr_size_t tx_buffer_size; - apr_size_t rx_buffer_size; - - /* Listening socket */ - apr_sockaddr_t *sockaddr; - apr_socket_t *listen_sock; - apr_pollfd_t listen_sock_pfd; - - void *obj; - const mrcp_connection_event_vtable_t *vtable; -}; - -typedef enum { - CONNECTION_TASK_MSG_ADD_CHANNEL, - CONNECTION_TASK_MSG_MODIFY_CHANNEL, - CONNECTION_TASK_MSG_REMOVE_CHANNEL, - CONNECTION_TASK_MSG_SEND_MESSAGE -} connection_task_msg_type_e; - -typedef struct connection_task_msg_t connection_task_msg_t; -struct connection_task_msg_t { - connection_task_msg_type_e type; - mrcp_connection_agent_t *agent; - mrcp_control_channel_t *channel; - mrcp_control_descriptor_t *descriptor; - mrcp_message_t *message; -}; - -static apt_bool_t mrcp_server_agent_on_destroy(apt_task_t *task); -static apt_bool_t mrcp_server_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg); -static apt_bool_t mrcp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor); - -static apt_bool_t mrcp_server_agent_listening_socket_create(mrcp_connection_agent_t *agent); -static void mrcp_server_agent_listening_socket_destroy(mrcp_connection_agent_t *agent); - - -/** Create connection agent */ -MRCP_DECLARE(mrcp_connection_agent_t*) mrcp_server_connection_agent_create( - const char *id, - const char *listen_ip, - apr_port_t listen_port, - apr_size_t max_connection_count, - apt_bool_t force_new_connection, - apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - mrcp_connection_agent_t *agent; - - if(!listen_ip) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Agent [%s] %s:%hu [%"APR_SIZE_T_FMT"]", - id,listen_ip,listen_port,max_connection_count); - agent = apr_palloc(pool,sizeof(mrcp_connection_agent_t)); - agent->pool = pool; - agent->sockaddr = NULL; - agent->listen_sock = NULL; - agent->force_new_connection = force_new_connection; - agent->rx_buffer_size = MRCP_STREAM_BUFFER_SIZE; - agent->tx_buffer_size = MRCP_STREAM_BUFFER_SIZE; - - apr_sockaddr_info_get(&agent->sockaddr,listen_ip,APR_INET,listen_port,0,pool); - if(!agent->sockaddr) { - return NULL; - } - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(connection_task_msg_t),pool); - - agent->task = apt_poller_task_create( - max_connection_count + 1, - mrcp_server_poller_signal_process, - agent, - msg_pool, - pool); - if(!agent->task) { - return NULL; - } - - task = apt_poller_task_base_get(agent->task); - if(task) { - apt_task_name_set(task,id); - } - - vtable = apt_poller_task_vtable_get(agent->task); - if(vtable) { - vtable->destroy = mrcp_server_agent_on_destroy; - vtable->process_msg = mrcp_server_agent_msg_process; - } - - APR_RING_INIT(&agent->connection_list, mrcp_connection_t, link); - agent->pending_channel_table = apr_hash_make(pool); - - if(mrcp_server_agent_listening_socket_create(agent) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Listening Socket [%s] %s:%hu", - id, - listen_ip, - listen_port); - } - return agent; -} - -static apt_bool_t mrcp_server_agent_on_destroy(apt_task_t *task) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task); - - mrcp_server_agent_listening_socket_destroy(agent); - apt_poller_task_cleanup(poller_task); - return TRUE; -} - -/** Destroy connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_destroy(mrcp_connection_agent_t *agent) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy MRCPv2 Agent [%s]", - mrcp_server_connection_agent_id_get(agent)); - return apt_poller_task_destroy(agent->task); -} - -/** Start connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_start(mrcp_connection_agent_t *agent) -{ - return apt_poller_task_start(agent->task); -} - -/** Terminate connection agent. */ -MRCP_DECLARE(apt_bool_t) mrcp_server_connection_agent_terminate(mrcp_connection_agent_t *agent) -{ - return apt_poller_task_terminate(agent->task); -} - -/** Set connection event handler. */ -MRCP_DECLARE(void) mrcp_server_connection_agent_handler_set( - mrcp_connection_agent_t *agent, - void *obj, - const mrcp_connection_event_vtable_t *vtable) -{ - agent->obj = obj; - agent->vtable = vtable; -} - -/** Set MRCP resource factory */ -MRCP_DECLARE(void) mrcp_server_connection_resource_factory_set( - mrcp_connection_agent_t *agent, - const mrcp_resource_factory_t *resource_factroy) -{ - agent->resource_factory = resource_factroy; -} - -/** Set rx buffer size */ -MRCP_DECLARE(void) mrcp_server_connection_rx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size) -{ - if(size < MRCP_STREAM_BUFFER_SIZE) { - size = MRCP_STREAM_BUFFER_SIZE; - } - agent->rx_buffer_size = size; -} - -/** Set tx buffer size */ -MRCP_DECLARE(void) mrcp_server_connection_tx_size_set( - mrcp_connection_agent_t *agent, - apr_size_t size) -{ - if(size < MRCP_STREAM_BUFFER_SIZE) { - size = MRCP_STREAM_BUFFER_SIZE; - } - agent->tx_buffer_size = size; -} - -/** Get task */ -MRCP_DECLARE(apt_task_t*) mrcp_server_connection_agent_task_get(const mrcp_connection_agent_t *agent) -{ - return apt_poller_task_base_get(agent->task); -} - -/** Get external object */ -MRCP_DECLARE(void*) mrcp_server_connection_agent_object_get(const mrcp_connection_agent_t *agent) -{ - return agent->obj; -} - -/** Get string identifier */ -MRCP_DECLARE(const char*) mrcp_server_connection_agent_id_get(const mrcp_connection_agent_t *agent) -{ - apt_task_t *task = apt_poller_task_base_get(agent->task); - return apt_task_name_get(task); -} - - -/** Create MRCPv2 control channel */ -MRCP_DECLARE(mrcp_control_channel_t*) mrcp_server_control_channel_create(mrcp_connection_agent_t *agent, void *obj, apr_pool_t *pool) -{ - mrcp_control_channel_t *channel = apr_palloc(pool,sizeof(mrcp_control_channel_t)); - channel->agent = agent; - channel->connection = NULL; - channel->active_request = NULL; - channel->request_timer = NULL; - channel->removed = FALSE; - channel->obj = obj; - channel->log_obj = NULL; - channel->pool = pool; - return channel; -} - -/** Destroy MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_destroy(mrcp_control_channel_t *channel) -{ - if(channel && channel->connection && channel->removed == TRUE) { - mrcp_connection_t *connection = channel->connection; - channel->connection = NULL; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id); - mrcp_connection_destroy(connection); - } - return TRUE; -} - -/** Signal task message */ -static apt_bool_t mrcp_server_control_message_signal( - connection_task_msg_type_e type, - mrcp_connection_agent_t *agent, - mrcp_control_channel_t *channel, - mrcp_control_descriptor_t *descriptor, - mrcp_message_t *message) -{ - apt_task_t *task = apt_poller_task_base_get(agent->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - connection_task_msg_t *msg = (connection_task_msg_t*)task_msg->data; - msg->type = type; - msg->agent = agent; - msg->channel = channel; - msg->descriptor = descriptor; - msg->message = message; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Add MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_add(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_ADD_CHANNEL,channel->agent,channel,descriptor,NULL); -} - -/** Modify MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_modify(mrcp_control_channel_t *channel, mrcp_control_descriptor_t *descriptor) -{ - return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_MODIFY_CHANNEL,channel->agent,channel,descriptor,NULL); -} - -/** Remove MRCPv2 control channel */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_channel_remove(mrcp_control_channel_t *channel) -{ - return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_REMOVE_CHANNEL,channel->agent,channel,NULL,NULL); -} - -/** Send MRCPv2 message */ -MRCP_DECLARE(apt_bool_t) mrcp_server_control_message_send(mrcp_control_channel_t *channel, mrcp_message_t *message) -{ - return mrcp_server_control_message_signal(CONNECTION_TASK_MSG_SEND_MESSAGE,channel->agent,channel,NULL,message); -} - -/** Create listening socket and add it to pollset */ -static apt_bool_t mrcp_server_agent_listening_socket_create(mrcp_connection_agent_t *agent) -{ - apr_status_t status; - if(!agent->sockaddr) { - return FALSE; - } - - /* create listening socket */ - status = apr_socket_create(&agent->listen_sock, agent->sockaddr->family, SOCK_STREAM, APR_PROTO_TCP, agent->pool); - if(status != APR_SUCCESS) { - return FALSE; - } - - apr_socket_opt_set(agent->listen_sock, APR_SO_NONBLOCK, 0); - apr_socket_timeout_set(agent->listen_sock, -1); - apr_socket_opt_set(agent->listen_sock, APR_SO_REUSEADDR, 1); - - status = apr_socket_bind(agent->listen_sock, agent->sockaddr); - if(status != APR_SUCCESS) { - apr_socket_close(agent->listen_sock); - agent->listen_sock = NULL; - return FALSE; - } - status = apr_socket_listen(agent->listen_sock, SOMAXCONN); - if(status != APR_SUCCESS) { - apr_socket_close(agent->listen_sock); - agent->listen_sock = NULL; - return FALSE; - } - - /* add listening socket to pollset */ - memset(&agent->listen_sock_pfd,0,sizeof(apr_pollfd_t)); - agent->listen_sock_pfd.desc_type = APR_POLL_SOCKET; - agent->listen_sock_pfd.reqevents = APR_POLLIN; - agent->listen_sock_pfd.desc.s = agent->listen_sock; - agent->listen_sock_pfd.client_data = agent->listen_sock; - if(apt_poller_task_descriptor_add(agent->task, &agent->listen_sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add Listening Socket to Pollset [%s]", - apt_task_name_get(apt_poller_task_base_get(agent->task))); - apr_socket_close(agent->listen_sock); - agent->listen_sock = NULL; - return FALSE; - } - - return TRUE; -} - -/** Remove from pollset and destroy listening socket */ -static void mrcp_server_agent_listening_socket_destroy(mrcp_connection_agent_t *agent) -{ - if(agent->listen_sock) { - apt_poller_task_descriptor_remove(agent->task,&agent->listen_sock_pfd); - apr_socket_close(agent->listen_sock); - agent->listen_sock = NULL; - } -} - -static mrcp_control_channel_t* mrcp_connection_channel_associate(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, const mrcp_message_t *message) -{ - apt_str_t identifier; - mrcp_control_channel_t *channel; - if(!connection || !message) { - return NULL; - } - apt_id_resource_generate(&message->channel_id.session_id,&message->channel_id.resource_name,'@',&identifier,connection->pool); - channel = mrcp_connection_channel_find(connection,&identifier); - if(!channel) { - channel = apr_hash_get(agent->pending_channel_table,identifier.buf,identifier.length); - if(channel) { - apr_hash_set(agent->pending_channel_table,identifier.buf,identifier.length,NULL); - mrcp_connection_channel_add(connection,channel); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Assign Control Channel <%s> to Connection %s [%d] -> [%d]", - channel->identifier.buf, - connection->id, - apr_hash_count(agent->pending_channel_table), - apr_hash_count(connection->channel_table)); - } - } - return channel; -} - -static mrcp_connection_t* mrcp_connection_find(mrcp_connection_agent_t *agent, const apt_str_t *remote_ip) -{ - mrcp_connection_t *connection; - if(!agent || !remote_ip) { - return NULL; - } - - for(connection = APR_RING_FIRST(&agent->connection_list); - connection != APR_RING_SENTINEL(&agent->connection_list, mrcp_connection_t, link); - connection = APR_RING_NEXT(connection, link)) { - if(apt_string_compare(&connection->remote_ip,remote_ip) == TRUE) { - return connection; - } - } - - return NULL; -} - -static apt_bool_t mrcp_connection_remove(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) -{ - APR_RING_REMOVE(connection,link); - return TRUE; -} - -static apt_bool_t mrcp_server_agent_connection_accept(mrcp_connection_agent_t *agent) -{ - char *local_ip = NULL; - char *remote_ip = NULL; - - mrcp_connection_t *connection = mrcp_connection_create(); - - if(apr_socket_accept(&connection->sock,agent->listen_sock,connection->pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Accept Connection"); - mrcp_connection_destroy(connection); - return FALSE; - } - - if(apr_socket_addr_get(&connection->r_sockaddr,APR_REMOTE,connection->sock) != APR_SUCCESS || - apr_socket_addr_get(&connection->l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Socket Address"); - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return FALSE; - } - - apr_sockaddr_ip_get(&local_ip,connection->l_sockaddr); - apr_sockaddr_ip_get(&remote_ip,connection->r_sockaddr); - apt_string_set(&connection->remote_ip,remote_ip); - connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu", - local_ip,connection->l_sockaddr->port, - remote_ip,connection->r_sockaddr->port); - - if(apr_hash_count(agent->pending_channel_table) == 0) { - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Reject Unexpected TCP/MRCPv2 Connection %s",connection->id); - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return FALSE; - } - - memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t)); - connection->sock_pfd.desc_type = APR_POLL_SOCKET; - connection->sock_pfd.reqevents = APR_POLLIN; - connection->sock_pfd.desc.s = connection->sock; - connection->sock_pfd.client_data = connection; - if(apt_poller_task_descriptor_add(agent->task, &connection->sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id); - apr_socket_close(connection->sock); - mrcp_connection_destroy(connection); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Accepted TCP/MRCPv2 Connection %s",connection->id); - connection->agent = agent; - APR_RING_INSERT_TAIL(&agent->connection_list,connection,mrcp_connection_t,link); - - connection->parser = mrcp_parser_create(agent->resource_factory,connection->pool); - connection->generator = mrcp_generator_create(agent->resource_factory,connection->pool); - - connection->tx_buffer_size = agent->tx_buffer_size; - connection->tx_buffer = apr_palloc(connection->pool,connection->tx_buffer_size+1); - - connection->rx_buffer_size = agent->rx_buffer_size; - connection->rx_buffer = apr_palloc(connection->pool,connection->rx_buffer_size+1); - apt_text_stream_init(&connection->rx_stream,connection->rx_buffer,connection->rx_buffer_size); - - if(apt_log_masking_get() != APT_LOG_MASKING_NONE) { - connection->verbose = FALSE; - mrcp_parser_verbose_set(connection->parser,TRUE); - mrcp_generator_verbose_set(connection->generator,TRUE); - } - return TRUE; -} - -static apt_bool_t mrcp_server_agent_connection_close(mrcp_connection_agent_t *agent, mrcp_connection_t *connection) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"TCP/MRCPv2 Peer Disconnected %s",connection->id); - apt_poller_task_descriptor_remove(agent->task,&connection->sock_pfd); - apr_socket_close(connection->sock); - connection->sock = NULL; - if(!connection->access_count) { - mrcp_connection_remove(agent,connection); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy TCP/MRCPv2 Connection %s",connection->id); - mrcp_connection_destroy(connection); - } - return TRUE; -} - -static apt_bool_t mrcp_server_agent_channel_add(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *offer) -{ - mrcp_control_descriptor_t *answer = mrcp_control_answer_create(offer,channel->pool); - apt_id_resource_generate(&offer->session_id,&offer->resource_name,'@',&channel->identifier,channel->pool); - if(offer->port) { - answer->port = agent->sockaddr->port; - } - if(offer->connection_type == MRCP_CONNECTION_TYPE_EXISTING) { - if(agent->force_new_connection == TRUE) { - /* force client to establish new connection */ - answer->connection_type = MRCP_CONNECTION_TYPE_NEW; - } - else { - mrcp_connection_t *connection = NULL; - /* try to find any existing connection */ - connection = mrcp_connection_find(agent,&offer->ip); - if(!connection) { - /* no existing conection found, force the new one */ - answer->connection_type = MRCP_CONNECTION_TYPE_NEW; - } - } - } - - apr_hash_set(agent->pending_channel_table,channel->identifier.buf,channel->identifier.length,channel); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Pending Control Channel <%s> [%d]", - channel->identifier.buf, - apr_hash_count(agent->pending_channel_table)); - /* send response */ - return mrcp_control_channel_add_respond(agent->vtable,channel,answer,TRUE); -} - -static apt_bool_t mrcp_server_agent_channel_modify(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel, mrcp_control_descriptor_t *offer) -{ - mrcp_control_descriptor_t *answer = mrcp_control_answer_create(offer,channel->pool); - if(offer->port) { - answer->port = agent->sockaddr->port; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Modify Control Channel <%s>",channel->identifier.buf); - /* send response */ - return mrcp_control_channel_modify_respond(agent->vtable,channel,answer,TRUE); -} - -static apt_bool_t mrcp_server_agent_channel_remove(mrcp_connection_agent_t *agent, mrcp_control_channel_t *channel) -{ - mrcp_connection_t *connection = channel->connection; - if(connection) { - mrcp_connection_channel_remove(connection,channel); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Control Channel <%s> [%d]", - channel->identifier.buf, - apr_hash_count(connection->channel_table)); - if(!connection->access_count) { - if(!connection->sock) { - mrcp_connection_remove(agent,connection); - /* set connection to be destroyed on channel destroy */ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Mark Connection for Removal %s",connection->id); - channel->connection = connection; - channel->removed = TRUE; - } - } - } - else { - apr_hash_set(agent->pending_channel_table,channel->identifier.buf,channel->identifier.length,NULL); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove Pending Control Channel <%s> [%d]", - channel->identifier.buf, - apr_hash_count(agent->pending_channel_table)); - } - /* send response */ - return mrcp_control_channel_remove_respond(agent->vtable,channel,TRUE); -} - -static apt_bool_t mrcp_server_agent_messsage_send(mrcp_connection_agent_t *agent, mrcp_connection_t *connection, mrcp_message_t *message) -{ - apt_bool_t status = FALSE; - apt_text_stream_t stream; - apt_message_status_e result; - if(!connection || !connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Null MRCPv2 Connection "APT_SIDRES_FMT,MRCP_MESSAGE_SIDRES(message)); - return FALSE; - } - - do { - apt_text_stream_init(&stream,connection->tx_buffer,connection->tx_buffer_size); - result = mrcp_generator_run(connection->generator,message,&stream); - if(result != APT_MESSAGE_STATUS_INVALID) { - stream.text.length = stream.pos - stream.text.buf; - *stream.pos = '\0'; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", - connection->id, - stream.text.length, - connection->verbose == TRUE ? stream.text.length : 0, - stream.text.buf); - - if(apr_socket_send(connection->sock,stream.text.buf,&stream.text.length) == APR_SUCCESS) { - status = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Data"); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Data"); - } - } - while(result == APT_MESSAGE_STATUS_INCOMPLETE); - - return status; -} - -static apt_bool_t mrcp_server_message_handler(mrcp_connection_t *connection, mrcp_message_t *message, apt_message_status_e status) -{ - mrcp_connection_agent_t *agent = connection->agent; - if(status == APT_MESSAGE_STATUS_COMPLETE) { - /* message is completely parsed */ - mrcp_control_channel_t *channel = mrcp_connection_channel_associate(agent,connection,message); - if(channel) { - mrcp_connection_message_receive(agent->vtable,channel,message); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Find Channel "APT_SIDRES_FMT" in Connection %s", - MRCP_MESSAGE_SIDRES(message), - connection->id); - } - } - else if(status == APT_MESSAGE_STATUS_INVALID) { - /* error case */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv2 Data"); - if(message && message->resource) { - mrcp_message_t *response; - response = mrcp_response_create(message,message->pool); - response->start_line.status_code = MRCP_STATUS_CODE_UNRECOGNIZED_MESSAGE; - if(mrcp_server_agent_messsage_send(agent,connection,response) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send MRCPv2 Response"); - } - } - } - return TRUE; -} - -/* Receive MRCP message through TCP/MRCPv2 connection */ -static apt_bool_t mrcp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor) -{ - mrcp_connection_agent_t *agent = obj; - mrcp_connection_t *connection = descriptor->client_data; - apr_status_t status; - apr_size_t offset; - apr_size_t length; - apt_text_stream_t *stream; - mrcp_message_t *message; - apt_message_status_e msg_status; - - if(descriptor->desc.s == agent->listen_sock) { - return mrcp_server_agent_connection_accept(agent); - } - - if(!connection || !connection->sock) { - return FALSE; - } - stream = &connection->rx_stream; - - /* calculate offset remaining from the previous receive / if any */ - offset = stream->pos - stream->text.buf; - /* calculate available length */ - length = connection->rx_buffer_size - offset; - - status = apr_socket_recv(connection->sock,stream->pos,&length); - if(status == APR_EOF || length == 0) { - return mrcp_server_agent_connection_close(agent,connection); - } - - /* calculate actual length of the stream */ - stream->text.length = offset + length; - stream->pos[length] = '\0'; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive MRCPv2 Data %s [%"APR_SIZE_T_FMT" bytes]\n%.*s", - connection->id, - length, - connection->verbose == TRUE ? length : 0, - stream->pos); - - /* reset pos */ - apt_text_stream_reset(stream); - - do { - msg_status = mrcp_parser_run(connection->parser,stream,&message); - if(mrcp_server_message_handler(connection,message,msg_status) == FALSE) { - return FALSE; - } - } - while(apt_text_is_eos(stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(stream); - return TRUE; -} - -/* Process task message */ -static apt_bool_t mrcp_server_agent_msg_process(apt_task_t *task, apt_task_msg_t *task_msg) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - mrcp_connection_agent_t *agent = apt_poller_task_object_get(poller_task); - connection_task_msg_t *msg = (connection_task_msg_t*) task_msg->data; - switch(msg->type) { - case CONNECTION_TASK_MSG_ADD_CHANNEL: - mrcp_server_agent_channel_add(agent,msg->channel,msg->descriptor); - break; - case CONNECTION_TASK_MSG_MODIFY_CHANNEL: - mrcp_server_agent_channel_modify(agent,msg->channel,msg->descriptor); - break; - case CONNECTION_TASK_MSG_REMOVE_CHANNEL: - mrcp_server_agent_channel_remove(agent,msg->channel); - break; - case CONNECTION_TASK_MSG_SEND_MESSAGE: - mrcp_server_agent_messsage_send(agent,msg->channel->connection,msg->message); - break; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/uni-rtsp/Makefile.am b/libs/unimrcp/libs/uni-rtsp/Makefile.am deleted file mode 100644 index f058b8d94b..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/uni-rtsp/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_LTLIBRARIES = libunirtsp.la - -include_HEADERS = include/rtsp.h \ - include/rtsp_header.h \ - include/rtsp_start_line.h \ - include/rtsp_message.h \ - include/rtsp_stream.h \ - include/rtsp_server.h \ - include/rtsp_client.h - -libunirtsp_la_SOURCES = src/rtsp_header.c \ - src/rtsp_start_line.c \ - src/rtsp_message.c \ - src/rtsp_stream.c \ - src/rtsp_server.c \ - src/rtsp_client.c diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp.h deleted file mode 100644 index 89ecb81776..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_H -#define RTSP_H - -/** - * @file rtsp.h - * @brief RTSP Core Definitions - */ - -#include -#include - -/** Library export/import defines */ -#ifdef WIN32 -#ifdef RTSP_STATIC_LIB -#define RTSP_DECLARE(type) type __stdcall -#else -#ifdef RTSP_LIB_EXPORT -#define RTSP_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define RTSP_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define RTSP_DECLARE(type) type -#endif - -#endif /* RTSP_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h deleted file mode 100644 index 811ccb304f..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_client.h +++ /dev/null @@ -1,155 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_client.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_CLIENT_H -#define RTSP_CLIENT_H - -/** - * @file rtsp_client.h - * @brief RTSP Client - */ - -#include "apt_task.h" -#include "rtsp_message.h" - -APT_BEGIN_EXTERN_C - -/** Opaque RTSP client declaration */ -typedef struct rtsp_client_t rtsp_client_t; -/** Opaque RTSP client session declaration */ -typedef struct rtsp_client_session_t rtsp_client_session_t; - -/** RTSP client vtable declaration */ -typedef struct rtsp_client_vtable_t rtsp_client_vtable_t; - -/** RTSP client vtable */ -struct rtsp_client_vtable_t { - /** Sesssion termination response handler */ - apt_bool_t (*on_session_terminate_response)(rtsp_client_t *client, rtsp_client_session_t *session); - /** Sesssion termination event handler */ - apt_bool_t (*on_session_terminate_event)(rtsp_client_t *client, rtsp_client_session_t *session); - /** Sesssion setup response handler */ - apt_bool_t (*on_session_response)(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response); - /** Sesssion event handler */ - apt_bool_t (*on_session_event)(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message); -}; - -/** - * Create RTSP client. - * @param id the identifier of the client - * @param max_connection_count the number of max RTSP connections - * @param request_timeout the request timeout to set - * @param obj the external object to send event to - * @param handler the response/event handler - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_client_t*) rtsp_client_create( - const char *id, - apr_size_t max_connection_count, - apr_size_t request_timeout, - void *obj, - const rtsp_client_vtable_t *handler, - apr_pool_t *pool); - -/** - * Destroy RTSP client. - * @param client the client to destroy - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_destroy(rtsp_client_t *client); - -/** - * Start client and wait for incoming requests. - * @param client the client to start - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_start(rtsp_client_t *client); - -/** - * Terminate client. - * @param client the client to terminate - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_terminate(rtsp_client_t *client); - -/** - * Get task. - * @param client the client to get task from - */ -RTSP_DECLARE(apt_task_t*) rtsp_client_task_get(const rtsp_client_t *client); - -/** - * Get external object. - * @param client the client to get object from - */ -RTSP_DECLARE(void*) rtsp_client_object_get(const rtsp_client_t *client); - - -/** - * Create RTSP session. - * @param client the client to create session for - * @param server_ip the IP address of RTSP server - * @param server_port the port of RTSP server - * @param resource_location the location of RTSP resource (path in RTSP URI) - */ -RTSP_DECLARE(rtsp_client_session_t*) rtsp_client_session_create( - rtsp_client_t *client, - const char *server_ip, - apr_port_t server_port, - const char *resource_location); - -/** - * Destroy RTSP session. - * @param session the session to destroy - */ -RTSP_DECLARE(void) rtsp_client_session_destroy(rtsp_client_session_t *session); - -/** - * Terminate RTSP session. - * @param client the client to use - * @param session the session to terminate - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_session_terminate(rtsp_client_t *client, rtsp_client_session_t *session); - -/** - * Send RTSP message. - * @param client the client to use - * @param session the session to send RTSP request for - * @param message the RTSP request to send - */ -RTSP_DECLARE(apt_bool_t) rtsp_client_session_request(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message); - -/** - * Get object associated with the session. - * @param session the session to get object from - */ -RTSP_DECLARE(void*) rtsp_client_session_object_get(const rtsp_client_session_t *session); - -/** - * Set object associated with the session. - * @param session the session to set object for - * @param obj the object to set - */ -RTSP_DECLARE(void) rtsp_client_session_object_set(rtsp_client_session_t *session, void *obj); - -/** - * Get the session identifier. - * @param session the session to get identifier from - */ -RTSP_DECLARE(const apt_str_t*) rtsp_client_session_id_get(const rtsp_client_session_t *session); - -APT_END_EXTERN_C - -#endif /* RTSP_CLIENT_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h deleted file mode 100644 index 7d5c6cb350..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_header.h +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_header.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_HEADER_H -#define RTSP_HEADER_H - -/** - * @file rtsp_header.h - * @brief RTSP Header - */ - -#include "rtsp.h" -#include "apt_header_field.h" - -APT_BEGIN_EXTERN_C - -/** RTSP transport protocol */ -typedef enum{ - RTSP_TRANSPORT_RTP, - - RTSP_TRANSPORT_COUNT, - RTSP_TRANSPORT_NONE = RTSP_TRANSPORT_COUNT -} rtsp_transport_e; - -/** RTSP transport profile */ -typedef enum{ - RTSP_PROFILE_AVP, - RTSP_PROFILE_SAVP, - - RTSP_PROFILE_COUNT, - RTSP_PROFILE_NONE = RTSP_PROFILE_COUNT -} rtsp_profile_e; - -/** RTSP lower-transport */ -typedef enum{ - RTSP_LOWER_TRANSPORT_UDP, - RTSP_LOWER_TRANSPORT_TCP, - - RTSP_LOWER_TRANSPORT_COUNT, - RTSP_LOWER_TRANSPORT_NONE = RTSP_LOWER_TRANSPORT_COUNT -} rtsp_lower_transport_e; - -/** RTSP transport attributes */ -typedef enum{ - RTSP_TRANSPORT_ATTRIB_CLIENT_PORT, - RTSP_TRANSPORT_ATTRIB_SERVER_PORT, - RTSP_TRANSPORT_ATTRIB_SOURCE, - RTSP_TRANSPORT_ATTRIB_DESTINATION, - RTSP_TRANSPORT_ATTRIB_UNICAST, - RTSP_TRANSPORT_ATTRIB_MULTICAST, - RTSP_TRANSPORT_ATTRIB_MODE, - - RTSP_TRANSPORT_ATTRIB_COUNT, - RTSP_TRANSPORT_ATTRIB_NONE = RTSP_TRANSPORT_ATTRIB_COUNT -} rtsp_transport_attrib_e; - -/** RTSP delivery */ -typedef enum{ - RTSP_DELIVERY_UNICAST, - RTSP_DELIVERY_MULTICAST, - - RTSP_DELIVERY_COUNT, - RTSP_DELIVERY_NONE = RTSP_DELIVERY_COUNT -} rtsp_delivery_e; - -/** RTSP header fields */ -typedef enum{ - RTSP_HEADER_FIELD_CSEQ, - RTSP_HEADER_FIELD_TRANSPORT, - RTSP_HEADER_FIELD_SESSION_ID, - RTSP_HEADER_FIELD_RTP_INFO, - RTSP_HEADER_FIELD_CONTENT_TYPE, - RTSP_HEADER_FIELD_CONTENT_LENGTH, - - RTSP_HEADER_FIELD_COUNT, - RTSP_HEADER_FIELD_UNKNOWN = RTSP_HEADER_FIELD_COUNT -} rtsp_header_field_id; - -/** RTSP content types */ -typedef enum { - RTSP_CONTENT_TYPE_SDP, - RTSP_CONTENT_TYPE_MRCP, - - RTSP_CONTENT_TYPE_COUNT, - RTSP_CONTENT_TYPE_NONE = RTSP_CONTENT_TYPE_COUNT -} rtsp_content_type_e; - - - -/** RTSP/RTP port range declaration */ -typedef struct rtsp_port_range_t rtsp_port_range_t; -/** RTSP transport declaration */ -typedef struct rtsp_transport_t rtsp_transport_t; -/** RTSP header declaration */ -typedef struct rtsp_header_t rtsp_header_t; - -/** RTSP/RTP port range */ -struct rtsp_port_range_t { - /** Min (low) port */ - apr_port_t min; - /** Max (high) port */ - apr_port_t max; -}; - -/** RTSP transport */ -struct rtsp_transport_t { - /** Transport profile */ - rtsp_transport_e protocol; - /** Transport profile */ - rtsp_profile_e profile; - /** Lower transport */ - rtsp_lower_transport_e lower_protocol; - /** Delivery method */ - rtsp_delivery_e delivery; - /** Client port range */ - rtsp_port_range_t client_port_range; - /** Server port range */ - rtsp_port_range_t server_port_range; - /** Source IP address */ - apt_str_t source; - /** Destination IP address */ - apt_str_t destination; - /** Mode indicates the method to support (either PLAY or RECORD) */ - apt_str_t mode; -}; - -/** RTSP header */ -struct rtsp_header_t { - /** Sequence number */ - apr_size_t cseq; - /** Transport */ - rtsp_transport_t transport; - /** Session identifier */ - apt_str_t session_id; - /** RTP-info */ - apt_str_t rtp_info; - - /** Content type */ - rtsp_content_type_e content_type; - /** Content length */ - apr_size_t content_length; - - /** Header section (collection of header fields)*/ - apt_header_section_t header_section; -}; - - -/** Initialize port range */ -static APR_INLINE void rtsp_port_range_init(rtsp_port_range_t *port_range) -{ - port_range->min = 0; - port_range->max = 0; -} - -/** Initialize port range */ -static APR_INLINE apt_bool_t rtsp_port_range_is_valid(const rtsp_port_range_t *port_range) -{ - return (port_range->min == 0 && port_range->max == 0) == FALSE; -} - -/** Initialize transport */ -static APR_INLINE void rtsp_transport_init(rtsp_transport_t *transport) -{ - transport->protocol = RTSP_TRANSPORT_RTP; - transport->profile = RTSP_PROFILE_NONE; - transport->lower_protocol = RTSP_LOWER_TRANSPORT_NONE; - rtsp_port_range_init(&transport->client_port_range); - rtsp_port_range_init(&transport->server_port_range); - apt_string_reset(&transport->source); - apt_string_reset(&transport->destination); - apt_string_reset(&transport->mode); -} - -/** Initialize header */ -static APR_INLINE void rtsp_header_init(rtsp_header_t *header, apr_pool_t *pool) -{ - header->cseq = 0; - rtsp_transport_init(&header->transport); - apt_string_reset(&header->session_id); - apt_string_reset(&header->rtp_info); - header->content_type = RTSP_CONTENT_TYPE_NONE; - header->content_length = 0; - - apt_header_section_init(&header->header_section); - apt_header_section_array_alloc(&header->header_section,RTSP_HEADER_FIELD_COUNT,pool); -} - - -/** Add RTSP header field */ -RTSP_DECLARE(apt_bool_t) rtsp_header_field_add(rtsp_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool); - -/** Parse RTSP header fields */ -RTSP_DECLARE(apt_bool_t) rtsp_header_fields_parse(rtsp_header_t *header, apr_pool_t *pool); - -/** Add RTSP header field property */ -RTSP_DECLARE(apt_bool_t) rtsp_header_property_add(rtsp_header_t *header, rtsp_header_field_id id, apr_pool_t *pool); - -/** Remove RTSP header field property */ -static APR_INLINE apt_bool_t rtsp_header_property_remove(rtsp_header_t *header, rtsp_header_field_id id) -{ - apt_header_field_t *header_field = apt_header_section_field_get(&header->header_section,id); - if(header_field) { - return apt_header_section_field_remove(&header->header_section,header_field); - } - return FALSE; -} - -/** Check RTSP header field property */ -static APR_INLINE apt_bool_t rtsp_header_property_check(const rtsp_header_t *header, rtsp_header_field_id id) -{ - return apt_header_section_field_check(&header->header_section,id); -} - - -APT_END_EXTERN_C - -#endif /* RTSP_HEADER_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h deleted file mode 100644 index a636bc4de7..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_message.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_message.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_MESSAGE_H -#define RTSP_MESSAGE_H - -/** - * @file rtsp_message.h - * @brief RTSP Message Definition - */ - -#include "rtsp_start_line.h" -#include "rtsp_header.h" - -APT_BEGIN_EXTERN_C - -/** RTSP message declaration */ -typedef struct rtsp_message_t rtsp_message_t; - -/** RTSP message */ -struct rtsp_message_t { - /** RTSP mesage type (request/response) */ - rtsp_start_line_t start_line; - /** RTSP header */ - rtsp_header_t header; - /** RTSP message body */ - apt_str_t body; - - /** Pool to allocate memory from */ - apr_pool_t *pool; -}; - -/** - * Create RTSP message. - * @param message_type the message type - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool); - -/** - * Create RTSP request message. - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool); - -/** - * Create RTSP response message. - * @param request the request to create response to - * @param status_code the status code of the response - * @param reason the reason phrase id of the response - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool); - -/** - * Destroy RTSP message - * @param message the message to destroy - */ -RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message); - -APT_END_EXTERN_C - -#endif /* RTSP_MESSAGE_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h deleted file mode 100644 index 768ed2c23a..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_server.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_server.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_SERVER_H -#define RTSP_SERVER_H - -/** - * @file rtsp_server.h - * @brief RTSP Server - */ - -#include "apt_task.h" -#include "rtsp_message.h" - -APT_BEGIN_EXTERN_C - -/** Opaque RTSP server declaration */ -typedef struct rtsp_server_t rtsp_server_t; -/** Opaque RTSP server session declaration */ -typedef struct rtsp_server_session_t rtsp_server_session_t; - -/** RTSP server vtable declaration */ -typedef struct rtsp_server_vtable_t rtsp_server_vtable_t; - -/** RTSP server vtable declaration */ -struct rtsp_server_vtable_t { - /** Virtual create session */ - apt_bool_t (*create_session)(rtsp_server_t *server, rtsp_server_session_t *session); - /** Virtual terminate session */ - apt_bool_t (*terminate_session)(rtsp_server_t *server, rtsp_server_session_t *session); - /** Virtual message handler */ - apt_bool_t (*handle_message)(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message); -}; - -/** - * Create RTSP server. - * @param id the identifier of the server - * @param listen_ip the listen IP address - * @param listen_port the listen port - * @param max_connection_count the number of max RTSP connections - * @param obj the external object to send events to - * @param handler the request handler - * @param pool the pool to allocate memory from - */ -RTSP_DECLARE(rtsp_server_t*) rtsp_server_create( - const char *id, - const char *listen_ip, - apr_port_t listen_port, - apr_size_t max_connection_count, - void *obj, - const rtsp_server_vtable_t *handler, - apr_pool_t *pool); - -/** - * Destroy RTSP server. - * @param server the server to destroy - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_destroy(rtsp_server_t *server); - -/** - * Start server and wait for incoming requests. - * @param server the server to start - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_start(rtsp_server_t *server); - -/** - * Terminate server. - * @param server the server to terminate - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_terminate(rtsp_server_t *server); - -/** - * Get task. - * @param server the server to get task from - */ -RTSP_DECLARE(apt_task_t*) rtsp_server_task_get(const rtsp_server_t *server); - -/** - * Get external object. - * @param server the server to get object from - */ -RTSP_DECLARE(void*) rtsp_server_object_get(const rtsp_server_t *server); - -/** - * Send RTSP message. - * @param server the server to use - * @param session the session to send RTSP response for - * @param message the RTSP response to send - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_session_respond(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message); - -/** - * Terminate RTSP session (respond to terminate request). - * @param server the server to use - * @param session the session to terminate - */ -RTSP_DECLARE(apt_bool_t) rtsp_server_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session); - -/** - * Get object associated with the session. - * @param session the session to get object from - */ -RTSP_DECLARE(void*) rtsp_server_session_object_get(const rtsp_server_session_t *session); - -/** - * Set object associated with the session. - * @param session the session to set object for - * @param obj the object to set - */ -RTSP_DECLARE(void) rtsp_server_session_object_set(rtsp_server_session_t *session, void *obj); - -/** - * Get the session identifier. - * @param session the session to get identifier from - */ -RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_session_t *session); - -/** - * Get active (in-progress) session request. - * @param session the session to get from - */ -RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session); - -/** - * Get the session destination (client) IP address. - * @param session the session to get IP address from - */ -RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session); - -APT_END_EXTERN_C - -#endif /* RTSP_SERVER_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h deleted file mode 100644 index dd53193d43..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_start_line.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_start_line.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_START_LINE_H -#define RTSP_START_LINE_H - -/** - * @file rtsp_start_line.h - * @brief RTSP Start Line (request-line/status-line) - */ - -#include "rtsp.h" -#include "apt_text_stream.h" - -APT_BEGIN_EXTERN_C - -/** Protocol version */ -typedef enum { - /** Unknown version */ - RTSP_VERSION_UNKNOWN = 0, - /** RTSP 1.0 */ - RTSP_VERSION_1 = 1, -} rtsp_version_e; - -/** RTSP message types */ -typedef enum { - RTSP_MESSAGE_TYPE_UNKNOWN, - RTSP_MESSAGE_TYPE_REQUEST, - RTSP_MESSAGE_TYPE_RESPONSE -} rtsp_message_type_e; - -/** RTSP methods */ -typedef enum{ - RTSP_METHOD_SETUP, - RTSP_METHOD_ANNOUNCE, - RTSP_METHOD_TEARDOWN, - RTSP_METHOD_DESCRIBE, - - RTSP_METHOD_COUNT, - RTSP_METHOD_UNKNOWN = RTSP_METHOD_COUNT -} rtsp_method_id; - -/** Status codes */ -typedef enum { - RTSP_STATUS_CODE_UNKNOWN = 0, - /** Success codes (2xx) */ - RTSP_STATUS_CODE_OK = 200, - RTSP_STATUS_CODE_CREATED = 201, - /** Failure codec (4xx) */ - RTSP_STATUS_CODE_BAD_REQUEST = 400, - RTSP_STATUS_CODE_UNAUTHORIZED = 401, - RTSP_STATUS_CODE_NOT_FOUND = 404, - RTSP_STATUS_CODE_METHOD_NOT_ALLOWED = 405, - RTSP_STATUS_CODE_NOT_ACCEPTABLE = 406, - RTSP_STATUS_CODE_PROXY_AUTH_REQUIRED = 407, - RTSP_STATUS_CODE_REQUEST_TIMEOUT = 408, - RTSP_STATUS_CODE_SESSION_NOT_FOUND = 454, - - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR = 500, - RTSP_STATUS_CODE_NOT_IMPLEMENTED = 501, -} rtsp_status_code_e; - -/** Reason phrases */ -typedef enum { - RTSP_REASON_PHRASE_OK, - RTSP_REASON_PHRASE_CREATED, - RTSP_REASON_PHRASE_BAD_REQUEST, - RTSP_REASON_PHRASE_UNAUTHORIZED, - RTSP_REASON_PHRASE_NOT_FOUND, - RTSP_REASON_PHRASE_METHOD_NOT_ALLOWED, - RTSP_REASON_PHRASE_NOT_ACCEPTABLE, - RTSP_REASON_PHRASE_PROXY_AUTH_REQUIRED, - RTSP_REASON_PHRASE_REQUEST_TIMEOUT, - RTSP_REASON_PHRASE_SESSION_NOT_FOUND, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_NOT_IMPLEMENTED, - RTSP_REASON_PHRASE_COUNT, - - /** Unknown reason phrase */ - RTSP_REASON_PHRASE_UNKNOWN = RTSP_REASON_PHRASE_COUNT -} rtsp_reason_phrase_e; - - -/** RTSP request-line declaration */ -typedef struct rtsp_request_line_t rtsp_request_line_t; -/** RTSP status-line declaration */ -typedef struct rtsp_status_line_t rtsp_status_line_t; -/** RTSP start-line declaration */ -typedef struct rtsp_start_line_t rtsp_start_line_t; - -/** RTSP request-line */ -struct rtsp_request_line_t { - /** Method name */ - apt_str_t method_name; - /** Method id */ - rtsp_method_id method_id; - /** RTSP URL */ - apt_str_t url; - /** Resource name parsed from RTSP URL */ - const char *resource_name; - /** Version of protocol in use */ - rtsp_version_e version; -}; - -/** RTSP status-line */ -struct rtsp_status_line_t { - /** Version of protocol in use */ - rtsp_version_e version; - /** success or failure or other status of the request */ - rtsp_status_code_e status_code; - /** Reason phrase */ - apt_str_t reason; -}; - -/** RTSP start-line */ -struct rtsp_start_line_t { - /** RTSP message type */ - rtsp_message_type_e message_type; - /** RTSP start-line */ - union { - rtsp_request_line_t request_line; - rtsp_status_line_t status_line; - } common; -}; - - -static APR_INLINE void rtsp_request_line_init(rtsp_request_line_t *request_line) -{ - apt_string_reset(&request_line->method_name); - request_line->method_id = RTSP_METHOD_UNKNOWN; - apt_string_reset(&request_line->url); - request_line->resource_name = NULL; - request_line->version = RTSP_VERSION_1; -} - -static APR_INLINE void rtsp_status_line_init(rtsp_status_line_t *status_line) -{ - status_line->version = RTSP_VERSION_1; - status_line->status_code = RTSP_STATUS_CODE_OK; - apt_string_reset(&status_line->reason); -} - -/** Initialize RTSP start-line */ -static APR_INLINE void rtsp_start_line_init(rtsp_start_line_t *start_line, rtsp_message_type_e message_type) -{ - start_line->message_type = message_type; - if(message_type == RTSP_MESSAGE_TYPE_REQUEST) { - rtsp_request_line_init(&start_line->common.request_line); - } - else if(message_type == RTSP_MESSAGE_TYPE_RESPONSE) { - rtsp_status_line_init(&start_line->common.status_line); - } -} - -/** Parse RTSP start-line */ -RTSP_DECLARE(apt_bool_t) rtsp_start_line_parse(rtsp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool); - -/** Generate RTSP start-line */ -RTSP_DECLARE(apt_bool_t) rtsp_start_line_generate(rtsp_start_line_t *start_line, apt_text_stream_t *text_stream); - -/** Get reason phrase by status code */ -RTSP_DECLARE(const apt_str_t*) rtsp_reason_phrase_get(rtsp_reason_phrase_e reason); - -APT_END_EXTERN_C - -#endif /* RTSP_START_LINE_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h b/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h deleted file mode 100644 index a4cc4e1385..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/include/rtsp_stream.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_stream.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RTSP_STREAM_H -#define RTSP_STREAM_H - -/** - * @file rtsp_stream.h - * @brief RTSP Stream Parser and Generator - */ - -#include "rtsp_message.h" -#include "apt_text_message.h" - -APT_BEGIN_EXTERN_C - -/** Opaque RTSP parser declaration */ -typedef struct rtsp_parser_t rtsp_parser_t; -/** Opaque RTSP generator declaration */ -typedef struct rtsp_generator_t rtsp_generator_t; - - -/** Create RTSP stream parser */ -RTSP_DECLARE(rtsp_parser_t*) rtsp_parser_create(apr_pool_t *pool); - -/** Parse RTSP stream */ -RTSP_DECLARE(apt_message_status_e) rtsp_parser_run(rtsp_parser_t *parser, apt_text_stream_t *stream, rtsp_message_t **message); - - -/** Create RTSP stream generator */ -RTSP_DECLARE(rtsp_generator_t*) rtsp_generator_create(apr_pool_t *pool); - -/** Generate RTSP stream */ -RTSP_DECLARE(apt_message_status_e) rtsp_generator_run(rtsp_generator_t *generator, rtsp_message_t *message, apt_text_stream_t *stream); - - -APT_END_EXTERN_C - -#endif /* RTSP_STREAM_H */ diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c deleted file mode 100644 index bf783aba65..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_client.c +++ /dev/null @@ -1,992 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_client.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include -#include "rtsp_client.h" -#include "rtsp_stream.h" -#include "apt_poller_task.h" -#include "apt_text_stream.h" -#include "apt_pool.h" -#include "apt_obj_list.h" -#include "apt_log.h" - -#define RTSP_STREAM_BUFFER_SIZE 1024 - -typedef struct rtsp_client_connection_t rtsp_client_connection_t; - -typedef enum { - TERMINATION_STATE_NONE, - TERMINATION_STATE_REQUESTED, - TERMINATION_STATE_INPROGRESS -} termination_state_e; - -/** RTSP client */ -struct rtsp_client_t { - apr_pool_t *pool; - apt_poller_task_t *task; - - /** List (ring) of RTSP connections */ - APR_RING_HEAD(rtsp_client_connection_head_t, rtsp_client_connection_t) connection_list; - - apr_uint32_t request_timeout; - - void *obj; - const rtsp_client_vtable_t *vtable; -}; - -/** RTSP connection */ -struct rtsp_client_connection_t { - /** Ring entry */ - APR_RING_ENTRY(rtsp_client_connection_t) link; - - /** Memory pool */ - apr_pool_t *pool; - /** Connected socket */ - apr_socket_t *sock; - /** Socket poll descriptor */ - apr_pollfd_t sock_pfd; - /** String identifier used for traces */ - const char *id; - /** RTSP client, connection belongs to */ - rtsp_client_t *client; - - /** Handle table (rtsp_client_session_t*) */ - apr_hash_t *handle_table; - /** Session table (rtsp_client_session_t*) */ - apr_hash_t *session_table; - - /** Inprogress request/session queue (rtsp_client_session_t*) */ - apt_obj_list_t *inprogress_request_queue; - - /** Last CSeq sent */ - apr_size_t last_cseq; - - char rx_buffer[RTSP_STREAM_BUFFER_SIZE]; - apt_text_stream_t rx_stream; - rtsp_parser_t *parser; - - char tx_buffer[RTSP_STREAM_BUFFER_SIZE]; - apt_text_stream_t tx_stream; - rtsp_generator_t *generator; -}; - -/** RTSP session */ -struct rtsp_client_session_t { - apr_pool_t *pool; - void *obj; - - /** Connection */ - rtsp_client_connection_t *connection; - /** Session identifier */ - apt_str_t id; - - apt_str_t server_ip; - apr_port_t server_port; - apt_str_t resource_location; - - /** In-progress request */ - rtsp_message_t *active_request; - /** Pending request queue (rtsp_message_t*) */ - apt_obj_list_t *pending_request_queue; - - /** Timer used for request timeouts */ - apt_timer_t *request_timer; - - /** Resource table */ - apr_hash_t *resource_table; - - /** termination state (none -> requested -> terminating) */ - termination_state_e term_state; -}; - -typedef enum { - TASK_MSG_SEND_MESSAGE, - TASK_MSG_TERMINATE_SESSION -} task_msg_data_type_e; - -typedef struct task_msg_data_t task_msg_data_t; - -struct task_msg_data_t { - task_msg_data_type_e type; - rtsp_client_t *client; - rtsp_client_session_t *session; - rtsp_message_t *message; -}; - -static apt_bool_t rtsp_client_task_msg_process(apt_task_t *task, apt_task_msg_t *msg); - -static apt_bool_t rtsp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor); - -static apt_bool_t rtsp_client_message_handler(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status); -static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, rtsp_client_connection_t *connection, rtsp_message_t *message); -static apt_bool_t rtsp_client_session_message_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message); -static apt_bool_t rtsp_client_session_response_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response); - -static void rtsp_client_timer_proc(apt_timer_t *timer, void *obj); - -/** Get string identifier */ -static const char* rtsp_client_id_get(const rtsp_client_t *client) -{ - apt_task_t *task = apt_poller_task_base_get(client->task); - return apt_task_name_get(task); -} - -/** Create RTSP client */ -RTSP_DECLARE(rtsp_client_t*) rtsp_client_create( - const char *id, - apr_size_t max_connection_count, - apr_size_t request_timeout, - void *obj, - const rtsp_client_vtable_t *handler, - apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - rtsp_client_t *client; - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Client [%s] [%"APR_SIZE_T_FMT"]", - id, max_connection_count); - client = apr_palloc(pool,sizeof(rtsp_client_t)); - client->pool = pool; - client->obj = obj; - client->vtable = handler; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(task_msg_data_t),pool); - - client->task = apt_poller_task_create( - max_connection_count, - rtsp_client_poller_signal_process, - client, - msg_pool, - pool); - if(!client->task) { - return NULL; - } - - task = apt_poller_task_base_get(client->task); - if(task) { - apt_task_name_set(task,id); - } - - vtable = apt_poller_task_vtable_get(client->task); - if(vtable) { - vtable->process_msg = rtsp_client_task_msg_process; - } - - APR_RING_INIT(&client->connection_list, rtsp_client_connection_t, link); - client->request_timeout = (apr_uint32_t)request_timeout; - return client; -} - -/** Destroy RTSP client */ -RTSP_DECLARE(apt_bool_t) rtsp_client_destroy(rtsp_client_t *client) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Client [%s]", - rtsp_client_id_get(client)); - return apt_poller_task_destroy(client->task); -} - -/** Start connection agent */ -RTSP_DECLARE(apt_bool_t) rtsp_client_start(rtsp_client_t *client) -{ - return apt_poller_task_start(client->task); -} - -/** Terminate connection agent */ -RTSP_DECLARE(apt_bool_t) rtsp_client_terminate(rtsp_client_t *client) -{ - return apt_poller_task_terminate(client->task); -} - -/** Get task */ -RTSP_DECLARE(apt_task_t*) rtsp_client_task_get(const rtsp_client_t *client) -{ - return apt_poller_task_base_get(client->task); -} - -/** Get external object */ -RTSP_DECLARE(void*) rtsp_client_object_get(const rtsp_client_t *client) -{ - return client->obj; -} - -/** Get object associated with the session */ -RTSP_DECLARE(void*) rtsp_client_session_object_get(const rtsp_client_session_t *session) -{ - return session->obj; -} - -/** Set object associated with the session */ -RTSP_DECLARE(void) rtsp_client_session_object_set(rtsp_client_session_t *session, void *obj) -{ - session->obj = obj; -} - -/** Get the session identifier */ -RTSP_DECLARE(const apt_str_t*) rtsp_client_session_id_get(const rtsp_client_session_t *session) -{ - return &session->id; -} - -/** Signal task message */ -static apt_bool_t rtsp_client_control_message_signal( - task_msg_data_type_e type, - rtsp_client_t *client, - rtsp_client_session_t *session, - rtsp_message_t *message) -{ - apt_task_t *task = apt_poller_task_base_get(client->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - task_msg_data_t *data = (task_msg_data_t*)task_msg->data; - data->type = type; - data->client = client; - data->session = session; - data->message = message; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Create RTSP session handle */ -RTSP_DECLARE(rtsp_client_session_t*) rtsp_client_session_create( - rtsp_client_t *client, - const char *server_ip, - apr_port_t server_port, - const char *resource_location) -{ - rtsp_client_session_t *session; - apr_pool_t *pool = apt_pool_create(); - session = apr_palloc(pool,sizeof(rtsp_client_session_t)); - session->pool = pool; - session->obj = NULL; - session->connection = NULL; - session->active_request = NULL; - session->pending_request_queue = apt_list_create(pool); - session->request_timer = apt_poller_task_timer_create( - client->task, - rtsp_client_timer_proc, - session, - pool); - session->resource_table = apr_hash_make(pool); - session->term_state = TERMINATION_STATE_NONE; - - apt_string_assign(&session->server_ip,server_ip,pool); - session->server_port = server_port; - apt_string_assign(&session->resource_location,resource_location,pool); - apt_string_reset(&session->id); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Handle "APT_PTR_FMT,session); - return session; -} - -/** Destroy RTSP session handle */ -RTSP_DECLARE(void) rtsp_client_session_destroy(rtsp_client_session_t *session) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Handle "APT_PTR_FMT,session); - if(session && session->pool) { - apr_pool_destroy(session->pool); - } -} - -/** Signal terminate request */ -RTSP_DECLARE(apt_bool_t) rtsp_client_session_terminate(rtsp_client_t *client, rtsp_client_session_t *session) -{ - return rtsp_client_control_message_signal(TASK_MSG_TERMINATE_SESSION,client,session,NULL); -} - -/** Signal RTSP message */ -RTSP_DECLARE(apt_bool_t) rtsp_client_session_request(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message) -{ - return rtsp_client_control_message_signal(TASK_MSG_SEND_MESSAGE,client,session,message); -} - - -/** Create connection */ -static apt_bool_t rtsp_client_connect(rtsp_client_t *client, rtsp_client_connection_t *connection, const char *ip, apr_port_t port) -{ - char *local_ip = NULL; - char *remote_ip = NULL; - apr_sockaddr_t *l_sockaddr = NULL; - apr_sockaddr_t *r_sockaddr = NULL; - - if(apr_sockaddr_info_get(&r_sockaddr,ip,APR_INET,port,0,connection->pool) != APR_SUCCESS) { - return FALSE; - } - - if(apr_socket_create(&connection->sock,r_sockaddr->family,SOCK_STREAM,APR_PROTO_TCP,connection->pool) != APR_SUCCESS) { - return FALSE; - } - - apr_socket_opt_set(connection->sock, APR_SO_NONBLOCK, 0); - apr_socket_timeout_set(connection->sock, -1); - apr_socket_opt_set(connection->sock, APR_SO_REUSEADDR, 1); - - if(apr_socket_connect(connection->sock,r_sockaddr) != APR_SUCCESS) { - apr_socket_close(connection->sock); - connection->sock = NULL; - return FALSE; - } - - if(apr_socket_addr_get(&l_sockaddr,APR_LOCAL,connection->sock) != APR_SUCCESS) { - apr_socket_close(connection->sock); - connection->sock = NULL; - return FALSE; - } - - apr_sockaddr_ip_get(&local_ip,l_sockaddr); - apr_sockaddr_ip_get(&remote_ip,r_sockaddr); - connection->id = apr_psprintf(connection->pool,"%s:%hu <-> %s:%hu", - local_ip,l_sockaddr->port, - remote_ip,r_sockaddr->port); - - memset(&connection->sock_pfd,0,sizeof(apr_pollfd_t)); - connection->sock_pfd.desc_type = APR_POLL_SOCKET; - connection->sock_pfd.reqevents = APR_POLLIN; - connection->sock_pfd.desc.s = connection->sock; - connection->sock_pfd.client_data = connection; - if(apt_poller_task_descriptor_add(client->task,&connection->sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",connection->id); - apr_socket_close(connection->sock); - connection->sock = NULL; - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Established RTSP Connection %s",connection->id); - return TRUE; -} - -/** Close connection */ -static apt_bool_t rtsp_client_connection_close(rtsp_client_t *client, rtsp_client_connection_t *connection) -{ - if(connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTSP Connection %s",connection->id); - apt_poller_task_descriptor_remove(client->task,&connection->sock_pfd); - apr_socket_close(connection->sock); - connection->sock = NULL; - } - return TRUE; -} - - -/* Create RTSP connection */ -static apt_bool_t rtsp_client_connection_create(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_client_connection_t *rtsp_connection; - apr_pool_t *pool = apt_pool_create(); - if(!pool) { - return FALSE; - } - - rtsp_connection = apr_palloc(pool,sizeof(rtsp_client_connection_t)); - rtsp_connection->pool = pool; - rtsp_connection->sock = NULL; - APR_RING_ELEM_INIT(rtsp_connection,link); - - if(rtsp_client_connect(client,rtsp_connection,session->server_ip.buf,session->server_port) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Connect to RTSP Server %s:%hu", - session->server_ip.buf,session->server_port); - apr_pool_destroy(pool); - return FALSE; - } - rtsp_connection->handle_table = apr_hash_make(pool); - rtsp_connection->session_table = apr_hash_make(pool); - rtsp_connection->inprogress_request_queue = apt_list_create(pool); - apt_text_stream_init(&rtsp_connection->rx_stream,rtsp_connection->rx_buffer,sizeof(rtsp_connection->rx_buffer)-1); - apt_text_stream_init(&rtsp_connection->tx_stream,rtsp_connection->tx_buffer,sizeof(rtsp_connection->tx_buffer)-1); - rtsp_connection->parser = rtsp_parser_create(pool); - rtsp_connection->generator = rtsp_generator_create(pool); - rtsp_connection->last_cseq = 0; - - rtsp_connection->client = client; - APR_RING_INSERT_TAIL(&client->connection_list,rtsp_connection,rtsp_client_connection_t,link); - session->connection = rtsp_connection; - return TRUE; -} - -/* Destroy RTSP connection */ -static apt_bool_t rtsp_client_connection_destroy(rtsp_client_connection_t *rtsp_connection) -{ - rtsp_client_t *client = rtsp_connection->client; - APR_RING_REMOVE(rtsp_connection,link); - rtsp_client_connection_close(client,rtsp_connection); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Connection %s",rtsp_connection->id); - apr_pool_destroy(rtsp_connection->pool); - - return TRUE; -} - -/* Respond to session termination request */ -static apt_bool_t rtsp_client_session_terminate_respond(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_client_connection_t *rtsp_connection = session->connection; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Handle "APT_PTR_FMT,session); - apr_hash_set(rtsp_connection->handle_table,session,sizeof(void*),NULL); - - session->term_state = TERMINATION_STATE_NONE; - client->vtable->on_session_terminate_response(client,session); - return TRUE; -} - -/* Teardown session resources */ -static apt_bool_t rtsp_client_session_resources_teardown(rtsp_client_t *client, rtsp_client_session_t *session) -{ - void *val; - rtsp_message_t *setup_request; - rtsp_message_t *teardown_request; - apr_hash_index_t *it; - - /* set termination state to in-progress and teardown remaining resources */ - session->term_state = TERMINATION_STATE_INPROGRESS; - it = apr_hash_first(session->pool,session->resource_table); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - setup_request = val; - if(!setup_request) continue; - - teardown_request = rtsp_request_create(session->pool); - teardown_request->start_line.common.request_line.resource_name = setup_request->start_line.common.request_line.resource_name; - teardown_request->start_line.common.request_line.method_id = RTSP_METHOD_TEARDOWN; - rtsp_client_session_message_process(client,session,teardown_request); - } - return TRUE; -} - -/* Process session termination request */ -static apt_bool_t rtsp_client_session_terminate_process(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_client_connection_t *rtsp_connection = session->connection; - if(!rtsp_connection) { - client->vtable->on_session_terminate_response(client,session); - return FALSE; - } - - if(session->active_request) { - /* set termination state to requested */ - session->term_state = TERMINATION_STATE_REQUESTED; - } - else { - rtsp_client_session_resources_teardown(client,session); - - /* respond immediately if no resources left */ - if(apr_hash_count(session->resource_table) == 0) { - rtsp_client_session_terminate_respond(client,session); - - if(apr_hash_count(rtsp_connection->handle_table) == 0) { - rtsp_client_connection_destroy(rtsp_connection); - } - } - } - - return TRUE; -} - -static apt_bool_t rtsp_client_session_url_generate(rtsp_client_session_t *session, rtsp_message_t *message) -{ - apt_str_t *url = &message->start_line.common.request_line.url; - if(session->resource_location.length) { - url->buf = apr_psprintf(message->pool,"rtsp://%s:%hu/%s/%s", - session->server_ip.buf, - session->server_port, - session->resource_location.buf, - message->start_line.common.request_line.resource_name); - } - else { - url->buf = apr_psprintf(message->pool,"rtsp://%s:%hu/%s", - session->server_ip.buf, - session->server_port, - message->start_line.common.request_line.resource_name); - } - url->length = strlen(url->buf); - return TRUE; -} - -static apt_bool_t rtsp_client_request_push(rtsp_client_connection_t *rtsp_connection, rtsp_client_session_t *session, rtsp_message_t *message) -{ - /* add request to inprogress request queue */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Push RTSP Request to In-Progress Queue "APT_PTRSID_FMT" CSeq:%"APR_SIZE_T_FMT, - session, - message->header.session_id.buf ? message->header.session_id.buf : "new", - message->header.cseq); - apt_list_push_back(rtsp_connection->inprogress_request_queue,session,session->pool); - session->active_request = message; - if(rtsp_connection->client->request_timeout) { - apt_timer_set(session->request_timer,rtsp_connection->client->request_timeout); - } - return TRUE; -} - -static apt_bool_t rtsp_client_request_pop(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *response, rtsp_message_t **ret_request, rtsp_client_session_t **ret_session) -{ - rtsp_client_session_t *session; - apt_list_elem_t *elem = apt_list_first_elem_get(rtsp_connection->inprogress_request_queue); - while(elem) { - session = apt_list_elem_object_get(elem); - if(session->active_request && session->active_request->header.cseq == response->header.cseq) { - if(ret_session) { - *ret_session = session; - } - if(ret_request) { - *ret_request = session->active_request; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Pop In-Progress RTSP Request "APT_PTR_FMT" CSeq:%"APR_SIZE_T_FMT, - session, - response->header.cseq); - apt_list_elem_remove(rtsp_connection->inprogress_request_queue,elem); - session->active_request = NULL; - apt_timer_kill(session->request_timer); - return TRUE; - } - elem = apt_list_next_elem_get(rtsp_connection->inprogress_request_queue,elem); - } - return FALSE; -} - -/* Process outgoing RTSP request */ -static apt_bool_t rtsp_client_session_request_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message) -{ - if(!session->connection) { - /* create RTSP connection */ - if(rtsp_client_connection_create(client,session) == FALSE) { - /* respond with error */ - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Handle "APT_PTR_FMT,session); - apr_hash_set(session->connection->handle_table,session,sizeof(void*),session); - } - - rtsp_client_session_url_generate(session,message); - - if(session->id.length) { - message->header.session_id = session->id; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool); - } - - message->header.cseq = ++session->connection->last_cseq; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_CSEQ,message->pool); - - if(rtsp_client_message_send(client,session->connection,message) == FALSE) { - /* respond with error */ - return FALSE; - } - - return rtsp_client_request_push(session->connection,session,message); -} - -/* Process pending RTSP requests */ -static apt_bool_t rtsp_client_session_pending_requests_process(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_message_t *request = apt_list_pop_front(session->pending_request_queue); - if(!request) { - /* pending queue is empty, no in-progress request */ - return FALSE; - } - - /* process pending request; get the next one, if current is failed */ - do { - rtsp_message_t *response; - if(rtsp_client_session_request_process(client,session,request) == TRUE) { - return TRUE; - } - - /* respond with error */ - response = rtsp_response_create( - request, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR, - session->pool); - rtsp_client_session_response_process(client,session,request,response); - - /* process the next pending request / if any */ - request = apt_list_pop_front(session->pending_request_queue); - } - while(request); - - /* no in-progress request */ - return FALSE; -} - - -/* Process outgoing RTSP message */ -static apt_bool_t rtsp_client_session_message_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message) -{ - if(session->active_request) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push RTSP Request to Pending Queue "APT_PTR_FMT,session); - apt_list_push_back(session->pending_request_queue,message,message->pool); - return TRUE; - } - - if(rtsp_client_session_request_process(client,session,message) == FALSE) { - /* respond with error in case request cannot be processed */ - rtsp_message_t *response = rtsp_response_create( - message, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR, - session->pool); - rtsp_client_session_response_process(client,session,message,response); - } - return TRUE; -} - -/* Process incoming RTSP event (request) */ -static apt_bool_t rtsp_client_session_event_process(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message) -{ - rtsp_message_t *response = NULL; - rtsp_client_session_t *session = NULL; - if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) { - /* find existing session */ - session = apr_hash_get( - rtsp_connection->session_table, - message->header.session_id.buf, - message->header.session_id.length); - } - - if(session) { - response = rtsp_response_create(message,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,message->pool); - if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) { - response->header.session_id = message->header.session_id; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool); - } - client->vtable->on_session_event(client,session,message); - } - else { - response = rtsp_response_create(message,RTSP_STATUS_CODE_NOT_FOUND,RTSP_REASON_PHRASE_NOT_FOUND,message->pool); - } - - return rtsp_client_message_send(client,rtsp_connection,response); -} - -/* Process incoming RTSP response */ -static apt_bool_t rtsp_client_session_response_process(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response) -{ - const char *resource_name; - if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP && - response->start_line.common.status_line.status_code == RTSP_STATUS_CODE_OK) { - - if(apr_hash_count(session->resource_table) == 0) { - if(rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_SESSION_ID) == TRUE) { - session->id = response->header.session_id; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_PTRSID_FMT, - session, - session->id.buf); - apr_hash_set(session->connection->session_table,session->id.buf,session->id.length,session); - } - } - - /* add resource */ - resource_name = request->start_line.common.request_line.resource_name; - apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,request); - } - else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) { - /* remove resource */ - resource_name = request->start_line.common.request_line.resource_name; - apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,NULL); - - if(apr_hash_count(session->resource_table) == 0) { - if(session->connection) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Session "APT_PTRSID_FMT, - session, - session->id.buf); - apr_hash_set(session->connection->session_table,session->id.buf,session->id.length,NULL); - } - } - } - - if(session->term_state != TERMINATION_STATE_INPROGRESS) { - client->vtable->on_session_response(client,session,request,response); - } - - return TRUE; -} - -/* Raise RTSP session terminate event */ -static apt_bool_t rtsp_client_session_terminate_raise(rtsp_client_t *client, rtsp_client_session_t *session) -{ - rtsp_message_t *request; - rtsp_message_t *response; - - /* cancel pending requests */ - do { - request = apt_list_pop_front(session->pending_request_queue); - if(request) { - response = rtsp_response_create( - session->active_request, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR, - session->pool); - rtsp_client_session_response_process(client,session,request,response); - } - } - while(request); - - if(session->term_state == TERMINATION_STATE_NONE) { - client->vtable->on_session_terminate_event(client,session); - } - else { - rtsp_client_session_terminate_respond(client,session); - } - return TRUE; -} - -/* Cancel RTSP request */ -static apt_bool_t rtsp_client_request_cancel(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason) -{ - rtsp_message_t *request; - rtsp_message_t *response; - if(!session->active_request) { - return FALSE; - } - - request = session->active_request; - response = rtsp_response_create( - request, - status_code, - reason, - session->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cancel RTSP Request "APT_PTRSID_FMT" CSeq:%"APR_SIZE_T_FMT" [%d]", - session, - request->header.session_id.buf ? request->header.session_id.buf : "new", - request->header.cseq, - status_code); - - return rtsp_client_message_handler(session->connection, response, APT_MESSAGE_STATUS_COMPLETE); -} - -/* RTSP connection disconnected */ -static apt_bool_t rtsp_client_on_disconnect(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection) -{ - rtsp_client_session_t *session; - apr_size_t remaining_handles; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"RTSP Peer Disconnected %s", rtsp_connection->id); - rtsp_client_connection_close(client,rtsp_connection); - - /* Cancel in-progreess requests */ - do { - session = apt_list_pop_front(rtsp_connection->inprogress_request_queue); - if(session) { - if(rtsp_client_request_cancel( - client, - session, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR) == TRUE) { - apt_timer_kill(session->request_timer); - } - } - } - while(session); - - /* Walk through RTSP handles and raise termination event for them */ - remaining_handles = apr_hash_count(rtsp_connection->handle_table); - if(remaining_handles) { - void *val; - apr_hash_index_t *it; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Terminate Remaining RTSP Handles [%"APR_SIZE_T_FMT"]",remaining_handles); - it = apr_hash_first(rtsp_connection->pool,rtsp_connection->session_table); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - session = val; - if(session) { - rtsp_client_session_terminate_raise(client,session); - } - } - } - - return TRUE; -} - -/* Send RTSP message through RTSP connection */ -static apt_bool_t rtsp_client_message_send(rtsp_client_t *client, rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message) -{ - apt_bool_t status = FALSE; - apt_text_stream_t *stream; - apt_message_status_e result; - - if(!rtsp_connection || !rtsp_connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No RTSP Connection"); - return FALSE; - } - stream = &rtsp_connection->tx_stream; - - do { - stream->text.length = sizeof(rtsp_connection->tx_buffer)-1; - apt_text_stream_reset(stream); - result = rtsp_generator_run(rtsp_connection->generator,message,stream); - if(result != APT_MESSAGE_STATUS_INVALID) { - stream->text.length = stream->pos - stream->text.buf; - *stream->pos = '\0'; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", - rtsp_connection->id, - stream->text.length, - stream->text.buf); - if(apr_socket_send(rtsp_connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) { - status = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Data"); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data"); - } - } - while(result == APT_MESSAGE_STATUS_INCOMPLETE); - - return status; -} - -/** Return TRUE to proceed with the next message in the stream (if any) */ -static apt_bool_t rtsp_client_message_handler(rtsp_client_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status) -{ - if(status != APT_MESSAGE_STATUS_COMPLETE) { - /* message is not completely parsed, nothing to do */ - return TRUE; - } - /* process parsed message */ - if(message->start_line.message_type == RTSP_MESSAGE_TYPE_RESPONSE) { - rtsp_message_t *request; - rtsp_client_session_t *session; - /* at first, pop in-progress request/session */ - if(rtsp_client_request_pop(rtsp_connection,message,&request,&session) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unexpected RTSP Response Received CSeq:%"APR_SIZE_T_FMT, - message->header.cseq); - return TRUE; - } - - /* next, process session response */ - rtsp_client_session_response_process(rtsp_connection->client,session,request,message); - - /* process session pending requests */ - if(rtsp_client_session_pending_requests_process(rtsp_connection->client,session) == FALSE) { - /* no in-progress request, check the termination state now */ - if(session->term_state != TERMINATION_STATE_NONE) { - if(session->term_state == TERMINATION_STATE_REQUESTED) { - rtsp_client_session_resources_teardown(rtsp_connection->client,session); - } - - /* respond if no resources left */ - if(apr_hash_count(session->resource_table) == 0) { - rtsp_client_session_terminate_respond(rtsp_connection->client,session); - - if(apr_hash_count(rtsp_connection->handle_table) == 0) { - rtsp_client_connection_destroy(rtsp_connection); - /* return FALSE to indicate connection has been destroyed */ - return FALSE; - } - } - } - } - } - else if(message->start_line.message_type == RTSP_MESSAGE_TYPE_REQUEST) { - rtsp_client_session_event_process(rtsp_connection->client,rtsp_connection,message); - } - return TRUE; -} - -/* Receive RTSP message through RTSP connection */ -static apt_bool_t rtsp_client_poller_signal_process(void *obj, const apr_pollfd_t *descriptor) -{ - rtsp_client_t *client = obj; - rtsp_client_connection_t *rtsp_connection = descriptor->client_data; - apr_status_t status; - apr_size_t offset; - apr_size_t length; - apt_text_stream_t *stream; - rtsp_message_t *message; - apt_message_status_e msg_status; - - if(!rtsp_connection || !rtsp_connection->sock) { - return FALSE; - } - stream = &rtsp_connection->rx_stream; - - /* calculate offset remaining from the previous receive / if any */ - offset = stream->pos - stream->text.buf; - /* calculate available length */ - length = sizeof(rtsp_connection->rx_buffer) - 1 - offset; - - status = apr_socket_recv(rtsp_connection->sock,stream->pos,&length); - if(status == APR_EOF || length == 0) { - return rtsp_client_on_disconnect(client,rtsp_connection); - } - - /* calculate actual length of the stream */ - stream->text.length = offset + length; - stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", - rtsp_connection->id, - length, - stream->pos); - - /* reset pos */ - apt_text_stream_reset(stream); - - do { - msg_status = rtsp_parser_run(rtsp_connection->parser,stream,&message); - if(rtsp_client_message_handler(rtsp_connection,message,msg_status) == FALSE) { - return FALSE; - } - } - while(apt_text_is_eos(stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(stream); - return TRUE; -} - -/* Process task message */ -static apt_bool_t rtsp_client_task_msg_process(apt_task_t *task, apt_task_msg_t *task_msg) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - rtsp_client_t *client = apt_poller_task_object_get(poller_task); - - task_msg_data_t *data = (task_msg_data_t*) task_msg->data; - switch(data->type) { - case TASK_MSG_SEND_MESSAGE: - rtsp_client_session_message_process(client,data->session,data->message); - break; - case TASK_MSG_TERMINATE_SESSION: - rtsp_client_session_terminate_process(client,data->session); - break; - } - - return TRUE; -} - -/* Timer callback */ -static void rtsp_client_timer_proc(apt_timer_t *timer, void *obj) -{ - rtsp_client_session_t *session = obj; - if(!session || !session->connection || !session->connection->client) { - return; - } - - if(session->request_timer == timer) { - rtsp_client_request_cancel( - session->connection->client, - session, - RTSP_STATUS_CODE_REQUEST_TIMEOUT, - RTSP_REASON_PHRASE_REQUEST_TIMEOUT); - } -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c deleted file mode 100644 index 4aee7d7dd0..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_header.c +++ /dev/null @@ -1,420 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_header.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "rtsp_header.h" -#include "apt_string_table.h" -#include "apt_text_stream.h" - -/** String table of RTSP header fields (rtsp_header_field_id) */ -static const apt_str_table_item_t rtsp_header_string_table[] = { - {{"CSeq", 4},1}, - {{"Transport", 9},0}, - {{"Session", 7},0}, - {{"RTP-Info", 8},0}, - {{"Content-Type", 12},8}, - {{"Content-Length",14},8} -}; - -/** String table of RTSP content types (rtsp_content_type) */ -static const apt_str_table_item_t rtsp_content_type_string_table[] = { - {{"application/sdp", 15},12}, - {{"application/mrcp",16},12} -}; - -/** String table of RTSP transport protocols (rtsp_transport_e) */ -static const apt_str_table_item_t rtsp_transport_string_table[] = { - {{"RTP", 3},0} -}; - -/** String table of RTSP lower transport protocols (rtsp_lower_transport_e) */ -static const apt_str_table_item_t rtsp_lower_transport_string_table[] = { - {{"UDP", 3},0}, - {{"TCP", 3},0} -}; - -/** String table of RTSP transport profiles (rtsp_profile_e) */ -static const apt_str_table_item_t rtsp_profile_string_table[] = { - {{"AVP", 3},0}, - {{"SAVP",4},0} -}; - -/** String table of RTSP transport attributes (rtsp_transport_attrib_e) */ -static const apt_str_table_item_t rtsp_transport_attrib_string_table[] = { - {{"client_port", 11},0}, - {{"server_port", 11},2}, - {{"source", 6},2}, - {{"destination", 11},0}, - {{"unicast", 7},0}, - {{"multicast", 9},1}, - {{"mode", 4},2} -}; - -/** Parse RTSP transport port range */ -static apt_bool_t rtsp_port_range_parse(rtsp_port_range_t *port_range, apt_text_stream_t *stream) -{ - apt_str_t value; - /* read min value */ - if(apt_text_field_read(stream,'-',TRUE,&value) == FALSE) { - return FALSE; - } - port_range->min = (apr_port_t)apt_size_value_parse(&value); - - /* read optional max value */ - if(apt_text_field_read(stream,';',TRUE,&value) == TRUE) { - port_range->max = (apr_port_t)apt_size_value_parse(&value); - } - - return TRUE; -} - -/** Generate RTSP transport port range */ -static apt_bool_t rtsp_port_range_generate(rtsp_transport_attrib_e attrib, const rtsp_port_range_t *port_range, apt_text_stream_t *text_stream) -{ - const apt_str_t *str; - str = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,attrib); - if(!str) { - return FALSE; - } - apt_text_string_insert(text_stream,str); - apt_text_char_insert(text_stream,'='); - apt_text_size_value_insert(text_stream,port_range->min); - if(port_range->max > port_range->min) { - apt_text_char_insert(text_stream,'-'); - apt_text_size_value_insert(text_stream,port_range->max); - } - return TRUE; -} - -/** Parse text value of RTSP transport attrib (source/destination, e.t.c) */ -static apt_bool_t rtsp_transport_attrib_value_parse(apt_str_t *value, apt_text_stream_t *stream, apr_pool_t *pool) -{ - apt_str_t field; - /* read value */ - if(apt_text_field_read(stream,';',TRUE,&field) == FALSE) { - return FALSE; - } - apt_string_copy(value,&field,pool); - return TRUE; -} - -/** Parse RTSP transport */ -static apt_bool_t rtsp_transport_attrib_parse(rtsp_transport_t *transport, const apt_str_t *field, apr_pool_t *pool) -{ - rtsp_transport_attrib_e attrib; - apt_str_t name; - apt_text_stream_t stream; - - stream.text = *field; - apt_text_stream_reset(&stream); - - /* read attrib name */ - if(apt_text_field_read(&stream,'=',TRUE,&name) == FALSE) { - return FALSE; - } - - attrib = apt_string_table_id_find(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,&name); - switch(attrib) { - case RTSP_TRANSPORT_ATTRIB_CLIENT_PORT: - rtsp_port_range_parse(&transport->client_port_range,&stream); - break; - case RTSP_TRANSPORT_ATTRIB_SERVER_PORT: - rtsp_port_range_parse(&transport->client_port_range,&stream); - break; - case RTSP_TRANSPORT_ATTRIB_SOURCE: - rtsp_transport_attrib_value_parse(&transport->source,&stream,pool); - break; - case RTSP_TRANSPORT_ATTRIB_DESTINATION: - rtsp_transport_attrib_value_parse(&transport->destination,&stream,pool); - break; - case RTSP_TRANSPORT_ATTRIB_UNICAST: - transport->delivery = RTSP_DELIVERY_UNICAST; - break; - case RTSP_TRANSPORT_ATTRIB_MULTICAST: - transport->delivery = RTSP_DELIVERY_MULTICAST; - break; - case RTSP_TRANSPORT_ATTRIB_MODE: - rtsp_transport_attrib_value_parse(&transport->mode,&stream,pool); - break; - default: - break; - } - return TRUE; -} - -/** Parse RTSP transport protocol (RTP/AVP[/UDP]) */ -static apt_bool_t rtsp_transport_protocol_parse(rtsp_transport_t *transport, const apt_str_t *value) -{ - apt_str_t field; - apt_text_stream_t stream; - - stream.text = *value; - apt_text_stream_reset(&stream); - - /* set the defaults */ - transport->protocol = RTSP_TRANSPORT_RTP; - transport->profile = RTSP_PROFILE_AVP; - transport->lower_protocol = RTSP_LOWER_TRANSPORT_UDP; - - /* read transport protocol (RTP) */ - if(apt_text_field_read(&stream,'/',TRUE,&field) == FALSE) { - return FALSE; - } - transport->protocol = apt_string_table_id_find(rtsp_transport_string_table,RTSP_TRANSPORT_COUNT,&field); - if(transport->protocol >= RTSP_TRANSPORT_COUNT) { - return FALSE; - } - - /* read transport profile (AVP) */ - if(apt_text_field_read(&stream,'/',TRUE,&field) == FALSE) { - return FALSE; - } - transport->profile = apt_string_table_id_find(rtsp_profile_string_table,RTSP_PROFILE_COUNT,&field); - if(transport->profile >= RTSP_PROFILE_COUNT) { - return FALSE; - } - - /* read optional lower transport protocol (UDP) */ - if(apt_text_field_read(&stream,'/',TRUE,&field) == TRUE) { - transport->lower_protocol = apt_string_table_id_find(rtsp_lower_transport_string_table,RTSP_LOWER_TRANSPORT_COUNT,&field); - if(transport->lower_protocol >= RTSP_LOWER_TRANSPORT_COUNT) { - return FALSE; - } - } - - return TRUE; -} - -/** Parse RTSP transport */ -static apt_bool_t rtsp_transport_parse(rtsp_transport_t *transport, const apt_str_t *value, apr_pool_t *pool) -{ - apt_str_t field; - apt_text_stream_t stream; - - apt_text_stream_init(&stream,value->buf,value->length); - /* read transport protocol (RTP/AVP[/UDP]) */ - if(apt_text_field_read(&stream,';',TRUE,&field) == FALSE) { - return FALSE; - } - - /* parse transport protocol (RTP/AVP[/UDP]) */ - if(rtsp_transport_protocol_parse(transport,&field) == FALSE) { - return FALSE; - } - - /* read transport attributes */ - while(apt_text_field_read(&stream,';',TRUE,&field) == TRUE) { - rtsp_transport_attrib_parse(transport,&field,pool); - } - - return TRUE; -} - -/** Generate RTSP transport */ -static apt_bool_t rtsp_transport_generate(const rtsp_transport_t *transport, apt_str_t *value, apr_pool_t *pool) -{ - char buf[256]; - apt_text_stream_t text_stream; - const apt_str_t *protocol = apt_string_table_str_get(rtsp_transport_string_table,RTSP_TRANSPORT_COUNT,transport->protocol); - const apt_str_t *profile = apt_string_table_str_get(rtsp_profile_string_table,RTSP_PROFILE_COUNT,transport->profile); - if(!protocol || !profile) { - return FALSE; - } - - apt_text_stream_init(&text_stream,buf,sizeof(buf)); - apt_text_string_insert(&text_stream,protocol); - apt_text_char_insert(&text_stream,'/'); - apt_text_string_insert(&text_stream,profile); - - if(transport->delivery != RTSP_DELIVERY_NONE) { - const apt_str_t *delivery = NULL; - rtsp_transport_attrib_e attrib = RTSP_TRANSPORT_ATTRIB_NONE; - if(transport->delivery == RTSP_DELIVERY_UNICAST) { - attrib = RTSP_TRANSPORT_ATTRIB_UNICAST; - } - else if(transport->delivery == RTSP_DELIVERY_MULTICAST) { - attrib = RTSP_TRANSPORT_ATTRIB_MULTICAST; - } - delivery = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,attrib); - if(!delivery) { - return FALSE; - } - - apt_text_char_insert(&text_stream,';'); - apt_text_string_insert(&text_stream,delivery); - } - - if(rtsp_port_range_is_valid(&transport->client_port_range) == TRUE) { - apt_text_char_insert(&text_stream,';'); - rtsp_port_range_generate(RTSP_TRANSPORT_ATTRIB_CLIENT_PORT,&transport->client_port_range,&text_stream); - } - if(rtsp_port_range_is_valid(&transport->server_port_range) == TRUE) { - apt_text_char_insert(&text_stream,';'); - rtsp_port_range_generate(RTSP_TRANSPORT_ATTRIB_SERVER_PORT,&transport->server_port_range,&text_stream); - } - - if(transport->mode.length) { - const apt_str_t *str; - str = apt_string_table_str_get(rtsp_transport_attrib_string_table,RTSP_TRANSPORT_ATTRIB_COUNT,RTSP_TRANSPORT_ATTRIB_MODE); - if(str) { - apt_text_char_insert(&text_stream,';'); - apt_text_string_insert(&text_stream,str); - apt_text_char_insert(&text_stream,'='); - apt_text_string_insert(&text_stream,&transport->mode); - } - } - value->length = text_stream.pos - text_stream.text.buf; - value->buf = apr_palloc(pool,value->length + 1); - memcpy(value->buf,text_stream.text.buf,value->length); - value->buf[value->length] = '\0'; - return TRUE; -} - -/** Parse RTSP transport */ -static apt_bool_t rtsp_session_id_parse(apt_str_t *session_id, const apt_str_t *value, apr_pool_t *pool) -{ - char *sep; - if(!value->buf) { - return FALSE; - } - apt_string_copy(session_id,value,pool); - sep = strchr(session_id->buf,';'); - if(sep) { - session_id->length = sep - session_id->buf; - *sep = '\0'; - } - return TRUE; -} - -/** Parse RTSP header field value */ -static apt_bool_t rtsp_header_field_value_parse(rtsp_header_t *header, rtsp_header_field_id id, const apt_str_t *value, apr_pool_t *pool) -{ - apt_bool_t status = TRUE; - switch(id) { - case RTSP_HEADER_FIELD_CSEQ: - header->cseq = apt_size_value_parse(value); - break; - case RTSP_HEADER_FIELD_TRANSPORT: - status = rtsp_transport_parse(&header->transport,value,pool); - break; - case RTSP_HEADER_FIELD_SESSION_ID: - status = rtsp_session_id_parse(&header->session_id,value,pool); - break; - case RTSP_HEADER_FIELD_RTP_INFO: - header->rtp_info = *value; - break; - case RTSP_HEADER_FIELD_CONTENT_TYPE: - header->content_type = apt_string_table_id_find(rtsp_content_type_string_table,RTSP_CONTENT_TYPE_COUNT,value); - break; - case RTSP_HEADER_FIELD_CONTENT_LENGTH: - header->content_length = apt_size_value_parse(value); - break; - default: - status = FALSE; - } - return status; -} - -/** Generate RTSP header field value */ -static apt_bool_t rtsp_header_field_value_generate(const rtsp_header_t *header, rtsp_header_field_id id, apt_str_t *value, apr_pool_t *pool) -{ - switch(id) { - case RTSP_HEADER_FIELD_CSEQ: - apt_size_value_generate(header->cseq,value,pool); - break; - case RTSP_HEADER_FIELD_TRANSPORT: - rtsp_transport_generate(&header->transport,value,pool); - break; - case RTSP_HEADER_FIELD_SESSION_ID: - *value = header->session_id; - break; - case RTSP_HEADER_FIELD_RTP_INFO: - *value = header->rtp_info; - break; - case RTSP_HEADER_FIELD_CONTENT_TYPE: - { - const apt_str_t *name = apt_string_table_str_get(rtsp_content_type_string_table,RTSP_CONTENT_TYPE_COUNT,header->content_type); - if(name) { - *value = *name; - } - break; - } - case RTSP_HEADER_FIELD_CONTENT_LENGTH: - apt_size_value_generate(header->content_length,value,pool); - break; - default: - break; - } - return TRUE; -} - -/** Add RTSP header field */ -RTSP_DECLARE(apt_bool_t) rtsp_header_field_add(rtsp_header_t *header, apt_header_field_t *header_field, apr_pool_t *pool) -{ - /* parse header field (name-value) */ - header_field->id = apt_string_table_id_find( - rtsp_header_string_table, - RTSP_HEADER_FIELD_COUNT, - &header_field->name); - if(apt_string_is_empty(&header_field->value) == FALSE) { - rtsp_header_field_value_parse(header,header_field->id,&header_field->value,pool); - } - - return apt_header_section_field_add(&header->header_section,header_field); -} - -/** Parse RTSP header fields */ -RTSP_DECLARE(apt_bool_t) rtsp_header_fields_parse(rtsp_header_t *header, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - for(header_field = APR_RING_FIRST(&header->header_section.ring); - header_field != APR_RING_SENTINEL(&header->header_section.ring, apt_header_field_t, link); - header_field = APR_RING_NEXT(header_field, link)) { - - header_field->id = apt_string_table_id_find( - rtsp_header_string_table, - RTSP_HEADER_FIELD_COUNT, - &header_field->name); - if(apt_string_is_empty(&header_field->value) == FALSE) { - rtsp_header_field_value_parse(header,header_field->id,&header_field->value,pool); - } - apt_header_section_field_set(&header->header_section,header_field); - } - return TRUE; -} - -/** Add RTSP header field property */ -RTSP_DECLARE(apt_bool_t) rtsp_header_property_add(rtsp_header_t *header, rtsp_header_field_id id, apr_pool_t *pool) -{ - apt_header_field_t *header_field; - header_field = apt_header_section_field_get(&header->header_section,id); - if(header_field) { - /* such header field already exists, just (re)generate value */ - return rtsp_header_field_value_generate(header,id,&header_field->value,pool); - } - - header_field = apt_header_field_alloc(pool); - if(rtsp_header_field_value_generate(header,id,&header_field->value,pool) == TRUE) { - const apt_str_t *name = apt_string_table_str_get(rtsp_header_string_table,RTSP_HEADER_FIELD_COUNT,id); - if(name) { - header_field->name = *name; - header_field->id = id; - return apt_header_section_field_insert(&header->header_section,header_field); - } - } - return FALSE; -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c deleted file mode 100644 index 59fd7168e0..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_message.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_message.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "rtsp_message.h" - -/** Initialize RTSP message */ -static APR_INLINE void rtsp_message_init(rtsp_message_t *message, rtsp_message_type_e message_type, apr_pool_t *pool) -{ - message->pool = pool; - rtsp_start_line_init(&message->start_line,message_type); - rtsp_header_init(&message->header,pool); - apt_string_reset(&message->body); -} - -/** Create RTSP message */ -RTSP_DECLARE(rtsp_message_t*) rtsp_message_create(rtsp_message_type_e message_type, apr_pool_t *pool) -{ - rtsp_message_t *message = apr_palloc(pool,sizeof(rtsp_message_t)); - rtsp_message_init(message,message_type,pool); - return message; -} - -/** Create RTSP request message */ -RTSP_DECLARE(rtsp_message_t*) rtsp_request_create(apr_pool_t *pool) -{ - rtsp_message_t *request = rtsp_message_create(RTSP_MESSAGE_TYPE_REQUEST,pool); - request->start_line.common.request_line.version = RTSP_VERSION_1; - return request; -} - -/** Create RTSP response message */ -RTSP_DECLARE(rtsp_message_t*) rtsp_response_create(const rtsp_message_t *request, rtsp_status_code_e status_code, rtsp_reason_phrase_e reason, apr_pool_t *pool) -{ - const apt_str_t *reason_str; - rtsp_status_line_t *status_line; - rtsp_message_t *response = rtsp_message_create(RTSP_MESSAGE_TYPE_RESPONSE,pool); - status_line = &response->start_line.common.status_line; - status_line->version = request->start_line.common.request_line.version; - status_line->status_code = status_code; - reason_str = rtsp_reason_phrase_get(reason); - if(reason_str) { - apt_string_copy(&status_line->reason,reason_str,pool); - } - - if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_CSEQ) == TRUE) { - response->header.cseq = request->header.cseq; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CSEQ,response->pool); - } - - if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_TRANSPORT) == TRUE) { - const rtsp_transport_t *req_transport = &request->header.transport; - rtsp_transport_t *res_transport = &response->header.transport; - if(req_transport->mode.length) { - apt_string_copy(&res_transport->mode,&req_transport->mode,pool); - } - } - - return response; -} - -/** Destroy RTSP message */ -RTSP_DECLARE(void) rtsp_message_destroy(rtsp_message_t *message) -{ - /* nothing to do message is allocated from pool */ -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c deleted file mode 100644 index 428634fde2..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_server.c +++ /dev/null @@ -1,889 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_server.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#ifdef WIN32 -#pragma warning(disable: 4127) -#endif -#include -#include -#include "rtsp_server.h" -#include "rtsp_stream.h" -#include "apt_poller_task.h" -#include "apt_text_stream.h" -#include "apt_pool.h" -#include "apt_obj_list.h" -#include "apt_log.h" - -#define RTSP_SESSION_ID_HEX_STRING_LENGTH 16 -#define RTSP_STREAM_BUFFER_SIZE 1024 - -typedef struct rtsp_server_connection_t rtsp_server_connection_t; - -/** RTSP server */ -struct rtsp_server_t { - apr_pool_t *pool; - apt_poller_task_t *task; - - /** List (ring) of RTSP connections */ - APR_RING_HEAD(rtsp_server_connection_head_t, rtsp_server_connection_t) connection_list; - - /* Listening socket descriptor */ - apr_sockaddr_t *sockaddr; - apr_socket_t *listen_sock; - apr_pollfd_t listen_sock_pfd; - - void *obj; - const rtsp_server_vtable_t *vtable; -}; - -/** RTSP connection */ -struct rtsp_server_connection_t { - /** Ring entry */ - APR_RING_ENTRY(rtsp_server_connection_t) link; - - /** Memory pool */ - apr_pool_t *pool; - /** Client IP address */ - char *client_ip; - /** Accepted socket */ - apr_socket_t *sock; - /** Socket poll descriptor */ - apr_pollfd_t sock_pfd; - /** String identifier used for traces */ - const char *id; - - /** RTSP server, connection belongs to */ - rtsp_server_t *server; - - /** Session table (rtsp_server_session_t*) */ - apr_hash_t *session_table; - - char rx_buffer[RTSP_STREAM_BUFFER_SIZE]; - apt_text_stream_t rx_stream; - rtsp_parser_t *parser; - - char tx_buffer[RTSP_STREAM_BUFFER_SIZE]; - apt_text_stream_t tx_stream; - rtsp_generator_t *generator; -}; - -/** RTSP session */ -struct rtsp_server_session_t { - apr_pool_t *pool; - void *obj; - rtsp_server_connection_t *connection; - - /** Session identifier */ - apt_str_t id; - - /** Last cseq sent */ - apr_size_t last_cseq; - - /** In-progress request */ - rtsp_message_t *active_request; - /** request queue */ - apt_obj_list_t *request_queue; - - /** Resource table */ - apr_hash_t *resource_table; - - /** In-progress termination request */ - apt_bool_t terminating; -}; - -typedef enum { - TASK_MSG_SEND_MESSAGE, - TASK_MSG_TERMINATE_SESSION -} task_msg_data_type_e; - -typedef struct task_msg_data_t task_msg_data_t; - -struct task_msg_data_t { - task_msg_data_type_e type; - rtsp_server_t *server; - rtsp_server_session_t *session; - rtsp_message_t *message; -}; - -static apt_bool_t rtsp_server_on_destroy(apt_task_t *task); -static apt_bool_t rtsp_server_task_msg_process(apt_task_t *task, apt_task_msg_t *msg); -static apt_bool_t rtsp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor); -static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, rtsp_server_connection_t *connection, rtsp_message_t *message); - -static apt_bool_t rtsp_server_listening_socket_create(rtsp_server_t *server); -static void rtsp_server_listening_socket_destroy(rtsp_server_t *server); - -/** Get string identifier */ -static const char* rtsp_server_id_get(const rtsp_server_t *server) -{ - apt_task_t *task = apt_poller_task_base_get(server->task); - return apt_task_name_get(task); -} - -/** Create RTSP server */ -RTSP_DECLARE(rtsp_server_t*) rtsp_server_create( - const char *id, - const char *listen_ip, - apr_port_t listen_port, - apr_size_t max_connection_count, - void *obj, - const rtsp_server_vtable_t *handler, - apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - rtsp_server_t *server; - - if(!listen_ip) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Server [%s] %s:%hu [%"APR_SIZE_T_FMT"]", - id, - listen_ip, - listen_port, - max_connection_count); - server = apr_palloc(pool,sizeof(rtsp_server_t)); - server->pool = pool; - server->obj = obj; - server->vtable = handler; - - server->listen_sock = NULL; - server->sockaddr = NULL; - apr_sockaddr_info_get(&server->sockaddr,listen_ip,APR_INET,listen_port,0,pool); - if(!server->sockaddr) { - return NULL; - } - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(task_msg_data_t),pool); - - server->task = apt_poller_task_create( - max_connection_count + 1, - rtsp_server_poller_signal_process, - server, - msg_pool, - pool); - if(!server->task) { - return NULL; - } - - task = apt_poller_task_base_get(server->task); - if(task) { - apt_task_name_set(task,id); - } - - vtable = apt_poller_task_vtable_get(server->task); - if(vtable) { - vtable->destroy = rtsp_server_on_destroy; - vtable->process_msg = rtsp_server_task_msg_process; - } - - APR_RING_INIT(&server->connection_list, rtsp_server_connection_t, link); - - if(rtsp_server_listening_socket_create(server) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Listening Socket [%s] %s:%hu", - id, - listen_ip, - listen_port); - } - return server; -} - -static apt_bool_t rtsp_server_on_destroy(apt_task_t *task) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - rtsp_server_t *server = apt_poller_task_object_get(poller_task); - - rtsp_server_listening_socket_destroy(server); - apt_poller_task_cleanup(poller_task); - return TRUE; -} - -/** Destroy RTSP server */ -RTSP_DECLARE(apt_bool_t) rtsp_server_destroy(rtsp_server_t *server) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Server [%s]", - rtsp_server_id_get(server)); - return apt_poller_task_destroy(server->task); -} - -/** Start connection agent */ -RTSP_DECLARE(apt_bool_t) rtsp_server_start(rtsp_server_t *server) -{ - return apt_poller_task_start(server->task); -} - -/** Terminate connection agent */ -RTSP_DECLARE(apt_bool_t) rtsp_server_terminate(rtsp_server_t *server) -{ - return apt_poller_task_terminate(server->task); -} - -/** Get task */ -RTSP_DECLARE(apt_task_t*) rtsp_server_task_get(const rtsp_server_t *server) -{ - return apt_poller_task_base_get(server->task); -} - -/** Get external object */ -RTSP_DECLARE(void*) rtsp_server_object_get(const rtsp_server_t *server) -{ - return server->obj; -} - -/** Get object associated with the session */ -RTSP_DECLARE(void*) rtsp_server_session_object_get(const rtsp_server_session_t *session) -{ - return session->obj; -} - -/** Set object associated with the session */ -RTSP_DECLARE(void) rtsp_server_session_object_set(rtsp_server_session_t *session, void *obj) -{ - session->obj = obj; -} - -/** Get the session identifier */ -RTSP_DECLARE(const apt_str_t*) rtsp_server_session_id_get(const rtsp_server_session_t *session) -{ - return &session->id; -} - -/** Get active request */ -RTSP_DECLARE(const rtsp_message_t*) rtsp_server_session_request_get(const rtsp_server_session_t *session) -{ - return session->active_request; -} - -/** Get the session destination (client) IP address */ -RTSP_DECLARE(const char*) rtsp_server_session_destination_get(const rtsp_server_session_t *session) -{ - if(session->connection) { - return session->connection->client_ip; - } - return NULL; -} - -/** Signal task message */ -static apt_bool_t rtsp_server_control_message_signal( - task_msg_data_type_e type, - rtsp_server_t *server, - rtsp_server_session_t *session, - rtsp_message_t *message) -{ - apt_task_t *task = apt_poller_task_base_get(server->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - task_msg_data_t *data = (task_msg_data_t*)task_msg->data; - data->type = type; - data->server = server; - data->session = session; - data->message = message; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Signal RTSP message */ -RTSP_DECLARE(apt_bool_t) rtsp_server_session_respond(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message) -{ - return rtsp_server_control_message_signal(TASK_MSG_SEND_MESSAGE,server,session,message); -} - -/** Signal terminate response */ -RTSP_DECLARE(apt_bool_t) rtsp_server_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session) -{ - return rtsp_server_control_message_signal(TASK_MSG_TERMINATE_SESSION,server,session,NULL); -} - -/* Create RTSP session */ -static rtsp_server_session_t* rtsp_server_session_create(rtsp_server_t *server) -{ - rtsp_server_session_t *session; - apr_pool_t *pool = apt_pool_create(); - session = apr_palloc(pool,sizeof(rtsp_server_session_t)); - session->pool = pool; - session->obj = NULL; - session->last_cseq = 0; - session->active_request = NULL; - session->request_queue = apt_list_create(pool); - session->resource_table = apr_hash_make(pool); - session->terminating = FALSE; - - apt_unique_id_generate(&session->id,RTSP_SESSION_ID_HEX_STRING_LENGTH,pool); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create RTSP Session "APT_SID_FMT,session->id.buf); - if(server->vtable->create_session(server,session) != TRUE) { - apr_pool_destroy(pool); - return NULL; - } - return session; -} - -/* Destroy RTSP session */ -static void rtsp_server_session_destroy(rtsp_server_session_t *session) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Session "APT_SID_FMT, - session ? session->id.buf : "(null)"); - if(session && session->pool) { - apr_pool_destroy(session->pool); - } -} - -/** Destroy RTSP connection */ -static void rtsp_server_connection_destroy(rtsp_server_connection_t *rtsp_connection) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy RTSP Connection %s",rtsp_connection->id); - apr_pool_destroy(rtsp_connection->pool); -} - -/* Finally terminate RTSP session */ -static apt_bool_t rtsp_server_session_do_terminate(rtsp_server_t *server, rtsp_server_session_t *session) -{ - rtsp_server_connection_t *rtsp_connection = session->connection; - - if(session->active_request) { - rtsp_message_t *response = rtsp_response_create(session->active_request, - RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,session->active_request->pool); - if(response) { - if(session->id.buf) { - response->header.session_id = session->id; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_SESSION_ID,response->pool); - } - - if(rtsp_connection) { - rtsp_server_message_send(server,rtsp_connection,response); - } - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remove RTSP Session "APT_SID_FMT,session->id.buf); - if(rtsp_connection) { - apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,NULL); - } - rtsp_server_session_destroy(session); - - if(rtsp_connection && !rtsp_connection->sock) { - if(apr_hash_count(rtsp_connection->session_table) == 0) { - rtsp_server_connection_destroy(rtsp_connection); - } - } - return TRUE; -} - -static apt_bool_t rtsp_server_error_respond(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *request, - rtsp_status_code_e status_code, rtsp_reason_phrase_e reason) -{ - /* send error response to client */ - rtsp_message_t *response = rtsp_response_create(request,status_code,reason,request->pool); - if(rtsp_server_message_send(server,rtsp_connection,response) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Response"); - return FALSE; - } - return TRUE; -} - -static apt_bool_t rtsp_server_session_terminate_request(rtsp_server_t *server, rtsp_server_session_t *session) -{ - session->terminating = TRUE; - return server->vtable->terminate_session(server,session); -} - -static apt_bool_t rtsp_server_session_message_handle(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message) -{ - if(message->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) { - /* remove resource */ - const char *resource_name = message->start_line.common.request_line.resource_name; - apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,NULL); - - if(apr_hash_count(session->resource_table) == 0) { - rtsp_server_session_terminate_request(server,session); - return TRUE; - } - } - - if(server->vtable->handle_message(server,session,message) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Handle Message "APT_SID_FMT,session->id.buf); - rtsp_server_error_respond(server,session->connection,message, - RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR, - RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR); - return FALSE; - } - return TRUE; -} - -/* Process incoming SETUP/DESCRIBE request */ -static rtsp_server_session_t* rtsp_server_session_setup_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message) -{ - rtsp_server_session_t *session = NULL; - if(message->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) { - /* create new session */ - session = rtsp_server_session_create(server); - if(!session) { - return NULL; - } - session->connection = rtsp_connection; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_SID_FMT,session->id.buf); - apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session); - } - else if(message->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) { - /* create new session as a communication object */ - session = rtsp_server_session_create(server); - if(!session) { - return NULL; - } - session->connection = rtsp_connection; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add RTSP Session "APT_SID_FMT,session->id.buf); - apr_hash_set(rtsp_connection->session_table,session->id.buf,session->id.length,session); - } - else { - /* error case */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing RTSP Session-ID"); - rtsp_server_error_respond(server,rtsp_connection,message, - RTSP_STATUS_CODE_BAD_REQUEST, - RTSP_REASON_PHRASE_BAD_REQUEST); - } - return session; -} - -/* Process incoming RTSP request */ -static apt_bool_t rtsp_server_session_request_process(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message) -{ - rtsp_server_session_t *session = NULL; - if(message->start_line.message_type != RTSP_MESSAGE_TYPE_REQUEST) { - /* received response to ANNOUNCE request/event */ - return TRUE; - } - - if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_SESSION_ID) != TRUE) { - /* no session-id specified */ - session = rtsp_server_session_setup_process(server,rtsp_connection,message); - if(session) { - session->active_request = message; - if(rtsp_server_session_message_handle(server,session,message) != TRUE) { - rtsp_server_session_destroy(session); - } - } - else { - /* error case, failed to create a session */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create RTSP Session"); - return rtsp_server_error_respond(server,rtsp_connection,message, - RTSP_STATUS_CODE_NOT_ACCEPTABLE, - RTSP_REASON_PHRASE_NOT_ACCEPTABLE); - } - return TRUE; - } - - /* existing session */ - session = apr_hash_get( - rtsp_connection->session_table, - message->header.session_id.buf, - message->header.session_id.length); - if(!session) { - /* error case, no such session */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such RTSP Session "APT_SID_FMT,message->header.session_id.buf); - return rtsp_server_error_respond(server,rtsp_connection,message, - RTSP_STATUS_CODE_NOT_FOUND, - RTSP_REASON_PHRASE_NOT_FOUND); - } - - if(session->terminating == TRUE) { - /* error case, session is being terminated */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Not Acceptable Request "APT_SID_FMT,message->header.session_id.buf); - return rtsp_server_error_respond(server,rtsp_connection,message, - RTSP_STATUS_CODE_NOT_ACCEPTABLE, - RTSP_REASON_PHRASE_NOT_ACCEPTABLE); - } - - if(session->active_request) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Push RTSP Request to Queue "APT_SID_FMT,session->id.buf); - apt_list_push_back(session->request_queue,message,message->pool); - return TRUE; - } - - /* handle the request */ - session->active_request = message; - rtsp_server_session_message_handle(server,session,message); - return TRUE; -} - -/* Process outgoing RTSP response */ -static apt_bool_t rtsp_server_session_response_process(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message) -{ - apt_bool_t terminate = FALSE; - rtsp_message_t *request = NULL; - if(message->start_line.message_type == RTSP_MESSAGE_TYPE_REQUEST) { - /* RTSP ANNOUNCE request (asynch event) */ - const char *resource_name = message->start_line.common.request_line.resource_name; - if(resource_name) { - request = apr_hash_get(session->resource_table,resource_name,APR_HASH_KEY_STRING); - } - if(!request) { - return FALSE; - } - message->start_line.common.request_line.url = request->start_line.common.request_line.url; - message->header.cseq = session->last_cseq; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_CSEQ,message->pool); - - if(session->id.buf) { - message->header.session_id = session->id; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool); - } - rtsp_server_message_send(server,session->connection,message); - return TRUE; - } - - if(!session->active_request) { - /* unexpected response */ - return FALSE; - } - - request = session->active_request; - if(request->start_line.common.request_line.method_id == RTSP_METHOD_DESCRIBE) { - terminate = TRUE; - } - else { - if(session->id.buf) { - message->header.session_id = session->id; - rtsp_header_property_add(&message->header,RTSP_HEADER_FIELD_SESSION_ID,message->pool); - } - if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) { - if(message->start_line.common.status_line.status_code == RTSP_STATUS_CODE_OK) { - /* add resource */ - const char *resource_name = request->start_line.common.request_line.resource_name; - apr_hash_set(session->resource_table,resource_name,APR_HASH_KEY_STRING,request); - } - else if(apr_hash_count(session->resource_table) == 0) { - terminate = TRUE; - } - } - } - - session->last_cseq = message->header.cseq; - rtsp_server_message_send(server,session->connection,message); - - if(terminate == TRUE) { - session->active_request = NULL; - rtsp_server_session_terminate_request(server,session); - return TRUE; - } - - session->active_request = apt_list_pop_front(session->request_queue); - if(session->active_request) { - rtsp_server_session_message_handle(server,session,session->active_request); - } - return TRUE; -} - -/* Send RTSP message through RTSP connection */ -static apt_bool_t rtsp_server_message_send(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message) -{ - apt_bool_t status = FALSE; - apt_text_stream_t *stream; - apt_message_status_e result; - - if(!rtsp_connection || !rtsp_connection->sock) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No RTSP Connection"); - return FALSE; - } - stream = &rtsp_connection->tx_stream; - - do { - stream->text.length = sizeof(rtsp_connection->tx_buffer)-1; - apt_text_stream_reset(stream); - result = rtsp_generator_run(rtsp_connection->generator,message,stream); - if(result != APT_MESSAGE_STATUS_INVALID) { - stream->text.length = stream->pos - stream->text.buf; - *stream->pos = '\0'; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Send RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", - rtsp_connection->id, - stream->text.length, - stream->text.buf); - if(apr_socket_send(rtsp_connection->sock,stream->text.buf,&stream->text.length) == APR_SUCCESS) { - status = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Data"); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data"); - } - } - while(result == APT_MESSAGE_STATUS_INCOMPLETE); - - return status; -} - -static apt_bool_t rtsp_server_message_handler(rtsp_server_connection_t *rtsp_connection, rtsp_message_t *message, apt_message_status_e status) -{ - if(status == APT_MESSAGE_STATUS_COMPLETE) { - /* message is completely parsed */ - apt_str_t *destination; - destination = &message->header.transport.destination; - if(!destination->buf && rtsp_connection->client_ip) { - apt_string_assign(destination,rtsp_connection->client_ip,rtsp_connection->pool); - } - rtsp_server_session_request_process(rtsp_connection->server,rtsp_connection,message); - } - else if(status == APT_MESSAGE_STATUS_INVALID) { - /* error case */ - rtsp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse RTSP Data"); - if(message) { - response = rtsp_response_create(message,RTSP_STATUS_CODE_BAD_REQUEST, - RTSP_REASON_PHRASE_BAD_REQUEST,message->pool); - if(rtsp_server_message_send(rtsp_connection->server,rtsp_connection,response) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Send RTSP Response"); - } - } - } - return TRUE; -} - -/** Create listening socket and add it to pollset */ -static apt_bool_t rtsp_server_listening_socket_create(rtsp_server_t *server) -{ - apr_status_t status; - - if(!server->sockaddr) { - return FALSE; - } - - /* create listening socket */ - status = apr_socket_create(&server->listen_sock, server->sockaddr->family, SOCK_STREAM, APR_PROTO_TCP, server->pool); - if(status != APR_SUCCESS) { - return FALSE; - } - - apr_socket_opt_set(server->listen_sock, APR_SO_NONBLOCK, 0); - apr_socket_timeout_set(server->listen_sock, -1); - apr_socket_opt_set(server->listen_sock, APR_SO_REUSEADDR, 1); - - status = apr_socket_bind(server->listen_sock, server->sockaddr); - if(status != APR_SUCCESS) { - apr_socket_close(server->listen_sock); - server->listen_sock = NULL; - return FALSE; - } - status = apr_socket_listen(server->listen_sock, SOMAXCONN); - if(status != APR_SUCCESS) { - apr_socket_close(server->listen_sock); - server->listen_sock = NULL; - return FALSE; - } - - /* add listening socket to pollset */ - memset(&server->listen_sock_pfd,0,sizeof(apr_pollfd_t)); - server->listen_sock_pfd.desc_type = APR_POLL_SOCKET; - server->listen_sock_pfd.reqevents = APR_POLLIN; - server->listen_sock_pfd.desc.s = server->listen_sock; - server->listen_sock_pfd.client_data = server->listen_sock; - if(apt_poller_task_descriptor_add(server->task, &server->listen_sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add Listening Socket to Pollset"); - apr_socket_close(server->listen_sock); - server->listen_sock = NULL; - return FALSE; - } - - return TRUE; -} - -/** Remove from pollset and destroy listening socket */ -static void rtsp_server_listening_socket_destroy(rtsp_server_t *server) -{ - if(server->listen_sock) { - apt_poller_task_descriptor_remove(server->task,&server->listen_sock_pfd); - apr_socket_close(server->listen_sock); - server->listen_sock = NULL; - } -} - -/* Accept RTSP connection */ -static apt_bool_t rtsp_server_connection_accept(rtsp_server_t *server) -{ - rtsp_server_connection_t *rtsp_connection; - char *local_ip = NULL; - char *remote_ip = NULL; - apr_sockaddr_t *l_sockaddr = NULL; - apr_sockaddr_t *r_sockaddr = NULL; - apr_pool_t *pool = apt_pool_create(); - if(!pool) { - return FALSE; - } - - rtsp_connection = apr_palloc(pool,sizeof(rtsp_server_connection_t)); - rtsp_connection->pool = pool; - rtsp_connection->sock = NULL; - rtsp_connection->client_ip = NULL; - APR_RING_ELEM_INIT(rtsp_connection,link); - - if(apr_socket_accept(&rtsp_connection->sock,server->listen_sock,rtsp_connection->pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Accept RTSP Connection"); - apr_pool_destroy(pool); - return FALSE; - } - - if(apr_socket_addr_get(&l_sockaddr,APR_LOCAL,rtsp_connection->sock) != APR_SUCCESS || - apr_socket_addr_get(&r_sockaddr,APR_REMOTE,rtsp_connection->sock) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get RTSP Socket Address"); - apr_pool_destroy(pool); - return FALSE; - } - - apr_sockaddr_ip_get(&local_ip,l_sockaddr); - apr_sockaddr_ip_get(&remote_ip,r_sockaddr); - rtsp_connection->client_ip = remote_ip; - rtsp_connection->id = apr_psprintf(pool,"%s:%hu <-> %s:%hu", - local_ip,l_sockaddr->port, - remote_ip,r_sockaddr->port); - - memset(&rtsp_connection->sock_pfd,0,sizeof(apr_pollfd_t)); - rtsp_connection->sock_pfd.desc_type = APR_POLL_SOCKET; - rtsp_connection->sock_pfd.reqevents = APR_POLLIN; - rtsp_connection->sock_pfd.desc.s = rtsp_connection->sock; - rtsp_connection->sock_pfd.client_data = rtsp_connection; - if(apt_poller_task_descriptor_add(server->task,&rtsp_connection->sock_pfd) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Add to Pollset %s",rtsp_connection->id); - apr_socket_close(rtsp_connection->sock); - apr_pool_destroy(pool); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Accepted TCP Connection %s",rtsp_connection->id); - rtsp_connection->session_table = apr_hash_make(rtsp_connection->pool); - apt_text_stream_init(&rtsp_connection->rx_stream,rtsp_connection->rx_buffer,sizeof(rtsp_connection->rx_buffer)-1); - apt_text_stream_init(&rtsp_connection->tx_stream,rtsp_connection->tx_buffer,sizeof(rtsp_connection->tx_buffer)-1); - rtsp_connection->parser = rtsp_parser_create(rtsp_connection->pool); - rtsp_connection->generator = rtsp_generator_create(rtsp_connection->pool); - rtsp_connection->server = server; - APR_RING_INSERT_TAIL(&server->connection_list,rtsp_connection,rtsp_server_connection_t,link); - return TRUE; -} - -/** Close connection */ -static apt_bool_t rtsp_server_connection_close(rtsp_server_t *server, rtsp_server_connection_t *rtsp_connection) -{ - apr_size_t remaining_sessions = 0; - if(!rtsp_connection || !rtsp_connection->sock) { - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close RTSP Connection %s",rtsp_connection->id); - apt_poller_task_descriptor_remove(server->task,&rtsp_connection->sock_pfd); - apr_socket_close(rtsp_connection->sock); - rtsp_connection->sock = NULL; - - APR_RING_REMOVE(rtsp_connection,link); - - remaining_sessions = apr_hash_count(rtsp_connection->session_table); - if(remaining_sessions) { - rtsp_server_session_t *session; - void *val; - apr_hash_index_t *it; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Terminate Remaining RTSP Sessions [%"APR_SIZE_T_FMT"]", - remaining_sessions); - it = apr_hash_first(rtsp_connection->pool,rtsp_connection->session_table); - for(; it; it = apr_hash_next(it)) { - apr_hash_this(it,NULL,NULL,&val); - session = val; - if(session && session->terminating == FALSE) { - rtsp_server_session_terminate_request(server,session); - } - } - } - else { - rtsp_server_connection_destroy(rtsp_connection); - } - return TRUE; -} - - -/* Receive RTSP message through RTSP connection */ -static apt_bool_t rtsp_server_poller_signal_process(void *obj, const apr_pollfd_t *descriptor) -{ - rtsp_server_t *server = obj; - rtsp_server_connection_t *rtsp_connection = descriptor->client_data; - apr_status_t status; - apr_size_t offset; - apr_size_t length; - apt_text_stream_t *stream; - rtsp_message_t *message; - apt_message_status_e msg_status; - - if(descriptor->desc.s == server->listen_sock) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Accept Connection"); - return rtsp_server_connection_accept(server); - } - - if(!rtsp_connection || !rtsp_connection->sock) { - return FALSE; - } - stream = &rtsp_connection->rx_stream; - - /* calculate offset remaining from the previous receive / if any */ - offset = stream->pos - stream->text.buf; - /* calculate available length */ - length = sizeof(rtsp_connection->rx_buffer) - 1 - offset; - - status = apr_socket_recv(rtsp_connection->sock,stream->pos,&length); - if(status == APR_EOF || length == 0) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"RTSP Peer Disconnected %s",rtsp_connection->id); - return rtsp_server_connection_close(server,rtsp_connection); - } - - /* calculate actual length of the stream */ - stream->text.length = offset + length; - stream->pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive RTSP Data %s [%"APR_SIZE_T_FMT" bytes]\n%s", - rtsp_connection->id, - length, - stream->pos); - - /* reset pos */ - apt_text_stream_reset(stream); - - do { - msg_status = rtsp_parser_run(rtsp_connection->parser,stream,&message); - rtsp_server_message_handler(rtsp_connection,message,msg_status); - } - while(apt_text_is_eos(stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(stream); - return TRUE; -} - -/* Process task message */ -static apt_bool_t rtsp_server_task_msg_process(apt_task_t *task, apt_task_msg_t *task_msg) -{ - apt_poller_task_t *poller_task = apt_task_object_get(task); - rtsp_server_t *server = apt_poller_task_object_get(poller_task); - - task_msg_data_t *data = (task_msg_data_t*) task_msg->data; - switch(data->type) { - case TASK_MSG_SEND_MESSAGE: - rtsp_server_session_response_process(server,data->session,data->message); - break; - case TASK_MSG_TERMINATE_SESSION: - rtsp_server_session_do_terminate(server,data->session); - break; - } - - return TRUE; -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c deleted file mode 100644 index a374675af3..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_start_line.c +++ /dev/null @@ -1,261 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_start_line.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "rtsp_start_line.h" -#include "apt_string_table.h" -#include "apt_log.h" - -/** Protocol name used in version string */ -#define RTSP_NAME "RTSP" -#define RTSP_NAME_LENGTH (sizeof(RTSP_NAME)-1) - -/** Separators used in RTSP version string parse/generate */ -#define RTSP_NAME_VERSION_SEPARATOR '/' -#define RTSP_VERSION_MAJOR_MINOR_SEPARATOR '.' - -/** String table of RTSP methods (rtsp_method_id) */ -static const apt_str_table_item_t rtsp_method_string_table[] = { - {{"SETUP", 5},0}, - {{"ANNOUNCE", 8},0}, - {{"TEARDOWN", 8},0}, - {{"DESCRIBE", 8},0} -}; - -/** String table of RTSP reason phrases (rtsp_reason_phrase_e) */ -static const apt_str_table_item_t rtsp_reason_string_table[] = { - {{"OK", 2},0}, - {{"Created", 7},0}, - {{"Bad Request", 11},0}, - {{"Unauthorized", 12},0}, - {{"Not Found", 9},4}, - {{"Method Not Allowed", 18},0}, - {{"Not Acceptable", 14},4}, - {{"Proxy Auth Required", 19},0}, - {{"Request Timeout", 15},0}, - {{"Session Not Found", 17},0}, - {{"Internal Server Error", 21},0}, - {{"Not Implemented", 15},4} -}; - -/** Parse RTSP URI */ -static apt_bool_t rtsp_resource_uri_parse(const apt_str_t *field, rtsp_request_line_t *request_line, apr_pool_t *pool) -{ - char *str; - apt_str_t *url = &request_line->url; - if(!field->length || !field->buf) { - return FALSE; - } - - apt_string_copy(url,field,pool); - if(url->buf[url->length-1] == '/') { - url->length--; - url->buf[url->length] = '\0'; - } - - str = strrchr(url->buf,'/'); - if(str) { - str++; - } - request_line->resource_name = str; - return TRUE; -} - -/** Parse RTSP version */ -static rtsp_version_e rtsp_version_parse(const apt_str_t *field) -{ - rtsp_version_e version = RTSP_VERSION_UNKNOWN; - const char *pos; - if(field->length <= RTSP_NAME_LENGTH || strncasecmp(field->buf,RTSP_NAME,RTSP_NAME_LENGTH) != 0) { - /* unexpected protocol name */ - return version; - } - - pos = field->buf + RTSP_NAME_LENGTH; - if(*pos == RTSP_NAME_VERSION_SEPARATOR) { - pos++; - switch(*pos) { - case '1': version = RTSP_VERSION_1; break; - default: ; - } - } - return version; -} - -/** Generate RTSP version */ -static apt_bool_t rtsp_version_generate(rtsp_version_e version, apt_text_stream_t *stream) -{ - if(stream->pos + RTSP_NAME_LENGTH + 1 >= stream->end) { - return FALSE; - } - memcpy(stream->pos,RTSP_NAME,RTSP_NAME_LENGTH); - stream->pos += RTSP_NAME_LENGTH; - *stream->pos++ = RTSP_NAME_VERSION_SEPARATOR; - - if(apt_text_size_value_insert(stream,version) == FALSE) { - return FALSE; - } - - if(stream->pos + 2 >= stream->end) { - return FALSE; - } - *stream->pos++ = RTSP_VERSION_MAJOR_MINOR_SEPARATOR; - *stream->pos++ = '0'; - return TRUE; -} - -/** Parse RTSP status-code */ -static APR_INLINE rtsp_status_code_e rtsp_status_code_parse(const apt_str_t *field) -{ - return apt_size_value_parse(field); -} - -/** Generate RTSP status-code */ -static APR_INLINE apt_bool_t rtsp_status_code_generate(rtsp_status_code_e status_code, apt_text_stream_t *stream) -{ - return apt_text_size_value_insert(stream,status_code); -} - -/** Generate RTSP request-line */ -static apt_bool_t rtsp_request_line_generate(rtsp_request_line_t *start_line, apt_text_stream_t *stream) -{ - const apt_str_t *method_name = apt_string_table_str_get(rtsp_method_string_table,RTSP_METHOD_COUNT,start_line->method_id); - if(!method_name) { - return FALSE; - } - start_line->method_name = *method_name; - if(apt_text_string_insert(stream,&start_line->method_name) == FALSE) { - return FALSE; - } - if(apt_text_space_insert(stream) == FALSE) { - return FALSE; - } - - if(apt_text_string_insert(stream,&start_line->url) == FALSE) { - return FALSE; - } - if(apt_text_space_insert(stream) == FALSE) { - return FALSE; - } - - return rtsp_version_generate(start_line->version,stream); -} - -/** Generate RTSP status-line */ -static apt_bool_t rtsp_status_line_generate(rtsp_status_line_t *start_line, apt_text_stream_t *stream) -{ - if(rtsp_version_generate(start_line->version,stream) == FALSE) { - return FALSE; - } - if(apt_text_space_insert(stream) == FALSE) { - return FALSE; - } - - if(rtsp_status_code_generate(start_line->status_code,stream) == FALSE) { - return FALSE; - } - if(apt_text_space_insert(stream) == FALSE) { - return FALSE; - } - - return apt_text_string_insert(stream,&start_line->reason); -} - -/** Parse RTSP start-line */ -RTSP_DECLARE(apt_bool_t) rtsp_start_line_parse(rtsp_start_line_t *start_line, apt_str_t *str, apr_pool_t *pool) -{ - apt_text_stream_t line; - apt_str_t field; - - apt_text_stream_init(&line,str->buf,str->length); - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot read the first field in start-line"); - return FALSE; - } - - if(field.buf == strstr(field.buf,RTSP_NAME)) { - /* parsing RTSP response */ - rtsp_status_line_t *status_line = &start_line->common.status_line; - start_line->message_type = RTSP_MESSAGE_TYPE_RESPONSE; - rtsp_status_line_init(status_line); - - status_line->version = rtsp_version_parse(&field); - - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse status-code in status-line"); - return FALSE; - } - status_line->status_code = rtsp_status_code_parse(&field); - - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse reason phrase in status-line"); - return FALSE; - } - apt_string_copy(&status_line->reason,&field,pool); - } - else { - /* parsing RTSP request */ - rtsp_request_line_t *request_line = &start_line->common.request_line; - start_line->message_type = RTSP_MESSAGE_TYPE_REQUEST; - rtsp_request_line_init(request_line); - - apt_string_copy(&request_line->method_name,&field,pool); - request_line->method_id = apt_string_table_id_find(rtsp_method_string_table,RTSP_METHOD_COUNT,&field); - - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse URL in request-line"); - return FALSE; - } - rtsp_resource_uri_parse(&field,request_line,pool); - - if(apt_text_field_read(&line,APT_TOKEN_SP,TRUE,&field) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot parse version in request-line"); - return FALSE; - } - request_line->version = rtsp_version_parse(&field); - } - - return TRUE; -} - -/** Generate RTSP start-line */ -RTSP_DECLARE(apt_bool_t) rtsp_start_line_generate(rtsp_start_line_t *start_line, apt_text_stream_t *stream) -{ - apt_bool_t status = FALSE; - switch(start_line->message_type) { - case RTSP_MESSAGE_TYPE_REQUEST: - status = rtsp_request_line_generate(&start_line->common.request_line,stream); - break; - case RTSP_MESSAGE_TYPE_RESPONSE: - status = rtsp_status_line_generate(&start_line->common.status_line,stream); - break; - default: - break; - } - - if(status == FALSE) { - return FALSE; - } - - return apt_text_eol_insert(stream); -} - -/** Get reason phrase by status code */ -RTSP_DECLARE(const apt_str_t*) rtsp_reason_phrase_get(rtsp_reason_phrase_e reason) -{ - return apt_string_table_str_get(rtsp_reason_string_table,RTSP_REASON_PHRASE_COUNT,reason); -} diff --git a/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c b/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c deleted file mode 100644 index 945e7a9874..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/src/rtsp_stream.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: rtsp_stream.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "rtsp_stream.h" -#include "apt_log.h" - -/** RTSP parser */ -struct rtsp_parser_t { - apt_message_parser_t *base; -}; - -/** RTSP generator */ -struct rtsp_generator_t { - apt_message_generator_t *base; -}; - -/** Create message and read start line */ -static apt_bool_t rtsp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool); -/** Header section handler */ -static apt_bool_t rtsp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context); - -static const apt_message_parser_vtable_t parser_vtable = { - rtsp_parser_on_start, - rtsp_parser_on_header_complete, - NULL -}; - - -/** Initialize by generating message start line and return header section and body */ -apt_bool_t rtsp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream); - -static const apt_message_generator_vtable_t generator_vtable = { - rtsp_generator_on_start, - NULL, - NULL -}; - - -/** Create RTSP parser */ -RTSP_DECLARE(rtsp_parser_t*) rtsp_parser_create(apr_pool_t *pool) -{ - rtsp_parser_t *parser = apr_palloc(pool,sizeof(rtsp_parser_t)); - parser->base = apt_message_parser_create(parser,&parser_vtable,pool); - return parser; -} - -/** Parse RTSP stream */ -RTSP_DECLARE(apt_message_status_e) rtsp_parser_run(rtsp_parser_t *parser, apt_text_stream_t *stream, rtsp_message_t **message) -{ - return apt_message_parser_run(parser->base,stream,(void**)message); -} - -/** Create message and read start line */ -static apt_bool_t rtsp_parser_on_start(apt_message_parser_t *parser, apt_message_context_t *context, apt_text_stream_t *stream, apr_pool_t *pool) -{ - rtsp_message_t *message; - apt_str_t start_line; - /* read start line */ - if(apt_text_line_read(stream,&start_line) == FALSE) { - return FALSE; - } - - message = rtsp_message_create(RTSP_MESSAGE_TYPE_UNKNOWN,pool); - if(rtsp_start_line_parse(&message->start_line,&start_line,message->pool) == FALSE) { - return FALSE; - } - - context->message = message; - context->header = &message->header.header_section; - context->body = &message->body; - return TRUE; -} - -/** Header section handler */ -static apt_bool_t rtsp_parser_on_header_complete(apt_message_parser_t *parser, apt_message_context_t *context) -{ - rtsp_message_t *rtsp_message = context->message; - rtsp_header_fields_parse(&rtsp_message->header,rtsp_message->pool); - - if(context->body && rtsp_header_property_check(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE) { - context->body->length = rtsp_message->header.content_length; - } - - return TRUE; -} - -/** Create RTSP stream generator */ -RTSP_DECLARE(rtsp_generator_t*) rtsp_generator_create(apr_pool_t *pool) -{ - rtsp_generator_t *generator = apr_palloc(pool,sizeof(rtsp_generator_t)); - generator->base = apt_message_generator_create(generator,&generator_vtable,pool); - return generator; -} - - -/** Generate RTSP stream */ -RTSP_DECLARE(apt_message_status_e) rtsp_generator_run(rtsp_generator_t *generator, rtsp_message_t *message, apt_text_stream_t *stream) -{ - return apt_message_generator_run(generator->base,message,stream); -} - -/** Initialize by generating message start line and return header section and body */ -apt_bool_t rtsp_generator_on_start(apt_message_generator_t *generator, apt_message_context_t *context, apt_text_stream_t *stream) -{ - rtsp_message_t *rtsp_message = context->message; - context->header = &rtsp_message->header.header_section; - context->body = &rtsp_message->body; - return rtsp_start_line_generate(&rtsp_message->start_line,stream); -} diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters deleted file mode 100644 index 5a1581a2c3..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2010.vcxproj.filters +++ /dev/null @@ -1,56 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {fd4564ef-9f34-4f23-992d-37f127e289a2} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj deleted file mode 100644 index 1b368a09e6..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.2017.vcxproj +++ /dev/null @@ -1,141 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - unirtsp - {504B3154-7A4F-459D-9877-B951021C3F1F} - unirtsp - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - ProgramDatabase - - - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - X64 - - - codecs;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - - - - - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj deleted file mode 100644 index c2e59e70fb..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcproj +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj deleted file mode 100644 index 82cedac8fe..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {504B3154-7A4F-459D-9877-B951021C3F1F} - unirtsp - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - X64 - - - ProgramDatabase - - - - - X64 - - - - - - - - - - - - - - - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters b/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters deleted file mode 100644 index 1a8db5806c..0000000000 --- a/libs/unimrcp/libs/uni-rtsp/unirtsp.vcxproj.filters +++ /dev/null @@ -1,56 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {8ffd50c3-3b28-438d-a305-071644d5f115} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/Makefile.am b/libs/unimrcp/modules/Makefile.am deleted file mode 100644 index 7c5ba9768e..0000000000 --- a/libs/unimrcp/modules/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = mrcp-sofiasip mrcp-unirtsp diff --git a/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am b/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am deleted file mode 100644 index f343037623..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/modules/mrcp-sofiasip/include \ - -I$(top_srcdir)/libs/mrcpv2-transport/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_SOFIA_INCLUDES) - -noinst_LTLIBRARIES = libmrcpsofiasip.la - -include_HEADERS = include/mrcp_sdp.h \ - include/mrcp_sofiasip_server_agent.h \ - include/mrcp_sofiasip_client_agent.h -libmrcpsofiasip_la_SOURCES = src/mrcp_sdp.c \ - src/mrcp_sofiasip_server_agent.c \ - src/mrcp_sofiasip_client_agent.c \ - src/mrcp_sofiasip_logger.c diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h deleted file mode 100644 index 5c4b5c74ef..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sdp.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sdp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SDP_H -#define MRCP_SDP_H - -/** - * @file mrcp_sdp.h - * @brief MRCP SDP Transformations - */ - -#include "mrcp_sig_types.h" - -APT_BEGIN_EXTERN_C - -/** Generate SDP string by MRCP descriptor */ -MRCP_DECLARE(apr_size_t) sdp_string_generate_by_mrcp_descriptor(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, apt_bool_t offer); - -/** Generate MRCP descriptor by SDP session */ -MRCP_DECLARE(apt_bool_t) mrcp_descriptor_generate_by_sdp_session(mrcp_session_descriptor_t* descriptor, const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool); - -/** Generate SDP resource discovery string */ -MRCP_DECLARE(apr_size_t) sdp_resource_discovery_string_generate(const char *ip, const char *origin, char *buffer, apr_size_t size); - -APT_END_EXTERN_C - -#endif /* MRCP_SDP_H */ diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h deleted file mode 100644 index 4dd605a8cd..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_client_agent.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sofiasip_client_agent.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SOFIASIP_CLIENT_AGENT_H -#define MRCP_SOFIASIP_CLIENT_AGENT_H - -/** - * @file mrcp_sofiasip_client_agent.h - * @brief Implementation of MRCP Signaling Interface using Sofia-SIP - */ - -#include -#include "mrcp_sig_agent.h" - -APT_BEGIN_EXTERN_C - -/** Sofia-SIP config declaration */ -typedef struct mrcp_sofia_client_config_t mrcp_sofia_client_config_t; - -/** Sofia-SIP config */ -struct mrcp_sofia_client_config_t { - /** Local IP address */ - char *local_ip; - /** External (NAT) IP address */ - char *ext_ip; - /** Local SIP port */ - apr_port_t local_port; - /** Local SIP user name */ - char *local_user_name; - /** User agent name */ - char *user_agent_name; - /** SDP origin */ - char *origin; - /** SIP transport */ - char *transport; - /** SIP T1 timer */ - apr_size_t sip_t1; - /** SIP T2 timer */ - apr_size_t sip_t2; - /** SIP T4 timer */ - apr_size_t sip_t4; - /** SIP T1x64 timer */ - apr_size_t sip_t1x64; - /** Print out SIP messages to the console */ - apt_bool_t tport_log; - /** Dump SIP messages to the specified file */ - char *tport_dump_file; -}; - -/** - * Create Sofia-SIP signaling agent. - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_client_agent_create(const char *id, mrcp_sofia_client_config_t *config, apr_pool_t *pool); - -/** - * Allocate Sofia-SIP config. - */ -MRCP_DECLARE(mrcp_sofia_client_config_t*) mrcp_sofiasip_client_config_alloc(apr_pool_t *pool); - -/** - * Initialize Sofia-SIP logger. - */ -MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_client_logger_init(const char *name, const char *level_str, apt_bool_t redirect); - -APT_END_EXTERN_C - -#endif /* MRCP_SOFIASIP_CLIENT_AGENT_H */ diff --git a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h b/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h deleted file mode 100644 index 4cc78c6fbf..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/include/mrcp_sofiasip_server_agent.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sofiasip_server_agent.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_SOFIASIP_SERVER_AGENT_H -#define MRCP_SOFIASIP_SERVER_AGENT_H - -/** - * @file mrcp_sofiasip_server_agent.h - * @brief Implementation of MRCP Signaling Interface using Sofia-SIP - */ - -#include -#include "mrcp_sig_agent.h" - -APT_BEGIN_EXTERN_C - -/** Sofia-SIP config declaration */ -typedef struct mrcp_sofia_server_config_t mrcp_sofia_server_config_t; - -/** Sofia-SIP config */ -struct mrcp_sofia_server_config_t { - /** Local IP address to bind to */ - char *local_ip; - /** External (NAT) IP address */ - char *ext_ip; - /** Local port to bind to */ - apr_port_t local_port; - /** SIP user name */ - char *user_name; - /** User agent name */ - char *user_agent_name; - /** SDP origin */ - char *origin; - /** SIP transport */ - char *transport; - /** Force destination IP address. Should be used only in case - SDP contains incorrect connection address (local IP address behind NAT) */ - apt_bool_t force_destination; - /** SIP T1 timer */ - apr_size_t sip_t1; - /** SIP T2 timer */ - apr_size_t sip_t2; - /** SIP T4 timer */ - apr_size_t sip_t4; - /** SIP T1x64 timer */ - apr_size_t sip_t1x64; - /** Print out SIP messages to the console */ - apt_bool_t tport_log; - /** Dump SIP messages to the specified file */ - char *tport_dump_file; -}; - -/** - * Create Sofia-SIP signaling agent. - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_server_agent_create(const char *id, mrcp_sofia_server_config_t *config, apr_pool_t *pool); - -/** - * Allocate Sofia-SIP config. - */ -MRCP_DECLARE(mrcp_sofia_server_config_t*) mrcp_sofiasip_server_config_alloc(apr_pool_t *pool); - -/** - * Initialize Sofia-SIP logger. - */ -MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_server_logger_init(const char *name, const char *level_str, apt_bool_t redirect); - -APT_END_EXTERN_C - -#endif /* MRCP_SOFIASIP_SERVER_AGENT_H */ diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters deleted file mode 100644 index 33ff479678..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2010.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {6e92b598-880e-4fe5-88fb-f69df8e06a57} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj deleted file mode 100644 index c8d8f65306..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.2017.vcxproj +++ /dev/null @@ -1,143 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpsofiasip - {746F3632-5BB2-4570-9453-31D6D58A7D8E} - mrcpsofiasip - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - ProgramDatabase - - - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - - - - - - - - - - - - {70a49bc2-7500-41d0-b75d-edcc5be987a0} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj deleted file mode 100644 index 20f9ce8e3a..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcproj +++ /dev/null @@ -1,288 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj deleted file mode 100644 index cd2e9a2251..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj +++ /dev/null @@ -1,147 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {746F3632-5BB2-4570-9453-31D6D58A7D8E} - mrcpsofiasip - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters b/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters deleted file mode 100644 index d0579e36d8..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/mrcpsofiasip.vcxproj.filters +++ /dev/null @@ -1,38 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {5256b9c6-18be-48fc-aaa3-8e2c17df7f8d} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c deleted file mode 100644 index 16fcfee97d..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sdp.c +++ /dev/null @@ -1,421 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sdp.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "mrcp_sdp.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_control_descriptor.h" -#include "mpf_rtp_attribs.h" -#include "mpf_rtp_pt.h" -#include "apt_text_stream.h" -#include "apt_log.h" - -#if _MSC_VER >= 1900 -#pragma warning(disable: 4477) -// 'snprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'apr_size_t' 264 -// 'snprintf' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'const apr_size_t' 198 -#endif - -static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_descriptor); -static apr_size_t sdp_control_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mrcp_control_descriptor_t *control_media, apt_bool_t offer); - -static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool); -static apt_bool_t mrcp_control_media_generate(mrcp_control_descriptor_t *mrcp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool); - -/** Generate SDP string by MRCP descriptor */ -MRCP_DECLARE(apr_size_t) sdp_string_generate_by_mrcp_descriptor(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, apt_bool_t offer) -{ - apr_size_t i; - apr_size_t count; - apr_size_t audio_index = 0; - mpf_rtp_media_descriptor_t *audio_media; - apr_size_t video_index = 0; - mpf_rtp_media_descriptor_t *video_media; - apr_size_t control_index = 0; - mrcp_control_descriptor_t *control_media; - apr_size_t offset = 0; - const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0"); - buffer[0] = '\0'; - offset += snprintf(buffer+offset,size-offset, - "v=0\r\n" - "o=%s 0 0 IN IP4 %s\r\n" - "s=-\r\n" - "c=IN IP4 %s\r\n" - "t=0 0\r\n", - descriptor->origin.buf ? descriptor->origin.buf : "-", - ip, - ip); - count = mrcp_session_media_count_get(descriptor); - for(i=0; iid == i) { - /* generate audio media */ - audio_index++; - offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media); - continue; - } - video_media = mrcp_session_video_media_get(descriptor,video_index); - if(video_media && video_media->id == i) { - /* generate video media */ - video_index++; - offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,video_media); - continue; - } - control_media = mrcp_session_control_media_get(descriptor,control_index); - if(control_media && control_media->id == i) { - /** generate mrcp control media */ - control_index++; - offset += sdp_control_media_generate(buffer+offset,size-offset,descriptor,control_media,offer); - continue; - } - } - return offset; -} - -/** Generate MRCP descriptor by SDP session */ -MRCP_DECLARE(apt_bool_t) mrcp_descriptor_generate_by_sdp_session(mrcp_session_descriptor_t* descriptor, const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool) -{ - sdp_media_t *sdp_media; - - if(!sdp) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Invalid SDP Message"); - return FALSE; - } - - if(force_destination_ip) { - apt_string_assign(&descriptor->ip,force_destination_ip,pool); - } - else if(sdp->sdp_connection) { - apt_string_assign(&descriptor->ip,sdp->sdp_connection->c_address,pool); - } - - for(sdp_media=sdp->sdp_media; sdp_media; sdp_media=sdp_media->m_next) { - switch(sdp_media->m_type) { - case sdp_media_audio: - { - mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->id = mrcp_session_audio_media_add(descriptor,media); - mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool); - break; - } - case sdp_media_video: - { - mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->id = mrcp_session_video_media_add(descriptor,media); - mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool); - break; - } - case sdp_media_application: - { - mrcp_control_descriptor_t *control_media = mrcp_control_descriptor_create(pool); - control_media->id = mrcp_session_control_media_add(descriptor,control_media); - mrcp_control_media_generate(control_media,sdp_media,&descriptor->ip,pool); - break; - } - default: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not Supported SDP Media [%s]", sdp_media->m_type_name); - break; - } - } - return TRUE; -} - -/** Generate SDP media by RTP media descriptor */ -static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_media) -{ - apr_size_t offset = 0; - if(audio_media->state == MPF_MEDIA_ENABLED) { - int codec_count = 0; - int i; - mpf_codec_descriptor_t *codec_descriptor; - apr_array_header_t *descriptor_arr = audio_media->codec_list.descriptor_arr; - const apt_str_t *direction_str; - if(!descriptor_arr) { - return 0; - } - - offset += snprintf(buffer+offset,size-offset,"m=audio %d RTP/AVP",audio_media->port); - for(i=0; inelts; i++) { - codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t); - if(codec_descriptor->enabled == TRUE) { - offset += snprintf(buffer+offset,size-offset," %d",codec_descriptor->payload_type); - codec_count++; - } - } - if(!codec_count){ - /* SDP m line should have at least one media format listed; use a reserved RTP payload type */ - offset += snprintf(buffer+offset,size-offset," %d",RTP_PT_RESERVED); - } - offset += snprintf(buffer+offset,size-offset,"\r\n"); - - if(descriptor->ip.length && audio_media->ip.length && - apt_string_compare(&descriptor->ip,&audio_media->ip) != TRUE) { - const char *media_ip = audio_media->ext_ip.buf ? audio_media->ext_ip.buf : audio_media->ip.buf; - offset += snprintf(buffer+offset,size-offset,"c=IN IP4 %s\r\n",media_ip); - } - - for(i=0; inelts; i++) { - codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t); - if(codec_descriptor->enabled == TRUE && codec_descriptor->name.buf) { - offset += snprintf(buffer+offset,size-offset,"a=rtpmap:%d %s/%d\r\n", - codec_descriptor->payload_type, - codec_descriptor->name.buf, - codec_descriptor->sampling_rate); - if(codec_descriptor->format.buf) { - offset += snprintf(buffer+offset,size-offset,"a=fmtp:%d %s\r\n", - codec_descriptor->payload_type, - codec_descriptor->format.buf); - } - } - } - - direction_str = mpf_rtp_direction_str_get(audio_media->direction); - if(direction_str) { - offset += snprintf(buffer+offset,size-offset,"a=%s\r\n",direction_str->buf); - } - - if(audio_media->ptime) { - offset += snprintf(buffer+offset,size-offset,"a=ptime:%hu\r\n",audio_media->ptime); - } - } - else { - offset += snprintf(buffer+offset,size-offset,"m=audio 0 RTP/AVP %d\r\n",RTP_PT_RESERVED); - } - - offset += snprintf(buffer+offset,size-offset,"a=mid:%"APR_SIZE_T_FMT"\r\n",audio_media->mid); - return offset; -} - -/** Generate SDP media by MRCP control media descriptor */ -static apr_size_t sdp_control_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mrcp_control_descriptor_t *control_media, apt_bool_t offer) -{ - int i; - apr_size_t offset = 0; - const apt_str_t *proto; - const apt_str_t *setup_type; - const apt_str_t *connection_type; - proto = mrcp_proto_get(control_media->proto); - setup_type = mrcp_setup_type_get(control_media->setup_type); - connection_type = mrcp_connection_type_get(control_media->connection_type); - if(offer == TRUE) { /* offer */ - if(control_media->port) { - offset += snprintf(buffer+offset,size-offset, - "m=application %d %s 1\r\n" - "a=setup:%s\r\n" - "a=connection:%s\r\n" - "a=resource:%s\r\n", - control_media->port, - proto ? proto->buf : "", - setup_type ? setup_type->buf : "", - connection_type ? connection_type->buf : "", - control_media->resource_name.buf); - - } - else { - offset += snprintf(buffer+offset,size-offset, - "m=application %d %s 1\r\n" - "a=resource:%s\r\n", - control_media->port, - proto ? proto->buf : "", - control_media->resource_name.buf); - } - } - else { /* answer */ - if(control_media->port) { - offset += snprintf(buffer+offset,size-offset, - "m=application %d %s 1\r\n" - "a=setup:%s\r\n" - "a=connection:%s\r\n" - "a=channel:%s@%s\r\n", - control_media->port, - proto ? proto->buf : "", - setup_type ? setup_type->buf : "", - connection_type ? connection_type->buf : "", - control_media->session_id.buf, - control_media->resource_name.buf); - } - else { - offset += snprintf(buffer+offset,size-offset, - "m=application %d %s 1\r\n" - "a=channel:%s@%s\r\n", - control_media->port, - proto ? proto->buf : "", - control_media->session_id.buf, - control_media->resource_name.buf); - } - } - - for(i=0; icmid_arr->nelts; i++) { - offset += snprintf(buffer+offset,size-offset, - "a=cmid:%"APR_SIZE_T_FMT"\r\n", - APR_ARRAY_IDX(control_media->cmid_arr,i,apr_size_t)); - } - - return offset; -} - -/** Generate RTP media descriptor by SDP media */ -static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool) -{ - mpf_rtp_attrib_e id; - apt_str_t name; - sdp_attribute_t *attrib = NULL; - sdp_rtpmap_t *map; - mpf_codec_descriptor_t *codec; - for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) { - apt_string_set(&name,attrib->a_name); - id = mpf_rtp_attrib_id_find(&name); - switch(id) { - case RTP_ATTRIB_MID: - rtp_media->mid = atoi(attrib->a_value); - break; - case RTP_ATTRIB_PTIME: - rtp_media->ptime = (apr_uint16_t)atoi(attrib->a_value); - break; - default: - break; - } - } - - mpf_codec_list_init(&rtp_media->codec_list,5,pool); - for(map = sdp_media->m_rtpmaps; map; map = map->rm_next) { - codec = mpf_codec_list_add(&rtp_media->codec_list); - if(codec) { - codec->payload_type = (apr_byte_t)map->rm_pt; - apt_string_assign(&codec->name,map->rm_encoding,pool); - codec->sampling_rate = (apr_uint16_t)map->rm_rate; - codec->channel_count = 1; - } - } - - switch(sdp_media->m_mode) { - case sdp_inactive: - rtp_media->direction = STREAM_DIRECTION_NONE; - break; - case sdp_sendonly: - rtp_media->direction = STREAM_DIRECTION_SEND; - break; - case sdp_recvonly: - rtp_media->direction = STREAM_DIRECTION_RECEIVE; - break; - case sdp_sendrecv: - rtp_media->direction = STREAM_DIRECTION_DUPLEX; - break; - } - - if(sdp_media->m_connections) { - apt_string_assign(&rtp_media->ip,sdp_media->m_connections->c_address,pool); - } - else { - rtp_media->ip = *ip; - } - if(sdp_media->m_port) { - rtp_media->port = (apr_port_t)sdp_media->m_port; - rtp_media->state = MPF_MEDIA_ENABLED; - } - else { - rtp_media->state = MPF_MEDIA_DISABLED; - } - return TRUE; -} - -/** Generate MRCP control media by SDP media */ -static apt_bool_t mrcp_control_media_generate(mrcp_control_descriptor_t *control_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool) -{ - mrcp_attrib_e id; - apt_str_t name; - apt_str_t value; - sdp_attribute_t *attrib = NULL; - apt_string_set(&name,sdp_media->m_proto_name); - control_media->proto = mrcp_proto_find(&name); - if(control_media->proto != MRCP_PROTO_TCP) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not supported SDP Proto [%s], expected [%s]",sdp_media->m_proto_name,mrcp_proto_get(MRCP_PROTO_TCP)->buf); - return FALSE; - } - - for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) { - apt_string_set(&name,attrib->a_name); - id = mrcp_attrib_id_find(&name); - switch(id) { - case MRCP_ATTRIB_SETUP: - apt_string_set(&value,attrib->a_value); - control_media->setup_type = mrcp_setup_type_find(&value); - break; - case MRCP_ATTRIB_CONNECTION: - apt_string_set(&value,attrib->a_value); - control_media->connection_type = mrcp_connection_type_find(&value); - break; - case MRCP_ATTRIB_RESOURCE: - apt_string_assign(&control_media->resource_name,attrib->a_value,pool); - break; - case MRCP_ATTRIB_CHANNEL: - apt_string_set(&value,attrib->a_value); - apt_id_resource_parse(&value,'@',&control_media->session_id,&control_media->resource_name,pool); - break; - case MRCP_ATTRIB_CMID: - mrcp_cmid_add(control_media->cmid_arr,atoi(attrib->a_value)); - break; - default: - break; - } - } - - if(sdp_media->m_connections) { - apt_string_assign(&control_media->ip,sdp_media->m_connections->c_address,pool); - } - else { - control_media->ip = *ip; - } - control_media->port = (apr_port_t)sdp_media->m_port; - return TRUE; -} - -/** Generate SDP resource discovery string */ -MRCP_DECLARE(apr_size_t) sdp_resource_discovery_string_generate(const char *ip, const char *origin, char *buffer, apr_size_t size) -{ - apr_size_t offset = 0; - if(!ip) { - ip = "0.0.0.0"; - } - if(!origin) { - origin = "-"; - } - buffer[0] = '\0'; - offset += snprintf(buffer+offset,size-offset, - "v=0\r\n" - "o=%s 0 0 IN IP4 %s\r\n" - "s=-\r\n" - "c=IN IP4 %s\r\n" - "t=0 0\r\n" - "m=application 0 TCP/MRCPv2 1\r\n" - "a=resource:speechsynth\r\n" - "a=resource:speechrecog\r\n" - "m=audio 0 RTP/AVP 0 8 96 101\r\n" - "a=rtpmap:0 PCMU/8000\r\n" - "a=rtpmap:8 PCMA/8000\r\n" - "a=rtpmap:96 L16/8000\r\n" - "a=rtpmap:101 telephone-event/8000\r\n", - origin, - ip, - ip); - return offset; -} diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c deleted file mode 100644 index fded058da1..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_client_agent.c +++ /dev/null @@ -1,637 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sofiasip_client_agent.c 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ - */ - -typedef struct mrcp_sofia_agent_t mrcp_sofia_agent_t; -#define NUA_MAGIC_T mrcp_sofia_agent_t - -typedef struct mrcp_sofia_session_t mrcp_sofia_session_t; -#define NUA_HMAGIC_T mrcp_sofia_session_t - -#include -#include -#include -#include -#include -#include -#include -#undef strcasecmp -#undef strncasecmp -#include - -#include "mrcp_sofiasip_client_agent.h" -#include "mrcp_session.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_sdp.h" -#include "apt_log.h" - -struct mrcp_sofia_agent_t { - mrcp_sig_agent_t *sig_agent; - - mrcp_sofia_client_config_t *config; - char *sip_contact_str; - char *sip_from_str; - char *sip_bind_str; - - su_root_t *root; - nua_t *nua; -}; - -struct mrcp_sofia_session_t { - mrcp_session_t *session; - const mrcp_sig_settings_t *sip_settings; - - su_home_t *home; - nua_handle_t *nh; - enum nua_callstate nua_state; - - apt_bool_t terminate_requested; - mrcp_session_descriptor_t *descriptor; - apr_thread_mutex_t *mutex; -}; - -/* Task Interface */ -static void mrcp_sofia_task_initialize(apt_task_t *task); -static apt_bool_t mrcp_sofia_task_run(apt_task_t *task); -static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task); - -/* MRCP Signaling Interface */ -static apt_bool_t mrcp_sofia_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_sofia_session_terminate_request(mrcp_session_t *session); -static apt_bool_t mrcp_sofia_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); - -static const mrcp_session_request_vtable_t session_request_vtable = { - mrcp_sofia_session_offer, - mrcp_sofia_session_terminate_request, - NULL, - mrcp_sofia_session_discover_request -}; - -static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_client_config_t *config, apr_pool_t *pool); -static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings); - -static void mrcp_sofia_event_callback( nua_event_t nua_event, - int status, - char const *phrase, - nua_t *nua, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]); - -apt_bool_t mrcp_sofiasip_log_init(const char *name, const char *level_str, apt_bool_t redirect); - -/** Create Sofia-SIP Signaling Agent */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_client_agent_create(const char *id, mrcp_sofia_client_config_t *config, apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - mrcp_sofia_agent_t *sofia_agent; - sofia_agent = apr_palloc(pool,sizeof(mrcp_sofia_agent_t)); - sofia_agent->sig_agent = mrcp_signaling_agent_create(id,sofia_agent,pool); - sofia_agent->sig_agent->create_client_session = mrcp_sofia_session_create; - sofia_agent->root = NULL; - sofia_agent->nua = NULL; - - if(mrcp_sofia_config_validate(sofia_agent,config,pool) == FALSE) { - return NULL; - } - - task = apt_task_create(sofia_agent,NULL,pool); - if(!task) { - return NULL; - } - apt_task_name_set(task,id); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->on_pre_run = mrcp_sofia_task_initialize; - vtable->run = mrcp_sofia_task_run; - vtable->terminate = mrcp_sofia_task_terminate; - } - sofia_agent->sig_agent->task = task; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SofiaSIP Agent [%s] ["SOFIA_SIP_VERSION"] %s", - id,sofia_agent->sip_bind_str); - return sofia_agent->sig_agent; -} - -/** Allocate Sofia-SIP config */ -MRCP_DECLARE(mrcp_sofia_client_config_t*) mrcp_sofiasip_client_config_alloc(apr_pool_t *pool) -{ - mrcp_sofia_client_config_t *config = apr_palloc(pool,sizeof(mrcp_sofia_client_config_t)); - config->local_ip = NULL; - config->ext_ip = NULL; - config->local_port = 0; - config->local_user_name = NULL; - - config->user_agent_name = NULL; - config->origin = NULL; - config->transport = NULL; - - config->sip_t1 = 0; - config->sip_t2 = 0; - config->sip_t4 = 0; - config->sip_t1x64 = 0; - - config->tport_log = FALSE; - config->tport_dump_file = NULL; - - return config; -} - -MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_client_logger_init(const char *name, const char *level_str, apt_bool_t redirect) -{ - return mrcp_sofiasip_log_init(name,level_str,redirect); -} - -static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_client_config_t *config, apr_pool_t *pool) -{ - if(!config->local_ip) { - return FALSE; - } - - sofia_agent->config = config; - if(config->ext_ip) { - /* Use external IP address in Contact and From headers, if behind NAT */ - sofia_agent->sip_contact_str = apr_psprintf(pool,"sip:%s:%hu", config->ext_ip, config->local_port); - sofia_agent->sip_from_str = apr_psprintf(pool,"sip:%s:%hu", config->ext_ip, config->local_port); - } - else { - sofia_agent->sip_contact_str = NULL; /* Let Sofia-SIP implicitly set Contact header by default */ - sofia_agent->sip_from_str = apr_psprintf(pool,"sip:%s:%hu", config->local_ip, config->local_port); - } - - if(config->transport) { - sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%hu;transport=%s", - config->local_ip, - config->local_port, - config->transport); - } - else { - sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%hu", - config->local_ip, - config->local_port); - } - return TRUE; -} - -static void mrcp_sofia_task_initialize(apt_task_t *task) -{ - mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task); - mrcp_sofia_client_config_t *sofia_config = sofia_agent->config; - - /* Initialize Sofia-SIP library and create event loop */ - su_init(); - sofia_agent->root = su_root_create(NULL); - - /* Create a user agent instance. The stack will call the 'event_callback()' - * callback when events such as succesful registration to network, - * an incoming call, etc, occur. - */ - sofia_agent->nua = nua_create( - sofia_agent->root, /* Event loop */ - mrcp_sofia_event_callback, /* Callback for processing events */ - sofia_agent, /* Additional data to pass to callback */ - NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */ - NUTAG_AUTOANSWER(0), - NUTAG_APPL_METHOD("OPTIONS"), - TAG_IF(sofia_config->sip_t1,NTATAG_SIP_T1(sofia_config->sip_t1)), - TAG_IF(sofia_config->sip_t2,NTATAG_SIP_T2(sofia_config->sip_t2)), - TAG_IF(sofia_config->sip_t4,NTATAG_SIP_T4(sofia_config->sip_t4)), - TAG_IF(sofia_config->sip_t1x64,NTATAG_SIP_T1X64(sofia_config->sip_t1x64)), - SIPTAG_USER_AGENT_STR(sofia_config->user_agent_name), - TAG_IF(sofia_config->tport_log == TRUE,TPTAG_LOG(1)), /* Print out SIP messages to the console */ - TAG_IF(sofia_config->tport_dump_file,TPTAG_DUMP(sofia_config->tport_dump_file)), /* Dump SIP messages to the file */ - TAG_END()); /* Last tag should always finish the sequence */ - if(!sofia_agent->nua) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create NUA [%s] %s", - apt_task_name_get(task), - sofia_agent->sip_bind_str); - } -} - -static apt_bool_t mrcp_sofia_task_run(apt_task_t *task) -{ - mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task); - - if(sofia_agent->nua) { - /* Run event loop */ - su_root_run(sofia_agent->root); - - /* Destroy allocated resources */ - nua_destroy(sofia_agent->nua); - sofia_agent->nua = NULL; - } - su_root_destroy(sofia_agent->root); - sofia_agent->root = NULL; - su_deinit(); - - apt_task_terminate_request_process(task); - return TRUE; -} - -static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task) -{ - mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task); - if(sofia_agent->nua) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Send Shutdown Signal to NUA [%s]", - apt_task_name_get(task)); - nua_shutdown(sofia_agent->nua); - } - return TRUE; -} - -static APR_INLINE mrcp_sofia_agent_t* mrcp_sofia_agent_get(mrcp_session_t *session) -{ - return session->signaling_agent->obj; -} - -static apt_bool_t mrcp_sofia_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings) -{ - const char *sip_to_str; - mrcp_sofia_agent_t *sofia_agent = mrcp_sofia_agent_get(session); - mrcp_sofia_session_t *sofia_session; - session->request_vtable = &session_request_vtable; - - if(!sofia_agent->nua) { - return FALSE; - } - - sofia_session = apr_palloc(session->pool,sizeof(mrcp_sofia_session_t)); - sofia_session->mutex = NULL; - sofia_session->home = su_home_new(sizeof(*sofia_session->home)); - sofia_session->session = session; - sofia_session->sip_settings = settings; - sofia_session->terminate_requested = FALSE; - sofia_session->descriptor = NULL; - session->obj = sofia_session; - - if(settings->user_name && *settings->user_name != '\0') { - sip_to_str = apr_psprintf(session->pool,"sip:%s@%s:%hu", - settings->user_name, - settings->server_ip, - settings->server_port); - } - else { - sip_to_str = apr_psprintf(session->pool,"sip:%s:%hu", - settings->server_ip, - settings->server_port); - } - - sofia_session->nh = nua_handle( - sofia_agent->nua, - sofia_session, - SIPTAG_TO_STR(sip_to_str), - SIPTAG_FROM_STR(sofia_agent->sip_from_str), - TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)), - TAG_IF(settings->feature_tags,SIPTAG_ACCEPT_CONTACT_STR(settings->feature_tags)), - TAG_END()); - sofia_session->nua_state = nua_callstate_init; - - apr_thread_mutex_create(&sofia_session->mutex,APR_THREAD_MUTEX_DEFAULT,session->pool); - return TRUE; -} - -static apt_bool_t mrcp_sofia_session_cleanup(mrcp_sofia_session_t *sofia_session) -{ - if(sofia_session->mutex) { - apr_thread_mutex_destroy(sofia_session->mutex); - sofia_session->mutex = NULL; - } - if(sofia_session->home) { - su_home_unref(sofia_session->home); - sofia_session->home = NULL; - } - return TRUE; -} - -static apt_bool_t mrcp_sofia_session_unref(mrcp_sofia_session_t *sofia_session) -{ - if(sofia_session->nh) { - nua_handle_bind(sofia_session->nh, NULL); - nua_handle_destroy(sofia_session->nh); - sofia_session->nh = NULL; - } - sofia_session->session = NULL; - return TRUE; -} - -static apt_bool_t mrcp_sofia_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - char sdp_str[2048]; - const char *local_sdp_str = NULL; - apt_bool_t res = FALSE; - mrcp_sofia_session_t *sofia_session = session->obj; - if(!sofia_session) { - return FALSE; - } - - if(session->signaling_agent) { - mrcp_sofia_agent_t *sofia_agent = mrcp_sofia_agent_get(session); - if(sofia_agent) { - if(sofia_agent->config->origin) { - apt_string_set(&descriptor->origin,sofia_agent->config->origin); - } - } - } - if(sdp_string_generate_by_mrcp_descriptor(sdp_str,sizeof(sdp_str),descriptor,TRUE) > 0) { - local_sdp_str = sdp_str; - sofia_session->descriptor = descriptor; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->log_obj,"Local SDP "APT_NAMESID_FMT"\n%s", - session->name, - MRCP_SESSION_SID(session), - local_sdp_str); - } - - apr_thread_mutex_lock(sofia_session->mutex); - - if(sofia_session->nh) { - res = TRUE; - nua_invite(sofia_session->nh, - TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)), - TAG_END()); - } - - apr_thread_mutex_unlock(sofia_session->mutex); - return res; -} - -static apt_bool_t mrcp_sofia_session_terminate_request(mrcp_session_t *session) -{ - mrcp_sofia_session_t *sofia_session = session->obj; - if(!sofia_session) { - return FALSE; - } - - sofia_session->terminate_requested = FALSE; - apr_thread_mutex_lock(sofia_session->mutex); - if(sofia_session->nh) { - sofia_session->terminate_requested = TRUE; - nua_bye(sofia_session->nh,TAG_END()); - } - apr_thread_mutex_unlock(sofia_session->mutex); - - if(sofia_session->terminate_requested == FALSE) { - mrcp_sofia_session_cleanup(sofia_session); - mrcp_session_terminate_response(session); - } - return TRUE; -} - -static apt_bool_t mrcp_sofia_session_discover_request(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - apt_bool_t res = FALSE; - mrcp_sofia_session_t *sofia_session = session->obj; - if(!sofia_session) { - return FALSE; - } - - apr_thread_mutex_lock(sofia_session->mutex); - if(sofia_session->nh) { - res = TRUE; - nua_options(sofia_session->nh,TAG_END()); - } - apr_thread_mutex_unlock(sofia_session->mutex); - return res; -} - -static void mrcp_sofia_on_session_ready( - int status, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - mrcp_session_t *session = sofia_session->session; - const char *remote_sdp_str = NULL; - mrcp_session_descriptor_t *descriptor = mrcp_session_descriptor_create(session->pool); - descriptor->response_code = status; - - tl_gets(tags, - SOATAG_REMOTE_SDP_STR_REF(remote_sdp_str), - TAG_END()); - - if(remote_sdp_str) { - sdp_parser_t *parser = NULL; - sdp_session_t *sdp = NULL; - const char *force_destination_ip = NULL; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->log_obj,"Remote SDP "APT_NAMESID_FMT"\n%s", - session->name, - MRCP_SESSION_SID(session), - remote_sdp_str); - - parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0); - sdp = sdp_session(parser); - if(sofia_session->sip_settings->force_destination == TRUE) { - force_destination_ip = sofia_session->sip_settings->server_ip; - } - - mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,force_destination_ip,session->pool); - sdp_parser_free(parser); - } - - mrcp_session_answer(session,descriptor); -} - -static void mrcp_sofia_on_session_redirect( - int status, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - mrcp_session_t *session = sofia_session->session; - sip_to_t *sip_to; - sip_contact_t *sip_contact; - if(!sip || !sip->sip_contact) { - return; - } - sip_contact = sip->sip_contact; - - apr_thread_mutex_lock(sofia_session->mutex); - - sip_to = sip_to_create(sofia_session->home, (const url_string_t *) sip_contact->m_url); - - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->log_obj,"Redirect "APT_NAMESID_FMT" to "URL_PRINT_FORMAT, - session->name, - MRCP_SESSION_SID(session), - URL_PRINT_ARGS(sip_to->a_url)); - - if(sofia_session->nh) { - nua_handle_bind(sofia_session->nh, NULL); - nua_handle_destroy(sofia_session->nh); - sofia_session->nh = NULL; - } - - sofia_session->nh = nua_handle( - sofia_agent->nua, - sofia_session, - SIPTAG_TO(sip_to), - SIPTAG_FROM_STR(sofia_agent->sip_from_str), - TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)), - TAG_END()); - - apr_thread_mutex_unlock(sofia_session->mutex); - - mrcp_sofia_session_offer(sofia_session->session,sofia_session->descriptor); -} - -static void mrcp_sofia_on_session_terminate( - int status, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - mrcp_session_t *session; - apt_bool_t terminate_requested; - - apr_thread_mutex_lock(sofia_session->mutex); - terminate_requested = sofia_session->terminate_requested; - session = sofia_session->session; - mrcp_sofia_session_unref(sofia_session); - apr_thread_mutex_unlock(sofia_session->mutex); - - if(terminate_requested == TRUE) { - sofia_session->nua_state = nua_callstate_terminated; - mrcp_sofia_session_cleanup(sofia_session); - mrcp_session_terminate_response(session); - return; - } - - if(sofia_session->nua_state == nua_callstate_ready) { - mrcp_session_terminate_event(session); - } - else { - mrcp_session_descriptor_t *descriptor = mrcp_session_descriptor_create(session->pool); - descriptor->response_code = status; - mrcp_session_answer(session,descriptor); - } - sofia_session->nua_state = nua_callstate_terminated; -} - -static void mrcp_sofia_on_state_change( - int status, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - int nua_state = nua_callstate_init; - tl_gets(tags, - NUTAG_CALLSTATE_REF(nua_state), - TAG_END()); - - if(!sofia_session || !sofia_session->session) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"SIP Call State [%s]", nua_callstate_name(nua_state)); - return; - } - apt_obj_log(APT_LOG_MARK,APT_PRIO_NOTICE,sofia_session->session->log_obj,"SIP Call State %s [%s]", - sofia_session->session->name, - nua_callstate_name(nua_state)); - - if(nua_state == nua_callstate_terminated) { - mrcp_sofia_on_session_terminate(status,sofia_agent,nh,sofia_session,sip,tags); - return; - } - - if(nua_state == nua_callstate_ready) { - mrcp_sofia_on_session_ready(status,sofia_agent,nh,sofia_session,sip,tags); - } - sofia_session->nua_state = nua_state; -} - -static void mrcp_sofia_on_resource_discover( - int status, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - mrcp_session_t *session = sofia_session->session; - if(session) { - const char *remote_sdp_str = NULL; - mrcp_session_descriptor_t *descriptor = mrcp_session_descriptor_create(session->pool); - descriptor->response_code = status; - - if(sip->sip_payload) { - remote_sdp_str = sip->sip_payload->pl_data; - } - - if(remote_sdp_str) { - sdp_parser_t *parser = NULL; - sdp_session_t *sdp = NULL; - apt_obj_log(APT_LOG_MARK,APT_PRIO_INFO,session->obj,"Resource Discovery SDP %s\n%s", - session->name, - remote_sdp_str); - - parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0); - sdp = sdp_session(parser); - mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,NULL,session->pool); - sdp_parser_free(parser); - } - - mrcp_session_discover_response(session,descriptor); - } -} - -/** This callback will be called by SIP stack to process incoming events */ -static void mrcp_sofia_event_callback( - nua_event_t nua_event, - int status, - char const *phrase, - nua_t *nua, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive SIP Event [%s] Status %d %s [%s]", - nua_event_name(nua_event), - status, - phrase, - sofia_agent->sig_agent->id); - - switch(nua_event) { - case nua_i_state: - mrcp_sofia_on_state_change(status,sofia_agent,nh,sofia_session,sip,tags); - break; - case nua_r_invite: - if(status >= 300 && status < 400) { - mrcp_sofia_on_session_redirect(status,sofia_agent,nh,sofia_session,sip,tags); - } - break; - case nua_r_options: - mrcp_sofia_on_resource_discover(status,sofia_agent,nh,sofia_session,sip,tags); - break; - case nua_r_shutdown: - /* if status < 200, shutdown still in progress */ - if(status >= 200) { - /* break main loop of sofia thread */ - su_root_break(sofia_agent->root); - } - break; - default: - break; - } -} diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_logger.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_logger.c deleted file mode 100644 index 49590e2fa8..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_logger.c +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sofiasip_logger.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "apt_log.h" - -SOFIAPUBVAR su_log_t tport_log[]; /* Transport event debug */ -SOFIAPUBVAR su_log_t nea_log[]; /* Event engine debug */ -SOFIAPUBVAR su_log_t nta_log[]; /* Transaction engine debug */ -SOFIAPUBVAR su_log_t nua_log[]; /* User Agent engine debug */ -SOFIAPUBVAR su_log_t soa_log[]; /* SDP Offer/Answer engine debug */ -SOFIAPUBVAR su_log_t su_log_default[]; /* Default debug */ - -static void mrcp_sofiasip_log(void *stream, char const *format, va_list arg_ptr) -{ - if(format) { - /* use generic vsnprintf() since apr_vformatter doesn't support - the format %p widely used by SofiaSIP. */ - char buf[4096]; - int len = vsnprintf(buf, sizeof(buf), format, arg_ptr); - if(len <= 0) - return; - if(buf[len-1] == '\n') { - /* remove trailing '\n' since apt logger appends it anyway */ - len--; - buf[len] = '\0'; - } - apt_log(APT_LOG_MARK, APT_PRIO_DEBUG, "%.*s", len, buf); - } -} - -static su_log_t* mrcp_sofiasip_logger_get(const char *name) -{ - if (!strcasecmp(name,"tport")) - return tport_log; - else if (!strcasecmp(name,"nea")) - return nea_log; - else if (!strcasecmp(name,"nta")) - return nta_log; - else if (!strcasecmp(name,"nua")) - return nua_log; - else if (!strcasecmp(name,"soa")) - return soa_log; - else if (!strcasecmp(name,"default")) - return su_log_default; - return NULL; -} - -apt_bool_t mrcp_sofiasip_log_init(const char *name, const char *level_str, apt_bool_t redirect) -{ - su_log_t *logger = mrcp_sofiasip_logger_get(name); - if(!logger) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown SofiaSIP Logger <%s>",name); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Init SofiaSIP Logger [%s] level:%s redirect:%d", - name, level_str, redirect); - su_log_init(logger); - - if(redirect == TRUE) { - su_log_redirect(logger, mrcp_sofiasip_log, NULL); - } - - if(level_str) { - int level = atoi(level_str); - if(level >=0 && level < 10) { - su_log_set_level(logger, level); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown SofiaSIP Log Level [%s]: must be in range [0..9]",level_str); - } - } - return TRUE; -} diff --git a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c b/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c deleted file mode 100644 index 26871190cd..0000000000 --- a/libs/unimrcp/modules/mrcp-sofiasip/src/mrcp_sofiasip_server_agent.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_sofiasip_server_agent.c 2250 2014-11-19 05:41:12Z achaloyan@gmail.com $ - */ - -typedef struct mrcp_sofia_agent_t mrcp_sofia_agent_t; -#define NUA_MAGIC_T mrcp_sofia_agent_t - -typedef struct mrcp_sofia_session_t mrcp_sofia_session_t; -#define NUA_HMAGIC_T mrcp_sofia_session_t - -#include -#include -#include -#include -#include -#include -#undef strcasecmp -#undef strncasecmp -#include - -#include "mrcp_sofiasip_server_agent.h" -#include "mrcp_session.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_sdp.h" -#include "apt_log.h" - -struct mrcp_sofia_agent_t { - mrcp_sig_agent_t *sig_agent; - - mrcp_sofia_server_config_t *config; - char *sip_contact_str; - char *sip_bind_str; - - su_root_t *root; - nua_t *nua; -}; - -struct mrcp_sofia_session_t { - mrcp_session_t *session; - su_home_t *home; - nua_handle_t *nh; -}; - -/* Task Interface */ -static void mrcp_sofia_task_initialize(apt_task_t *task); -static apt_bool_t mrcp_sofia_task_run(apt_task_t *task); -static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task); - -/* MRCP Signaling Interface */ -static apt_bool_t mrcp_sofia_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_sofia_on_session_terminate(mrcp_session_t *session); - -static const mrcp_session_response_vtable_t session_response_vtable = { - mrcp_sofia_on_session_answer, - mrcp_sofia_on_session_terminate, - NULL /* mrcp_sofia_on_session_control */, - NULL /* mrcp_sofia_on_session_discover */ -}; - -static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_server_config_t *config, apr_pool_t *pool); - -static void mrcp_sofia_event_callback( nua_event_t nua_event, - int status, - char const *phrase, - nua_t *nua, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]); - -apt_bool_t mrcp_sofiasip_log_init(const char *name, const char *level_str, apt_bool_t redirect); - -/** Create Sofia-SIP Signaling Agent */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_sofiasip_server_agent_create(const char *id, mrcp_sofia_server_config_t *config, apr_pool_t *pool) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - mrcp_sofia_agent_t *sofia_agent; - sofia_agent = apr_palloc(pool,sizeof(mrcp_sofia_agent_t)); - sofia_agent->sig_agent = mrcp_signaling_agent_create(id,sofia_agent,pool); - sofia_agent->config = config; - sofia_agent->root = NULL; - sofia_agent->nua = NULL; - - if(mrcp_sofia_config_validate(sofia_agent,config,pool) == FALSE) { - return NULL; - } - - task = apt_task_create(sofia_agent,NULL,pool); - if(!task) { - return NULL; - } - apt_task_name_set(task,id); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->on_pre_run = mrcp_sofia_task_initialize; - vtable->run = mrcp_sofia_task_run; - vtable->terminate = mrcp_sofia_task_terminate; - } - sofia_agent->sig_agent->task = task; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SofiaSIP Agent [%s] ["SOFIA_SIP_VERSION"] %s", - id,sofia_agent->sip_bind_str); - return sofia_agent->sig_agent; -} - -/** Allocate Sofia-SIP config */ -MRCP_DECLARE(mrcp_sofia_server_config_t*) mrcp_sofiasip_server_config_alloc(apr_pool_t *pool) -{ - mrcp_sofia_server_config_t *config = apr_palloc(pool,sizeof(mrcp_sofia_server_config_t)); - config->local_ip = NULL; - config->ext_ip = NULL; - config->local_port = 0; - config->user_name = NULL; - config->user_agent_name = NULL; - config->origin = NULL; - config->transport = NULL; - config->force_destination = FALSE; - config->sip_t1 = 0; - config->sip_t2 = 0; - config->sip_t4 = 0; - config->sip_t1x64 = 0; - - config->tport_log = FALSE; - config->tport_dump_file = NULL; - - return config; -} - -MRCP_DECLARE(apt_bool_t) mrcp_sofiasip_server_logger_init(const char *name, const char *level_str, apt_bool_t redirect) -{ - return mrcp_sofiasip_log_init(name,level_str,redirect); -} - -static apt_bool_t mrcp_sofia_config_validate(mrcp_sofia_agent_t *sofia_agent, mrcp_sofia_server_config_t *config, apr_pool_t *pool) -{ - sofia_agent->config = config; - sofia_agent->sip_contact_str = NULL; /* Let Sofia-SIP implicitly set Contact header by default */ - if(config->ext_ip) { - /* Use external IP address in Contact header, if behind NAT */ - sofia_agent->sip_contact_str = apr_psprintf(pool,"sip:%s:%hu",config->ext_ip,config->local_port); - } - if(config->transport) { - sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%hu;transport=%s", - config->local_ip, - config->local_port, - config->transport); - } - else { - sofia_agent->sip_bind_str = apr_psprintf(pool,"sip:%s:%hu", - config->local_ip, - config->local_port); - } - return TRUE; -} - -static void mrcp_sofia_task_initialize(apt_task_t *task) -{ - mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task); - mrcp_sofia_server_config_t *sofia_config = sofia_agent->config; - - /* Initialize Sofia-SIP library and create event loop */ - su_init(); - sofia_agent->root = su_root_create(NULL); - - /* Create a user agent instance. The stack will call the 'event_callback()' - * callback when events such as succesful registration to network, - * an incoming call, etc, occur. - */ - sofia_agent->nua = nua_create( - sofia_agent->root, /* Event loop */ - mrcp_sofia_event_callback, /* Callback for processing events */ - sofia_agent, /* Additional data to pass to callback */ - NUTAG_URL(sofia_agent->sip_bind_str), /* Address to bind to */ - NUTAG_AUTOANSWER(0), - NUTAG_APPL_METHOD("OPTIONS"), - TAG_IF(sofia_config->sip_t1,NTATAG_SIP_T1(sofia_config->sip_t1)), - TAG_IF(sofia_config->sip_t2,NTATAG_SIP_T2(sofia_config->sip_t2)), - TAG_IF(sofia_config->sip_t4,NTATAG_SIP_T4(sofia_config->sip_t4)), - TAG_IF(sofia_config->sip_t1x64,NTATAG_SIP_T1X64(sofia_config->sip_t1x64)), - SIPTAG_USER_AGENT_STR(sofia_config->user_agent_name), - TAG_IF(sofia_config->tport_log == TRUE,TPTAG_LOG(1)), /* Print out SIP messages to the console */ - TAG_IF(sofia_config->tport_dump_file,TPTAG_DUMP(sofia_config->tport_dump_file)), /* Dump SIP messages to the file */ - TAG_END()); /* Last tag should always finish the sequence */ - if(!sofia_agent->nua) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create NUA [%s] %s", - apt_task_name_get(task), - sofia_agent->sip_bind_str); - } -} - -static apt_bool_t mrcp_sofia_task_run(apt_task_t *task) -{ - mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task); - - if(sofia_agent->nua) { - /* Run event loop */ - su_root_run(sofia_agent->root); - - /* Destroy allocated resources */ - nua_destroy(sofia_agent->nua); - sofia_agent->nua = NULL; - } - su_root_destroy(sofia_agent->root); - sofia_agent->root = NULL; - su_deinit(); - - apt_task_terminate_request_process(task); - return TRUE; -} - -static apt_bool_t mrcp_sofia_task_terminate(apt_task_t *task) -{ - mrcp_sofia_agent_t *sofia_agent = apt_task_object_get(task); - if(sofia_agent->nua) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Send Shutdown Signal to NUA [%s]", - apt_task_name_get(task)); - nua_shutdown(sofia_agent->nua); - } - return TRUE; -} - -static mrcp_sofia_session_t* mrcp_sofia_session_create(mrcp_sofia_agent_t *sofia_agent, nua_handle_t *nh) -{ - mrcp_sofia_session_t *sofia_session; - mrcp_session_t* session = sofia_agent->sig_agent->create_server_session(sofia_agent->sig_agent); - if(!session) { - return NULL; - } - session->response_vtable = &session_response_vtable; - session->event_vtable = NULL; - - sofia_session = apr_palloc(session->pool,sizeof(mrcp_sofia_session_t)); - sofia_session->home = su_home_new(sizeof(*sofia_session->home)); - sofia_session->session = session; - session->obj = sofia_session; - - nua_handle_bind(nh, sofia_session); - sofia_session->nh = nh; - return sofia_session; -} - -static int sip_status_get(mrcp_session_status_e status) -{ - switch (status) { - case MRCP_SESSION_STATUS_OK: - return 200; - case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE: - return 404; - case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE: - return 406; - case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE: - return 480; - case MRCP_SESSION_STATUS_ERROR: - return 500; - } - return 200; -} - -static apt_bool_t mrcp_sofia_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor) -{ - mrcp_sofia_session_t *sofia_session = session->obj; - mrcp_sofia_agent_t *sofia_agent = session->signaling_agent->obj; - const char *local_sdp_str = NULL; - char sdp_str[2048]; - - if(!sofia_agent || !sofia_session || !sofia_session->nh) { - return FALSE; - } - - if(descriptor->status != MRCP_SESSION_STATUS_OK) { - int status = sip_status_get(descriptor->status); - nua_respond(sofia_session->nh, status, sip_status_phrase(status), - TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)), - TAG_END()); - return TRUE; - } - - if(sofia_agent->config->origin) { - apt_string_set(&descriptor->origin,sofia_agent->config->origin); - } - - if(sdp_string_generate_by_mrcp_descriptor(sdp_str,sizeof(sdp_str),descriptor,FALSE) > 0) { - local_sdp_str = sdp_str; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Local SDP "APT_NAMESID_FMT"\n%s", - session->name, - MRCP_SESSION_SID(session), - local_sdp_str); - } - - nua_respond(sofia_session->nh, SIP_200_OK, - TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)), - TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)), - SOATAG_AUDIO_AUX("telephone-event"), - NUTAG_AUTOANSWER(0), - TAG_END()); - - return TRUE; -} - -static apt_bool_t mrcp_sofia_on_session_terminate(mrcp_session_t *session) -{ - mrcp_sofia_session_t *sofia_session = session->obj; - if(sofia_session) { - if(sofia_session->nh) { - nua_handle_bind(sofia_session->nh, NULL); - nua_handle_destroy(sofia_session->nh); - } - if(sofia_session->home) { - su_home_unref(sofia_session->home); - sofia_session->home = NULL; - } - sofia_session->session = NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Session "APT_SID_FMT, MRCP_SESSION_SID(session)); - mrcp_session_destroy(session); - return TRUE; -} - -static void mrcp_sofia_on_call_receive(mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - apt_bool_t status = FALSE; - const char *remote_sdp_str = NULL; - mrcp_session_descriptor_t *descriptor; - - if(!sofia_session) { - sofia_session = mrcp_sofia_session_create(sofia_agent,nh); - if(!sofia_session) { - nua_respond(nh, SIP_488_NOT_ACCEPTABLE, TAG_END()); - return; - } - } - - descriptor = mrcp_session_descriptor_create(sofia_session->session->pool); - - tl_gets(tags, - SOATAG_REMOTE_SDP_STR_REF(remote_sdp_str), - TAG_END()); - - if(remote_sdp_str) { - sdp_parser_t *parser = NULL; - sdp_session_t *sdp = NULL; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Remote SDP "APT_NAMESID_FMT"\n%s", - sofia_session->session->name, - MRCP_SESSION_SID(sofia_session->session), - remote_sdp_str); - - parser = sdp_parse(sofia_session->home,remote_sdp_str,(int)strlen(remote_sdp_str),0); - sdp = sdp_session(parser); - status = mrcp_descriptor_generate_by_sdp_session(descriptor,sdp,NULL,sofia_session->session->pool); - sdp_parser_free(parser); - } - - if(status == FALSE) { - nua_respond(nh, SIP_400_BAD_REQUEST, TAG_END()); - return; - } - - mrcp_session_offer(sofia_session->session,descriptor); -} - -static void mrcp_sofia_on_call_terminate(mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - if(sofia_session) { - mrcp_session_terminate_request(sofia_session->session); - } -} - -static void mrcp_sofia_on_state_change(mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - int nua_state = nua_callstate_init; - tl_gets(tags, - NUTAG_CALLSTATE_REF(nua_state), - TAG_END()); - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"SIP Call State %s [%s]", - sofia_session ? sofia_session->session->name : "", - nua_callstate_name(nua_state)); - - switch(nua_state) { - case nua_callstate_received: - mrcp_sofia_on_call_receive(sofia_agent,nh,sofia_session,sip,tags); - break; - case nua_callstate_terminated: - mrcp_sofia_on_call_terminate(sofia_agent,nh,sofia_session,sip,tags); - break; - } -} - -static void mrcp_sofia_on_resource_discover(mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - char sdp_str[2048]; - const char *local_sdp_str = NULL; - - const char *ip = sofia_agent->config->ext_ip ? - sofia_agent->config->ext_ip : sofia_agent->config->local_ip; - - if(sdp_resource_discovery_string_generate(ip,sofia_agent->config->origin,sdp_str,sizeof(sdp_str)) > 0) { - local_sdp_str = sdp_str; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Resource Discovery SDP\n[%s]\n", - local_sdp_str); - } - - nua_respond(nh, SIP_200_OK, - NUTAG_WITH_CURRENT(sofia_agent->nua), - TAG_IF(sofia_agent->sip_contact_str,SIPTAG_CONTACT_STR(sofia_agent->sip_contact_str)), - TAG_IF(local_sdp_str,SOATAG_USER_SDP_STR(local_sdp_str)), - SOATAG_AUDIO_AUX("telephone-event"), - TAG_END()); -} - -/** This callback will be called by SIP stack to process incoming events */ -static void mrcp_sofia_event_callback( nua_event_t nua_event, - int status, - char const *phrase, - nua_t *nua, - mrcp_sofia_agent_t *sofia_agent, - nua_handle_t *nh, - mrcp_sofia_session_t *sofia_session, - sip_t const *sip, - tagi_t tags[]) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Receive SIP Event [%s] Status %d %s [%s]", - nua_event_name(nua_event), - status, - phrase, - sofia_agent->sig_agent->id); - - switch(nua_event) { - case nua_i_state: - mrcp_sofia_on_state_change(sofia_agent,nh,sofia_session,sip,tags); - break; - case nua_i_options: - mrcp_sofia_on_resource_discover(sofia_agent,nh,sofia_session,sip,tags); - break; - case nua_r_shutdown: - /* if status < 200, shutdown still in progress */ - if(status >= 200) { - /* break main loop of sofia thread */ - su_root_break(sofia_agent->root); - } - break; - default: - break; - } -} diff --git a/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am b/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am deleted file mode 100644 index 479d631da3..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/modules/mrcp-unirtsp/include \ - -I$(top_srcdir)/libs/mrcp-signaling/include \ - -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/uni-rtsp/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) $(UNIMRCP_SOFIA_INCLUDES) - -noinst_LTLIBRARIES = libmrcpunirtsp.la - -include_HEADERS = include/mrcp_unirtsp_sdp.h \ - include/mrcp_unirtsp_server_agent.h \ - include/mrcp_unirtsp_client_agent.h -libmrcpunirtsp_la_SOURCES = src/mrcp_unirtsp_sdp.c \ - src/mrcp_unirtsp_server_agent.c \ - src/mrcp_unirtsp_client_agent.c -libmrcpunirtsp_la_LIBADD = $(top_builddir)/libs/uni-rtsp/libunirtsp.la diff --git a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h b/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h deleted file mode 100644 index bfc1a3f04e..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_client_agent.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_unirtsp_client_agent.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_UNIRTSP_CLIENT_AGENT_H -#define MRCP_UNIRTSP_CLIENT_AGENT_H - -/** - * @file mrcp_unirtsp_client_agent.h - * @brief Implementation of MRCP Signaling Interface using UniRTSP - */ - -#include -#include "apt_string.h" -#include "mrcp_sig_agent.h" - -APT_BEGIN_EXTERN_C - -/** Declaration of UniRTSP agent config */ -typedef struct rtsp_client_config_t rtsp_client_config_t; - -/** Configuration of UniRTSP agent */ -struct rtsp_client_config_t { - /** SDP origin */ - char *origin; - /** Number of max RTSP connections */ - apr_size_t max_connection_count; - /** Request timeout */ - apr_size_t request_timeout; -}; - -/** - * Create UniRTSP signaling agent. - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_client_agent_create(const char *id, rtsp_client_config_t *config, apr_pool_t *pool); - -/** - * Allocate UniRTSP config. - */ -MRCP_DECLARE(rtsp_client_config_t*) mrcp_unirtsp_client_config_alloc(apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* MRCP_UNIRTSP_CLIENT_AGENT_H */ diff --git a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h b/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h deleted file mode 100644 index 556b4b46d7..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_sdp.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_unirtsp_sdp.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_UNIRTSP_SDP_H -#define MRCP_UNIRTSP_SDP_H - -/** - * @file mrcp_unirtsp_sdp.h - * @brief MRCP RTSP SDP Transformations - */ - -#include "mrcp_session_descriptor.h" - -APT_BEGIN_EXTERN_C - -/** Generate MRCP descriptor by RTSP request */ -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_request( - const rtsp_message_t *request, - const char *force_destination_ip, - const apr_table_t *resource_map, - apr_pool_t *pool, - su_home_t *home); - -/** Generate MRCP descriptor by RTSP response */ -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_response( - const rtsp_message_t *request, - const rtsp_message_t *response, - const char *force_destination_ip, - const apr_table_t *resource_map, - apr_pool_t *pool, - su_home_t *home); - -/** Generate RTSP request by MRCP descriptor */ -MRCP_DECLARE(rtsp_message_t*) rtsp_request_generate_by_mrcp_descriptor( - const mrcp_session_descriptor_t *descriptor, - const apr_table_t *resource_map, - apr_pool_t *pool); -/** Generate RTSP response by MRCP descriptor */ -MRCP_DECLARE(rtsp_message_t*) rtsp_response_generate_by_mrcp_descriptor( - const rtsp_message_t *request, - const mrcp_session_descriptor_t *descriptor, - const apr_table_t *resource_map, - apr_pool_t *pool); - -/** Generate RTSP resource discovery request */ -MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_request_generate( - const char *resource_name, - const apr_table_t *resource_map, - apr_pool_t *pool); - -/** Generate resource discovery descriptor by RTSP response */ -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_resource_discovery_response_generate( - const rtsp_message_t *request, - const rtsp_message_t *response, - const apr_table_t *resource_map, - apr_pool_t *pool, - su_home_t *home); - -/** Generate RTSP resource discovery response */ -MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_response_generate( - const rtsp_message_t *request, - const char *ip, - const char *origin, - apr_pool_t *pool); - - -/** Get MRCP resource name by RTSP resource name */ -MRCP_DECLARE(const char*) mrcp_name_get_by_rtsp_name(const apr_table_t *resource_map, const char *rtsp_name); -/** Get RTSP resource name by MRCP resource name */ -MRCP_DECLARE(const char*) rtsp_name_get_by_mrcp_name(const apr_table_t *resource_map, const char *mrcp_name); - -APT_END_EXTERN_C - -#endif /* MRCP_UNIRTSP_SDP_H */ diff --git a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h b/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h deleted file mode 100644 index c326bb650d..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/include/mrcp_unirtsp_server_agent.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_unirtsp_server_agent.h 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#ifndef MRCP_UNIRTSP_SERVER_AGENT_H -#define MRCP_UNIRTSP_SERVER_AGENT_H - -/** - * @file mrcp_unirtsp_server_agent.h - * @brief Implementation of MRCP Signaling Interface using UniRTSP - */ - -#include -#include "mrcp_sig_agent.h" - -APT_BEGIN_EXTERN_C - -/** UniRTSP config declaration */ -typedef struct rtsp_server_config_t rtsp_server_config_t; - -/** UniRTSP config */ -struct rtsp_server_config_t { - /** Local IP address to bind to */ - char *local_ip; - /** Local port to bind to */ - apr_port_t local_port; - - /** Resource location */ - char *resource_location; - /** SDP origin */ - char *origin; - - /** Map of the MRCP resource names */ - apr_table_t *resource_map; - - /** Number of max RTSP connections */ - apr_size_t max_connection_count; - - /** Force destination IP address. Should be used only in case - SDP contains incorrect connection address (local IP address behind NAT) */ - apt_bool_t force_destination; -}; - -/** - * Create UniRTSP signaling agent. - */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_server_agent_create(const char *id, rtsp_server_config_t *config, apr_pool_t *pool); - -/** - * Allocate UniRTSP config. - */ -MRCP_DECLARE(rtsp_server_config_t*) mrcp_unirtsp_server_config_alloc(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* MRCP_UNIRTSP_SERVER_AGENT_H */ diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters deleted file mode 100644 index a990550f29..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2010.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {f87f8ada-12d1-412b-bd14-7e62df3f92a0} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2017.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2017.vcxproj deleted file mode 100644 index cfd215e0a9..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.2017.vcxproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mrcpunirtsp - {DEB01ACB-D65F-4A62-AED9-58C1054499E9} - mrcpunirtsp - Win32Proj - - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - true - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - $(SolutionDir)$(PlatformName)\$(Configuration)\ - $(PlatformName)\$(Configuration)\ - - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - 4456;4100;%(DisableSpecificWarnings) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - ProgramDatabase - 4456;4100;%(DisableSpecificWarnings) - - - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - 4456;4100;%(DisableSpecificWarnings) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - APT_STATIC_LIB;RTSP_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - 4456;4100;%(DisableSpecificWarnings) - - - - - - - - - - - - - - - {70a49bc2-7500-41d0-b75d-edcc5be987a0} - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj deleted file mode 100644 index 37855a6356..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcproj +++ /dev/null @@ -1,280 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj deleted file mode 100644 index 200d68b92b..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj +++ /dev/null @@ -1,146 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DEB01ACB-D65F-4A62-AED9-58C1054499E9} - mrcpunirtsp - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {504b3154-7a4f-459d-9877-b951021c3f1f} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj.filters b/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj.filters deleted file mode 100644 index 3aff69f385..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/mrcpunirtsp.vcxproj.filters +++ /dev/null @@ -1,35 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {1ae8fa5f-5d29-4bd7-a332-b2e917a801ca} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c b/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c deleted file mode 100644 index 760a10c069..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_client_agent.c +++ /dev/null @@ -1,437 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_unirtsp_client_agent.c 2253 2014-11-21 02:57:19Z achaloyan@gmail.com $ - */ - -#include -#include - -#include "mrcp_unirtsp_client_agent.h" -#include "mrcp_session.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_message.h" -#include "mrcp_stream.h" -#include "mrcp_resource_factory.h" -#include "rtsp_client.h" -#include "mrcp_unirtsp_sdp.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - - -typedef struct mrcp_unirtsp_agent_t mrcp_unirtsp_agent_t; -typedef struct mrcp_unirtsp_session_t mrcp_unirtsp_session_t; - -struct mrcp_unirtsp_agent_t { - mrcp_sig_agent_t *sig_agent; - rtsp_client_t *rtsp_client; - - rtsp_client_config_t *config; -}; - -struct mrcp_unirtsp_session_t { - mrcp_message_t *mrcp_message; - mrcp_session_t *mrcp_session; - rtsp_client_session_t *rtsp_session; - const mrcp_sig_settings_t *rtsp_settings; - su_home_t *home; -}; - - -static apt_bool_t mrcp_unirtsp_session_offer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_unirtsp_session_terminate(mrcp_session_t *session); -static apt_bool_t mrcp_unirtsp_session_control(mrcp_session_t *session, mrcp_message_t *message); -static apt_bool_t mrcp_unirtsp_resource_discover(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); - -static const mrcp_session_request_vtable_t session_request_vtable = { - mrcp_unirtsp_session_offer, - mrcp_unirtsp_session_terminate, - mrcp_unirtsp_session_control, - mrcp_unirtsp_resource_discover -}; - -static apt_bool_t mrcp_unirtsp_on_session_terminate_response(rtsp_client_t *client, rtsp_client_session_t *session); -static apt_bool_t mrcp_unirtsp_on_session_terminate_event(rtsp_client_t *client, rtsp_client_session_t *session); -static apt_bool_t mrcp_unirtsp_on_session_response(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *request, rtsp_message_t *response); -static apt_bool_t mrcp_unirtsp_on_session_event(rtsp_client_t *client, rtsp_client_session_t *session, rtsp_message_t *message); - -static const rtsp_client_vtable_t session_response_vtable = { - mrcp_unirtsp_on_session_terminate_response, - mrcp_unirtsp_on_session_terminate_event, - mrcp_unirtsp_on_session_response, - mrcp_unirtsp_on_session_event -}; - -static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *session, const mrcp_sig_settings_t *settings); -static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_client_config_t *config, apr_pool_t *pool); -static apt_bool_t mrcp_unirtsp_on_resource_discover(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *request, rtsp_message_t *response); - - -/** Create UniRTSP Signaling Agent */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_client_agent_create(const char *id, rtsp_client_config_t *config, apr_pool_t *pool) -{ - apt_task_t *task; - mrcp_unirtsp_agent_t *agent; - agent = apr_palloc(pool,sizeof(mrcp_unirtsp_agent_t)); - agent->sig_agent = mrcp_signaling_agent_create(id,agent,pool); - agent->sig_agent->create_client_session = mrcp_unirtsp_session_create; - agent->config = config; - - if(rtsp_config_validate(agent,config,pool) == FALSE) { - return NULL; - } - - agent->rtsp_client = rtsp_client_create( - id, - config->max_connection_count, - config->request_timeout, - agent, - &session_response_vtable, - pool); - if(!agent->rtsp_client) { - return NULL; - } - - task = rtsp_client_task_get(agent->rtsp_client); - agent->sig_agent->task = task; - - return agent->sig_agent; -} - -/** Allocate UniRTSP config */ -MRCP_DECLARE(rtsp_client_config_t*) mrcp_unirtsp_client_config_alloc(apr_pool_t *pool) -{ - rtsp_client_config_t *config = apr_palloc(pool,sizeof(rtsp_client_config_t)); - config->origin = NULL; - config->max_connection_count = 100; - config->request_timeout = 0; - return config; -} - -static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_client_config_t *config, apr_pool_t *pool) -{ - agent->config = config; - return TRUE; -} - -static APR_INLINE mrcp_unirtsp_agent_t* client_agent_get(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_unirtsp_agent_t *agent = apt_consumer_task_object_get(consumer_task); - return agent; -} - -static apt_bool_t mrcp_unirtsp_session_create(mrcp_session_t *mrcp_session, const mrcp_sig_settings_t *settings) -{ - mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; - mrcp_unirtsp_session_t *session; - mrcp_session->request_vtable = &session_request_vtable; - - session = apr_palloc(mrcp_session->pool,sizeof(mrcp_unirtsp_session_t)); - session->home = su_home_new(sizeof(*session->home)); - session->rtsp_settings = settings; - session->mrcp_message = NULL; - session->mrcp_session = mrcp_session; - mrcp_session->obj = session; - - session->rtsp_session = rtsp_client_session_create( - agent->rtsp_client, - session->rtsp_settings->server_ip, - session->rtsp_settings->server_port, - session->rtsp_settings->resource_location); - if(!session->rtsp_session) { - su_home_unref(session->home); - return FALSE; - } - rtsp_client_session_object_set(session->rtsp_session,session); - return TRUE; -} - -static void mrcp_unirtsp_session_destroy(mrcp_unirtsp_session_t *session) -{ - if(session->home) { - su_home_unref(session->home); - session->home = NULL; - } - rtsp_client_session_object_set(session->rtsp_session,NULL); - rtsp_client_session_destroy(session->rtsp_session); -} - -static apt_bool_t mrcp_unirtsp_on_session_terminate_response(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session) -{ - mrcp_unirtsp_session_t *session = rtsp_client_session_object_get(rtsp_session); - - mrcp_unirtsp_session_destroy(session); - mrcp_session_terminate_response(session->mrcp_session); - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_on_session_terminate_event(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session) -{ - mrcp_unirtsp_session_t *session = rtsp_client_session_object_get(rtsp_session); - mrcp_session_terminate_event(session->mrcp_session); - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_on_announce_response(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *message, const char *resource_name) -{ - mrcp_message_t *mrcp_message = NULL; - - if(!session || !resource_name) { - return FALSE; - } - - if(rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE && - message->header.content_type == RTSP_CONTENT_TYPE_MRCP && - rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE && - message->header.content_length > 0) { - - apt_text_stream_t text_stream; - mrcp_parser_t *parser; - apt_str_t resource_name_str; - - text_stream.text = message->body; - apt_text_stream_reset(&text_stream); - apt_string_set(&resource_name_str,resource_name); - - parser = mrcp_parser_create(agent->sig_agent->resource_factory,session->mrcp_session->pool); - mrcp_parser_resource_set(parser,&resource_name_str); - if(mrcp_parser_run(parser,&text_stream,&mrcp_message) == APT_MESSAGE_STATUS_COMPLETE) { - mrcp_message->channel_id.session_id = message->header.session_id; - } - else { - /* error case */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv1 Message"); - } - } - else { - /* error case */ - } - - if(!mrcp_message) { - if(!session->mrcp_message) { - return FALSE; - } - mrcp_message = mrcp_response_create(session->mrcp_message,session->mrcp_session->pool); - mrcp_message->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - } - - session->mrcp_message = NULL; - mrcp_session_control_response(session->mrcp_session,mrcp_message); - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_on_session_response(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session, rtsp_message_t *request, rtsp_message_t *response) -{ - apt_bool_t status = FALSE; - mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client); - mrcp_unirtsp_session_t *session = rtsp_client_session_object_get(rtsp_session); - if(!agent || !session) { - return FALSE; - } - - switch(request->start_line.common.request_line.method_id) { - case RTSP_METHOD_SETUP: - { - const apt_str_t *session_id; - const char *force_destination_ip = NULL; - mrcp_session_descriptor_t *descriptor; - - if(session->rtsp_settings->force_destination == TRUE) { - force_destination_ip = session->rtsp_settings->server_ip; - } - - descriptor = mrcp_descriptor_generate_by_rtsp_response( - request, - response, - force_destination_ip, - session->rtsp_settings->resource_map, - session->mrcp_session->pool, - session->home); - if(!descriptor) { - return FALSE; - } - session_id = rtsp_client_session_id_get(session->rtsp_session); - if(session_id) { - apt_string_copy( - &session->mrcp_session->id, - session_id, - session->mrcp_session->pool); - } - status = mrcp_session_answer(session->mrcp_session,descriptor); - break; - } - case RTSP_METHOD_TEARDOWN: - { - mrcp_session_descriptor_t *descriptor; - descriptor = mrcp_descriptor_generate_by_rtsp_response( - request, - response, - NULL, - session->rtsp_settings->resource_map, - session->mrcp_session->pool, - session->home); - if(!descriptor) { - return FALSE; - } - status = mrcp_session_answer(session->mrcp_session,descriptor); - break; - } - case RTSP_METHOD_ANNOUNCE: - { - mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client); - const char *resource_name = mrcp_name_get_by_rtsp_name( - session->rtsp_settings->resource_map, - request->start_line.common.request_line.resource_name); - mrcp_unirtsp_on_announce_response(agent,session,response,resource_name); - break; - } - case RTSP_METHOD_DESCRIBE: - { - mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client); - mrcp_unirtsp_on_resource_discover(agent,session,request,response); - break; - } - default: - break; - } - - return status; -} - -static apt_bool_t mrcp_unirtsp_on_session_event(rtsp_client_t *rtsp_client, rtsp_client_session_t *rtsp_session, rtsp_message_t *message) -{ - mrcp_unirtsp_agent_t *agent = rtsp_client_object_get(rtsp_client); - mrcp_unirtsp_session_t *session = rtsp_client_session_object_get(rtsp_session); - const char *resource_name; - - if(!session) { - return FALSE; - } - - resource_name = mrcp_name_get_by_rtsp_name( - session->rtsp_settings->resource_map, - message->start_line.common.request_line.resource_name); - if(!resource_name) { - return FALSE; - } - - mrcp_unirtsp_on_announce_response(agent,session,message,resource_name); - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_session_offer(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor) -{ - mrcp_unirtsp_session_t *session = mrcp_session->obj; - mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; - rtsp_message_t *request; - - if(agent->config->origin) { - apt_string_set(&descriptor->origin,agent->config->origin); - } - - request = rtsp_request_generate_by_mrcp_descriptor(descriptor,session->rtsp_settings->resource_map,mrcp_session->pool); - return rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,request); -} - -static apt_bool_t mrcp_unirtsp_session_terminate(mrcp_session_t *mrcp_session) -{ - mrcp_unirtsp_session_t *session = mrcp_session->obj; - mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; - - return rtsp_client_session_terminate(agent->rtsp_client,session->rtsp_session); -} - -static apt_bool_t mrcp_unirtsp_session_control(mrcp_session_t *mrcp_session, mrcp_message_t *mrcp_message) -{ - mrcp_unirtsp_session_t *session = mrcp_session->obj; - mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; - - char buffer[2000]; - apt_text_stream_t stream; - rtsp_message_t *rtsp_message = NULL; - apt_str_t *body; - - apt_text_stream_init(&stream,buffer,sizeof(buffer)); - - mrcp_message->start_line.version = MRCP_VERSION_1; - if(mrcp_message_generate(agent->sig_agent->resource_factory,mrcp_message,&stream) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv1 Message"); - return FALSE; - } - stream.text.length = stream.pos - stream.text.buf; - - rtsp_message = rtsp_request_create(mrcp_session->pool); - rtsp_message->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name( - session->rtsp_settings->resource_map, - mrcp_message->channel_id.resource_name.buf); - rtsp_message->start_line.common.request_line.method_id = RTSP_METHOD_ANNOUNCE; - - body = &rtsp_message->body; - body->length = mrcp_message->start_line.length; - body->buf = apr_palloc(rtsp_message->pool,body->length+1); - memcpy(body->buf,stream.text.buf,stream.text.length); - if(mrcp_message->body.length) { - memcpy(body->buf+stream.text.length,mrcp_message->body.buf,mrcp_message->body.length); - } - body->buf[body->length] = '\0'; - - rtsp_message->header.content_type = RTSP_CONTENT_TYPE_MRCP; - rtsp_header_property_add(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_TYPE,rtsp_message->pool); - rtsp_message->header.content_length = body->length; - rtsp_header_property_add(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,rtsp_message->pool); - - session->mrcp_message = mrcp_message; - rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,rtsp_message); - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_resource_discover(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor) -{ - mrcp_unirtsp_session_t *session = mrcp_session->obj; - mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; - rtsp_message_t *request; - - if(!descriptor) { - return FALSE; - } - request = rtsp_resource_discovery_request_generate( - descriptor->resource_name.buf, - session->rtsp_settings->resource_map, - mrcp_session->pool); - if(request) { - rtsp_client_session_request(agent->rtsp_client,session->rtsp_session,request); - } - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_on_resource_discover(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *request, rtsp_message_t *response) -{ - mrcp_session_descriptor_t *descriptor; - if(!session) { - return FALSE; - } - - descriptor = mrcp_resource_discovery_response_generate( - request, - response, - session->rtsp_settings->resource_map, - session->mrcp_session->pool, - session->home); - if(descriptor) { - mrcp_session_discover_response(session->mrcp_session,descriptor); - } - return TRUE; -} diff --git a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c b/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c deleted file mode 100644 index fa546179b3..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_sdp.c +++ /dev/null @@ -1,598 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_unirtsp_sdp.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "rtsp_message.h" -#include "mrcp_unirtsp_sdp.h" -#include "mpf_rtp_attribs.h" -#include "mpf_rtp_pt.h" -#include "apt_text_stream.h" -#include "apt_log.h" - -/** Generate SDP media by RTP media descriptor */ -static apr_size_t sdp_rtp_media_generate(char *buffer, apr_size_t size, const mrcp_session_descriptor_t *descriptor, const mpf_rtp_media_descriptor_t *audio_media) -{ - apr_size_t offset = 0; - if(audio_media->state == MPF_MEDIA_ENABLED) { - int codec_count = 0; - int i; - mpf_codec_descriptor_t *codec_descriptor; - apr_array_header_t *descriptor_arr = audio_media->codec_list.descriptor_arr; - const apt_str_t *direction_str; - if(!descriptor_arr) { - return 0; - } - offset += snprintf(buffer+offset,size-offset,"m=audio %d RTP/AVP",audio_media->port); - for(i=0; inelts; i++) { - codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t); - if(codec_descriptor->enabled == TRUE) { - offset += snprintf(buffer+offset,size-offset," %d",codec_descriptor->payload_type); - codec_count++; - } - } - if(!codec_count){ - /* SDP m line should have at least one media format listed; use a reserved RTP payload type */ - offset += snprintf(buffer+offset,size-offset," %d",RTP_PT_RESERVED); - } - offset += snprintf(buffer+offset,size-offset,"\r\n"); - - for(i=0; inelts; i++) { - codec_descriptor = &APR_ARRAY_IDX(descriptor_arr,i,mpf_codec_descriptor_t); - if(codec_descriptor->enabled == TRUE && codec_descriptor->name.buf) { - offset += snprintf(buffer+offset,size-offset,"a=rtpmap:%d %s/%d\r\n", - codec_descriptor->payload_type, - codec_descriptor->name.buf, - codec_descriptor->sampling_rate); - if(codec_descriptor->format.buf) { - offset += snprintf(buffer+offset,size-offset,"a=fmtp:%d %s\r\n", - codec_descriptor->payload_type, - codec_descriptor->format.buf); - } - } - } - - direction_str = mpf_rtp_direction_str_get(audio_media->direction); - if(direction_str) { - offset += snprintf(buffer+offset,size-offset,"a=%s\r\n",direction_str->buf); - } - - if(audio_media->ptime) { - offset += snprintf(buffer+offset,size-offset,"a=ptime:%hu\r\n",audio_media->ptime); - } - } - else { - offset += snprintf(buffer+offset,size-offset,"m=audio 0 RTP/AVP %d\r\n",RTP_PT_RESERVED); - } - - return offset; -} - -/** Generate RTP media descriptor by SDP media */ -static apt_bool_t mpf_rtp_media_generate(mpf_rtp_media_descriptor_t *rtp_media, const sdp_media_t *sdp_media, const apt_str_t *ip, apr_pool_t *pool) -{ - mpf_rtp_attrib_e id; - apt_str_t name; - sdp_attribute_t *attrib = NULL; - sdp_rtpmap_t *map; - mpf_codec_descriptor_t *codec; - for(attrib = sdp_media->m_attributes; attrib; attrib=attrib->a_next) { - apt_string_set(&name,attrib->a_name); - id = mpf_rtp_attrib_id_find(&name); - switch(id) { - case RTP_ATTRIB_PTIME: - rtp_media->ptime = (apr_uint16_t)atoi(attrib->a_value); - break; - default: - break; - } - } - - mpf_codec_list_init(&rtp_media->codec_list,5,pool); - for(map = sdp_media->m_rtpmaps; map; map = map->rm_next) { - codec = mpf_codec_list_add(&rtp_media->codec_list); - if(codec) { - codec->payload_type = (apr_byte_t)map->rm_pt; - apt_string_assign(&codec->name,map->rm_encoding,pool); - codec->sampling_rate = (apr_uint16_t)map->rm_rate; - codec->channel_count = 1; - } - } - - switch(sdp_media->m_mode) { - case sdp_inactive: - rtp_media->direction = STREAM_DIRECTION_NONE; - break; - case sdp_sendonly: - rtp_media->direction = STREAM_DIRECTION_SEND; - break; - case sdp_recvonly: - rtp_media->direction = STREAM_DIRECTION_RECEIVE; - break; - case sdp_sendrecv: - rtp_media->direction = STREAM_DIRECTION_DUPLEX; - break; - } - - if(sdp_media->m_connections) { - apt_string_assign(&rtp_media->ip,sdp_media->m_connections->c_address,pool); - } - else { - rtp_media->ip = *ip; - } - if(sdp_media->m_port) { - rtp_media->port = (apr_port_t)sdp_media->m_port; - rtp_media->state = MPF_MEDIA_ENABLED; - } - else { - rtp_media->state = MPF_MEDIA_DISABLED; - } - return TRUE; -} - -/** Generate MRCP descriptor by SDP session */ -static apt_bool_t mrcp_descriptor_generate_by_rtsp_sdp_session(mrcp_session_descriptor_t *descriptor, const sdp_session_t *sdp, const char *force_destination_ip, apr_pool_t *pool) -{ - sdp_media_t *sdp_media; - - if(force_destination_ip) { - apt_string_assign(&descriptor->ip,force_destination_ip,pool); - } - else if(sdp->sdp_connection) { - apt_string_assign(&descriptor->ip,sdp->sdp_connection->c_address,pool); - } - - for(sdp_media=sdp->sdp_media; sdp_media; sdp_media=sdp_media->m_next) { - switch(sdp_media->m_type) { - case sdp_media_audio: - { - mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->id = mrcp_session_audio_media_add(descriptor,media); - mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool); - break; - } - case sdp_media_video: - { - mpf_rtp_media_descriptor_t *media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->id = mrcp_session_video_media_add(descriptor,media); - mpf_rtp_media_generate(media,sdp_media,&descriptor->ip,pool); - break; - } - default: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Not Supported SDP Media [%s]", sdp_media->m_type_name); - break; - } - } - return TRUE; -} - -/** Generate MRCP descriptor by RTSP request */ -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_request( - const rtsp_message_t *request, - const char *force_destination_ip, - const apr_table_t *resource_map, - apr_pool_t *pool, - su_home_t *home) -{ - mrcp_session_descriptor_t *descriptor = NULL; - const char *resource_name = mrcp_name_get_by_rtsp_name( - resource_map, - request->start_line.common.request_line.resource_name); - if(!resource_name) { - return NULL; - } - - if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) { - if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE && - rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE && - request->body.buf) { - - sdp_parser_t *parser; - sdp_session_t *sdp; - - parser = sdp_parse(home,request->body.buf,request->body.length,0); - sdp = sdp_session(parser); - if(sdp) { - descriptor = mrcp_session_descriptor_create(pool); - mrcp_descriptor_generate_by_rtsp_sdp_session(descriptor,sdp,force_destination_ip,pool); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse SDP Message"); - } - sdp_parser_free(parser); - } - else { - /* create default descriptor in case RTSP SETUP contains no SDP */ - mpf_rtp_media_descriptor_t *media; - descriptor = mrcp_session_descriptor_create(pool); - media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - media->state = MPF_MEDIA_ENABLED; - media->id = mrcp_session_audio_media_add(descriptor,media); - if(rtsp_header_property_check(&request->header,RTSP_HEADER_FIELD_TRANSPORT) == TRUE) { - media->port = request->header.transport.client_port_range.min; - media->ip = request->header.transport.destination; - } - } - - if(descriptor) { - apt_string_assign(&descriptor->resource_name,resource_name,pool); - descriptor->resource_state = TRUE; - } - } - else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) { - descriptor = mrcp_session_descriptor_create(pool); - apt_string_assign(&descriptor->resource_name,resource_name,pool); - descriptor->resource_state = FALSE; - } - return descriptor; -} - -/** Generate MRCP descriptor by RTSP response */ -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_descriptor_generate_by_rtsp_response( - const rtsp_message_t *request, - const rtsp_message_t *response, - const char *force_destination_ip, - const apr_table_t *resource_map, - apr_pool_t *pool, - su_home_t *home) -{ - mrcp_session_descriptor_t *descriptor = NULL; - const char *resource_name = mrcp_name_get_by_rtsp_name( - resource_map, - request->start_line.common.request_line.resource_name); - if(!resource_name) { - return NULL; - } - - if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) { - if(rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE && - rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE && - response->body.buf) { - - sdp_parser_t *parser; - sdp_session_t *sdp; - - parser = sdp_parse(home,response->body.buf,response->body.length,0); - sdp = sdp_session(parser); - if(sdp) { - descriptor = mrcp_session_descriptor_create(pool); - mrcp_descriptor_generate_by_rtsp_sdp_session(descriptor,sdp,force_destination_ip,pool); - - apt_string_assign(&descriptor->resource_name,resource_name,pool); - descriptor->resource_state = TRUE; - descriptor->response_code = response->start_line.common.status_line.status_code; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse SDP Message"); - } - - sdp_parser_free(parser); - } - else { - descriptor = mrcp_session_descriptor_create(pool); - apt_string_assign(&descriptor->resource_name,resource_name,pool); - descriptor->resource_state = FALSE; - } - } - else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) { - descriptor = mrcp_session_descriptor_create(pool); - apt_string_assign(&descriptor->resource_name,resource_name,pool); - descriptor->resource_state = FALSE; - } - return descriptor; -} - -/** Generate RTSP request by MRCP descriptor */ -MRCP_DECLARE(rtsp_message_t*) rtsp_request_generate_by_mrcp_descriptor(const mrcp_session_descriptor_t *descriptor, const apr_table_t *resource_map, apr_pool_t *pool) -{ - apr_size_t i; - apr_size_t count; - apr_size_t audio_index = 0; - mpf_rtp_media_descriptor_t *audio_media; - apr_size_t video_index = 0; - mpf_rtp_media_descriptor_t *video_media; - apr_size_t offset = 0; - char buffer[2048]; - apr_size_t size = sizeof(buffer); - rtsp_message_t *request; - const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0"); - - request = rtsp_request_create(pool); - request->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name( - resource_map, - descriptor->resource_name.buf); - if(descriptor->resource_state != TRUE) { - request->start_line.common.request_line.method_id = RTSP_METHOD_TEARDOWN; - return request; - } - - request->start_line.common.request_line.method_id = RTSP_METHOD_SETUP; - - buffer[0] = '\0'; - offset += snprintf(buffer+offset,size-offset, - "v=0\r\n" - "o=%s 0 0 IN IP4 %s\r\n" - "s=-\r\n" - "c=IN IP4 %s\r\n" - "t=0 0\r\n", - descriptor->origin.buf ? descriptor->origin.buf : "-", - ip, - ip); - count = mrcp_session_media_count_get(descriptor); - for(i=0; iid == i) { - /* generate audio media */ - audio_index++; - offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media); - request->header.transport.client_port_range.min = audio_media->port; - request->header.transport.client_port_range.max = audio_media->port+1; - continue; - } - video_media = mrcp_session_video_media_get(descriptor,video_index); - if(video_media && video_media->id == i) { - /* generate video media */ - video_index++; - offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,video_media); - continue; - } - } - - request->header.transport.protocol = RTSP_TRANSPORT_RTP; - request->header.transport.profile = RTSP_PROFILE_AVP; - request->header.transport.delivery = RTSP_DELIVERY_UNICAST; - rtsp_header_property_add(&request->header,RTSP_HEADER_FIELD_TRANSPORT,request->pool); - - if(offset) { - apt_string_assign_n(&request->body,buffer,offset,pool); - request->header.content_type = RTSP_CONTENT_TYPE_SDP; - rtsp_header_property_add(&request->header,RTSP_HEADER_FIELD_CONTENT_TYPE,request->pool); - request->header.content_length = offset; - rtsp_header_property_add(&request->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,request->pool); - } - return request; -} - -/** Generate RTSP response by MRCP descriptor */ -MRCP_DECLARE(rtsp_message_t*) rtsp_response_generate_by_mrcp_descriptor(const rtsp_message_t *request, const mrcp_session_descriptor_t *descriptor, const apr_table_t *resource_map, apr_pool_t *pool) -{ - rtsp_message_t *response = NULL; - - switch(descriptor->status) { - case MRCP_SESSION_STATUS_OK: - response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,pool); - break; - case MRCP_SESSION_STATUS_NO_SUCH_RESOURCE: - response = rtsp_response_create(request,RTSP_STATUS_CODE_NOT_FOUND,RTSP_REASON_PHRASE_NOT_FOUND,pool); - break; - case MRCP_SESSION_STATUS_UNACCEPTABLE_RESOURCE: - case MRCP_SESSION_STATUS_UNAVAILABLE_RESOURCE: - response = rtsp_response_create(request,RTSP_STATUS_CODE_NOT_ACCEPTABLE,RTSP_REASON_PHRASE_NOT_ACCEPTABLE,pool); - break; - case MRCP_SESSION_STATUS_ERROR: - response = rtsp_response_create(request,RTSP_STATUS_CODE_INTERNAL_SERVER_ERROR,RTSP_REASON_PHRASE_INTERNAL_SERVER_ERROR,pool); - break; - } - - if(!response) { - return NULL; - } - - if(descriptor->status == MRCP_SESSION_STATUS_OK) { - apr_size_t i; - apr_size_t count; - apr_size_t audio_index = 0; - mpf_rtp_media_descriptor_t *audio_media; - apr_size_t video_index = 0; - mpf_rtp_media_descriptor_t *video_media; - apr_size_t offset = 0; - char buffer[2048]; - apr_size_t size = sizeof(buffer); - const char *ip = descriptor->ext_ip.buf ? descriptor->ext_ip.buf : (descriptor->ip.buf ? descriptor->ip.buf : "0.0.0.0"); - - buffer[0] = '\0'; - offset += snprintf(buffer+offset,size-offset, - "v=0\r\n" - "o=%s 0 0 IN IP4 %s\r\n" - "s=-\r\n" - "c=IN IP4 %s\r\n" - "t=0 0\r\n", - descriptor->origin.buf ? descriptor->origin.buf : "-", - ip, - ip); - count = mrcp_session_media_count_get(descriptor); - for(i=0; iid == i) { - /* generate audio media */ - rtsp_transport_t *transport; - audio_index++; - offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,audio_media); - transport = &response->header.transport; - transport->server_port_range.min = audio_media->port; - transport->server_port_range.max = audio_media->port+1; - transport->client_port_range = request->header.transport.client_port_range; - continue; - } - video_media = mrcp_session_video_media_get(descriptor,video_index); - if(video_media && video_media->id == i) { - /* generate video media */ - video_index++; - offset += sdp_rtp_media_generate(buffer+offset,size-offset,descriptor,video_media); - continue; - } - } - - /* ok */ - response->header.transport.protocol = RTSP_TRANSPORT_RTP; - response->header.transport.profile = RTSP_PROFILE_AVP; - response->header.transport.delivery = RTSP_DELIVERY_UNICAST; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_TRANSPORT,response->pool); - - if(offset) { - apt_string_assign_n(&response->body,buffer,offset,pool); - response->header.content_type = RTSP_CONTENT_TYPE_SDP; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CONTENT_TYPE,response->pool); - response->header.content_length = offset; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,response->pool); - } - } - return response; -} - -/** Generate RTSP resource discovery request */ -MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_request_generate( - const char *resource_name, - const apr_table_t *resource_map, - apr_pool_t *pool) -{ - rtsp_message_t *request = rtsp_request_create(pool); - request->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name( - resource_map, - resource_name); - - request->start_line.common.request_line.method_id = RTSP_METHOD_DESCRIBE; - return request; -} - -/** Generate resource discovery descriptor by RTSP response */ -MRCP_DECLARE(mrcp_session_descriptor_t*) mrcp_resource_discovery_response_generate( - const rtsp_message_t *request, - const rtsp_message_t *response, - const apr_table_t *resource_map, - apr_pool_t *pool, - su_home_t *home) -{ - mrcp_session_descriptor_t *descriptor = NULL; - const char *resource_name = mrcp_name_get_by_rtsp_name( - resource_map, - request->start_line.common.request_line.resource_name); - if(!resource_name) { - return NULL; - } - - descriptor = mrcp_session_descriptor_create(pool); - apt_string_assign(&descriptor->resource_name,resource_name,pool); - - if(rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE && - rtsp_header_property_check(&response->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE && - response->body.buf) { - - sdp_parser_t *parser; - sdp_session_t *sdp; - - parser = sdp_parse(home,response->body.buf,response->body.length,0); - sdp = sdp_session(parser); - if(sdp) { - mrcp_descriptor_generate_by_rtsp_sdp_session(descriptor,sdp,0,pool); - descriptor->resource_state = TRUE; - descriptor->response_code = response->start_line.common.status_line.status_code; - } - else { - apt_string_assign(&descriptor->resource_name,resource_name,pool); - descriptor->resource_state = TRUE; - } - - sdp_parser_free(parser); - } - else { - descriptor->resource_state = FALSE; - } - return descriptor; -} - -/** Generate RTSP resource discovery response */ -MRCP_DECLARE(rtsp_message_t*) rtsp_resource_discovery_response_generate( - const rtsp_message_t *request, - const char *ip, - const char *origin, - apr_pool_t *pool) -{ - rtsp_message_t *response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,pool); - if(response) { - apr_size_t offset = 0; - char buffer[2048]; - apr_size_t size = sizeof(buffer); - - if(!ip) { - ip = "0.0.0.0"; - } - if(!origin) { - origin = "-"; - } - - buffer[0] = '\0'; - offset += snprintf(buffer+offset,size-offset, - "v=0\r\n" - "o=%s 0 0 IN IP4 %s\r\n" - "s=-\r\n" - "c=IN IP4 %s\r\n" - "t=0 0\r\n" - "m=audio 0 RTP/AVP 0 8 96 101\r\n" - "a=rtpmap:0 PCMU/8000\r\n" - "a=rtpmap:8 PCMA/8000\r\n" - "a=rtpmap:96 L16/8000\r\n" - "a=rtpmap:101 telephone-event/8000\r\n", - origin, - ip, - ip); - - if(offset) { - apt_string_assign_n(&response->body,buffer,offset,pool); - response->header.content_type = RTSP_CONTENT_TYPE_SDP; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CONTENT_TYPE,response->pool); - response->header.content_length = offset; - rtsp_header_property_add(&response->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,response->pool); - } - } - - return response; -} - -/** Get MRCP resource name by RTSP resource name */ -MRCP_DECLARE(const char*) mrcp_name_get_by_rtsp_name(const apr_table_t *resource_map, const char *rtsp_name) -{ - if(rtsp_name) { - const apr_array_header_t *header = apr_table_elts(resource_map); - apr_table_entry_t *entry = (apr_table_entry_t *)header->elts; - int i; - for(i=0; inelts; i++) { - if(!entry[i].val) continue; - - if(strcasecmp(entry[i].val,rtsp_name) == 0) { - return entry[i].key; - } - } - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown RTSP Resource Name [%s]", rtsp_name); - } - return "unknown"; -} - -/** Get RTSP resource name by MRCP resource name */ -MRCP_DECLARE(const char*) rtsp_name_get_by_mrcp_name(const apr_table_t *resource_map, const char *mrcp_name) -{ - const char *rtsp_name = apr_table_get(resource_map,mrcp_name); - if(rtsp_name) { - return rtsp_name; - } - return mrcp_name; -} diff --git a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c b/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c deleted file mode 100644 index a05614763f..0000000000 --- a/libs/unimrcp/modules/mrcp-unirtsp/src/mrcp_unirtsp_server_agent.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_unirtsp_server_agent.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include - -#include "mrcp_unirtsp_server_agent.h" -#include "mrcp_session.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_message.h" -#include "mrcp_resource_factory.h" -#include "mrcp_stream.h" -#include "rtsp_server.h" -#include "mrcp_unirtsp_sdp.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - -typedef struct mrcp_unirtsp_agent_t mrcp_unirtsp_agent_t; -typedef struct mrcp_unirtsp_session_t mrcp_unirtsp_session_t; - -struct mrcp_unirtsp_agent_t { - mrcp_sig_agent_t *sig_agent; - rtsp_server_t *rtsp_server; - - rtsp_server_config_t *config; -}; - -struct mrcp_unirtsp_session_t { - mrcp_session_t *mrcp_session; - rtsp_server_session_t *rtsp_session; - su_home_t *home; -}; - - -static apt_bool_t mrcp_unirtsp_on_session_answer(mrcp_session_t *session, mrcp_session_descriptor_t *descriptor); -static apt_bool_t mrcp_unirtsp_on_session_terminate(mrcp_session_t *session); -static apt_bool_t mrcp_unirtsp_on_session_control(mrcp_session_t *session, mrcp_message_t *message); - -static const mrcp_session_response_vtable_t session_response_vtable = { - mrcp_unirtsp_on_session_answer, - mrcp_unirtsp_on_session_terminate, - mrcp_unirtsp_on_session_control, - NULL /* mrcp_unirtsp_on_session_discover */ -}; - -static apt_bool_t mrcp_unirtsp_session_create(rtsp_server_t *server, rtsp_server_session_t *session); -static apt_bool_t mrcp_unirtsp_session_terminate(rtsp_server_t *server, rtsp_server_session_t *session); -static apt_bool_t mrcp_unirtsp_message_handle(rtsp_server_t *server, rtsp_server_session_t *session, rtsp_message_t *message); - -static const rtsp_server_vtable_t session_request_vtable = { - mrcp_unirtsp_session_create, - mrcp_unirtsp_session_terminate, - mrcp_unirtsp_message_handle -}; - - -static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_server_config_t *config, apr_pool_t *pool); - - -/** Create UniRTSP Signaling Agent */ -MRCP_DECLARE(mrcp_sig_agent_t*) mrcp_unirtsp_server_agent_create(const char *id, rtsp_server_config_t *config, apr_pool_t *pool) -{ - apt_task_t *task; - mrcp_unirtsp_agent_t *agent; - agent = apr_palloc(pool,sizeof(mrcp_unirtsp_agent_t)); - agent->sig_agent = mrcp_signaling_agent_create(id,agent,pool); - agent->config = config; - - if(rtsp_config_validate(agent,config,pool) == FALSE) { - return NULL; - } - - agent->rtsp_server = rtsp_server_create( - id, - config->local_ip, - config->local_port, - config->max_connection_count, - agent, - &session_request_vtable, - pool); - if(!agent->rtsp_server) { - return NULL; - } - - task = rtsp_server_task_get(agent->rtsp_server); - agent->sig_agent->task = task; - - return agent->sig_agent; -} - -/** Allocate UniRTSP config */ -MRCP_DECLARE(rtsp_server_config_t*) mrcp_unirtsp_server_config_alloc(apr_pool_t *pool) -{ - rtsp_server_config_t *config = apr_palloc(pool,sizeof(rtsp_server_config_t)); - config->local_ip = NULL; - config->local_port = 0; - config->origin = NULL; - config->resource_location = NULL; - config->resource_map = apr_table_make(pool,2); - config->max_connection_count = 100; - config->force_destination = FALSE; - return config; -} - - -static apt_bool_t rtsp_config_validate(mrcp_unirtsp_agent_t *agent, rtsp_server_config_t *config, apr_pool_t *pool) -{ - if(!config->local_ip) { - return FALSE; - } - agent->config = config; - return TRUE; -} - -static APR_INLINE mrcp_unirtsp_agent_t* server_agent_get(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mrcp_unirtsp_agent_t *agent = apt_consumer_task_object_get(consumer_task); - return agent; -} - -static apt_bool_t mrcp_unirtsp_session_create(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session) -{ - mrcp_unirtsp_agent_t *agent = rtsp_server_object_get(rtsp_server); - const apt_str_t *session_id; - mrcp_unirtsp_session_t *session; - mrcp_session_t* mrcp_session = agent->sig_agent->create_server_session(agent->sig_agent); - if(!mrcp_session) { - return FALSE; - } - session_id = rtsp_server_session_id_get(rtsp_session); - if(session_id) { - mrcp_session->id = *session_id; - } - mrcp_session->response_vtable = &session_response_vtable; - mrcp_session->event_vtable = NULL; - - session = apr_palloc(mrcp_session->pool,sizeof(mrcp_unirtsp_session_t)); - session->mrcp_session = mrcp_session; - mrcp_session->obj = session; - - session->home = su_home_new(sizeof(*session->home)); - - rtsp_server_session_object_set(rtsp_session,session); - session->rtsp_session = rtsp_session; - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_session_terminate(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session) -{ - mrcp_unirtsp_session_t *session = rtsp_server_session_object_get(rtsp_session); - if(!session) { - return FALSE; - } - return mrcp_session_terminate_request(session->mrcp_session); -} - -static void mrcp_unirtsp_session_destroy(mrcp_unirtsp_session_t *session) -{ - if(session->home) { - su_home_unref(session->home); - session->home = NULL; - } - rtsp_server_session_object_set(session->rtsp_session,NULL); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Session "APT_SID_FMT,MRCP_SESSION_SID(session->mrcp_session)); - mrcp_session_destroy(session->mrcp_session); -} - -static apt_bool_t mrcp_unirtsp_session_announce(mrcp_unirtsp_agent_t *agent, mrcp_unirtsp_session_t *session, rtsp_message_t *message) -{ - const char *resource_name = mrcp_name_get_by_rtsp_name( - agent->config->resource_map, - message->start_line.common.request_line.resource_name); - apt_bool_t status = TRUE; - - if(session && resource_name && - rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_CONTENT_TYPE) == TRUE && - message->header.content_type == RTSP_CONTENT_TYPE_MRCP && - rtsp_header_property_check(&message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH) == TRUE && - message->header.content_length > 0) { - - apt_text_stream_t text_stream; - mrcp_parser_t *parser; - apt_str_t resource_name_str; - mrcp_message_t *mrcp_message; - - text_stream.text = message->body; - apt_text_stream_reset(&text_stream); - apt_string_set(&resource_name_str,resource_name); - - parser = mrcp_parser_create(agent->sig_agent->resource_factory,session->mrcp_session->pool); - mrcp_parser_resource_set(parser,&resource_name_str); - if(mrcp_parser_run(parser,&text_stream,&mrcp_message) == APT_MESSAGE_STATUS_COMPLETE) { - mrcp_message->channel_id.session_id = message->header.session_id; - status = mrcp_session_control_request(session->mrcp_session,mrcp_message); - } - else { - /* error response */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse MRCPv1 Message"); - status = FALSE; - } - } - else { - /* error response */ - status = FALSE; - } - return status; -} - -static apt_bool_t mrcp_unirtsp_message_handle(rtsp_server_t *rtsp_server, rtsp_server_session_t *rtsp_session, rtsp_message_t *rtsp_message) -{ - apt_bool_t status = FALSE; - mrcp_unirtsp_agent_t *agent = rtsp_server_object_get(rtsp_server); - mrcp_unirtsp_session_t *session = rtsp_server_session_object_get(rtsp_session); - if(!session) { - return FALSE; - } - - switch(rtsp_message->start_line.common.request_line.method_id) { - case RTSP_METHOD_SETUP: - case RTSP_METHOD_TEARDOWN: - { - const char *force_destination_ip = NULL; - mrcp_session_descriptor_t *descriptor; - - if(agent->config->force_destination == TRUE) { - force_destination_ip = rtsp_server_session_destination_get(rtsp_session); - } - descriptor = mrcp_descriptor_generate_by_rtsp_request( - rtsp_message, - force_destination_ip, - agent->config->resource_map, - session->mrcp_session->pool, - session->home); - if(!descriptor) { - rtsp_message_t *response = rtsp_response_create(rtsp_message, - RTSP_STATUS_CODE_BAD_REQUEST, - RTSP_REASON_PHRASE_BAD_REQUEST, - rtsp_message->pool); - status = rtsp_server_session_respond(rtsp_server,session->rtsp_session,response); - break; - } - status = mrcp_session_offer(session->mrcp_session,descriptor); - break; - } - case RTSP_METHOD_ANNOUNCE: - { - status = mrcp_unirtsp_session_announce(agent,session,rtsp_message); - break; - } - case RTSP_METHOD_DESCRIBE: - { - rtsp_message_t *response = rtsp_resource_discovery_response_generate( - rtsp_message, - agent->config->local_ip, - agent->config->origin, - session->mrcp_session->pool); - status = rtsp_server_session_respond(rtsp_server,session->rtsp_session,response); - break; - } - default: - break; - } - - return status; -} - -static apt_bool_t mrcp_unirtsp_on_session_answer(mrcp_session_t *mrcp_session, mrcp_session_descriptor_t *descriptor) -{ - mrcp_unirtsp_session_t *session = mrcp_session->obj; - mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; - rtsp_message_t *response = NULL; - const rtsp_message_t *request = rtsp_server_session_request_get(session->rtsp_session); - if(!request) { - return FALSE; - } - - if(request->start_line.common.request_line.method_id == RTSP_METHOD_SETUP) { - if(agent->config->origin) { - apt_string_set(&descriptor->origin,agent->config->origin); - } - - response = rtsp_response_generate_by_mrcp_descriptor( - request, - descriptor, - agent->config->resource_map, - mrcp_session->pool); - } - else if(request->start_line.common.request_line.method_id == RTSP_METHOD_TEARDOWN) { - response = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,mrcp_session->pool); - } - - if(!response) { - return FALSE; - } - rtsp_server_session_respond(agent->rtsp_server,session->rtsp_session,response); - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_on_session_terminate(mrcp_session_t *mrcp_session) -{ - mrcp_unirtsp_session_t *session = mrcp_session->obj; - rtsp_server_session_t *rtsp_session = session->rtsp_session; - mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; - - mrcp_unirtsp_session_destroy(session); - rtsp_server_session_terminate(agent->rtsp_server,rtsp_session); - return TRUE; -} - -static apt_bool_t mrcp_unirtsp_on_session_control(mrcp_session_t *mrcp_session, mrcp_message_t *mrcp_message) -{ - mrcp_unirtsp_session_t *session = mrcp_session->obj; - mrcp_unirtsp_agent_t *agent = mrcp_session->signaling_agent->obj; - - char buffer[2000]; - apt_text_stream_t stream; - rtsp_message_t *rtsp_message = NULL; - apt_str_t *body; - - apt_text_stream_init(&stream,buffer,sizeof(buffer)); - - mrcp_message->start_line.version = MRCP_VERSION_1; - if(mrcp_message_generate(agent->sig_agent->resource_factory,mrcp_message,&stream) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv1 Message"); - return FALSE; - } - stream.text.length = stream.pos - stream.text.buf; - - if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - /* send RTSP response (OK) */ - const rtsp_message_t *request = rtsp_server_session_request_get(session->rtsp_session); - if(request) { - rtsp_message = rtsp_response_create(request,RTSP_STATUS_CODE_OK,RTSP_REASON_PHRASE_OK,mrcp_session->pool); - } - } - else if(mrcp_message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - /* send RTSP announce */ - rtsp_message = rtsp_request_create(mrcp_session->pool); - rtsp_message->start_line.common.request_line.resource_name = rtsp_name_get_by_mrcp_name( - agent->config->resource_map, - mrcp_message->channel_id.resource_name.buf); - rtsp_message->start_line.common.request_line.method_id = RTSP_METHOD_ANNOUNCE; - } - - if(!rtsp_message) { - return FALSE; - } - - body = &rtsp_message->body; - body->length = mrcp_message->start_line.length; - body->buf = apr_palloc(rtsp_message->pool,body->length+1); - memcpy(body->buf,stream.text.buf,stream.text.length); - if(mrcp_message->body.length) { - memcpy(body->buf+stream.text.length,mrcp_message->body.buf,mrcp_message->body.length); - } - body->buf[body->length] = '\0'; - - rtsp_message->header.content_type = RTSP_CONTENT_TYPE_MRCP; - rtsp_header_property_add(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_TYPE,rtsp_message->pool); - rtsp_message->header.content_length = body->length; - rtsp_header_property_add(&rtsp_message->header,RTSP_HEADER_FIELD_CONTENT_LENGTH,rtsp_message->pool); - - rtsp_server_session_respond(agent->rtsp_server,session->rtsp_session,rtsp_message); - return TRUE; -} diff --git a/libs/unimrcp/packages/inno-setup/setup-sdk-win32.txt b/libs/unimrcp/packages/inno-setup/setup-sdk-win32.txt deleted file mode 100644 index c9599058f9..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup-sdk-win32.txt +++ /dev/null @@ -1,3 +0,0 @@ -#include "setup.txt" -#define release_dir "Release" -OutputBaseFilename=unimrcp-sdk-{#= uni_version} diff --git a/libs/unimrcp/packages/inno-setup/setup-sdk-x64.txt b/libs/unimrcp/packages/inno-setup/setup-sdk-x64.txt deleted file mode 100644 index 0e5a2fe939..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup-sdk-x64.txt +++ /dev/null @@ -1,4 +0,0 @@ -#include "setup.txt" -#define release_dir "x64\Release" -OutputBaseFilename=unimrcp-x64-sdk-{#= uni_version} -ArchitecturesInstallIn64BitMode=x64 diff --git a/libs/unimrcp/packages/inno-setup/setup-win32.txt b/libs/unimrcp/packages/inno-setup/setup-win32.txt deleted file mode 100644 index dab742af23..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup-win32.txt +++ /dev/null @@ -1,3 +0,0 @@ -#include "setup.txt" -#define uni_outdir "..\..\Release" -OutputBaseFilename=unimrcp-{#= uni_version} diff --git a/libs/unimrcp/packages/inno-setup/setup-x64.txt b/libs/unimrcp/packages/inno-setup/setup-x64.txt deleted file mode 100644 index 74324882bc..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup-x64.txt +++ /dev/null @@ -1,5 +0,0 @@ -#include "setup.txt" -#define uni_outdir "..\..\x64\Release" -OutputBaseFilename=unimrcp-x64-{#= uni_version} -ArchitecturesInstallIn64BitMode=x64 -ArchitecturesAllowed=x64 diff --git a/libs/unimrcp/packages/inno-setup/setup.txt b/libs/unimrcp/packages/inno-setup/setup.txt deleted file mode 100644 index 4091232256..0000000000 --- a/libs/unimrcp/packages/inno-setup/setup.txt +++ /dev/null @@ -1,14 +0,0 @@ -#define uni_version "1.2.0" -#define uni_src "..\.." - -AppName=UniMRCP -AppVerName=UniMRCP {#= uni_version} -AppPublisher=UniMRCP -AppPublisherURL=http://www.unimrcp.org/ -AppSupportURL=http://groups.google.com/group/unimrcp -AppUpdatesURL=http://code.google.com/p/unimrcp/downloads/list -DefaultDirName={pf}\UniMRCP -DefaultGroupName=UniMRCP -Compression=lzma -InternalCompressLevel=max -SolidCompression=true diff --git a/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss b/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss deleted file mode 100644 index 8fb56cea1b..0000000000 --- a/libs/unimrcp/packages/inno-setup/unimrcp-sdk.iss +++ /dev/null @@ -1,56 +0,0 @@ -[Setup] -; include either setup-sdk-win32.txt or setup-sdk-x64.txt -#include "setup-sdk-win32.txt" -;#include "setup-sdk-x64.txt" - -[Types] -Name: full; Description: Full installation -Name: sdk; Description: SDK installation -Name: docs; Description: Documentation installation -Name: custom; Description: Custom installation; Flags: iscustom - -[Components] -Name: sdk; Description: UniMRCP SDK (client, server and plugin development); Types: full sdk -Name: docs; Description: UniMRCP documentation; Types: full docs -Name: docs\design; Description: Design concepts; Types: full docs -Name: docs\api; Description: API reference; Types: full docs - -[Files] -Source: {#= uni_src}\libs\apr\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\apr-toolkit\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mpf\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcp\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcp\message\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcp\control\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcp\resources\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcp-engine\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcp-signaling\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcpv2-transport\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcp-client\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\libs\mrcp-server\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\platforms\libunimrcp-client\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\platforms\libunimrcp-server\include\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\{#= release_dir}\lib\*.lib; DestDir: {app}\lib; Components: sdk -Source: {#= uni_src}\libs\apr\{#= release_dir}\*.lib; DestDir: {app}\lib; Components: sdk -Source: {#= uni_src}\libs\apr-util\{#= release_dir}\*.lib; DestDir: {app}\lib; Components: sdk -Source: {#= uni_src}\libs\sofia-sip\win32\libsofia-sip-ua\{#= release_dir}\*.lib; DestDir: {app}\lib; Components: sdk -Source: {#= uni_src}\build\*.h; DestDir: {app}\include; Components: sdk -Source: {#= uni_src}\build\props\sdk\*.props; DestDir: {app}\props; Components: sdk; AfterInstall: SetProjectPath(ExpandConstant('{app}\props\unimrcpsdk.props')) -Source: {#= uni_src}\build\vsprops\sdk\*.vsprops; DestDir: {app}\vsprops; Components: sdk; AfterInstall: SetProjectPath(ExpandConstant('{app}\vsprops\unimrcpsdk.vsprops')) -Source: {#= uni_src}\docs\ea\*; DestDir: {app}\doc\ea; Components: docs/design; Flags: recursesubdirs -Source: {#= uni_src}\docs\dox\*; DestDir: {app}\doc\dox; Components: docs/api; Flags: recursesubdirs - -[Icons] -Name: {group}\UniMRCP Docs\Design concepts; Filename: {app}\doc\ea\index.htm; Components: docs\design -Name: {group}\UniMRCP Docs\API; Filename: {app}\doc\dox\html\index.html; Components: docs\api -Name: {group}\Uninstall; Filename: {uninstallexe} - -[Code] -procedure SetProjectPath(PropertySheetFile: String); -var - Content: String; -begin - LoadStringFromFile (PropertySheetFile, Content); - StringChange (Content, 'C:\Program Files\UniMRCP', ExpandConstant('{app}')); - SaveStringToFile (PropertySheetFile, Content, False); -end; diff --git a/libs/unimrcp/packages/inno-setup/unimrcp.iss b/libs/unimrcp/packages/inno-setup/unimrcp.iss deleted file mode 100644 index b4e9852a45..0000000000 --- a/libs/unimrcp/packages/inno-setup/unimrcp.iss +++ /dev/null @@ -1,91 +0,0 @@ -[Setup] -; include either setup-win32.txt or setup-x64.txt -#include "setup-win32.txt" -;#include "setup-x64.txt" - -[Types] -Name: full; Description: Full installation -Name: server; Description: Server installation -Name: client; Description: Client installation -Name: custom; Description: Custom installation; Flags: iscustom - -[Components] -Name: server; Description: UniMRCP server; Types: full server -Name: server\recorder; Description: Recorder plugin; Types: full server -Name: server\demosynth; Description: Demo synthesizer plugin; Types: full server -Name: server\demorecog; Description: Demo recognizer plugin; Types: full server -Name: server\demoverifier; Description: Demo verifier plugin; Types: full server -Name: client; Description: UniMRCP client (sample applications); Types: full client - -[Dirs] -Name: {app}\data; Permissions: everyone-full -Name: {app}\log; Permissions: everyone-full - -[Files] -Source: {#= uni_outdir}\bin\unimrcpserver.exe; DestDir: {app}\bin; Components: server -Source: {#= uni_outdir}\bin\unimrcpservice.exe; DestDir: {app}\bin; Components: server -Source: {#= uni_outdir}\bin\unimrcpclient.exe; DestDir: {app}\bin; Components: client -Source: {#= uni_outdir}\bin\umc.exe; DestDir: {app}\bin; Components: client -Source: {#= uni_outdir}\bin\*.dll; DestDir: {app}\bin; Components: server client -Source: {#= uni_outdir}\plugin\mrcprecorder.dll; DestDir: {app}\plugin; Components: server/recorder -Source: {#= uni_outdir}\plugin\demosynth.dll; DestDir: {app}\plugin; Components: server/demosynth -Source: {#= uni_outdir}\plugin\demorecog.dll; DestDir: {app}\plugin; Components: server/demorecog -Source: {#= uni_outdir}\plugin\demoverifier.dll; DestDir: {app}\plugin; Components: server/demoverifier -Source: {#= uni_outdir}\conf\unimrcpserver.xml; DestDir: {app}\conf; Components: server -Source: {#= uni_outdir}\conf\unimrcpclient.xml; DestDir: {app}\conf; Components: client -Source: {#= uni_outdir}\conf\client-profiles\*.xml; DestDir: {app}\conf\client-profiles; Components: client -Source: {#= uni_outdir}\conf\umcscenarios.xml; DestDir: {app}\conf; Components: client -Source: {#= uni_outdir}\data\*.pcm; DestDir: {app}\data; Components: server client -Source: {#= uni_outdir}\data\*.xml; DestDir: {app}\data; Components: server client -Source: {#= uni_outdir}\data\*.txt; DestDir: {app}\data; Components: server client - -[Icons] -Name: {group}\UniMRCP Server Console; Filename: {app}\bin\unimrcpserver.exe; Parameters: "--root-dir ""{app}"""; Components: server -Name: {group}\UniMRCP Client Console; Filename: {app}\bin\unimrcpclient.exe; Parameters: "--root-dir ""{app}"""; Components: client -Name: {group}\UniMRCP Service\Start Server; Filename: {app}\bin\unimrcpservice.exe; Parameters: --start; Components: server -Name: {group}\UniMRCP Service\Stop Server; Filename: {app}\bin\unimrcpservice.exe; Parameters: --stop; Components: server -Name: {group}\Uninstall; Filename: {uninstallexe} - -[Run] -Filename: {app}\bin\unimrcpservice.exe; Description: Register service; Parameters: "--register ""{app}"""; Components: server - -[UninstallRun] -Filename: {app}\bin\unimrcpservice.exe; Parameters: --unregister; Components: server - -[Code] -var - Content: String; - -procedure ModifyPluginConf(PluginName: String; Enable: Boolean); -var - TextFrom: String; - TextTo: String; -begin - if Enable = True then - begin - TextFrom := 'class="' + PluginName + '" enable="0"'; - TextTo := 'class="' + PluginName + '" enable="1"'; - end - else - begin - TextFrom := 'class="' + PluginName + '" enable="1"'; - TextTo := 'class="' + PluginName + '" enable="0"'; - end - StringChange (Content, TextFrom, TextTo); -end; - -procedure CurStepChanged(CurStep: TSetupStep); -var - CfgFile: String; -begin - if CurStep = ssPostInstall then - begin - CfgFile := ExpandConstant('{app}\conf\unimrcpserver.xml'); - LoadStringFromFile (CfgFile, Content); - ModifyPluginConf ('mrcprecorder', IsComponentSelected('server\recorder')); - ModifyPluginConf ('demosynth', IsComponentSelected('server\demosynth')); - ModifyPluginConf ('demorecog', IsComponentSelected('server\demorecog')); - ModifyPluginConf ('demoverifier', IsComponentSelected('server\demoverifier')); - SaveStringToFile (CfgFile, Content, False); - end -end; diff --git a/libs/unimrcp/platforms/Makefile.am b/libs/unimrcp/platforms/Makefile.am deleted file mode 100644 index 13fc51f34e..0000000000 --- a/libs/unimrcp/platforms/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = - -if UNIMRCP_CLIENT_LIB -SUBDIRS += libunimrcp-client -endif - -if UNIMRCP_CLIENT_APP -SUBDIRS += unimrcp-client -endif - -if UMC -SUBDIRS += umc -endif - -if ASR_CLIENT -SUBDIRS += libasr-client asr-client -endif - -if UNIMRCP_SERVER_LIB -SUBDIRS += libunimrcp-server -endif - -if UNIMRCP_SERVER_APP -SUBDIRS += unimrcp-server -endif diff --git a/libs/unimrcp/platforms/asr-client/Makefile.am b/libs/unimrcp/platforms/asr-client/Makefile.am deleted file mode 100644 index 62371acd75..0000000000 --- a/libs/unimrcp/platforms/asr-client/Makefile.am +++ /dev/null @@ -1,10 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/platforms/libasr-client/include \ - $(UNIMRCP_CLIENTAPP_INCLUDES) - -bin_PROGRAMS = asrclient - -asrclient_SOURCES = src/main.c -asrclient_LDADD = $(top_builddir)/platforms/libasr-client/libasrclient.la -asrclient_LDFLAGS = $(UNIMRCP_CLIENTAPP_OPTS) - -include $(top_srcdir)/build/rules/uniclientapp.am diff --git a/libs/unimrcp/platforms/asr-client/asrclient.vcproj b/libs/unimrcp/platforms/asr-client/asrclient.vcproj deleted file mode 100644 index de7caff797..0000000000 --- a/libs/unimrcp/platforms/asr-client/asrclient.vcproj +++ /dev/null @@ -1,298 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj b/libs/unimrcp/platforms/asr-client/asrclient.vcxproj deleted file mode 100644 index af032d1dca..0000000000 --- a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj +++ /dev/null @@ -1,136 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684} - asrclient - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;..\libasr-client\include;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - - - libasrclient.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - include;..\libasr-client\include;%(AdditionalIncludeDirectories) - - - libasrclient.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - include;..\libasr-client\include;%(AdditionalIncludeDirectories) - MultiThreadedDebugDLL - ProgramDatabase - - - libasrclient.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - include;..\libasr-client\include;%(AdditionalIncludeDirectories) - - - libasrclient.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - {272fafa8-2b2f-4716-b95f-3b37cf2e0cb3} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj.filters b/libs/unimrcp/platforms/asr-client/asrclient.vcxproj.filters deleted file mode 100644 index 3efc5f63ae..0000000000 --- a/libs/unimrcp/platforms/asr-client/asrclient.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {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 - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/asr-client/src/main.c b/libs/unimrcp/platforms/asr-client/src/main.c deleted file mode 100644 index 10f97cd065..0000000000 --- a/libs/unimrcp/platforms/asr-client/src/main.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.c 2213 2014-11-06 03:02:45Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include -#include -#include "asr_engine.h" - -typedef struct { - const char *root_dir_path; - apt_log_priority_e log_priority; - apt_log_output_e log_output; - apr_pool_t *pool; -} client_options_t; - -typedef struct { - asr_engine_t *engine; - const char *grammar_file; - const char *input_file; - const char *profile; - - apr_thread_t *thread; - apr_pool_t *pool; -} asr_params_t; - -/** Thread function to run ASR scenario in */ -static void* APR_THREAD_FUNC asr_session_run(apr_thread_t *thread, void *data) -{ - asr_params_t *params = data; - asr_session_t *session = asr_session_create(params->engine,params->profile); - if(session) { - const char *result = asr_session_file_recognize(session,params->grammar_file,params->input_file); - if(result) { - printf("Recog Result [%s]",result); - } - - asr_session_destroy(session); - } - - /* destroy pool params allocated from */ - apr_pool_destroy(params->pool); - return NULL; -} - -/** Launch demo ASR session */ -static apt_bool_t asr_session_launch(asr_engine_t *engine, const char *grammar_file, const char *input_file, const char *profile) -{ - apr_pool_t *pool; - asr_params_t *params; - - /* create pool to allocate params from */ - apr_pool_create(&pool,NULL); - params = apr_palloc(pool,sizeof(asr_params_t)); - params->pool = pool; - params->engine = engine; - - if(grammar_file) { - params->grammar_file = apr_pstrdup(pool,grammar_file); - } - else { - params->grammar_file = "grammar.xml"; - } - - if(input_file) { - params->input_file = apr_pstrdup(pool,input_file); - } - else { - params->input_file = "one-8kHz.pcm"; - } - - if(profile) { - params->profile = apr_pstrdup(pool,profile); - } - else { - params->profile = "uni2"; - } - - /* Launch a thread to run demo ASR session in */ - if(apr_thread_create(¶ms->thread,NULL,asr_session_run,params,pool) != APR_SUCCESS) { - apr_pool_destroy(pool); - return FALSE; - } - - return TRUE; -} - -static apt_bool_t cmdline_process(asr_engine_t *engine, char *cmdline) -{ - apt_bool_t running = TRUE; - char *name; - char *last; - name = apr_strtok(cmdline, " ", &last); - - if(strcasecmp(name,"run") == 0) { - char *grammar = apr_strtok(NULL, " ", &last); - char *input = apr_strtok(NULL, " ", &last); - char *profile = apr_strtok(NULL, " ", &last); - asr_session_launch(engine,grammar,input,profile); - } - else if(strcasecmp(name,"loglevel") == 0) { - char *priority = apr_strtok(NULL, " ", &last); - if(priority) { - asr_engine_log_priority_set(atol(priority)); - } - } - else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) { - running = FALSE; - } - else if(strcasecmp(name,"help") == 0) { - printf("usage:\n" - "\n- run [grammar_file] [audio_input_file] [profile_name] (run demo asr client)\n" - " grammar_file is the name of grammar file, (path is relative to data dir)\n" - " audio_input_file is the name of audio file, (path is relative to data dir)\n" - " profile_name is one of 'uni2', 'uni1', ...\n" - "\n examples: \n" - " run\n" - " run grammar.xml one.pcm\n" - " run grammar.xml one.pcm uni1\n" - "\n- loglevel [level] (set loglevel, one of 0,1...7)\n" - "\n- quit, exit\n"); - } - else { - printf("unknown command: %s (input help for usage)\n",name); - } - return running; -} - -static apt_bool_t cmdline_run(asr_engine_t *engine) -{ - apt_bool_t running = TRUE; - char cmdline[1024]; - apr_size_t i; - do { - printf(">"); - memset(&cmdline, 0, sizeof(cmdline)); - for(i = 0; i < sizeof(cmdline); i++) { - cmdline[i] = (char) getchar(); - if(cmdline[i] == '\n') { - cmdline[i] = '\0'; - break; - } - } - if(*cmdline) { - running = cmdline_process(engine,cmdline); - } - } - while(running != 0); - return TRUE; -} - -static void usage(void) -{ - printf( - "\n" - "Usage:\n" - "\n" - " asrclient [options]\n" - "\n" - " Available options:\n" - "\n" - " -r [--root-dir] path : Set the project root directory path.\n" - "\n" - " -l [--log-prio] priority : Set the log priority.\n" - " (0-emergency, ..., 7-debug)\n" - "\n" - " -o [--log-output] mode : Set the log output mode.\n" - " (0-none, 1-console only, 2-file only, 3-both)\n" - "\n" - " -h [--help] : Show the help.\n" - "\n"); -} - -static void options_destroy(client_options_t *options) -{ - if(options->pool) { - apr_pool_destroy(options->pool); - } -} - -static client_options_t* options_load(int argc, const char * const *argv) -{ - apr_status_t rv; - apr_getopt_t *opt = NULL; - int optch; - const char *optarg; - apr_pool_t *pool; - client_options_t *options; - - const apr_getopt_option_t opt_option[] = { - /* long-option, short-option, has-arg flag, description */ - { "root-dir", 'r', TRUE, "path to root dir" }, /* -r arg or --root-dir arg */ - { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */ - { "log-output", 'o', TRUE, "log output mode" }, /* -o arg or --log-output arg */ - { "help", 'h', FALSE, "show help" }, /* -h or --help */ - { NULL, 0, 0, NULL }, /* end */ - }; - - /* create APR pool to allocate options from */ - apr_pool_create(&pool,NULL); - if(!pool) { - return NULL; - } - options = apr_palloc(pool,sizeof(client_options_t)); - options->pool = pool; - /* set the default options */ - options->root_dir_path = NULL; - options->log_priority = APT_PRIO_INFO; - options->log_output = APT_LOG_OUTPUT_CONSOLE; - - - rv = apr_getopt_init(&opt, pool , argc, argv); - if(rv != APR_SUCCESS) { - options_destroy(options); - return NULL; - } - - while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) { - switch(optch) { - case 'r': - options->root_dir_path = optarg; - break; - case 'l': - if(optarg) { - options->log_priority = atoi(optarg); - } - break; - case 'o': - if(optarg) { - options->log_output = atoi(optarg); - } - break; - case 'h': - usage(); - return FALSE; - } - } - - if(rv != APR_EOF) { - usage(); - options_destroy(options); - return NULL; - } - - return options; -} - -int main(int argc, const char * const *argv) -{ - client_options_t *options; - asr_engine_t *engine; - - /* APR global initialization */ - if(apr_initialize() != APR_SUCCESS) { - apr_terminate(); - return 0; - } - - /* load options */ - options = options_load(argc,argv); - if(!options) { - apr_terminate(); - return 0; - } - - /* create asr engine */ - engine = asr_engine_create( - options->root_dir_path, - options->log_priority, - options->log_output); - if(engine) { - /* run command line */ - cmdline_run(engine); - /* destroy demo framework */ - asr_engine_destroy(engine); - } - - /* destroy options */ - options_destroy(options); - - /* APR global termination */ - apr_terminate(); - return 0; -} diff --git a/libs/unimrcp/platforms/libasr-client/Makefile.am b/libs/unimrcp/platforms/libasr-client/Makefile.am deleted file mode 100644 index 68ecd07b6a..0000000000 --- a/libs/unimrcp/platforms/libasr-client/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/platforms/libasr-client/include \ - -I$(top_srcdir)/platforms/libunimrcp-client/include \ - $(UNIMRCP_CLIENTLIB_INCLUDES) - -lib_LTLIBRARIES = libasrclient.la - -include_HEADERS = include/asr_engine.h -libasrclient_la_SOURCES = src/asr_engine.c -libasrclient_la_LIBADD = $(top_builddir)/platforms/libunimrcp-client/libunimrcpclient.la -libasrclient_la_LDFLAGS = $(UNIMRCP_CLIENTLIB_OPTS) - -include $(top_srcdir)/build/rules/uniclientlib.am diff --git a/libs/unimrcp/platforms/libasr-client/include/asr_engine.h b/libs/unimrcp/platforms/libasr-client/include/asr_engine.h deleted file mode 100644 index fbb2261eab..0000000000 --- a/libs/unimrcp/platforms/libasr-client/include/asr_engine.h +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2009-2014 Arsen Chaloyan - * - * 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. - * - * $Id: asr_engine.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef ASR_ENGINE_H -#define ASR_ENGINE_H - -/** - * @file asr_engine.h - * @brief Basic ASR engine on top of UniMRCP client library - */ - -#include "apt_log.h" - -/** Lib export/import defines (win32) */ -#ifdef WIN32 -#ifdef ASR_CLIENT_STATIC_LIB -#define ASR_CLIENT_DECLARE(type) type __stdcall -#else -#ifdef ASR_CLIENT_LIB_EXPORT -#define ASR_CLIENT_DECLARE(type) __declspec(dllexport) type __stdcall -#else -#define ASR_CLIENT_DECLARE(type) __declspec(dllimport) type __stdcall -#endif -#endif -#else -#define ASR_CLIENT_DECLARE(type) type -#endif - -APT_BEGIN_EXTERN_C - -/** Opaque ASR engine */ -typedef struct asr_engine_t asr_engine_t; - -/** Opaque ASR session */ -typedef struct asr_session_t asr_session_t; - - -/** - * Create ASR engine. - * @param root_dir_path the path to root directory - * @param log_priority the log priority level - * @param log_output the log output mode - */ -ASR_CLIENT_DECLARE(asr_engine_t*) asr_engine_create( - const char *root_dir_path, - apt_log_priority_e log_priority, - apt_log_output_e log_output); - -/** - * Destroy ASR engine. - * @param engine the engine to destroy - */ -ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_destroy(asr_engine_t *engine); - - - -/** - * Create ASR session. - * @param engine the engine session belongs to - * @param profile the name of UniMRCP profile to use - */ -ASR_CLIENT_DECLARE(asr_session_t*) asr_session_create(asr_engine_t *engine, const char *profile); - -/** - * Initiate recognition based on specified grammar and input file. - * @param session the session to run recognition in the scope of - * @param grammar_file the name of the grammar file to use (path is relative to data dir) - * @param input_file the name of the audio input file to use (path is relative to data dir) - * @return the recognition result (input element of NLSML content) - */ -ASR_CLIENT_DECLARE(const char*) asr_session_file_recognize( - asr_session_t *session, - const char *grammar_file, - const char *input_file); - -/** - * Initiate recognition based on specified grammar and input stream. - * @param session the session to run recognition in the scope of - * @param grammar_file the name of the grammar file to use (path is relative to data dir) - * @param callback the callback to be called to get input media frames - * @param obj the object to pass to the callback - * @return the recognition result (input element of NLSML content) - * - * @remark Audio data should be streamed through - * asr_session_stream_write() function calls. - */ -ASR_CLIENT_DECLARE(const char*) asr_session_stream_recognize( - asr_session_t *session, - const char *grammar_file); - -/** - * Write audio data to recognize. - * @param session the session to write audio data for - * @param data the audio data - * @param size the size of data - */ -ASR_CLIENT_DECLARE(apt_bool_t) asr_session_stream_write( - asr_session_t *session, - char *data, - int size); - -/** - * Destroy ASR session. - * @param session the session to destroy - */ -ASR_CLIENT_DECLARE(apt_bool_t) asr_session_destroy(asr_session_t *session); - - -/** - * Set log priority. - * @param priority the priority to set - */ -ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_log_priority_set(apt_log_priority_e log_priority); - - -APT_END_EXTERN_C - -#endif /* ASR_ENGINE_H */ diff --git a/libs/unimrcp/platforms/libasr-client/libasrclient.vcproj b/libs/unimrcp/platforms/libasr-client/libasrclient.vcproj deleted file mode 100644 index e48c41e261..0000000000 --- a/libs/unimrcp/platforms/libasr-client/libasrclient.vcproj +++ /dev/null @@ -1,308 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj b/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj deleted file mode 100644 index 744bf1cf6e..0000000000 --- a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj +++ /dev/null @@ -1,148 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} - libasrclient - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - true - - - - - include;%(AdditionalIncludeDirectories) - ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - true - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions) - ProgramDatabase - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ASR_CLIENT_LIB_EXPORT;%(PreprocessorDefinitions) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - - - - - - - {ee157390-1e85-416c-946e-620e32c9ad33} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj.filters b/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj.filters deleted file mode 100644 index 3bdaf623d4..0000000000 --- a/libs/unimrcp/platforms/libasr-client/libasrclient.vcxproj.filters +++ /dev/null @@ -1,23 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {21e6c16e-f977-468a-9576-0c5981eb7da5} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libasr-client/src/asr_engine.c b/libs/unimrcp/platforms/libasr-client/src/asr_engine.c deleted file mode 100644 index 1473a89604..0000000000 --- a/libs/unimrcp/platforms/libasr-client/src/asr_engine.c +++ /dev/null @@ -1,752 +0,0 @@ -/* - * Copyright 2009-2014 Arsen Chaloyan - * - * 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. - * - * $Id: asr_engine.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include - -/* APR includes */ -#include -#include - -/* Common includes */ -#include "unimrcp_client.h" -#include "mrcp_application.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -/* Recognizer includes */ -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -/* MPF includes */ -#include -/* APT includes */ -#include "apt_nlsml_doc.h" -#include "apt_log.h" -#include "apt_pool.h" - -#include "asr_engine.h" - -typedef enum { - INPUT_MODE_NONE, - INPUT_MODE_FILE, - INPUT_MODE_STREAM -} input_mode_e; - -/** ASR engine on top of UniMRCP client stack */ -struct asr_engine_t { - /** MRCP client stack */ - mrcp_client_t *mrcp_client; - /** MRCP client stack */ - mrcp_application_t *mrcp_app; - /** Memory pool */ - apr_pool_t *pool; -}; - - -/** ASR session on top of UniMRCP session/channel */ -struct asr_session_t { - /** Back pointer to engine */ - asr_engine_t *engine; - /** MRCP session */ - mrcp_session_t *mrcp_session; - /** MRCP channel */ - mrcp_channel_t *mrcp_channel; - /** RECOGNITION-COMPLETE message */ - mrcp_message_t *recog_complete; - - /** Input mode (either file or stream) */ - input_mode_e input_mode; - /** File to read media frames from */ - FILE *audio_in; - /* Buffer of media frames */ - mpf_frame_buffer_t *media_buffer; - /** Streaming is in-progress */ - apt_bool_t streaming; - - /** Conditional wait object */ - apr_thread_cond_t *wait_object; - /** Mutex of the wait object */ - apr_thread_mutex_t *mutex; - - /** Message sent from client stack */ - const mrcp_app_message_t *app_message; -}; - - -/** Declaration of recognizer audio stream methods */ -static apt_bool_t asr_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t audio_stream_vtable = { - NULL, - NULL, - NULL, - asr_stream_read, - NULL, - NULL, - NULL, - NULL -}; - -static apt_bool_t app_message_handler(const mrcp_app_message_t *app_message); - - -/** Create ASR engine */ -ASR_CLIENT_DECLARE(asr_engine_t*) asr_engine_create( - const char *root_dir_path, - apt_log_priority_e log_priority, - apt_log_output_e log_output) -{ - apr_pool_t *pool = NULL; - apt_dir_layout_t *dir_layout; - asr_engine_t *engine; - mrcp_client_t *mrcp_client; - mrcp_application_t *mrcp_app; - - /* create APR pool */ - pool = apt_pool_create(); - if(!pool) { - return NULL; - } - - /* create the structure of default directories layout */ - dir_layout = apt_default_dir_layout_create(root_dir_path,pool); - /* create singleton logger */ - apt_log_instance_create(log_output,log_priority,pool); - - if((log_output & APT_LOG_OUTPUT_FILE) == APT_LOG_OUTPUT_FILE) { - /* open the log file */ - const char *log_dir_path = apt_dir_layout_path_get(dir_layout,APT_LAYOUT_LOG_DIR); - apt_log_file_open(log_dir_path,"unimrcpclient",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,FALSE,pool); - } - - engine = apr_palloc(pool,sizeof(asr_engine_t)); - engine->pool = pool; - engine->mrcp_client = NULL; - engine->mrcp_app = NULL; - - /* create UniMRCP client stack */ - mrcp_client = unimrcp_client_create(dir_layout); - if(!mrcp_client) { - apt_log_instance_destroy(); - apr_pool_destroy(pool); - return NULL; - } - - /* create an application */ - mrcp_app = mrcp_application_create( - app_message_handler, - engine, - pool); - if(!mrcp_app) { - mrcp_client_destroy(mrcp_client); - apt_log_instance_destroy(); - apr_pool_destroy(pool); - return NULL; - } - - /* register application in client stack */ - mrcp_client_application_register(mrcp_client,mrcp_app,"ASRAPP"); - - /* start client stack */ - if(mrcp_client_start(mrcp_client) != TRUE) { - mrcp_client_destroy(mrcp_client); - apt_log_instance_destroy(); - apr_pool_destroy(pool); - return NULL; - } - - engine->mrcp_client = mrcp_client; - engine->mrcp_app = mrcp_app; - return engine; -} - -/** Destroy ASR engine */ -ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_destroy(asr_engine_t *engine) -{ - if(engine->mrcp_client) { - /* shutdown client stack */ - mrcp_client_shutdown(engine->mrcp_client); - /* destroy client stack */ - mrcp_client_destroy(engine->mrcp_client); - engine->mrcp_client = NULL; - engine->mrcp_app = NULL; - } - - /* destroy singleton logger */ - apt_log_instance_destroy(); - /* destroy APR pool */ - apr_pool_destroy(engine->pool); - return TRUE; -} - - - -/** Destroy ASR session */ -static apt_bool_t asr_session_destroy_ex(asr_session_t *asr_session, apt_bool_t terminate) -{ - if(terminate == TRUE) { - apr_thread_mutex_lock(asr_session->mutex); - if(mrcp_application_session_terminate(asr_session->mrcp_session) == TRUE) { - apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex); - /* the response must be checked to be the valid one */ - } - apr_thread_mutex_unlock(asr_session->mutex); - } - - if(asr_session->audio_in) { - fclose(asr_session->audio_in); - asr_session->audio_in = NULL; - } - - if(asr_session->mutex) { - apr_thread_mutex_destroy(asr_session->mutex); - asr_session->mutex = NULL; - } - if(asr_session->wait_object) { - apr_thread_cond_destroy(asr_session->wait_object); - asr_session->wait_object = NULL; - } - if(asr_session->media_buffer) { - mpf_frame_buffer_destroy(asr_session->media_buffer); - asr_session->media_buffer = NULL; - } - - return mrcp_application_session_destroy(asr_session->mrcp_session); -} - -/** Open audio input file */ -static apt_bool_t asr_input_file_open(asr_session_t *asr_session, const char *input_file) -{ - const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(asr_session->engine->mrcp_app); - apr_pool_t *pool = mrcp_application_session_pool_get(asr_session->mrcp_session); - char *input_file_path = apt_datadir_filepath_get(dir_layout,input_file,pool); - if(!input_file_path) { - return FALSE; - } - - if(asr_session->audio_in) { - fclose(asr_session->audio_in); - asr_session->audio_in = NULL; - } - - asr_session->audio_in = fopen(input_file_path,"rb"); - if(!asr_session->audio_in) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open [%s]",input_file_path); - return FALSE; - } - - return TRUE; -} - -/** MPF callback to read audio frame */ -static apt_bool_t asr_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - asr_session_t *asr_session = stream->obj; - if(asr_session && asr_session->streaming == TRUE) { - if(asr_session->input_mode == INPUT_MODE_FILE) { - if(asr_session->audio_in) { - if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,asr_session->audio_in) == frame->codec_frame.size) { - /* normal read */ - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - } - else { - /* file is over */ - asr_session->streaming = FALSE; - } - } - } - if(asr_session->input_mode == INPUT_MODE_STREAM) { - if(asr_session->media_buffer) { - mpf_frame_buffer_read(asr_session->media_buffer,frame); - } - } - } - return TRUE; -} - -/** Create DEFINE-GRAMMAR request */ -static mrcp_message_t* define_grammar_message_create(asr_session_t *asr_session, const char *grammar_file) -{ - /* create MRCP message */ - mrcp_message_t *mrcp_message = mrcp_application_message_create( - asr_session->mrcp_session, - asr_session->mrcp_channel, - RECOGNIZER_DEFINE_GRAMMAR); - if(mrcp_message) { - mrcp_generic_header_t *generic_header; - - /* set message body */ - const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(asr_session->engine->mrcp_app); - apr_pool_t *pool = mrcp_application_session_pool_get(asr_session->mrcp_session); - char *grammar_file_path = apt_datadir_filepath_get(dir_layout,grammar_file,pool); - if(grammar_file_path) { - apr_finfo_t finfo; - apr_file_t *grammar_file; - apt_str_t *content = &mrcp_message->body; - - if(apr_file_open(&grammar_file,grammar_file_path,APR_FOPEN_READ|APR_FOPEN_BINARY,0,pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Grammar File %s",grammar_file_path); - return NULL; - } - - if(apr_file_info_get(&finfo,APR_FINFO_SIZE,grammar_file) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Grammar File Info %s",grammar_file_path); - apr_file_close(grammar_file); - return NULL; - } - - content->length = (apr_size_t)finfo.size; - content->buf = (char*) apr_palloc(pool,content->length+1); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Load Grammar File Content size [%"APR_SIZE_T_FMT" bytes] %s", - content->length,grammar_file_path); - if(apr_file_read(grammar_file,content->buf,&content->length) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Read Grammar File Content %s",grammar_file_path); - apr_file_close(grammar_file); - return NULL; - } - content->buf[content->length] = '\0'; - apr_file_close(grammar_file); - } - - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(mrcp_message); - if(generic_header) { - /* set generic header fields */ - if(mrcp_message->start_line.version == MRCP_VERSION_2) { - apt_string_assign(&generic_header->content_type,"application/srgs+xml",mrcp_message->pool); - } - else { - apt_string_assign(&generic_header->content_type,"application/grammar+xml",mrcp_message->pool); - } - mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE); - apt_string_assign(&generic_header->content_id,"demo-grammar",mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_ID); - } - } - return mrcp_message; -} - -/** Create RECOGNIZE request */ -static mrcp_message_t* recognize_message_create(asr_session_t *asr_session) -{ - /* create MRCP message */ - mrcp_message_t *mrcp_message = mrcp_application_message_create( - asr_session->mrcp_session, - asr_session->mrcp_channel, - RECOGNIZER_RECOGNIZE); - if(mrcp_message) { - mrcp_recog_header_t *recog_header; - mrcp_generic_header_t *generic_header; - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(mrcp_message); - if(generic_header) { - /* set generic header fields */ - apt_string_assign(&generic_header->content_type,"text/uri-list",mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE); - /* set message body */ - apt_string_assign(&mrcp_message->body,"session:demo-grammar",mrcp_message->pool); - } - /* get/allocate recognizer header */ - recog_header = mrcp_resource_header_prepare(mrcp_message); - if(recog_header) { - if(mrcp_message->start_line.version == MRCP_VERSION_2) { - /* set recognizer header fields */ - recog_header->cancel_if_queue = FALSE; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CANCEL_IF_QUEUE); - } - recog_header->no_input_timeout = 5000; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT); - recog_header->recognition_timeout = 20000; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT); - recog_header->speech_complete_timeout = 400; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT); - recog_header->dtmf_term_timeout = 3000; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT); - recog_header->dtmf_interdigit_timeout = 3000; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT); - recog_header->confidence_threshold = 0.5f; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD); - recog_header->start_input_timers = TRUE; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_START_INPUT_TIMERS); - } - } - return mrcp_message; -} - -/** Get NLSML result */ -static const char* nlsml_result_get(mrcp_message_t *message) -{ - nlsml_interpretation_t *interpretation; - nlsml_instance_t *instance; - nlsml_result_t *result = nlsml_result_parse(message->body.buf, message->body.length, message->pool); - if(!result) { - return NULL; - } - - /* get first interpretation */ - interpretation = nlsml_first_interpretation_get(result); - if(!interpretation) { - return NULL; - } - - /* get first instance */ - instance = nlsml_interpretation_first_instance_get(interpretation); - if(!instance) { - return NULL; - } - - nlsml_instance_swi_suppress(instance); - return nlsml_instance_content_generate(instance, message->pool); -} - - -/** Application message handler */ -static apt_bool_t app_message_handler(const mrcp_app_message_t *app_message) -{ - if((app_message->message_type == MRCP_APP_MESSAGE_TYPE_SIGNALING && - app_message->sig_message.message_type == MRCP_SIG_MESSAGE_TYPE_RESPONSE) || - app_message->message_type == MRCP_APP_MESSAGE_TYPE_CONTROL) { - - asr_session_t *asr_session = mrcp_application_session_object_get(app_message->session); - if(asr_session) { - apr_thread_mutex_lock(asr_session->mutex); - asr_session->app_message = app_message; - apr_thread_cond_signal(asr_session->wait_object); - apr_thread_mutex_unlock(asr_session->mutex); - } - } - return TRUE; -} - -/** Check signaling response */ -static apt_bool_t sig_response_check(const mrcp_app_message_t *app_message) -{ - if(!app_message || app_message->message_type != MRCP_APP_MESSAGE_TYPE_SIGNALING) { - return FALSE; - } - - return (app_message->sig_message.status == MRCP_SIG_STATUS_CODE_SUCCESS) ? TRUE : FALSE; -} - -/** Check MRCP response */ -static apt_bool_t mrcp_response_check(const mrcp_app_message_t *app_message, mrcp_request_state_e state) -{ - mrcp_message_t *mrcp_message = NULL; - if(app_message && app_message->message_type == MRCP_APP_MESSAGE_TYPE_CONTROL) { - mrcp_message = app_message->control_message; - } - - if(!mrcp_message || mrcp_message->start_line.message_type != MRCP_MESSAGE_TYPE_RESPONSE ) { - return FALSE; - } - - if(mrcp_message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS && - mrcp_message->start_line.status_code != MRCP_STATUS_CODE_SUCCESS_WITH_IGNORE) { - return FALSE; - } - return (mrcp_message->start_line.request_state == state) ? TRUE : FALSE; -} - -/** Get MRCP event */ -static mrcp_message_t* mrcp_event_get(const mrcp_app_message_t *app_message) -{ - mrcp_message_t *mrcp_message = NULL; - if(app_message && app_message->message_type == MRCP_APP_MESSAGE_TYPE_CONTROL) { - mrcp_message = app_message->control_message; - } - - if(!mrcp_message || mrcp_message->start_line.message_type != MRCP_MESSAGE_TYPE_EVENT) { - return NULL; - } - return mrcp_message; -} - -/** Create ASR session */ -ASR_CLIENT_DECLARE(asr_session_t*) asr_session_create(asr_engine_t *engine, const char *profile) -{ - mpf_termination_t *termination; - mrcp_channel_t *channel; - mrcp_session_t *session; - const mrcp_app_message_t *app_message; - apr_pool_t *pool; - asr_session_t *asr_session; - mpf_stream_capabilities_t *capabilities; - - /* create session */ - session = mrcp_application_session_create(engine->mrcp_app,profile,NULL); - if(!session) { - return NULL; - } - pool = mrcp_application_session_pool_get(session); - - asr_session = apr_palloc(pool,sizeof(asr_session_t)); - mrcp_application_session_object_set(session,asr_session); - - /* create source stream capabilities */ - capabilities = mpf_source_stream_capabilities_create(pool); - /* add codec capabilities (Linear PCM) */ - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000, - "LPCM"); - - termination = mrcp_application_audio_termination_create( - session, /* session, termination belongs to */ - &audio_stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* capabilities of audio stream */ - asr_session); /* object to associate */ - - channel = mrcp_application_channel_create( - session, /* session, channel belongs to */ - MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */ - termination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - asr_session); /* object to associate */ - - if(!channel) { - mrcp_application_session_destroy(session); - return NULL; - } - - asr_session->engine = engine; - asr_session->mrcp_session = session; - asr_session->mrcp_channel = channel; - asr_session->recog_complete = NULL; - asr_session->input_mode = INPUT_MODE_NONE; - asr_session->streaming = FALSE; - asr_session->audio_in = NULL; - asr_session->media_buffer = NULL; - asr_session->mutex = NULL; - asr_session->wait_object = NULL; - asr_session->app_message = NULL; - - /* Create cond wait object and mutex */ - apr_thread_mutex_create(&asr_session->mutex,APR_THREAD_MUTEX_DEFAULT,pool); - apr_thread_cond_create(&asr_session->wait_object,pool); - - /* Create media buffer */ - asr_session->media_buffer = mpf_frame_buffer_create(160,20,pool); - - /* Send add channel request and wait for the response */ - apr_thread_mutex_lock(asr_session->mutex); - app_message = NULL; - if(mrcp_application_channel_add(asr_session->mrcp_session,asr_session->mrcp_channel) == TRUE) { - apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex); - app_message = asr_session->app_message; - asr_session->app_message = NULL; - } - apr_thread_mutex_unlock(asr_session->mutex); - - if(sig_response_check(app_message) == FALSE) { - asr_session_destroy_ex(asr_session,TRUE); - return NULL; - } - return asr_session; -} - -/** Initiate recognition based on specified grammar and input file */ -ASR_CLIENT_DECLARE(const char*) asr_session_file_recognize( - asr_session_t *asr_session, - const char *grammar_file, - const char *input_file) -{ - const mrcp_app_message_t *app_message; - mrcp_message_t *mrcp_message; - - app_message = NULL; - mrcp_message = define_grammar_message_create(asr_session,grammar_file); - if(!mrcp_message) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create DEFINE-GRAMMAR Request"); - return NULL; - } - - /* Send DEFINE-GRAMMAR request and wait for the response */ - apr_thread_mutex_lock(asr_session->mutex); - if(mrcp_application_message_send(asr_session->mrcp_session,asr_session->mrcp_channel,mrcp_message) == TRUE) { - apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex); - app_message = asr_session->app_message; - asr_session->app_message = NULL; - } - apr_thread_mutex_unlock(asr_session->mutex); - - if(mrcp_response_check(app_message,MRCP_REQUEST_STATE_COMPLETE) == FALSE) { - return NULL; - } - - /* Reset prev recog result (if any) */ - asr_session->recog_complete = NULL; - - app_message = NULL; - mrcp_message = recognize_message_create(asr_session); - if(!mrcp_message) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create RECOGNIZE Request"); - return NULL; - } - - /* Send RECOGNIZE request and wait for the response */ - apr_thread_mutex_lock(asr_session->mutex); - if(mrcp_application_message_send(asr_session->mrcp_session,asr_session->mrcp_channel,mrcp_message) == TRUE) { - apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex); - app_message = asr_session->app_message; - asr_session->app_message = NULL; - } - apr_thread_mutex_unlock(asr_session->mutex); - - if(mrcp_response_check(app_message,MRCP_REQUEST_STATE_INPROGRESS) == FALSE) { - return NULL; - } - - /* Open input file and start streaming */ - asr_session->input_mode = INPUT_MODE_FILE; - if(asr_input_file_open(asr_session,input_file) == FALSE) { - return NULL; - } - asr_session->streaming = TRUE; - - /* Wait for events either START-OF-INPUT or RECOGNITION-COMPLETE */ - do { - apr_thread_mutex_lock(asr_session->mutex); - app_message = NULL; - if(apr_thread_cond_timedwait(asr_session->wait_object,asr_session->mutex, 60 * 1000000) != APR_SUCCESS) { - apr_thread_mutex_unlock(asr_session->mutex); - return NULL; - } - app_message = asr_session->app_message; - asr_session->app_message = NULL; - apr_thread_mutex_unlock(asr_session->mutex); - - mrcp_message = mrcp_event_get(app_message); - if(mrcp_message && mrcp_message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) { - asr_session->recog_complete = mrcp_message; - } - } - while(!asr_session->recog_complete); - - /* Get results */ - return nlsml_result_get(asr_session->recog_complete); -} - -/** Initiate recognition based on specified grammar and input stream */ -ASR_CLIENT_DECLARE(const char*) asr_session_stream_recognize( - asr_session_t *asr_session, - const char *grammar_file) -{ - const mrcp_app_message_t *app_message; - mrcp_message_t *mrcp_message; - - app_message = NULL; - mrcp_message = define_grammar_message_create(asr_session,grammar_file); - if(!mrcp_message) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create DEFINE-GRAMMAR Request"); - return NULL; - } - - /* Send DEFINE-GRAMMAR request and wait for the response */ - apr_thread_mutex_lock(asr_session->mutex); - if(mrcp_application_message_send(asr_session->mrcp_session,asr_session->mrcp_channel,mrcp_message) == TRUE) { - apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex); - app_message = asr_session->app_message; - asr_session->app_message = NULL; - } - apr_thread_mutex_unlock(asr_session->mutex); - - if(mrcp_response_check(app_message,MRCP_REQUEST_STATE_COMPLETE) == FALSE) { - return NULL; - } - - /* Reset prev recog result (if any) */ - asr_session->recog_complete = NULL; - - app_message = NULL; - mrcp_message = recognize_message_create(asr_session); - if(!mrcp_message) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create RECOGNIZE Request"); - return NULL; - } - - /* Send RECOGNIZE request and wait for the response */ - apr_thread_mutex_lock(asr_session->mutex); - if(mrcp_application_message_send(asr_session->mrcp_session,asr_session->mrcp_channel,mrcp_message) == TRUE) { - apr_thread_cond_wait(asr_session->wait_object,asr_session->mutex); - app_message = asr_session->app_message; - asr_session->app_message = NULL; - } - apr_thread_mutex_unlock(asr_session->mutex); - - if(mrcp_response_check(app_message,MRCP_REQUEST_STATE_INPROGRESS) == FALSE) { - return NULL; - } - - /* Reset media buffer */ - mpf_frame_buffer_restart(asr_session->media_buffer); - - /* Set input mode and start streaming */ - asr_session->input_mode = INPUT_MODE_STREAM; - asr_session->streaming = TRUE; - - /* Wait for events either START-OF-INPUT or RECOGNITION-COMPLETE */ - do { - apr_thread_mutex_lock(asr_session->mutex); - app_message = NULL; - if(apr_thread_cond_timedwait(asr_session->wait_object,asr_session->mutex, 60 * 1000000) != APR_SUCCESS) { - apr_thread_mutex_unlock(asr_session->mutex); - return NULL; - } - app_message = asr_session->app_message; - asr_session->app_message = NULL; - apr_thread_mutex_unlock(asr_session->mutex); - - mrcp_message = mrcp_event_get(app_message); - if(mrcp_message && mrcp_message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) { - asr_session->recog_complete = mrcp_message; - } - } - while(!asr_session->recog_complete); - - /* Get results */ - return nlsml_result_get(asr_session->recog_complete); -} - -/** Write audio frame to recognize */ -ASR_CLIENT_DECLARE(apt_bool_t) asr_session_stream_write( - asr_session_t *asr_session, - char *data, - int size) -{ - mpf_frame_t frame; - frame.type = MEDIA_FRAME_TYPE_AUDIO; - frame.marker = MPF_MARKER_NONE; - frame.codec_frame.buffer = data; - frame.codec_frame.size = size; - - if(mpf_frame_buffer_write(asr_session->media_buffer,&frame) != TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Write Audio [%d]",size); - return FALSE; - } - return TRUE; -} - -/** Destroy ASR session */ -ASR_CLIENT_DECLARE(apt_bool_t) asr_session_destroy(asr_session_t *asr_session) -{ - return asr_session_destroy_ex(asr_session,TRUE); -} - -/** Set log priority */ -ASR_CLIENT_DECLARE(apt_bool_t) asr_engine_log_priority_set(apt_log_priority_e log_priority) -{ - return apt_log_priority_set(log_priority); -} diff --git a/libs/unimrcp/platforms/libunimrcp-client/Makefile.am b/libs/unimrcp/platforms/libunimrcp-client/Makefile.am deleted file mode 100644 index 28bc44aac3..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/platforms/libunimrcp-client/include \ - $(UNIMRCP_CLIENTLIB_INCLUDES) - -lib_LTLIBRARIES = libunimrcpclient.la - -include_HEADERS = include/unimrcp_client.h -libunimrcpclient_la_SOURCES = src/unimrcp_client.c -libunimrcpclient_la_LIBADD = $(UNIMRCP_CLIENTLIB_LIBS) -libunimrcpclient_la_LDFLAGS = $(UNIMRCP_CLIENTLIB_OPTS) - -include $(top_srcdir)/build/rules/uniclientlib.am diff --git a/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h b/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h deleted file mode 100644 index b1536f4c0c..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/include/unimrcp_client.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: unimrcp_client.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef UNIMRCP_CLIENT_H -#define UNIMRCP_CLIENT_H - -/** - * @file unimrcp_client.h - * @brief UniMRCP Client - */ - -#include "mrcp_client.h" - -APT_BEGIN_EXTERN_C - -/** - * Create UniMRCP client. - * @param dir_layout the dir layout structure - */ -MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create(apt_dir_layout_t *dir_layout); - -/** - * Create UniMRCP client. - * @param xmlconfig XML configuration string - */ -MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create2(const char *xmlconfig); - - -APT_END_EXTERN_C - -#endif /* UNIMRCP_CLIENT_H */ diff --git a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj b/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj deleted file mode 100644 index 170941bc41..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj b/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj deleted file mode 100644 index eba5aa5662..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {EE157390-1E85-416C-946E-620E32C9AD33} - libunimrcpclient - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - X64 - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - {72782932-37cc-46ae-8c7f-9a7b1a6ee108} - false - - - {746f3632-5bb2-4570-9453-31d6d58a7d8e} - false - - - {deb01acb-d65f-4a62-aed9-58c1054499e9} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj.filters b/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj.filters deleted file mode 100644 index a2d863b27f..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/libunimrcpclient.vcxproj.filters +++ /dev/null @@ -1,29 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {15d2ec58-ba87-4dd8-9f7a-434f9e186e4e} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c b/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c deleted file mode 100644 index 65cb74221a..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-client/src/unimrcp_client.c +++ /dev/null @@ -1,1416 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: unimrcp_client.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include -#include "uni_version.h" -#include "uni_revision.h" -#include "unimrcp_client.h" -#include "mrcp_resource_loader.h" -#include "mpf_engine.h" -#include "mpf_engine_factory.h" -#include "mpf_codec_manager.h" -#include "mpf_rtp_termination_factory.h" -#include "mrcp_sofiasip_client_agent.h" -#include "mrcp_unirtsp_client_agent.h" -#include "mrcp_client_connection.h" -#include "mrcp_ca_factory.h" -#include "apt_net.h" -#include "apt_log.h" - -#define CONF_FILE_NAME "unimrcpclient.xml" - -#define DEFAULT_IP_ADDRESS "127.0.0.1" -#define DEFAULT_SIP_PORT 8062 -#define DEFAULT_RTP_PORT_MIN 4000 -#define DEFAULT_RTP_PORT_MAX 5000 - -#define DEFAULT_SOFIASIP_UA_NAME "UniMRCP SofiaSIP" -#define DEFAULT_SDP_ORIGIN "UniMRCPClient" -#define DEFAULT_RESOURCE_LOCATION "media" - -#define XML_FILE_BUFFER_LENGTH 16000 - -/** UniMRCP client loader */ -typedef struct unimrcp_client_loader_t unimrcp_client_loader_t; - -/** UniMRCP client loader */ -struct unimrcp_client_loader_t { - /** MRCP client */ - mrcp_client_t *client; - /** Directory layout */ - apt_dir_layout_t *dir_layout; - /** XML document */ - apr_xml_doc *doc; - /** Pool to allocate memory from */ - apr_pool_t *pool; - - /** Default IP address (named property) */ - const char *ip; - /** Default external (NAT) IP address (named property) */ - const char *ext_ip; - /** Default server IP address (named property) */ - const char *server_ip; - - /** Implicitly detected, cached IP address */ - const char *auto_ip; -}; - -static apt_bool_t unimrcp_client_load(unimrcp_client_loader_t *loader, const char *dir_path, const char *file_name); -static apt_bool_t unimrcp_client_load2(unimrcp_client_loader_t *loader, const char *xmlconfig); - -/** Initialize client -- common to unimrcp_client_create and unimrcp_client_create2 */ -static unimrcp_client_loader_t* unimrcp_client_init(apt_dir_layout_t *dir_layout) -{ - apr_pool_t *pool; - mrcp_client_t *client; - unimrcp_client_loader_t *loader; - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"UniMRCP Client ["UNI_VERSION_STRING"] [r"UNI_REVISION_STRING"]"); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"APR ["APR_VERSION_STRING"]"); - client = mrcp_client_create(dir_layout); - if(!client) { - return NULL; - } - pool = mrcp_client_memory_pool_get(client); - if(!pool) { - return NULL; - } - - loader = apr_palloc(pool,sizeof(unimrcp_client_loader_t)); - loader->dir_layout = dir_layout; - loader->doc = NULL; - loader->client = client; - loader->pool = pool; - loader->ip = NULL; - loader->ext_ip = NULL; - loader->server_ip = NULL; - loader->auto_ip = NULL; - return loader; -} - -/** Create and load UniMRCP client using the directories layout */ -MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create(apt_dir_layout_t *dir_layout) -{ - const char *dir_path; - unimrcp_client_loader_t *loader; - - if(!dir_layout) { - return NULL; - } - - loader = unimrcp_client_init(dir_layout); - if (!loader) - return NULL; - - dir_path = apt_dir_layout_path_get(dir_layout,APT_LAYOUT_CONF_DIR); - - if(unimrcp_client_load(loader,dir_path,CONF_FILE_NAME) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load UniMRCP Client Document"); - } - - return loader->client; -} - -/** Create UniMRCP client from XML string configuration */ -MRCP_DECLARE(mrcp_client_t*) unimrcp_client_create2(const char *xmlconfig) -{ - unimrcp_client_loader_t *loader; - - loader = unimrcp_client_init(NULL); - if (!loader) - return NULL; - - if(unimrcp_client_load2(loader,xmlconfig) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Process UniMRCP Client Configuration"); - } - - return loader->client; -} - -/** Check whether specified attribute is valid */ -static APR_INLINE apt_bool_t is_attr_valid(const apr_xml_attr *attr) -{ - return (attr && attr->value && *attr->value != '\0'); -} - -/** Check whether specified attribute is enabled (true) */ -static APR_INLINE apt_bool_t is_attr_enabled(const apr_xml_attr *attr) -{ - if(attr && strcasecmp(attr->value,"false") == 0) { - return FALSE; - } - return TRUE; -} - -/** Check whether cdata is valid */ -static APR_INLINE apt_bool_t is_cdata_valid(const apr_xml_elem *elem) -{ - return (elem->first_cdata.first && elem->first_cdata.first->text); -} - -/** Get text cdata */ -static APR_INLINE const char* cdata_text_get(const apr_xml_elem *elem) -{ - return elem->first_cdata.first->text; -} - -/** Get boolean cdata */ -static APR_INLINE apt_bool_t cdata_bool_get(const apr_xml_elem *elem) -{ - return (strcasecmp(elem->first_cdata.first->text,"true") == 0) ? TRUE : FALSE; -} - -/** Copy cdata */ -static APR_INLINE char* cdata_copy(const apr_xml_elem *elem, apr_pool_t *pool) -{ - return apr_pstrdup(pool,elem->first_cdata.first->text); -} - -/** Get generic "id" and "enable" attributes */ -static apt_bool_t header_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **id, const apr_xml_attr **enable) -{ - const apr_xml_attr *attr; - if(!id || !enable) { - return FALSE; - } - - *id = NULL; - *enable = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"id") == 0) { - *id = attr; - } - else if(strcasecmp(attr->name,"enable") == 0) { - *enable = attr; - } - } - - if(is_attr_valid(*id) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Required Attribute in Element <%s>",elem->name); - return FALSE; - } - return TRUE; -} - -/** Get profile attributes such as "id", "enable" and "tag" */ -static apt_bool_t profile_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **id, const apr_xml_attr **enable, const apr_xml_attr **tag) -{ - const apr_xml_attr *attr; - if(!id || !enable || !tag) { - return FALSE; - } - - *id = NULL; - *enable = NULL; - *tag = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"id") == 0) { - *id = attr; - } - else if(strcasecmp(attr->name,"enable") == 0) { - *enable = attr; - } - else if(strcasecmp(attr->name,"tag") == 0) { - *tag = attr; - } - } - - if(is_attr_valid(*id) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Required Attribute in Element <%s>",elem->name); - return FALSE; - } - return TRUE; -} - -/** Get generic "name" and "value" attributes */ -static apt_bool_t name_value_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **name, const apr_xml_attr **value) -{ - const apr_xml_attr *attr; - if(!name || !value) { - return FALSE; - } - - *name = NULL; - *value = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"name") == 0) { - *name = attr; - } - else if(strcasecmp(attr->name,"value") == 0) { - *value = attr; - } - } - return (*name && *value) ? TRUE : FALSE; -} - -static char* unimrcp_client_ip_address_get(unimrcp_client_loader_t *loader, const apr_xml_elem *elem, const char *default_ip) -{ - const apr_xml_attr *attr = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"type") == 0) { - break; - } - } - - if(attr && strcasecmp(attr->value,"auto") == 0) { - /* implicitly detect IP address, if not already detected */ - if(!loader->auto_ip) { - char *auto_addr = DEFAULT_IP_ADDRESS; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Detecting IP Address"); - apt_ip_get(&auto_addr,loader->pool); - loader->auto_ip = auto_addr; - } - return apr_pstrdup(loader->pool,loader->auto_ip); - } - else if(attr && strcasecmp(attr->value,"iface") == 0) { - /* get IP address by network interface name */ - char *ip_addr = DEFAULT_IP_ADDRESS; - if(is_cdata_valid(elem) == TRUE) { - const char *iface_name = cdata_text_get(elem); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Get IP Address by Interface [%s]", iface_name); - apt_ip_get_by_iface(iface_name,&ip_addr,loader->pool); - } - return ip_addr; - } - - if(is_cdata_valid(elem)) { - /* use specified IP address */ - return cdata_copy(elem,loader->pool); - } - - /* use default IP address */ - return apr_pstrdup(loader->pool,loader->ip); -} - - - -/** Load resource */ -static apt_bool_t unimrcp_client_resource_load(mrcp_resource_loader_t *resource_loader, const apr_xml_elem *root, apr_pool_t *pool) -{ - apt_str_t resource_class; - const apr_xml_attr *id_attr; - const apr_xml_attr *enable_attr; - apt_string_reset(&resource_class); - - if(header_attribs_get(root,&id_attr,&enable_attr) == FALSE) { - return FALSE; - } - - if(is_attr_enabled(enable_attr) == FALSE) { - return TRUE; - } - - apt_string_set(&resource_class,id_attr->value); - return mrcp_resource_load(resource_loader,&resource_class); -} - -/** Load resource factory */ -static apt_bool_t unimrcp_client_resource_factory_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - mrcp_resource_factory_t *resource_factory; - mrcp_resource_loader_t *resource_loader = mrcp_resource_loader_create(FALSE,loader->pool); - if(!resource_loader) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resources"); - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"resource") == 0) { - unimrcp_client_resource_load(resource_loader,elem,loader->pool); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - resource_factory = mrcp_resource_factory_get(resource_loader); - return mrcp_client_resource_factory_register(loader->client,resource_factory); -} - -/** Load SofiaSIP signaling agent */ -static apt_bool_t unimrcp_client_sip_uac_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_sig_agent_t *agent; - mrcp_sofia_client_config_t *config; - - config = mrcp_sofiasip_client_config_alloc(loader->pool); - config->local_port = DEFAULT_SIP_PORT; - config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME; - config->origin = DEFAULT_SDP_ORIGIN; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading SofiaSIP Agent <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"sip-ip") == 0) { - config->local_ip = unimrcp_client_ip_address_get(loader,elem,loader->ip); - } - else if(strcasecmp(elem->name,"sip-ext-ip") == 0) { - config->ext_ip = unimrcp_client_ip_address_get(loader,elem,loader->ext_ip); - } - else if(strcasecmp(elem->name,"sip-port") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->local_port = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-transport") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->transport = cdata_copy(elem,loader->pool); - } - } - else if(strcasecmp(elem->name,"ua-name") == 0) { - if(is_cdata_valid(elem) == TRUE) { - const apr_xml_attr *attr = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"appendversion") == 0) { - break; - } - } - if(is_attr_enabled(attr)) { - config->user_agent_name = apr_psprintf(loader->pool,"%s "UNI_VERSION_STRING,cdata_text_get(elem)); - } - else { - config->user_agent_name = cdata_copy(elem,loader->pool); - } - } - } - else if(strcasecmp(elem->name,"sdp-origin") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->origin = cdata_copy(elem,loader->pool); - } - } - else if(strcasecmp(elem->name,"sip-t1") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->sip_t1 = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-t2") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->sip_t2 = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-t4") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->sip_t4 = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-t1x64") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->sip_t1x64 = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-message-output") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->tport_log = cdata_bool_get(elem); - } - } - else if(strcasecmp(elem->name,"sip-message-dump") == 0) { - if(is_cdata_valid(elem) == TRUE) { - const char *root_path; - const char *path = cdata_text_get(elem); - if(loader->dir_layout && apr_filepath_root(&root_path,&path,0,loader->pool) == APR_ERELATIVE) - config->tport_dump_file = apt_dir_layout_path_compose( - loader->dir_layout, - APT_LAYOUT_LOG_DIR, - path, - loader->pool); - else - config->tport_dump_file = cdata_copy(elem,loader->pool); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(!config->local_ip) { - /* use default IP address if not specified */ - config->local_ip = apr_pstrdup(loader->pool,loader->ip); - } - if(!config->ext_ip && loader->ext_ip) { - /* use default ext IP address if not specified */ - config->ext_ip = apr_pstrdup(loader->pool,loader->ext_ip); - } - - agent = mrcp_sofiasip_client_agent_create(id,config,loader->pool); - return mrcp_client_signaling_agent_register(loader->client,agent); -} - -/** Load UniRTSP signaling agent */ -static apt_bool_t unimrcp_client_rtsp_uac_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_sig_agent_t *agent; - rtsp_client_config_t *config; - - config = mrcp_unirtsp_client_config_alloc(loader->pool); - config->origin = DEFAULT_SDP_ORIGIN; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading UniRTSP Agent <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"sdp-origin") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->origin = cdata_copy(elem,loader->pool); - } - } - else if(strcasecmp(elem->name,"max-connection-count") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->max_connection_count = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"request-timeout") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->request_timeout = atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - agent = mrcp_unirtsp_client_agent_create(id,config,loader->pool); - return mrcp_client_signaling_agent_register(loader->client,agent); -} - -/** Load MRCPv2 connection agent */ -static apt_bool_t unimrcp_client_mrcpv2_uac_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_connection_agent_t *agent; - apr_size_t max_connection_count = 100; - apt_bool_t offer_new_connection = FALSE; - const char *rx_buffer_size = NULL; - const char *tx_buffer_size = NULL; - const char *request_timeout = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Agent <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"max-connection-count") == 0) { - if(is_cdata_valid(elem) == TRUE) { - max_connection_count = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"offer-new-connection") == 0) { - if(is_cdata_valid(elem) == TRUE) { - offer_new_connection = cdata_bool_get(elem); - } - } - else if(strcasecmp(elem->name,"rx-buffer-size") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rx_buffer_size = cdata_text_get(elem); - } - } - else if(strcasecmp(elem->name,"tx-buffer-size") == 0) { - if(is_cdata_valid(elem) == TRUE) { - tx_buffer_size = cdata_text_get(elem); - } - } - else if(strcasecmp(elem->name,"request-timeout") == 0) { - if(is_cdata_valid(elem) == TRUE) { - request_timeout = cdata_text_get(elem); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - agent = mrcp_client_connection_agent_create(id,max_connection_count,offer_new_connection,loader->pool); - if(agent) { - if(rx_buffer_size) { - mrcp_client_connection_rx_size_set(agent,atol(rx_buffer_size)); - } - if(tx_buffer_size) { - mrcp_client_connection_tx_size_set(agent,atol(tx_buffer_size)); - } - if(request_timeout) { - mrcp_client_connection_timeout_set(agent,atol(request_timeout)); - } - } - return mrcp_client_connection_agent_register(loader->client,agent); -} - -/** Load media engine */ -static apt_bool_t unimrcp_client_media_engine_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mpf_engine_t *media_engine; - unsigned long realtime_rate = 1; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Media Engine <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"realtime-rate") == 0) { - if(is_cdata_valid(elem) == TRUE) { - realtime_rate = atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - media_engine = mpf_engine_create(id,loader->pool); - if(media_engine) { - mpf_engine_scheduler_rate_set(media_engine,realtime_rate); - } - return mrcp_client_media_engine_register(loader->client,media_engine); -} - -/** Load RTP factory */ -static apt_bool_t unimrcp_client_rtp_factory_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - char *rtp_ip = NULL; - char *rtp_ext_ip = NULL; - mpf_termination_factory_t *rtp_factory; - mpf_rtp_config_t *rtp_config; - - rtp_config = mpf_rtp_config_alloc(loader->pool); - rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN; - rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Factory <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"rtp-ip") == 0) { - rtp_ip = unimrcp_client_ip_address_get(loader,elem,loader->ip); - } - else if(strcasecmp(elem->name,"rtp-ext-ip") == 0) { - rtp_ext_ip = unimrcp_client_ip_address_get(loader,elem,loader->ext_ip); - } - else if(strcasecmp(elem->name,"rtp-port-min") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtp_config->rtp_port_min = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"rtp-port-max") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtp_config->rtp_port_max = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(rtp_ip) { - apt_string_set(&rtp_config->ip,rtp_ip); - } - else { - apt_string_set(&rtp_config->ip,loader->ip); - } - if(rtp_ext_ip) { - apt_string_set(&rtp_config->ext_ip,rtp_ext_ip); - } - else if(loader->ext_ip){ - apt_string_set(&rtp_config->ext_ip,loader->ext_ip); - } - - rtp_factory = mpf_rtp_termination_factory_create(rtp_config,loader->pool); - return mrcp_client_rtp_factory_register(loader->client,rtp_factory,id); -} - - -/** Load SIP settings */ -static apt_bool_t unimrcp_client_sip_settings_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_sig_settings_t *settings = mrcp_signaling_settings_alloc(loader->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading SIP Settings <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"server-ip") == 0) { - settings->server_ip = unimrcp_client_ip_address_get(loader,elem,loader->server_ip); - } - else if(strcasecmp(elem->name,"server-port") == 0) { - if(is_cdata_valid(elem) == TRUE) { - settings->server_port = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"server-username") == 0) { - if(is_cdata_valid(elem) == TRUE) { - settings->user_name = cdata_copy(elem,loader->pool); - } - } - else if(strcasecmp(elem->name,"force-destination") == 0) { - if(is_cdata_valid(elem) == TRUE) { - settings->force_destination = cdata_bool_get(elem); - } - } - else if(strcasecmp(elem->name,"feature-tags") == 0) { - if(is_cdata_valid(elem) == TRUE) { - settings->feature_tags = cdata_copy(elem,loader->pool); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(!settings->server_ip) { - settings->server_ip = apr_pstrdup(loader->pool,loader->server_ip); - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create SIP Settings %s:%hu",settings->server_ip,settings->server_port); - return mrcp_client_signaling_settings_register(loader->client,settings,id); -} - -/** Load RTSP settings */ -static apt_bool_t unimrcp_client_rtsp_settings_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_sig_settings_t *settings = mrcp_signaling_settings_alloc(loader->pool); - settings->resource_location = DEFAULT_RESOURCE_LOCATION; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTSP Settings <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"server-ip") == 0) { - settings->server_ip = unimrcp_client_ip_address_get(loader,elem,loader->server_ip); - } - else if(strcasecmp(elem->name,"server-port") == 0) { - if(is_cdata_valid(elem) == TRUE) { - settings->server_port = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"force-destination") == 0) { - if(is_cdata_valid(elem) == TRUE) { - settings->force_destination = cdata_bool_get(elem); - } - } - else if(strcasecmp(elem->name,"resource-location") == 0) { - if(is_cdata_valid(elem) == TRUE) { - settings->resource_location = cdata_copy(elem,loader->pool); - } - else { - settings->resource_location = ""; - } - } - else if(strcasecmp(elem->name,"resource-map") == 0) { - const apr_xml_attr *name_attr; - const apr_xml_attr *value_attr; - const apr_xml_elem *child_elem; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resource Map"); - for(child_elem = elem->first_child; child_elem; child_elem = child_elem->next) { - if(name_value_attribs_get(child_elem,&name_attr,&value_attr) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",name_attr->value,value_attr->value); - apr_table_set(settings->resource_map,name_attr->value,value_attr->value); - } - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(!settings->server_ip) { - settings->server_ip = apr_pstrdup(loader->pool,loader->server_ip); - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create RTSP Settings %s:%hu",settings->server_ip,settings->server_port); - return mrcp_client_signaling_settings_register(loader->client,settings,id); -} - -/** Load jitter buffer settings */ -static apt_bool_t unimrcp_client_jb_settings_load(unimrcp_client_loader_t *loader, mpf_jb_config_t *jb, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Jitter Buffer Settings"); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"playout-delay") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->initial_playout_delay = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"min-playout-delay") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->min_playout_delay = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"max-playout-delay") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->max_playout_delay = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"adaptive") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->adaptive = (apr_byte_t) atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"time-skew-detection") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->time_skew_detection = (apr_byte_t) atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load RTCP settings */ -static apt_bool_t unimrcp_client_rtcp_settings_load(unimrcp_client_loader_t *loader, mpf_rtp_settings_t *rtcp_settings, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - const apr_xml_attr *attr = NULL; - for(attr = root->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"enable") == 0) { - break; - } - } - - if(is_attr_enabled(attr) == FALSE) { - /* RTCP is disabled, skip the rest */ - return TRUE; - } - - rtcp_settings->rtcp = TRUE; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTCP Settings"); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"rtcp-bye") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtcp_settings->rtcp_bye_policy = atoi(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"tx-interval") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtcp_settings->rtcp_tx_interval = (apr_uint16_t)atoi(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"rx-resolution") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtcp_settings->rtcp_rx_resolution = (apr_uint16_t)atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load RTP settings */ -static apt_bool_t unimrcp_client_rtp_settings_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mpf_rtp_settings_t *rtp_settings = mpf_rtp_settings_alloc(loader->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Settings <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"jitter-buffer") == 0) { - unimrcp_client_jb_settings_load(loader,&rtp_settings->jb_config,elem); - } - else if(strcasecmp(elem->name,"ptime") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtp_settings->ptime = (apr_uint16_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"codecs") == 0) { - const mpf_codec_manager_t *codec_manager = mrcp_client_codec_manager_get(loader->client); - if(is_cdata_valid(elem) == TRUE && codec_manager) { - mpf_codec_manager_codec_list_load( - codec_manager, - &rtp_settings->codec_list, - cdata_text_get(elem), - loader->pool); - } - } - else if(strcasecmp(elem->name,"rtcp") == 0) { - unimrcp_client_rtcp_settings_load(loader,rtp_settings,elem); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - return mrcp_client_rtp_settings_register(loader->client,rtp_settings,id); -} - -/** Create factory of signaling agents */ -static mrcp_sa_factory_t* unimrcp_client_sa_factory_create(unimrcp_client_loader_t *loader, const apr_xml_elem *elem) -{ - mrcp_sa_factory_t *sa_factory = NULL; - mrcp_sig_agent_t *sig_agent; - char *uac_name; - char *state; - char *uac_list_str = apr_pstrdup(loader->pool,cdata_text_get(elem)); - do { - uac_name = apr_strtok(uac_list_str, ",", &state); - if(uac_name) { - sig_agent = mrcp_client_signaling_agent_get(loader->client,uac_name); - if(sig_agent) { - if(!sa_factory) - sa_factory = mrcp_sa_factory_create(loader->pool); - - mrcp_sa_factory_agent_add(sa_factory,sig_agent); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown UAC Name <%s>",uac_name); - } - } - uac_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - } - while(uac_name); - return sa_factory; -} - -/** Create factory of MRCPv2 connection agents */ -static mrcp_ca_factory_t* unimrcp_client_ca_factory_create(unimrcp_client_loader_t *loader, const apr_xml_elem *elem) -{ - mrcp_ca_factory_t *ca_factory = NULL; - mrcp_connection_agent_t *agent; - char *name; - char *state; - char *list_str = apr_pstrdup(loader->pool,cdata_text_get(elem)); - do { - name = apr_strtok(list_str, ",", &state); - if(name) { - agent = mrcp_client_connection_agent_get(loader->client,name); - if(agent) { - if(!ca_factory) - ca_factory = mrcp_ca_factory_create(loader->pool); - - mrcp_ca_factory_agent_add(ca_factory,agent); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown MRCPv2-UAC Name <%s>",name); - } - } - list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - } - while(name); - return ca_factory; -} - -/** Create factory of media engines */ -static mpf_engine_factory_t* unimrcp_client_mpf_factory_create(unimrcp_client_loader_t *loader, const apr_xml_elem *elem) -{ - mpf_engine_factory_t *mpf_factory = NULL; - mpf_engine_t *media_engine; - - char *name; - char *state; - char *list_str = apr_pstrdup(loader->pool,cdata_text_get(elem)); - do { - name = apr_strtok(list_str, ",", &state); - if(name) { - media_engine = mrcp_client_media_engine_get(loader->client,name); - if(media_engine) { - if(!mpf_factory) - mpf_factory = mpf_engine_factory_create(loader->pool); - - mpf_engine_factory_engine_add(mpf_factory,media_engine); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Media Engine Name <%s>",name); - } - } - list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - } - while(name); - - return mpf_factory; -} - -/** Load MRCPv2 profile */ -static apt_bool_t unimrcp_client_mrcpv2_profile_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id, const char *tag) -{ - const apr_xml_elem *elem; - mrcp_client_profile_t *profile; - mrcp_sa_factory_t *sa_factory = NULL; - mrcp_ca_factory_t *ca_factory = NULL; - mpf_engine_factory_t *mpf_factory = NULL; - mpf_termination_factory_t *rtp_factory = NULL; - mpf_rtp_settings_t *rtp_settings = NULL; - mrcp_sig_settings_t *sip_settings = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Profile <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - - if(is_cdata_valid(elem) == FALSE) { - continue; - } - - if(strcasecmp(elem->name,"sip-uac") == 0) { - sa_factory = unimrcp_client_sa_factory_create(loader,elem); - } - else if(strcasecmp(elem->name,"mrcpv2-uac") == 0) { - ca_factory = unimrcp_client_ca_factory_create(loader,elem); - } - else if(strcasecmp(elem->name,"media-engine") == 0) { - mpf_factory = unimrcp_client_mpf_factory_create(loader,elem); - } - else if(strcasecmp(elem->name,"rtp-factory") == 0) { - rtp_factory = mrcp_client_rtp_factory_get(loader->client,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"sip-settings") == 0) { - sip_settings = mrcp_client_signaling_settings_get(loader->client,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"rtp-settings") == 0) { - rtp_settings = mrcp_client_rtp_settings_get(loader->client,cdata_text_get(elem)); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Profile [%s]",id); - profile = mrcp_client_profile_create_ex( - MRCP_VERSION_2,NULL, - sa_factory,ca_factory, - mpf_factory,rtp_factory, - rtp_settings,sip_settings, - loader->pool); - if(tag) { - mrcp_client_profile_tag_set(profile,tag); - } - return mrcp_client_profile_register(loader->client,profile,id); -} - -/** Load MRCPv1 profile */ -static apt_bool_t unimrcp_client_mrcpv1_profile_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root, const char *id, const char *tag) -{ - const apr_xml_elem *elem; - mrcp_client_profile_t *profile; - mrcp_sa_factory_t *sa_factory = NULL; - mpf_engine_factory_t *mpf_factory = NULL; - mpf_termination_factory_t *rtp_factory = NULL; - mpf_rtp_settings_t *rtp_settings = NULL; - mrcp_sig_settings_t *rtsp_settings = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv1 Profile <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - - if(is_cdata_valid(elem) == FALSE) { - continue; - } - - if(strcasecmp(elem->name,"rtsp-uac") == 0) { - sa_factory = unimrcp_client_sa_factory_create(loader,elem); - } - else if(strcasecmp(elem->name,"media-engine") == 0) { - mpf_factory = unimrcp_client_mpf_factory_create(loader,elem); - } - else if(strcasecmp(elem->name,"rtp-factory") == 0) { - rtp_factory = mrcp_client_rtp_factory_get(loader->client,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"rtsp-settings") == 0) { - rtsp_settings = mrcp_client_signaling_settings_get(loader->client,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"rtp-settings") == 0) { - rtp_settings = mrcp_client_rtp_settings_get(loader->client,cdata_text_get(elem)); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv1 Profile [%s]",id); - profile = mrcp_client_profile_create_ex( - MRCP_VERSION_1, - NULL,sa_factory,NULL, - mpf_factory,rtp_factory, - rtp_settings,rtsp_settings, - loader->pool); - if(tag) { - mrcp_client_profile_tag_set(profile,tag); - } - return mrcp_client_profile_register(loader->client,profile,id); -} - - -/** Load properties */ -static apt_bool_t unimrcp_client_properties_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Properties"); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"ip") == 0) { - loader->ip = unimrcp_client_ip_address_get(loader,elem,DEFAULT_IP_ADDRESS); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property ip:%s",loader->ip); - } - else if(strcasecmp(elem->name,"ext-ip") == 0) { - loader->ext_ip = unimrcp_client_ip_address_get(loader,elem,DEFAULT_IP_ADDRESS); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property ext-ip:%s",loader->ext_ip); - } - else if(strcasecmp(elem->name,"server-ip") == 0) { - loader->server_ip = unimrcp_client_ip_address_get(loader,elem,DEFAULT_IP_ADDRESS); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property server-ip:%s",loader->server_ip); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(!loader->ip) { - loader->ip = DEFAULT_IP_ADDRESS; - } - if(!loader->server_ip) { - loader->server_ip = loader->ip; - } - return TRUE; -} - -/** Load components */ -static apt_bool_t unimrcp_client_components_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - const apr_xml_attr *id_attr; - const apr_xml_attr *enable_attr; - const char *id; - - /* Create codec manager first (probably it should be loaded from config either) */ - mpf_codec_manager_t *codec_manager = mpf_engine_codec_manager_create(loader->pool); - if(codec_manager) { - mrcp_client_codec_manager_register(loader->client,codec_manager); - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Components"); - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"resource-factory") == 0) { - unimrcp_client_resource_factory_load(loader,elem); - continue; - } - - /* get common "id" and "enable" attributes */ - if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) { - /* invalid id */ - continue; - } - if(is_attr_enabled(enable_attr) == FALSE) { - /* disabled element, just skip it */ - continue; - } - id = apr_pstrdup(loader->pool,id_attr->value); - - if(strcasecmp(elem->name,"sip-uac") == 0) { - unimrcp_client_sip_uac_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"rtsp-uac") == 0) { - unimrcp_client_rtsp_uac_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"mrcpv2-uac") == 0) { - unimrcp_client_mrcpv2_uac_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"media-engine") == 0) { - unimrcp_client_media_engine_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"rtp-factory") == 0) { - unimrcp_client_rtp_factory_load(loader,elem,id); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load settings */ -static apt_bool_t unimrcp_client_settings_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - const apr_xml_attr *id_attr; - const apr_xml_attr *enable_attr; - const char *id; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Settings"); - for(elem = root->first_child; elem; elem = elem->next) { - /* get common "id" and "enable" attributes */ - if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) { - /* invalid id */ - continue; - } - if(is_attr_enabled(enable_attr) == FALSE) { - /* disabled element, just skip it */ - continue; - } - id = apr_pstrdup(loader->pool,id_attr->value); - - if(strcasecmp(elem->name,"sip-settings") == 0) { - unimrcp_client_sip_settings_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"rtsp-settings") == 0) { - unimrcp_client_rtsp_settings_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"rtp-settings") == 0) { - unimrcp_client_rtp_settings_load(loader,elem,id); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load profiles */ -static apt_bool_t unimrcp_client_profiles_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - const apr_xml_attr *id_attr; - const apr_xml_attr *enable_attr; - const apr_xml_attr *tag_attr; - const char *id; - const char *tag; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Profiles"); - for(elem = root->first_child; elem; elem = elem->next) { - /* get common "id" and "enable" attributes */ - if(profile_attribs_get(elem,&id_attr,&enable_attr,&tag_attr) == FALSE) { - /* invalid id */ - continue; - } - if(is_attr_enabled(enable_attr) == FALSE) { - /* disabled element, just skip it */ - continue; - } - id = apr_pstrdup(loader->pool,id_attr->value); - tag = tag_attr ? apr_pstrdup(loader->pool,tag_attr->value) : NULL; - - if(strcasecmp(elem->name,"mrcpv2-profile") == 0) { - unimrcp_client_mrcpv2_profile_load(loader,elem,id,tag); - } - else if(strcasecmp(elem->name,"mrcpv1-profile") == 0) { - unimrcp_client_mrcpv1_profile_load(loader,elem,id,tag); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load misc parameters */ -static apt_bool_t unimrcp_client_misc_load(unimrcp_client_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Misc Parameters"); - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"sofiasip-logger") == 0) { - char *logger_list_str; - char *logger_name; - char *state; - apr_xml_attr *attr; - apt_bool_t redirect = FALSE; - const char *loglevel_str = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"redirect") == 0) { - if(attr->value && strcasecmp(attr->value,"true") == 0) - redirect = TRUE; - } - else if(strcasecmp(attr->name,"loglevel") == 0) { - loglevel_str = attr->value; - } - } - - logger_list_str = apr_pstrdup(loader->pool,cdata_text_get(elem)); - do { - logger_name = apr_strtok(logger_list_str, ",", &state); - if(logger_name) { - mrcp_sofiasip_client_logger_init(logger_name,loglevel_str,redirect); - } - logger_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - } - while(logger_name); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Parse XML document */ -static apr_xml_doc* unimrcp_client_doc_parse(const char *file_path, apr_pool_t *pool) -{ - apr_xml_parser *parser = NULL; - apr_xml_doc *xml_doc = NULL; - apr_file_t *fd = NULL; - apr_status_t rv; - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Open Config File [%s]",file_path); - rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool); - if(rv != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Config File [%s]",file_path); - return NULL; - } - - rv = apr_xml_parse_file(pool,&parser,&xml_doc,fd,XML_FILE_BUFFER_LENGTH); - if(rv != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse Config File [%s]",file_path); - xml_doc = NULL; - } - - apr_file_close(fd); - return xml_doc; -} - -/** Process parsed XML document */ -static apt_bool_t unimrcp_client_doc_process(unimrcp_client_loader_t *loader, const char *dir_path, apr_xml_doc *doc, apr_pool_t *pool) -{ - const apr_xml_elem *elem; - const apr_xml_elem *root; - const apr_xml_attr *attr; - const char *version = NULL; - const char *subfolder = NULL; - - if(!doc) { - return FALSE; - } - - root = doc->root; - - /* Match document name */ - if(!root || strcasecmp(root->name,"unimrcpclient") != 0) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document <%s>",root ? root->name : "null"); - return FALSE; - } - - /* Read attributes */ - for(attr = root->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"version") == 0) { - version = attr->value; - } - else if(strcasecmp(attr->name,"subfolder") == 0) { - subfolder = attr->value; - } - } - - /* Check version number first */ - if(!version) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Version"); - return FALSE; - } - - loader->doc = doc; - - /* Navigate through document */ - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"properties") == 0) { - unimrcp_client_properties_load(loader,elem); - } - else if(strcasecmp(elem->name,"components") == 0) { - unimrcp_client_components_load(loader,elem); - } - else if(strcasecmp(elem->name,"settings") == 0) { - unimrcp_client_settings_load(loader,elem); - } - else if(strcasecmp(elem->name,"profiles") == 0) { - unimrcp_client_profiles_load(loader,elem); - } - else if(strcasecmp(elem->name,"misc") == 0) { - unimrcp_client_misc_load(loader,elem); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(subfolder && *subfolder != '\0') { - apr_dir_t *dir; - apr_finfo_t finfo; - apr_status_t rv; - char *subdir_path; - - if (!dir_path) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Attempt to Process Subdirectory when " - "Creating from Config String"); - return TRUE; - } - - if(apr_filepath_merge(&subdir_path,dir_path,subfolder,APR_FILEPATH_NATIVE,pool) == APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Enter Directory [%s]",subdir_path); - rv = apr_dir_open(&dir,subdir_path,pool); - if(rv == APR_SUCCESS) { - while(apr_dir_read(&finfo, APR_FINFO_NAME, dir) == APR_SUCCESS) { - if(apr_fnmatch("*.xml", finfo.name, 0) == APR_SUCCESS) { - unimrcp_client_load(loader,subdir_path,finfo.name); - } - } - apr_dir_close(dir); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Leave Directory [%s]",dir_path); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Directory %s",dir_path); - } - } - } - return TRUE; -} - -/** Load UniMRCP client from file */ -static apt_bool_t unimrcp_client_load(unimrcp_client_loader_t *loader, const char *dir_path, const char *file_name) -{ - apr_pool_t *pool = loader->pool; - apr_xml_doc *doc; - char *file_path; - - if(!dir_path || !file_name) { - return FALSE; - } - - if(apr_filepath_merge(&file_path,dir_path,file_name,APR_FILEPATH_NATIVE,pool) != APR_SUCCESS) { - return FALSE; - } - - /* Parse XML document */ - doc = unimrcp_client_doc_parse(file_path,pool); - return unimrcp_client_doc_process(loader, dir_path, doc, pool); -} - -/** Read configuration from string */ -static apt_bool_t unimrcp_client_load2(unimrcp_client_loader_t *loader, const char *xmlconfig) -{ - apr_pool_t *pool = loader->pool; - apr_xml_parser *parser; - apr_xml_doc *xml_doc; - char errbuf[4096]; - apr_status_t rv; - - parser = apr_xml_parser_create(pool); - if (!parser) return FALSE; - rv = apr_xml_parser_feed(parser, xmlconfig, strlen(xmlconfig)); - if (rv != APR_SUCCESS) { - apr_xml_parser_geterror(parser, errbuf, sizeof(errbuf)); - apt_log(APT_LOG_MARK, APT_PRIO_ERROR, "Error parsing XML configuration: %d %pm: %s", - rv, &rv, errbuf); - return FALSE; - } - rv = apr_xml_parser_done(parser, &xml_doc); - if (rv != APR_SUCCESS) { - apr_xml_parser_geterror(parser, errbuf, sizeof(errbuf)); - apt_log(APT_LOG_MARK, APT_PRIO_ERROR, "Error parsing XML configuration: %d %pm: %s", - rv, &rv, errbuf); - return FALSE; - } - return unimrcp_client_doc_process(loader, NULL, xml_doc, pool); -} diff --git a/libs/unimrcp/platforms/libunimrcp-server/Makefile.am b/libs/unimrcp/platforms/libunimrcp-server/Makefile.am deleted file mode 100644 index 1226d61813..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/platforms/libunimrcp-server/include \ - $(UNIMRCP_SERVERLIB_INCLUDES) - -lib_LTLIBRARIES = libunimrcpserver.la - -include_HEADERS = include/unimrcp_server.h -libunimrcpserver_la_SOURCES = src/unimrcp_server.c -libunimrcpserver_la_LIBADD = $(UNIMRCP_SERVERLIB_LIBS) -libunimrcpserver_la_LDFLAGS = $(UNIMRCP_SERVERLIB_OPTS) - -include $(top_srcdir)/build/rules/uniserverlib.am diff --git a/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h b/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h deleted file mode 100644 index aaf81d387e..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/include/unimrcp_server.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: unimrcp_server.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef UNIMRCP_SERVER_H -#define UNIMRCP_SERVER_H - -/** - * @file unimrcp_server.h - * @brief UniMRCP Server - */ - -#include "mrcp_server.h" - -APT_BEGIN_EXTERN_C - -/** - * Start UniMRCP server. - * @param dir_layout the dir layout structure - */ -MRCP_DECLARE(mrcp_server_t*) unimrcp_server_start(apt_dir_layout_t *dir_layout); - -/** - * Shutdown UniMRCP server. - * @param server the MRCP server to shutdown - */ -MRCP_DECLARE(apt_bool_t) unimrcp_server_shutdown(mrcp_server_t *server); - -APT_END_EXTERN_C - -#endif /* UNIMRCP_SERVER_H */ diff --git a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj b/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj deleted file mode 100644 index 0f5b68f4e9..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcproj +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj b/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj deleted file mode 100644 index a4ba6c4943..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {C98AF157-352E-4737-BD30-A24E2647F5AE} - libunimrcpserver - Win32Proj - - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - StaticLibrary - Unicode - true - - - StaticLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - X64 - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - $(ProjectRootDir)modules\mrcp-sofiasip\include;$(ProjectRootDir)modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - - - - - - - - - - - - - {18b1f35a-10f8-4287-9b37-2d10501b0b38} - false - - - {746f3632-5bb2-4570-9453-31d6d58a7d8e} - false - - - {deb01acb-d65f-4a62-aed9-58c1054499e9} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj.filters b/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj.filters deleted file mode 100644 index 67b6af97a6..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/libunimrcpserver.vcxproj.filters +++ /dev/null @@ -1,29 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {c164436d-b3de-474f-99bc-6b2ca1a4c879} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - include - - - include - - - include - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c b/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c deleted file mode 100644 index 90f1805412..0000000000 --- a/libs/unimrcp/platforms/libunimrcp-server/src/unimrcp_server.c +++ /dev/null @@ -1,1251 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: unimrcp_server.c 2252 2014-11-21 02:45:15Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "uni_version.h" -#include "uni_revision.h" -#include "unimrcp_server.h" -#include "mrcp_resource_loader.h" -#include "mpf_engine.h" -#include "mpf_codec_manager.h" -#include "mpf_rtp_termination_factory.h" -#include "mrcp_sofiasip_server_agent.h" -#include "mrcp_unirtsp_server_agent.h" -#include "mrcp_server_connection.h" -#include "apt_net.h" -#include "apt_log.h" - -#define CONF_FILE_NAME "unimrcpserver.xml" -#ifdef WIN32 -#define DEFAULT_PLUGIN_EXT "dll" -#else -#define DEFAULT_PLUGIN_EXT "so" -#endif - -#define DEFAULT_IP_ADDRESS "127.0.0.1" -#define DEFAULT_SIP_PORT 8060 -#define DEFAULT_RTSP_PORT 1554 -#define DEFAULT_MRCP_PORT 1544 -#define DEFAULT_RTP_PORT_MIN 5000 -#define DEFAULT_RTP_PORT_MAX 6000 - -#define DEFAULT_SOFIASIP_UA_NAME "UniMRCP SofiaSIP" -#define DEFAULT_SDP_ORIGIN "UniMRCPServer" - -#define XML_FILE_BUFFER_LENGTH 16000 - -/** UniMRCP server loader */ -typedef struct unimrcp_server_loader_t unimrcp_server_loader_t; - -/** UniMRCP server loader */ -struct unimrcp_server_loader_t { - /** MRCP server */ - mrcp_server_t *server; - /** Directory layout */ - apt_dir_layout_t *dir_layout; - /** XML document */ - apr_xml_doc *doc; - /** Pool to allocate memory from */ - apr_pool_t *pool; - - /** Default IP address (named property) */ - const char *ip; - /** Default external (NAT) IP address (named property) */ - const char *ext_ip; - - /** Implicitly detected, cached IP address */ - const char *auto_ip; -}; - -static apt_bool_t unimrcp_server_load(mrcp_server_t *mrcp_server, apt_dir_layout_t *dir_layout, apr_pool_t *pool); - -/** Start UniMRCP server */ -MRCP_DECLARE(mrcp_server_t*) unimrcp_server_start(apt_dir_layout_t *dir_layout) -{ - apr_pool_t *pool; - mrcp_server_t *server; - - if(!dir_layout) { - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"UniMRCP Server ["UNI_VERSION_STRING"] [r"UNI_REVISION_STRING"]"); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"APR ["APR_VERSION_STRING"]"); - server = mrcp_server_create(dir_layout); - if(!server) { - return NULL; - } - pool = mrcp_server_memory_pool_get(server); - if(!pool) { - return NULL; - } - - if(unimrcp_server_load(server,dir_layout,pool) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load UniMRCP Server Document"); - } - - mrcp_server_start(server); - return server; -} - -/** Shutdown UniMRCP server */ -MRCP_DECLARE(apt_bool_t) unimrcp_server_shutdown(mrcp_server_t *server) -{ - if(mrcp_server_shutdown(server) == FALSE) { - return FALSE; - } - return mrcp_server_destroy(server); -} - - -/** Check whether specified attribute is valid */ -static APR_INLINE apt_bool_t is_attr_valid(const apr_xml_attr *attr) -{ - return (attr && attr->value && *attr->value != '\0'); -} - -/** Check whether specified attribute is enabled (true) */ -static APR_INLINE apt_bool_t is_attr_enabled(const apr_xml_attr *attr) -{ - if(attr && strcasecmp(attr->value,"false") == 0) { - return FALSE; - } - return TRUE; -} - -/** Check whether cdata is valid */ -static APR_INLINE apt_bool_t is_cdata_valid(const apr_xml_elem *elem) -{ - return (elem->first_cdata.first && elem->first_cdata.first->text); -} - -/** Get text cdata */ -static APR_INLINE const char* cdata_text_get(const apr_xml_elem *elem) -{ - return elem->first_cdata.first->text; -} - -/** Get boolean cdata */ -static APR_INLINE apt_bool_t cdata_bool_get(const apr_xml_elem *elem) -{ - return (strcasecmp(elem->first_cdata.first->text,"true") == 0) ? TRUE : FALSE; -} - -/** Copy cdata */ -static APR_INLINE char* cdata_copy(const apr_xml_elem *elem, apr_pool_t *pool) -{ - return apr_pstrdup(pool,elem->first_cdata.first->text); -} - -/** Get generic "id" and "enable" attributes */ -static apt_bool_t header_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **id, const apr_xml_attr **enable) -{ - const apr_xml_attr *attr; - if(!id || !enable) { - return FALSE; - } - - *id = NULL; - *enable = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"id") == 0) { - *id = attr; - } - else if(strcasecmp(attr->name,"enable") == 0) { - *enable = attr; - } - } - - if(is_attr_valid(*id) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing Required Attribute in Element <%s>",elem->name); - return FALSE; - } - return TRUE; -} - -/** Get generic "name" and "value" attributes */ -static apt_bool_t name_value_attribs_get(const apr_xml_elem *elem, const apr_xml_attr **name, const apr_xml_attr **value) -{ - const apr_xml_attr *attr; - if(!name || !value) { - return FALSE; - } - - *name = NULL; - *value = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"name") == 0) { - *name = attr; - } - else if(strcasecmp(attr->name,"value") == 0) { - *value = attr; - } - } - return (*name && *value) ? TRUE : FALSE; -} - -static char* unimrcp_server_ip_address_get(unimrcp_server_loader_t *loader, const apr_xml_elem *elem) -{ - const apr_xml_attr *attr = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"type") == 0) { - break; - } - } - - if(attr && strcasecmp(attr->value,"auto") == 0) { - /* implicitly detect IP address, if not already detected */ - if(!loader->auto_ip) { - char *auto_addr = DEFAULT_IP_ADDRESS; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Detecting IP Address"); - apt_ip_get(&auto_addr,loader->pool); - loader->auto_ip = auto_addr; - } - return apr_pstrdup(loader->pool,loader->auto_ip); - } - else if(attr && strcasecmp(attr->value,"iface") == 0) { - /* get IP address by network interface name */ - char *ip_addr = DEFAULT_IP_ADDRESS; - if(is_cdata_valid(elem) == TRUE) { - const char *iface_name = cdata_text_get(elem); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Get IP Address by Interface [%s]", iface_name); - apt_ip_get_by_iface(iface_name,&ip_addr,loader->pool); - } - return ip_addr; - } - - if(is_cdata_valid(elem)) { - /* use provided IP address */ - return cdata_copy(elem,loader->pool); - } - - /* use default IP address */ - return apr_pstrdup(loader->pool,loader->ip); -} - -/** Load resource */ -static apt_bool_t unimrcp_server_resource_load(mrcp_resource_loader_t *resource_loader, const apr_xml_elem *root, apr_pool_t *pool) -{ - apt_str_t resource_class; - const apr_xml_attr *id_attr; - const apr_xml_attr *enable_attr; - apt_string_reset(&resource_class); - - if(header_attribs_get(root,&id_attr,&enable_attr) == FALSE) { - return FALSE; - } - - if(is_attr_enabled(enable_attr) == FALSE) { - return TRUE; - } - - apt_string_set(&resource_class,id_attr->value); - return mrcp_resource_load(resource_loader,&resource_class); -} - -/** Load resource factory */ -static apt_bool_t unimrcp_server_resource_factory_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - mrcp_resource_factory_t *resource_factory; - mrcp_resource_loader_t *resource_loader = mrcp_resource_loader_create(FALSE,loader->pool); - if(!resource_loader) { - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resources"); - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"resource") == 0) { - unimrcp_server_resource_load(resource_loader,elem,loader->pool); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - resource_factory = mrcp_resource_factory_get(resource_loader); - return mrcp_server_resource_factory_register(loader->server,resource_factory); -} - -/** Load SofiaSIP signaling agent */ -static apt_bool_t unimrcp_server_sip_uas_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_sig_agent_t *agent; - mrcp_sofia_server_config_t *config; - - config = mrcp_sofiasip_server_config_alloc(loader->pool); - config->local_port = DEFAULT_SIP_PORT; - config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME; - config->origin = DEFAULT_SDP_ORIGIN; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading SofiaSIP Agent <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"sip-ip") == 0) { - config->local_ip = unimrcp_server_ip_address_get(loader,elem); - } - else if(strcasecmp(elem->name,"sip-ext-ip") == 0) { - config->ext_ip = unimrcp_server_ip_address_get(loader,elem); - } - else if(strcasecmp(elem->name,"sip-port") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->local_port = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-transport") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->transport = cdata_copy(elem,loader->pool); - } - } - else if(strcasecmp(elem->name,"ua-name") == 0) { - if(is_cdata_valid(elem) == TRUE) { - const apr_xml_attr *attr = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"appendversion") == 0) { - break; - } - } - if(is_attr_enabled(attr)) { - config->user_agent_name = apr_psprintf(loader->pool,"%s "UNI_VERSION_STRING,cdata_text_get(elem)); - } - else { - config->user_agent_name = cdata_copy(elem,loader->pool); - } - } - } - else if(strcasecmp(elem->name,"sdp-origin") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->origin = cdata_copy(elem,loader->pool); - } - } - else if(strcasecmp(elem->name,"force-destination") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->force_destination = cdata_bool_get(elem); - } - } - else if(strcasecmp(elem->name,"sip-t1") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->sip_t1 = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-t2") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->sip_t2 = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-t4") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->sip_t4 = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-t1x64") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->sip_t1x64 = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sip-message-output") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->tport_log = cdata_bool_get(elem); - } - } - else if(strcasecmp(elem->name,"sip-message-dump") == 0) { - if(is_cdata_valid(elem) == TRUE) { - const char *root_path; - const char *path = cdata_text_get(elem); - if(loader->dir_layout && apr_filepath_root(&root_path,&path,0,loader->pool) == APR_ERELATIVE) - config->tport_dump_file = apt_dir_layout_path_compose( - loader->dir_layout, - APT_LAYOUT_LOG_DIR, - path, - loader->pool); - else - config->tport_dump_file = cdata_copy(elem,loader->pool); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(!config->local_ip) { - /* use default IP address if not specified */ - config->local_ip = apr_pstrdup(loader->pool,loader->ip); - } - if(!config->ext_ip && loader->ext_ip) { - /* use default ext IP address if not specified */ - config->ext_ip = apr_pstrdup(loader->pool,loader->ext_ip); - } - - agent = mrcp_sofiasip_server_agent_create(id,config,loader->pool); - return mrcp_server_signaling_agent_register(loader->server,agent); -} - -/** Load UniRTSP signaling agent */ -static apt_bool_t unimrcp_server_rtsp_uas_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_sig_agent_t *agent; - rtsp_server_config_t *config; - - config = mrcp_unirtsp_server_config_alloc(loader->pool); - config->origin = DEFAULT_SDP_ORIGIN; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading UniRTSP Agent <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"rtsp-ip") == 0) { - config->local_ip = unimrcp_server_ip_address_get(loader,elem); - } - else if(strcasecmp(elem->name,"rtsp-port") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->local_port = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"sdp-origin") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->origin = cdata_copy(elem,loader->pool); - } - } - else if(strcasecmp(elem->name,"max-connection-count") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->max_connection_count = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"force-destination") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->force_destination = cdata_bool_get(elem); - } - } - else if(strcasecmp(elem->name,"resource-map") == 0) { - const apr_xml_attr *name_attr; - const apr_xml_attr *value_attr; - const apr_xml_elem *child_elem; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Resource Map"); - for(child_elem = elem->first_child; child_elem; child_elem = child_elem->next) { - if(name_value_attribs_get(child_elem,&name_attr,&value_attr) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",name_attr->value,value_attr->value); - apr_table_set(config->resource_map,name_attr->value,value_attr->value); - } - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(!config->local_ip) { - /* use default IP address if not specified */ - config->local_ip = apr_pstrdup(loader->pool,loader->ip); - } - - agent = mrcp_unirtsp_server_agent_create(id,config,loader->pool); - return mrcp_server_signaling_agent_register(loader->server,agent); -} - -/** Load MRCPv2 connection agent */ -static apt_bool_t unimrcp_server_mrcpv2_uas_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_connection_agent_t *agent; - char *mrcp_ip = NULL; - apr_port_t mrcp_port = DEFAULT_MRCP_PORT; - apr_size_t max_connection_count = 100; - apt_bool_t force_new_connection = FALSE; - apr_size_t rx_buffer_size = 0; - apr_size_t tx_buffer_size = 0; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Agent <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"mrcp-ip") == 0) { - mrcp_ip = unimrcp_server_ip_address_get(loader,elem); - } - else if(strcasecmp(elem->name,"mrcp-port") == 0) { - if(is_cdata_valid(elem) == TRUE) { - mrcp_port = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"max-connection-count") == 0) { - if(is_cdata_valid(elem) == TRUE) { - max_connection_count = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"force-new-connection") == 0) { - if(is_cdata_valid(elem) == TRUE) { - force_new_connection = cdata_bool_get(elem); - } - } - else if(strcasecmp(elem->name,"rx-buffer-size") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rx_buffer_size = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"tx-buffer-size") == 0) { - if(is_cdata_valid(elem) == TRUE) { - tx_buffer_size = atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(!mrcp_ip) { - /* use default IP address if not specified */ - mrcp_ip = apr_pstrdup(loader->pool,loader->ip); - } - - agent = mrcp_server_connection_agent_create(id,mrcp_ip,mrcp_port,max_connection_count,force_new_connection,loader->pool); - if(agent) { - if(rx_buffer_size) { - mrcp_server_connection_rx_size_set(agent,rx_buffer_size); - } - if(tx_buffer_size) { - mrcp_server_connection_tx_size_set(agent,tx_buffer_size); - } - } - return mrcp_server_connection_agent_register(loader->server,agent); -} - -/** Load media engine */ -static apt_bool_t unimrcp_server_media_engine_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mpf_engine_t *media_engine; - unsigned long realtime_rate = 1; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Media Engine <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"realtime-rate") == 0) { - if(is_cdata_valid(elem) == TRUE) { - realtime_rate = atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - media_engine = mpf_engine_create(id,loader->pool); - if(media_engine) { - mpf_engine_scheduler_rate_set(media_engine,realtime_rate); - } - return mrcp_server_media_engine_register(loader->server,media_engine); -} - -/** Load RTP factory */ -static apt_bool_t unimrcp_server_rtp_factory_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - char *rtp_ip = NULL; - char *rtp_ext_ip = NULL; - mpf_termination_factory_t *rtp_factory; - mpf_rtp_config_t *rtp_config; - - rtp_config = mpf_rtp_config_alloc(loader->pool); - rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN; - rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Factory <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"rtp-ip") == 0) { - rtp_ip = unimrcp_server_ip_address_get(loader,elem); - } - else if(strcasecmp(elem->name,"rtp-ext-ip") == 0) { - rtp_ext_ip = unimrcp_server_ip_address_get(loader,elem); - } - else if(strcasecmp(elem->name,"rtp-port-min") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtp_config->rtp_port_min = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"rtp-port-max") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtp_config->rtp_port_max = (apr_port_t)atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - if(rtp_ip) { - apt_string_set(&rtp_config->ip,rtp_ip); - } - else { - apt_string_set(&rtp_config->ip,loader->ip); - } - if(rtp_ext_ip) { - apt_string_set(&rtp_config->ext_ip,rtp_ext_ip); - } - else if(loader->ext_ip){ - apt_string_set(&rtp_config->ext_ip,loader->ext_ip); - } - - rtp_factory = mpf_rtp_termination_factory_create(rtp_config,loader->pool); - return mrcp_server_rtp_factory_register(loader->server,rtp_factory,id); -} - -/** Load plugin */ -static apt_bool_t unimrcp_server_plugin_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root) -{ - mrcp_engine_t *engine; - mrcp_engine_config_t *config; - char *plugin_file_name; - char *plugin_path; - const char *plugin_id = NULL; - const char *plugin_name = NULL; - const char *plugin_ext = NULL; - apt_bool_t plugin_enabled = TRUE; - const apr_xml_attr *attr; - for(attr = root->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"id") == 0) { - plugin_id = apr_pstrdup(loader->pool,attr->value); - } - else if(strcasecmp(attr->name,"name") == 0) { - plugin_name = attr->value; - } - else if(strcasecmp(attr->name,"ext") == 0) { - plugin_ext = attr->value; - } - else if(strcasecmp(attr->name,"enable") == 0) { - plugin_enabled = is_attr_enabled(attr); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Attribute <%s>",attr->name); - } - } - - if(!plugin_id || !plugin_name) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing plugin id or name"); - return FALSE; - } - - if(!plugin_enabled) { - /* disabled plugin, just skip it */ - return TRUE; - } - - if(!plugin_ext) { - plugin_ext = DEFAULT_PLUGIN_EXT; - } - - plugin_file_name = apr_psprintf(loader->pool,"%s.%s",plugin_name,plugin_ext); - plugin_path = apt_dir_layout_path_compose(loader->dir_layout,APT_LAYOUT_PLUGIN_DIR,plugin_file_name,loader->pool); - if(!plugin_path) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to compose plugin path %s",plugin_file_name); - return FALSE; - } - - config = mrcp_engine_config_alloc(loader->pool); - - /* load optional named and generic name/value params */ - if(root->first_child){ - const apr_xml_attr *attr_name; - const apr_xml_attr *attr_value; - const apr_xml_elem *elem; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Engine Params"); - config->params = apr_table_make(loader->pool,1); - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"max-channel-count") == 0) { - if(is_cdata_valid(elem) == TRUE) { - config->max_channel_count = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"param") == 0) { - if(name_value_attribs_get(elem,&attr_name,&attr_value) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value); - apr_table_set(config->params,attr_name->value,attr_value->value); - } - } - } - } - - engine = mrcp_server_engine_load(loader->server,plugin_id,plugin_path,config); - return mrcp_server_engine_register(loader->server,engine); -} - -/** Load plugin (engine) factory */ -static apt_bool_t unimrcp_server_plugin_factory_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Plugin Factory"); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"engine") == 0) { - unimrcp_server_plugin_load(loader,elem); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load jitter buffer settings */ -static apt_bool_t unimrcp_server_jb_settings_load(unimrcp_server_loader_t *loader, mpf_jb_config_t *jb, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Jitter Buffer Settings"); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"playout-delay") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->initial_playout_delay = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"min-playout-delay") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->min_playout_delay = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"max-playout-delay") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->max_playout_delay = atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"adaptive") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->adaptive = (apr_byte_t) atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"time-skew-detection") == 0) { - if(is_cdata_valid(elem) == TRUE) { - jb->time_skew_detection = (apr_byte_t) atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load RTCP settings */ -static apt_bool_t unimrcp_server_rtcp_settings_load(unimrcp_server_loader_t *loader, mpf_rtp_settings_t *rtcp_settings, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - const apr_xml_attr *attr = NULL; - for(attr = root->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"enable") == 0) { - break; - } - } - - if(is_attr_enabled(attr) == FALSE) { - /* RTCP is disabled, skip the rest */ - return TRUE; - } - - rtcp_settings->rtcp = TRUE; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTCP Settings"); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"rtcp-bye") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtcp_settings->rtcp_bye_policy = atoi(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"tx-interval") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtcp_settings->rtcp_tx_interval = (apr_uint16_t)atoi(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"rx-resolution") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtcp_settings->rtcp_rx_resolution = (apr_uint16_t)atol(cdata_text_get(elem)); - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load RTP settings */ -static apt_bool_t unimrcp_server_rtp_settings_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mpf_rtp_settings_t *rtp_settings = mpf_rtp_settings_alloc(loader->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading RTP Settings <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"jitter-buffer") == 0) { - unimrcp_server_jb_settings_load(loader,&rtp_settings->jb_config,elem); - } - else if(strcasecmp(elem->name,"ptime") == 0) { - if(is_cdata_valid(elem) == TRUE) { - rtp_settings->ptime = (apr_uint16_t)atol(cdata_text_get(elem)); - } - } - else if(strcasecmp(elem->name,"codecs") == 0) { - const apr_xml_attr *attr; - const mpf_codec_manager_t *codec_manager = mrcp_server_codec_manager_get(loader->server); - if(is_cdata_valid(elem) == TRUE && codec_manager) { - mpf_codec_manager_codec_list_load( - codec_manager, - &rtp_settings->codec_list, - cdata_text_get(elem), - loader->pool); - } - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"own-preference") == 0) { - rtp_settings->own_preferrence = is_attr_enabled(attr); - break; - } - } - } - else if(strcasecmp(elem->name,"rtcp") == 0) { - unimrcp_server_rtcp_settings_load(loader,rtp_settings,elem); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - return mrcp_server_rtp_settings_register(loader->server,rtp_settings,id); -} - -/** Load map of resources and engines */ -static apr_table_t* resource_engine_map_load(const apr_xml_elem *root, apr_pool_t *pool) -{ - const apr_xml_attr *attr_name; - const apr_xml_attr *attr_value; - const apr_xml_elem *elem; - apr_table_t *plugin_map = apr_table_make(pool,2); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Plugin Map"); - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"param") == 0) { - if(name_value_attribs_get(elem,&attr_name,&attr_value) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Param %s:%s",attr_name->value,attr_value->value); - apr_table_set(plugin_map,attr_name->value,attr_value->value); - } - } - } - return plugin_map; -} - -/** Load MRCPv2 profile */ -static apt_bool_t unimrcp_server_mrcpv2_profile_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_server_profile_t *profile; - mrcp_sig_agent_t *sip_agent = NULL; - mrcp_connection_agent_t *mrcpv2_agent = NULL; - mpf_engine_t *media_engine = NULL; - mpf_termination_factory_t *rtp_factory = NULL; - mpf_rtp_settings_t *rtp_settings = NULL; - apr_table_t *resource_engine_map = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv2 Profile <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - - if(is_cdata_valid(elem) == FALSE) { - continue; - } - - if(strcasecmp(elem->name,"sip-uas") == 0) { - sip_agent = mrcp_server_signaling_agent_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"mrcpv2-uas") == 0) { - mrcpv2_agent = mrcp_server_connection_agent_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"media-engine") == 0) { - media_engine = mrcp_server_media_engine_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"rtp-factory") == 0) { - rtp_factory = mrcp_server_rtp_factory_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"rtp-settings") == 0) { - rtp_settings = mrcp_server_rtp_settings_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"resource-engine-map") == 0) { - resource_engine_map = resource_engine_map_load(elem,loader->pool); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv2 Profile [%s]",id); - profile = mrcp_server_profile_create( - id, - MRCP_VERSION_2, - NULL, - sip_agent, - mrcpv2_agent, - media_engine, - rtp_factory, - rtp_settings, - loader->pool); - return mrcp_server_profile_register(loader->server,profile,resource_engine_map); -} - -/** Load MRCPv1 profile */ -static apt_bool_t unimrcp_server_mrcpv1_profile_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root, const char *id) -{ - const apr_xml_elem *elem; - mrcp_server_profile_t *profile; - mrcp_sig_agent_t *rtsp_agent = NULL; - mpf_engine_t *media_engine = NULL; - mpf_termination_factory_t *rtp_factory = NULL; - mpf_rtp_settings_t *rtp_settings = NULL; - apr_table_t *resource_engine_map = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading MRCPv1 Profile <%s>",id); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - - if(is_cdata_valid(elem) == FALSE) { - continue; - } - - if(strcasecmp(elem->name,"rtsp-uas") == 0) { - rtsp_agent = mrcp_server_signaling_agent_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"media-engine") == 0) { - media_engine = mrcp_server_media_engine_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"rtp-factory") == 0) { - rtp_factory = mrcp_server_rtp_factory_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"rtp-settings") == 0) { - rtp_settings = mrcp_server_rtp_settings_get(loader->server,cdata_text_get(elem)); - } - else if(strcasecmp(elem->name,"resource-engine-map") == 0) { - resource_engine_map = resource_engine_map_load(elem,loader->pool); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create MRCPv1 Profile [%s]",id); - profile = mrcp_server_profile_create( - id, - MRCP_VERSION_1, - NULL, - rtsp_agent, - NULL, - media_engine, - rtp_factory, - rtp_settings, - loader->pool); - return mrcp_server_profile_register(loader->server,profile,resource_engine_map); -} - - -/** Load properties */ -static apt_bool_t unimrcp_server_properties_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Properties"); - for(elem = root->first_child; elem; elem = elem->next) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Element <%s>",elem->name); - if(strcasecmp(elem->name,"ip") == 0) { - loader->ip = unimrcp_server_ip_address_get(loader,elem); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property ip:%s",loader->ip); - } - else if(strcasecmp(elem->name,"ext-ip") == 0) { - loader->ext_ip = unimrcp_server_ip_address_get(loader,elem); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Property ext-ip:%s",loader->ext_ip); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load components */ -static apt_bool_t unimrcp_server_components_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - const apr_xml_attr *id_attr; - const apr_xml_attr *enable_attr; - const char *id; - - /* Create codec manager first (probably it should be loaded from config either) */ - mpf_codec_manager_t *codec_manager = mpf_engine_codec_manager_create(loader->pool); - if(codec_manager) { - mrcp_server_codec_manager_register(loader->server,codec_manager); - } - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Components"); - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"resource-factory") == 0) { - unimrcp_server_resource_factory_load(loader,elem); - continue; - } - if(strcasecmp(elem->name,"plugin-factory") == 0) { - unimrcp_server_plugin_factory_load(loader,elem); - continue; - } - - /* get common "id" and "enable" attributes */ - if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) { - /* invalid id */ - continue; - } - if(is_attr_enabled(enable_attr) == FALSE) { - /* disabled element, just skip it */ - continue; - } - id = apr_pstrdup(loader->pool,id_attr->value); - - if(strcasecmp(elem->name,"sip-uas") == 0) { - unimrcp_server_sip_uas_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"rtsp-uas") == 0) { - unimrcp_server_rtsp_uas_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"mrcpv2-uas") == 0) { - unimrcp_server_mrcpv2_uas_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"media-engine") == 0) { - unimrcp_server_media_engine_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"rtp-factory") == 0) { - unimrcp_server_rtp_factory_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"plugin-factory") == 0) { - unimrcp_server_plugin_factory_load(loader,elem); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load settings */ -static apt_bool_t unimrcp_server_settings_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - const apr_xml_attr *id_attr; - const apr_xml_attr *enable_attr; - const char *id; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Settings"); - for(elem = root->first_child; elem; elem = elem->next) { - /* get common "id" and "enable" attributes */ - if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) { - /* invalid id */ - continue; - } - if(is_attr_enabled(enable_attr) == FALSE) { - /* disabled element, just skip it */ - continue; - } - id = apr_pstrdup(loader->pool,id_attr->value); - - if(strcasecmp(elem->name,"rtp-settings") == 0) { - unimrcp_server_rtp_settings_load(loader,elem,id); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load profiles */ -static apt_bool_t unimrcp_server_profiles_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - const apr_xml_attr *id_attr; - const apr_xml_attr *enable_attr; - const char *id; - - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Profiles"); - for(elem = root->first_child; elem; elem = elem->next) { - /* get common "id" and "enable" attributes */ - if(header_attribs_get(elem,&id_attr,&enable_attr) == FALSE) { - /* invalid id */ - continue; - } - if(is_attr_enabled(enable_attr) == FALSE) { - /* disabled element, just skip it */ - continue; - } - id = apr_pstrdup(loader->pool,id_attr->value); - - if(strcasecmp(elem->name,"mrcpv2-profile") == 0) { - unimrcp_server_mrcpv2_profile_load(loader,elem,id); - } - else if(strcasecmp(elem->name,"mrcpv1-profile") == 0) { - unimrcp_server_mrcpv1_profile_load(loader,elem,id); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Load misc parameters */ -static apt_bool_t unimrcp_server_misc_load(unimrcp_server_loader_t *loader, const apr_xml_elem *root) -{ - const apr_xml_elem *elem; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Loading Misc Parameters"); - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"sofiasip-logger") == 0) { - char *logger_list_str; - char *logger_name; - char *state; - apr_xml_attr *attr; - apt_bool_t redirect = FALSE; - const char *loglevel_str = NULL; - for(attr = elem->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"redirect") == 0) { - if(attr->value && strcasecmp(attr->value,"true") == 0) - redirect = TRUE; - } - else if(strcasecmp(attr->name,"loglevel") == 0) { - loglevel_str = attr->value; - } - } - - logger_list_str = apr_pstrdup(loader->pool,cdata_text_get(elem)); - do { - logger_name = apr_strtok(logger_list_str, ",", &state); - if(logger_name) { - mrcp_sofiasip_server_logger_init(logger_name,loglevel_str,redirect); - } - logger_list_str = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - } - while(logger_name); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} - -/** Parse XML document */ -static apr_xml_doc* unimrcp_server_doc_parse(const char *file_path, apr_pool_t *pool) -{ - apr_xml_parser *parser = NULL; - apr_xml_doc *xml_doc = NULL; - apr_file_t *fd = NULL; - apr_status_t rv; - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Open Config File [%s]",file_path); - rv = apr_file_open(&fd,file_path,APR_READ|APR_BINARY,0,pool); - if(rv != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Config File [%s]",file_path); - return NULL; - } - - rv = apr_xml_parse_file(pool,&parser,&xml_doc,fd,XML_FILE_BUFFER_LENGTH); - if(rv != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse Config File [%s]",file_path); - xml_doc = NULL; - } - - apr_file_close(fd); - return xml_doc; -} - -static apt_bool_t unimrcp_server_load(mrcp_server_t *mrcp_server, apt_dir_layout_t *dir_layout, apr_pool_t *pool) -{ - const char *file_path; - apr_xml_doc *doc; - const apr_xml_elem *elem; - const apr_xml_elem *root; - const apr_xml_attr *attr; - unimrcp_server_loader_t *loader; - const char *version = NULL; - - file_path = apt_confdir_filepath_get(dir_layout,CONF_FILE_NAME,pool); - if(!file_path) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Path to Conf File [%s]",CONF_FILE_NAME); - return FALSE; - } - - /* Parse XML document */ - doc = unimrcp_server_doc_parse(file_path,pool); - if(!doc) { - return FALSE; - } - - root = doc->root; - - /* Match document name */ - if(!root || strcasecmp(root->name,"unimrcpserver") != 0) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document <%s>",root ? root->name : "null"); - return FALSE; - } - - /* Read attributes */ - for(attr = root->attr; attr; attr = attr->next) { - if(strcasecmp(attr->name,"version") == 0) { - version = attr->value; - } - } - - /* Check version number first */ - if(!version) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Version"); - return FALSE; - } - - loader = apr_palloc(pool,sizeof(unimrcp_server_loader_t)); - loader->doc = doc; - loader->server = mrcp_server; - loader->dir_layout = dir_layout; - loader->pool = pool; - loader->ip = DEFAULT_IP_ADDRESS; - loader->ext_ip = NULL; - loader->auto_ip = NULL; - - /* Navigate through document */ - for(elem = root->first_child; elem; elem = elem->next) { - if(strcasecmp(elem->name,"properties") == 0) { - unimrcp_server_properties_load(loader,elem); - } - else if(strcasecmp(elem->name,"components") == 0) { - unimrcp_server_components_load(loader,elem); - } - else if(strcasecmp(elem->name,"settings") == 0) { - unimrcp_server_settings_load(loader,elem); - } - else if(strcasecmp(elem->name,"profiles") == 0) { - unimrcp_server_profiles_load(loader,elem); - } - else if(strcasecmp(elem->name,"misc") == 0) { - unimrcp_server_misc_load(loader,elem); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",elem->name); - } - } - return TRUE; -} diff --git a/libs/unimrcp/platforms/umc/Makefile.am b/libs/unimrcp/platforms/umc/Makefile.am deleted file mode 100644 index 5b41d43e2d..0000000000 --- a/libs/unimrcp/platforms/umc/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/platforms/umc/include \ - $(UNIMRCP_CLIENTAPP_INCLUDES) - -bin_PROGRAMS = umc - -umc_SOURCES = src/main.cpp \ - src/umcconsole.cpp \ - src/umcframework.cpp \ - src/umcscenario.cpp \ - src/umcsession.cpp \ - src/synthscenario.cpp \ - src/synthsession.cpp \ - src/recogscenario.cpp \ - src/recogsession.cpp \ - src/recorderscenario.cpp \ - src/recordersession.cpp \ - src/dtmfscenario.cpp \ - src/dtmfsession.cpp \ - src/setparamscenario.cpp \ - src/setparamsession.cpp \ - src/verifierscenario.cpp \ - src/verifiersession.cpp -umc_LDADD = $(UNIMRCP_CLIENTAPP_LIBS) -umc_LDFLAGS = $(UNIMRCP_CLIENTAPP_OPTS) - -include $(top_srcdir)/build/rules/uniclientapp.am diff --git a/libs/unimrcp/platforms/umc/include/dtmfscenario.h b/libs/unimrcp/platforms/umc/include/dtmfscenario.h deleted file mode 100644 index 7847ab3237..0000000000 --- a/libs/unimrcp/platforms/umc/include/dtmfscenario.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: dtmfscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef DTMF_SCENARIO_H -#define DTMF_SCENARIO_H - -/** - * @file dtmfscenario.h - * @brief DTMF Recognition Scenario - */ - -#include "umcscenario.h" - -class DtmfScenario : public UmcScenario -{ -public: -/* ============================ CREATORS =================================== */ - DtmfScenario(); - virtual ~DtmfScenario(); - -/* ============================ MANIPULATORS =============================== */ - virtual void Destroy(); - - virtual UmcSession* CreateSession(); - -/* ============================ ACCESSORS ================================== */ - const char* GetContentType() const; - const char* GetGrammar() const; - const char* GetDigits() const; - -/* ============================ INQUIRIES ================================== */ - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool); - - bool LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool); - -/* ============================ DATA ======================================= */ - const char* m_ContentType; - const char* m_Grammar; - const char* m_Digits; -}; - -/* ============================ INLINE METHODS ============================= */ -inline const char* DtmfScenario::GetContentType() const -{ - return m_ContentType; -} - -inline const char* DtmfScenario::GetGrammar() const -{ - return m_Grammar; -} - -inline const char* DtmfScenario::GetDigits() const -{ - return m_Digits; -} - - -#endif /* DTMF_SCENARIO_H */ diff --git a/libs/unimrcp/platforms/umc/include/dtmfsession.h b/libs/unimrcp/platforms/umc/include/dtmfsession.h deleted file mode 100644 index 4093fff43c..0000000000 --- a/libs/unimrcp/platforms/umc/include/dtmfsession.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: dtmfsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef DTMF_SESSION_H -#define DTMF_SESSION_H - -/** - * @file dtmfsession.h - * @brief DTMF Recognition Session - */ - -#include "umcsession.h" - -class DtmfScenario; -struct RecogChannel; - -class DtmfSession : public UmcSession -{ -public: -/* ============================ CREATORS =================================== */ - DtmfSession(const DtmfScenario* pScenario); - virtual ~DtmfSession(); - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool Start(); - - RecogChannel* CreateRecogChannel(); - bool StartRecognition(mrcp_channel_t* pMrcpChannel); - - mrcp_message_t* CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel); - - static bool ParseNLSMLResult(mrcp_message_t* pMrcpMessage); - -/* ============================ HANDLERS =================================== */ - virtual bool OnSessionTerminate(mrcp_sig_status_code_e status); - virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status); - virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message); - -/* ============================ ACCESSORS ================================== */ - const DtmfScenario* GetScenario() const; - -private: -/* ============================ DATA ======================================= */ - RecogChannel* m_pRecogChannel; -}; - - -/* ============================ INLINE METHODS ============================= */ -inline const DtmfScenario* DtmfSession::GetScenario() const -{ - return (DtmfScenario*)m_pScenario; -} - -#endif /* DTMF_SESSION_H */ diff --git a/libs/unimrcp/platforms/umc/include/recogscenario.h b/libs/unimrcp/platforms/umc/include/recogscenario.h deleted file mode 100644 index 6d40ebfe9e..0000000000 --- a/libs/unimrcp/platforms/umc/include/recogscenario.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: recogscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RECOG_SCENARIO_H -#define RECOG_SCENARIO_H - -/** - * @file recogscenario.h - * @brief Recognizer Scenario - */ - -#include "umcscenario.h" - -class RecogScenario : public UmcScenario -{ -public: -/* ============================ CREATORS =================================== */ - RecogScenario(); - virtual ~RecogScenario(); - -/* ============================ MANIPULATORS =============================== */ - virtual void Destroy(); - - virtual UmcSession* CreateSession(); - -/* ============================ ACCESSORS ================================== */ - const char* GetContentType() const; - const char* GetContent() const; - apr_size_t GetContentLength() const; - const char* GetAudioSource() const; - -/* ============================ INQUIRIES ================================== */ - bool IsDefineGrammarEnabled() const; - bool IsRecognizeEnabled() const; -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool); - - bool LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool); - bool LoadDefineGrammar(const apr_xml_elem* pElem, apr_pool_t* pool); - -/* ============================ DATA ======================================= */ - bool m_DefineGrammar; - bool m_Recognize; - const char* m_ContentType; - const char* m_Content; - apr_size_t m_ContentLength; - const char* m_AudioSource; -}; - -/* ============================ INLINE METHODS ============================= */ -inline const char* RecogScenario::GetContentType() const -{ - return m_ContentType; -} - -inline const char* RecogScenario::GetContent() const -{ - return m_Content; -} - -inline apr_size_t RecogScenario::GetContentLength() const -{ - return m_ContentLength; -} - -inline const char* RecogScenario::GetAudioSource() const -{ - return m_AudioSource; -} - -inline bool RecogScenario::IsDefineGrammarEnabled() const -{ - return m_DefineGrammar; -} - -inline bool RecogScenario::IsRecognizeEnabled() const -{ - return m_Recognize; -} - -#endif /* RECOG_SCENARIO_H */ diff --git a/libs/unimrcp/platforms/umc/include/recogsession.h b/libs/unimrcp/platforms/umc/include/recogsession.h deleted file mode 100644 index 02ba2a7f1d..0000000000 --- a/libs/unimrcp/platforms/umc/include/recogsession.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: recogsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RECOG_SESSION_H -#define RECOG_SESSION_H - -/** - * @file recogsession.h - * @brief Recognizer Session - */ - -#include "umcsession.h" - -class RecogScenario; -struct RecogChannel; - -class RecogSession : public UmcSession -{ -public: -/* ============================ CREATORS =================================== */ - RecogSession(const RecogScenario* pScenario); - virtual ~RecogSession(); - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool Start(); - virtual bool Stop(); - - RecogChannel* CreateRecogChannel(); - bool StartRecognition(mrcp_channel_t* pMrcpChannel); - bool OnDefineGrammar(mrcp_channel_t* pMrcpChannel); - - mrcp_message_t* CreateDefineGrammarRequest(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel); - - static bool ParseNLSMLResult(mrcp_message_t* pMrcpMessage); - FILE* GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const; - -/* ============================ HANDLERS =================================== */ - virtual bool OnSessionTerminate(mrcp_sig_status_code_e status); - virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status); - virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message); - -/* ============================ ACCESSORS ================================== */ - const RecogScenario* GetScenario() const; - -private: -/* ============================ DATA ======================================= */ - RecogChannel* m_pRecogChannel; - const char* m_ContentId; -}; - - -/* ============================ INLINE METHODS ============================= */ -inline const RecogScenario* RecogSession::GetScenario() const -{ - return (RecogScenario*)m_pScenario; -} - -#endif /* RECOG_SESSION_H */ diff --git a/libs/unimrcp/platforms/umc/include/recorderscenario.h b/libs/unimrcp/platforms/umc/include/recorderscenario.h deleted file mode 100644 index 4a1f283c23..0000000000 --- a/libs/unimrcp/platforms/umc/include/recorderscenario.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: recorderscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RECORDER_SCENARIO_H -#define RECORDER_SCENARIO_H - -/** - * @file recorderscenario.h - * @brief Recorder Scenario - */ - -#include "umcscenario.h" - -class RecorderScenario : public UmcScenario -{ -public: -/* ============================ CREATORS =================================== */ - RecorderScenario(); - virtual ~RecorderScenario(); - -/* ============================ MANIPULATORS =============================== */ - virtual void Destroy(); - - virtual UmcSession* CreateSession(); - -/* ============================ ACCESSORS ================================== */ - const char* GetAudioSource() const; - -/* ============================ INQUIRIES ================================== */ - bool IsRecordEnabled() const; -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool); - - bool LoadRecord(const apr_xml_elem* pElem, apr_pool_t* pool); - -/* ============================ DATA ======================================= */ - bool m_Record; - const char* m_AudioSource; -}; - -/* ============================ INLINE METHODS ============================= */ -inline const char* RecorderScenario::GetAudioSource() const -{ - return m_AudioSource; -} - -inline bool RecorderScenario::IsRecordEnabled() const -{ - return m_Record; -} - -#endif /* RECORDER_SCENARIO_H */ diff --git a/libs/unimrcp/platforms/umc/include/recordersession.h b/libs/unimrcp/platforms/umc/include/recordersession.h deleted file mode 100644 index 31d53c8a45..0000000000 --- a/libs/unimrcp/platforms/umc/include/recordersession.h +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: recordersession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef RECORDER_SESSION_H -#define RECORDER_SESSION_H - -/** - * @file recordersession.h - * @brief Recorder Session - */ - -#include "umcsession.h" - -class RecorderScenario; -struct RecorderChannel; - -class RecorderSession : public UmcSession -{ -public: -/* ============================ CREATORS =================================== */ - RecorderSession(const RecorderScenario* pScenario); - virtual ~RecorderSession(); - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool Start(); - - RecorderChannel* CreateRecorderChannel(); - bool StartRecorder(mrcp_channel_t* pMrcpChannel); - - mrcp_message_t* CreateRecordRequest(mrcp_channel_t* pMrcpChannel); - - FILE* GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const; - -/* ============================ HANDLERS =================================== */ - virtual bool OnSessionTerminate(mrcp_sig_status_code_e status); - virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status); - virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message); - -/* ============================ ACCESSORS ================================== */ - const RecorderScenario* GetScenario() const; - -private: -/* ============================ DATA ======================================= */ - RecorderChannel* m_pRecorderChannel; -}; - - -/* ============================ INLINE METHODS ============================= */ -inline const RecorderScenario* RecorderSession::GetScenario() const -{ - return (RecorderScenario*)m_pScenario; -} - -#endif /* RECORDER_SESSION_H */ diff --git a/libs/unimrcp/platforms/umc/include/setparamscenario.h b/libs/unimrcp/platforms/umc/include/setparamscenario.h deleted file mode 100644 index bc1ad0ed89..0000000000 --- a/libs/unimrcp/platforms/umc/include/setparamscenario.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: setparamscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef SETPARAM_SCENARIO_H -#define SETPARAM_SCENARIO_H - -/** - * @file setaparamscenario.h - * @brief Set Params Scenario - */ - -#include "umcscenario.h" - -class SetParamScenario : public UmcScenario -{ -public: -/* ============================ CREATORS =================================== */ - -/* ============================ MANIPULATORS =============================== */ - - virtual UmcSession* CreateSession(); - -/* ============================ ACCESSORS ================================== */ - -/* ============================ INQUIRIES ================================== */ -protected: -/* ============================ MANIPULATORS =============================== */ - -/* ============================ DATA ======================================= */ -}; - -/* ============================ INLINE METHODS ============================= */ - -#endif /* SETPARAM_SCENARIO_H */ diff --git a/libs/unimrcp/platforms/umc/include/setparamsession.h b/libs/unimrcp/platforms/umc/include/setparamsession.h deleted file mode 100644 index 16754f309f..0000000000 --- a/libs/unimrcp/platforms/umc/include/setparamsession.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: setparamsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef SETPARAM_SESSION_H -#define SETPARAM_SESSION_H - -/** - * @file setparamsession.h - * @brief Set Recognizer Params - */ - -#include -#include "umcsession.h" - -class SetParamScenario; -struct RecogChannel; - -class SetParamSession : public UmcSession -{ -public: -/* ============================ CREATORS =================================== */ - SetParamSession(const SetParamScenario* pScenario); - virtual ~SetParamSession(); - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool Start(); - - RecogChannel* CreateRecogChannel(); - - bool CreateRequestQueue(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateSetParams1(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateGetParams1(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateSetParams2(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateGetParams2(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateSetParams3(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateGetParams3(mrcp_channel_t* pMrcpChannel); - - bool ProcessNextRequest(mrcp_channel_t* pMrcpChannel); - -/* ============================ HANDLERS =================================== */ - virtual bool OnSessionTerminate(mrcp_sig_status_code_e status); - virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status); - virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message); - -/* ============================ ACCESSORS ================================== */ - const SetParamScenario* GetScenario() const; - -private: -/* ============================ DATA ======================================= */ - RecogChannel* m_pRecogChannel; - apr_array_header_t* m_RequestQueue; - int m_CurrentRequest; -}; - - -/* ============================ INLINE METHODS ============================= */ -inline const SetParamScenario* SetParamSession::GetScenario() const -{ - return (SetParamScenario*)m_pScenario; -} - -#endif /* SETPARAM_SESSION_H */ diff --git a/libs/unimrcp/platforms/umc/include/synthscenario.h b/libs/unimrcp/platforms/umc/include/synthscenario.h deleted file mode 100644 index 120afc7854..0000000000 --- a/libs/unimrcp/platforms/umc/include/synthscenario.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: synthscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef SYNTH_SCENARIO_H -#define SYNTH_SCENARIO_H - -/** - * @file synthscenario.h - * @brief Synthesizer Scenario - */ - -#include "umcscenario.h" - -class SynthScenario : public UmcScenario -{ -public: -/* ============================ CREATORS =================================== */ - SynthScenario(); - virtual ~SynthScenario(); - -/* ============================ MANIPULATORS =============================== */ - virtual void Destroy(); - - virtual UmcSession* CreateSession(); - -/* ============================ ACCESSORS ================================== */ - const char* GetContentType() const; - const char* GetContent() const; - -/* ============================ INQUIRIES ================================== */ - bool IsSpeakEnabled() const; - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool); - - bool LoadSpeak(const apr_xml_elem* pElem, apr_pool_t* pool); - -/* ============================ DATA ======================================= */ - bool m_Speak; - const char* m_ContentType; - const char* m_Content; -}; - -/* ============================ INLINE METHODS ============================= */ -inline const char* SynthScenario::GetContentType() const -{ - return m_ContentType; -} - -inline const char* SynthScenario::GetContent() const -{ - return m_Content; -} - -inline bool SynthScenario::IsSpeakEnabled() const -{ - return m_Speak; -} - -#endif /* SYNTH_SCENARIO_H */ diff --git a/libs/unimrcp/platforms/umc/include/synthsession.h b/libs/unimrcp/platforms/umc/include/synthsession.h deleted file mode 100644 index d980431af8..0000000000 --- a/libs/unimrcp/platforms/umc/include/synthsession.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: synthsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef SYNTH_SESSION_H -#define SYNTH_SESSION_H - -/** - * @file synthsession.h - * @brief Synthesizer Session - */ - -#include "umcsession.h" - -class SynthScenario; -struct SynthChannel; - -class SynthSession : public UmcSession -{ -public: -/* ============================ CREATORS =================================== */ - SynthSession(const SynthScenario* pScenario); - virtual ~SynthSession(); - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool Start(); - virtual bool Stop(); - - SynthChannel* CreateSynthChannel(); - - mrcp_message_t* CreateSpeakRequest(mrcp_channel_t* pMrcpChannel); - FILE* GetAudioOut(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const; - -/* ============================ HANDLERS =================================== */ - virtual bool OnSessionTerminate(mrcp_sig_status_code_e status); - virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status); - virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message); - -/* ============================ ACCESSORS ================================== */ - const SynthScenario* GetScenario() const; - -private: -/* ============================ DATA ======================================= */ - SynthChannel* m_pSynthChannel; -}; - - -/* ============================ INLINE METHODS ============================= */ -inline const SynthScenario* SynthSession::GetScenario() const -{ - return (SynthScenario*)m_pScenario; -} - -#endif /* SYNTH_SESSION_H */ diff --git a/libs/unimrcp/platforms/umc/include/umcconsole.h b/libs/unimrcp/platforms/umc/include/umcconsole.h deleted file mode 100644 index 06dc221309..0000000000 --- a/libs/unimrcp/platforms/umc/include/umcconsole.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: umcconsole.h 2197 2014-10-16 01:34:19Z achaloyan@gmail.com $ - */ - -#ifndef UMC_CONSOLE_H -#define UMC_CONSOLE_H - -/** - * @file umcconsole.h - * @brief UMC Application Console - */ - -#include "apt_log.h" - -class UmcFramework; - -class UmcConsole -{ -public: -/* ============================ CREATORS =================================== */ - UmcConsole(); - ~UmcConsole(); - -/* ============================ MANIPULATORS =============================== */ - bool Run(int argc, const char * const *argv); - -protected: - bool LoadOptions(int argc, const char * const *argv, apr_pool_t *pool); - bool RunCmdLine(); - bool ProcessCmdLine(char* pCmdLine); - static void Usage(); - -private: -/* ============================ DATA ======================================= */ - struct UmcOptions - { - const char* m_RootDirPath; - const char* m_DirLayoutConf; - const char* m_LogPriority; - const char* m_LogOutput; - - UmcOptions() : - m_RootDirPath(NULL), m_DirLayoutConf(NULL), - m_LogPriority(NULL), m_LogOutput(NULL) {} - }; - - UmcOptions m_Options; - UmcFramework* m_pFramework; -}; - -#endif /* UMC_CONSOLE_H */ diff --git a/libs/unimrcp/platforms/umc/include/umcframework.h b/libs/unimrcp/platforms/umc/include/umcframework.h deleted file mode 100644 index fbbb47c441..0000000000 --- a/libs/unimrcp/platforms/umc/include/umcframework.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: umcframework.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef UMC_FRAMEWORK_H -#define UMC_FRAMEWORK_H - -/** - * @file umcframework.h - * @brief UMC Application Framework - */ - -#include -#include -#include "mrcp_application.h" -#include "apt_consumer_task.h" - -class UmcSession; -class UmcScenario; - -class UmcFramework -{ -public: -/* ============================ CREATORS =================================== */ - UmcFramework(); - ~UmcFramework(); - -/* ============================ MANIPULATORS =============================== */ - bool Create(apt_dir_layout_t* pDirLayout, apr_pool_t* pool); - void Destroy(); - - void RunSession(const char* pScenarioName, const char* pProfileName); - void StopSession(const char* id); - void KillSession(const char* id); - - void ShowScenarios(); - void ShowSessions(); - -protected: - bool CreateMrcpClient(); - void DestroyMrcpClient(); - - bool CreateTask(); - void DestroyTask(); - - UmcScenario* CreateScenario(const char* pType); - apr_xml_doc* LoadDocument(); - - bool LoadScenarios(); - void DestroyScenarios(); - - bool ProcessRunRequest(const char* pScenarioName, const char* pProfileName); - void ProcessStopRequest(const char* id); - void ProcessKillRequest(const char* id); - void ProcessShowScenarios(); - void ProcessShowSessions(); - - bool AddSession(UmcSession* pSession); - bool RemoveSession(UmcSession* pSession); - -/* ============================ HANDLERS =================================== */ - friend apt_bool_t UmcProcessMsg(apt_task_t* pTask, apt_task_msg_t* pMsg); - friend void UmcOnStartComplete(apt_task_t* pTask); - friend void UmcOnTerminateComplete(apt_task_t* pTask); - - friend apt_bool_t AppMessageHandler(const mrcp_app_message_t* pAppMessage); - friend apt_bool_t AppOnSessionTerminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); - -private: -/* ============================ DATA ======================================= */ - apr_pool_t* m_pPool; - apt_dir_layout_t* m_pDirLayout; - apt_consumer_task_t* m_pTask; - - mrcp_client_t* m_pMrcpClient; - mrcp_application_t* m_pMrcpApplication; - - apr_hash_t* m_pScenarioTable; - apr_hash_t* m_pSessionTable; -}; - -#endif /* UMC_FRAMEWORK_H */ diff --git a/libs/unimrcp/platforms/umc/include/umcscenario.h b/libs/unimrcp/platforms/umc/include/umcscenario.h deleted file mode 100644 index c3f3b03cc6..0000000000 --- a/libs/unimrcp/platforms/umc/include/umcscenario.h +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: umcscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef UMC_SCENARIO_H -#define UMC_SCENARIO_H - -/** - * @file umcscenario.h - * @brief UMC Scenario - */ - -#include -#include "mrcp_application.h" - -class UmcSession; - -class UmcScenario -{ -public: -/* ============================ CREATORS =================================== */ - UmcScenario(); - virtual ~UmcScenario(); - -/* ============================ MANIPULATORS =============================== */ - virtual bool Load(const apr_xml_elem* pElem, apr_pool_t* pool); - virtual void Destroy(); - - virtual UmcSession* CreateSession() = 0; - - void SetDirLayout(apt_dir_layout_t* pDirLayout); - void SetName(const char* pName); - void SetMrcpProfile(const char* pMrcpProfile); - - bool InitCapabilities(mpf_stream_capabilities_t* pCapabilities) const; - -/* ============================ ACCESSORS ================================== */ - apt_dir_layout_t* GetDirLayout() const; - const char* GetName() const; - const char* GetMrcpProfile() const; - -/* ============================ INQUIRIES ================================== */ - bool IsDiscoveryEnabled() const; - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool); - - bool LoadDiscovery(const apr_xml_elem* pElem, apr_pool_t* pool); - bool LoadTermination(const apr_xml_elem* pElem, apr_pool_t* pool); - bool LoadCapabilities(const apr_xml_elem* pElem, apr_pool_t* pool); - bool LoadRtpTermination(const apr_xml_elem* pElem, apr_pool_t* pool); - - const char* LoadFileContent(const char* pFileName, apr_size_t& size, apr_pool_t* pool) const; - const char* LoadFileContent(const char* pFileName, apr_pool_t* pool) const; - static int ParseRates(const char* pStr, apr_pool_t* pool); - -/* ============================ INQUIRIES ================================== */ - static bool IsElementEnabled(const apr_xml_elem* pElem); - -/* ============================ DATA ======================================= */ - const char* m_pName; - const char* m_pMrcpProfile; - apt_dir_layout_t* m_pDirLayout; - - bool m_ResourceDiscovery; - mpf_codec_capabilities_t* m_pCapabilities; - mpf_rtp_termination_descriptor_t* m_pRtpDescriptor; -}; - - -/* ============================ INLINE METHODS ============================= */ -inline void UmcScenario::SetDirLayout(apt_dir_layout_t* pDirLayout) -{ - m_pDirLayout = pDirLayout; -} - -inline apt_dir_layout_t* UmcScenario::GetDirLayout() const -{ - return m_pDirLayout; -} - -inline void UmcScenario::SetName(const char* pName) -{ - m_pName = pName; -} - -inline const char* UmcScenario::GetName() const -{ - return m_pName; -} - -inline void UmcScenario::SetMrcpProfile(const char* pMrcpProfile) -{ - m_pMrcpProfile = pMrcpProfile; -} - -inline const char* UmcScenario::GetMrcpProfile() const -{ - return m_pMrcpProfile; -} - -inline bool UmcScenario::IsDiscoveryEnabled() const -{ - return m_ResourceDiscovery; -} - - -inline const char* UmcScenario::LoadFileContent(const char* pFileName, apr_pool_t* pool) const -{ - apr_size_t dummy; - return LoadFileContent(pFileName, dummy, pool); -} - -#endif /* UMC_SCENARIO_H */ diff --git a/libs/unimrcp/platforms/umc/include/umcsession.h b/libs/unimrcp/platforms/umc/include/umcsession.h deleted file mode 100644 index a265d2a546..0000000000 --- a/libs/unimrcp/platforms/umc/include/umcsession.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: umcsession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef UMC_SESSION_H -#define UMC_SESSION_H - -/** - * @file umcsession.h - * @brief UMC Session - */ - -#include "mrcp_application.h" - -class UmcScenario; - -class UmcSession -{ -public: -/* ============================ CREATORS =================================== */ - UmcSession(const UmcScenario* pScenario); - virtual ~UmcSession(); - -/* ============================ MANIPULATORS =============================== */ - virtual bool Run(); - virtual bool Stop(); - virtual bool Terminate(); - - void SetMrcpProfile(const char* pMrcpProfile); - void SetMrcpApplication(mrcp_application_t* pMrcpApplication); - -/* ============================ HANDLERS =================================== */ - virtual bool OnSessionTerminate(mrcp_sig_status_code_e status); - virtual bool OnSessionUpdate(mrcp_sig_status_code_e status); - virtual bool OnChannelAdd(mrcp_channel_t *channel, mrcp_sig_status_code_e status); - virtual bool OnChannelRemove(mrcp_channel_t *channel, mrcp_sig_status_code_e status); - virtual bool OnMessageReceive(mrcp_channel_t *channel, mrcp_message_t *message); - virtual bool OnTerminateEvent(mrcp_channel_t *channel); - virtual bool OnResourceDiscover(mrcp_session_descriptor_t* descriptor, mrcp_sig_status_code_e status); - -/* ============================ ACCESSORS ================================== */ - const UmcScenario* GetScenario() const; - - const char* GetId() const; - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool Start() = 0; - - bool CreateMrcpSession(const char* pProfileName); - bool DestroyMrcpSession(); - - bool AddMrcpChannel(mrcp_channel_t* pMrcpChannel); - bool RemoveMrcpChannel(mrcp_channel_t* pMrcpChannel); - bool SendMrcpRequest(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage); - bool ResourceDiscover(); - - mrcp_channel_t* CreateMrcpChannel( - mrcp_resource_id resource_id, - mpf_termination_t* pTermination, - mpf_rtp_termination_descriptor_t* pRtpDescriptor, - void* pObj); - mpf_termination_t* CreateAudioTermination( - const mpf_audio_stream_vtable_t* pStreamVtable, - mpf_stream_capabilities_t* pCapabilities, - void* pObj); - mrcp_message_t* CreateMrcpMessage( - mrcp_channel_t* pMrcpChannel, - mrcp_method_id method_id); - -/* ============================ ACCESSORS ================================== */ - apr_pool_t* GetSessionPool() const; - const char* GetMrcpSessionId() const; - mrcp_message_t* GetMrcpMessage() const; - -/* ============================ DATA ======================================= */ - const UmcScenario* m_pScenario; - const char* m_pMrcpProfile; - char m_Id[10]; - -private: -/* ============================ DATA ======================================= */ - mrcp_application_t* m_pMrcpApplication; - mrcp_session_t* m_pMrcpSession; - mrcp_message_t* m_pMrcpMessage; /* last message sent */ - bool m_Running; - bool m_Terminating; -}; - - -/* ============================ INLINE METHODS ============================= */ -inline const UmcScenario* UmcSession::GetScenario() const -{ - return m_pScenario; -} - -inline const char* UmcSession::GetId() const -{ - return m_Id; -} - -inline void UmcSession::SetMrcpApplication(mrcp_application_t* pMrcpApplication) -{ - m_pMrcpApplication = pMrcpApplication; -} - -inline void UmcSession::SetMrcpProfile(const char* pMrcpProfile) -{ - m_pMrcpProfile = pMrcpProfile; -} - -inline mrcp_message_t* UmcSession::GetMrcpMessage() const -{ - return m_pMrcpMessage; -} - -#endif /* UMC_SESSION_H */ diff --git a/libs/unimrcp/platforms/umc/include/verifierscenario.h b/libs/unimrcp/platforms/umc/include/verifierscenario.h deleted file mode 100644 index b4b49a382b..0000000000 --- a/libs/unimrcp/platforms/umc/include/verifierscenario.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: verifierscenario.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef VERIFIER_SCENARIO_H -#define VERIFIER_SCENARIO_H - -/** - * @file verifierscenario.h - * @brief Verifier Scenario - */ - -#include "umcscenario.h" - -class VerifierScenario : public UmcScenario -{ -public: -/* ============================ CREATORS =================================== */ - VerifierScenario(); - virtual ~VerifierScenario(); - -/* ============================ MANIPULATORS =============================== */ - virtual void Destroy(); - - virtual UmcSession* CreateSession(); - -/* ============================ ACCESSORS ================================== */ - const char* GetRepositoryURI() const; - const char* GetVerificationMode() const; - const char* GetVoiceprintIdentifier() const; - -/* ============================ INQUIRIES ================================== */ -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool); - - bool LoadVerify(const apr_xml_elem* pElem, apr_pool_t* pool); - -/* ============================ DATA ======================================= */ - const char* m_RepositoryURI; - const char* m_VerificationMode; - const char* m_VoiceprintIdentifier; -}; - -/* ============================ INLINE METHODS ============================= */ -inline const char* VerifierScenario::GetRepositoryURI() const -{ - return m_RepositoryURI; -} - -inline const char* VerifierScenario::GetVerificationMode() const -{ - return m_VerificationMode; -} - -inline const char* VerifierScenario::GetVoiceprintIdentifier() const -{ - return m_VoiceprintIdentifier; -} - -#endif /* VERIFIER_SCENARIO_H */ diff --git a/libs/unimrcp/platforms/umc/include/verifiersession.h b/libs/unimrcp/platforms/umc/include/verifiersession.h deleted file mode 100644 index 777a58507a..0000000000 --- a/libs/unimrcp/platforms/umc/include/verifiersession.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: verifiersession.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef VERIFIER_SESSION_H -#define VERIFIER_SESSION_H - -/** - * @file verifiersession.h - * @brief Verifier Session - */ - -#include "umcsession.h" - -class VerifierScenario; -struct VerifierChannel; - -class VerifierSession : public UmcSession -{ -public: -/* ============================ CREATORS =================================== */ - VerifierSession(const VerifierScenario* pScenario); - virtual ~VerifierSession(); - -protected: -/* ============================ MANIPULATORS =============================== */ - virtual bool Start(); - virtual bool Stop(); - - VerifierChannel* CreateVerifierChannel(); - bool StartVerification(mrcp_channel_t* pMrcpChannel); - - mrcp_message_t* CreateStartSessionRequest(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateEndSessionRequest(mrcp_channel_t* pMrcpChannel); - mrcp_message_t* CreateVerificationRequest(mrcp_channel_t* pMrcpChannel); - - FILE* GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const; - -/* ============================ HANDLERS =================================== */ - virtual bool OnSessionTerminate(mrcp_sig_status_code_e status); - virtual bool OnChannelAdd(mrcp_channel_t* channel, mrcp_sig_status_code_e status); - virtual bool OnMessageReceive(mrcp_channel_t* channel, mrcp_message_t* message); - -/* ============================ ACCESSORS ================================== */ - const VerifierScenario* GetScenario() const; - -private: -/* ============================ DATA ======================================= */ - VerifierChannel* m_pVerifierChannel; - const char* m_ContentId; -}; - - -/* ============================ INLINE METHODS ============================= */ -inline const VerifierScenario* VerifierSession::GetScenario() const -{ - return (VerifierScenario*)m_pScenario; -} - -#endif /* VERIFIER_SESSION_H */ diff --git a/libs/unimrcp/platforms/umc/src/dtmfscenario.cpp b/libs/unimrcp/platforms/umc/src/dtmfscenario.cpp deleted file mode 100644 index 190c9a87f1..0000000000 --- a/libs/unimrcp/platforms/umc/src/dtmfscenario.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: dtmfscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "dtmfscenario.h" -#include "dtmfsession.h" -#include "apt_log.h" - -DtmfScenario::DtmfScenario() : - m_ContentType(NULL), - m_Grammar(NULL), - m_Digits(NULL) -{ -} - -DtmfScenario::~DtmfScenario() -{ -} - -void DtmfScenario::Destroy() -{ -} - -bool DtmfScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - if(UmcScenario::LoadElement(pElem,pool)) - return true; - - if(strcasecmp(pElem->name,"recognize") == 0) - { - LoadRecognize(pElem,pool); - return true; - } - - return false; -} - -bool DtmfScenario::LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - const apr_xml_attr* pAttr; - for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"content-type") == 0) - { - m_ContentType = pAttr->value; - } - else if(strcasecmp(pAttr->name,"grammar") == 0) - { - m_Grammar = pAttr->value; - } - else if(strcasecmp(pAttr->name,"digits") == 0) - { - m_Digits = pAttr->value; - } - } - - return true; -} - - -UmcSession* DtmfScenario::CreateSession() -{ - return new DtmfSession(this); -} diff --git a/libs/unimrcp/platforms/umc/src/dtmfsession.cpp b/libs/unimrcp/platforms/umc/src/dtmfsession.cpp deleted file mode 100644 index b10b13946c..0000000000 --- a/libs/unimrcp/platforms/umc/src/dtmfsession.cpp +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: dtmfsession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "dtmfsession.h" -#include "dtmfscenario.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -#include "mpf_dtmf_generator.h" -#include "apt_nlsml_doc.h" -#include "apt_log.h" - -struct RecogChannel -{ - /** MRCP control channel */ - mrcp_channel_t* m_pMrcpChannel; - /** DTMF generator */ - mpf_dtmf_generator_t* m_pDtmfGenerator; - /** Streaming is in-progress */ - bool m_Streaming; -}; - -DtmfSession::DtmfSession(const DtmfScenario* pScenario) : - UmcSession(pScenario), - m_pRecogChannel(NULL) -{ -} - -DtmfSession::~DtmfSession() -{ -} - -bool DtmfSession::Start() -{ - /* create channel and associate all the required data */ - m_pRecogChannel = CreateRecogChannel(); - if(!m_pRecogChannel) - return false; - - /* add channel to session (send asynchronous request) */ - if(!AddMrcpChannel(m_pRecogChannel->m_pMrcpChannel)) - { - delete m_pRecogChannel; - m_pRecogChannel = NULL; - return false; - } - return true; -} - -bool DtmfSession::OnSessionTerminate(mrcp_sig_status_code_e status) -{ - if(m_pRecogChannel) - { - if(m_pRecogChannel->m_pDtmfGenerator) - { - mpf_dtmf_generator_destroy(m_pRecogChannel->m_pDtmfGenerator); - m_pRecogChannel->m_pDtmfGenerator = NULL; - } - - delete m_pRecogChannel; - m_pRecogChannel = NULL; - } - return UmcSession::OnSessionTerminate(status); -} - -static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame) -{ - RecogChannel* pRecogChannel = (RecogChannel*) pStream->obj; - if(pRecogChannel && pRecogChannel->m_Streaming) - { - if(pRecogChannel->m_pDtmfGenerator) - { - mpf_dtmf_generator_put_frame(pRecogChannel->m_pDtmfGenerator,pFrame); - } - } - return TRUE; -} - -RecogChannel* DtmfSession::CreateRecogChannel() -{ - mrcp_channel_t* pChannel; - mpf_termination_t* pTermination; - mpf_stream_capabilities_t* pCapabilities; - apr_pool_t* pool = GetSessionPool(); - - /* create channel */ - RecogChannel *pRecogChannel = new RecogChannel; - pRecogChannel->m_pMrcpChannel = NULL; - pRecogChannel->m_pDtmfGenerator = NULL; - pRecogChannel->m_Streaming = false; - - /* create source stream capabilities */ - pCapabilities = mpf_source_stream_capabilities_create(pool); - GetScenario()->InitCapabilities(pCapabilities); - - static const mpf_audio_stream_vtable_t audio_stream_vtable = - { - NULL, - NULL, - NULL, - ReadStream, - NULL, - NULL, - NULL, - NULL - }; - - pTermination = CreateAudioTermination( - &audio_stream_vtable, /* virtual methods table of audio stream */ - pCapabilities, /* capabilities of audio stream */ - pRecogChannel); /* object to associate */ - - pChannel = CreateMrcpChannel( - MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */ - pTermination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - pRecogChannel); /* object to associate */ - if(!pChannel) - { - delete pRecogChannel; - return NULL; - } - - pRecogChannel->m_pMrcpChannel = pChannel; - return pRecogChannel; -} - -bool DtmfSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status) -{ - if(!UmcSession::OnChannelAdd(pMrcpChannel,status)) - return false; - - if(status != MRCP_SIG_STATUS_CODE_SUCCESS) - { - /* error case, just terminate the demo */ - return Terminate(); - } - - RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pRecogChannel) - { - const mpf_audio_stream_t* pStream = mrcp_application_audio_stream_get(pMrcpChannel); - if(pStream) - { - pRecogChannel->m_pDtmfGenerator = mpf_dtmf_generator_create(pStream,GetSessionPool()); - } - } - - return StartRecognition(pMrcpChannel); -} - -bool DtmfSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage) -{ - if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage)) - return false; - - const DtmfScenario* pScenario = GetScenario(); - RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) - { - if(pMrcpMessage->start_line.method_id == RECOGNIZER_RECOGNIZE) - { - /* received the response to RECOGNIZE request */ - if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) - { - /* start to stream the DTMFs to recognize */ - if(pRecogChannel && pRecogChannel->m_pDtmfGenerator) - { - const char* digits = pScenario->GetDigits(); - if(digits) - { - mpf_dtmf_generator_enqueue(pRecogChannel->m_pDtmfGenerator,digits); - pRecogChannel->m_Streaming = true; - } - } - } - else - { - /* received unexpected response, terminate the session */ - Terminate(); - } - } - else - { - /* received unexpected response */ - } - } - else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) - { - if(pMrcpMessage->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) - { - ParseNLSMLResult(pMrcpMessage); - if(pRecogChannel) - { - pRecogChannel->m_Streaming = false; - } - Terminate(); - } - else if(pMrcpMessage->start_line.method_id == RECOGNIZER_START_OF_INPUT) - { - /* received start-of-input, do whatever you need here */ - } - } - return true; -} - -bool DtmfSession::StartRecognition(mrcp_channel_t* pMrcpChannel) -{ - RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel); - /* create and send RECOGNIZE request */ - mrcp_message_t* pMrcpMessage = CreateRecognizeRequest(pMrcpChannel); - if(pMrcpMessage) - { - SendMrcpRequest(pRecogChannel->m_pMrcpChannel,pMrcpMessage); - } - - return true; -} - -mrcp_message_t* DtmfSession::CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_RECOGNIZE); - if(!pMrcpMessage) - return NULL; - - const DtmfScenario* pScenario = GetScenario(); - - mrcp_generic_header_t* pGenericHeader; - mrcp_recog_header_t* pRecogHeader; - - /* get/allocate generic header */ - pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage); - if(pGenericHeader) - { - apt_string_assign(&pGenericHeader->content_type,pScenario->GetContentType(),pMrcpMessage->pool); - mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_TYPE); - /* set message body */ - if(pScenario->GetGrammar()) - apt_string_assign(&pMrcpMessage->body,pScenario->GetGrammar(),pMrcpMessage->pool); - } - /* get/allocate recognizer header */ - pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pRecogHeader) - { - /* set recognizer header fields */ - if(pMrcpMessage->start_line.version == MRCP_VERSION_2) - { - pRecogHeader->cancel_if_queue = FALSE; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_CANCEL_IF_QUEUE); - } - } - return pMrcpMessage; -} - -bool DtmfSession::ParseNLSMLResult(mrcp_message_t* pMrcpMessage) -{ - nlsml_result_t *pResult = nlsml_result_parse(pMrcpMessage->body.buf, pMrcpMessage->body.length, pMrcpMessage->pool); - if(!pResult) - return false; - - nlsml_result_trace(pResult, pMrcpMessage->pool); - return true; -} diff --git a/libs/unimrcp/platforms/umc/src/main.cpp b/libs/unimrcp/platforms/umc/src/main.cpp deleted file mode 100644 index d06873989e..0000000000 --- a/libs/unimrcp/platforms/umc/src/main.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "umcconsole.h" - -int main(int argc, const char * const *argv) -{ - UmcConsole console; - console.Run(argc,argv); - return 0; -} diff --git a/libs/unimrcp/platforms/umc/src/recogscenario.cpp b/libs/unimrcp/platforms/umc/src/recogscenario.cpp deleted file mode 100644 index 658a46586d..0000000000 --- a/libs/unimrcp/platforms/umc/src/recogscenario.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: recogscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "recogscenario.h" -#include "recogsession.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -#include "apt_log.h" - -RecogScenario::RecogScenario() : - m_DefineGrammar(true), - m_Recognize(true), - m_ContentType("application/srgs+xml"), - m_Content(NULL), - m_ContentLength(0), - m_AudioSource(NULL) -{ -} - -RecogScenario::~RecogScenario() -{ -} - -void RecogScenario::Destroy() -{ -} - -bool RecogScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - if(UmcScenario::LoadElement(pElem,pool)) - return true; - - if(strcasecmp(pElem->name,"define-grammar") == 0) - { - LoadDefineGrammar(pElem,pool); - return true; - } - else if(strcasecmp(pElem->name,"recognize") == 0) - { - LoadRecognize(pElem,pool); - return true; - } - - return false; -} - -bool RecogScenario::LoadRecognize(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - const apr_xml_attr* pAttr; - for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"enable") == 0) - { - m_Recognize = atoi(pAttr->value) > 0; - } - else if(strcasecmp(pAttr->name,"content-type") == 0) - { - m_ContentType = pAttr->value; - } - else if(strcasecmp(pAttr->name,"content-location") == 0) - { - m_Content = LoadFileContent(pAttr->value,pool); - } - else if(strcasecmp(pAttr->name,"audio-source") == 0) - { - m_AudioSource = pAttr->value; - } - } - - return true; -} - -bool RecogScenario::LoadDefineGrammar(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - const apr_xml_attr* pAttr; - for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"enable") == 0) - { - m_DefineGrammar = atoi(pAttr->value) > 0; - } - else if(strcasecmp(pAttr->name,"content-type") == 0) - { - m_ContentType = pAttr->value; - } - else if(strcasecmp(pAttr->name,"content-location") == 0) - { - m_Content = LoadFileContent(pAttr->value,m_ContentLength,pool); - } - } - return true; -} - - -UmcSession* RecogScenario::CreateSession() -{ - return new RecogSession(this); -} diff --git a/libs/unimrcp/platforms/umc/src/recogsession.cpp b/libs/unimrcp/platforms/umc/src/recogsession.cpp deleted file mode 100644 index 5779bf4418..0000000000 --- a/libs/unimrcp/platforms/umc/src/recogsession.cpp +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: recogsession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "recogsession.h" -#include "recogscenario.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -#include "apt_nlsml_doc.h" -#include "apt_log.h" - -struct RecogChannel -{ - /** MRCP control channel */ - mrcp_channel_t* m_pMrcpChannel; - /** IN-PROGRESS RECOGNIZE request */ - mrcp_message_t* m_pRecogRequest; - /** Streaming is in-progress */ - bool m_Streaming; - /** File to read audio stream from */ - FILE* m_pAudioIn; - /** Estimated time to complete (used if no audio_in available) */ - apr_size_t m_TimeToComplete; - - RecogChannel() : - m_pMrcpChannel(NULL), - m_pRecogRequest(NULL), - m_Streaming(false), - m_pAudioIn(NULL), - m_TimeToComplete(0) {} -}; - -RecogSession::RecogSession(const RecogScenario* pScenario) : - UmcSession(pScenario), - m_pRecogChannel(NULL), - m_ContentId("request1@form-level") -{ -} - -RecogSession::~RecogSession() -{ -} - -bool RecogSession::Start() -{ - const RecogScenario* pScenario = GetScenario(); - if(!pScenario->IsDefineGrammarEnabled() && !pScenario->IsRecognizeEnabled()) - return false; - - /* create channel and associate all the required data */ - m_pRecogChannel = CreateRecogChannel(); - if(!m_pRecogChannel) - return false; - - /* add channel to session (send asynchronous request) */ - if(!AddMrcpChannel(m_pRecogChannel->m_pMrcpChannel)) - { - delete m_pRecogChannel; - m_pRecogChannel = NULL; - return false; - } - return true; -} - -bool RecogSession::Stop() -{ - if(!UmcSession::Stop()) - return false; - - if(!m_pRecogChannel) - return false; - - mrcp_message_t* pStopMessage = CreateMrcpMessage(m_pRecogChannel->m_pMrcpChannel,RECOGNIZER_STOP); - if(!pStopMessage) - return false; - - if(m_pRecogChannel->m_pRecogRequest) - { - mrcp_generic_header_t* pGenericHeader; - /* get/allocate generic header */ - pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pStopMessage); - if(pGenericHeader) - { - pGenericHeader->active_request_id_list.count = 1; - pGenericHeader->active_request_id_list.ids[0] = - m_pRecogChannel->m_pRecogRequest->start_line.request_id; - mrcp_generic_header_property_add(pStopMessage,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - } - - m_pRecogChannel->m_pRecogRequest = NULL; - } - - return SendMrcpRequest(m_pRecogChannel->m_pMrcpChannel,pStopMessage); -} - -bool RecogSession::OnSessionTerminate(mrcp_sig_status_code_e status) -{ - if(m_pRecogChannel) - { - FILE* pAudioIn = m_pRecogChannel->m_pAudioIn; - if(pAudioIn) - { - m_pRecogChannel->m_pAudioIn = NULL; - fclose(pAudioIn); - } - - delete m_pRecogChannel; - m_pRecogChannel = NULL; - } - return UmcSession::OnSessionTerminate(status); -} - -static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame) -{ - RecogChannel* pRecogChannel = (RecogChannel*) pStream->obj; - if(pRecogChannel && pRecogChannel->m_Streaming) - { - if(pRecogChannel->m_pAudioIn) - { - if(fread(pFrame->codec_frame.buffer,1,pFrame->codec_frame.size,pRecogChannel->m_pAudioIn) == pFrame->codec_frame.size) - { - /* normal read */ - pFrame->type |= MEDIA_FRAME_TYPE_AUDIO; - } - else - { - /* file is over */ - pRecogChannel->m_Streaming = false; - } - } - else - { - /* fill with silence in case no file available */ - if(pRecogChannel->m_TimeToComplete >= CODEC_FRAME_TIME_BASE) - { - pFrame->type |= MEDIA_FRAME_TYPE_AUDIO; - memset(pFrame->codec_frame.buffer,0,pFrame->codec_frame.size); - pRecogChannel->m_TimeToComplete -= CODEC_FRAME_TIME_BASE; - } - else - { - pRecogChannel->m_Streaming = false; - } - } - } - return TRUE; -} - -RecogChannel* RecogSession::CreateRecogChannel() -{ - mrcp_channel_t* pChannel; - mpf_termination_t* pTermination; - mpf_stream_capabilities_t* pCapabilities; - apr_pool_t* pool = GetSessionPool(); - - /* create channel */ - RecogChannel* pRecogChannel = new RecogChannel; - - /* create source stream capabilities */ - pCapabilities = mpf_source_stream_capabilities_create(pool); - GetScenario()->InitCapabilities(pCapabilities); - - static const mpf_audio_stream_vtable_t audio_stream_vtable = - { - NULL, - NULL, - NULL, - ReadStream, - NULL, - NULL, - NULL, - NULL - }; - - pTermination = CreateAudioTermination( - &audio_stream_vtable, /* virtual methods table of audio stream */ - pCapabilities, /* capabilities of audio stream */ - pRecogChannel); /* object to associate */ - - pChannel = CreateMrcpChannel( - MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */ - pTermination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - pRecogChannel); /* object to associate */ - if(!pChannel) - { - delete pRecogChannel; - return NULL; - } - - pRecogChannel->m_pMrcpChannel = pChannel; - return pRecogChannel; -} - -bool RecogSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status) -{ - if(!UmcSession::OnChannelAdd(pMrcpChannel,status)) - return false; - - if(status != MRCP_SIG_STATUS_CODE_SUCCESS) - { - /* error case, just terminate the demo */ - return Terminate(); - } - - if(GetScenario()->IsDefineGrammarEnabled()) - { - mrcp_message_t* pMrcpMessage = CreateDefineGrammarRequest(pMrcpChannel); - if(pMrcpMessage) - SendMrcpRequest(pMrcpChannel,pMrcpMessage); - return true; - } - - return StartRecognition(pMrcpChannel); -} - -bool RecogSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage) -{ - if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage)) - return false; - - RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) - { - /* received MRCP response */ - if(pMrcpMessage->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR) - { - /* received the response to DEFINE-GRAMMAR request */ - if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) - { - OnDefineGrammar(pMrcpChannel); - } - else - { - /* received unexpected response, terminate the session */ - Terminate(); - } - } - else if(pMrcpMessage->start_line.method_id == RECOGNIZER_RECOGNIZE) - { - /* received the response to RECOGNIZE request */ - if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) - { - RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pRecogChannel) - pRecogChannel->m_pRecogRequest = GetMrcpMessage(); - - /* start to stream the speech to recognize */ - if(pRecogChannel) - pRecogChannel->m_Streaming = true; - } - else - { - /* received unexpected response, terminate the session */ - Terminate(); - } - } - else - { - /* received unexpected response */ - } - } - else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) - { - if(pMrcpMessage->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) - { - ParseNLSMLResult(pMrcpMessage); - if(pRecogChannel) - pRecogChannel->m_Streaming = false; - - RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pRecogChannel) - pRecogChannel->m_pRecogRequest = NULL; - - Terminate(); - } - else if(pMrcpMessage->start_line.method_id == RECOGNIZER_START_OF_INPUT) - { - /* received start-of-input, do whatever you need here */ - } - } - return true; -} - -bool RecogSession::OnDefineGrammar(mrcp_channel_t* pMrcpChannel) -{ - if(GetScenario()->IsRecognizeEnabled()) - { - return StartRecognition(pMrcpChannel); - } - - return Terminate(); -} - -bool RecogSession::StartRecognition(mrcp_channel_t* pMrcpChannel) -{ - const mpf_codec_descriptor_t* pDescriptor = mrcp_application_source_descriptor_get(pMrcpChannel); - if(!pDescriptor) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Source Descriptor"); - return Terminate(); - } - - RecogChannel* pRecogChannel = (RecogChannel*) mrcp_application_channel_object_get(pMrcpChannel); - /* create and send RECOGNIZE request */ - mrcp_message_t* pMrcpMessage = CreateRecognizeRequest(pMrcpChannel); - if(pMrcpMessage) - { - SendMrcpRequest(pRecogChannel->m_pMrcpChannel,pMrcpMessage); - } - - pRecogChannel->m_pAudioIn = GetAudioIn(pDescriptor,GetSessionPool()); - if(!pRecogChannel->m_pAudioIn) - { - /* no audio input availble, set some estimated time to complete instead */ - pRecogChannel->m_TimeToComplete = 5000; // 5 sec - } - return true; -} - -mrcp_message_t* RecogSession::CreateDefineGrammarRequest(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_DEFINE_GRAMMAR); - if(!pMrcpMessage) - return NULL; - - const RecogScenario* pScenario = GetScenario(); - - mrcp_generic_header_t* pGenericHeader; - /* get/allocate generic header */ - pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage); - if(pGenericHeader) - { - /* set generic header fields */ - if(pScenario->GetContentType()) - { - apt_string_assign(&pGenericHeader->content_type,pScenario->GetContentType(),pMrcpMessage->pool); - mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_TYPE); - } - apt_string_assign(&pGenericHeader->content_id,m_ContentId,pMrcpMessage->pool); - mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_ID); - } - - /* set message body */ - if(pScenario->GetContent()) - apt_string_assign_n(&pMrcpMessage->body,pScenario->GetContent(),pScenario->GetContentLength(),pMrcpMessage->pool); - return pMrcpMessage; -} - -mrcp_message_t* RecogSession::CreateRecognizeRequest(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_RECOGNIZE); - if(!pMrcpMessage) - return NULL; - - const RecogScenario* pScenario = GetScenario(); - - mrcp_generic_header_t* pGenericHeader; - mrcp_recog_header_t* pRecogHeader; - - /* get/allocate generic header */ - pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage); - if(pGenericHeader) - { - /* set generic header fields */ - if(pScenario->IsDefineGrammarEnabled()) - { - apt_string_assign(&pGenericHeader->content_type,"text/uri-list",pMrcpMessage->pool); - /* set message body */ - const char* pContent = apr_pstrcat(pMrcpMessage->pool,"session:",m_ContentId,NULL); - apt_string_set(&pMrcpMessage->body,pContent); - } - else - { - apt_string_assign(&pGenericHeader->content_type,pScenario->GetContentType(),pMrcpMessage->pool); - /* set content-id */ - apt_string_assign(&pGenericHeader->content_id,m_ContentId,pMrcpMessage->pool); - mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_ID); - /* set message body */ - if(pScenario->GetContent()) - apt_string_assign(&pMrcpMessage->body,pScenario->GetContent(),pMrcpMessage->pool); - } - mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_TYPE); - } - /* get/allocate recognizer header */ - pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pRecogHeader) - { - /* set recognizer header fields */ - if(pMrcpMessage->start_line.version == MRCP_VERSION_2) - { - pRecogHeader->cancel_if_queue = FALSE; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_CANCEL_IF_QUEUE); - } - pRecogHeader->no_input_timeout = 5000; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT); - pRecogHeader->recognition_timeout = 10000; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT); - pRecogHeader->start_input_timers = TRUE; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_START_INPUT_TIMERS); - pRecogHeader->confidence_threshold = 0.87f; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD); - pRecogHeader->save_waveform = TRUE; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SAVE_WAVEFORM); - } - return pMrcpMessage; -} - -bool RecogSession::ParseNLSMLResult(mrcp_message_t* pMrcpMessage) -{ - nlsml_result_t *pResult = nlsml_result_parse(pMrcpMessage->body.buf, pMrcpMessage->body.length, pMrcpMessage->pool); - if(!pResult) - return false; - - nlsml_result_trace(pResult, pMrcpMessage->pool); - return true; -} - -FILE* RecogSession::GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const -{ - const char* pFileName = GetScenario()->GetAudioSource(); - if(!pFileName) - { - pFileName = apr_psprintf(pool,"one-%dkHz.pcm",pDescriptor->sampling_rate/1000); - } - apt_dir_layout_t* pDirLayout = GetScenario()->GetDirLayout(); - const char* pFilePath = apt_datadir_filepath_get(pDirLayout,pFileName,pool); - if(!pFilePath) - return NULL; - - FILE* pFile = fopen(pFilePath,"rb"); - if(!pFile) - { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",pFilePath); - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",pFilePath); - return pFile; -} diff --git a/libs/unimrcp/platforms/umc/src/recorderscenario.cpp b/libs/unimrcp/platforms/umc/src/recorderscenario.cpp deleted file mode 100644 index 6d303b848a..0000000000 --- a/libs/unimrcp/platforms/umc/src/recorderscenario.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: recorderscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "recorderscenario.h" -#include "recordersession.h" - -RecorderScenario::RecorderScenario() : - m_Record(true), - m_AudioSource(NULL) -{ -} - -RecorderScenario::~RecorderScenario() -{ -} - -void RecorderScenario::Destroy() -{ -} - -bool RecorderScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - if(UmcScenario::LoadElement(pElem,pool)) - return true; - - if(strcasecmp(pElem->name,"record") == 0) - { - LoadRecord(pElem,pool); - return true; - } - - return false; -} - -bool RecorderScenario::LoadRecord(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - const apr_xml_attr* pAttr; - for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"enable") == 0) - { - m_Record = atoi(pAttr->value) > 0; - } - else if(strcasecmp(pAttr->name,"audio-source") == 0) - { - m_AudioSource = pAttr->value; - } - } - - return true; -} - -UmcSession* RecorderScenario::CreateSession() -{ - return new RecorderSession(this); -} diff --git a/libs/unimrcp/platforms/umc/src/recordersession.cpp b/libs/unimrcp/platforms/umc/src/recordersession.cpp deleted file mode 100644 index 886e3248fb..0000000000 --- a/libs/unimrcp/platforms/umc/src/recordersession.cpp +++ /dev/null @@ -1,286 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: recordersession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "recordersession.h" -#include "recorderscenario.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_recorder_header.h" -#include "mrcp_recorder_resource.h" -#include "apt_log.h" - -struct RecorderChannel -{ - /** MRCP control channel */ - mrcp_channel_t* m_pMrcpChannel; - /** Streaming is in-progress */ - bool m_Streaming; - /** File to read audio stream from */ - FILE* m_pAudioIn; -}; - -RecorderSession::RecorderSession(const RecorderScenario* pScenario) : - UmcSession(pScenario), - m_pRecorderChannel(NULL) -{ -} - -RecorderSession::~RecorderSession() -{ -} - -bool RecorderSession::Start() -{ - const RecorderScenario* pScenario = GetScenario(); - if(!pScenario->IsRecordEnabled()) - return false; - - /* create channel and associate all the required data */ - m_pRecorderChannel = CreateRecorderChannel(); - if(!m_pRecorderChannel) - return false; - - /* add channel to session (send asynchronous request) */ - if(!AddMrcpChannel(m_pRecorderChannel->m_pMrcpChannel)) - { - delete m_pRecorderChannel; - m_pRecorderChannel = NULL; - return false; - } - return true; -} - -bool RecorderSession::OnSessionTerminate(mrcp_sig_status_code_e status) -{ - if(m_pRecorderChannel) - { - FILE* pAudioIn = m_pRecorderChannel->m_pAudioIn; - if(pAudioIn) - { - m_pRecorderChannel->m_pAudioIn = NULL; - fclose(pAudioIn); - } - - delete m_pRecorderChannel; - m_pRecorderChannel = NULL; - } - return UmcSession::OnSessionTerminate(status); -} - -static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame) -{ - RecorderChannel* pRecorderChannel = (RecorderChannel*) pStream->obj; - if(pRecorderChannel && pRecorderChannel->m_Streaming) - { - if(pRecorderChannel->m_pAudioIn) - { - if(fread(pFrame->codec_frame.buffer,1,pFrame->codec_frame.size,pRecorderChannel->m_pAudioIn) == pFrame->codec_frame.size) - { - /* normal read */ - pFrame->type |= MEDIA_FRAME_TYPE_AUDIO; - } - else - { - /* file is over */ - pRecorderChannel->m_Streaming = false; - } - } - } - return TRUE; -} - -RecorderChannel* RecorderSession::CreateRecorderChannel() -{ - mrcp_channel_t* pChannel; - mpf_termination_t* pTermination; - mpf_stream_capabilities_t* pCapabilities; - apr_pool_t* pool = GetSessionPool(); - - /* create channel */ - RecorderChannel *pRecorderChannel = new RecorderChannel; - pRecorderChannel->m_pMrcpChannel = NULL; - pRecorderChannel->m_Streaming = false; - pRecorderChannel->m_pAudioIn = NULL; - - /* create source stream capabilities */ - pCapabilities = mpf_source_stream_capabilities_create(pool); - GetScenario()->InitCapabilities(pCapabilities); - - static const mpf_audio_stream_vtable_t audio_stream_vtable = - { - NULL, - NULL, - NULL, - ReadStream, - NULL, - NULL, - NULL, - NULL - }; - - pTermination = CreateAudioTermination( - &audio_stream_vtable, /* virtual methods table of audio stream */ - pCapabilities, /* capabilities of audio stream */ - pRecorderChannel); /* object to associate */ - - pChannel = CreateMrcpChannel( - MRCP_RECORDER_RESOURCE, /* MRCP resource identifier */ - pTermination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - pRecorderChannel); /* object to associate */ - if(!pChannel) - { - delete pRecorderChannel; - return NULL; - } - - pRecorderChannel->m_pMrcpChannel = pChannel; - return pRecorderChannel; -} - -bool RecorderSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status) -{ - if(!UmcSession::OnChannelAdd(pMrcpChannel,status)) - return false; - - if(status != MRCP_SIG_STATUS_CODE_SUCCESS) - { - /* error case, just terminate the demo */ - return Terminate(); - } - - return StartRecorder(pMrcpChannel); -} - -bool RecorderSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage) -{ - if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage)) - return false; - - RecorderChannel* pRecorderChannel = (RecorderChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) - { - /* received MRCP response */ - if(pMrcpMessage->start_line.method_id == RECORDER_RECORD) - { - /* received the response to RECORD request */ - if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) - { - /* start to stream the speech to record */ - if(pRecorderChannel) - { - pRecorderChannel->m_Streaming = true; - } - } - else - { - /* received unexpected response, terminate the session */ - Terminate(); - } - } - else - { - /* received unexpected response */ - } - } - else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) - { - if(pMrcpMessage->start_line.method_id == RECORDER_RECORD_COMPLETE) - { - if(pRecorderChannel) - { - pRecorderChannel->m_Streaming = false; - } - Terminate(); - } - else if(pMrcpMessage->start_line.method_id == RECORDER_START_OF_INPUT) - { - /* received start-of-input, do whatever you need here */ - } - } - return true; -} - -bool RecorderSession::StartRecorder(mrcp_channel_t* pMrcpChannel) -{ - const mpf_codec_descriptor_t* pDescriptor = mrcp_application_source_descriptor_get(pMrcpChannel); - if(!pDescriptor) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Source Descriptor"); - return Terminate(); - } - - RecorderChannel* pRecorderChannel = (RecorderChannel*) mrcp_application_channel_object_get(pMrcpChannel); - /* create and send RECORD request */ - mrcp_message_t* pMrcpMessage = CreateRecordRequest(pMrcpChannel); - if(pMrcpMessage) - { - SendMrcpRequest(pRecorderChannel->m_pMrcpChannel,pMrcpMessage); - } - - pRecorderChannel->m_pAudioIn = GetAudioIn(pDescriptor,GetSessionPool()); - return true; -} - -mrcp_message_t* RecorderSession::CreateRecordRequest(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECORDER_RECORD); - if(!pMrcpMessage) - return NULL; - - mrcp_recorder_header_t* pRecorderHeader; - - /* get/allocate recorder header */ - pRecorderHeader = (mrcp_recorder_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pRecorderHeader) - { - /* set recorder header fields */ - pRecorderHeader->no_input_timeout = 5000; - mrcp_resource_header_property_add(pMrcpMessage,RECORDER_HEADER_NO_INPUT_TIMEOUT); - - pRecorderHeader->final_silence = 300; - mrcp_resource_header_property_add(pMrcpMessage,RECORDER_HEADER_FINAL_SILENCE); - - pRecorderHeader->max_time = 10000; - mrcp_resource_header_property_add(pMrcpMessage,RECORDER_HEADER_MAX_TIME); - } - return pMrcpMessage; -} - -FILE* RecorderSession::GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const -{ - const char* pFileName = GetScenario()->GetAudioSource(); - if(!pFileName) - { - pFileName = apr_psprintf(pool,"demo-%dkHz.pcm",pDescriptor->sampling_rate/1000); - } - apt_dir_layout_t* pDirLayout = GetScenario()->GetDirLayout(); - const char* pFilePath = apt_datadir_filepath_get(pDirLayout,pFileName,pool); - if(!pFilePath) - return NULL; - - FILE* pFile = fopen(pFilePath,"rb"); - if(!pFile) - { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",pFilePath); - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",pFilePath); - return pFile; -} diff --git a/libs/unimrcp/platforms/umc/src/setparamscenario.cpp b/libs/unimrcp/platforms/umc/src/setparamscenario.cpp deleted file mode 100644 index cbb203379e..0000000000 --- a/libs/unimrcp/platforms/umc/src/setparamscenario.cpp +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: setparamscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "setparamscenario.h" -#include "setparamsession.h" - -UmcSession* SetParamScenario::CreateSession() -{ - return new SetParamSession(this); -} diff --git a/libs/unimrcp/platforms/umc/src/setparamsession.cpp b/libs/unimrcp/platforms/umc/src/setparamsession.cpp deleted file mode 100644 index c1fabd3e77..0000000000 --- a/libs/unimrcp/platforms/umc/src/setparamsession.cpp +++ /dev/null @@ -1,390 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: setparamsession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "setparamsession.h" -#include "setparamscenario.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -#include "apt_log.h" - -struct RecogChannel -{ - /** MRCP control channel */ - mrcp_channel_t* m_pMrcpChannel; -}; - -SetParamSession::SetParamSession(const SetParamScenario* pScenario) : - UmcSession(pScenario), - m_pRecogChannel(NULL), - m_RequestQueue(NULL), - m_CurrentRequest(0) -{ -} - -SetParamSession::~SetParamSession() -{ -} - -bool SetParamSession::Start() -{ - /* create channel and associate all the required data */ - m_pRecogChannel = CreateRecogChannel(); - if(!m_pRecogChannel) - return false; - - /* add channel to session (send asynchronous request) */ - if(!AddMrcpChannel(m_pRecogChannel->m_pMrcpChannel)) - { - delete m_pRecogChannel; - m_pRecogChannel = NULL; - return false; - } - return true; -} - -bool SetParamSession::OnSessionTerminate(mrcp_sig_status_code_e status) -{ - if(m_pRecogChannel) - { - delete m_pRecogChannel; - m_pRecogChannel = NULL; - } - return UmcSession::OnSessionTerminate(status); -} - -static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame) -{ - return TRUE; -} - -RecogChannel* SetParamSession::CreateRecogChannel() -{ - mrcp_channel_t* pChannel; - mpf_termination_t* pTermination; - mpf_stream_capabilities_t* pCapabilities; - apr_pool_t* pool = GetSessionPool(); - - /* create channel */ - RecogChannel *pRecogChannel = new RecogChannel; - pRecogChannel->m_pMrcpChannel = NULL; - - /* create source stream capabilities */ - pCapabilities = mpf_source_stream_capabilities_create(pool); - GetScenario()->InitCapabilities(pCapabilities); - - static const mpf_audio_stream_vtable_t audio_stream_vtable = - { - NULL, - NULL, - NULL, - ReadStream, - NULL, - NULL, - NULL, - NULL - }; - - pTermination = CreateAudioTermination( - &audio_stream_vtable, /* virtual methods table of audio stream */ - pCapabilities, /* capabilities of audio stream */ - pRecogChannel); /* object to associate */ - - pChannel = CreateMrcpChannel( - MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */ - pTermination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - pRecogChannel); /* object to associate */ - if(!pChannel) - { - delete pRecogChannel; - return NULL; - } - - pRecogChannel->m_pMrcpChannel = pChannel; - return pRecogChannel; -} - -bool SetParamSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status) -{ - if(!UmcSession::OnChannelAdd(pMrcpChannel,status)) - return false; - - if(status != MRCP_SIG_STATUS_CODE_SUCCESS) - { - /* error case, just terminate the demo */ - return Terminate(); - } - - if(!CreateRequestQueue(pMrcpChannel)) - { - return Terminate(); - } - - return ProcessNextRequest(pMrcpChannel); -} - -bool SetParamSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage) -{ - if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage)) - return false; - - if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) - { - /* received MRCP response */ - if(pMrcpMessage->start_line.method_id == RECOGNIZER_SET_PARAMS || pMrcpMessage->start_line.method_id == RECOGNIZER_GET_PARAMS) - { - /* received the response */ - if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) - { - m_CurrentRequest++; - ProcessNextRequest(pMrcpChannel); - } - else - { - /* received unexpected response, terminate the session */ - Terminate(); - } - } - else - { - /* received unexpected response */ - Terminate(); - } - } - return true; -} - -bool SetParamSession::ProcessNextRequest(mrcp_channel_t* pMrcpChannel) -{ - if(m_CurrentRequest >= m_RequestQueue->nelts) - { - return Terminate(); - } - - mrcp_message_t* pMrcpMessage = APR_ARRAY_IDX(m_RequestQueue,m_CurrentRequest,mrcp_message_t*); - if(!pMrcpMessage) - { - return Terminate(); - } - - return SendMrcpRequest(pMrcpChannel,pMrcpMessage); -} - -bool SetParamSession::CreateRequestQueue(mrcp_channel_t* pMrcpChannel) -{ - m_CurrentRequest = 0; - m_RequestQueue = apr_array_make(GetSessionPool(),5,sizeof(mrcp_message_t*)); - mrcp_message_t* pMrcpMessage; - - pMrcpMessage = CreateSetParams1(pMrcpChannel); - if(pMrcpMessage) - *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage; - - pMrcpMessage = CreateGetParams1(pMrcpChannel); - if(pMrcpMessage) - *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage; - - pMrcpMessage = CreateSetParams2(pMrcpChannel); - if(pMrcpMessage) - *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage; - - pMrcpMessage = CreateGetParams2(pMrcpChannel); - if(pMrcpMessage) - *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage; - - pMrcpMessage = CreateSetParams3(pMrcpChannel); - if(pMrcpMessage) - *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage; - - pMrcpMessage = CreateGetParams3(pMrcpChannel); - if(pMrcpMessage) - *(mrcp_message_t**)apr_array_push(m_RequestQueue) = pMrcpMessage; - - return true; -} - -mrcp_message_t* SetParamSession::CreateSetParams1(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_SET_PARAMS); - if(!pMrcpMessage) - return NULL; - - mrcp_recog_header_t* pRecogHeader; - /* get/allocate recog header */ - pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pRecogHeader) - { - /* set recog header fields */ - pRecogHeader->confidence_threshold = 0.4f; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD); - pRecogHeader->sensitivity_level = 0.531f; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SENSITIVITY_LEVEL); - pRecogHeader->speed_vs_accuracy = 0.5f; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEED_VS_ACCURACY); - pRecogHeader->n_best_list_length = 5; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_N_BEST_LIST_LENGTH); - pRecogHeader->no_input_timeout = 5000; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT); - } - - return pMrcpMessage; -} - -mrcp_message_t* SetParamSession::CreateGetParams1(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_GET_PARAMS); - if(!pMrcpMessage) - return NULL; - - mrcp_recog_header_t* pRecogHeader; - /* get/allocate recog header */ - pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pRecogHeader) - { - /* set recog header fields */ - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD); - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_SENSITIVITY_LEVEL); - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEED_VS_ACCURACY); - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_N_BEST_LIST_LENGTH); - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT); - } - - return pMrcpMessage; -} - -mrcp_message_t* SetParamSession::CreateSetParams2(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_SET_PARAMS); - if(!pMrcpMessage) - return NULL; - - mrcp_recog_header_t* pRecogHeader; - /* get/allocate recog header */ - pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pRecogHeader) - { - /* set recog header fields */ - pRecogHeader->recognition_timeout = 5000; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT); - pRecogHeader->speech_complete_timeout = 1000; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT); - pRecogHeader->speech_incomplete_timeout = 2000; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT); - pRecogHeader->dtmf_interdigit_timeout = 3000; - mrcp_resource_header_property_add(pMrcpMessage,RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT); - } - - return pMrcpMessage; -} - -mrcp_message_t* SetParamSession::CreateGetParams2(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_GET_PARAMS); - if(!pMrcpMessage) - return NULL; - - mrcp_recog_header_t* pRecogHeader; - /* get/allocate recog header */ - pRecogHeader = (mrcp_recog_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pRecogHeader) - { - /* set recog header fields */ - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT); - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT); - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT); - mrcp_resource_header_name_property_add(pMrcpMessage,RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT); - } - - return pMrcpMessage; -} - -mrcp_message_t* SetParamSession::CreateSetParams3(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_SET_PARAMS); - if(!pMrcpMessage) - return NULL; - - mrcp_generic_header_t* pGenericHeader; - /* get/allocate generic header */ - pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage); - if(pGenericHeader) - { - apr_pool_t* pool = GetSessionPool(); - /* set generic header fields */ - apt_pair_arr_t* pVSP = apt_pair_array_create(3,pool); - if(pVSP) - { - apt_str_t name; - apt_str_t value; - - apt_string_set(&name,"confidencelevel"); - apt_string_set(&value,"500"); - apt_pair_array_append(pVSP,&name,&value,pool); - - apt_string_set(&name,"sensitivity"); - apt_string_set(&value,"0.500"); - apt_pair_array_append(pVSP,&name,&value,pool); - - apt_string_set(&name,"speedvsaccuracy"); - apt_string_set(&value,"0.789"); - apt_pair_array_append(pVSP,&name,&value,pool); - - apt_string_set(&name,"timeout"); - apt_string_set(&value,"1000"); - apt_pair_array_append(pVSP,&name,&value,pool); - - apt_string_set(&name,"swirec_application_name"); - apt_string_set(&value,"UniMRCP"); - apt_pair_array_append(pVSP,&name,&value,pool); - - apt_string_set(&name,"swirec_phoneme_lookahead_beam"); - apt_string_set(&value,"-50"); - apt_pair_array_append(pVSP,&name,&value,pool); - - pGenericHeader->vendor_specific_params = pVSP; - mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS); - } - } - - return pMrcpMessage; -} - -mrcp_message_t* SetParamSession::CreateGetParams3(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,RECOGNIZER_GET_PARAMS); - if(!pMrcpMessage) - return NULL; - - mrcp_generic_header_t* pGenericHeader; - /* get/allocate generic header */ - pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage); - if(pGenericHeader) - { - mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_ACCEPT_CHARSET); - mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_CACHE_CONTROL); - mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_LOGGING_TAG); - mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS); - mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_FETCH_TIMEOUT); - mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_SET_COOKIE); - mrcp_generic_header_name_property_add(pMrcpMessage,GENERIC_HEADER_SET_COOKIE2); - } - - return pMrcpMessage; -} diff --git a/libs/unimrcp/platforms/umc/src/synthscenario.cpp b/libs/unimrcp/platforms/umc/src/synthscenario.cpp deleted file mode 100644 index de1718ce47..0000000000 --- a/libs/unimrcp/platforms/umc/src/synthscenario.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: synthscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "synthscenario.h" -#include "synthsession.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_synth_header.h" -#include "mrcp_synth_resource.h" - - -SynthScenario::SynthScenario() : - m_Speak(true), - m_ContentType("application/synthesis+ssml"), - m_Content(NULL) -{ -} - -SynthScenario::~SynthScenario() -{ -} - -void SynthScenario::Destroy() -{ -} - -bool SynthScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - if(UmcScenario::LoadElement(pElem,pool)) - return true; - - if(strcasecmp(pElem->name,"speak") == 0) - { - LoadSpeak(pElem,pool); - return true; - } - - return false; -} - -bool SynthScenario::LoadSpeak(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - const apr_xml_attr* pAttr; - for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"enable") == 0) - { - m_Speak = atoi(pAttr->value) > 0; - } - else if(strcasecmp(pAttr->name,"content-type") == 0) - { - m_ContentType = pAttr->value; - } - else if(strcasecmp(pAttr->name,"content-location") == 0) - { - m_Content = LoadFileContent(pAttr->value,pool); - } - } - - return true; -} - -UmcSession* SynthScenario::CreateSession() -{ - return new SynthSession(this); -} diff --git a/libs/unimrcp/platforms/umc/src/synthsession.cpp b/libs/unimrcp/platforms/umc/src/synthsession.cpp deleted file mode 100644 index 07adaf6cbb..0000000000 --- a/libs/unimrcp/platforms/umc/src/synthsession.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: synthsession.cpp 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $ - */ - -#include "synthsession.h" -#include "synthscenario.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_synth_header.h" -#include "mrcp_synth_resource.h" -#include "apt_log.h" - -struct SynthChannel -{ - /** MRCP channel */ - mrcp_channel_t* m_pMrcpChannel; - /** IN-PROGRESS SPEAK request */ - mrcp_message_t* m_pSpeakRequest; - /** File to write audio stream to */ - FILE* m_pAudioOut; - - SynthChannel() : m_pMrcpChannel(NULL), m_pSpeakRequest(NULL), m_pAudioOut(NULL) {} -}; - -SynthSession::SynthSession(const SynthScenario* pScenario) : - UmcSession(pScenario), - m_pSynthChannel(NULL) -{ -} - -SynthSession::~SynthSession() -{ -} - -bool SynthSession::Start() -{ - if(!GetScenario()->IsSpeakEnabled()) - return false; - - /* create channel and associate all the required data */ - m_pSynthChannel = CreateSynthChannel(); - if(!m_pSynthChannel) - return false; - - /* add channel to session (send asynchronous request) */ - if(!AddMrcpChannel(m_pSynthChannel->m_pMrcpChannel)) - { - delete m_pSynthChannel; - m_pSynthChannel = NULL; - return false; - } - return true; -} - -bool SynthSession::Stop() -{ - if(!UmcSession::Stop()) - return false; - - if(!m_pSynthChannel) - return false; - - mrcp_message_t* pStopMessage = CreateMrcpMessage(m_pSynthChannel->m_pMrcpChannel,SYNTHESIZER_STOP); - if(!pStopMessage) - return false; - - if(m_pSynthChannel->m_pSpeakRequest) - { - mrcp_generic_header_t* pGenericHeader; - /* get/allocate generic header */ - pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pStopMessage); - if(pGenericHeader) - { - pGenericHeader->active_request_id_list.count = 1; - pGenericHeader->active_request_id_list.ids[0] = - m_pSynthChannel->m_pSpeakRequest->start_line.request_id; - mrcp_generic_header_property_add(pStopMessage,GENERIC_HEADER_ACTIVE_REQUEST_ID_LIST); - } - - m_pSynthChannel->m_pSpeakRequest = NULL; - } - - return SendMrcpRequest(m_pSynthChannel->m_pMrcpChannel,pStopMessage); -} - -bool SynthSession::OnSessionTerminate(mrcp_sig_status_code_e status) -{ - if(m_pSynthChannel) - { - FILE* pAudioOut = m_pSynthChannel->m_pAudioOut; - if(pAudioOut) - { - m_pSynthChannel->m_pAudioOut = NULL; - fclose(pAudioOut); - } - - delete m_pSynthChannel; - m_pSynthChannel = NULL; - } - return UmcSession::OnSessionTerminate(status); -} - -static apt_bool_t WriteStream(mpf_audio_stream_t* pStream, const mpf_frame_t* pFrame) -{ - SynthChannel* pSynthChannel = (SynthChannel*) pStream->obj; - if(pSynthChannel && pSynthChannel->m_pAudioOut) - { - fwrite(pFrame->codec_frame.buffer,1,pFrame->codec_frame.size,pSynthChannel->m_pAudioOut); - } - return TRUE; -} - -SynthChannel* SynthSession::CreateSynthChannel() -{ - mrcp_channel_t* pChannel; - mpf_termination_t* pTermination; - mpf_stream_capabilities_t* pCapabilities; - apr_pool_t* pool = GetSessionPool(); - - /* create channel */ - SynthChannel* pSynthChannel = new SynthChannel; - - /* create sink stream capabilities */ - pCapabilities = mpf_sink_stream_capabilities_create(pool); - GetScenario()->InitCapabilities(pCapabilities); - - static const mpf_audio_stream_vtable_t audio_stream_vtable = - { - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - WriteStream, - NULL - }; - - pTermination = CreateAudioTermination( - &audio_stream_vtable, /* virtual methods table of audio stream */ - pCapabilities, /* capabilities of audio stream */ - pSynthChannel); /* object to associate */ - - pChannel = CreateMrcpChannel( - MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */ - pTermination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - pSynthChannel); /* object to associate */ - if(!pChannel) - { - delete pSynthChannel; - return NULL; - } - - pSynthChannel->m_pMrcpChannel = pChannel; - return pSynthChannel; -} - -bool SynthSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status) -{ - if(!UmcSession::OnChannelAdd(pMrcpChannel,status)) - return false; - - const mpf_codec_descriptor_t* pDescriptor = mrcp_application_sink_descriptor_get(pMrcpChannel); - if(!pDescriptor) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Sink Descriptor"); - return Terminate(); - } - - SynthChannel* pSynthChannel = (SynthChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(status != MRCP_SIG_STATUS_CODE_SUCCESS) - { - /* error case, just terminate the demo */ - return Terminate(); - } - - /* create MRCP message */ - mrcp_message_t* pMrcpMessage = CreateSpeakRequest(pMrcpChannel); - if(pMrcpMessage) - { - SendMrcpRequest(pSynthChannel->m_pMrcpChannel,pMrcpMessage); - } - - pSynthChannel->m_pAudioOut = GetAudioOut(pDescriptor,GetSessionPool()); - return true; -} - -bool SynthSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage) -{ - if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage)) - return false; - - if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) - { - /* received MRCP response */ - if(pMrcpMessage->start_line.method_id == SYNTHESIZER_SPEAK) - { - /* received the response to SPEAK request */ - if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) - { - SynthChannel* pSynthChannel = (SynthChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pSynthChannel) - pSynthChannel->m_pSpeakRequest = GetMrcpMessage(); - - /* waiting for SPEAK-COMPLETE event */ - } - else - { - /* received unexpected response, terminate the session */ - Terminate(); - } - } - else - { - /* received unexpected response */ - } - } - else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) - { - /* received MRCP event */ - if(pMrcpMessage->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) - { - SynthChannel* pSynthChannel = (SynthChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pSynthChannel) - pSynthChannel->m_pSpeakRequest = NULL; - /* received SPEAK-COMPLETE event, terminate the session */ - Terminate(); - } - } - return true; -} - -mrcp_message_t* SynthSession::CreateSpeakRequest(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,SYNTHESIZER_SPEAK); - if(!pMrcpMessage) - return NULL; - - const SynthScenario* pScenario = GetScenario(); - - mrcp_generic_header_t* pGenericHeader; - mrcp_synth_header_t* pSynthHeader; - /* get/allocate generic header */ - pGenericHeader = (mrcp_generic_header_t*) mrcp_generic_header_prepare(pMrcpMessage); - if(pGenericHeader) - { - /* set generic header fields */ - apt_string_assign(&pGenericHeader->content_type,pScenario->GetContentType(),pMrcpMessage->pool); - mrcp_generic_header_property_add(pMrcpMessage,GENERIC_HEADER_CONTENT_TYPE); - - /* set message body */ - if(pScenario->GetContent()) - apt_string_assign(&pMrcpMessage->body,pScenario->GetContent(),pMrcpMessage->pool); - } - /* get/allocate synthesizer header */ - pSynthHeader = (mrcp_synth_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pSynthHeader) - { - /* set synthesizer header fields */ - pSynthHeader->voice_param.age = 28; - mrcp_resource_header_property_add(pMrcpMessage,SYNTHESIZER_HEADER_VOICE_AGE); - } - - return pMrcpMessage; -} - -FILE* SynthSession::GetAudioOut(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const -{ - FILE* file; - char* pFileName = apr_psprintf(pool,"synth-%dkHz-%s.pcm",pDescriptor->sampling_rate/1000, GetMrcpSessionId()); - apt_dir_layout_t* pDirLayout = GetScenario()->GetDirLayout(); - char* pFilePath = apt_vardir_filepath_get(pDirLayout,pFileName,pool); - if(!pFilePath) - return NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Speech Output File [%s] for Writing",pFilePath); - file = fopen(pFilePath,"wb"); - if(!file) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Speech Output File [%s] for Writing",pFilePath); - return NULL; - } - return file; -} diff --git a/libs/unimrcp/platforms/umc/src/umcconsole.cpp b/libs/unimrcp/platforms/umc/src/umcconsole.cpp deleted file mode 100644 index a065208a91..0000000000 --- a/libs/unimrcp/platforms/umc/src/umcconsole.cpp +++ /dev/null @@ -1,333 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: umcconsole.cpp 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "umcconsole.h" -#include "umcframework.h" -#include "apt_pool.h" -#include "uni_version.h" - - -UmcConsole::UmcConsole() : - m_pFramework(NULL) -{ - m_pFramework = new UmcFramework; -} - -UmcConsole::~UmcConsole() -{ - delete m_pFramework; -} - -bool UmcConsole::Run(int argc, const char * const *argv) -{ - apr_pool_t* pool = NULL; - apt_dir_layout_t* pDirLayout = NULL; - const char *logConfPath; - - /* APR global initialization */ - if(apr_initialize() != APR_SUCCESS) - { - apr_terminate(); - return false; - } - - /* create APR pool */ - pool = apt_pool_create(); - if(!pool) - { - apr_terminate(); - return false; - } - - /* load options */ - if(!LoadOptions(argc,argv,pool)) - { - apr_pool_destroy(pool); - apr_terminate(); - return false; - } - - if(m_Options.m_DirLayoutConf) - { - /* create and load directories layout from the configuration file */ - pDirLayout = apt_dir_layout_create(pool); - if(pDirLayout) - apt_dir_layout_load(pDirLayout,m_Options.m_DirLayoutConf,pool); - } - else - { - /* create default directories layout */ - pDirLayout = apt_default_dir_layout_create(m_Options.m_RootDirPath,pool); - } - - if(!pDirLayout) - { - printf("Failed to Create Directories Layout\n"); - apr_pool_destroy(pool); - apr_terminate(); - return false; - } - - /* get path to logger configuration file */ - logConfPath = apt_confdir_filepath_get(pDirLayout,"logger.xml",pool); - /* create and load singleton logger */ - apt_log_instance_load(logConfPath,pool); - - if(m_Options.m_LogPriority) - { - /* override the log priority, if specified in command line */ - apt_log_priority_set((apt_log_priority_e)atoi(m_Options.m_LogPriority)); - } - if(m_Options.m_LogOutput) - { - /* override the log output mode, if specified in command line */ - apt_log_output_mode_set((apt_log_output_e)atoi(m_Options.m_LogOutput)); - } - - if(apt_log_output_mode_check(APT_LOG_OUTPUT_FILE) == TRUE) - { - /* open the log file */ - const char *logDirPath = apt_dir_layout_path_get(pDirLayout,APT_LAYOUT_LOG_DIR); - apt_log_file_open(logDirPath,"unimrcpclient",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,FALSE,pool); - } - - /* create demo framework */ - if(m_pFramework->Create(pDirLayout,pool)) - { - /* run command line */ - RunCmdLine(); - /* destroy demo framework */ - m_pFramework->Destroy(); - } - - /* destroy singleton logger */ - apt_log_instance_destroy(); - /* destroy APR pool */ - apr_pool_destroy(pool); - /* APR global termination */ - apr_terminate(); - return true; -} - -bool UmcConsole::ProcessCmdLine(char* pCmdLine) -{ - bool running = true; - char *name; - char *last; - name = apr_strtok(pCmdLine, " ", &last); - - if(strcasecmp(name,"run") == 0) - { - char* pScenarioName = apr_strtok(NULL, " ", &last); - if(pScenarioName) - { - const char* pProfileName = apr_strtok(NULL, " ", &last); - if(!pProfileName) - { - pProfileName = "uni2"; - } - m_pFramework->RunSession(pScenarioName,pProfileName); - } - } - else if(strcasecmp(name,"kill") == 0) - { - char* pID = apr_strtok(NULL, " ", &last); - if(pID) - { - m_pFramework->KillSession(pID); - } - } - else if(strcasecmp(name,"stop") == 0) - { - char* pID = apr_strtok(NULL, " ", &last); - if(pID) - { - m_pFramework->StopSession(pID); - } - } - else if(strcasecmp(name,"show") == 0) - { - char* pWhat = apr_strtok(NULL, " ", &last); - if(pWhat) - { - if(strcasecmp(pWhat,"sessions") == 0) - m_pFramework->ShowSessions(); - else if(strcasecmp(pWhat,"scenarios") == 0) - m_pFramework->ShowScenarios(); - } - } - else if(strcasecmp(name,"loglevel") == 0) - { - char* pPriority = apr_strtok(NULL, " ", &last); - if(pPriority) - { - apt_log_priority_set((apt_log_priority_e)atol(pPriority)); - } - } - else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) - { - running = false; - } - else if(strcasecmp(name,"help") == 0) - { - printf("usage:\n" - "\n- run [scenario] [profile] (run new session)\n" - " scenario is one of 'synth', 'recog', ... (use 'show scenarios')\n" - " profile is one of 'uni2', 'uni1', ... (see unimrcpclient.xml)\n" - "\n examples: \n" - " run synth\n" - " run recog\n" - " run synth uni1\n" - " run recog uni1\n" - "\n- kill [id] (kill session)\n" - " id is a session identifier: 1, 2, ... (use 'show sessions')\n" - "\n example: \n" - " kill 1\n" - "\n- show [what] (show either available scenarios or in-progress sessions)\n" - "\n examples: \n" - " show scenarios\n" - " show sessions\n" - "\n- loglevel [level] (set loglevel, one of 0,1...7)\n" - "\n- quit, exit\n"); - } - else - { - printf("unknown command: %s (input help for usage)\n",name); - } - return running; -} - -bool UmcConsole::RunCmdLine() -{ - apt_bool_t running = true; - char cmdline[1024]; - apr_size_t i; - do - { - printf(">"); - memset(&cmdline, 0, sizeof(cmdline)); - for(i = 0; i < sizeof(cmdline); i++) - { - cmdline[i] = (char) getchar(); - if(cmdline[i] == '\n') - { - cmdline[i] = '\0'; - break; - } - } - if(*cmdline) - { - running = ProcessCmdLine(cmdline); - } - } - while(running != 0); - return true; -} - -void UmcConsole::Usage() -{ - printf( - "\n" - " * " UNI_COPYRIGHT"\n" - " *\n" - UNI_LICENSE"\n" - "\n" - "Usage:\n" - "\n" - " umc [options]\n" - "\n" - " Available options:\n" - "\n" - " -r [--root-dir] path : Set the path to the project root directory.\n" - "\n" - " -c [--dir-layout] path : Set the path to the dir layout config file.\n" - " (takes the precedence over --root-dir option)\n" - "\n" - " -l [--log-prio] priority : Set the log priority.\n" - " (0-emergency, ..., 7-debug)\n" - "\n" - " -o [--log-output] mode : Set the log output mode.\n" - " (0-none, 1-console only, 2-file only, 3-both)\n" - "\n" - " -v [--version] : Show the version.\n" - "\n" - " -h [--help] : Show the help.\n" - "\n"); -} - -bool UmcConsole::LoadOptions(int argc, const char * const *argv, apr_pool_t *pool) -{ - apr_status_t rv; - apr_getopt_t* opt = NULL; - int optch; - const char* optarg; - - const apr_getopt_option_t opt_option[] = - { - /* long-option, short-option, has-arg flag, description */ - { "root-dir", 'r', TRUE, "path to root dir" }, /* -r arg or --root-dir arg */ - { "dir-layout", 'c', TRUE, "path to dir layout conf" }, /* -c arg or --dir-layout arg */ - { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */ - { "log-output", 'o', TRUE, "log output mode" }, /* -o arg or --log-output arg */ - { "version", 'v', FALSE, "show version" }, /* -v or --version */ - { "help", 'h', FALSE, "show help" }, /* -h or --help */ - { NULL, 0, 0, NULL }, /* end */ - }; - - rv = apr_getopt_init(&opt, pool , argc, argv); - if(rv != APR_SUCCESS) - return false; - - while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) - { - switch(optch) - { - case 'r': - m_Options.m_RootDirPath = optarg; - break; - case 'c': - m_Options.m_DirLayoutConf = optarg; - break; - case 'l': - if(optarg) - m_Options.m_LogPriority = optarg; - break; - case 'o': - if(optarg) - m_Options.m_LogOutput = optarg; - break; - case 'v': - printf(UNI_VERSION_STRING); - return FALSE; - case 'h': - Usage(); - return FALSE; - } - } - - if(rv != APR_EOF) - { - Usage(); - return false; - } - - return true; -} diff --git a/libs/unimrcp/platforms/umc/src/umcframework.cpp b/libs/unimrcp/platforms/umc/src/umcframework.cpp deleted file mode 100644 index 50ac00c415..0000000000 --- a/libs/unimrcp/platforms/umc/src/umcframework.cpp +++ /dev/null @@ -1,632 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: umcframework.cpp 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include "umcframework.h" -#include "umcsession.h" -#include "synthscenario.h" -#include "recogscenario.h" -#include "recorderscenario.h" -#include "dtmfscenario.h" -#include "setparamscenario.h" -#include "verifierscenario.h" -#include "unimrcp_client.h" -#include "apt_log.h" - -typedef struct -{ - char m_SessionId[10]; - char m_ScenarioName[128]; - char m_ProfileName[128]; - const mrcp_app_message_t* m_pAppMessage; -} UmcTaskMsg; - -enum UmcTaskMsgType -{ - UMC_TASK_CLIENT_MSG, - UMC_TASK_RUN_SESSION_MSG, - UMC_TASK_STOP_SESSION_MSG, - UMC_TASK_KILL_SESSION_MSG, - UMC_TASK_SHOW_SCENARIOS_MSG, - UMC_TASK_SHOW_SESSIONS_MSG -}; - -apt_bool_t UmcProcessMsg(apt_task_t* pTask, apt_task_msg_t* pMsg); -void UmcOnStartComplete(apt_task_t* pTask); -void UmcOnTerminateComplete(apt_task_t* pTask); -apt_bool_t AppMessageHandler(const mrcp_app_message_t* pAppMessage); - - -UmcFramework::UmcFramework() : - m_pPool(NULL), - m_pDirLayout(NULL), - m_pTask(NULL), - m_pMrcpClient(NULL), - m_pMrcpApplication(NULL), - m_pScenarioTable(NULL), - m_pSessionTable(NULL) -{ -} - -UmcFramework::~UmcFramework() -{ -} - -bool UmcFramework::Create(apt_dir_layout_t* pDirLayout, apr_pool_t* pool) -{ - m_pDirLayout = pDirLayout; - m_pPool = pool; - - m_pSessionTable = apr_hash_make(m_pPool); - m_pScenarioTable = apr_hash_make(m_pPool); - return CreateTask(); -} - -void UmcFramework::Destroy() -{ - DestroyTask(); - - m_pScenarioTable = NULL; - m_pSessionTable = NULL; -} - -bool UmcFramework::CreateMrcpClient() -{ - /* create MRCP client stack first */ - m_pMrcpClient = unimrcp_client_create(m_pDirLayout); - if(!m_pMrcpClient) - return false; - - /* create MRCP application to send/get requests to/from MRCP client stack */ - m_pMrcpApplication = mrcp_application_create(AppMessageHandler,this,m_pPool); - if(!m_pMrcpApplication) - { - mrcp_client_destroy(m_pMrcpClient); - m_pMrcpClient = NULL; - return false; - } - - /* register MRCP application to MRCP client */ - mrcp_client_application_register(m_pMrcpClient,m_pMrcpApplication,"UMC"); - /* start MRCP client stack processing */ - if(mrcp_client_start(m_pMrcpClient) == FALSE) - { - mrcp_client_destroy(m_pMrcpClient); - m_pMrcpClient = NULL; - m_pMrcpApplication = NULL; - return false; - } - return true; -} - -void UmcFramework::DestroyMrcpClient() -{ - if(m_pMrcpClient) - { - /* shutdown MRCP client stack processing first (blocking call) */ - mrcp_client_shutdown(m_pMrcpClient); - /* destroy MRCP client stack */ - mrcp_client_destroy(m_pMrcpClient); - m_pMrcpClient = NULL; - m_pMrcpApplication = NULL; - } -} - -bool UmcFramework::CreateTask() -{ - apt_task_t* pTask; - apt_task_vtable_t* pVtable; - apt_task_msg_pool_t* pMsgPool; - - pMsgPool = apt_task_msg_pool_create_dynamic(sizeof(UmcTaskMsg),m_pPool); - m_pTask = apt_consumer_task_create(this,pMsgPool,m_pPool); - if(!m_pTask) - return false; - - pTask = apt_consumer_task_base_get(m_pTask); - apt_task_name_set(pTask,"Framework Agent"); - pVtable = apt_consumer_task_vtable_get(m_pTask); - if(pVtable) - { - pVtable->process_msg = UmcProcessMsg; - pVtable->on_start_complete = UmcOnStartComplete; - pVtable->on_terminate_complete = UmcOnTerminateComplete; - } - - apt_task_start(pTask); - return true; -} - -void UmcFramework::DestroyTask() -{ - if(m_pTask) - { - apt_task_t* pTask = apt_consumer_task_base_get(m_pTask); - if(pTask) - { - apt_task_terminate(pTask,TRUE); - apt_task_destroy(pTask); - } - m_pTask = NULL; - } -} - -UmcScenario* UmcFramework::CreateScenario(const char* pType) -{ - if(pType) - { - if(strcasecmp(pType,"Synthesizer") == 0) - return new SynthScenario(); - else if(strcasecmp(pType,"Recognizer") == 0) - return new RecogScenario(); - else if(strcasecmp(pType,"Recorder") == 0) - return new RecorderScenario(); - else if(strcasecmp(pType,"DtmfRecognizer") == 0) - return new DtmfScenario(); - else if(strcasecmp(pType,"Params") == 0) - return new SetParamScenario(); - else if(strcasecmp(pType,"Verifier") == 0) - return new VerifierScenario(); - } - return NULL; -} - -apr_xml_doc* UmcFramework::LoadDocument() -{ - apr_xml_parser* pParser = NULL; - apr_xml_doc* pDoc = NULL; - apr_file_t* pFD = NULL; - apr_status_t rv; - const char* pFilePath; - - pFilePath = apt_dir_layout_path_compose(m_pDirLayout,APT_LAYOUT_CONF_DIR,"umcscenarios.xml",m_pPool); - if(!pFilePath) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Compose Config File Path"); - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Open Config File [%s]",pFilePath); - rv = apr_file_open(&pFD,pFilePath,APR_READ|APR_BINARY,0,m_pPool); - if(rv != APR_SUCCESS) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Config File [%s]",pFilePath); - return NULL; - } - - rv = apr_xml_parse_file(m_pPool,&pParser,&pDoc,pFD,2000); - if(rv != APR_SUCCESS) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Parse Config File [%s]",pFilePath); - pDoc = NULL; - } - - apr_file_close(pFD); - return pDoc; -} - -bool UmcFramework::LoadScenarios() -{ - apr_xml_doc* pDoc = LoadDocument(); - if(!pDoc) - return false; - - const apr_xml_attr* pAttr; - const apr_xml_elem* pElem; - const apr_xml_elem* pRoot = pDoc->root; - if(!pRoot || strcasecmp(pRoot->name,"umcscenarios") != 0) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Document"); - return FALSE; - } - for(pElem = pRoot->first_child; pElem; pElem = pElem->next) - { - if(strcasecmp(pElem->name,"scenario") != 0) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Unknown Element <%s>",pElem->name); - continue; - } - - const char* pName = NULL; - const char* pClass = NULL; - const char* pMrcpProfile = NULL; - for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"name") == 0) - { - pName = pAttr->value; - } - else if(strcasecmp(pAttr->name,"class") == 0) - { - pClass = pAttr->value; - } - else if(strcasecmp(pAttr->name,"profile") == 0) - { - pMrcpProfile = pAttr->value; - } - } - - if(pName && pClass) - { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Load Scenario name [%s] class [%s]",pName,pClass); - UmcScenario* pScenario = CreateScenario(pClass); - if(pScenario) - { - pScenario->SetDirLayout(m_pDirLayout); - pScenario->SetName(pName); - pScenario->SetMrcpProfile(pMrcpProfile); - if(pScenario->Load(pElem,m_pPool)) - apr_hash_set(m_pScenarioTable,pScenario->GetName(),APR_HASH_KEY_STRING,pScenario); - else - delete pScenario; - } - else - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No such scenario <%s>",pClass); - } - } - else - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Missing either name or class of the scenario"); - } - } - return true; -} - -void UmcFramework::DestroyScenarios() -{ - UmcScenario* pScenario; - void* pVal; - apr_hash_index_t* it = apr_hash_first(m_pPool,m_pScenarioTable); - for(; it; it = apr_hash_next(it)) - { - apr_hash_this(it,NULL,NULL,&pVal); - pScenario = (UmcScenario*) pVal; - if(pScenario) - { - pScenario->Destroy(); - delete pScenario; - } - } - apr_hash_clear(m_pScenarioTable); -} - -bool UmcFramework::AddSession(UmcSession* pSession) -{ - if(!pSession) - return false; - - apr_hash_set(m_pSessionTable,pSession->GetId(),APR_HASH_KEY_STRING,pSession); - return true; -} - -bool UmcFramework::RemoveSession(UmcSession* pSession) -{ - if(!pSession) - return false; - - apr_hash_set(m_pSessionTable,pSession->GetId(),APR_HASH_KEY_STRING,NULL); - return true; -} - -bool UmcFramework::ProcessRunRequest(const char* pScenarioName, const char* pProfileName) -{ - UmcScenario* pScenario = (UmcScenario*) apr_hash_get(m_pScenarioTable,pScenarioName,APR_HASH_KEY_STRING); - if(!pScenario) - return false; - - UmcSession* pSession = pScenario->CreateSession(); - if(!pSession) - return false; - - printf("[%s]\n",pSession->GetId()); - pSession->SetMrcpProfile(pProfileName); - pSession->SetMrcpApplication(m_pMrcpApplication); - if(!pSession->Run()) - { - delete pSession; - return false; - } - - AddSession(pSession); - return true; -} - -void UmcFramework::ProcessStopRequest(const char* id) -{ - UmcSession* pSession; - void* pVal; - apr_hash_index_t* it = apr_hash_first(m_pPool,m_pSessionTable); - for(; it; it = apr_hash_next(it)) - { - apr_hash_this(it,NULL,NULL,&pVal); - pSession = (UmcSession*) pVal; - if(pSession && strcasecmp(pSession->GetId(),id) == 0) - { - /* stop in-progress request */ - pSession->Stop(); - return; - } - } -} - -void UmcFramework::ProcessKillRequest(const char* id) -{ - UmcSession* pSession; - void* pVal; - apr_hash_index_t* it = apr_hash_first(m_pPool,m_pSessionTable); - for(; it; it = apr_hash_next(it)) - { - apr_hash_this(it,NULL,NULL,&pVal); - pSession = (UmcSession*) pVal; - if(pSession && strcasecmp(pSession->GetId(),id) == 0) - { - /* terminate session */ - pSession->Terminate(); - return; - } - } -} - -void UmcFramework::ProcessShowScenarios() -{ - UmcScenario* pScenario; - void* pVal; - printf("%d Scenario(s)\n", apr_hash_count(m_pScenarioTable)); - apr_hash_index_t* it = apr_hash_first(m_pPool,m_pScenarioTable); - for(; it; it = apr_hash_next(it)) - { - apr_hash_this(it,NULL,NULL,&pVal); - pScenario = (UmcScenario*) pVal; - if(pScenario) - { - printf("[%s]\n", pScenario->GetName()); - } - } -} - -void UmcFramework::ProcessShowSessions() -{ - UmcSession* pSession; - void* pVal; - printf("%d Session(s)\n", apr_hash_count(m_pSessionTable)); - apr_hash_index_t* it = apr_hash_first(m_pPool,m_pSessionTable); - for(; it; it = apr_hash_next(it)) - { - apr_hash_this(it,NULL,NULL,&pVal); - pSession = (UmcSession*) pVal; - if(pSession) - { - printf("[%s] - %s\n", pSession->GetId(), pSession->GetScenario()->GetName()); - } - } -} - -void UmcFramework::RunSession(const char* pScenarioName, const char* pProfileName) -{ - apt_task_t* pTask = apt_consumer_task_base_get(m_pTask); - apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask); - if(!pTaskMsg) - return; - - pTaskMsg->type = TASK_MSG_USER; - pTaskMsg->sub_type = UMC_TASK_RUN_SESSION_MSG; - UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data; - strncpy(pUmcMsg->m_ScenarioName,pScenarioName,sizeof(pUmcMsg->m_ScenarioName)-1); - strncpy(pUmcMsg->m_ProfileName,pProfileName,sizeof(pUmcMsg->m_ProfileName)-1); - pUmcMsg->m_pAppMessage = NULL; - apt_task_msg_signal(pTask,pTaskMsg); -} - -void UmcFramework::StopSession(const char* id) -{ - apt_task_t* pTask = apt_consumer_task_base_get(m_pTask); - apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask); - if(!pTaskMsg) - return; - - pTaskMsg->type = TASK_MSG_USER; - pTaskMsg->sub_type = UMC_TASK_STOP_SESSION_MSG; - - UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data; - strncpy(pUmcMsg->m_SessionId,id,sizeof(pUmcMsg->m_SessionId)-1); - pUmcMsg->m_pAppMessage = NULL; - apt_task_msg_signal(pTask,pTaskMsg); -} - -void UmcFramework::KillSession(const char* id) -{ - apt_task_t* pTask = apt_consumer_task_base_get(m_pTask); - apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask); - if(!pTaskMsg) - return; - - pTaskMsg->type = TASK_MSG_USER; - pTaskMsg->sub_type = UMC_TASK_KILL_SESSION_MSG; - - UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data; - strncpy(pUmcMsg->m_SessionId,id,sizeof(pUmcMsg->m_SessionId)-1); - pUmcMsg->m_pAppMessage = NULL; - apt_task_msg_signal(pTask,pTaskMsg); -} - -void UmcFramework::ShowScenarios() -{ - apt_task_t* pTask = apt_consumer_task_base_get(m_pTask); - apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask); - if(!pTaskMsg) - return; - - pTaskMsg->type = TASK_MSG_USER; - pTaskMsg->sub_type = UMC_TASK_SHOW_SCENARIOS_MSG; - apt_task_msg_signal(pTask,pTaskMsg); -} - -void UmcFramework::ShowSessions() -{ - apt_task_t* pTask = apt_consumer_task_base_get(m_pTask); - apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask); - if(!pTaskMsg) - return; - - pTaskMsg->type = TASK_MSG_USER; - pTaskMsg->sub_type = UMC_TASK_SHOW_SESSIONS_MSG; - apt_task_msg_signal(pTask,pTaskMsg); -} - -apt_bool_t AppMessageHandler(const mrcp_app_message_t* pMessage) -{ - UmcFramework* pFramework = (UmcFramework*) mrcp_application_object_get(pMessage->application); - if(!pFramework) - return FALSE; - - apt_task_t* pTask = apt_consumer_task_base_get(pFramework->m_pTask); - apt_task_msg_t* pTaskMsg = apt_task_msg_get(pTask); - if(pTaskMsg) - { - pTaskMsg->type = TASK_MSG_USER; - pTaskMsg->sub_type = UMC_TASK_CLIENT_MSG; - - UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pTaskMsg->data; - pUmcMsg->m_pAppMessage = pMessage; - apt_task_msg_signal(pTask,pTaskMsg); - } - - return TRUE; -} - - -apt_bool_t AppOnSessionUpdate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); - return pSession->OnSessionUpdate(status); -} - -apt_bool_t AppOnSessionTerminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); - if(!pSession->OnSessionTerminate(status)) - return false; - - UmcFramework* pFramework = (UmcFramework*) mrcp_application_object_get(application); - pFramework->RemoveSession(pSession); - delete pSession; - return true; -} - -apt_bool_t AppOnChannelAdd(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); - return pSession->OnChannelAdd(channel,status); -} - -apt_bool_t AppOnChannelRemove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); - return pSession->OnChannelRemove(channel,status); -} - -apt_bool_t AppOnMessageReceive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); - return pSession->OnMessageReceive(channel,message); -} - -apt_bool_t AppOnTerminateEvent(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel) -{ - UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); - return pSession->OnTerminateEvent(channel); -} - -apt_bool_t AppOnResourceDiscover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status) -{ - UmcSession* pSession = (UmcSession*) mrcp_application_session_object_get(session); - return pSession->OnResourceDiscover(descriptor,status); -} - -void UmcOnStartComplete(apt_task_t* pTask) -{ - apt_consumer_task_t* pConsumerTask = (apt_consumer_task_t*) apt_task_object_get(pTask); - UmcFramework* pFramework = (UmcFramework*) apt_consumer_task_object_get(pConsumerTask); - - pFramework->CreateMrcpClient(); - pFramework->LoadScenarios(); -} - -void UmcOnTerminateComplete(apt_task_t* pTask) -{ - apt_consumer_task_t* pConsumerTask = (apt_consumer_task_t*) apt_task_object_get(pTask); - UmcFramework* pFramework = (UmcFramework*) apt_consumer_task_object_get(pConsumerTask); - - pFramework->DestroyMrcpClient(); - pFramework->DestroyScenarios(); -} - -apt_bool_t UmcProcessMsg(apt_task_t *pTask, apt_task_msg_t *pMsg) -{ - if(pMsg->type != TASK_MSG_USER) - return FALSE; - - apt_consumer_task_t* pConsumerTask = (apt_consumer_task_t*) apt_task_object_get(pTask); - UmcFramework* pFramework = (UmcFramework*) apt_consumer_task_object_get(pConsumerTask); - UmcTaskMsg* pUmcMsg = (UmcTaskMsg*) pMsg->data; - switch(pMsg->sub_type) - { - case UMC_TASK_CLIENT_MSG: - { - static const mrcp_app_message_dispatcher_t applicationDispatcher = - { - AppOnSessionUpdate, - AppOnSessionTerminate, - AppOnChannelAdd, - AppOnChannelRemove, - AppOnMessageReceive, - AppOnTerminateEvent, - AppOnResourceDiscover - }; - - mrcp_application_message_dispatch(&applicationDispatcher,pUmcMsg->m_pAppMessage); - break; - } - case UMC_TASK_RUN_SESSION_MSG: - { - pFramework->ProcessRunRequest(pUmcMsg->m_ScenarioName,pUmcMsg->m_ProfileName); - break; - } - case UMC_TASK_STOP_SESSION_MSG: - { - pFramework->ProcessStopRequest(pUmcMsg->m_SessionId); - break; - } - case UMC_TASK_KILL_SESSION_MSG: - { - pFramework->ProcessKillRequest(pUmcMsg->m_SessionId); - break; - } - case UMC_TASK_SHOW_SCENARIOS_MSG: - { - pFramework->ProcessShowScenarios(); - break; - } - case UMC_TASK_SHOW_SESSIONS_MSG: - { - pFramework->ProcessShowSessions(); - break; - } - } - return TRUE; -} diff --git a/libs/unimrcp/platforms/umc/src/umcscenario.cpp b/libs/unimrcp/platforms/umc/src/umcscenario.cpp deleted file mode 100644 index d9300dcf3c..0000000000 --- a/libs/unimrcp/platforms/umc/src/umcscenario.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: umcscenario.cpp 2232 2014-11-12 01:33:37Z achaloyan@gmail.com $ - */ - -#include -#include "umcscenario.h" -#include "apt_log.h" - -UmcScenario::UmcScenario() : - m_pName(NULL), - m_pMrcpProfile("uni2"), - m_pDirLayout(NULL), - m_ResourceDiscovery(false), - m_pCapabilities(NULL), - m_pRtpDescriptor(NULL) -{ -} - -UmcScenario::~UmcScenario() -{ -} - -bool UmcScenario::Load(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - const apr_xml_elem* pChildElem; - /* Load Child Elements */ - for(pChildElem = pElem->first_child; pChildElem; pChildElem = pChildElem->next) - { - if(!LoadElement(pChildElem,pool)) - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Load Child Element %s",pChildElem->name); - } - return true; -} - -void UmcScenario::Destroy() -{ -} - -bool UmcScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - if(strcasecmp(pElem->name,"resource-discovery") == 0) - { - LoadDiscovery(pElem,pool); - return true; - } - else if(strcasecmp(pElem->name,"termination") == 0) - { - LoadTermination(pElem,pool); - return true; - } - else if(strcasecmp(pElem->name,"rtp-termination") == 0) - { - LoadRtpTermination(pElem,pool); - return true; - } - - return false; -} - -bool UmcScenario::LoadDiscovery(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - m_ResourceDiscovery = IsElementEnabled(pElem); - return true; -} - -bool UmcScenario::LoadTermination(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - if(!IsElementEnabled(pElem)) - return true; - - const apr_xml_elem* pChildElem; - /* Load Child Elements */ - for(pChildElem = pElem->first_child; pChildElem; pChildElem = pChildElem->next) - { - if(strcasecmp(pChildElem->name,"capabilities") == 0) - return LoadCapabilities(pChildElem,pool); - } - return true; -} - -bool UmcScenario::LoadCapabilities(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - const apr_xml_elem* pChildElem; - /* Load Child Elements */ - m_pCapabilities = (mpf_codec_capabilities_t*) apr_palloc(pool,sizeof(mpf_codec_capabilities_t)); - mpf_codec_capabilities_init(m_pCapabilities,1,pool); - for(pChildElem = pElem->first_child; pChildElem; pChildElem = pChildElem->next) - { - if(strcasecmp(pChildElem->name,"codec") != 0) - continue; - - const char* pName = NULL; - const char* pRates = NULL; - const apr_xml_attr* pAttr; - for(pAttr = pChildElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"name") == 0) - { - pName = pAttr->value; - } - else if(strcasecmp(pAttr->name,"rates") == 0) - { - pRates = pAttr->value; - } - } - - if(pName) - { - int rates = ParseRates(pRates,pool); - mpf_codec_capabilities_add(m_pCapabilities,rates,pName); - } - } - return true; -} - -int UmcScenario::ParseRates(const char* pStr, apr_pool_t* pool) -{ - int rates = 0; - if(pStr) - { - char* pRateStr; - char* pState; - char* pRateListStr = apr_pstrdup(pool,pStr); - do - { - pRateStr = apr_strtok(pRateListStr, " ", &pState); - if(pRateStr) - { - apr_uint16_t rate = (apr_uint16_t)atoi(pRateStr); - rates |= mpf_sample_rate_mask_get(rate); - } - pRateListStr = NULL; /* make sure we pass NULL on subsequent calls of apr_strtok() */ - } - while(pRateStr); - } - return rates; -} - -bool UmcScenario::LoadRtpTermination(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - return true; -} - -bool UmcScenario::InitCapabilities(mpf_stream_capabilities_t* pCapabilities) const -{ - if(m_pCapabilities) - { - int i; - mpf_codec_attribs_t *pAttribs; - for(i=0; iattrib_arr->nelts; i++) - { - pAttribs = &APR_ARRAY_IDX(m_pCapabilities->attrib_arr,i,mpf_codec_attribs_t); - mpf_codec_capabilities_add( - &pCapabilities->codecs, - pAttribs->sample_rates, - pAttribs->name.buf); - } - } - else - { - /* add default codec capabilities (Linear PCM) */ - mpf_codec_capabilities_add( - &pCapabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "LPCM"); - } - - return true; -} - -bool UmcScenario::IsElementEnabled(const apr_xml_elem* pElem) -{ - const apr_xml_attr* pAttr; - for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"enable") == 0) - { - return atoi(pAttr->value) > 0; - } - } - return true; -} - -const char* UmcScenario::LoadFileContent(const char* pFileName, apr_size_t& size, apr_pool_t* pool) const -{ - if(!m_pDirLayout || !pFileName) - return NULL; - - char* pFilePath = apt_datadir_filepath_get(m_pDirLayout,pFileName,pool); - if(!pFilePath) - return NULL; - - apr_file_t *pFile; - if(apr_file_open(&pFile,pFilePath,APR_FOPEN_READ|APR_FOPEN_BINARY,0,pool) != APR_SUCCESS) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File %s",pFilePath); - return NULL; - } - - apr_finfo_t finfo; - if(apr_file_info_get(&finfo,APR_FINFO_SIZE,pFile) != APR_SUCCESS) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get File Info %s",pFilePath); - apr_file_close(pFile); - return NULL; - } - - size = (apr_size_t)finfo.size; - char* pContent = (char*) apr_palloc(pool,size+1); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Load File Content size [%" APR_SIZE_T_FMT" bytes] %s",size,pFilePath); - if(apr_file_read(pFile,pContent,&size) != APR_SUCCESS) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Read Content %s",pFilePath); - apr_file_close(pFile); - return NULL; - } - pContent[size] = '\0'; - apr_file_close(pFile); - return pContent; -} diff --git a/libs/unimrcp/platforms/umc/src/umcsession.cpp b/libs/unimrcp/platforms/umc/src/umcsession.cpp deleted file mode 100644 index 29618e0925..0000000000 --- a/libs/unimrcp/platforms/umc/src/umcsession.cpp +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: umcsession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "umcsession.h" -#include "umcscenario.h" -#include "mrcp_message.h" - -UmcSession::UmcSession(const UmcScenario* pScenario) : - m_pScenario(pScenario), - m_pMrcpProfile(NULL), - m_pMrcpApplication(NULL), - m_pMrcpSession(NULL), - m_pMrcpMessage(NULL), - m_Running(false), - m_Terminating(false) -{ - static int id = 0; - if(id == INT_MAX) - id = 0; - id++; - - int size = apr_snprintf(m_Id,sizeof(m_Id)-1,"%d",id); - m_Id[size] = '\0'; -} - -UmcSession::~UmcSession() -{ -} - -bool UmcSession::Run() -{ - if(m_Running) - return false; - - if(!m_pMrcpProfile) - m_pMrcpProfile = m_pScenario->GetMrcpProfile(); - - if(!m_pMrcpProfile || !m_pMrcpApplication) - return false; - - /* create session */ - if(!CreateMrcpSession(m_pMrcpProfile)) - return false; - - m_Running = true; - - bool ret = false; - if(m_pScenario->IsDiscoveryEnabled()) - ret = ResourceDiscover(); - else - ret = Start(); - - if(!ret) - { - m_Running = false; - DestroyMrcpSession(); - } - return ret; -} - -bool UmcSession::Stop() -{ - if(m_Terminating) - return false; - - return true; -} - -bool UmcSession::Terminate() -{ - if(m_Terminating) - return false; - - m_Running = false; - m_Terminating = true; - return (mrcp_application_session_terminate(m_pMrcpSession) == TRUE); -} - -bool UmcSession::OnSessionTerminate(mrcp_sig_status_code_e status) -{ - if(!m_Terminating) - return false; - - m_Terminating = false; - return DestroyMrcpSession(); -} - -bool UmcSession::OnSessionUpdate(mrcp_sig_status_code_e status) -{ - return m_Running; -} - -bool UmcSession::OnChannelAdd(mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - return m_Running; -} - -bool UmcSession::OnChannelRemove(mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - return m_Running; -} - -bool UmcSession::OnMessageReceive(mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(!m_Running) - return false; - - if(!m_pMrcpMessage) - return false; - - /* match request identifiers */ - if(m_pMrcpMessage->start_line.request_id != message->start_line.request_id) - return false; - - return true; -} - -bool UmcSession::OnTerminateEvent(mrcp_channel_t *channel) -{ - if(!m_Running) - return false; - - return Terminate(); -} - -bool UmcSession::OnResourceDiscover(mrcp_session_descriptor_t* descriptor, mrcp_sig_status_code_e status) -{ - if(!m_Running) - return false; - - if(!Start()) - Terminate(); - return true; -} - -bool UmcSession::CreateMrcpSession(const char* pProfileName) -{ - m_pMrcpSession = mrcp_application_session_create(m_pMrcpApplication,pProfileName,this); - char name[32]; - apr_snprintf(name,sizeof(name),"umc-%s",m_Id); - mrcp_application_session_name_set(m_pMrcpSession,name); - return (m_pMrcpSession != NULL); -} - -bool UmcSession::DestroyMrcpSession() -{ - if(!m_pMrcpSession) - return false; - - mrcp_application_session_destroy(m_pMrcpSession); - m_pMrcpSession = NULL; - return true; -} - -bool UmcSession::AddMrcpChannel(mrcp_channel_t* pMrcpChannel) -{ - if(!m_Running) - return false; - - return (mrcp_application_channel_add(m_pMrcpSession,pMrcpChannel) == TRUE); -} - -bool UmcSession::RemoveMrcpChannel(mrcp_channel_t* pMrcpChannel) -{ - if(!m_Running) - return false; - - return (mrcp_application_channel_remove(m_pMrcpSession,pMrcpChannel) == TRUE); -} - -bool UmcSession::SendMrcpRequest(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage) -{ - if(!m_Running) - return false; - - m_pMrcpMessage = pMrcpMessage; - return (mrcp_application_message_send(m_pMrcpSession,pMrcpChannel,pMrcpMessage) == TRUE); -} - -bool UmcSession::ResourceDiscover() -{ - if(!m_Running) - return false; - - return (mrcp_application_resource_discover(m_pMrcpSession) == TRUE); -} - -mrcp_channel_t* UmcSession::CreateMrcpChannel( - mrcp_resource_id resource_id, - mpf_termination_t* pTermination, - mpf_rtp_termination_descriptor_t* pRtpDescriptor, - void* pObj) -{ - return mrcp_application_channel_create( - m_pMrcpSession, /* session, channel belongs to */ - resource_id, /* MRCP resource identifier */ - pTermination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - pObj); /* object to associate */ -} - -mpf_termination_t* UmcSession::CreateAudioTermination( - const mpf_audio_stream_vtable_t* pStreamVtable, - mpf_stream_capabilities_t* pCapabilities, - void* pObj) -{ - return mrcp_application_audio_termination_create( - m_pMrcpSession, /* session, termination belongs to */ - pStreamVtable, /* virtual methods table of audio stream */ - pCapabilities, /* capabilities of audio stream */ - pObj); /* object to associate */ -} - -mrcp_message_t* UmcSession::CreateMrcpMessage( - mrcp_channel_t* pMrcpChannel, - mrcp_method_id method_id) -{ - return mrcp_application_message_create(m_pMrcpSession,pMrcpChannel,method_id); -} - - - -apr_pool_t* UmcSession::GetSessionPool() const -{ - if(!m_pMrcpSession) - return NULL; - return mrcp_application_session_pool_get(m_pMrcpSession); -} - -const char* UmcSession::GetMrcpSessionId() const -{ - if(!m_pMrcpSession) - return NULL; - - const apt_str_t *pId = mrcp_application_session_id_get(m_pMrcpSession); - return pId->buf; -} diff --git a/libs/unimrcp/platforms/umc/src/verifierscenario.cpp b/libs/unimrcp/platforms/umc/src/verifierscenario.cpp deleted file mode 100644 index e11d3f6e93..0000000000 --- a/libs/unimrcp/platforms/umc/src/verifierscenario.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: verifierscenario.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "verifierscenario.h" -#include "verifiersession.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -#include "apt_log.h" - -VerifierScenario::VerifierScenario() : - m_RepositoryURI(NULL), - m_VerificationMode(NULL), - m_VoiceprintIdentifier(NULL) -{ -} - -VerifierScenario::~VerifierScenario() -{ -} - -void VerifierScenario::Destroy() -{ -} - -bool VerifierScenario::LoadElement(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - if(UmcScenario::LoadElement(pElem,pool)) - return true; - - if(strcasecmp(pElem->name,"verify") == 0) - { - LoadVerify(pElem,pool); - return true; - } - return false; -} - -bool VerifierScenario::LoadVerify(const apr_xml_elem* pElem, apr_pool_t* pool) -{ - const apr_xml_attr* pAttr; - for(pAttr = pElem->attr; pAttr; pAttr = pAttr->next) - { - if(strcasecmp(pAttr->name,"repository-uri") == 0) - { - m_RepositoryURI = pAttr->value; - } - else if(strcasecmp(pAttr->name,"verification-mode") == 0) - { - m_VerificationMode = pAttr->value; - } - else if(strcasecmp(pAttr->name,"voiceprint-identifier") == 0) - { - m_VoiceprintIdentifier = pAttr->value; - } - } - - return true; -} - - -UmcSession* VerifierScenario::CreateSession() -{ - return new VerifierSession(this); -} diff --git a/libs/unimrcp/platforms/umc/src/verifiersession.cpp b/libs/unimrcp/platforms/umc/src/verifiersession.cpp deleted file mode 100644 index c9da9f4465..0000000000 --- a/libs/unimrcp/platforms/umc/src/verifiersession.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: verifiersession.cpp 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "verifiersession.h" -#include "verifierscenario.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_verifier_header.h" -#include "mrcp_verifier_resource.h" -#include "apt_nlsml_doc.h" -#include "apt_log.h" - -struct VerifierChannel -{ - /** MRCP control channel */ - mrcp_channel_t* m_pMrcpChannel; - /** IN-PROGRESS VERIFY request */ - mrcp_message_t* m_pVerificationRequest; - /** Streaming is in-progress */ - bool m_Streaming; - /** File to read audio stream from */ - FILE* m_pAudioIn; - /** Estimated time to complete (used if no audio_in available) */ - apr_size_t m_TimeToComplete; - - VerifierChannel() : - m_pMrcpChannel(NULL), - m_pVerificationRequest(NULL), - m_Streaming(false), - m_pAudioIn(NULL), - m_TimeToComplete(0) {} -}; - -VerifierSession::VerifierSession(const VerifierScenario* pScenario) : - UmcSession(pScenario), - m_pVerifierChannel(NULL), - m_ContentId("request1@form-level") -{ -} - -VerifierSession::~VerifierSession() -{ -} - -bool VerifierSession::Start() -{ - /* create channel and associate all the required data */ - m_pVerifierChannel = CreateVerifierChannel(); - if(!m_pVerifierChannel) - return false; - - /* add channel to session (send asynchronous request) */ - if(!AddMrcpChannel(m_pVerifierChannel->m_pMrcpChannel)) - { - delete m_pVerifierChannel; - m_pVerifierChannel = NULL; - return false; - } - return true; -} - -bool VerifierSession::Stop() -{ - if(!UmcSession::Stop()) - return false; - - if(!m_pVerifierChannel) - return false; - - mrcp_message_t* pStopMessage = CreateMrcpMessage(m_pVerifierChannel->m_pMrcpChannel,VERIFIER_STOP); - if(!pStopMessage) - return false; - - return SendMrcpRequest(m_pVerifierChannel->m_pMrcpChannel,pStopMessage); -} - -bool VerifierSession::OnSessionTerminate(mrcp_sig_status_code_e status) -{ - if(m_pVerifierChannel) - { - FILE* pAudioIn = m_pVerifierChannel->m_pAudioIn; - if(pAudioIn) - { - m_pVerifierChannel->m_pAudioIn = NULL; - fclose(pAudioIn); - } - - delete m_pVerifierChannel; - m_pVerifierChannel = NULL; - } - return UmcSession::OnSessionTerminate(status); -} - -static apt_bool_t ReadStream(mpf_audio_stream_t* pStream, mpf_frame_t* pFrame) -{ - VerifierChannel* pVerifierChannel = (VerifierChannel*) pStream->obj; - if(pVerifierChannel && pVerifierChannel->m_Streaming) - { - if(pVerifierChannel->m_pAudioIn) - { - if(fread(pFrame->codec_frame.buffer,1,pFrame->codec_frame.size,pVerifierChannel->m_pAudioIn) == pFrame->codec_frame.size) - { - /* normal read */ - pFrame->type |= MEDIA_FRAME_TYPE_AUDIO; - } - else - { - /* file is over */ - pVerifierChannel->m_Streaming = false; - } - } - else - { - /* fill with silence in case no file available */ - if(pVerifierChannel->m_TimeToComplete >= CODEC_FRAME_TIME_BASE) - { - pFrame->type |= MEDIA_FRAME_TYPE_AUDIO; - memset(pFrame->codec_frame.buffer,0,pFrame->codec_frame.size); - pVerifierChannel->m_TimeToComplete -= CODEC_FRAME_TIME_BASE; - } - else - { - pVerifierChannel->m_Streaming = false; - } - } - } - return TRUE; -} - -VerifierChannel* VerifierSession::CreateVerifierChannel() -{ - mrcp_channel_t* pChannel; - mpf_termination_t* pTermination; - mpf_stream_capabilities_t* pCapabilities; - apr_pool_t* pool = GetSessionPool(); - - /* create channel */ - VerifierChannel* pVerifierChannel = new VerifierChannel; - - /* create source stream capabilities */ - pCapabilities = mpf_source_stream_capabilities_create(pool); - GetScenario()->InitCapabilities(pCapabilities); - - static const mpf_audio_stream_vtable_t audio_stream_vtable = - { - NULL, - NULL, - NULL, - ReadStream, - NULL, - NULL, - NULL, - NULL - }; - - pTermination = CreateAudioTermination( - &audio_stream_vtable, /* virtual methods table of audio stream */ - pCapabilities, /* capabilities of audio stream */ - pVerifierChannel); /* object to associate */ - - pChannel = CreateMrcpChannel( - MRCP_VERIFIER_RESOURCE, /* MRCP resource identifier */ - pTermination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - pVerifierChannel); /* object to associate */ - if(!pChannel) - { - delete pVerifierChannel; - return NULL; - } - - pVerifierChannel->m_pMrcpChannel = pChannel; - return pVerifierChannel; -} - -bool VerifierSession::OnChannelAdd(mrcp_channel_t* pMrcpChannel, mrcp_sig_status_code_e status) -{ - if(!UmcSession::OnChannelAdd(pMrcpChannel,status)) - return false; - - if(status != MRCP_SIG_STATUS_CODE_SUCCESS) - { - /* error case, just terminate the demo */ - return Terminate(); - } - - return StartVerification(pMrcpChannel); -} - -bool VerifierSession::OnMessageReceive(mrcp_channel_t* pMrcpChannel, mrcp_message_t* pMrcpMessage) -{ - if(!UmcSession::OnMessageReceive(pMrcpChannel,pMrcpMessage)) - return false; - - VerifierChannel* pVerifierChannel = (VerifierChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) - { - /* received MRCP response */ - if(pMrcpMessage->start_line.method_id == VERIFIER_START_SESSION) - { - /* received the response to START-SESSION request */ - /* create and send VERIFY request */ - mrcp_message_t* pMrcpMessage = CreateVerificationRequest(pMrcpChannel); - if(pMrcpMessage) - { - SendMrcpRequest(pVerifierChannel->m_pMrcpChannel,pMrcpMessage); - } - } - else if(pMrcpMessage->start_line.method_id == VERIFIER_END_SESSION) - { - /* received the response to END-SESSION request */ - Terminate(); - } - else if(pMrcpMessage->start_line.method_id == VERIFIER_VERIFY) - { - /* received the response to VERIFY request */ - if(pMrcpMessage->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) - { - VerifierChannel* pVerifierChannel = (VerifierChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pVerifierChannel) - pVerifierChannel->m_pVerificationRequest = GetMrcpMessage(); - - /* start to stream the speech to Verify */ - if(pVerifierChannel) - pVerifierChannel->m_Streaming = true; - } - else - { - /* create and send END-SESSION request */ - mrcp_message_t* pMrcpMessage = CreateEndSessionRequest(pMrcpChannel); - if(pMrcpMessage) - { - SendMrcpRequest(pVerifierChannel->m_pMrcpChannel,pMrcpMessage); - } - } - } - else - { - /* received unexpected response */ - } - } - else if(pMrcpMessage->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) - { - if(pMrcpMessage->start_line.method_id == VERIFIER_VERIFICATION_COMPLETE) - { - if(pVerifierChannel) - pVerifierChannel->m_Streaming = false; - - VerifierChannel* pVerifierChannel = (VerifierChannel*) mrcp_application_channel_object_get(pMrcpChannel); - if(pVerifierChannel) - pVerifierChannel->m_pVerificationRequest = NULL; - - /* create and send END-SESSION request */ - mrcp_message_t* pMrcpMessage = CreateEndSessionRequest(pMrcpChannel); - if(pVerifierChannel && pMrcpMessage) - { - SendMrcpRequest(pVerifierChannel->m_pMrcpChannel,pMrcpMessage); - } - } - else if(pMrcpMessage->start_line.method_id == VERIFIER_START_OF_INPUT) - { - /* received start-of-input, do whatever you need here */ - } - } - return true; -} - -bool VerifierSession::StartVerification(mrcp_channel_t* pMrcpChannel) -{ - const mpf_codec_descriptor_t* pDescriptor = mrcp_application_source_descriptor_get(pMrcpChannel); - if(!pDescriptor) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Source Descriptor"); - return Terminate(); - } - - VerifierChannel* pVerifierChannel = (VerifierChannel*) mrcp_application_channel_object_get(pMrcpChannel); - /* create and send Verification request */ - mrcp_message_t* pMrcpMessage = CreateStartSessionRequest(pMrcpChannel); - if(pMrcpMessage) - { - SendMrcpRequest(pVerifierChannel->m_pMrcpChannel,pMrcpMessage); - } - - pVerifierChannel->m_pAudioIn = GetAudioIn(pDescriptor,GetSessionPool()); - if(!pVerifierChannel->m_pAudioIn) - { - /* no audio input availble, set some estimated time to complete instead */ - pVerifierChannel->m_TimeToComplete = 5000; // 5 sec - } - return true; -} - -mrcp_message_t* VerifierSession::CreateStartSessionRequest(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,VERIFIER_START_SESSION); - if(!pMrcpMessage) - return NULL; - - mrcp_verifier_header_t* pVerifierHeader; - - /* get/allocate verifier header */ - pVerifierHeader = (mrcp_verifier_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pVerifierHeader) - { - const VerifierScenario* pScenario = GetScenario(); - const char* pRepositoryURI = pScenario->GetRepositoryURI(); - if(pRepositoryURI) - { - apt_string_set(&pVerifierHeader->repository_uri,pRepositoryURI); - mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_REPOSITORY_URI); - } - const char* pVoiceprintIdentifier = pScenario->GetVoiceprintIdentifier(); - if(pVoiceprintIdentifier) - { - apt_string_set(&pVerifierHeader->voiceprint_identifier,pVoiceprintIdentifier); - mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_VOICEPRINT_IDENTIFIER); - } - const char* pVerificationMode = pScenario->GetVerificationMode(); - if(pVerificationMode) - { - apt_string_set(&pVerifierHeader->verification_mode,pVerificationMode); - mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_VERIFICATION_MODE); - } - } - return pMrcpMessage; -} - -mrcp_message_t* VerifierSession::CreateEndSessionRequest(mrcp_channel_t* pMrcpChannel) -{ - return CreateMrcpMessage(pMrcpChannel,VERIFIER_END_SESSION); -} - -mrcp_message_t* VerifierSession::CreateVerificationRequest(mrcp_channel_t* pMrcpChannel) -{ - mrcp_message_t* pMrcpMessage = CreateMrcpMessage(pMrcpChannel,VERIFIER_VERIFY); - if(!pMrcpMessage) - return NULL; - - mrcp_verifier_header_t* pVerifierHeader; - - /* get/allocate verifier header */ - pVerifierHeader = (mrcp_verifier_header_t*) mrcp_resource_header_prepare(pMrcpMessage); - if(pVerifierHeader) - { - pVerifierHeader->no_input_timeout = 5000; - mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_NO_INPUT_TIMEOUT); - pVerifierHeader->start_input_timers = TRUE; - mrcp_resource_header_property_add(pMrcpMessage,VERIFIER_HEADER_START_INPUT_TIMERS); - } - return pMrcpMessage; -} - -FILE* VerifierSession::GetAudioIn(const mpf_codec_descriptor_t* pDescriptor, apr_pool_t* pool) const -{ - const VerifierScenario* pScenario = GetScenario(); - const char* pVoiceprintIdentifier = pScenario->GetVoiceprintIdentifier(); - if(!pVoiceprintIdentifier) - { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Voiceprint Specified"); - return NULL; - } - - const char* pFileName = apr_psprintf(pool,"%s-%dkHz.pcm", - pVoiceprintIdentifier, - pDescriptor->sampling_rate/1000); - apt_dir_layout_t* pDirLayout = pScenario->GetDirLayout(); - const char* pFilePath = apt_datadir_filepath_get(pDirLayout,pFileName,pool); - if(!pFilePath) - return NULL; - - FILE* pFile = fopen(pFilePath,"rb"); - if(!pFile) - { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",pFilePath); - return NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",pFilePath); - return pFile; -} diff --git a/libs/unimrcp/platforms/umc/umc.rc b/libs/unimrcp/platforms/umc/umc.rc deleted file mode 100644 index 98a3cf9209..0000000000 --- a/libs/unimrcp/platforms/umc/umc.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include "uni_version.h" - -1 VERSIONINFO - FILEVERSION UNI_VERSION_STRING_CSV,0 - PRODUCTVERSION UNI_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", UNI_LICENSE "\0" - VALUE "CompanyName", "UniMRCP\0" - VALUE "FileDescription", "UniMRCP Client Application\0" - VALUE "FileVersion", UNI_VERSION_STRING "\0" - VALUE "InternalName", "umc" "\0" - VALUE "LegalCopyright", UNI_COPYRIGHT "\0" - VALUE "OriginalFilename", "umc.exe" "\0" - VALUE "ProductName", "UniMRCP Project\0" - VALUE "ProductVersion", UNI_VERSION_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/libs/unimrcp/platforms/umc/umc.vcproj b/libs/unimrcp/platforms/umc/umc.vcproj deleted file mode 100644 index d003362f18..0000000000 --- a/libs/unimrcp/platforms/umc/umc.vcproj +++ /dev/null @@ -1,460 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/umc/umc.vcxproj b/libs/unimrcp/platforms/umc/umc.vcxproj deleted file mode 100644 index 36c4cb2aaa..0000000000 --- a/libs/unimrcp/platforms/umc/umc.vcxproj +++ /dev/null @@ -1,176 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894} - umc - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - - - - - {ee157390-1e85-416c-946e-620e32c9ad33} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/umc/umc.vcxproj.filters b/libs/unimrcp/platforms/umc/umc.vcxproj.filters deleted file mode 100644 index 8fbefd40bc..0000000000 --- a/libs/unimrcp/platforms/umc/umc.vcxproj.filters +++ /dev/null @@ -1,119 +0,0 @@ - - - - - {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 - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - include - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/unimrcp-client/Makefile.am b/libs/unimrcp/platforms/unimrcp-client/Makefile.am deleted file mode 100644 index f7310d2765..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/platforms/unimrcp-client/include \ - $(UNIMRCP_CLIENTAPP_INCLUDES) - -bin_PROGRAMS = unimrcpclient - -unimrcpclient_SOURCES = src/main.c \ - src/demo_framework.c \ - src/demo_synth_application.c \ - src/demo_recog_application.c \ - src/demo_bypass_application.c \ - src/demo_discover_application.c \ - src/demo_util.c -unimrcpclient_LDADD = $(UNIMRCP_CLIENTAPP_LIBS) -unimrcpclient_LDFLAGS = $(UNIMRCP_CLIENTAPP_OPTS) - -include $(top_srcdir)/build/rules/uniclientapp.am diff --git a/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h b/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h deleted file mode 100644 index a1f3899a7c..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/include/demo_application.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_application.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef DEMO_APPLICATION_H -#define DEMO_APPLICATION_H - -/** - * @file demo_application.h - * @brief Demo MRCP Application - */ - -#include "mrcp_application.h" - -APT_BEGIN_EXTERN_C - -/** Demo application declaration */ -typedef struct demo_application_t demo_application_t; - -/** Demo application */ -struct demo_application_t { - /** MRCP application */ - mrcp_application_t *application; - /** Demo framework */ - void *framework; - - /** Virtual run method */ - apt_bool_t (*run)(demo_application_t *application, const char *profile); - /** Virtual app_message handler */ - apt_bool_t (*handler)(demo_application_t *application, const mrcp_app_message_t *app_message); -}; - - -/** Create demo synthesizer application */ -demo_application_t* demo_synth_application_create(apr_pool_t *pool); - -/** Create demo recognizer application */ -demo_application_t* demo_recog_application_create(apr_pool_t *pool); - -/** Create demo bypass media application */ -demo_application_t* demo_bypass_application_create(apr_pool_t *pool); - -/** Create demo resource discover application */ -demo_application_t* demo_discover_application_create(apr_pool_t *pool); - - -APT_END_EXTERN_C - -#endif /* DEMO_APPLICATION_H */ diff --git a/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h b/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h deleted file mode 100644 index e7b7ccdeaa..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/include/demo_framework.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_framework.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef DEMO_FRAMEWORK_H -#define DEMO_FRAMEWORK_H - -/** - * @file demo_framework.h - * @brief Demo MRCP Application Framework - */ - -#include "mrcp_types.h" - -APT_BEGIN_EXTERN_C - -/** Opaque demo framework declaration */ -typedef struct demo_framework_t demo_framework_t; - -/** - * Create demo framework. - */ -demo_framework_t* demo_framework_create(apt_dir_layout_t *dir_layout); - -/** - * Run demo application. - * @param framework the framework to run application for - * @param app_name the name of the application to run - * @param profile_name the name of the profile to use - */ -apt_bool_t demo_framework_app_run(demo_framework_t *framework, const char *app_name, const char *profile_name); - -/** - * Destroy demo framework. - * @param framework the framework to destroy - */ -apt_bool_t demo_framework_destroy(demo_framework_t *framework); - -APT_END_EXTERN_C - -#endif /* DEMO_FRAMEWORK_H */ diff --git a/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h b/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h deleted file mode 100644 index 7e686e275a..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/include/demo_util.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_util.h 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#ifndef DEMO_UTIL_H -#define DEMO_UTIL_H - -/** - * @file demo_util.h - * @brief Demo MRCP Utilities - */ - -#include "mrcp_application.h" - -APT_BEGIN_EXTERN_C - -/** Create demo MRCP message (SPEAK request) */ -mrcp_message_t* demo_speak_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout); - -/** Create demo MRCP message (DEFINE-GRAMMAR request) */ -mrcp_message_t* demo_define_grammar_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout); -/** Create demo MRCP message (RECOGNIZE request) */ -mrcp_message_t* demo_recognize_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout); - -/** Create demo RTP termination descriptor */ -mpf_rtp_termination_descriptor_t* demo_rtp_descriptor_create(apr_pool_t *pool); - -APT_END_EXTERN_C - -#endif /* DEMO_UTIL_H */ diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c deleted file mode 100644 index 1eef85788c..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_bypass_application.c +++ /dev/null @@ -1,213 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_bypass_application.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -/* - * Demo synthesizer scenario (client stack stays out of media path). - * C -> S: SIP INVITE or RTPS SETUP (add synthesizer channel) - * S -> C: SIP OK or RTPS OK - * C -> S: MRCP SPEAK - * S -> C: MRCP IN-PROGRESS - * S -> X: RTP Start Transmission (RTP stream is sent directly to external endpoint bypassing client stack) - * S -> C: MRCP SPEAK-COMPLETE - * S -> X: RTP Stop Transmission - * C -> S: SIP INVITE or RTPS SETUP (optionally remove synthesizer channel) - * S -> C: SIP OK or RTPS OK - * C -> S: SIP BYE or RTPS TEARDOWN - * S -> C: SIP OK or RTPS OK - */ - -#include "demo_application.h" -#include "demo_util.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_synth_header.h" -#include "mrcp_synth_resource.h" -#include "apt_log.h" - -typedef struct demo_app_channel_t demo_app_channel_t; - -/** Declaration of synthesizer application channel */ -struct demo_app_channel_t { - /** MRCP control channel */ - mrcp_channel_t *channel; -}; - -/** Declaration of demo application methods */ -static apt_bool_t demo_application_run(demo_application_t *demo_application, const char *profile); -static apt_bool_t demo_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message); - -static apt_bool_t demo_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t demo_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t demo_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); -static apt_bool_t demo_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); -static apt_bool_t demo_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - -static const mrcp_app_message_dispatcher_t demo_application_dispatcher = { - demo_application_on_session_update, - demo_application_on_session_terminate, - demo_application_on_channel_add, - demo_application_on_channel_remove, - demo_application_on_message_receive, - NULL /* demo_application_on_terminate_event */, - NULL /* demo_application_on_resource_discover */ -}; - - -/** Create demo bypass media application */ -demo_application_t* demo_bypass_application_create(apr_pool_t *pool) -{ - demo_application_t *demo_application = apr_palloc(pool,sizeof(demo_application_t)); - demo_application->application = NULL; - demo_application->framework = NULL; - demo_application->handler = demo_application_handler; - demo_application->run = demo_application_run; - return demo_application; -} - -/** Create demo channel */ -static mrcp_channel_t* demo_application_channel_create(mrcp_session_t *session) -{ - mrcp_channel_t *channel; - apr_pool_t *pool = mrcp_application_session_pool_get(session); - /* create channel */ - demo_app_channel_t *demo_channel = apr_palloc(pool,sizeof(demo_app_channel_t)); - mpf_rtp_termination_descriptor_t *rtp_descriptor = demo_rtp_descriptor_create(pool); - channel = mrcp_application_channel_create( - session, /* session, channel belongs to */ - MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */ - NULL, /* no termination (not to use internal media processing) */ - rtp_descriptor, /* RTP descriptor, used to create RTP termination */ - demo_channel); /* object to associate */ - return channel; -} - - -/** Run demo scenario */ -static apt_bool_t demo_application_run(demo_application_t *demo_application, const char *profile) -{ - mrcp_channel_t *channel; - /* create session */ - mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL); - if(!session) { - return FALSE; - } - - /* create channel and associate all the required data */ - channel = demo_application_channel_create(session); - if(!channel) { - mrcp_application_session_destroy(session); - return FALSE; - } - - /* add channel to session (send asynchronous request) */ - if(mrcp_application_channel_add(session,channel) != TRUE) { - /* session and channel are still not referenced - and both are allocated from session pool and will - be freed with session destroy call */ - mrcp_application_session_destroy(session); - return FALSE; - } - - return TRUE; -} - -/** Handle the messages sent from the MRCP client stack */ -static apt_bool_t demo_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message) -{ - /* app_message should be dispatched now, - * the default dispatcher is used in demo. */ - return mrcp_application_message_dispatch(&demo_application_dispatcher,app_message); -} - -/** Handle the responses sent to session update requests */ -static apt_bool_t demo_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - return TRUE; -} - -/** Handle the responses sent to session terminate requests */ -static apt_bool_t demo_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - /* received response to session termination request, - now it's safe to destroy no more referenced session */ - mrcp_application_session_destroy(session); - return TRUE; -} - -/** Handle the responses sent to channel add requests */ -static apt_bool_t demo_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - if(status == MRCP_SIG_STATUS_CODE_SUCCESS) { - mpf_rtp_termination_descriptor_t *rtp_descriptor; - mrcp_message_t *mrcp_message; - const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application); - /* create and send SPEAK request */ - mrcp_message = demo_speak_message_create(session,channel,dir_layout); - if(mrcp_message) { - mrcp_application_message_send(session,channel,mrcp_message); - } - rtp_descriptor = mrcp_application_rtp_descriptor_get(channel); - if(rtp_descriptor) { - mpf_rtp_media_descriptor_t *local_media = rtp_descriptor->audio.local; - mpf_rtp_media_descriptor_t *remote_media = rtp_descriptor->audio.remote; - if(local_media && remote_media) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Media Attributes: L[%s/%d] R[%s/%d]", - local_media->ip.buf, - local_media->port, - remote_media->ip.buf, - remote_media->port); - } - } - } - else { - /* error case, just terminate the demo */ - mrcp_application_session_terminate(session); - } - return TRUE; -} - -/** Handle the responses sent to channel remove requests */ -static apt_bool_t demo_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - /* terminate the demo */ - mrcp_application_session_terminate(session); - return TRUE; -} - -/** Handle the MRCP responses/events */ -static apt_bool_t demo_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - /* received MRCP response */ - if(message->start_line.method_id == SYNTHESIZER_SPEAK) { - /* received the response to SPEAK request, - waiting for SPEAK-COMPLETE event */ - } - else { - /* received unexpected response */ - } - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - /* received MRCP event */ - if(message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) { - /* received SPEAK-COMPLETE event, remove channel */ - mrcp_application_channel_remove(session,channel); - } - } - return TRUE; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c deleted file mode 100644 index 0218f5637d..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_discover_application.c +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_discover_application.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -/* - * Demo resource discovery. - * C -> S: SIP OPTIONS or RTPS DESCRIBE - * S -> C: SIP OK or RTPS OK - */ - -#include "demo_application.h" -#include "mrcp_session_descriptor.h" -#include "mrcp_control_descriptor.h" -#include "apt_log.h" - - -/** Declaration of synthesizer application methods */ -static apt_bool_t discover_application_run(demo_application_t *demo_application, const char *profile); -static apt_bool_t discover_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message); - -/** Declaration of application message handlers */ -static apt_bool_t discover_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t discover_application_on_resource_discover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status); - -static const mrcp_app_message_dispatcher_t discover_application_dispatcher = { - NULL, - discover_application_on_session_terminate, - NULL, - NULL, - NULL, - NULL, - discover_application_on_resource_discover -}; - -/** Create demo resource discover application */ -demo_application_t* demo_discover_application_create(apr_pool_t *pool) -{ - demo_application_t *discover_application = apr_palloc(pool,sizeof(demo_application_t)); - discover_application->application = NULL; - discover_application->framework = NULL; - discover_application->handler = discover_application_handler; - discover_application->run = discover_application_run; - return discover_application; -} - -/** Run demo resource discover scenario */ -static apt_bool_t discover_application_run(demo_application_t *demo_application, const char *profile) -{ - /* create session */ - mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL); - if(!session) { - return FALSE; - } - - /* send resource discover request */ - if(mrcp_application_resource_discover(session) != TRUE) { - mrcp_application_session_destroy(session); - return FALSE; - } - - return TRUE; -} - -/** Handle the messages sent from the MRCP client stack */ -static apt_bool_t discover_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message) -{ - /* app_message should be dispatched now, - * the default dispatcher is used in demo. */ - return mrcp_application_message_dispatch(&discover_application_dispatcher,app_message); -} - -/** Handle the responses sent to session terminate requests */ -static apt_bool_t discover_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - /* received response to session termination request, - now it's safe to destroy no more referenced session */ - mrcp_application_session_destroy(session); - return TRUE; -} - -/** Handle the responses sent to resource discover requests */ -static apt_bool_t discover_application_on_resource_discover(mrcp_application_t *application, mrcp_session_t *session, mrcp_session_descriptor_t *descriptor, mrcp_sig_status_code_e status) -{ - if(descriptor && status == MRCP_SIG_STATUS_CODE_SUCCESS) { - int i; - int count = descriptor->control_media_arr->nelts; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Resource Discover [%d]", count); - - for(i = 0; i < count; i++) { - mrcp_control_descriptor_t *control_media = mrcp_session_control_media_get(descriptor,i); - if(control_media) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"[%d] - %s", i,control_media->resource_name.buf); - } - } - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Discover Resources"); - } - - mrcp_application_session_terminate(session); - return TRUE; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c deleted file mode 100644 index e3738a2211..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_framework.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_framework.c 2233 2014-11-12 01:34:59Z achaloyan@gmail.com $ - */ - -#include -#include "demo_framework.h" -#include "demo_application.h" -#include "unimrcp_client.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - -#define FRAMEWORK_TASK_NAME "Framework Agent" - -#define MAX_APP_NAME_LENGTH 16 -#define MAX_PROFILE_NAME_LENGTH 16 - -/** Demo framework */ -struct demo_framework_t { - /** MRCP client stack instance */ - mrcp_client_t *client; - /** Message processing task */ - apt_consumer_task_t *task; - /** Table of demo applications */ - apr_hash_t *application_table; - /** Memory to allocate memory from */ - apr_pool_t *pool; -}; - -typedef struct framework_task_data_t framework_task_data_t; -struct framework_task_data_t { - char app_name[MAX_APP_NAME_LENGTH]; - char profile_name[MAX_PROFILE_NAME_LENGTH]; - demo_application_t *demo_application; - const mrcp_app_message_t *app_message; -}; - -typedef enum { - DEMO_APPLICATION_MSG_ID, - DEMO_CONSOLE_MSG_ID -} framework_msg_type_e; - -static apt_bool_t demo_framework_message_handler(const mrcp_app_message_t *app_message); -static apt_bool_t demo_framework_consumer_task_create(demo_framework_t *framework); -static apt_bool_t demo_framework_app_register(demo_framework_t *framework, demo_application_t *demo_application, const char *name); - -/** Create demo framework */ -demo_framework_t* demo_framework_create(apt_dir_layout_t *dir_layout) -{ - demo_framework_t *framework = NULL; - mrcp_client_t *client = unimrcp_client_create(dir_layout); - if(client) { - demo_application_t *demo_application; - apr_pool_t *pool = mrcp_client_memory_pool_get(client); - /* create demo framework */ - framework = apr_palloc(pool,sizeof(demo_framework_t)); - framework->pool = pool; - framework->client = client; - framework->application_table = apr_hash_make(pool); - - /* create demo synthesizer application */ - demo_application = demo_synth_application_create(framework->pool); - if(demo_application) { - demo_framework_app_register(framework,demo_application,"synth"); - } - - /* create demo recognizer application */ - demo_application = demo_recog_application_create(framework->pool); - if(demo_application) { - demo_framework_app_register(framework,demo_application,"recog"); - } - - /* create demo bypass media application */ - demo_application = demo_bypass_application_create(framework->pool); - if(demo_application) { - demo_framework_app_register(framework,demo_application,"bypass"); - } - - /* create demo resource discover application */ - demo_application = demo_discover_application_create(framework->pool); - if(demo_application) { - demo_framework_app_register(framework,demo_application,"discover"); - } - - demo_framework_consumer_task_create(framework); - - if(framework->task) { - apt_task_t *task = apt_consumer_task_base_get(framework->task); - apt_task_start(task); - } - - /* start client stack */ - mrcp_client_start(client); - } - - return framework; -} - -/** Run demo application */ -apt_bool_t demo_framework_app_run(demo_framework_t *framework, const char *app_name, const char *profile_name) -{ - apt_task_t *task = apt_consumer_task_base_get(framework->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - framework_task_data_t *framework_task_data = (framework_task_data_t*)task_msg->data; - task_msg->type = TASK_MSG_USER; - task_msg->sub_type = DEMO_CONSOLE_MSG_ID; - strncpy(framework_task_data->app_name,app_name,sizeof(framework_task_data->app_name)-1); - strncpy(framework_task_data->profile_name,profile_name,sizeof(framework_task_data->profile_name)-1); - framework_task_data->app_message = NULL; - framework_task_data->demo_application = NULL; - apt_task_msg_signal(task,task_msg); - } - return TRUE; -} - -/** Destroy demo framework */ -apt_bool_t demo_framework_destroy(demo_framework_t *framework) -{ - if(!framework) { - return FALSE; - } - - if(framework->task) { - apt_task_t *task = apt_consumer_task_base_get(framework->task); - apt_task_terminate(task,TRUE); - apt_task_destroy(task); - framework->task = NULL; - } - - mrcp_client_shutdown(framework->client); - return mrcp_client_destroy(framework->client); -} - -static apt_bool_t demo_framework_app_register(demo_framework_t *framework, demo_application_t *demo_application, const char *name) -{ - apr_hash_set(framework->application_table,name,APR_HASH_KEY_STRING,demo_application); - demo_application->framework = framework; - demo_application->application = mrcp_application_create( - demo_framework_message_handler, - demo_application, - framework->pool); - return mrcp_client_application_register(framework->client,demo_application->application,name); -} - -static void demo_framework_on_start_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run Demo Framework"); -} - -static apt_bool_t demo_framework_console_msg_process(demo_framework_t *framework, const char *app_name, const char *profile_name) -{ - demo_application_t *demo_application = apr_hash_get(framework->application_table,app_name,APR_HASH_KEY_STRING); - if(!demo_application) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"No Such Demo Application [%s]",app_name); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run Demo Application Scenario [%s]",app_name); - return demo_application->run(demo_application,profile_name); -} - -static apt_bool_t demo_framework_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - if(msg->type == TASK_MSG_USER) { - framework_task_data_t *data = (framework_task_data_t*)msg->data; - switch(msg->sub_type) { - case DEMO_APPLICATION_MSG_ID: - { - data->demo_application->handler(data->demo_application,data->app_message); - break; - } - case DEMO_CONSOLE_MSG_ID: - { - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - demo_framework_t *framework = apt_consumer_task_object_get(consumer_task); - demo_framework_console_msg_process(framework,data->app_name,data->profile_name); - break; - } - } - } - return TRUE; -} - -static apt_bool_t demo_framework_consumer_task_create(demo_framework_t *framework) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(framework_task_data_t),framework->pool); - framework->task = apt_consumer_task_create(framework,msg_pool,framework->pool); - if(!framework->task) { - return FALSE; - } - task = apt_consumer_task_base_get(framework->task); - apt_task_name_set(task,FRAMEWORK_TASK_NAME); - vtable = apt_consumer_task_vtable_get(framework->task); - if(vtable) { - vtable->process_msg = demo_framework_msg_process; - vtable->on_start_complete = demo_framework_on_start_complete; - } - - return TRUE; -} - -/** Callback is called from MRCP client stack (task) context. - * Signal app_message to the main consumer task of the demo framework - * for further processing (see demo_framework_msg_process). - */ -static apt_bool_t demo_framework_message_handler(const mrcp_app_message_t *app_message) -{ - demo_application_t *demo_application; - if(!app_message->application) { - return FALSE; - } - demo_application = mrcp_application_object_get(app_message->application); - if(demo_application && demo_application->framework) { - demo_framework_t *framework = demo_application->framework; - apt_task_t *task = apt_consumer_task_base_get(framework->task); - apt_task_msg_t *task_msg = apt_task_msg_get(task); - if(task_msg) { - framework_task_data_t *framework_task_data = (framework_task_data_t*)task_msg->data; - task_msg->type = TASK_MSG_USER; - task_msg->sub_type = DEMO_APPLICATION_MSG_ID; - framework_task_data->app_message = app_message; - framework_task_data->demo_application = demo_application; - apt_task_msg_signal(task,task_msg); - } - } - return TRUE; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c deleted file mode 100644 index a87ca874c9..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_recog_application.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_recog_application.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -/* - * Demo recognizer scenario. - * C -> S: SIP INVITE or RTPS SETUP (add recognizer channel) - * S -> C: SIP OK or RTPS OK - * C -> S: MRCP RECOGNIZE - * S -> C: MRCP IN-PROGRESS - * C -> S: RTP Start Transmission - * S -> C: MRCP START-OF-INPUT - * S -> C: MRCP RECOGNITION-COMPLETE - * C -> S: RTP Stop Transmission - * C -> S: SIP INVITE or RTPS SETUP (optionally remove recognizer channel) - * S -> C: SIP OK or RTPS OK - * C -> S: SIP BYE or RTPS TEARDOWN - * S -> C: SIP OK or RTPS OK - */ - -#include "demo_application.h" -#include "demo_util.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -#include "apt_nlsml_doc.h" -#include "apt_log.h" - -typedef struct recog_app_channel_t recog_app_channel_t; - -/** Declaration of recognizer application channel */ -struct recog_app_channel_t { - /** MRCP control channel */ - mrcp_channel_t *channel; - - /** Streaming is in-progress */ - apt_bool_t streaming; - /** File to read audio stream from */ - FILE *audio_in; - /** Estimated time to complete (used if no audio_in available) */ - apr_size_t time_to_complete; -}; - -/** Declaration of recognizer application methods */ -static apt_bool_t recog_application_run(demo_application_t *demo_application, const char *profile); -static apt_bool_t recog_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message); - -/** Declaration of application message handlers */ -static apt_bool_t recog_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t recog_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t recog_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); -static apt_bool_t recog_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); -static apt_bool_t recog_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - -static const mrcp_app_message_dispatcher_t recog_application_dispatcher = { - recog_application_on_session_update, - recog_application_on_session_terminate, - recog_application_on_channel_add, - recog_application_on_channel_remove, - recog_application_on_message_receive, - NULL /* recog_application_on_terminate_event */, - NULL /* recog_application_on_resource_discover */ -}; - -/** Declaration of recognizer audio stream methods */ -static apt_bool_t recog_app_stream_destroy(mpf_audio_stream_t *stream); -static apt_bool_t recog_app_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t recog_app_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t recog_app_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t audio_stream_vtable = { - recog_app_stream_destroy, - recog_app_stream_open, - recog_app_stream_close, - recog_app_stream_read, - NULL, - NULL, - NULL, - NULL -}; - - -/** Create demo recognizer application */ -demo_application_t* demo_recog_application_create(apr_pool_t *pool) -{ - demo_application_t *recog_application = apr_palloc(pool,sizeof(demo_application_t)); - recog_application->application = NULL; - recog_application->framework = NULL; - recog_application->handler = recog_application_handler; - recog_application->run = recog_application_run; - return recog_application; -} - -/** Create demo recognizer channel */ -static mrcp_channel_t* recog_application_channel_create(mrcp_session_t *session) -{ - mrcp_channel_t *channel; - mpf_termination_t *termination; - mpf_stream_capabilities_t *capabilities; - apr_pool_t *pool = mrcp_application_session_pool_get(session); - - /* create channel */ - recog_app_channel_t *recog_channel = apr_palloc(pool,sizeof(recog_app_channel_t)); - recog_channel->streaming = FALSE; - recog_channel->audio_in = NULL; - recog_channel->time_to_complete = 0; - - /* create source stream capabilities */ - capabilities = mpf_source_stream_capabilities_create(pool); - - /* add codec capabilities (Linear PCM) */ - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "LPCM"); - -#if 0 - /* more capabilities can be added or replaced */ - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "PCMU"); -#endif - - termination = mrcp_application_audio_termination_create( - session, /* session, termination belongs to */ - &audio_stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* capabilities of audio stream */ - recog_channel); /* object to associate */ - - channel = mrcp_application_channel_create( - session, /* session, channel belongs to */ - MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */ - termination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - recog_channel); /* object to associate */ - return channel; -} - -/** Run demo recognizer scenario */ -static apt_bool_t recog_application_run(demo_application_t *demo_application, const char *profile) -{ - mrcp_channel_t *channel; - /* create session */ - mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL); - if(!session) { - return FALSE; - } - - /* create channel and associate all the required data */ - channel = recog_application_channel_create(session); - if(!channel) { - mrcp_application_session_destroy(session); - return FALSE; - } - - /* add channel to session (send asynchronous request) */ - if(mrcp_application_channel_add(session,channel) != TRUE) { - /* session and channel are still not referenced - and both are allocated from session pool and will - be freed with session destroy call */ - mrcp_application_session_destroy(session); - return FALSE; - } - - return TRUE; -} - -/** Handle the messages sent from the MRCP client stack */ -static apt_bool_t recog_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message) -{ - /* app_message should be dispatched now, - * the default dispatcher is used in demo. */ - return mrcp_application_message_dispatch(&recog_application_dispatcher,app_message); -} - -/** Handle the responses sent to session update requests */ -static apt_bool_t recog_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - /* not used in demo */ - return TRUE; -} - -/** Handle the responses sent to session terminate requests */ -static apt_bool_t recog_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - /* received response to session termination request, - now it's safe to destroy no more referenced session */ - mrcp_application_session_destroy(session); - return TRUE; -} - -/** Handle the responses sent to channel add requests */ -static apt_bool_t recog_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - if(status == MRCP_SIG_STATUS_CODE_SUCCESS) { - mrcp_message_t *mrcp_message; - const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application); - /* create and send DEFINE-GRAMMAR request */ - mrcp_message = demo_define_grammar_message_create(session,channel,dir_layout); - if(mrcp_message) { - mrcp_application_message_send(session,channel,mrcp_message); - } - } - else { - /* error case, just terminate the demo */ - mrcp_application_session_terminate(session); - } - return TRUE; -} - -static apt_bool_t recog_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel); - - /* terminate the demo */ - mrcp_application_session_terminate(session); - - if(recog_channel) { - FILE *audio_in = recog_channel->audio_in; - if(audio_in) { - recog_channel->audio_in = NULL; - fclose(audio_in); - } - } - return TRUE; -} - -/** Handle the DEFINE-GRAMMAR responses */ -static apt_bool_t recog_application_on_define_grammar(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel) -{ - mrcp_message_t *mrcp_message; - recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel); - const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application); - - const mpf_codec_descriptor_t *descriptor = mrcp_application_source_descriptor_get(channel); - if(!descriptor) { - /* terminate the demo */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Source Descriptor"); - return mrcp_application_session_terminate(session); - } - - /* create and send RECOGNIZE request */ - mrcp_message = demo_recognize_message_create(session,channel,dir_layout); - if(mrcp_message) { - mrcp_application_message_send(session,channel,mrcp_message); - } - - if(recog_channel) { - apr_pool_t *pool = mrcp_application_session_pool_get(session); - char *file_name = apr_psprintf(pool,"one-%dkHz.pcm",descriptor->sampling_rate/1000); - char *file_path = apt_datadir_filepath_get(dir_layout,file_name,pool); - if(file_path) { - recog_channel->audio_in = fopen(file_path,"rb"); - if(recog_channel->audio_in) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source",file_path); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Cannot Find [%s]",file_path); - /* set some estimated time to complete */ - recog_channel->time_to_complete = 5000; // 5 sec - } - } - } - return TRUE; -} - -static apt_bool_t recog_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - recog_app_channel_t *recog_channel = mrcp_application_channel_object_get(channel); - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - /* received MRCP response */ - if(message->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR) { - /* received the response to DEFINE-GRAMMAR request */ - if(message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) { - recog_application_on_define_grammar(application,session,channel); - } - else { - /* received unexpected response, remove channel */ - mrcp_application_channel_remove(session,channel); - } - } - else if(message->start_line.method_id == RECOGNIZER_RECOGNIZE) { - /* received the response to RECOGNIZE request */ - if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - /* start to stream the speech to recognize */ - if(recog_channel) { - recog_channel->streaming = TRUE; - } - } - else { - /* received unexpected response, remove channel */ - mrcp_application_channel_remove(session,channel); - } - } - else { - /* received unexpected response */ - } - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - if(message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) { - nlsml_result_t *result = nlsml_result_parse(message->body.buf, message->body.length, message->pool); - if(result) { - nlsml_result_trace(result, message->pool); - } - - if(recog_channel) { - recog_channel->streaming = FALSE; - } - mrcp_application_channel_remove(session,channel); - } - else if(message->start_line.method_id == RECOGNIZER_START_OF_INPUT) { - /* received start-of-input, do whatever you need here */ - } - } - return TRUE; -} - -/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */ -static apt_bool_t recog_app_stream_destroy(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform application stream specific action before open */ -static apt_bool_t recog_app_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform application stream specific action after close */ -static apt_bool_t recog_app_stream_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to read new frame */ -static apt_bool_t recog_app_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - recog_app_channel_t *recog_channel = stream->obj; - if(recog_channel && recog_channel->streaming == TRUE) { - if(recog_channel->audio_in) { - if(fread(frame->codec_frame.buffer,1,frame->codec_frame.size,recog_channel->audio_in) == frame->codec_frame.size) { - /* normal read */ - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - } - else { - /* file is over */ - recog_channel->streaming = FALSE; - } - } - else { - /* fill with silence in case no file available */ - if(recog_channel->time_to_complete >= CODEC_FRAME_TIME_BASE) { - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - memset(frame->codec_frame.buffer,0,frame->codec_frame.size); - recog_channel->time_to_complete -= CODEC_FRAME_TIME_BASE; - } - else { - recog_channel->streaming = FALSE; - } - } - } - return TRUE; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c deleted file mode 100644 index e99d5a8490..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_synth_application.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_synth_application.c 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $ - */ - -/* - * Demo synthesizer scenario. - * C -> S: SIP INVITE or RTPS SETUP (add synthesizer channel) - * S -> C: SIP OK or RTPS OK - * C -> S: MRCP SPEAK - * S -> C: MRCP IN-PROGRESS - * S -> C: RTP Start Transmission - * S -> C: MRCP SPEAK-COMPLETE - * S -> C: RTP Stop Transmission - * C -> S: SIP INVITE or RTPS SETUP (optionally remove synthesizer channel) - * S -> C: SIP OK or RTPS OK - * C -> S: SIP BYE or RTPS TEARDOWN - * S -> C: SIP OK or RTPS OK - */ - -#include "demo_application.h" -#include "demo_util.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_synth_header.h" -#include "mrcp_synth_resource.h" -#include "apt_log.h" - -typedef struct synth_app_channel_t synth_app_channel_t; - -/** Declaration of synthesizer application channel */ -struct synth_app_channel_t { - /** MRCP control channel */ - mrcp_channel_t *channel; - /** File to write audio stream to */ - FILE *audio_out; -}; - -/** Declaration of synthesizer application methods */ -static apt_bool_t synth_application_run(demo_application_t *demo_application, const char *profile); -static apt_bool_t synth_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message); - -/** Declaration of application message handlers */ -static apt_bool_t synth_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t synth_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t synth_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); -static apt_bool_t synth_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status); -static apt_bool_t synth_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); - -static const mrcp_app_message_dispatcher_t synth_application_dispatcher = { - synth_application_on_session_update, - synth_application_on_session_terminate, - synth_application_on_channel_add, - synth_application_on_channel_remove, - synth_application_on_message_receive, - NULL /* synth_application_on_terminate_event */, - NULL /* synth_application_on_resource_discover */ -}; - -/** Declaration of synthesizer audio stream methods */ -static apt_bool_t synth_app_stream_destroy(mpf_audio_stream_t *stream); -static apt_bool_t synth_app_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t synth_app_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t synth_app_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t audio_stream_vtable = { - synth_app_stream_destroy, - NULL, - NULL, - NULL, - synth_app_stream_open, - synth_app_stream_close, - synth_app_stream_write, - NULL -}; - - -/** Create demo synthesizer application */ -demo_application_t* demo_synth_application_create(apr_pool_t *pool) -{ - demo_application_t *synth_application = apr_palloc(pool,sizeof(demo_application_t)); - synth_application->application = NULL; - synth_application->framework = NULL; - synth_application->handler = synth_application_handler; - synth_application->run = synth_application_run; - return synth_application; -} - -/** Create demo synthesizer channel */ -static mrcp_channel_t* synth_application_channel_create(mrcp_session_t *session) -{ - mrcp_channel_t *channel; - mpf_termination_t *termination; - mpf_stream_capabilities_t *capabilities; - apr_pool_t *pool = mrcp_application_session_pool_get(session); - - /* create channel */ - synth_app_channel_t *synth_channel = apr_palloc(pool,sizeof(synth_app_channel_t)); - synth_channel->audio_out = NULL; - - /* create sink stream capabilities */ - capabilities = mpf_sink_stream_capabilities_create(pool); - - /* add codec capabilities (Linear PCM) */ - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "LPCM"); - -#if 0 - /* more capabilities can be added or replaced */ - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "PCMU"); -#endif - - termination = mrcp_application_audio_termination_create( - session, /* session, termination belongs to */ - &audio_stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* capabilities of audio stream */ - synth_channel); /* object to associate */ - - channel = mrcp_application_channel_create( - session, /* session, channel belongs to */ - MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */ - termination, /* media termination, used to terminate audio stream */ - NULL, /* RTP descriptor, used to create RTP termination (NULL by default) */ - synth_channel); /* object to associate */ - return channel; -} - - -/** Run demo synthesizer scenario */ -static apt_bool_t synth_application_run(demo_application_t *demo_application, const char *profile) -{ - mrcp_channel_t *channel; - /* create session */ - mrcp_session_t *session = mrcp_application_session_create(demo_application->application,profile,NULL); - if(!session) { - return FALSE; - } - - /* create channel and associate all the required data */ - channel = synth_application_channel_create(session); - if(!channel) { - mrcp_application_session_destroy(session); - return FALSE; - } - - /* add channel to session (send asynchronous request) */ - if(mrcp_application_channel_add(session,channel) != TRUE) { - /* session and channel are still not referenced - and both are allocated from session pool and will - be freed with session destroy call */ - mrcp_application_session_destroy(session); - return FALSE; - } - - return TRUE; -} - -/** Handle the messages sent from the MRCP client stack */ -static apt_bool_t synth_application_handler(demo_application_t *application, const mrcp_app_message_t *app_message) -{ - /* app_message should be dispatched now, - * the default dispatcher is used in demo. */ - return mrcp_application_message_dispatch(&synth_application_dispatcher,app_message); -} - -/** Handle the responses sent to session update requests */ -static apt_bool_t synth_application_on_session_update(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - /* not used in demo */ - return TRUE; -} - -/** Handle the responses sent to session terminate requests */ -static apt_bool_t synth_application_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - /* received response to session termination request, - now it's safe to destroy no more referenced session */ - mrcp_application_session_destroy(session); - return TRUE; -} - -/** Handle the responses sent to channel add requests */ -static apt_bool_t synth_application_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - if(status == MRCP_SIG_STATUS_CODE_SUCCESS) { - mrcp_message_t *mrcp_message; - synth_app_channel_t *synth_channel = mrcp_application_channel_object_get(channel); - apr_pool_t *pool = mrcp_application_session_pool_get(session); - const apt_dir_layout_t *dir_layout = mrcp_application_dir_layout_get(application); - const mpf_codec_descriptor_t *descriptor = mrcp_application_sink_descriptor_get(channel); - if(!descriptor) { - /* terminate the demo */ - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Media Sink Descriptor"); - return mrcp_application_session_terminate(session); - } - - /* create and send SPEAK request */ - mrcp_message = demo_speak_message_create(session,channel,dir_layout); - if(mrcp_message) { - mrcp_application_message_send(session,channel,mrcp_message); - } - - if(synth_channel) { - const apt_str_t *id = mrcp_application_session_id_get(session); - char *file_name = apr_psprintf(pool,"synth-%dkHz-%s.pcm", - descriptor->sampling_rate/1000, - id->buf); - char *file_path = apt_vardir_filepath_get(dir_layout,file_name,pool); - if(file_path) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Speech Output File [%s] for Writing",file_path); - synth_channel->audio_out = fopen(file_path,"wb"); - if(!synth_channel->audio_out) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Utterance Output File [%s] for Writing",file_path); - } - } - } - } - else { - /* error case, just terminate the demo */ - mrcp_application_session_terminate(session); - } - return TRUE; -} - -/** Handle the responses sent to channel remove requests */ -static apt_bool_t synth_application_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_sig_status_code_e status) -{ - synth_app_channel_t *synth_channel = mrcp_application_channel_object_get(channel); - - /* terminate the demo */ - mrcp_application_session_terminate(session); - - if(synth_channel) { - FILE *audio_out = synth_channel->audio_out; - if(audio_out) { - synth_channel->audio_out = NULL; - fclose(audio_out); - } - } - return TRUE; -} - -/** Handle the MRCP responses/events */ -static apt_bool_t synth_application_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - if(message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - /* received MRCP response */ - if(message->start_line.method_id == SYNTHESIZER_SPEAK) { - /* received the response to SPEAK request */ - if(message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - /* waiting for SPEAK-COMPLETE event */ - } - else { - /* received unexpected response, remove channel */ - mrcp_application_channel_remove(session,channel); - } - } - else { - /* received unexpected response */ - } - } - else if(message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - /* received MRCP event */ - if(message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) { - /* received SPEAK-COMPLETE event, remove channel */ - mrcp_application_channel_remove(session,channel); - } - } - return TRUE; -} - -/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */ -static apt_bool_t synth_app_stream_destroy(mpf_audio_stream_t *stream) -{ - /* nothing to destroy in demo */ - return TRUE; -} - -/** Callback is called from MPF engine context to perform application stream specific action before open */ -static apt_bool_t synth_app_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform application stream specific action after close */ -static apt_bool_t synth_app_stream_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to make new frame available to write/send */ -static apt_bool_t synth_app_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - synth_app_channel_t *synth_channel = stream->obj; - if(synth_channel && synth_channel->audio_out) { - fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,synth_channel->audio_out); - } - return TRUE; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c b/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c deleted file mode 100644 index fa59112578..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/demo_util.c +++ /dev/null @@ -1,176 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_util.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "demo_util.h" -/* common includes */ -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -/* synthesizer includes */ -#include "mrcp_synth_header.h" -#include "mrcp_synth_resource.h" -/* recognizer includes */ -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -/* logger include */ -#include "apt_log.h" - -static void demo_message_body_set(mrcp_message_t *mrcp_message, const apt_dir_layout_t *dir_layout, const char *file_name) -{ - char *file_path = apt_datadir_filepath_get(dir_layout,file_name,mrcp_message->pool); - if(file_path) { - FILE *file = fopen(file_path,"r"); - if(file) { - char text[1024]; - apr_size_t size; - size = fread(text,1,sizeof(text),file); - apt_string_assign_n(&mrcp_message->body,text,size,mrcp_message->pool); - fclose(file); - } - } -} - -/** Create demo MRCP message (SPEAK request) */ -mrcp_message_t* demo_speak_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout) -{ - /* create MRCP message */ - mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,SYNTHESIZER_SPEAK); - if(mrcp_message) { - mrcp_generic_header_t *generic_header; - mrcp_synth_header_t *synth_header; - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(mrcp_message); - if(generic_header) { - /* set generic header fields */ - apt_string_assign(&generic_header->content_type,"application/synthesis+ssml",mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE); - } - /* get/allocate synthesizer header */ - synth_header = mrcp_resource_header_prepare(mrcp_message); - if(synth_header) { - /* set synthesizer header fields */ - synth_header->voice_param.age = 28; - mrcp_resource_header_property_add(mrcp_message,SYNTHESIZER_HEADER_VOICE_AGE); - } - /* set message body */ - demo_message_body_set(mrcp_message,dir_layout,"speak.xml"); - } - return mrcp_message; -} - -/** Create demo MRCP message (DEFINE-GRAMMAR request) */ -mrcp_message_t* demo_define_grammar_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout) -{ - /* create MRCP message */ - mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,RECOGNIZER_DEFINE_GRAMMAR); - if(mrcp_message) { - mrcp_generic_header_t *generic_header; - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(mrcp_message); - if(generic_header) { - /* set generic header fields */ - if(mrcp_message->start_line.version == MRCP_VERSION_2) { - apt_string_assign(&generic_header->content_type,"application/srgs+xml",mrcp_message->pool); - } - else { - apt_string_assign(&generic_header->content_type,"application/grammar+xml",mrcp_message->pool); - } - mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE); - apt_string_assign(&generic_header->content_id,"request1@form-level.store",mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_ID); - } - /* set message body */ - demo_message_body_set(mrcp_message,dir_layout,"grammar.xml"); - } - return mrcp_message; -} - -/** Create demo MRCP message (RECOGNIZE request) */ -mrcp_message_t* demo_recognize_message_create(mrcp_session_t *session, mrcp_channel_t *channel, const apt_dir_layout_t *dir_layout) -{ - const char text[] = "session:request1@form-level.store"; - - /* create MRCP message */ - mrcp_message_t *mrcp_message = mrcp_application_message_create(session,channel,RECOGNIZER_RECOGNIZE); - if(mrcp_message) { - mrcp_recog_header_t *recog_header; - mrcp_generic_header_t *generic_header; - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(mrcp_message); - if(generic_header) { - /* set generic header fields */ - apt_string_assign(&generic_header->content_type,"text/uri-list",mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message,GENERIC_HEADER_CONTENT_TYPE); - } - /* get/allocate recognizer header */ - recog_header = mrcp_resource_header_prepare(mrcp_message); - if(recog_header) { - if(mrcp_message->start_line.version == MRCP_VERSION_2) { - /* set recognizer header fields */ - recog_header->cancel_if_queue = FALSE; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CANCEL_IF_QUEUE); - } - recog_header->no_input_timeout = 5000; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT); - recog_header->recognition_timeout = 10000; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_RECOGNITION_TIMEOUT); - recog_header->start_input_timers = TRUE; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_START_INPUT_TIMERS); - recog_header->confidence_threshold = 0.87f; - mrcp_resource_header_property_add(mrcp_message,RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD); - } - /* set message body */ - apt_string_assign(&mrcp_message->body,text,mrcp_message->pool); - } - return mrcp_message; -} - -/** Create demo RTP termination descriptor */ -mpf_rtp_termination_descriptor_t* demo_rtp_descriptor_create(apr_pool_t *pool) -{ - mpf_codec_descriptor_t *codec_descriptor; - mpf_rtp_media_descriptor_t *media; - /* create rtp descriptor */ - mpf_rtp_termination_descriptor_t *rtp_descriptor = apr_palloc(pool,sizeof(mpf_rtp_termination_descriptor_t)); - mpf_rtp_termination_descriptor_init(rtp_descriptor); - /* create rtp local media */ - media = apr_palloc(pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media); - apt_string_assign(&media->ip,"127.0.0.1",pool); - media->port = 6000; - media->state = MPF_MEDIA_ENABLED; - media->direction = STREAM_DIRECTION_RECEIVE; - - /* initialize codec list */ - mpf_codec_list_init(&media->codec_list,2,pool); - /* set codec descriptor */ - codec_descriptor = mpf_codec_list_add(&media->codec_list); - if(codec_descriptor) { - codec_descriptor->payload_type = 0; - } - /* set another codec descriptor */ - codec_descriptor = mpf_codec_list_add(&media->codec_list); - if(codec_descriptor) { - codec_descriptor->payload_type = 96; - apt_string_set(&codec_descriptor->name,"PCMU"); - codec_descriptor->sampling_rate = 16000; - codec_descriptor->channel_count = 1; - } - - rtp_descriptor->audio.local = media; - return rtp_descriptor; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/src/main.c b/libs/unimrcp/platforms/unimrcp-client/src/main.c deleted file mode 100644 index 702c254b8b..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/src/main.c +++ /dev/null @@ -1,275 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "demo_framework.h" -#include "apt_pool.h" -#include "apt_log.h" -#include "uni_version.h" - -typedef struct { - const char *root_dir_path; - const char *dir_layout_conf; - const char *log_priority; - const char *log_output; -} client_options_t; - -static apt_bool_t demo_framework_cmdline_process(demo_framework_t *framework, char *cmdline) -{ - apt_bool_t running = TRUE; - char *name; - char *last; - name = apr_strtok(cmdline, " ", &last); - - if(strcasecmp(name,"run") == 0) { - char *app_name = apr_strtok(NULL, " ", &last); - if(app_name) { - char *profile_name = apr_strtok(NULL, " ", &last); - if(!profile_name) { - profile_name = "uni2"; - } - demo_framework_app_run(framework,app_name,profile_name); - } - } - else if(strcasecmp(name,"loglevel") == 0) { - char *priority = apr_strtok(NULL, " ", &last); - if(priority) { - apt_log_priority_set(atol(priority)); - } - } - else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) { - running = FALSE; - } - else if(strcasecmp(name,"help") == 0) { - printf("usage:\n" - "\n- run [app_name] [profile_name] (run demo application)\n" - " app_name is one of 'synth', 'recog', 'bypass', 'discover'\n" - " profile_name is one of 'uni2', 'uni1', ...\n" - "\n examples: \n" - " run synth\n" - " run recog\n" - " run synth uni1\n" - " run recog uni1\n" - "\n- loglevel [level] (set loglevel, one of 0,1...7)\n" - "\n- quit, exit\n"); - } - else { - printf("unknown command: %s (input help for usage)\n",name); - } - return running; -} - -static apt_bool_t demo_framework_cmdline_run(demo_framework_t *framework) -{ - apt_bool_t running = TRUE; - char cmdline[1024]; - apr_size_t i; - do { - printf(">"); - memset(&cmdline, 0, sizeof(cmdline)); - for(i = 0; i < sizeof(cmdline); i++) { - cmdline[i] = (char) getchar(); - if(cmdline[i] == '\n') { - cmdline[i] = '\0'; - break; - } - } - if(*cmdline) { - running = demo_framework_cmdline_process(framework,cmdline); - } - } - while(running != 0); - return TRUE; -} - -static void usage(void) -{ - printf( - "\n" - " * "UNI_COPYRIGHT"\n" - " *\n" - UNI_LICENSE"\n" - "\n" - "Usage:\n" - "\n" - " unimrcpclient [options]\n" - "\n" - " Available options:\n" - "\n" - " -r [--root-dir] path : Set the path to the project root directory.\n" - "\n" - " -c [--dir-layout] path : Set the path to the dir layout config file.\n" - " (takes the precedence over --root-dir option)\n" - "\n" - " -l [--log-prio] priority : Set the log priority.\n" - " (0-emergency, ..., 7-debug)\n" - "\n" - " -o [--log-output] mode : Set the log output mode.\n" - " (0-none, 1-console only, 2-file only, 3-both)\n" - "\n" - " -v [--version] : Show the version.\n" - "\n" - " -h [--help] : Show the help.\n" - "\n"); -} - -static apt_bool_t demo_framework_options_load(client_options_t *options, int argc, const char * const *argv, apr_pool_t *pool) -{ - apr_status_t rv; - apr_getopt_t *opt = NULL; - int optch; - const char *optarg; - - const apr_getopt_option_t opt_option[] = { - /* long-option, short-option, has-arg flag, description */ - { "root-dir", 'r', TRUE, "path to root dir" }, /* -r arg or --root-dir arg */ - { "dir-layout", 'c', TRUE, "path to dir layout conf" }, /* -c arg or --dir-layout arg */ - { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */ - { "log-output", 'o', TRUE, "log output mode" }, /* -o arg or --log-output arg */ - { "version", 'v', FALSE, "show version" }, /* -v or --version */ - { "help", 'h', FALSE, "show help" }, /* -h or --help */ - { NULL, 0, 0, NULL }, /* end */ - }; - - rv = apr_getopt_init(&opt, pool , argc, argv); - if(rv != APR_SUCCESS) { - return FALSE; - } - - /* reset the options */ - options->root_dir_path = NULL; - options->dir_layout_conf = NULL; - options->log_priority = NULL; - options->log_output = NULL; - - while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) { - switch(optch) { - case 'r': - options->root_dir_path = optarg; - break; - case 'c': - options->dir_layout_conf = optarg; - break; - case 'l': - options->log_priority = optarg; - break; - case 'o': - options->log_output = optarg; - break; - case 'v': - printf(UNI_VERSION_STRING); - return FALSE; - case 'h': - usage(); - return FALSE; - } - } - - if(rv != APR_EOF) { - usage(); - return FALSE; - } - - return TRUE; -} - -int main(int argc, const char * const *argv) -{ - apr_pool_t *pool; - client_options_t options; - const char *log_conf_path; - demo_framework_t *framework; - apt_dir_layout_t *dir_layout = NULL; - - /* APR global initialization */ - if(apr_initialize() != APR_SUCCESS) { - apr_terminate(); - return 0; - } - - /* create APR pool */ - pool = apt_pool_create(); - if(!pool) { - apr_terminate(); - return 0; - } - - /* load options */ - if(demo_framework_options_load(&options,argc,argv,pool) != TRUE) { - apr_pool_destroy(pool); - apr_terminate(); - return 0; - } - - if(options.dir_layout_conf) { - /* create and load directories layout from the configuration file */ - dir_layout = apt_dir_layout_create(pool); - if(dir_layout) - apt_dir_layout_load(dir_layout,options.dir_layout_conf,pool); - } - else { - /* create default directories layout */ - dir_layout = apt_default_dir_layout_create(options.root_dir_path,pool); - } - - if(!dir_layout) { - printf("Failed to Create Directories Layout\n"); - apr_pool_destroy(pool); - apr_terminate(); - return 0; - } - - /* get path to logger configuration file */ - log_conf_path = apt_confdir_filepath_get(dir_layout,"logger.xml",pool); - /* create and load singleton logger */ - apt_log_instance_load(log_conf_path,pool); - - if(options.log_priority) { - /* override the log priority, if specified in command line */ - apt_log_priority_set(atoi(options.log_priority)); - } - if(options.log_output) { - /* override the log output mode, if specified in command line */ - apt_log_output_mode_set(atoi(options.log_output)); - } - - if(apt_log_output_mode_check(APT_LOG_OUTPUT_FILE) == TRUE) { - /* open the log file */ - const char *log_dir_path = apt_dir_layout_path_get(dir_layout,APT_LAYOUT_LOG_DIR); - apt_log_file_open(log_dir_path,"unimrcpclient",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,FALSE,pool); - } - - /* create demo framework */ - framework = demo_framework_create(dir_layout); - if(framework) { - /* run command line */ - demo_framework_cmdline_run(framework); - /* destroy demo framework */ - demo_framework_destroy(framework); - } - - /* destroy singleton logger */ - apt_log_instance_destroy(); - /* destroy APR pool */ - apr_pool_destroy(pool); - /* APR global termination */ - apr_terminate(); - return 0; -} diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.rc b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.rc deleted file mode 100644 index 6bfb85f311..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include "uni_version.h" - -1 VERSIONINFO - FILEVERSION UNI_VERSION_STRING_CSV,0 - PRODUCTVERSION UNI_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", UNI_LICENSE "\0" - VALUE "CompanyName", "UniMRCP\0" - VALUE "FileDescription", "UniMRCP Client Application\0" - VALUE "FileVersion", UNI_VERSION_STRING "\0" - VALUE "InternalName", "unimrcpclient" "\0" - VALUE "LegalCopyright", UNI_COPYRIGHT "\0" - VALUE "OriginalFilename", "unimrcpclient.exe" "\0" - VALUE "ProductName", "UniMRCP Project\0" - VALUE "ProductVersion", UNI_VERSION_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj deleted file mode 100644 index 706498e4a4..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcproj +++ /dev/null @@ -1,368 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj deleted file mode 100644 index e477078f01..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj +++ /dev/null @@ -1,153 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {57FAF32E-49FD-491F-895D-132D0D5EFE0A} - unimrcpclient - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - $(UniMRCPClientLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - - - - - - - - - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - - - - - {ee157390-1e85-416c-946e-620e32c9ad33} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj.filters b/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj.filters deleted file mode 100644 index 83f0ded84c..0000000000 --- a/libs/unimrcp/platforms/unimrcp-client/unimrcpclient.vcxproj.filters +++ /dev/null @@ -1,50 +0,0 @@ - - - - - {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 - - - - - src - - - src - - - src - - - src - - - src - - - src - - - src - - - - - include - - - include - - - include - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/unimrcp-server/Makefile.am b/libs/unimrcp/platforms/unimrcp-server/Makefile.am deleted file mode 100644 index 3e8b50823a..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -AM_CPPFLAGS = -I$(top_srcdir)/platforms/unimrcp-server/include \ - $(UNIMRCP_SERVERAPP_INCLUDES) - -bin_PROGRAMS = unimrcpserver -unimrcpserver_SOURCES = src/main.c src/uni_cmdline.c src/uni_daemon.c -unimrcpserver_LDADD = $(UNIMRCP_SERVERAPP_LIBS) -unimrcpserver_LDFLAGS = $(UNIMRCP_SERVERAPP_OPTS) - -include $(top_srcdir)/build/rules/uniserverapp.am diff --git a/libs/unimrcp/platforms/unimrcp-server/src/main.c b/libs/unimrcp/platforms/unimrcp-server/src/main.c deleted file mode 100644 index a295a44934..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/src/main.c +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.c 2204 2014-10-31 01:01:42Z achaloyan@gmail.com $ - */ - -#include -#include -#include -#include "apt_pool.h" -#include "apt_dir_layout.h" -#include "apt_log.h" -#include "uni_version.h" - -typedef struct { - const char *root_dir_path; - const char *dir_layout_conf; - apt_bool_t foreground; - const char *log_priority; - const char *log_output; -#ifdef WIN32 - const char *svcname; -#endif -} server_options_t; - -#ifdef WIN32 -apt_bool_t uni_service_run(const char *name, apt_dir_layout_t *dir_layout, apr_pool_t *pool); -#else -apt_bool_t uni_daemon_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool); -#endif - -apt_bool_t uni_cmdline_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool); - - -static void usage() -{ - printf( - "\n" - " * "UNI_COPYRIGHT"\n" - " *\n" - UNI_LICENSE"\n" - "\n" - "Usage:\n" - "\n" - " unimrcpserver [options]\n" - "\n" - " Available options:\n" - "\n" - " -r [--root-dir] path : Set the path to the project root directory.\n" - "\n" - " -c [--dir-layout] path : Set the path to the dir layout config file.\n" - " (takes the precedence over --root-dir option)\n" - "\n" - " -l [--log-prio] priority : Set the log priority.\n" - " (0-emergency, ..., 7-debug)\n" - "\n" - " -o [--log-output] mode : Set the log output mode.\n" - " (0-none, 1-console only, 2-file only, 3-both)\n" - "\n" -#ifdef WIN32 - " -s [--service] : Run as a Windows service.\n" - "\n" - " -n [--name] svcname : Set the service name (default: unimrcp)\n" - "\n" -#else - " -d [--daemon] : Run as a daemon.\n" - "\n" -#endif - " -v [--version] : Show the version.\n" - "\n" - " -h [--help] : Show the help.\n" - "\n"); -} - -static apt_bool_t options_load(server_options_t *options, int argc, const char * const *argv, apr_pool_t *pool) -{ - apr_status_t rv; - apr_getopt_t *opt = NULL; - int optch; - const char *optarg; - - const apr_getopt_option_t opt_option[] = { - /* long-option, short-option, has-arg flag, description */ - { "root-dir", 'r', TRUE, "path to root dir" }, /* -r arg or --root-dir arg */ - { "dir-layout", 'c', TRUE, "path to dir layout conf" }, /* -c arg or --dir-layout arg */ - { "log-prio", 'l', TRUE, "log priority" }, /* -l arg or --log-prio arg */ - { "log-output", 'o', TRUE, "log output mode" }, /* -o arg or --log-output arg */ -#ifdef WIN32 - { "service", 's', FALSE, "run as service" }, /* -s or --service */ - { "name", 'n', TRUE, "service name" }, /* -n or --name arg */ -#else - { "daemon", 'd', FALSE, "start as daemon" }, /* -d or --daemon */ -#endif - { "version", 'v', FALSE, "show version" }, /* -v or --version */ - { "help", 'h', FALSE, "show help" }, /* -h or --help */ - { NULL, 0, 0, NULL }, /* end */ - }; - - rv = apr_getopt_init(&opt, pool , argc, argv); - if(rv != APR_SUCCESS) { - return FALSE; - } - - /* reset the options */ - options->root_dir_path = NULL; - options->dir_layout_conf = NULL; - options->foreground = TRUE; - options->log_priority = NULL; - options->log_output = NULL; -#ifdef WIN32 - options->svcname = NULL; -#endif - - while((rv = apr_getopt_long(opt, opt_option, &optch, &optarg)) == APR_SUCCESS) { - switch(optch) { - case 'r': - options->root_dir_path = optarg; - break; - case 'c': - options->dir_layout_conf = optarg; - break; - case 'l': - options->log_priority = optarg; - break; - case 'o': - options->log_output = optarg; - break; -#ifdef WIN32 - case 's': - options->foreground = FALSE; - break; - case 'n': - options->svcname = optarg; - break; -#else - case 'd': - options->foreground = FALSE; - break; -#endif - case 'v': - printf(UNI_VERSION_STRING); - return FALSE; - case 'h': - usage(); - return FALSE; - } - } - - if(rv != APR_EOF) { - usage(); - return FALSE; - } - - return TRUE; -} - -int main(int argc, const char * const *argv) -{ - apr_pool_t *pool; - server_options_t options; - const char *log_conf_path; - apt_dir_layout_t *dir_layout = NULL; - - /* APR global initialization */ - if(apr_initialize() != APR_SUCCESS) { - apr_terminate(); - return 0; - } - - /* create APR pool */ - pool = apt_pool_create(); - if(!pool) { - apr_terminate(); - return 0; - } - - /* load options */ - if(options_load(&options,argc,argv,pool) != TRUE) { - apr_pool_destroy(pool); - apr_terminate(); - return 0; - } - - if(options.dir_layout_conf) { - /* create and load directories layout from the configuration file */ - dir_layout = apt_dir_layout_create(pool); - if(dir_layout) - apt_dir_layout_load(dir_layout,options.dir_layout_conf,pool); - } - else { - /* create default directories layout */ - dir_layout = apt_default_dir_layout_create(options.root_dir_path,pool); - } - - if(!dir_layout) { - printf("Failed to Create Directories Layout\n"); - apr_pool_destroy(pool); - apr_terminate(); - return 0; - } - - /* get path to logger configuration file */ - log_conf_path = apt_confdir_filepath_get(dir_layout,"logger.xml",pool); - /* create and load singleton logger */ - apt_log_instance_load(log_conf_path,pool); - - if(options.log_priority) { - /* override the log priority, if specified in command line */ - apt_log_priority_set(atoi(options.log_priority)); - } - if(options.log_output) { - /* override the log output mode, if specified in command line */ - apt_log_output_mode_set(atoi(options.log_output)); - } - - if(apt_log_output_mode_check(APT_LOG_OUTPUT_FILE) == TRUE) { - /* open the log file */ - const char *log_dir_path = apt_dir_layout_path_get(dir_layout,APT_LAYOUT_LOG_DIR); - apt_log_file_open(log_dir_path,"unimrcpserver",MAX_LOG_FILE_SIZE,MAX_LOG_FILE_COUNT,TRUE,pool); - } - - if(options.foreground == TRUE) { - /* run command line */ - uni_cmdline_run(dir_layout,pool); - } -#ifdef WIN32 - else { - /* run as windows service */ - uni_service_run(options.svcname,dir_layout,pool); - } -#else - else { - /* run as daemon */ - uni_daemon_run(dir_layout,pool); - } -#endif - - /* destroy singleton logger */ - apt_log_instance_destroy(); - /* destroy APR pool */ - apr_pool_destroy(pool); - /* APR global termination */ - apr_terminate(); - return 0; -} diff --git a/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c b/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c deleted file mode 100644 index e79132bb49..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/src/uni_cmdline.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: uni_cmdline.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include "unimrcp_server.h" -#include "apt_log.h" - -static apt_bool_t cmdline_process(char *cmdline) -{ - apt_bool_t running = TRUE; - char *name; - char *last; - name = apr_strtok(cmdline, " ", &last); - - if(strcasecmp(name,"loglevel") == 0) { - char *priority = apr_strtok(NULL, " ", &last); - if(priority) { - apt_log_priority_set(atol(priority)); - } - } - else if(strcasecmp(name,"exit") == 0 || strcmp(name,"quit") == 0) { - running = FALSE; - } - else if(strcasecmp(name,"help") == 0) { - printf("usage:\n"); - printf("- loglevel [level] (set loglevel, one of 0,1...7)\n"); - printf("- quit, exit\n"); - } - else { - printf("unknown command: %s (input help for usage)\n",name); - } - return running; -} - -apt_bool_t uni_cmdline_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool) -{ - apt_bool_t running = TRUE; - char cmdline[1024]; - apr_size_t i; - mrcp_server_t *server; - - /* start server */ - server = unimrcp_server_start(dir_layout); - if(!server) { - return FALSE; - } - - do { - printf(">"); - memset(&cmdline, 0, sizeof(cmdline)); - for(i = 0; i < sizeof(cmdline); i++) { - cmdline[i] = (char) getchar(); - if(cmdline[i] == '\n') { - cmdline[i] = '\0'; - break; - } - } - if(*cmdline) { - running = cmdline_process(cmdline); - } - } - while(running != 0); - - /* shutdown server */ - unimrcp_server_shutdown(server); - return TRUE; -} diff --git a/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c b/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c deleted file mode 100644 index 969f14dd60..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/src/uni_daemon.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: uni_daemon.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include "unimrcp_server.h" -#include "apt_log.h" - -static apt_bool_t daemon_running; - -static void sigterm_handler(int signo) -{ - daemon_running = FALSE; -} - -apt_bool_t uni_daemon_run(apt_dir_layout_t *dir_layout, apr_pool_t *pool) -{ - mrcp_server_t *server; - - daemon_running = TRUE; - apr_signal(SIGTERM,sigterm_handler); - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Run as Daemon"); - apr_proc_detach(APR_PROC_DETACH_DAEMONIZE); - - /* start server */ - server = unimrcp_server_start(dir_layout); - if(!server) { - return FALSE; - } - - while(daemon_running) apr_sleep(1000000); - - /* shutdown server */ - unimrcp_server_shutdown(server); - return TRUE; -} diff --git a/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c b/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c deleted file mode 100644 index 31b70c0c39..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/src/uni_service.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: uni_service.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include "unimrcp_server.h" -#include "apt_log.h" - -#define WIN_SERVICE_NAME "unimrcp" - -static SERVICE_STATUS_HANDLE win_service_status_handle = NULL; -static SERVICE_STATUS win_service_status; - -static mrcp_server_t *server = NULL; -static apt_dir_layout_t *service_dir_layout = NULL; -static const char *svcname = NULL; - -/** Display error message with Windows error code and description */ -static void winerror(const char *file, int line, const char *msg) -{ - char buf[128]; - DWORD err = GetLastError(); - int ret = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - err, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - buf, sizeof(buf), NULL); - apt_log(file, line, APT_PRIO_WARNING, "%s: %lu %.*s\n", msg, err, ret, buf); -} - -/** SCM state change handler */ -static void WINAPI win_service_handler(DWORD control) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Service Handler 0x%02lx",control); - switch (control) - { - case SERVICE_CONTROL_INTERROGATE: - break; - case SERVICE_CONTROL_SHUTDOWN: - case SERVICE_CONTROL_STOP: - if(server) { - win_service_status.dwCurrentState = SERVICE_STOP_PENDING; - if(!SetServiceStatus(win_service_status_handle, &win_service_status)) { - winerror(APT_LOG_MARK, "Failed to Set Service Status"); - } - - /* shutdown server */ - unimrcp_server_shutdown(server); - } - win_service_status.dwCurrentState = SERVICE_STOPPED; - win_service_status.dwCheckPoint = 0; - win_service_status.dwWaitHint = 0; - break; - } - - if(!SetServiceStatus(win_service_status_handle, &win_service_status)) { - winerror(APT_LOG_MARK, "Failed to Set Service Status"); - } -} - -static void WINAPI win_service_main(DWORD argc, LPTSTR *argv) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Service Main"); - win_service_status.dwServiceType = SERVICE_WIN32; - win_service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP; - win_service_status.dwWin32ExitCode = 0; - win_service_status.dwServiceSpecificExitCode = 0; - win_service_status.dwCheckPoint = 0; - win_service_status.dwWaitHint = 0; - - win_service_status_handle = RegisterServiceCtrlHandler(svcname, win_service_handler); - if(win_service_status_handle == (SERVICE_STATUS_HANDLE)0) { - winerror(APT_LOG_MARK, "Failed to Register Service Control Handler"); - return; - } - - win_service_status.dwCurrentState = SERVICE_START_PENDING; - if(!SetServiceStatus(win_service_status_handle, &win_service_status)) { - winerror(APT_LOG_MARK, "Failed to Set Service Status"); - } - - /* start server */ - server = unimrcp_server_start(service_dir_layout); - - win_service_status.dwCurrentState = server ? SERVICE_RUNNING : SERVICE_STOPPED; - if(!SetServiceStatus(win_service_status_handle, &win_service_status)) { - winerror(APT_LOG_MARK, "Failed to Set Service Status"); - } -} - -/** Run SCM service */ -apt_bool_t uni_service_run(const char *name, apt_dir_layout_t *dir_layout, apr_pool_t *pool) -{ - SERVICE_TABLE_ENTRY win_service_table[2]; - svcname = name ? name : WIN_SERVICE_NAME; - memset(&win_service_table, 0, sizeof(win_service_table)); - win_service_table->lpServiceName = (char *) svcname; - win_service_table->lpServiceProc = win_service_main; - - service_dir_layout = dir_layout; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Run as Service %s",svcname); - if(!StartServiceCtrlDispatcher(win_service_table)) { - winerror(APT_LOG_MARK, "Failed to Connect to SCM"); - } - return TRUE; -} diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.rc b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.rc deleted file mode 100644 index 4f6c5dd891..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include "uni_version.h" - -1 VERSIONINFO - FILEVERSION UNI_VERSION_STRING_CSV,0 - PRODUCTVERSION UNI_VERSION_STRING_CSV,0 - FILEFLAGSMASK 0x3fL -#if defined(_DEBUG) - FILEFLAGS 0x01L -#else - FILEFLAGS 0x00L -#endif -#if defined(WINNT) || defined(WIN64) - FILEOS 0x40004L -#else - FILEOS 0x4L -#endif - FILETYPE 0x1L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "Comments", UNI_LICENSE "\0" - VALUE "CompanyName", "UniMRCP\0" - VALUE "FileDescription", "UniMRCP Server Application\0" - VALUE "FileVersion", UNI_VERSION_STRING "\0" - VALUE "InternalName", "unimrcpserver" "\0" - VALUE "LegalCopyright", UNI_COPYRIGHT "\0" - VALUE "OriginalFilename", "unimrcpserver.exe" "\0" - VALUE "ProductName", "UniMRCP Project\0" - VALUE "ProductVersion", UNI_VERSION_STRING "\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj deleted file mode 100644 index 46e57dab5a..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcproj +++ /dev/null @@ -1,340 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj deleted file mode 100644 index e2d74c9575..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj +++ /dev/null @@ -1,135 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {592CF22D-3F8F-4A77-A174-130D77B7623B} - unimrcpserver - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - $(UniMRCPServerLibs);%(AdditionalDependencies) - - - - - $(UniMRCPServerLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - $(UniMRCPServerLibs);%(AdditionalDependencies) - - - - - X64 - - - $(UniMRCPServerLibs);%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - ..\..\build;%(AdditionalIncludeDirectories) - - - - - {c98af157-352e-4737-bd30-a24e2647f5ae} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj.filters b/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj.filters deleted file mode 100644 index 6b335bf544..0000000000 --- a/libs/unimrcp/platforms/unimrcp-server/unimrcpserver.vcxproj.filters +++ /dev/null @@ -1,30 +0,0 @@ - - - - - {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 - - - - - src - - - src - - - src - - - src - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/Makefile.am b/libs/unimrcp/plugins/Makefile.am deleted file mode 100644 index 2300a4934a..0000000000 --- a/libs/unimrcp/plugins/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = - -if DEMOSYNTH_PLUGIN -SUBDIRS += demo-synth -endif - -if DEMORECOG_PLUGIN -SUBDIRS += demo-recog -endif - -if DEMOVERIFIER_PLUGIN -SUBDIRS += demo-verifier -endif - -if RECORDER_PLUGIN -SUBDIRS += mrcp-recorder -endif diff --git a/libs/unimrcp/plugins/demo-recog/Makefile.am b/libs/unimrcp/plugins/demo-recog/Makefile.am deleted file mode 100644 index 51babdaaa3..0000000000 --- a/libs/unimrcp/plugins/demo-recog/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -AM_CPPFLAGS = $(UNIMRCP_PLUGIN_INCLUDES) - -plugin_LTLIBRARIES = demorecog.la - -demorecog_la_SOURCES = src/demo_recog_engine.c -demorecog_la_LDFLAGS = $(UNIMRCP_PLUGIN_OPTS) - -include $(top_srcdir)/build/rules/uniplugin.am diff --git a/libs/unimrcp/plugins/demo-recog/demorecog.vcproj b/libs/unimrcp/plugins/demo-recog/demorecog.vcproj deleted file mode 100644 index 567aa3d158..0000000000 --- a/libs/unimrcp/plugins/demo-recog/demorecog.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj b/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj deleted file mode 100644 index 562c8b4902..0000000000 --- a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {B495B6D9-AF84-479D-B30A-313C16EF8BFD} - demorecog - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj.filters b/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj.filters deleted file mode 100644 index af5b05f706..0000000000 --- a/libs/unimrcp/plugins/demo-recog/demorecog.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {4c5e54ad-7563-43a7-8b11-5067a45289e9} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c b/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c deleted file mode 100644 index 75954a45b2..0000000000 --- a/libs/unimrcp/plugins/demo-recog/src/demo_recog_engine.c +++ /dev/null @@ -1,564 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_recog_engine.c 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $ - */ - -/* - * Mandatory rules concerning plugin implementation. - * 1. Each plugin MUST implement a plugin/engine creator function - * with the exact signature and name (the main entry point) - * MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool) - * 2. Each plugin MUST declare its version number - * MRCP_PLUGIN_VERSION_DECLARE - * 3. One and only one response MUST be sent back to the received request. - * 4. Methods (callbacks) of the MRCP engine channel MUST not block. - * (asynchronous response can be sent from the context of other thread) - * 5. Methods (callbacks) of the MPF engine stream MUST not block. - */ - -#include "mrcp_recog_engine.h" -#include "mpf_activity_detector.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - -#define RECOG_ENGINE_TASK_NAME "Demo Recog Engine" - -typedef struct demo_recog_engine_t demo_recog_engine_t; -typedef struct demo_recog_channel_t demo_recog_channel_t; -typedef struct demo_recog_msg_t demo_recog_msg_t; - -/** Declaration of recognizer engine methods */ -static apt_bool_t demo_recog_engine_destroy(mrcp_engine_t *engine); -static apt_bool_t demo_recog_engine_open(mrcp_engine_t *engine); -static apt_bool_t demo_recog_engine_close(mrcp_engine_t *engine); -static mrcp_engine_channel_t* demo_recog_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool); - -static const struct mrcp_engine_method_vtable_t engine_vtable = { - demo_recog_engine_destroy, - demo_recog_engine_open, - demo_recog_engine_close, - demo_recog_engine_channel_create -}; - - -/** Declaration of recognizer channel methods */ -static apt_bool_t demo_recog_channel_destroy(mrcp_engine_channel_t *channel); -static apt_bool_t demo_recog_channel_open(mrcp_engine_channel_t *channel); -static apt_bool_t demo_recog_channel_close(mrcp_engine_channel_t *channel); -static apt_bool_t demo_recog_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request); - -static const struct mrcp_engine_channel_method_vtable_t channel_vtable = { - demo_recog_channel_destroy, - demo_recog_channel_open, - demo_recog_channel_close, - demo_recog_channel_request_process -}; - -/** Declaration of recognizer audio stream methods */ -static apt_bool_t demo_recog_stream_destroy(mpf_audio_stream_t *stream); -static apt_bool_t demo_recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t demo_recog_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t demo_recog_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t audio_stream_vtable = { - demo_recog_stream_destroy, - NULL, - NULL, - NULL, - demo_recog_stream_open, - demo_recog_stream_close, - demo_recog_stream_write, - NULL -}; - -/** Declaration of demo recognizer engine */ -struct demo_recog_engine_t { - apt_consumer_task_t *task; -}; - -/** Declaration of demo recognizer channel */ -struct demo_recog_channel_t { - /** Back pointer to engine */ - demo_recog_engine_t *demo_engine; - /** Engine channel base */ - mrcp_engine_channel_t *channel; - - /** Active (in-progress) recognition request */ - mrcp_message_t *recog_request; - /** Pending stop response */ - mrcp_message_t *stop_response; - /** Indicates whether input timers are started */ - apt_bool_t timers_started; - /** Voice activity detector */ - mpf_activity_detector_t *detector; - /** File to write utterance to */ - FILE *audio_out; -}; - -typedef enum { - DEMO_RECOG_MSG_OPEN_CHANNEL, - DEMO_RECOG_MSG_CLOSE_CHANNEL, - DEMO_RECOG_MSG_REQUEST_PROCESS -} demo_recog_msg_type_e; - -/** Declaration of demo recognizer task message */ -struct demo_recog_msg_t { - demo_recog_msg_type_e type; - mrcp_engine_channel_t *channel; - mrcp_message_t *request; -}; - -static apt_bool_t demo_recog_msg_signal(demo_recog_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request); -static apt_bool_t demo_recog_msg_process(apt_task_t *task, apt_task_msg_t *msg); - -/** Declare this macro to set plugin version */ -MRCP_PLUGIN_VERSION_DECLARE - -/** Declare this macro to use log routine of the server, plugin is loaded from */ -MRCP_PLUGIN_LOGGER_IMPLEMENT - -/** Create demo recognizer engine */ -MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool) -{ - demo_recog_engine_t *demo_engine = apr_palloc(pool,sizeof(demo_recog_engine_t)); - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(demo_recog_msg_t),pool); - demo_engine->task = apt_consumer_task_create(demo_engine,msg_pool,pool); - if(!demo_engine->task) { - return NULL; - } - task = apt_consumer_task_base_get(demo_engine->task); - apt_task_name_set(task,RECOG_ENGINE_TASK_NAME); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = demo_recog_msg_process; - } - - /* create engine base */ - return mrcp_engine_create( - MRCP_RECOGNIZER_RESOURCE, /* MRCP resource identifier */ - demo_engine, /* object to associate */ - &engine_vtable, /* virtual methods table of engine */ - pool); /* pool to allocate memory from */ -} - -/** Destroy recognizer engine */ -static apt_bool_t demo_recog_engine_destroy(mrcp_engine_t *engine) -{ - demo_recog_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_destroy(task); - demo_engine->task = NULL; - } - return TRUE; -} - -/** Open recognizer engine */ -static apt_bool_t demo_recog_engine_open(mrcp_engine_t *engine) -{ - demo_recog_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_start(task); - } - return mrcp_engine_open_respond(engine,TRUE); -} - -/** Close recognizer engine */ -static apt_bool_t demo_recog_engine_close(mrcp_engine_t *engine) -{ - demo_recog_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_terminate(task,TRUE); - } - return mrcp_engine_close_respond(engine); -} - -static mrcp_engine_channel_t* demo_recog_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities; - mpf_termination_t *termination; - - /* create demo recog channel */ - demo_recog_channel_t *recog_channel = apr_palloc(pool,sizeof(demo_recog_channel_t)); - recog_channel->demo_engine = engine->obj; - recog_channel->recog_request = NULL; - recog_channel->stop_response = NULL; - recog_channel->detector = mpf_activity_detector_create(pool); - recog_channel->audio_out = NULL; - - capabilities = mpf_sink_stream_capabilities_create(pool); - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "LPCM"); - - /* create media termination */ - termination = mrcp_engine_audio_termination_create( - recog_channel, /* object to associate */ - &audio_stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - /* create engine channel base */ - recog_channel->channel = mrcp_engine_channel_create( - engine, /* engine */ - &channel_vtable, /* virtual methods table of engine channel */ - recog_channel, /* object to associate */ - termination, /* associated media termination */ - pool); /* pool to allocate memory from */ - - return recog_channel->channel; -} - -/** Destroy engine channel */ -static apt_bool_t demo_recog_channel_destroy(mrcp_engine_channel_t *channel) -{ - /* nothing to destrtoy */ - return TRUE; -} - -/** Open engine channel (asynchronous response MUST be sent)*/ -static apt_bool_t demo_recog_channel_open(mrcp_engine_channel_t *channel) -{ - return demo_recog_msg_signal(DEMO_RECOG_MSG_OPEN_CHANNEL,channel,NULL); -} - -/** Close engine channel (asynchronous response MUST be sent)*/ -static apt_bool_t demo_recog_channel_close(mrcp_engine_channel_t *channel) -{ - return demo_recog_msg_signal(DEMO_RECOG_MSG_CLOSE_CHANNEL,channel,NULL); -} - -/** Process MRCP channel request (asynchronous response MUST be sent)*/ -static apt_bool_t demo_recog_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - return demo_recog_msg_signal(DEMO_RECOG_MSG_REQUEST_PROCESS,channel,request); -} - -/** Process RECOGNIZE request */ -static apt_bool_t demo_recog_channel_recognize(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - /* process RECOGNIZE request */ - mrcp_recog_header_t *recog_header; - demo_recog_channel_t *recog_channel = channel->method_obj; - const mpf_codec_descriptor_t *descriptor = mrcp_engine_sink_stream_codec_get(channel); - - if(!descriptor) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Codec Descriptor "APT_SIDRES_FMT, MRCP_MESSAGE_SIDRES(request)); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - return FALSE; - } - - recog_channel->timers_started = TRUE; - - /* get recognizer header */ - recog_header = mrcp_resource_header_get(request); - if(recog_header) { - if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_START_INPUT_TIMERS) == TRUE) { - recog_channel->timers_started = recog_header->start_input_timers; - } - if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_NO_INPUT_TIMEOUT) == TRUE) { - mpf_activity_detector_noinput_timeout_set(recog_channel->detector,recog_header->no_input_timeout); - } - if(mrcp_resource_header_property_check(request,RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT) == TRUE) { - mpf_activity_detector_silence_timeout_set(recog_channel->detector,recog_header->speech_complete_timeout); - } - } - - if(!recog_channel->audio_out) { - const apt_dir_layout_t *dir_layout = channel->engine->dir_layout; - char *file_name = apr_psprintf(channel->pool,"utter-%dkHz-%s.pcm", - descriptor->sampling_rate/1000, - request->channel_id.session_id.buf); - char *file_path = apt_vardir_filepath_get(dir_layout,file_name,channel->pool); - if(file_path) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Utterance Output File [%s] for Writing",file_path); - recog_channel->audio_out = fopen(file_path,"wb"); - if(!recog_channel->audio_out) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Utterance Output File [%s] for Writing",file_path); - } - } - } - - response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - /* send asynchronous response */ - mrcp_engine_channel_message_send(channel,response); - recog_channel->recog_request = request; - return TRUE; -} - -/** Process STOP request */ -static apt_bool_t demo_recog_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - /* process STOP request */ - demo_recog_channel_t *recog_channel = channel->method_obj; - /* store STOP request, make sure there is no more activity and only then send the response */ - recog_channel->stop_response = response; - return TRUE; -} - -/** Process START-INPUT-TIMERS request */ -static apt_bool_t demo_recog_channel_timers_start(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - demo_recog_channel_t *recog_channel = channel->method_obj; - recog_channel->timers_started = TRUE; - return mrcp_engine_channel_message_send(channel,response); -} - -/** Dispatch MRCP request */ -static apt_bool_t demo_recog_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - apt_bool_t processed = FALSE; - mrcp_message_t *response = mrcp_response_create(request,request->pool); - switch(request->start_line.method_id) { - case RECOGNIZER_SET_PARAMS: - break; - case RECOGNIZER_GET_PARAMS: - break; - case RECOGNIZER_DEFINE_GRAMMAR: - break; - case RECOGNIZER_RECOGNIZE: - processed = demo_recog_channel_recognize(channel,request,response); - break; - case RECOGNIZER_GET_RESULT: - break; - case RECOGNIZER_START_INPUT_TIMERS: - processed = demo_recog_channel_timers_start(channel,request,response); - break; - case RECOGNIZER_STOP: - processed = demo_recog_channel_stop(channel,request,response); - break; - default: - break; - } - if(processed == FALSE) { - /* send asynchronous response for not handled request */ - mrcp_engine_channel_message_send(channel,response); - } - return TRUE; -} - -/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */ -static apt_bool_t demo_recog_stream_destroy(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform any action before open */ -static apt_bool_t demo_recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform any action after close */ -static apt_bool_t demo_recog_stream_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/* Raise demo START-OF-INPUT event */ -static apt_bool_t demo_recog_start_of_input(demo_recog_channel_t *recog_channel) -{ - /* create START-OF-INPUT event */ - mrcp_message_t *message = mrcp_event_create( - recog_channel->recog_request, - RECOGNIZER_START_OF_INPUT, - recog_channel->recog_request->pool); - if(!message) { - return FALSE; - } - - /* set request state */ - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - /* send asynch event */ - return mrcp_engine_channel_message_send(recog_channel->channel,message); -} - -/* Load demo recognition result */ -static apt_bool_t demo_recog_result_load(demo_recog_channel_t *recog_channel, mrcp_message_t *message) -{ - FILE *file; - mrcp_engine_channel_t *channel = recog_channel->channel; - const apt_dir_layout_t *dir_layout = channel->engine->dir_layout; - char *file_path = apt_datadir_filepath_get(dir_layout,"result.xml",message->pool); - if(!file_path) { - return FALSE; - } - - /* read the demo result from file */ - file = fopen(file_path,"r"); - if(file) { - mrcp_generic_header_t *generic_header; - char text[1024]; - apr_size_t size; - size = fread(text,1,sizeof(text),file); - apt_string_assign_n(&message->body,text,size,message->pool); - fclose(file); - - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(message); - if(generic_header) { - /* set content types */ - apt_string_assign(&generic_header->content_type,"application/x-nlsml",message->pool); - mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE); - } - } - return TRUE; -} - -/* Raise demo RECOGNITION-COMPLETE event */ -static apt_bool_t demo_recog_recognition_complete(demo_recog_channel_t *recog_channel, mrcp_recog_completion_cause_e cause) -{ - mrcp_recog_header_t *recog_header; - /* create RECOGNITION-COMPLETE event */ - mrcp_message_t *message = mrcp_event_create( - recog_channel->recog_request, - RECOGNIZER_RECOGNITION_COMPLETE, - recog_channel->recog_request->pool); - if(!message) { - return FALSE; - } - - /* get/allocate recognizer header */ - recog_header = mrcp_resource_header_prepare(message); - if(recog_header) { - /* set completion cause */ - recog_header->completion_cause = cause; - mrcp_resource_header_property_add(message,RECOGNIZER_HEADER_COMPLETION_CAUSE); - } - /* set request state */ - message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - - if(cause == RECOGNIZER_COMPLETION_CAUSE_SUCCESS) { - demo_recog_result_load(recog_channel,message); - } - - recog_channel->recog_request = NULL; - /* send asynch event */ - return mrcp_engine_channel_message_send(recog_channel->channel,message); -} - -/** Callback is called from MPF engine context to write/send new frame */ -static apt_bool_t demo_recog_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - demo_recog_channel_t *recog_channel = stream->obj; - if(recog_channel->stop_response) { - /* send asynchronous response to STOP request */ - mrcp_engine_channel_message_send(recog_channel->channel,recog_channel->stop_response); - recog_channel->stop_response = NULL; - recog_channel->recog_request = NULL; - return TRUE; - } - - if(recog_channel->recog_request) { - mpf_detector_event_e det_event = mpf_activity_detector_process(recog_channel->detector,frame); - switch(det_event) { - case MPF_DETECTOR_EVENT_ACTIVITY: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(recog_channel->recog_request)); - demo_recog_start_of_input(recog_channel); - break; - case MPF_DETECTOR_EVENT_INACTIVITY: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(recog_channel->recog_request)); - demo_recog_recognition_complete(recog_channel,RECOGNIZER_COMPLETION_CAUSE_SUCCESS); - break; - case MPF_DETECTOR_EVENT_NOINPUT: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Noinput "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(recog_channel->recog_request)); - if(recog_channel->timers_started == TRUE) { - demo_recog_recognition_complete(recog_channel,RECOGNIZER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT); - } - break; - default: - break; - } - - if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) { - if(frame->marker == MPF_MARKER_START_OF_EVENT) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Start of Event "APT_SIDRES_FMT" id:%d", - MRCP_MESSAGE_SIDRES(recog_channel->recog_request), - frame->event_frame.event_id); - } - else if(frame->marker == MPF_MARKER_END_OF_EVENT) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected End of Event "APT_SIDRES_FMT" id:%d duration:%d ts", - MRCP_MESSAGE_SIDRES(recog_channel->recog_request), - frame->event_frame.event_id, - frame->event_frame.duration); - } - } - - if(recog_channel->audio_out) { - fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,recog_channel->audio_out); - } - } - return TRUE; -} - -static apt_bool_t demo_recog_msg_signal(demo_recog_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - apt_bool_t status = FALSE; - demo_recog_channel_t *demo_channel = channel->method_obj; - demo_recog_engine_t *demo_engine = demo_channel->demo_engine; - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_msg_t *msg = apt_task_msg_get(task); - if(msg) { - demo_recog_msg_t *demo_msg; - msg->type = TASK_MSG_USER; - demo_msg = (demo_recog_msg_t*) msg->data; - - demo_msg->type = type; - demo_msg->channel = channel; - demo_msg->request = request; - status = apt_task_msg_signal(task,msg); - } - return status; -} - -static apt_bool_t demo_recog_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - demo_recog_msg_t *demo_msg = (demo_recog_msg_t*)msg->data; - switch(demo_msg->type) { - case DEMO_RECOG_MSG_OPEN_CHANNEL: - /* open channel and send asynch response */ - mrcp_engine_channel_open_respond(demo_msg->channel,TRUE); - break; - case DEMO_RECOG_MSG_CLOSE_CHANNEL: - { - /* close channel, make sure there is no activity and send asynch response */ - demo_recog_channel_t *recog_channel = demo_msg->channel->method_obj; - if(recog_channel->audio_out) { - fclose(recog_channel->audio_out); - recog_channel->audio_out = NULL; - } - - mrcp_engine_channel_close_respond(demo_msg->channel); - break; - } - case DEMO_RECOG_MSG_REQUEST_PROCESS: - demo_recog_channel_request_dispatch(demo_msg->channel,demo_msg->request); - break; - default: - break; - } - return TRUE; -} diff --git a/libs/unimrcp/plugins/demo-synth/Makefile.am b/libs/unimrcp/plugins/demo-synth/Makefile.am deleted file mode 100644 index 4b62aef593..0000000000 --- a/libs/unimrcp/plugins/demo-synth/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -AM_CPPFLAGS = $(UNIMRCP_PLUGIN_INCLUDES) - -plugin_LTLIBRARIES = demosynth.la - -demosynth_la_SOURCES = src/demo_synth_engine.c -demosynth_la_LDFLAGS = $(UNIMRCP_PLUGIN_OPTS) - -include $(top_srcdir)/build/rules/uniplugin.am diff --git a/libs/unimrcp/plugins/demo-synth/demosynth.vcproj b/libs/unimrcp/plugins/demo-synth/demosynth.vcproj deleted file mode 100644 index 673fb07f30..0000000000 --- a/libs/unimrcp/plugins/demo-synth/demosynth.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj b/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj deleted file mode 100644 index 4df06203cb..0000000000 --- a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {92BFA534-C419-4EB2-AAA3-510653F38F08} - demosynth - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj.filters b/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj.filters deleted file mode 100644 index 1c71d5467d..0000000000 --- a/libs/unimrcp/plugins/demo-synth/demosynth.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {c816d2c0-8f04-4474-ad43-cfac130a1a84} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c b/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c deleted file mode 100644 index bc68c895fa..0000000000 --- a/libs/unimrcp/plugins/demo-synth/src/demo_synth_engine.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_synth_engine.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -/* - * Mandatory rules concerning plugin implementation. - * 1. Each plugin MUST implement a plugin/engine creator function - * with the exact signature and name (the main entry point) - * MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool) - * 2. Each plugin MUST declare its version number - * MRCP_PLUGIN_VERSION_DECLARE - * 3. One and only one response MUST be sent back to the received request. - * 4. Methods (callbacks) of the MRCP engine channel MUST not block. - * (asynchronous response can be sent from the context of other thread) - * 5. Methods (callbacks) of the MPF engine stream MUST not block. - */ - -#include "mrcp_synth_engine.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - -#define SYNTH_ENGINE_TASK_NAME "Demo Synth Engine" - -typedef struct demo_synth_engine_t demo_synth_engine_t; -typedef struct demo_synth_channel_t demo_synth_channel_t; -typedef struct demo_synth_msg_t demo_synth_msg_t; - -/** Declaration of synthesizer engine methods */ -static apt_bool_t demo_synth_engine_destroy(mrcp_engine_t *engine); -static apt_bool_t demo_synth_engine_open(mrcp_engine_t *engine); -static apt_bool_t demo_synth_engine_close(mrcp_engine_t *engine); -static mrcp_engine_channel_t* demo_synth_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool); - -static const struct mrcp_engine_method_vtable_t engine_vtable = { - demo_synth_engine_destroy, - demo_synth_engine_open, - demo_synth_engine_close, - demo_synth_engine_channel_create -}; - - -/** Declaration of synthesizer channel methods */ -static apt_bool_t demo_synth_channel_destroy(mrcp_engine_channel_t *channel); -static apt_bool_t demo_synth_channel_open(mrcp_engine_channel_t *channel); -static apt_bool_t demo_synth_channel_close(mrcp_engine_channel_t *channel); -static apt_bool_t demo_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request); - -static const struct mrcp_engine_channel_method_vtable_t channel_vtable = { - demo_synth_channel_destroy, - demo_synth_channel_open, - demo_synth_channel_close, - demo_synth_channel_request_process -}; - -/** Declaration of synthesizer audio stream methods */ -static apt_bool_t demo_synth_stream_destroy(mpf_audio_stream_t *stream); -static apt_bool_t demo_synth_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t demo_synth_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t demo_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t audio_stream_vtable = { - demo_synth_stream_destroy, - demo_synth_stream_open, - demo_synth_stream_close, - demo_synth_stream_read, - NULL, - NULL, - NULL, - NULL -}; - -/** Declaration of demo synthesizer engine */ -struct demo_synth_engine_t { - apt_consumer_task_t *task; -}; - -/** Declaration of demo synthesizer channel */ -struct demo_synth_channel_t { - /** Back pointer to engine */ - demo_synth_engine_t *demo_engine; - /** Engine channel base */ - mrcp_engine_channel_t *channel; - - /** Active (in-progress) speak request */ - mrcp_message_t *speak_request; - /** Pending stop response */ - mrcp_message_t *stop_response; - /** Estimated time to complete */ - apr_size_t time_to_complete; - /** Is paused */ - apt_bool_t paused; - /** Speech source (used instead of actual synthesis) */ - FILE *audio_file; -}; - -typedef enum { - DEMO_SYNTH_MSG_OPEN_CHANNEL, - DEMO_SYNTH_MSG_CLOSE_CHANNEL, - DEMO_SYNTH_MSG_REQUEST_PROCESS -} demo_synth_msg_type_e; - -/** Declaration of demo synthesizer task message */ -struct demo_synth_msg_t { - demo_synth_msg_type_e type; - mrcp_engine_channel_t *channel; - mrcp_message_t *request; -}; - - -static apt_bool_t demo_synth_msg_signal(demo_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request); -static apt_bool_t demo_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg); - -/** Declare this macro to set plugin version */ -MRCP_PLUGIN_VERSION_DECLARE - -/** Declare this macro to use log routine of the server, plugin is loaded from */ -MRCP_PLUGIN_LOGGER_IMPLEMENT - -/** Create demo synthesizer engine */ -MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool) -{ - /* create demo engine */ - demo_synth_engine_t *demo_engine = apr_palloc(pool,sizeof(demo_synth_engine_t)); - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - /* create task/thread to run demo engine in the context of this task */ - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(demo_synth_msg_t),pool); - demo_engine->task = apt_consumer_task_create(demo_engine,msg_pool,pool); - if(!demo_engine->task) { - return NULL; - } - task = apt_consumer_task_base_get(demo_engine->task); - apt_task_name_set(task,SYNTH_ENGINE_TASK_NAME); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = demo_synth_msg_process; - } - - /* create engine base */ - return mrcp_engine_create( - MRCP_SYNTHESIZER_RESOURCE, /* MRCP resource identifier */ - demo_engine, /* object to associate */ - &engine_vtable, /* virtual methods table of engine */ - pool); /* pool to allocate memory from */ -} - -/** Destroy synthesizer engine */ -static apt_bool_t demo_synth_engine_destroy(mrcp_engine_t *engine) -{ - demo_synth_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_destroy(task); - demo_engine->task = NULL; - } - return TRUE; -} - -/** Open synthesizer engine */ -static apt_bool_t demo_synth_engine_open(mrcp_engine_t *engine) -{ - demo_synth_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_start(task); - } - return mrcp_engine_open_respond(engine,TRUE); -} - -/** Close synthesizer engine */ -static apt_bool_t demo_synth_engine_close(mrcp_engine_t *engine) -{ - demo_synth_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_terminate(task,TRUE); - } - return mrcp_engine_close_respond(engine); -} - -/** Create demo synthesizer channel derived from engine channel base */ -static mrcp_engine_channel_t* demo_synth_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities; - mpf_termination_t *termination; - - /* create demo synth channel */ - demo_synth_channel_t *synth_channel = apr_palloc(pool,sizeof(demo_synth_channel_t)); - synth_channel->demo_engine = engine->obj; - synth_channel->speak_request = NULL; - synth_channel->stop_response = NULL; - synth_channel->time_to_complete = 0; - synth_channel->paused = FALSE; - synth_channel->audio_file = NULL; - - capabilities = mpf_source_stream_capabilities_create(pool); - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "LPCM"); - - /* create media termination */ - termination = mrcp_engine_audio_termination_create( - synth_channel, /* object to associate */ - &audio_stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - /* create engine channel base */ - synth_channel->channel = mrcp_engine_channel_create( - engine, /* engine */ - &channel_vtable, /* virtual methods table of engine channel */ - synth_channel, /* object to associate */ - termination, /* associated media termination */ - pool); /* pool to allocate memory from */ - - return synth_channel->channel; -} - -/** Destroy engine channel */ -static apt_bool_t demo_synth_channel_destroy(mrcp_engine_channel_t *channel) -{ - /* nothing to destroy */ - return TRUE; -} - -/** Open engine channel (asynchronous response MUST be sent)*/ -static apt_bool_t demo_synth_channel_open(mrcp_engine_channel_t *channel) -{ - return demo_synth_msg_signal(DEMO_SYNTH_MSG_OPEN_CHANNEL,channel,NULL); -} - -/** Close engine channel (asynchronous response MUST be sent)*/ -static apt_bool_t demo_synth_channel_close(mrcp_engine_channel_t *channel) -{ - return demo_synth_msg_signal(DEMO_SYNTH_MSG_CLOSE_CHANNEL,channel,NULL); -} - -/** Process MRCP channel request (asynchronous response MUST be sent)*/ -static apt_bool_t demo_synth_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - return demo_synth_msg_signal(DEMO_SYNTH_MSG_REQUEST_PROCESS,channel,request); -} - -/** Process SPEAK request */ -static apt_bool_t demo_synth_channel_speak(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - char *file_path = NULL; - demo_synth_channel_t *synth_channel = channel->method_obj; - const mpf_codec_descriptor_t *descriptor = mrcp_engine_source_stream_codec_get(channel); - - if(!descriptor) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Codec Descriptor "APT_SIDRES_FMT, MRCP_MESSAGE_SIDRES(request)); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - return FALSE; - } - - synth_channel->time_to_complete = 0; - if(channel->engine) { - char *file_name = apr_psprintf(channel->pool,"demo-%dkHz.pcm",descriptor->sampling_rate/1000); - file_path = apt_datadir_filepath_get(channel->engine->dir_layout,file_name,channel->pool); - } - if(file_path) { - synth_channel->audio_file = fopen(file_path,"rb"); - if(synth_channel->audio_file) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set [%s] as Speech Source "APT_SIDRES_FMT, - file_path, - MRCP_MESSAGE_SIDRES(request)); - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"No Speech Source [%s] Found "APT_SIDRES_FMT, - file_path, - MRCP_MESSAGE_SIDRES(request)); - /* calculate estimated time to complete */ - if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_LENGTH) == TRUE) { - mrcp_generic_header_t *generic_header = mrcp_generic_header_get(request); - if(generic_header) { - synth_channel->time_to_complete = generic_header->content_length * 10; /* 10 msec per character */ - } - } - } - } - - response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - /* send asynchronous response */ - mrcp_engine_channel_message_send(channel,response); - synth_channel->speak_request = request; - return TRUE; -} - -/** Process STOP request */ -static apt_bool_t demo_synth_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - demo_synth_channel_t *synth_channel = channel->method_obj; - /* store the request, make sure there is no more activity and only then send the response */ - synth_channel->stop_response = response; - return TRUE; -} - -/** Process PAUSE request */ -static apt_bool_t demo_synth_channel_pause(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - demo_synth_channel_t *synth_channel = channel->method_obj; - synth_channel->paused = TRUE; - /* send asynchronous response */ - mrcp_engine_channel_message_send(channel,response); - return TRUE; -} - -/** Process RESUME request */ -static apt_bool_t demo_synth_channel_resume(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - demo_synth_channel_t *synth_channel = channel->method_obj; - synth_channel->paused = FALSE; - /* send asynchronous response */ - mrcp_engine_channel_message_send(channel,response); - return TRUE; -} - -/** Process SET-PARAMS request */ -static apt_bool_t demo_synth_channel_set_params(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - mrcp_synth_header_t *req_synth_header; - /* get synthesizer header */ - req_synth_header = mrcp_resource_header_get(request); - if(req_synth_header) { - /* check voice age header */ - if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice Age [%"APR_SIZE_T_FMT"]", - req_synth_header->voice_param.age); - } - /* check voice name header */ - if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_NAME) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice Name [%s]", - req_synth_header->voice_param.name.buf); - } - } - - /* send asynchronous response */ - mrcp_engine_channel_message_send(channel,response); - return TRUE; -} - -/** Process GET-PARAMS request */ -static apt_bool_t demo_synth_channel_get_params(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - mrcp_synth_header_t *req_synth_header; - /* get synthesizer header */ - req_synth_header = mrcp_resource_header_get(request); - if(req_synth_header) { - mrcp_synth_header_t *res_synth_header = mrcp_resource_header_prepare(response); - /* check voice age header */ - if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) { - res_synth_header->voice_param.age = 25; - mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_AGE); - } - /* check voice name header */ - if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_NAME) == TRUE) { - apt_string_set(&res_synth_header->voice_param.name,"David"); - mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_NAME); - } - } - - /* send asynchronous response */ - mrcp_engine_channel_message_send(channel,response); - return TRUE; -} - -/** Dispatch MRCP request */ -static apt_bool_t demo_synth_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - apt_bool_t processed = FALSE; - mrcp_message_t *response = mrcp_response_create(request,request->pool); - switch(request->start_line.method_id) { - case SYNTHESIZER_SET_PARAMS: - processed = demo_synth_channel_set_params(channel,request,response); - break; - case SYNTHESIZER_GET_PARAMS: - processed = demo_synth_channel_get_params(channel,request,response); - break; - case SYNTHESIZER_SPEAK: - processed = demo_synth_channel_speak(channel,request,response); - break; - case SYNTHESIZER_STOP: - processed = demo_synth_channel_stop(channel,request,response); - break; - case SYNTHESIZER_PAUSE: - processed = demo_synth_channel_pause(channel,request,response); - break; - case SYNTHESIZER_RESUME: - processed = demo_synth_channel_resume(channel,request,response); - break; - case SYNTHESIZER_BARGE_IN_OCCURRED: - processed = demo_synth_channel_stop(channel,request,response); - break; - case SYNTHESIZER_CONTROL: - break; - case SYNTHESIZER_DEFINE_LEXICON: - break; - default: - break; - } - if(processed == FALSE) { - /* send asynchronous response for not handled request */ - mrcp_engine_channel_message_send(channel,response); - } - return TRUE; -} - -/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */ -static apt_bool_t demo_synth_stream_destroy(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform any action before open */ -static apt_bool_t demo_synth_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform any action after close */ -static apt_bool_t demo_synth_stream_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to read/get new frame */ -static apt_bool_t demo_synth_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - demo_synth_channel_t *synth_channel = stream->obj; - /* check if STOP was requested */ - if(synth_channel->stop_response) { - /* send asynchronous response to STOP request */ - mrcp_engine_channel_message_send(synth_channel->channel,synth_channel->stop_response); - synth_channel->stop_response = NULL; - synth_channel->speak_request = NULL; - synth_channel->paused = FALSE; - if(synth_channel->audio_file) { - fclose(synth_channel->audio_file); - synth_channel->audio_file = NULL; - } - return TRUE; - } - - /* check if there is active SPEAK request and it isn't in paused state */ - if(synth_channel->speak_request && synth_channel->paused == FALSE) { - /* normal processing */ - apt_bool_t completed = FALSE; - if(synth_channel->audio_file) { - /* read speech from file */ - apr_size_t size = frame->codec_frame.size; - if(fread(frame->codec_frame.buffer,1,size,synth_channel->audio_file) == size) { - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - } - else { - completed = TRUE; - } - } - else { - /* fill with silence in case no file available */ - if(synth_channel->time_to_complete >= CODEC_FRAME_TIME_BASE) { - memset(frame->codec_frame.buffer,0,frame->codec_frame.size); - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - synth_channel->time_to_complete -= CODEC_FRAME_TIME_BASE; - } - else { - completed = TRUE; - } - } - - if(completed) { - /* raise SPEAK-COMPLETE event */ - mrcp_message_t *message = mrcp_event_create( - synth_channel->speak_request, - SYNTHESIZER_SPEAK_COMPLETE, - synth_channel->speak_request->pool); - if(message) { - /* get/allocate synthesizer header */ - mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(message); - if(synth_header) { - /* set completion cause */ - synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL; - mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_COMPLETION_CAUSE); - } - /* set request state */ - message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - - synth_channel->speak_request = NULL; - if(synth_channel->audio_file) { - fclose(synth_channel->audio_file); - synth_channel->audio_file = NULL; - } - /* send asynch event */ - mrcp_engine_channel_message_send(synth_channel->channel,message); - } - } - } - return TRUE; -} - -static apt_bool_t demo_synth_msg_signal(demo_synth_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - apt_bool_t status = FALSE; - demo_synth_channel_t *demo_channel = channel->method_obj; - demo_synth_engine_t *demo_engine = demo_channel->demo_engine; - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_msg_t *msg = apt_task_msg_get(task); - if(msg) { - demo_synth_msg_t *demo_msg; - msg->type = TASK_MSG_USER; - demo_msg = (demo_synth_msg_t*) msg->data; - - demo_msg->type = type; - demo_msg->channel = channel; - demo_msg->request = request; - status = apt_task_msg_signal(task,msg); - } - return status; -} - -static apt_bool_t demo_synth_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - demo_synth_msg_t *demo_msg = (demo_synth_msg_t*)msg->data; - switch(demo_msg->type) { - case DEMO_SYNTH_MSG_OPEN_CHANNEL: - /* open channel and send asynch response */ - mrcp_engine_channel_open_respond(demo_msg->channel,TRUE); - break; - case DEMO_SYNTH_MSG_CLOSE_CHANNEL: - /* close channel, make sure there is no activity and send asynch response */ - mrcp_engine_channel_close_respond(demo_msg->channel); - break; - case DEMO_SYNTH_MSG_REQUEST_PROCESS: - demo_synth_channel_request_dispatch(demo_msg->channel,demo_msg->request); - break; - default: - break; - } - return TRUE; -} diff --git a/libs/unimrcp/plugins/demo-verifier/Makefile.am b/libs/unimrcp/plugins/demo-verifier/Makefile.am deleted file mode 100644 index 9da71c1024..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -AM_CPPFLAGS = $(UNIMRCP_PLUGIN_INCLUDES) - -plugin_LTLIBRARIES = demoverifier.la - -demoverifier_la_SOURCES = src/demo_verifier_engine.c -demoverifier_la_LDFLAGS = $(UNIMRCP_PLUGIN_OPTS) - -include $(top_srcdir)/build/rules/uniplugin.am diff --git a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcproj b/libs/unimrcp/plugins/demo-verifier/demoverifier.vcproj deleted file mode 100644 index efe5f79423..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj b/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj deleted file mode 100644 index 6dfd17cd6b..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {F7563CAD-5C95-46E5-89B7-0953C6C6E746} - demoverifier - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj.filters b/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj.filters deleted file mode 100644 index afd5da4d9f..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/demoverifier.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {42255732-d637-4aef-ab75-104eb723ff72} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/demo-verifier/src/demo_verifier_engine.c b/libs/unimrcp/plugins/demo-verifier/src/demo_verifier_engine.c deleted file mode 100644 index 6e3d290d36..0000000000 --- a/libs/unimrcp/plugins/demo-verifier/src/demo_verifier_engine.c +++ /dev/null @@ -1,589 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: demo_verifier_engine.c 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $ - */ - -/* - * Mandatory rules concerning plugin implementation. - * 1. Each plugin MUST implement a plugin/engine creator function - * with the exact signature and name (the main entry point) - * MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool) - * 2. Each plugin MUST declare its version number - * MRCP_PLUGIN_VERSION_DECLARE - * 3. One and only one response MUST be sent back to the received request. - * 4. Methods (callbacks) of the MRCP engine channel MUST not block. - * (asynchronous response can be sent from the context of other thread) - * 5. Methods (callbacks) of the MPF engine stream MUST not block. - */ - -#include "mrcp_verifier_engine.h" -#include "mpf_activity_detector.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - -#define VERIFIER_ENGINE_TASK_NAME "Demo Verifier Engine" - -typedef struct demo_verifier_engine_t demo_verifier_engine_t; -typedef struct demo_verifier_channel_t demo_verifier_channel_t; -typedef struct demo_verifier_msg_t demo_verifier_msg_t; - -/** Declaration of verification engine methods */ -static apt_bool_t demo_verifier_engine_destroy(mrcp_engine_t *engine); -static apt_bool_t demo_verifier_engine_open(mrcp_engine_t *engine); -static apt_bool_t demo_verifier_engine_close(mrcp_engine_t *engine); -static mrcp_engine_channel_t* demo_verifier_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool); - -static const struct mrcp_engine_method_vtable_t engine_vtable = { - demo_verifier_engine_destroy, - demo_verifier_engine_open, - demo_verifier_engine_close, - demo_verifier_engine_channel_create -}; - - -/** Declaration of verification channel methods */ -static apt_bool_t demo_verifier_channel_destroy(mrcp_engine_channel_t *channel); -static apt_bool_t demo_verifier_channel_open(mrcp_engine_channel_t *channel); -static apt_bool_t demo_verifier_channel_close(mrcp_engine_channel_t *channel); -static apt_bool_t demo_verifier_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request); - -static const struct mrcp_engine_channel_method_vtable_t channel_vtable = { - demo_verifier_channel_destroy, - demo_verifier_channel_open, - demo_verifier_channel_close, - demo_verifier_channel_request_process -}; - -/** Declaration of verification audio stream methods */ -static apt_bool_t demo_verifier_stream_destroy(mpf_audio_stream_t *stream); -static apt_bool_t demo_verifier_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t demo_verifier_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t demo_verifier_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t audio_stream_vtable = { - demo_verifier_stream_destroy, - NULL, - NULL, - NULL, - demo_verifier_stream_open, - demo_verifier_stream_close, - demo_verifier_stream_write, - NULL -}; - -/** Declaration of demo verification engine */ -struct demo_verifier_engine_t { - apt_consumer_task_t *task; -}; - -/** Declaration of demo verification channel */ -struct demo_verifier_channel_t { - /** Back pointer to engine */ - demo_verifier_engine_t *demo_engine; - /** Engine channel base */ - mrcp_engine_channel_t *channel; - - /** Active (in-progress) verification request */ - mrcp_message_t *verifier_request; - /** Pending stop response */ - mrcp_message_t *stop_response; - /** Indicates whether input timers are started */ - apt_bool_t timers_started; - /** Voice activity detector */ - mpf_activity_detector_t *detector; - /** File to write voiceprint to */ - FILE *audio_out; -}; - -typedef enum { - DEMO_VERIF_MSG_OPEN_CHANNEL, - DEMO_VERIF_MSG_CLOSE_CHANNEL, - DEMO_VERIF_MSG_REQUEST_PROCESS -} demo_verifier_msg_type_e; - -/** Declaration of demo verification task message */ -struct demo_verifier_msg_t { - demo_verifier_msg_type_e type; - mrcp_engine_channel_t *channel; - mrcp_message_t *request; -}; - -static apt_bool_t demo_verifier_msg_signal(demo_verifier_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request); -static apt_bool_t demo_verifier_msg_process(apt_task_t *task, apt_task_msg_t *msg); - -static apt_bool_t demo_verifier_result_load(demo_verifier_channel_t *verifier_channel, mrcp_message_t *message); - -/** Declare this macro to set plugin version */ -MRCP_PLUGIN_VERSION_DECLARE - -/** Declare this macro to use log routine of the server, plugin is loaded from */ -MRCP_PLUGIN_LOGGER_IMPLEMENT - -/** Create demo verification engine */ -MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool) -{ - demo_verifier_engine_t *demo_engine = apr_palloc(pool,sizeof(demo_verifier_engine_t)); - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(demo_verifier_msg_t),pool); - demo_engine->task = apt_consumer_task_create(demo_engine,msg_pool,pool); - if(!demo_engine->task) { - return NULL; - } - task = apt_consumer_task_base_get(demo_engine->task); - apt_task_name_set(task,VERIFIER_ENGINE_TASK_NAME); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = demo_verifier_msg_process; - } - - /* create engine base */ - return mrcp_engine_create( - MRCP_VERIFIER_RESOURCE, /* MRCP resource identifier */ - demo_engine, /* object to associate */ - &engine_vtable, /* virtual methods table of engine */ - pool); /* pool to allocate memory from */ -} - -/** Destroy verification engine */ -static apt_bool_t demo_verifier_engine_destroy(mrcp_engine_t *engine) -{ - demo_verifier_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_destroy(task); - demo_engine->task = NULL; - } - return TRUE; -} - -/** Open verification engine */ -static apt_bool_t demo_verifier_engine_open(mrcp_engine_t *engine) -{ - demo_verifier_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_start(task); - } - return mrcp_engine_open_respond(engine,TRUE); -} - -/** Close verification engine */ -static apt_bool_t demo_verifier_engine_close(mrcp_engine_t *engine) -{ - demo_verifier_engine_t *demo_engine = engine->obj; - if(demo_engine->task) { - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_terminate(task,TRUE); - } - return mrcp_engine_close_respond(engine); -} - -static mrcp_engine_channel_t* demo_verifier_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities; - mpf_termination_t *termination; - - /* create demo verification channel */ - demo_verifier_channel_t *verifier_channel = apr_palloc(pool,sizeof(demo_verifier_channel_t)); - verifier_channel->demo_engine = engine->obj; - verifier_channel->verifier_request = NULL; - verifier_channel->stop_response = NULL; - verifier_channel->detector = mpf_activity_detector_create(pool); - verifier_channel->audio_out = NULL; - - capabilities = mpf_sink_stream_capabilities_create(pool); - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "LPCM"); - - /* create media termination */ - termination = mrcp_engine_audio_termination_create( - verifier_channel, /* object to associate */ - &audio_stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - /* create engine channel base */ - verifier_channel->channel = mrcp_engine_channel_create( - engine, /* engine */ - &channel_vtable, /* virtual methods table of engine channel */ - verifier_channel, /* object to associate */ - termination, /* associated media termination */ - pool); /* pool to allocate memory from */ - - return verifier_channel->channel; -} - -/** Destroy engine channel */ -static apt_bool_t demo_verifier_channel_destroy(mrcp_engine_channel_t *channel) -{ - /* nothing to destrtoy */ - return TRUE; -} - -/** Open engine channel (asynchronous response MUST be sent)*/ -static apt_bool_t demo_verifier_channel_open(mrcp_engine_channel_t *channel) -{ - return demo_verifier_msg_signal(DEMO_VERIF_MSG_OPEN_CHANNEL,channel,NULL); -} - -/** Close engine channel (asynchronous response MUST be sent)*/ -static apt_bool_t demo_verifier_channel_close(mrcp_engine_channel_t *channel) -{ - return demo_verifier_msg_signal(DEMO_VERIF_MSG_CLOSE_CHANNEL,channel,NULL); -} - -/** Process MRCP channel request (asynchronous response MUST be sent)*/ -static apt_bool_t demo_verifier_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - return demo_verifier_msg_signal(DEMO_VERIF_MSG_REQUEST_PROCESS,channel,request); -} - -/** Process VERIFY request */ -static apt_bool_t demo_verifier_channel_verify(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - /* process verify request */ - mrcp_verifier_header_t *verifier_header; - demo_verifier_channel_t *verifier_channel = channel->method_obj; - const mpf_codec_descriptor_t *descriptor = mrcp_engine_sink_stream_codec_get(channel); - - if(!descriptor) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Codec Descriptor "APT_SIDRES_FMT, MRCP_MESSAGE_SIDRES(request)); - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - return FALSE; - } - - verifier_channel->timers_started = TRUE; - - /* get verifier header */ - verifier_header = mrcp_resource_header_get(request); - if(verifier_header) { - if(mrcp_resource_header_property_check(request,VERIFIER_HEADER_START_INPUT_TIMERS) == TRUE) { - verifier_channel->timers_started = verifier_header->start_input_timers; - } - if(mrcp_resource_header_property_check(request,VERIFIER_HEADER_NO_INPUT_TIMEOUT) == TRUE) { - mpf_activity_detector_noinput_timeout_set(verifier_channel->detector,verifier_header->no_input_timeout); - } - if(mrcp_resource_header_property_check(request,VERIFIER_HEADER_SPEECH_COMPLETE_TIMEOUT) == TRUE) { - mpf_activity_detector_silence_timeout_set(verifier_channel->detector,verifier_header->speech_complete_timeout); - } - } - - if(!verifier_channel->audio_out) { - const apt_dir_layout_t *dir_layout = channel->engine->dir_layout; - char *file_name = apr_psprintf(channel->pool,"voiceprint-%dkHz-%s.pcm", - descriptor->sampling_rate/1000, - request->channel_id.session_id.buf); - char *file_path = apt_vardir_filepath_get(dir_layout,file_name,channel->pool); - if(file_path) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Utterance Output File [%s] for Writing",file_path); - verifier_channel->audio_out = fopen(file_path,"wb"); - if(!verifier_channel->audio_out) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Utterance Output File [%s] for Writing",file_path); - } - } - } - - response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - /* send asynchronous response */ - mrcp_engine_channel_message_send(channel,response); - verifier_channel->verifier_request = request; - return TRUE; -} - -/** Process STOP request */ -static apt_bool_t demo_verifier_channel_stop(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - /* process STOP request */ - demo_verifier_channel_t *verifier_channel = channel->method_obj; - /* store STOP request, make sure there is no more activity and only then send the response */ - verifier_channel->stop_response = response; - return TRUE; -} - -/** Process START-INPUT-TIMERS request */ -static apt_bool_t demo_verifier_channel_timers_start(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - demo_verifier_channel_t *verifier_channel = channel->method_obj; - verifier_channel->timers_started = TRUE; - return mrcp_engine_channel_message_send(channel,response); -} - -/** Process GET-INTERMEDIATE-RESULT request */ -static apt_bool_t demo_verifier_channel_get_result(mrcp_engine_channel_t *channel, mrcp_message_t *request, mrcp_message_t *response) -{ - demo_verifier_channel_t *verifier_channel = channel->method_obj; - demo_verifier_result_load(verifier_channel,response); - return mrcp_engine_channel_message_send(channel,response); -} - - -/** Dispatch MRCP request */ -static apt_bool_t demo_verifier_channel_request_dispatch(mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - apt_bool_t processed = FALSE; - mrcp_message_t *response = mrcp_response_create(request,request->pool); - switch(request->start_line.method_id) { - case VERIFIER_SET_PARAMS: - break; - case VERIFIER_GET_PARAMS: - break; - case VERIFIER_START_SESSION: - break; - case VERIFIER_END_SESSION: - break; - case VERIFIER_QUERY_VOICEPRINT: - break; - case VERIFIER_DELETE_VOICEPRINT: - break; - case VERIFIER_VERIFY: - processed = demo_verifier_channel_verify(channel,request,response); - break; - case VERIFIER_VERIFY_FROM_BUFFER: - break; - case VERIFIER_VERIFY_ROLLBACK: - break; - case VERIFIER_STOP: - processed = demo_verifier_channel_stop(channel,request,response); - break; - case VERIFIER_CLEAR_BUFFER: - break; - case VERIFIER_START_INPUT_TIMERS: - processed = demo_verifier_channel_timers_start(channel,request,response); - break; - case VERIFIER_GET_INTERMIDIATE_RESULT: - processed = demo_verifier_channel_get_result(channel,request,response); - break; - - default: - break; - } - if(processed == FALSE) { - /* send asynchronous response for not handled request */ - mrcp_engine_channel_message_send(channel,response); - } - return TRUE; -} - -/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */ -static apt_bool_t demo_verifier_stream_destroy(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform any action before open */ -static apt_bool_t demo_verifier_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform any action after close */ -static apt_bool_t demo_verifier_stream_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/* Raise demo START-OF-INPUT event */ -static apt_bool_t demo_verifier_start_of_input(demo_verifier_channel_t *verifier_channel) -{ - /* create START-OF-INPUT event */ - mrcp_message_t *message = mrcp_event_create( - verifier_channel->verifier_request, - VERIFIER_START_OF_INPUT, - verifier_channel->verifier_request->pool); - if(!message) { - return FALSE; - } - - /* set request state */ - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - /* send asynch event */ - return mrcp_engine_channel_message_send(verifier_channel->channel,message); -} - -/* Load demo verification result */ -static apt_bool_t demo_verifier_result_load(demo_verifier_channel_t *verifier_channel, mrcp_message_t *message) -{ - FILE *file; - mrcp_engine_channel_t *channel = verifier_channel->channel; - const apt_dir_layout_t *dir_layout = channel->engine->dir_layout; - char *file_path = apt_datadir_filepath_get(dir_layout,"result-verification.xml",message->pool); - if(!file_path) { - return FALSE; - } - - /* read the demo result from file */ - file = fopen(file_path,"r"); - if(file) { - mrcp_generic_header_t *generic_header; - char text[1024]; - apr_size_t size; - size = fread(text,1,sizeof(text),file); - apt_string_assign_n(&message->body,text,size,message->pool); - fclose(file); - - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(message); - if(generic_header) { - /* set content types */ - apt_string_assign(&generic_header->content_type,"application/nlsml+xml",message->pool); - mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE); - } - } - return TRUE; -} - -/* Raise demo VERIFICATION-COMPLETE event */ -static apt_bool_t demo_verifier_verification_complete(demo_verifier_channel_t *verifier_channel, mrcp_verifier_completion_cause_e cause) -{ - mrcp_verifier_header_t *verifier_header; - /* create VERIFICATION-COMPLETE event */ - mrcp_message_t *message = mrcp_event_create( - verifier_channel->verifier_request, - VERIFIER_VERIFICATION_COMPLETE, - verifier_channel->verifier_request->pool); - if(!message) { - return FALSE; - } - - /* get/allocate verifier header */ - verifier_header = mrcp_resource_header_prepare(message); - if(verifier_header) { - /* set completion cause */ - verifier_header->completion_cause = cause; - mrcp_resource_header_property_add(message,VERIFIER_HEADER_COMPLETION_CAUSE); - } - /* set request state */ - message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - - if(cause == VERIFIER_COMPLETION_CAUSE_SUCCESS) { - demo_verifier_result_load(verifier_channel,message); - } - - verifier_channel->verifier_request = NULL; - /* send asynch event */ - return mrcp_engine_channel_message_send(verifier_channel->channel,message); -} - -/** Callback is called from MPF engine context to write/send new frame */ -static apt_bool_t demo_verifier_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - demo_verifier_channel_t *verifier_channel = stream->obj; - if(verifier_channel->stop_response) { - /* send asynchronous response to STOP request */ - mrcp_engine_channel_message_send(verifier_channel->channel,verifier_channel->stop_response); - verifier_channel->stop_response = NULL; - verifier_channel->verifier_request = NULL; - return TRUE; - } - - if(verifier_channel->verifier_request) { - mpf_detector_event_e det_event = mpf_activity_detector_process(verifier_channel->detector,frame); - switch(det_event) { - case MPF_DETECTOR_EVENT_ACTIVITY: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request)); - demo_verifier_start_of_input(verifier_channel); - break; - case MPF_DETECTOR_EVENT_INACTIVITY: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request)); - demo_verifier_verification_complete(verifier_channel,VERIFIER_COMPLETION_CAUSE_SUCCESS); - break; - case MPF_DETECTOR_EVENT_NOINPUT: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Noinput "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request)); - if(verifier_channel->timers_started == TRUE) { - demo_verifier_verification_complete(verifier_channel,VERIFIER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT); - } - break; - default: - break; - } - - if((frame->type & MEDIA_FRAME_TYPE_EVENT) == MEDIA_FRAME_TYPE_EVENT) { - if(frame->marker == MPF_MARKER_START_OF_EVENT) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Start of Event "APT_SIDRES_FMT" id:%d", - MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request), - frame->event_frame.event_id); - } - else if(frame->marker == MPF_MARKER_END_OF_EVENT) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected End of Event "APT_SIDRES_FMT" id:%d duration:%d ts", - MRCP_MESSAGE_SIDRES(verifier_channel->verifier_request), - frame->event_frame.event_id, - frame->event_frame.duration); - } - } - - if(verifier_channel->audio_out) { - fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,verifier_channel->audio_out); - } - } - return TRUE; -} - -static apt_bool_t demo_verifier_msg_signal(demo_verifier_msg_type_e type, mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - apt_bool_t status = FALSE; - demo_verifier_channel_t *demo_channel = channel->method_obj; - demo_verifier_engine_t *demo_engine = demo_channel->demo_engine; - apt_task_t *task = apt_consumer_task_base_get(demo_engine->task); - apt_task_msg_t *msg = apt_task_msg_get(task); - if(msg) { - demo_verifier_msg_t *demo_msg; - msg->type = TASK_MSG_USER; - demo_msg = (demo_verifier_msg_t*) msg->data; - - demo_msg->type = type; - demo_msg->channel = channel; - demo_msg->request = request; - status = apt_task_msg_signal(task,msg); - } - return status; -} - -static apt_bool_t demo_verifier_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - demo_verifier_msg_t *demo_msg = (demo_verifier_msg_t*)msg->data; - switch(demo_msg->type) { - case DEMO_VERIF_MSG_OPEN_CHANNEL: - /* open channel and send asynch response */ - mrcp_engine_channel_open_respond(demo_msg->channel,TRUE); - break; - case DEMO_VERIF_MSG_CLOSE_CHANNEL: - { - /* close channel, make sure there is no activity and send asynch response */ - demo_verifier_channel_t *verifier_channel = demo_msg->channel->method_obj; - if(verifier_channel->audio_out) { - fclose(verifier_channel->audio_out); - verifier_channel->audio_out = NULL; - } - - mrcp_engine_channel_close_respond(demo_msg->channel); - break; - } - case DEMO_VERIF_MSG_REQUEST_PROCESS: - demo_verifier_channel_request_dispatch(demo_msg->channel,demo_msg->request); - break; - default: - break; - } - return TRUE; -} diff --git a/libs/unimrcp/plugins/mrcp-recorder/Makefile.am b/libs/unimrcp/plugins/mrcp-recorder/Makefile.am deleted file mode 100644 index fe49710588..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -AM_CPPFLAGS = $(UNIMRCP_PLUGIN_INCLUDES) - -plugin_LTLIBRARIES = mrcprecorder.la - -mrcprecorder_la_SOURCES = src/mrcp_recorder_engine.c -mrcprecorder_la_LDFLAGS = $(UNIMRCP_PLUGIN_OPTS) - -include $(top_srcdir)/build/rules/uniplugin.am diff --git a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcproj b/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcproj deleted file mode 100644 index 71194f7b10..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj b/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj deleted file mode 100644 index 9a3a6a5aa6..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj +++ /dev/null @@ -1,123 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2} - mrcprecorder - Win32Proj - - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - DynamicLibrary - Unicode - true - - - DynamicLibrary - Unicode - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - include;%(AdditionalIncludeDirectories) - - - - - include;%(AdditionalIncludeDirectories) - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - ProgramDatabase - - - - - X64 - - - include;%(AdditionalIncludeDirectories) - - - - - - - - {843425be-9a9a-44f4-a4e3-4b57d6abd53c} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj.filters b/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj.filters deleted file mode 100644 index 6fe96d5625..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/mrcprecorder.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hpp;hxx;hm;inl;inc;xsd - - - {b1d2c804-b3bb-4413-8d11-7ff67d4e874c} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/plugins/mrcp-recorder/src/mrcp_recorder_engine.c b/libs/unimrcp/plugins/mrcp-recorder/src/mrcp_recorder_engine.c deleted file mode 100644 index 785be23efb..0000000000 --- a/libs/unimrcp/plugins/mrcp-recorder/src/mrcp_recorder_engine.c +++ /dev/null @@ -1,481 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mrcp_recorder_engine.c 2193 2014-10-08 03:44:33Z achaloyan@gmail.com $ - */ - -/* - * Mandatory rules concerning plugin implementation. - * 1. Each plugin MUST implement a plugin/engine creator function - * with the exact signature and name (the main entry point) - * MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool) - * 2. Each plugin MUST declare its version number - * MRCP_PLUGIN_VERSION_DECLARE - * 3. One and only one response MUST be sent back to the received request. - * 4. Methods (callbacks) of the MRCP engine channel MUST not block. - * (asynchronous response can be sent from the context of other thread) - * 5. Methods (callbacks) of the MPF engine stream MUST not block. - */ - -#include "mrcp_recorder_engine.h" -#include "mpf_activity_detector.h" -#include "apt_log.h" - -#define RECORDER_ENGINE_TASK_NAME "Recorder Engine" - -typedef struct recorder_channel_t recorder_channel_t; - -/** Declaration of recorder engine methods */ -static apt_bool_t recorder_engine_destroy(mrcp_engine_t *engine); -static apt_bool_t recorder_engine_open(mrcp_engine_t *engine); -static apt_bool_t recorder_engine_close(mrcp_engine_t *engine); -static mrcp_engine_channel_t* recorder_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool); - -static const struct mrcp_engine_method_vtable_t engine_vtable = { - recorder_engine_destroy, - recorder_engine_open, - recorder_engine_close, - recorder_engine_channel_create -}; - - -/** Declaration of recorder channel methods */ -static apt_bool_t recorder_channel_destroy(mrcp_engine_channel_t *channel); -static apt_bool_t recorder_channel_open(mrcp_engine_channel_t *channel); -static apt_bool_t recorder_channel_close(mrcp_engine_channel_t *channel); -static apt_bool_t recorder_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request); - -static const struct mrcp_engine_channel_method_vtable_t channel_vtable = { - recorder_channel_destroy, - recorder_channel_open, - recorder_channel_close, - recorder_channel_request_process -}; - -/** Declaration of recorder audio stream methods */ -static apt_bool_t recorder_stream_destroy(mpf_audio_stream_t *stream); -static apt_bool_t recorder_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t recorder_stream_close(mpf_audio_stream_t *stream); -static apt_bool_t recorder_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - -static const mpf_audio_stream_vtable_t audio_stream_vtable = { - recorder_stream_destroy, - NULL, - NULL, - NULL, - recorder_stream_open, - recorder_stream_close, - recorder_stream_write, - NULL -}; - -/** Declaration of recorder channel */ -struct recorder_channel_t { - /** Engine channel base */ - mrcp_engine_channel_t *channel; - - /** Active (in-progress) record request */ - mrcp_message_t *record_request; - /** Pending stop response */ - mrcp_message_t *stop_response; - /** Indicates whether input timers are started */ - apt_bool_t timers_started; - /** Voice activity detector */ - mpf_activity_detector_t *detector; - /** Max length of the recording in msec */ - apr_size_t max_time; - /** Elapsed time of the recording in msec */ - apr_size_t cur_time; - /** Written size of the recording in bytes */ - apr_size_t cur_size; - /** File name of the recording */ - const char *file_name; - /** File to write to */ - FILE *audio_out; -}; - - -/** Declare this macro to set plugin version */ -MRCP_PLUGIN_VERSION_DECLARE - -/** Declare this macro to use log routine of the server, plugin is loaded from */ -MRCP_PLUGIN_LOGGER_IMPLEMENT - -/** Create recorder engine */ -MRCP_PLUGIN_DECLARE(mrcp_engine_t*) mrcp_plugin_create(apr_pool_t *pool) -{ - /* create engine base */ - return mrcp_engine_create( - MRCP_RECORDER_RESOURCE, /* MRCP resource identifier */ - NULL, /* object to associate */ - &engine_vtable, /* virtual methods table of engine */ - pool); /* pool to allocate memory from */ -} - -/** Destroy recorder engine */ -static apt_bool_t recorder_engine_destroy(mrcp_engine_t *engine) -{ - return TRUE; -} - -/** Open recorder engine */ -static apt_bool_t recorder_engine_open(mrcp_engine_t *engine) -{ - return mrcp_engine_open_respond(engine,TRUE); -} - -/** Close recorder engine */ -static apt_bool_t recorder_engine_close(mrcp_engine_t *engine) -{ - return mrcp_engine_close_respond(engine); -} - -static mrcp_engine_channel_t* recorder_engine_channel_create(mrcp_engine_t *engine, apr_pool_t *pool) -{ - mpf_stream_capabilities_t *capabilities; - mpf_termination_t *termination; - - /* create recorder channel */ - recorder_channel_t *recorder_channel = apr_palloc(pool,sizeof(recorder_channel_t)); - recorder_channel->record_request = NULL; - recorder_channel->stop_response = NULL; - recorder_channel->detector = mpf_activity_detector_create(pool); - recorder_channel->max_time = 0; - recorder_channel->cur_time = 0; - recorder_channel->cur_size = 0; - recorder_channel->file_name = NULL; - recorder_channel->audio_out = NULL; - - capabilities = mpf_sink_stream_capabilities_create(pool); - mpf_codec_capabilities_add( - &capabilities->codecs, - MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000, - "LPCM"); - - /* create media termination */ - termination = mrcp_engine_audio_termination_create( - recorder_channel, /* object to associate */ - &audio_stream_vtable, /* virtual methods table of audio stream */ - capabilities, /* stream capabilities */ - pool); /* pool to allocate memory from */ - - /* create engine channel base */ - recorder_channel->channel = mrcp_engine_channel_create( - engine, /* engine */ - &channel_vtable, /* virtual methods table of engine channel */ - recorder_channel, /* object to associate */ - termination, /* associated media termination */ - pool); /* pool to allocate memory from */ - - return recorder_channel->channel; -} - -/** Destroy engine channel */ -static apt_bool_t recorder_channel_destroy(mrcp_engine_channel_t *channel) -{ - /* nothing to destrtoy */ - return TRUE; -} - -/** Open engine channel (asynchronous response MUST be sent)*/ -static apt_bool_t recorder_channel_open(mrcp_engine_channel_t *channel) -{ - /* open channel and send asynch response */ - return mrcp_engine_channel_open_respond(channel,TRUE); -} - -/** Close engine channel (asynchronous response MUST be sent)*/ -static apt_bool_t recorder_channel_close(mrcp_engine_channel_t *channel) -{ - /* close channel, make sure there is no activity and send asynch response */ - return mrcp_engine_channel_close_respond(channel); -} - -/** Open file to record */ -static apt_bool_t recorder_file_open(recorder_channel_t *recorder_channel, mrcp_message_t *request) -{ - char *file_path; - char *file_name; - mrcp_engine_channel_t *channel = recorder_channel->channel; - const apt_dir_layout_t *dir_layout = channel->engine->dir_layout; - const mpf_codec_descriptor_t *descriptor = mrcp_engine_sink_stream_codec_get(channel); - - if(!descriptor) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Get Codec Descriptor "APT_SIDRES_FMT, MRCP_MESSAGE_SIDRES(request)); - return FALSE; - } - - file_name = apr_psprintf(channel->pool,"rec-%dkHz-%s-%"MRCP_REQUEST_ID_FMT".pcm", - descriptor->sampling_rate/1000, - request->channel_id.session_id.buf, - request->start_line.request_id); - file_path = apt_vardir_filepath_get(dir_layout,file_name,channel->pool); - if(!file_path) { - return FALSE; - } - - if(recorder_channel->audio_out) { - fclose(recorder_channel->audio_out); - recorder_channel->audio_out = NULL; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Utterance Output File [%s] for Writing",file_path); - recorder_channel->audio_out = fopen(file_path,"wb"); - if(!recorder_channel->audio_out) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open Utterance Output File [%s] for Writing",file_path); - return FALSE; - } - - recorder_channel->file_name = file_name; - return TRUE; -} - -/** Set Record-URI header field */ -static apt_bool_t recorder_channel_uri_set(recorder_channel_t *recorder_channel, mrcp_message_t *message) -{ - char *record_uri; - /* get/allocate recorder header */ - mrcp_recorder_header_t *recorder_header = mrcp_resource_header_prepare(message); - if(!recorder_header) { - return FALSE; - } - - record_uri = apr_psprintf( - message->pool, - ";size=%"APR_SIZE_T_FMT";duration=%"APR_SIZE_T_FMT, - recorder_channel->file_name, - recorder_channel->cur_size, - recorder_channel->cur_time); - - apt_string_set(&recorder_header->record_uri,record_uri); - mrcp_resource_header_property_add(message,RECORDER_HEADER_RECORD_URI); - return TRUE; -} - -/** Process RECORD request */ -static apt_bool_t recorder_channel_record(recorder_channel_t *recorder_channel, mrcp_message_t *request, mrcp_message_t *response) -{ - /* process RECORD request */ - mrcp_recorder_header_t *recorder_header; - recorder_channel->timers_started = TRUE; - - /* get recorder header */ - recorder_header = mrcp_resource_header_get(request); - if(recorder_header) { - if(mrcp_resource_header_property_check(request,RECORDER_HEADER_START_INPUT_TIMERS) == TRUE) { - recorder_channel->timers_started = recorder_header->start_input_timers; - } - if(mrcp_resource_header_property_check(request,RECORDER_HEADER_NO_INPUT_TIMEOUT) == TRUE) { - mpf_activity_detector_noinput_timeout_set(recorder_channel->detector,recorder_header->no_input_timeout); - } - if(mrcp_resource_header_property_check(request,RECORDER_HEADER_FINAL_SILENCE) == TRUE) { - mpf_activity_detector_silence_timeout_set(recorder_channel->detector,recorder_header->final_silence); - } - if(mrcp_resource_header_property_check(request,RECORDER_HEADER_MAX_TIME) == TRUE) { - recorder_channel->max_time = recorder_header->max_time; - } - } - - /* open file to record */ - if(recorder_file_open(recorder_channel,request) == FALSE) { - response->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED; - /* send asynchronous response */ - mrcp_engine_channel_message_send(recorder_channel->channel,response); - return TRUE; - } - - recorder_channel->cur_time = 0; - recorder_channel->cur_size = 0; - response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - /* send asynchronous response */ - mrcp_engine_channel_message_send(recorder_channel->channel,response); - recorder_channel->record_request = request; - return TRUE; -} - -/** Process STOP request */ -static apt_bool_t recorder_channel_stop(recorder_channel_t *recorder_channel, mrcp_message_t *request, mrcp_message_t *response) -{ - /* store STOP request, make sure there is no more activity and only then send the response */ - recorder_channel->stop_response = response; - return TRUE; -} - -/** Process START-INPUT-TIMERS request */ -static apt_bool_t recorder_channel_timers_start(recorder_channel_t *recorder_channel, mrcp_message_t *request, mrcp_message_t *response) -{ - recorder_channel->timers_started = TRUE; - return mrcp_engine_channel_message_send(recorder_channel->channel,response); -} - -/** Process MRCP channel request (asynchronous response MUST be sent)*/ -static apt_bool_t recorder_channel_request_process(mrcp_engine_channel_t *channel, mrcp_message_t *request) -{ - apt_bool_t processed = FALSE; - recorder_channel_t *recorder_channel = channel->method_obj; - mrcp_message_t *response = mrcp_response_create(request,request->pool); - switch(request->start_line.method_id) { - case RECORDER_SET_PARAMS: - break; - case RECORDER_GET_PARAMS: - break; - case RECORDER_RECORD: - processed = recorder_channel_record(recorder_channel,request,response); - break; - case RECORDER_STOP: - processed = recorder_channel_stop(recorder_channel,request,response); - break; - case RECORDER_START_INPUT_TIMERS: - processed = recorder_channel_timers_start(recorder_channel,request,response); - break; - default: - break; - } - if(processed == FALSE) { - /* send asynchronous response for not handled request */ - mrcp_engine_channel_message_send(channel,response); - } - return TRUE; -} - -/* Raise START-OF-INPUT event */ -static apt_bool_t recorder_start_of_input(recorder_channel_t *recorder_channel) -{ - /* create START-OF-INPUT event */ - mrcp_message_t *message = mrcp_event_create( - recorder_channel->record_request, - RECORDER_START_OF_INPUT, - recorder_channel->record_request->pool); - if(!message) { - return FALSE; - } - - /* set request state */ - message->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - /* send asynch event */ - return mrcp_engine_channel_message_send(recorder_channel->channel,message); -} - -/* Raise RECORD-COMPLETE event */ -static apt_bool_t recorder_record_complete(recorder_channel_t *recorder_channel, mrcp_recorder_completion_cause_e cause) -{ - mrcp_recorder_header_t *recorder_header; - /* create RECORD-COMPLETE event */ - mrcp_message_t *message = mrcp_event_create( - recorder_channel->record_request, - RECORDER_RECORD_COMPLETE, - recorder_channel->record_request->pool); - if(!message) { - return FALSE; - } - - if(recorder_channel->audio_out) { - fclose(recorder_channel->audio_out); - recorder_channel->audio_out = NULL; - } - - /* get/allocate recorder header */ - recorder_header = mrcp_resource_header_prepare(message); - if(recorder_header) { - /* set completion cause */ - recorder_header->completion_cause = cause; - mrcp_resource_header_property_add(message,RECORDER_HEADER_COMPLETION_CAUSE); - } - /* set record-uri */ - recorder_channel_uri_set(recorder_channel,message); - /* set request state */ - message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - - recorder_channel->record_request = NULL; - /* send asynch event */ - return mrcp_engine_channel_message_send(recorder_channel->channel,message); -} - -/** Callback is called from MPF engine context to destroy any additional data associated with audio stream */ -static apt_bool_t recorder_stream_destroy(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform any action before open */ -static apt_bool_t recorder_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to perform any action after close */ -static apt_bool_t recorder_stream_close(mpf_audio_stream_t *stream) -{ - return TRUE; -} - -/** Callback is called from MPF engine context to write/send new frame */ -static apt_bool_t recorder_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - recorder_channel_t *recorder_channel = stream->obj; - if(recorder_channel->stop_response) { - if(recorder_channel->audio_out) { - fclose(recorder_channel->audio_out); - recorder_channel->audio_out = NULL; - } - - if(recorder_channel->record_request){ - /* set record-uri */ - recorder_channel_uri_set(recorder_channel,recorder_channel->stop_response); - } - /* send asynchronous response to STOP request */ - mrcp_engine_channel_message_send(recorder_channel->channel,recorder_channel->stop_response); - recorder_channel->stop_response = NULL; - recorder_channel->record_request = NULL; - return TRUE; - } - - if(recorder_channel->record_request) { - mpf_detector_event_e det_event = mpf_activity_detector_process(recorder_channel->detector,frame); - switch(det_event) { - case MPF_DETECTOR_EVENT_ACTIVITY: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Activity "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(recorder_channel->record_request)); - recorder_start_of_input(recorder_channel); - break; - case MPF_DETECTOR_EVENT_INACTIVITY: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Voice Inactivity "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(recorder_channel->record_request)); - recorder_record_complete(recorder_channel,RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE); - break; - case MPF_DETECTOR_EVENT_NOINPUT: - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Detected Noinput "APT_SIDRES_FMT, - MRCP_MESSAGE_SIDRES(recorder_channel->record_request)); - if(recorder_channel->timers_started == TRUE) { - recorder_record_complete(recorder_channel,RECORDER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT); - } - break; - default: - break; - } - - if(recorder_channel->audio_out) { - fwrite(frame->codec_frame.buffer,1,frame->codec_frame.size,recorder_channel->audio_out); - - recorder_channel->cur_size += frame->codec_frame.size; - recorder_channel->cur_time += CODEC_FRAME_TIME_BASE; - if(recorder_channel->max_time && recorder_channel->cur_time >= recorder_channel->max_time) { - recorder_record_complete(recorder_channel,RECORDER_COMPLETION_CAUSE_SUCCESS_MAXTIME); - } - } - } - return TRUE; -} diff --git a/libs/unimrcp/tests/Makefile.am b/libs/unimrcp/tests/Makefile.am deleted file mode 100644 index fc52c02681..0000000000 --- a/libs/unimrcp/tests/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -SUBDIRS = apttest mpftest mrcptest rtsptest strtablegen diff --git a/libs/unimrcp/tests/apttest/Makefile.am b/libs/unimrcp/tests/apttest/Makefile.am deleted file mode 100644 index 205207400a..0000000000 --- a/libs/unimrcp/tests/apttest/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_PROGRAMS = apttest -apttest_LDADD = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) -apttest_SOURCES = src/main.c \ - src/task_suite.c \ - src/consumer_task_suite.c \ - src/multipart_suite.c diff --git a/libs/unimrcp/tests/apttest/apttest.vcproj b/libs/unimrcp/tests/apttest/apttest.vcproj deleted file mode 100644 index 4765530fc9..0000000000 --- a/libs/unimrcp/tests/apttest/apttest.vcproj +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/apttest/apttest.vcxproj b/libs/unimrcp/tests/apttest/apttest.vcxproj deleted file mode 100644 index a766f033b1..0000000000 --- a/libs/unimrcp/tests/apttest/apttest.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15} - apttest - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/apttest/apttest.vcxproj.filters b/libs/unimrcp/tests/apttest/apttest.vcxproj.filters deleted file mode 100644 index eba965070c..0000000000 --- a/libs/unimrcp/tests/apttest/apttest.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ - - - - - {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 - - - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/apttest/src/consumer_task_suite.c b/libs/unimrcp/tests/apttest/src/consumer_task_suite.c deleted file mode 100644 index 74f8197b05..0000000000 --- a/libs/unimrcp/tests/apttest/src/consumer_task_suite.c +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: consumer_task_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include "apt_test_suite.h" -#include "apt_consumer_task.h" -#include "apt_log.h" - -typedef struct { - apr_time_t timestamp; - int number; -} sample_msg_data_t; - -static void task_on_start_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Start"); -} - -static void task_on_terminate_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On Task Terminate"); -} - -static apt_bool_t task_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - sample_msg_data_t *data = (sample_msg_data_t*)msg->data; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process Message [%d]",data->number); - return TRUE; -} - - -static apt_bool_t consumer_task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv) -{ - apt_consumer_task_t *consumer_task; - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - apt_task_msg_t *msg; - sample_msg_data_t *data; - int i; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(sample_msg_data_t),suite->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task"); - consumer_task = apt_consumer_task_create(NULL,msg_pool,suite->pool); - if(!consumer_task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task"); - return FALSE; - } - task = apt_consumer_task_base_get(consumer_task); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = task_msg_process; - vtable->on_start_complete = task_on_start_complete; - vtable->on_terminate_complete = task_on_terminate_complete; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task"); - if(apt_task_start(task) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task"); - apt_task_destroy(task); - return FALSE; - } - - for(i=0; i<10; i++) { - msg = apt_task_msg_acquire(msg_pool); - msg->type = TASK_MSG_USER; - data = (sample_msg_data_t*) msg->data; - - data->number = i; - data->timestamp = apr_time_now(); - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Signal Message [%d]",data->number); - apt_task_msg_signal(task,msg); - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [wait till complete]"); - apt_task_terminate(task,TRUE); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task"); - apt_task_destroy(task); - return TRUE; -} - -apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool) -{ - apt_test_suite_t *suite = apt_test_suite_create(pool,"consumer",NULL,consumer_task_test_run); - return suite; -} diff --git a/libs/unimrcp/tests/apttest/src/main.c b/libs/unimrcp/tests/apttest/src/main.c deleted file mode 100644 index 772f7f0003..0000000000 --- a/libs/unimrcp/tests/apttest/src/main.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_test_suite.h" -#include "apt_log.h" - -apt_test_suite_t* task_test_suite_create(apr_pool_t *pool); -apt_test_suite_t* consumer_task_test_suite_create(apr_pool_t *pool); -apt_test_suite_t* multipart_test_suite_create(apr_pool_t *pool); - -int main(int argc, const char * const *argv) -{ - apt_test_framework_t *test_framework; - apt_test_suite_t *test_suite; - apr_pool_t *pool; - - /* one time apr global initialization */ - if(apr_initialize() != APR_SUCCESS) { - return 0; - } - - /* create test framework */ - test_framework = apt_test_framework_create(); - pool = apt_test_framework_pool_get(test_framework); - - /* create test suites and add them to test framework */ - test_suite = task_test_suite_create(pool); - apt_test_framework_suite_add(test_framework,test_suite); - - test_suite = consumer_task_test_suite_create(pool); - apt_test_framework_suite_add(test_framework,test_suite); - - test_suite = multipart_test_suite_create(pool); - apt_test_framework_suite_add(test_framework,test_suite); - - /* run tests */ - apt_test_framework_run(test_framework,argc,argv); - - /* destroy test framework */ - apt_test_framework_destroy(test_framework); - - /* final apr global termination */ - apr_terminate(); - return 0; -} diff --git a/libs/unimrcp/tests/apttest/src/multipart_suite.c b/libs/unimrcp/tests/apttest/src/multipart_suite.c deleted file mode 100644 index 74a9c29b1a..0000000000 --- a/libs/unimrcp/tests/apttest/src/multipart_suite.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: multipart_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_test_suite.h" -#include "apt_multipart_content.h" -#include "apt_log.h" - -static apt_str_t* multipart_content_generate(apt_test_suite_t *suite) -{ - apt_multipart_content_t *multipart = apt_multipart_content_create(1500,NULL,suite->pool); - apt_str_t content_type; - apt_str_t content; - apt_str_t *body; - - apt_string_set(&content_type,"text/plain"); - apt_string_set(&content,"This is the content of the first part"); - apt_multipart_content_add2(multipart,&content_type,NULL,&content); - - apt_string_set(&content_type,"application/ssml+xml"); - apt_string_set(&content, - "\r\n" - " You have 4 new messages.

\r\n" - "
"); - apt_multipart_content_add2(multipart,&content_type,NULL,&content); - - body = apt_multipart_content_finalize(multipart); - if(body) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Genereted Multipart Content [%lu bytes]\n%s", - body->length, - body->buf); - } - return body; -} - -static apt_bool_t multipart_content_parse(apt_test_suite_t *suite, apt_str_t *body) -{ - apt_multipart_content_t *multipart = apt_multipart_content_assign(body,NULL,suite->pool); - if(multipart) { - apt_bool_t is_final; - apt_content_part_t content_part; - while(apt_multipart_content_get(multipart,&content_part,&is_final) == TRUE) { - if(is_final == TRUE) { - break; - } - if(content_part.type && apt_string_is_empty(content_part.type) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Content Part Type: %.*s", - content_part.type->length, - content_part.type->buf); - } - if(content_part.id && apt_string_is_empty(content_part.id) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Content Part Id: %.*s", - content_part.id->length, - content_part.id->buf); - } - if(content_part.length && apt_string_is_empty(content_part.length) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Content Part Length: %.*s\n%.*s", - content_part.length->length, - content_part.length->buf, - content_part.body.length, - content_part.body.buf); - } - } - } - return TRUE; -} - - -static apt_bool_t multipart_test_run(apt_test_suite_t *suite, int argc, const char * const *argv) -{ - apt_bool_t status = FALSE; - apt_str_t *body = multipart_content_generate(suite); - if(body) { - status = multipart_content_parse(suite,body); - } - return status; -} - -apt_test_suite_t* multipart_test_suite_create(apr_pool_t *pool) -{ - apt_test_suite_t *suite = apt_test_suite_create(pool,"multipart",NULL,multipart_test_run); - return suite; -} diff --git a/libs/unimrcp/tests/apttest/src/task_suite.c b/libs/unimrcp/tests/apttest/src/task_suite.c deleted file mode 100644 index e42f14e598..0000000000 --- a/libs/unimrcp/tests/apttest/src/task_suite.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: task_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_test_suite.h" -#include "apt_task.h" -#include "apt_log.h" - -static apt_bool_t task_main(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Do the Job"); - apt_task_delay(3000); - return TRUE; -} - -static apt_bool_t task_test_run(apt_test_suite_t *suite, int argc, const char * const *argv) -{ - apt_task_t *task; - apt_task_vtable_t *vtable; - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Task"); - task = apt_task_create(NULL,NULL,suite->pool); - if(!task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Task"); - return FALSE; - } - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->run = task_main; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Start Task"); - if(apt_task_start(task) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task"); - apt_task_destroy(task); - return FALSE; - } - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Wait for Task to Complete"); - apt_task_wait_till_complete(task); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task"); - apt_task_destroy(task); - return TRUE; -} - -apt_test_suite_t* task_test_suite_create(apr_pool_t *pool) -{ - apt_test_suite_t *suite = apt_test_suite_create(pool,"task",NULL,task_test_run); - return suite; -} diff --git a/libs/unimrcp/tests/mpftest/Makefile.am b/libs/unimrcp/tests/mpftest/Makefile.am deleted file mode 100644 index 0a032d121b..0000000000 --- a/libs/unimrcp/tests/mpftest/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mpf/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_PROGRAMS = mpftest -mpftest_LDADD = $(top_builddir)/libs/mpf/libmpf.la \ - $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) -mpftest_SOURCES = src/main.c \ - src/mpf_suite.c diff --git a/libs/unimrcp/tests/mpftest/mpftest.vcproj b/libs/unimrcp/tests/mpftest/mpftest.vcproj deleted file mode 100644 index 7a359cf1e0..0000000000 --- a/libs/unimrcp/tests/mpftest/mpftest.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/mpftest/mpftest.vcxproj b/libs/unimrcp/tests/mpftest/mpftest.vcxproj deleted file mode 100644 index a28878891a..0000000000 --- a/libs/unimrcp/tests/mpftest/mpftest.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {DCF01B1C-5268-44F3-9130-D647FABFB663} - mpftest - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies) - - - - - mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies) - - - - - X64 - - - mpf.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;ws2_32.lib;winmm.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - {b5a00bfa-6083-4fae-a097-71642d6473b5} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mpftest/mpftest.vcxproj.filters b/libs/unimrcp/tests/mpftest/mpftest.vcxproj.filters deleted file mode 100644 index dbe64db07d..0000000000 --- a/libs/unimrcp/tests/mpftest/mpftest.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - {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 - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mpftest/src/main.c b/libs/unimrcp/tests/mpftest/src/main.c deleted file mode 100644 index 7e61aa19e7..0000000000 --- a/libs/unimrcp/tests/mpftest/src/main.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_test_suite.h" -#include "apt_log.h" - -apt_test_suite_t* mpf_suite_create(apr_pool_t *pool); - -int main(int argc, const char * const *argv) -{ - apt_test_framework_t *test_framework; - apt_test_suite_t *test_suite; - apr_pool_t *pool; - - /* one time apr global initialization */ - if(apr_initialize() != APR_SUCCESS) { - return 0; - } - - /* create test framework */ - test_framework = apt_test_framework_create(); - pool = apt_test_framework_pool_get(test_framework); - - /* create test suites and add them to test framework */ - test_suite = mpf_suite_create(pool); - apt_test_framework_suite_add(test_framework,test_suite); - - /* run tests */ - apt_test_framework_run(test_framework,argc,argv); - - /* destroy test framework */ - apt_test_framework_destroy(test_framework); - - /* final apr global termination */ - apr_terminate(); - return 0; -} diff --git a/libs/unimrcp/tests/mpftest/src/mpf_suite.c b/libs/unimrcp/tests/mpftest/src/mpf_suite.c deleted file mode 100644 index a18e3319ae..0000000000 --- a/libs/unimrcp/tests/mpftest/src/mpf_suite.c +++ /dev/null @@ -1,571 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: mpf_suite.c 2214 2014-11-06 03:05:51Z achaloyan@gmail.com $ - */ - -#include -#include "apt_test_suite.h" -#include "apt_pool.h" -#include "apt_consumer_task.h" -#include "apt_dir_layout.h" -#include "apt_log.h" -#include "mpf_engine.h" -#include "mpf_rtp_termination_factory.h" -#include "mpf_file_termination_factory.h" -#include "mpf_audio_file_descriptor.h" -#include "mpf_rtp_descriptor.h" -#include "mpf_codec_manager.h" - -typedef struct mpf_suite_session_t mpf_suite_session_t; -typedef struct mpf_suite_agent_t mpf_suite_agent_t; - -/** Test suite session */ -struct mpf_suite_session_t { - /** Pool to allocate memory from */ - apr_pool_t *pool; - - /** Media context associated with the session */ - mpf_context_t *context; - /** The first termination in the context */ - mpf_termination_t *file_termination; - /** The second termination in the context */ - mpf_termination_t *rtp_termination; -}; - -/** Test suite agent */ -struct mpf_suite_agent_t { - /** Directory layout */ - apt_dir_layout_t *dir_layout; - /** The main task of the test agent, which sends messages to MPF engine and - * processes responses and events sent back from MPF engine */ - apt_consumer_task_t *consumer_task; - /** MPF engine */ - mpf_engine_t *engine; - /** RTP termination factory */ - mpf_termination_factory_t *rtp_termination_factory; - /** File termination factory */ - mpf_termination_factory_t *file_termination_factory; - /* Configuration of RTP termination factory */ - mpf_rtp_config_t *rtp_config; - /* RTP stream settings */ - mpf_rtp_settings_t *rtp_settings; - - /** RTP receiver -> File */ - mpf_suite_session_t *rx_session; - /** File -> RTP transmitter */ - mpf_suite_session_t *tx_session; - - /** Wait object, which is signalled to indicate shutdown */ - apr_thread_cond_t *wait_object; - /** Mutex of the wait object */ - apr_thread_mutex_t *wait_object_mutex; -}; - -static apt_bool_t mpf_test_run(apt_test_suite_t *suite, int argc, const char * const *argv); - -static void mpf_suite_on_start_complete(apt_task_t *task); -static void mpf_suite_on_terminate_complete(apt_task_t *task); -static apt_bool_t mpf_suite_task_msg_process(apt_task_t *task, apt_task_msg_t *msg); - -static mpf_audio_file_descriptor_t* mpf_file_reader_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session); -static mpf_audio_file_descriptor_t* mpf_file_writer_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session); -static mpf_rtp_stream_descriptor_t* mpf_rtp_rx_local_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session); -static mpf_rtp_stream_descriptor_t* mpf_rtp_rx_remote_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session); -static mpf_rtp_stream_descriptor_t* mpf_rtp_tx_local_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session); -static mpf_rtp_stream_descriptor_t* mpf_rtp_tx_remote_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session); - - -/** Create MPF test suite */ -apt_test_suite_t* mpf_suite_create(apr_pool_t *pool) -{ - apt_test_suite_t *suite = apt_test_suite_create(pool,"mpf",NULL,mpf_test_run); - return suite; -} - -/** Run MPF test suite */ -static apt_bool_t mpf_test_run(apt_test_suite_t *suite, int argc, const char * const *argv) -{ - mpf_suite_agent_t *agent; - mpf_codec_manager_t *codec_manager; - mpf_rtp_config_t *rtp_config; - mpf_rtp_settings_t *rtp_settings; - mpf_engine_t *engine; - - apt_task_t *task; - apt_task_vtable_t *vtable; - apt_task_msg_pool_t *msg_pool; - - agent = apr_palloc(suite->pool,sizeof(mpf_suite_agent_t)); - - agent->dir_layout = apt_default_dir_layout_create(NULL,suite->pool); - engine = mpf_engine_create("MPF-Engine",suite->pool); - if(!engine) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create MPF Engine"); - return FALSE; - } - - codec_manager = mpf_engine_codec_manager_create(suite->pool); - if(!codec_manager) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Codec Manager"); - return FALSE; - } - - mpf_engine_codec_manager_register(engine,codec_manager); - agent->engine = engine; - - rtp_config = mpf_rtp_config_alloc(suite->pool); - apt_string_set(&rtp_config->ip,"127.0.0.1"); - rtp_config->rtp_port_min = 5000; - rtp_config->rtp_port_max = 6000; - - agent->rtp_config = rtp_config; - - rtp_settings = mpf_rtp_settings_alloc(suite->pool); - rtp_settings->ptime = 20; - rtp_settings->jb_config.adaptive = 1; - rtp_settings->jb_config.time_skew_detection = 1; - rtp_settings->jb_config.min_playout_delay = 0; - rtp_settings->jb_config.initial_playout_delay = 50; - rtp_settings->jb_config.max_playout_delay = 800; - mpf_codec_manager_codec_list_load(codec_manager,&rtp_settings->codec_list,"PCMU",suite->pool); - - agent->rtp_settings = rtp_settings; - - agent->rtp_termination_factory = mpf_rtp_termination_factory_create(rtp_config,suite->pool); - agent->file_termination_factory = mpf_file_termination_factory_create(suite->pool); - - agent->rx_session = NULL; - agent->tx_session = NULL; - - msg_pool = apt_task_msg_pool_create_dynamic(sizeof(mpf_message_t),suite->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create Consumer Task"); - agent->consumer_task = apt_consumer_task_create(agent,msg_pool,suite->pool); - if(!agent->consumer_task) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Consumer Task"); - return FALSE; - } - task = apt_consumer_task_base_get(agent->consumer_task); - apt_task_name_set(task,"MPF-Tester"); - vtable = apt_task_vtable_get(task); - if(vtable) { - vtable->process_msg = mpf_suite_task_msg_process; - vtable->on_start_complete = mpf_suite_on_start_complete; - vtable->on_terminate_complete = mpf_suite_on_terminate_complete; - } - - apt_task_add(task,mpf_task_get(engine)); - - apr_thread_mutex_create(&agent->wait_object_mutex,APR_THREAD_MUTEX_UNNESTED,suite->pool); - apr_thread_cond_create(&agent->wait_object,suite->pool); - - if(apt_task_start(task) == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Start Task"); - apt_task_destroy(task); - return FALSE; - } - - apr_thread_mutex_lock(agent->wait_object_mutex); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Wait for Task to Complete"); - apr_thread_cond_wait(agent->wait_object,agent->wait_object_mutex); - apr_thread_mutex_unlock(agent->wait_object_mutex); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Terminate Task [wait till complete]"); - apt_task_terminate(task,TRUE); - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Destroy Task"); - apt_task_destroy(task); - - apr_thread_cond_destroy(agent->wait_object); - apr_thread_mutex_destroy(agent->wait_object_mutex); - return TRUE; -} - -static mpf_suite_session_t* mpf_suite_rx_session_create(const mpf_suite_agent_t *agent) -{ - mpf_task_msg_t *task_msg = NULL; - void *descriptor; - apr_pool_t *pool; - mpf_suite_session_t *session; - - pool = apt_pool_create(); - session = apr_palloc(pool,sizeof(mpf_suite_session_t)); - session->pool = pool; - session->context = NULL; - session->file_termination = NULL; - session->rtp_termination = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create MPF Context [Rx]"); - session->context = mpf_engine_context_create(agent->engine,NULL,session,2,pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [RTP Rx]"); - session->rtp_termination = mpf_termination_create(agent->rtp_termination_factory,session,session->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [RTP Rx]"); - descriptor = mpf_rtp_rx_local_descriptor_create(agent,session); - mpf_engine_termination_message_add( - agent->engine, - MPF_ADD_TERMINATION,session->context,session->rtp_termination,descriptor, - &task_msg); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [File Writer]"); - session->file_termination = mpf_termination_create(agent->file_termination_factory,session,session->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [File Writer]"); - descriptor = mpf_file_writer_descriptor_create(agent,session); - mpf_engine_termination_message_add( - agent->engine, - MPF_ADD_TERMINATION,session->context,session->file_termination,descriptor, - &task_msg); - - mpf_engine_message_send(agent->engine,&task_msg); - return session; -} - -static mpf_suite_session_t* mpf_suite_tx_session_create(const mpf_suite_agent_t *agent) -{ - mpf_task_msg_t *task_msg = NULL; - void *descriptor; - apr_pool_t *pool; - mpf_suite_session_t *session; - - pool = apt_pool_create(); - session = apr_palloc(pool,sizeof(mpf_suite_session_t)); - session->pool = pool; - session->context = NULL; - session->file_termination = NULL; - session->rtp_termination = NULL; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create MPF Context [Tx]"); - session->context = mpf_engine_context_create(agent->engine,NULL,session,2,pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [File Reader]"); - session->file_termination = mpf_termination_create(agent->file_termination_factory,session,session->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [File Reader]"); - descriptor = mpf_file_reader_descriptor_create(agent,session); - mpf_engine_termination_message_add( - agent->engine, - MPF_ADD_TERMINATION,session->context,session->file_termination,descriptor, - &task_msg); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Create Termination [RTP Tx]"); - session->rtp_termination = mpf_termination_create(agent->rtp_termination_factory,session,session->pool); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Add Termination [RTP Tx]"); - descriptor = mpf_rtp_tx_local_descriptor_create(agent,session); - mpf_engine_termination_message_add( - agent->engine, - MPF_ADD_TERMINATION,session->context,session->rtp_termination,descriptor, - &task_msg); - - mpf_engine_message_send(agent->engine,&task_msg); - return session; -} - -static void mpf_suite_session_destroy(mpf_suite_agent_t *agent, mpf_suite_session_t* session) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Destroy MPF Context"); - mpf_engine_context_destroy(session->context); - session->context = NULL; - - if(agent->rx_session == session) { - agent->rx_session = NULL; - } - else if(agent->tx_session == session) { - agent->tx_session = NULL; - } - - apr_pool_destroy(session->pool); - - if(!agent->tx_session && !agent->rx_session) { - apr_thread_mutex_lock(agent->wait_object_mutex); - apr_thread_cond_signal(agent->wait_object); - apr_thread_mutex_unlock(agent->wait_object_mutex); - } -} - -/** Start execution of MPF test suite scenario */ -static void mpf_suite_on_start_complete(apt_task_t *task) -{ - apt_consumer_task_t *consumer_task; - mpf_suite_agent_t *agent; - - consumer_task = apt_task_object_get(task); - agent = apt_consumer_task_object_get(consumer_task); - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On MPF Suite Start"); - - agent->rx_session = mpf_suite_rx_session_create(agent); - agent->tx_session = mpf_suite_tx_session_create(agent); -} - -/** Execution of MPF test suite scenario is terminated */ -static void mpf_suite_on_terminate_complete(apt_task_t *task) -{ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"On MPF Suite Terminate"); -} - -/** Process MPF response */ -static apt_bool_t mpf_suite_response_process(mpf_suite_agent_t *agent, const mpf_message_t *mpf_message) -{ - mpf_task_msg_t *task_msg = NULL; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Response"); - if(mpf_message->command_id == MPF_ADD_TERMINATION) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Add Termination"); - if(mpf_message->termination) { - mpf_suite_session_t *session; - session = mpf_termination_object_get(mpf_message->termination); - if(session->rtp_termination == mpf_message->termination) { - mpf_rtp_stream_descriptor_t *descriptor = NULL; - if(session == agent->rx_session) { - descriptor = mpf_rtp_rx_remote_descriptor_create(agent,session); - } - if(session == agent->tx_session) { - descriptor = mpf_rtp_tx_remote_descriptor_create(agent,session); - } - - if(descriptor) { - mpf_engine_termination_message_add( - agent->engine, - MPF_MODIFY_TERMINATION,session->context,session->rtp_termination,descriptor, - &task_msg); - } - - mpf_engine_assoc_message_add( - agent->engine, - MPF_ADD_ASSOCIATION,session->context,session->file_termination,session->rtp_termination, - &task_msg); - - mpf_engine_topology_message_add( - agent->engine, - MPF_APPLY_TOPOLOGY,session->context, - &task_msg); - } - } - } - else if(mpf_message->command_id == MPF_SUBTRACT_TERMINATION) { - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"On Subtract Termination"); - if(mpf_message->termination) { - mpf_suite_session_t *session; - session = mpf_termination_object_get(mpf_message->termination); - if(session->file_termination == mpf_message->termination) { - session->file_termination = NULL; - } - else if(session->rtp_termination == mpf_message->termination) { - session->rtp_termination = NULL; - } - mpf_termination_destroy(mpf_message->termination); - - if(!session->file_termination && !session->rtp_termination) { - mpf_suite_session_destroy(agent,session); - } - } - } - return mpf_engine_message_send(agent->engine,&task_msg); -} - -/** Process MPF event */ -static apt_bool_t mpf_suite_event_process(mpf_suite_agent_t *agent, const mpf_message_t *mpf_message) -{ - mpf_task_msg_t *task_msg = NULL; - mpf_suite_session_t *session; - apt_log(APT_LOG_MARK,APT_PRIO_DEBUG,"Process MPF Event"); - if(mpf_message->termination) { - session = mpf_termination_object_get(mpf_message->termination); - /* first destroy existing topology */ - mpf_engine_topology_message_add( - agent->engine, - MPF_DESTROY_TOPOLOGY,session->context, - &task_msg); - - if(session->file_termination) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Subtract Termination [File]"); - mpf_engine_termination_message_add( - agent->engine, - MPF_SUBTRACT_TERMINATION,session->context,session->file_termination,NULL, - &task_msg); - } - if(session->rtp_termination) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Subtract Termination [RTP]"); - mpf_engine_termination_message_add( - agent->engine, - MPF_SUBTRACT_TERMINATION,session->context,session->rtp_termination,NULL, - &task_msg); - } - } - return mpf_engine_message_send(agent->engine,&task_msg); -} - -/** Process task messages */ -static apt_bool_t mpf_suite_task_msg_process(apt_task_t *task, apt_task_msg_t *msg) -{ - apr_size_t i; - const mpf_message_t *mpf_message; - apt_consumer_task_t *consumer_task = apt_task_object_get(task); - mpf_suite_agent_t *agent = apt_consumer_task_object_get(consumer_task); - const mpf_message_container_t *container = (const mpf_message_container_t*) msg->data; - for(i=0; icount; i++) { - mpf_message = &container->messages[i]; - if(mpf_message->message_type == MPF_MESSAGE_TYPE_RESPONSE) { - mpf_suite_response_process(agent,mpf_message); - } - else { - mpf_suite_event_process(agent,mpf_message); - } - } - return TRUE; -} - -/** Create file reader descriptor */ -static mpf_audio_file_descriptor_t* mpf_file_reader_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session) -{ - const char *file_path = apt_datadir_filepath_get(agent->dir_layout,"demo-8kHz.pcm",session->pool); - mpf_audio_file_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_audio_file_descriptor_t)); - descriptor->mask = FILE_READER; - descriptor->read_handle = NULL; - descriptor->write_handle = NULL; - descriptor->codec_descriptor = mpf_codec_lpcm_descriptor_create(8000,1,session->pool); - if(file_path) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s] for Reading",file_path); - descriptor->read_handle = fopen(file_path,"rb"); - if(!descriptor->read_handle) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File [%s]",file_path); - } - } - return descriptor; -} - -/** Create file writer descriptor */ -static mpf_audio_file_descriptor_t* mpf_file_writer_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session) -{ - const char *file_path = apt_vardir_filepath_get(agent->dir_layout,"output-8kHz.pcm",session->pool); - mpf_audio_file_descriptor_t *descriptor = apr_palloc(session->pool,sizeof(mpf_audio_file_descriptor_t)); - descriptor->mask = FILE_WRITER; - descriptor->max_write_size = 500000; /* ~500Kb */ - descriptor->write_handle = NULL; - descriptor->read_handle = NULL; - descriptor->codec_descriptor = mpf_codec_lpcm_descriptor_create(8000,1,session->pool); - if(file_path) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s] for Writing",file_path); - descriptor->write_handle = fopen(file_path,"wb"); - if(!descriptor->write_handle) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File [%s] for Writing",file_path); - } - } - return descriptor; -} - -/** Create RTP rx local descriptor */ -static mpf_rtp_stream_descriptor_t* mpf_rtp_rx_local_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session) -{ - mpf_rtp_media_descriptor_t *media_descriptor; - mpf_rtp_stream_descriptor_t *stream_descriptor; - - media_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media_descriptor); - media_descriptor->state = MPF_MEDIA_ENABLED; - media_descriptor->direction = STREAM_DIRECTION_RECEIVE; - apt_string_set(&media_descriptor->ip,"127.0.0.1"); - media_descriptor->port = 5000; - - stream_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t)); - mpf_rtp_stream_descriptor_init(stream_descriptor); - stream_descriptor->local = media_descriptor; - stream_descriptor->settings = agent->rtp_settings; - return stream_descriptor; -} - -/** Create RTP rx remote descriptor */ -static mpf_rtp_stream_descriptor_t* mpf_rtp_rx_remote_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session) -{ - mpf_codec_list_t *codec_list; - mpf_codec_descriptor_t *codec_descriptor; - mpf_rtp_media_descriptor_t *media_descriptor; - mpf_rtp_stream_descriptor_t *stream_descriptor; - - media_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media_descriptor); - media_descriptor->state = MPF_MEDIA_ENABLED; - media_descriptor->direction = STREAM_DIRECTION_SEND; - apt_string_set(&media_descriptor->ip,"127.0.0.1"); - media_descriptor->port = 5002; - codec_list = &media_descriptor->codec_list; - mpf_codec_list_init(codec_list,1,session->pool); - codec_descriptor = mpf_codec_list_add(codec_list); - if(codec_descriptor) { - codec_descriptor->payload_type = 0; - apt_string_set(&codec_descriptor->name,"PCMU"); - codec_descriptor->sampling_rate = 8000; - codec_descriptor->channel_count = 1; - } - - stream_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t)); - mpf_rtp_stream_descriptor_init(stream_descriptor); - stream_descriptor->remote = media_descriptor; - stream_descriptor->settings = agent->rtp_settings; - return stream_descriptor; -} - -/** Create RTP tx local descriptor */ -static mpf_rtp_stream_descriptor_t* mpf_rtp_tx_local_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session) -{ - mpf_rtp_media_descriptor_t *media_descriptor; - mpf_rtp_stream_descriptor_t *stream_descriptor; - - media_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media_descriptor); - media_descriptor->state = MPF_MEDIA_ENABLED; - media_descriptor->direction = STREAM_DIRECTION_SEND; - apt_string_set(&media_descriptor->ip,"127.0.0.1"); - media_descriptor->port = 5002; - - stream_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t)); - mpf_rtp_stream_descriptor_init(stream_descriptor); - stream_descriptor->local = media_descriptor; - stream_descriptor->settings = agent->rtp_settings; - return stream_descriptor; -} - -/** Create RTP tx remote descriptor */ -static mpf_rtp_stream_descriptor_t* mpf_rtp_tx_remote_descriptor_create(const mpf_suite_agent_t *agent, const mpf_suite_session_t *session) -{ - mpf_codec_list_t *codec_list; - mpf_codec_descriptor_t *codec_descriptor; - mpf_rtp_media_descriptor_t *media_descriptor; - mpf_rtp_stream_descriptor_t *stream_descriptor; - - media_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_media_descriptor_t)); - mpf_rtp_media_descriptor_init(media_descriptor); - media_descriptor->state = MPF_MEDIA_ENABLED; - media_descriptor->direction = STREAM_DIRECTION_RECEIVE; - apt_string_set(&media_descriptor->ip,"127.0.0.1"); - media_descriptor->port = 5000; - codec_list = &media_descriptor->codec_list; - mpf_codec_list_init(codec_list,1,session->pool); - codec_descriptor = mpf_codec_list_add(codec_list); - if(codec_descriptor) { - codec_descriptor->payload_type = 0; - apt_string_set(&codec_descriptor->name,"PCMU"); - codec_descriptor->sampling_rate = 8000; - codec_descriptor->channel_count = 1; - } - - stream_descriptor = apr_palloc(session->pool,sizeof(mpf_rtp_stream_descriptor_t)); - mpf_rtp_stream_descriptor_init(stream_descriptor); - stream_descriptor->remote = media_descriptor; - stream_descriptor->settings = agent->rtp_settings; - return stream_descriptor; -} diff --git a/libs/unimrcp/tests/mrcptest/Makefile.am b/libs/unimrcp/tests/mrcptest/Makefile.am deleted file mode 100644 index 02bba67955..0000000000 --- a/libs/unimrcp/tests/mrcptest/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/mrcp/include \ - -I$(top_srcdir)/libs/mrcp/message/include \ - -I$(top_srcdir)/libs/mrcp/control/include \ - -I$(top_srcdir)/libs/mrcp/resources/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_PROGRAMS = mrcptest -mrcptest_LDADD = $(top_builddir)/libs/mrcp/libmrcp.la \ - $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) -mrcptest_SOURCES = src/main.c \ - src/parse_gen_suite.c \ - src/set_get_suite.c \ - src/transparent_set_get_suite.c diff --git a/libs/unimrcp/tests/mrcptest/mrcptest.vcproj b/libs/unimrcp/tests/mrcptest/mrcptest.vcproj deleted file mode 100644 index eaba7349cf..0000000000 --- a/libs/unimrcp/tests/mrcptest/mrcptest.vcproj +++ /dev/null @@ -1,304 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj b/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj deleted file mode 100644 index c49e4193a6..0000000000 --- a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj +++ /dev/null @@ -1,127 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {3CA97077-6210-4362-998A-D15A35EEAA08} - mrcptest - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - mrcp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj.filters b/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj.filters deleted file mode 100644 index b0435c5f24..0000000000 --- a/libs/unimrcp/tests/mrcptest/mrcptest.vcxproj.filters +++ /dev/null @@ -1,27 +0,0 @@ - - - - - {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 - - - - - src - - - src - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/src/main.c b/libs/unimrcp/tests/mrcptest/src/main.c deleted file mode 100644 index dd12d22177..0000000000 --- a/libs/unimrcp/tests/mrcptest/src/main.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_test_suite.h" -#include "apt_log.h" - -apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool); -apt_test_suite_t* set_get_test_suite_create(apr_pool_t *pool); -apt_test_suite_t* transparent_set_get_test_suite_create(apr_pool_t *pool); - -int main(int argc, const char * const *argv) -{ - apt_test_framework_t *test_framework; - apt_test_suite_t *test_suite; - apr_pool_t *pool; - - /* one time apr global initialization */ - if(apr_initialize() != APR_SUCCESS) { - return 0; - } - - /* create test framework */ - test_framework = apt_test_framework_create(); - pool = apt_test_framework_pool_get(test_framework); - - /* create test suites and add them to test framework */ - test_suite = set_get_test_suite_create(pool); - apt_test_framework_suite_add(test_framework,test_suite); - test_suite = transparent_set_get_test_suite_create(pool); - apt_test_framework_suite_add(test_framework,test_suite); - test_suite = parse_gen_test_suite_create(pool); - apt_test_framework_suite_add(test_framework,test_suite); - - /* run tests */ - apt_test_framework_run(test_framework,argc,argv); - - /* destroy test framework */ - apt_test_framework_destroy(test_framework); - - /* final apr global termination */ - apr_terminate(); - return 0; -} diff --git a/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c b/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c deleted file mode 100644 index 9d087cdcb3..0000000000 --- a/libs/unimrcp/tests/mrcptest/src/parse_gen_suite.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: parse_gen_suite.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#include -#include -#include "apt_test_suite.h" -#include "apt_log.h" -#include "mrcp_resource_loader.h" -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -#include "mrcp_stream.h" - -static apt_bool_t test_stream_generate(mrcp_generator_t *generator, mrcp_message_t *message) -{ - char buffer[500]; - apt_text_stream_t stream; - apt_message_status_e status; - apt_bool_t continuation; - - do { - apt_text_stream_init(&stream,buffer,sizeof(buffer)-1); - continuation = FALSE; - status = mrcp_generator_run(generator,message,&stream); - if(status == APT_MESSAGE_STATUS_COMPLETE) { - stream.text.length = stream.pos - stream.text.buf; - *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCPv2 Data [%"APR_SIZE_T_FMT" bytes]\n%s",stream.text.length,stream.text.buf); - } - else if(status == APT_MESSAGE_STATUS_INCOMPLETE) { - *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated MRCPv2 Data [%"APR_SIZE_T_FMT" bytes] continuation awaited\n%s",stream.text.length,stream.text.buf); - continuation = TRUE; - } - else if(status == APT_MESSAGE_STATUS_INVALID) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate MRCPv2 Data"); - } - } - while(continuation == TRUE); - return TRUE; -} - -static apt_bool_t mrcp_message_handler(mrcp_generator_t *generator, mrcp_message_t *message, apt_message_status_e status) -{ - if(status == APT_MESSAGE_STATUS_COMPLETE) { - /* message is completely parsed */ - test_stream_generate(generator,message); - } - return TRUE; -} - -static apt_bool_t resource_name_read(apr_file_t *file, mrcp_parser_t *parser) -{ - char buffer[100]; - apt_text_stream_t stream; - apt_bool_t status = FALSE; - apt_text_stream_init(&stream,buffer,sizeof(buffer)-1); - if(apr_file_read(file,stream.pos,&stream.text.length) != APR_SUCCESS) { - return FALSE; - } - - /* skip the first line in a test file, which indicates resource name */ - if(*stream.pos =='/' && *(stream.pos+1)=='/') { - apt_str_t line; - stream.pos += 2; - if(apt_text_line_read(&stream,&line) == TRUE) { - apr_off_t offset = stream.pos - stream.text.buf; - apr_file_seek(file,APR_SET,&offset); - mrcp_parser_resource_set(parser,&line); - status = TRUE; - } - } - return status; -} - -static apt_bool_t test_file_process(apt_test_suite_t *suite, mrcp_resource_factory_t *factory, mrcp_version_e version, const char *file_path) -{ - apr_file_t *file; - char buffer[500]; - apt_text_stream_t stream; - mrcp_parser_t *parser; - mrcp_generator_t *generator; - apr_size_t length; - apr_size_t offset; - apt_str_t resource_name; - mrcp_message_t *message; - apt_message_status_e msg_status; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s]",file_path); - if(apr_file_open(&file,file_path,APR_FOPEN_READ | APR_FOPEN_BINARY,APR_OS_DEFAULT,suite->pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File"); - return FALSE; - } - - parser = mrcp_parser_create(factory,suite->pool); - generator = mrcp_generator_create(factory,suite->pool); - - apt_string_reset(&resource_name); - if(version == MRCP_VERSION_1) { - resource_name_read(file,parser); - } - - apt_text_stream_init(&stream,buffer,sizeof(buffer)-1); - - do { - /* calculate offset remaining from the previous receive / if any */ - offset = stream.pos - stream.text.buf; - /* calculate available length */ - length = sizeof(buffer) - 1 - offset; - - if(apr_file_read(file,stream.pos,&length) != APR_SUCCESS) { - break; - } - /* calculate actual length of the stream */ - stream.text.length = offset + length; - stream.pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse MRCPv2 Data [%"APR_SIZE_T_FMT" bytes]\n%s",length,stream.pos); - - /* reset pos */ - apt_text_stream_reset(&stream); - - do { - msg_status = mrcp_parser_run(parser,&stream,&message); - mrcp_message_handler(generator,message,msg_status); - } - while(apt_text_is_eos(&stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(&stream); - } - while(apr_file_eof(file) != APR_EOF); - - apr_file_close(file); - return TRUE; -} - -static apt_bool_t test_dir_process(apt_test_suite_t *suite, mrcp_resource_factory_t *factory, mrcp_version_e version) -{ - apr_status_t rv; - apr_dir_t *dir; - - const char *dir_name = "v2"; - if(version == MRCP_VERSION_1) { - dir_name = "v1"; - } - if(apr_dir_open(&dir,dir_name,suite->pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Directory [%s]",dir_name); - return FALSE; - } - - do { - apr_finfo_t finfo; - rv = apr_dir_read(&finfo,APR_FINFO_DIRENT,dir); - if(rv == APR_SUCCESS) { - if(finfo.filetype == APR_REG && finfo.name) { - int ch; - char *file_path; - apr_filepath_merge(&file_path,dir_name,finfo.name,APR_FILEPATH_NATIVE,suite->pool); - test_file_process(suite,factory,version,file_path); - printf("\nPress ENTER to continue\n"); - do {ch = getchar(); } while ((ch != '\n') && (ch != EOF)); - } - } - } - while(rv == APR_SUCCESS); - - apr_dir_close(dir); - return TRUE; -} - -static apt_bool_t parse_gen_test_run(apt_test_suite_t *suite, int argc, const char * const *argv) -{ - mrcp_resource_factory_t *factory; - mrcp_resource_loader_t *resource_loader; - resource_loader = mrcp_resource_loader_create(TRUE,suite->pool); - if(!resource_loader) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Loader"); - return FALSE; - } - - factory = mrcp_resource_factory_get(resource_loader); - if(!factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory"); - return FALSE; - } - - test_dir_process(suite,factory,MRCP_VERSION_2); - test_dir_process(suite,factory,MRCP_VERSION_1); - - mrcp_resource_factory_destroy(factory); - return TRUE; -} - -apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool) -{ - apt_test_suite_t *suite = apt_test_suite_create(pool,"parse-gen",NULL,parse_gen_test_run); - return suite; -} diff --git a/libs/unimrcp/tests/mrcptest/src/set_get_suite.c b/libs/unimrcp/tests/mrcptest/src/set_get_suite.c deleted file mode 100644 index f7ac1cfcef..0000000000 --- a/libs/unimrcp/tests/mrcptest/src/set_get_suite.c +++ /dev/null @@ -1,326 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: set_get_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_test_suite.h" -#include "apt_log.h" -/* common includes */ -#include "mrcp_resource_loader.h" -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -/* synthesizer includes */ -#include "mrcp_synth_header.h" -#include "mrcp_synth_resource.h" -/* recognizer includes */ -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" - -#define SAMPLE_VOICE_AGE 28 -#define SAMPLE_CONTENT_TYPE "application/synthesis+ssml" -#define SAMPLE_CONTENT_ID "123456" -#define SAMPLE_CONTENT "SSML content goes here" -#define SAMPLE_PARAM_NAME "SampleParamName" -#define SAMPLE_PARAM_VALUE "SampleParamValue" - -/* Create SPEAK request */ -static mrcp_message_t* speak_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool) -{ - mrcp_message_t *message; - mrcp_resource_t *resource = mrcp_resource_get(factory,MRCP_SYNTHESIZER_RESOURCE); - if(!resource) { - return NULL; - } - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Request"); - message = mrcp_request_create(resource,MRCP_VERSION_2,SYNTHESIZER_SPEAK,pool); - if(message) { - mrcp_generic_header_t *generic_header; - mrcp_synth_header_t *synth_header; - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(message); - if(generic_header) { - /* set generic header fields */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-Type: %s",SAMPLE_CONTENT_TYPE); - apt_string_assign(&generic_header->content_type,SAMPLE_CONTENT_TYPE,message->pool); - mrcp_generic_header_property_add(message,GENERIC_HEADER_CONTENT_TYPE); - } - /* get/allocate synthesizer header */ - synth_header = mrcp_resource_header_prepare(message); - if(synth_header) { - /* set synthesizer header fields */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: %d",SAMPLE_VOICE_AGE); - synth_header->voice_param.age = SAMPLE_VOICE_AGE; - mrcp_resource_header_property_add(message,SYNTHESIZER_HEADER_VOICE_AGE); - } - /* set message body */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Body: %s",SAMPLE_CONTENT); - apt_string_assign(&message->body,SAMPLE_CONTENT,message->pool); - } - return message; -} - -/* Test SPEAK request */ -static apt_bool_t speak_request_test(mrcp_resource_factory_t *factory, mrcp_message_t *message) -{ - apt_bool_t res; - mrcp_generic_header_t *generic_header; - mrcp_synth_header_t *synth_header; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Test SPEAK Request"); - res = FALSE; - /* get generic header */ - generic_header = mrcp_generic_header_get(message); - if(generic_header) { - /* test content type header */ - if(mrcp_generic_header_property_check(message,GENERIC_HEADER_CONTENT_TYPE) == TRUE) { - if(strncasecmp(generic_header->content_type.buf,SAMPLE_CONTENT_TYPE,generic_header->content_type.length) == 0) { - /* OK */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Content-Type: %s",generic_header->content_type.buf); - res = TRUE; - } - } - } - if(res == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Generic Header"); - return FALSE; - } - - res = FALSE; - /* get synthesizer header */ - synth_header = mrcp_resource_header_get(message); - if(synth_header) { - /* test voice age header */ - if(mrcp_resource_header_property_check(message,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) { - if(synth_header->voice_param.age == SAMPLE_VOICE_AGE) { - /* OK */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Voice-Age: %"APR_SIZE_T_FMT,synth_header->voice_param.age); - res = TRUE; - } - } - } - if(res == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Synthesizer Header"); - return FALSE; - } - - if(strncasecmp(message->body.buf,SAMPLE_CONTENT,message->body.length) != 0) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Message Body"); - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Body: %s",message->body.buf); - return TRUE; -} - -/* Create SPEAK response */ -static mrcp_message_t* speak_response_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request) -{ - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Response"); - response = mrcp_response_create(request,request->pool); - if(response) { - /* set IN-PROGRESS state */ - response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - } - return response; -} - -/* Create SPEAK-COMPLETE event */ -static mrcp_message_t* speak_event_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request) -{ - mrcp_message_t *event_message; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK-COMPLETE Event"); - event_message = mrcp_event_create(request,SYNTHESIZER_SPEAK_COMPLETE,request->pool); - if(event_message) { - /* get/allocate synthesizer header */ - mrcp_synth_header_t *synth_header = mrcp_resource_header_prepare(event_message); - if(synth_header) { - /* set completion cause */ - synth_header->completion_cause = SYNTHESIZER_COMPLETION_CAUSE_NORMAL; - mrcp_resource_header_property_add(event_message,SYNTHESIZER_HEADER_COMPLETION_CAUSE); - } - /* set request state */ - event_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - } - return event_message; -} - - -/* Create GET-PARAMS request */ -static mrcp_message_t* get_params_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool) -{ - mrcp_message_t *message; - mrcp_resource_t *resource = mrcp_resource_get(factory,MRCP_SYNTHESIZER_RESOURCE); - if(!resource) { - return NULL; - } - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Request"); - message = mrcp_request_create(resource,MRCP_VERSION_2,SYNTHESIZER_GET_PARAMS,pool); - if(message) { - apt_str_t param_name; - apt_str_t param_value; - mrcp_generic_header_t *generic_header; - mrcp_synth_header_t *synth_header; - /* get/allocate generic header */ - generic_header = mrcp_generic_header_prepare(message); - if(generic_header) { - /* set content id empty header */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-ID: "); - mrcp_generic_header_name_property_add(message,GENERIC_HEADER_CONTENT_ID); - - /* set vendor specific params header */ - generic_header->vendor_specific_params = apt_pair_array_create(1,pool); - apt_string_set(¶m_name,SAMPLE_PARAM_NAME); - apt_string_reset(¶m_value); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Vendor-Specific-Params: %s",param_name.buf); - apt_pair_array_append(generic_header->vendor_specific_params,¶m_name,¶m_value,pool); - mrcp_generic_header_property_add(message,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS); - } - /* get/allocate synthesizer header */ - synth_header = mrcp_resource_header_prepare(message); - if(synth_header) { - /* set voice age empty header */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: "); - mrcp_resource_header_name_property_add(message,SYNTHESIZER_HEADER_VOICE_AGE); - } - } - return message; -} - -/* Create GET-PARAMS response */ -static mrcp_message_t* get_params_response_create(mrcp_resource_factory_t *factory, mrcp_message_t *request) -{ - apt_bool_t res; - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Response"); - response = mrcp_response_create(request,request->pool); - if(response) { - mrcp_generic_header_t *generic_header; - mrcp_synth_header_t *synth_header; - res = FALSE; - /* get generic header */ - generic_header = mrcp_generic_header_get(request); - if(generic_header) { - mrcp_generic_header_t *res_generic_header = mrcp_generic_header_prepare(response); - /* test content id header */ - if(mrcp_generic_header_property_check(request,GENERIC_HEADER_CONTENT_ID) == TRUE) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Content-ID: %s",SAMPLE_CONTENT_ID); - apt_string_assign(&res_generic_header->content_id,SAMPLE_CONTENT_ID,response->pool); - mrcp_generic_header_property_add(response,GENERIC_HEADER_CONTENT_ID); - res = TRUE; - } - /* test vendor specific header */ - if(mrcp_generic_header_property_check(request,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS) == TRUE) { - apt_str_t name; - const apt_pair_t *pair; - res_generic_header->vendor_specific_params = apt_pair_array_create(1,response->pool); - apt_string_set(&name,SAMPLE_PARAM_NAME); - pair = apt_pair_array_find(generic_header->vendor_specific_params,&name); - if(pair) { - apt_str_t value; - apt_string_set(&value,SAMPLE_PARAM_VALUE); - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Vendor-Specific-Params: %s=%s",name.buf,value.buf); - apt_pair_array_append(res_generic_header->vendor_specific_params,&name,&value,response->pool); - } - mrcp_generic_header_property_add(response,GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS); - res = TRUE; - } - } - - if(res == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Generic Header"); - return NULL; - } - - res = FALSE; - /* get synthesizer header */ - synth_header = mrcp_resource_header_get(request); - if(synth_header) { - mrcp_synth_header_t *res_synth_header = mrcp_resource_header_prepare(response); - /* test voice age header */ - if(mrcp_resource_header_property_check(request,SYNTHESIZER_HEADER_VOICE_AGE) == TRUE) { - res_synth_header->voice_param.age = SAMPLE_VOICE_AGE; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Voice-Age: %"APR_SIZE_T_FMT,res_synth_header->voice_param.age); - mrcp_resource_header_property_add(response,SYNTHESIZER_HEADER_VOICE_AGE); - res = TRUE; - } - } - if(res == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Synthesizer Header"); - return NULL; - } - - } - return response; -} - - - - -static apt_bool_t speak_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory) -{ - mrcp_message_t *message = speak_request_create(factory,suite->pool); - if(!message) { - return FALSE; - } - - if(speak_request_test(factory,message) != TRUE) { - return FALSE; - } - - speak_response_create(factory,message); - speak_event_create(factory,message); - return TRUE; -} - -static apt_bool_t get_params_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory) -{ - mrcp_message_t *message = get_params_request_create(factory,suite->pool); - if(!message) { - return FALSE; - } - - get_params_response_create(factory,message); - return TRUE; -} - -static apt_bool_t set_get_test_run(apt_test_suite_t *suite, int argc, const char * const *argv) -{ - mrcp_resource_factory_t *factory; - mrcp_resource_loader_t *resource_loader; - resource_loader = mrcp_resource_loader_create(TRUE,suite->pool); - if(!resource_loader) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Loader"); - return FALSE; - } - - factory = mrcp_resource_factory_get(resource_loader); - if(!factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory"); - return FALSE; - } - - speak_test_run(suite,factory); - get_params_test_run(suite,factory); - - mrcp_resource_factory_destroy(factory); - return TRUE; -} - -apt_test_suite_t* set_get_test_suite_create(apr_pool_t *pool) -{ - apt_test_suite_t *suite = apt_test_suite_create(pool,"set-get",NULL,set_get_test_run); - return suite; -} diff --git a/libs/unimrcp/tests/mrcptest/src/transparent_set_get_suite.c b/libs/unimrcp/tests/mrcptest/src/transparent_set_get_suite.c deleted file mode 100644 index 19ab6e4206..0000000000 --- a/libs/unimrcp/tests/mrcptest/src/transparent_set_get_suite.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: transparent_set_get_suite.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_test_suite.h" -#include "apt_log.h" -/* common includes */ -#include "mrcp_resource_loader.h" -#include "mrcp_resource_factory.h" -#include "mrcp_message.h" -/* synthesizer includes */ -#include "mrcp_synth_resource.h" -/* recognizer includes */ -#include "mrcp_recog_resource.h" - -#define SAMPLE_VOICE_AGE "28" -#define SAMPLE_CONTENT_TYPE "application/synthesis+ssml" -#define SAMPLE_CONTENT_ID "123456" -#define SAMPLE_CONTENT "SSML content goes here" -#define SAMPLE_PARAM_NAME "SampleParamName" -#define SAMPLE_PARAM_VALUE "SampleParamValue" - -/* Create SPEAK request */ -static mrcp_message_t* speak_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool) -{ - mrcp_message_t *message; - mrcp_resource_t *resource = mrcp_resource_get(factory,MRCP_SYNTHESIZER_RESOURCE); - if(!resource) { - return NULL; - } - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Request"); - message = mrcp_request_create(resource,MRCP_VERSION_2,SYNTHESIZER_SPEAK,pool); - if(message) { - /* set transparent header fields */ - apt_header_field_t *header_field; - header_field = apt_header_field_create_c("Content-Type",SAMPLE_CONTENT_TYPE,message->pool); - if(header_field) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf); - mrcp_message_header_field_add(message,header_field); - } - - header_field = apt_header_field_create_c("Voice-Age",SAMPLE_VOICE_AGE,message->pool); - if(header_field) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf); - mrcp_message_header_field_add(message,header_field); - } - - /* set message body */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set Body: %s",SAMPLE_CONTENT); - apt_string_assign(&message->body,SAMPLE_CONTENT,message->pool); - } - return message; -} - -/* Test SPEAK request */ -static apt_bool_t speak_request_test(mrcp_resource_factory_t *factory, mrcp_message_t *message) -{ - apt_bool_t res; - apt_header_field_t *header_field; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Test SPEAK Request"); - res = FALSE; - - header_field = NULL; - while( (header_field = mrcp_message_next_header_field_get(message,header_field)) != NULL ) { - if(strncasecmp(header_field->name.buf,"Content-Type",header_field->name.length) == 0) { - if(strncasecmp(header_field->value.buf,SAMPLE_CONTENT_TYPE,header_field->value.length) == 0) { - /* OK */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get %s: %s",header_field->name.buf,header_field->value.buf); - res = TRUE; - } - } - else if(strncasecmp(header_field->name.buf,"Voice-Age",header_field->name.length) == 0) { - if(strncasecmp(header_field->value.buf,SAMPLE_VOICE_AGE,header_field->value.length) == 0) { - /* OK */ - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get %s: %s",header_field->name.buf,header_field->value.buf); - res = TRUE; - } - } - } - if(res == FALSE) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Header Fields"); - return FALSE; - } - - if(strncasecmp(message->body.buf,SAMPLE_CONTENT,message->body.length) != 0) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Test Message Body"); - return FALSE; - } - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Get Body: %s",message->body.buf); - return TRUE; -} - -/* Create SPEAK response */ -static mrcp_message_t* speak_response_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request) -{ - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK Response"); - response = mrcp_response_create(request,request->pool); - if(response) { - /* set IN-PROGRESS state */ - response->start_line.request_state = MRCP_REQUEST_STATE_INPROGRESS; - } - return response; -} - -/* Create SPEAK-COMPLETE event */ -static mrcp_message_t* speak_event_create(mrcp_resource_factory_t *factory, const mrcp_message_t *request) -{ - mrcp_message_t *event_message; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create SPEAK-COMPLETE Event"); - event_message = mrcp_event_create(request,SYNTHESIZER_SPEAK_COMPLETE,request->pool); - if(event_message) { - apt_header_field_t *header_field; - header_field = apt_header_field_create_c("Completion-Cause","000 normal",event_message->pool); - if(header_field) { - mrcp_message_header_field_add(event_message,header_field); - } - - /* set request state */ - event_message->start_line.request_state = MRCP_REQUEST_STATE_COMPLETE; - } - return event_message; -} - -/* Create GET-PARAMS request */ -static mrcp_message_t* get_params_request_create(mrcp_resource_factory_t *factory, apr_pool_t *pool) -{ - mrcp_message_t *message; - mrcp_resource_t *resource = mrcp_resource_get(factory,MRCP_SYNTHESIZER_RESOURCE); - if(!resource) { - return NULL; - } - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Request"); - message = mrcp_request_create(resource,MRCP_VERSION_2,SYNTHESIZER_GET_PARAMS,pool); - if(message) { - apt_header_field_t *header_field; - header_field = apt_header_field_create_c("Content-Id","",message->pool); - if(header_field) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s:",header_field->name.buf); - mrcp_message_header_field_add(message,header_field); - } - header_field = apt_header_field_create_c("Vendor-Specific-Params",SAMPLE_PARAM_NAME,message->pool); - if(header_field) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s:",header_field->name.buf); - mrcp_message_header_field_add(message,header_field); - } - header_field = apt_header_field_create_c("Voice-Age","",message->pool); - if(header_field) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s:",header_field->name.buf); - mrcp_message_header_field_add(message,header_field); - } - } - return message; -} - -/* Create GET-PARAMS response */ -static mrcp_message_t* get_params_response_create(mrcp_resource_factory_t *factory, mrcp_message_t *request) -{ - mrcp_message_t *response; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Create GET-PARAMS Response"); - response = mrcp_response_create(request,request->pool); - if(response) { - apt_header_field_t *header_field; - header_field = apt_header_field_create_c("Content-Id",SAMPLE_CONTENT_ID,response->pool); - if(header_field) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf); - mrcp_message_header_field_add(response,header_field); - } - header_field = apt_header_field_create_c("Vendor-Specific-Params",SAMPLE_PARAM_NAME"="SAMPLE_PARAM_VALUE,response->pool); - if(header_field) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf); - mrcp_message_header_field_add(response,header_field); - } - header_field = apt_header_field_create_c("Voice-Age",SAMPLE_VOICE_AGE,response->pool); - if(header_field) { - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Set %s: %s",header_field->name.buf,header_field->value.buf); - mrcp_message_header_field_add(response,header_field); - } - } - return response; -} - - -static apt_bool_t speak_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory) -{ - mrcp_message_t *message = speak_request_create(factory,suite->pool); - if(!message) { - return FALSE; - } - - if(speak_request_test(factory,message) != TRUE) { - return FALSE; - } - - speak_response_create(factory,message); - speak_event_create(factory,message); - return TRUE; -} - -static apt_bool_t get_params_test_run(apt_test_suite_t *suite, mrcp_resource_factory_t *factory) -{ - mrcp_message_t *message = get_params_request_create(factory,suite->pool); - if(!message) { - return FALSE; - } - - get_params_response_create(factory,message); - return TRUE; -} - -static apt_bool_t set_get_test_run(apt_test_suite_t *suite, int argc, const char * const *argv) -{ - mrcp_resource_factory_t *factory; - mrcp_resource_loader_t *resource_loader; - resource_loader = mrcp_resource_loader_create(TRUE,suite->pool); - if(!resource_loader) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Loader"); - return FALSE; - } - - factory = mrcp_resource_factory_get(resource_loader); - if(!factory) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Create Resource Factory"); - return FALSE; - } - - speak_test_run(suite,factory); - get_params_test_run(suite,factory); - - mrcp_resource_factory_destroy(factory); - return TRUE; -} - -apt_test_suite_t* transparent_set_get_test_suite_create(apr_pool_t *pool) -{ - apt_test_suite_t *suite = apt_test_suite_create(pool,"trans-set-get",NULL,set_get_test_run); - return suite; -} diff --git a/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg b/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg deleted file mode 100644 index 1ea765535a..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/definegrammar.msg +++ /dev/null @@ -1,18 +0,0 @@ -//speechrecog -DEFINE-GRAMMAR 543257 MRCP/1.0 -Content-Type:application/grammar+xml -Content-Id:request1@form-level.store -Content-Length:309 - - - - - - - - - - oui - yes - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/getparams.msg b/libs/unimrcp/tests/mrcptest/v1/getparams.msg deleted file mode 100644 index 61ef0b9f93..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/getparams.msg +++ /dev/null @@ -1,5 +0,0 @@ -//speechsynth -GET-PARAMS 543256 MRCP/1.0 -Voice-gender: -Voice-variant: - diff --git a/libs/unimrcp/tests/mrcptest/v1/multi.msg b/libs/unimrcp/tests/mrcptest/v1/multi.msg deleted file mode 100644 index 8a1f44e772..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/multi.msg +++ /dev/null @@ -1,27 +0,0 @@ -//speechsynth -GET-PARAMS 543256 MRCP/1.0 -Voice-gender: -Voice-variant: - -SET-PARAMS 543256 MRCP/1.0 -Voice-gender:female -Voice-variant:3 - -SPEAK 543257 MRCP/1.0 -Kill-On-Barge-In:false -Voice-gender:neutral -Prosody-volume:medium -Content-Type:application/synthesis+ssml -Content-Length:412 - - - - - You have 4 new messages. - The first is from Stephanie Williams - and arrived at - 3:45pm. - - The subject is ski trip - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/pause.msg b/libs/unimrcp/tests/mrcptest/v1/pause.msg deleted file mode 100644 index 1ba3d79deb..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/pause.msg +++ /dev/null @@ -1,3 +0,0 @@ -//speechsynth -PAUSE 543258 MRCP/1.0 - diff --git a/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg b/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg deleted file mode 100644 index 054700a496..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/recognitioncomplete.msg +++ /dev/null @@ -1,20 +0,0 @@ -//speechrecog -RECOGNITION-COMPLETE 543257 COMPLETE MRCP/1.0 -Completion-Cause:000 success -Waveform-URL:http://web.media.com/session123/audio.wav -Content-Type:application/x-nlsml -Content-Length:446 - - - - - - - Andre Roy - - - may I speak to Andre Roy - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/recognize.msg b/libs/unimrcp/tests/mrcptest/v1/recognize.msg deleted file mode 100644 index 0f1c55d6d3..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/recognize.msg +++ /dev/null @@ -1,30 +0,0 @@ -//speechrecog -RECOGNIZE 543257 MRCP/1.0 -Confidence-Threshold:90 -Content-Type:application/grammar+xml -Content-Id:request1@form-level.store -Content-Length:608 - - - - - - - - - - oui - yes - - - - - - may I speak to - - Michel Tremblay - Andre Roy - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/response.msg b/libs/unimrcp/tests/mrcptest/v1/response.msg deleted file mode 100644 index 744fe11ec7..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/response.msg +++ /dev/null @@ -1,3 +0,0 @@ -//speechsynth -MRCP/1.0 543257 200 IN-PROGRESS - diff --git a/libs/unimrcp/tests/mrcptest/v1/resume.msg b/libs/unimrcp/tests/mrcptest/v1/resume.msg deleted file mode 100644 index 25bd8ab873..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/resume.msg +++ /dev/null @@ -1,3 +0,0 @@ -//speechsynth -RESUME 543260 MRCP/1.0 - diff --git a/libs/unimrcp/tests/mrcptest/v1/setparams.msg b/libs/unimrcp/tests/mrcptest/v1/setparams.msg deleted file mode 100644 index 4fad0b2082..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/setparams.msg +++ /dev/null @@ -1,5 +0,0 @@ -//speechsynth -SET-PARAMS 543256 MRCP/1.0 -Voice-gender:female -Voice-variant:3 - diff --git a/libs/unimrcp/tests/mrcptest/v1/speak.msg b/libs/unimrcp/tests/mrcptest/v1/speak.msg deleted file mode 100644 index d0f7d38db5..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/speak.msg +++ /dev/null @@ -1,19 +0,0 @@ -//speechsynth -SPEAK 543257 MRCP/1.0 -Kill-On-Barge-In:false -Voice-gender:neutral -Prosody-volume:medium -Content-Type:application/synthesis+ssml -Content-Length:412 - - - - - You have 4 new messages. - The first is from Stephanie Williams - and arrived at - 3:45pm. - - The subject is ski trip - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg b/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg deleted file mode 100644 index 52cadadbec..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/speakcomplete.msg +++ /dev/null @@ -1,4 +0,0 @@ -//speechsynth -SPEAK-COMPLETE 543260 COMPLETE MRCP/1.0 -Completion-Cause:000 normal - diff --git a/libs/unimrcp/tests/mrcptest/v1/stop.msg b/libs/unimrcp/tests/mrcptest/v1/stop.msg deleted file mode 100644 index 2f44e1f9aa..0000000000 --- a/libs/unimrcp/tests/mrcptest/v1/stop.msg +++ /dev/null @@ -1,3 +0,0 @@ -//speechsynth -STOP 543258 MRCP/1.0 - diff --git a/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg b/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg deleted file mode 100644 index e96d3d3fa7..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/definegrammar.msg +++ /dev/null @@ -1,30 +0,0 @@ -MRCP/2.0 865 DEFINE-GRAMMAR 543257 -Channel-Identifier:32AECB23433801@speechrecog -Content-Type:application/srgs+xml -Content-ID: -Content-Length:685 - - - - - - - - - - oui - yes - - - - - - may I speak to - - Michel Tremblay - Andre Roy - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v2/getparams.msg b/libs/unimrcp/tests/mrcptest/v2/getparams.msg deleted file mode 100644 index 9b02a762ae..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/getparams.msg +++ /dev/null @@ -1,5 +0,0 @@ -MRCP/2.0 112 GET-PARAMS 543256 -Channel-Identifier:32AECB23433802@speechsynth -Voice-gender: -Voice-variant: - diff --git a/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg b/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg deleted file mode 100644 index e68d28fe01..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/recognitioncomplete.msg +++ /dev/null @@ -1,20 +0,0 @@ -MRCP/2.0 616 RECOGNITION-COMPLETE 543257 COMPLETE -Channel-Identifier:32AECB23433801@speechrecog -Completion-Cause:000 success -Waveform-URI:;size=342456;duration=25435 -Content-Type:application/nlsml+xml -Content-Length:430 - - - - - - - Andre Roy - - - may I speak to Andre Roy - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v2/recognize.msg b/libs/unimrcp/tests/mrcptest/v2/recognize.msg deleted file mode 100644 index e378491422..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/recognize.msg +++ /dev/null @@ -1,30 +0,0 @@ -MRCP/2.0 903 RECOGNIZE 543257 -Channel-Identifier:32AECB23433801@speechrecog -Confidence-Threshold:0.9 -Content-Type:application/srgs+xml -Content-ID: -Content-Length:702 - - - - - - - - - - oui - yes - - - - - - may I speak to - - Michel Tremblay - Andre Roy - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v2/setparams.msg b/libs/unimrcp/tests/mrcptest/v2/setparams.msg deleted file mode 100644 index 02db19e22e..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/setparams.msg +++ /dev/null @@ -1,5 +0,0 @@ -MRCP/2.0 119 SET-PARAMS 543256 -Channel-Identifier:32AECB23433802@speechsynth -Voice-gender:female -Voice-variant:3 - diff --git a/libs/unimrcp/tests/mrcptest/v2/speak.msg b/libs/unimrcp/tests/mrcptest/v2/speak.msg deleted file mode 100644 index 4c540322e5..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/speak.msg +++ /dev/null @@ -1,26 +0,0 @@ -MRCP/2.0 732 SPEAK 543257 -Channel-Identifier:32AECB23433802@speechsynth -Voice-gender:neutral -Voice-Age:25 -Prosody-volume:medium -Content-Type:application/ssml+xml -Content-Length:542 - - - -

- You have 4 new messages. - The first is from Stephanie Williams and arrived at - - 0345p. - - The subject is - ski trip - -

-
\ No newline at end of file diff --git a/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg b/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg deleted file mode 100644 index 2f1cf96765..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/speakcomplete.msg +++ /dev/null @@ -1,5 +0,0 @@ -MRCP/2.0 161 SPEAK-COMPLETE 543257 COMPLETE -Channel-Identifier:32AECB23433802@speechsynth -Completion-Cause:000 normal -Speech-Marker:timestamp=857206027059 - diff --git a/libs/unimrcp/tests/mrcptest/v2/stop.msg b/libs/unimrcp/tests/mrcptest/v2/stop.msg deleted file mode 100644 index 003c767cb7..0000000000 --- a/libs/unimrcp/tests/mrcptest/v2/stop.msg +++ /dev/null @@ -1,3 +0,0 @@ -MRCP/2.0 74 STOP 543258 -Channel-Identifier:32AECB23433802@speechsynth - diff --git a/libs/unimrcp/tests/rtsptest/Makefile.am b/libs/unimrcp/tests/rtsptest/Makefile.am deleted file mode 100644 index 0a6f82f231..0000000000 --- a/libs/unimrcp/tests/rtsptest/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/uni-rtsp/include \ - -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_PROGRAMS = rtsptest -rtsptest_LDADD = $(top_builddir)/libs/uni-rtsp/libunirtsp.la \ - $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) -rtsptest_SOURCES = src/main.c \ - src/parse_gen_suite.c diff --git a/libs/unimrcp/tests/rtsptest/msg/announce.msg b/libs/unimrcp/tests/rtsptest/msg/announce.msg deleted file mode 100644 index 142f16ce35..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/announce.msg +++ /dev/null @@ -1,24 +0,0 @@ -ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:4 -Session:12345678 -Content-Type:application/mrcp -Content-Length:567 - -SPEAK 543257 MRCP/1.0 -Kill-On-Barge-In:false -Voice-gender:neutral -Prosody-volume:medium -Content-Type:application/synthesis+ssml -Content-Length:412 - - - - - You have 4 new messages. - The first is from Stephanie Williams - and arrived at - 3:45pm. - - The subject is ski trip - - \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/msg/ok.msg b/libs/unimrcp/tests/rtsptest/msg/ok.msg deleted file mode 100644 index b88ac1ca40..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/ok.msg +++ /dev/null @@ -1,16 +0,0 @@ -RTSP/1.0 200 OK -CSeq:2 -Transport:RTP/AVP;unicast;client_port=46456-46457;server_port=46460-46461 -Session:12345678 -Content-Length:188 -Content-Type:application/sdp - -v=0 -o=- 3211724219 3211724219 IN IP4 10.3.2.88 -s=Media Server -c=IN IP4 0.0.0.0 -t=0 0 -m=audio 46460 RTP/AVP 0 96 -a=rtpmap:0 pcmu/8000 -a=rtpmap:96 telephone-event/8000 -a=fmtp:96 0-15 \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/msg/re-ok.msg b/libs/unimrcp/tests/rtsptest/msg/re-ok.msg deleted file mode 100644 index 2b8dd7503a..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/re-ok.msg +++ /dev/null @@ -1,6 +0,0 @@ -RTSP/1.0 200 OK -CSeq:3 -Transport:RTP/AVP;unicast;client_port=46456-46457; - server_port=46460-46461;mode=record;ttl=127 -Session:12345678 - diff --git a/libs/unimrcp/tests/rtsptest/msg/re-setup.msg b/libs/unimrcp/tests/rtsptest/msg/re-setup.msg deleted file mode 100644 index 288ef23b30..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/re-setup.msg +++ /dev/null @@ -1,6 +0,0 @@ -SETUP rtsp://media.server.com/media/recognizer RTSP/1.0 -CSeq:3 -Transport:RTP/AVP;unicast;client_port=46456-46457; - mode=record;ttl=127 -Session:12345678;timeout=200 - diff --git a/libs/unimrcp/tests/rtsptest/msg/setup.msg b/libs/unimrcp/tests/rtsptest/msg/setup.msg deleted file mode 100644 index 1606500258..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/setup.msg +++ /dev/null @@ -1,16 +0,0 @@ -SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:2 -Transport:RTP/AVP;unicast;client_port=46456-46457 -Content-Type:application/sdp -Content-Length:188 - -v=0 -o=- 123 456 IN IP4 10.0.0.1 -s=Media Server -p=+1-888-555-1212 -c=IN IP4 0.0.0.0 -t=0 0 -m=audio 0 RTP/AVP 0 96 -a=rtpmap:0 pcmu/8000 -a=rtpmap:96 telephone-event/8000 -a=fmtp:96 0-15 \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/msg/teardown.msg b/libs/unimrcp/tests/rtsptest/msg/teardown.msg deleted file mode 100644 index f673a0ccd8..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/teardown.msg +++ /dev/null @@ -1,4 +0,0 @@ -TEARDOWN rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:12 -Session:12345678 - diff --git a/libs/unimrcp/tests/rtsptest/msg/ultimate.msg b/libs/unimrcp/tests/rtsptest/msg/ultimate.msg deleted file mode 100644 index bac7ffe683..0000000000 --- a/libs/unimrcp/tests/rtsptest/msg/ultimate.msg +++ /dev/null @@ -1,46 +0,0 @@ -RTSP/1.0 200 OK -CSeq:3 -Transport:RTP/AVP;unicast;client_port=46456-46457; - server_port=46460-46461;mode=record;ttl=127 -Session:12345678 - -SETUP rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:2 -Transport:RTP/AVP;unicast;client_port=46456-46457 -Content-Type:application/sdp -Content-Length:190 - -v=0 -o=- 123 456 IN IP4 10.0.0.1 -s=Media Server -p=+1-888-555-1212 -c=IN IP4 0.0.0.0 -t=0 0 -m=audio 0 RTP/AVP 0 96 -a=rtpmap:0 pcmu/8000 -a=rtpmap:96 telephone-event/8000 -a=fmtp:96 0-15 -ANNOUNCE rtsp://media.server.com/media/synthesizer RTSP/1.0 -CSeq:4 -Session:12345678 -Content-Type:application/mrcp -Content-Length:567 - -SPEAK 543257 MRCP/1.0 -Kill-On-Barge-In:false -Voice-gender:neutral -Prosody-volume:medium -Content-Type:application/synthesis+ssml -Content-Length:412 - - - - - You have 4 new messages. - The first is from Stephanie Williams - and arrived at - 3:45pm. - - The subject is ski trip - - \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/rtsptest.vcproj b/libs/unimrcp/tests/rtsptest/rtsptest.vcproj deleted file mode 100644 index 6051b862bd..0000000000 --- a/libs/unimrcp/tests/rtsptest/rtsptest.vcproj +++ /dev/null @@ -1,296 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj b/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj deleted file mode 100644 index 5f0b4546fc..0000000000 --- a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335} - rtsptest - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - unirtsp.lib;aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - - {504b3154-7a4f-459d-9877-b951021c3f1f} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj.filters b/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj.filters deleted file mode 100644 index 62dd2c5691..0000000000 --- a/libs/unimrcp/tests/rtsptest/rtsptest.vcxproj.filters +++ /dev/null @@ -1,21 +0,0 @@ - - - - - {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 - - - - - src - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/rtsptest/src/main.c b/libs/unimrcp/tests/rtsptest/src/main.c deleted file mode 100644 index df5bad58fd..0000000000 --- a/libs/unimrcp/tests/rtsptest/src/main.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include "apt_test_suite.h" -#include "apt_log.h" - -apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool); - -int main(int argc, const char * const *argv) -{ - apt_test_framework_t *test_framework; - apt_test_suite_t *test_suite; - apr_pool_t *pool; - - /* one time apr global initialization */ - if(apr_initialize() != APR_SUCCESS) { - return 0; - } - - /* create test framework */ - test_framework = apt_test_framework_create(); - pool = apt_test_framework_pool_get(test_framework); - - /* create test suites and add them to test framework */ - test_suite = parse_gen_test_suite_create(pool); - apt_test_framework_suite_add(test_framework,test_suite); - - /* run tests */ - apt_test_framework_run(test_framework,argc,argv); - - /* destroy test framework */ - apt_test_framework_destroy(test_framework); - - /* final apr global termination */ - apr_terminate(); - return 0; -} diff --git a/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c b/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c deleted file mode 100644 index 136ded899b..0000000000 --- a/libs/unimrcp/tests/rtsptest/src/parse_gen_suite.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: parse_gen_suite.c 2249 2014-11-19 05:26:24Z achaloyan@gmail.com $ - */ - -#include -#include -#include "apt_test_suite.h" -#include "apt_log.h" -#include "rtsp_stream.h" - -static apt_bool_t test_stream_generate(rtsp_generator_t *generator, rtsp_message_t *message) -{ - char buffer[500]; - apt_text_stream_t stream; - apt_message_status_e status; - apt_bool_t continuation; - - do { - apt_text_stream_init(&stream,buffer,sizeof(buffer)-1); - continuation = FALSE; - status = rtsp_generator_run(generator,message,&stream); - if(status == APT_MESSAGE_STATUS_COMPLETE) { - stream.text.length = stream.pos - stream.text.buf; - *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Data [%"APR_SIZE_T_FMT" bytes]\n%s",stream.text.length,stream.text.buf); - } - else if(status == APT_MESSAGE_STATUS_INCOMPLETE) { - *stream.pos = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_NOTICE,"Generated RTSP Data [%"APR_SIZE_T_FMT" bytes] continuation awaited\n%s",stream.text.length,stream.text.buf); - continuation = TRUE; - } - else { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Generate RTSP Data"); - } - } - while(continuation == TRUE); - return TRUE; -} - -static apt_bool_t rtsp_message_handler(rtsp_generator_t *generator, rtsp_message_t *message, apt_message_status_e status) -{ - if(status == APT_MESSAGE_STATUS_COMPLETE) { - /* message is completely parsed */ - test_stream_generate(generator,message); - } - return TRUE; -} - -static apt_bool_t test_file_process(apt_test_suite_t *suite, const char *file_path) -{ - apr_file_t *file; - char buffer[500]; - apt_text_stream_t stream; - rtsp_parser_t *parser; - rtsp_generator_t *generator; - apr_size_t length; - apr_size_t offset; - rtsp_message_t *message; - apt_message_status_e msg_status; - - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open File [%s]",file_path); - if(apr_file_open(&file,file_path,APR_FOPEN_READ | APR_FOPEN_BINARY,APR_OS_DEFAULT,suite->pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Failed to Open File"); - return FALSE; - } - - parser = rtsp_parser_create(suite->pool); - generator = rtsp_generator_create(suite->pool); - - apt_text_stream_init(&stream,buffer,sizeof(buffer)-1); - - do { - /* calculate offset remaining from the previous receive / if any */ - offset = stream.pos - stream.text.buf; - /* calculate available length */ - length = sizeof(buffer) - 1 - offset; - - if(apr_file_read(file,stream.pos,&length) != APR_SUCCESS) { - break; - } - /* calculate actual length of the stream */ - stream.text.length = offset + length; - stream.pos[length] = '\0'; - apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Parse RTSP Data [%"APR_SIZE_T_FMT" bytes]\n%s",length,stream.pos); - - /* reset pos */ - apt_text_stream_reset(&stream); - - do { - msg_status = rtsp_parser_run(parser,&stream,&message); - rtsp_message_handler(generator,message,msg_status); - } - while(apt_text_is_eos(&stream) == FALSE); - - /* scroll remaining stream */ - apt_text_stream_scroll(&stream); - } - while(apr_file_eof(file) != APR_EOF); - - apr_file_close(file); - return TRUE; -} - -static apt_bool_t test_dir_process(apt_test_suite_t *suite) -{ - apr_status_t rv; - apr_dir_t *dir; - - const char *dir_name = "msg"; - if(apr_dir_open(&dir,dir_name,suite->pool) != APR_SUCCESS) { - apt_log(APT_LOG_MARK,APT_PRIO_WARNING,"Cannot Open Directory [%s]",dir_name); - return FALSE; - } - - do { - apr_finfo_t finfo; - rv = apr_dir_read(&finfo,APR_FINFO_DIRENT,dir); - if(rv == APR_SUCCESS) { - if(finfo.filetype == APR_REG && finfo.name) { - int ch; - char *file_path; - apr_filepath_merge(&file_path,dir_name,finfo.name,APR_FILEPATH_NATIVE,suite->pool); - test_file_process(suite,file_path); - printf("\nPress ENTER to continue\n"); - do {ch = getchar(); } while ((ch != '\n') && (ch != EOF)); - } - } - } - while(rv == APR_SUCCESS); - - apr_dir_close(dir); - return TRUE; -} - -static apt_bool_t parse_gen_test_run(apt_test_suite_t *suite, int argc, const char * const *argv) -{ - test_dir_process(suite); - return TRUE; -} - -apt_test_suite_t* parse_gen_test_suite_create(apr_pool_t *pool) -{ - apt_test_suite_t *suite = apt_test_suite_create(pool,"parse-gen",NULL,parse_gen_test_run); - return suite; -} diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_multi b/libs/unimrcp/tests/sipp/mrcp_uac_multi deleted file mode 100644 index 5b2cbdab87..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_multi +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - Call-ID: [call_id] - CSeq: 1 INVITE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 9 TCP/MRCPv2 1 - a=setup:active - a=connection:new - a=resource:speechsynth - a=cmid:1 - m=application 9 TCP/MRCPv2 1 - a=setup:active - a=connection:new - a=resource:speechrecog - a=cmid:1 - m=audio [media_port] RTP/AVP 0 8 - a=sendrecv - a=mid:1 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 1 ACK - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 2 BYE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_recog b/libs/unimrcp/tests/sipp/mrcp_uac_recog deleted file mode 100644 index 13ea1f4448..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_recog +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - Call-ID: [call_id] - CSeq: 1 INVITE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 9 TCP/MRCPv2 1 - a=setup:active - a=connection:new - a=resource:speechrecog - a=cmid:1 - m=audio [media_port] RTP/AVP 0 8 - a=sendonly - a=mid:1 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 1 ACK - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 2 BYE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_synth b/libs/unimrcp/tests/sipp/mrcp_uac_synth deleted file mode 100644 index 627c8894db..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_synth +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - Call-ID: [call_id] - CSeq: 1 INVITE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 9 TCP/MRCPv2 1 - a=setup:active - a=connection:new - a=resource:speechsynth - a=cmid:1 - m=audio [media_port] RTP/AVP 0 8 - a=recvonly - a=mid:1 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 1 ACK - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 2 BYE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_unknown b/libs/unimrcp/tests/sipp/mrcp_uac_unknown deleted file mode 100644 index 190d924491..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_unknown +++ /dev/null @@ -1,102 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - Call-ID: [call_id] - CSeq: 1 INVITE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 9 TCP/MRCPv2 1 - a=setup:active - a=connection:new - a=resource:unknown - a=cmid:1 - m=audio [media_port] RTP/AVP 0 8 - a=mid:1 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 1 ACK - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 2 BYE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uac_update b/libs/unimrcp/tests/sipp/mrcp_uac_update deleted file mode 100644 index da91fee311..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uac_update +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - - - ;tag=[call_number] - To: sut - Call-ID: [call_id] - CSeq: 1 INVITE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 9 TCP/MRCPv2 1 - a=setup:active - a=connection:new - a=resource:speechsynth - a=cmid:1 - m=audio [media_port] RTP/AVP 0 8 - a=recvonly - a=mid:1 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 1 ACK - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - - ;tag=[call_number] - To: sut - Call-ID: [call_id] - CSeq: 1 INVITE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 9 TCP/MRCPv2 1 - a=setup:active - a=connection:new - a=resource:speechsynth - a=cmid:1 - m=audio [media_port] RTP/AVP 0 8 - a=sendrecv - a=mid:1 - m=application 9 TCP/MRCPv2 1 - a=setup:active - a=connection:existing - a=resource:speechrecog - a=cmid:1 - - ]]> - - - - - - - - - - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 1 ACK - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - - ;tag=[call_number] - To: sut [peer_tag_param] - Call-ID: [call_id] - CSeq: 2 BYE - Contact: sip:sipp@[local_ip]:[local_port] - Max-Forwards: 70 - Subject: Performance Test - Content-Length: 0 - - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uas_recog b/libs/unimrcp/tests/sipp/mrcp_uas_recog deleted file mode 100644 index 27bc361a5d..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uas_recog +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 1050 TCP/MRCPv2 1 - a=setup:passive - a=connection:new - a=channel:dca48cf082dd584b@speechrecog - a=cmid:1 - m=audio [media_port] RTP/AVP 0 8 - a=recvonly - a=mid:1 - - ]]> - - - - - - - - - - - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 0 TCP/MRCPv2 1 - a=setup:passive - a=connection:existing - a=channel:dca48cf082dd584b@speechrecog - a=cmid:1 - m=audio 0 RTP/AVP 0 8 - a=recvonly - a=mid:1 - - ]]> - - - - - - - - - - - Content-Length: 0 - - ]]> - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uas_reject b/libs/unimrcp/tests/sipp/mrcp_uas_reject deleted file mode 100644 index 5f6af6b117..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uas_reject +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Content-Length: 0 - ]]> - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uas_synth b/libs/unimrcp/tests/sipp/mrcp_uas_synth deleted file mode 100644 index b2400aaddd..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uas_synth +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 1050 TCP/MRCPv2 1 - a=setup:passive - a=connection:new - a=channel:dca48cf082dd584b@speechsynth - a=cmid:1 - m=audio [media_port] RTP/AVP 0 8 - a=sendonly - a=mid:1 - - ]]> - - - - - - - - - - - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 0 TCP/MRCPv2 1 - a=setup:passive - a=connection:existing - a=channel:dca48cf082dd584b@speechsynth - a=cmid:1 - m=audio 0 RTP/AVP 0 8 - a=sendonly - a=mid:1 - - ]]> - - - - - - - - - - - Content-Length: 0 - - ]]> - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/sipp/mrcp_uas_unknown b/libs/unimrcp/tests/sipp/mrcp_uas_unknown deleted file mode 100644 index e3a1b1e50d..0000000000 --- a/libs/unimrcp/tests/sipp/mrcp_uas_unknown +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - Content-Type: application/sdp - Content-Length: [len] - - v=0 - o=user1 53655765 2353687637 IN IP4 [local_ip] - s=- - c=IN IP4 [media_ip] - t=0 0 - m=application 0 TCP/MRCPv2 1 - a=setup:passive - a=connection:new - a=channel:dca48cf082dd584b@unknown - a=cmid:1 - m=audio 0 RTP/AVP 0 8 - a=sendonly - a=mid:1 - - ]]> - - - - - - - - - - - Content-Length: 0 - - ]]> - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/strtablegen/Makefile.am b/libs/unimrcp/tests/strtablegen/Makefile.am deleted file mode 100644 index 5ffb011dc7..0000000000 --- a/libs/unimrcp/tests/strtablegen/Makefile.am +++ /dev/null @@ -1,9 +0,0 @@ -MAINTAINERCLEANFILES = Makefile.in - -AM_CPPFLAGS = -I$(top_srcdir)/libs/apr-toolkit/include \ - $(UNIMRCP_APR_INCLUDES) - -noinst_PROGRAMS = strtablegen -strtablegen_LDADD = $(top_builddir)/libs/apr-toolkit/libaprtoolkit.la \ - $(UNIMRCP_APR_LIBS) -strtablegen_SOURCES = src/main.c diff --git a/libs/unimrcp/tests/strtablegen/src/main.c b/libs/unimrcp/tests/strtablegen/src/main.c deleted file mode 100644 index ef82abc796..0000000000 --- a/libs/unimrcp/tests/strtablegen/src/main.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2008-2014 Arsen Chaloyan - * - * 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. - * - * $Id: main.c 2136 2014-07-04 06:33:36Z achaloyan@gmail.com $ - */ - -#include -#include -#include "apt_pool.h" -#include "apt_string_table.h" -#include "apt_text_stream.h" - -static apt_bool_t is_unique(const apt_str_table_item_t table[], apr_size_t count, - apr_size_t item_index, apr_size_t char_index, char value) -{ - size_t i; - const char *buf; - for(i=0; ivalue,&line,pool); - item->key = 0; - count++; - } - while(count < max_count); - - return count; -} - -static apt_bool_t string_table_write(const apt_str_table_item_t table[], apr_size_t count, FILE *file) -{ - size_t i; - const apt_str_table_item_t *item; - for(i=0; ivalue.buf, item->value.length, item->key); - } - return TRUE; -} - -int main(int argc, char *argv[]) -{ - apr_pool_t *pool = NULL; - apt_str_table_item_t table[100]; - size_t count; - FILE *file_in, *file_out; - - /* one time apr global initialization */ - if(apr_initialize() != APR_SUCCESS) { - return 0; - } - pool = apt_pool_create(); - - if(argc < 2) { - printf("usage: stringtablegen stringtable.in [stringtable.out]\n"); - return 0; - } - file_in = fopen(argv[1], "rb"); - if(file_in == NULL) { - printf("cannot open file %s\n", argv[1]); - return 0; - } - - if(argc > 2) { - file_out = fopen(argv[2], "wb"); - } - else { - file_out = stdout; - } - - /* read items (strings) from the file */ - count = string_table_read(table,100,file_in,pool); - - /* generate string table */ - string_table_key_generate(table,count); - - /* dump string table to the file */ - string_table_write(table,count,file_out); - - fclose(file_in); - if(file_out != stdout) { - fclose(file_out); - } - - apr_pool_destroy(pool); - /* final apr global termination */ - apr_terminate(); - return 0; -} diff --git a/libs/unimrcp/tests/strtablegen/stringtable.in b/libs/unimrcp/tests/strtablegen/stringtable.in deleted file mode 100644 index 7f045949cd..0000000000 --- a/libs/unimrcp/tests/strtablegen/stringtable.in +++ /dev/null @@ -1,12 +0,0 @@ -Channel-Identifier -Active-Request-Id-List -Proxy-Sync-Id -Accept-Charset -Content-Type -Content-Id -Content-Base -Content-Encoding -Content-Location -Content-Length -Cache-Control -Logging-Tag diff --git a/libs/unimrcp/tests/strtablegen/strtablegen.vcproj b/libs/unimrcp/tests/strtablegen/strtablegen.vcproj deleted file mode 100644 index 72d6686182..0000000000 --- a/libs/unimrcp/tests/strtablegen/strtablegen.vcproj +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj b/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj deleted file mode 100644 index 11845bbc67..0000000000 --- a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj +++ /dev/null @@ -1,124 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872} - strtablegen - - - - Application - - - Application - - - Application - - - Application - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - AllRules.ruleset - - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - X64 - - - ProgramDatabase - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - - - - - X64 - - - aprtoolkit.lib;libaprutil-1.lib;libapr-1.lib;%(AdditionalDependencies) - UseLinkTimeCodeGeneration - - - - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - - - - \ No newline at end of file diff --git a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj.filters b/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj.filters deleted file mode 100644 index 3efc5f63ae..0000000000 --- a/libs/unimrcp/tests/strtablegen/strtablegen.vcxproj.filters +++ /dev/null @@ -1,18 +0,0 @@ - - - - - {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 - - - - - src - - - \ No newline at end of file diff --git a/libs/unimrcp/unimrcp-2010.sln b/libs/unimrcp/unimrcp-2010.sln deleted file mode 100644 index 957d126a62..0000000000 --- a/libs/unimrcp/unimrcp-2010.sln +++ /dev/null @@ -1,358 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual Studio 2010 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{5377DC3A-DB96-4819-8AAF-2A75F3A69119}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "platforms", "platforms", "{8E282AE2-038C-49FE-AC67-BC9615AFD800}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{09BABD45-8F30-4F99-B8B8-8DD78F6804DB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{62083CC3-13BF-49EA-BFE8-4C9337C0D82C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "conf", "conf", "{9155EBB8-E7DD-49AE-A86A-7B90B9F09888}" - ProjectSection(SolutionItems) = preProject - conf\logger.xml = conf\logger.xml - conf\unimrcpclient.xml = conf\unimrcpclient.xml - conf\unimrcpclient.xsd = conf\unimrcpclient.xsd - conf\unimrcpserver.xml = conf\unimrcpserver.xml - conf\unimrcpserver.xsd = conf\unimrcpserver.xsd - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client-profiles", "client-profiles", "{F2D6C1AF-0C05-4695-84AF-15A2F92F9899}" - ProjectSection(SolutionItems) = preProject - conf\client-profiles\lumenvox.xml = conf\client-profiles\lumenvox.xml - conf\client-profiles\nuance.xml = conf\client-profiles\nuance.xml - conf\client-profiles\unimrcp.xml = conf\client-profiles\unimrcp.xml - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpserver", "platforms\unimrcp-server\unimrcpserver.vcxproj", "{592CF22D-3F8F-4A77-A174-130D77B7623B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aprtoolkit", "libs\apr-toolkit\aprtoolkit.vcxproj", "{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpf", "libs\mpf\mpf.vcxproj", "{B5A00BFA-6083-4FAE-A097-71642D6473B5}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcp", "libs\mrcp\mrcp.vcxproj", "{1C320193-46A6-4B34-9C56-8AB584FC1B56}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsignaling", "libs\mrcp-signaling\mrcpsignaling.vcxproj", "{12A49562-BAB9-43A3-A21D-15B60BBB4C31}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpserver", "libs\mrcp-server\mrcpserver.vcxproj", "{18B1F35A-10F8-4287-9B37-2D10501B0B38}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpserver", "platforms\libunimrcp-server\libunimrcpserver.vcxproj", "{C98AF157-352E-4737-BD30-A24E2647F5AE}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "modules\mrcp-sofiasip\mrcpsofiasip.vcxproj", "{746F3632-5BB2-4570-9453-31D6D58A7D8E}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpclient", "libs\mrcp-client\mrcpclient.vcxproj", "{72782932-37CC-46AE-8C7F-9A7B1A6EE108}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpclient", "platforms\libunimrcp-client\libunimrcpclient.vcxproj", "{EE157390-1E85-416C-946E-620E32C9AD33}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpclient", "platforms\unimrcp-client\unimrcpclient.vcxproj", "{57FAF32E-49FD-491F-895D-132D0D5EFE0A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpv2transport", "libs\mrcpv2-transport\mrcpv2transport.vcxproj", "{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpengine", "libs\mrcp-engine\mrcpengine.vcxproj", "{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demosynth", "plugins\demo-synth\demosynth.vcxproj", "{92BFA534-C419-4EB2-AAA3-510653F38F08}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demorecog", "plugins\demo-recog\demorecog.vcxproj", "{B495B6D9-AF84-479D-B30A-313C16EF8BFD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strtablegen", "tests\strtablegen\strtablegen.vcxproj", "{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "apttest", "tests\apttest\apttest.vcxproj", "{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpftest", "tests\mpftest\mpftest.vcxproj", "{DCF01B1C-5268-44F3-9130-D647FABFB663}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcptest", "tests\mrcptest\mrcptest.vcxproj", "{3CA97077-6210-4362-998A-D15A35EEAA08}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unirtsp", "libs\uni-rtsp\unirtsp.vcxproj", "{504B3154-7A4F-459D-9877-B951021C3F1F}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtsptest", "tests\rtsptest\rtsptest.vcxproj", "{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpunirtsp", "modules\mrcp-unirtsp\mrcpunirtsp.vcxproj", "{DEB01ACB-D65F-4A62-AED9-58C1054499E9}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prepare", "build\tools\prepare.vcxproj", "{01D63BF5-7798-4746-852A-4B45229BB735}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpservice", "build\tools\unimrcpservice.vcxproj", "{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asrclient", "platforms\asr-client\asrclient.vcxproj", "{6B83AC6D-01CE-4E1C-81CE-02AD8116C684}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libasrclient", "platforms\libasr-client\libasrclient.vcxproj", "{272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "umc", "platforms\umc\umc.vcxproj", "{CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcprecorder", "plugins\mrcp-recorder\mrcprecorder.vcxproj", "{5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demoverifier", "plugins\demo-verifier\demoverifier.vcxproj", "{F7563CAD-5C95-46E5-89B7-0953C6C6E746}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.ActiveCfg = Debug|Win32 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.Build.0 = Debug|Win32 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|x64.ActiveCfg = Debug|x64 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|x64.Build.0 = Debug|x64 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.ActiveCfg = Release|Win32 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.Build.0 = Release|Win32 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|x64.ActiveCfg = Release|x64 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|x64.Build.0 = Release|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.ActiveCfg = Debug|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.Build.0 = Debug|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.ActiveCfg = Debug|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.Build.0 = Debug|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.ActiveCfg = Release|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.Build.0 = Release|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.ActiveCfg = Release|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.Build.0 = Release|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.ActiveCfg = Debug|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.Build.0 = Debug|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.ActiveCfg = Debug|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.Build.0 = Debug|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.ActiveCfg = Release|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.Build.0 = Release|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.ActiveCfg = Release|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.Build.0 = Release|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.ActiveCfg = Debug|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.Build.0 = Debug|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.ActiveCfg = Debug|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.Build.0 = Debug|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.ActiveCfg = Release|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.Build.0 = Release|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.ActiveCfg = Release|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.Build.0 = Release|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.ActiveCfg = Debug|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.Build.0 = Debug|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.ActiveCfg = Debug|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.Build.0 = Debug|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.ActiveCfg = Release|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.Build.0 = Release|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.ActiveCfg = Release|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.Build.0 = Release|x64 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.ActiveCfg = Debug|Win32 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.Build.0 = Debug|Win32 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|x64.ActiveCfg = Debug|x64 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|x64.Build.0 = Debug|x64 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.ActiveCfg = Release|Win32 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.Build.0 = Release|Win32 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|x64.ActiveCfg = Release|x64 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|x64.Build.0 = Release|x64 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.ActiveCfg = Debug|Win32 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.Build.0 = Debug|Win32 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|x64.ActiveCfg = Debug|x64 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|x64.Build.0 = Debug|x64 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.ActiveCfg = Release|Win32 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.Build.0 = Release|Win32 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|x64.ActiveCfg = Release|x64 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|x64.Build.0 = Release|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.ActiveCfg = Debug|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.Build.0 = Debug|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.ActiveCfg = Debug|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.Build.0 = Debug|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.ActiveCfg = Release|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.Build.0 = Release|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.ActiveCfg = Release|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.Build.0 = Release|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.ActiveCfg = Debug|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.Build.0 = Debug|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.ActiveCfg = Debug|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.Build.0 = Debug|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.ActiveCfg = Release|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.Build.0 = Release|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.ActiveCfg = Release|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.Build.0 = Release|x64 - {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.ActiveCfg = Debug|Win32 - {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.Build.0 = Debug|Win32 - {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|x64.ActiveCfg = Debug|x64 - {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|x64.Build.0 = Debug|x64 - {EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.ActiveCfg = Release|Win32 - {EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.Build.0 = Release|Win32 - {EE157390-1E85-416C-946E-620E32C9AD33}.Release|x64.ActiveCfg = Release|x64 - {EE157390-1E85-416C-946E-620E32C9AD33}.Release|x64.Build.0 = Release|x64 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.ActiveCfg = Debug|Win32 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.Build.0 = Debug|Win32 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|x64.ActiveCfg = Debug|x64 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|x64.Build.0 = Debug|x64 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.ActiveCfg = Release|Win32 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.Build.0 = Release|Win32 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|x64.ActiveCfg = Release|x64 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|x64.Build.0 = Release|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.ActiveCfg = Debug|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.Build.0 = Debug|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.ActiveCfg = Debug|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.Build.0 = Debug|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.ActiveCfg = Release|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.Build.0 = Release|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.ActiveCfg = Release|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.Build.0 = Release|x64 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.ActiveCfg = Debug|Win32 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.Build.0 = Debug|Win32 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|x64.ActiveCfg = Debug|x64 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|x64.Build.0 = Debug|x64 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.ActiveCfg = Release|Win32 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.Build.0 = Release|Win32 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|x64.ActiveCfg = Release|x64 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|x64.Build.0 = Release|x64 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.ActiveCfg = Debug|Win32 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.Build.0 = Debug|Win32 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|x64.ActiveCfg = Debug|x64 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|x64.Build.0 = Debug|x64 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.ActiveCfg = Release|Win32 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.Build.0 = Release|Win32 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|x64.ActiveCfg = Release|x64 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|x64.Build.0 = Release|x64 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.ActiveCfg = Debug|Win32 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.Build.0 = Debug|Win32 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|x64.ActiveCfg = Debug|x64 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|x64.Build.0 = Debug|x64 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.ActiveCfg = Release|Win32 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.Build.0 = Release|Win32 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|x64.ActiveCfg = Release|x64 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|x64.Build.0 = Release|x64 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.ActiveCfg = Debug|Win32 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.Build.0 = Debug|Win32 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|x64.ActiveCfg = Debug|x64 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|x64.Build.0 = Debug|x64 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.ActiveCfg = Release|Win32 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.Build.0 = Release|Win32 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|x64.ActiveCfg = Release|x64 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|x64.Build.0 = Release|x64 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.ActiveCfg = Debug|Win32 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.Build.0 = Debug|Win32 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|x64.ActiveCfg = Debug|x64 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|x64.Build.0 = Debug|x64 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.ActiveCfg = Release|Win32 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.Build.0 = Release|Win32 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|x64.ActiveCfg = Release|x64 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|x64.Build.0 = Release|x64 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.ActiveCfg = Debug|Win32 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.Build.0 = Debug|Win32 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|x64.ActiveCfg = Debug|x64 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|x64.Build.0 = Debug|x64 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.ActiveCfg = Release|Win32 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.Build.0 = Release|Win32 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|x64.ActiveCfg = Release|x64 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|x64.Build.0 = Release|x64 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.ActiveCfg = Debug|Win32 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.Build.0 = Debug|Win32 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|x64.ActiveCfg = Debug|x64 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|x64.Build.0 = Debug|x64 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.ActiveCfg = Release|Win32 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.Build.0 = Release|Win32 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|x64.ActiveCfg = Release|x64 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|x64.Build.0 = Release|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.ActiveCfg = Debug|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.Build.0 = Debug|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.ActiveCfg = Debug|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.Build.0 = Debug|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.ActiveCfg = Release|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.Build.0 = Release|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.ActiveCfg = Release|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.Build.0 = Release|x64 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.ActiveCfg = Debug|Win32 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.Build.0 = Debug|Win32 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|x64.ActiveCfg = Debug|x64 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|x64.Build.0 = Debug|x64 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.ActiveCfg = Release|Win32 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.Build.0 = Release|Win32 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|x64.ActiveCfg = Release|x64 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|x64.Build.0 = Release|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.ActiveCfg = Debug|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.Build.0 = Debug|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.ActiveCfg = Debug|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.Build.0 = Debug|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.ActiveCfg = Release|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.Build.0 = Release|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.ActiveCfg = Release|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.Build.0 = Release|x64 - {01D63BF5-7798-4746-852A-4B45229BB735}.Debug|Win32.ActiveCfg = Debug|Win32 - {01D63BF5-7798-4746-852A-4B45229BB735}.Debug|x64.ActiveCfg = Debug|x64 - {01D63BF5-7798-4746-852A-4B45229BB735}.Release|Win32.ActiveCfg = Release|Win32 - {01D63BF5-7798-4746-852A-4B45229BB735}.Release|x64.ActiveCfg = Release|x64 - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|Win32.ActiveCfg = Debug|Win32 - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|x64.ActiveCfg = Debug|x64 - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|Win32.ActiveCfg = Release|Win32 - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|x64.ActiveCfg = Release|x64 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|Win32.ActiveCfg = Debug|Win32 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|Win32.Build.0 = Debug|Win32 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|x64.ActiveCfg = Debug|x64 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|x64.Build.0 = Debug|x64 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|Win32.ActiveCfg = Release|Win32 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|Win32.Build.0 = Release|Win32 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|x64.ActiveCfg = Release|x64 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|x64.Build.0 = Release|x64 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|Win32.ActiveCfg = Debug|Win32 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|Win32.Build.0 = Debug|Win32 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|x64.ActiveCfg = Debug|x64 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|x64.Build.0 = Debug|x64 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|Win32.ActiveCfg = Release|Win32 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|Win32.Build.0 = Release|Win32 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|x64.ActiveCfg = Release|x64 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|x64.Build.0 = Release|x64 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|Win32.ActiveCfg = Debug|Win32 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|Win32.Build.0 = Debug|Win32 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|x64.ActiveCfg = Debug|x64 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|x64.Build.0 = Debug|x64 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|Win32.ActiveCfg = Release|Win32 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|Win32.Build.0 = Release|Win32 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|x64.ActiveCfg = Release|x64 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|x64.Build.0 = Release|x64 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|Win32.ActiveCfg = Debug|Win32 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|Win32.Build.0 = Debug|Win32 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|x64.ActiveCfg = Debug|x64 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|x64.Build.0 = Debug|x64 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|Win32.ActiveCfg = Release|Win32 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|Win32.Build.0 = Release|Win32 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|x64.ActiveCfg = Release|x64 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|x64.Build.0 = Release|x64 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|Win32.ActiveCfg = Debug|Win32 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|Win32.Build.0 = Debug|Win32 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|x64.ActiveCfg = Debug|x64 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|x64.Build.0 = Debug|x64 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|Win32.ActiveCfg = Release|Win32 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|Win32.Build.0 = Release|Win32 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|x64.ActiveCfg = Release|x64 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {18B1F35A-10F8-4287-9B37-2D10501B0B38} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {504B3154-7A4F-459D-9877-B951021C3F1F} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF} - {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF} - {592CF22D-3F8F-4A77-A174-130D77B7623B} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {C98AF157-352E-4737-BD30-A24E2647F5AE} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {EE157390-1E85-416C-946E-620E32C9AD33} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {57FAF32E-49FD-491F-895D-132D0D5EFE0A} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {92BFA534-C419-4EB2-AAA3-510653F38F08} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB} - {B495B6D9-AF84-479D-B30A-313C16EF8BFD} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB} - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB} - {F7563CAD-5C95-46E5-89B7-0953C6C6E746} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB} - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {DCF01B1C-5268-44F3-9130-D647FABFB663} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {3CA97077-6210-4362-998A-D15A35EEAA08} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {01D63BF5-7798-4746-852A-4B45229BB735} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C} - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C} - {F2D6C1AF-0C05-4695-84AF-15A2F92F9899} = {9155EBB8-E7DD-49AE-A86A-7B90B9F09888} - EndGlobalSection -EndGlobal diff --git a/libs/unimrcp/unimrcp.sln b/libs/unimrcp/unimrcp.sln deleted file mode 100644 index 10b74f6232..0000000000 --- a/libs/unimrcp/unimrcp.sln +++ /dev/null @@ -1,447 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "libs", "libs", "{5377DC3A-DB96-4819-8AAF-2A75F3A69119}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "modules", "modules", "{493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "platforms", "platforms", "{8E282AE2-038C-49FE-AC67-BC9615AFD800}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "plugins", "plugins", "{09BABD45-8F30-4F99-B8B8-8DD78F6804DB}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{AC4356E8-48A1-4D2D-AFB1-11CF30B974CD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpserver", "platforms\unimrcp-server\unimrcpserver.vcproj", "{592CF22D-3F8F-4A77-A174-130D77B7623B}" - ProjectSection(ProjectDependencies) = postProject - {C98AF157-352E-4737-BD30-A24E2647F5AE} = {C98AF157-352E-4737-BD30-A24E2647F5AE} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aprtoolkit", "libs\apr-toolkit\aprtoolkit.vcproj", "{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpf", "libs\mpf\mpf.vcproj", "{B5A00BFA-6083-4FAE-A097-71642D6473B5}" - ProjectSection(ProjectDependencies) = postProject - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcp", "libs\mrcp\mrcp.vcproj", "{1C320193-46A6-4B34-9C56-8AB584FC1B56}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsignaling", "libs\mrcp-signaling\mrcpsignaling.vcproj", "{12A49562-BAB9-43A3-A21D-15B60BBB4C31}" - ProjectSection(ProjectDependencies) = postProject - {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5} - {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpserver", "libs\mrcp-server\mrcpserver.vcproj", "{18B1F35A-10F8-4287-9B37-2D10501B0B38}" - ProjectSection(ProjectDependencies) = postProject - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31} - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpserver", "platforms\libunimrcp-server\libunimrcpserver.vcproj", "{C98AF157-352E-4737-BD30-A24E2647F5AE}" - ProjectSection(ProjectDependencies) = postProject - {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9} - {18B1F35A-10F8-4287-9B37-2D10501B0B38} = {18B1F35A-10F8-4287-9B37-2D10501B0B38} - {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "modules\mrcp-sofiasip\mrcpsofiasip.vcproj", "{746F3632-5BB2-4570-9453-31D6D58A7D8E}" - ProjectSection(ProjectDependencies) = postProject - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31} - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpclient", "libs\mrcp-client\mrcpclient.vcproj", "{72782932-37CC-46AE-8C7F-9A7B1A6EE108}" - ProjectSection(ProjectDependencies) = postProject - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31} - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libunimrcpclient", "platforms\libunimrcp-client\libunimrcpclient.vcproj", "{EE157390-1E85-416C-946E-620E32C9AD33}" - ProjectSection(ProjectDependencies) = postProject - {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {DEB01ACB-D65F-4A62-AED9-58C1054499E9} - {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {746F3632-5BB2-4570-9453-31D6D58A7D8E} - {72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {72782932-37CC-46AE-8C7F-9A7B1A6EE108} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpclient", "platforms\unimrcp-client\unimrcpclient.vcproj", "{57FAF32E-49FD-491F-895D-132D0D5EFE0A}" - ProjectSection(ProjectDependencies) = postProject - {EE157390-1E85-416C-946E-620E32C9AD33} = {EE157390-1E85-416C-946E-620E32C9AD33} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpv2transport", "libs\mrcpv2-transport\mrcpv2transport.vcproj", "{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}" - ProjectSection(ProjectDependencies) = postProject - {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpengine", "libs\mrcp-engine\mrcpengine.vcproj", "{843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}" - ProjectSection(ProjectDependencies) = postProject - {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5} - {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demosynth", "plugins\demo-synth\demosynth.vcproj", "{92BFA534-C419-4EB2-AAA3-510653F38F08}" - ProjectSection(ProjectDependencies) = postProject - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demorecog", "plugins\demo-recog\demorecog.vcproj", "{B495B6D9-AF84-479D-B30A-313C16EF8BFD}" - ProjectSection(ProjectDependencies) = postProject - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "strtablegen", "tests\strtablegen\strtablegen.vcproj", "{79EF9F1D-E211-4ED1-91D2-FC935AB3A872}" - ProjectSection(ProjectDependencies) = postProject - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "apttest", "tests\apttest\apttest.vcproj", "{429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}" - ProjectSection(ProjectDependencies) = postProject - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpftest", "tests\mpftest\mpftest.vcproj", "{DCF01B1C-5268-44F3-9130-D647FABFB663}" - ProjectSection(ProjectDependencies) = postProject - {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {B5A00BFA-6083-4FAE-A097-71642D6473B5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcptest", "tests\mrcptest\mrcptest.vcproj", "{3CA97077-6210-4362-998A-D15A35EEAA08}" - ProjectSection(ProjectDependencies) = postProject - {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {1C320193-46A6-4B34-9C56-8AB584FC1B56} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{62083CC3-13BF-49EA-BFE8-4C9337C0D82C}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unirtsp", "libs\uni-rtsp\unirtsp.vcproj", "{504B3154-7A4F-459D-9877-B951021C3F1F}" - ProjectSection(ProjectDependencies) = postProject - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "rtsptest", "tests\rtsptest\rtsptest.vcproj", "{17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}" - ProjectSection(ProjectDependencies) = postProject - {504B3154-7A4F-459D-9877-B951021C3F1F} = {504B3154-7A4F-459D-9877-B951021C3F1F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpunirtsp", "modules\mrcp-unirtsp\mrcpunirtsp.vcproj", "{DEB01ACB-D65F-4A62-AED9-58C1054499E9}" - ProjectSection(ProjectDependencies) = postProject - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {12A49562-BAB9-43A3-A21D-15B60BBB4C31} - {504B3154-7A4F-459D-9877-B951021C3F1F} = {504B3154-7A4F-459D-9877-B951021C3F1F} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "prepare", "build\tools\prepare.vcproj", "{01D63BF5-7798-4746-852A-4B45229BB735}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unimrcpservice", "build\tools\unimrcpservice.vcproj", "{4714EF49-BFD5-4B22-95F7-95A07F1EAC25}" - ProjectSection(ProjectDependencies) = postProject - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "asrclient", "platforms\asr-client\asrclient.vcproj", "{6B83AC6D-01CE-4E1C-81CE-02AD8116C684}" - ProjectSection(ProjectDependencies) = postProject - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} = {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libasrclient", "platforms\libasr-client\libasrclient.vcproj", "{272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}" - ProjectSection(ProjectDependencies) = postProject - {EE157390-1E85-416C-946E-620E32C9AD33} = {EE157390-1E85-416C-946E-620E32C9AD33} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "umc", "platforms\umc\umc.vcproj", "{CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}" - ProjectSection(ProjectDependencies) = postProject - {EE157390-1E85-416C-946E-620E32C9AD33} = {EE157390-1E85-416C-946E-620E32C9AD33} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcprecorder", "plugins\mrcp-recorder\mrcprecorder.vcproj", "{5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}" - ProjectSection(ProjectDependencies) = postProject - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "conf", "conf", "{9155EBB8-E7DD-49AE-A86A-7B90B9F09888}" - ProjectSection(SolutionItems) = preProject - conf\logger.xml = conf\logger.xml - conf\unimrcpclient.xml = conf\unimrcpclient.xml - conf\unimrcpclient.xsd = conf\unimrcpclient.xsd - conf\unimrcpserver.xml = conf\unimrcpserver.xml - conf\unimrcpserver.xsd = conf\unimrcpserver.xsd - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "client-profiles", "client-profiles", "{F2D6C1AF-0C05-4695-84AF-15A2F92F9899}" - ProjectSection(SolutionItems) = preProject - conf\client-profiles\lumenvox.xml = conf\client-profiles\lumenvox.xml - conf\client-profiles\nuance.xml = conf\client-profiles\nuance.xml - conf\client-profiles\unimrcp.xml = conf\client-profiles\unimrcp.xml - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "demoverifier", "plugins\demo-verifier\demoverifier.vcproj", "{F7563CAD-5C95-46E5-89B7-0953C6C6E746}" - ProjectSection(ProjectDependencies) = postProject - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.ActiveCfg = Debug|Win32 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|Win32.Build.0 = Debug|Win32 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|x64.ActiveCfg = Debug|x64 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Debug|x64.Build.0 = Debug|x64 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.ActiveCfg = Release|Win32 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|Win32.Build.0 = Release|Win32 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|x64.ActiveCfg = Release|x64 - {592CF22D-3F8F-4A77-A174-130D77B7623B}.Release|x64.Build.0 = Release|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.ActiveCfg = Debug|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.Build.0 = Debug|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.ActiveCfg = Debug|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.Build.0 = Debug|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.ActiveCfg = Release|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.Build.0 = Release|Win32 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.ActiveCfg = Release|x64 - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.Build.0 = Release|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.ActiveCfg = Debug|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.Build.0 = Debug|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.ActiveCfg = Debug|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.Build.0 = Debug|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.ActiveCfg = Release|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.Build.0 = Release|Win32 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.ActiveCfg = Release|x64 - {B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.Build.0 = Release|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.ActiveCfg = Debug|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.Build.0 = Debug|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.ActiveCfg = Debug|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.Build.0 = Debug|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.ActiveCfg = Release|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.Build.0 = Release|Win32 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.ActiveCfg = Release|x64 - {1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.Build.0 = Release|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.ActiveCfg = Debug|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.Build.0 = Debug|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.ActiveCfg = Debug|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.Build.0 = Debug|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.ActiveCfg = Release|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.Build.0 = Release|Win32 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.ActiveCfg = Release|x64 - {12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.Build.0 = Release|x64 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.ActiveCfg = Debug|Win32 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|Win32.Build.0 = Debug|Win32 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|x64.ActiveCfg = Debug|x64 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Debug|x64.Build.0 = Debug|x64 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.ActiveCfg = Release|Win32 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|Win32.Build.0 = Release|Win32 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|x64.ActiveCfg = Release|x64 - {18B1F35A-10F8-4287-9B37-2D10501B0B38}.Release|x64.Build.0 = Release|x64 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.ActiveCfg = Debug|Win32 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|Win32.Build.0 = Debug|Win32 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|x64.ActiveCfg = Debug|x64 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Debug|x64.Build.0 = Debug|x64 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.ActiveCfg = Release|Win32 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|Win32.Build.0 = Release|Win32 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|x64.ActiveCfg = Release|x64 - {C98AF157-352E-4737-BD30-A24E2647F5AE}.Release|x64.Build.0 = Release|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.ActiveCfg = Debug|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.Build.0 = Debug|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.ActiveCfg = Debug|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.Build.0 = Debug|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.ActiveCfg = Release|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.Build.0 = Release|Win32 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.ActiveCfg = Release|x64 - {746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.Build.0 = Release|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.ActiveCfg = Debug|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.Build.0 = Debug|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.ActiveCfg = Debug|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.Build.0 = Debug|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.ActiveCfg = Release|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.Build.0 = Release|Win32 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.ActiveCfg = Release|x64 - {72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.Build.0 = Release|x64 - {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.ActiveCfg = Debug|Win32 - {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|Win32.Build.0 = Debug|Win32 - {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|x64.ActiveCfg = Debug|x64 - {EE157390-1E85-416C-946E-620E32C9AD33}.Debug|x64.Build.0 = Debug|x64 - {EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.ActiveCfg = Release|Win32 - {EE157390-1E85-416C-946E-620E32C9AD33}.Release|Win32.Build.0 = Release|Win32 - {EE157390-1E85-416C-946E-620E32C9AD33}.Release|x64.ActiveCfg = Release|x64 - {EE157390-1E85-416C-946E-620E32C9AD33}.Release|x64.Build.0 = Release|x64 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.ActiveCfg = Debug|Win32 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|Win32.Build.0 = Debug|Win32 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|x64.ActiveCfg = Debug|x64 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Debug|x64.Build.0 = Debug|x64 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.ActiveCfg = Release|Win32 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|Win32.Build.0 = Release|Win32 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|x64.ActiveCfg = Release|x64 - {57FAF32E-49FD-491F-895D-132D0D5EFE0A}.Release|x64.Build.0 = Release|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.ActiveCfg = Debug|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.Build.0 = Debug|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.ActiveCfg = Debug|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.Build.0 = Debug|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.ActiveCfg = Release|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.Build.0 = Release|Win32 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.ActiveCfg = Release|x64 - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.Build.0 = Release|x64 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.ActiveCfg = Debug|Win32 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|Win32.Build.0 = Debug|Win32 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|x64.ActiveCfg = Debug|x64 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Debug|x64.Build.0 = Debug|x64 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.ActiveCfg = Release|Win32 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|Win32.Build.0 = Release|Win32 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|x64.ActiveCfg = Release|x64 - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C}.Release|x64.Build.0 = Release|x64 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.ActiveCfg = Debug|Win32 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|Win32.Build.0 = Debug|Win32 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|x64.ActiveCfg = Debug|x64 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Debug|x64.Build.0 = Debug|x64 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.ActiveCfg = Release|Win32 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|Win32.Build.0 = Release|Win32 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|x64.ActiveCfg = Release|x64 - {92BFA534-C419-4EB2-AAA3-510653F38F08}.Release|x64.Build.0 = Release|x64 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.ActiveCfg = Debug|Win32 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|Win32.Build.0 = Debug|Win32 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|x64.ActiveCfg = Debug|x64 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Debug|x64.Build.0 = Debug|x64 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.ActiveCfg = Release|Win32 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|Win32.Build.0 = Release|Win32 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|x64.ActiveCfg = Release|x64 - {B495B6D9-AF84-479D-B30A-313C16EF8BFD}.Release|x64.Build.0 = Release|x64 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.ActiveCfg = Debug|Win32 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|Win32.Build.0 = Debug|Win32 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|x64.ActiveCfg = Debug|x64 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Debug|x64.Build.0 = Debug|x64 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.ActiveCfg = Release|Win32 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|Win32.Build.0 = Release|Win32 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|x64.ActiveCfg = Release|x64 - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872}.Release|x64.Build.0 = Release|x64 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.ActiveCfg = Debug|Win32 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|Win32.Build.0 = Debug|Win32 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|x64.ActiveCfg = Debug|x64 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Debug|x64.Build.0 = Debug|x64 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.ActiveCfg = Release|Win32 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|Win32.Build.0 = Release|Win32 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|x64.ActiveCfg = Release|x64 - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15}.Release|x64.Build.0 = Release|x64 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.ActiveCfg = Debug|Win32 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|Win32.Build.0 = Debug|Win32 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|x64.ActiveCfg = Debug|x64 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Debug|x64.Build.0 = Debug|x64 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.ActiveCfg = Release|Win32 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|Win32.Build.0 = Release|Win32 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|x64.ActiveCfg = Release|x64 - {DCF01B1C-5268-44F3-9130-D647FABFB663}.Release|x64.Build.0 = Release|x64 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.ActiveCfg = Debug|Win32 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|Win32.Build.0 = Debug|Win32 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|x64.ActiveCfg = Debug|x64 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Debug|x64.Build.0 = Debug|x64 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.ActiveCfg = Release|Win32 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|Win32.Build.0 = Release|Win32 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|x64.ActiveCfg = Release|x64 - {3CA97077-6210-4362-998A-D15A35EEAA08}.Release|x64.Build.0 = Release|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.ActiveCfg = Debug|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.Build.0 = Debug|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.ActiveCfg = Debug|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.Build.0 = Debug|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.ActiveCfg = Release|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.Build.0 = Release|Win32 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.ActiveCfg = Release|x64 - {504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.Build.0 = Release|x64 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.ActiveCfg = Debug|Win32 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|Win32.Build.0 = Debug|Win32 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|x64.ActiveCfg = Debug|x64 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Debug|x64.Build.0 = Debug|x64 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.ActiveCfg = Release|Win32 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|Win32.Build.0 = Release|Win32 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|x64.ActiveCfg = Release|x64 - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335}.Release|x64.Build.0 = Release|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.ActiveCfg = Debug|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.Build.0 = Debug|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.ActiveCfg = Debug|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.Build.0 = Debug|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.ActiveCfg = Release|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.Build.0 = Release|Win32 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.ActiveCfg = Release|x64 - {DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.Build.0 = Release|x64 - {01D63BF5-7798-4746-852A-4B45229BB735}.Debug|Win32.ActiveCfg = Debug|Win32 - {01D63BF5-7798-4746-852A-4B45229BB735}.Debug|x64.ActiveCfg = Debug|x64 - {01D63BF5-7798-4746-852A-4B45229BB735}.Release|Win32.ActiveCfg = Release|Win32 - {01D63BF5-7798-4746-852A-4B45229BB735}.Release|x64.ActiveCfg = Release|x64 - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|Win32.ActiveCfg = Debug|Win32 - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Debug|x64.ActiveCfg = Debug|x64 - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|Win32.ActiveCfg = Release|Win32 - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25}.Release|x64.ActiveCfg = Release|x64 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|Win32.ActiveCfg = Debug|Win32 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|Win32.Build.0 = Debug|Win32 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|x64.ActiveCfg = Debug|x64 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Debug|x64.Build.0 = Debug|x64 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|Win32.ActiveCfg = Release|Win32 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|Win32.Build.0 = Release|Win32 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|x64.ActiveCfg = Release|x64 - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684}.Release|x64.Build.0 = Release|x64 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|Win32.ActiveCfg = Debug|Win32 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|Win32.Build.0 = Debug|Win32 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|x64.ActiveCfg = Debug|x64 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Debug|x64.Build.0 = Debug|x64 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|Win32.ActiveCfg = Release|Win32 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|Win32.Build.0 = Release|Win32 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|x64.ActiveCfg = Release|x64 - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3}.Release|x64.Build.0 = Release|x64 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|Win32.ActiveCfg = Debug|Win32 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|Win32.Build.0 = Debug|Win32 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|x64.ActiveCfg = Debug|x64 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Debug|x64.Build.0 = Debug|x64 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|Win32.ActiveCfg = Release|Win32 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|Win32.Build.0 = Release|Win32 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|x64.ActiveCfg = Release|x64 - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894}.Release|x64.Build.0 = Release|x64 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|Win32.ActiveCfg = Debug|Win32 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|Win32.Build.0 = Debug|Win32 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|x64.ActiveCfg = Debug|x64 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Debug|x64.Build.0 = Debug|x64 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|Win32.ActiveCfg = Release|Win32 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|Win32.Build.0 = Release|Win32 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|x64.ActiveCfg = Release|x64 - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2}.Release|x64.Build.0 = Release|x64 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|Win32.ActiveCfg = Debug|Win32 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|Win32.Build.0 = Debug|Win32 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|x64.ActiveCfg = Debug|x64 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Debug|x64.Build.0 = Debug|x64 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|Win32.ActiveCfg = Release|Win32 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|Win32.Build.0 = Release|Win32 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|x64.ActiveCfg = Release|x64 - {F7563CAD-5C95-46E5-89B7-0953C6C6E746}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {B5A00BFA-6083-4FAE-A097-71642D6473B5} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {1C320193-46A6-4B34-9C56-8AB584FC1B56} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {18B1F35A-10F8-4287-9B37-2D10501B0B38} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {843425BE-9A9A-44F4-A4E3-4B57D6ABD53C} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {504B3154-7A4F-459D-9877-B951021C3F1F} = {5377DC3A-DB96-4819-8AAF-2A75F3A69119} - {746F3632-5BB2-4570-9453-31D6D58A7D8E} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF} - {DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {493A1DB9-6E7C-48C7-93B5-F75C3C25B9DF} - {592CF22D-3F8F-4A77-A174-130D77B7623B} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {C98AF157-352E-4737-BD30-A24E2647F5AE} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {EE157390-1E85-416C-946E-620E32C9AD33} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {57FAF32E-49FD-491F-895D-132D0D5EFE0A} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {6B83AC6D-01CE-4E1C-81CE-02AD8116C684} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {272FAFA8-2B2F-4716-B95F-3B37CF2E0CB3} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {CD1C52C1-D8E1-4654-AE65-6CCAB38DE894} = {8E282AE2-038C-49FE-AC67-BC9615AFD800} - {92BFA534-C419-4EB2-AAA3-510653F38F08} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB} - {B495B6D9-AF84-479D-B30A-313C16EF8BFD} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB} - {5AFB8B04-AEB9-408C-B53E-AFBC44B5F3F2} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB} - {F7563CAD-5C95-46E5-89B7-0953C6C6E746} = {09BABD45-8F30-4F99-B8B8-8DD78F6804DB} - {79EF9F1D-E211-4ED1-91D2-FC935AB3A872} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {429C907B-97D1-4B2D-9B0E-A14A5BFDAD15} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {DCF01B1C-5268-44F3-9130-D647FABFB663} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {3CA97077-6210-4362-998A-D15A35EEAA08} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {17A33F3F-BAF5-403F-8EF4-FECDA7D9A335} = {AC4356E8-48A1-4D2D-AFB1-11CF30B974CD} - {01D63BF5-7798-4746-852A-4B45229BB735} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C} - {4714EF49-BFD5-4B22-95F7-95A07F1EAC25} = {62083CC3-13BF-49EA-BFE8-4C9337C0D82C} - {F2D6C1AF-0C05-4695-84AF-15A2F92F9899} = {9155EBB8-E7DD-49AE-A86A-7B90B9F09888} - EndGlobalSection -EndGlobal diff --git a/src/include/switch.h b/src/include/switch.h index 8bfd15a3f6..68c20044c5 100644 --- a/src/include/switch.h +++ b/src/include/switch.h @@ -188,9 +188,6 @@ * mod_pocketsphinx * - PocketSphinx (http://www.speech.cs.cmu.edu/pocketsphinx/) * - * mod_unimrcp - * - MRCP (http://www.unimrcp.org/) - * * * Codecs * mod_amr diff --git a/src/mod/.gitignore b/src/mod/.gitignore index 056bfb1fe2..90608ed1ed 100644 --- a/src/mod/.gitignore +++ b/src/mod/.gitignore @@ -27,9 +27,6 @@ /applications/mod_translate/Makefile /applications/mod_valet_parking/Makefile /applications/mod_voicemail/Makefile -/asr_tts/mod_unimrcp/Makefile -/asr_tts/mod_unimrcp/Makefile.in -/asr_tts/mod_unimrcp/mod_unimrcp.log /asr_tts/mod_flite/*/*/mod_flite_manifest.rc /codecs/mod_b64/Makefile /codecs/mod_skel_codec/Makefile diff --git a/src/mod/Makefile.am b/src/mod/Makefile.am index 4225ec7fd9..325e8e81d7 100644 --- a/src/mod/Makefile.am +++ b/src/mod/Makefile.am @@ -9,7 +9,6 @@ check: $(OUR_CHECK_MODULES) mod_skypopen-all: mod_gsmopen-all mod_gsmopen-all: mod_spandsp-all -mod_unimrcp-all: mod_sofia-all mod_rayo-all: mod_ssml-all mod_ssml-all: mod_rayo-all diff --git a/src/mod/asr_tts/mod_unimrcp/Makefile.am b/src/mod/asr_tts/mod_unimrcp/Makefile.am deleted file mode 100644 index 6f144744fe..0000000000 --- a/src/mod/asr_tts/mod_unimrcp/Makefile.am +++ /dev/null @@ -1,44 +0,0 @@ -include $(top_srcdir)/build/modmake.rulesam - -MODNAME=mod_unimrcp - -UNIMRCP_DIR=$(switch_srcdir)/libs/unimrcp -UNIMRCP_BUILDDIR=$(switch_builddir)/libs/unimrcp -UNIMRCPLA=$(UNIMRCP_BUILDDIR)/platforms/libunimrcp-client/libunimrcpclient.la - -mod_LTLIBRARIES = mod_unimrcp.la -mod_unimrcp_la_SOURCES = mod_unimrcp.c -mod_unimrcp_la_CFLAGS = $(AM_CFLAGS) -mod_unimrcp_la_CFLAGS += -I. -mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr/include -mod_unimrcp_la_CFLAGS += -I$(switch_srcdir)/libs/apr-util/include -mod_unimrcp_la_CFLAGS += -I$(switch_builddir)/libs/apr/include -mod_unimrcp_la_CFLAGS += -I$(switch_builddir)/libs/apr-util/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/build -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/platforms/libunimrcp-client/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-sofiasip/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/modules/mrcp-unirtsp/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp-client/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp-signaling/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcpv2-transport/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/message/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/control/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mrcp/resources/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/mpf/include -mod_unimrcp_la_CFLAGS += -I$(UNIMRCP_DIR)/libs/apr-toolkit/include - -mod_unimrcp_la_LIBADD = $(switch_builddir)/libfreeswitch.la $(UNIMRCPLA) $(switch_builddir)/libs/apr/libapr-1.la $(switch_builddir)/libs/apr-util/libaprutil-1.la $(switch_builddir)/libs/apr-util/xml/expat/lib/libexpat.la -mod_unimrcp_la_LDFLAGS = -avoid-version -module -no-undefined -shared - -if ISMAC -mod_unimrcp_la_LDFLAGS += -framework CoreFoundation -framework SystemConfiguration -endif - -BUILT_SOURCES = $(UNIMRCPLA) - -$(UNIMRCPLA): $(UNIMRCP_DIR) $(UNIMRCP_DIR)/.update - cd $(UNIMRCP_BUILDDIR) && $(MAKE) - $(TOUCH_TARGET) - -$(mod_unimrcp_la_SOURCES) : $(BUILT_SOURCES) diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2017.vcxproj b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2017.vcxproj deleted file mode 100644 index ad2634981f..0000000000 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.2017.vcxproj +++ /dev/null @@ -1,205 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - mod_unimrcp - {D07C378A-F5F7-438F-ADF3-4AC4FB1883CD} - mod_unimrcp - Win32Proj - - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - DynamicLibrary - MultiByte - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(Configuration)\ - $(Platform)\$(Configuration)\ - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - $(SolutionDir)Debug/bin;%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - $(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - $(SolutionDir)Release/bin;%(AdditionalLibraryDirectories) - false - - - - - - - X64 - - - APT_STATIC_LIB;MPF_STATIC_LIB;MRCP_STATIC_LIB;LIBSOFIA_SIP_UA_STATIC;%(PreprocessorDefinitions) - - - - - $(SolutionDir)$(PlatformName)\$(Configuration)\;%(AdditionalLibraryDirectories) - false - - - MachineX64 - - - - - CompileAsC - CompileAsC - CompileAsC - CompileAsC - - - - - {13deeca0-bdd4-4744-a1a2-8eb0a44df3d2} - false - - - {b5a00bfa-6083-4fae-a097-71642d6473b5} - false - - - {72782932-37cc-46ae-8c7f-9a7b1a6ee108} - false - - - {12a49562-bab9-43a3-a21d-15b60bbb4c31} - false - - - {a9edac04-6a5f-4ba7-bc0d-cce7b255b6ea} - false - - - {1c320193-46a6-4b34-9c56-8ab584fc1b56} - false - - - {504b3154-7a4f-459d-9877-b951021c3f1f} - false - - - {746f3632-5bb2-4570-9453-31d6d58a7d8e} - false - - - {deb01acb-d65f-4a62-aed9-58c1054499e9} - false - - - {f057da7f-79e5-4b00-845c-ef446ef055e3} - false - - - {f6c55d93-b927-4483-bb69-15aef3dd2dff} - false - - - {df018947-0fff-4eb3-bdee-441dc81da7a4} - - - {70a49bc2-7500-41d0-b75d-edcc5be987a0} - - - {202d7a4e-760d-4d0e-afa1-d7459ced30ff} - false - - - - - - \ No newline at end of file diff --git a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c b/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c deleted file mode 100644 index a89329f4b5..0000000000 --- a/src/mod/asr_tts/mod_unimrcp/mod_unimrcp.c +++ /dev/null @@ -1,4631 +0,0 @@ -/* - * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application - * Copyright (C) 2009-2015, 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_unimrcp - * - * The Initial Developer of the Original Code is - * Christopher M. Rienzo - * - * Portions created by the Initial Developer are Copyright (C) - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Brian West - * Christopher M. Rienzo - * Luke Dashjr (OpenMethods, LLC) - * - * Maintainer: Christopher M. Rienzo - * - * mod_unimrcp.c -- UniMRCP module (MRCP client) - * - */ -#include - -/* UniMRCP includes */ -#include "apt.h" -#include "apt_log.h" -#include "unimrcp_client.h" -#include "mrcp_application.h" -#include "mrcp_session.h" -#include "mrcp_message.h" -#include "mrcp_generic_header.h" -#include "mrcp_synth_header.h" -#include "mrcp_synth_resource.h" -#include "mrcp_recog_header.h" -#include "mrcp_recog_resource.h" -#include "uni_version.h" -#include "mrcp_resource_loader.h" -#include "mpf_engine.h" -#include "mpf_codec_manager.h" -#include "mpf_dtmf_generator.h" -#include "mpf_rtp_termination_factory.h" -#include "mrcp_sofiasip_client_agent.h" -#include "mrcp_unirtsp_client_agent.h" -#include "mrcp_client_connection.h" -#include "apt_net.h" - -/********************************************************************************************************************************************* - * mod_unimrcp : module interface to FreeSWITCH - */ - -/* module name */ -#define MOD_UNIMRCP "unimrcp" -/* module config file */ -#define CONFIG_FILE "unimrcp.conf" - - -/** - * A UniMRCP application. - */ -struct mod_unimrcp_application { - /** UniMRCP application */ - mrcp_application_t *app; - /** MRCP callbacks from UniMRCP to this module's application */ - mrcp_app_message_dispatcher_t dispatcher; - /** Audio callbacks from UniMRCP to this module's application */ - mpf_audio_stream_vtable_t audio_stream_vtable; - /** maps FreeSWITCH param to MRCP param name */ - switch_hash_t *fs_param_map; - /** maps MRCP header to unimrcp header handler function */ - switch_hash_t *param_id_map; -}; -typedef struct mod_unimrcp_application mod_unimrcp_application_t; - -/** - * module globals - global configuration and variables - */ -struct mod_unimrcp_globals { - /** max-connection-count config */ - char *unimrcp_max_connection_count; - /** request-timeout config */ - char *unimrcp_request_timeout; - /** rx-buffer-size */ - char *unimrcp_rx_buffer_size; - /** tx-buffer-size */ - char *unimrcp_tx_buffer_size; - /** offer-new-connection config */ - char *unimrcp_offer_new_connection; - /** default-tts-profile config */ - char *unimrcp_default_synth_profile; - /** default-asr-profile config */ - char *unimrcp_default_recog_profile; - /** log level for UniMRCP library */ - char *unimrcp_log_level; - /** profile events configuration param */ - char *enable_profile_events_param; - /** True if profile events are wanted */ - int enable_profile_events; - /** the MRCP client stack */ - mrcp_client_t *mrcp_client; - /** synthesizer application */ - mod_unimrcp_application_t synth; - /** recognizer application */ - mod_unimrcp_application_t recog; - /** synchronize access for speech channel numbering */ - switch_mutex_t *mutex; - /** next available speech channel number */ - int speech_channel_number; - /** the available profiles */ - switch_hash_t *profiles; -}; -typedef struct mod_unimrcp_globals mod_unimrcp_globals_t; - -/** Module global variables */ -static mod_unimrcp_globals_t globals; - -/** - * Profile-specific configuration. This allows us to handle differing MRCP server behavior - * on a per-profile basis - */ -struct profile { - /** name of the profile */ - char *name; - - /** MIME type to use for JSGF grammars */ - const char *jsgf_mime_type; - /** MIME type to use for GSL grammars */ - const char *gsl_mime_type; - /** MIME type to use for SRGS XML grammars */ - const char *srgs_xml_mime_type; - /** MIME type to use for SRGS ABNF grammars */ - const char *srgs_mime_type; - - /** MIME type to use for Google Speech module context */ - const char *xml_mime_type; - - /** MIME type to use for SSML (TTS) */ - const char *ssml_mime_type; - - /** Default params to use for RECOGNIZE requests */ - switch_hash_t *default_recog_params; - /** Default params to use for SPEAK requests */ - switch_hash_t *default_synth_params; -}; -typedef struct profile profile_t; -static switch_status_t profile_create(profile_t ** profile, const char *name, switch_memory_pool_t *pool); - -/* Profile events that may be monitored. Useful for tracking MRCP profile utilization */ -#define MY_EVENT_PROFILE_CREATE "unimrcp::profile_create" -#define MY_EVENT_PROFILE_OPEN "unimrcp::profile_open" -#define MY_EVENT_PROFILE_CLOSE "unimrcp::profile_close" - -/** - * Defines XML parsing instructions - */ -static switch_xml_config_item_t instructions[] = { - SWITCH_CONFIG_ITEM_STRING_STRDUP("max-connection-count", CONFIG_REQUIRED, &globals.unimrcp_max_connection_count, "100", "", - "The max MRCPv2 connections to manage"), - SWITCH_CONFIG_ITEM_STRING_STRDUP("offer-new-connection", CONFIG_REQUIRED, &globals.unimrcp_offer_new_connection, "1", "", ""), - SWITCH_CONFIG_ITEM_STRING_STRDUP("default-tts-profile", CONFIG_REQUIRED, &globals.unimrcp_default_synth_profile, "default", "", - "The default profile to use for TTS"), - SWITCH_CONFIG_ITEM_STRING_STRDUP("default-asr-profile", CONFIG_REQUIRED, &globals.unimrcp_default_recog_profile, "default", "", - "The default profile to use for ASR"), - SWITCH_CONFIG_ITEM_STRING_STRDUP("log-level", CONFIG_REQUIRED, &globals.unimrcp_log_level, "WARNING", - "EMERGENCY|ALERT|CRITICAL|ERROR|WARNING|NOTICE|INFO|DEBUG", "Logging level for UniMRCP"), - SWITCH_CONFIG_ITEM_STRING_STRDUP("enable-profile-events", CONFIG_REQUIRED, &globals.enable_profile_events_param, "false", "", - "Fire profile events (true|false)"), - SWITCH_CONFIG_ITEM_STRING_STRDUP("request-timeout", CONFIG_REQUIRED, &globals.unimrcp_request_timeout, "10000", "", - "Maximum time to wait for server response to a request"), - SWITCH_CONFIG_ITEM_STRING_STRDUP("connection-rx-buffer-size", 0, &globals.unimrcp_rx_buffer_size, "1024", "", - "Maximum time to wait for server response to a request"), - SWITCH_CONFIG_ITEM_STRING_STRDUP("connection-tx-buffer-size", 0, &globals.unimrcp_tx_buffer_size, "1024", "", - "Maximum time to wait for server response to a request"), - SWITCH_CONFIG_ITEM_END() -}; - -/* mod_unimrcp interface to FreeSWITCH */ -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown); -SWITCH_MODULE_RUNTIME_FUNCTION(mod_unimrcp_runtime); -SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load); -SWITCH_MODULE_DEFINITION(mod_unimrcp, mod_unimrcp_load, mod_unimrcp_shutdown, NULL); - -static switch_status_t mod_unimrcp_do_config(); -static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool); -static int process_rtp_config(mrcp_client_t *client, mpf_rtp_config_t *rtp_config, mpf_rtp_settings_t *rtp_settings, const char *param, const char *val, apr_pool_t *pool); -static int process_mrcpv1_config(rtsp_client_config_t *config, mrcp_sig_settings_t *sig_settings, const char *param, const char *val, apr_pool_t *pool); -static int process_mrcpv2_config(mrcp_sofia_client_config_t *config, mrcp_sig_settings_t *sig_settings, const char *param, const char *val, apr_pool_t *pool); -static int process_profile_config(profile_t *profile, const char *param, const char *val, apr_pool_t *pool); - -/* UniMRCP <--> FreeSWITCH logging bridge */ -static apt_bool_t unimrcp_log(const char *file, int line, const char *obj, apt_log_priority_e priority, const char *format, va_list arg_ptr); -static apt_log_priority_e str_to_log_level(const char *level); - -static int get_next_speech_channel_number(void); - -#define XML_ID " FreeSWITCH audio buffering - */ - -/* size of the buffer */ -#define AUDIO_QUEUE_SIZE (1024 * 32) - -/* Define to enable read/write logging and dumping of queue data to file */ -#undef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - -/** - * Audio queue internals - */ -struct audio_queue { -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - /** debug file for tx operations */ - switch_file_t *file_write; - /** debug file name */ - char file_write_name[30]; - /** debug file for rx operations */ - switch_file_t *file_read; - /** debug file name */ - char file_read_name[30]; -#endif - /** the buffer of audio data */ - switch_buffer_t *buffer; - /** synchronizes access to queue */ - switch_mutex_t *mutex; - /** signaling for blocked readers/writers */ - switch_thread_cond_t *cond; - /** total bytes written */ - switch_size_t write_bytes; - /** total bytes read */ - switch_size_t read_bytes; - /** number of bytes reader is waiting for */ - switch_size_t waiting; - /** name of this queue (for logging) */ - char *name; - /** optional session uuid associated with this queue (for logging) */ - char *session_uuid; -}; -typedef struct audio_queue audio_queue_t; - -static switch_status_t audio_queue_create(audio_queue_t ** queue, const char *name, const char *session_uuid, switch_memory_pool_t *pool); -static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len); -static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch_size_t *data_len, int block); -static switch_status_t audio_queue_clear(audio_queue_t *queue); -static switch_status_t audio_queue_signal(audio_queue_t *queue); -static switch_status_t audio_queue_destroy(audio_queue_t *queue); - -/********************************************************************************************************************************************* - * SPEECH_CHANNEL : speech functions common to recognizer and synthesizer - */ - -#define SPEECH_CHANNEL_TIMEOUT_USEC (5000 * 1000) -#define AUDIO_TIMEOUT_USEC (SWITCH_MAX_INTERVAL * 1000) - -/** - * Type of MRCP channel - */ -enum speech_channel_type { - SPEECH_CHANNEL_SYNTHESIZER, - SPEECH_CHANNEL_RECOGNIZER -}; -typedef enum speech_channel_type speech_channel_type_t; - -/** - * channel states - */ -enum speech_channel_state { - /** closed */ - SPEECH_CHANNEL_CLOSED, - /** ready for speech request */ - SPEECH_CHANNEL_READY, - /** processing speech request */ - SPEECH_CHANNEL_PROCESSING, - /** finished processing speech request */ - SPEECH_CHANNEL_DONE, - /** error opening channel */ - SPEECH_CHANNEL_ERROR -}; -typedef enum speech_channel_state speech_channel_state_t; - - - -/** - * An MRCP speech channel - */ -struct speech_channel { - /** the name of this channel (for logging) */ - char *name; - /** optional session associated w/ this channel */ - char *session_uuid; - /** The profile used by this channel */ - profile_t *profile; - /** type of channel */ - speech_channel_type_t type; - /** application this channel is running */ - mod_unimrcp_application_t *application; - /** UniMRCP session */ - mrcp_session_t *unimrcp_session; - /** UniMRCP channel */ - mrcp_channel_t *unimrcp_channel; - /** memory pool */ - switch_memory_pool_t *memory_pool; - /** synchronizes channel state */ - switch_mutex_t *mutex; - /** wait on channel states */ - switch_thread_cond_t *cond; - /** channel state */ - speech_channel_state_t state; - /** UniMRCP <--> FreeSWITCH audio buffer */ - audio_queue_t *audio_queue; - /** True, if channel was opened successfully */ - int channel_opened; - /** rate */ - uint16_t rate; - /** silence sample */ - int silence; - /** speech channel params */ - switch_hash_t *params; - /** app specific data */ - void *data; - void *fsh; -}; -typedef struct speech_channel speech_channel_t; - -/* speech channel interface for UniMRCP */ -static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status); -static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, - mrcp_sig_status_code_e status); -static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, - mrcp_sig_status_code_e status); - -/* speech_channel funcs */ -static switch_status_t speech_channel_create(speech_channel_t ** schannel, const char *name, const char *session_uuid, speech_channel_type_t type, mod_unimrcp_application_t *app, - uint16_t rate, switch_memory_pool_t *pool); -static mpf_termination_t *speech_channel_create_mpf_termination(speech_channel_t *schannel); -static switch_status_t speech_channel_open(speech_channel_t *schannel, profile_t *profile); -static switch_status_t speech_channel_destroy(speech_channel_t *schannel); -static switch_status_t speech_channel_stop(speech_channel_t *schannel); -static switch_status_t speech_channel_set_param(speech_channel_t *schannel, const char *name, const char *val); -static switch_status_t speech_channel_write(speech_channel_t *schannel, void *data, switch_size_t *len); -static switch_status_t speech_channel_read(speech_channel_t *schannel, void *data, switch_size_t *len, int block); -static switch_status_t speech_channel_set_state(speech_channel_t *schannel, speech_channel_state_t state); -static switch_status_t speech_channel_set_state_unlocked(speech_channel_t *schannel, speech_channel_state_t state); -static const char *speech_channel_state_to_string(speech_channel_state_t state); -static const char *speech_channel_type_to_string(speech_channel_type_t type); - - -/********************************************************************************************************************************************* - * SYNTHESIZER : UniMRCP <--> FreeSWITCH tts interface - */ - -/* synthesis languages */ -#define MIME_TYPE_PLAIN_TEXT "text/plain" - -static switch_status_t synth_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool); -static switch_status_t synth_shutdown(); - -/* synthesizer's interface for FreeSWITCH */ -static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, int channels, switch_speech_flag_t *flags); -static switch_status_t synth_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags); -static switch_status_t synth_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags); -static switch_status_t synth_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags); -static void synth_speech_flush_tts(switch_speech_handle_t *sh); -static void synth_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val); -static void synth_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val); -static void synth_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val); - -/* synthesizer's interface for UniMRCP */ -static apt_bool_t synth_message_handler(const mrcp_app_message_t *app_message); -static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); -static apt_bool_t synth_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame); - -/* synthesizer specific speech_channel funcs */ -static switch_status_t synth_channel_speak(speech_channel_t *schannel, const char *text); -static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, - mrcp_synth_header_t *synth_hdr); -static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_synth_header_t *synth_hdr); - -/********************************************************************************************************************************************* - * GRAMMAR : recognizer grammar management - */ - -/** - * type of the grammar - */ -enum grammar_type { - GRAMMAR_TYPE_UNKNOWN, - /* text/uri-list */ - GRAMMAR_TYPE_URI, - /* application/srgs */ - GRAMMAR_TYPE_SRGS, - /* application/srgs+xml */ - GRAMMAR_TYPE_SRGS_XML, - /* application/x-nuance-gsl */ - GRAMMAR_TYPE_NUANCE_GSL, - /* application/x-jsgf */ - GRAMMAR_TYPE_JSGF, - /* application/xml */ - GRAMMAR_TYPE_XML -}; -typedef enum grammar_type grammar_type_t; - -/** - * A grammar for recognition - */ -struct grammar { - /** name of this grammar */ - char *name; - /** grammar MIME type */ - grammar_type_t type; - /** the grammar or its URI, depending on type */ - char *data; -}; -typedef struct grammar grammar_t; - -static switch_status_t grammar_create(grammar_t ** grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool); -static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile); - -/********************************************************************************************************************************************* - * RECOGNIZER : UniMRCP <--> FreeSWITCH asr interface - */ - -#define START_OF_INPUT_RECEIVED 1 -#define START_OF_INPUT_REPORTED 2 - -/** - * Data specific to the recognizer - */ -struct recognizer_data { - /** the available grammars */ - switch_hash_t *grammars; - /** the enabled grammars */ - switch_hash_t *enabled_grammars; - /** recognize result */ - char *result; - /** recognize result headers */ - switch_event_t *result_headers; - /** true, if voice has started */ - int start_of_input; - /** true, if input timers have started */ - int timers_started; - /** UniMRCP mpf stream */ - mpf_audio_stream_t *unimrcp_stream; - /** DTMF generator */ - mpf_dtmf_generator_t *dtmf_generator; - /** true, if presently transmitting DTMF */ - char dtmf_generator_active; -}; -typedef struct recognizer_data recognizer_data_t; - -static switch_status_t recog_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool); -static switch_status_t recog_shutdown(); - -/* recognizer's interface for FreeSWITCH */ -static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags); -static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name); -static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const char *name); -static switch_status_t recog_asr_enable_grammar(switch_asr_handle_t *ah, const char *name); -static switch_status_t recog_asr_disable_grammar(switch_asr_handle_t *ah, const char *name); -static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah); -static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags); -static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags); -static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags); -static switch_status_t recog_asr_resume(switch_asr_handle_t *ah); -static switch_status_t recog_asr_pause(switch_asr_handle_t *ah); -static switch_status_t recog_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags); -static switch_status_t recog_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags); -static switch_status_t recog_asr_get_result_headers(switch_asr_handle_t *ah, switch_event_t **headers, switch_asr_flag_t *flags); -static switch_status_t recog_asr_start_input_timers(switch_asr_handle_t *ah); -static void recog_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val); -static void recog_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val); -static void recog_asr_float_param(switch_asr_handle_t *ah, char *param, double val); - -/* recognizer's interface for UniMRCP */ -static apt_bool_t recog_message_handler(const mrcp_app_message_t *app_message); -static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message); -static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec); -static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame); - -/* recognizer specific speech_channel_funcs */ -static switch_status_t recog_channel_start(speech_channel_t *schannel); -static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, const char *name, grammar_type_t type, const char *data); -static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel, const char *name); -static switch_status_t recog_channel_enable_grammar(speech_channel_t *schannel, const char *name); -static switch_status_t recog_channel_disable_grammar(speech_channel_t *schannel, const char *name); -static switch_status_t recog_channel_disable_all_grammars(speech_channel_t *schannel); -static switch_status_t recog_channel_check_results(speech_channel_t *schannel); -static switch_status_t recog_channel_set_start_of_input(speech_channel_t *schannel); -static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel); -static switch_status_t recog_channel_set_results(speech_channel_t *schannel, const char *results); -static switch_status_t recog_channel_set_result_headers(speech_channel_t *schannel, mrcp_recog_header_t *recog_hdr); -static switch_status_t recog_channel_get_results(speech_channel_t *schannel, char **results); -static switch_status_t recog_channel_get_result_headers(speech_channel_t *schannel, switch_event_t **result_headers); -static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, - mrcp_recog_header_t *recog_hdr); -static switch_status_t recog_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_recog_header_t *recog_hdr); -static switch_status_t recog_channel_set_timers_started(speech_channel_t *schannel); - - -/** - * Create a mod_unimrcp profile - * @param profile the created profile - * @param name the profile name - * @param pool the memory pool to use - * @return SWITCH_STATUS_SUCCESS if the profile is created - */ -static switch_status_t profile_create(profile_t ** profile, const char *name, switch_memory_pool_t *pool) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - profile_t *lprofile = NULL; - switch_event_t *event = NULL; - - lprofile = (profile_t *) switch_core_alloc(pool, sizeof(profile_t)); - if (lprofile) { - lprofile->name = switch_core_strdup(pool, name); - lprofile->srgs_mime_type = "application/srgs"; - lprofile->srgs_xml_mime_type = "application/srgs+xml"; - lprofile->gsl_mime_type = "application/x-nuance-gsl"; - lprofile->jsgf_mime_type = "application/x-jsgf"; - lprofile->ssml_mime_type = "application/ssml+xml"; - lprofile->xml_mime_type = "application/xml"; - switch_core_hash_init(&lprofile->default_synth_params); - switch_core_hash_init(&lprofile->default_recog_params); - *profile = lprofile; - - if (globals.enable_profile_events && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_CREATE) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Profile", lprofile->name); - switch_event_fire(&event); - } - } else { - *profile = NULL; - status = SWITCH_STATUS_FALSE; - } - - return status; -} - -/** - * Inspect text to determine if its first non-whitespace text matches "match" - * @param text the text to inspect. - * @param match the text to match - * @return true if matches - */ -static int text_starts_with(const char *text, const char *match) -{ - int result = 0; - - text = skip_initial_whitespace(text); - if (!zstr(text)) { - size_t textlen, matchlen; - textlen = strlen(text); - matchlen = strlen(match); - /* is there a match? */ - result = textlen > matchlen && !strncmp(match, text, matchlen); - } - - return result; -} - -/** - * Find the first non-whitespace text character in text - * @param text the text to scan - * @return pointer to the first non-whitespace char in text or the empty string if none - */ -static const char *skip_initial_whitespace(const char *text) -{ - if (!zstr(text)) { - while(switch_isspace(*text)) { - text++; - } - } - return text; -} - -/** - * Create the audio queue - * - * @param audio_queue the created queue - * @param name the name of this queue (for logging) - * @param session_uuid optional session associated with this channel - * @param pool memory pool to allocate queue from - * @return SWITCH_STATUS_SUCCESS if successful. SWITCH_STATUS_FALSE if unable to allocate queue - */ -static switch_status_t audio_queue_create(audio_queue_t ** audio_queue, const char *name, const char *session_uuid, switch_memory_pool_t *pool) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - audio_queue_t *laudio_queue = NULL; -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - int flags; -#endif - char *lname; - char *lsession_uuid = NULL; - *audio_queue = NULL; - - lname = zstr(name) ? "" : switch_core_strdup(pool, name); - lsession_uuid = zstr(session_uuid) ? NULL : switch_core_strdup(pool, session_uuid); - - if ((laudio_queue = (audio_queue_t *) switch_core_alloc(pool, sizeof(audio_queue_t))) == NULL) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(lsession_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue\n", lname); - status = SWITCH_STATUS_FALSE; - goto done; - } - - laudio_queue->name = lname; - laudio_queue->session_uuid = lsession_uuid; - - if (switch_buffer_create(pool, &laudio_queue->buffer, AUDIO_QUEUE_SIZE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(lsession_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue buffer\n", laudio_queue->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - - if (switch_mutex_init(&laudio_queue->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(lsession_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue mutex\n", laudio_queue->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - - if (switch_thread_cond_create(&laudio_queue->cond, pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(lsession_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue condition variable\n", laudio_queue->name); - status = SWITCH_STATUS_FALSE; - goto done; - } -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - flags = SWITCH_FOPEN_CREATE | SWITCH_FOPEN_WRITE | SWITCH_FOPEN_TRUNCATE | SWITCH_FOPEN_BINARY; - strcpy(laudio_queue->file_read_name, "/tmp/mod_unimrcp_rx_XXXXXX"); - if (switch_file_mktemp(&laudio_queue->file_read, laudio_queue->file_read_name, flags, pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue read file\n", laudio_queue->name); - laudio_queue->file_read = NULL; - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) queue rx saved to %s\n", laudio_queue->name, laudio_queue->file_read_name); - } - strcpy(laudio_queue->file_write_name, "/tmp/mod_unimrcp_tx_XXXXXX"); - if (switch_file_mktemp(&laudio_queue->file_write, laudio_queue->file_write_name, flags, pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_ERROR, "(%s) unable to create audio queue write file\n", laudio_queue->name); - laudio_queue->file_write = NULL; - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) queue tx saved to %s\n", laudio_queue->name, laudio_queue->file_write_name); - } -#endif - - laudio_queue->write_bytes = 0; - laudio_queue->read_bytes = 0; - laudio_queue->waiting = 0; - *audio_queue = laudio_queue; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(laudio_queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue created\n", laudio_queue->name); - - done: - - if (status != SWITCH_STATUS_SUCCESS) { - audio_queue_destroy(laudio_queue); - } - return status; -} - -/** - * Write to the audio queue - * - * @param queue the queue to write to - * @param data the data to write - * @param data_len the number of octets to write - * @return SWITCH_STATUS_SUCCESS if data was written, SWITCH_STATUS_FALSE if data can't be written because queue is full - */ -static switch_status_t audio_queue_write(audio_queue_t *queue, void *data, switch_size_t *data_len) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - switch_size_t len = *data_len; -#endif - switch_mutex_lock(queue->mutex); - -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - if (queue->file_write) { - switch_file_write(queue->file_write, data, &len); - } -#endif - - if (switch_buffer_write(queue->buffer, data, *data_len) > 0) { - queue->write_bytes = queue->write_bytes + *data_len; -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue write total = %ld\trequested = %ld\n", queue->name, queue->write_bytes, - *data_len); -#endif - if (queue->waiting <= switch_buffer_inuse(queue->buffer)) { - switch_thread_cond_signal(queue->cond); - } - } else { - *data_len = 0; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue overflow!\n", queue->name); - status = SWITCH_STATUS_FALSE; - } - - switch_mutex_unlock(queue->mutex); - return status; -} - -/** - * Read from the audio queue - * - * @param queue the queue to read from - * @param data the read data - * @param data_len the amount of data requested / actual amount of data read (returned) - * @param block 1 if blocking is allowed - * @return SWITCH_STATUS_SUCCESS if successful. SWITCH_STATUS_FALSE if no data was requested, or there was a timeout while waiting to read - */ -static switch_status_t audio_queue_read(audio_queue_t *queue, void *data, switch_size_t *data_len, int block) -{ - switch_size_t requested = *data_len; - switch_status_t status = SWITCH_STATUS_SUCCESS; -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - switch_size_t len = *data_len; -#endif - switch_mutex_lock(queue->mutex); - - /* allow the initial frame to buffer */ - if (!queue->read_bytes && switch_buffer_inuse(queue->buffer) < requested) { - *data_len = 0; - status = SWITCH_STATUS_SUCCESS; - goto done; - } - - /* wait for data, if allowed */ - if (block) { - while (switch_buffer_inuse(queue->buffer) < requested) { - queue->waiting = requested; - if (switch_thread_cond_timedwait(queue->cond, queue->mutex, AUDIO_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT) { - break; - } - } - queue->waiting = 0; - } - - if (switch_buffer_inuse(queue->buffer) < requested) { - requested = switch_buffer_inuse(queue->buffer); - } - if (requested == 0) { - *data_len = 0; - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* read the data */ - *data_len = switch_buffer_read(queue->buffer, data, requested); - queue->read_bytes = queue->read_bytes + *data_len; -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue read total = %ld\tread = %ld\trequested = %ld\n", queue->name, - queue->read_bytes, *data_len, requested); - if (queue->file_read) { - switch_file_write(queue->file_read, data, &len); - } -#endif - - done: - - switch_mutex_unlock(queue->mutex); - return status; -} - -/** - * Empty the queue - * - * @param queue the queue to empty - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t audio_queue_clear(audio_queue_t *queue) -{ - switch_mutex_lock(queue->mutex); - switch_buffer_zero(queue->buffer); - switch_thread_cond_signal(queue->cond); - switch_mutex_unlock(queue->mutex); - queue->read_bytes = 0; - queue->write_bytes = 0; - queue->waiting = 0; - return SWITCH_STATUS_SUCCESS; -} - -/** - * Wake any threads waiting on this queue - * - * @param queue the queue to empty - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t audio_queue_signal(audio_queue_t *queue) -{ - switch_mutex_lock(queue->mutex); - switch_thread_cond_signal(queue->cond); - switch_mutex_unlock(queue->mutex); - return SWITCH_STATUS_SUCCESS; -} - -/** - * Destroy the audio queue - * - * @param queue the queue to clean up - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t audio_queue_destroy(audio_queue_t *queue) -{ - if (queue) { - char *name = queue->name; - if (zstr(name)) { - name = ""; - } -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - if (queue->file_read) { - switch_file_close(queue->file_read); - queue->file_read = NULL; - } - if (queue->file_write) { - switch_file_close(queue->file_write); - queue->file_write = NULL; - } -#endif - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(queue->session_uuid), SWITCH_LOG_DEBUG, "(%s) audio queue destroyed\n", name); - } - return SWITCH_STATUS_SUCCESS; -} - -/** - * Create a speech channel - * - * @param schannel the created channel - * @param name the name of the channel - * @param session_uuid optional session associated with this channel - * @param type the type of channel to create - * @param app the application - * @param rate the rate to use - * @param pool the memory pool to use - * @return SWITCH_STATUS_SUCCESS if successful. SWITCH_STATUS_FALSE if the channel cannot be allocated. - */ -static switch_status_t speech_channel_create(speech_channel_t ** schannel, const char *name, const char *session_uuid, speech_channel_type_t type, mod_unimrcp_application_t *app, - uint16_t rate, switch_memory_pool_t *pool) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schan = NULL; - *schannel = NULL; - - if ((schan = (speech_channel_t *) switch_core_alloc(pool, sizeof(speech_channel_t))) == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - schan->profile = NULL; - schan->type = type; - schan->application = app; - schan->state = SPEECH_CHANNEL_CLOSED; - schan->memory_pool = pool; - schan->params = NULL; - schan->rate = rate; - schan->silence = 0; /* L16 silence sample */ - schan->channel_opened = 0; - - if (switch_mutex_init(&schan->mutex, SWITCH_MUTEX_UNNESTED, pool) != SWITCH_STATUS_SUCCESS || - switch_thread_cond_create(&schan->cond, pool) != SWITCH_STATUS_SUCCESS || - audio_queue_create(&schan->audio_queue, name, session_uuid, pool) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto done; - } - switch_core_hash_init(&schan->params); - schan->data = NULL; - schan->name = zstr(name) ? "" : switch_core_strdup(pool, name); - schan->session_uuid = zstr(session_uuid) ? NULL : switch_core_strdup(pool, session_uuid); - - *schannel = schan; - - done: - - return status; -} - -/** - * Destroy the speech channel - * - * @param schannel the channel to destroy - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t speech_channel_destroy(speech_channel_t *schannel) -{ - if (schannel) { - /* Terminate the MRCP session if not already done */ - if (schannel->mutex) { - switch_mutex_lock(schannel->mutex); - if (schannel->state != SPEECH_CHANNEL_CLOSED) { - int warned = 0; - mrcp_application_session_terminate(schannel->unimrcp_session); - /* wait forever for session to terminate. Log WARNING if this starts taking too long */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Waiting for MRCP session to terminate\n", schannel->name); - while (schannel->state != SPEECH_CHANNEL_CLOSED) { - if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) { - warned = 1; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) MRCP session has not terminated after %d ms\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000)); - } - } - } - switch_mutex_unlock(schannel->mutex); - } - - /* It is now safe to clean up the speech channel */ - if (schannel->mutex) { - switch_mutex_lock(schannel->mutex); - } - audio_queue_destroy(schannel->audio_queue); - schannel->audio_queue = NULL; - if (schannel->params) { - switch_core_hash_destroy(&schannel->params); - } - if (schannel->mutex) { - switch_mutex_unlock(schannel->mutex); - } - } - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Create the audio termination for the speech channel - * @param schannel the speech channel - * @return the termination or NULL - */ -static mpf_termination_t *speech_channel_create_mpf_termination(speech_channel_t *schannel) -{ - mpf_termination_t *termination = NULL; - mpf_stream_capabilities_t *capabilities = NULL; - int sample_rates; - - if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) { - capabilities = mpf_sink_stream_capabilities_create(schannel->unimrcp_session->pool); - } else { - capabilities = mpf_source_stream_capabilities_create(schannel->unimrcp_session->pool); - } - /* FreeSWITCH is capable of resampling so pick rates that are are multiples of the desired rate. - * UniMRCP should transcode whatever the MRCP server wants to use into LPCM (host-byte ordered L16) for us. - */ - if (schannel->rate == 16000) { - sample_rates = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000; - } else if (schannel->rate == 32000) { - sample_rates = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | MPF_SAMPLE_RATE_32000; - } else if (schannel->rate == 48000) { - sample_rates = MPF_SAMPLE_RATE_8000 | MPF_SAMPLE_RATE_16000 | MPF_SAMPLE_RATE_48000; - } else { - sample_rates = MPF_SAMPLE_RATE_8000; - } - mpf_codec_capabilities_add(&capabilities->codecs, sample_rates, "LPCM"); - termination = - mrcp_application_audio_termination_create(schannel->unimrcp_session, &schannel->application->audio_stream_vtable, capabilities, schannel); - - return termination; -} - -/** - * Open the speech channel - * - * @param schannel the channel to open - * @param profile the profile to use - * @return SWITCH_STATUS_FALSE if failed, SWITCH_STATUS_RESTART if retry can be attempted with another profile, SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t speech_channel_open(speech_channel_t *schannel, profile_t *profile) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - mpf_termination_t *termination = NULL; - mrcp_resource_type_e resource_type; - int warned = 0; - - switch_mutex_lock(schannel->mutex); - - /* make sure we can open channel */ - if (schannel->state != SPEECH_CHANNEL_CLOSED) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - schannel->profile = profile; - - /* create MRCP session */ - if ((schannel->unimrcp_session = mrcp_application_session_create(schannel->application->app, profile->name, schannel)) == NULL) { - /* profile doesn't exist? */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Unable to create session with %s\n", schannel->name, profile->name); - status = SWITCH_STATUS_RESTART; - goto done; - } - mrcp_application_session_name_set(schannel->unimrcp_session, schannel->name); - - /* create audio termination and add to channel */ - if ((termination = speech_channel_create_mpf_termination(schannel)) == NULL) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Unable to create termination with %s\n", schannel->name, profile->name); - mrcp_application_session_destroy(schannel->unimrcp_session); - status = SWITCH_STATUS_FALSE; - goto done; - } - if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) { - resource_type = MRCP_SYNTHESIZER_RESOURCE; - } else { - resource_type = MRCP_RECOGNIZER_RESOURCE; - } - if ((schannel->unimrcp_channel = mrcp_application_channel_create(schannel->unimrcp_session, resource_type, termination, NULL, schannel)) == NULL) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Unable to create channel with %s\n", schannel->name, profile->name); - mrcp_application_session_destroy(schannel->unimrcp_session); - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* add channel to session... this establishes the connection to the MRCP server */ - if (mrcp_application_channel_add(schannel->unimrcp_session, schannel->unimrcp_channel) != TRUE) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Unable to add channel to session with %s\n", schannel->name, profile->name); - mrcp_application_session_destroy(schannel->unimrcp_session); - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* wait for channel to be ready */ - warned = 0; - while (schannel->state == SPEECH_CHANNEL_CLOSED) { - if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) { - warned = 1; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) MRCP session has not opened after %d ms\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000)); - } - } - if (schannel->state == SPEECH_CHANNEL_READY) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) channel is ready\n", schannel->name); - } else if (schannel->state == SPEECH_CHANNEL_CLOSED) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Timed out waiting for channel to be ready\n", schannel->name); - /* can't retry */ - status = SWITCH_STATUS_FALSE; - } else if (schannel->state == SPEECH_CHANNEL_ERROR) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Terminating MRCP session\n", schannel->name); - if (!mrcp_application_session_terminate(schannel->unimrcp_session)) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Unable to terminate application session\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* Wait for session to be cleaned up */ - warned = 0; - while (schannel->state == SPEECH_CHANNEL_ERROR) { - if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) { - warned = 1; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) MRCP session has not cleaned up after %d ms\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000)); - } - } - if (schannel->state != SPEECH_CHANNEL_CLOSED) { - /* major issue... can't retry */ - status = SWITCH_STATUS_FALSE; - } else { - /* failed to open profile, retry is allowed */ - status = SWITCH_STATUS_RESTART; - } - } - - done: - - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Send SPEAK request to synthesizer - * - * @param schannel the synthesizer channel - * @param text The text to speak. This may be plain text or SSML. - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t synth_channel_speak(speech_channel_t *schannel, const char *text) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - mrcp_message_t *mrcp_message = NULL; - mrcp_generic_header_t *generic_header = NULL; - mrcp_synth_header_t *synth_header = NULL; - int warned = 0; - - switch_mutex_lock(schannel->mutex); - if (schannel->state != SPEECH_CHANNEL_READY) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, SYNTHESIZER_SPEAK); - if (mrcp_message == NULL) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Failed to create SPEAK message\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* set generic header fields (content-type) */ - if ((generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message)) == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* good enough way of determining SSML or plain text body */ - if (text_starts_with(text, XML_ID) || text_starts_with(text, SSML_ID)) { - apt_string_assign(&generic_header->content_type, schannel->profile->ssml_mime_type, mrcp_message->pool); - } else { - apt_string_assign(&generic_header->content_type, MIME_TYPE_PLAIN_TEXT, mrcp_message->pool); - } - mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE); - - /* set synthesizer header fields (voice, rate, etc.) */ - if ((synth_header = (mrcp_synth_header_t *) mrcp_resource_header_prepare(mrcp_message)) == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* add params to MRCP message */ - synth_channel_set_params(schannel, mrcp_message, generic_header, synth_header); - - /* set body (plain text or SSML) */ - apt_string_assign(&mrcp_message->body, text, schannel->memory_pool); - - /* Empty audio queue and send SPEAK to MRCP server */ - audio_queue_clear(schannel->audio_queue); - if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) { - status = SWITCH_STATUS_FALSE; - goto done; - } - /* wait for IN-PROGRESS */ - while (schannel->state == SPEECH_CHANNEL_READY) { - if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) { - warned = 1; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) SPEAK IN-PROGRESS not received after %d ms\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000)); - } - } - if (schannel->state != SPEECH_CHANNEL_PROCESSING) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - done: - - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Set parameters in a synthesizer MRCP header - * - * @param schannel the speech channel containing the params - * @param msg the MRCP message to set - * @param gen_hdr the generic headers to set - * @param synth_hdr the synthesizer headers to set - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t synth_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, - mrcp_synth_header_t *synth_hdr) -{ - /* loop through each param and add to synth header or vendor-specific-params */ - switch_hash_index_t *hi = NULL; - for (hi = switch_core_hash_first(schannel->params); hi; hi = switch_core_hash_next(&hi)) { - char *param_name = NULL, *param_val = NULL; - const void *key; - void *val; - switch_core_hash_this(hi, &key, NULL, &val); - param_name = (char *) key; - param_val = (char *) val; - if (!zstr(param_name) && !zstr(param_val)) { - unimrcp_param_id_t *id = (unimrcp_param_id_t *) switch_core_hash_find(schannel->application->param_id_map, param_name); - if (id) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) %s: %s\n", schannel->name, param_name, param_val); - synth_channel_set_header(schannel, id->id, param_val, msg, synth_hdr); - } else { - apt_str_t apt_param_name = { 0 }; - apt_str_t apt_param_val = { 0 }; - - /* this is probably a vendor-specific MRCP param */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) (vendor-specific value) %s: %s\n", schannel->name, param_name, param_val); - apt_string_set(&apt_param_name, param_name); /* copy isn't necessary since apt_pair_array_append will do it */ - apt_string_set(&apt_param_val, param_val); - if (!gen_hdr->vendor_specific_params) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) creating vendor specific pair array\n", schannel->name); - gen_hdr->vendor_specific_params = apt_pair_array_create(10, msg->pool); - } - apt_pair_array_append(gen_hdr->vendor_specific_params, &apt_param_name, &apt_param_val, msg->pool); - } - } - } - - if (gen_hdr->vendor_specific_params) { - mrcp_generic_header_property_add(msg, GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS); - } - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Set parameter in a synthesizer MRCP header - * - * @param schannel the speech channel containing the param - * @param id the UniMRCP header enum - * @param val the value to set - * @param msg the MRCP message to set - * @param synth_hdr the synthesizer header to set - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t synth_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_synth_header_t *synth_hdr) -{ - switch (id) { - case SYNTHESIZER_HEADER_VOICE_GENDER: - if (!strcasecmp("male", val)) { - synth_hdr->voice_param.gender = VOICE_GENDER_MALE; - } else if (!strcasecmp("female", val)) { - synth_hdr->voice_param.gender = VOICE_GENDER_FEMALE; - } else if (!strcasecmp("neutral", val)) { - synth_hdr->voice_param.gender = VOICE_GENDER_NEUTRAL; - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid voice gender, %s\n", schannel->name, val); - break; - } - mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_GENDER); - break; - - case SYNTHESIZER_HEADER_VOICE_AGE:{ - int age = atoi(val); - if (age > 0 && age < 1000) { - synth_hdr->voice_param.age = age; - mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_AGE); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid voice age, %s\n", schannel->name, val); - } - break; - } - - case SYNTHESIZER_HEADER_VOICE_VARIANT:{ - int variant = atoi(val); - if (variant > 0) { - synth_hdr->voice_param.variant = variant; - mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_VARIANT); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid voice variant, %s\n", schannel->name, val); - } - break; - } - - case SYNTHESIZER_HEADER_VOICE_NAME: - apt_string_assign(&synth_hdr->voice_param.name, val, msg->pool); - mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_VOICE_NAME); - break; - - case SYNTHESIZER_HEADER_KILL_ON_BARGE_IN: - synth_hdr->kill_on_barge_in = !strcasecmp("true", val); - mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_KILL_ON_BARGE_IN); - break; - - case SYNTHESIZER_HEADER_PROSODY_VOLUME: - if (switch_isdigit(*val) || *val == '.') { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_NUMERIC; - synth_hdr->prosody_param.volume.value.numeric = (float) atof(val); - } else if (*val == '+' || *val == '-') { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_RELATIVE_CHANGE; - synth_hdr->prosody_param.volume.value.relative = (float) atof(val); - } else if (!strcasecmp("silent", val)) { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL; - synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_SILENT; - } else if (!strcasecmp("x-soft", val)) { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL; - synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_XSOFT; - } else if (!strcasecmp("soft", val)) { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL; - synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_SOFT; - } else if (!strcasecmp("medium", val)) { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL; - synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_MEDIUM; - } else if (!strcasecmp("loud", val)) { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL; - synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_LOUD; - } else if (!strcasecmp("x-loud", val)) { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL; - synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_XLOUD; - } else if (!strcasecmp("default", val)) { - synth_hdr->prosody_param.volume.type = PROSODY_VOLUME_TYPE_LABEL; - synth_hdr->prosody_param.volume.value.label = PROSODY_VOLUME_DEFAULT; - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid prosody volume, %s\n", schannel->name, val); - break; - } - mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_PROSODY_VOLUME); - break; - - case SYNTHESIZER_HEADER_PROSODY_RATE: - if (switch_isdigit(*val) || *val == '.' || *val == '-') { - synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_RELATIVE_CHANGE; - synth_hdr->prosody_param.rate.value.relative = (float) atof(val); - } else if (!strcasecmp("x-slow", val)) { - synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL; - synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_XSLOW; - } else if (!strcasecmp("slow", val)) { - synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL; - synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_SLOW; - } else if (!strcasecmp("medium", val)) { - synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL; - synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_MEDIUM; - } else if (!strcasecmp("fast", val)) { - synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL; - synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_FAST; - } else if (!strcasecmp("x-fast", val)) { - synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL; - synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_XFAST; - } else if (!strcasecmp("default", val)) { - synth_hdr->prosody_param.rate.type = PROSODY_RATE_TYPE_LABEL; - synth_hdr->prosody_param.rate.value.label = PROSODY_RATE_DEFAULT; - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) ignoring invalid prosody rate, %s\n", schannel->name, val); - break; - } - mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_PROSODY_RATE); - break; - - case SYNTHESIZER_HEADER_SPEECH_LANGUAGE: - apt_string_assign(&synth_hdr->speech_language, val, msg->pool); - mrcp_resource_header_property_add(msg, SYNTHESIZER_HEADER_SPEECH_LANGUAGE); - break; - - /* unsupported by this module */ - case SYNTHESIZER_HEADER_JUMP_SIZE: - case SYNTHESIZER_HEADER_SPEAKER_PROFILE: - case SYNTHESIZER_HEADER_COMPLETION_CAUSE: - case SYNTHESIZER_HEADER_COMPLETION_REASON: - case SYNTHESIZER_HEADER_SPEECH_MARKER: - case SYNTHESIZER_HEADER_FETCH_HINT: - case SYNTHESIZER_HEADER_AUDIO_FETCH_HINT: - case SYNTHESIZER_HEADER_FAILED_URI: - case SYNTHESIZER_HEADER_FAILED_URI_CAUSE: - case SYNTHESIZER_HEADER_SPEAK_RESTART: - case SYNTHESIZER_HEADER_SPEAK_LENGTH: - case SYNTHESIZER_HEADER_LOAD_LEXICON: - case SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER: - default: - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) unsupported SYNTHESIZER_HEADER type\n", schannel->name); - } - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Stop SPEAK/RECOGNIZE request on speech channel - * - * @param schannel the channel - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t speech_channel_stop(speech_channel_t *schannel) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - int warned = 0; - switch_mutex_lock(schannel->mutex); - - if (schannel->state == SPEECH_CHANNEL_PROCESSING) { - mrcp_method_id method; - mrcp_message_t *mrcp_message; - if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) { - method = SYNTHESIZER_STOP; - } else { - method = RECOGNIZER_STOP; - } - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Stopping %s\n", schannel->name, speech_channel_type_to_string(schannel->type)); - /* Send STOP to MRCP server */ - mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, method); - if (mrcp_message == NULL) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Failed to create STOP message\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message); - while (schannel->state == SPEECH_CHANNEL_PROCESSING) { - if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) { - warned = 1; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) STOP has not COMPLETED after %d ms.\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000)); - } - } - - if (schannel->state == SPEECH_CHANNEL_ERROR) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Channel error\n", schannel->name); - schannel->state = SPEECH_CHANNEL_ERROR; - status = SWITCH_STATUS_FALSE; - goto done; - } - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) %s stopped\n", schannel->name, speech_channel_type_to_string(schannel->type)); - } else if (schannel->state == SPEECH_CHANNEL_DONE) { - speech_channel_set_state_unlocked(schannel, SPEECH_CHANNEL_READY); - } - - done: - - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Convert speech channel type into a string - * - * @param type the speech channel type - * @return the speech channel type as a string - */ -static const char *speech_channel_type_to_string(speech_channel_type_t type) -{ - switch (type) { - case SPEECH_CHANNEL_SYNTHESIZER: - return "SYNTHESIZER"; - case SPEECH_CHANNEL_RECOGNIZER: - return "RECOGNIZER"; - } - - return "UNKNOWN"; -} - -/** - * Set parameter - * - * @param schannel the speech channel - * @param param the parameter to set - * @param val the parameter value - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t speech_channel_set_param(speech_channel_t *schannel, const char *param, const char *val) -{ - switch_mutex_lock(schannel->mutex); - if (!zstr(param) && val != NULL) { - /* check if this is a FreeSWITCH param that needs to be translated to an MRCP param: e.g. voice ==> voice-name */ - const char *v; - const char *p = switch_core_hash_find(schannel->application->fs_param_map, param); - if (!p) { - p = switch_core_strdup(schannel->memory_pool, param); - } - v = switch_core_strdup(schannel->memory_pool, val); - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) param = %s, val = %s\n", schannel->name, p, v); - switch_core_hash_insert(schannel->params, p, v); - } - switch_mutex_unlock(schannel->mutex); - return SWITCH_STATUS_SUCCESS; -} - -/** - * Write synthesized speech / speech to be recognized - * - * @param schannel the speech channel - * @param data the speech data - * @param the number of octets to write / actual number written - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t speech_channel_write(speech_channel_t *schannel, void *data, switch_size_t *len) -{ - if (!schannel || !schannel->mutex || !schannel->audio_queue) { - return SWITCH_STATUS_FALSE; - } - - if (schannel->state == SPEECH_CHANNEL_PROCESSING) { - audio_queue_write(schannel->audio_queue, data, len); - } - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Read synthesized speech / speech to be recognized - * - * @param schannel the speech channel - * @param data the speech data - * @param the number of octets to read / actual number read - * @param block 1 if blocking is allowed - * @return SWITCH_STATUS_SUCCESS if successful, SWITCH_STATUS_BREAK if channel is no longer processing - */ -static switch_status_t speech_channel_read(speech_channel_t *schannel, void *data, switch_size_t *len, int block) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (!schannel || !schannel->mutex || !schannel->audio_queue) { - return SWITCH_STATUS_FALSE; - } - - switch (schannel->state) { - case SPEECH_CHANNEL_DONE: - /* pull any remaining audio - never blocking */ - if (audio_queue_read(schannel->audio_queue, data, len, 0) == SWITCH_STATUS_FALSE) { - /* all frames read */ - status = SWITCH_STATUS_BREAK; - } - break; - case SPEECH_CHANNEL_PROCESSING: - /* IN-PROGRESS */ - audio_queue_read(schannel->audio_queue, data, len, block); - break; - default: - status = SWITCH_STATUS_BREAK; - } - - return status; -} - -/** - * Convert channel state to string - * - * @param state the channel state - * @return string representation of the state - */ -static const char *speech_channel_state_to_string(speech_channel_state_t state) -{ - switch (state) { - case SPEECH_CHANNEL_CLOSED: - return "CLOSED"; - case SPEECH_CHANNEL_READY: - return "READY"; - case SPEECH_CHANNEL_PROCESSING: - return "PROCESSING"; - case SPEECH_CHANNEL_DONE: - return "DONE"; - case SPEECH_CHANNEL_ERROR: - return "ERROR"; - } - - return "UNKNOWN"; -} - -/** - * Set the current channel state - * - * @param schannel the channel - * @param state the new channel state - * @return SWITCH_STATUS_SUCCESS, if successful - */ -static switch_status_t speech_channel_set_state(speech_channel_t *schannel, speech_channel_state_t state) -{ - switch_status_t status; - switch_mutex_lock(schannel->mutex); - status = speech_channel_set_state_unlocked(schannel, state); - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Use this function to set the current channel state without locking the - * speech channel. Do this if you already have the speech channel locked. - * - * @param schannel the channel - * @param state the new channel state - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t speech_channel_set_state_unlocked(speech_channel_t *schannel, speech_channel_state_t state) -{ - if (schannel->state == SPEECH_CHANNEL_PROCESSING && state != SPEECH_CHANNEL_PROCESSING) { - /* wake anyone waiting for audio data */ - audio_queue_signal(schannel->audio_queue); - } - - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) %s ==> %s\n", schannel->name, speech_channel_state_to_string(schannel->state), - speech_channel_state_to_string(state)); - schannel->state = state; - switch_thread_cond_signal(schannel->cond); - return SWITCH_STATUS_SUCCESS; -} - -/** - * Process speech_open request from FreeSWITCH. This is expected to be called before every tts request made - * with synth_speech_feed_tts(), though the FreeSWITCH code has the option to cache the speech handle between - * TTS requests. - * - * @param sh the FreeSWITCH speech handle - * @param voice_name the voice to use - * @param rate the sampling rate requested - * @param channels the number of channels requested - * @param flags other options - * @return SWITCH_STATUS_SUCCESS if successful, otherwise SWITCH_STATUS_FALSE - */ -static switch_status_t synth_speech_open(switch_speech_handle_t *sh, const char *voice_name, int rate, int channels, switch_speech_flag_t *flags) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schannel = NULL; - const char *profile_name = sh->param; - profile_t *profile = NULL; - int speech_channel_number = get_next_speech_channel_number(); - char *name = NULL; - char *session_uuid = NULL; - switch_hash_index_t *hi = NULL; - - /* Name the channel */ - if (profile_name && strchr(profile_name, ':')) { - /* Profile has session name appended to it. Pick it out */ - profile_name = switch_core_strdup(sh->memory_pool, profile_name); - session_uuid = strchr(profile_name, ':'); - *session_uuid = '\0'; - session_uuid++; - session_uuid = switch_core_strdup(sh->memory_pool, session_uuid); - } else { - /* check if session is associated w/ this memory pool */ - switch_core_session_t *session = switch_core_memory_pool_get_data(sh->memory_pool, "__session"); - if (session) { - session_uuid = switch_core_session_get_uuid(session); - } - } - name = switch_core_sprintf(sh->memory_pool, "TTS-%d", speech_channel_number); - - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_INFO, - "speech_handle: name = %s, rate = %d, speed = %d, samples = %d, voice = %s, engine = %s, param = %s\n", sh->name, sh->rate, - sh->speed, sh->samples, sh->voice, sh->engine, sh->param); - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_INFO, "voice = %s, rate = %d\n", voice_name, rate); - - /* Allocate the channel */ - if (speech_channel_create(&schannel, name, session_uuid, SPEECH_CHANNEL_SYNTHESIZER, &globals.synth, (uint16_t) rate, sh->memory_pool) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto done; - } - sh->private_info = schannel; - schannel->fsh = sh; - - /* Open the channel */ - if (zstr(profile_name)) { - profile_name = globals.unimrcp_default_synth_profile; - } - profile = (profile_t *) switch_core_hash_find(globals.profiles, profile_name); - if (!profile) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_ERROR, "(%s) Can't find profile, %s\n", name, profile_name); - status = SWITCH_STATUS_FALSE; - goto done; - } - if ((status = speech_channel_open(schannel, profile)) != SWITCH_STATUS_SUCCESS) { - goto done; - } - - /* Set session TTS params */ - if (!zstr(voice_name)) { - speech_channel_set_param(schannel, "Voice-Name", voice_name); - } - - /* Set default TTS params */ - for (hi = switch_core_hash_first(profile->default_synth_params); hi; hi = switch_core_hash_next(&hi)) { - char *param_name = NULL, *param_val = NULL; - const void *key; - void *val; - switch_core_hash_this(hi, &key, NULL, &val); - param_name = (char *) key; - param_val = (char *) val; - speech_channel_set_param(schannel, param_name, param_val); - } - - done: - - return status; -} - -/** - * Process speech_close request from FreeSWITCH. This is called after the TTS request has completed - * and FreeSWITCH does not wish to cache the speech handle for another request. - * - * @param sh the FreeSWITCH speech handle - * @param flags other options - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t synth_speech_close(switch_speech_handle_t *sh, switch_speech_flag_t *flags) -{ - speech_channel_t *schannel = (speech_channel_t *) sh->private_info; - speech_channel_stop(schannel); - speech_channel_destroy(schannel); - return SWITCH_STATUS_SUCCESS; -} - -/** - * Process feed_tts request from FreeSWITCH. This is called by FreeSWITCH after speech_open. - * Send SPEAK request to MRCP server. - * - * @param sh the FreeSWITCH speech handle - * @param text the text to speak. This could be plain text, ssml, vxml, etc... this function will figure it out. - * @param flags other options - * @return SWITCH_STATUS_SUCCESS if TTS started successfully, SWITCH_STATUS_FALSE otherwise. - */ -static switch_status_t synth_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schannel = (speech_channel_t *) sh->private_info; - - if (zstr(text)) { - status = SWITCH_STATUS_FALSE; - } else { - status = synth_channel_speak(schannel, text); - } - return status; -} - -/** - * Process read_tts request from FreeSWITCH. FreeSWITCH is expecting L16 host byte ordered data. We must return - * exactly what is requested, otherwise FreeSWITCH won't play any audio. Pad the data with silence, if necessary. - * - * @param sh the FreeSWITCH speech handle - * @param data the read data - * @param datalen the amount of data requested / amount of data read - * @param flags other options - * @return SWITCH_STATUS_SUCCESS if data was read, SWITCH_STATUS_BREAK if TTS is done - */ -static switch_status_t synth_speech_read_tts(switch_speech_handle_t *sh, void *data, switch_size_t *datalen, switch_speech_flag_t *flags) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_size_t bytes_read; - speech_channel_t *schannel = (speech_channel_t *) sh->private_info; - bytes_read = *datalen; - if (speech_channel_read(schannel, data, &bytes_read, (*flags & SWITCH_SPEECH_FLAG_BLOCKING)) == SWITCH_STATUS_SUCCESS) { - /* pad data, if not enough read */ - if (bytes_read < *datalen) { -#ifdef MOD_UNIMRCP_DEBUG_AUDIO_QUEUE - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) adding %ld bytes of padding\n", schannel->name, *datalen - bytes_read); -#endif - memset((uint8_t *) data + bytes_read, schannel->silence, *datalen - bytes_read); - } - } else { - /* ready for next speak request */ - speech_channel_set_state(schannel, SPEECH_CHANNEL_READY); - *datalen = 0; - status = SWITCH_STATUS_BREAK; - } - - /* report negotiated sample rate back to FreeSWITCH */ - sh->native_rate = schannel->rate; - - return status; -} - -/** - * Process flush_tts request from FreeSWITCH. Interrupt current TTS request with STOP. - * This method is called by FreeSWITCH after a TTS request has finished, or if a request needs to be interrupted. - * - * @param sh the FreeSWITCH speech handle - */ -static void synth_speech_flush_tts(switch_speech_handle_t *sh) -{ - speech_channel_t *schannel = (speech_channel_t *) sh->private_info; - speech_channel_stop(schannel); -} - -/** - * Process text_param_tts request from FreeSWITCH. - * Update MRCP session text parameters. - * - * @param sh the FreeSWITCH speech handle - * @param param the parameter to set - * @param val the value to set the parameter to - */ -static void synth_speech_text_param_tts(switch_speech_handle_t *sh, char *param, const char *val) -{ - speech_channel_t *schannel = (speech_channel_t *) sh->private_info; - speech_channel_set_param(schannel, param, val); -} - -/** - * Process numeric_param_tts request from FreeSWITCH. - * Update MRCP session numeric parameters - * - * @param sh the FreeSWITCH speech handle - * @param param the parameter to set - * @param val the value to set the parameter to - */ -static void synth_speech_numeric_param_tts(switch_speech_handle_t *sh, char *param, int val) -{ - speech_channel_t *schannel = (speech_channel_t *) sh->private_info; - char *val_str = switch_mprintf("%d", val); - speech_channel_set_param(schannel, param, val_str); - switch_safe_free(val_str); -} - -/** - * Process float_param_tts request from FreeSWITCH. - * Update MRCP session float parameters - * - * @param sh the FreeSWITCH speech handle - * @param param the parameter to set - * @param val the value to set the parameter to - */ -static void synth_speech_float_param_tts(switch_speech_handle_t *sh, char *param, double val) -{ - speech_channel_t *schannel = (speech_channel_t *) sh->private_info; - char *val_str = switch_mprintf("%f", val); - speech_channel_set_param(schannel, param, val_str); - switch_safe_free(val_str); -} - -/** - * Process UniMRCP messages for the synthesizer application. All MRCP synthesizer callbacks start here first. - * - * @param app_message the application message - */ -static apt_bool_t synth_message_handler(const mrcp_app_message_t *app_message) -{ - /* call the appropriate callback in the dispatcher function table based on the app_message received */ - return mrcp_application_message_dispatch(&globals.synth.dispatcher, app_message); -} - -/** - * Handle the UniMRCP responses sent to session terminate requests - * - * @param application the MRCP application - * @param session the MRCP session - * @param status the result of the session terminate request - * @return TRUE - */ -static apt_bool_t speech_on_session_terminate(mrcp_application_t *application, mrcp_session_t *session, mrcp_sig_status_code_e status) -{ - speech_channel_t *schannel = (speech_channel_t *) mrcp_application_session_object_get(session); - switch_event_t *event = NULL; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Destroying MRCP session\n", schannel->name); - mrcp_application_session_destroy(session); - - /* notify of channel close */ - if (schannel->channel_opened && globals.enable_profile_events) { - switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_CLOSE); - if (event) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Profile", schannel->profile->name); - if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "TTS"); - } else { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "ASR"); - } - switch_event_fire(&event); - } - } - speech_channel_set_state(schannel, SPEECH_CHANNEL_CLOSED); - - return TRUE; -} - -/** - * Handle the UniMRCP responses sent to channel add requests - * - * @param application the MRCP application - * @param session the MRCP session - * @param channel the MRCP channel - * @param status the result of the channel add request - * @return TRUE - */ -static apt_bool_t speech_on_channel_add(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, - mrcp_sig_status_code_e status) -{ - switch_event_t *event = NULL; - speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel); - char codec_name[60] = { 0 }; - const mpf_codec_descriptor_t *descriptor; - - /* check status */ - if (!session || !schannel || status != MRCP_SIG_STATUS_CODE_SUCCESS) { - goto error; - } - - /* what sample rate did we negotiate? */ - if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) { - descriptor = mrcp_application_sink_descriptor_get(channel); - } else { - descriptor = mrcp_application_source_descriptor_get(channel); - } - if (!descriptor) { - goto error; - } - - schannel->rate = descriptor->sampling_rate; - - /* report negotiated sample rate back to FreeSWITCH */ - if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) { - ((switch_speech_handle_t*)schannel->fsh)->native_rate = schannel->rate; - } else { - ((switch_asr_handle_t*)schannel->fsh)->native_rate = schannel->rate; - } - - if (descriptor->name.length) { - strncpy(codec_name, descriptor->name.buf, sizeof(codec_name) - 1 ); - } - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) %s channel is ready, codec = %s, sample rate = %d\n", schannel->name, - speech_channel_type_to_string(schannel->type), codec_name, schannel->rate); - speech_channel_set_state(schannel, SPEECH_CHANNEL_READY); - - /* notify of channel open */ - if (globals.enable_profile_events && switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_OPEN) == SWITCH_STATUS_SUCCESS) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Profile", schannel->profile->name); - if (schannel->type == SPEECH_CHANNEL_SYNTHESIZER) { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "TTS"); - } else { - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "MRCP-Resource-Type", "ASR"); - } - switch_event_fire(&event); - } - schannel->channel_opened = 1; - - return TRUE; - -error: - if (schannel) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) %s channel error!\n", schannel->name, - speech_channel_type_to_string(schannel->type)); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "(unknown) channel error!\n"); - } - - return TRUE; -} - - -/** - * Handle the UniMRCP responses sent to channel remove requests - * - * @param application the MRCP application - * @param session the MRCP session - * @param channel the MRCP channel - * @param status the result of the channel remove request - * @return TRUE - */ -static apt_bool_t speech_on_channel_remove(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, - mrcp_sig_status_code_e status) -{ - speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel); - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_INFO, "(%s) %s channel is removed\n", schannel->name, speech_channel_type_to_string(schannel->type)); - schannel->unimrcp_channel = NULL; - - if (session) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Terminating MRCP session\n", schannel->name); - mrcp_application_session_terminate(session); - } - - return TRUE; -} - -/** - * Handle the MRCP synthesizer responses/events from UniMRCP - * - * @param application the MRCP application - * @param session the MRCP session - * @param channel the MRCP channel - * @param message the MRCP message - * @return TRUE - */ -static apt_bool_t synth_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel); - if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - /* received MRCP response */ - if (message->start_line.method_id == SYNTHESIZER_SPEAK) { - /* received the response to SPEAK request */ - if (message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - /* waiting for SPEAK-COMPLETE event */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) REQUEST IN PROGRESS\n", schannel->name); - speech_channel_set_state(schannel, SPEECH_CHANNEL_PROCESSING); - } else { - /* received unexpected request_state */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected SPEAK response, request_state = %d\n", schannel->name, - message->start_line.request_state); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } else if (message->start_line.method_id == SYNTHESIZER_STOP) { - /* received response to the STOP request */ - if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) { - /* got COMPLETE */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) COMPLETE\n", schannel->name); - speech_channel_set_state(schannel, SPEECH_CHANNEL_DONE); - } else { - /* received unexpected request state */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected STOP response, request_state = %d\n", schannel->name, - message->start_line.request_state); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } else { - /* received unexpected response */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name, - (int) message->start_line.method_id); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - /* received MRCP event */ - if (message->start_line.method_id == SYNTHESIZER_SPEAK_COMPLETE) { - /* got SPEAK-COMPLETE */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) SPEAK-COMPLETE\n", schannel->name); - speech_channel_set_state(schannel, SPEECH_CHANNEL_DONE); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name, - (int) message->start_line.method_id); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name, - message->start_line.message_type); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - - return TRUE; -} - -/** - * Incoming TTS data from UniMRCP - * - * @param stream the audio stream sending data - * @param frame the data - * @return TRUE - */ -static apt_bool_t synth_stream_write(mpf_audio_stream_t *stream, const mpf_frame_t *frame) -{ - switch_size_t size = frame->codec_frame.size; - speech_channel_t *schannel = (speech_channel_t *) stream->obj; - speech_channel_write(schannel, frame->codec_frame.buffer, &size); - return TRUE; -} - -/** - * Link the synthesizer module interface to FreeSWITCH and UniMRCP - * - * @param module_interface mod_unimrcp's interface - * @param pool the memory pool to use for all allocations - * @return SWITCH_STATUS_SUCCESS if successful, SWITCH_STATUS_FALSE otherwise - */ -static switch_status_t synth_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool) -{ - /* link to FreeSWITCH ASR / TTS callbacks */ - switch_speech_interface_t *speech_interface = NULL; - if ((speech_interface = (switch_speech_interface_t *) switch_loadable_module_create_interface(module_interface, SWITCH_SPEECH_INTERFACE)) == NULL) { - return SWITCH_STATUS_FALSE; - } - speech_interface->interface_name = MOD_UNIMRCP; - speech_interface->speech_open = synth_speech_open; - speech_interface->speech_close = synth_speech_close; - speech_interface->speech_feed_tts = synth_speech_feed_tts; - speech_interface->speech_read_tts = synth_speech_read_tts; - speech_interface->speech_flush_tts = synth_speech_flush_tts; - speech_interface->speech_text_param_tts = synth_speech_text_param_tts; - speech_interface->speech_numeric_param_tts = synth_speech_numeric_param_tts; - speech_interface->speech_float_param_tts = synth_speech_float_param_tts; - - /* Create the synthesizer application and link its callbacks to UniMRCP */ - if ((globals.synth.app = mrcp_application_create(synth_message_handler, (void *) 0, pool)) == NULL) { - return SWITCH_STATUS_FALSE; - } - globals.synth.dispatcher.on_session_update = NULL; - globals.synth.dispatcher.on_session_terminate = speech_on_session_terminate; - globals.synth.dispatcher.on_channel_add = speech_on_channel_add; - globals.synth.dispatcher.on_channel_remove = speech_on_channel_remove; - globals.synth.dispatcher.on_message_receive = synth_on_message_receive; - globals.synth.audio_stream_vtable.destroy = NULL; - globals.synth.audio_stream_vtable.open_rx = NULL; - globals.synth.audio_stream_vtable.close_rx = NULL; - globals.synth.audio_stream_vtable.read_frame = NULL; - globals.synth.audio_stream_vtable.open_tx = NULL; - globals.synth.audio_stream_vtable.close_tx = NULL; - globals.synth.audio_stream_vtable.write_frame = synth_stream_write; - mrcp_client_application_register(globals.mrcp_client, globals.synth.app, "synth"); - - /* map FreeSWITCH params to MRCP param */ - switch_core_hash_init_nocase(&globals.synth.fs_param_map); - switch_core_hash_insert(globals.synth.fs_param_map, "voice", "voice-name"); - - /* map MRCP params to UniMRCP ID */ - switch_core_hash_init_nocase(&globals.synth.param_id_map); - switch_core_hash_insert(globals.synth.param_id_map, "jump-size", unimrcp_param_id_create(SYNTHESIZER_HEADER_JUMP_SIZE, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "kill-on-barge-in", unimrcp_param_id_create(SYNTHESIZER_HEADER_KILL_ON_BARGE_IN, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "speaker-profile", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAKER_PROFILE, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "completion-cause", unimrcp_param_id_create(SYNTHESIZER_HEADER_COMPLETION_CAUSE, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "completion-reason", unimrcp_param_id_create(SYNTHESIZER_HEADER_COMPLETION_REASON, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "voice-gender", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_GENDER, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "voice-age", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_AGE, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "voice-variant", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_VARIANT, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "voice-name", unimrcp_param_id_create(SYNTHESIZER_HEADER_VOICE_NAME, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "prosody-volume", unimrcp_param_id_create(SYNTHESIZER_HEADER_PROSODY_VOLUME, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "prosody-rate", unimrcp_param_id_create(SYNTHESIZER_HEADER_PROSODY_RATE, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "speech-marker", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEECH_MARKER, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "speech-language", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEECH_LANGUAGE, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "fetch-hint", unimrcp_param_id_create(SYNTHESIZER_HEADER_FETCH_HINT, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "audio-fetch-hint", unimrcp_param_id_create(SYNTHESIZER_HEADER_AUDIO_FETCH_HINT, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "failed-uri", unimrcp_param_id_create(SYNTHESIZER_HEADER_FAILED_URI, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "failed-uri-cause", unimrcp_param_id_create(SYNTHESIZER_HEADER_FAILED_URI_CAUSE, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "speak-restart", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAK_RESTART, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "speak-length", unimrcp_param_id_create(SYNTHESIZER_HEADER_SPEAK_LENGTH, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "load-lexicon", unimrcp_param_id_create(SYNTHESIZER_HEADER_LOAD_LEXICON, pool)); - switch_core_hash_insert(globals.synth.param_id_map, "lexicon-search-order", unimrcp_param_id_create(SYNTHESIZER_HEADER_LEXICON_SEARCH_ORDER, pool)); - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Shut down the synthesizer - * - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t synth_shutdown() -{ - if (globals.synth.fs_param_map) { - switch_core_hash_destroy(&globals.synth.fs_param_map); - } - if (globals.synth.param_id_map) { - switch_core_hash_destroy(&globals.synth.param_id_map); - } - return SWITCH_STATUS_SUCCESS; -} - -/** - * Create a grammar object to reference in recognition requests - * - * @param grammar the grammar - * @param name the name of the grammar - * @param type the type of the grammar (URI, SRGS, or GSL) - * @param data the grammar data (or URI) - * @param pool memory pool to allocate from - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t grammar_create(grammar_t ** grammar, const char *name, grammar_type_t type, const char *data, switch_memory_pool_t *pool) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - grammar_t *g = (grammar_t *) switch_core_alloc(pool, sizeof(grammar_t)); - if (g == NULL) { - status = SWITCH_STATUS_FALSE; - *grammar = NULL; - } else { - g->name = switch_core_strdup(pool, name); - g->type = type; - g->data = switch_core_strdup(pool, data); - *grammar = g; - } - - return status; -} - -/** - * Get the MIME type for this grammar type - * @param type the grammar type - * @param profile the profile requesting the type - * @return the MIME type - */ -static const char *grammar_type_to_mime(grammar_type_t type, profile_t *profile) -{ - switch (type) { - case GRAMMAR_TYPE_UNKNOWN: - return ""; - case GRAMMAR_TYPE_URI: - return "text/uri-list"; - case GRAMMAR_TYPE_SRGS: - return profile->srgs_mime_type; - case GRAMMAR_TYPE_SRGS_XML: - return profile->srgs_xml_mime_type; - case GRAMMAR_TYPE_NUANCE_GSL: - return profile->gsl_mime_type; - case GRAMMAR_TYPE_JSGF: - return profile->jsgf_mime_type; - case GRAMMAR_TYPE_XML: - return profile->xml_mime_type; - } - return ""; -} - -/** - * Start RECOGNIZE request - * - * @param schannel the channel to start - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_channel_start(speech_channel_t *schannel) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - switch_hash_index_t *egk; - mrcp_message_t *mrcp_message; - mrcp_recog_header_t *recog_header; - mrcp_generic_header_t *generic_header; - recognizer_data_t *r; - char *start_input_timers; - const char *mime_type; - char *key = NULL; - switch_size_t len; - grammar_t *grammar = NULL; - switch_size_t grammar_uri_count = 0; - switch_size_t grammar_uri_list_len = 0; - char *grammar_uri_list = NULL; - int warned = 0; - - switch_mutex_lock(schannel->mutex); - if (schannel->state != SPEECH_CHANNEL_READY) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - if (schannel->data == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - r = (recognizer_data_t *) schannel->data; - r->result = NULL; - if (r->result_headers) { - switch_event_destroy(&r->result_headers); - } - r->start_of_input = 0; - - /* input timers are started by default unless the start-input-timers=false param is set */ - start_input_timers = (char *) switch_core_hash_find(schannel->params, "start-input-timers"); - r->timers_started = zstr(start_input_timers) || strcasecmp(start_input_timers, "false"); - - /* count enabled grammars */ - for (egk = switch_core_hash_first(r->enabled_grammars); egk; egk = switch_core_hash_next(&egk)) { - // NOTE: This postponed type check is necessary to allow a non-URI-list grammar to execute alone - if (grammar_uri_count == 1 && grammar->type != GRAMMAR_TYPE_URI) - goto no_grammar_alone; - ++grammar_uri_count; - switch_core_hash_this(egk, (void *) &key, NULL, (void *) &grammar); - if (grammar->type != GRAMMAR_TYPE_URI && grammar_uri_count != 1) { - no_grammar_alone: - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Grammar '%s' can only be used alone (not a URI list)\n", schannel->name, key); - status = SWITCH_STATUS_FALSE; - switch_safe_free(egk); - goto done; - } - len = strlen(grammar->data); - if (!len) - continue; - grammar_uri_list_len += len; - if (grammar->data[len - 1] != '\n') - grammar_uri_list_len += 2; - } - - switch (grammar_uri_count) { - case 0: - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) No grammar specified\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - case 1: - /* grammar should already be the unique grammar */ - break; - default: - /* get the enabled grammars list */ - grammar_uri_list = switch_core_alloc(schannel->memory_pool, grammar_uri_list_len + 1); - grammar_uri_list_len = 0; - for (egk = switch_core_hash_first(r->enabled_grammars); egk; egk = switch_core_hash_next(&egk)) { - switch_core_hash_this(egk, (void *) &key, NULL, (void *) &grammar); - len = strlen(grammar->data); - if (!len) - continue; - memcpy(&(grammar_uri_list[grammar_uri_list_len]), grammar->data, len); - grammar_uri_list_len += len; - if (grammar_uri_list[grammar_uri_list_len - 1] != '\n') - { - grammar_uri_list_len += 2; - grammar_uri_list[grammar_uri_list_len - 2] = '\r'; - grammar_uri_list[grammar_uri_list_len - 1] = '\n'; - } - } - grammar_uri_list[grammar_uri_list_len++] = '\0'; - grammar = NULL; - } - - /* create MRCP message */ - mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_RECOGNIZE); - if (mrcp_message == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* allocate generic header */ - generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message); - if (generic_header == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* set Content-Type */ - mime_type = grammar_type_to_mime(grammar ? grammar->type : GRAMMAR_TYPE_URI, schannel->profile); - if (zstr(mime_type)) { - status = SWITCH_STATUS_FALSE; - goto done; - } - apt_string_assign(&generic_header->content_type, mime_type, mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE); - - /* set Content-ID for inline grammars */ - if (grammar && grammar->type != GRAMMAR_TYPE_URI) { - apt_string_assign(&generic_header->content_id, grammar->name, mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_ID); - } - - /* allocate recognizer-specific header */ - recog_header = (mrcp_recog_header_t *) mrcp_resource_header_prepare(mrcp_message); - if (recog_header == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* set Cancel-If-Queue */ - if (mrcp_message->start_line.version == MRCP_VERSION_2) { - recog_header->cancel_if_queue = FALSE; - mrcp_resource_header_property_add(mrcp_message, RECOGNIZER_HEADER_CANCEL_IF_QUEUE); - } - - /* set parameters */ - recog_channel_set_params(schannel, mrcp_message, generic_header, recog_header); - - /* set message body */ - apt_string_assign(&mrcp_message->body, grammar ? grammar->data : grammar_uri_list, mrcp_message->pool); - - /* Empty audio queue and send RECOGNIZE to MRCP server */ - audio_queue_clear(schannel->audio_queue); - if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) { - status = SWITCH_STATUS_FALSE; - goto done; - } - /* wait for IN-PROGRESS */ - while (schannel->state == SPEECH_CHANNEL_READY) { - if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) { - warned = 1; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) IN-PROGRESS not received for RECOGNIZE after %d ms.\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000)); - } - } - if (schannel->state != SPEECH_CHANNEL_PROCESSING) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - done: - - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Load speech recognition grammar - * - * @param schannel the recognizer channel - * @param name the name of this grammar - * @param type the grammar type - * @param data the grammar data (or URI) - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_channel_load_grammar(speech_channel_t *schannel, const char *name, grammar_type_t type, const char *data) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - grammar_t *g = NULL; - char *ldata = NULL; - - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Loading grammar %s, data = %s\n", schannel->name, name, data); - - switch_mutex_lock(schannel->mutex); - if (schannel->state != SPEECH_CHANNEL_READY) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* if inline or requested via define-grammar param, use DEFINE-GRAMMAR to cache it on the server */ - if (type != GRAMMAR_TYPE_URI || switch_true(switch_core_hash_find(schannel->params, "define-grammar"))) { - mrcp_message_t *mrcp_message; - mrcp_generic_header_t *generic_header; - const char *mime_type; - int warned = 0; - - /* create MRCP message */ - mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_DEFINE_GRAMMAR); - if (mrcp_message == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* set Content-Type and Content-ID in message */ - generic_header = (mrcp_generic_header_t *) mrcp_generic_header_prepare(mrcp_message); - if (generic_header == NULL) { - status = SWITCH_STATUS_FALSE; - goto done; - } - mime_type = grammar_type_to_mime(type, schannel->profile); - if (zstr(mime_type)) { - status = SWITCH_STATUS_FALSE; - goto done; - } - apt_string_assign(&generic_header->content_type, mime_type, mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_TYPE); - apt_string_assign(&generic_header->content_id, name, mrcp_message->pool); - mrcp_generic_header_property_add(mrcp_message, GENERIC_HEADER_CONTENT_ID); - - /* put grammar in message body */ - apt_string_assign(&mrcp_message->body, data, mrcp_message->pool); - - /* send message and wait for response */ - speech_channel_set_state_unlocked(schannel, SPEECH_CHANNEL_PROCESSING); - if (mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message) == FALSE) { - status = SWITCH_STATUS_FALSE; - goto done; - } - while (schannel->state == SPEECH_CHANNEL_PROCESSING) { - if (switch_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC) == SWITCH_STATUS_TIMEOUT && !warned) { - warned = 1; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) DEFINE-GRAMMAR not COMPLETED after %d ms.\n", schannel->name, SPEECH_CHANNEL_TIMEOUT_USEC / (1000)); - } - } - if (schannel->state != SPEECH_CHANNEL_READY) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* set up name, type for future RECOGNIZE requests. We'll reference this cached grammar by name */ - ldata = switch_mprintf("session:%s", name); - data = ldata; - type = GRAMMAR_TYPE_URI; - } - - /* Create the grammar and save it */ - if ((status = grammar_create(&g, name, type, data, schannel->memory_pool)) == SWITCH_STATUS_SUCCESS) { - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - switch_core_hash_insert(r->grammars, g->name, g); - } - - done: - - switch_mutex_unlock(schannel->mutex); - switch_safe_free(ldata); - - return status; -} - -/** - * Unload speech recognition grammar - * - * @param schannel the recognizer channel - * @param grammar_name the name of the grammar to unload - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_channel_unload_grammar(speech_channel_t *schannel, const char *grammar_name) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (zstr(grammar_name)) { - status = SWITCH_STATUS_FALSE; - } else { - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Unloading grammar %s\n", schannel->name, grammar_name); - switch_core_hash_delete(r->enabled_grammars, grammar_name); - switch_core_hash_delete(r->grammars, grammar_name); - } - - return status; -} - -/** - * Enable speech recognition grammar - * - * @param schannel the recognizer channel - * @param grammar_name the name of the grammar to enable - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_channel_enable_grammar(speech_channel_t *schannel, const char *grammar_name) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (zstr(grammar_name)) { - status = SWITCH_STATUS_FALSE; - } else { - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - grammar_t *grammar; - grammar = (grammar_t *) switch_core_hash_find(r->grammars, grammar_name); - if (grammar == NULL) - { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Undefined grammar, %s\n", schannel->name, grammar_name); - status = SWITCH_STATUS_FALSE; - } - else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Enabling grammar %s\n", schannel->name, grammar_name); - switch_core_hash_insert(r->enabled_grammars, grammar_name, grammar); - } - } - - return status; -} - -/** - * Disable speech recognition grammar - * - * @param schannel the recognizer channel - * @param grammar_name the name of the grammar to disable - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_channel_disable_grammar(speech_channel_t *schannel, const char *grammar_name) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (zstr(grammar_name)) { - status = SWITCH_STATUS_FALSE; - } else { - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Disabling grammar %s\n", schannel->name, grammar_name); - switch_core_hash_delete(r->enabled_grammars, grammar_name); - } - - return status; -} - -/** - * Disable all speech recognition grammars - * - * @param schannel the recognizer channel - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_channel_disable_all_grammars(speech_channel_t *schannel) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Disabling all grammars\n", schannel->name); - switch_core_hash_destroy(&r->enabled_grammars); - switch_core_hash_init(&r->enabled_grammars); - - return status; -} - -/** - * Check if recognition is complete - * - * @return SWITCH_STATUS_SUCCESS if results available or start of input - */ -static switch_status_t recog_channel_check_results(speech_channel_t *schannel) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - recognizer_data_t *r; - switch_mutex_lock(schannel->mutex); - r = (recognizer_data_t *) schannel->data; - if (!zstr(r->result)) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) SUCCESS, have result\n", schannel->name); - } else if (r->start_of_input == START_OF_INPUT_RECEIVED) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) SUCCESS, start of input\n", schannel->name); - } else { - status = SWITCH_STATUS_FALSE; - } - - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Start recognizer's input timers - * - * @return SWITCH_STATUS_SUCCESS if timers were started - */ -static switch_status_t recog_channel_start_input_timers(speech_channel_t *schannel) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - switch_mutex_lock(schannel->mutex); - - if (schannel->state == SPEECH_CHANNEL_PROCESSING && !r->timers_started && !r->start_of_input) { - mrcp_message_t *mrcp_message; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Starting input timers\n", schannel->name); - /* Send START-INPUT-TIMERS to MRCP server */ - mrcp_message = mrcp_application_message_create(schannel->unimrcp_session, schannel->unimrcp_channel, RECOGNIZER_START_INPUT_TIMERS); - if (mrcp_message == NULL) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Failed to create START-INPUT-TIMERS message\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - /* set it and forget it */ - mrcp_application_message_send(schannel->unimrcp_session, schannel->unimrcp_channel, mrcp_message); - } - - done: - - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Flag that input has started - * - * @param schannel the channel that has heard input - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t recog_channel_set_start_of_input(speech_channel_t *schannel) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - recognizer_data_t *r; - switch_mutex_lock(schannel->mutex); - r = (recognizer_data_t *) schannel->data; - r->start_of_input = START_OF_INPUT_RECEIVED; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) start of input\n", schannel->name); - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Set the recognition results - * - * @param schannel the channel whose results are set - * @param result the results - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_channel_set_results(speech_channel_t *schannel, const char *result) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - recognizer_data_t *r; - switch_mutex_lock(schannel->mutex); - r = (recognizer_data_t *) schannel->data; - if (!zstr(r->result)) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result is already set\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - if (zstr(result)) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result is NULL\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, result); - r->result = switch_core_strdup(schannel->memory_pool, result); - - done: - - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Find a parameter from a ;-separated string - * - * @param str the input string to find data in - * @param param the parameter to to look for - * @return a pointer in the str if successful, or NULL. - */ -static char *find_parameter(const char *str, const char *param) -{ - char *ptr = (char *) str; - - while (ptr) { - if (!strncasecmp(ptr, param, strlen(param))) - return ptr; - - if ((ptr = strchr(ptr, ';'))) - ptr++; - - while (ptr && *ptr == ' ') { - ptr++; - } - } - - return NULL; -} - -/** - * Get a parameter value from a ;-separated string - * - * @param str the input string to parse data from - * @param param the parameter to to look for - * @return a malloc'ed char* if successful, or NULL. - */ -static char *get_parameter_value(const char *str, const char *param) -{ - const char *param_ptr; - char *param_value = NULL; - char *tmp; - switch_size_t param_len; - char *param_tmp; - - if (zstr(str) || zstr(param)) return NULL; - - /* Append "=" to the end of the string */ - param_tmp = switch_mprintf("%s=", param); - if (!param_tmp) return NULL; - param = param_tmp; - - param_len = strlen(param); - param_ptr = find_parameter(str, param); - - if (zstr(param_ptr)) goto fail; - - param_value = strdup(param_ptr + param_len); - - if (zstr(param_value)) goto fail; - - if ((tmp = strchr(param_value, ';'))) *tmp = '\0'; - - switch_safe_free(param_tmp); - return param_value; - - fail: - switch_safe_free(param_tmp); - switch_safe_free(param_value); - return NULL; -} - -/** - * Set the recognition result headers - * - * @param schannel the channel whose results are set - * @param recog_hdr the recognition headers - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_channel_set_result_headers(speech_channel_t *schannel, mrcp_recog_header_t *recog_hdr) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - recognizer_data_t *r; - - switch_mutex_lock(schannel->mutex); - - r = (recognizer_data_t *) schannel->data; - - if (r->result_headers) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result headers are already set\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - - if (!recog_hdr) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result headers are NULL\n", schannel->name); - status = SWITCH_STATUS_FALSE; - goto done; - } - - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) ASR adding result headers\n", schannel->name); - - if ((status = switch_event_create(&r->result_headers, SWITCH_EVENT_CLONE)) == SWITCH_STATUS_SUCCESS) { - - switch_event_add_header(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Completion-Cause", "%d", recog_hdr->completion_cause); - - if (!zstr(recog_hdr->completion_reason.buf)) { - switch_event_add_header_string(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Completion-Reason", recog_hdr->completion_reason.buf); - } - - if (!zstr(recog_hdr->waveform_uri.buf)) { - char *tmp; - - if ((tmp = strdup(recog_hdr->waveform_uri.buf))) { - char *tmp2; - if ((tmp2 = strchr(tmp, ';'))) *tmp2 = '\0'; - switch_event_add_header_string(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Waveform-URI", tmp); - free(tmp); - } - - if ((tmp = get_parameter_value(recog_hdr->waveform_uri.buf, "size"))) { - switch_event_add_header_string(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Waveform-Size", tmp); - free(tmp); - } - - if ((tmp = get_parameter_value(recog_hdr->waveform_uri.buf, "duration"))) { - switch_event_add_header_string(r->result_headers, SWITCH_STACK_BOTTOM, "ASR-Waveform-Duration", tmp); - free(tmp); - } - } - } - - done: - - switch_mutex_unlock(schannel->mutex); - - return status; -} - -/** - * Get the recognition results. - * - * @param schannel the channel to get results from - * @param result the results. free() the results when finished with them. - * @return SWITCH_STATUS_SUCCESS if there are results, SWITCH_STATUS_BREAK if start of input - */ -static switch_status_t recog_channel_get_results(speech_channel_t *schannel, char **result) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - switch_mutex_lock(schannel->mutex); - if (!zstr(r->result)) { - *result = strdup(r->result); - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) result:\n\n%s\n", schannel->name, *result ? *result : ""); - r->result = NULL; - r->start_of_input = START_OF_INPUT_REPORTED; - } else if (r->start_of_input == START_OF_INPUT_RECEIVED) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) start of input\n", schannel->name); - status = SWITCH_STATUS_BREAK; - r->start_of_input = START_OF_INPUT_REPORTED; - } else { - status = SWITCH_STATUS_FALSE; - } - - switch_mutex_unlock(schannel->mutex); - return status; -} - -/** - * Get the recognition result headers. - * - * @param schannel the channel to get results from - * @param result_headers the recognition result headers. switch_event_destroy() the results when finished with them. - * @return SWITCH_STATUS_SUCCESS will always be returned, since this is just optional data. - */ -static switch_status_t recog_channel_get_result_headers(speech_channel_t *schannel, switch_event_t **result_headers) -{ - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - - switch_mutex_lock(schannel->mutex); - - if (r->result_headers && result_headers) { - *result_headers = r->result_headers; - r->result_headers = NULL; - } - - switch_mutex_unlock(schannel->mutex); - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Set parameters in a recognizer MRCP header - * - * @param schannel the speech channel containing the params - * @param msg the MRCP message to set - * @param gen_hdr the generic headers to set - * @param recog_hdr the recognizer headers to set - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t recog_channel_set_params(speech_channel_t *schannel, mrcp_message_t *msg, mrcp_generic_header_t *gen_hdr, - mrcp_recog_header_t *recog_hdr) -{ - /* loop through each param and add to recog header or vendor-specific-params */ - switch_hash_index_t *hi = NULL; - for (hi = switch_core_hash_first(schannel->params); hi; hi = switch_core_hash_next(&hi)) { - char *param_name = NULL, *param_val = NULL; - const void *key; - void *val; - switch_core_hash_this(hi, &key, NULL, &val); - param_name = (char *) key; - param_val = (char *) val; - if (!zstr(param_name) && !zstr(param_val)) { - unimrcp_param_id_t *id = (unimrcp_param_id_t *) switch_core_hash_find(schannel->application->param_id_map, param_name); - if (id) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) \"%s\": \"%s\"\n", schannel->name, param_name, param_val); - recog_channel_set_header(schannel, id->id, param_val, msg, recog_hdr); - } else if (!strcasecmp(param_name, "define-grammar")) { - // This parameter is used internally only, not in MRCP headers - } else if (!strcasecmp(param_name, "name")) { - // This parameter is used internally only, not in MRCP headers - } else if (!strcasecmp(param_name, "start-recognize")) { - // This parameter is used internally only, not in MRCP headers - } else { - /* this is probably a vendor-specific MRCP param */ - apt_str_t apt_param_name = { 0 }; - apt_str_t apt_param_val = { 0 }; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) (vendor-specific value) %s: %s\n", schannel->name, param_name, param_val); - apt_string_set(&apt_param_name, param_name); /* copy isn't necessary since apt_pair_array_append will do it */ - apt_string_set(&apt_param_val, param_val); - if (!gen_hdr->vendor_specific_params) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) creating vendor specific pair array\n", schannel->name); - gen_hdr->vendor_specific_params = apt_pair_array_create(10, msg->pool); - } - apt_pair_array_append(gen_hdr->vendor_specific_params, &apt_param_name, &apt_param_val, msg->pool); - } - } - } - - if (gen_hdr->vendor_specific_params) { - mrcp_generic_header_property_add(msg, GENERIC_HEADER_VENDOR_SPECIFIC_PARAMS); - } - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Set parameter in a recognizer MRCP header - * - * @param schannel the speech channel containing the param - * @param id the UniMRCP header enum - * @param val the value to set - * @param msg the MRCP message to set - * @param recog_hdr the recognizer header to set - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t recog_channel_set_header(speech_channel_t *schannel, int id, char *val, mrcp_message_t *msg, mrcp_recog_header_t *recog_hdr) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - - switch (id) { - case RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD: - recog_hdr->confidence_threshold = (float) atof(val); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD); - break; - - case RECOGNIZER_HEADER_SENSITIVITY_LEVEL: - recog_hdr->sensitivity_level = (float) atof(val); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SENSITIVITY_LEVEL); - break; - - case RECOGNIZER_HEADER_SPEED_VS_ACCURACY: - recog_hdr->speed_vs_accuracy = (float) atof(val); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEED_VS_ACCURACY); - break; - - case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:{ - int n_best_list_length = atoi(val); - if (n_best_list_length > 0) { - recog_hdr->n_best_list_length = n_best_list_length; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_N_BEST_LIST_LENGTH); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid n best list length, \"%s\"\n", schannel->name, val); - } - break; - } - case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:{ - int no_input_timeout = atoi(val); - if (no_input_timeout >= 0) { - recog_hdr->no_input_timeout = no_input_timeout; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_NO_INPUT_TIMEOUT); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid no input timeout, \"%s\"\n", schannel->name, val); - } - break; - } - case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:{ - int recognition_timeout = atoi(val); - if (recognition_timeout >= 0) { - recog_hdr->recognition_timeout = recognition_timeout; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_TIMEOUT); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid recognition timeout, \"%s\"\n", schannel->name, val); - } - break; - } - case RECOGNIZER_HEADER_START_INPUT_TIMERS: - recog_hdr->start_input_timers = !strcasecmp("true", val); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_START_INPUT_TIMERS); - break; - case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:{ - int speech_complete_timeout = atoi(val); - if (speech_complete_timeout >= 0) { - recog_hdr->speech_complete_timeout = speech_complete_timeout; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech complete timeout, \"%s\"\n", schannel->name, val); - } - break; - } - case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:{ - int speech_incomplete_timeout = atoi(val); - if (speech_incomplete_timeout >= 0) { - recog_hdr->speech_incomplete_timeout = speech_incomplete_timeout; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid speech incomplete timeout, \"%s\"\n", schannel->name, - val); - } - break; - } - case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:{ - int dtmf_interdigit_timeout = atoi(val); - if (dtmf_interdigit_timeout >= 0) { - recog_hdr->dtmf_interdigit_timeout = dtmf_interdigit_timeout; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf interdigit timeout, \"%s\"\n", schannel->name, val); - } - break; - } - case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:{ - int dtmf_term_timeout = atoi(val); - if (dtmf_term_timeout >= 0) { - recog_hdr->dtmf_term_timeout = dtmf_term_timeout; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf term timeout, \"%s\"\n", schannel->name, val); - } - break; - } - case RECOGNIZER_HEADER_DTMF_TERM_CHAR: - if (strlen(val) == 1) { - recog_hdr->dtmf_term_char = *val; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_DTMF_TERM_CHAR); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid dtmf term char, \"%s\"\n", schannel->name, val); - } - break; - - case RECOGNIZER_HEADER_SAVE_WAVEFORM: - recog_hdr->save_waveform = !strcasecmp("true", val); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SAVE_WAVEFORM); - break; - - case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL: - recog_hdr->new_audio_channel = !strcasecmp("true", val); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL); - break; - - case RECOGNIZER_HEADER_SPEECH_LANGUAGE: - apt_string_assign(&recog_hdr->speech_language, val, msg->pool); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_SPEECH_LANGUAGE); - break; - - case RECOGNIZER_HEADER_RECOGNITION_MODE: - apt_string_assign(&recog_hdr->recognition_mode, val, msg->pool); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_RECOGNITION_MODE); - break; - - case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:{ - int hotword_max_duration = atoi(val); - if (hotword_max_duration >= 0) { - recog_hdr->hotword_max_duration = hotword_max_duration; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MAX_DURATION); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword max duration, \"%s\"\n", schannel->name, val); - } - break; - } - case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:{ - int hotword_min_duration = atoi(val); - if (hotword_min_duration >= 0) { - recog_hdr->hotword_min_duration = hotword_min_duration; - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_HOTWORD_MIN_DURATION); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) Ignoring invalid hotword min duration, \"%s\"\n", schannel->name, val); - } - break; - } - case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER: - recog_hdr->clear_dtmf_buffer = !strcasecmp("true", val); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER); - break; - - case RECOGNIZER_HEADER_EARLY_NO_MATCH: - recog_hdr->early_no_match = !strcasecmp("true", val); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_EARLY_NO_MATCH); - break; - - case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI: - apt_string_assign(&recog_hdr->input_waveform_uri, val, msg->pool); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_INPUT_WAVEFORM_URI); - break; - - case RECOGNIZER_HEADER_MEDIA_TYPE: - apt_string_assign(&recog_hdr->media_type, val, msg->pool); - mrcp_resource_header_property_add(msg, RECOGNIZER_HEADER_MEDIA_TYPE); - break; - - /* Unsupported headers */ - - /* MRCP server headers */ - case RECOGNIZER_HEADER_WAVEFORM_URI: - case RECOGNIZER_HEADER_COMPLETION_CAUSE: - case RECOGNIZER_HEADER_FAILED_URI: - case RECOGNIZER_HEADER_FAILED_URI_CAUSE: - case RECOGNIZER_HEADER_INPUT_TYPE: - case RECOGNIZER_HEADER_COMPLETION_REASON: - /* module handles this automatically */ - case RECOGNIZER_HEADER_CANCEL_IF_QUEUE: - /* GET-PARAMS method only */ - case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK: - case RECOGNIZER_HEADER_DTMF_BUFFER_TIME: - - /* INTERPRET method only */ - case RECOGNIZER_HEADER_INTERPRET_TEXT: - - /* unknown */ - case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE: - - default: - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_WARNING, "(%s) unsupported RECOGNIZER header\n", schannel->name); - } - - return status; -} - -/** - * Flag that the recognizer channel timers are started - * @param schannel the recognizer channel to flag - */ -static switch_status_t recog_channel_set_timers_started(speech_channel_t *schannel) -{ - recognizer_data_t *r; - switch_mutex_lock(schannel->mutex); - r = (recognizer_data_t *) schannel->data; - r->timers_started = 1; - switch_mutex_unlock(schannel->mutex); - return SWITCH_STATUS_SUCCESS; -} - -/** - * Process asr_open request from FreeSWITCH. - * - * @param ah the FreeSWITCH speech rec handle - * @param codec the codec to use - * @param rate the sample rate of the codec - * @param dest the profile to use - * @param flags other flags - * @return SWITCH_STATUS_SUCCESS if successful, otherwise SWITCH_STATUS_FALSE - */ -static switch_status_t recog_asr_open(switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schannel = NULL; - int speech_channel_number = get_next_speech_channel_number(); - char *name = ""; - const char *profile_name = !zstr(dest) ? dest : ah->param; - profile_t *profile = NULL; - recognizer_data_t *r = NULL; - switch_hash_index_t *hi = NULL; - char *session_uuid = NULL; - - /* Name the channel */ - if (profile_name && strchr(profile_name, ':')) { - /* Profile has session name appended to it. Pick it out */ - profile_name = switch_core_strdup(ah->memory_pool, profile_name); - session_uuid = strchr(profile_name, ':'); - *session_uuid = '\0'; - session_uuid++; - session_uuid = switch_core_strdup(ah->memory_pool, session_uuid); - } else { - /* check if session is associated w/ this memory pool */ - switch_core_session_t *session = switch_core_memory_pool_get_data(ah->memory_pool, "__session"); - if (session) { - session_uuid = switch_core_session_get_uuid(session); - } - } - name = switch_core_sprintf(ah->memory_pool, "ASR-%d", speech_channel_number); - - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_INFO, "asr_handle: name = %s, codec = %s, rate = %d, grammar = %s, param = %s\n", - ah->name, ah->codec, ah->rate, ah->grammar, ah->param); - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_INFO, "codec = %s, rate = %d, dest = %s\n", codec, rate, dest); - - /* Allocate the channel */ - if (speech_channel_create(&schannel, name, session_uuid, SPEECH_CHANNEL_RECOGNIZER, &globals.recog, (uint16_t) rate, ah->memory_pool) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto done; - } - schannel->fsh = ah; - ah->private_info = schannel; - r = (recognizer_data_t *) switch_core_alloc(ah->memory_pool, sizeof(recognizer_data_t)); - schannel->data = r; - memset(r, 0, sizeof(recognizer_data_t)); - switch_core_hash_init(&r->grammars); - switch_core_hash_init(&r->enabled_grammars); - - /* Open the channel */ - if (zstr(profile_name)) { - profile_name = globals.unimrcp_default_recog_profile; - } - profile = (profile_t *) switch_core_hash_find(globals.profiles, profile_name); - if (!profile) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(session_uuid), SWITCH_LOG_ERROR, "(%s) Can't find profile, %s\n", name, profile_name); - status = SWITCH_STATUS_FALSE; - goto done; - } - if ((status = speech_channel_open(schannel, profile)) != SWITCH_STATUS_SUCCESS) { - goto done; - } - - /* Set default ASR params */ - for (hi = switch_core_hash_first(profile->default_recog_params); hi; hi = switch_core_hash_next(&hi)) { - char *param_name = NULL, *param_val = NULL; - const void *key; - void *val; - switch_core_hash_this(hi, &key, NULL, &val); - param_name = (char *) key; - param_val = (char *) val; - speech_channel_set_param(schannel, param_name, param_val); - } - - done: - - return status; -} - -/** - * Process asr_load_grammar request from FreeSWITCH. - * - * FreeSWITCH sends this request to load a grammar - * @param ah the FreeSWITCH speech recognition handle - * @param grammar the grammar data. This can be an absolute file path, a URI, or the grammar text. - * @param name used to reference grammar for unloading or for recognition requests - */ -static switch_status_t recog_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *name) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - const char *grammar_data = NULL; - char *grammar_file_data = NULL; - char *start_recognize; - switch_file_t *grammar_file = NULL; - switch_size_t grammar_file_size = 0, to_read = 0; - grammar_type_t type = GRAMMAR_TYPE_UNKNOWN; - char *filename = NULL; - - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) grammar = %s, name = %s\n", schannel->name, grammar, name); - - grammar = skip_initial_whitespace(grammar); - if (zstr(grammar)) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* stop recognition */ - if (speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - /* figure out what type of grammar this is */ - if (text_starts_with(grammar, HTTP_ID) || text_starts_with(grammar, HTTPS_ID) || text_starts_with(grammar, FILE_ID) || text_starts_with(grammar, SESSION_ID) - || text_starts_with(grammar, BUILTIN_ID)) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Grammar is URI\n", schannel->name); - type = GRAMMAR_TYPE_URI; - grammar_data = grammar; - } else if (text_starts_with(grammar, INLINE_ID)) { - grammar_data = grammar + strlen(INLINE_ID); - } else { - /* grammar points to file containing the grammar text. We assume the MRCP server can't get to this file - * so read the data from the file and cache it */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Grammar is inside file\n", schannel->name); - if (switch_is_file_path(grammar)) { - filename = switch_mprintf("%s.gram", grammar); - } else { - filename = switch_mprintf("%s%s%s.gram", SWITCH_GLOBAL_dirs.grammar_dir, SWITCH_PATH_SEPARATOR, grammar); - } - grammar_data = NULL; - if (switch_file_open(&grammar_file, filename, SWITCH_FOPEN_READ, 0, schannel->memory_pool) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Could not read grammar file: %s\n", schannel->name, filename); - status = SWITCH_STATUS_FALSE; - goto done; - } - grammar_file_size = switch_file_get_size(grammar_file); - if (grammar_file_size == 0) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Grammar file is empty: %s\n", schannel->name, filename); - status = SWITCH_STATUS_FALSE; - goto done; - } - grammar_file_data = (char *) switch_core_alloc(schannel->memory_pool, grammar_file_size + 1); - to_read = grammar_file_size; - if (switch_file_read(grammar_file, grammar_file_data, &to_read) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Grammar file read error: %s\n", schannel->name, filename); - status = SWITCH_STATUS_FALSE; - goto done; - } - if (to_read != grammar_file_size) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Could not read entire grammar file: %s\n", schannel->name, filename); - status = SWITCH_STATUS_FALSE; - goto done; - } - grammar_file_data[to_read] = '\0'; - grammar_data = grammar_file_data; - } - - /* if a name was not given, check if defined in a param */ - if (zstr(name)) { - name = switch_core_hash_find(schannel->params, "name"); - - /* if not defined in param, create one */ - if (zstr(name)) { - char id[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - switch_uuid_str(id, sizeof(id)); - name = switch_core_strdup(schannel->memory_pool, id); - } - } - - /* determine content type of file grammar or inline grammar */ - if (type == GRAMMAR_TYPE_UNKNOWN) { - if (text_starts_with(grammar_data, XML_ID) || text_starts_with(grammar_data, SRGS_ID)) { - type = GRAMMAR_TYPE_SRGS_XML; - } else if (text_starts_with(grammar_data, GSL_ID)) { - type = GRAMMAR_TYPE_NUANCE_GSL; - } else if (text_starts_with(grammar_data, ABNF_ID)) { - type = GRAMMAR_TYPE_SRGS; - } else if (text_starts_with(grammar_data, JSGF_ID)) { - type = GRAMMAR_TYPE_JSGF; - } else if (text_starts_with(grammar_data, GSR_ID)) { - type = GRAMMAR_TYPE_XML; - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) unable to determine grammar type: %s\n", schannel->name, grammar_data); - status = SWITCH_STATUS_FALSE; - goto done; - } - } - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) grammar is %s\n", schannel->name, grammar_type_to_mime(type, schannel->profile)); - - /* load the grammar */ - if (recog_channel_load_grammar(schannel, name, type, grammar_data) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto done; - } - - start_recognize = (char *) switch_core_hash_find(schannel->params, "start-recognize"); - if (zstr(start_recognize) || strcasecmp(start_recognize, "false")) - { - if (recog_channel_disable_all_grammars(schannel) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto done; - } - if (recog_channel_enable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - goto done; - } - status = recog_channel_start(schannel); - } - - done: - - switch_safe_free(filename); - if (grammar_file) { - switch_file_close(grammar_file); - } - return status; -} - -/** - * Process asr_unload_grammar request from FreeSWITCH. - * - * FreeSWITCH sends this request to stop recognition on this grammar. - * @param ah the FreeSWITCH speech recognition handle - * @param name the grammar name. - */ -static switch_status_t recog_asr_unload_grammar(switch_asr_handle_t *ah, const char *name) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_unload_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - } - return status; -} - -/** - * Process asr_enable_grammar request from FreeSWITCH. - * - * FreeSWITCH sends this request to enable recognition on this grammar. - * @param ah the FreeSWITCH speech recognition handle - * @param name the grammar name. - */ -static switch_status_t recog_asr_enable_grammar(switch_asr_handle_t *ah, const char *name) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_enable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - } - return status; -} - -/** - * Process asr_disable_grammar request from FreeSWITCH. - * - * FreeSWITCH sends this request to disable recognition on this grammar. - * @param ah the FreeSWITCH speech recognition handle - * @param name the grammar name. - */ -static switch_status_t recog_asr_disable_grammar(switch_asr_handle_t *ah, const char *name) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - if (zstr(name) || speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_disable_grammar(schannel, name) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - } - return status; -} - -/** - * Process asr_disable_all_grammars request from FreeSWITCH. - * - * FreeSWITCH sends this request to disable recognition of all grammars. - * @param ah the FreeSWITCH speech recognition handle - * @param name the grammar name. - */ -static switch_status_t recog_asr_disable_all_grammars(switch_asr_handle_t *ah) -{ - switch_status_t status = SWITCH_STATUS_SUCCESS; - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - if (speech_channel_stop(schannel) != SWITCH_STATUS_SUCCESS || recog_channel_disable_all_grammars(schannel) != SWITCH_STATUS_SUCCESS) { - status = SWITCH_STATUS_FALSE; - } - return status; -} - -/** - * Process asr_close request from FreeSWITCH - * - * @param ah the FreeSWITCH speech recognition handle - * @param flags speech recognition flags (unused) - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t recog_asr_close(switch_asr_handle_t *ah, switch_asr_flag_t *flags) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - recognizer_data_t *r = NULL; - - /* close if not already closed */ - if (schannel != NULL && !switch_test_flag(ah, SWITCH_ASR_FLAG_CLOSED)) { - r = (recognizer_data_t *) schannel->data; - speech_channel_stop(schannel); - switch_core_hash_destroy(&r->grammars); - switch_core_hash_destroy(&r->enabled_grammars); - switch_mutex_lock(schannel->mutex); - if (r->dtmf_generator) { - r->dtmf_generator_active = 0; - mpf_dtmf_generator_destroy(r->dtmf_generator); - } - if (r->result_headers) { - switch_event_destroy(&r->result_headers); - } - switch_mutex_unlock(schannel->mutex); - speech_channel_destroy(schannel); - } - /* this lets FreeSWITCH's speech_thread know the handle is closed */ - switch_set_flag(ah, SWITCH_ASR_FLAG_CLOSED); - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Process asr_feed request from FreeSWITCH - * - * @param ah the FreeSWITCH speech recognition handle - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_asr_feed(switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags) -{ - switch_size_t slen = len; - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - return speech_channel_write(schannel, data, &slen); -} - -/** - * Process asr_feed_dtmf request from FreeSWITCH - * - * @param ah the FreeSWITCH speech recognition handle - * @return SWITCH_STATUS_SUCCESS if successful - */ -static switch_status_t recog_asr_feed_dtmf(switch_asr_handle_t *ah, const switch_dtmf_t *dtmf, switch_asr_flag_t *flags) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - char digits[2]; - - if (!r->dtmf_generator) { - if (!r->unimrcp_stream) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Cannot queue DTMF: No UniMRCP stream object open\n", schannel->name); - return SWITCH_STATUS_FALSE; - } - r->dtmf_generator = mpf_dtmf_generator_create(r->unimrcp_stream, schannel->unimrcp_session->pool); - if (!r->dtmf_generator) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_ERROR, "(%s) Cannot queue DTMF: Failed to create DTMF generator\n", schannel->name); - return SWITCH_STATUS_FALSE; - } - } - - digits[0] = dtmf->digit; - digits[1] = '\0'; - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) Queued DTMF: %s\n", schannel->name, digits); - mpf_dtmf_generator_enqueue(r->dtmf_generator, digits); - r->dtmf_generator_active = 1; - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Process asr_resume request from FreeSWITCH - * - * @param ah the FreeSWITCH speech recognition handle - */ -static switch_status_t recog_asr_resume(switch_asr_handle_t *ah) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - return recog_channel_start(schannel); -} - -/** - * Process asr_pause request from FreeSWITCH - * - * @param ah the FreeSWITCH speech recognition handle - */ -static switch_status_t recog_asr_pause(switch_asr_handle_t *ah) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - return speech_channel_stop(schannel); -} - -/** - * Process asr_check_results request from FreeSWITCH - * This method is polled by FreeSWITCH until we return SWITCH_STATUS_SUCCESS. Then - * the results are fetched. - * - * @param ah the FreeSWITCH speech recognition handle - * @param flags other flags - */ -static switch_status_t recog_asr_check_results(switch_asr_handle_t *ah, switch_asr_flag_t *flags) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - return recog_channel_check_results(schannel); -} - -/** - * Process asr_get_results request from FreeSWITCH. Return the XML string back - * to FreeSWITCH. FreeSWITCH will free() the xmlstr. - * - * @param ah the FreeSWITCH speech recognition handle - * @param flags other flags - */ -static switch_status_t recog_asr_get_results(switch_asr_handle_t *ah, char **xmlstr, switch_asr_flag_t *flags) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - return recog_channel_get_results(schannel, xmlstr); -} - -/** - * Process asr_get_result_headers request from FreeSWITCH. Return the headers back - * to FreeSWITCH. FreeSWITCH will switch_event_destroy() the headers. - * - * @param ah the FreeSWITCH speech recognition handle - * @param flags other flags - */ -static switch_status_t recog_asr_get_result_headers(switch_asr_handle_t *ah, switch_event_t **headers, switch_asr_flag_t *flags) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - return recog_channel_get_result_headers(schannel, headers); -} - -/** - * Send START-INPUT-TIMERS to executing recognition request - * @param ah the handle to start timers on - * @return SWITCH_STATUS_SUCCESS - */ -static switch_status_t recog_asr_start_input_timers(switch_asr_handle_t *ah) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - return recog_channel_start_input_timers(schannel); -} - -/** - * Process text_param request from FreeSWITCH. - * Update MRCP session text parameters. - * - * @param ah the FreeSWITCH asr handle - * @param param the parameter to set - * @param val the value to set the parameter to - */ -static void recog_asr_text_param(switch_asr_handle_t *ah, char *param, const char *val) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - speech_channel_set_param(schannel, param, val); -} - -/** - * Process numeric_param request from FreeSWITCH. - * Update MRCP session numeric parameters - * - * @param ah the FreeSWITCH asr handle - * @param param the parameter to set - * @param val the value to set the parameter to - */ -static void recog_asr_numeric_param(switch_asr_handle_t *ah, char *param, int val) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - char *val_str = switch_mprintf("%d", val); - speech_channel_set_param(schannel, param, val_str); - switch_safe_free(val_str); -} - -/** - * Process float_param request from FreeSWITCH. - * Update MRCP session float parameters - * - * @param ah the FreeSWITCH asr handle - * @param param the parameter to set - * @param val the value to set the parameter to - */ -static void recog_asr_float_param(switch_asr_handle_t *ah, char *param, double val) -{ - speech_channel_t *schannel = (speech_channel_t *) ah->private_info; - char *val_str = switch_mprintf("%f", val); - speech_channel_set_param(schannel, param, val_str); - switch_safe_free(val_str); -} - -/** - * Process messages from UniMRCP for the recognizer application - */ -static apt_bool_t recog_message_handler(const mrcp_app_message_t *app_message) -{ - return mrcp_application_message_dispatch(&globals.recog.dispatcher, app_message); -} - -/** - * Handle the MRCP responses/events - */ -static apt_bool_t recog_on_message_receive(mrcp_application_t *application, mrcp_session_t *session, mrcp_channel_t *channel, mrcp_message_t *message) -{ - speech_channel_t *schannel = (speech_channel_t *) mrcp_application_channel_object_get(channel); - mrcp_recog_header_t *recog_hdr = (mrcp_recog_header_t *) mrcp_resource_header_get(message); - if (message->start_line.message_type == MRCP_MESSAGE_TYPE_RESPONSE) { - /* received MRCP response */ - if (message->start_line.method_id == RECOGNIZER_RECOGNIZE) { - /* received the response to RECOGNIZE request */ - if (message->start_line.request_state == MRCP_REQUEST_STATE_INPROGRESS) { - /* RECOGNIZE in progress */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE IN PROGRESS\n", schannel->name); - speech_channel_set_state(schannel, SPEECH_CHANNEL_PROCESSING); - } else if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) { - /* RECOGNIZE failed to start */ - if (!recog_hdr || recog_hdr->completion_cause == RECOGNIZER_COMPLETION_CAUSE_UNKNOWN) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d\n", schannel->name, - message->start_line.status_code); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE failed: status = %d, completion-cause = %03d\n", - schannel->name, message->start_line.status_code, recog_hdr->completion_cause); - } - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } else if (message->start_line.request_state == MRCP_REQUEST_STATE_PENDING) { - /* RECOGNIZE is queued */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE PENDING\n", schannel->name); - } else { - /* received unexpected request_state */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected RECOGNIZE request state: %d\n", schannel->name, - message->start_line.request_state); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } else if (message->start_line.method_id == RECOGNIZER_STOP) { - /* received response to the STOP request */ - if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) { - /* got COMPLETE */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNIZE STOPPED\n", schannel->name); - speech_channel_set_state(schannel, SPEECH_CHANNEL_READY); - } else { - /* received unexpected request state */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected STOP request state: %d\n", schannel->name, - message->start_line.request_state); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } else if (message->start_line.method_id == RECOGNIZER_START_INPUT_TIMERS) { - /* received response to START-INPUT-TIMERS request */ - if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) { - if (message->start_line.status_code >= 200 && message->start_line.status_code <= 299) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) timers started\n", schannel->name); - recog_channel_set_timers_started(schannel); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) timers failed to start, status code = %d\n", schannel->name, - message->start_line.status_code); - } - } - } else if (message->start_line.method_id == RECOGNIZER_DEFINE_GRAMMAR) { - /* received response to DEFINE-GRAMMAR request */ - if (message->start_line.request_state == MRCP_REQUEST_STATE_COMPLETE) { - if (message->start_line.status_code >= 200 && message->start_line.status_code <= 299) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) grammar loaded\n", schannel->name); - speech_channel_set_state(schannel, SPEECH_CHANNEL_READY); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) grammar failed to load, status code = %d\n", schannel->name, - message->start_line.status_code); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } - } else { - /* received unexpected response */ - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected response, method_id = %d\n", schannel->name, - (int) message->start_line.method_id); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } else if (message->start_line.message_type == MRCP_MESSAGE_TYPE_EVENT) { - /* received MRCP event */ - if (message->start_line.method_id == RECOGNIZER_RECOGNITION_COMPLETE) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) RECOGNITION COMPLETE, Completion-Cause: %03d\n", schannel->name, - recog_hdr->completion_cause); - if (message->body.length > 0) { - if (message->body.buf[message->body.length - 1] == '\0') { - recog_channel_set_result_headers(schannel, recog_hdr); - recog_channel_set_results(schannel, message->body.buf); - } else { - /* string is not null terminated */ - char *result = (char *) switch_core_alloc(schannel->memory_pool, message->body.length + 1); - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, - "(%s) Recognition result is not null-terminated. Appending null terminator.\n", schannel->name); - strncpy(result, message->body.buf, message->body.length); - result[message->body.length] = '\0'; - recog_channel_set_result_headers(schannel, recog_hdr); - recog_channel_set_results(schannel, result); - } - } else { - char *completion_cause = switch_mprintf("Completion-Cause: %03d", recog_hdr->completion_cause); - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) No result\n", schannel->name); - recog_channel_set_result_headers(schannel, recog_hdr); - recog_channel_set_results(schannel, completion_cause); - switch_safe_free(completion_cause); - } - speech_channel_set_state(schannel, SPEECH_CHANNEL_READY); - } else if (message->start_line.method_id == RECOGNIZER_START_OF_INPUT) { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) START OF INPUT\n", schannel->name); - recog_channel_set_start_of_input(schannel); - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected event, method_id = %d\n", schannel->name, - (int) message->start_line.method_id); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - } else { - switch_log_printf(SWITCH_CHANNEL_UUID_LOG(schannel->session_uuid), SWITCH_LOG_DEBUG, "(%s) unexpected message type, message_type = %d\n", schannel->name, - message->start_line.message_type); - speech_channel_set_state(schannel, SPEECH_CHANNEL_ERROR); - } - - return TRUE; -} - -/** - * UniMRCP callback requesting open for speech recognition - * - * @param stream the UniMRCP stream - * @param codec the codec - * @return TRUE - */ -static apt_bool_t recog_stream_open(mpf_audio_stream_t *stream, mpf_codec_t *codec) -{ - speech_channel_t *schannel = (speech_channel_t *) stream->obj; - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - - r->unimrcp_stream = stream; - - return TRUE; -} - -/** - * UniMRCP callback requesting next frame for speech recognition - * - * @param stream the UniMRCP stream - * @param frame the frame to fill - * @return TRUE - */ -static apt_bool_t recog_stream_read(mpf_audio_stream_t *stream, mpf_frame_t *frame) -{ - speech_channel_t *schannel = (speech_channel_t *) stream->obj; - recognizer_data_t *r = (recognizer_data_t *) schannel->data; - switch_size_t to_read = frame->codec_frame.size; - - /* grab the data. pad it if there isn't enough */ - if (speech_channel_read(schannel, frame->codec_frame.buffer, &to_read, 0) == SWITCH_STATUS_SUCCESS) { - if (to_read < frame->codec_frame.size) { - memset((uint8_t *) frame->codec_frame.buffer + to_read, schannel->silence, frame->codec_frame.size - to_read); - } - frame->type |= MEDIA_FRAME_TYPE_AUDIO; - } - - switch_mutex_lock(schannel->mutex); - if (r->dtmf_generator_active) { - if (!mpf_dtmf_generator_put_frame(r->dtmf_generator, frame)) { - if (!mpf_dtmf_generator_sending(r->dtmf_generator)) - r->dtmf_generator_active = 0; - } - } - switch_mutex_unlock(schannel->mutex); - - return TRUE; -} - -/** - * Link the recognizer module interface to FreeSWITCH and UniMRCP - */ -static switch_status_t recog_load(switch_loadable_module_interface_t *module_interface, switch_memory_pool_t *pool) -{ - /* link to FreeSWITCH ASR / TTS callbacks */ - switch_asr_interface_t *asr_interface = NULL; - if ((asr_interface = (switch_asr_interface_t *) switch_loadable_module_create_interface(module_interface, SWITCH_ASR_INTERFACE)) == NULL) { - return SWITCH_STATUS_FALSE; - } - asr_interface->interface_name = MOD_UNIMRCP; - asr_interface->asr_open = recog_asr_open; - asr_interface->asr_load_grammar = recog_asr_load_grammar; - asr_interface->asr_unload_grammar = recog_asr_unload_grammar; - asr_interface->asr_enable_grammar = recog_asr_enable_grammar; - asr_interface->asr_disable_grammar = recog_asr_disable_grammar; - asr_interface->asr_disable_all_grammars = recog_asr_disable_all_grammars; - asr_interface->asr_close = recog_asr_close; - asr_interface->asr_feed = recog_asr_feed; - asr_interface->asr_feed_dtmf = recog_asr_feed_dtmf; - asr_interface->asr_resume = recog_asr_resume; - asr_interface->asr_pause = recog_asr_pause; - asr_interface->asr_check_results = recog_asr_check_results; - asr_interface->asr_get_results = recog_asr_get_results; - asr_interface->asr_get_result_headers = recog_asr_get_result_headers; - asr_interface->asr_start_input_timers = recog_asr_start_input_timers; - asr_interface->asr_text_param = recog_asr_text_param; - asr_interface->asr_numeric_param = recog_asr_numeric_param; - asr_interface->asr_float_param = recog_asr_float_param; - - /* Create the recognizer application and link its callbacks */ - if ((globals.recog.app = mrcp_application_create(recog_message_handler, (void *) 0, pool)) == NULL) { - return SWITCH_STATUS_FALSE; - } - globals.recog.dispatcher.on_session_update = NULL; - globals.recog.dispatcher.on_session_terminate = speech_on_session_terminate; - globals.recog.dispatcher.on_channel_add = speech_on_channel_add; - globals.recog.dispatcher.on_channel_remove = speech_on_channel_remove; - globals.recog.dispatcher.on_message_receive = recog_on_message_receive; - globals.recog.audio_stream_vtable.destroy = NULL; - globals.recog.audio_stream_vtable.open_rx = recog_stream_open; - globals.recog.audio_stream_vtable.close_rx = NULL; - globals.recog.audio_stream_vtable.read_frame = recog_stream_read; - globals.recog.audio_stream_vtable.open_tx = NULL; - globals.recog.audio_stream_vtable.close_tx = NULL; - globals.recog.audio_stream_vtable.write_frame = NULL; - mrcp_client_application_register(globals.mrcp_client, globals.recog.app, "recog"); - - /* map FreeSWITCH params or old params to MRCPv2 param */ - switch_core_hash_init_nocase(&globals.recog.fs_param_map); - /* MRCPv1 param */ - switch_core_hash_insert(globals.recog.fs_param_map, "recognizer-start-timers", "start-input-timers"); - - /* map MRCP params to UniMRCP ID */ - switch_core_hash_init_nocase(&globals.recog.param_id_map); - switch_core_hash_insert(globals.recog.param_id_map, "Confidence-Threshold", unimrcp_param_id_create(RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Sensitivity-Level", unimrcp_param_id_create(RECOGNIZER_HEADER_SENSITIVITY_LEVEL, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Speed-Vs-Accuracy", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEED_VS_ACCURACY, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "N-Best-List-Length", unimrcp_param_id_create(RECOGNIZER_HEADER_N_BEST_LIST_LENGTH, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "No-Input-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_NO_INPUT_TIMEOUT, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Recognition-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNITION_TIMEOUT, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Waveform-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_WAVEFORM_URI, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Completion-Cause", unimrcp_param_id_create(RECOGNIZER_HEADER_COMPLETION_CAUSE, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Recognizer-Context-Block", - unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Start-Input-Timers", unimrcp_param_id_create(RECOGNIZER_HEADER_START_INPUT_TIMERS, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Speech-Complete-Timeout", - unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Speech-Incomplete-Timeout", - unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Interdigit-Timeout", - unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Term-Timeout", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Term-Char", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_TERM_CHAR, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Failed-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_FAILED_URI, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Failed-Uri-Cause", unimrcp_param_id_create(RECOGNIZER_HEADER_FAILED_URI_CAUSE, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Save-Waveform", unimrcp_param_id_create(RECOGNIZER_HEADER_SAVE_WAVEFORM, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "New-Audio-Channel", unimrcp_param_id_create(RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Speech-Language", unimrcp_param_id_create(RECOGNIZER_HEADER_SPEECH_LANGUAGE, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Input-Type", unimrcp_param_id_create(RECOGNIZER_HEADER_INPUT_TYPE, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Input-Waveform-Uri", unimrcp_param_id_create(RECOGNIZER_HEADER_INPUT_WAVEFORM_URI, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Completion-Reason", unimrcp_param_id_create(RECOGNIZER_HEADER_COMPLETION_REASON, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Media-Type", unimrcp_param_id_create(RECOGNIZER_HEADER_MEDIA_TYPE, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Ver-Buffer-Utterance", unimrcp_param_id_create(RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Recognition-Mode", unimrcp_param_id_create(RECOGNIZER_HEADER_RECOGNITION_MODE, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Cancel-If-Queue", unimrcp_param_id_create(RECOGNIZER_HEADER_CANCEL_IF_QUEUE, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Hotword-Max-Duration", unimrcp_param_id_create(RECOGNIZER_HEADER_HOTWORD_MAX_DURATION, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Hotword-Min-Duration", unimrcp_param_id_create(RECOGNIZER_HEADER_HOTWORD_MIN_DURATION, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Interpret-Text", unimrcp_param_id_create(RECOGNIZER_HEADER_INTERPRET_TEXT, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "DTMF-Buffer-Time", unimrcp_param_id_create(RECOGNIZER_HEADER_DTMF_BUFFER_TIME, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Clear-DTMF-Buffer", unimrcp_param_id_create(RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER, pool)); - switch_core_hash_insert(globals.recog.param_id_map, "Early-No-Match", unimrcp_param_id_create(RECOGNIZER_HEADER_EARLY_NO_MATCH, pool)); - - return SWITCH_STATUS_SUCCESS; -} - -/** - * Shutdown the recognizer - */ -static switch_status_t recog_shutdown() -{ - if (globals.recog.fs_param_map) { - switch_core_hash_destroy(&globals.recog.fs_param_map); - } - if (globals.recog.param_id_map) { - switch_core_hash_destroy(&globals.recog.param_id_map); - } - return SWITCH_STATUS_SUCCESS; -} - -/** - * Process the XML configuration for this module - * Uses the instructions[] defined in this module to process the configuration. - * - * @return SWITCH_STATUS_SUCCESS if the configuration is OK - */ -static switch_status_t mod_unimrcp_do_config() -{ - switch_xml_t cfg, xml, settings; - switch_status_t status = SWITCH_STATUS_SUCCESS; - - if (!(xml = switch_xml_open_cfg(CONFIG_FILE, &cfg, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open %s\n", CONFIG_FILE); - status = SWITCH_STATUS_FALSE; - goto done; - } - - if ((settings = switch_xml_child(cfg, "settings"))) { - if (switch_xml_config_parse(switch_xml_child(settings, "param"), SWITCH_FALSE, instructions) == SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Config parsed ok!\n"); - globals.enable_profile_events = !zstr(globals.enable_profile_events_param) && (!strcasecmp(globals.enable_profile_events_param, "true") - || !strcmp(globals.enable_profile_events_param, "1")); - } - } - - done: - - if (xml) { - switch_xml_free(xml); - } - - return status; -} - -#define DEFAULT_LOCAL_IP_ADDRESS "127.0.0.1" -#define DEFAULT_REMOTE_IP_ADDRESS "127.0.0.1" -#define DEFAULT_SIP_LOCAL_PORT 5090 -#define DEFAULT_SIP_REMOTE_PORT 5060 -#define DEFAULT_RTP_PORT_MIN 4000 -#define DEFAULT_RTP_PORT_MAX 5000 - -#define DEFAULT_SOFIASIP_UA_NAME "FreeSWITCH" -#define DEFAULT_SDP_ORIGIN "FreeSWITCH" -#define DEFAULT_RESOURCE_LOCATION "media" - -/** - * Get IP address from IP address value - * - * @param value "auto" or IP address - * @param pool the memory pool to use - * @return IP address - */ -static char *ip_addr_get(const char *value, apr_pool_t *pool) -{ - if (!value || strcasecmp(value, "auto") == 0) { - char *addr = DEFAULT_LOCAL_IP_ADDRESS; - apt_ip_get(&addr, pool); - return addr; - } - return apr_pstrdup(pool, value); -} - -/** - * set mod_unimrcp-specific profile configuration - * - * @param profile the MRCP profile to configure - * @param param the param name - * @param val the param value - * @param pool the memory pool to use - */ -static int process_profile_config(profile_t *profile, const char *param, const char *val, switch_memory_pool_t *pool) -{ - int mine = 1; - if (strcasecmp(param, "jsgf-mime-type") == 0) { - profile->jsgf_mime_type = switch_core_strdup(pool, val); - } else if (strcasecmp(param, "gsl-mime-type") == 0) { - profile->gsl_mime_type = switch_core_strdup(pool, val); - } else if (strcasecmp(param, "srgs-xml-mime-type") == 0) { - profile->srgs_xml_mime_type = switch_core_strdup(pool, val); - } else if (strcasecmp(param, "srgs-mime-type") == 0) { - profile->srgs_mime_type = switch_core_strdup(pool, val); - } else if (strcasecmp(param, "ssml-mime-type") == 0) { - profile->ssml_mime_type = switch_core_strdup(pool, val); - } else { - mine = 0; - } - - return mine; -} - -/** - * set RTP config struct with param, val pair - * @param client the MRCP client - * @param rtp_config the config struct to set - * @param param the param name - * @param val the param value - * @param pool memory pool to use - * @return true if this param belongs to RTP config - */ -static int process_rtp_config(mrcp_client_t *client, mpf_rtp_config_t *rtp_config, mpf_rtp_settings_t *rtp_settings, const char *param, const char *val, apr_pool_t *pool) -{ - int mine = 1; - if (strcasecmp(param, "rtp-ip") == 0) { - apt_string_set(&rtp_config->ip, ip_addr_get(val, pool)); - } else if (strcasecmp(param, "rtp-ext-ip") == 0) { - apt_string_set(&rtp_config->ext_ip, ip_addr_get(val, pool)); - } else if (strcasecmp(param, "rtp-port-min") == 0) { - rtp_config->rtp_port_min = (apr_port_t) atol(val); - } else if (strcasecmp(param, "rtp-port-max") == 0) { - rtp_config->rtp_port_max = (apr_port_t) atol(val); - } else if (strcasecmp(param, "playout-delay") == 0) { - rtp_settings->jb_config.initial_playout_delay = atol(val); - } else if (strcasecmp(param, "min-playout-delay") == 0) { - rtp_settings->jb_config.min_playout_delay = atol(val); - } else if (strcasecmp(param, "max-playout-delay") == 0) { - rtp_settings->jb_config.max_playout_delay = atol(val); - } else if (strcasecmp(param, "codecs") == 0) { - const mpf_codec_manager_t *codec_manager = mrcp_client_codec_manager_get(client); - if (codec_manager) { - mpf_codec_manager_codec_list_load(codec_manager, &rtp_settings->codec_list, val, pool); - } - } else if (strcasecmp(param, "ptime") == 0) { - rtp_settings->ptime = (apr_uint16_t) atol(val); - } else if (strcasecmp(param, "rtcp") == 0) { - rtp_settings->rtcp = atoi(val); - } else if (strcasecmp(param, "rtcp-bye") == 0) { - rtp_settings->rtcp_bye_policy = atoi(val); - } else if (strcasecmp(param, "rtcp-tx-interval") == 0) { - rtp_settings->rtcp_tx_interval = (apr_uint16_t) atoi(val); - } else if (strcasecmp(param, "rtcp-rx-resolution") == 0) { - rtp_settings->rtcp_rx_resolution = (apr_uint16_t) atol(val); - } else { - mine = 0; - } - - return mine; -} - -/** - * set RTSP client config struct with param, val pair - * @param config the config struct to set - * @param sig_settings the sig settings struct to set - * @param param the param name - * @param val the param value - * @param pool memory pool to use - * @return true if this param belongs to RTSP config - */ -static int process_mrcpv1_config(rtsp_client_config_t *config, mrcp_sig_settings_t *sig_settings, const char *param, const char *val, apr_pool_t *pool) -{ - int mine = 1; - if (strcasecmp(param, "server-ip") == 0) { - sig_settings->server_ip = ip_addr_get(val, pool); - } else if (strcasecmp(param, "server-port") == 0) { - sig_settings->server_port = (apr_port_t) atol(val); - } else if (strcasecmp(param, "resource-location") == 0) { - sig_settings->resource_location = apr_pstrdup(pool, val); - } else if (strcasecmp(param, "sdp-origin") == 0) { - config->origin = apr_pstrdup(pool, val); - } else if (strcasecmp(param, "max-connection-count") == 0) { - config->max_connection_count = atol(val); - } else if (strcasecmp(param, "force-destination") == 0) { - sig_settings->force_destination = atoi(val); - } else if (strcasecmp(param, "speechsynth") == 0 || strcasecmp(param, "speechrecog") == 0) { - apr_table_set(sig_settings->resource_map, param, val); - } else { - mine = 0; - } - return mine; -} - -/** - * set SofiaSIP client config struct with param, val pair - * @param config the config struct to set - * @param sig_settings the sig settings struct to set - * @param param the param name - * @param val the param value - * @param pool memory pool to use - * @return true if this param belongs to SofiaSIP config - */ -static int process_mrcpv2_config(mrcp_sofia_client_config_t *config, mrcp_sig_settings_t *sig_settings, const char *param, const char *val, apr_pool_t *pool) -{ - int mine = 1; - if (strcasecmp(param, "client-ip") == 0) { - config->local_ip = ip_addr_get(val, pool); - } else if (strcasecmp(param, "client-ext-ip") == 0) { - config->ext_ip = ip_addr_get(val, pool); - } else if (strcasecmp(param, "client-port") == 0) { - config->local_port = (apr_port_t) atol(val); - } else if (strcasecmp(param, "server-ip") == 0) { - sig_settings->server_ip = ip_addr_get(val, pool); - } else if (strcasecmp(param, "server-port") == 0) { - sig_settings->server_port = (apr_port_t) atol(val); - } else if (strcasecmp(param, "server-username") == 0) { - sig_settings->user_name = apr_pstrdup(pool, val); - } else if (strcasecmp(param, "force-destination") == 0) { - sig_settings->force_destination = atoi(val); - } else if (strcasecmp(param, "sip-transport") == 0) { - config->transport = apr_pstrdup(pool, val); - } else if (strcasecmp(param, "ua-name") == 0) { - config->user_agent_name = apr_pstrdup(pool, val); - } else if (strcasecmp(param, "sdp-origin") == 0) { - config->origin = apr_pstrdup(pool, val); - } else { - mine = 0; - } - return mine; -} - -/** - * Create the MRCP client and configure it with profiles defined in FreeSWITCH XML config - * - * Some code and ideas borrowed from unimrcp-client.c - * Please check libs/unimrcp/platforms/libunimrcp-client/src/unimrcp-client.c when upgrading - * the UniMRCP library to ensure nothing new needs to be set up. - * - * @return the MRCP client - */ -static mrcp_client_t *mod_unimrcp_client_create(switch_memory_pool_t *mod_pool) -{ - switch_xml_t cfg = NULL, xml = NULL, profiles = NULL, profile = NULL; - mrcp_client_t *client = NULL; - apr_pool_t *pool = NULL; - mrcp_resource_loader_t *resource_loader = NULL; - mrcp_resource_factory_t *resource_factory = NULL; - mpf_codec_manager_t *codec_manager = NULL; - apr_size_t max_connection_count = 0; - apt_bool_t offer_new_connection = FALSE; - mrcp_connection_agent_t *connection_agent; - mpf_engine_t *media_engine; - apt_dir_layout_t *dir_layout; - - /* create the client */ - if ((dir_layout = apt_default_dir_layout_create("../", mod_pool)) == NULL) { - goto done; - } - client = mrcp_client_create(dir_layout); - if (!client) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MRCP client\n"); - goto done; - } - - pool = mrcp_client_memory_pool_get(client); - if (!pool) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to get MRCP client memory pool\n"); - client = NULL; - goto done; - } - - /* load the synthesizer and recognizer resources */ - resource_loader = mrcp_resource_loader_create(FALSE, pool); - if (!resource_loader) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MRCP resource loader\n"); - client = NULL; - goto done; - } else { - apt_str_t synth_resource; - apt_str_t recog_resource; - apt_string_set(&synth_resource, "speechsynth"); - mrcp_resource_load(resource_loader, &synth_resource); - apt_string_set(&recog_resource, "speechrecog"); - mrcp_resource_load(resource_loader, &recog_resource); - resource_factory = mrcp_resource_factory_get(resource_loader); - mrcp_client_resource_factory_register(client, resource_factory); - } - - codec_manager = mpf_engine_codec_manager_create(pool); - if (!codec_manager) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MPF codec manager\n"); - client = NULL; - goto done; - } - if (!mrcp_client_codec_manager_register(client, codec_manager)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create register MRCP client codec manager\n"); - client = NULL; - goto done; - } - - /* set up MRCP connection agent that will be shared with all profiles */ - if (!zstr(globals.unimrcp_max_connection_count)) { - max_connection_count = atoi(globals.unimrcp_max_connection_count); - } - if (max_connection_count <= 0) { - max_connection_count = 100; - } - if (!zstr(globals.unimrcp_offer_new_connection)) { - offer_new_connection = strcasecmp("true", globals.unimrcp_offer_new_connection); - } - connection_agent = mrcp_client_connection_agent_create("MRCPv2ConnectionAgent", max_connection_count, offer_new_connection, pool); - if (!connection_agent) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MRCP connection agent\n"); - client = NULL; - goto done; - } - if (!zstr(globals.unimrcp_rx_buffer_size)) { - apr_size_t rx_buffer_size = (apr_size_t)atol(globals.unimrcp_rx_buffer_size); - if (rx_buffer_size > 0) { - mrcp_client_connection_rx_size_set(connection_agent, rx_buffer_size); - } - } - if (!zstr(globals.unimrcp_tx_buffer_size)) { - apr_size_t tx_buffer_size = (apr_size_t)atol(globals.unimrcp_tx_buffer_size); - if (tx_buffer_size > 0) { - mrcp_client_connection_tx_size_set(connection_agent, tx_buffer_size); - } - } - if (!zstr(globals.unimrcp_request_timeout)) { - apr_size_t request_timeout = (apr_size_t)atol(globals.unimrcp_request_timeout); - if (request_timeout > 0) { - mrcp_client_connection_timeout_set(connection_agent, request_timeout); - } - } - if (!mrcp_client_connection_agent_register(client, connection_agent)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create register MRCP connection agent\n"); - client = NULL; - goto done; - } - - /* Set up the media engine that will be shared with all profiles */ - media_engine = mpf_engine_create("MediaEngine", pool); - if (!media_engine) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to create MPF media engine\n"); - client = NULL; - goto done; - } - if (!mpf_engine_scheduler_rate_set(media_engine, 1)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to set MPF engine scheduler rate\n"); - client = NULL; - goto done; - } - if (!mrcp_client_media_engine_register(client, media_engine)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to register MPF media engine\n"); - client = NULL; - goto done; - } - - /* configure the client profiles */ - if (!(xml = switch_xml_open_cfg(CONFIG_FILE, &cfg, NULL))) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Could not open %s\n", CONFIG_FILE); - client = NULL; - goto done; - } - if ((profiles = switch_xml_child(cfg, "profiles"))) { - for (profile = switch_xml_child(profiles, "profile"); profile; profile = switch_xml_next(profile)) { - /* a profile is a signaling agent + termination factory + media engine + connection agent (MRCPv2 only) */ - mrcp_sig_agent_t *agent = NULL; - mpf_termination_factory_t *termination_factory = NULL; - mrcp_profile_t *mprofile = NULL; - mpf_rtp_config_t *rtp_config = NULL; - mpf_rtp_settings_t *rtp_settings = mpf_rtp_settings_alloc(pool); - mrcp_sig_settings_t *sig_settings = mrcp_signaling_settings_alloc(pool); - profile_t *mod_profile = NULL; - switch_xml_t default_params = NULL; - mrcp_connection_agent_t *v2_profile_connection_agent = NULL; - - /* get profile attributes */ - const char *name = apr_pstrdup(pool, switch_xml_attr(profile, "name")); - const char *version = switch_xml_attr(profile, "version"); - if (zstr(name) || zstr(version)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, " missing name or version attribute\n"); - client = NULL; - goto done; - } - - /* prepare mod_unimrcp's profile for configuration */ - profile_create(&mod_profile, name, mod_pool); - if (mod_profile) { - switch_core_hash_insert(globals.profiles, mod_profile->name, mod_profile); - } else { - client = NULL; - goto done; - } - - /* pull in any default SPEAK params */ - default_params = switch_xml_child(profile, "synthparams"); - if (default_params) { - switch_xml_t param = NULL; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading SPEAK params\n"); - for (param = switch_xml_child(default_params, "param"); param; param = switch_xml_next(param)) { - const char *param_name = switch_xml_attr(param, "name"); - const char *param_value = switch_xml_attr(param, "value"); - if (zstr(param_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing SPEAK param name\n"); - client = NULL; - goto done; - } - if (zstr(param_value)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing SPEAK param value\n"); - client = NULL; - goto done; - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading SPEAK Param %s:%s\n", param_name, param_value); - switch_core_hash_insert(mod_profile->default_synth_params, switch_core_strdup(pool, param_name), switch_core_strdup(pool, param_value)); - } - } - - /* pull in any default RECOGNIZE params */ - default_params = switch_xml_child(profile, "recogparams"); - if (default_params) { - switch_xml_t param = NULL; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading RECOGNIZE params\n"); - for (param = switch_xml_child(default_params, "param"); param; param = switch_xml_next(param)) { - const char *param_name = switch_xml_attr(param, "name"); - const char *param_value = switch_xml_attr(param, "value"); - if (zstr(param_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing RECOGNIZE param name\n"); - client = NULL; - goto done; - } - if (zstr(param_value)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing RECOGNIZE param value\n"); - client = NULL; - goto done; - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading RECOGNIZE Param %s:%s\n", param_name, param_value); - switch_core_hash_insert(mod_profile->default_recog_params, switch_core_strdup(pool, param_name), switch_core_strdup(pool, param_value)); - } - } - - /* create RTP config, common to MRCPv1 and MRCPv2 */ - rtp_config = mpf_rtp_config_alloc(pool); - rtp_config->rtp_port_min = DEFAULT_RTP_PORT_MIN; - rtp_config->rtp_port_max = DEFAULT_RTP_PORT_MAX; - apt_string_set(&rtp_config->ip, DEFAULT_LOCAL_IP_ADDRESS); - - if (strcmp("1", version) == 0) { - /* MRCPv1 configuration */ - switch_xml_t param = NULL; - rtsp_client_config_t *config = mrcp_unirtsp_client_config_alloc(pool); - config->origin = DEFAULT_SDP_ORIGIN; - sig_settings->resource_location = DEFAULT_RESOURCE_LOCATION; - v2_profile_connection_agent = NULL; - - if (!zstr(globals.unimrcp_request_timeout)) { - apr_size_t request_timeout = (apr_size_t)atol(globals.unimrcp_request_timeout); - if (request_timeout > 0) { - config->request_timeout = request_timeout; - } - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading MRCPv1 profile: %s\n", name); - for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) { - const char *param_name = switch_xml_attr(param, "name"); - const char *param_value = switch_xml_attr(param, "value"); - if (zstr(param_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n"); - client = NULL; - goto done; - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading Param %s:%s\n", param_name, param_value); - if (!process_mrcpv1_config(config, sig_settings, param_name, param_value, pool) && - !process_rtp_config(client, rtp_config, rtp_settings, param_name, param_value, pool) && - !process_profile_config(mod_profile, param_name, param_value, mod_pool)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param %s\n", param_name); - } - } - agent = mrcp_unirtsp_client_agent_create(name, config, pool); - if (!agent) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create MRCP RTSP client agent\n"); - client = NULL; - goto done; - } - } else if (strcmp("2", version) == 0) { - /* MRCPv2 configuration */ - mrcp_sofia_client_config_t *config = mrcp_sofiasip_client_config_alloc(pool); - switch_xml_t param = NULL; - config->local_ip = DEFAULT_LOCAL_IP_ADDRESS; - config->local_port = DEFAULT_SIP_LOCAL_PORT; - sig_settings->server_ip = DEFAULT_REMOTE_IP_ADDRESS; - sig_settings->server_port = DEFAULT_SIP_REMOTE_PORT; - config->ext_ip = NULL; - config->user_agent_name = DEFAULT_SOFIASIP_UA_NAME; - config->origin = DEFAULT_SDP_ORIGIN; - v2_profile_connection_agent = connection_agent; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading MRCPv2 profile: %s\n", name); - for (param = switch_xml_child(profile, "param"); param; param = switch_xml_next(param)) { - const char *param_name = switch_xml_attr(param, "name"); - const char *param_value = switch_xml_attr(param, "value"); - if (zstr(param_name)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing param name\n"); - client = NULL; - goto done; - } - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Loading Param %s:%s\n", param_name, param_value); - if (!process_mrcpv2_config(config, sig_settings, param_name, param_value, pool) && - !process_rtp_config(client, rtp_config, rtp_settings, param_name, param_value, pool) && - !process_profile_config(mod_profile, param_name, param_value, mod_pool)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Ignoring unknown param %s\n", param_name); - } - } - agent = mrcp_sofiasip_client_agent_create(name, config, pool); - if (!agent) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create MRCP SIP client agent\n"); - client = NULL; - goto done; - } - } else { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "version must be either \"1\" or \"2\"\n"); - client = NULL; - goto done; - } - - termination_factory = mpf_rtp_termination_factory_create(rtp_config, pool); - if (!termination_factory) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create RTP termination factory\n"); - client = NULL; - goto done; - } - mrcp_client_rtp_factory_register(client, termination_factory, name); - mrcp_client_rtp_settings_register(client, rtp_settings, "RTP-Settings"); - mrcp_client_signaling_settings_register(client, sig_settings, "Signaling-Settings"); - mrcp_client_signaling_agent_register(client, agent); - - /* create the profile and register it */ - mprofile = mrcp_client_profile_create(NULL, agent, v2_profile_connection_agent, media_engine, termination_factory, rtp_settings, sig_settings, pool); - if (!mprofile) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create MRCP client profile\n"); - client = NULL; - goto done; - } - mrcp_client_profile_register(client, mprofile, name); - } - } - - done: - - if (xml) { - switch_xml_free(xml); - } - - return client; -} - -/** - * Macro expands to: switch_status_t mod_unimrcp_load(switch_loadable_module_interface_t **module_interface, switch_memory_pool_t *pool) - */ -SWITCH_MODULE_LOAD_FUNCTION(mod_unimrcp_load) -{ - if (switch_event_reserve_subclass(MY_EVENT_PROFILE_CREATE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CREATE); - return SWITCH_STATUS_TERM; - } - - if (switch_event_reserve_subclass(MY_EVENT_PROFILE_CLOSE) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_CLOSE); - return SWITCH_STATUS_TERM; - } - - if (switch_event_reserve_subclass(MY_EVENT_PROFILE_OPEN) != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't register subclass %s!\n", MY_EVENT_PROFILE_OPEN); - 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); - - memset(&globals, 0, sizeof(globals)); - switch_mutex_init(&globals.mutex, SWITCH_MUTEX_UNNESTED, pool); - globals.speech_channel_number = 0; - switch_core_hash_init_nocase(&globals.profiles); - - /* get MRCP module configuration */ - mod_unimrcp_do_config(); - if (zstr(globals.unimrcp_default_synth_profile)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-tts-profile\n"); - return SWITCH_STATUS_FALSE; - } - if (zstr(globals.unimrcp_default_recog_profile)) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing default-asr-profile\n"); - return SWITCH_STATUS_FALSE; - } - - /* link UniMRCP logs to FreeSWITCH */ - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UniMRCP log level = %s\n", globals.unimrcp_log_level); - if (apt_log_instance_create(APT_LOG_OUTPUT_NONE, str_to_log_level(globals.unimrcp_log_level), pool) == FALSE) { - /* already created */ - apt_log_priority_set(str_to_log_level(globals.unimrcp_log_level)); - } - apt_log_ext_handler_set(unimrcp_log); - - /* Create the MRCP client */ - if ((globals.mrcp_client = mod_unimrcp_client_create(pool)) == NULL) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create mrcp client\n"); - return SWITCH_STATUS_FALSE; - } - - /* Create the synthesizer interface */ - if (synth_load(*module_interface, pool) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } - - /* Create the recognizer interface */ - if (recog_load(*module_interface, pool) != SWITCH_STATUS_SUCCESS) { - return SWITCH_STATUS_FALSE; - } - - /* Start the client stack */ - mrcp_client_start(globals.mrcp_client); - - /* indicate that the module should continue to be loaded */ - return SWITCH_STATUS_SUCCESS; -} - -/** - * Called when the system shuts down - * Macro expands to: switch_status_t mod_unimrcp_shutdown() - */ -SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_unimrcp_shutdown) -{ - - switch_event_free_subclass(MY_EVENT_PROFILE_CREATE); - switch_event_free_subclass(MY_EVENT_PROFILE_CLOSE); - switch_event_free_subclass(MY_EVENT_PROFILE_OPEN); - - synth_shutdown(); - recog_shutdown(); - - /* Stop the MRCP client stack */ - mrcp_client_shutdown(globals.mrcp_client); - mrcp_client_destroy(globals.mrcp_client); - globals.mrcp_client = 0; - - switch_core_hash_destroy(&globals.profiles); - - return SWITCH_STATUS_SUCCESS; -} - -/** - * If it exists, this is called in it's own thread when the module-load completes - * If it returns anything but SWITCH_STATUS_TERM it will be called again automatically - * Macro expands to: switch_status_t mod_unimrcp_runtime() - */ -SWITCH_MODULE_RUNTIME_FUNCTION(mod_unimrcp_runtime) -{ - return SWITCH_STATUS_TERM; -} - -/** - * Translate log level string to enum - * @param level log level string - * @return log level enum - */ -static apt_log_priority_e str_to_log_level(const char *level) -{ - if (strcmp(level, "EMERGENCY") == 0) { - return APT_PRIO_EMERGENCY; - } else if (strcmp(level, "ALERT") == 0) { - return APT_PRIO_ALERT; - } else if (strcmp(level, "CRITICAL") == 0) { - return APT_PRIO_CRITICAL; - } else if (strcmp(level, "ERROR") == 0) { - return APT_PRIO_ERROR; - } else if (strcmp(level, "WARNING") == 0) { - return APT_PRIO_WARNING; - } else if (strcmp(level, "NOTICE") == 0) { - return APT_PRIO_NOTICE; - } else if (strcmp(level, "INFO") == 0) { - return APT_PRIO_INFO; - } else if (strcmp(level, "DEBUG") == 0) { - return APT_PRIO_DEBUG; - } - return APT_PRIO_DEBUG; -} - -/** - * Connects UniMRCP logging to FreeSWITCH - * @return TRUE - */ -static apt_bool_t unimrcp_log(const char *file, int line, const char *obj, apt_log_priority_e priority, const char *format, va_list arg_ptr) -{ - switch_log_level_t level; - char log_message[4096] = { 0 }; /* same size as MAX_LOG_ENTRY_SIZE in UniMRCP apt_log.c */ - size_t msglen; - const char *id = (obj == NULL) ? "" : ((speech_channel_t *)obj)->name; - - if (zstr(format)) { - return TRUE; - } - - switch (priority) { - case APT_PRIO_EMERGENCY: - /* pass through */ - case APT_PRIO_ALERT: - /* pass through */ - case APT_PRIO_CRITICAL: - level = SWITCH_LOG_CRIT; - break; - case APT_PRIO_ERROR: - level = SWITCH_LOG_ERROR; - break; - case APT_PRIO_WARNING: - level = SWITCH_LOG_WARNING; - break; - case APT_PRIO_NOTICE: - level = SWITCH_LOG_NOTICE; - break; - case APT_PRIO_INFO: - level = SWITCH_LOG_INFO; - break; - case APT_PRIO_DEBUG: - /* pass through */ - default: - level = SWITCH_LOG_DEBUG; - break; - } - - /* apr_vsnprintf supports format extensions required by UniMRCP */ - apr_vsnprintf(log_message, sizeof(log_message), format, arg_ptr); - msglen = strlen(log_message); - if (msglen >= 2 && log_message[msglen - 2] == '\\' && log_message[msglen - 1] == 'n') { - /* log_message already ends in \n */ - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, NULL, level, "(%s) %s", id, log_message); - } else if (msglen > 0) { - /* log message needs \n appended */ - switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, "", line, NULL, level, "(%s) %s\n", id, log_message); - } - - return TRUE; -} - -/** - * @return the next number to assign the channel - */ -static int get_next_speech_channel_number(void) -{ - int num; - switch_mutex_lock(globals.mutex); - num = globals.speech_channel_number; - if (globals.speech_channel_number == INT_MAX) { - globals.speech_channel_number = 0; - } else { - globals.speech_channel_number++; - } - switch_mutex_unlock(globals.mutex); - - return num; -} - -/** - * Create a parameter id - * - * @param id the UniMRCP ID - * @return the pair - */ -static unimrcp_param_id_t *unimrcp_param_id_create(int id, switch_memory_pool_t *pool) -{ - unimrcp_param_id_t *param = (unimrcp_param_id_t *) switch_core_alloc(pool, sizeof(unimrcp_param_id_t)); - if (param) { - param->id = id; - } - return param; -} - - -/* 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 noet: - */ diff --git a/src/mod/asr_tts/mod_unimrcp/unimrcp.props b/src/mod/asr_tts/mod_unimrcp/unimrcp.props deleted file mode 100644 index 6f304ae5f0..0000000000 --- a/src/mod/asr_tts/mod_unimrcp/unimrcp.props +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - <_ProjectFileVersion>10.0.30319.1 - - - - $(SolutionDir)libs\unimrcp\platforms\libunimrcp-client\include;$(SolutionDir)libs\unimrcp\libs\mrcp-client\include;$(SolutionDir)libs\unimrcp\libs\mrcp-signaling\include;$(SolutionDir)libs\unimrcp\libs\apr-toolkit\include;$(SolutionDir)libs\unimrcp\build;$(SolutionDir)libs\unimrcp\libs\mrcp\include;$(SolutionDir)libs\unimrcp\libs\mrcp\message\include;$(SolutionDir)libs\unimrcp\libs\mrcp\control\include;$(SolutionDir)libs\unimrcp\libs\mrcp\resources\include;$(SolutionDir)libs\unimrcp\libs\mpf\include;$(SolutionDir)libs\unimrcp\libs\mrcpv2-transport\include;$(SolutionDir)libs\unimrcp\modules\mrcp-sofiasip\include;$(SolutionDir)libs\unimrcp\modules\mrcp-unirtsp\include;%(AdditionalIncludeDirectories) - MRCP_STATIC_LIB;MPF_STATIC_LIB;APT_STATIC_LIB;%(PreprocessorDefinitions) - - - \ No newline at end of file diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml b/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml index e5191909cb..9f525c597c 100644 --- a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml +++ b/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml @@ -277,36 +277,6 @@ ]]>
- - - - yesno - ]]]]> - - - ]]> - - - - - yesno - ]]]]> - - - ]]> - Date: Thu, 18 Aug 2022 13:40:33 -0400 Subject: [PATCH 051/155] [core] rename lib apr symbols to fspr --- libs/apr/Makefile.in | 4 +- libs/apr/apr.dsp | 140 ++-- libs/apr/apr.dsw | 4 +- .../netware/{apr_atomic.c => fspr_atomic.c} | 24 +- libs/apr/atomic/os390/atomic.c | 36 +- .../unix/{apr_atomic.c => fspr_atomic.c} | 158 ++-- .../win32/{apr_atomic.c => fspr_atomic.c} | 66 +- libs/apr/build-outputs.mk | 202 ++--- libs/apr/build/NWGNUenvironment.inc | 4 +- libs/apr/build/NWGNUmakefile | 8 +- libs/apr/build/NWGNUtail.inc | 4 +- libs/apr/build/apr_app.dsp | 2 +- libs/apr/build/apr_common.m4 | 4 +- libs/apr/build/find_apr.m4 | 2 +- libs/apr/build/libapr_app.dsp | 2 +- libs/apr/build/make_exports.awk | 6 +- libs/apr/build/make_nw_export.awk | 10 +- libs/apr/build/nw_export.inc | 118 +-- libs/apr/build/prebuildNW.bat | 2 +- libs/apr/configure.ac | 36 +- libs/apr/docs/APRDesign.html | 24 +- libs/apr/docs/canonical_filenames.html | 4 +- libs/apr/docs/doxygen.conf | 6 +- libs/apr/docs/non_apr_programs | 16 +- libs/apr/docs/pool-design.html | 6 +- libs/apr/docs/win32_builds.html | 2 +- libs/apr/dso/aix/dso.c | 40 +- libs/apr/dso/beos/dso.c | 36 +- libs/apr/dso/netware/dso.c | 54 +- libs/apr/dso/os2/dso.c | 44 +- libs/apr/dso/os390/dso.c | 44 +- libs/apr/dso/unix/dso.c | 44 +- libs/apr/dso/win32/dso.c | 78 +- libs/apr/file_io/netware/filestat.c | 142 ++-- libs/apr/file_io/netware/filesys.c | 24 +- libs/apr/file_io/netware/flock.c | 6 +- libs/apr/file_io/netware/mktemp.c | 20 +- libs/apr/file_io/netware/pipe.c | 60 +- libs/apr/file_io/os2/dir.c | 54 +- libs/apr/file_io/os2/dir_make_recurse.c | 38 +- libs/apr/file_io/os2/filedup.c | 56 +- libs/apr/file_io/os2/filestat.c | 52 +- libs/apr/file_io/os2/filesys.c | 38 +- libs/apr/file_io/os2/flock.c | 6 +- libs/apr/file_io/os2/maperrorcode.c | 10 +- libs/apr/file_io/os2/open.c | 82 +- libs/apr/file_io/os2/pipe.c | 52 +- libs/apr/file_io/os2/readwrite.c | 66 +- libs/apr/file_io/os2/seek.c | 18 +- libs/apr/file_io/unix/copy.c | 70 +- libs/apr/file_io/unix/dir.c | 100 +-- libs/apr/file_io/unix/fileacc.c | 30 +- libs/apr/file_io/unix/filedup.c | 80 +- libs/apr/file_io/unix/filepath.c | 68 +- libs/apr/file_io/unix/filepath_util.c | 42 +- libs/apr/file_io/unix/filestat.c | 80 +- libs/apr/file_io/unix/flock.c | 6 +- libs/apr/file_io/unix/fullrw.c | 46 +- libs/apr/file_io/unix/mktemp.c | 38 +- libs/apr/file_io/unix/open.c | 112 +-- libs/apr/file_io/unix/pipe.c | 60 +- libs/apr/file_io/unix/readwrite.c | 132 +-- libs/apr/file_io/unix/seek.c | 20 +- libs/apr/file_io/unix/tempdir.c | 36 +- libs/apr/file_io/win32/dir.c | 160 ++-- libs/apr/file_io/win32/filedup.c | 68 +- libs/apr/file_io/win32/filepath.c | 110 +-- libs/apr/file_io/win32/filestat.c | 172 ++-- libs/apr/file_io/win32/filesys.c | 94 +-- libs/apr/file_io/win32/flock.c | 16 +- libs/apr/file_io/win32/open.c | 202 ++--- libs/apr/file_io/win32/pipe.c | 84 +- libs/apr/file_io/win32/readwrite.c | 180 ++-- libs/apr/file_io/win32/seek.c | 40 +- libs/apr/helpers/apr_rename.pl | 70 +- libs/apr/include/apr_random.h | 74 -- .../aix/{apr_arch_dso.h => fspr_arch_dso.h} | 14 +- .../beos/{apr_arch_dso.h => fspr_arch_dso.h} | 16 +- ...ch_proc_mutex.h => fspr_arch_proc_mutex.h} | 16 +- ..._thread_cond.h => fspr_arch_thread_cond.h} | 20 +- ...hread_mutex.h => fspr_arch_thread_mutex.h} | 18 +- ...ead_rwlock.h => fspr_arch_thread_rwlock.h} | 16 +- ...ch_threadproc.h => fspr_arch_threadproc.h} | 50 +- ...private_common.h => fspr_private_common.h} | 16 +- .../{apr_arch_dso.h => fspr_arch_dso.h} | 14 +- ...apr_arch_file_io.h => fspr_arch_file_io.h} | 52 +- ...lobal_mutex.h => fspr_arch_global_mutex.h} | 10 +- ...ernal_time.h => fspr_arch_internal_time.h} | 4 +- ...arch_networkio.h => fspr_arch_networkio.h} | 4 +- .../{apr_arch_pre_nw.h => fspr_arch_pre_nw.h} | 0 ...ch_proc_mutex.h => fspr_arch_proc_mutex.h} | 10 +- ..._thread_cond.h => fspr_arch_thread_cond.h} | 6 +- ...hread_mutex.h => fspr_arch_thread_mutex.h} | 6 +- ...ead_rwlock.h => fspr_arch_thread_rwlock.h} | 6 +- ...ch_threadproc.h => fspr_arch_threadproc.h} | 60 +- .../netware/{apr_private.h => fspr_private.h} | 4 +- libs/apr/include/arch/os2/apr_arch_os2calls.h | 59 -- .../os2/{apr_arch_dso.h => fspr_arch_dso.h} | 16 +- ...apr_arch_file_io.h => fspr_arch_file_io.h} | 42 +- ...arch_networkio.h => fspr_arch_networkio.h} | 32 +- .../apr/include/arch/os2/fspr_arch_os2calls.h | 59 ++ ...ch_proc_mutex.h => fspr_arch_proc_mutex.h} | 8 +- ..._thread_cond.h => fspr_arch_thread_cond.h} | 8 +- ...hread_mutex.h => fspr_arch_thread_mutex.h} | 8 +- ...ead_rwlock.h => fspr_arch_thread_rwlock.h} | 8 +- ...ch_threadproc.h => fspr_arch_threadproc.h} | 46 +- .../os390/{apr_arch_dso.h => fspr_arch_dso.h} | 14 +- .../unix/{apr_arch_dso.h => fspr_arch_dso.h} | 14 +- ...apr_arch_file_io.h => fspr_arch_file_io.h} | 44 +- ...lobal_mutex.h => fspr_arch_global_mutex.h} | 22 +- ...apr_arch_inherit.h => fspr_arch_inherit.h} | 12 +- ...ernal_time.h => fspr_arch_internal_time.h} | 4 +- .../{apr_arch_misc.h => fspr_arch_misc.h} | 30 +- ...arch_networkio.h => fspr_arch_networkio.h} | 40 +- ...oll_private.h => fspr_arch_poll_private.h} | 24 +- ...ch_proc_mutex.h => fspr_arch_proc_mutex.h} | 48 +- .../unix/{apr_arch_shm.h => fspr_arch_shm.h} | 26 +- ..._thread_cond.h => fspr_arch_thread_cond.h} | 18 +- ...hread_mutex.h => fspr_arch_thread_mutex.h} | 16 +- ...ead_rwlock.h => fspr_arch_thread_rwlock.h} | 18 +- ...ch_threadproc.h => fspr_arch_threadproc.h} | 56 +- .../{apr_arch_atime.h => fspr_arch_atime.h} | 12 +- .../win32/{apr_arch_dso.h => fspr_arch_dso.h} | 16 +- ...apr_arch_file_io.h => fspr_arch_file_io.h} | 112 +-- ...apr_arch_inherit.h => fspr_arch_inherit.h} | 14 +- .../{apr_arch_misc.h => fspr_arch_misc.h} | 102 +-- ...arch_networkio.h => fspr_arch_networkio.h} | 38 +- ...ch_proc_mutex.h => fspr_arch_proc_mutex.h} | 6 +- ..._thread_cond.h => fspr_arch_thread_cond.h} | 6 +- ...hread_mutex.h => fspr_arch_thread_mutex.h} | 6 +- ...ead_rwlock.h => fspr_arch_thread_rwlock.h} | 6 +- ...ch_threadproc.h => fspr_arch_threadproc.h} | 56 +- .../{apr_arch_utf8.h => fspr_arch_utf8.h} | 22 +- ...n32_handles.h => fspr_dbg_win32_handles.h} | 108 +-- .../win32/{apr_private.h => fspr_private.h} | 6 +- libs/apr/include/{apr.h.in => fspr.h.in} | 40 +- libs/apr/include/{apr.hnw => fspr.hnw} | 40 +- libs/apr/include/{apr.hw => fspr.hw} | 50 +- .../{apr_allocator.h => fspr_allocator.h} | 66 +- .../include/{apr_atomic.h => fspr_atomic.h} | 46 +- libs/apr/include/{apr_dso.h => fspr_dso.h} | 26 +- libs/apr/include/{apr_env.h => fspr_env.h} | 18 +- .../apr/include/{apr_errno.h => fspr_errno.h} | 86 +- .../{apr_file_info.h => fspr_file_info.h} | 150 ++-- .../include/{apr_file_io.h => fspr_file_io.h} | 296 +++---- .../include/{apr_fnmatch.h => fspr_fnmatch.h} | 18 +- .../include/{apr_general.h => fspr_general.h} | 50 +- .../include/{apr_getopt.h => fspr_getopt.h} | 48 +- ...apr_global_mutex.h => fspr_global_mutex.h} | 58 +- libs/apr/include/{apr_hash.h => fspr_hash.h} | 82 +- .../include/{apr_inherit.h => fspr_inherit.h} | 20 +- libs/apr/include/{apr_lib.h => fspr_lib.h} | 100 +-- libs/apr/include/{apr_mmap.h => fspr_mmap.h} | 54 +- .../{apr_network_io.h => fspr_network_io.h} | 292 +++---- libs/apr/include/{apr_poll.h => fspr_poll.h} | 96 +-- .../apr/include/{apr_pools.h => fspr_pools.h} | 280 +++---- .../{apr_portable.h => fspr_portable.h} | 322 ++++---- .../{apr_proc_mutex.h => fspr_proc_mutex.h} | 46 +- libs/apr/include/fspr_random.h | 74 ++ libs/apr/include/{apr_ring.h => fspr_ring.h} | 6 +- libs/apr/include/{apr_shm.h => fspr_shm.h} | 36 +- .../include/{apr_signal.h => fspr_signal.h} | 24 +- .../include/{apr_strings.h => fspr_strings.h} | 102 +-- .../include/{apr_support.h => fspr_support.h} | 12 +- .../include/{apr_tables.h => fspr_tables.h} | 148 ++-- .../{apr_thread_cond.h => fspr_thread_cond.h} | 38 +- ...apr_thread_mutex.h => fspr_thread_mutex.h} | 26 +- .../{apr_thread_proc.h => fspr_thread_proc.h} | 298 +++---- ...r_thread_rwlock.h => fspr_thread_rwlock.h} | 34 +- libs/apr/include/{apr_time.h => fspr_time.h} | 132 +-- libs/apr/include/{apr_user.h => fspr_user.h} | 60 +- .../include/{apr_version.h => fspr_version.h} | 14 +- libs/apr/include/{apr_want.h => fspr_want.h} | 8 +- libs/apr/libapr.dsp | 140 ++-- libs/apr/locks/beos/proc_mutex.c | 64 +- libs/apr/locks/beos/thread_cond.c | 56 +- libs/apr/locks/beos/thread_mutex.c | 42 +- libs/apr/locks/beos/thread_rwlock.c | 40 +- libs/apr/locks/netware/proc_mutex.c | 66 +- libs/apr/locks/netware/thread_cond.c | 50 +- libs/apr/locks/netware/thread_mutex.c | 40 +- libs/apr/locks/netware/thread_rwlock.c | 46 +- libs/apr/locks/os2/proc_mutex.c | 78 +- libs/apr/locks/os2/thread_cond.c | 34 +- libs/apr/locks/os2/thread_mutex.c | 36 +- libs/apr/locks/os2/thread_rwlock.c | 42 +- libs/apr/locks/unix/global_mutex.c | 94 +-- libs/apr/locks/unix/proc_mutex.c | 238 +++--- libs/apr/locks/unix/thread_cond.c | 60 +- libs/apr/locks/unix/thread_mutex.c | 40 +- libs/apr/locks/unix/thread_rwlock.c | 64 +- libs/apr/locks/win32/proc_mutex.c | 92 +-- libs/apr/locks/win32/thread_cond.c | 62 +- libs/apr/locks/win32/thread_mutex.c | 50 +- libs/apr/locks/win32/thread_rwlock.c | 76 +- .../memory/unix/{apr_pools.c => fspr_pools.c} | 778 +++++++++--------- libs/apr/misc/netware/charset.c | 14 +- libs/apr/misc/netware/libprews.c | 12 +- libs/apr/misc/netware/rand.c | 10 +- libs/apr/misc/netware/start.c | 38 +- libs/apr/misc/unix/charset.c | 16 +- libs/apr/misc/unix/env.c | 24 +- libs/apr/misc/unix/errorcodes.c | 62 +- libs/apr/misc/unix/getopt.c | 40 +- libs/apr/misc/unix/otherchild.c | 64 +- libs/apr/misc/unix/rand.c | 22 +- libs/apr/misc/unix/start.c | 50 +- libs/apr/misc/unix/version.c | 8 +- libs/apr/misc/win32/charset.c | 16 +- libs/apr/misc/win32/env.c | 80 +- libs/apr/misc/win32/{apr_app.c => fspr_app.c} | 16 +- libs/apr/misc/win32/internal.c | 22 +- libs/apr/misc/win32/misc.c | 80 +- libs/apr/misc/win32/rand.c | 26 +- libs/apr/misc/win32/start.c | 76 +- libs/apr/misc/win32/utf8.c | 42 +- libs/apr/mmap/unix/common.c | 12 +- libs/apr/mmap/unix/mmap.c | 60 +- libs/apr/mmap/win32/mmap.c | 62 +- libs/apr/network_io/beos/sendrecv.c | 58 +- libs/apr/network_io/os2/os2calls.c | 90 +- libs/apr/network_io/os2/sendrecv.c | 28 +- libs/apr/network_io/os2/sendrecv_udp.c | 36 +- libs/apr/network_io/os2/sockets.c | 136 +-- libs/apr/network_io/os2/sockopt.c | 34 +- libs/apr/network_io/unix/inet_ntop.c | 24 +- libs/apr/network_io/unix/inet_pton.c | 8 +- libs/apr/network_io/unix/multicast.c | 72 +- libs/apr/network_io/unix/sendrecv.c | 204 ++--- libs/apr/network_io/unix/sockaddr.c | 188 ++--- libs/apr/network_io/unix/sockets.c | 134 +-- libs/apr/network_io/unix/sockopt.c | 94 +-- libs/apr/network_io/win32/sendrecv.c | 126 +-- libs/apr/network_io/win32/sockets.c | 182 ++-- libs/apr/network_io/win32/sockopt.c | 94 +-- .../passwd/{apr_getpass.c => fspr_getpass.c} | 18 +- libs/apr/poll/os2/poll.c | 10 +- libs/apr/poll/os2/pollset.c | 62 +- libs/apr/poll/unix/epoll.c | 78 +- libs/apr/poll/unix/kqueue.c | 84 +- libs/apr/poll/unix/poll.c | 76 +- libs/apr/poll/unix/port.c | 88 +- libs/apr/poll/unix/select.c | 96 +-- .../unix/{apr_random.c => fspr_random.c} | 106 +-- libs/apr/random/unix/sha2.c | 98 +-- libs/apr/random/unix/sha2.h | 44 +- libs/apr/random/unix/sha2_glue.c | 26 +- libs/apr/renames_pending | 60 +- libs/apr/shmem/beos/shm.c | 64 +- libs/apr/shmem/os2/shm.c | 58 +- libs/apr/shmem/unix/shm.c | 226 ++--- libs/apr/shmem/win32/shm.c | 124 +-- .../strings/{apr_cpystrn.c => fspr_cpystrn.c} | 34 +- .../strings/{apr_fnmatch.c => fspr_fnmatch.c} | 54 +- .../{apr_snprintf.c => fspr_snprintf.c} | 152 ++-- .../strings/{apr_strings.c => fspr_strings.c} | 90 +- .../{apr_strnatcmp.c => fspr_strnatcmp.c} | 30 +- .../strings/{apr_strtok.c => fspr_strtok.c} | 8 +- libs/apr/support/unix/waitio.c | 32 +- libs/apr/tables/{apr_hash.c => fspr_hash.c} | 172 ++-- .../tables/{apr_tables.c => fspr_tables.c} | 424 +++++----- libs/apr/test/globalmutexchild.c | 38 +- libs/apr/test/internal/testregex.c | 54 +- libs/apr/test/internal/testucs.c | 22 +- libs/apr/test/mod_test.c | 4 +- libs/apr/test/occhild.c | 22 +- libs/apr/test/proc_child.c | 4 +- libs/apr/test/readchild.c | 24 +- libs/apr/test/sendfile.c | 300 +++---- libs/apr/test/sockchild.c | 40 +- libs/apr/test/testapp.c | 8 +- libs/apr/test/testargs.c | 62 +- libs/apr/test/testatomic.c | 182 ++-- libs/apr/test/testdir.c | 160 ++-- libs/apr/test/testdso.c | 140 ++-- libs/apr/test/testdup.c | 104 +-- libs/apr/test/testenv.c | 58 +- libs/apr/test/testfile.c | 426 +++++----- libs/apr/test/testfilecopy.c | 54 +- libs/apr/test/testfileinfo.c | 150 ++-- libs/apr/test/testflock.c | 42 +- libs/apr/test/testfmt.c | 48 +- libs/apr/test/testfnmatch.c | 18 +- libs/apr/test/testglobalmutex.c | 46 +- libs/apr/test/testglobalmutex.h | 2 +- libs/apr/test/testhash.c | 252 +++--- libs/apr/test/testipsub.c | 46 +- libs/apr/test/testlfs.c | 122 +-- libs/apr/test/testlock.c | 180 ++-- libs/apr/test/testlockperf.c | 136 +-- libs/apr/test/testmmap.c | 46 +- libs/apr/test/testmutexscope.c | 80 +- libs/apr/test/testnames.c | 86 +- libs/apr/test/testoc.c | 46 +- libs/apr/test/testpath.c | 40 +- libs/apr/test/testpipe.c | 100 +-- libs/apr/test/testpoll.c | 216 ++--- libs/apr/test/testpools.c | 54 +- libs/apr/test/testproc.c | 98 +-- libs/apr/test/testprocmutex.c | 76 +- libs/apr/test/testrand.c | 8 +- libs/apr/test/testrand2.c | 58 +- libs/apr/test/testshm.c | 132 +-- libs/apr/test/testshm.h | 2 +- libs/apr/test/testshmconsumer.c | 38 +- libs/apr/test/testshmproducer.c | 34 +- libs/apr/test/testsleep.c | 10 +- libs/apr/test/testsock.c | 164 ++-- libs/apr/test/testsockets.c | 102 +-- libs/apr/test/testsockopt.c | 62 +- libs/apr/test/teststr.c | 82 +- libs/apr/test/teststrnatcmp.c | 20 +- libs/apr/test/testtable.c | 130 +-- libs/apr/test/testtemp.c | 18 +- libs/apr/test/testthread.c | 58 +- libs/apr/test/testtime.c | 162 ++-- libs/apr/test/testud.c | 36 +- libs/apr/test/testuser.c | 98 +-- libs/apr/test/testutil.c | 14 +- libs/apr/test/testutil.h | 10 +- libs/apr/test/testvsn.c | 10 +- libs/apr/test/tryread.c | 22 +- .../{apr_proc_stub.c => fspr_proc_stub.c} | 0 libs/apr/threadproc/beos/proc.c | 142 ++-- libs/apr/threadproc/beos/thread.c | 84 +- libs/apr/threadproc/beos/threadpriv.c | 36 +- libs/apr/threadproc/netware/proc.c | 166 ++-- libs/apr/threadproc/netware/procsup.c | 4 +- libs/apr/threadproc/netware/signals.c | 22 +- libs/apr/threadproc/netware/thread.c | 100 +-- libs/apr/threadproc/netware/threadpriv.c | 46 +- libs/apr/threadproc/os2/proc.c | 180 ++-- libs/apr/threadproc/os2/thread.c | 96 +-- libs/apr/threadproc/os2/threadpriv.c | 50 +- libs/apr/threadproc/unix/proc.c | 216 ++--- libs/apr/threadproc/unix/procsup.c | 4 +- libs/apr/threadproc/unix/signals.c | 40 +- libs/apr/threadproc/unix/thread.c | 124 +-- libs/apr/threadproc/unix/threadpriv.c | 56 +- libs/apr/threadproc/win32/proc.c | 314 +++---- libs/apr/threadproc/win32/signals.c | 26 +- libs/apr/threadproc/win32/thread.c | 128 +-- libs/apr/threadproc/win32/threadpriv.c | 62 +- libs/apr/time/unix/time.c | 92 +-- libs/apr/time/unix/timestr.c | 36 +- libs/apr/time/win32/access.c | 52 +- libs/apr/time/win32/time.c | 96 +-- libs/apr/time/win32/timestr.c | 44 +- libs/apr/user/netware/groupinfo.c | 16 +- libs/apr/user/netware/userinfo.c | 28 +- libs/apr/user/unix/groupinfo.c | 22 +- libs/apr/user/unix/userinfo.c | 44 +- libs/apr/user/win32/groupinfo.c | 30 +- libs/apr/user/win32/userinfo.c | 90 +- 354 files changed, 11614 insertions(+), 11614 deletions(-) rename libs/apr/atomic/netware/{apr_atomic.c => fspr_atomic.c} (61%) rename libs/apr/atomic/unix/{apr_atomic.c => fspr_atomic.c} (65%) rename libs/apr/atomic/win32/{apr_atomic.c => fspr_atomic.c} (56%) delete mode 100644 libs/apr/include/apr_random.h rename libs/apr/include/arch/aix/{apr_arch_dso.h => fspr_arch_dso.h} (86%) rename libs/apr/include/arch/beos/{apr_arch_dso.h => fspr_arch_dso.h} (85%) rename libs/apr/include/arch/beos/{apr_arch_proc_mutex.h => fspr_arch_proc_mutex.h} (82%) rename libs/apr/include/arch/beos/{apr_arch_thread_cond.h => fspr_arch_thread_cond.h} (81%) rename libs/apr/include/arch/beos/{apr_arch_thread_mutex.h => fspr_arch_thread_mutex.h} (81%) rename libs/apr/include/arch/beos/{apr_arch_thread_rwlock.h => fspr_arch_thread_rwlock.h} (84%) rename libs/apr/include/arch/beos/{apr_arch_threadproc.h => fspr_arch_threadproc.h} (71%) rename libs/apr/include/arch/{apr_private_common.h => fspr_private_common.h} (75%) rename libs/apr/include/arch/netware/{apr_arch_dso.h => fspr_arch_dso.h} (86%) rename libs/apr/include/arch/netware/{apr_arch_file_io.h => fspr_arch_file_io.h} (76%) rename libs/apr/include/arch/netware/{apr_arch_global_mutex.h => fspr_arch_global_mutex.h} (85%) rename libs/apr/include/arch/netware/{apr_arch_internal_time.h => fspr_arch_internal_time.h} (94%) rename libs/apr/include/arch/netware/{apr_arch_networkio.h => fspr_arch_networkio.h} (93%) rename libs/apr/include/arch/netware/{apr_arch_pre_nw.h => fspr_arch_pre_nw.h} (100%) rename libs/apr/include/arch/netware/{apr_arch_proc_mutex.h => fspr_arch_proc_mutex.h} (86%) rename libs/apr/include/arch/netware/{apr_arch_thread_cond.h => fspr_arch_thread_cond.h} (91%) rename libs/apr/include/arch/netware/{apr_arch_thread_mutex.h => fspr_arch_thread_mutex.h} (91%) rename libs/apr/include/arch/netware/{apr_arch_thread_rwlock.h => fspr_arch_thread_rwlock.h} (91%) rename libs/apr/include/arch/netware/{apr_arch_threadproc.h => fspr_arch_threadproc.h} (59%) rename libs/apr/include/arch/netware/{apr_private.h => fspr_private.h} (98%) delete mode 100644 libs/apr/include/arch/os2/apr_arch_os2calls.h rename libs/apr/include/arch/os2/{apr_arch_dso.h => fspr_arch_dso.h} (79%) rename libs/apr/include/arch/os2/{apr_arch_file_io.h => fspr_arch_file_io.h} (67%) rename libs/apr/include/arch/os2/{apr_arch_networkio.h => fspr_arch_networkio.h} (80%) create mode 100644 libs/apr/include/arch/os2/fspr_arch_os2calls.h rename libs/apr/include/arch/os2/{apr_arch_proc_mutex.h => fspr_arch_proc_mutex.h} (89%) rename libs/apr/include/arch/os2/{apr_arch_thread_cond.h => fspr_arch_thread_cond.h} (89%) rename libs/apr/include/arch/os2/{apr_arch_thread_mutex.h => fspr_arch_thread_mutex.h} (89%) rename libs/apr/include/arch/os2/{apr_arch_thread_rwlock.h => fspr_arch_thread_rwlock.h} (89%) rename libs/apr/include/arch/os2/{apr_arch_threadproc.h => fspr_arch_threadproc.h} (64%) rename libs/apr/include/arch/os390/{apr_arch_dso.h => fspr_arch_dso.h} (86%) rename libs/apr/include/arch/unix/{apr_arch_dso.h => fspr_arch_dso.h} (88%) rename libs/apr/include/arch/unix/{apr_arch_file_io.h => fspr_arch_file_io.h} (80%) rename libs/apr/include/arch/unix/{apr_arch_global_mutex.h => fspr_arch_global_mutex.h} (74%) rename libs/apr/include/arch/unix/{apr_arch_inherit.h => fspr_arch_inherit.h} (85%) rename libs/apr/include/arch/unix/{apr_arch_internal_time.h => fspr_arch_internal_time.h} (94%) rename libs/apr/include/arch/unix/{apr_arch_misc.h => fspr_arch_misc.h} (76%) rename libs/apr/include/arch/unix/{apr_arch_networkio.h => fspr_arch_networkio.h} (80%) rename libs/apr/include/arch/unix/{apr_arch_poll_private.h => fspr_arch_poll_private.h} (83%) rename libs/apr/include/arch/unix/{apr_arch_proc_mutex.h => fspr_arch_proc_mutex.h} (68%) rename libs/apr/include/arch/unix/{apr_arch_shm.h => fspr_arch_shm.h} (81%) rename libs/apr/include/arch/unix/{apr_arch_thread_cond.h => fspr_arch_thread_cond.h} (82%) rename libs/apr/include/arch/unix/{apr_arch_thread_mutex.h => fspr_arch_thread_mutex.h} (83%) rename libs/apr/include/arch/unix/{apr_arch_thread_rwlock.h => fspr_arch_thread_rwlock.h} (82%) rename libs/apr/include/arch/unix/{apr_arch_threadproc.h => fspr_arch_threadproc.h} (71%) rename libs/apr/include/arch/win32/{apr_arch_atime.h => fspr_arch_atime.h} (87%) rename libs/apr/include/arch/win32/{apr_arch_dso.h => fspr_arch_dso.h} (81%) rename libs/apr/include/arch/win32/{apr_arch_file_io.h => fspr_arch_file_io.h} (72%) rename libs/apr/include/arch/win32/{apr_arch_inherit.h => fspr_arch_inherit.h} (87%) rename libs/apr/include/arch/win32/{apr_arch_misc.h => fspr_arch_misc.h} (78%) rename libs/apr/include/arch/win32/{apr_arch_networkio.h => fspr_arch_networkio.h} (74%) rename libs/apr/include/arch/win32/{apr_arch_proc_mutex.h => fspr_arch_proc_mutex.h} (92%) rename libs/apr/include/arch/win32/{apr_arch_thread_cond.h => fspr_arch_thread_cond.h} (92%) rename libs/apr/include/arch/win32/{apr_arch_thread_mutex.h => fspr_arch_thread_mutex.h} (94%) rename libs/apr/include/arch/win32/{apr_arch_thread_rwlock.h => fspr_arch_thread_rwlock.h} (92%) rename libs/apr/include/arch/win32/{apr_arch_threadproc.h => fspr_arch_threadproc.h} (60%) rename libs/apr/include/arch/win32/{apr_arch_utf8.h => fspr_arch_utf8.h} (76%) rename libs/apr/include/arch/win32/{apr_dbg_win32_handles.h => fspr_dbg_win32_handles.h} (62%) rename libs/apr/include/arch/win32/{apr_private.h => fspr_private.h} (97%) rename libs/apr/include/{apr.h.in => fspr.h.in} (92%) rename libs/apr/include/{apr.hnw => fspr.hnw} (91%) rename libs/apr/include/{apr.hw => fspr.hw} (92%) rename libs/apr/include/{apr_allocator.h => fspr_allocator.h} (65%) rename libs/apr/include/{apr_atomic.h => fspr_atomic.h} (64%) rename libs/apr/include/{apr_dso.h => fspr_dso.h} (74%) rename libs/apr/include/{apr_env.h => fspr_env.h} (77%) rename libs/apr/include/{apr_errno.h => fspr_errno.h} (95%) rename libs/apr/include/{apr_file_info.h => fspr_file_info.h} (78%) rename libs/apr/include/{apr_file_io.h => fspr_file_io.h} (72%) rename libs/apr/include/{apr_fnmatch.h => fspr_fnmatch.h} (89%) rename libs/apr/include/{apr_general.h => fspr_general.h} (80%) rename libs/apr/include/{apr_getopt.h => fspr_getopt.h} (78%) rename libs/apr/include/{apr_global_mutex.h => fspr_global_mutex.h} (71%) rename libs/apr/include/{apr_hash.h => fspr_hash.h} (69%) rename libs/apr/include/{apr_inherit.h => fspr_inherit.h} (70%) rename libs/apr/include/{apr_lib.h => fspr_lib.h} (65%) rename libs/apr/include/{apr_mmap.h => fspr_mmap.h} (76%) rename libs/apr/include/{apr_network_io.h => fspr_network_io.h} (72%) rename libs/apr/include/{apr_poll.h => fspr_poll.h} (65%) rename libs/apr/include/{apr_pools.h => fspr_pools.h} (70%) rename libs/apr/include/{apr_portable.h => fspr_portable.h} (51%) rename libs/apr/include/{apr_proc_mutex.h => fspr_proc_mutex.h} (78%) create mode 100644 libs/apr/include/fspr_random.h rename libs/apr/include/{apr_ring.h => fspr_ring.h} (99%) rename libs/apr/include/{apr_shm.h => fspr_shm.h} (81%) rename libs/apr/include/{apr_signal.h => fspr_signal.h} (81%) rename libs/apr/include/{apr_strings.h => fspr_strings.h} (77%) rename libs/apr/include/{apr_support.h => fspr_support.h} (83%) rename libs/apr/include/{apr_tables.h => fspr_tables.h} (74%) rename libs/apr/include/{apr_thread_cond.h => fspr_thread_cond.h} (79%) rename libs/apr/include/{apr_thread_mutex.h => fspr_thread_mutex.h} (81%) rename libs/apr/include/{apr_thread_proc.h => fspr_thread_proc.h} (71%) rename libs/apr/include/{apr_thread_rwlock.h => fspr_thread_rwlock.h} (78%) rename libs/apr/include/{apr_time.h => fspr_time.h} (56%) rename libs/apr/include/{apr_user.h => fspr_user.h} (65%) rename libs/apr/include/{apr_version.h => fspr_version.h} (93%) rename libs/apr/include/{apr_want.h => fspr_want.h} (94%) rename libs/apr/memory/unix/{apr_pools.c => fspr_pools.c} (67%) rename libs/apr/misc/win32/{apr_app.c => fspr_app.c} (90%) rename libs/apr/passwd/{apr_getpass.c => fspr_getpass.c} (93%) rename libs/apr/random/unix/{apr_random.c => fspr_random.c} (71%) rename libs/apr/strings/{apr_cpystrn.c => fspr_cpystrn.c} (89%) rename libs/apr/strings/{apr_fnmatch.c => fspr_fnmatch.c} (84%) rename libs/apr/strings/{apr_snprintf.c => fspr_snprintf.c} (90%) rename libs/apr/strings/{apr_strings.c => fspr_strings.c} (82%) rename libs/apr/strings/{apr_strnatcmp.c => fspr_strnatcmp.c} (84%) rename libs/apr/strings/{apr_strtok.c => fspr_strtok.c} (91%) rename libs/apr/tables/{apr_hash.c => fspr_hash.c} (72%) rename libs/apr/tables/{apr_tables.c => fspr_tables.c} (71%) rename libs/apr/threadproc/beos/{apr_proc_stub.c => fspr_proc_stub.c} (100%) diff --git a/libs/apr/Makefile.in b/libs/apr/Makefile.in index ee7969f9fc..2c347b7322 100644 --- a/libs/apr/Makefile.in +++ b/libs/apr/Makefile.in @@ -45,7 +45,7 @@ TARGETS = $(TARGET_LIB) export_vars.c apr.exp CLEAN_TARGETS = apr-config.out apr.exp exports.c export_vars.c .make.dirs \ build/apr_rules.out DISTCLEAN_TARGETS = config.cache config.log config.status \ - include/apr.h include/arch/unix/apr_private.h \ + include/fspr.h include/arch/unix/apr_private.h \ libtool $(APR_CONFIG) build/apr_rules.mk apr.pc \ build/pkg/pkginfo EXTRACLEAN_TARGETS = configure aclocal.m4 include/arch/unix/apr_private.h.in \ @@ -81,7 +81,7 @@ $(top_srcdir)/configure: $(top_srcdir)/configure.ac install: $(TARGET_LIB) apr-config.out build/apr_rules.out $(APR_MKDIR) $(DESTDIR)$(libdir) $(DESTDIR)$(bindir) $(DESTDIR)$(installbuilddir) \ $(DESTDIR)$(libdir)/pkgconfig $(DESTDIR)$(includedir) - $(INSTALL_DATA) $(top_blddir)/include/apr.h $(DESTDIR)$(includedir) + $(INSTALL_DATA) $(top_blddir)/include/fspr.h $(DESTDIR)$(includedir) for f in $(top_srcdir)/include/apr_*.h; do \ $(INSTALL_DATA) $${f} $(DESTDIR)$(includedir); \ done diff --git a/libs/apr/apr.dsp b/libs/apr/apr.dsp index d1c1b29cfd..7c3d0160da 100644 --- a/libs/apr/apr.dsp +++ b/libs/apr/apr.dsp @@ -41,7 +41,7 @@ RSC=rc.exe # PROP Intermediate_Dir "LibR" # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibR\apr_src" /FD /c +# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibR\fspr_src" /FD /c # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" BSC32=bscmake.exe @@ -65,7 +65,7 @@ LIB32=link.exe -lib # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibD\apr_src" /FD /c +# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_STATIC" /D "WIN32" /D "_WINDOWS" /Fd"LibD\fspr_src" /FD /c # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" BSC32=bscmake.exe @@ -89,7 +89,7 @@ LIB32=link.exe -lib # PROP Default_Filter "" # Begin Source File -SOURCE=.\atomic\win32\apr_atomic.c +SOURCE=.\atomic\win32\fspr_atomic.c # End Source File # End Group # Begin Group "dso" @@ -193,7 +193,7 @@ SOURCE=.\locks\win32\thread_rwlock.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\memory\unix\apr_pools.c +SOURCE=.\memory\unix\fspr_pools.c # End Source File # End Group # Begin Group "misc" @@ -201,7 +201,7 @@ SOURCE=.\memory\unix\apr_pools.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\misc\win32\apr_app.c +SOURCE=.\misc\win32\fspr_app.c # PROP Exclude_From_Build 1 # End Source File # Begin Source File @@ -302,7 +302,7 @@ SOURCE=.\network_io\win32\sockopt.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\passwd\apr_getpass.c +SOURCE=.\passwd\fspr_getpass.c # End Source File # End Group # Begin Group "random" @@ -310,7 +310,7 @@ SOURCE=.\passwd\apr_getpass.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\random\unix\apr_random.c +SOURCE=.\random\unix\fspr_random.c # End Source File # Begin Source File @@ -334,27 +334,27 @@ SOURCE=.\shmem\win32\shm.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\strings\apr_cpystrn.c +SOURCE=.\strings\fspr_cpystrn.c # End Source File # Begin Source File -SOURCE=.\strings\apr_fnmatch.c +SOURCE=.\strings\fspr_fnmatch.c # End Source File # Begin Source File -SOURCE=.\strings\apr_snprintf.c +SOURCE=.\strings\fspr_snprintf.c # End Source File # Begin Source File -SOURCE=.\strings\apr_strings.c +SOURCE=.\strings\fspr_strings.c # End Source File # Begin Source File -SOURCE=.\strings\apr_strnatcmp.c +SOURCE=.\strings\fspr_strnatcmp.c # End Source File # Begin Source File -SOURCE=.\strings\apr_strtok.c +SOURCE=.\strings\fspr_strtok.c # End Source File # End Group # Begin Group "tables" @@ -362,11 +362,11 @@ SOURCE=.\strings\apr_strtok.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\tables\apr_hash.c +SOURCE=.\tables\fspr_hash.c # End Source File # Begin Source File -SOURCE=.\tables\apr_tables.c +SOURCE=.\tables\fspr_tables.c # End Source File # End Group # Begin Group "threadproc" @@ -423,51 +423,51 @@ SOURCE=.\user\win32\userinfo.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_atime.h +SOURCE=.\include\arch\win32\fspr_arch_atime.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_dso.h +SOURCE=.\include\arch\win32\fspr_arch_dso.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_file_io.h +SOURCE=.\include\arch\win32\fspr_arch_file_io.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_inherit.h +SOURCE=.\include\arch\win32\fspr_arch_inherit.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_misc.h +SOURCE=.\include\arch\win32\fspr_arch_misc.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_networkio.h +SOURCE=.\include\arch\win32\fspr_arch_networkio.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_thread_mutex.h +SOURCE=.\include\arch\win32\fspr_arch_thread_mutex.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_thread_rwlock.h +SOURCE=.\include\arch\win32\fspr_arch_thread_rwlock.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_threadproc.h +SOURCE=.\include\arch\win32\fspr_arch_threadproc.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_utf8.h +SOURCE=.\include\arch\win32\fspr_arch_utf8.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_private.h +SOURCE=.\include\arch\win32\fspr_private.h # End Source File # Begin Source File -SOURCE=.\include\arch\apr_private_common.h +SOURCE=.\include\arch\fspr_private_common.h # End Source File # End Group # Begin Group "Public Header Files" @@ -475,35 +475,35 @@ SOURCE=.\include\arch\apr_private_common.h # PROP Default_Filter "" # Begin Source File -SOURCE=.\include\apr.h.in +SOURCE=.\include\fspr.h.in # PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=.\include\apr.hnw +SOURCE=.\include\fspr.hnw # PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=.\include\apr.hw +SOURCE=.\include\fspr.hw !IF "$(CFG)" == "apr - Win32 Release" # Begin Custom Build - Creating apr.h from apr.hw -InputPath=.\include\apr.hw +InputPath=.\include\fspr.hw -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apr.hw > .\include\apr.h +".\include\fspr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\fspr.hw > .\include\fspr.h # End Custom Build !ELSEIF "$(CFG)" == "apr - Win32 Debug" # Begin Custom Build - Creating apr.h from apr.hw -InputPath=.\include\apr.hw +InputPath=.\include\fspr.hw -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apr.hw > .\include\apr.h +".\include\fspr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\fspr.hw > .\include\fspr.h # End Custom Build @@ -512,139 +512,139 @@ InputPath=.\include\apr.hw # End Source File # Begin Source File -SOURCE=.\include\apr_allocator.h +SOURCE=.\include\fspr_allocator.h # End Source File # Begin Source File -SOURCE=.\include\apr_atomic.h +SOURCE=.\include\fspr_atomic.h # End Source File # Begin Source File -SOURCE=.\include\apr_dso.h +SOURCE=.\include\fspr_dso.h # End Source File # Begin Source File -SOURCE=.\include\apr_env.h +SOURCE=.\include\fspr_env.h # End Source File # Begin Source File -SOURCE=.\include\apr_errno.h +SOURCE=.\include\fspr_errno.h # End Source File # Begin Source File -SOURCE=.\include\apr_file_info.h +SOURCE=.\include\fspr_file_info.h # End Source File # Begin Source File -SOURCE=.\include\apr_file_io.h +SOURCE=.\include\fspr_file_io.h # End Source File # Begin Source File -SOURCE=.\include\apr_fnmatch.h +SOURCE=.\include\fspr_fnmatch.h # End Source File # Begin Source File -SOURCE=.\include\apr_general.h +SOURCE=.\include\fspr_general.h # End Source File # Begin Source File -SOURCE=.\include\apr_getopt.h +SOURCE=.\include\fspr_getopt.h # End Source File # Begin Source File -SOURCE=.\include\apr_global_mutex.h +SOURCE=.\include\fspr_global_mutex.h # End Source File # Begin Source File -SOURCE=.\include\apr_hash.h +SOURCE=.\include\fspr_hash.h # End Source File # Begin Source File -SOURCE=.\include\apr_inherit.h +SOURCE=.\include\fspr_inherit.h # End Source File # Begin Source File -SOURCE=.\include\apr_lib.h +SOURCE=.\include\fspr_lib.h # End Source File # Begin Source File -SOURCE=.\include\apr_mmap.h +SOURCE=.\include\fspr_mmap.h # End Source File # Begin Source File -SOURCE=.\include\apr_network_io.h +SOURCE=.\include\fspr_network_io.h # End Source File # Begin Source File -SOURCE=.\include\apr_poll.h +SOURCE=.\include\fspr_poll.h # End Source File # Begin Source File -SOURCE=.\include\apr_pools.h +SOURCE=.\include\fspr_pools.h # End Source File # Begin Source File -SOURCE=.\include\apr_portable.h +SOURCE=.\include\fspr_portable.h # End Source File # Begin Source File -SOURCE=.\include\apr_proc_mutex.h +SOURCE=.\include\fspr_proc_mutex.h # End Source File # Begin Source File -SOURCE=.\include\apr_ring.h +SOURCE=.\include\fspr_ring.h # End Source File # Begin Source File -SOURCE=.\include\apr_shm.h +SOURCE=.\include\fspr_shm.h # End Source File # Begin Source File -SOURCE=.\include\apr_signal.h +SOURCE=.\include\fspr_signal.h # End Source File # Begin Source File -SOURCE=.\include\apr_strings.h +SOURCE=.\include\fspr_strings.h # End Source File # Begin Source File -SOURCE=.\include\apr_support.h +SOURCE=.\include\fspr_support.h # End Source File # Begin Source File -SOURCE=.\include\apr_tables.h +SOURCE=.\include\fspr_tables.h # End Source File # Begin Source File -SOURCE=.\include\apr_thread_cond.h +SOURCE=.\include\fspr_thread_cond.h # End Source File # Begin Source File -SOURCE=.\include\apr_thread_mutex.h +SOURCE=.\include\fspr_thread_mutex.h # End Source File # Begin Source File -SOURCE=.\include\apr_thread_proc.h +SOURCE=.\include\fspr_thread_proc.h # End Source File # Begin Source File -SOURCE=.\include\apr_thread_rwlock.h +SOURCE=.\include\fspr_thread_rwlock.h # End Source File # Begin Source File -SOURCE=.\include\apr_time.h +SOURCE=.\include\fspr_time.h # End Source File # Begin Source File -SOURCE=.\include\apr_user.h +SOURCE=.\include\fspr_user.h # End Source File # Begin Source File -SOURCE=.\include\apr_version.h +SOURCE=.\include\fspr_version.h # End Source File # Begin Source File -SOURCE=.\include\apr_want.h +SOURCE=.\include\fspr_want.h # End Source File # End Group # End Target diff --git a/libs/apr/apr.dsw b/libs/apr/apr.dsw index dc0871bbc8..73db5d052e 100644 --- a/libs/apr/apr.dsw +++ b/libs/apr/apr.dsw @@ -15,7 +15,7 @@ Package=<4> ############################################################################### -Project: "apr_app"=".\build\apr_app.dsp" - Package Owner=<4> +Project: "fspr_app"=".\build\fspr_app.dsp" - Package Owner=<4> Package=<5> {{{ @@ -42,7 +42,7 @@ Package=<4> ############################################################################### -Project: "libapr_app"=".\build\libapr_app.dsp" - Package Owner=<4> +Project: "libfspr_app"=".\build\libfspr_app.dsp" - Package Owner=<4> Package=<5> {{{ diff --git a/libs/apr/atomic/netware/apr_atomic.c b/libs/apr/atomic/netware/fspr_atomic.c similarity index 61% rename from libs/apr/atomic/netware/apr_atomic.c rename to libs/apr/atomic/netware/fspr_atomic.c index 94a3549775..e54704064c 100644 --- a/libs/apr/atomic/netware/apr_atomic.c +++ b/libs/apr/atomic/netware/fspr_atomic.c @@ -14,57 +14,57 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_atomic.h" +#include "fspr.h" +#include "fspr_atomic.h" #include -APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_atomic_init(fspr_pool_t *pool) { return APR_SUCCESS; } -APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(fspr_uint32_t) fspr_atomic_add32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { return atomic_xchgadd((unsigned long *)mem,(unsigned long)val); } -APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(void) fspr_atomic_sub32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { atomic_sub((unsigned long *)mem,(unsigned long)val); } -APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem) +APR_DECLARE(fspr_uint32_t) fspr_atomic_inc32(volatile fspr_uint32_t *mem) { return atomic_xchgadd((unsigned long *)mem, 1); } -APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(void) fspr_atomic_set32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { *mem = val; } -APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) +APR_DECLARE(fspr_uint32_t) fspr_atomic_read32(volatile fspr_uint32_t *mem) { return *mem; } -APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with,apr_uint32_t cmp) +APR_DECLARE(fspr_uint32_t) fspr_atomic_cas32(volatile fspr_uint32_t *mem, fspr_uint32_t with,fspr_uint32_t cmp) { return atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with); } -APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(fspr_uint32_t) fspr_atomic_xchg32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { return atomic_xchg((unsigned long *)mem,(unsigned long)val); } -APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem) +APR_DECLARE(int) fspr_atomic_dec32(volatile fspr_uint32_t *mem) { return (atomic_xchgadd((unsigned long *)mem, 0xFFFFFFFF) - 1); } -APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) +APR_DECLARE(void *) fspr_atomic_casptr(volatile void **mem, void *with, const void *cmp) { return (void*)atomic_cmpxchg((unsigned long *)mem,(unsigned long)cmp,(unsigned long)with); } diff --git a/libs/apr/atomic/os390/atomic.c b/libs/apr/atomic/os390/atomic.c index 35ddf1c226..b85b5bfa64 100644 --- a/libs/apr/atomic/os390/atomic.c +++ b/libs/apr/atomic/os390/atomic.c @@ -15,19 +15,19 @@ */ -#include "apr.h" -#include "apr_atomic.h" +#include "fspr.h" +#include "fspr_atomic.h" #include -apr_status_t apr_atomic_init(apr_pool_t *p) +fspr_status_t fspr_atomic_init(fspr_pool_t *p) { return APR_SUCCESS; } -apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) +fspr_uint32_t fspr_atomic_add32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t old, new_val; + fspr_uint32_t old, new_val; old = *mem; /* old is automatically updated on cs failure */ do { @@ -36,9 +36,9 @@ apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) return old; } -void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) +void fspr_atomic_sub32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t old, new_val; + fspr_uint32_t old, new_val; old = *mem; /* old is automatically updated on cs failure */ do { @@ -46,14 +46,14 @@ void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) } while (__cs(&old, (cs_t *)mem, new_val)); } -apr_uint32_t apr_atomic_inc32(volatile apr_uint32_t *mem) +fspr_uint32_t fspr_atomic_inc32(volatile fspr_uint32_t *mem) { - return apr_atomic_add32(mem, 1); + return fspr_atomic_add32(mem, 1); } -int apr_atomic_dec32(volatile apr_uint32_t *mem) +int fspr_atomic_dec32(volatile fspr_uint32_t *mem) { - apr_uint32_t old, new_val; + fspr_uint32_t old, new_val; old = *mem; /* old is automatically updated on cs failure */ do { @@ -63,28 +63,28 @@ int apr_atomic_dec32(volatile apr_uint32_t *mem) return new_val != 0; } -apr_uint32_t apr_atomic_read32(volatile apr_uint32_t *mem) +fspr_uint32_t fspr_atomic_read32(volatile fspr_uint32_t *mem) { return *mem; } -void apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) +void fspr_atomic_set32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { *mem = val; } -apr_uint32_t apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t swap, - apr_uint32_t cmp) +fspr_uint32_t fspr_atomic_cas32(volatile fspr_uint32_t *mem, fspr_uint32_t swap, + fspr_uint32_t cmp) { - apr_uint32_t old = cmp; + fspr_uint32_t old = cmp; __cs(&old, (cs_t *)mem, swap); return old; /* old is automatically updated from mem on cs failure */ } -apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) +fspr_uint32_t fspr_atomic_xchg32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t old, new_val; + fspr_uint32_t old, new_val; old = *mem; /* old is automatically updated on cs failure */ do { diff --git a/libs/apr/atomic/unix/apr_atomic.c b/libs/apr/atomic/unix/fspr_atomic.c similarity index 65% rename from libs/apr/atomic/unix/apr_atomic.c rename to libs/apr/atomic/unix/fspr_atomic.c index 3110d96d7c..6a366a1a73 100644 --- a/libs/apr/atomic/unix/apr_atomic.c +++ b/libs/apr/atomic/unix/fspr_atomic.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_atomic.h" -#include "apr_thread_mutex.h" +#include "fspr.h" +#include "fspr_atomic.h" +#include "fspr_thread_mutex.h" -#include "apr_private.h" +#include "fspr_private.h" #include @@ -31,11 +31,11 @@ #if (defined(__i386__) || defined(__x86_64__)) \ && defined(__GNUC__) && !defined(USE_GENERIC_ATOMICS) -APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, - apr_uint32_t with, - apr_uint32_t cmp) +APR_DECLARE(fspr_uint32_t) fspr_atomic_cas32(volatile fspr_uint32_t *mem, + fspr_uint32_t with, + fspr_uint32_t cmp) { - apr_uint32_t prev; + fspr_uint32_t prev; asm volatile ("lock; cmpxchgl %1, %2" : "=a" (prev) @@ -45,8 +45,8 @@ APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, } #define APR_OVERRIDE_ATOMIC_CAS32 -static apr_uint32_t inline intel_atomic_add32(volatile apr_uint32_t *mem, - apr_uint32_t val) +static fspr_uint32_t inline intel_atomic_add32(volatile fspr_uint32_t *mem, + fspr_uint32_t val) { asm volatile ("lock; xaddl %0,%1" : "=r"(val), "=m"(*mem) /* outputs */ @@ -55,14 +55,14 @@ static apr_uint32_t inline intel_atomic_add32(volatile apr_uint32_t *mem, return val; } -APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, - apr_uint32_t val) +APR_DECLARE(fspr_uint32_t) fspr_atomic_add32(volatile fspr_uint32_t *mem, + fspr_uint32_t val) { return intel_atomic_add32(mem, val); } #define APR_OVERRIDE_ATOMIC_ADD32 -APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(void) fspr_atomic_sub32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { asm volatile ("lock; subl %1, %0" : @@ -71,7 +71,7 @@ APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) } #define APR_OVERRIDE_ATOMIC_SUB32 -APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem) +APR_DECLARE(int) fspr_atomic_dec32(volatile fspr_uint32_t *mem) { unsigned char prev; @@ -84,21 +84,21 @@ APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem) } #define APR_OVERRIDE_ATOMIC_DEC32 -APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem) +APR_DECLARE(fspr_uint32_t) fspr_atomic_inc32(volatile fspr_uint32_t *mem) { return intel_atomic_add32(mem, 1); } #define APR_OVERRIDE_ATOMIC_INC32 -APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(void) fspr_atomic_set32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { *mem = val; } #define APR_OVERRIDE_ATOMIC_SET32 -APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(fspr_uint32_t) fspr_atomic_xchg32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t prev = val; + fspr_uint32_t prev = val; asm volatile ("lock; xchgl %0, %1" : "=r" (prev) @@ -108,18 +108,18 @@ APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint } #define APR_OVERRIDE_ATOMIC_XCHG32 -/*#define apr_atomic_init(pool) APR_SUCCESS*/ +/*#define fspr_atomic_init(pool) APR_SUCCESS*/ #endif /* (__linux__ || __EMX__ || __FreeBSD__) && __i386__ */ #if (defined(__PPC__) || defined(__ppc__)) && defined(__GNUC__) \ && !defined(USE_GENERIC_ATOMICS) -APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, - apr_uint32_t swap, - apr_uint32_t cmp) +APR_DECLARE(fspr_uint32_t) fspr_atomic_cas32(volatile fspr_uint32_t *mem, + fspr_uint32_t swap, + fspr_uint32_t cmp) { - apr_uint32_t prev; + fspr_uint32_t prev; asm volatile ("0:\n\t" /* retry local label */ "lwarx %0,0,%1\n\t" /* load prev and reserve */ @@ -138,10 +138,10 @@ APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, } #define APR_OVERRIDE_ATOMIC_CAS32 -APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, - apr_uint32_t delta) +APR_DECLARE(fspr_uint32_t) fspr_atomic_add32(volatile fspr_uint32_t *mem, + fspr_uint32_t delta) { - apr_uint32_t prev, temp; + fspr_uint32_t prev, temp; asm volatile ("0:\n\t" /* retry local label */ "lwarx %0,0,%2\n\t" /* load prev and reserve */ @@ -168,18 +168,18 @@ APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, #define NUM_ATOMIC_HASH 7 /* shift by 2 to get rid of alignment issues */ #define ATOMIC_HASH(x) (unsigned int)(((unsigned long)(x)>>2)%(unsigned int)NUM_ATOMIC_HASH) -static apr_thread_mutex_t **hash_mutex; +static fspr_thread_mutex_t **hash_mutex; #endif /* APR_HAS_THREADS */ -apr_status_t apr_atomic_init(apr_pool_t *p) +fspr_status_t fspr_atomic_init(fspr_pool_t *p) { #if APR_HAS_THREADS int i; - apr_status_t rv; - hash_mutex = apr_palloc(p, sizeof(apr_thread_mutex_t*) * NUM_ATOMIC_HASH); + fspr_status_t rv; + hash_mutex = fspr_palloc(p, sizeof(fspr_thread_mutex_t*) * NUM_ATOMIC_HASH); for (i = 0; i < NUM_ATOMIC_HASH; i++) { - rv = apr_thread_mutex_create(&(hash_mutex[i]), + rv = fspr_thread_mutex_create(&(hash_mutex[i]), APR_THREAD_MUTEX_DEFAULT, p); if (rv != APR_SUCCESS) { return rv; @@ -195,28 +195,28 @@ apr_status_t apr_atomic_init(apr_pool_t *p) #if !defined(APR_OVERRIDE_ATOMIC_ADD32) #if defined(APR_OVERRIDE_ATOMIC_CAS32) -apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) +fspr_uint32_t fspr_atomic_add32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t old_value, new_value; + fspr_uint32_t old_value, new_value; do { old_value = *mem; new_value = old_value + val; - } while (apr_atomic_cas32(mem, new_value, old_value) != old_value); + } while (fspr_atomic_cas32(mem, new_value, old_value) != old_value); return old_value; } #else -apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) +fspr_uint32_t fspr_atomic_add32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t old_value; + fspr_uint32_t old_value; #if APR_HAS_THREADS - apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; + fspr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; - CHECK(apr_thread_mutex_lock(lock)); + CHECK(fspr_thread_mutex_lock(lock)); old_value = *mem; *mem += val; - CHECK(apr_thread_mutex_unlock(lock)); + CHECK(fspr_thread_mutex_unlock(lock)); #else old_value = *mem; *mem += val; @@ -228,24 +228,24 @@ apr_uint32_t apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) #if !defined(APR_OVERRIDE_ATOMIC_SUB32) #if defined(APR_OVERRIDE_ATOMIC_CAS32) -void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) +void fspr_atomic_sub32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t old_value, new_value; + fspr_uint32_t old_value, new_value; do { old_value = *mem; new_value = old_value - val; - } while (apr_atomic_cas32(mem, new_value, old_value) != old_value); + } while (fspr_atomic_cas32(mem, new_value, old_value) != old_value); } #else -void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) +void fspr_atomic_sub32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { #if APR_HAS_THREADS - apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; + fspr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; - CHECK(apr_thread_mutex_lock(lock)); + CHECK(fspr_thread_mutex_lock(lock)); *mem -= val; - CHECK(apr_thread_mutex_unlock(lock)); + CHECK(fspr_thread_mutex_unlock(lock)); #else *mem -= val; #endif /* APR_HAS_THREADS */ @@ -254,14 +254,14 @@ void apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) #endif /* !defined(APR_OVERRIDE_ATOMIC_SUB32) */ #if !defined(APR_OVERRIDE_ATOMIC_SET32) -void apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) +void fspr_atomic_set32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { #if APR_HAS_THREADS - apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; + fspr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; - CHECK(apr_thread_mutex_lock(lock)); + CHECK(fspr_thread_mutex_lock(lock)); *mem = val; - CHECK(apr_thread_mutex_unlock(lock)); + CHECK(fspr_thread_mutex_unlock(lock)); #else *mem = val; #endif /* APR_HAS_THREADS */ @@ -269,35 +269,35 @@ void apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) #endif /* !defined(APR_OVERRIDE_ATOMIC_SET32) */ #if !defined(APR_OVERRIDE_ATOMIC_INC32) -apr_uint32_t apr_atomic_inc32(volatile apr_uint32_t *mem) +fspr_uint32_t fspr_atomic_inc32(volatile fspr_uint32_t *mem) { - return apr_atomic_add32(mem, 1); + return fspr_atomic_add32(mem, 1); } #endif /* !defined(APR_OVERRIDE_ATOMIC_INC32) */ #if !defined(APR_OVERRIDE_ATOMIC_DEC32) #if defined(APR_OVERRIDE_ATOMIC_CAS32) -int apr_atomic_dec32(volatile apr_uint32_t *mem) +int fspr_atomic_dec32(volatile fspr_uint32_t *mem) { - apr_uint32_t old_value, new_value; + fspr_uint32_t old_value, new_value; do { old_value = *mem; new_value = old_value - 1; - } while (apr_atomic_cas32(mem, new_value, old_value) != old_value); + } while (fspr_atomic_cas32(mem, new_value, old_value) != old_value); return old_value != 1; } #else -int apr_atomic_dec32(volatile apr_uint32_t *mem) +int fspr_atomic_dec32(volatile fspr_uint32_t *mem) { #if APR_HAS_THREADS - apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; - apr_uint32_t new; + fspr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; + fspr_uint32_t new; - CHECK(apr_thread_mutex_lock(lock)); + CHECK(fspr_thread_mutex_lock(lock)); (*mem)--; new = *mem; - CHECK(apr_thread_mutex_unlock(lock)); + CHECK(fspr_thread_mutex_unlock(lock)); return new; #else (*mem)--; @@ -308,19 +308,19 @@ int apr_atomic_dec32(volatile apr_uint32_t *mem) #endif /* !defined(APR_OVERRIDE_ATOMIC_DEC32) */ #if !defined(APR_OVERRIDE_ATOMIC_CAS32) -apr_uint32_t apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with, - apr_uint32_t cmp) +fspr_uint32_t fspr_atomic_cas32(volatile fspr_uint32_t *mem, fspr_uint32_t with, + fspr_uint32_t cmp) { - apr_uint32_t prev; + fspr_uint32_t prev; #if APR_HAS_THREADS - apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; + fspr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; - CHECK(apr_thread_mutex_lock(lock)); + CHECK(fspr_thread_mutex_lock(lock)); prev = *mem; if (prev == cmp) { *mem = with; } - CHECK(apr_thread_mutex_unlock(lock)); + CHECK(fspr_thread_mutex_unlock(lock)); #else prev = *mem; if (prev == cmp) { @@ -333,25 +333,25 @@ apr_uint32_t apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with, #if !defined(APR_OVERRIDE_ATOMIC_XCHG32) #if defined(APR_OVERRIDE_ATOMIC_CAS32) -apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) +fspr_uint32_t fspr_atomic_xchg32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t prev; + fspr_uint32_t prev; do { prev = *mem; - } while (apr_atomic_cas32(mem, val, prev) != prev); + } while (fspr_atomic_cas32(mem, val, prev) != prev); return prev; } #else -apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) +fspr_uint32_t fspr_atomic_xchg32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { - apr_uint32_t prev; + fspr_uint32_t prev; #if APR_HAS_THREADS - apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; + fspr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; - CHECK(apr_thread_mutex_lock(lock)); + CHECK(fspr_thread_mutex_lock(lock)); prev = *mem; *mem = val; - CHECK(apr_thread_mutex_unlock(lock)); + CHECK(fspr_thread_mutex_unlock(lock)); #else prev = *mem; *mem = val; @@ -362,18 +362,18 @@ apr_uint32_t apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) #endif /* !defined(APR_OVERRIDE_ATOMIC_XCHG32) */ #if !defined(APR_OVERRIDE_ATOMIC_CASPTR) -void *apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) +void *fspr_atomic_casptr(volatile void **mem, void *with, const void *cmp) { void *prev; #if APR_HAS_THREADS - apr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; + fspr_thread_mutex_t *lock = hash_mutex[ATOMIC_HASH(mem)]; - CHECK(apr_thread_mutex_lock(lock)); + CHECK(fspr_thread_mutex_lock(lock)); prev = *(void **)mem; if (prev == cmp) { *mem = with; } - CHECK(apr_thread_mutex_unlock(lock)); + CHECK(fspr_thread_mutex_unlock(lock)); #else prev = *(void **)mem; if (prev == cmp) { @@ -385,7 +385,7 @@ void *apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) #endif /* !defined(APR_OVERRIDE_ATOMIC_CASPTR) */ #if !defined(APR_OVERRIDE_ATOMIC_READ32) -APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) +APR_DECLARE(fspr_uint32_t) fspr_atomic_read32(volatile fspr_uint32_t *mem) { return *mem; } diff --git a/libs/apr/atomic/win32/apr_atomic.c b/libs/apr/atomic/win32/fspr_atomic.c similarity index 56% rename from libs/apr/atomic/win32/apr_atomic.c rename to libs/apr/atomic/win32/fspr_atomic.c index 18a7bcd0ba..e9cfc0558a 100644 --- a/libs/apr/atomic/win32/apr_atomic.c +++ b/libs/apr/atomic/win32/fspr_atomic.c @@ -14,59 +14,59 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_atomic.h" -#include "apr_thread_mutex.h" +#include "fspr.h" +#include "fspr_atomic.h" +#include "fspr_thread_mutex.h" -APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_atomic_init(fspr_pool_t *p) { return APR_SUCCESS; } /* - * Remapping function pointer type to accept apr_uint32_t's type-safely - * as the arguments for as our apr_atomic_foo32 Functions + * Remapping function pointer type to accept fspr_uint32_t's type-safely + * as the arguments for as our fspr_atomic_foo32 Functions */ #if (_MSC_VER < 1800) -typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_fn) - (apr_uint32_t volatile *); -typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_fn) - (apr_uint32_t volatile *, - apr_uint32_t); -typedef WINBASEAPI apr_uint32_t (WINAPI * apr_atomic_win32_ptr_val_val_fn) - (apr_uint32_t volatile *, - apr_uint32_t, apr_uint32_t); -typedef WINBASEAPI void * (WINAPI * apr_atomic_win32_ptr_ptr_ptr_fn) +typedef WINBASEAPI fspr_uint32_t (WINAPI * fspr_atomic_win32_ptr_fn) + (fspr_uint32_t volatile *); +typedef WINBASEAPI fspr_uint32_t (WINAPI * fspr_atomic_win32_ptr_val_fn) + (fspr_uint32_t volatile *, + fspr_uint32_t); +typedef WINBASEAPI fspr_uint32_t (WINAPI * fspr_atomic_win32_ptr_val_val_fn) + (fspr_uint32_t volatile *, + fspr_uint32_t, fspr_uint32_t); +typedef WINBASEAPI void * (WINAPI * fspr_atomic_win32_ptr_ptr_ptr_fn) (volatile void **, void *, const void *); #endif -APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(fspr_uint32_t) fspr_atomic_add32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { #if (defined(_M_IA64) || defined(_M_AMD64)) return InterlockedExchangeAdd(mem, val); #elif (_MSC_VER >= 1800) return InterlockedExchangeAdd(mem, val); #else - return ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val); + return ((fspr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, val); #endif } /* Of course we want the 2's compliment of the unsigned value, val */ #pragma warning(disable: 4146) -APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(void) fspr_atomic_sub32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { #if (defined(_M_IA64) || defined(_M_AMD64)) InterlockedExchangeAdd(mem, -val); #elif (_MSC_VER >= 1800) InterlockedExchangeAdd(mem, -val); #else - ((apr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val); + ((fspr_atomic_win32_ptr_val_fn)InterlockedExchangeAdd)(mem, -val); #endif } -APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem) +APR_DECLARE(fspr_uint32_t) fspr_atomic_inc32(volatile fspr_uint32_t *mem) { /* we return old value, win32 returns new value :( */ #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) @@ -74,50 +74,50 @@ APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem) #elif (_MSC_VER >= 1800) return InterlockedIncrement(mem) - 1; #else - return ((apr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1; + return ((fspr_atomic_win32_ptr_fn)InterlockedIncrement)(mem) - 1; #endif } -APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem) +APR_DECLARE(int) fspr_atomic_dec32(volatile fspr_uint32_t *mem) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedDecrement(mem); #elif (_MSC_VER >= 1800) return InterlockedDecrement(mem); #else - return ((apr_atomic_win32_ptr_fn)InterlockedDecrement)(mem); + return ((fspr_atomic_win32_ptr_fn)InterlockedDecrement)(mem); #endif } -APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(void) fspr_atomic_set32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) InterlockedExchange(mem, val); #elif (_MSC_VER >= 1800) InterlockedExchange(mem, val); #else - ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val); + ((fspr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val); #endif } -APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem) +APR_DECLARE(fspr_uint32_t) fspr_atomic_read32(volatile fspr_uint32_t *mem) { return *mem; } -APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with, - apr_uint32_t cmp) +APR_DECLARE(fspr_uint32_t) fspr_atomic_cas32(volatile fspr_uint32_t *mem, fspr_uint32_t with, + fspr_uint32_t cmp) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedCompareExchange(mem, with, cmp); #elif (_MSC_VER >= 1800) return InterlockedCompareExchange(mem, with, cmp); #else - return ((apr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp); + return ((fspr_atomic_win32_ptr_val_val_fn)InterlockedCompareExchange)(mem, with, cmp); #endif } -APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp) +APR_DECLARE(void *) fspr_atomic_casptr(volatile void **mem, void *with, const void *cmp) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedCompareExchangePointer(mem, with, cmp); @@ -125,17 +125,17 @@ APR_DECLARE(void *) apr_atomic_casptr(volatile void **mem, void *with, const voi return InterlockedCompareExchangePointer(mem, with, cmp); #else /* Too many VC6 users have stale win32 API files, stub this */ - return ((apr_atomic_win32_ptr_ptr_ptr_fn)InterlockedCompareExchange)(mem, with, cmp); + return ((fspr_atomic_win32_ptr_ptr_ptr_fn)InterlockedCompareExchange)(mem, with, cmp); #endif } -APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val) +APR_DECLARE(fspr_uint32_t) fspr_atomic_xchg32(volatile fspr_uint32_t *mem, fspr_uint32_t val) { #if (defined(_M_IA64) || defined(_M_AMD64)) && !defined(RC_INVOKED) return InterlockedExchange(mem, val); #elif (_MSC_VER >= 1800) return InterlockedExchange(mem, val); #else - return ((apr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val); + return ((fspr_atomic_win32_ptr_val_fn)InterlockedExchange)(mem, val); #endif } diff --git a/libs/apr/build-outputs.mk b/libs/apr/build-outputs.mk index 2c127688d1..d3e68a8bea 100644 --- a/libs/apr/build-outputs.mk +++ b/libs/apr/build-outputs.mk @@ -1,83 +1,83 @@ # DO NOT EDIT. AUTOMATICALLY GENERATED. -passwd/apr_getpass.lo: passwd/apr_getpass.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h -strings/apr_cpystrn.lo: strings/apr_cpystrn.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h -strings/apr_strnatcmp.lo: strings/apr_strnatcmp.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h -strings/apr_strings.lo: strings/apr_strings.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h -strings/apr_strtok.lo: strings/apr_strtok.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_pools.h -strings/apr_fnmatch.lo: strings/apr_fnmatch.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_fnmatch.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h -strings/apr_snprintf.lo: strings/apr_snprintf.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -tables/apr_tables.lo: tables/apr_tables.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h include/apr_tables.h -tables/apr_hash.lo: tables/apr_hash.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_thread_mutex.h include/apr_hash.h include/apr_pools.h +passwd/fspr_getpass.lo: passwd/fspr_getpass.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_pools.h +strings/fspr_cpystrn.lo: strings/fspr_cpystrn.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_pools.h +strings/fspr_strnatcmp.lo: strings/fspr_strnatcmp.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_pools.h +strings/fspr_strings.lo: strings/fspr_strings.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_pools.h +strings/fspr_strtok.lo: strings/fspr_strtok.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_pools.h +strings/fspr_fnmatch.lo: strings/fspr_fnmatch.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_file_info.h include/fspr_user.h include/fspr_fnmatch.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +strings/fspr_snprintf.lo: strings/fspr_snprintf.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +tables/fspr_tables.lo: tables/fspr_tables.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_pools.h include/fspr_tables.h +tables/fspr_hash.lo: tables/fspr_hash.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_hash.h include/fspr_pools.h -OBJECTS_all = passwd/apr_getpass.lo strings/apr_cpystrn.lo strings/apr_strnatcmp.lo strings/apr_strings.lo strings/apr_strtok.lo strings/apr_fnmatch.lo strings/apr_snprintf.lo tables/apr_tables.lo tables/apr_hash.lo +OBJECTS_all = passwd/fspr_getpass.lo strings/fspr_cpystrn.lo strings/fspr_strnatcmp.lo strings/fspr_strings.lo strings/fspr_strtok.lo strings/fspr_fnmatch.lo strings/fspr_snprintf.lo tables/fspr_tables.lo tables/fspr_hash.lo -atomic/unix/apr_atomic.lo: atomic/unix/apr_atomic.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_thread_mutex.h include/apr_atomic.h include/apr_pools.h +atomic/unix/fspr_atomic.lo: atomic/unix/fspr_atomic.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_atomic.h include/fspr_pools.h -OBJECTS_atomic_unix = atomic/unix/apr_atomic.lo +OBJECTS_atomic_unix = atomic/unix/fspr_atomic.lo -dso/unix/dso.lo: dso/unix/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +dso/unix/dso.lo: dso/unix/dso.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_dso_unix = dso/unix/dso.lo file_io/unix/flock.lo: file_io/unix/flock.c .make.dirs -file_io/unix/readwrite.lo: file_io/unix/readwrite.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_network_io.h include/apr_general.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_time.h include/apr_pools.h -file_io/unix/filepath_util.lo: file_io/unix/filepath_util.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_pools.h include/apr_tables.h +file_io/unix/readwrite.lo: file_io/unix/readwrite.c .make.dirs include/fspr_support.h include/fspr_allocator.h include/fspr_network_io.h include/fspr_general.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_time.h include/fspr_pools.h +file_io/unix/filepath_util.lo: file_io/unix/filepath_util.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_pools.h include/fspr_tables.h file_io/unix/seek.lo: file_io/unix/seek.c .make.dirs -file_io/unix/dir.lo: file_io/unix/dir.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -file_io/unix/mktemp.lo: file_io/unix/mktemp.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -file_io/unix/filedup.lo: file_io/unix/filedup.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -file_io/unix/tempdir.lo: file_io/unix/tempdir.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_env.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_inherit.h include/apr_time.h include/apr_pools.h include/apr_tables.h -file_io/unix/filepath.lo: file_io/unix/filepath.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h -file_io/unix/pipe.lo: file_io/unix/pipe.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -file_io/unix/open.lo: file_io/unix/open.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_hash.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -file_io/unix/filestat.lo: file_io/unix/filestat.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h -file_io/unix/copy.lo: file_io/unix/copy.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h -file_io/unix/fileacc.lo: file_io/unix/fileacc.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h -file_io/unix/fullrw.lo: file_io/unix/fullrw.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h +file_io/unix/dir.lo: file_io/unix/dir.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +file_io/unix/mktemp.lo: file_io/unix/mktemp.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +file_io/unix/filedup.lo: file_io/unix/filedup.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +file_io/unix/tempdir.lo: file_io/unix/tempdir.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_env.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_inherit.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +file_io/unix/filepath.lo: file_io/unix/filepath.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_inherit.h include/fspr_thread_mutex.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +file_io/unix/pipe.lo: file_io/unix/pipe.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +file_io/unix/open.lo: file_io/unix/open.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_hash.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +file_io/unix/filestat.lo: file_io/unix/filestat.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_inherit.h include/fspr_thread_mutex.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +file_io/unix/copy.lo: file_io/unix/copy.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +file_io/unix/fileacc.lo: file_io/unix/fileacc.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_errno.h include/fspr_want.h include/fspr_pools.h include/fspr_strings.h +file_io/unix/fullrw.lo: file_io/unix/fullrw.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h OBJECTS_file_io_unix = file_io/unix/flock.lo file_io/unix/readwrite.lo file_io/unix/filepath_util.lo file_io/unix/seek.lo file_io/unix/dir.lo file_io/unix/mktemp.lo file_io/unix/filedup.lo file_io/unix/tempdir.lo file_io/unix/filepath.lo file_io/unix/pipe.lo file_io/unix/open.lo file_io/unix/filestat.lo file_io/unix/copy.lo file_io/unix/fileacc.lo file_io/unix/fullrw.lo locks/unix/thread_rwlock.lo: locks/unix/thread_rwlock.c .make.dirs -locks/unix/thread_mutex.lo: locks/unix/thread_mutex.c .make.dirs include/apr_want.h +locks/unix/thread_mutex.lo: locks/unix/thread_mutex.c .make.dirs include/fspr_want.h locks/unix/thread_cond.lo: locks/unix/thread_cond.c .make.dirs -locks/unix/proc_mutex.lo: locks/unix/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h -locks/unix/global_mutex.lo: locks/unix/global_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +locks/unix/proc_mutex.lo: locks/unix/proc_mutex.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_errno.h include/fspr_want.h include/fspr_pools.h include/fspr_strings.h +locks/unix/global_mutex.lo: locks/unix/global_mutex.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_locks_unix = locks/unix/thread_rwlock.lo locks/unix/thread_mutex.lo locks/unix/thread_cond.lo locks/unix/proc_mutex.lo locks/unix/global_mutex.lo -memory/unix/apr_pools.lo: memory/unix/apr_pools.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_env.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_atomic.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_hash.h include/apr_lib.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +memory/unix/fspr_pools.lo: memory/unix/fspr_pools.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_env.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_atomic.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_inherit.h include/fspr_hash.h include/fspr_lib.h include/fspr_proc_mutex.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h -OBJECTS_memory_unix = memory/unix/apr_pools.lo +OBJECTS_memory_unix = memory/unix/fspr_pools.lo -misc/unix/charset.lo: misc/unix/charset.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -misc/unix/env.lo: misc/unix/env.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_env.h include/apr_thread_mutex.h include/apr_pools.h -misc/unix/version.lo: misc/unix/version.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_version.h include/apr_thread_mutex.h include/apr_pools.h -misc/unix/rand.lo: misc/unix/rand.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_thread_mutex.h include/apr_pools.h -misc/unix/start.lo: misc/unix/start.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_signal.h include/apr_want.h include/apr_thread_mutex.h include/apr_atomic.h include/apr_pools.h -misc/unix/errorcodes.lo: misc/unix/errorcodes.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_dso.h include/apr_pools.h -misc/unix/getopt.lo: misc/unix/getopt.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h +misc/unix/charset.lo: misc/unix/charset.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +misc/unix/env.lo: misc/unix/env.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_env.h include/fspr_thread_mutex.h include/fspr_pools.h +misc/unix/version.lo: misc/unix/version.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_version.h include/fspr_thread_mutex.h include/fspr_pools.h +misc/unix/rand.lo: misc/unix/rand.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_pools.h +misc/unix/start.lo: misc/unix/start.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_signal.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_atomic.h include/fspr_pools.h +misc/unix/errorcodes.lo: misc/unix/errorcodes.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_dso.h include/fspr_pools.h +misc/unix/getopt.lo: misc/unix/getopt.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_pools.h misc/unix/otherchild.lo: misc/unix/otherchild.c .make.dirs OBJECTS_misc_unix = misc/unix/charset.lo misc/unix/env.lo misc/unix/version.lo misc/unix/rand.lo misc/unix/start.lo misc/unix/errorcodes.lo misc/unix/getopt.lo misc/unix/otherchild.lo -mmap/unix/mmap.lo: mmap/unix/mmap.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_ring.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h include/apr_mmap.h -mmap/unix/common.lo: mmap/unix/common.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_ring.h include/apr_tables.h include/apr_time.h include/apr_pools.h include/apr_mmap.h +mmap/unix/mmap.lo: mmap/unix/mmap.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_shm.h include/fspr_ring.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h include/fspr_mmap.h +mmap/unix/common.lo: mmap/unix/common.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_ring.h include/fspr_tables.h include/fspr_time.h include/fspr_pools.h include/fspr_mmap.h OBJECTS_mmap_unix = mmap/unix/mmap.lo mmap/unix/common.lo -network_io/unix/sockaddr.lo: network_io/unix/sockaddr.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h -network_io/unix/sockopt.lo: network_io/unix/sockopt.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h -network_io/unix/sendrecv.lo: network_io/unix/sendrecv.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_user.h include/apr_network_io.h include/apr_general.h include/apr_inherit.h include/apr_file_info.h include/apr_errno.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h -network_io/unix/multicast.lo: network_io/unix/multicast.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_general.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -network_io/unix/sockets.lo: network_io/unix/sockets.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_general.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -network_io/unix/inet_ntop.lo: network_io/unix/inet_ntop.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h +network_io/unix/sockaddr.lo: network_io/unix/sockaddr.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_pools.h +network_io/unix/sockopt.lo: network_io/unix/sockopt.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_errno.h include/fspr_want.h include/fspr_pools.h include/fspr_strings.h +network_io/unix/sendrecv.lo: network_io/unix/sendrecv.c .make.dirs include/fspr_support.h include/fspr_allocator.h include/fspr_user.h include/fspr_network_io.h include/fspr_general.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_errno.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +network_io/unix/multicast.lo: network_io/unix/multicast.c .make.dirs include/fspr_support.h include/fspr_allocator.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_proc_mutex.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +network_io/unix/sockets.lo: network_io/unix/sockets.c .make.dirs include/fspr_support.h include/fspr_allocator.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +network_io/unix/inet_ntop.lo: network_io/unix/inet_ntop.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_errno.h include/fspr_want.h include/fspr_pools.h include/fspr_strings.h network_io/unix/inet_pton.lo: network_io/unix/inet_pton.c .make.dirs OBJECTS_network_io_unix = network_io/unix/sockaddr.lo network_io/unix/sockopt.lo network_io/unix/sendrecv.lo network_io/unix/multicast.lo network_io/unix/sockets.lo network_io/unix/inet_ntop.lo network_io/unix/inet_pton.lo poll/unix/epoll.lo: poll/unix/epoll.c .make.dirs -poll/unix/select.lo: poll/unix/select.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_poll.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +poll/unix/select.lo: poll/unix/select.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_poll.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h poll/unix/poll.lo: poll/unix/poll.c .make.dirs poll/unix/port.lo: poll/unix/port.c .make.dirs poll/unix/kqueue.lo: poll/unix/kqueue.c .make.dirs @@ -85,147 +85,147 @@ poll/unix/kqueue.lo: poll/unix/kqueue.c .make.dirs OBJECTS_poll_unix = poll/unix/epoll.lo poll/unix/select.lo poll/unix/poll.lo poll/unix/port.lo poll/unix/kqueue.lo random/unix/sha2.lo: random/unix/sha2.c .make.dirs -random/unix/apr_random.lo: random/unix/apr_random.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_random.h include/apr_thread_proc.h include/apr_time.h include/apr_pools.h include/apr_tables.h -random/unix/sha2_glue.lo: random/unix/sha2_glue.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_thread_mutex.h include/apr_random.h include/apr_pools.h +random/unix/fspr_random.lo: random/unix/fspr_random.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_random.h include/fspr_thread_proc.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +random/unix/sha2_glue.lo: random/unix/sha2_glue.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_random.h include/fspr_pools.h -OBJECTS_random_unix = random/unix/sha2.lo random/unix/apr_random.lo random/unix/sha2_glue.lo +OBJECTS_random_unix = random/unix/sha2.lo random/unix/fspr_random.lo random/unix/sha2_glue.lo -shmem/unix/shm.lo: shmem/unix/shm.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_strings.h include/apr_thread_mutex.h include/apr_pools.h +shmem/unix/shm.lo: shmem/unix/shm.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_pools.h OBJECTS_shmem_unix = shmem/unix/shm.lo -support/unix/waitio.lo: support/unix/waitio.c .make.dirs include/apr_support.h include/apr_allocator.h include/apr_network_io.h include/apr_general.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_poll.h include/apr_time.h include/apr_pools.h +support/unix/waitio.lo: support/unix/waitio.c .make.dirs include/fspr_support.h include/fspr_allocator.h include/fspr_network_io.h include/fspr_general.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_poll.h include/fspr_time.h include/fspr_pools.h OBJECTS_support_unix = support/unix/waitio.lo threadproc/unix/procsup.lo: threadproc/unix/procsup.c .make.dirs -threadproc/unix/thread.lo: threadproc/unix/thread.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -threadproc/unix/signals.lo: threadproc/unix/signals.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_signal.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_pools.h -threadproc/unix/proc.lo: threadproc/unix/proc.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_signal.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_proc_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_random.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -threadproc/unix/threadpriv.lo: threadproc/unix/threadpriv.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +threadproc/unix/thread.lo: threadproc/unix/thread.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +threadproc/unix/signals.lo: threadproc/unix/signals.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_signal.h include/fspr_strings.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_pools.h +threadproc/unix/proc.lo: threadproc/unix/proc.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_signal.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_proc_mutex.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_inherit.h include/fspr_random.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +threadproc/unix/threadpriv.lo: threadproc/unix/threadpriv.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_threadproc_unix = threadproc/unix/procsup.lo threadproc/unix/thread.lo threadproc/unix/signals.lo threadproc/unix/proc.lo threadproc/unix/threadpriv.lo -time/unix/time.lo: time/unix/time.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -time/unix/timestr.lo: time/unix/timestr.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +time/unix/time.lo: time/unix/time.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +time/unix/timestr.lo: time/unix/timestr.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_time_unix = time/unix/time.lo time/unix/timestr.lo -user/unix/userinfo.lo: user/unix/userinfo.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -user/unix/groupinfo.lo: user/unix/groupinfo.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +user/unix/userinfo.lo: user/unix/userinfo.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +user/unix/groupinfo.lo: user/unix/groupinfo.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_user_unix = user/unix/userinfo.lo user/unix/groupinfo.lo OBJECTS_unix = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_unix) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix) -dso/aix/dso.lo: dso/aix/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +dso/aix/dso.lo: dso/aix/dso.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_dso_aix = dso/aix/dso.lo OBJECTS_aix = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_aix) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix) -dso/beos/dso.lo: dso/beos/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +dso/beos/dso.lo: dso/beos/dso.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_dso_beos = dso/beos/dso.lo -locks/beos/thread_rwlock.lo: locks/beos/thread_rwlock.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -locks/beos/thread_mutex.lo: locks/beos/thread_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -locks/beos/thread_cond.lo: locks/beos/thread_cond.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -locks/beos/proc_mutex.lo: locks/beos/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +locks/beos/thread_rwlock.lo: locks/beos/thread_rwlock.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +locks/beos/thread_mutex.lo: locks/beos/thread_mutex.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +locks/beos/thread_cond.lo: locks/beos/thread_cond.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +locks/beos/proc_mutex.lo: locks/beos/proc_mutex.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_locks_beos = locks/beos/thread_rwlock.lo locks/beos/thread_mutex.lo locks/beos/thread_cond.lo locks/beos/proc_mutex.lo network_io/beos/socketcommon.lo: network_io/beos/socketcommon.c .make.dirs -network_io/beos/sendrecv.lo: network_io/beos/sendrecv.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_time.h include/apr_pools.h +network_io/beos/sendrecv.lo: network_io/beos/sendrecv.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_errno.h include/fspr_want.h include/fspr_time.h include/fspr_pools.h OBJECTS_network_io_beos = network_io/beos/socketcommon.lo network_io/beos/sendrecv.lo -shmem/beos/shm.lo: shmem/beos/shm.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +shmem/beos/shm.lo: shmem/beos/shm.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_shmem_beos = shmem/beos/shm.lo -threadproc/beos/apr_proc_stub.lo: threadproc/beos/apr_proc_stub.c .make.dirs -threadproc/beos/thread.lo: threadproc/beos/thread.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -threadproc/beos/proc.lo: threadproc/beos/proc.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_pools.h include/apr_strings.h +threadproc/beos/fspr_proc_stub.lo: threadproc/beos/fspr_proc_stub.c .make.dirs +threadproc/beos/thread.lo: threadproc/beos/thread.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +threadproc/beos/proc.lo: threadproc/beos/proc.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_errno.h include/fspr_want.h include/fspr_pools.h include/fspr_strings.h threadproc/beos/threadpriv.lo: threadproc/beos/threadpriv.c .make.dirs threadproc/beos/threadproc_common.lo: threadproc/beos/threadproc_common.c .make.dirs -OBJECTS_threadproc_beos = threadproc/beos/apr_proc_stub.lo threadproc/beos/thread.lo threadproc/beos/proc.lo threadproc/beos/threadpriv.lo threadproc/beos/threadproc_common.lo +OBJECTS_threadproc_beos = threadproc/beos/fspr_proc_stub.lo threadproc/beos/thread.lo threadproc/beos/proc.lo threadproc/beos/threadpriv.lo threadproc/beos/threadproc_common.lo OBJECTS_beos = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_beos) $(OBJECTS_file_io_unix) $(OBJECTS_locks_beos) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_beos) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_beos) $(OBJECTS_support_unix) $(OBJECTS_threadproc_beos) $(OBJECTS_time_unix) $(OBJECTS_user_unix) -dso/os2/dso.lo: dso/os2/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +dso/os2/dso.lo: dso/os2/dso.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_dso_os2 = dso/os2/dso.lo -file_io/os2/dir_make_recurse.lo: file_io/os2/dir_make_recurse.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h -file_io/os2/filesys.lo: file_io/os2/filesys.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_want.h include/apr_strings.h include/apr_thread_mutex.h include/apr_lib.h include/apr_pools.h +file_io/os2/dir_make_recurse.lo: file_io/os2/dir_make_recurse.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +file_io/os2/filesys.lo: file_io/os2/filesys.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_want.h include/fspr_strings.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_pools.h file_io/os2/flock.lo: file_io/os2/flock.c .make.dirs -file_io/os2/readwrite.lo: file_io/os2/readwrite.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h +file_io/os2/readwrite.lo: file_io/os2/readwrite.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h file_io/os2/filepath_util.lo: file_io/os2/filepath_util.c .make.dirs -file_io/os2/seek.lo: file_io/os2/seek.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h -file_io/os2/dir.lo: file_io/os2/dir.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_proc_mutex.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +file_io/os2/seek.lo: file_io/os2/seek.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +file_io/os2/dir.lo: file_io/os2/dir.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_proc_mutex.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h file_io/os2/mktemp.lo: file_io/os2/mktemp.c .make.dirs -file_io/os2/filedup.lo: file_io/os2/filedup.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h +file_io/os2/filedup.lo: file_io/os2/filedup.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h file_io/os2/tempdir.lo: file_io/os2/tempdir.c .make.dirs -file_io/os2/maperrorcode.lo: file_io/os2/maperrorcode.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_time.h include/apr_pools.h include/apr_tables.h +file_io/os2/maperrorcode.lo: file_io/os2/maperrorcode.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h file_io/os2/filepath.lo: file_io/os2/filepath.c .make.dirs -file_io/os2/pipe.lo: file_io/os2/pipe.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -file_io/os2/open.lo: file_io/os2/open.c .make.dirs include/apr_allocator.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_shm.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_dso.h include/apr_proc_mutex.h include/apr_lib.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -file_io/os2/filestat.lo: file_io/os2/filestat.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_want.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h +file_io/os2/pipe.lo: file_io/os2/pipe.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +file_io/os2/open.lo: file_io/os2/open.c .make.dirs include/fspr_allocator.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_shm.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_dso.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +file_io/os2/filestat.lo: file_io/os2/filestat.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h file_io/os2/copy.lo: file_io/os2/copy.c .make.dirs file_io/os2/fileacc.lo: file_io/os2/fileacc.c .make.dirs file_io/os2/fullrw.lo: file_io/os2/fullrw.c .make.dirs OBJECTS_file_io_os2 = file_io/os2/dir_make_recurse.lo file_io/os2/filesys.lo file_io/os2/flock.lo file_io/os2/readwrite.lo file_io/os2/filepath_util.lo file_io/os2/seek.lo file_io/os2/dir.lo file_io/os2/mktemp.lo file_io/os2/filedup.lo file_io/os2/tempdir.lo file_io/os2/maperrorcode.lo file_io/os2/filepath.lo file_io/os2/pipe.lo file_io/os2/open.lo file_io/os2/filestat.lo file_io/os2/copy.lo file_io/os2/fileacc.lo file_io/os2/fullrw.lo -locks/os2/thread_rwlock.lo: locks/os2/thread_rwlock.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -locks/os2/thread_mutex.lo: locks/os2/thread_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -locks/os2/thread_cond.lo: locks/os2/thread_cond.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -locks/os2/proc_mutex.lo: locks/os2/proc_mutex.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +locks/os2/thread_rwlock.lo: locks/os2/thread_rwlock.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +locks/os2/thread_mutex.lo: locks/os2/thread_mutex.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +locks/os2/thread_cond.lo: locks/os2/thread_cond.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +locks/os2/proc_mutex.lo: locks/os2/proc_mutex.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_locks_os2 = locks/os2/thread_rwlock.lo locks/os2/thread_mutex.lo locks/os2/thread_cond.lo locks/os2/proc_mutex.lo network_io/os2/sockaddr.lo: network_io/os2/sockaddr.c .make.dirs -network_io/os2/sockopt.lo: network_io/os2/sockopt.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h -network_io/os2/sendrecv_udp.lo: network_io/os2/sendrecv_udp.c .make.dirs include/apr_support.h include/apr_general.h include/apr_network_io.h include/apr_inherit.h include/apr_file_info.h include/apr_allocator.h include/apr_thread_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_lib.h include/apr_time.h include/apr_pools.h -network_io/os2/sendrecv.lo: network_io/os2/sendrecv.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_errno.h include/apr_want.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_inherit.h include/apr_thread_mutex.h include/apr_lib.h include/apr_time.h include/apr_pools.h include/apr_tables.h -network_io/os2/os2calls.lo: network_io/os2/os2calls.c .make.dirs include/apr_allocator.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_shm.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_dso.h include/apr_proc_mutex.h include/apr_lib.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -network_io/os2/sockets.lo: network_io/os2/sockets.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +network_io/os2/sockopt.lo: network_io/os2/sockopt.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_errno.h include/fspr_want.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_inherit.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +network_io/os2/sendrecv_udp.lo: network_io/os2/sendrecv_udp.c .make.dirs include/fspr_support.h include/fspr_general.h include/fspr_network_io.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_allocator.h include/fspr_thread_mutex.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h +network_io/os2/sendrecv.lo: network_io/os2/sendrecv.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_errno.h include/fspr_want.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_inherit.h include/fspr_thread_mutex.h include/fspr_lib.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +network_io/os2/os2calls.lo: network_io/os2/os2calls.c .make.dirs include/fspr_allocator.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_shm.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_dso.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +network_io/os2/sockets.lo: network_io/os2/sockets.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h network_io/os2/inet_ntop.lo: network_io/os2/inet_ntop.c .make.dirs network_io/os2/inet_pton.lo: network_io/os2/inet_pton.c .make.dirs OBJECTS_network_io_os2 = network_io/os2/sockaddr.lo network_io/os2/sockopt.lo network_io/os2/sendrecv_udp.lo network_io/os2/sendrecv.lo network_io/os2/os2calls.lo network_io/os2/sockets.lo network_io/os2/inet_ntop.lo network_io/os2/inet_pton.lo -poll/os2/pollset.lo: poll/os2/pollset.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_poll.h include/apr_time.h include/apr_pools.h include/apr_tables.h -poll/os2/poll.lo: poll/os2/poll.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_errno.h include/apr_inherit.h include/apr_file_info.h include/apr_user.h include/apr_file_io.h include/apr_want.h include/apr_thread_mutex.h include/apr_poll.h include/apr_time.h include/apr_pools.h include/apr_tables.h +poll/os2/pollset.lo: poll/os2/pollset.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_poll.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h +poll/os2/poll.lo: poll/os2/poll.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_errno.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_user.h include/fspr_file_io.h include/fspr_want.h include/fspr_thread_mutex.h include/fspr_poll.h include/fspr_time.h include/fspr_pools.h include/fspr_tables.h OBJECTS_poll_os2 = poll/os2/pollset.lo poll/os2/poll.lo -shmem/os2/shm.lo: shmem/os2/shm.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +shmem/os2/shm.lo: shmem/os2/shm.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_shmem_os2 = shmem/os2/shm.lo -threadproc/os2/thread.lo: threadproc/os2/thread.c .make.dirs include/apr_allocator.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_shm.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_dso.h include/apr_proc_mutex.h include/apr_lib.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +threadproc/os2/thread.lo: threadproc/os2/thread.c .make.dirs include/fspr_allocator.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_shm.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_dso.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h threadproc/os2/signals.lo: threadproc/os2/signals.c .make.dirs -threadproc/os2/proc.lo: threadproc/os2/proc.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_signal.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_proc_mutex.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_inherit.h include/apr_lib.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h -threadproc/os2/threadpriv.lo: threadproc/os2/threadpriv.c .make.dirs include/apr_allocator.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_shm.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_dso.h include/apr_proc_mutex.h include/apr_lib.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +threadproc/os2/proc.lo: threadproc/os2/proc.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_signal.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_proc_mutex.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_inherit.h include/fspr_lib.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h +threadproc/os2/threadpriv.lo: threadproc/os2/threadpriv.c .make.dirs include/fspr_allocator.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_shm.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_dso.h include/fspr_proc_mutex.h include/fspr_lib.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_threadproc_os2 = threadproc/os2/thread.lo threadproc/os2/signals.lo threadproc/os2/proc.lo threadproc/os2/threadpriv.lo OBJECTS_os2 = $(OBJECTS_all) $(OBJECTS_atomic_unix) $(OBJECTS_dso_os2) $(OBJECTS_file_io_os2) $(OBJECTS_locks_os2) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_os2) $(OBJECTS_poll_os2) $(OBJECTS_random_unix) $(OBJECTS_shmem_os2) $(OBJECTS_support_unix) $(OBJECTS_threadproc_os2) $(OBJECTS_time_unix) $(OBJECTS_user_unix) -atomic/os390/atomic.lo: atomic/os390/atomic.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_thread_mutex.h include/apr_errno.h include/apr_want.h include/apr_atomic.h include/apr_pools.h +atomic/os390/atomic.lo: atomic/os390/atomic.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_thread_mutex.h include/fspr_errno.h include/fspr_want.h include/fspr_atomic.h include/fspr_pools.h OBJECTS_atomic_os390 = atomic/os390/atomic.lo -dso/os390/dso.lo: dso/os390/dso.c .make.dirs include/apr_allocator.h include/apr_general.h include/apr_network_io.h include/apr_portable.h include/apr_inherit.h include/apr_file_info.h include/apr_thread_mutex.h include/apr_thread_proc.h include/apr_dso.h include/apr_tables.h include/apr_errno.h include/apr_want.h include/apr_user.h include/apr_file_io.h include/apr_strings.h include/apr_proc_mutex.h include/apr_shm.h include/apr_global_mutex.h include/apr_time.h include/apr_pools.h +dso/os390/dso.lo: dso/os390/dso.c .make.dirs include/fspr_allocator.h include/fspr_general.h include/fspr_network_io.h include/fspr_portable.h include/fspr_inherit.h include/fspr_file_info.h include/fspr_thread_mutex.h include/fspr_thread_proc.h include/fspr_dso.h include/fspr_tables.h include/fspr_errno.h include/fspr_want.h include/fspr_user.h include/fspr_file_io.h include/fspr_strings.h include/fspr_proc_mutex.h include/fspr_shm.h include/fspr_global_mutex.h include/fspr_time.h include/fspr_pools.h OBJECTS_dso_os390 = dso/os390/dso.lo OBJECTS_os390 = $(OBJECTS_all) $(OBJECTS_atomic_os390) $(OBJECTS_dso_os390) $(OBJECTS_file_io_unix) $(OBJECTS_locks_unix) $(OBJECTS_memory_unix) $(OBJECTS_misc_unix) $(OBJECTS_mmap_unix) $(OBJECTS_network_io_unix) $(OBJECTS_poll_unix) $(OBJECTS_random_unix) $(OBJECTS_shmem_unix) $(OBJECTS_support_unix) $(OBJECTS_threadproc_unix) $(OBJECTS_time_unix) $(OBJECTS_user_unix) -HEADERS = $(top_srcdir)/include/apr_thread_mutex.h $(top_srcdir)/include/apr_env.h $(top_srcdir)/include/apr_poll.h $(top_srcdir)/include/apr_fnmatch.h $(top_srcdir)/include/apr_global_mutex.h $(top_srcdir)/include/apr_pools.h $(top_srcdir)/include/apr_want.h $(top_srcdir)/include/apr_file_io.h $(top_srcdir)/include/apr_version.h $(top_srcdir)/include/apr_mmap.h $(top_srcdir)/include/apr_dso.h $(top_srcdir)/include/apr_thread_proc.h $(top_srcdir)/include/apr_errno.h $(top_srcdir)/include/apr_shm.h $(top_srcdir)/include/apr_network_io.h $(top_srcdir)/include/apr_signal.h $(top_srcdir)/include/apr_user.h $(top_srcdir)/include/apr_support.h $(top_srcdir)/include/apr_atomic.h $(top_srcdir)/include/apr_random.h $(top_srcdir)/include/apr_thread_cond.h $(top_srcdir)/include/apr_thread_rwlock.h $(top_srcdir)/include/apr_getopt.h $(top_srcdir)/include/apr_inherit.h $(top_srcdir)/include/apr_strings.h $(top_srcdir)/include/apr_general.h $(top_srcdir)/include/apr_proc_mutex.h $(top_srcdir)/include/apr_tables.h $(top_srcdir)/include/apr_ring.h $(top_srcdir)/include/apr_file_info.h $(top_srcdir)/include/apr_allocator.h $(top_srcdir)/include/apr_portable.h $(top_srcdir)/include/apr_hash.h $(top_srcdir)/include/apr_time.h $(top_srcdir)/include/apr_lib.h +HEADERS = $(top_srcdir)/include/fspr_thread_mutex.h $(top_srcdir)/include/fspr_env.h $(top_srcdir)/include/fspr_poll.h $(top_srcdir)/include/fspr_fnmatch.h $(top_srcdir)/include/fspr_global_mutex.h $(top_srcdir)/include/fspr_pools.h $(top_srcdir)/include/fspr_want.h $(top_srcdir)/include/fspr_file_io.h $(top_srcdir)/include/fspr_version.h $(top_srcdir)/include/fspr_mmap.h $(top_srcdir)/include/fspr_dso.h $(top_srcdir)/include/fspr_thread_proc.h $(top_srcdir)/include/fspr_errno.h $(top_srcdir)/include/fspr_shm.h $(top_srcdir)/include/fspr_network_io.h $(top_srcdir)/include/fspr_signal.h $(top_srcdir)/include/fspr_user.h $(top_srcdir)/include/fspr_support.h $(top_srcdir)/include/fspr_atomic.h $(top_srcdir)/include/fspr_random.h $(top_srcdir)/include/fspr_thread_cond.h $(top_srcdir)/include/fspr_thread_rwlock.h $(top_srcdir)/include/fspr_getopt.h $(top_srcdir)/include/fspr_inherit.h $(top_srcdir)/include/fspr_strings.h $(top_srcdir)/include/fspr_general.h $(top_srcdir)/include/fspr_proc_mutex.h $(top_srcdir)/include/fspr_tables.h $(top_srcdir)/include/fspr_ring.h $(top_srcdir)/include/fspr_file_info.h $(top_srcdir)/include/fspr_allocator.h $(top_srcdir)/include/fspr_portable.h $(top_srcdir)/include/fspr_hash.h $(top_srcdir)/include/fspr_time.h $(top_srcdir)/include/fspr_lib.h SOURCE_DIRS = random/unix dso/os2 time/unix locks/unix user/unix locks/beos tables support/unix file_io/unix mmap/unix atomic/unix poll/os2 dso/os390 atomic/os390 dso/beos poll/unix passwd network_io/beos threadproc/os2 network_io/os2 threadproc/beos shmem/unix network_io/unix file_io/os2 dso/aix threadproc/unix misc/unix shmem/beos dso/unix locks/os2 shmem/os2 memory/unix strings $(EXTRA_SOURCE_DIRS) diff --git a/libs/apr/build/NWGNUenvironment.inc b/libs/apr/build/NWGNUenvironment.inc index fd54b487c9..53039ba962 100644 --- a/libs/apr/build/NWGNUenvironment.inc +++ b/libs/apr/build/NWGNUenvironment.inc @@ -164,9 +164,9 @@ ifeq "$(RELEASE)" "optimized" CFLAGS += -O4,p endif -# -prefix apr_arch_pre_nw.h #include pre_nw.h for all files +# -prefix fspr_arch_pre_nw.h #include pre_nw.h for all files -CFLAGS += -prefix apr_arch_pre_nw.h +CFLAGS += -prefix fspr_arch_pre_nw.h PATH:=$(PATH);$(METROWERKS)\bin;$(METROWERKS)\Other Metrowerks Tools\Command Line Tools diff --git a/libs/apr/build/NWGNUmakefile b/libs/apr/build/NWGNUmakefile index 6f9b32dd04..a9aac49fcd 100644 --- a/libs/apr/build/NWGNUmakefile +++ b/libs/apr/build/NWGNUmakefile @@ -16,10 +16,10 @@ include $(APR_WORK)\build\NWGNUhead.inc # build this level's files FILES_prebuild_headers = \ - $(APR)/include/apr.h \ + $(APR)/include/fspr.h \ $(APRUTIL)/include/apu.h \ $(APRUTIL)/include/apu_want.h \ - $(APRUTIL)/include/apr_ldap.h \ + $(APRUTIL)/include/fspr_ldap.h \ $(APRUTIL)/include/private/apu_config.h \ $(APRUTIL)/include/private/apu_select_dbm.h \ $(APRUTIL)/xml/expat/lib/expat.h \ @@ -83,9 +83,9 @@ clean :: $(CHK) nw_export.i $(DEL) nw_export.i $(CHK) $(NLM_NAME)_cc.opt $(DEL) $(NLM_NAME)_cc.opt $(CHK) NWGNUversion.inc $(DEL) NWGNUversion.inc - $(CHK) $(subst /,\,$(APR))\include\apr.h $(DEL) $(subst /,\,$(APR))\include\apr.h + $(CHK) $(subst /,\,$(APR))\include\fspr.h $(DEL) $(subst /,\,$(APR))\include\fspr.h $(CHK) $(subst /,\,$(APRUTIL))\include\apu.h $(DEL) $(subst /,\,$(APRUTIL))\include\apu.h - $(CHK) $(subst /,\,$(APRUTIL))\include\apr_ldap.h $(DEL) $(subst /,\,$(APRUTIL))\include\apr_ldap.h + $(CHK) $(subst /,\,$(APRUTIL))\include\fspr_ldap.h $(DEL) $(subst /,\,$(APRUTIL))\include\fspr_ldap.h $(CHK) $(subst /,\,$(APRUTIL))\include\private\apu_config.h $(DEL) $(subst /,\,$(APRUTIL))\include\private\apu_config.h $(CHK) $(subst /,\,$(APRUTIL))\include\private\apu_select_dbm.h $(DEL) $(subst /,\,$(APRUTIL))\include\private\apu_select_dbm.h $(CHK) $(subst /,\,$(APRUTIL))\xml\expat\lib\expat.h $(DEL) $(subst /,\,$(APRUTIL))\xml\expat\lib\expat.h diff --git a/libs/apr/build/NWGNUtail.inc b/libs/apr/build/NWGNUtail.inc index 641c091b24..2c3ccf36f9 100644 --- a/libs/apr/build/NWGNUtail.inc +++ b/libs/apr/build/NWGNUtail.inc @@ -88,9 +88,9 @@ endif # Generic compiler rules # -$(APR_WORK)\build\NWGNUversion.inc : $(APR_WORK)\include\apr_version.h $(APR_WORK)\build\nw_ver.awk +$(APR_WORK)\build\NWGNUversion.inc : $(APR_WORK)\include\fspr_version.h $(APR_WORK)\build\nw_ver.awk @echo Generating $(subst /,\,$@) - awk -f $(APR_WORK)\build\nw_ver.awk $(APR_WORK)\include\apr_version.h > $(APR_WORK)\build\NWGNUversion.inc + awk -f $(APR_WORK)\build\nw_ver.awk $(APR_WORK)\include\fspr_version.h > $(APR_WORK)\build\NWGNUversion.inc -include $(APR_WORK)\build\NWGNUversion.inc diff --git a/libs/apr/build/apr_app.dsp b/libs/apr/build/apr_app.dsp index ac060a503f..55c84e3c48 100644 --- a/libs/apr/build/apr_app.dsp +++ b/libs/apr/build/apr_app.dsp @@ -83,7 +83,7 @@ LIB32=link.exe -lib # Name "apr_app - Win32 Debug" # Begin Source File -SOURCE=..\misc\win32\apr_app.c +SOURCE=..\misc\win32\fspr_app.c # End Source File # End Target # End Project diff --git a/libs/apr/build/apr_common.m4 b/libs/apr/build/apr_common.m4 index e8e9f51f08..13d6be60dd 100644 --- a/libs/apr/build/apr_common.m4 +++ b/libs/apr/build/apr_common.m4 @@ -338,7 +338,7 @@ AC_DEFUN([APR_CHECK_APR_DEFINE],[ apr_old_cppflags=$CPPFLAGS CPPFLAGS="$CPPFLAGS $INCLUDES" AC_EGREP_CPP(YES_IS_DEFINED, [ -#include +#include #if $1 YES_IS_DEFINED #endif @@ -403,7 +403,7 @@ ac_decision='' AC_DEFUN([APR_DECIDE],[dnl -dnl Define the flag (or not) in apr_private.h via autoheader +dnl Define the flag (or not) in fspr_private.h via autoheader AH_TEMPLATE($1, [Define if $2 will be used]) ac_decision='$1' ac_decision_msg='$2' diff --git a/libs/apr/build/find_apr.m4 b/libs/apr/build/find_apr.m4 index 048cb7bfc8..1060965d8d 100644 --- a/libs/apr/build/find_apr.m4 +++ b/libs/apr/build/find_apr.m4 @@ -143,7 +143,7 @@ AC_DEFUN([APR_FIND_APR], [ if test "$apr_found" = "no" && test -d "$1"; then apr_temp_abs_srcdir="`cd $1 && pwd`" apr_found="reconfig" - apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/apr_version.h\"`" + apr_bundled_major="`sed -n '/#define.*APR_MAJOR_VERSION/s/^[^0-9]*\([0-9]*\).*$/\1/p' \"$1/include/fspr_version.h\"`" case $apr_bundled_major in "") AC_MSG_ERROR([failed to find major version of bundled APR]) diff --git a/libs/apr/build/libapr_app.dsp b/libs/apr/build/libapr_app.dsp index 0cd962e5cd..875dade39f 100644 --- a/libs/apr/build/libapr_app.dsp +++ b/libs/apr/build/libapr_app.dsp @@ -83,7 +83,7 @@ LIB32=link.exe -lib # Name "libapr_app - Win32 Debug" # Begin Source File -SOURCE=..\misc\win32\apr_app.c +SOURCE=..\misc\win32\fspr_app.c # End Source File # Begin Source File diff --git a/libs/apr/build/make_exports.awk b/libs/apr/build/make_exports.awk index 1d12fc65ab..bd417e2a44 100644 --- a/libs/apr/build/make_exports.awk +++ b/libs/apr/build/make_exports.awk @@ -100,21 +100,21 @@ function add_symbol(symbol) { /^[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(][^)]*[)]/ { sub("[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(]", "", $0) sub("[)].*$", "", $0) - add_symbol("apr_" $0 "_pool_get") + add_symbol("fspr_" $0 "_pool_get") next } /^[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(][^)]*[)]/ { sub("[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(]", "", $0) sub("[)].*$", "", $0) - add_symbol("apr_" $0 "_inherit_set") + add_symbol("fspr_" $0 "_inherit_set") next } /^[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(][^)]*[)]/ { sub("[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(]", "", $0) sub("[)].*$", "", $0) - add_symbol("apr_" $0 "_inherit_unset") + add_symbol("fspr_" $0 "_inherit_unset") next } diff --git a/libs/apr/build/make_nw_export.awk b/libs/apr/build/make_nw_export.awk index 291ecc0b2c..21cc683157 100644 --- a/libs/apr/build/make_nw_export.awk +++ b/libs/apr/build/make_nw_export.awk @@ -6,8 +6,8 @@ BEGIN { } # List of functions that we don't support, yet?? -#/apr_##name##_set_inherit/{next} -#/apr_##name##_unset_inherit/{next} +#/fspr_##name##_set_inherit/{next} +#/fspr_##name##_unset_inherit/{next} function add_symbol (sym_name) { @@ -47,21 +47,21 @@ function add_symbol (sym_name) { /^[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(][^)]*[)]/ { sub("[ \t]*APR_POOL_DECLARE_ACCESSOR[^(]*[(]", "", $0) sub("[)].*$", "", $0) - add_symbol("apr_" $0 "_pool_get") + add_symbol("fspr_" $0 "_pool_get") next } /^[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(][^)]*[)]/ { sub("[ \t]*APR_DECLARE_INHERIT_SET[^(]*[(]", "", $0) sub("[)].*$", "", $0) - add_symbol("apr_" $0 "_inherit_set") + add_symbol("fspr_" $0 "_inherit_set") next } /^[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(][^)]*[)]/ { sub("[ \t]*APR_DECLARE_INHERIT_UNSET[^(]*[(]", "", $0) sub("[)].*$", "", $0) - add_symbol("apr_" $0 "_inherit_unset") + add_symbol("fspr_" $0 "_inherit_unset") next } diff --git a/libs/apr/build/nw_export.inc b/libs/apr/build/nw_export.inc index 58495cd075..d9f3208d6a 100644 --- a/libs/apr/build/nw_export.inc +++ b/libs/apr/build/nw_export.inc @@ -1,7 +1,7 @@ /* Must include apr.h first so that we can undefine the standard prototypes macros after it messes with them. */ -#include "apr.h" +#include "fspr.h" #undef APR_DECLARE #undef APR_DECLARE_NONSTD @@ -10,41 +10,41 @@ #undef APR_DECLARE_DATA /* Preprocess all of the standard APR headers. */ -#include "apr_allocator.h" -#include "apr_atomic.h" -#include "apr_dso.h" -#include "apr_env.h" -#include "apr_errno.h" -#include "apr_file_info.h" -#include "apr_file_io.h" -#include "apr_fnmatch.h" -#include "apr_general.h" -#include "apr_getopt.h" -#include "apr_global_mutex.h" -#include "apr_hash.h" -#include "apr_inherit.h" -#include "apr_lib.h" -#include "apr_mmap.h" -#include "apr_network_io.h" -#include "apr_poll.h" -#include "apr_pools.h" -#include "apr_portable.h" -#include "apr_proc_mutex.h" -#include "apr_ring.h" -#include "apr_random.h" -#include "apr_shm.h" -#include "apr_signal.h" -#include "apr_strings.h" -#include "apr_support.h" -#include "apr_tables.h" -#include "apr_thread_cond.h" -#include "apr_thread_mutex.h" -#include "apr_thread_proc.h" -#include "apr_thread_rwlock.h" -#include "apr_time.h" -#include "apr_user.h" -#include "apr_version.h" -#include "apr_want.h" +#include "fspr_allocator.h" +#include "fspr_atomic.h" +#include "fspr_dso.h" +#include "fspr_env.h" +#include "fspr_errno.h" +#include "fspr_file_info.h" +#include "fspr_file_io.h" +#include "fspr_fnmatch.h" +#include "fspr_general.h" +#include "fspr_getopt.h" +#include "fspr_global_mutex.h" +#include "fspr_hash.h" +#include "fspr_inherit.h" +#include "fspr_lib.h" +#include "fspr_mmap.h" +#include "fspr_network_io.h" +#include "fspr_poll.h" +#include "fspr_pools.h" +#include "fspr_portable.h" +#include "fspr_proc_mutex.h" +#include "fspr_ring.h" +#include "fspr_random.h" +#include "fspr_shm.h" +#include "fspr_signal.h" +#include "fspr_strings.h" +#include "fspr_support.h" +#include "fspr_tables.h" +#include "fspr_thread_cond.h" +#include "fspr_thread_mutex.h" +#include "fspr_thread_proc.h" +#include "fspr_thread_rwlock.h" +#include "fspr_time.h" +#include "fspr_user.h" +#include "fspr_version.h" +#include "fspr_want.h" /* Must include apu.h first so that we can undefine @@ -57,29 +57,29 @@ #undef APU_DECLARE_DATA /* Preprocess all of the standard APR headers. */ -#include "apr_anylock.h" -#include "apr_base64.h" -#include "apr_buckets.h" -#include "apr_date.h" -#include "apr_dbd.h" -#include "apr_dbm.h" -#include "apr_hooks.h" -#include "apr_ldap.h" -#include "apr_ldap_url.h" -#include "apr_md4.h" -#include "apr_md5.h" -#include "apr_optional.h" -#include "apr_optional_hooks.h" -#include "apr_queue.h" -#include "apr_reslist.h" -#include "apr_rmm.h" -#include "apr_sdbm.h" -#include "apr_sha1.h" -#include "apr_strmatch.h" -#include "apr_uri.h" -#include "apr_uuid.h" -#include "apr_xlate.h" -#include "apr_xml.h" +#include "fspr_anylock.h" +#include "fspr_base64.h" +#include "fspr_buckets.h" +#include "fspr_date.h" +#include "fspr_dbd.h" +#include "fspr_dbm.h" +#include "fspr_hooks.h" +#include "fspr_ldap.h" +#include "fspr_ldap_url.h" +#include "fspr_md4.h" +#include "fspr_md5.h" +#include "fspr_optional.h" +#include "fspr_optional_hooks.h" +#include "fspr_queue.h" +#include "fspr_reslist.h" +#include "fspr_rmm.h" +#include "fspr_sdbm.h" +#include "fspr_sha1.h" +#include "fspr_strmatch.h" +#include "fspr_uri.h" +#include "fspr_uuid.h" +#include "fspr_xlate.h" +#include "fspr_xml.h" #include "apu_version.h" #include "apu_want.h" diff --git a/libs/apr/build/prebuildNW.bat b/libs/apr/build/prebuildNW.bat index 941d920c9b..7b3f3a7b08 100755 --- a/libs/apr/build/prebuildNW.bat +++ b/libs/apr/build/prebuildNW.bat @@ -24,7 +24,7 @@ goto Done @echo # "apr-util\uri\uri_delims.h" on the build machine. @echo Fixing up the APR headers -copy ..\include\apr.hnw ..\include\apr.h +copy ..\include\fspr.hnw ..\include\fspr.h @echo Fixing up the APR-Util headers copy ..\..\apr-util\include\apu.hnw ..\..\apr-util\include\apu.h diff --git a/libs/apr/configure.ac b/libs/apr/configure.ac index 2b8f551880..b267825e09 100644 --- a/libs/apr/configure.ac +++ b/libs/apr/configure.ac @@ -7,7 +7,7 @@ dnl Use ./buildconf to prepare build files and run autoconf for APR. AC_PREREQ(2.50) AC_INIT(build/apr_common.m4) -AC_CONFIG_HEADER(include/arch/unix/apr_private.h) +AC_CONFIG_HEADER(include/arch/unix/fspr_private.h) AC_CONFIG_AUX_DIR(build) dnl @@ -24,7 +24,7 @@ CFLAGS="$CFLAGS $CONFIGURE_CFLAGS" CXXFLAGS="$CXXFLAGS $CONFIGURE_CXXFLAGS" LDFLAGS="$LDFLAGS $CONFIGURE_LDFLAGS" -dnl Hard-coded inclusion at the tail end of apr_private.h: +dnl Hard-coded inclusion at the tail end of fspr_private.h: AH_BOTTOM([ /* switch this on if we have a BeOS version below BONE */ #if BEOS && !HAVE_BONE_VERSION @@ -36,7 +36,7 @@ AH_BOTTOM([ /* * Include common private declarations. */ -#include "../apr_private_common.h" +#include "../fspr_private_common.h" ]) dnl Save user-defined environment settings for later restoration @@ -95,7 +95,7 @@ APR_MKDIR_P_CHECK($apr_builders/mkdir.sh) # get our version information get_version="$apr_builders/get-version.sh" -version_hdr="$apr_srcdir/include/apr_version.h" +version_hdr="$apr_srcdir/include/fspr_version.h" APR_MAJOR_VERSION="`$get_version major $version_hdr APR`" APR_DOTTED_VERSION="`$get_version all $version_hdr APR`" @@ -1169,7 +1169,7 @@ fi if test "$ac_cv_sizeof_int" = "4"; then int_value=int fi -# Now we need to find what apr_int64_t (sizeof == 8) will be. +# Now we need to find what fspr_int64_t (sizeof == 8) will be. # The first match is our preference. if test "$ac_cv_sizeof_int" = "8"; then int64_literal='#define APR_INT64_C(val) (val)' @@ -1243,12 +1243,12 @@ fi if test "$ac_cv_type_size_t" = "yes"; then size_t_value="size_t" else - size_t_value="apr_int32_t" + size_t_value="fspr_int32_t" fi if test "$ac_cv_type_ssize_t" = "yes"; then ssize_t_value="ssize_t" else - ssize_t_value="apr_int32_t" + ssize_t_value="fspr_int32_t" fi if test "$ac_cv_socklen_t" = "yes"; then socklen_t_value="socklen_t" @@ -1298,17 +1298,17 @@ else aprlfs=0 fi -AC_MSG_CHECKING([which type to use for apr_off_t]) +AC_MSG_CHECKING([which type to use for fspr_off_t]) if test "${ac_cv_sizeof_off_t}${apr_cv_use_lfs64}" = "4yes"; then # LFS is go! off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT' off_t_value='off64_t' - off_t_strfn='apr_strtoi64' + off_t_strfn='fspr_strtoi64' elif test "${ac_cv_sizeof_off_t}x${ac_cv_sizeof_long}" = "4x4"; then # Special case: off_t may change size with _FILE_OFFSET_BITS # on 32-bit systems with LFS support. To avoid compatibility # issues when other packages do define _FILE_OFFSET_BITS, - # hard-code apr_off_t to long. + # hard-code fspr_off_t to long. off_t_value=long off_t_fmt='#define APR_OFF_T_FMT "ld"' off_t_strfn='strtol' @@ -1324,13 +1324,13 @@ elif test "$ac_cv_type_off_t" = "yes"; then off_t_strfn='strtoi' elif test "$ac_cv_sizeof_off_t" = "$ac_cv_sizeof_long_long"; then off_t_fmt='#define APR_OFF_T_FMT APR_INT64_T_FMT' - off_t_strfn='apr_strtoi64' + off_t_strfn='fspr_strtoi64' else AC_ERROR([could not determine the size of off_t]) fi else # Fallback on int - off_t_value=apr_int32_t + off_t_value=fspr_int32_t off_t_fmt=d off_t_strfn='strtoi' fi @@ -1440,7 +1440,7 @@ fi if test "$have_int64_strfn" = "1"; then AC_DEFINE_UNQUOTED(APR_INT64_STRFN, [$int64_strfn], - [Define as function which can be used for conversion of strings to apr_int64_t]) + [Define as function which can be used for conversion of strings to fspr_int64_t]) fi AC_SUBST(have_strnicmp) @@ -1451,11 +1451,11 @@ AC_SUBST(have_strdup) AC_SUBST(have_strstr) AC_SUBST(have_memchr) -if test "$off_t_strfn" = "apr_strtoi64" && test "$have_int64_strfn" = "1"; then +if test "$off_t_strfn" = "fspr_strtoi64" && test "$have_int64_strfn" = "1"; then off_t_strfn=$int64_strfn fi AC_DEFINE_UNQUOTED(APR_OFF_T_STRFN, [$off_t_strfn], - [Define as function used for conversion of strings to apr_off_t]) + [Define as function used for conversion of strings to fspr_off_t]) dnl ----------------------------- Checking for DSO support echo "${nl}Checking for DSO..." @@ -1949,7 +1949,7 @@ AC_SUBST(file_as_socket) if test "$ac_cv_func_poll $file_as_socket" = "yes 1"; then AC_DEFINE(WAITIO_USES_POLL, 1, - [Define if apr_wait_for_io_or_timeout() uses poll(2)]) + [Define if fspr_wait_for_io_or_timeout() uses poll(2)]) fi # Check the types only if we have gethostbyname_r @@ -2135,7 +2135,7 @@ AC_SUBST(INCLUDE_RULES) AC_SUBST(INCLUDE_OUTPUTS) AC_CONFIG_FILES([Makefile - include/apr.h + include/fspr.h build/apr_rules.mk build/pkg/pkginfo apr-$APR_MAJOR_VERSION-config:apr-config.in @@ -2163,7 +2163,7 @@ dnl This section is expanded by configure UNQUOTED so variable dnl references must be backslash-escaped as necessary. # Commands run at the beginning of config.status: -APR_SAVE_HEADERS="include/apr.h include/arch/unix/apr_private.h" +APR_SAVE_HEADERS="include/fspr.h include/arch/unix/fspr_private.h" APR_MAJOR_VERSION=$APR_MAJOR_VERSION for apri in \${APR_SAVE_HEADERS}; do diff --git a/libs/apr/docs/APRDesign.html b/libs/apr/docs/APRDesign.html index 7d1caeb8d4..d4f6de2d3b 100644 --- a/libs/apr/docs/APRDesign.html +++ b/libs/apr/docs/APRDesign.html @@ -22,10 +22,10 @@ code to the effort.

APR On Windows and Netware

APR on Windows and Netware is different from APR on all other systems, -because those platforms don't use autoconf. On Unix, apr_private.h (private to +because those platforms don't use autoconf. On Unix, fspr_private.h (private to APR) and apr.h (public, used by applications that use APR) are generated by autoconf from acconfig.h and apr.h.in respectively. On Windows (and Netware), -apr_private.h and apr.h are created from apr_private.hw (apr_private.hwn) +fspr_private.h and apr.h are created from fspr_private.hw (fspr_private.hwn) and apr.hw (apr.hwn) respectively.

@@ -34,7 +34,7 @@ and apr.hw (apr.hwn) respectively.

these additions as well. A general rule of thumb, is that if it is a feature macro, such as APR_HAS_THREADS, Windows and Netware need it. In other words, if the definition is going to be used in a public APR - header file, such as apr_general.h, Windows needs it. + header file, such as fspr_general.h, Windows needs it. The only time it is safe to add a macro or test without also adding the macro to apr*.h[n]w, is if the macro tells APR how to build. For @@ -161,7 +161,7 @@ implemented one way. For example, time is a complete type because there is only one reasonable time implementation.
  • The second exception to the incomplete type rule can be found in -apr_portable.h. This file defines the native types for each platform. +fspr_portable.h. This file defines the native types for each platform. Using these types, it is possible to extract native types for any APR type.

    @@ -171,14 +171,14 @@ in file_io/unix/fileio.h:

         struct ap_file_t {
    -        apr_pool_t *cntxt;
    +        fspr_pool_t *cntxt;
             int filedes;
             FILE *filehand;
             ...
         }
     
    -

    In include/apr_file_io.h:

    +

    In include/fspr_file_io.h:

    typedef struct ap_file_t ap_file_t; @@ -187,7 +187,7 @@ in file_io/unix/fileio.h:

    field in this structure. Windows does not have a filedes field, so obviously, it is important that programs not be able to access these.

    -

    You may notice the apr_pool_t field. Most APR types have this field. This +

    You may notice the fspr_pool_t field. Most APR types have this field. This type is used to allocate memory within APR. Because every APR type has a pool, any APR function can allocate memory if it needs to. This is very important and it is one of the reasons that APR works. If you create a new type, you @@ -281,15 +281,15 @@ the error code indicates an error condition or a status codition.

    If your function has multiple return codes that all indicate success, but with different results, or if your function can only return PASS/FAIL, you -should still return an apr_status_t. In the first case, define one +should still return an fspr_status_t. In the first case, define one APR status code for each return value, an example of this is -apr_proc_wait, which can only return APR_CHILDDONE, +fspr_proc_wait, which can only return APR_CHILDDONE, APR_CHILDNOTDONE, or an error code. In the second case, please return APR_SUCCESS for PASS, and define a new APR status code for failure, an -example of this is apr_compare_users, which can only return +example of this is fspr_compare_users, which can only return APR_SUCCESS, APR_EMISMATCH, or an error code.

    -

    All of these definitions can be found in apr_errno.h for all platforms. When +

    All of these definitions can be found in fspr_errno.h for all platforms. When an error occurs in an APR function, the function must return an error code. If the error occurred in a system call and that system call uses errno to report an error, then the code is returned unchanged. For example:

    @@ -320,7 +320,7 @@ case. We'll get to how this problem is solved in a little while.

    If the error occurs in an APR function but it is not due to a system call, but it is actually an APR error or just a status code from APR, then the -appropriate code should be returned. These codes are defined in apr_errno.h +appropriate code should be returned. These codes are defined in fspr_errno.h and should be self explanatory.

    No APR code should ever return a code between APR_OS_START_USEERR and diff --git a/libs/apr/docs/canonical_filenames.html b/libs/apr/docs/canonical_filenames.html index 10867d3796..f1abad5bd8 100644 --- a/libs/apr/docs/canonical_filenames.html +++ b/libs/apr/docs/canonical_filenames.html @@ -88,7 +88,7 @@ system objects.

    Canonical API

    -Functions to manipulate the apr_canon_file_t (an opaque type) include: +Functions to manipulate the fspr_canon_file_t (an opaque type) include:
    • Create canon_file_t (from char* path and canon_file_t parent path) @@ -99,7 +99,7 @@ Functions to manipulate the apr_canon_file_t (an opaque type) include:

    The path is corrected to the file system case only if is in absolute -form. The apr_canon_file_t should be preserved as long as possible and +form. The fspr_canon_file_t should be preserved as long as possible and used as the parent to create child entries to reduce the number of expensive stat and case canonicalization calls to the OS.

    diff --git a/libs/apr/docs/doxygen.conf b/libs/apr/docs/doxygen.conf index 29c2cbf694..76adb8646a 100644 --- a/libs/apr/docs/doxygen.conf +++ b/libs/apr/docs/doxygen.conf @@ -14,9 +14,9 @@ EXPAND_ONLY_PREDEF=YES PREDEFINED="APR_DECLARE(x)=x" \ "APR_DECLARE_NONSTD(x)=x" \ "APR_DECLARE_DATA" \ - "APR_POOL_DECLARE_ACCESSOR(x)=apr_pool_t* apr_##x##_pool_get (const apr_##x##_t *the##x)" \ - "APR_DECLARE_INHERIT_SET(x)=apr_status_t apr_##x##_inherit_set(apr_##x##_t *the##x)" \ - "APR_DECLARE_INHERIT_UNSET(x)=apr_status_t apr_##x##_inherit_unset(apr_##x##_t *the##x)" \ + "APR_POOL_DECLARE_ACCESSOR(x)=fspr_pool_t* fspr_##x##_pool_get (const fspr_##x##_t *the##x)" \ + "APR_DECLARE_INHERIT_SET(x)=fspr_status_t fspr_##x##_inherit_set(fspr_##x##_t *the##x)" \ + "APR_DECLARE_INHERIT_UNSET(x)=fspr_status_t fspr_##x##_inherit_unset(fspr_##x##_t *the##x)" \ "APR_HAS_THREADS" \ "__attribute__(x)=" \ DOXYGEN= diff --git a/libs/apr/docs/non_apr_programs b/libs/apr/docs/non_apr_programs index 5003a8bd55..4595f0e83a 100644 --- a/libs/apr/docs/non_apr_programs +++ b/libs/apr/docs/non_apr_programs @@ -6,7 +6,7 @@ we don't expect them to migrate to using APR just because APR has been released. So, we have provided a way for non-APR'ized programs to interact very cleanly with APR. -There are a set of functions, all documented in apr_portable.h, which allow +There are a set of functions, all documented in fspr_portable.h, which allow a programmer to either get a native type from an APR type, or to setup an APR type from a native type. @@ -15,11 +15,11 @@ APR for file I/O, but you (in your infinite wisdom) want to use APR to make sure your section is portable. Assume the program provides a type foo_t with a file descriptor in it (fd). -void function_using_apr(foo_t non_apr_struct, ap_pool_t *p) +void function_using_apr(foo_t non_fspr_struct, ap_pool_t *p) { - ap_file_t *apr_file = NULL; + ap_file_t *fspr_file = NULL; - ap_put_os_file(&apr_file, &non_apr_struct->fd, p); + ap_put_os_file(&fspr_file, &non_fspr_struct->fd, p); ... } @@ -28,20 +28,20 @@ There are portable functions for each APR incomplete type. They are all called ap_put_os_foobar(), and they each take the same basic arguments, a pointer to a pointer to the incomplete type (the last pointer in that list should be NULL), a pointer to the native type, and a pool. Each of these can -be found in apr_portable.h. +be found in fspr_portable.h. If you have to do the exact opposite (take an APR type and convert it to a native type, there are functions for that too. For example: -void function_not_using_apr(apr_file_t *apr_file) +void function_not_using_apr(fspr_file_t *fspr_file) { int unix_file_desc; - ap_get_os_file(&unix_file_desc, apr_file); + ap_get_os_file(&unix_file_desc, fspr_file); ... } For each ap_put_os_foobar, there is a corresponding ap_get_os_file. These are -also documented in apr_portable.h. +also documented in fspr_portable.h. diff --git a/libs/apr/docs/pool-design.html b/libs/apr/docs/pool-design.html index 6ce6d81e6a..462afaa9c1 100644 --- a/libs/apr/docs/pool-design.html +++ b/libs/apr/docs/pool-design.html @@ -60,13 +60,13 @@

    -subpool = apr_create_subpool(pool);
    +subpool = fspr_create_subpool(pool);
     for (i = 0; i < n; ++i) {
    -  apr_pool_clear(subpool);
    +  fspr_pool_clear(subpool);
     
       do_operation(..., subpool);
     }
    -apr_pool_destroy(subpool);
    +fspr_pool_destroy(subpool);

    This pattern prevents the 'pool' from growing unbounded and diff --git a/libs/apr/docs/win32_builds.html b/libs/apr/docs/win32_builds.html index ad57d8e138..664769fbaf 100644 --- a/libs/apr/docs/win32_builds.html +++ b/libs/apr/docs/win32_builds.html @@ -43,7 +43,7 @@ link with the /pdbtype:sept flag! At the time your application links to an APR library, the corresponding _src.pdb file should exist in the original path the library was built, or it may be sufficient to keep the _src.pdb file - in the same path as the library file. (E.g. apr.lib and apr_src.pdb should + in the same path as the library file. (E.g. apr.lib and fspr_src.pdb should reside together in your lib directory.) The later option is unconfirmed.

    In order to keep the symbols compiled into the static library, your application diff --git a/libs/apr/dso/aix/dso.c b/libs/apr/dso/aix/dso.c index 25f6262af8..f3449d38da 100644 --- a/libs/apr/dso/aix/dso.c +++ b/libs/apr/dso/aix/dso.c @@ -49,8 +49,8 @@ #include #include #include -#include "apr_arch_dso.h" -#include "apr_portable.h" +#include "fspr_arch_dso.h" +#include "fspr_portable.h" #if APR_HAS_DSO @@ -97,26 +97,26 @@ struct dl_info { * add the basic "wrappers" here. */ -APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso, - apr_os_dso_handle_t osdso, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_put(fspr_dso_handle_t **aprdso, + fspr_os_dso_handle_t osdso, + fspr_pool_t *pool) { - *aprdso = apr_pcalloc(pool, sizeof **aprdso); + *aprdso = fspr_pcalloc(pool, sizeof **aprdso); (*aprdso)->handle = osdso; (*aprdso)->pool = pool; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso, - apr_dso_handle_t *aprdso) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_get(fspr_os_dso_handle_t *osdso, + fspr_dso_handle_t *aprdso) { *osdso = aprdso->handle; return APR_SUCCESS; } -static apr_status_t dso_cleanup(void *thedso) +static fspr_status_t dso_cleanup(void *thedso) { - apr_dso_handle_t *dso = thedso; + fspr_dso_handle_t *dso = thedso; if (dso->handle != NULL && dlclose(dso->handle) != 0) return APR_EINIT; @@ -125,12 +125,12 @@ static apr_status_t dso_cleanup(void *thedso) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, - const char *path, apr_pool_t *ctx) +APR_DECLARE(fspr_status_t) fspr_dso_load(fspr_dso_handle_t **res_handle, + const char *path, fspr_pool_t *ctx) { void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL); - *res_handle = apr_pcalloc(ctx, sizeof(*res_handle)); + *res_handle = fspr_pcalloc(ctx, sizeof(*res_handle)); if(os_handle == NULL) { (*res_handle)->errormsg = dlerror(); @@ -141,18 +141,18 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, (*res_handle)->pool = ctx; (*res_handle)->errormsg = NULL; - apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(fspr_status_t) fspr_dso_unload(fspr_dso_handle_t *handle) { - return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup); + return fspr_pool_cleanup_run(handle->pool, handle, dso_cleanup); } -APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, +APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym, + fspr_dso_handle_t *handle, const char *symname) { void *retval = dlsym(handle->handle, symname); @@ -166,10 +166,10 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, return APR_SUCCESS; } -APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) +APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *dso, char *buffer, fspr_size_t buflen) { if (dso->errormsg) { - apr_cpystrn(buffer, dso->errormsg, buflen); + fspr_cpystrn(buffer, dso->errormsg, buflen); return dso->errormsg; } return "No Error"; diff --git a/libs/apr/dso/beos/dso.c b/libs/apr/dso/beos/dso.c index 91dd1b4e81..6ca214e865 100644 --- a/libs/apr/dso/beos/dso.c +++ b/libs/apr/dso/beos/dso.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_arch_dso.h" -#include "apr_portable.h" +#include "fspr_arch_dso.h" +#include "fspr_portable.h" #if APR_HAS_DSO -static apr_status_t dso_cleanup(void *thedso) +static fspr_status_t dso_cleanup(void *thedso) { - apr_dso_handle_t *dso = thedso; + fspr_dso_handle_t *dso = thedso; if (dso->handle > 0 && unload_add_on(dso->handle) < B_NO_ERROR) return APR_EINIT; @@ -30,12 +30,12 @@ static apr_status_t dso_cleanup(void *thedso) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, - const char *path, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dso_load(fspr_dso_handle_t **res_handle, + const char *path, fspr_pool_t *pool) { image_id newid = -1; - *res_handle = apr_pcalloc(pool, sizeof(*res_handle)); + *res_handle = fspr_pcalloc(pool, sizeof(*res_handle)); if((newid = load_add_on(path)) < B_NO_ERROR) { (*res_handle)->errormsg = strerror(newid); @@ -45,17 +45,17 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, (*res_handle)->pool = pool; (*res_handle)->handle = newid; - apr_pool_cleanup_register(pool, *res_handle, dso_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *res_handle, dso_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(fspr_status_t) fspr_dso_unload(fspr_dso_handle_t *handle) { - return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup); + return fspr_pool_cleanup_run(handle->pool, handle, dso_cleanup); } -APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, apr_dso_handle_t *handle, +APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym, fspr_dso_handle_t *handle, const char *symname) { int err; @@ -72,24 +72,24 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, apr_dso_hand return APR_SUCCESS; } -APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) +APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *dso, char *buffer, fspr_size_t buflen) { strncpy(buffer, strerror(errno), buflen); return buffer; } -APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso, - apr_os_dso_handle_t osdso, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_put(fspr_dso_handle_t **aprdso, + fspr_os_dso_handle_t osdso, + fspr_pool_t *pool) { - *aprdso = apr_pcalloc(pool, sizeof **aprdso); + *aprdso = fspr_pcalloc(pool, sizeof **aprdso); (*aprdso)->handle = osdso; (*aprdso)->pool = pool; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso, - apr_dso_handle_t *aprdso) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_get(fspr_os_dso_handle_t *osdso, + fspr_dso_handle_t *aprdso) { *osdso = aprdso->handle; return APR_SUCCESS; diff --git a/libs/apr/dso/netware/dso.c b/libs/apr/dso/netware/dso.c index 4cd2ad611e..effe03eeea 100644 --- a/libs/apr/dso/netware/dso.c +++ b/libs/apr/dso/netware/dso.c @@ -14,33 +14,33 @@ * limitations under the License. */ -#include "apr_arch_dso.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_dso.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #include #include -APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso, - apr_os_dso_handle_t osdso, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_put(fspr_dso_handle_t **aprdso, + fspr_os_dso_handle_t osdso, + fspr_pool_t *pool) { - *aprdso = apr_pcalloc(pool, sizeof **aprdso); + *aprdso = fspr_pcalloc(pool, sizeof **aprdso); (*aprdso)->handle = osdso; (*aprdso)->pool = pool; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso, - apr_dso_handle_t *aprdso) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_get(fspr_os_dso_handle_t *osdso, + fspr_dso_handle_t *aprdso) { *osdso = aprdso->handle; return APR_SUCCESS; } -static apr_status_t dso_cleanup(void *thedso) +static fspr_status_t dso_cleanup(void *thedso) { - apr_dso_handle_t *dso = thedso; + fspr_dso_handle_t *dso = thedso; sym_list *symbol = NULL; void *NLMHandle = getnlmhandle(); @@ -65,22 +65,22 @@ static apr_status_t dso_cleanup(void *thedso) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, - const char *path, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dso_load(fspr_dso_handle_t **res_handle, + const char *path, fspr_pool_t *pool) { void *os_handle = NULL; char *fullpath = NULL; - apr_status_t rv; + fspr_status_t rv; - if ((rv = apr_filepath_merge(&fullpath, NULL, path, + if ((rv = fspr_filepath_merge(&fullpath, NULL, path, APR_FILEPATH_NATIVE, pool)) != APR_SUCCESS) { return rv; } os_handle = dlopen(fullpath, RTLD_NOW | RTLD_LOCAL); - *res_handle = apr_pcalloc(pool, sizeof(**res_handle)); + *res_handle = fspr_pcalloc(pool, sizeof(**res_handle)); if(os_handle == NULL) { (*res_handle)->errormsg = dlerror(); @@ -91,20 +91,20 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, (*res_handle)->pool = pool; (*res_handle)->errormsg = NULL; (*res_handle)->symbols = NULL; - (*res_handle)->path = apr_pstrdup(pool, fullpath); + (*res_handle)->path = fspr_pstrdup(pool, fullpath); - apr_pool_cleanup_register(pool, *res_handle, dso_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *res_handle, dso_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(fspr_status_t) fspr_dso_unload(fspr_dso_handle_t *handle) { - return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup); + return fspr_pool_cleanup_run(handle->pool, handle, dso_cleanup); } -APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, +APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym, + fspr_dso_handle_t *handle, const char *symname) { sym_list *symbol = NULL; @@ -115,21 +115,21 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, return APR_ESYMNOTFOUND; } - symbol = apr_pcalloc(handle->pool, sizeof(sym_list)); + symbol = fspr_pcalloc(handle->pool, sizeof(sym_list)); symbol->next = handle->symbols; handle->symbols = symbol; - symbol->symbol = apr_pstrdup(handle->pool, symname); + symbol->symbol = fspr_pstrdup(handle->pool, symname); *ressym = retval; return APR_SUCCESS; } -APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, - apr_size_t buflen) +APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *dso, char *buffer, + fspr_size_t buflen) { if (dso->errormsg) { - apr_cpystrn(buffer, dso->errormsg, buflen); + fspr_cpystrn(buffer, dso->errormsg, buflen); return dso->errormsg; } return "No Error"; diff --git a/libs/apr/dso/os2/dso.c b/libs/apr/dso/os2/dso.c index 1a7f7de838..0cc71842fb 100644 --- a/libs/apr/dso/os2/dso.c +++ b/libs/apr/dso/os2/dso.c @@ -14,17 +14,17 @@ * limitations under the License. */ -#include "apr_arch_dso.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_dso.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #include #include #if APR_HAS_DSO -static apr_status_t dso_cleanup(void *thedso) +static fspr_status_t dso_cleanup(void *thedso) { - apr_dso_handle_t *dso = thedso; + fspr_dso_handle_t *dso = thedso; int rc; if (dso->handle == 0) @@ -39,39 +39,39 @@ static apr_status_t dso_cleanup(void *thedso) } -APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, const char *path, apr_pool_t *ctx) +APR_DECLARE(fspr_status_t) fspr_dso_load(fspr_dso_handle_t **res_handle, const char *path, fspr_pool_t *ctx) { char failed_module[200]; HMODULE handle; int rc; - *res_handle = apr_pcalloc(ctx, sizeof(**res_handle)); + *res_handle = fspr_pcalloc(ctx, sizeof(**res_handle)); (*res_handle)->cont = ctx; (*res_handle)->load_error = APR_SUCCESS; (*res_handle)->failed_module = NULL; if ((rc = DosLoadModule(failed_module, sizeof(failed_module), path, &handle)) != 0) { (*res_handle)->load_error = APR_FROM_OS_ERROR(rc); - (*res_handle)->failed_module = apr_pstrdup(ctx, failed_module); + (*res_handle)->failed_module = fspr_pstrdup(ctx, failed_module); return APR_FROM_OS_ERROR(rc); } (*res_handle)->handle = handle; - apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(fspr_status_t) fspr_dso_unload(fspr_dso_handle_t *handle) { - return apr_pool_cleanup_run(handle->cont, handle, dso_cleanup); + return fspr_pool_cleanup_run(handle->cont, handle, dso_cleanup); } -APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, +APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym, + fspr_dso_handle_t *handle, const char *symname) { PFN func; @@ -91,10 +91,10 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, -APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr_size_t buflen) +APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *dso, char *buffer, fspr_size_t buflen) { char message[200]; - apr_strerror(dso->load_error, message, sizeof(message)); + fspr_strerror(dso->load_error, message, sizeof(message)); if (dso->failed_module != NULL) { strcat(message, " ("); @@ -102,17 +102,17 @@ APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, apr strcat(message, ")"); } - apr_cpystrn(buffer, message, buflen); + fspr_cpystrn(buffer, message, buflen); return buffer; } -APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso, - apr_os_dso_handle_t osdso, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_put(fspr_dso_handle_t **aprdso, + fspr_os_dso_handle_t osdso, + fspr_pool_t *pool) { - *aprdso = apr_pcalloc(pool, sizeof **aprdso); + *aprdso = fspr_pcalloc(pool, sizeof **aprdso); (*aprdso)->handle = osdso; (*aprdso)->cont = pool; (*aprdso)->load_error = APR_SUCCESS; @@ -122,8 +122,8 @@ APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso, -APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso, - apr_dso_handle_t *aprdso) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_get(fspr_os_dso_handle_t *osdso, + fspr_dso_handle_t *aprdso) { *osdso = aprdso->handle; return APR_SUCCESS; diff --git a/libs/apr/dso/os390/dso.c b/libs/apr/dso/os390/dso.c index 293d0653e7..7c7f9fb832 100644 --- a/libs/apr/dso/os390/dso.c +++ b/libs/apr/dso/os390/dso.c @@ -14,34 +14,34 @@ * limitations under the License. */ -#include "apr_portable.h" -#include "apr_strings.h" -#include "apr_arch_dso.h" +#include "fspr_portable.h" +#include "fspr_strings.h" +#include "fspr_arch_dso.h" #include #include #if APR_HAS_DSO -APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso, - apr_os_dso_handle_t osdso, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_put(fspr_dso_handle_t **aprdso, + fspr_os_dso_handle_t osdso, + fspr_pool_t *pool) { - *aprdso = apr_pcalloc(pool, sizeof **aprdso); + *aprdso = fspr_pcalloc(pool, sizeof **aprdso); (*aprdso)->handle = osdso; (*aprdso)->pool = pool; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso, - apr_dso_handle_t *aprdso) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_get(fspr_os_dso_handle_t *osdso, + fspr_dso_handle_t *aprdso) { *osdso = aprdso->handle; return APR_SUCCESS; } -static apr_status_t dso_cleanup(void *thedso) +static fspr_status_t dso_cleanup(void *thedso) { - apr_dso_handle_t *dso = thedso; + fspr_dso_handle_t *dso = thedso; int rc; if (dso->handle == 0) @@ -57,17 +57,17 @@ static apr_status_t dso_cleanup(void *thedso) return errno; } -APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, - const char *path, apr_pool_t *ctx) +APR_DECLARE(fspr_status_t) fspr_dso_load(fspr_dso_handle_t **res_handle, + const char *path, fspr_pool_t *ctx) { dllhandle *handle; int rc; - *res_handle = apr_pcalloc(ctx, sizeof(*res_handle)); + *res_handle = fspr_pcalloc(ctx, sizeof(*res_handle)); (*res_handle)->pool = ctx; if ((handle = dllload(path)) != NULL) { (*res_handle)->handle = handle; - apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } @@ -75,13 +75,13 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, return errno; } -APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(fspr_status_t) fspr_dso_unload(fspr_dso_handle_t *handle) { - return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup); + return fspr_pool_cleanup_run(handle->pool, handle, dso_cleanup); } -APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, +APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym, + fspr_dso_handle_t *handle, const char *symname) { void *func_ptr; @@ -99,10 +99,10 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, return errno; } -APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *handle, char *buffer, - apr_size_t buflen) +APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *handle, char *buffer, + fspr_size_t buflen) { - apr_cpystrn(buffer, strerror(handle->failing_errno), buflen); + fspr_cpystrn(buffer, strerror(handle->failing_errno), buflen); return buffer; } diff --git a/libs/apr/dso/unix/dso.c b/libs/apr/dso/unix/dso.c index 15d39d7d19..2e77a19bf5 100644 --- a/libs/apr/dso/unix/dso.c +++ b/libs/apr/dso/unix/dso.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr_arch_dso.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_dso.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #if APR_HAS_DSO @@ -38,26 +38,26 @@ #define DYLD_LIBRARY_HANDLE (void *)-1 #endif -APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso, - apr_os_dso_handle_t osdso, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_put(fspr_dso_handle_t **aprdso, + fspr_os_dso_handle_t osdso, + fspr_pool_t *pool) { - *aprdso = apr_pcalloc(pool, sizeof **aprdso); + *aprdso = fspr_pcalloc(pool, sizeof **aprdso); (*aprdso)->handle = osdso; (*aprdso)->pool = pool; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso, - apr_dso_handle_t *aprdso) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_get(fspr_os_dso_handle_t *osdso, + fspr_dso_handle_t *aprdso) { *osdso = aprdso->handle; return APR_SUCCESS; } -static apr_status_t dso_cleanup(void *thedso) +static fspr_status_t dso_cleanup(void *thedso) { - apr_dso_handle_t *dso = thedso; + fspr_dso_handle_t *dso = thedso; if (dso->handle == NULL) return APR_SUCCESS; @@ -77,8 +77,8 @@ static apr_status_t dso_cleanup(void *thedso) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, - const char *path, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dso_load(fspr_dso_handle_t **res_handle, + const char *path, fspr_pool_t *pool) { #if defined(DSO_USE_SHL) shl_t os_handle = shl_load(path, BIND_IMMEDIATE, 0L); @@ -140,7 +140,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, #endif #endif /* DSO_USE_x */ - *res_handle = apr_pcalloc(pool, sizeof(**res_handle)); + *res_handle = fspr_pcalloc(pool, sizeof(**res_handle)); if(os_handle == NULL) { #if defined(DSO_USE_SHL) @@ -159,18 +159,18 @@ APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, (*res_handle)->pool = pool; (*res_handle)->errormsg = NULL; - apr_pool_cleanup_register(pool, *res_handle, dso_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *res_handle, dso_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle) +APR_DECLARE(fspr_status_t) fspr_dso_unload(fspr_dso_handle_t *handle) { - return apr_pool_cleanup_run(handle->pool, handle, dso_cleanup); + return fspr_pool_cleanup_run(handle->pool, handle, dso_cleanup); } -APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, +APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym, + fspr_dso_handle_t *handle, const char *symname) { #if defined(DSO_USE_SHL) @@ -238,11 +238,11 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, #endif /* DSO_USE_x */ } -APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buffer, - apr_size_t buflen) +APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *dso, char *buffer, + fspr_size_t buflen) { if (dso->errormsg) { - apr_cpystrn(buffer, dso->errormsg, buflen); + fspr_cpystrn(buffer, dso->errormsg, buflen); return dso->errormsg; } return "No Error"; diff --git a/libs/apr/dso/win32/dso.c b/libs/apr/dso/win32/dso.c index d4a689387b..928b88344b 100644 --- a/libs/apr/dso/win32/dso.c +++ b/libs/apr/dso/win32/dso.c @@ -14,48 +14,48 @@ * limitations under the License. */ -#include "apr_arch_dso.h" -#include "apr_strings.h" -#include "apr_private.h" -#include "apr_arch_file_io.h" -#include "apr_arch_utf8.h" +#include "fspr_arch_dso.h" +#include "fspr_strings.h" +#include "fspr_private.h" +#include "fspr_arch_file_io.h" +#include "fspr_arch_utf8.h" #if APR_HAS_DSO -APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **aprdso, - apr_os_dso_handle_t osdso, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_put(fspr_dso_handle_t **aprdso, + fspr_os_dso_handle_t osdso, + fspr_pool_t *pool) { - *aprdso = apr_pcalloc(pool, sizeof **aprdso); + *aprdso = fspr_pcalloc(pool, sizeof **aprdso); (*aprdso)->handle = osdso; (*aprdso)->cont = pool; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *osdso, - apr_dso_handle_t *aprdso) +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_get(fspr_os_dso_handle_t *osdso, + fspr_dso_handle_t *aprdso) { *osdso = aprdso->handle; return APR_SUCCESS; } -static apr_status_t dso_cleanup(void *thedso) +static fspr_status_t dso_cleanup(void *thedso) { - apr_dso_handle_t *dso = thedso; + fspr_dso_handle_t *dso = thedso; if (dso->handle != NULL && !FreeLibrary(dso->handle)) { - return apr_get_os_error(); + return fspr_get_os_error(); } dso->handle = NULL; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, - const char *path, apr_pool_t *ctx) +APR_DECLARE(fspr_status_t) fspr_dso_load(struct fspr_dso_handle_t **res_handle, + const char *path, fspr_pool_t *ctx) { HINSTANCE os_handle; - apr_status_t rv; + fspr_status_t rv; #ifndef _WIN32_WCE UINT em; #endif @@ -63,11 +63,11 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wpath[APR_PATH_MAX]; + fspr_wchar_t wpath[APR_PATH_MAX]; if ((rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) + / sizeof(fspr_wchar_t), path)) != APR_SUCCESS) { - *res_handle = apr_pcalloc(ctx, sizeof(**res_handle)); + *res_handle = fspr_pcalloc(ctx, sizeof(**res_handle)); return ((*res_handle)->load_error = rv); } /* Prevent ugly popups from killing our app */ @@ -78,7 +78,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, if (!os_handle) os_handle = LoadLibraryExW(wpath, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if (!os_handle) - rv = apr_get_os_error(); + rv = fspr_get_os_error(); #ifndef _WIN32_WCE SetErrorMode(em); #endif @@ -94,7 +94,7 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, * LoadLibrary in the MS PSDK also reveals that it -explicitly- states * that backslashes must be used for the LoadLibrary family of calls. */ - apr_cpystrn(fspec, path, sizeof(fspec)); + fspr_cpystrn(fspec, path, sizeof(fspec)); while ((p = strchr(p, '/')) != NULL) *p = '\\'; @@ -104,14 +104,14 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, if (!os_handle) os_handle = LoadLibraryEx(path, NULL, 0); if (!os_handle) - rv = apr_get_os_error(); + rv = fspr_get_os_error(); else rv = APR_SUCCESS; SetErrorMode(em); } #endif - *res_handle = apr_pcalloc(ctx, sizeof(**res_handle)); + *res_handle = fspr_pcalloc(ctx, sizeof(**res_handle)); (*res_handle)->cont = ctx; if (rv) { @@ -121,27 +121,27 @@ APR_DECLARE(apr_status_t) apr_dso_load(struct apr_dso_handle_t **res_handle, (*res_handle)->handle = (void*)os_handle; (*res_handle)->load_error = APR_SUCCESS; - apr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(ctx, *res_handle, dso_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dso_unload(struct apr_dso_handle_t *handle) +APR_DECLARE(fspr_status_t) fspr_dso_unload(struct fspr_dso_handle_t *handle) { - return apr_pool_cleanup_run(handle->cont, handle, dso_cleanup); + return fspr_pool_cleanup_run(handle->cont, handle, dso_cleanup); } -APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, - struct apr_dso_handle_t *handle, +APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym, + struct fspr_dso_handle_t *handle, const char *symname) { #ifdef _WIN32_WCE - apr_size_t symlen = strlen(symname) + 1; - apr_size_t wsymlen = 256; - apr_wchar_t wsymname[256]; - apr_status_t rv; + fspr_size_t symlen = strlen(symname) + 1; + fspr_size_t wsymlen = 256; + fspr_wchar_t wsymname[256]; + fspr_status_t rv; - rv = apr_conv_utf8_to_ucs2(wsymname, &wsymlen, symname, &symlen); + rv = fspr_conv_utf8_to_ucs2(wsymname, &wsymlen, symname, &symlen); if (rv != APR_SUCCESS) { return rv; } @@ -149,19 +149,19 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, return APR_ENAMETOOLONG; } - *ressym = (apr_dso_handle_sym_t)GetProcAddressW(handle->handle, wsymname); + *ressym = (fspr_dso_handle_sym_t)GetProcAddressW(handle->handle, wsymname); #else - *ressym = (apr_dso_handle_sym_t)GetProcAddress(handle->handle, symname); + *ressym = (fspr_dso_handle_sym_t)GetProcAddress(handle->handle, symname); #endif if (!*ressym) { - return apr_get_os_error(); + return fspr_get_os_error(); } return APR_SUCCESS; } -APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize) +APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *dso, char *buf, fspr_size_t bufsize) { - return apr_strerror(dso->load_error, buf, bufsize); + return fspr_strerror(dso->load_error, buf, bufsize); } #endif diff --git a/libs/apr/file_io/netware/filestat.c b/libs/apr/file_io/netware/filestat.c index a3f60e57df..5b58ef5b50 100644 --- a/libs/apr/file_io/netware/filestat.c +++ b/libs/apr/file_io/netware/filestat.c @@ -14,15 +14,15 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" #include "fsio.h" #include "nks/dirio.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_errno.h" -#include "apr_hash.h" -#include "apr_thread_rwlock.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_errno.h" +#include "fspr_hash.h" +#include "fspr_thread_rwlock.h" #ifdef HAVE_UTIME_H #include @@ -30,9 +30,9 @@ #define APR_HAS_PSA -static apr_filetype_e filetype_from_mode(mode_t mode) +static fspr_filetype_e filetype_from_mode(mode_t mode) { - apr_filetype_e type = APR_NOFILE; + fspr_filetype_e type = APR_NOFILE; if (S_ISREG(mode)) type = APR_REG; @@ -53,12 +53,12 @@ static apr_filetype_e filetype_from_mode(mode_t mode) return type; } -static void fill_out_finfo(apr_finfo_t *finfo, struct stat *info, - apr_int32_t wanted) +static void fill_out_finfo(fspr_finfo_t *finfo, struct stat *info, + fspr_int32_t wanted) { finfo->valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK | APR_FINFO_OWNER | APR_FINFO_PROT; - finfo->protection = apr_unix_mode2perms(info->st_mode); + finfo->protection = fspr_unix_mode2perms(info->st_mode); finfo->filetype = filetype_from_mode(info->st_mode); finfo->user = info->st_uid; finfo->group = info->st_gid; @@ -66,9 +66,9 @@ static void fill_out_finfo(apr_finfo_t *finfo, struct stat *info, finfo->inode = info->st_ino; finfo->device = info->st_dev; finfo->nlink = info->st_nlink; - apr_time_ansi_put(&finfo->atime, info->st_atime.tv_sec); - apr_time_ansi_put(&finfo->mtime, info->st_mtime.tv_sec); - apr_time_ansi_put(&finfo->ctime, info->st_ctime.tv_sec); + fspr_time_ansi_put(&finfo->atime, info->st_atime.tv_sec); + fspr_time_ansi_put(&finfo->mtime, info->st_mtime.tv_sec); + fspr_time_ansi_put(&finfo->ctime, info->st_ctime.tv_sec); /* ### needs to be revisited * if (wanted & APR_FINFO_CSIZE) { * finfo->csize = info->st_blocks * 512; @@ -77,14 +77,14 @@ static void fill_out_finfo(apr_finfo_t *finfo, struct stat *info, */ } -APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, - apr_int32_t wanted, - apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_info_get(fspr_finfo_t *finfo, + fspr_int32_t wanted, + fspr_file_t *thefile) { struct stat info; if (thefile->buffered) { - apr_status_t rv = apr_file_flush(thefile); + fspr_status_t rv = fspr_file_flush(thefile); if (rv != APR_SUCCESS) return rv; } @@ -100,30 +100,30 @@ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, } } -APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, - apr_fileperms_t perms) +APR_DECLARE(fspr_status_t) fspr_file_perms_set(const char *fname, + fspr_fileperms_t perms) { - mode_t mode = apr_unix_perms2mode(perms); + mode_t mode = fspr_unix_perms2mode(perms); if (chmod(fname, mode) == -1) return errno; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, - apr_fileattrs_t attributes, - apr_fileattrs_t attr_mask, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_attrs_set(const char *fname, + fspr_fileattrs_t attributes, + fspr_fileattrs_t attr_mask, + fspr_pool_t *pool) { - apr_status_t status; - apr_finfo_t finfo; + fspr_status_t status; + fspr_finfo_t finfo; /* Don't do anything if we can't handle the requested attributes */ if (!(attr_mask & (APR_FILE_ATTR_READONLY | APR_FILE_ATTR_EXECUTABLE))) return APR_SUCCESS; - status = apr_stat(&finfo, fname, APR_FINFO_PROT, pool); + status = fspr_stat(&finfo, fname, APR_FINFO_PROT, pool); if (status) return status; @@ -162,21 +162,21 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, } } - return apr_file_perms_set(fname, finfo.protection); + return fspr_file_perms_set(fname, finfo.protection); } #ifndef APR_HAS_PSA -static apr_status_t stat_cache_cleanup(void *data) +static fspr_status_t stat_cache_cleanup(void *data) { - apr_pool_t *p = (apr_pool_t *)getGlobalPool(); - apr_hash_index_t *hi; - apr_hash_t *statCache = (apr_hash_t*)data; + fspr_pool_t *p = (fspr_pool_t *)getGlobalPool(); + fspr_hash_index_t *hi; + fspr_hash_t *statCache = (fspr_hash_t*)data; char *key; - apr_ssize_t keylen; + fspr_ssize_t keylen; NXPathCtx_t pathctx; - for (hi = apr_hash_first(p, statCache); hi; hi = apr_hash_next(hi)) { - apr_hash_this(hi, (const void**)&key, &keylen, (void**)&pathctx); + for (hi = fspr_hash_first(p, statCache); hi; hi = fspr_hash_next(hi)) { + fspr_hash_this(hi, (const void**)&key, &keylen, (void**)&pathctx); if (pathctx) { NXFreePathContext(pathctx); @@ -186,11 +186,11 @@ static apr_status_t stat_cache_cleanup(void *data) return APR_SUCCESS; } -int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestmap, apr_pool_t *p) +int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestmap, fspr_pool_t *p) { - apr_pool_t *gPool = (apr_pool_t *)getGlobalPool(); - apr_hash_t *statCache = NULL; - apr_thread_rwlock_t *rwlock = NULL; + fspr_pool_t *gPool = (fspr_pool_t *)getGlobalPool(); + fspr_hash_t *statCache = NULL; + fspr_thread_rwlock_t *rwlock = NULL; NXPathCtx_t pathctx = 0; char *ptr = NULL, *tr; @@ -205,22 +205,22 @@ int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestm if (!gPool) { char poolname[50]; - if (apr_pool_create(&gPool, NULL) != APR_SUCCESS) { + if (fspr_pool_create(&gPool, NULL) != APR_SUCCESS) { return getstat(ctx, path, buf, requestmap); } setGlobalPool(gPool); - apr_pool_tag(gPool, apr_pstrdup(gPool, "cstat_mem_pool")); + fspr_pool_tag(gPool, fspr_pstrdup(gPool, "cstat_mem_pool")); - statCache = apr_hash_make(gPool); - apr_pool_userdata_set ((void*)statCache, "STAT_CACHE", stat_cache_cleanup, gPool); + statCache = fspr_hash_make(gPool); + fspr_pool_userdata_set ((void*)statCache, "STAT_CACHE", stat_cache_cleanup, gPool); - apr_thread_rwlock_create(&rwlock, gPool); - apr_pool_userdata_set ((void*)rwlock, "STAT_CACHE_LOCK", apr_pool_cleanup_null, gPool); + fspr_thread_rwlock_create(&rwlock, gPool); + fspr_pool_userdata_set ((void*)rwlock, "STAT_CACHE_LOCK", fspr_pool_cleanup_null, gPool); } else { - apr_pool_userdata_get((void**)&statCache, "STAT_CACHE", gPool); - apr_pool_userdata_get((void**)&rwlock, "STAT_CACHE_LOCK", gPool); + fspr_pool_userdata_get((void**)&statCache, "STAT_CACHE", gPool); + fspr_pool_userdata_get((void**)&rwlock, "STAT_CACHE_LOCK", gPool); } if (!gPool || !statCache || !rwlock) { @@ -239,7 +239,7 @@ int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestm } if (ptr) { - ppath = apr_pstrndup (p, path, len); + ppath = fspr_pstrndup (p, path, len); strlwr(ppath); if (ptr[1] != '\0') { ptr++; @@ -249,19 +249,19 @@ int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestm slash, we need to make sure we stat the current directory with a dot */ if (((*ptr == '/') || (*ptr == '\\')) && (*(ptr+1) == '\0')) { - pinfo = apr_pstrdup (p, "."); + pinfo = fspr_pstrdup (p, "."); } else { - pinfo = apr_pstrdup (p, ptr); + pinfo = fspr_pstrdup (p, ptr); } } /* If we have a statCache then try to pull the information from the cache. Otherwise just stat the file and return.*/ if (statCache) { - apr_thread_rwlock_rdlock(rwlock); - pathctx = (NXPathCtx_t) apr_hash_get(statCache, ppath, APR_HASH_KEY_STRING); - apr_thread_rwlock_unlock(rwlock); + fspr_thread_rwlock_rdlock(rwlock); + pathctx = (NXPathCtx_t) fspr_hash_get(statCache, ppath, APR_HASH_KEY_STRING); + fspr_thread_rwlock_unlock(rwlock); if (pathctx) { return getstat(pathctx, pinfo, buf, requestmap); } @@ -270,9 +270,9 @@ int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestm err = NXCreatePathContext(0, ppath, 0, NULL, &pathctx); if (!err) { - apr_thread_rwlock_wrlock(rwlock); - apr_hash_set(statCache, apr_pstrdup(gPool,ppath) , APR_HASH_KEY_STRING, (void*)pathctx); - apr_thread_rwlock_unlock(rwlock); + fspr_thread_rwlock_wrlock(rwlock); + fspr_hash_set(statCache, fspr_pstrdup(gPool,ppath) , APR_HASH_KEY_STRING, (void*)pathctx); + fspr_thread_rwlock_unlock(rwlock); return getstat(pathctx, pinfo, buf, requestmap); } } @@ -282,9 +282,9 @@ int cstat (NXPathCtx_t ctx, char *path, struct stat *buf, unsigned long requestm } #endif -APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, +APR_DECLARE(fspr_status_t) fspr_stat(fspr_finfo_t *finfo, const char *fname, - apr_int32_t wanted, apr_pool_t *pool) + fspr_int32_t wanted, fspr_pool_t *pool) { struct stat info; int srv; @@ -305,7 +305,7 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, if (wanted & APR_FINFO_LINK) wanted &= ~APR_FINFO_LINK; if (wanted & APR_FINFO_NAME) { - finfo->name = apr_pstrdup(pool, info.st_name); + finfo->name = fspr_pstrdup(pool, info.st_name); finfo->valid |= APR_FINFO_NAME; } return (wanted & ~finfo->valid) ? APR_INCOMPLETE : APR_SUCCESS; @@ -345,14 +345,14 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, } } -APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, - apr_time_t mtime, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_mtime_set(const char *fname, + fspr_time_t mtime, + fspr_pool_t *pool) { - apr_status_t status; - apr_finfo_t finfo; + fspr_status_t status; + fspr_finfo_t finfo; - status = apr_stat(&finfo, fname, APR_FINFO_ATIME, pool); + status = fspr_stat(&finfo, fname, APR_FINFO_ATIME, pool); if (status) { return status; } @@ -361,10 +361,10 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, { struct timeval tvp[2]; - tvp[0].tv_sec = apr_time_sec(finfo.atime); - tvp[0].tv_usec = apr_time_usec(finfo.atime); - tvp[1].tv_sec = apr_time_sec(mtime); - tvp[1].tv_usec = apr_time_usec(mtime); + tvp[0].tv_sec = fspr_time_sec(finfo.atime); + tvp[0].tv_usec = fspr_time_usec(finfo.atime); + tvp[1].tv_sec = fspr_time_sec(mtime); + tvp[1].tv_usec = fspr_time_usec(mtime); if (utimes(fname, tvp) == -1) { return errno; diff --git a/libs/apr/file_io/netware/filesys.c b/libs/apr/file_io/netware/filesys.c index 05c44cecd5..f366f4644b 100644 --- a/libs/apr/file_io/netware/filesys.c +++ b/libs/apr/file_io/netware/filesys.c @@ -14,21 +14,21 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_arch_file_io.h" -#include "apr_strings.h" +#include "fspr.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" -apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) +fspr_status_t filepath_root_case(char **rootpath, char *root, fspr_pool_t *p) { /* See the Windows code to figure out what to do here. It probably checks to make sure that the root exists and case it correctly according to the file system. */ - *rootpath = apr_pstrdup(p, root); + *rootpath = fspr_pstrdup(p, root); return APR_SUCCESS; } -apr_status_t filepath_has_drive(const char *rootpath, int only, apr_pool_t *p) +fspr_status_t filepath_has_drive(const char *rootpath, int only, fspr_pool_t *p) { char *s; @@ -46,7 +46,7 @@ apr_status_t filepath_has_drive(const char *rootpath, int only, apr_pool_t *p) return 0; } -apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_pool_t *p) +fspr_status_t filepath_compare_drive(const char *path1, const char *path2, fspr_pool_t *p) { char *s1, *s2; @@ -64,8 +64,8 @@ apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_po return -1; } -APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_get(char **rootpath, fspr_int32_t flags, + fspr_pool_t *p) { char path[APR_PATH_MAX]; char *ptr; @@ -85,7 +85,7 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, if (*ptr == ':') { ptr = path; } - *rootpath = apr_pstrdup(p, ptr); + *rootpath = fspr_pstrdup(p, ptr); if (!(flags & APR_FILEPATH_NATIVE)) { for (ptr = *rootpath; *ptr; ++ptr) { if (*ptr == '\\') @@ -95,8 +95,8 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_set(const char *rootpath, + fspr_pool_t *p) { if (chdir2(rootpath) != 0) return errno; diff --git a/libs/apr/file_io/netware/flock.c b/libs/apr/file_io/netware/flock.c index c083a0ed40..084d4d9bb7 100644 --- a/libs/apr/file_io/netware/flock.c +++ b/libs/apr/file_io/netware/flock.c @@ -15,10 +15,10 @@ */ #include -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" -apr_status_t apr_file_lock(apr_file_t *thefile, int type) +fspr_status_t fspr_file_lock(fspr_file_t *thefile, int type) { int fc; @@ -30,7 +30,7 @@ apr_status_t apr_file_lock(apr_file_t *thefile, int type) return APR_SUCCESS; } -apr_status_t apr_file_unlock(apr_file_t *thefile) +fspr_status_t fspr_file_unlock(fspr_file_t *thefile) { if(NXFileRangeUnlock(thefile->filedes,NX_RANGE_LOCK_CANCEL,0 , 0) == -1) return errno; diff --git a/libs/apr/file_io/netware/mktemp.c b/libs/apr/file_io/netware/mktemp.c index c5ffebd20d..8ffa947404 100644 --- a/libs/apr/file_io/netware/mktemp.c +++ b/libs/apr/file_io/netware/mktemp.c @@ -14,18 +14,18 @@ * limitations under the License. */ -#include "apr_private.h" -#include "apr_file_io.h" /* prototype of apr_mkstemp() */ -#include "apr_strings.h" /* prototype of apr_mkstemp() */ -#include "apr_arch_file_io.h" /* prototype of apr_mkstemp() */ -#include "apr_portable.h" /* for apr_os_file_put() */ +#include "fspr_private.h" +#include "fspr_file_io.h" /* prototype of fspr_mkstemp() */ +#include "fspr_strings.h" /* prototype of fspr_mkstemp() */ +#include "fspr_arch_file_io.h" /* prototype of fspr_mkstemp() */ +#include "fspr_portable.h" /* for fspr_os_file_put() */ #include /* for mkstemp() - Single Unix */ -APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_int32_t flags, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_mktemp(fspr_file_t **fp, char *template, fspr_int32_t flags, fspr_pool_t *p) { int fd; - apr_status_t rv; + fspr_status_t rv; flags = (!flags) ? APR_CREATE | APR_READ | APR_WRITE | APR_DELONCLOSE : flags & ~APR_EXCL; @@ -38,11 +38,11 @@ APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_i * Otherwise file locking will not allow the file to be shared. */ close(fd); - if ((rv = apr_file_open(fp, template, flags|APR_FILE_NOCLEANUP, + if ((rv = fspr_file_open(fp, template, flags|APR_FILE_NOCLEANUP, APR_UREAD | APR_UWRITE, p)) == APR_SUCCESS) { - apr_pool_cleanup_register((*fp)->pool, (void *)(*fp), - apr_unix_file_cleanup, apr_unix_file_cleanup); + fspr_pool_cleanup_register((*fp)->pool, (void *)(*fp), + fspr_unix_file_cleanup, fspr_unix_file_cleanup); } return rv; diff --git a/libs/apr/file_io/netware/pipe.c b/libs/apr/file_io/netware/pipe.c index 4b6b826887..70ed4b8e12 100644 --- a/libs/apr/file_io/netware/pipe.c +++ b/libs/apr/file_io/netware/pipe.c @@ -18,12 +18,12 @@ #include #include -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_arch_inherit.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_arch_inherit.h" -static apr_status_t pipeblock(apr_file_t *thepipe) +static fspr_status_t pipeblock(fspr_file_t *thepipe) { #ifdef USE_FLAGS int err; @@ -46,7 +46,7 @@ static apr_status_t pipeblock(apr_file_t *thepipe) return APR_SUCCESS; } -static apr_status_t pipenonblock(apr_file_t *thepipe) +static fspr_status_t pipenonblock(fspr_file_t *thepipe) { #ifdef USE_FLAGS int err; @@ -70,7 +70,7 @@ static apr_status_t pipenonblock(apr_file_t *thepipe) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_set(fspr_file_t *thepipe, fspr_interval_time_t timeout) { if (thepipe->is_pipe == 1) { thepipe->timeout = timeout; @@ -89,7 +89,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_int return APR_EINVAL; } -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t *timeout) +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_get(fspr_file_t *thepipe, fspr_interval_time_t *timeout) { if (thepipe->is_pipe == 1) { *timeout = thepipe->timeout; @@ -98,14 +98,14 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_int return APR_EINVAL; } -APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, - apr_os_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_os_pipe_put_ex(fspr_file_t **file, + fspr_os_file_t *thefile, int register_cleanup, - apr_pool_t *pool) + fspr_pool_t *pool) { int *dafile = thefile; - (*file) = apr_pcalloc(pool, sizeof(apr_file_t)); + (*file) = fspr_pcalloc(pool, sizeof(fspr_file_t)); (*file)->pool = pool; (*file)->eof_hit = 0; (*file)->is_pipe = 1; @@ -121,21 +121,21 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, (*file)->thlock = NULL; #endif if (register_cleanup) { - apr_pool_cleanup_register((*file)->pool, (void *)(*file), - apr_unix_file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*file)->pool, (void *)(*file), + fspr_unix_file_cleanup, + fspr_pool_cleanup_null); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, - apr_os_file_t *thefile, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_pipe_put(fspr_file_t **file, + fspr_os_file_t *thefile, + fspr_pool_t *pool) { - return apr_os_pipe_put_ex(file, thefile, 0, pool); + return fspr_os_pipe_put_ex(file, thefile, 0, pool); } -APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_pipe_create(fspr_file_t **in, fspr_file_t **out, fspr_pool_t *pool) { int filedes[2]; int err; @@ -144,8 +144,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out return errno; } - (*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t)); - (*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t)); + (*in) = (fspr_file_t *)fspr_pcalloc(pool, sizeof(fspr_file_t)); + (*out) = (fspr_file_t *)fspr_pcalloc(pool, sizeof(fspr_file_t)); (*in)->pool = (*out)->pool = pool; @@ -166,19 +166,19 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out (*in)->ungetchar = -1; (*in)->thlock = (*out)->thlock = NULL; - (void) apr_pollset_create(&(*in)->pollset, 1, pool, 0); - (void) apr_pollset_create(&(*out)->pollset, 1, pool, 0); + (void) fspr_pollset_create(&(*in)->pollset, 1, pool, 0); + (void) fspr_pollset_create(&(*out)->pollset, 1, pool, 0); - apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup, - apr_pool_cleanup_null); - apr_pool_cleanup_register((*out)->pool, (void *)(*out), apr_unix_file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*in)->pool, (void *)(*in), fspr_unix_file_cleanup, + fspr_pool_cleanup_null); + fspr_pool_cleanup_register((*out)->pool, (void *)(*out), fspr_unix_file_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, - apr_fileperms_t perm, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_namedpipe_create(const char *filename, + fspr_fileperms_t perm, fspr_pool_t *pool) { return APR_ENOTIMPL; } diff --git a/libs/apr/file_io/os2/dir.c b/libs/apr/file_io/os2/dir.c index 3b08355f56..f237d21514 100644 --- a/libs/apr/file_io/os2/dir.c +++ b/libs/apr/file_io/os2/dir.c @@ -14,30 +14,30 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #include -static apr_status_t dir_cleanup(void *thedir) +static fspr_status_t dir_cleanup(void *thedir) { - apr_dir_t *dir = thedir; - return apr_dir_close(dir); + fspr_dir_t *dir = thedir; + return fspr_dir_close(dir); } -APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dir_open(fspr_dir_t **new, const char *dirname, fspr_pool_t *pool) { - apr_dir_t *thedir = (apr_dir_t *)apr_palloc(pool, sizeof(apr_dir_t)); + fspr_dir_t *thedir = (fspr_dir_t *)fspr_palloc(pool, sizeof(fspr_dir_t)); if (thedir == NULL) return APR_ENOMEM; thedir->pool = pool; - thedir->dirname = apr_pstrdup(pool, dirname); + thedir->dirname = fspr_pstrdup(pool, dirname); if (thedir->dirname == NULL) return APR_ENOMEM; @@ -45,13 +45,13 @@ APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, apr thedir->handle = 0; thedir->validentry = FALSE; *new = thedir; - apr_pool_cleanup_register(pool, thedir, dir_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, thedir, dir_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir) +APR_DECLARE(fspr_status_t) fspr_dir_close(fspr_dir_t *thedir) { int rv = 0; @@ -68,15 +68,15 @@ APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir) -APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, - apr_dir_t *thedir) +APR_DECLARE(fspr_status_t) fspr_dir_read(fspr_finfo_t *finfo, fspr_int32_t wanted, + fspr_dir_t *thedir) { int rv; ULONG entries = 1; if (thedir->handle == 0) { thedir->handle = HDIR_CREATE; - rv = DosFindFirst(apr_pstrcat(thedir->pool, thedir->dirname, "/*", NULL), &thedir->handle, + rv = DosFindFirst(fspr_pstrcat(thedir->pool, thedir->dirname, "/*", NULL), &thedir->handle, FILE_ARCHIVED|FILE_DIRECTORY|FILE_SYSTEM|FILE_HIDDEN|FILE_READONLY, &thedir->entry, sizeof(thedir->entry), &entries, FIL_STANDARD); } else { @@ -98,11 +98,11 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, /* Only directories & regular files show up in directory listings */ finfo->filetype = (thedir->entry.attrFile & FILE_DIRECTORY) ? APR_DIR : APR_REG; - apr_os2_time_to_apr_time(&finfo->mtime, thedir->entry.fdateLastWrite, + fspr_os2_time_to_fspr_time(&finfo->mtime, thedir->entry.fdateLastWrite, thedir->entry.ftimeLastWrite); - apr_os2_time_to_apr_time(&finfo->atime, thedir->entry.fdateLastAccess, + fspr_os2_time_to_fspr_time(&finfo->atime, thedir->entry.fdateLastAccess, thedir->entry.ftimeLastAccess); - apr_os2_time_to_apr_time(&finfo->ctime, thedir->entry.fdateCreation, + fspr_os2_time_to_fspr_time(&finfo->ctime, thedir->entry.fdateCreation, thedir->entry.ftimeCreation); finfo->name = thedir->entry.achName; @@ -123,28 +123,28 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, -APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir) +APR_DECLARE(fspr_status_t) fspr_dir_rewind(fspr_dir_t *thedir) { - return apr_dir_close(thedir); + return fspr_dir_close(thedir); } -APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dir_make(const char *path, fspr_fileperms_t perm, fspr_pool_t *pool) { return APR_FROM_OS_ERROR(DosCreateDir(path, NULL)); } -APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dir_remove(const char *path, fspr_pool_t *pool) { return APR_FROM_OS_ERROR(DosDeleteDir(path)); } -APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir) +APR_DECLARE(fspr_status_t) fspr_os_dir_get(fspr_os_dir_t **thedir, fspr_dir_t *dir) { if (dir == NULL) { return APR_ENODIR; @@ -155,11 +155,11 @@ APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir) -APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir, apr_os_dir_t *thedir, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dir_put(fspr_dir_t **dir, fspr_os_dir_t *thedir, + fspr_pool_t *pool) { if ((*dir) == NULL) { - (*dir) = (apr_dir_t *)apr_pcalloc(pool, sizeof(apr_dir_t)); + (*dir) = (fspr_dir_t *)fspr_pcalloc(pool, sizeof(fspr_dir_t)); (*dir)->pool = pool; } (*dir)->handle = *thedir; diff --git a/libs/apr/file_io/os2/dir_make_recurse.c b/libs/apr/file_io/os2/dir_make_recurse.c index 1f645b7dda..fde99ace7a 100644 --- a/libs/apr/file_io/os2/dir_make_recurse.c +++ b/libs/apr/file_io/os2/dir_make_recurse.c @@ -14,27 +14,27 @@ * limitations under the License. */ -#include "apr_file_io.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_file_io.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #include #define IS_SEP(c) (c == '/' || c == '\\') /* Remove trailing separators that don't affect the meaning of PATH. */ -static const char *path_canonicalize(const char *path, apr_pool_t *pool) +static const char *path_canonicalize(const char *path, fspr_pool_t *pool) { /* At some point this could eliminate redundant components. For * now, it just makes sure there is no trailing slash. */ - apr_size_t len = strlen(path); - apr_size_t orig_len = len; + fspr_size_t len = strlen(path); + fspr_size_t orig_len = len; while ((len > 0) && IS_SEP(path[len - 1])) { len--; } if (len != orig_len) { - return apr_pstrndup(pool, path, len); + return fspr_pstrndup(pool, path, len); } else { return path; @@ -44,7 +44,7 @@ static const char *path_canonicalize(const char *path, apr_pool_t *pool) /* Remove one component off the end of PATH. */ -static char *path_remove_last_component(const char *path, apr_pool_t *pool) +static char *path_remove_last_component(const char *path, fspr_pool_t *pool) { const char *newpath = path_canonicalize(path, pool); int i; @@ -55,32 +55,32 @@ static char *path_remove_last_component(const char *path, apr_pool_t *pool) } } - return apr_pstrndup(pool, path, (i < 0) ? 0 : i); + return fspr_pstrndup(pool, path, (i < 0) ? 0 : i); } -apr_status_t apr_dir_make_recursive(const char *path, apr_fileperms_t perm, - apr_pool_t *pool) +fspr_status_t fspr_dir_make_recursive(const char *path, fspr_fileperms_t perm, + fspr_pool_t *pool) { - apr_status_t apr_err = APR_SUCCESS; + fspr_status_t fspr_err = APR_SUCCESS; - apr_err = apr_dir_make(path, perm, pool); /* Try to make PATH right out */ + fspr_err = fspr_dir_make(path, perm, pool); /* Try to make PATH right out */ - if (APR_STATUS_IS_EEXIST(apr_err)) { /* It's OK if PATH exists */ + if (APR_STATUS_IS_EEXIST(fspr_err)) { /* It's OK if PATH exists */ return APR_SUCCESS; } - if (APR_STATUS_IS_ENOENT(apr_err)) { /* Missing an intermediate dir */ + if (APR_STATUS_IS_ENOENT(fspr_err)) { /* Missing an intermediate dir */ char *dir; dir = path_remove_last_component(path, pool); - apr_err = apr_dir_make_recursive(dir, perm, pool); + fspr_err = fspr_dir_make_recursive(dir, perm, pool); - if (!apr_err) { - apr_err = apr_dir_make(path, perm, pool); + if (!fspr_err) { + fspr_err = fspr_dir_make(path, perm, pool); } } - return apr_err; + return fspr_err; } diff --git a/libs/apr/file_io/os2/filedup.c b/libs/apr/file_io/os2/filedup.c index 72b86e2faa..c19ade0e6e 100644 --- a/libs/apr/file_io/os2/filedup.c +++ b/libs/apr/file_io/os2/filedup.c @@ -14,20 +14,20 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #include -#include "apr_arch_inherit.h" +#include "fspr_arch_inherit.h" -static apr_status_t file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p) +static fspr_status_t file_dup(fspr_file_t **new_file, fspr_file_t *old_file, fspr_pool_t *p) { int rv; - apr_file_t *dup_file; + fspr_file_t *dup_file; if (*new_file == NULL) { - dup_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t)); + dup_file = (fspr_file_t *)fspr_palloc(p, sizeof(fspr_file_t)); if (dup_file == NULL) { return APR_ENOMEM; @@ -45,7 +45,7 @@ static apr_status_t file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_po return APR_FROM_OS_ERROR(rv); } - dup_file->fname = apr_pstrdup(dup_file->pool, old_file->fname); + dup_file->fname = fspr_pstrdup(dup_file->pool, old_file->fname); dup_file->buffered = old_file->buffered; dup_file->isopen = old_file->isopen; dup_file->flags = old_file->flags & ~APR_INHERIT; @@ -53,8 +53,8 @@ static apr_status_t file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_po dup_file->pipe = old_file->pipe; if (*new_file == NULL) { - apr_pool_cleanup_register(dup_file->pool, dup_file, apr_file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(dup_file->pool, dup_file, fspr_file_cleanup, + fspr_pool_cleanup_null); *new_file = dup_file; } @@ -63,10 +63,10 @@ static apr_status_t file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_po -APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, apr_file_t *old_file, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_dup(fspr_file_t **new_file, fspr_file_t *old_file, fspr_pool_t *p) { if (*new_file) { - apr_file_close(*new_file); + fspr_file_close(*new_file); (*new_file)->filedes = -1; } @@ -75,23 +75,23 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, apr_file_t *old_fi -APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, apr_file_t *old_file, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_dup2(fspr_file_t *new_file, fspr_file_t *old_file, fspr_pool_t *p) { return file_dup(&new_file, old_file, p); } -APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, - apr_file_t *old_file, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_setaside(fspr_file_t **new_file, + fspr_file_t *old_file, + fspr_pool_t *p) { - *new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t)); - memcpy(*new_file, old_file, sizeof(apr_file_t)); + *new_file = (fspr_file_t *)fspr_palloc(p, sizeof(fspr_file_t)); + memcpy(*new_file, old_file, sizeof(fspr_file_t)); (*new_file)->pool = p; if (old_file->buffered) { - (*new_file)->buffer = apr_palloc(p, APR_FILE_BUFSIZE); + (*new_file)->buffer = fspr_palloc(p, APR_FILE_BUFSIZE); if (old_file->direction == 1) { memcpy((*new_file)->buffer, old_file->buffer, old_file->bufpos); @@ -101,25 +101,25 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, } if (old_file->mutex) { - apr_thread_mutex_create(&((*new_file)->mutex), + fspr_thread_mutex_create(&((*new_file)->mutex), APR_THREAD_MUTEX_DEFAULT, p); - apr_thread_mutex_destroy(old_file->mutex); + fspr_thread_mutex_destroy(old_file->mutex); } } if (old_file->fname) { - (*new_file)->fname = apr_pstrdup(p, old_file->fname); + (*new_file)->fname = fspr_pstrdup(p, old_file->fname); } if (!(old_file->flags & APR_FILE_NOCLEANUP)) { - apr_pool_cleanup_register(p, (void *)(*new_file), - apr_file_cleanup, - apr_file_cleanup); + fspr_pool_cleanup_register(p, (void *)(*new_file), + fspr_file_cleanup, + fspr_file_cleanup); } old_file->filedes = -1; - apr_pool_cleanup_kill(old_file->pool, (void *)old_file, - apr_file_cleanup); + fspr_pool_cleanup_kill(old_file->pool, (void *)old_file, + fspr_file_cleanup); return APR_SUCCESS; } diff --git a/libs/apr/file_io/os2/filestat.c b/libs/apr/file_io/os2/filestat.c index f31c7c1b50..dd9b0f8e78 100644 --- a/libs/apr/file_io/os2/filestat.c +++ b/libs/apr/file_io/os2/filestat.c @@ -16,14 +16,14 @@ #define INCL_DOS #define INCL_DOSERRORS -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_lib.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_lib.h" #include -#include "apr_strings.h" +#include "fspr_strings.h" -static void FS3_to_finfo(apr_finfo_t *finfo, FILESTATUS3 *fstatus) +static void FS3_to_finfo(fspr_finfo_t *finfo, FILESTATUS3 *fstatus) { finfo->protection = (fstatus->attrFile & FILE_READONLY) ? 0x555 : 0x777; @@ -39,11 +39,11 @@ static void FS3_to_finfo(apr_finfo_t *finfo, FILESTATUS3 *fstatus) finfo->device = 0; finfo->size = fstatus->cbFile; finfo->csize = fstatus->cbFileAlloc; - apr_os2_time_to_apr_time(&finfo->atime, fstatus->fdateLastAccess, + fspr_os2_time_to_fspr_time(&finfo->atime, fstatus->fdateLastAccess, fstatus->ftimeLastAccess ); - apr_os2_time_to_apr_time(&finfo->mtime, fstatus->fdateLastWrite, + fspr_os2_time_to_fspr_time(&finfo->mtime, fstatus->fdateLastWrite, fstatus->ftimeLastWrite ); - apr_os2_time_to_apr_time(&finfo->ctime, fstatus->fdateCreation, + fspr_os2_time_to_fspr_time(&finfo->ctime, fstatus->fdateCreation, fstatus->ftimeCreation ); finfo->valid = APR_FINFO_TYPE | APR_FINFO_PROT | APR_FINFO_SIZE | APR_FINFO_CSIZE | APR_FINFO_MTIME @@ -52,7 +52,7 @@ static void FS3_to_finfo(apr_finfo_t *finfo, FILESTATUS3 *fstatus) -static apr_status_t handle_type(apr_filetype_e *ftype, HFILE file) +static fspr_status_t handle_type(fspr_filetype_e *ftype, HFILE file) { ULONG filetype, fileattr, rc; @@ -86,15 +86,15 @@ static apr_status_t handle_type(apr_filetype_e *ftype, HFILE file) -APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, apr_int32_t wanted, - apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_info_get(fspr_finfo_t *finfo, fspr_int32_t wanted, + fspr_file_t *thefile) { ULONG rc; FILESTATUS3 fstatus; if (thefile->isopen) { if (thefile->buffered) { - apr_status_t rv = apr_file_flush(thefile); + fspr_status_t rv = fspr_file_flush(thefile); if (rv != APR_SUCCESS) { return rv; @@ -124,14 +124,14 @@ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, apr_int32_t want return APR_FROM_OS_ERROR(rc); } -APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, apr_fileperms_t perms) +APR_DECLARE(fspr_status_t) fspr_file_perms_set(const char *fname, fspr_fileperms_t perms) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, - apr_int32_t wanted, apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_stat(fspr_finfo_t *finfo, const char *fname, + fspr_int32_t wanted, fspr_pool_t *cont) { ULONG rc; FILESTATUS3 fstatus; @@ -153,18 +153,18 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, FILE_DIRECTORY|FILE_HIDDEN|FILE_SYSTEM|FILE_ARCHIVED, &ffb, sizeof(ffb), &count, FIL_STANDARD); if (rc == 0 && count == 1) { - finfo->name = apr_pstrdup(cont, ffb.achName); + finfo->name = fspr_pstrdup(cont, ffb.achName); finfo->valid |= APR_FINFO_NAME; } } } else if (rc == ERROR_INVALID_ACCESS) { - memset(finfo, 0, sizeof(apr_finfo_t)); + memset(finfo, 0, sizeof(fspr_finfo_t)); finfo->valid = APR_FINFO_TYPE | APR_FINFO_PROT; finfo->protection = 0666; finfo->filetype = APR_CHR; if (wanted & APR_FINFO_NAME) { - finfo->name = apr_pstrdup(cont, fname); + finfo->name = fspr_pstrdup(cont, fname); finfo->valid |= APR_FINFO_NAME; } } else { @@ -176,10 +176,10 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, -APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, - apr_fileattrs_t attributes, - apr_fileattrs_t attr_mask, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_file_attrs_set(const char *fname, + fspr_fileattrs_t attributes, + fspr_fileattrs_t attr_mask, + fspr_pool_t *cont) { FILESTATUS3 fs3; ULONG rc; @@ -221,9 +221,9 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, /* ### Somebody please write this! */ -APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, - apr_time_t mtime, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_mtime_set(const char *fname, + fspr_time_t mtime, + fspr_pool_t *pool) { FILESTATUS3 fs3; ULONG rc; @@ -233,7 +233,7 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, return APR_FROM_OS_ERROR(rc); } - apr_apr_time_to_os2_time(&fs3.fdateLastWrite, &fs3.ftimeLastWrite, mtime); + fspr_fspr_time_to_os2_time(&fs3.fdateLastWrite, &fs3.ftimeLastWrite, mtime); rc = DosSetPathInfo(fname, FIL_STANDARD, &fs3, sizeof(fs3), 0); return APR_FROM_OS_ERROR(rc); diff --git a/libs/apr/file_io/os2/filesys.c b/libs/apr/file_io/os2/filesys.c index ae43bc0a0f..c2fbb9d219 100644 --- a/libs/apr/file_io/os2/filesys.c +++ b/libs/apr/file_io/os2/filesys.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_lib.h" +#include "fspr.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_lib.h" #include /* OS/2 Exceptions: @@ -52,9 +52,9 @@ const char c_is_fnchar[256] = #define IS_SLASH(c) (c == '/' || c == '\\') -apr_status_t filepath_root_test(char *path, apr_pool_t *p) +fspr_status_t filepath_root_test(char *path, fspr_pool_t *p) { - char drive = apr_toupper(path[0]); + char drive = fspr_toupper(path[0]); if (drive >= 'A' && drive <= 'Z' && path[1] == ':' && IS_SLASH(path[2])) return APR_SUCCESS; @@ -63,8 +63,8 @@ apr_status_t filepath_root_test(char *path, apr_pool_t *p) } -apr_status_t filepath_drive_get(char **rootpath, char drive, - apr_int32_t flags, apr_pool_t *p) +fspr_status_t filepath_drive_get(char **rootpath, char drive, + fspr_int32_t flags, fspr_pool_t *p) { char path[APR_PATH_MAX]; char *pos; @@ -75,7 +75,7 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, path[1] = ':'; path[2] = '/'; - rc = DosQueryCurrentDir(apr_toupper(drive) - 'A', path+3, &bufsize); + rc = DosQueryCurrentDir(fspr_toupper(drive) - 'A', path+3, &bufsize); if (rc) { return APR_FROM_OS_ERROR(rc); @@ -88,16 +88,16 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, } } - *rootpath = apr_pstrdup(p, path); + *rootpath = fspr_pstrdup(p, path); return APR_SUCCESS; } -apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) +fspr_status_t filepath_root_case(char **rootpath, char *root, fspr_pool_t *p) { - if (root[0] && apr_islower(root[0]) && root[1] == ':') { - *rootpath = apr_pstrdup(p, root); - (*rootpath)[0] = apr_toupper((*rootpath)[0]); + if (root[0] && fspr_islower(root[0]) && root[1] == ':') { + *rootpath = fspr_pstrdup(p, root); + (*rootpath)[0] = fspr_toupper((*rootpath)[0]); } else { *rootpath = root; @@ -106,8 +106,8 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) } -APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_get(char **defpath, fspr_int32_t flags, + fspr_pool_t *p) { char path[APR_PATH_MAX]; ULONG drive; @@ -120,7 +120,7 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags, strcpy(path+1, ":\\"); rv = DosQueryCurrentDir(drive, path+3, &pathlen); - *defpath = apr_pstrdup(p, path); + *defpath = fspr_pstrdup(p, path); if (!(flags & APR_FILEPATH_NATIVE)) { for (pos=*defpath; *pos; pos++) { @@ -134,12 +134,12 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags, -APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_set(const char *path, fspr_pool_t *p) { ULONG rv = 0; if (path[1] == ':') - rv = DosSetDefaultDisk(apr_toupper(path[0]) - '@'); + rv = DosSetDefaultDisk(fspr_toupper(path[0]) - '@'); if (rv == 0) rv = DosSetCurrentDir(path); diff --git a/libs/apr/file_io/os2/flock.c b/libs/apr/file_io/os2/flock.c index ec94022081..6499589825 100644 --- a/libs/apr/file_io/os2/flock.c +++ b/libs/apr/file_io/os2/flock.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" -APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) +APR_DECLARE(fspr_status_t) fspr_file_lock(fspr_file_t *thefile, int type) { FILELOCK lockrange = { 0, 0x7fffffff }; ULONG rc; @@ -27,7 +27,7 @@ APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) return APR_FROM_OS_ERROR(rc); } -APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_unlock(fspr_file_t *thefile) { FILELOCK unlockrange = { 0, 0x7fffffff }; ULONG rc; diff --git a/libs/apr/file_io/os2/maperrorcode.c b/libs/apr/file_io/os2/maperrorcode.c index 282338bba0..2982eea0a6 100644 --- a/libs/apr/file_io/os2/maperrorcode.c +++ b/libs/apr/file_io/os2/maperrorcode.c @@ -15,11 +15,11 @@ */ #define INCL_DOSERRORS -#include "apr_arch_file_io.h" -#include "apr_file_io.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" #include #include -#include "apr_errno.h" +#include "fspr_errno.h" static int errormap[][2] = { { NO_ERROR, APR_SUCCESS }, @@ -75,7 +75,7 @@ static int errormap[][2] = { #define MAPSIZE (sizeof(errormap)/sizeof(errormap[0])) -int apr_canonical_error(apr_status_t err) +int fspr_canonical_error(fspr_status_t err) { int rv = -1, index; @@ -89,7 +89,7 @@ int apr_canonical_error(apr_status_t err) if (index -apr_status_t apr_file_cleanup(void *thefile) +fspr_status_t fspr_file_cleanup(void *thefile) { - apr_file_t *file = thefile; - return apr_file_close(file); + fspr_file_t *file = thefile; + return fspr_file_close(file); } -APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, apr_int32_t flag, apr_fileperms_t perm, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open(fspr_file_t **new, const char *fname, fspr_int32_t flag, fspr_fileperms_t perm, fspr_pool_t *pool) { int oflags = 0; int mflags = OPEN_FLAGS_FAIL_ON_ERROR|OPEN_SHARE_DENYNONE; int rv; ULONG action; - apr_file_t *dafile = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t)); + fspr_file_t *dafile = (fspr_file_t *)fspr_palloc(pool, sizeof(fspr_file_t)); dafile->pool = pool; dafile->isopen = FALSE; @@ -59,8 +59,8 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, apr dafile->buffered = (flag & APR_BUFFERED) > 0; if (dafile->buffered) { - dafile->buffer = apr_palloc(pool, APR_FILE_BUFSIZE); - rv = apr_thread_mutex_create(&dafile->mutex, 0, pool); + dafile->buffer = fspr_palloc(pool, APR_FILE_BUFSIZE); + rv = fspr_thread_mutex_create(&dafile->mutex, 0, pool); if (rv) return rv; @@ -97,7 +97,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, apr return APR_FROM_OS_ERROR(rv); dafile->isopen = TRUE; - dafile->fname = apr_pstrdup(pool, fname); + dafile->fname = fspr_pstrdup(pool, fname); dafile->filePtr = 0; dafile->bufpos = 0; dafile->dataRead = 0; @@ -105,7 +105,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, apr dafile->pipe = FALSE; if (!(flag & APR_FILE_NOCLEANUP)) { - apr_pool_cleanup_register(dafile->pool, dafile, apr_file_cleanup, apr_file_cleanup); + fspr_pool_cleanup_register(dafile->pool, dafile, fspr_file_cleanup, fspr_file_cleanup); } *new = dafile; @@ -114,13 +114,13 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, apr -APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file) +APR_DECLARE(fspr_status_t) fspr_file_close(fspr_file_t *file) { ULONG rc; - apr_status_t status; + fspr_status_t status; if (file && file->isopen) { - apr_file_flush(file); + fspr_file_flush(file); rc = DosClose(file->filedes); if (rc == 0) { @@ -136,14 +136,14 @@ APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file) } if (file->buffered) - apr_thread_mutex_destroy(file->mutex); + fspr_thread_mutex_destroy(file->mutex); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_remove(const char *path, fspr_pool_t *pool) { ULONG rc = DosDelete(path); return APR_FROM_OS_ERROR(rc); @@ -151,8 +151,8 @@ APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool) -APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, const char *to_path, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_rename(const char *from_path, const char *to_path, + fspr_pool_t *p) { ULONG rc = DosMove(from_path, to_path); @@ -169,7 +169,7 @@ APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, const char *to_ -APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile, apr_file_t *file) +APR_DECLARE(fspr_status_t) fspr_os_file_get(fspr_os_file_t *thefile, fspr_file_t *file) { *thefile = file->filedes; return APR_SUCCESS; @@ -177,11 +177,11 @@ APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile, apr_file_t *fi -APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, apr_os_file_t *thefile, apr_int32_t flags, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_file_put(fspr_file_t **file, fspr_os_file_t *thefile, fspr_int32_t flags, fspr_pool_t *pool) { - apr_os_file_t *dafile = thefile; + fspr_os_file_t *dafile = thefile; - (*file) = apr_palloc(pool, sizeof(apr_file_t)); + (*file) = fspr_palloc(pool, sizeof(fspr_file_t)); (*file)->pool = pool; (*file)->filedes = *dafile; (*file)->isopen = TRUE; @@ -191,10 +191,10 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, apr_os_file_t *thef (*file)->buffered = (flags & APR_BUFFERED) > 0; if ((*file)->buffered) { - apr_status_t rv; + fspr_status_t rv; - (*file)->buffer = apr_palloc(pool, APR_FILE_BUFSIZE); - rv = apr_thread_mutex_create(&(*file)->mutex, 0, pool); + (*file)->buffer = fspr_palloc(pool, APR_FILE_BUFSIZE); + rv = fspr_thread_mutex_create(&(*file)->mutex, 0, pool); if (rv) return rv; @@ -204,7 +204,7 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, apr_os_file_t *thef } -APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr) +APR_DECLARE(fspr_status_t) fspr_file_eof(fspr_file_t *fptr) { if (!fptr->isopen || fptr->eof_hit == 1) { return APR_EOF; @@ -213,33 +213,33 @@ APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr) } -APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stderr(fspr_file_t **thefile, fspr_pool_t *pool) { - apr_os_file_t fd = 2; + fspr_os_file_t fd = 2; - return apr_os_file_put(thefile, &fd, 0, pool); + return fspr_os_file_put(thefile, &fd, 0, pool); } -APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stdout(fspr_file_t **thefile, fspr_pool_t *pool) { - apr_os_file_t fd = 1; + fspr_os_file_t fd = 1; - return apr_os_file_put(thefile, &fd, 0, pool); + return fspr_os_file_put(thefile, &fd, 0, pool); } -APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stdin(fspr_file_t **thefile, fspr_pool_t *pool) { - apr_os_file_t fd = 0; + fspr_os_file_t fd = 0; - return apr_os_file_put(thefile, &fd, 0, pool); + return fspr_os_file_put(thefile, &fd, 0, pool); } APR_POOL_IMPLEMENT_ACCESSOR(file); -APR_IMPLEMENT_INHERIT_SET(file, flags, pool, apr_file_cleanup) +APR_IMPLEMENT_INHERIT_SET(file, flags, pool, fspr_file_cleanup) -APR_IMPLEMENT_INHERIT_UNSET(file, flags, pool, apr_file_cleanup) +APR_IMPLEMENT_INHERIT_UNSET(file, flags, pool, fspr_file_cleanup) diff --git a/libs/apr/file_io/os2/pipe.c b/libs/apr/file_io/os2/pipe.c index ee2b2b004e..007977aafc 100644 --- a/libs/apr/file_io/os2/pipe.c +++ b/libs/apr/file_io/os2/pipe.c @@ -15,16 +15,16 @@ */ #define INCL_DOSERRORS -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #include #include -APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_pipe_create(fspr_file_t **in, fspr_file_t **out, fspr_pool_t *pool) { ULONG filedes[2]; ULONG rc, action; @@ -54,7 +54,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out return APR_FROM_OS_ERROR(rc); } - (*in) = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t)); + (*in) = (fspr_file_t *)fspr_palloc(pool, sizeof(fspr_file_t)); rc = DosCreateEventSem(NULL, &(*in)->pipeSem, DC_SEM_SHARED, FALSE); if (rc) { @@ -78,33 +78,33 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out (*in)->pool = pool; (*in)->filedes = filedes[0]; - (*in)->fname = apr_pstrdup(pool, pipename); + (*in)->fname = fspr_pstrdup(pool, pipename); (*in)->isopen = TRUE; (*in)->buffered = FALSE; (*in)->flags = 0; (*in)->pipe = 1; (*in)->timeout = -1; (*in)->blocking = BLK_ON; - apr_pool_cleanup_register(pool, *in, apr_file_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *in, fspr_file_cleanup, fspr_pool_cleanup_null); - (*out) = (apr_file_t *)apr_palloc(pool, sizeof(apr_file_t)); + (*out) = (fspr_file_t *)fspr_palloc(pool, sizeof(fspr_file_t)); (*out)->pool = pool; (*out)->filedes = filedes[1]; - (*out)->fname = apr_pstrdup(pool, pipename); + (*out)->fname = fspr_pstrdup(pool, pipename); (*out)->isopen = TRUE; (*out)->buffered = FALSE; (*out)->flags = 0; (*out)->pipe = 1; (*out)->timeout = -1; (*out)->blocking = BLK_ON; - apr_pool_cleanup_register(pool, *out, apr_file_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *out, fspr_file_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, apr_fileperms_t perm, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_namedpipe_create(const char *filename, fspr_fileperms_t perm, fspr_pool_t *pool) { /* Not yet implemented, interface not suitable */ return APR_ENOTIMPL; @@ -112,7 +112,7 @@ APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, apr_fi -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_set(fspr_file_t *thepipe, fspr_interval_time_t timeout) { if (thepipe->pipe == 1) { thepipe->timeout = timeout; @@ -135,7 +135,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_int -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t *timeout) +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_get(fspr_file_t *thepipe, fspr_interval_time_t *timeout) { if (thepipe->pipe == 1) { *timeout = thepipe->timeout; @@ -146,12 +146,12 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_int -APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, - apr_os_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_os_pipe_put_ex(fspr_file_t **file, + fspr_os_file_t *thefile, int register_cleanup, - apr_pool_t *pool) + fspr_pool_t *pool) { - (*file) = apr_pcalloc(pool, sizeof(apr_file_t)); + (*file) = fspr_pcalloc(pool, sizeof(fspr_file_t)); (*file)->pool = pool; (*file)->isopen = TRUE; (*file)->pipe = 1; @@ -160,8 +160,8 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, (*file)->filedes = *thefile; if (register_cleanup) { - apr_pool_cleanup_register(pool, *file, apr_file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *file, fspr_file_cleanup, + fspr_pool_cleanup_null); } return APR_SUCCESS; @@ -169,9 +169,9 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, -APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, - apr_os_file_t *thefile, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_pipe_put(fspr_file_t **file, + fspr_os_file_t *thefile, + fspr_pool_t *pool) { - return apr_os_pipe_put_ex(file, thefile, 0, pool); + return fspr_os_pipe_put_ex(file, thefile, 0, pool); } diff --git a/libs/apr/file_io/os2/readwrite.c b/libs/apr/file_io/os2/readwrite.c index f25a4210d6..90d786755e 100644 --- a/libs/apr/file_io/os2/readwrite.c +++ b/libs/apr/file_io/os2/readwrite.c @@ -17,14 +17,14 @@ #define INCL_DOS #define INCL_DOSERRORS -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #include -APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *nbytes) +APR_DECLARE(fspr_status_t) fspr_file_read(fspr_file_t *thefile, void *buf, fspr_size_t *nbytes) { ULONG rc = 0; ULONG bytesread; @@ -39,13 +39,13 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size ULONG blocksize; ULONG size = *nbytes; - apr_thread_mutex_lock(thefile->mutex); + fspr_thread_mutex_lock(thefile->mutex); if (thefile->direction == 1) { - int rv = apr_file_flush(thefile); + int rv = fspr_file_flush(thefile); if (rv != APR_SUCCESS) { - apr_thread_mutex_unlock(thefile->mutex); + fspr_thread_mutex_unlock(thefile->mutex); return rv; } @@ -79,7 +79,7 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size } *nbytes = rc == 0 ? pos - (char *)buf : 0; - apr_thread_mutex_unlock(thefile->mutex); + fspr_thread_mutex_unlock(thefile->mutex); if (*nbytes == 0 && rc == 0 && thefile->eof_hit) { return APR_EOF; @@ -122,7 +122,7 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size -APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, apr_size_t *nbytes) +APR_DECLARE(fspr_status_t) fspr_file_write(fspr_file_t *thefile, const void *buf, fspr_size_t *nbytes) { ULONG rc = 0; ULONG byteswritten; @@ -137,7 +137,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a int blocksize; int size = *nbytes; - apr_thread_mutex_lock(thefile->mutex); + fspr_thread_mutex_lock(thefile->mutex); if ( thefile->direction == 0 ) { // Position file pointer for writing at the offset we are logically reading from @@ -150,7 +150,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a while (rc == 0 && size > 0) { if (thefile->bufpos == APR_FILE_BUFSIZE) // write buffer is full - rc = apr_file_flush(thefile); + rc = fspr_file_flush(thefile); blocksize = size > APR_FILE_BUFSIZE - thefile->bufpos ? APR_FILE_BUFSIZE - thefile->bufpos : size; memcpy(thefile->buffer + thefile->bufpos, pos, blocksize); @@ -159,7 +159,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a size -= blocksize; } - apr_thread_mutex_unlock(thefile->mutex); + fspr_thread_mutex_unlock(thefile->mutex); return APR_FROM_OS_ERROR(rc); } else { if (thefile->flags & APR_APPEND) { @@ -194,7 +194,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a #ifdef HAVE_WRITEV -APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iovec *vec, apr_size_t nvec, apr_size_t *nbytes) +APR_DECLARE(fspr_status_t) fspr_file_writev(fspr_file_t *thefile, const struct iovec *vec, fspr_size_t nvec, fspr_size_t *nbytes) { int bytes; if ((bytes = writev(thefile->filedes, vec, nvec)) < 0) { @@ -210,7 +210,7 @@ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iove -APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_putc(char ch, fspr_file_t *thefile) { ULONG rc; ULONG byteswritten; @@ -230,24 +230,24 @@ APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile) -APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_ungetc(char ch, fspr_file_t *thefile) { - apr_off_t offset = -1; - return apr_file_seek(thefile, APR_CUR, &offset); + fspr_off_t offset = -1; + return fspr_file_seek(thefile, APR_CUR, &offset); } -APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_getc(char *ch, fspr_file_t *thefile) { ULONG rc; - apr_size_t bytesread; + fspr_size_t bytesread; if (!thefile->isopen) { return APR_EBADF; } bytesread = 1; - rc = apr_file_read(thefile, ch, &bytesread); + rc = fspr_file_read(thefile, ch, &bytesread); if (rc) { return rc; @@ -263,16 +263,16 @@ APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile) -APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_puts(const char *str, fspr_file_t *thefile) { - apr_size_t len; + fspr_size_t len; len = strlen(str); - return apr_file_write(thefile, str, &len); + return fspr_file_write(thefile, str, &len); } -APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_flush(fspr_file_t *thefile) { if (thefile->buffered) { ULONG written = 0; @@ -296,15 +296,15 @@ APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile) } -APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_gets(char *str, int len, fspr_file_t *thefile) { - apr_size_t readlen; - apr_status_t rv = APR_SUCCESS; + fspr_size_t readlen; + fspr_status_t rv = APR_SUCCESS; int i; for (i = 0; i < len-1; i++) { readlen = 1; - rv = apr_file_read(thefile, str+i, &readlen); + rv = fspr_file_read(thefile, str+i, &readlen); if (rv != APR_SUCCESS) { break; @@ -332,7 +332,7 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) -APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, +APR_DECLARE_NONSTD(int) fspr_file_printf(fspr_file_t *fptr, const char *format, ...) { int cc; @@ -345,8 +345,8 @@ APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, return 0; } va_start(ap, format); - len = apr_vsnprintf(buf, HUGE_STRING_LEN, format, ap); - cc = apr_file_puts(buf, fptr); + len = fspr_vsnprintf(buf, HUGE_STRING_LEN, format, ap); + cc = fspr_file_puts(buf, fptr); va_end(ap); free(buf); return (cc == APR_SUCCESS) ? len : -1; @@ -354,7 +354,7 @@ APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, -apr_status_t apr_file_check_read(apr_file_t *fd) +fspr_status_t fspr_file_check_read(fspr_file_t *fd) { int rc; diff --git a/libs/apr/file_io/os2/seek.c b/libs/apr/file_io/os2/seek.c index 6fdfe8e826..61420de7cc 100644 --- a/libs/apr/file_io/os2/seek.c +++ b/libs/apr/file_io/os2/seek.c @@ -14,20 +14,20 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_lib.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_lib.h" #include #include -static apr_status_t setptr(apr_file_t *thefile, unsigned long pos ) +static fspr_status_t setptr(fspr_file_t *thefile, unsigned long pos ) { long newbufpos; ULONG rc; if (thefile->direction == 1) { - apr_status_t rv = apr_file_flush(thefile); + fspr_status_t rv = fspr_file_flush(thefile); if (rv != APR_SUCCESS) { return rv; @@ -52,7 +52,7 @@ static apr_status_t setptr(apr_file_t *thefile, unsigned long pos ) -APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t where, apr_off_t *offset) +APR_DECLARE(fspr_status_t) fspr_file_seek(fspr_file_t *thefile, fspr_seek_where_t where, fspr_off_t *offset) { if (!thefile->isopen) { return APR_EBADF; @@ -62,7 +62,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh if (thefile->buffered) { int rc = EINVAL; - apr_finfo_t finfo; + fspr_finfo_t finfo; switch (where) { case APR_SET: @@ -74,7 +74,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh break; case APR_END: - rc = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile); + rc = fspr_file_info_get(&finfo, APR_FINFO_NORM, thefile); if (rc == APR_SUCCESS) rc = setptr(thefile, finfo.size + *offset); break; @@ -103,7 +103,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh -APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset) +APR_DECLARE(fspr_status_t) fspr_file_trunc(fspr_file_t *fp, fspr_off_t offset) { int rc = DosSetFileSize(fp->filedes, offset); diff --git a/libs/apr/file_io/unix/copy.c b/libs/apr/file_io/unix/copy.c index 113a1081bd..df5b1fec7f 100644 --- a/libs/apr/file_io/unix/copy.c +++ b/libs/apr/file_io/unix/copy.c @@ -14,30 +14,30 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_file_io.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" -static apr_status_t apr_file_transfer_contents(const char *from_path, +static fspr_status_t fspr_file_transfer_contents(const char *from_path, const char *to_path, - apr_int32_t flags, - apr_fileperms_t to_perms, - apr_pool_t *pool) + fspr_int32_t flags, + fspr_fileperms_t to_perms, + fspr_pool_t *pool) { - apr_file_t *s, *d; - apr_status_t status; - apr_finfo_t finfo; - apr_fileperms_t perms; + fspr_file_t *s, *d; + fspr_status_t status; + fspr_finfo_t finfo; + fspr_fileperms_t perms; /* Open source file. */ - status = apr_file_open(&s, from_path, APR_READ, APR_OS_DEFAULT, pool); + status = fspr_file_open(&s, from_path, APR_READ, APR_OS_DEFAULT, pool); if (status) return status; /* Maybe get its permissions. */ if (to_perms == APR_FILE_SOURCE_PERMS) { - status = apr_file_info_get(&finfo, APR_FINFO_PROT, s); + status = fspr_file_info_get(&finfo, APR_FINFO_PROT, s); if (status != APR_SUCCESS && status != APR_INCOMPLETE) { - apr_file_close(s); /* toss any error */ + fspr_file_close(s); /* toss any error */ return status; } perms = finfo.protection; @@ -46,66 +46,66 @@ static apr_status_t apr_file_transfer_contents(const char *from_path, perms = to_perms; /* Open dest file. */ - status = apr_file_open(&d, to_path, flags, perms, pool); + status = fspr_file_open(&d, to_path, flags, perms, pool); if (status) { - apr_file_close(s); /* toss any error */ + fspr_file_close(s); /* toss any error */ return status; } /* Copy bytes till the cows come home. */ while (1) { char buf[BUFSIZ]; - apr_size_t bytes_this_time = sizeof(buf); - apr_status_t read_err; - apr_status_t write_err; + fspr_size_t bytes_this_time = sizeof(buf); + fspr_status_t read_err; + fspr_status_t write_err; /* Read 'em. */ - read_err = apr_file_read(s, buf, &bytes_this_time); + read_err = fspr_file_read(s, buf, &bytes_this_time); if (read_err && !APR_STATUS_IS_EOF(read_err)) { - apr_file_close(s); /* toss any error */ - apr_file_close(d); /* toss any error */ + fspr_file_close(s); /* toss any error */ + fspr_file_close(d); /* toss any error */ return read_err; } /* Write 'em. */ - write_err = apr_file_write_full(d, buf, bytes_this_time, NULL); + write_err = fspr_file_write_full(d, buf, bytes_this_time, NULL); if (write_err) { - apr_file_close(s); /* toss any error */ - apr_file_close(d); /* toss any error */ + fspr_file_close(s); /* toss any error */ + fspr_file_close(d); /* toss any error */ return write_err; } if (read_err && APR_STATUS_IS_EOF(read_err)) { - status = apr_file_close(s); + status = fspr_file_close(s); if (status) { - apr_file_close(d); /* toss any error */ + fspr_file_close(d); /* toss any error */ return status; } /* return the results of this close: an error, or success */ - return apr_file_close(d); + return fspr_file_close(d); } } /* NOTREACHED */ } -APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path, +APR_DECLARE(fspr_status_t) fspr_file_copy(const char *from_path, const char *to_path, - apr_fileperms_t perms, - apr_pool_t *pool) + fspr_fileperms_t perms, + fspr_pool_t *pool) { - return apr_file_transfer_contents(from_path, to_path, + return fspr_file_transfer_contents(from_path, to_path, (APR_WRITE | APR_CREATE | APR_TRUNCATE), perms, pool); } -APR_DECLARE(apr_status_t) apr_file_append(const char *from_path, +APR_DECLARE(fspr_status_t) fspr_file_append(const char *from_path, const char *to_path, - apr_fileperms_t perms, - apr_pool_t *pool) + fspr_fileperms_t perms, + fspr_pool_t *pool) { - return apr_file_transfer_contents(from_path, to_path, + return fspr_file_transfer_contents(from_path, to_path, (APR_WRITE | APR_CREATE | APR_APPEND), perms, pool); diff --git a/libs/apr/file_io/unix/dir.c b/libs/apr/file_io/unix/dir.c index e05dc993c5..faba53d71d 100644 --- a/libs/apr/file_io/unix/dir.c +++ b/libs/apr/file_io/unix/dir.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #if APR_HAVE_SYS_SYSLIMITS_H #include #endif @@ -24,9 +24,9 @@ #include #endif -static apr_status_t dir_cleanup(void *thedir) +static fspr_status_t dir_cleanup(void *thedir) { - apr_dir_t *dir = thedir; + fspr_dir_t *dir = thedir; if (closedir(dir->dirstruct) == 0) { return APR_SUCCESS; } @@ -38,24 +38,24 @@ static apr_status_t dir_cleanup(void *thedir) #define PATH_SEPARATOR '/' /* Remove trailing separators that don't affect the meaning of PATH. */ -static const char *path_canonicalize (const char *path, apr_pool_t *pool) +static const char *path_canonicalize (const char *path, fspr_pool_t *pool) { /* At some point this could eliminate redundant components. For * now, it just makes sure there is no trailing slash. */ - apr_size_t len = strlen (path); - apr_size_t orig_len = len; + fspr_size_t len = strlen (path); + fspr_size_t orig_len = len; while ((len > 0) && (path[len - 1] == PATH_SEPARATOR)) len--; if (len != orig_len) - return apr_pstrndup (pool, path, len); + return fspr_pstrndup (pool, path, len); else return path; } /* Remove one component off the end of PATH. */ -static char *path_remove_last_component (const char *path, apr_pool_t *pool) +static char *path_remove_last_component (const char *path, fspr_pool_t *pool) { const char *newpath = path_canonicalize (path, pool); int i; @@ -65,18 +65,18 @@ static char *path_remove_last_component (const char *path, apr_pool_t *pool) break; } - return apr_pstrndup (pool, path, (i < 0) ? 0 : i); + return fspr_pstrndup (pool, path, (i < 0) ? 0 : i); } -apr_status_t apr_dir_open(apr_dir_t **new, const char *dirname, - apr_pool_t *pool) +fspr_status_t fspr_dir_open(fspr_dir_t **new, const char *dirname, + fspr_pool_t *pool) { /* On some platforms (e.g., Linux+GNU libc), d_name[] in struct * dirent is declared with enough storage for the name. On other * platforms (e.g., Solaris 8 for Intel), d_name is declared as a * one-byte array. Note: gcc evaluates this at compile time. */ - apr_size_t dirent_size = + fspr_size_t dirent_size = (sizeof((*new)->entry->d_name) > 1 ? sizeof(struct dirent) : sizeof (struct dirent) + 255); DIR *dir = opendir(dirname); @@ -85,25 +85,25 @@ apr_status_t apr_dir_open(apr_dir_t **new, const char *dirname, return errno; } - (*new) = (apr_dir_t *)apr_palloc(pool, sizeof(apr_dir_t)); + (*new) = (fspr_dir_t *)fspr_palloc(pool, sizeof(fspr_dir_t)); (*new)->pool = pool; - (*new)->dirname = apr_pstrdup(pool, dirname); + (*new)->dirname = fspr_pstrdup(pool, dirname); (*new)->dirstruct = dir; - (*new)->entry = apr_pcalloc(pool, dirent_size); + (*new)->entry = fspr_pcalloc(pool, dirent_size); - apr_pool_cleanup_register((*new)->pool, *new, dir_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->pool, *new, dir_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -apr_status_t apr_dir_close(apr_dir_t *thedir) +fspr_status_t fspr_dir_close(fspr_dir_t *thedir) { - return apr_pool_cleanup_run(thedir->pool, thedir, dir_cleanup); + return fspr_pool_cleanup_run(thedir->pool, thedir, dir_cleanup); } #ifdef DIRENT_TYPE -static apr_filetype_e filetype_from_dirent_type(int type) +static fspr_filetype_e filetype_from_dirent_type(int type) { switch (type) { case DT_REG: @@ -130,12 +130,12 @@ static apr_filetype_e filetype_from_dirent_type(int type) } #endif -apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, - apr_dir_t *thedir) +fspr_status_t fspr_dir_read(fspr_finfo_t *finfo, fspr_int32_t wanted, + fspr_dir_t *thedir) { - apr_status_t ret = 0; + fspr_status_t ret = 0; #ifdef DIRENT_TYPE - apr_filetype_e type; + fspr_filetype_e type; #endif #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ && !defined(READDIR_IS_THREAD_SAFE) @@ -201,12 +201,12 @@ apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, { char fspec[APR_PATH_MAX]; int off; - apr_cpystrn(fspec, thedir->dirname, sizeof(fspec)); + fspr_cpystrn(fspec, thedir->dirname, sizeof(fspec)); off = strlen(fspec); if ((fspec[off - 1] != '/') && (off + 1 < sizeof(fspec))) fspec[off++] = '/'; - apr_cpystrn(fspec + off, thedir->entry->d_name, sizeof(fspec) - off); - ret = apr_stat(finfo, fspec, APR_FINFO_LINK | wanted, thedir->pool); + fspr_cpystrn(fspec + off, thedir->entry->d_name, sizeof(fspec) - off); + ret = fspr_stat(finfo, fspec, APR_FINFO_LINK | wanted, thedir->pool); /* We passed a stack name that will disappear */ finfo->fname = NULL; } @@ -234,7 +234,7 @@ apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, #endif } - finfo->name = apr_pstrdup(thedir->pool, thedir->entry->d_name); + finfo->name = fspr_pstrdup(thedir->pool, thedir->entry->d_name); finfo->valid |= APR_FINFO_NAME; if (wanted) @@ -243,16 +243,16 @@ apr_status_t apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, return APR_SUCCESS; } -apr_status_t apr_dir_rewind(apr_dir_t *thedir) +fspr_status_t fspr_dir_rewind(fspr_dir_t *thedir) { rewinddir(thedir->dirstruct); return APR_SUCCESS; } -apr_status_t apr_dir_make(const char *path, apr_fileperms_t perm, - apr_pool_t *pool) +fspr_status_t fspr_dir_make(const char *path, fspr_fileperms_t perm, + fspr_pool_t *pool) { - mode_t mode = apr_unix_perms2mode(perm); + mode_t mode = fspr_unix_perms2mode(perm); if (mkdir(path, mode) == 0) { return APR_SUCCESS; @@ -262,35 +262,35 @@ apr_status_t apr_dir_make(const char *path, apr_fileperms_t perm, } } -apr_status_t apr_dir_make_recursive(const char *path, apr_fileperms_t perm, - apr_pool_t *pool) +fspr_status_t fspr_dir_make_recursive(const char *path, fspr_fileperms_t perm, + fspr_pool_t *pool) { - apr_status_t apr_err = 0; + fspr_status_t fspr_err = 0; - apr_err = apr_dir_make (path, perm, pool); /* Try to make PATH right out */ + fspr_err = fspr_dir_make (path, perm, pool); /* Try to make PATH right out */ - if (apr_err == EEXIST) /* It's OK if PATH exists */ + if (fspr_err == EEXIST) /* It's OK if PATH exists */ return APR_SUCCESS; - if (apr_err == ENOENT) { /* Missing an intermediate dir */ + if (fspr_err == ENOENT) { /* Missing an intermediate dir */ char *dir; dir = path_remove_last_component(path, pool); /* If there is no path left, give up. */ if (dir[0] == '\0') { - return apr_err; + return fspr_err; } - apr_err = apr_dir_make_recursive(dir, perm, pool); + fspr_err = fspr_dir_make_recursive(dir, perm, pool); - if (!apr_err) - apr_err = apr_dir_make (path, perm, pool); + if (!fspr_err) + fspr_err = fspr_dir_make (path, perm, pool); } - return apr_err; + return fspr_err; } -apr_status_t apr_dir_remove(const char *path, apr_pool_t *pool) +fspr_status_t fspr_dir_remove(const char *path, fspr_pool_t *pool) { if (rmdir(path) == 0) { return APR_SUCCESS; @@ -300,7 +300,7 @@ apr_status_t apr_dir_remove(const char *path, apr_pool_t *pool) } } -apr_status_t apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir) +fspr_status_t fspr_os_dir_get(fspr_os_dir_t **thedir, fspr_dir_t *dir) { if (dir == NULL) { return APR_ENODIR; @@ -309,11 +309,11 @@ apr_status_t apr_os_dir_get(apr_os_dir_t **thedir, apr_dir_t *dir) return APR_SUCCESS; } -apr_status_t apr_os_dir_put(apr_dir_t **dir, apr_os_dir_t *thedir, - apr_pool_t *pool) +fspr_status_t fspr_os_dir_put(fspr_dir_t **dir, fspr_os_dir_t *thedir, + fspr_pool_t *pool) { if ((*dir) == NULL) { - (*dir) = (apr_dir_t *)apr_pcalloc(pool, sizeof(apr_dir_t)); + (*dir) = (fspr_dir_t *)fspr_pcalloc(pool, sizeof(fspr_dir_t)); (*dir)->pool = pool; } (*dir)->dirstruct = thedir; diff --git a/libs/apr/file_io/unix/fileacc.c b/libs/apr/file_io/unix/fileacc.c index 437f3589f5..b1efa0e822 100644 --- a/libs/apr/file_io/unix/fileacc.c +++ b/libs/apr/file_io/unix/fileacc.c @@ -14,25 +14,25 @@ * limitations under the License. */ -#include "apr_strings.h" -#include "apr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_arch_file_io.h" -/* A file to put ALL of the accessor functions for apr_file_t types. */ +/* A file to put ALL of the accessor functions for fspr_file_t types. */ -APR_DECLARE(apr_status_t) apr_file_name_get(const char **fname, - apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_name_get(const char **fname, + fspr_file_t *thefile) { *fname = thefile->fname; return APR_SUCCESS; } -APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f) +APR_DECLARE(fspr_int32_t) fspr_file_flags_get(fspr_file_t *f) { return f->flags; } #if !defined(OS2) && !defined(WIN32) -mode_t apr_unix_perms2mode(apr_fileperms_t perms) +mode_t fspr_unix_perms2mode(fspr_fileperms_t perms) { mode_t mode = 0; @@ -68,9 +68,9 @@ mode_t apr_unix_perms2mode(apr_fileperms_t perms) return mode; } -apr_fileperms_t apr_unix_mode2perms(mode_t mode) +fspr_fileperms_t fspr_unix_mode2perms(mode_t mode) { - apr_fileperms_t perms = 0; + fspr_fileperms_t perms = 0; if (mode & S_ISUID) perms |= APR_USETID; @@ -105,15 +105,15 @@ apr_fileperms_t apr_unix_mode2perms(mode_t mode) } #endif -APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key, - apr_file_t *file) +APR_DECLARE(fspr_status_t) fspr_file_data_get(void **data, const char *key, + fspr_file_t *file) { - return apr_pool_userdata_get(data, key, file->pool); + return fspr_pool_userdata_get(data, key, file->pool); } -APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data, +APR_DECLARE(fspr_status_t) fspr_file_data_set(fspr_file_t *file, void *data, const char *key, - apr_status_t (*cleanup)(void *)) + fspr_status_t (*cleanup)(void *)) { - return apr_pool_userdata_set(data, key, cleanup, file->pool); + return fspr_pool_userdata_set(data, key, cleanup, file->pool); } diff --git a/libs/apr/file_io/unix/filedup.c b/libs/apr/file_io/unix/filedup.c index f2b61efe03..007421f91b 100644 --- a/libs/apr/file_io/unix/filedup.c +++ b/libs/apr/file_io/unix/filedup.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_thread_mutex.h" -#include "apr_arch_inherit.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_thread_mutex.h" +#include "fspr_arch_inherit.h" -static apr_status_t file_dup(apr_file_t **new_file, - apr_file_t *old_file, apr_pool_t *p, +static fspr_status_t file_dup(fspr_file_t **new_file, + fspr_file_t *old_file, fspr_pool_t *p, int which_dup) { int rv; @@ -40,12 +40,12 @@ static apr_status_t file_dup(apr_file_t **new_file, return errno; if (which_dup == 1) { - (*new_file) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t)); + (*new_file) = (fspr_file_t *)fspr_pcalloc(p, sizeof(fspr_file_t)); (*new_file)->pool = p; (*new_file)->filedes = rv; } - (*new_file)->fname = apr_pstrdup(p, old_file->fname); + (*new_file)->fname = fspr_pstrdup(p, old_file->fname); (*new_file)->buffered = old_file->buffered; /* If the existing socket in a dup2 is already buffered, we @@ -54,7 +54,7 @@ static apr_status_t file_dup(apr_file_t **new_file, */ #if APR_HAS_THREADS if ((*new_file)->buffered && !(*new_file)->thlock && old_file->thlock) { - apr_thread_mutex_create(&((*new_file)->thlock), + fspr_thread_mutex_create(&((*new_file)->thlock), APR_THREAD_MUTEX_DEFAULT, p); } #endif @@ -62,7 +62,7 @@ static apr_status_t file_dup(apr_file_t **new_file, * got one. */ if ((*new_file)->buffered && !(*new_file)->buffer) { - (*new_file)->buffer = apr_palloc(p, APR_FILE_BUFSIZE); + (*new_file)->buffer = fspr_palloc(p, APR_FILE_BUFSIZE); } /* this is the way dup() works */ @@ -71,29 +71,29 @@ static apr_status_t file_dup(apr_file_t **new_file, /* make sure unget behavior is consistent */ (*new_file)->ungetchar = old_file->ungetchar; - /* apr_file_dup2() retains the original cleanup, reflecting + /* fspr_file_dup2() retains the original cleanup, reflecting * the existing inherit and nocleanup flags. This means, - * that apr_file_dup2() cannot be called against an apr_file_t - * already closed with apr_file_close, because the expected + * that fspr_file_dup2() cannot be called against an fspr_file_t + * already closed with fspr_file_close, because the expected * cleanup was already killed. */ if (which_dup == 2) { return APR_SUCCESS; } - /* apr_file_dup() retains all old_file flags with the exceptions + /* fspr_file_dup() retains all old_file flags with the exceptions * of APR_INHERIT and APR_FILE_NOCLEANUP. - * The user must call apr_file_inherit_set() on the dupped - * apr_file_t when desired. + * The user must call fspr_file_inherit_set() on the dupped + * fspr_file_t when desired. */ (*new_file)->flags = old_file->flags & ~(APR_INHERIT | APR_FILE_NOCLEANUP); - apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), - apr_unix_file_cleanup, - apr_unix_file_cleanup); + fspr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), + fspr_unix_file_cleanup, + fspr_unix_file_cleanup); #ifndef WAITIO_USES_POLL - /* Start out with no pollset. apr_wait_for_io_or_timeout() will + /* Start out with no pollset. fspr_wait_for_io_or_timeout() will * initialize the pollset if needed. */ (*new_file)->pollset = NULL; @@ -101,27 +101,27 @@ static apr_status_t file_dup(apr_file_t **new_file, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, - apr_file_t *old_file, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_dup(fspr_file_t **new_file, + fspr_file_t *old_file, fspr_pool_t *p) { return file_dup(new_file, old_file, p, 1); } -APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, - apr_file_t *old_file, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_dup2(fspr_file_t *new_file, + fspr_file_t *old_file, fspr_pool_t *p) { return file_dup(&new_file, old_file, p, 2); } -APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, - apr_file_t *old_file, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_setaside(fspr_file_t **new_file, + fspr_file_t *old_file, + fspr_pool_t *p) { - *new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t)); - memcpy(*new_file, old_file, sizeof(apr_file_t)); + *new_file = (fspr_file_t *)fspr_palloc(p, sizeof(fspr_file_t)); + memcpy(*new_file, old_file, sizeof(fspr_file_t)); (*new_file)->pool = p; if (old_file->buffered) { - (*new_file)->buffer = apr_palloc(p, APR_FILE_BUFSIZE); + (*new_file)->buffer = fspr_palloc(p, APR_FILE_BUFSIZE); if (old_file->direction == 1) { memcpy((*new_file)->buffer, old_file->buffer, old_file->bufpos); } @@ -130,26 +130,26 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, } #if APR_HAS_THREADS if (old_file->thlock) { - apr_thread_mutex_create(&((*new_file)->thlock), + fspr_thread_mutex_create(&((*new_file)->thlock), APR_THREAD_MUTEX_DEFAULT, p); - apr_thread_mutex_destroy(old_file->thlock); + fspr_thread_mutex_destroy(old_file->thlock); } #endif /* APR_HAS_THREADS */ } if (old_file->fname) { - (*new_file)->fname = apr_pstrdup(p, old_file->fname); + (*new_file)->fname = fspr_pstrdup(p, old_file->fname); } if (!(old_file->flags & APR_FILE_NOCLEANUP)) { - apr_pool_cleanup_register(p, (void *)(*new_file), - apr_unix_file_cleanup, + fspr_pool_cleanup_register(p, (void *)(*new_file), + fspr_unix_file_cleanup, ((*new_file)->flags & APR_INHERIT) - ? apr_pool_cleanup_null - : apr_unix_file_cleanup); + ? fspr_pool_cleanup_null + : fspr_unix_file_cleanup); } old_file->filedes = -1; - apr_pool_cleanup_kill(old_file->pool, (void *)old_file, - apr_unix_file_cleanup); + fspr_pool_cleanup_kill(old_file->pool, (void *)old_file, + fspr_unix_file_cleanup); #ifndef WAITIO_USES_POLL (*new_file)->pollset = NULL; #endif diff --git a/libs/apr/file_io/unix/filepath.c b/libs/apr/file_io/unix/filepath.c index 64f1b2fbd4..1e87b9f267 100644 --- a/libs/apr/file_io/unix/filepath.c +++ b/libs/apr/file_io/unix/filepath.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_strings.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_strings.h" #define APR_WANT_STRFUNC -#include "apr_want.h" +#include "fspr_want.h" #if APR_HAVE_UNISTD_H #include #endif @@ -34,8 +34,8 @@ /* Any OS that requires/refuses trailing slashes should be dealt with here. */ -APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_get(char **defpath, fspr_int32_t flags, + fspr_pool_t *p) { char path[APR_PATH_MAX]; @@ -45,7 +45,7 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags, else return errno; } - *defpath = apr_pstrdup(p, path); + *defpath = fspr_pstrdup(p, path); return APR_SUCCESS; } @@ -53,7 +53,7 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **defpath, apr_int32_t flags, /* Any OS that requires/refuses trailing slashes should be dealt with here */ -APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_set(const char *path, fspr_pool_t *p) { if (chdir(path) != 0) return errno; @@ -61,13 +61,13 @@ APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, +APR_DECLARE(fspr_status_t) fspr_filepath_root(const char **rootpath, const char **inpath, - apr_int32_t flags, - apr_pool_t *p) + fspr_int32_t flags, + fspr_pool_t *p) { if (**inpath == '/') { - *rootpath = apr_pstrdup(p, "/"); + *rootpath = fspr_pstrdup(p, "/"); do { ++(*inpath); } while (**inpath == '/'); @@ -78,19 +78,19 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, return APR_ERELATIVE; } -APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, +APR_DECLARE(fspr_status_t) fspr_filepath_merge(char **newpath, const char *rootpath, const char *addpath, - apr_int32_t flags, - apr_pool_t *p) + fspr_int32_t flags, + fspr_pool_t *p) { char *path; - apr_size_t rootlen; /* is the length of the src rootpath */ - apr_size_t maxlen; /* maximum total path length */ - apr_size_t keptlen; /* is the length of the retained rootpath */ - apr_size_t pathlen; /* is the length of the result path */ - apr_size_t seglen; /* is the end of the current segment */ - apr_status_t rv; + fspr_size_t rootlen; /* is the length of the src rootpath */ + fspr_size_t maxlen; /* maximum total path length */ + fspr_size_t keptlen; /* is the length of the retained rootpath */ + fspr_size_t pathlen; /* is the length of the result path */ + fspr_size_t seglen; /* is the end of the current segment */ + fspr_status_t rv; /* Treat null as an empty path. */ @@ -134,7 +134,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, * passing the address of a char const* for a char** arg. */ char *getpath = NULL; - rv = apr_filepath_get(&getpath, flags, p); + rv = fspr_filepath_get(&getpath, flags, p); rootpath = getpath; if (rv != APR_SUCCESS) return errno; @@ -144,7 +144,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, /* XXX: Any kernel subject to goofy, uncanonical results * must run the rootpath against the user's given flags. - * Simplest would be a recursive call to apr_filepath_merge + * Simplest would be a recursive call to fspr_filepath_merge * with an empty (not null) rootpath and addpath of the cwd. */ } @@ -156,7 +156,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, if (maxlen > APR_PATH_MAX) { return APR_ENAMETOOLONG; } - path = (char *)apr_palloc(p, maxlen); + path = (char *)fspr_palloc(p, maxlen); if (addpath[0] == '/') { /* Ignore the given root path, strip off leading @@ -292,21 +292,21 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts, +APR_DECLARE(fspr_status_t) fspr_filepath_list_split(fspr_array_header_t **pathelts, const char *liststr, - apr_pool_t *p) + fspr_pool_t *p) { - return apr_filepath_list_split_impl(pathelts, liststr, ':', p); + return fspr_filepath_list_split_impl(pathelts, liststr, ':', p); } -APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr, - apr_array_header_t *pathelts, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_list_merge(char **liststr, + fspr_array_header_t *pathelts, + fspr_pool_t *p) { - return apr_filepath_list_merge_impl(liststr, pathelts, ':', p); + return fspr_filepath_list_merge_impl(liststr, pathelts, ':', p); } -APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_encoding(int *style, fspr_pool_t *p) { *style = APR_FILEPATH_ENCODING_LOCALE; return APR_SUCCESS; diff --git a/libs/apr/file_io/unix/filepath_util.c b/libs/apr/file_io/unix/filepath_util.c index d8ccc56714..d81dc91ce3 100644 --- a/libs/apr/file_io/unix/filepath_util.c +++ b/libs/apr/file_io/unix/filepath_util.c @@ -17,29 +17,29 @@ #define APR_WANT_STRFUNC #define APR_WANT_MEMFUNC -#include "apr_want.h" +#include "fspr_want.h" -#include "apr_errno.h" -#include "apr_pools.h" -#include "apr_strings.h" -#include "apr_tables.h" +#include "fspr_errno.h" +#include "fspr_pools.h" +#include "fspr_strings.h" +#include "fspr_tables.h" -#include "apr_private.h" +#include "fspr_private.h" -apr_status_t apr_filepath_list_split_impl(apr_array_header_t **pathelts, +fspr_status_t fspr_filepath_list_split_impl(fspr_array_header_t **pathelts, const char *liststr, char separator, - apr_pool_t *p) + fspr_pool_t *p) { char *path, *part, *ptr; char separator_string[2] = { '\0', '\0' }; - apr_array_header_t *elts; + fspr_array_header_t *elts; int nelts; separator_string[0] = separator; /* Count the number of path elements. We know there'll be at least one even if path is an empty string. */ - path = apr_pstrdup(p, liststr); + path = fspr_pstrdup(p, liststr); for (nelts = 0, ptr = path; ptr != NULL; ++nelts) { ptr = strchr(ptr, separator); @@ -48,14 +48,14 @@ apr_status_t apr_filepath_list_split_impl(apr_array_header_t **pathelts, } /* Split the path into the array. */ - elts = apr_array_make(p, nelts, sizeof(char*)); - while ((part = apr_strtok(path, separator_string, &ptr)) != NULL) + elts = fspr_array_make(p, nelts, sizeof(char*)); + while ((part = fspr_strtok(path, separator_string, &ptr)) != NULL) { if (*part == '\0') /* Ignore empty path components. */ continue; - *(char**)apr_array_push(elts) = part; - path = NULL; /* For the next call to apr_strtok */ + *(char**)fspr_array_push(elts) = part; + path = NULL; /* For the next call to fspr_strtok */ } *pathelts = elts; @@ -63,12 +63,12 @@ apr_status_t apr_filepath_list_split_impl(apr_array_header_t **pathelts, } -apr_status_t apr_filepath_list_merge_impl(char **liststr, - apr_array_header_t *pathelts, +fspr_status_t fspr_filepath_list_merge_impl(char **liststr, + fspr_array_header_t *pathelts, char separator, - apr_pool_t *p) + fspr_pool_t *p) { - apr_size_t path_size = 0; + fspr_size_t path_size = 0; char *path; int i; @@ -91,13 +91,13 @@ apr_status_t apr_filepath_list_merge_impl(char **liststr, path_size += (i - 1); /* Merge the path components */ - path = *liststr = apr_palloc(p, path_size + 1); + path = *liststr = fspr_palloc(p, path_size + 1); for (i = 0; i < pathelts->nelts; ++i) { /* ### Hmmmm. Calling strlen twice on the same string. Yuck. - But is is better than reallocation in apr_pstrcat? */ + But is is better than reallocation in fspr_pstrcat? */ const char *part = ((char**)pathelts->elts)[i]; - apr_size_t part_size = strlen(part); + fspr_size_t part_size = strlen(part); if (part_size == 0) /* Ignore empty path components. */ continue; diff --git a/libs/apr/file_io/unix/filestat.c b/libs/apr/file_io/unix/filestat.c index a34b22c370..d5e92724d5 100644 --- a/libs/apr/file_io/unix/filestat.c +++ b/libs/apr/file_io/unix/filestat.c @@ -14,19 +14,19 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_errno.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_errno.h" #ifdef HAVE_UTIME #include #endif -static apr_filetype_e filetype_from_mode(mode_t mode) +static fspr_filetype_e filetype_from_mode(mode_t mode) { - apr_filetype_e type; + fspr_filetype_e type; switch (mode & S_IFMT) { case S_IFREG: @@ -67,12 +67,12 @@ static apr_filetype_e filetype_from_mode(mode_t mode) return type; } -static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info, - apr_int32_t wanted) +static void fill_out_finfo(fspr_finfo_t *finfo, struct_stat *info, + fspr_int32_t wanted) { finfo->valid = APR_FINFO_MIN | APR_FINFO_IDENT | APR_FINFO_NLINK | APR_FINFO_OWNER | APR_FINFO_PROT; - finfo->protection = apr_unix_mode2perms(info->st_mode); + finfo->protection = fspr_unix_mode2perms(info->st_mode); finfo->filetype = filetype_from_mode(info->st_mode); finfo->user = info->st_uid; finfo->group = info->st_gid; @@ -80,9 +80,9 @@ static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info, finfo->inode = info->st_ino; finfo->device = info->st_dev; finfo->nlink = info->st_nlink; - apr_time_ansi_put(&finfo->atime, info->st_atime); - apr_time_ansi_put(&finfo->mtime, info->st_mtime); - apr_time_ansi_put(&finfo->ctime, info->st_ctime); + fspr_time_ansi_put(&finfo->atime, info->st_atime); + fspr_time_ansi_put(&finfo->mtime, info->st_mtime); + fspr_time_ansi_put(&finfo->ctime, info->st_ctime); /* ### needs to be revisited * if (wanted & APR_FINFO_CSIZE) { * finfo->csize = info->st_blocks * 512; @@ -91,14 +91,14 @@ static void fill_out_finfo(apr_finfo_t *finfo, struct_stat *info, */ } -APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, - apr_int32_t wanted, - apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_info_get(fspr_finfo_t *finfo, + fspr_int32_t wanted, + fspr_file_t *thefile) { struct_stat info; if (thefile->buffered) { - apr_status_t rv = apr_file_flush(thefile); + fspr_status_t rv = fspr_file_flush(thefile); if (rv != APR_SUCCESS) return rv; } @@ -114,30 +114,30 @@ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, } } -APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, - apr_fileperms_t perms) +APR_DECLARE(fspr_status_t) fspr_file_perms_set(const char *fname, + fspr_fileperms_t perms) { - mode_t mode = apr_unix_perms2mode(perms); + mode_t mode = fspr_unix_perms2mode(perms); if (chmod(fname, mode) == -1) return errno; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, - apr_fileattrs_t attributes, - apr_fileattrs_t attr_mask, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_attrs_set(const char *fname, + fspr_fileattrs_t attributes, + fspr_fileattrs_t attr_mask, + fspr_pool_t *pool) { - apr_status_t status; - apr_finfo_t finfo = {0}; + fspr_status_t status; + fspr_finfo_t finfo = {0}; /* Don't do anything if we can't handle the requested attributes */ if (!(attr_mask & (APR_FILE_ATTR_READONLY | APR_FILE_ATTR_EXECUTABLE))) return APR_SUCCESS; - status = apr_stat(&finfo, fname, APR_FINFO_PROT, pool); + status = fspr_stat(&finfo, fname, APR_FINFO_PROT, pool); if (status) return status; @@ -176,18 +176,18 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, } } - return apr_file_perms_set(fname, finfo.protection); + return fspr_file_perms_set(fname, finfo.protection); } -APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, - apr_time_t mtime, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_mtime_set(const char *fname, + fspr_time_t mtime, + fspr_pool_t *pool) { - apr_status_t status; - apr_finfo_t finfo = {0}; + fspr_status_t status; + fspr_finfo_t finfo = {0}; - status = apr_stat(&finfo, fname, APR_FINFO_ATIME, pool); + status = fspr_stat(&finfo, fname, APR_FINFO_ATIME, pool); if (status) { return status; } @@ -196,10 +196,10 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, { struct timeval tvp[2]; - tvp[0].tv_sec = apr_time_sec(finfo.atime); - tvp[0].tv_usec = apr_time_usec(finfo.atime); - tvp[1].tv_sec = apr_time_sec(mtime); - tvp[1].tv_usec = apr_time_usec(mtime); + tvp[0].tv_sec = fspr_time_sec(finfo.atime); + tvp[0].tv_usec = fspr_time_usec(finfo.atime); + tvp[1].tv_sec = fspr_time_sec(mtime); + tvp[1].tv_usec = fspr_time_usec(mtime); if (utimes(fname, tvp) == -1) { return errno; @@ -224,9 +224,9 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, } -APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, +APR_DECLARE(fspr_status_t) fspr_stat(fspr_finfo_t *finfo, const char *fname, - apr_int32_t wanted, apr_pool_t *pool) + fspr_int32_t wanted, fspr_pool_t *pool) { struct_stat info; int srv; diff --git a/libs/apr/file_io/unix/flock.c b/libs/apr/file_io/unix/flock.c index f400a96701..9081b5faf4 100644 --- a/libs/apr/file_io/unix/flock.c +++ b/libs/apr/file_io/unix/flock.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" #if APR_HAVE_FCNTL_H #include @@ -23,7 +23,7 @@ #include #endif -APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) +APR_DECLARE(fspr_status_t) fspr_file_lock(fspr_file_t *thefile, int type) { int rc; @@ -82,7 +82,7 @@ APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_unlock(fspr_file_t *thefile) { int rc; diff --git a/libs/apr/file_io/unix/fullrw.c b/libs/apr/file_io/unix/fullrw.c index 9ad27ec99b..9503e983ad 100644 --- a/libs/apr/file_io/unix/fullrw.c +++ b/libs/apr/file_io/unix/fullrw.c @@ -14,20 +14,20 @@ * limitations under the License. */ -#include "apr_file_io.h" +#include "fspr_file_io.h" -APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf, - apr_size_t nbytes, - apr_size_t *bytes_read) +APR_DECLARE(fspr_status_t) fspr_file_read_full(fspr_file_t *thefile, void *buf, + fspr_size_t nbytes, + fspr_size_t *bytes_read) { - apr_status_t status; - apr_size_t total_read = 0; + fspr_status_t status; + fspr_size_t total_read = 0; do { - apr_size_t amt = nbytes; + fspr_size_t amt = nbytes; - status = apr_file_read(thefile, buf, &amt); + status = fspr_file_read(thefile, buf, &amt); buf = (char *)buf + amt; nbytes -= amt; total_read += amt; @@ -39,18 +39,18 @@ APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf, return status; } -APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_file_write_full(fspr_file_t *thefile, const void *buf, - apr_size_t nbytes, - apr_size_t *bytes_written) + fspr_size_t nbytes, + fspr_size_t *bytes_written) { - apr_status_t status; - apr_size_t total_written = 0; + fspr_status_t status; + fspr_size_t total_written = 0; do { - apr_size_t amt = nbytes; + fspr_size_t amt = nbytes; - status = apr_file_write(thefile, buf, &amt); + status = fspr_file_write(thefile, buf, &amt); buf = (char *)buf + amt; nbytes -= amt; total_written += amt; @@ -62,18 +62,18 @@ APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, return status; } -APR_DECLARE(apr_status_t) apr_file_writev_full(apr_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_file_writev_full(fspr_file_t *thefile, const struct iovec *vec, - apr_size_t nvec, - apr_size_t *bytes_written) + fspr_size_t nvec, + fspr_size_t *bytes_written) { - apr_status_t rv = APR_SUCCESS; - apr_size_t i; - apr_size_t amt = 0; - apr_size_t total = 0; + fspr_status_t rv = APR_SUCCESS; + fspr_size_t i; + fspr_size_t amt = 0; + fspr_size_t total = 0; for (i = 0; i < nvec && rv == APR_SUCCESS; i++) { - rv = apr_file_write_full(thefile, vec[i].iov_base, + rv = fspr_file_write_full(thefile, vec[i].iov_base, vec[i].iov_len, &amt); total += amt; } diff --git a/libs/apr/file_io/unix/mktemp.c b/libs/apr/file_io/unix/mktemp.c index 73c61dcfce..2ea22e01b9 100644 --- a/libs/apr/file_io/unix/mktemp.c +++ b/libs/apr/file_io/unix/mktemp.c @@ -46,11 +46,11 @@ * SUCH DAMAGE. */ -#include "apr_private.h" -#include "apr_file_io.h" /* prototype of apr_mkstemp() */ -#include "apr_strings.h" /* prototype of apr_mkstemp() */ -#include "apr_arch_file_io.h" /* prototype of apr_mkstemp() */ -#include "apr_portable.h" /* for apr_os_file_put() */ +#include "fspr_private.h" +#include "fspr_file_io.h" /* prototype of fspr_mkstemp() */ +#include "fspr_strings.h" /* prototype of fspr_mkstemp() */ +#include "fspr_arch_file_io.h" /* prototype of fspr_mkstemp() */ +#include "fspr_portable.h" /* for fspr_os_file_put() */ #ifndef HAVE_MKSTEMP @@ -89,18 +89,18 @@ static const unsigned char padchar[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; -static apr_uint32_t randseed=0; +static fspr_uint32_t randseed=0; -static int gettemp(char *path, apr_file_t **doopen, apr_int32_t flags, apr_pool_t *p) +static int gettemp(char *path, fspr_file_t **doopen, fspr_int32_t flags, fspr_pool_t *p) { register char *start, *trv, *suffp; char *pad; - apr_finfo_t sbuf; - apr_status_t rv; - apr_uint32_t randnum; + fspr_finfo_t sbuf; + fspr_status_t rv; + fspr_uint32_t randnum; if (randseed==0) { - randseed = (int)apr_time_now(); + randseed = (int)fspr_time_now(); seedrandom(randseed); } @@ -127,7 +127,7 @@ static int gettemp(char *path, apr_file_t **doopen, apr_int32_t flags, apr_pool_ break; if (*trv == '/') { *trv = '\0'; - rv = apr_stat(&sbuf, path, APR_FINFO_TYPE, p); + rv = fspr_stat(&sbuf, path, APR_FINFO_TYPE, p); *trv = '/'; if (rv != APR_SUCCESS) return rv; @@ -139,7 +139,7 @@ static int gettemp(char *path, apr_file_t **doopen, apr_int32_t flags, apr_pool_ } for (;;) { - if ((rv = apr_file_open(doopen, path, flags, + if ((rv = fspr_file_open(doopen, path, flags, APR_UREAD | APR_UWRITE, p)) == APR_SUCCESS) return APR_SUCCESS; if (!APR_STATUS_IS_EEXIST(rv)) @@ -172,7 +172,7 @@ static int gettemp(char *path, apr_file_t **doopen, apr_int32_t flags, apr_pool_ #endif #endif /* !defined(HAVE_MKSTEMP) */ -APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_int32_t flags, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_mktemp(fspr_file_t **fp, char *template, fspr_int32_t flags, fspr_pool_t *p) { #ifdef HAVE_MKSTEMP int fd; @@ -197,13 +197,13 @@ APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *template, apr_i * * We either have to unset the flags, or fix up the fd and other * xthread and inherit bits appropriately. Since gettemp() above - * calls apr_file_open, our flags are respected in that code path. + * calls fspr_file_open, our flags are respected in that code path. */ - apr_os_file_put(fp, &fd, flags, p); - (*fp)->fname = apr_pstrdup(p, template); + fspr_os_file_put(fp, &fd, flags, p); + (*fp)->fname = fspr_pstrdup(p, template); - apr_pool_cleanup_register((*fp)->pool, (void *)(*fp), - apr_unix_file_cleanup, apr_unix_file_cleanup); + fspr_pool_cleanup_register((*fp)->pool, (void *)(*fp), + fspr_unix_file_cleanup, fspr_unix_file_cleanup); #endif return APR_SUCCESS; } diff --git a/libs/apr/file_io/unix/open.c b/libs/apr/file_io/unix/open.c index ef3b9670ef..c2b9cd1c54 100644 --- a/libs/apr/file_io/unix/open.c +++ b/libs/apr/file_io/unix/open.c @@ -14,25 +14,25 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_thread_mutex.h" -#include "apr_arch_inherit.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_thread_mutex.h" +#include "fspr_arch_inherit.h" #ifdef NETWARE #include "nks/dirio.h" -#include "apr_hash.h" +#include "fspr_hash.h" #include "fsio.h" #endif -apr_status_t apr_unix_file_cleanup(void *thefile) +fspr_status_t fspr_unix_file_cleanup(void *thefile) { - apr_file_t *file = thefile; - apr_status_t flush_rv = APR_SUCCESS, rv = APR_SUCCESS; + fspr_file_t *file = thefile; + fspr_status_t flush_rv = APR_SUCCESS, rv = APR_SUCCESS; if (file->buffered) { - flush_rv = apr_file_flush(file); + flush_rv = fspr_file_flush(file); } if (close(file->filedes) == 0) { file->filedes = -1; @@ -41,7 +41,7 @@ apr_status_t apr_unix_file_cleanup(void *thefile) } #if APR_HAS_THREADS if (file->thlock) { - rv = apr_thread_mutex_destroy(file->thlock); + rv = fspr_thread_mutex_destroy(file->thlock); } #endif } @@ -51,9 +51,9 @@ apr_status_t apr_unix_file_cleanup(void *thefile) } #ifndef WAITIO_USES_POLL if (file->pollset != NULL) { - int pollset_rv = apr_pollset_destroy(file->pollset); + int pollset_rv = fspr_pollset_destroy(file->pollset); /* If the file close failed, return its error value, - * not apr_pollset_destroy()'s. + * not fspr_pollset_destroy()'s. */ if (rv == APR_SUCCESS) { rv = pollset_rv; @@ -63,17 +63,17 @@ apr_status_t apr_unix_file_cleanup(void *thefile) return rv != APR_SUCCESS ? rv : flush_rv; } -APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, +APR_DECLARE(fspr_status_t) fspr_file_open(fspr_file_t **new, const char *fname, - apr_int32_t flag, - apr_fileperms_t perm, - apr_pool_t *pool) + fspr_int32_t flag, + fspr_fileperms_t perm, + fspr_pool_t *pool) { - apr_os_file_t fd; + fspr_os_file_t fd; int oflags = 0; #if APR_HAS_THREADS - apr_thread_mutex_t *thlock; - apr_status_t rv; + fspr_thread_mutex_t *thlock; + fspr_status_t rv; #endif if ((flag & APR_READ) && (flag & APR_WRITE)) { @@ -121,7 +121,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, #if APR_HAS_THREADS if ((flag & APR_BUFFERED) && (flag & APR_XTHREAD)) { - rv = apr_thread_mutex_create(&thlock, + rv = fspr_thread_mutex_create(&thlock, APR_THREAD_MUTEX_DEFAULT, pool); if (rv) { return rv; @@ -133,24 +133,24 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, fd = open(fname, oflags, 0666); } else { - fd = open(fname, oflags, apr_unix_perms2mode(perm)); + fd = open(fname, oflags, fspr_unix_perms2mode(perm)); } if (fd < 0) { return errno; } - (*new) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t)); + (*new) = (fspr_file_t *)fspr_pcalloc(pool, sizeof(fspr_file_t)); (*new)->pool = pool; (*new)->flags = flag; (*new)->filedes = fd; - (*new)->fname = apr_pstrdup(pool, fname); + (*new)->fname = fspr_pstrdup(pool, fname); (*new)->blocking = BLK_ON; (*new)->buffered = (flag & APR_BUFFERED) > 0; if ((*new)->buffered) { - (*new)->buffer = apr_palloc(pool, APR_FILE_BUFSIZE); + (*new)->buffer = fspr_palloc(pool, APR_FILE_BUFSIZE); #if APR_HAS_THREADS if ((*new)->flags & APR_XTHREAD) { (*new)->thlock = thlock; @@ -170,25 +170,25 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, (*new)->dataRead = 0; (*new)->direction = 0; #ifndef WAITIO_USES_POLL - /* Start out with no pollset. apr_wait_for_io_or_timeout() will + /* Start out with no pollset. fspr_wait_for_io_or_timeout() will * initialize the pollset if needed. */ (*new)->pollset = NULL; #endif if (!(flag & APR_FILE_NOCLEANUP)) { - apr_pool_cleanup_register((*new)->pool, (void *)(*new), - apr_unix_file_cleanup, - apr_unix_file_cleanup); + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), + fspr_unix_file_cleanup, + fspr_unix_file_cleanup); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file) +APR_DECLARE(fspr_status_t) fspr_file_close(fspr_file_t *file) { - return apr_pool_cleanup_run(file->pool, file, apr_unix_file_cleanup); + return fspr_pool_cleanup_run(file->pool, file, fspr_unix_file_cleanup); } -APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_remove(const char *path, fspr_pool_t *pool) { if (unlink(path) == 0) { return APR_SUCCESS; @@ -198,9 +198,9 @@ APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool) } } -APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, +APR_DECLARE(fspr_status_t) fspr_file_rename(const char *from_path, const char *to_path, - apr_pool_t *p) + fspr_pool_t *p) { if (rename(from_path, to_path) != 0) { return errno; @@ -208,20 +208,20 @@ APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile, - apr_file_t *file) +APR_DECLARE(fspr_status_t) fspr_os_file_get(fspr_os_file_t *thefile, + fspr_file_t *file) { *thefile = file->filedes; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, - apr_os_file_t *thefile, - apr_int32_t flags, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_file_put(fspr_file_t **file, + fspr_os_file_t *thefile, + fspr_int32_t flags, fspr_pool_t *pool) { int *dafile = thefile; - (*file) = apr_pcalloc(pool, sizeof(apr_file_t)); + (*file) = fspr_pcalloc(pool, sizeof(fspr_file_t)); (*file)->pool = pool; (*file)->eof_hit = 0; (*file)->blocking = BLK_UNKNOWN; /* in case it is a pipe */ @@ -232,18 +232,18 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, (*file)->buffered = (flags & APR_BUFFERED) > 0; #ifndef WAITIO_USES_POLL - /* Start out with no pollset. apr_wait_for_io_or_timeout() will + /* Start out with no pollset. fspr_wait_for_io_or_timeout() will * initialize the pollset if needed. */ (*file)->pollset = NULL; #endif if ((*file)->buffered) { - (*file)->buffer = apr_palloc(pool, APR_FILE_BUFSIZE); + (*file)->buffer = fspr_palloc(pool, APR_FILE_BUFSIZE); #if APR_HAS_THREADS if ((*file)->flags & APR_XTHREAD) { - apr_status_t rv; - rv = apr_thread_mutex_create(&((*file)->thlock), + fspr_status_t rv; + rv = fspr_thread_mutex_create(&((*file)->thlock), APR_THREAD_MUTEX_DEFAULT, pool); if (rv) { return rv; @@ -254,7 +254,7 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr) +APR_DECLARE(fspr_status_t) fspr_file_eof(fspr_file_t *fptr) { if (fptr->eof_hit == 1) { return APR_EOF; @@ -262,32 +262,32 @@ APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stderr(fspr_file_t **thefile, + fspr_pool_t *pool) { int fd = STDERR_FILENO; - return apr_os_file_put(thefile, &fd, 0, pool); + return fspr_os_file_put(thefile, &fd, 0, pool); } -APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stdout(fspr_file_t **thefile, + fspr_pool_t *pool) { int fd = STDOUT_FILENO; - return apr_os_file_put(thefile, &fd, 0, pool); + return fspr_os_file_put(thefile, &fd, 0, pool); } -APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stdin(fspr_file_t **thefile, + fspr_pool_t *pool) { int fd = STDIN_FILENO; - return apr_os_file_put(thefile, &fd, 0, pool); + return fspr_os_file_put(thefile, &fd, 0, pool); } -APR_IMPLEMENT_INHERIT_SET(file, flags, pool, apr_unix_file_cleanup) +APR_IMPLEMENT_INHERIT_SET(file, flags, pool, fspr_unix_file_cleanup) -APR_IMPLEMENT_INHERIT_UNSET(file, flags, pool, apr_unix_file_cleanup) +APR_IMPLEMENT_INHERIT_UNSET(file, flags, pool, fspr_unix_file_cleanup) APR_POOL_IMPLEMENT_ACCESSOR(file) diff --git a/libs/apr/file_io/unix/pipe.c b/libs/apr/file_io/unix/pipe.c index 5411f5d407..66086fbbf0 100644 --- a/libs/apr/file_io/unix/pipe.c +++ b/libs/apr/file_io/unix/pipe.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_portable.h" -#include "apr_arch_inherit.h" +#include "fspr_arch_inherit.h" /* Figure out how to get pipe block/nonblock on BeOS... * Basically, BONE7 changed things again so that ioctl didn't work, @@ -33,7 +33,7 @@ #endif #endif -static apr_status_t pipeblock(apr_file_t *thepipe) +static fspr_status_t pipeblock(fspr_file_t *thepipe) { #if !BEOS_BLOCKING int fd_flags; @@ -69,7 +69,7 @@ static apr_status_t pipeblock(apr_file_t *thepipe) return APR_SUCCESS; } -static apr_status_t pipenonblock(apr_file_t *thepipe) +static fspr_status_t pipenonblock(fspr_file_t *thepipe) { #if !BEOS_BLOCKING int fd_flags = fcntl(thepipe->filedes, F_GETFL, 0); @@ -105,7 +105,7 @@ static apr_status_t pipenonblock(apr_file_t *thepipe) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_set(fspr_file_t *thepipe, fspr_interval_time_t timeout) { if (thepipe->is_pipe == 1) { thepipe->timeout = timeout; @@ -124,7 +124,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_int return APR_EINVAL; } -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t *timeout) +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_get(fspr_file_t *thepipe, fspr_interval_time_t *timeout) { if (thepipe->is_pipe == 1) { *timeout = thepipe->timeout; @@ -133,14 +133,14 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_int return APR_EINVAL; } -APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, - apr_os_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_os_pipe_put_ex(fspr_file_t **file, + fspr_os_file_t *thefile, int register_cleanup, - apr_pool_t *pool) + fspr_pool_t *pool) { int *dafile = thefile; - (*file) = apr_pcalloc(pool, sizeof(apr_file_t)); + (*file) = fspr_pcalloc(pool, sizeof(fspr_file_t)); (*file)->pool = pool; (*file)->eof_hit = 0; (*file)->is_pipe = 1; @@ -156,12 +156,12 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, (*file)->thlock = NULL; #endif if (register_cleanup) { - apr_pool_cleanup_register((*file)->pool, (void *)(*file), - apr_unix_file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*file)->pool, (void *)(*file), + fspr_unix_file_cleanup, + fspr_pool_cleanup_null); } #ifndef WAITIO_USES_POLL - /* Start out with no pollset. apr_wait_for_io_or_timeout() will + /* Start out with no pollset. fspr_wait_for_io_or_timeout() will * initialize the pollset if needed. */ (*file)->pollset = NULL; @@ -169,14 +169,14 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, - apr_os_file_t *thefile, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_pipe_put(fspr_file_t **file, + fspr_os_file_t *thefile, + fspr_pool_t *pool) { - return apr_os_pipe_put_ex(file, thefile, 0, pool); + return fspr_os_pipe_put_ex(file, thefile, 0, pool); } -APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_pipe_create(fspr_file_t **in, fspr_file_t **out, fspr_pool_t *pool) { int filedes[2]; @@ -184,7 +184,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out return errno; } - (*in) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t)); + (*in) = (fspr_file_t *)fspr_pcalloc(pool, sizeof(fspr_file_t)); (*in)->pool = pool; (*in)->filedes = filedes[0]; (*in)->is_pipe = 1; @@ -200,7 +200,7 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out #ifndef WAITIO_USES_POLL (*in)->pollset = NULL; #endif - (*out) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t)); + (*out) = (fspr_file_t *)fspr_pcalloc(pool, sizeof(fspr_file_t)); (*out)->pool = pool; (*out)->filedes = filedes[1]; (*out)->is_pipe = 1; @@ -215,17 +215,17 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out #ifndef WAITIO_USES_POLL (*out)->pollset = NULL; #endif - apr_pool_cleanup_register((*in)->pool, (void *)(*in), apr_unix_file_cleanup, - apr_pool_cleanup_null); - apr_pool_cleanup_register((*out)->pool, (void *)(*out), apr_unix_file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*in)->pool, (void *)(*in), fspr_unix_file_cleanup, + fspr_pool_cleanup_null); + fspr_pool_cleanup_register((*out)->pool, (void *)(*out), fspr_unix_file_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, - apr_fileperms_t perm, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_namedpipe_create(const char *filename, + fspr_fileperms_t perm, fspr_pool_t *pool) { - mode_t mode = apr_unix_perms2mode(perm); + mode_t mode = fspr_unix_perms2mode(perm); if (mkfifo(filename, mode) == -1) { return errno; diff --git a/libs/apr/file_io/unix/readwrite.c b/libs/apr/file_io/unix/readwrite.c index 1721582ba8..2006b6f274 100644 --- a/libs/apr/file_io/unix/readwrite.c +++ b/libs/apr/file_io/unix/readwrite.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_thread_mutex.h" -#include "apr_support.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_thread_mutex.h" +#include "fspr_support.h" /* The only case where we don't use wait_for_io_or_timeout is on * pre-BONE BeOS, so this check should be sufficient and simpler */ @@ -25,10 +25,10 @@ #define USE_WAIT_FOR_IO #endif -APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *nbytes) +APR_DECLARE(fspr_status_t) fspr_file_read(fspr_file_t *thefile, void *buf, fspr_size_t *nbytes) { - apr_ssize_t rv; - apr_size_t bytes_read; + fspr_ssize_t rv; + fspr_size_t bytes_read; if (*nbytes <= 0) { *nbytes = 0; @@ -37,21 +37,21 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size if (thefile->buffered) { char *pos = (char *)buf; - apr_uint64_t blocksize; - apr_uint64_t size = *nbytes; + fspr_uint64_t blocksize; + fspr_uint64_t size = *nbytes; #if APR_HAS_THREADS if (thefile->thlock) { - apr_thread_mutex_lock(thefile->thlock); + fspr_thread_mutex_lock(thefile->thlock); } #endif if (thefile->direction == 1) { - rv = apr_file_flush(thefile); + rv = fspr_file_flush(thefile); if (rv) { #if APR_HAS_THREADS if (thefile->thlock) { - apr_thread_mutex_unlock(thefile->thlock); + fspr_thread_mutex_unlock(thefile->thlock); } #endif return rv; @@ -98,7 +98,7 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size } #if APR_HAS_THREADS if (thefile->thlock) { - apr_thread_mutex_unlock(thefile->thlock); + fspr_thread_mutex_unlock(thefile->thlock); } #endif return rv; @@ -124,7 +124,7 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && thefile->timeout != 0) { - apr_status_t arv = apr_wait_for_io_or_timeout(thefile, NULL, 1); + fspr_status_t arv = fspr_wait_for_io_or_timeout(thefile, NULL, 1); if (arv != APR_SUCCESS) { *nbytes = bytes_read; return arv; @@ -149,9 +149,9 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size } } -APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, apr_size_t *nbytes) +APR_DECLARE(fspr_status_t) fspr_file_write(fspr_file_t *thefile, const void *buf, fspr_size_t *nbytes) { - apr_size_t rv; + fspr_size_t rv; if (thefile->buffered) { char *pos = (char *)buf; @@ -160,7 +160,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a #if APR_HAS_THREADS if (thefile->thlock) { - apr_thread_mutex_lock(thefile->thlock); + fspr_thread_mutex_lock(thefile->thlock); } #endif @@ -168,7 +168,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a /* Position file pointer for writing at the offset we are * logically reading from */ - apr_int64_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; + fspr_int64_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; if (offset != thefile->filePtr) lseek(thefile->filedes, offset, SEEK_SET); thefile->bufpos = thefile->dataRead = 0; @@ -178,7 +178,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a rv = 0; while (rv == 0 && size > 0) { if (thefile->bufpos == APR_FILE_BUFSIZE) /* write buffer is full*/ - rv = apr_file_flush(thefile); + rv = fspr_file_flush(thefile); blocksize = size > APR_FILE_BUFSIZE - thefile->bufpos ? APR_FILE_BUFSIZE - thefile->bufpos : size; @@ -190,7 +190,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a #if APR_HAS_THREADS if (thefile->thlock) { - apr_thread_mutex_unlock(thefile->thlock); + fspr_thread_mutex_unlock(thefile->thlock); } #endif return rv; @@ -198,12 +198,12 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a else { do { rv = write(thefile->filedes, buf, *nbytes); - } while (rv == (apr_size_t)-1 && errno == EINTR); + } while (rv == (fspr_size_t)-1 && errno == EINTR); #ifdef USE_WAIT_FOR_IO - if (rv == (apr_size_t)-1 && + if (rv == (fspr_size_t)-1 && (errno == EAGAIN || errno == EWOULDBLOCK) && thefile->timeout != 0) { - apr_status_t arv = apr_wait_for_io_or_timeout(thefile, NULL, 0); + fspr_status_t arv = fspr_wait_for_io_or_timeout(thefile, NULL, 0); if (arv != APR_SUCCESS) { *nbytes = 0; return arv; @@ -212,8 +212,8 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a do { do { rv = write(thefile->filedes, buf, *nbytes); - } while (rv == (apr_size_t)-1 && errno == EINTR); - if (rv == (apr_size_t)-1 && + } while (rv == (fspr_size_t)-1 && errno == EINTR); + if (rv == (fspr_size_t)-1 && (errno == EAGAIN || errno == EWOULDBLOCK)) { *nbytes /= 2; /* yes, we'll loop if kernel lied * and we can't even write 1 byte @@ -226,7 +226,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a } } #endif - if (rv == (apr_size_t)-1) { + if (rv == (fspr_size_t)-1) { (*nbytes) = 0; return errno; } @@ -235,8 +235,8 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a } } -APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iovec *vec, - apr_size_t nvec, apr_size_t *nbytes) +APR_DECLARE(fspr_status_t) fspr_file_writev(fspr_file_t *thefile, const struct iovec *vec, + fspr_size_t nvec, fspr_size_t *nbytes) { #ifdef HAVE_WRITEV int bytes; @@ -261,49 +261,49 @@ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, const struct iove * The only reasonable option, that maintains the semantics of a real * writev(), is to only write the first iovec. Callers of file_writev() * must deal with partial writes as they normally would. If you want to - * ensure an entire iovec is written, use apr_file_writev_full(). + * ensure an entire iovec is written, use fspr_file_writev_full(). */ *nbytes = vec[0].iov_len; - return apr_file_write(thefile, vec[0].iov_base, nbytes); + return fspr_file_write(thefile, vec[0].iov_base, nbytes); #endif } -APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_putc(char ch, fspr_file_t *thefile) { - apr_size_t nbytes = 1; + fspr_size_t nbytes = 1; - return apr_file_write(thefile, &ch, &nbytes); + return fspr_file_write(thefile, &ch, &nbytes); } -APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_ungetc(char ch, fspr_file_t *thefile) { thefile->ungetchar = (unsigned char)ch; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_getc(char *ch, fspr_file_t *thefile) { - apr_size_t nbytes = 1; + fspr_size_t nbytes = 1; - return apr_file_read(thefile, ch, &nbytes); + return fspr_file_read(thefile, ch, &nbytes); } -APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_puts(const char *str, fspr_file_t *thefile) { - return apr_file_write_full(thefile, str, strlen(str), NULL); + return fspr_file_write_full(thefile, str, strlen(str), NULL); } -APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_flush(fspr_file_t *thefile) { if (thefile->buffered) { - apr_int64_t written = 0; + fspr_int64_t written = 0; if (thefile->direction == 1 && thefile->bufpos) { do { written = write(thefile->filedes, thefile->buffer, thefile->bufpos); - } while (written == (apr_int64_t)-1 && errno == EINTR); - if (written == (apr_int64_t)-1) { + } while (written == (fspr_int64_t)-1 && errno == EINTR); + if (written == (fspr_int64_t)-1) { return errno; } thefile->filePtr += written; @@ -316,10 +316,10 @@ APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_gets(char *str, int len, fspr_file_t *thefile) { - apr_status_t rv = APR_SUCCESS; /* get rid of gcc warning */ - apr_size_t nbytes; + fspr_status_t rv = APR_SUCCESS; /* get rid of gcc warning */ + fspr_size_t nbytes; const char *str_start = str; char *final = str + len - 1; @@ -330,22 +330,22 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) } /* If we have an underlying buffer, we can be *much* more efficient - * and skip over the apr_file_read calls. + * and skip over the fspr_file_read calls. */ if (thefile->buffered) { #if APR_HAS_THREADS if (thefile->thlock) { - apr_thread_mutex_lock(thefile->thlock); + fspr_thread_mutex_lock(thefile->thlock); } #endif if (thefile->direction == 1) { - rv = apr_file_flush(thefile); + rv = fspr_file_flush(thefile); if (rv) { #if APR_HAS_THREADS if (thefile->thlock) { - apr_thread_mutex_unlock(thefile->thlock); + fspr_thread_mutex_unlock(thefile->thlock); } #endif return rv; @@ -357,14 +357,14 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) } while (str < final) { /* leave room for trailing '\0' */ - /* Force ungetc leftover to call apr_file_read. */ + /* Force ungetc leftover to call fspr_file_read. */ if (thefile->bufpos < thefile->dataRead && thefile->ungetchar == -1) { *str = thefile->buffer[thefile->bufpos++]; } else { nbytes = 1; - rv = apr_file_read(thefile, str, &nbytes); + rv = fspr_file_read(thefile, str, &nbytes); if (rv != APR_SUCCESS) { break; } @@ -378,14 +378,14 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) #if APR_HAS_THREADS if (thefile->thlock) { - apr_thread_mutex_unlock(thefile->thlock); + fspr_thread_mutex_unlock(thefile->thlock); } #endif } else { while (str < final) { /* leave room for trailing '\0' */ nbytes = 1; - rv = apr_file_read(thefile, str, &nbytes); + rv = fspr_file_read(thefile, str, &nbytes); if (rv != APR_SUCCESS) { break; } @@ -410,17 +410,17 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) return rv; } -struct apr_file_printf_data { - apr_vformatter_buff_t vbuff; - apr_file_t *fptr; +struct fspr_file_printf_data { + fspr_vformatter_buff_t vbuff; + fspr_file_t *fptr; char *buf; }; -static int file_printf_flush(apr_vformatter_buff_t *buff) +static int file_printf_flush(fspr_vformatter_buff_t *buff) { - struct apr_file_printf_data *data = (struct apr_file_printf_data *)buff; + struct fspr_file_printf_data *data = (struct fspr_file_printf_data *)buff; - if (apr_file_write_full(data->fptr, data->buf, + if (fspr_file_write_full(data->fptr, data->buf, data->vbuff.curpos - data->buf, NULL)) { return -1; } @@ -429,10 +429,10 @@ static int file_printf_flush(apr_vformatter_buff_t *buff) return 0; } -APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, +APR_DECLARE_NONSTD(int) fspr_file_printf(fspr_file_t *fptr, const char *format, ...) { - struct apr_file_printf_data data; + struct fspr_file_printf_data data; va_list ap; int count; @@ -445,10 +445,10 @@ APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, data.vbuff.endpos = data.buf + HUGE_STRING_LEN; data.fptr = fptr; va_start(ap, format); - count = apr_vformatter(file_printf_flush, - (apr_vformatter_buff_t *)&data, format, ap); - /* apr_vformatter does not call flush for the last bits */ - if (count >= 0) file_printf_flush((apr_vformatter_buff_t *)&data); + count = fspr_vformatter(file_printf_flush, + (fspr_vformatter_buff_t *)&data, format, ap); + /* fspr_vformatter does not call flush for the last bits */ + if (count >= 0) file_printf_flush((fspr_vformatter_buff_t *)&data); va_end(ap); diff --git a/libs/apr/file_io/unix/seek.c b/libs/apr/file_io/unix/seek.c index d1fe484627..c477d86e93 100644 --- a/libs/apr/file_io/unix/seek.c +++ b/libs/apr/file_io/unix/seek.c @@ -14,15 +14,15 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" -static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) +static fspr_status_t setptr(fspr_file_t *thefile, fspr_off_t pos ) { - apr_off_t newbufpos; - apr_status_t rv; + fspr_off_t newbufpos; + fspr_status_t rv; if (thefile->direction == 1) { - rv = apr_file_flush(thefile); + rv = fspr_file_flush(thefile); if (rv) { return rv; } @@ -49,15 +49,15 @@ static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) } -APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t where, apr_off_t *offset) +APR_DECLARE(fspr_status_t) fspr_file_seek(fspr_file_t *thefile, fspr_seek_where_t where, fspr_off_t *offset) { - apr_off_t rv; + fspr_off_t rv; thefile->eof_hit = 0; if (thefile->buffered) { int rc = EINVAL; - apr_finfo_t finfo; + fspr_finfo_t finfo; switch (where) { case APR_SET: @@ -69,7 +69,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh break; case APR_END: - rc = apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile); + rc = fspr_file_info_get(&finfo, APR_FINFO_SIZE, thefile); if (rc == APR_SUCCESS) rc = setptr(thefile, finfo.size + *offset); break; @@ -91,7 +91,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh } } -apr_status_t apr_file_trunc(apr_file_t *fp, apr_off_t offset) +fspr_status_t fspr_file_trunc(fspr_file_t *fp, fspr_off_t offset) { if (ftruncate(fp->filedes, offset) == -1) { return errno; diff --git a/libs/apr/file_io/unix/tempdir.c b/libs/apr/file_io/unix/tempdir.c index 1138e2c900..6a0091d5dc 100644 --- a/libs/apr/file_io/unix/tempdir.c +++ b/libs/apr/file_io/unix/tempdir.c @@ -13,22 +13,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#include "apr_private.h" -#include "apr_file_io.h" -#include "apr_strings.h" -#include "apr_env.h" +#include "fspr_private.h" +#include "fspr_file_io.h" +#include "fspr_strings.h" +#include "fspr_env.h" /* Try to open a temporary file in the temporary dir, write to it, and then close it. */ -static int test_tempdir(const char *temp_dir, apr_pool_t *p) +static int test_tempdir(const char *temp_dir, fspr_pool_t *p) { - apr_file_t *dummy_file; - char *path = apr_pstrcat(p, temp_dir, "/apr-tmp.XXXXXX", NULL); + fspr_file_t *dummy_file; + char *path = fspr_pstrcat(p, temp_dir, "/apr-tmp.XXXXXX", NULL); - if (apr_file_mktemp(&dummy_file, path, 0, p) == APR_SUCCESS) { - if (apr_file_putc('!', dummy_file) == APR_SUCCESS) { - if (apr_file_close(dummy_file) == APR_SUCCESS) { + if (fspr_file_mktemp(&dummy_file, path, 0, p) == APR_SUCCESS) { + if (fspr_file_putc('!', dummy_file) == APR_SUCCESS) { + if (fspr_file_close(dummy_file) == APR_SUCCESS) { return 1; } } @@ -37,10 +37,10 @@ static int test_tempdir(const char *temp_dir, apr_pool_t *p) } -APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_temp_dir_get(const char **temp_dir, + fspr_pool_t *p) { - apr_status_t apr_err; + fspr_status_t fspr_err; const char *try_dirs[] = { "/tmp", "/usr/tmp", "/var/tmp" }; const char *try_envs[] = { "TMP", "TEMP", "TMPDIR" }; const char *dir; @@ -69,9 +69,9 @@ APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir, /* Try the environment first. */ for (i = 0; i < (sizeof(try_envs) / sizeof(const char *)); i++) { char *value; - apr_err = apr_env_get(&value, try_envs[i], p); - if ((apr_err == APR_SUCCESS) && value) { - apr_size_t len = strlen(value); + fspr_err = fspr_env_get(&value, try_envs[i], p); + if ((fspr_err == APR_SUCCESS) && value) { + fspr_size_t len = strlen(value); if (len && (len < APR_PATH_MAX) && test_tempdir(value, p)) { dir = value; goto end; @@ -114,7 +114,7 @@ APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir, #endif /* Finally, try the current working directory. */ - if (APR_SUCCESS == apr_filepath_get(&cwd, APR_FILEPATH_NATIVE, p)) { + if (APR_SUCCESS == fspr_filepath_get(&cwd, APR_FILEPATH_NATIVE, p)) { if (test_tempdir(cwd, p)) { dir = cwd; goto end; @@ -125,6 +125,6 @@ APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir, return APR_EGENERAL; end: - *temp_dir = apr_pstrdup(p, dir); + *temp_dir = fspr_pstrdup(p, dir); return APR_SUCCESS; } diff --git a/libs/apr/file_io/win32/dir.c b/libs/apr/file_io/win32/dir.c index 76fe42bca8..809f9e08fd 100644 --- a/libs/apr/file_io/win32/dir.c +++ b/libs/apr/file_io/win32/dir.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_arch_atime.h" +#include "fspr.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_arch_atime.h" #if APR_HAVE_ERRNO_H #include @@ -35,27 +35,27 @@ #endif -static apr_status_t dir_cleanup(void *thedir) +static fspr_status_t dir_cleanup(void *thedir) { - apr_dir_t *dir = thedir; + fspr_dir_t *dir = thedir; if (dir->dirhand != INVALID_HANDLE_VALUE && !FindClose(dir->dirhand)) { - return apr_get_os_error(); + return fspr_get_os_error(); } dir->dirhand = INVALID_HANDLE_VALUE; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dir_open(fspr_dir_t **new, const char *dirname, + fspr_pool_t *pool) { - apr_status_t rv; + fspr_status_t rv; - apr_size_t len = strlen(dirname); - (*new) = apr_pcalloc(pool, sizeof(apr_dir_t)); + fspr_size_t len = strlen(dirname); + (*new) = fspr_pcalloc(pool, sizeof(fspr_dir_t)); /* Leave room here to add and pop the '*' wildcard for FindFirstFile * and double-null terminate so we have one character to change. */ - (*new)->dirname = apr_palloc(pool, len + 3); + (*new)->dirname = fspr_palloc(pool, len + 3); memcpy((*new)->dirname, dirname, len); if (len && (*new)->dirname[len - 1] != '/') { (*new)->dirname[len++] = '/'; @@ -68,8 +68,8 @@ APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, { /* Create a buffer for the longest file name we will ever see */ - (*new)->w.entry = apr_pcalloc(pool, sizeof(WIN32_FIND_DATAW)); - (*new)->name = apr_pcalloc(pool, APR_FILE_MAX * 3 + 1); + (*new)->w.entry = fspr_pcalloc(pool, sizeof(WIN32_FIND_DATAW)); + (*new)->name = fspr_pcalloc(pool, APR_FILE_MAX * 3 + 1); } #endif #if APR_HAS_ANSI_FS @@ -85,16 +85,16 @@ APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, (*new) = NULL; return APR_ENAMETOOLONG; } - (*new)->n.entry = apr_pcalloc(pool, sizeof(WIN32_FIND_DATAW)); + (*new)->n.entry = fspr_pcalloc(pool, sizeof(WIN32_FIND_DATAW)); } #endif (*new)->rootlen = len - 1; (*new)->pool = pool; (*new)->dirhand = INVALID_HANDLE_VALUE; - apr_pool_cleanup_register((*new)->pool, (void *)(*new), dir_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), dir_cleanup, + fspr_pool_cleanup_null); - rv = apr_dir_read(NULL, 0, *new); + rv = fspr_dir_read(NULL, 0, *new); if (rv != APR_SUCCESS) { dir_cleanup(*new); *new = NULL; @@ -103,33 +103,33 @@ APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new, const char *dirname, return rv; } -APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *dir) +APR_DECLARE(fspr_status_t) fspr_dir_close(fspr_dir_t *dir) { - apr_pool_cleanup_kill(dir->pool, dir, dir_cleanup); + fspr_pool_cleanup_kill(dir->pool, dir, dir_cleanup); return dir_cleanup(dir); } -APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, - apr_dir_t *thedir) +APR_DECLARE(fspr_status_t) fspr_dir_read(fspr_finfo_t *finfo, fspr_int32_t wanted, + fspr_dir_t *thedir) { - apr_status_t rv; + fspr_status_t rv; char *fname; /* The while loops below allow us to skip all invalid file names, so that * we aren't reporting any files where their absolute paths are too long. */ #if APR_HAS_UNICODE_FS - apr_wchar_t wdirname[APR_PATH_MAX]; - apr_wchar_t *eos = NULL; + fspr_wchar_t wdirname[APR_PATH_MAX]; + fspr_wchar_t *eos = NULL; IF_WIN_OS_IS_UNICODE { - /* This code path is always be invoked by apr_dir_open or - * apr_dir_rewind, so return without filling out the finfo. + /* This code path is always be invoked by fspr_dir_open or + * fspr_dir_rewind, so return without filling out the finfo. */ if (thedir->dirhand == INVALID_HANDLE_VALUE) { - apr_status_t rv; + fspr_status_t rv; if (rv = utf8_to_unicode_path(wdirname, sizeof(wdirname) - / sizeof(apr_wchar_t), + / sizeof(fspr_wchar_t), thedir->dirname)) { return rv; } @@ -139,27 +139,27 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, thedir->dirhand = FindFirstFileW(wdirname, thedir->w.entry); eos[0] = '\0'; if (thedir->dirhand == INVALID_HANDLE_VALUE) { - return apr_get_os_error(); + return fspr_get_os_error(); } thedir->bof = 1; return APR_SUCCESS; } else if (thedir->bof) { /* Noop - we already called FindFirstFileW from - * either apr_dir_open or apr_dir_rewind ... use + * either fspr_dir_open or fspr_dir_rewind ... use * that first record. */ thedir->bof = 0; } else if (!FindNextFileW(thedir->dirhand, thedir->w.entry)) { - return apr_get_os_error(); + return fspr_get_os_error(); } while (thedir->rootlen && thedir->rootlen + wcslen(thedir->w.entry->cFileName) >= APR_PATH_MAX) { if (!FindNextFileW(thedir->dirhand, thedir->w.entry)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } if (rv = unicode_to_utf8_path(thedir->name, APR_FILE_MAX * 3 + 1, @@ -171,8 +171,8 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, #if APR_HAS_ANSI_FS ELSE_WIN_OS_IS_ANSI { - /* This code path is always be invoked by apr_dir_open or - * apr_dir_rewind, so return without filling out the finfo. + /* This code path is always be invoked by fspr_dir_open or + * fspr_dir_rewind, so return without filling out the finfo. */ if (thedir->dirhand == INVALID_HANDLE_VALUE) { /* '/' terminated, so add the '*' and pop it when we finish */ @@ -183,26 +183,26 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, thedir->n.entry); eop[0] = '\0'; if (thedir->dirhand == INVALID_HANDLE_VALUE) { - return apr_get_os_error(); + return fspr_get_os_error(); } thedir->bof = 1; return APR_SUCCESS; } else if (thedir->bof) { /* Noop - we already called FindFirstFileW from - * either apr_dir_open or apr_dir_rewind ... use + * either fspr_dir_open or fspr_dir_rewind ... use * that first record. */ thedir->bof = 0; } else if (!FindNextFile(thedir->dirhand, thedir->n.entry)) { - return apr_get_os_error(); + return fspr_get_os_error(); } while (thedir->rootlen && thedir->rootlen + strlen(thedir->n.entry->cFileName) >= MAX_PATH) { if (!FindNextFileW(thedir->dirhand, thedir->w.entry)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } fname = thedir->n.entry->cFileName; @@ -244,11 +244,11 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, #else char fspec[APR_PATH_MAX]; #endif - apr_size_t dirlen = strlen(thedir->dirname); + fspr_size_t dirlen = strlen(thedir->dirname); if (dirlen >= sizeof(fspec)) dirlen = sizeof(fspec) - 1; - apr_cpystrn(fspec, thedir->dirname, sizeof(fspec)); - apr_cpystrn(fspec + dirlen, fname, sizeof(fspec) - dirlen); + fspr_cpystrn(fspec, thedir->dirname, sizeof(fspec)); + fspr_cpystrn(fspec + dirlen, fname, sizeof(fspec) - dirlen); return more_finfo(finfo, fspec, wanted, MORE_OF_FSPEC); } #endif @@ -257,66 +257,66 @@ APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *dir) +APR_DECLARE(fspr_status_t) fspr_dir_rewind(fspr_dir_t *dir) { - apr_status_t rv; + fspr_status_t rv; /* this will mark the handle as invalid and we'll open it - * again if apr_dir_read() is subsequently called + * again if fspr_dir_read() is subsequently called */ rv = dir_cleanup(dir); if (rv == APR_SUCCESS) - rv = apr_dir_read(NULL, 0, dir); + rv = fspr_dir_read(NULL, 0, dir); return rv; } -APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dir_make(const char *path, fspr_fileperms_t perm, + fspr_pool_t *pool) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wpath[APR_PATH_MAX]; - apr_status_t rv; + fspr_wchar_t wpath[APR_PATH_MAX]; + fspr_status_t rv; if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) { + / sizeof(fspr_wchar_t), path)) { return rv; } if (!CreateDirectoryW(wpath, NULL)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } #endif #if APR_HAS_ANSI_FS ELSE_WIN_OS_IS_ANSI if (!CreateDirectory(path, NULL)) { - return apr_get_os_error(); + return fspr_get_os_error(); } #endif return APR_SUCCESS; } -static apr_status_t dir_make_parent(char *path, - apr_fileperms_t perm, - apr_pool_t *pool) +static fspr_status_t dir_make_parent(char *path, + fspr_fileperms_t perm, + fspr_pool_t *pool) { - apr_status_t rv; + fspr_status_t rv; char *ch = strrchr(path, '\\'); if (!ch) { return APR_ENOENT; } *ch = '\0'; - rv = apr_dir_make (path, perm, pool); /* Try to make straight off */ + rv = fspr_dir_make (path, perm, pool); /* Try to make straight off */ if (APR_STATUS_IS_ENOENT(rv)) { /* Missing an intermediate dir */ rv = dir_make_parent(path, perm, pool); if (rv == APR_SUCCESS) { - rv = apr_dir_make (path, perm, pool); /* And complete the path */ + rv = fspr_dir_make (path, perm, pool); /* And complete the path */ } } @@ -324,13 +324,13 @@ static apr_status_t dir_make_parent(char *path, return rv; } -APR_DECLARE(apr_status_t) apr_dir_make_recursive(const char *path, - apr_fileperms_t perm, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dir_make_recursive(const char *path, + fspr_fileperms_t perm, + fspr_pool_t *pool) { - apr_status_t rv = 0; + fspr_status_t rv = 0; - rv = apr_dir_make (path, perm, pool); /* Try to make PATH right out */ + rv = fspr_dir_make (path, perm, pool); /* Try to make PATH right out */ if (APR_STATUS_IS_EEXIST(rv)) /* It's OK if PATH exists */ return APR_SUCCESS; @@ -338,45 +338,45 @@ APR_DECLARE(apr_status_t) apr_dir_make_recursive(const char *path, if (APR_STATUS_IS_ENOENT(rv)) { /* Missing an intermediate dir */ char *dir; - rv = apr_filepath_merge(&dir, "", path, APR_FILEPATH_NATIVE, pool); + rv = fspr_filepath_merge(&dir, "", path, APR_FILEPATH_NATIVE, pool); if (rv == APR_SUCCESS) rv = dir_make_parent(dir, perm, pool); /* Make intermediate dirs */ if (rv == APR_SUCCESS) - rv = apr_dir_make (dir, perm, pool); /* And complete the path */ + rv = fspr_dir_make (dir, perm, pool); /* And complete the path */ } return rv; } -APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_dir_remove(const char *path, fspr_pool_t *pool) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wpath[APR_PATH_MAX]; - apr_status_t rv; + fspr_wchar_t wpath[APR_PATH_MAX]; + fspr_status_t rv; if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) { + / sizeof(fspr_wchar_t), path)) { return rv; } if (!RemoveDirectoryW(wpath)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } #endif #if APR_HAS_ANSI_FS ELSE_WIN_OS_IS_ANSI if (!RemoveDirectory(path)) { - return apr_get_os_error(); + return fspr_get_os_error(); } #endif return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir, - apr_dir_t *dir) +APR_DECLARE(fspr_status_t) fspr_os_dir_get(fspr_os_dir_t **thedir, + fspr_dir_t *dir) { if (dir == NULL) { return APR_ENODIR; @@ -385,9 +385,9 @@ APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir, - apr_os_dir_t *thedir, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_dir_put(fspr_dir_t **dir, + fspr_os_dir_t *thedir, + fspr_pool_t *pool) { return APR_ENOTIMPL; } diff --git a/libs/apr/file_io/win32/filedup.c b/libs/apr/file_io/win32/filedup.c index 69e4d91347..f1d5cb08ea 100644 --- a/libs/apr/file_io/win32/filedup.c +++ b/libs/apr/file_io/win32/filedup.c @@ -14,15 +14,15 @@ * limitations under the License. */ -#include "win32/apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_strings.h" +#include "win32/fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" #include -#include "apr_arch_inherit.h" +#include "fspr_arch_inherit.h" -APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, - apr_file_t *old_file, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_dup(fspr_file_t **new_file, + fspr_file_t *old_file, fspr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -33,31 +33,31 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, if (!DuplicateHandle(hproc, old_file->filehand, hproc, &newhand, 0, FALSE, DUPLICATE_SAME_ACCESS)) { - return apr_get_os_error(); + return fspr_get_os_error(); } - (*new_file) = (apr_file_t *) apr_pcalloc(p, sizeof(apr_file_t)); + (*new_file) = (fspr_file_t *) fspr_pcalloc(p, sizeof(fspr_file_t)); (*new_file)->filehand = newhand; (*new_file)->flags = old_file->flags & ~APR_INHERIT; (*new_file)->pool = p; - (*new_file)->fname = apr_pstrdup(p, old_file->fname); + (*new_file)->fname = fspr_pstrdup(p, old_file->fname); (*new_file)->append = old_file->append; (*new_file)->buffered = FALSE; (*new_file)->ungetchar = old_file->ungetchar; #if APR_HAS_THREADS if (old_file->mutex) { - apr_thread_mutex_create(&((*new_file)->mutex), + fspr_thread_mutex_create(&((*new_file)->mutex), APR_THREAD_MUTEX_DEFAULT, p); } #endif - apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), file_cleanup, + fspr_pool_cleanup_null); /* Create a pollset with room for one descriptor. */ /* ### check return codes */ - (void) apr_pollset_create(&(*new_file)->pollset, 1, p, 0); + (void) fspr_pollset_create(&(*new_file)->pollset, 1, p, 0); return APR_SUCCESS; #endif /* !defined(_WIN32_WCE) */ @@ -67,8 +67,8 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, #define stdout_handle 0x02 #define stderr_handle 0x04 -APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, - apr_file_t *old_file, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_dup2(fspr_file_t *new_file, + fspr_file_t *old_file, fspr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -76,7 +76,7 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, DWORD stdhandle = 0; HANDLE hproc = GetCurrentProcess(); HANDLE newhand = NULL; - apr_int32_t newflags; + fspr_int32_t newflags; /* dup2 is not supported literaly with native Windows handles. * We can, however, emulate dup2 for the standard i/o handles, @@ -97,12 +97,12 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, if (!DuplicateHandle(hproc, old_file->filehand, hproc, &newhand, 0, TRUE, DUPLICATE_SAME_ACCESS)) { - return apr_get_os_error(); + return fspr_get_os_error(); } if (((stdhandle & stderr_handle) && !SetStdHandle(STD_ERROR_HANDLE, newhand)) || ((stdhandle & stdout_handle) && !SetStdHandle(STD_OUTPUT_HANDLE, newhand)) || ((stdhandle & stdin_handle) && !SetStdHandle(STD_INPUT_HANDLE, newhand))) { - return apr_get_os_error(); + return fspr_get_os_error(); } newflags = old_file->flags | APR_INHERIT; } @@ -110,7 +110,7 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, if (!DuplicateHandle(hproc, old_file->filehand, hproc, &newhand, 0, FALSE, DUPLICATE_SAME_ACCESS)) { - return apr_get_os_error(); + return fspr_get_os_error(); } newflags = old_file->flags & ~APR_INHERIT; } @@ -121,14 +121,14 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, new_file->flags = newflags; new_file->filehand = newhand; - new_file->fname = apr_pstrdup(new_file->pool, old_file->fname); + new_file->fname = fspr_pstrdup(new_file->pool, old_file->fname); new_file->append = old_file->append; new_file->buffered = FALSE; new_file->ungetchar = old_file->ungetchar; #if APR_HAS_THREADS if (old_file->mutex) { - apr_thread_mutex_create(&(new_file->mutex), + fspr_thread_mutex_create(&(new_file->mutex), APR_THREAD_MUTEX_DEFAULT, p); } #endif @@ -137,15 +137,15 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, #endif /* !defined(_WIN32_WCE) */ } -APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, - apr_file_t *old_file, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_setaside(fspr_file_t **new_file, + fspr_file_t *old_file, + fspr_pool_t *p) { - *new_file = (apr_file_t *)apr_palloc(p, sizeof(apr_file_t)); - memcpy(*new_file, old_file, sizeof(apr_file_t)); + *new_file = (fspr_file_t *)fspr_palloc(p, sizeof(fspr_file_t)); + memcpy(*new_file, old_file, sizeof(fspr_file_t)); (*new_file)->pool = p; if (old_file->buffered) { - (*new_file)->buffer = apr_palloc(p, APR_FILE_BUFSIZE); + (*new_file)->buffer = fspr_palloc(p, APR_FILE_BUFSIZE); if (old_file->direction == 1) { memcpy((*new_file)->buffer, old_file->buffer, old_file->bufpos); } @@ -154,26 +154,26 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, } } if (old_file->mutex) { - apr_thread_mutex_create(&((*new_file)->mutex), + fspr_thread_mutex_create(&((*new_file)->mutex), APR_THREAD_MUTEX_DEFAULT, p); - apr_thread_mutex_destroy(old_file->mutex); + fspr_thread_mutex_destroy(old_file->mutex); } if (old_file->fname) { - (*new_file)->fname = apr_pstrdup(p, old_file->fname); + (*new_file)->fname = fspr_pstrdup(p, old_file->fname); } if (!(old_file->flags & APR_FILE_NOCLEANUP)) { - apr_pool_cleanup_register(p, (void *)(*new_file), + fspr_pool_cleanup_register(p, (void *)(*new_file), file_cleanup, file_cleanup); } old_file->filehand = INVALID_HANDLE_VALUE; - apr_pool_cleanup_kill(old_file->pool, (void *)old_file, + fspr_pool_cleanup_kill(old_file->pool, (void *)old_file, file_cleanup); /* Create a pollset with room for one descriptor. */ /* ### check return codes */ - (void) apr_pollset_create(&(*new_file)->pollset, 1, p, 0); + (void) fspr_pollset_create(&(*new_file)->pollset, 1, p, 0); return APR_SUCCESS; } diff --git a/libs/apr/file_io/win32/filepath.c b/libs/apr/file_io/win32/filepath.c index 766e35f8d8..353cb2649e 100644 --- a/libs/apr/file_io/win32/filepath.c +++ b/libs/apr/file_io/win32/filepath.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_lib.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_lib.h" #include #include @@ -37,10 +37,10 @@ * OS2 appears immune from the nonsense :) */ -APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, +APR_DECLARE(fspr_status_t) fspr_filepath_root(const char **rootpath, const char **inpath, - apr_int32_t flags, - apr_pool_t *p) + fspr_int32_t flags, + fspr_pool_t *p) { const char *testpath = *inpath; char *newpath; @@ -78,7 +78,7 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, Otherwise we either have an incomplete or relative path */ if (volume && strlen(volume) > 0) { - newpath = apr_pcalloc(p, strlen(server)+strlen(volume)+5); + newpath = fspr_pcalloc(p, strlen(server)+strlen(volume)+5); construct(newpath, server, volume, NULL, NULL, NULL, PATH_NETWARE); /* NetWare doesn't add the root slash so we need to add it manually. @@ -106,7 +106,7 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, in same manner as unix although this path will be incomplete. */ - *rootpath = apr_pstrdup(p, seperator); + *rootpath = fspr_pstrdup(p, seperator); do { ++(*inpath); } while ((**inpath == '/') || (**inpath == '\\')); @@ -133,12 +133,12 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, && (testpath[3] == '/' || testpath[3] == '\\')) { if (IS_FNCHAR(testpath[4]) && testpath[5] == ':') { - apr_status_t rv; + fspr_status_t rv; testpath += 4; /* given '//?/C: or //./C: let us try this * all over again from the drive designator */ - rv = apr_filepath_root(rootpath, &testpath, flags, p); + rv = fspr_filepath_root(rootpath, &testpath, flags, p); if (!rv || rv == APR_EINCOMPLETE) *inpath = testpath; return rv; @@ -170,7 +170,7 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, } while (*delim1 && *delim1 != '/' && *delim1 != '\\'); if (*delim1) { - apr_status_t rv; + fspr_status_t rv; delim2 = delim1 + 1; while (*delim2 && *delim2 != '/' && *delim2 != '\\') { /* Protect against //machine/X/ where X is illegal */ @@ -181,7 +181,7 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, /* Copy the '//machine/[share[/]]' path, always providing * an extra byte for the trailing slash. */ - newpath = apr_pstrmemdup(p, testpath, delim2 - testpath + 1); + newpath = fspr_pstrmemdup(p, testpath, delim2 - testpath + 1); if (delim2 == delim1 + 1) { /* We found simply \\machine\, so give up already @@ -196,7 +196,7 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, * Win32 will argue about slashed in UNC paths, * so use backslashes till we finish testing, * and add the trailing backslash [required]. - * apr_pstrmemdup above guarentees us the new + * fspr_pstrmemdup above guarentees us the new * trailing null character. */ newpath[0] = '\\'; @@ -246,7 +246,7 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, */ delim1 = strchr(testpath, '\0'); if (delim1 > testpath + 2) { - newpath = apr_pstrndup(p, testpath, delim1 - testpath + 1); + newpath = fspr_pstrndup(p, testpath, delim1 - testpath + 1); if (flags & APR_FILEPATH_TRUENAME) newpath[delim1 - testpath] = seperator[0]; else @@ -254,7 +254,7 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, newpath[delim1 - testpath + 1] = '\0'; } else { - newpath = apr_pstrndup(p, testpath, delim1 - testpath); + newpath = fspr_pstrndup(p, testpath, delim1 - testpath); } if (flags & APR_FILEPATH_TRUENAME) { newpath[0] = seperator[0]; @@ -268,7 +268,7 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, /* Left with a path of '/', what drive are we asking about? */ *inpath = testpath + 1; - newpath = apr_palloc(p, 2); + newpath = fspr_palloc(p, 2); if (flags & APR_FILEPATH_TRUENAME) newpath[0] = seperator[0]; else @@ -281,20 +281,20 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, /* Evaluate path of 'd:[/]' */ if (IS_FNCHAR(*testpath) && testpath[1] == ':') { - apr_status_t rv; + fspr_status_t rv; /* Validate that D:\ drive exists, test must be rooted * Note that posix/win32 insists a drive letter is upper case, * so who are we to argue with a 'feature'. * It is a safe fold, since only A-Z is legal, and has no * side effects of legal mis-mapped non-us-ascii codes. */ - newpath = apr_palloc(p, 4); + newpath = fspr_palloc(p, 4); newpath[0] = testpath[0]; newpath[1] = testpath[1]; newpath[2] = seperator[0]; newpath[3] = '\0'; if (flags & APR_FILEPATH_TRUENAME) { - newpath[0] = apr_toupper(newpath[0]); + newpath[0] = fspr_toupper(newpath[0]); rv = filepath_root_test(newpath, p); if (rv) return rv; @@ -328,24 +328,24 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, } -APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, +APR_DECLARE(fspr_status_t) fspr_filepath_merge(char **newpath, const char *basepath, const char *addpath, - apr_int32_t flags, - apr_pool_t *p) + fspr_int32_t flags, + fspr_pool_t *p) { char path[APR_PATH_MAX]; /* isn't null term */ const char *baseroot = NULL; const char *addroot; - apr_size_t rootlen; /* the length of the root portion of path, d:/ is 3 */ - apr_size_t baselen; /* the length of basepath (excluding baseroot) */ - apr_size_t keptlen; /* the length of the retained basepath (incl root) */ - apr_size_t pathlen; /* the length of the result path */ - apr_size_t segend; /* the end of the current segment */ - apr_size_t seglen; /* the length of the segment (excl trailing chars) */ - apr_status_t basetype = 0; /* from parsing the basepath's baseroot */ - apr_status_t addtype; /* from parsing the addpath's addroot */ - apr_status_t rv; + fspr_size_t rootlen; /* the length of the root portion of path, d:/ is 3 */ + fspr_size_t baselen; /* the length of basepath (excluding baseroot) */ + fspr_size_t keptlen; /* the length of the retained basepath (incl root) */ + fspr_size_t pathlen; /* the length of the result path */ + fspr_size_t segend; /* the end of the current segment */ + fspr_size_t seglen; /* the length of the segment (excl trailing chars) */ + fspr_status_t basetype = 0; /* from parsing the basepath's baseroot */ + fspr_status_t addtype; /* from parsing the addpath's addroot */ + fspr_status_t rv; #ifndef NETWARE int fixunc = 0; /* flag to complete an incomplete UNC basepath */ #endif @@ -359,7 +359,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, else { /* This call _should_ test the path */ - addtype = apr_filepath_root(&addroot, &addpath, + addtype = fspr_filepath_root(&addroot, &addpath, APR_FILEPATH_TRUENAME | (flags & APR_FILEPATH_NATIVE), p); @@ -370,7 +370,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, addroot = ""; } else if (addtype != APR_EINCOMPLETE) { - /* apr_filepath_root was incomprehensible so fail already + /* fspr_filepath_root was incomprehensible so fail already */ return addtype; } @@ -425,7 +425,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, rv = filepath_drive_get(&getpath, addroot[0], flags, p); else #endif - rv = apr_filepath_get(&getpath, flags, p); + rv = fspr_filepath_get(&getpath, flags, p); if (rv != APR_SUCCESS) return rv; basepath = getpath; @@ -434,7 +434,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, if (!baseroot) { /* This call should _not_ test the path */ - basetype = apr_filepath_root(&baseroot, &basepath, + basetype = fspr_filepath_root(&baseroot, &basepath, (flags & APR_FILEPATH_NATIVE), p); if (basetype == APR_SUCCESS) { basetype = APR_EABSOLUTE; @@ -443,7 +443,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, baseroot = ""; } else if (basetype != APR_EINCOMPLETE) { - /* apr_filepath_root was incomprehensible so fail already + /* fspr_filepath_root was incomprehensible so fail already */ return basetype; } @@ -740,8 +740,8 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, if (fixunc) { const char *testpath = path; const char *testroot; - apr_status_t testtype; - apr_size_t i = (addpath[segend] != '\0'); + fspr_status_t testtype; + fspr_size_t i = (addpath[segend] != '\0'); /* This isn't legal unless the unc path is complete! */ @@ -764,7 +764,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, path[pathlen] = '\0'; /* This call _should_ test the path */ - testtype = apr_filepath_root(&testroot, &testpath, + testtype = fspr_filepath_root(&testroot, &testpath, APR_FILEPATH_TRUENAME | (flags & APR_FILEPATH_NATIVE), p); @@ -774,7 +774,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, fixunc = 0; } else if (testtype != APR_EINCOMPLETE) { - /* apr_filepath_root was very unexpected so fail already + /* fspr_filepath_root was very unexpected so fail already */ return testtype; } @@ -784,7 +784,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, { /* An actual segment, append it to the destination path */ - apr_size_t i = (addpath[segend] != '\0'); + fspr_size_t i = (addpath[segend] != '\0'); if (pathlen + seglen + i >= sizeof(path)) return APR_ENAMETOOLONG; memcpy(path + pathlen, addpath, seglen + i); @@ -835,7 +835,7 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, } /* Go through all the new segments */ while (keptlen < pathlen) { - apr_finfo_t finfo; + fspr_finfo_t finfo; char saveslash = 0; seglen = 0; /* find any slash and set it aside for a minute. */ @@ -848,10 +848,10 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, } /* Null term for stat! */ path[keptlen + seglen] = '\0'; - if ((rv = apr_stat(&finfo, path, + if ((rv = fspr_stat(&finfo, path, APR_FINFO_LINK | APR_FINFO_TYPE | APR_FINFO_NAME, p)) == APR_SUCCESS) { - apr_size_t namelen = strlen(finfo.name); + fspr_size_t namelen = strlen(finfo.name); #if defined(OS2) /* only has case folding, never aliases that change the length */ @@ -949,28 +949,28 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, } } - *newpath = apr_pmemdup(p, path, pathlen + 1); + *newpath = fspr_pmemdup(p, path, pathlen + 1); (*newpath)[pathlen] = '\0'; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts, +APR_DECLARE(fspr_status_t) fspr_filepath_list_split(fspr_array_header_t **pathelts, const char *liststr, - apr_pool_t *p) + fspr_pool_t *p) { - return apr_filepath_list_split_impl(pathelts, liststr, ';', p); + return fspr_filepath_list_split_impl(pathelts, liststr, ';', p); } -APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr, - apr_array_header_t *pathelts, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_list_merge(char **liststr, + fspr_array_header_t *pathelts, + fspr_pool_t *p) { - return apr_filepath_list_merge_impl(liststr, pathelts, ';', p); + return fspr_filepath_list_merge_impl(liststr, pathelts, ';', p); } -APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_encoding(int *style, fspr_pool_t *p) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE diff --git a/libs/apr/file_io/win32/filestat.c b/libs/apr/file_io/win32/filestat.c index af93bb933b..1972ccf3b3 100644 --- a/libs/apr/file_io/win32/filestat.c +++ b/libs/apr/file_io/win32/filestat.c @@ -14,28 +14,28 @@ * limitations under the License. */ -#include "apr.h" +#include "fspr.h" #include -#include "apr_private.h" -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_errno.h" -#include "apr_time.h" +#include "fspr_private.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_errno.h" +#include "fspr_time.h" #include -#include "apr_arch_atime.h" -#include "apr_arch_misc.h" +#include "fspr_arch_atime.h" +#include "fspr_arch_misc.h" /* We have to assure that the file name contains no '*'s, or other * wildcards when using FindFirstFile to recover the true file name. */ -static apr_status_t test_safe_name(const char *name) +static fspr_status_t test_safe_name(const char *name) { /* Only accept ':' in the second position of the filename, * as the drive letter delimiter: */ - if (apr_isalpha(*name) && (name[1] == ':')) { + if (fspr_isalpha(*name) && (name[1] == ':')) { name += 2; } while (*name) { @@ -50,12 +50,12 @@ static apr_status_t test_safe_name(const char *name) return APR_SUCCESS; } -static apr_status_t free_localheap(void *heap) { +static fspr_status_t free_localheap(void *heap) { LocalFree(heap); return APR_SUCCESS; } -static apr_gid_t worldid = NULL; +static fspr_gid_t worldid = NULL; static void free_world(void) { @@ -72,13 +72,13 @@ typedef enum prot_scope_e { prot_scope_user = 8 } prot_scope_e; -static apr_fileperms_t convert_prot(ACCESS_MASK acc, prot_scope_e scope) +static fspr_fileperms_t convert_prot(ACCESS_MASK acc, prot_scope_e scope) { /* These choices are based on the single filesystem bit that controls * the given behavior. They are -not- recommended for any set protection * function, such a function should -set- use GENERIC_READ/WRITE/EXECUTE */ - apr_fileperms_t prot = 0; + fspr_fileperms_t prot = 0; if (acc & FILE_EXECUTE) prot |= APR_WEXECUTE; if (acc & FILE_WRITE_DATA) @@ -88,7 +88,7 @@ static apr_fileperms_t convert_prot(ACCESS_MASK acc, prot_scope_e scope) return (prot << scope); } -static void resolve_prot(apr_finfo_t *finfo, apr_int32_t wanted, PACL dacl) +static void resolve_prot(fspr_finfo_t *finfo, fspr_int32_t wanted, PACL dacl) { TRUSTEE_W ident = {NULL, NO_MULTIPLE_TRUSTEE, TRUSTEE_IS_SID}; ACCESS_MASK acc; @@ -139,11 +139,11 @@ static void resolve_prot(apr_finfo_t *finfo, apr_int32_t wanted, PACL dacl) } } -static apr_status_t resolve_ident(apr_finfo_t *finfo, const char *fname, - apr_int32_t wanted, apr_pool_t *pool) +static fspr_status_t resolve_ident(fspr_finfo_t *finfo, const char *fname, + fspr_int32_t wanted, fspr_pool_t *pool) { - apr_file_t *thefile = NULL; - apr_status_t rv; + fspr_file_t *thefile = NULL; + fspr_status_t rv; /* * NT5 (W2K) only supports symlinks in the same manner as mount points. * This code should eventually take that into account, for now treat @@ -153,28 +153,28 @@ static apr_status_t resolve_ident(apr_finfo_t *finfo, const char *fname, * user, group or permissions. */ - if ((rv = apr_file_open(&thefile, fname, APR_OPENINFO + if ((rv = fspr_file_open(&thefile, fname, APR_OPENINFO | ((wanted & APR_FINFO_LINK) ? APR_OPENLINK : 0) | ((wanted & (APR_FINFO_PROT | APR_FINFO_OWNER)) ? APR_READCONTROL : 0), APR_OS_DEFAULT, pool)) == APR_SUCCESS) { - rv = apr_file_info_get(finfo, wanted, thefile); + rv = fspr_file_info_get(finfo, wanted, thefile); finfo->filehand = NULL; - apr_file_close(thefile); + fspr_file_close(thefile); } else if (APR_STATUS_IS_EACCES(rv) && (wanted & (APR_FINFO_PROT | APR_FINFO_OWNER))) { /* We have a backup plan. Perhaps we couldn't grab READ_CONTROL? * proceed without asking for that permission... */ - if ((rv = apr_file_open(&thefile, fname, APR_OPENINFO + if ((rv = fspr_file_open(&thefile, fname, APR_OPENINFO | ((wanted & APR_FINFO_LINK) ? APR_OPENLINK : 0), APR_OS_DEFAULT, pool)) == APR_SUCCESS) { - rv = apr_file_info_get(finfo, wanted & ~(APR_FINFO_PROT + rv = fspr_file_info_get(finfo, wanted & ~(APR_FINFO_PROT | APR_FINFO_OWNER), thefile); finfo->filehand = NULL; - apr_file_close(thefile); + fspr_file_close(thefile); } } @@ -188,7 +188,7 @@ static apr_status_t resolve_ident(apr_finfo_t *finfo, const char *fname, return rv; } -static void guess_protection_bits(apr_finfo_t *finfo) +static void guess_protection_bits(fspr_finfo_t *finfo) { /* Read, write execute for owner. In the Win9x environment, any * readable file is executable (well, not entirely 100% true, but @@ -207,20 +207,20 @@ static void guess_protection_bits(apr_finfo_t *finfo) finfo->valid |= APR_FINFO_UPROT | APR_FINFO_GPROT | APR_FINFO_WPROT; } -apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile, - apr_int32_t wanted, int whatfile) +fspr_status_t more_finfo(fspr_finfo_t *finfo, const void *ufile, + fspr_int32_t wanted, int whatfile) { PSID user = NULL, grp = NULL; PACL dacl = NULL; - apr_status_t rv; + fspr_status_t rv; - if (apr_os_level < APR_WIN_NT) + if (fspr_os_level < APR_WIN_NT) guess_protection_bits(finfo); else if (wanted & (APR_FINFO_PROT | APR_FINFO_OWNER)) { /* On NT this request is incredibly expensive, but accurate. * Since the WinNT-only functions below are protected by the - * (apr_os_level < APR_WIN_NT) case above, we need no extra + * (fspr_os_level < APR_WIN_NT) case above, we need no extra * tests, but remember GetNamedSecurityInfo & GetSecurityInfo * are not supported on 9x. */ @@ -233,7 +233,7 @@ apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile, if (wanted & APR_FINFO_PROT) sinf |= DACL_SECURITY_INFORMATION; if (whatfile == MORE_OF_WFSPEC) { - apr_wchar_t *wfile = (apr_wchar_t*) ufile; + fspr_wchar_t *wfile = (fspr_wchar_t*) ufile; int fix = 0; if (wcsncmp(wfile, L"\\\\?\\", 4) == 0) { fix = 4; @@ -266,8 +266,8 @@ apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile, else return APR_INCOMPLETE; if (rv == ERROR_SUCCESS) - apr_pool_cleanup_register(finfo->pool, pdesc, free_localheap, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(finfo->pool, pdesc, free_localheap, + fspr_pool_cleanup_null); else user = grp = dacl = NULL; @@ -303,9 +303,9 @@ apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile, * if this is a CHR filetype. If it's reasonably certain it can't be, * then the function returns 0. */ -int fillin_fileinfo(apr_finfo_t *finfo, +int fillin_fileinfo(fspr_finfo_t *finfo, WIN32_FILE_ATTRIBUTE_DATA *wininfo, - int byhandle, apr_int32_t wanted) + int byhandle, fspr_int32_t wanted) { DWORD *sizes = &wininfo->nFileSizeHigh + byhandle; int warn = 0; @@ -317,10 +317,10 @@ int fillin_fileinfo(apr_finfo_t *finfo, FileTimeToAprTime(&finfo->mtime, &wininfo->ftLastWriteTime); #if APR_HAS_LARGE_FILES - finfo->size = (apr_off_t)sizes[1] - | ((apr_off_t)sizes[0] << 32); + finfo->size = (fspr_off_t)sizes[1] + | ((fspr_off_t)sizes[0] << 32); #else - finfo->size = (apr_off_t)sizes[1]; + finfo->size = (fspr_off_t)sizes[1]; if (finfo->size < 0 || sizes[0]) finfo->size = 0x7fffffff; #endif @@ -369,20 +369,20 @@ int fillin_fileinfo(apr_finfo_t *finfo, } -APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, apr_int32_t wanted, - apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_info_get(fspr_finfo_t *finfo, fspr_int32_t wanted, + fspr_file_t *thefile) { BY_HANDLE_FILE_INFORMATION FileInfo; if (thefile->buffered) { /* XXX: flush here is not mutex protected */ - apr_status_t rv = apr_file_flush(thefile); + fspr_status_t rv = fspr_file_flush(thefile); if (rv != APR_SUCCESS) return rv; } if (!GetFileInformationByHandle(thefile->filehand, &FileInfo)) { - return apr_get_os_error(); + return fspr_get_os_error(); } fillin_fileinfo(finfo, (WIN32_FILE_ATTRIBUTE_DATA *) &FileInfo, 1, wanted); @@ -416,8 +416,8 @@ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, apr_int32_t want finfo->fname = thefile->fname; /* Extra goodies known only by GetFileInformationByHandle() */ - finfo->inode = (apr_ino_t)FileInfo.nFileIndexLow - | ((apr_ino_t)FileInfo.nFileIndexHigh << 32); + finfo->inode = (fspr_ino_t)FileInfo.nFileIndexLow + | ((fspr_ino_t)FileInfo.nFileIndexHigh << 32); finfo->device = FileInfo.dwVolumeSerialNumber; finfo->nlink = FileInfo.nNumberOfLinks; @@ -432,21 +432,21 @@ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, apr_int32_t want return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, - apr_fileperms_t perms) +APR_DECLARE(fspr_status_t) fspr_file_perms_set(const char *fname, + fspr_fileperms_t perms) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, - apr_int32_t wanted, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_stat(fspr_finfo_t *finfo, const char *fname, + fspr_int32_t wanted, fspr_pool_t *pool) { /* XXX: is constant - needs testing - which requires a lighter-weight root test fn */ int isroot = 0; - apr_status_t ident_rv = 0; - apr_status_t rv; + fspr_status_t ident_rv = 0; + fspr_status_t rv; #if APR_HAS_UNICODE_FS - apr_wchar_t wfname[APR_PATH_MAX]; + fspr_wchar_t wfname[APR_PATH_MAX]; #endif char *filename = NULL; @@ -489,12 +489,12 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, } if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) - / sizeof(apr_wchar_t), fname)) + / sizeof(fspr_wchar_t), fname)) return rv; if (!(wanted & APR_FINFO_NAME)) { if (!GetFileAttributesExW(wfname, GetFileExInfoStandard, &FileInfo.i)) - return apr_get_os_error(); + return fspr_get_os_error(); } else { /* Guard against bogus wildcards and retrieve by name @@ -508,13 +508,13 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, } hFind = FindFirstFileW(wfname, &FileInfo.w); if (hFind == INVALID_HANDLE_VALUE) - return apr_get_os_error(); + return fspr_get_os_error(); FindClose(hFind); if (unicode_to_utf8_path(tmpname, sizeof(tmpname), FileInfo.w.cFileName)) { return APR_ENAMETOOLONG; } - filename = apr_pstrdup(pool, tmpname); + filename = fspr_pstrdup(pool, tmpname); } } #endif @@ -523,17 +523,17 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, { char *root = NULL; const char *test = fname; - rv = apr_filepath_root(&root, &test, APR_FILEPATH_NATIVE, pool); + rv = fspr_filepath_root(&root, &test, APR_FILEPATH_NATIVE, pool); isroot = (root && *root && !(*test)); - if ((apr_os_level >= APR_WIN_98) && (!(wanted & APR_FINFO_NAME) || isroot)) + if ((fspr_os_level >= APR_WIN_98) && (!(wanted & APR_FINFO_NAME) || isroot)) { /* cannot use FindFile on a Win98 root, it returns \* * GetFileAttributesExA is not available on Win95 */ if (!GetFileAttributesExA(fname, GetFileExInfoStandard, &FileInfo.i)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } else if (isroot) { @@ -543,7 +543,7 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, { finfo->pool = pool; finfo->filetype = 0; - finfo->mtime = apr_time_now(); + finfo->mtime = fspr_time_now(); finfo->protection |= APR_WREAD | APR_WEXECUTE | APR_WWRITE; finfo->protection |= (finfo->protection << prot_scope_group) | (finfo->protection << prot_scope_user); @@ -567,10 +567,10 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, } hFind = FindFirstFileA(fname, &FileInfo.n); if (hFind == INVALID_HANDLE_VALUE) { - return apr_get_os_error(); + return fspr_get_os_error(); } FindClose(hFind); - filename = apr_pstrdup(pool, FileInfo.n.cFileName); + filename = fspr_pstrdup(pool, FileInfo.n.cFileName); } } #endif @@ -583,12 +583,12 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, * to reliably translate char devices to the path '\\.\device' * so go ask for the full path. */ - if (apr_os_level >= APR_WIN_NT) + if (fspr_os_level >= APR_WIN_NT) { #if APR_HAS_UNICODE_FS - apr_wchar_t tmpname[APR_FILE_MAX]; - apr_wchar_t *tmpoff = NULL; - if (GetFullPathNameW(wfname, sizeof(tmpname) / sizeof(apr_wchar_t), + fspr_wchar_t tmpname[APR_FILE_MAX]; + fspr_wchar_t *tmpoff = NULL; + if (GetFullPathNameW(wfname, sizeof(tmpname) / sizeof(fspr_wchar_t), tmpname, &tmpoff)) { if (!wcsncmp(tmpname, L"\\\\.\\", 4)) { @@ -646,7 +646,7 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, if (wanted &= ~finfo->valid) { /* Caller wants more than APR_FINFO_MIN | APR_FINFO_NAME */ #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + if (fspr_os_level >= APR_WIN_NT) return more_finfo(finfo, wfname, wanted, MORE_OF_WFSPEC); #endif return more_finfo(finfo, fname, wanted, MORE_OF_FSPEC); @@ -655,15 +655,15 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, - apr_fileattrs_t attributes, - apr_fileattrs_t attr_mask, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_attrs_set(const char *fname, + fspr_fileattrs_t attributes, + fspr_fileattrs_t attr_mask, + fspr_pool_t *pool) { DWORD flags; - apr_status_t rv; + fspr_status_t rv; #if APR_HAS_UNICODE_FS - apr_wchar_t wfname[APR_PATH_MAX]; + fspr_wchar_t wfname[APR_PATH_MAX]; #endif /* Don't do anything if we can't handle the requested attributes */ @@ -689,7 +689,7 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, #endif if (flags == 0xFFFFFFFF) - return apr_get_os_error(); + return fspr_get_os_error(); if (attr_mask & APR_FILE_ATTR_READONLY) { @@ -721,20 +721,20 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, #endif if (rv == 0) - return apr_get_os_error(); + return fspr_get_os_error(); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, - apr_time_t mtime, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_mtime_set(const char *fname, + fspr_time_t mtime, + fspr_pool_t *pool) { - apr_file_t *thefile; - apr_status_t rv; + fspr_file_t *thefile; + fspr_status_t rv; - rv = apr_file_open(&thefile, fname, + rv = fspr_file_open(&thefile, fname, APR_READ | APR_WRITEATTRS, APR_OS_DEFAULT, pool); if (!rv) @@ -745,16 +745,16 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, if (!GetFileTime(thefile->filehand, &file_ctime, &file_atime, &file_mtime)) - rv = apr_get_os_error(); + rv = fspr_get_os_error(); else { AprTimeToFileTime(&file_mtime, mtime); if (!SetFileTime(thefile->filehand, &file_ctime, &file_atime, &file_mtime)) - rv = apr_get_os_error(); + rv = fspr_get_os_error(); } - apr_file_close(thefile); + fspr_file_close(thefile); } return rv; diff --git a/libs/apr/file_io/win32/filesys.c b/libs/apr/file_io/win32/filesys.c index ad31e3387a..0694cefac9 100644 --- a/libs/apr/file_io/win32/filesys.c +++ b/libs/apr/file_io/win32/filesys.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_arch_file_io.h" -#include "apr_strings.h" +#include "fspr.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" /* Win32 Exceptions: * @@ -38,7 +38,7 @@ * Oddly, \x7f _is_ acceptable ;) */ -/* apr_c_is_fnchar[] maps Win32's file name and shell escape symbols +/* fspr_c_is_fnchar[] maps Win32's file name and shell escape symbols * * element & 1 == valid file name character [excluding delimiters] * element & 2 == character should be shell (caret) escaped from cmd.exe @@ -46,7 +46,7 @@ * this must be in-sync with Apache httpd's gen_test_char.c for cgi escaping. */ -const char apr_c_is_fnchar[256] = +const char fspr_c_is_fnchar[256] = {/* Reject all ctrl codes... Escape \n and \r (ascii 10 and 13) */ 0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* ! " # $ % & ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? */ @@ -63,15 +63,15 @@ const char apr_c_is_fnchar[256] = }; -apr_status_t filepath_root_test(char *path, apr_pool_t *p) +fspr_status_t filepath_root_test(char *path, fspr_pool_t *p) { - apr_status_t rv; + fspr_status_t rv; #if APR_HAS_UNICODE_FS - if (apr_os_level >= APR_WIN_NT) + if (fspr_os_level >= APR_WIN_NT) { - apr_wchar_t wpath[APR_PATH_MAX]; + fspr_wchar_t wpath[APR_PATH_MAX]; if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) + / sizeof(fspr_wchar_t), path)) return rv; rv = GetDriveTypeW(wpath); } @@ -85,24 +85,24 @@ apr_status_t filepath_root_test(char *path, apr_pool_t *p) } -apr_status_t filepath_drive_get(char **rootpath, char drive, - apr_int32_t flags, apr_pool_t *p) +fspr_status_t filepath_drive_get(char **rootpath, char drive, + fspr_int32_t flags, fspr_pool_t *p) { char path[APR_PATH_MAX]; #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t *ignored; - apr_wchar_t wdrive[8]; - apr_wchar_t wpath[APR_PATH_MAX]; - apr_status_t rv; + fspr_wchar_t *ignored; + fspr_wchar_t wdrive[8]; + fspr_wchar_t wpath[APR_PATH_MAX]; + fspr_status_t rv; /* ???: This needs review, apparently "\\?\d:." returns "\\?\d:" * as if that is useful for anything. */ wcscpy(wdrive, L"D:."); - wdrive[0] = (apr_wchar_t)(unsigned char)drive; - if (!GetFullPathNameW(wdrive, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored)) - return apr_get_os_error(); + wdrive[0] = (fspr_wchar_t)(unsigned char)drive; + if (!GetFullPathNameW(wdrive, sizeof(wpath) / sizeof(fspr_wchar_t), wpath, &ignored)) + return fspr_get_os_error(); if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath))) return rv; } @@ -117,7 +117,7 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, drivestr[2] = '.';; drivestr[3] = '\0'; if (!GetFullPathName(drivestr, sizeof(path), path, &ignored)) - return apr_get_os_error(); + return fspr_get_os_error(); } #endif if (!(flags & APR_FILEPATH_NATIVE)) { @@ -126,34 +126,34 @@ apr_status_t filepath_drive_get(char **rootpath, char drive, **rootpath = '/'; } } - *rootpath = apr_pstrdup(p, path); + *rootpath = fspr_pstrdup(p, path); return APR_SUCCESS; } -apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) +fspr_status_t filepath_root_case(char **rootpath, char *root, fspr_pool_t *p) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t *ignored; - apr_wchar_t wpath[APR_PATH_MAX]; - apr_status_t rv; - apr_wchar_t wroot[APR_PATH_MAX]; + fspr_wchar_t *ignored; + fspr_wchar_t wpath[APR_PATH_MAX]; + fspr_status_t rv; + fspr_wchar_t wroot[APR_PATH_MAX]; /* ???: This needs review, apparently "\\?\d:." returns "\\?\d:" * as if that is useful for anything. */ if (rv = utf8_to_unicode_path(wroot, sizeof(wroot) - / sizeof(apr_wchar_t), root)) + / sizeof(fspr_wchar_t), root)) return rv; - if (!GetFullPathNameW(wroot, sizeof(wpath) / sizeof(apr_wchar_t), wpath, &ignored)) - return apr_get_os_error(); + if (!GetFullPathNameW(wroot, sizeof(wpath) / sizeof(fspr_wchar_t), wpath, &ignored)) + return fspr_get_os_error(); /* Borrow wroot as a char buffer (twice as big as necessary) */ if ((rv = unicode_to_utf8_path((char*)wroot, sizeof(wroot), wpath))) return rv; - *rootpath = apr_pstrdup(p, (char*)wroot); + *rootpath = fspr_pstrdup(p, (char*)wroot); } #endif #if APR_HAS_ANSI_FS @@ -162,25 +162,25 @@ apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p) char path[APR_PATH_MAX]; char *ignored; if (!GetFullPathName(root, sizeof(path), path, &ignored)) - return apr_get_os_error(); - *rootpath = apr_pstrdup(p, path); + return fspr_get_os_error(); + *rootpath = fspr_pstrdup(p, path); } #endif return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_get(char **rootpath, fspr_int32_t flags, + fspr_pool_t *p) { char path[APR_PATH_MAX]; #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wpath[APR_PATH_MAX]; - apr_status_t rv; - if (!GetCurrentDirectoryW(sizeof(wpath) / sizeof(apr_wchar_t), wpath)) - return apr_get_os_error(); + fspr_wchar_t wpath[APR_PATH_MAX]; + fspr_status_t rv; + if (!GetCurrentDirectoryW(sizeof(wpath) / sizeof(fspr_wchar_t), wpath)) + return fspr_get_os_error(); if ((rv = unicode_to_utf8_path(path, sizeof(path), wpath))) return rv; } @@ -189,7 +189,7 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, ELSE_WIN_OS_IS_ANSI { if (!GetCurrentDirectory(sizeof(path), path)) - return apr_get_os_error(); + return fspr_get_os_error(); } #endif if (!(flags & APR_FILEPATH_NATIVE)) { @@ -198,31 +198,31 @@ APR_DECLARE(apr_status_t) apr_filepath_get(char **rootpath, apr_int32_t flags, **rootpath = '/'; } } - *rootpath = apr_pstrdup(p, path); + *rootpath = fspr_pstrdup(p, path); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_filepath_set(const char *rootpath, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_filepath_set(const char *rootpath, + fspr_pool_t *p) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wpath[APR_PATH_MAX]; - apr_status_t rv; + fspr_wchar_t wpath[APR_PATH_MAX]; + fspr_status_t rv; if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), rootpath)) + / sizeof(fspr_wchar_t), rootpath)) return rv; if (!SetCurrentDirectoryW(wpath)) - return apr_get_os_error(); + return fspr_get_os_error(); } #endif #if APR_HAS_ANSI_FS ELSE_WIN_OS_IS_ANSI { if (!SetCurrentDirectory(rootpath)) - return apr_get_os_error(); + return fspr_get_os_error(); } #endif return APR_SUCCESS; diff --git a/libs/apr/file_io/win32/flock.c b/libs/apr/file_io/win32/flock.c index e08e08a7a4..17b8459642 100644 --- a/libs/apr/file_io/win32/flock.c +++ b/libs/apr/file_io/win32/flock.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" -APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) +APR_DECLARE(fspr_status_t) fspr_file_lock(fspr_file_t *thefile, int type) { #ifdef _WIN32_WCE /* The File locking is unsuported on WCE */ @@ -28,12 +28,12 @@ APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) flags = ((type & APR_FLOCK_NONBLOCK) ? LOCKFILE_FAIL_IMMEDIATELY : 0) + (((type & APR_FLOCK_TYPEMASK) == APR_FLOCK_SHARED) ? 0 : LOCKFILE_EXCLUSIVE_LOCK); - if (apr_os_level >= APR_WIN_NT) { + if (fspr_os_level >= APR_WIN_NT) { /* Syntax is correct, len is passed for LengthLow and LengthHigh*/ OVERLAPPED offset; memset (&offset, 0, sizeof(offset)); if (!LockFileEx(thefile->filehand, flags, 0, len, len, &offset)) - return apr_get_os_error(); + return fspr_get_os_error(); } else { /* On Win9x, LockFile() never blocks. Hack in a crufty poll. @@ -62,23 +62,23 @@ APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type) #endif /* !defined(_WIN32_WCE) */ } -APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_unlock(fspr_file_t *thefile) { #ifdef _WIN32_WCE return APR_ENOTIMPL; #else DWORD len = 0xffffffff; - if (apr_os_level >= APR_WIN_NT) { + if (fspr_os_level >= APR_WIN_NT) { /* Syntax is correct, len is passed for LengthLow and LengthHigh*/ OVERLAPPED offset; memset (&offset, 0, sizeof(offset)); if (!UnlockFileEx(thefile->filehand, 0, len, len, &offset)) - return apr_get_os_error(); + return fspr_get_os_error(); } else { if (!UnlockFile(thefile->filehand, 0, 0, len, 0)) - return apr_get_os_error(); + return fspr_get_os_error(); } return APR_SUCCESS; diff --git a/libs/apr/file_io/win32/open.c b/libs/apr/file_io/win32/open.c index b3a5176729..2ed23c1d33 100644 --- a/libs/apr/file_io/win32/open.c +++ b/libs/apr/file_io/win32/open.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_private.h" -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_thread_mutex.h" +#include "fspr_private.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_thread_mutex.h" #if APR_HAVE_ERRNO_H #include #endif @@ -29,11 +29,11 @@ #if APR_HAVE_SYS_STAT_H #include #endif -#include "apr_arch_misc.h" -#include "apr_arch_inherit.h" +#include "fspr_arch_misc.h" +#include "fspr_arch_inherit.h" #if APR_HAS_UNICODE_FS -apr_status_t utf8_to_unicode_path(apr_wchar_t* retstr, apr_size_t retlen, +fspr_status_t utf8_to_unicode_path(fspr_wchar_t* retstr, fspr_size_t retlen, const char* srcstr) { /* TODO: The computations could preconvert the string to determine @@ -48,9 +48,9 @@ apr_status_t utf8_to_unicode_path(apr_wchar_t* retstr, apr_size_t retlen, * Note that the \\?\ form only works for local drive paths, and * \\?\UNC\ is needed UNC paths. */ - apr_size_t srcremains = strlen(srcstr) + 1; - apr_wchar_t *t = retstr; - apr_status_t rv; + fspr_size_t srcremains = strlen(srcstr) + 1; + fspr_wchar_t *t = retstr; + fspr_status_t rv; /* This is correct, we don't twist the filename if it is will * definately be shorter than MAX_PATH. It merits some @@ -81,7 +81,7 @@ apr_status_t utf8_to_unicode_path(apr_wchar_t* retstr, apr_size_t retlen, } } - if (rv = apr_conv_utf8_to_ucs2(srcstr, &srcremains, t, &retlen)) { + if (rv = fspr_conv_utf8_to_ucs2(srcstr, &srcremains, t, &retlen)) { return (rv == APR_INCOMPLETE) ? APR_EINVAL : rv; } if (srcremains) { @@ -93,8 +93,8 @@ apr_status_t utf8_to_unicode_path(apr_wchar_t* retstr, apr_size_t retlen, return APR_SUCCESS; } -apr_status_t unicode_to_utf8_path(char* retstr, apr_size_t retlen, - const apr_wchar_t* srcstr) +fspr_status_t unicode_to_utf8_path(char* retstr, fspr_size_t retlen, + const fspr_wchar_t* srcstr) { /* Skip the leading 4 characters if the path begins \\?\, or substitute * // for the \\?\UNC\ path prefix, allocating the maximum string @@ -102,8 +102,8 @@ apr_status_t unicode_to_utf8_path(char* retstr, apr_size_t retlen, * then transform \\'s back into /'s since the \\?\ form never * allows '/' path seperators, and APR always uses '/'s. */ - apr_size_t srcremains = wcslen(srcstr) + 1; - apr_status_t rv; + fspr_size_t srcremains = wcslen(srcstr) + 1; + fspr_status_t rv; char *t = retstr; if (srcstr[0] == L'\\' && srcstr[1] == L'\\' && srcstr[2] == L'?' && srcstr[3] == L'\\') { @@ -122,7 +122,7 @@ apr_status_t unicode_to_utf8_path(char* retstr, apr_size_t retlen, } } - if (rv = apr_conv_ucs2_to_utf8(srcstr, &srcremains, t, &retlen)) { + if (rv = fspr_conv_ucs2_to_utf8(srcstr, &srcremains, t, &retlen)) { return rv; } if (srcremains) { @@ -132,17 +132,17 @@ apr_status_t unicode_to_utf8_path(char* retstr, apr_size_t retlen, } #endif -void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) +void *res_name_from_filename(const char *file, int global, fspr_pool_t *pool) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t *wpre, *wfile, *ch; - apr_size_t n = strlen(file) + 1; - apr_size_t r, d; - apr_status_t rv; + fspr_wchar_t *wpre, *wfile, *ch; + fspr_size_t n = strlen(file) + 1; + fspr_size_t r, d; + fspr_status_t rv; - if (apr_os_level >= APR_WIN_2000) { + if (fspr_os_level >= APR_WIN_2000) { if (global) wpre = L"Global\\"; else @@ -161,10 +161,10 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) --n; } } - wfile = apr_palloc(pool, (r + n) * sizeof(apr_wchar_t)); + wfile = fspr_palloc(pool, (r + n) * sizeof(fspr_wchar_t)); wcscpy(wfile, wpre); d = n; - if (rv = apr_conv_utf8_to_ucs2(file, &n, wfile + r, &d)) { + if (rv = fspr_conv_utf8_to_ucs2(file, &n, wfile + r, &d)) { return NULL; } for (ch = wfile + r; *ch; ++ch) { @@ -178,14 +178,14 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) ELSE_WIN_OS_IS_ANSI { char *nfile, *ch; - apr_size_t n = strlen(file) + 1; + fspr_size_t n = strlen(file) + 1; #if !APR_HAS_UNICODE_FS - apr_status_t rv; - apr_size_t r, d; + fspr_status_t rv; + fspr_size_t r, d; char *pre; - if (apr_os_level >= APR_WIN_2000) { + if (fspr_os_level >= APR_WIN_2000) { if (global) pre = "Global\\"; else @@ -199,16 +199,16 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) file += n - 256 - r; n = 256; } - nfile = apr_palloc(pool, (r + n) * sizeof(apr_wchar_t)); + nfile = fspr_palloc(pool, (r + n) * sizeof(fspr_wchar_t)); memcpy(nfile, pre, r); memcpy(nfile + r, file, n); #else - const apr_size_t r = 0; + const fspr_size_t r = 0; if (n > 256) { file += n - 256; n = 256; } - nfile = apr_pmemdup(pool, file, n); + nfile = fspr_pmemdup(pool, file, n); #endif for (ch = nfile + r; *ch; ++ch) { if (*ch == ':' || *ch == '/' || *ch == '\\') @@ -220,10 +220,10 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool) } -apr_status_t file_cleanup(void *thefile) +fspr_status_t file_cleanup(void *thefile) { - apr_file_t *file = thefile; - apr_status_t flush_rv = APR_SUCCESS; + fspr_file_t *file = thefile; + fspr_status_t flush_rv = APR_SUCCESS; if (file->filehand != INVALID_HANDLE_VALUE) { @@ -243,7 +243,7 @@ apr_status_t file_cleanup(void *thefile) if (file->buffered) { /* XXX: flush here is not mutex protected */ - flush_rv = apr_file_flush((apr_file_t *)thefile); + flush_rv = fspr_file_flush((fspr_file_t *)thefile); } CloseHandle(file->filehand); file->filehand = INVALID_HANDLE_VALUE; @@ -255,16 +255,16 @@ apr_status_t file_cleanup(void *thefile) return flush_rv; } -APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, - apr_int32_t flag, apr_fileperms_t perm, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open(fspr_file_t **new, const char *fname, + fspr_int32_t flag, fspr_fileperms_t perm, + fspr_pool_t *pool) { HANDLE handle = INVALID_HANDLE_VALUE; DWORD oflags = 0; DWORD createflags = 0; DWORD attributes = 0; DWORD sharemode = FILE_SHARE_READ | FILE_SHARE_WRITE; - apr_status_t rv; + fspr_status_t rv; if (flag & APR_READ) { oflags |= GENERIC_READ; @@ -276,7 +276,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, oflags |= FILE_WRITE_ATTRIBUTES; } - if (apr_os_level >= APR_WIN_NT) + if (fspr_os_level >= APR_WIN_NT) sharemode |= FILE_SHARE_DELETE; if (flag & APR_CREATE) { @@ -310,7 +310,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, attributes |= FILE_FLAG_OPEN_REPARSE_POINT; } - /* Without READ or WRITE, we fail unless apr called apr_file_open + /* Without READ or WRITE, we fail unless apr called fspr_file_open * internally with the private APR_OPENINFO flag. * * With the APR_OPENINFO flag on NT, use the option flag @@ -319,7 +319,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, */ if (!(flag & (APR_READ | APR_WRITE))) { if (flag & APR_OPENINFO) { - if (apr_os_level >= APR_WIN_NT) { + if (fspr_os_level >= APR_WIN_NT) { attributes |= FILE_FLAG_BACKUP_SEMANTICS; } } @@ -340,7 +340,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wfname[APR_PATH_MAX]; + fspr_wchar_t wfname[APR_PATH_MAX]; if (flag & APR_SENDFILE_ENABLED) { /* This feature is required to enable sendfile operations @@ -351,7 +351,7 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, } if (rv = utf8_to_unicode_path(wfname, sizeof(wfname) - / sizeof(apr_wchar_t), fname)) + / sizeof(fspr_wchar_t), fname)) return rv; handle = CreateFileW(wfname, oflags, sharemode, NULL, createflags, attributes, 0); @@ -370,13 +370,13 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, } #endif if (handle == INVALID_HANDLE_VALUE) { - return apr_get_os_error(); + return fspr_get_os_error(); } - (*new) = (apr_file_t *)apr_pcalloc(pool, sizeof(apr_file_t)); + (*new) = (fspr_file_t *)fspr_pcalloc(pool, sizeof(fspr_file_t)); (*new)->pool = pool; (*new)->filehand = handle; - (*new)->fname = apr_pstrdup(pool, fname); + (*new)->fname = fspr_pstrdup(pool, fname); (*new)->flags = flag; (*new)->timeout = -1; (*new)->ungetchar = -1; @@ -387,15 +387,15 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, } if (flag & APR_BUFFERED) { (*new)->buffered = 1; - (*new)->buffer = apr_palloc(pool, APR_FILE_BUFSIZE); + (*new)->buffer = fspr_palloc(pool, APR_FILE_BUFSIZE); } /* Need the mutex to handled buffered and O_APPEND style file i/o */ if ((*new)->buffered || (*new)->append) { - rv = apr_thread_mutex_create(&(*new)->mutex, + rv = fspr_thread_mutex_create(&(*new)->mutex, APR_THREAD_MUTEX_DEFAULT, pool); if (rv) { if (file_cleanup(*new) == APR_SUCCESS) { - apr_pool_cleanup_kill(pool, *new, file_cleanup); + fspr_pool_cleanup_kill(pool, *new, file_cleanup); } return rv; } @@ -403,23 +403,23 @@ APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **new, const char *fname, /* Create a pollset with room for one descriptor. */ /* ### check return codes */ - (void) apr_pollset_create(&(*new)->pollset, 1, pool, 0); + (void) fspr_pollset_create(&(*new)->pollset, 1, pool, 0); if (!(flag & APR_FILE_NOCLEANUP)) { - apr_pool_cleanup_register((*new)->pool, (void *)(*new), file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), file_cleanup, + fspr_pool_cleanup_null); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file) +APR_DECLARE(fspr_status_t) fspr_file_close(fspr_file_t *file) { - apr_status_t stat; + fspr_status_t stat; if ((stat = file_cleanup(file)) == APR_SUCCESS) { - apr_pool_cleanup_kill(file->pool, file, file_cleanup); + fspr_pool_cleanup_kill(file->pool, file, file_cleanup); if (file->mutex) { - apr_thread_mutex_destroy(file->mutex); + fspr_thread_mutex_destroy(file->mutex); } return APR_SUCCESS; @@ -427,15 +427,15 @@ APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file) return stat; } -APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_remove(const char *path, fspr_pool_t *pool) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wpath[APR_PATH_MAX]; - apr_status_t rv; + fspr_wchar_t wpath[APR_PATH_MAX]; + fspr_status_t rv; if (rv = utf8_to_unicode_path(wpath, sizeof(wpath) - / sizeof(apr_wchar_t), path)) { + / sizeof(fspr_wchar_t), path)) { return rv; } if (DeleteFileW(wpath)) @@ -447,24 +447,24 @@ APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool) if (DeleteFile(path)) return APR_SUCCESS; #endif - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_file_rename(const char *frompath, +APR_DECLARE(fspr_status_t) fspr_file_rename(const char *frompath, const char *topath, - apr_pool_t *pool) + fspr_pool_t *pool) { IF_WIN_OS_IS_UNICODE { #if APR_HAS_UNICODE_FS - apr_wchar_t wfrompath[APR_PATH_MAX], wtopath[APR_PATH_MAX]; - apr_status_t rv; + fspr_wchar_t wfrompath[APR_PATH_MAX], wtopath[APR_PATH_MAX]; + fspr_status_t rv; if (rv = utf8_to_unicode_path(wfrompath, sizeof(wfrompath) - / sizeof(apr_wchar_t), frompath)) { + / sizeof(fspr_wchar_t), frompath)) { return rv; } if (rv = utf8_to_unicode_path(wtopath, sizeof(wtopath) - / sizeof(apr_wchar_t), topath)) { + / sizeof(fspr_wchar_t), topath)) { return rv; } #ifndef _WIN32_WCE @@ -496,28 +496,28 @@ APR_DECLARE(apr_status_t) apr_file_rename(const char *frompath, { CloseHandle(handle); if (!DeleteFile(topath)) - return apr_get_os_error(); + return fspr_get_os_error(); } if (MoveFile(frompath, topath)) return APR_SUCCESS; } #endif - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile, - apr_file_t *file) +APR_DECLARE(fspr_status_t) fspr_os_file_get(fspr_os_file_t *thefile, + fspr_file_t *file) { *thefile = file->filehand; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, - apr_os_file_t *thefile, - apr_int32_t flags, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_file_put(fspr_file_t **file, + fspr_os_file_t *thefile, + fspr_int32_t flags, + fspr_pool_t *pool) { - (*file) = apr_pcalloc(pool, sizeof(apr_file_t)); + (*file) = fspr_pcalloc(pool, sizeof(fspr_file_t)); (*file)->pool = pool; (*file)->filehand = *thefile; (*file)->ungetchar = -1; /* no char avail */ @@ -529,16 +529,16 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, } if (flags & APR_BUFFERED) { (*file)->buffered = 1; - (*file)->buffer = apr_palloc(pool, APR_FILE_BUFSIZE); + (*file)->buffer = fspr_palloc(pool, APR_FILE_BUFSIZE); } if ((*file)->append || (*file)->buffered) { - apr_status_t rv; - rv = apr_thread_mutex_create(&(*file)->mutex, + fspr_status_t rv; + rv = fspr_thread_mutex_create(&(*file)->mutex, APR_THREAD_MUTEX_DEFAULT, pool); if (rv) { if (file_cleanup(*file) == APR_SUCCESS) { - apr_pool_cleanup_kill(pool, *file, file_cleanup); + fspr_pool_cleanup_kill(pool, *file, file_cleanup); } return rv; } @@ -546,7 +546,7 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, /* Create a pollset with room for one descriptor. */ /* ### check return codes */ - (void) apr_pollset_create(&(*file)->pollset, 1, pool, 0); + (void) fspr_pollset_create(&(*file)->pollset, 1, pool, 0); /* XXX... we pcalloc above so all others are zeroed. * Should we be testing if thefile is a handle to @@ -557,7 +557,7 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr) +APR_DECLARE(fspr_status_t) fspr_file_eof(fspr_file_t *fptr) { if (fptr->eof_hit == 1) { return APR_EOF; @@ -565,66 +565,66 @@ APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stderr(fspr_file_t **thefile, fspr_pool_t *pool) { #ifdef _WIN32_WCE return APR_ENOTIMPL; #else - apr_os_file_t file_handle; + fspr_os_file_t file_handle; - apr_set_os_error(APR_SUCCESS); + fspr_set_os_error(APR_SUCCESS); file_handle = GetStdHandle(STD_ERROR_HANDLE); if (!file_handle || (file_handle == INVALID_HANDLE_VALUE)) { - apr_status_t rv = apr_get_os_error(); + fspr_status_t rv = fspr_get_os_error(); if (rv == APR_SUCCESS) { return APR_EINVAL; } return rv; } - return apr_os_file_put(thefile, &file_handle, 0, pool); + return fspr_os_file_put(thefile, &file_handle, 0, pool); #endif } -APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stdout(fspr_file_t **thefile, fspr_pool_t *pool) { #ifdef _WIN32_WCE return APR_ENOTIMPL; #else - apr_os_file_t file_handle; + fspr_os_file_t file_handle; - apr_set_os_error(APR_SUCCESS); + fspr_set_os_error(APR_SUCCESS); file_handle = GetStdHandle(STD_OUTPUT_HANDLE); if (!file_handle || (file_handle == INVALID_HANDLE_VALUE)) { - apr_status_t rv = apr_get_os_error(); + fspr_status_t rv = fspr_get_os_error(); if (rv == APR_SUCCESS) { return APR_EINVAL; } return rv; } - return apr_os_file_put(thefile, &file_handle, 0, pool); + return fspr_os_file_put(thefile, &file_handle, 0, pool); #endif } -APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_open_stdin(fspr_file_t **thefile, fspr_pool_t *pool) { #ifdef _WIN32_WCE return APR_ENOTIMPL; #else - apr_os_file_t file_handle; + fspr_os_file_t file_handle; - apr_set_os_error(APR_SUCCESS); + fspr_set_os_error(APR_SUCCESS); file_handle = GetStdHandle(STD_INPUT_HANDLE); if (!file_handle || (file_handle == INVALID_HANDLE_VALUE)) { - apr_status_t rv = apr_get_os_error(); + fspr_status_t rv = fspr_get_os_error(); if (rv == APR_SUCCESS) { return APR_EINVAL; } return rv; } - return apr_os_file_put(thefile, &file_handle, 0, pool); + return fspr_os_file_put(thefile, &file_handle, 0, pool); #endif } diff --git a/libs/apr/file_io/win32/pipe.c b/libs/apr/file_io/win32/pipe.c index cda79e3af3..a9da026a37 100644 --- a/libs/apr/file_io/win32/pipe.c +++ b/libs/apr/file_io/win32/pipe.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "win32/apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_strings.h" +#include "win32/fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" #if APR_HAVE_ERRNO_H #include #endif @@ -29,9 +29,9 @@ #if APR_HAVE_SYS_STAT_H #include #endif -#include "apr_arch_misc.h" +#include "fspr_arch_misc.h" -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_set(fspr_file_t *thepipe, fspr_interval_time_t timeout) { /* Always OK to unset timeouts */ if (timeout == -1) { @@ -50,30 +50,30 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, apr_int return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, apr_interval_time_t *timeout) +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_get(fspr_file_t *thepipe, fspr_interval_time_t *timeout) { /* Always OK to get the timeout (even if it's unset ... -1) */ *timeout = thepipe->timeout; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_file_pipe_create(fspr_file_t **in, fspr_file_t **out, fspr_pool_t *p) { /* Unix creates full blocking pipes. */ - return apr_create_nt_pipe(in, out, APR_FULL_BLOCK, p); + return fspr_create_nt_pipe(in, out, APR_FULL_BLOCK, p); } -/* apr_create_nt_pipe() - * An internal (for now) APR function used by apr_proc_create() +/* fspr_create_nt_pipe() + * An internal (for now) APR function used by fspr_proc_create() * when setting up pipes to communicate with the child process. - * apr_create_nt_pipe() allows setting the blocking mode of each end of + * fspr_create_nt_pipe() allows setting the blocking mode of each end of * the pipe when the pipe is created (rather than after the pipe is created). * A pipe handle must be opened in full async i/o mode in order to * emulate Unix non-blocking pipes with timeouts. * * In general, we don't want to enable child side pipe handles for async i/o. * This prevents us from enabling both ends of the pipe for async i/o in - * apr_file_pipe_create. + * fspr_file_pipe_create. * * Why not use NamedPipes on NT which support setting pipe state to * non-blocking? On NT, even though you can set a pipe non-blocking, @@ -81,9 +81,9 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, apr_file_t **out * WaitForSinglelObject, et. al. will not detect pipe i/o). On NT, you * have to poll the pipe to detect i/o on a non-blocking pipe. */ -apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, - apr_int32_t blocking_mode, - apr_pool_t *p) +fspr_status_t fspr_create_nt_pipe(fspr_file_t **in, fspr_file_t **out, + fspr_int32_t blocking_mode, + fspr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -98,7 +98,7 @@ apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, sa.bInheritHandle = TRUE; sa.lpSecurityDescriptor = NULL; - (*in) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t)); + (*in) = (fspr_file_t *)fspr_pcalloc(p, sizeof(fspr_file_t)); (*in)->pool = p; (*in)->fname = NULL; (*in)->pipe = 1; @@ -110,9 +110,9 @@ apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, (*in)->dataRead = 0; (*in)->direction = 0; (*in)->pOverlapped = NULL; - (void) apr_pollset_create(&(*in)->pollset, 1, p, 0); + (void) fspr_pollset_create(&(*in)->pollset, 1, p, 0); - (*out) = (apr_file_t *)apr_pcalloc(p, sizeof(apr_file_t)); + (*out) = (fspr_file_t *)fspr_pcalloc(p, sizeof(fspr_file_t)); (*out)->pool = p; (*out)->fname = NULL; (*out)->pipe = 1; @@ -124,15 +124,15 @@ apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, (*out)->dataRead = 0; (*out)->direction = 0; (*out)->pOverlapped = NULL; - (void) apr_pollset_create(&(*out)->pollset, 1, p, 0); + (void) fspr_pollset_create(&(*out)->pollset, 1, p, 0); - if (apr_os_level >= APR_WIN_NT) { + if (fspr_os_level >= APR_WIN_NT) { /* Create the read end of the pipe */ dwOpenMode = PIPE_ACCESS_INBOUND; if (blocking_mode == APR_WRITE_BLOCK /* READ_NONBLOCK */ || blocking_mode == APR_FULL_NONBLOCK) { dwOpenMode |= FILE_FLAG_OVERLAPPED; - (*in)->pOverlapped = (OVERLAPPED*) apr_pcalloc(p, sizeof(OVERLAPPED)); + (*in)->pOverlapped = (OVERLAPPED*) fspr_pcalloc(p, sizeof(OVERLAPPED)); (*in)->pOverlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); } @@ -154,7 +154,7 @@ apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, if (blocking_mode == APR_READ_BLOCK /* WRITE_NONBLOCK */ || blocking_mode == APR_FULL_NONBLOCK) { dwOpenMode |= FILE_FLAG_OVERLAPPED; - (*out)->pOverlapped = (OVERLAPPED*) apr_pcalloc(p, sizeof(OVERLAPPED)); + (*out)->pOverlapped = (OVERLAPPED*) fspr_pcalloc(p, sizeof(OVERLAPPED)); (*out)->pOverlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); } @@ -169,22 +169,22 @@ apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, else { /* Pipes on Win9* are blocking. Live with it. */ if (!CreatePipe(&(*in)->filehand, &(*out)->filehand, &sa, 65536)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } - apr_pool_cleanup_register((*in)->pool, (void *)(*in), file_cleanup, - apr_pool_cleanup_null); - apr_pool_cleanup_register((*out)->pool, (void *)(*out), file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*in)->pool, (void *)(*in), file_cleanup, + fspr_pool_cleanup_null); + fspr_pool_cleanup_register((*out)->pool, (void *)(*out), file_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; #endif /* _WIN32_WCE */ } -APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, - apr_fileperms_t perm, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_file_namedpipe_create(const char *filename, + fspr_fileperms_t perm, + fspr_pool_t *pool) { /* Not yet implemented, interface not suitable. * Win32 requires the named pipe to be *opened* at the time it's @@ -200,31 +200,31 @@ APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, * would be to handle stdio-style or blocking pipes. Win32 doesn't have * select() blocking for pipes anyways :( */ -APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, - apr_os_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_os_pipe_put_ex(fspr_file_t **file, + fspr_os_file_t *thefile, int register_cleanup, - apr_pool_t *pool) + fspr_pool_t *pool) { - (*file) = apr_pcalloc(pool, sizeof(apr_file_t)); + (*file) = fspr_pcalloc(pool, sizeof(fspr_file_t)); (*file)->pool = pool; (*file)->pipe = 1; (*file)->timeout = -1; (*file)->ungetchar = -1; (*file)->filehand = *thefile; - (void) apr_pollset_create(&(*file)->pollset, 1, pool, 0); + (void) fspr_pollset_create(&(*file)->pollset, 1, pool, 0); if (register_cleanup) { - apr_pool_cleanup_register(pool, *file, file_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *file, file_cleanup, + fspr_pool_cleanup_null); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, - apr_os_file_t *thefile, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_pipe_put(fspr_file_t **file, + fspr_os_file_t *thefile, + fspr_pool_t *pool) { - return apr_os_pipe_put_ex(file, thefile, 0, pool); + return fspr_os_pipe_put_ex(file, thefile, 0, pool); } diff --git a/libs/apr/file_io/win32/readwrite.c b/libs/apr/file_io/win32/readwrite.c index d15ac7c1ac..a0acc26943 100644 --- a/libs/apr/file_io/win32/readwrite.c +++ b/libs/apr/file_io/win32/readwrite.c @@ -14,23 +14,23 @@ * limitations under the License. */ -#include "win32/apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_lib.h" -#include "apr_errno.h" +#include "win32/fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_lib.h" +#include "fspr_errno.h" #include -#include "apr_arch_atime.h" -#include "apr_arch_misc.h" +#include "fspr_arch_atime.h" +#include "fspr_arch_misc.h" /* * read_with_timeout() * Uses async i/o to emulate unix non-blocking i/o with timeouts. */ -static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t len_in, apr_size_t *nbytes) +static fspr_status_t read_with_timeout(fspr_file_t *file, void *buf, fspr_size_t len_in, fspr_size_t *nbytes) { - apr_status_t rv; + fspr_status_t rv; DWORD len = (DWORD)len_in; DWORD bytesread = 0; @@ -42,7 +42,7 @@ static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t le if (file->pipe) { DWORD bytes; if (!PeekNamedPipe(file->filehand, NULL, 0, NULL, &bytes, NULL)) { - rv = apr_get_os_error(); + rv = fspr_get_os_error(); if (rv == APR_FROM_OS_ERROR(ERROR_BROKEN_PIPE)) { rv = APR_EOF; } @@ -77,7 +77,7 @@ static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t le *nbytes = bytesread; if (!rv) { - rv = apr_get_os_error(); + rv = fspr_get_os_error(); if (rv == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) { /* Wait for the pending i/o */ if (file->timeout > 0) { @@ -101,7 +101,7 @@ static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t le break; case WAIT_FAILED: - rv = apr_get_os_error(); + rv = fspr_get_os_error(); break; default: @@ -109,7 +109,7 @@ static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t le } if (rv != APR_SUCCESS) { - if (apr_os_level >= APR_WIN_98) { + if (fspr_os_level >= APR_WIN_98) { CancelIo(file->filehand); } } @@ -131,9 +131,9 @@ static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t le return rv; } -APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_file_read(fspr_file_t *thefile, void *buf, fspr_size_t *len) { - apr_status_t rv; + fspr_status_t rv; DWORD bytes_read = 0; if (*len <= 0) { @@ -143,14 +143,14 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size /* If the file is open for xthread support, allocate and * initialize the overlapped and io completion event (hEvent). - * Threads should NOT share an apr_file_t or its hEvent. + * Threads should NOT share an fspr_file_t or its hEvent. */ if ((thefile->flags & APR_XTHREAD) && !thefile->pOverlapped ) { - thefile->pOverlapped = (OVERLAPPED*) apr_pcalloc(thefile->pool, + thefile->pOverlapped = (OVERLAPPED*) fspr_pcalloc(thefile->pool, sizeof(OVERLAPPED)); thefile->pOverlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); if (!thefile->pOverlapped->hEvent) { - rv = apr_get_os_error(); + rv = fspr_get_os_error(); return rv; } } @@ -169,15 +169,15 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size } if (thefile->buffered) { char *pos = (char *)buf; - apr_size_t blocksize; - apr_size_t size = *len; + fspr_size_t blocksize; + fspr_size_t size = *len; - apr_thread_mutex_lock(thefile->mutex); + fspr_thread_mutex_lock(thefile->mutex); if (thefile->direction == 1) { - rv = apr_file_flush(thefile); + rv = fspr_file_flush(thefile); if (rv != APR_SUCCESS) { - apr_thread_mutex_unlock(thefile->mutex); + fspr_thread_mutex_unlock(thefile->mutex); return rv; } thefile->bufpos = 0; @@ -188,7 +188,7 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size rv = 0; while (rv == 0 && size > 0) { if (thefile->bufpos >= thefile->dataRead) { - apr_size_t read; + fspr_size_t read; rv = read_with_timeout(thefile, thefile->buffer, APR_FILE_BUFSIZE, &read); if (read == 0) { @@ -214,10 +214,10 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size if (*len) { rv = APR_SUCCESS; } - apr_thread_mutex_unlock(thefile->mutex); + fspr_thread_mutex_unlock(thefile->mutex); } else { /* Unbuffered i/o */ - apr_size_t nbytes; + fspr_size_t nbytes; rv = read_with_timeout(thefile, buf, *len, &nbytes); if (rv == APR_EOF) thefile->eof_hit = TRUE; @@ -227,35 +227,35 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, apr_size return rv; } -APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, apr_size_t *nbytes) +APR_DECLARE(fspr_status_t) fspr_file_write(fspr_file_t *thefile, const void *buf, fspr_size_t *nbytes) { - apr_status_t rv; + fspr_status_t rv; DWORD bwrote; /* If the file is open for xthread support, allocate and * initialize the overlapped and io completion event (hEvent). - * Threads should NOT share an apr_file_t or its hEvent. + * Threads should NOT share an fspr_file_t or its hEvent. */ if ((thefile->flags & APR_XTHREAD) && !thefile->pOverlapped ) { - thefile->pOverlapped = (OVERLAPPED*) apr_pcalloc(thefile->pool, + thefile->pOverlapped = (OVERLAPPED*) fspr_pcalloc(thefile->pool, sizeof(OVERLAPPED)); thefile->pOverlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); if (!thefile->pOverlapped->hEvent) { - rv = apr_get_os_error(); + rv = fspr_get_os_error(); return rv; } } if (thefile->buffered) { char *pos = (char *)buf; - apr_size_t blocksize; - apr_size_t size = *nbytes; + fspr_size_t blocksize; + fspr_size_t size = *nbytes; - apr_thread_mutex_lock(thefile->mutex); + fspr_thread_mutex_lock(thefile->mutex); if (thefile->direction == 0) { // Position file pointer for writing at the offset we are logically reading from - apr_off_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; + fspr_off_t offset = thefile->filePtr - thefile->dataRead + thefile->bufpos; DWORD offlo = (DWORD)offset; DWORD offhi = (DWORD)(offset >> 32); if (offset != thefile->filePtr) @@ -267,7 +267,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a rv = 0; while (rv == 0 && size > 0) { if (thefile->bufpos == APR_FILE_BUFSIZE) // write buffer is full - rv = apr_file_flush(thefile); + rv = fspr_file_flush(thefile); blocksize = size > APR_FILE_BUFSIZE - thefile->bufpos ? APR_FILE_BUFSIZE - thefile->bufpos : size; memcpy(thefile->buffer + thefile->bufpos, pos, blocksize); @@ -276,27 +276,27 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a size -= blocksize; } - apr_thread_mutex_unlock(thefile->mutex); + fspr_thread_mutex_unlock(thefile->mutex); return rv; } else { if (!thefile->pipe) { - apr_off_t offset = 0; - apr_status_t rc; + fspr_off_t offset = 0; + fspr_status_t rc; if (thefile->append) { - /* apr_file_lock will mutex the file across processes. - * The call to apr_thread_mutex_lock is added to avoid + /* fspr_file_lock will mutex the file across processes. + * The call to fspr_thread_mutex_lock is added to avoid * a race condition between LockFile and WriteFile * that occasionally leads to deadlocked threads. */ - apr_thread_mutex_lock(thefile->mutex); - rc = apr_file_lock(thefile, APR_FLOCK_EXCLUSIVE); + fspr_thread_mutex_lock(thefile->mutex); + rc = fspr_file_lock(thefile, APR_FLOCK_EXCLUSIVE); if (rc != APR_SUCCESS) { - apr_thread_mutex_unlock(thefile->mutex); + fspr_thread_mutex_unlock(thefile->mutex); return rc; } - rc = apr_file_seek(thefile, APR_END, &offset); + rc = fspr_file_seek(thefile, APR_END, &offset); if (rc != APR_SUCCESS) { - apr_thread_mutex_unlock(thefile->mutex); + fspr_thread_mutex_unlock(thefile->mutex); return rc; } } @@ -307,8 +307,8 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a rv = WriteFile(thefile->filehand, buf, (DWORD)*nbytes, &bwrote, thefile->pOverlapped); if (thefile->append) { - apr_file_unlock(thefile); - apr_thread_mutex_unlock(thefile->mutex); + fspr_file_unlock(thefile); + fspr_thread_mutex_unlock(thefile->mutex); } } else { @@ -321,7 +321,7 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a } else { (*nbytes) = 0; - rv = apr_get_os_error(); + rv = fspr_get_os_error(); if (rv == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) { DWORD timeout_ms; @@ -348,13 +348,13 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a rv = APR_TIMEUP; break; case WAIT_FAILED: - rv = apr_get_os_error(); + rv = fspr_get_os_error(); break; default: break; } if (rv != APR_SUCCESS) { - if (apr_os_level >= APR_WIN_98) + if (fspr_os_level >= APR_WIN_98) CancelIo(thefile->filehand); } } @@ -368,21 +368,21 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a /* ToDo: Write for it anyway and test the oslevel! * Too bad WriteFileGather() is not supported on 95&98 (or NT prior to SP2) */ -APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_file_writev(fspr_file_t *thefile, const struct iovec *vec, - apr_size_t nvec, - apr_size_t *nbytes) + fspr_size_t nvec, + fspr_size_t *nbytes) { - apr_status_t rv = APR_SUCCESS; - apr_size_t i; - apr_size_t bwrote = 0; + fspr_status_t rv = APR_SUCCESS; + fspr_size_t i; + fspr_size_t bwrote = 0; char *buf; *nbytes = 0; for (i = 0; i < nvec; i++) { buf = vec[i].iov_base; bwrote = vec[i].iov_len; - rv = apr_file_write(thefile, buf, &bwrote); + rv = fspr_file_write(thefile, buf, &bwrote); *nbytes += bwrote; if (rv != APR_SUCCESS) { break; @@ -391,26 +391,26 @@ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, return rv; } -APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_putc(char ch, fspr_file_t *thefile) { - apr_size_t len = 1; + fspr_size_t len = 1; - return apr_file_write(thefile, &ch, &len); + return fspr_file_write(thefile, &ch, &len); } -APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_ungetc(char ch, fspr_file_t *thefile) { thefile->ungetchar = (unsigned char) ch; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_getc(char *ch, fspr_file_t *thefile) { - apr_status_t rc; - apr_size_t bread; + fspr_status_t rc; + fspr_size_t bread; bread = 1; - rc = apr_file_read(thefile, ch, &bread); + rc = fspr_file_read(thefile, ch, &bread); if (rc) { return rc; @@ -423,22 +423,22 @@ APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_puts(const char *str, fspr_file_t *thefile) { - apr_size_t len = strlen(str); + fspr_size_t len = strlen(str); - return apr_file_write(thefile, str, &len); + return fspr_file_write(thefile, str, &len); } -APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_gets(char *str, int len, fspr_file_t *thefile) { - apr_size_t readlen; - apr_status_t rv = APR_SUCCESS; + fspr_size_t readlen; + fspr_status_t rv = APR_SUCCESS; int i; for (i = 0; i < len-1; i++) { readlen = 1; - rv = apr_file_read(thefile, str+i, &readlen); + rv = fspr_file_read(thefile, str+i, &readlen); if (rv != APR_SUCCESS && rv != APR_EOF) return rv; @@ -459,13 +459,13 @@ APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, apr_file_t *thefile) return rv; } -APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile) +APR_DECLARE(fspr_status_t) fspr_file_flush(fspr_file_t *thefile) { if (thefile->buffered) { DWORD numbytes, written = 0; - apr_status_t rc = 0; + fspr_status_t rc = 0; char *buffer; - apr_size_t bytesleft; + fspr_size_t bytesleft; if (thefile->direction == 1 && thefile->bufpos) { buffer = thefile->buffer; @@ -480,7 +480,7 @@ APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile) } if (!WriteFile(thefile->filehand, buffer, numbytes, &written, NULL)) { - rc = apr_get_os_error(); + rc = fspr_get_os_error(); thefile->filePtr += written; break; } @@ -504,17 +504,17 @@ APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile) return APR_SUCCESS; } -struct apr_file_printf_data { - apr_vformatter_buff_t vbuff; - apr_file_t *fptr; +struct fspr_file_printf_data { + fspr_vformatter_buff_t vbuff; + fspr_file_t *fptr; char *buf; }; -static int file_printf_flush(apr_vformatter_buff_t *buff) +static int file_printf_flush(fspr_vformatter_buff_t *buff) { - struct apr_file_printf_data *data = (struct apr_file_printf_data *)buff; + struct fspr_file_printf_data *data = (struct fspr_file_printf_data *)buff; - if (apr_file_write_full(data->fptr, data->buf, + if (fspr_file_write_full(data->fptr, data->buf, data->vbuff.curpos - data->buf, NULL)) { return -1; } @@ -523,10 +523,10 @@ static int file_printf_flush(apr_vformatter_buff_t *buff) return 0; } -APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, +APR_DECLARE_NONSTD(int) fspr_file_printf(fspr_file_t *fptr, const char *format, ...) { - struct apr_file_printf_data data; + struct fspr_file_printf_data data; va_list ap; int count; @@ -538,10 +538,10 @@ APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, data.vbuff.endpos = data.buf + HUGE_STRING_LEN; data.fptr = fptr; va_start(ap, format); - count = apr_vformatter(file_printf_flush, - (apr_vformatter_buff_t *)&data, format, ap); - /* apr_vformatter does not call flush for the last bits */ - if (count >= 0) file_printf_flush((apr_vformatter_buff_t *)&data); + count = fspr_vformatter(file_printf_flush, + (fspr_vformatter_buff_t *)&data, format, ap); + /* fspr_vformatter does not call flush for the last bits */ + if (count >= 0) file_printf_flush((fspr_vformatter_buff_t *)&data); va_end(ap); diff --git a/libs/apr/file_io/win32/seek.c b/libs/apr/file_io/win32/seek.c index 2566d061cf..1bd59de25e 100644 --- a/libs/apr/file_io/win32/seek.c +++ b/libs/apr/file_io/win32/seek.c @@ -14,20 +14,20 @@ * limitations under the License. */ -#include "win32/apr_arch_file_io.h" -#include "apr_file_io.h" +#include "win32/fspr_arch_file_io.h" +#include "fspr_file_io.h" #include #include -static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) +static fspr_status_t setptr(fspr_file_t *thefile, fspr_off_t pos ) { - apr_size_t newbufpos; - apr_status_t rv; + fspr_size_t newbufpos; + fspr_status_t rv; DWORD rc; if (thefile->direction == 1) { /* XXX: flush here is not mutex protected */ - rv = apr_file_flush(thefile); + rv = fspr_file_flush(thefile); if (rv != APR_SUCCESS) return rv; thefile->bufpos = thefile->dataRead = 0; @@ -37,11 +37,11 @@ static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) /* We may be truncating to size here. * XXX: testing an 'unsigned' as >= 0 below indicates a bug */ - newbufpos = (apr_size_t)(pos - (thefile->filePtr + newbufpos = (fspr_size_t)(pos - (thefile->filePtr - thefile->dataRead)); if (newbufpos >= 0 && newbufpos <= thefile->dataRead) { - thefile->bufpos = (apr_size_t)newbufpos; + thefile->bufpos = (fspr_size_t)newbufpos; rv = APR_SUCCESS; } else { DWORD offlo = (DWORD)pos; @@ -54,7 +54,7 @@ static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) * to confirm this. INVALID_SET_FILE_POINTER is too recently * added for us to rely on it as a constant. */ - rv = apr_get_os_error(); + rv = fspr_get_os_error(); else rv = APR_SUCCESS; @@ -70,10 +70,10 @@ static apr_status_t setptr(apr_file_t *thefile, apr_off_t pos ) } -APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t where, apr_off_t *offset) +APR_DECLARE(fspr_status_t) fspr_file_seek(fspr_file_t *thefile, fspr_seek_where_t where, fspr_off_t *offset) { - apr_finfo_t finfo; - apr_status_t rc = APR_SUCCESS; + fspr_finfo_t finfo; + fspr_status_t rc = APR_SUCCESS; thefile->eof_hit = 0; @@ -89,7 +89,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh break; case APR_END: - rc = apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile); + rc = fspr_file_info_get(&finfo, APR_FINFO_SIZE, thefile); if (rc == APR_SUCCESS) rc = setptr(thefile, finfo.size + *offset); break; @@ -115,7 +115,7 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh break; case APR_END: - rc = apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile); + rc = fspr_file_info_get(&finfo, APR_FINFO_SIZE, thefile); if (rc == APR_SUCCESS && finfo.size + *offset >= 0) thefile->filePtr = finfo.size + *offset; break; @@ -144,31 +144,31 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, apr_seek_where_t wh offlo = SetFilePointer(thefile->filehand, (LONG)offlo, (LONG*)&offhi, howmove); if (offlo == 0xFFFFFFFF) - rc = apr_get_os_error(); + rc = fspr_get_os_error(); else rc = APR_SUCCESS; /* Since we can land at 0xffffffff we will measure our APR_SUCCESS */ if (rc == APR_SUCCESS) - *offset = ((apr_off_t)offhi << 32) | offlo; + *offset = ((fspr_off_t)offhi << 32) | offlo; return rc; } } -APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *thefile, apr_off_t offset) +APR_DECLARE(fspr_status_t) fspr_file_trunc(fspr_file_t *thefile, fspr_off_t offset) { - apr_status_t rv; + fspr_status_t rv; DWORD offlo = (DWORD)offset; DWORD offhi = (DWORD)(offset >> 32); DWORD rc; rc = SetFilePointer(thefile->filehand, offlo, &offhi, FILE_BEGIN); if (rc == 0xFFFFFFFF) - if ((rv = apr_get_os_error()) != APR_SUCCESS) + if ((rv = fspr_get_os_error()) != APR_SUCCESS) return rv; if (!SetEndOfFile(thefile->filehand)) - return apr_get_os_error(); + return fspr_get_os_error(); if (thefile->buffered) { return setptr(thefile, offset); diff --git a/libs/apr/helpers/apr_rename.pl b/libs/apr/helpers/apr_rename.pl index 25b9d52d4c..5254978574 100755 --- a/libs/apr/helpers/apr_rename.pl +++ b/libs/apr/helpers/apr_rename.pl @@ -8,7 +8,7 @@ shift if $just_check; my $dir = shift || '.'; my %names; -my $prefix = 'apr_'; +my $prefix = 'fspr_'; while () { chomp; @@ -41,7 +41,7 @@ sub replace { while () { for (m/[^_\"]*$prefix($pattern)\b/og) { $found++; - print " $file:$. apr_$_ -> apr_$names{$_}\n"; + print " $file:$. fspr_$_ -> fspr_$names{$_}\n"; } push @lines, $_ if $replace; } @@ -66,41 +66,41 @@ sub replace { } __DATA__ -apr_time_t: -apr_implode_gmt apr_time_exp_gmt_get +fspr_time_t: +fspr_implode_gmt fspr_time_exp_gmt_get -apr_socket_t: -apr_close_socket apr_socket_close -apr_create_socket apr_socket_create -apr_get_sockaddr apr_socket_addr_get -apr_get_socketdata apr_socket_data_get -apr_set_socketdata apr_socket_data_set -apr_shutdown apr_socket_shutdown -apr_bind apr_socket_bind -apr_listen apr_socket_listen -apr_accept apr_socket_accept -apr_connect apr_socket_connect -apr_send apr_socket_send -apr_sendv apr_socket_sendv -apr_sendto apr_socket_sendto -apr_recvfrom apr_socket_recvfrom -apr_sendfile apr_socket_sendfile -apr_recv apr_socket_recv +fspr_socket_t: +fspr_close_socket fspr_socket_close +fspr_create_socket fspr_socket_create +fspr_get_sockaddr fspr_socket_addr_get +fspr_get_socketdata fspr_socket_data_get +fspr_set_socketdata fspr_socket_data_set +fspr_shutdown fspr_socket_shutdown +fspr_bind fspr_socket_bind +fspr_listen fspr_socket_listen +fspr_accept fspr_socket_accept +fspr_connect fspr_socket_connect +fspr_send fspr_socket_send +fspr_sendv fspr_socket_sendv +fspr_sendto fspr_socket_sendto +fspr_recvfrom fspr_socket_recvfrom +fspr_sendfile fspr_socket_sendfile +fspr_recv fspr_socket_recv -apr_filepath_*: -apr_filename_of_pathname apr_filepath_name_get +fspr_filepath_*: +fspr_filename_of_pathname fspr_filepath_name_get -apr_gid_t: -apr_get_groupid apr_gid_get -apr_get_groupname apr_gid_name_get -apr_group_name_get apr_gid_name_get -apr_compare_groups apr_gid_compare +fspr_gid_t: +fspr_get_groupid fspr_gid_get +fspr_get_groupname fspr_gid_name_get +fspr_group_name_get fspr_gid_name_get +fspr_compare_groups fspr_gid_compare -apr_uid_t: -apr_get_home_directory apr_uid_homepath_get -apr_get_userid apr_uid_get -apr_current_userid apr_uid_current -apr_compare_users apr_uid_compare -apr_get_username apr_uid_name_get -apr_compare_users apr_uid_compare +fspr_uid_t: +fspr_get_home_directory fspr_uid_homepath_get +fspr_get_userid fspr_uid_get +fspr_current_userid fspr_uid_current +fspr_compare_users fspr_uid_compare +fspr_get_username fspr_uid_name_get +fspr_compare_users fspr_uid_compare diff --git a/libs/apr/include/apr_random.h b/libs/apr/include/apr_random.h deleted file mode 100644 index 9c0eac23ad..0000000000 --- a/libs/apr/include/apr_random.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#ifndef APR_RANDOM_H -#define APR_RANDOM_H - -#include - -typedef struct apr_crypto_hash_t apr_crypto_hash_t; - -typedef void apr_crypto_hash_init_t(apr_crypto_hash_t *hash); -typedef void apr_crypto_hash_add_t(apr_crypto_hash_t *hash,const void *data, - apr_size_t bytes); -typedef void apr_crypto_hash_finish_t(apr_crypto_hash_t *hash, - unsigned char *result); - -/* FIXME: make this opaque */ -struct apr_crypto_hash_t { - apr_crypto_hash_init_t *init; - apr_crypto_hash_add_t *add; - apr_crypto_hash_finish_t *finish; - apr_size_t size; - void *data; -}; - -APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p); - -typedef struct apr_random_t apr_random_t; - -APR_DECLARE(void) apr_random_init(apr_random_t *g,apr_pool_t *p, - apr_crypto_hash_t *pool_hash, - apr_crypto_hash_t *key_hash, - apr_crypto_hash_t *prng_hash); -APR_DECLARE(apr_random_t *) apr_random_standard_new(apr_pool_t *p); -APR_DECLARE(void) apr_random_add_entropy(apr_random_t *g, - const void *entropy_, - apr_size_t bytes); -APR_DECLARE(apr_status_t) apr_random_insecure_bytes(apr_random_t *g, - void *random, - apr_size_t bytes); -APR_DECLARE(apr_status_t) apr_random_secure_bytes(apr_random_t *g, - void *random, - apr_size_t bytes); -APR_DECLARE(void) apr_random_barrier(apr_random_t *g); -APR_DECLARE(apr_status_t) apr_random_secure_ready(apr_random_t *r); -APR_DECLARE(apr_status_t) apr_random_insecure_ready(apr_random_t *r); - -/* Call this in the child after forking to mix the randomness - pools. Note that its generally a bad idea to fork a process with a - real PRNG in it - better to have the PRNG externally and get the - randomness from there. However, if you really must do it, then you - should supply all your entropy to all the PRNGs - don't worry, they - won't produce the same output. - - Note that apr_proc_fork() calls this for you, so only weird - applications need ever call it themselves. -*/ -struct apr_proc_t; -APR_DECLARE(void) apr_random_after_fork(struct apr_proc_t *proc); - -#endif /* ndef APR_RANDOM_H */ diff --git a/libs/apr/include/arch/aix/apr_arch_dso.h b/libs/apr/include/arch/aix/fspr_arch_dso.h similarity index 86% rename from libs/apr/include/arch/aix/apr_arch_dso.h rename to libs/apr/include/arch/aix/fspr_arch_dso.h index d1cac684f6..04a2700285 100644 --- a/libs/apr/include/arch/aix/apr_arch_dso.h +++ b/libs/apr/include/arch/aix/fspr_arch_dso.h @@ -17,11 +17,11 @@ #ifndef DSO_H #define DSO_H -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_dso.h" -#include "apr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_dso.h" +#include "fspr.h" #if APR_HAS_DSO @@ -30,8 +30,8 @@ void *dlsym(void *handle, const char *symbol); const char *dlerror(void); int dlclose(void *handle); -struct apr_dso_handle_t { - apr_pool_t *pool; +struct fspr_dso_handle_t { + fspr_pool_t *pool; void *handle; const char *errormsg; }; diff --git a/libs/apr/include/arch/beos/apr_arch_dso.h b/libs/apr/include/arch/beos/fspr_arch_dso.h similarity index 85% rename from libs/apr/include/arch/beos/apr_arch_dso.h rename to libs/apr/include/arch/beos/fspr_arch_dso.h index fbc5c2ff01..0be76ade03 100644 --- a/libs/apr/include/arch/beos/apr_arch_dso.h +++ b/libs/apr/include/arch/beos/fspr_arch_dso.h @@ -17,20 +17,20 @@ #ifndef DSO_H #define DSO_H -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_dso.h" -#include "apr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_errno.h" +#include "fspr_dso.h" +#include "fspr.h" #include #include #if APR_HAS_DSO -struct apr_dso_handle_t { +struct fspr_dso_handle_t { image_id handle; /* Handle to the DSO loaded */ - apr_pool_t *pool; + fspr_pool_t *pool; const char *errormsg; /* if the load fails, we have an error * message here :) */ diff --git a/libs/apr/include/arch/beos/apr_arch_proc_mutex.h b/libs/apr/include/arch/beos/fspr_arch_proc_mutex.h similarity index 82% rename from libs/apr/include/arch/beos/apr_arch_proc_mutex.h rename to libs/apr/include/arch/beos/fspr_arch_proc_mutex.h index c60d8c6228..c0a08b465a 100644 --- a/libs/apr/include/arch/beos/apr_arch_proc_mutex.h +++ b/libs/apr/include/arch/beos/fspr_arch_proc_mutex.h @@ -17,15 +17,15 @@ #ifndef PROC_MUTEX_H #define PROC_MUTEX_H -#include "apr_pools.h" -#include "apr_proc_mutex.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" +#include "fspr_pools.h" +#include "fspr_proc_mutex.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" -struct apr_proc_mutex_t { - apr_pool_t *pool; +struct fspr_proc_mutex_t { + fspr_pool_t *pool; /* Our lock :) */ sem_id Lock; diff --git a/libs/apr/include/arch/beos/apr_arch_thread_cond.h b/libs/apr/include/arch/beos/fspr_arch_thread_cond.h similarity index 81% rename from libs/apr/include/arch/beos/apr_arch_thread_cond.h rename to libs/apr/include/arch/beos/fspr_arch_thread_cond.h index c9420b53cb..f18aba7d6c 100644 --- a/libs/apr/include/arch/beos/apr_arch_thread_cond.h +++ b/libs/apr/include/arch/beos/fspr_arch_thread_cond.h @@ -18,23 +18,23 @@ #define THREAD_COND_H #include -#include "apr_pools.h" -#include "apr_thread_cond.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include "apr_ring.h" +#include "fspr_pools.h" +#include "fspr_thread_cond.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" +#include "fspr_ring.h" struct waiter_t { APR_RING_ENTRY(waiter_t) link; sem_id sem; }; -struct apr_thread_cond_t { - apr_pool_t *pool; +struct fspr_thread_cond_t { + fspr_pool_t *pool; sem_id lock; - apr_thread_mutex_t *condlock; + fspr_thread_mutex_t *condlock; thread_id owner; /* active list */ APR_RING_HEAD(active_list, waiter_t) alist; diff --git a/libs/apr/include/arch/beos/apr_arch_thread_mutex.h b/libs/apr/include/arch/beos/fspr_arch_thread_mutex.h similarity index 81% rename from libs/apr/include/arch/beos/apr_arch_thread_mutex.h rename to libs/apr/include/arch/beos/fspr_arch_thread_mutex.h index bb7d4ae80b..f2fbb22388 100644 --- a/libs/apr/include/arch/beos/apr_arch_thread_mutex.h +++ b/libs/apr/include/arch/beos/fspr_arch_thread_mutex.h @@ -18,15 +18,15 @@ #define THREAD_MUTEX_H #include -#include "apr_pools.h" -#include "apr_thread_mutex.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" +#include "fspr_pools.h" +#include "fspr_thread_mutex.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" -struct apr_thread_mutex_t { - apr_pool_t *pool; +struct fspr_thread_mutex_t { + fspr_pool_t *pool; /* Our lock :) */ sem_id Lock; @@ -34,7 +34,7 @@ struct apr_thread_mutex_t { /* If we nest locks we need these... */ int nested; - apr_os_thread_t owner; + fspr_os_thread_t owner; int owner_ref; }; diff --git a/libs/apr/include/arch/beos/apr_arch_thread_rwlock.h b/libs/apr/include/arch/beos/fspr_arch_thread_rwlock.h similarity index 84% rename from libs/apr/include/arch/beos/apr_arch_thread_rwlock.h rename to libs/apr/include/arch/beos/fspr_arch_thread_rwlock.h index 694b0d5046..9a7849fbd5 100644 --- a/libs/apr/include/arch/beos/apr_arch_thread_rwlock.h +++ b/libs/apr/include/arch/beos/fspr_arch_thread_rwlock.h @@ -18,15 +18,15 @@ #define THREAD_RWLOCK_H #include -#include "apr_pools.h" -#include "apr_thread_rwlock.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" +#include "fspr_pools.h" +#include "fspr_thread_rwlock.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" -struct apr_thread_rwlock_t { - apr_pool_t *pool; +struct fspr_thread_rwlock_t { + fspr_pool_t *pool; /* Our lock :) */ sem_id Lock; diff --git a/libs/apr/include/arch/beos/apr_arch_threadproc.h b/libs/apr/include/arch/beos/fspr_arch_threadproc.h similarity index 71% rename from libs/apr/include/arch/beos/apr_arch_threadproc.h rename to libs/apr/include/arch/beos/fspr_arch_threadproc.h index 13de053634..aa55461a4a 100644 --- a/libs/apr/include/arch/beos/apr_arch_threadproc.h +++ b/libs/apr/include/arch/beos/fspr_arch_threadproc.h @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr_thread_proc.h" -#include "apr_arch_file_io.h" -#include "apr_file_io.h" -#include "apr_thread_proc.h" -#include "apr_general.h" -#include "apr_portable.h" +#include "fspr_thread_proc.h" +#include "fspr_arch_file_io.h" +#include "fspr_file_io.h" +#include "fspr_thread_proc.h" +#include "fspr_general.h" +#include "fspr_portable.h" #include #include #include @@ -39,23 +39,23 @@ #define BEOS_MAX_DATAKEYS 128 -struct apr_thread_t { - apr_pool_t *pool; +struct fspr_thread_t { + fspr_pool_t *pool; thread_id td; void *data; - apr_thread_start_t func; - apr_status_t exitval; + fspr_thread_start_t func; + fspr_status_t exitval; }; -struct apr_threadattr_t { - apr_pool_t *pool; +struct fspr_threadattr_t { + fspr_pool_t *pool; int32 attr; int detached; int joinable; }; -struct apr_threadkey_t { - apr_pool_t *pool; +struct fspr_threadkey_t { + fspr_pool_t *pool; int32 key; }; @@ -73,20 +73,20 @@ struct beos_key { void (* destructor) (void *); }; -struct apr_procattr_t { - apr_pool_t *pool; - apr_file_t *parent_in; - apr_file_t *child_in; - apr_file_t *parent_out; - apr_file_t *child_out; - apr_file_t *parent_err; - apr_file_t *child_err; +struct fspr_procattr_t { + fspr_pool_t *pool; + fspr_file_t *parent_in; + fspr_file_t *child_in; + fspr_file_t *parent_out; + fspr_file_t *child_out; + fspr_file_t *parent_err; + fspr_file_t *child_err; char *currdir; - apr_int32_t cmdtype; - apr_int32_t detached; + fspr_int32_t cmdtype; + fspr_int32_t detached; }; -struct apr_thread_once_t { +struct fspr_thread_once_t { sem_id sem; int hit; }; diff --git a/libs/apr/include/arch/apr_private_common.h b/libs/apr/include/arch/fspr_private_common.h similarity index 75% rename from libs/apr/include/arch/apr_private_common.h rename to libs/apr/include/arch/fspr_private_common.h index 9cd52ecf22..2213744b1c 100644 --- a/libs/apr/include/arch/apr_private_common.h +++ b/libs/apr/include/arch/fspr_private_common.h @@ -21,22 +21,22 @@ #ifndef APR_PRIVATE_COMMON_H #define APR_PRIVATE_COMMON_H -#include "apr_pools.h" -#include "apr_tables.h" +#include "fspr_pools.h" +#include "fspr_tables.h" -apr_status_t apr_filepath_list_split_impl(apr_array_header_t **pathelts, +fspr_status_t fspr_filepath_list_split_impl(fspr_array_header_t **pathelts, const char *liststr, char separator, - apr_pool_t *p); + fspr_pool_t *p); -apr_status_t apr_filepath_list_merge_impl(char **liststr, - apr_array_header_t *pathelts, +fspr_status_t fspr_filepath_list_merge_impl(char **liststr, + fspr_array_header_t *pathelts, char separator, - apr_pool_t *p); + fspr_pool_t *p); /* temporary defines to handle 64bit compile mismatches */ #define APR_INT_TRUNC_CAST int -#define APR_UINT32_TRUNC_CAST apr_uint32_t +#define APR_UINT32_TRUNC_CAST fspr_uint32_t #define APR_UINT32_MAX 0xFFFFFFFFUL #endif /*APR_PRIVATE_COMMON_H*/ diff --git a/libs/apr/include/arch/netware/apr_arch_dso.h b/libs/apr/include/arch/netware/fspr_arch_dso.h similarity index 86% rename from libs/apr/include/arch/netware/apr_arch_dso.h rename to libs/apr/include/arch/netware/fspr_arch_dso.h index ea0fe8c254..54bf22f72f 100644 --- a/libs/apr/include/arch/netware/apr_arch_dso.h +++ b/libs/apr/include/arch/netware/fspr_arch_dso.h @@ -17,11 +17,11 @@ #ifndef DSO_H #define DSO_H -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_dso.h" -#include "apr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_dso.h" +#include "fspr.h" #include @@ -32,8 +32,8 @@ struct sym_list { char *symbol; }; -struct apr_dso_handle_t { - apr_pool_t *pool; +struct fspr_dso_handle_t { + fspr_pool_t *pool; void *handle; const char *errormsg; sym_list *symbols; diff --git a/libs/apr/include/arch/netware/apr_arch_file_io.h b/libs/apr/include/arch/netware/fspr_arch_file_io.h similarity index 76% rename from libs/apr/include/arch/netware/apr_arch_file_io.h rename to libs/apr/include/arch/netware/fspr_arch_file_io.h index 6b2bfeca44..d1172e2153 100644 --- a/libs/apr/include/arch/netware/apr_arch_file_io.h +++ b/libs/apr/include/arch/netware/fspr_arch_file_io.h @@ -17,15 +17,15 @@ #ifndef FILE_IO_H #define FILE_IO_H -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_tables.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_lib.h" -#include "apr_poll.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_tables.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_lib.h" +#include "fspr_poll.h" /* System headers the file I/O library needs */ #if APR_HAVE_FCNTL_H @@ -78,45 +78,45 @@ typedef struct stat struct_stat; -struct apr_file_t { - apr_pool_t *pool; +struct fspr_file_t { + fspr_pool_t *pool; int filedes; char *fname; - apr_int32_t flags; + fspr_int32_t flags; int eof_hit; int is_pipe; - apr_interval_time_t timeout; + fspr_interval_time_t timeout; int buffered; enum {BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking; int ungetchar; /* Last char provided by an unget op. (-1 = no char)*/ /* if there is a timeout set, then this pollset is used */ - apr_pollset_t *pollset; + fspr_pollset_t *pollset; /* Stuff for buffered mode */ char *buffer; int bufpos; /* Read/Write position in buffer */ - apr_off_t dataRead; /* amount of valid data read into buffer */ + fspr_off_t dataRead; /* amount of valid data read into buffer */ int direction; /* buffer being used for 0 = read, 1 = write */ - apr_off_t filePtr; /* position in file of handle */ + fspr_off_t filePtr; /* position in file of handle */ #if APR_HAS_THREADS - struct apr_thread_mutex_t *thlock; + struct fspr_thread_mutex_t *thlock; #endif }; -struct apr_dir_t { - apr_pool_t *pool; +struct fspr_dir_t { + fspr_pool_t *pool; char *dirname; DIR *dirstruct; struct dirent *entry; }; -typedef struct apr_stat_entry_t apr_stat_entry_t; +typedef struct fspr_stat_entry_t fspr_stat_entry_t; -struct apr_stat_entry_t { +struct fspr_stat_entry_t { struct stat info; char *casedName; - apr_time_t expire; + fspr_time_t expire; NXPathCtx_t pathCtx; }; @@ -131,21 +131,21 @@ struct apr_stat_entry_t { * we need to fold the case to canonical form. This function is * supposed to do so. */ -apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p); +fspr_status_t filepath_root_case(char **rootpath, char *root, fspr_pool_t *p); /* This function check to see of the given path includes a drive/volume * specifier. If the _only_ parameter is set to DRIVE_ONLY then it * check to see of the path only contains a drive/volume specifier and * nothing else. */ -apr_status_t filepath_has_drive(const char *rootpath, int only, apr_pool_t *p); +fspr_status_t filepath_has_drive(const char *rootpath, int only, fspr_pool_t *p); /* This function compares the drive/volume specifiers for each given path. * It returns zero if they match or non-zero if not. */ -apr_status_t filepath_compare_drive(const char *path1, const char *path2, apr_pool_t *p); +fspr_status_t filepath_compare_drive(const char *path1, const char *path2, fspr_pool_t *p); -apr_status_t apr_unix_file_cleanup(void *); +fspr_status_t fspr_unix_file_cleanup(void *); #endif /* ! FILE_IO_H */ diff --git a/libs/apr/include/arch/netware/apr_arch_global_mutex.h b/libs/apr/include/arch/netware/fspr_arch_global_mutex.h similarity index 85% rename from libs/apr/include/arch/netware/apr_arch_global_mutex.h rename to libs/apr/include/arch/netware/fspr_arch_global_mutex.h index 4167d37821..bceaddb5b6 100644 --- a/libs/apr/include/arch/netware/apr_arch_global_mutex.h +++ b/libs/apr/include/arch/netware/fspr_arch_global_mutex.h @@ -17,12 +17,12 @@ #ifndef GLOBAL_MUTEX_H #define GLOBAL_MUTEX_H -#include "apr_global_mutex.h" -#include "apr_thread_mutex.h" +#include "fspr_global_mutex.h" +#include "fspr_thread_mutex.h" -struct apr_global_mutex_t { - apr_pool_t *pool; - apr_thread_mutex_t *mutex; +struct fspr_global_mutex_t { + fspr_pool_t *pool; + fspr_thread_mutex_t *mutex; }; #endif /* GLOBAL_MUTEX_H */ diff --git a/libs/apr/include/arch/netware/apr_arch_internal_time.h b/libs/apr/include/arch/netware/fspr_arch_internal_time.h similarity index 94% rename from libs/apr/include/arch/netware/apr_arch_internal_time.h rename to libs/apr/include/arch/netware/fspr_arch_internal_time.h index 59f1067208..8f43fb1cce 100644 --- a/libs/apr/include/arch/netware/apr_arch_internal_time.h +++ b/libs/apr/include/arch/netware/fspr_arch_internal_time.h @@ -17,10 +17,10 @@ #ifndef TIME_INTERNAL_H #define TIME_INTERNAL_H -#include "apr.h" +#include "fspr.h" #define TZONE (*___timezone()) -void apr_netware_setup_time(void); +void fspr_netware_setup_time(void); #endif /* TIME_INTERNAL_H */ diff --git a/libs/apr/include/arch/netware/apr_arch_networkio.h b/libs/apr/include/arch/netware/fspr_arch_networkio.h similarity index 93% rename from libs/apr/include/arch/netware/apr_arch_networkio.h rename to libs/apr/include/arch/netware/fspr_arch_networkio.h index 63f17abe59..0779530996 100644 --- a/libs/apr/include/arch/netware/apr_arch_networkio.h +++ b/libs/apr/include/arch/netware/fspr_arch_networkio.h @@ -22,9 +22,9 @@ arch/netware and then arch/unix. But in this specific case we want arch/win32. */ -#include <../win32/apr_arch_networkio.h> +#include <../win32/fspr_arch_networkio.h> #else -#include <../unix/apr_arch_networkio.h> +#include <../unix/fspr_arch_networkio.h> #endif #endif /* ! NETWORK_IO_H */ diff --git a/libs/apr/include/arch/netware/apr_arch_pre_nw.h b/libs/apr/include/arch/netware/fspr_arch_pre_nw.h similarity index 100% rename from libs/apr/include/arch/netware/apr_arch_pre_nw.h rename to libs/apr/include/arch/netware/fspr_arch_pre_nw.h diff --git a/libs/apr/include/arch/netware/apr_arch_proc_mutex.h b/libs/apr/include/arch/netware/fspr_arch_proc_mutex.h similarity index 86% rename from libs/apr/include/arch/netware/apr_arch_proc_mutex.h rename to libs/apr/include/arch/netware/fspr_arch_proc_mutex.h index 7a634c2e50..169a6c292e 100644 --- a/libs/apr/include/arch/netware/apr_arch_proc_mutex.h +++ b/libs/apr/include/arch/netware/fspr_arch_proc_mutex.h @@ -17,12 +17,12 @@ #ifndef PROC_MUTEX_H #define PROC_MUTEX_H -#include "apr_proc_mutex.h" -#include "apr_thread_mutex.h" +#include "fspr_proc_mutex.h" +#include "fspr_thread_mutex.h" -struct apr_proc_mutex_t { - apr_pool_t *pool; - apr_thread_mutex_t *mutex; +struct fspr_proc_mutex_t { + fspr_pool_t *pool; + fspr_thread_mutex_t *mutex; }; #endif /* PROC_MUTEX_H */ diff --git a/libs/apr/include/arch/netware/apr_arch_thread_cond.h b/libs/apr/include/arch/netware/fspr_arch_thread_cond.h similarity index 91% rename from libs/apr/include/arch/netware/apr_arch_thread_cond.h rename to libs/apr/include/arch/netware/fspr_arch_thread_cond.h index b11a5f86a7..ec0e69018f 100644 --- a/libs/apr/include/arch/netware/apr_arch_thread_cond.h +++ b/libs/apr/include/arch/netware/fspr_arch_thread_cond.h @@ -17,11 +17,11 @@ #ifndef THREAD_COND_H #define THREAD_COND_H -#include "apr_thread_cond.h" +#include "fspr_thread_cond.h" #include -struct apr_thread_cond_t { - apr_pool_t *pool; +struct fspr_thread_cond_t { + fspr_pool_t *pool; NXCond_t *cond; }; diff --git a/libs/apr/include/arch/netware/apr_arch_thread_mutex.h b/libs/apr/include/arch/netware/fspr_arch_thread_mutex.h similarity index 91% rename from libs/apr/include/arch/netware/apr_arch_thread_mutex.h rename to libs/apr/include/arch/netware/fspr_arch_thread_mutex.h index 0453799c2d..7691795a3d 100644 --- a/libs/apr/include/arch/netware/apr_arch_thread_mutex.h +++ b/libs/apr/include/arch/netware/fspr_arch_thread_mutex.h @@ -17,11 +17,11 @@ #ifndef THREAD_MUTEX_H #define THREAD_MUTEX_H -#include "apr_thread_mutex.h" +#include "fspr_thread_mutex.h" #include -struct apr_thread_mutex_t { - apr_pool_t *pool; +struct fspr_thread_mutex_t { + fspr_pool_t *pool; NXMutex_t *mutex; }; diff --git a/libs/apr/include/arch/netware/apr_arch_thread_rwlock.h b/libs/apr/include/arch/netware/fspr_arch_thread_rwlock.h similarity index 91% rename from libs/apr/include/arch/netware/apr_arch_thread_rwlock.h rename to libs/apr/include/arch/netware/fspr_arch_thread_rwlock.h index d2dbd42f79..56df129656 100644 --- a/libs/apr/include/arch/netware/apr_arch_thread_rwlock.h +++ b/libs/apr/include/arch/netware/fspr_arch_thread_rwlock.h @@ -17,11 +17,11 @@ #ifndef THREAD_RWLOCK_H #define THREAD_RWLOCK_H -#include "apr_thread_rwlock.h" +#include "fspr_thread_rwlock.h" #include -struct apr_thread_rwlock_t { - apr_pool_t *pool; +struct fspr_thread_rwlock_t { + fspr_pool_t *pool; NXRwLock_t *rwlock; }; diff --git a/libs/apr/include/arch/netware/apr_arch_threadproc.h b/libs/apr/include/arch/netware/fspr_arch_threadproc.h similarity index 59% rename from libs/apr/include/arch/netware/apr_arch_threadproc.h rename to libs/apr/include/arch/netware/fspr_arch_threadproc.h index 713ed295af..5dd85058f7 100644 --- a/libs/apr/include/arch/netware/apr_arch_threadproc.h +++ b/libs/apr/include/arch/netware/fspr_arch_threadproc.h @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" +#include "fspr.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" #include @@ -26,52 +26,52 @@ #define SHELL_PATH "" #define APR_DEFAULT_STACK_SIZE 65536 -struct apr_thread_t { - apr_pool_t *pool; +struct fspr_thread_t { + fspr_pool_t *pool; NXContext_t ctx; NXThreadId_t td; char *thread_name; - apr_int32_t cancel; - apr_int32_t cancel_how; + fspr_int32_t cancel; + fspr_int32_t cancel_how; void *data; - apr_thread_start_t func; - apr_status_t exitval; + fspr_thread_start_t func; + fspr_status_t exitval; }; -struct apr_threadattr_t { - apr_pool_t *pool; - apr_size_t stack_size; - apr_int32_t detach; +struct fspr_threadattr_t { + fspr_pool_t *pool; + fspr_size_t stack_size; + fspr_int32_t detach; char *thread_name; }; -struct apr_threadkey_t { - apr_pool_t *pool; +struct fspr_threadkey_t { + fspr_pool_t *pool; NXKey_t key; }; -struct apr_procattr_t { - apr_pool_t *pool; - apr_file_t *parent_in; - apr_file_t *child_in; - apr_file_t *parent_out; - apr_file_t *child_out; - apr_file_t *parent_err; - apr_file_t *child_err; +struct fspr_procattr_t { + fspr_pool_t *pool; + fspr_file_t *parent_in; + fspr_file_t *child_in; + fspr_file_t *parent_out; + fspr_file_t *child_out; + fspr_file_t *parent_err; + fspr_file_t *child_err; char *currdir; - apr_int32_t cmdtype; - apr_int32_t detached; - apr_int32_t addrspace; + fspr_int32_t cmdtype; + fspr_int32_t detached; + fspr_int32_t addrspace; }; -struct apr_thread_once_t { +struct fspr_thread_once_t { unsigned long value; }; -//struct apr_proc_t { -// apr_pool_t *pool; +//struct fspr_proc_t { +// fspr_pool_t *pool; // pid_t pid; -// apr_procattr_t *attr; +// fspr_procattr_t *attr; //}; #endif /* ! THREAD_PROC_H */ diff --git a/libs/apr/include/arch/netware/apr_private.h b/libs/apr/include/arch/netware/fspr_private.h similarity index 98% rename from libs/apr/include/arch/netware/apr_private.h rename to libs/apr/include/arch/netware/fspr_private.h index ad659b5988..a200fcc6a1 100644 --- a/libs/apr/include/arch/netware/apr_private.h +++ b/libs/apr/include/arch/netware/fspr_private.h @@ -28,7 +28,7 @@ /* Include the public APR symbols, include our idea of the 'right' * subset of the Windows.h header. This saves us repetition. */ -#include "apr.h" +#include "fspr.h" #include #include @@ -185,7 +185,7 @@ void* getStatCache(); /* * Include common private declarations. */ -#include "../apr_private_common.h" +#include "../fspr_private_common.h" #endif /*APR_PRIVATE_H*/ #endif /*NETWARE*/ diff --git a/libs/apr/include/arch/os2/apr_arch_os2calls.h b/libs/apr/include/arch/os2/apr_arch_os2calls.h deleted file mode 100644 index 3c739bfd19..0000000000 --- a/libs/apr/include/arch/os2/apr_arch_os2calls.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You 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. - */ - -#include "apr_errno.h" -#include -#include - -extern int (*apr_os2_socket)(int, int, int); -extern int (*apr_os2_select)(int *, int, int, int, long); -extern int (*apr_os2_sock_errno)(); -extern int (*apr_os2_accept)(int, struct sockaddr *, int *); -extern int (*apr_os2_bind)(int, struct sockaddr *, int); -extern int (*apr_os2_connect)(int, struct sockaddr *, int); -extern int (*apr_os2_getpeername)(int, struct sockaddr *, int *); -extern int (*apr_os2_getsockname)(int, struct sockaddr *, int *); -extern int (*apr_os2_getsockopt)(int, int, int, char *, int *); -extern int (*apr_os2_ioctl)(int, int, caddr_t, int); -extern int (*apr_os2_listen)(int, int); -extern int (*apr_os2_recv)(int, char *, int, int); -extern int (*apr_os2_send)(int, const char *, int, int); -extern int (*apr_os2_setsockopt)(int, int, int, char *, int); -extern int (*apr_os2_shutdown)(int, int); -extern int (*apr_os2_soclose)(int); -extern int (*apr_os2_writev)(int, struct iovec *, int); -extern int (*apr_os2_sendto)(int, const char *, int, int, const struct sockaddr *, int); -extern int (*apr_os2_recvfrom)(int, char *, int, int, struct sockaddr *, int *); - -#define socket apr_os2_socket -#define select apr_os2_select -#define sock_errno apr_os2_sock_errno -#define accept apr_os2_accept -#define bind apr_os2_bind -#define connect apr_os2_connect -#define getpeername apr_os2_getpeername -#define getsockname apr_os2_getsockname -#define getsockopt apr_os2_getsockopt -#define ioctl apr_os2_ioctl -#define listen apr_os2_listen -#define recv apr_os2_recv -#define send apr_os2_send -#define setsockopt apr_os2_setsockopt -#define shutdown apr_os2_shutdown -#define soclose apr_os2_soclose -#define writev apr_os2_writev -#define sendto apr_os2_sendto -#define recvfrom apr_os2_recvfrom diff --git a/libs/apr/include/arch/os2/apr_arch_dso.h b/libs/apr/include/arch/os2/fspr_arch_dso.h similarity index 79% rename from libs/apr/include/arch/os2/apr_arch_dso.h rename to libs/apr/include/arch/os2/fspr_arch_dso.h index 2bda6b7c66..ee6eb45ae7 100644 --- a/libs/apr/include/arch/os2/apr_arch_dso.h +++ b/libs/apr/include/arch/os2/fspr_arch_dso.h @@ -17,18 +17,18 @@ #ifndef DSO_H #define DSO_H -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_dso.h" -#include "apr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_dso.h" +#include "fspr.h" #if APR_HAS_DSO -struct apr_dso_handle_t { - apr_pool_t *cont; /* Context for returning error strings */ +struct fspr_dso_handle_t { + fspr_pool_t *cont; /* Context for returning error strings */ HMODULE handle; /* Handle to the DSO loaded */ - apr_status_t load_error; + fspr_status_t load_error; char *failed_module; }; diff --git a/libs/apr/include/arch/os2/apr_arch_file_io.h b/libs/apr/include/arch/os2/fspr_arch_file_io.h similarity index 67% rename from libs/apr/include/arch/os2/apr_arch_file_io.h rename to libs/apr/include/arch/os2/fspr_arch_file_io.h index a8884c34dc..8f2c2da0f6 100644 --- a/libs/apr/include/arch/os2/apr_arch_file_io.h +++ b/libs/apr/include/arch/os2/fspr_arch_file_io.h @@ -17,13 +17,13 @@ #ifndef FILE_IO_H #define FILE_IO_H -#include "apr_private.h" -#include "apr_general.h" -#include "apr_thread_mutex.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_poll.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_thread_mutex.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_poll.h" /* We have an implementation of mkstemp but it's not very multi-threading * friendly & is part of the POSIX emulation rather than native so don't @@ -33,14 +33,14 @@ #define APR_FILE_BUFSIZE 4096 -struct apr_file_t { - apr_pool_t *pool; +struct fspr_file_t { + fspr_pool_t *pool; HFILE filedes; char * fname; int isopen; int buffered; int eof_hit; - apr_int32_t flags; + fspr_int32_t flags; int timeout; int pipe; HEV pipeSem; @@ -52,32 +52,32 @@ struct apr_file_t { unsigned long dataRead; // amount of valid data read into buffer int direction; // buffer being used for 0 = read, 1 = write unsigned long filePtr; // position in file of handle - apr_thread_mutex_t *mutex;// mutex semaphore, must be owned to access the above fields + fspr_thread_mutex_t *mutex;// mutex semaphore, must be owned to access the above fields }; -struct apr_dir_t { - apr_pool_t *pool; +struct fspr_dir_t { + fspr_pool_t *pool; char *dirname; ULONG handle; FILEFINDBUF3 entry; int validentry; }; -apr_status_t apr_file_cleanup(void *); -apr_status_t apr_os2_time_to_apr_time(apr_time_t *result, FDATE os2date, +fspr_status_t fspr_file_cleanup(void *); +fspr_status_t fspr_os2_time_to_fspr_time(fspr_time_t *result, FDATE os2date, FTIME os2time); -apr_status_t apr_apr_time_to_os2_time(FDATE *os2date, FTIME *os2time, - apr_time_t aprtime); +fspr_status_t fspr_fspr_time_to_os2_time(FDATE *os2date, FTIME *os2time, + fspr_time_t aprtime); /* see win32/fileio.h for description of these */ extern const char c_is_fnchar[256]; #define IS_FNCHAR(c) c_is_fnchar[(unsigned char)c] -apr_status_t filepath_root_test(char *path, apr_pool_t *p); -apr_status_t filepath_drive_get(char **rootpath, char drive, - apr_int32_t flags, apr_pool_t *p); -apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p); +fspr_status_t filepath_root_test(char *path, fspr_pool_t *p); +fspr_status_t filepath_drive_get(char **rootpath, char drive, + fspr_int32_t flags, fspr_pool_t *p); +fspr_status_t filepath_root_case(char **rootpath, char *root, fspr_pool_t *p); #endif /* ! FILE_IO_H */ diff --git a/libs/apr/include/arch/os2/apr_arch_networkio.h b/libs/apr/include/arch/os2/fspr_arch_networkio.h similarity index 80% rename from libs/apr/include/arch/os2/apr_arch_networkio.h rename to libs/apr/include/arch/os2/fspr_arch_networkio.h index 10c6de81fb..9fd277ab8d 100644 --- a/libs/apr/include/arch/os2/apr_arch_networkio.h +++ b/libs/apr/include/arch/os2/fspr_arch_networkio.h @@ -17,11 +17,11 @@ #ifndef NETWORK_IO_H #define NETWORK_IO_H -#include "apr_private.h" -#include "apr_network_io.h" -#include "apr_general.h" -#include "apr_arch_os2calls.h" -#include "apr_poll.h" +#include "fspr_private.h" +#include "fspr_network_io.h" +#include "fspr_general.h" +#include "fspr_arch_os2calls.h" +#include "fspr_poll.h" #if APR_HAVE_NETDB_H #include @@ -34,24 +34,24 @@ struct sock_userdata_t { void *data; }; -struct apr_socket_t { - apr_pool_t *pool; +struct fspr_socket_t { + fspr_pool_t *pool; int socketdes; int type; int protocol; - apr_sockaddr_t *local_addr; - apr_sockaddr_t *remote_addr; - apr_interval_time_t timeout; + fspr_sockaddr_t *local_addr; + fspr_sockaddr_t *remote_addr; + fspr_interval_time_t timeout; int nonblock; int local_port_unknown; int local_interface_unknown; int remote_addr_unknown; - apr_int32_t options; - apr_int32_t inherit; + fspr_int32_t options; + fspr_int32_t inherit; sock_userdata_t *userdata; /* if there is a timeout set, then this pollset is used */ - apr_pollset_t *pollset; + fspr_pollset_t *pollset; }; /* Error codes returned from sock_errno() */ @@ -68,9 +68,9 @@ struct apr_socket_t { #define SOCEPIPE (SOCBASEERR+32) /* Broken pipe */ #define SOCEOS2ERR (SOCBASEERR+100) /* OS/2 Error */ -const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size); -int apr_inet_pton(int af, const char *src, void *dst); -void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t); +const char *fspr_inet_ntop(int af, const void *src, char *dst, fspr_size_t size); +int fspr_inet_pton(int af, const char *src, void *dst); +void fspr_sockaddr_vars_set(fspr_sockaddr_t *, int, fspr_port_t); #endif /* ! NETWORK_IO_H */ diff --git a/libs/apr/include/arch/os2/fspr_arch_os2calls.h b/libs/apr/include/arch/os2/fspr_arch_os2calls.h new file mode 100644 index 0000000000..335662ffce --- /dev/null +++ b/libs/apr/include/arch/os2/fspr_arch_os2calls.h @@ -0,0 +1,59 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +#include "fspr_errno.h" +#include +#include + +extern int (*fspr_os2_socket)(int, int, int); +extern int (*fspr_os2_select)(int *, int, int, int, long); +extern int (*fspr_os2_sock_errno)(); +extern int (*fspr_os2_accept)(int, struct sockaddr *, int *); +extern int (*fspr_os2_bind)(int, struct sockaddr *, int); +extern int (*fspr_os2_connect)(int, struct sockaddr *, int); +extern int (*fspr_os2_getpeername)(int, struct sockaddr *, int *); +extern int (*fspr_os2_getsockname)(int, struct sockaddr *, int *); +extern int (*fspr_os2_getsockopt)(int, int, int, char *, int *); +extern int (*fspr_os2_ioctl)(int, int, caddr_t, int); +extern int (*fspr_os2_listen)(int, int); +extern int (*fspr_os2_recv)(int, char *, int, int); +extern int (*fspr_os2_send)(int, const char *, int, int); +extern int (*fspr_os2_setsockopt)(int, int, int, char *, int); +extern int (*fspr_os2_shutdown)(int, int); +extern int (*fspr_os2_soclose)(int); +extern int (*fspr_os2_writev)(int, struct iovec *, int); +extern int (*fspr_os2_sendto)(int, const char *, int, int, const struct sockaddr *, int); +extern int (*fspr_os2_recvfrom)(int, char *, int, int, struct sockaddr *, int *); + +#define socket fspr_os2_socket +#define select fspr_os2_select +#define sock_errno fspr_os2_sock_errno +#define accept fspr_os2_accept +#define bind fspr_os2_bind +#define connect fspr_os2_connect +#define getpeername fspr_os2_getpeername +#define getsockname fspr_os2_getsockname +#define getsockopt fspr_os2_getsockopt +#define ioctl fspr_os2_ioctl +#define listen fspr_os2_listen +#define recv fspr_os2_recv +#define send fspr_os2_send +#define setsockopt fspr_os2_setsockopt +#define shutdown fspr_os2_shutdown +#define soclose fspr_os2_soclose +#define writev fspr_os2_writev +#define sendto fspr_os2_sendto +#define recvfrom fspr_os2_recvfrom diff --git a/libs/apr/include/arch/os2/apr_arch_proc_mutex.h b/libs/apr/include/arch/os2/fspr_arch_proc_mutex.h similarity index 89% rename from libs/apr/include/arch/os2/apr_arch_proc_mutex.h rename to libs/apr/include/arch/os2/fspr_arch_proc_mutex.h index 8caf3369dc..5270fbf277 100644 --- a/libs/apr/include/arch/os2/apr_arch_proc_mutex.h +++ b/libs/apr/include/arch/os2/fspr_arch_proc_mutex.h @@ -17,11 +17,11 @@ #ifndef PROC_MUTEX_H #define PROC_MUTEX_H -#include "apr_proc_mutex.h" -#include "apr_file_io.h" +#include "fspr_proc_mutex.h" +#include "fspr_file_io.h" -struct apr_proc_mutex_t { - apr_pool_t *pool; +struct fspr_proc_mutex_t { + fspr_pool_t *pool; HMTX hMutex; TID owner; int lock_count; diff --git a/libs/apr/include/arch/os2/apr_arch_thread_cond.h b/libs/apr/include/arch/os2/fspr_arch_thread_cond.h similarity index 89% rename from libs/apr/include/arch/os2/apr_arch_thread_cond.h rename to libs/apr/include/arch/os2/fspr_arch_thread_cond.h index 648b85d148..6a2ecd8e01 100644 --- a/libs/apr/include/arch/os2/apr_arch_thread_cond.h +++ b/libs/apr/include/arch/os2/fspr_arch_thread_cond.h @@ -17,11 +17,11 @@ #ifndef THREAD_COND_H #define THREAD_COND_H -#include "apr_thread_cond.h" -#include "apr_file_io.h" +#include "fspr_thread_cond.h" +#include "fspr_file_io.h" -struct apr_thread_cond_t { - apr_pool_t *pool; +struct fspr_thread_cond_t { + fspr_pool_t *pool; }; #endif /* THREAD_COND_H */ diff --git a/libs/apr/include/arch/os2/apr_arch_thread_mutex.h b/libs/apr/include/arch/os2/fspr_arch_thread_mutex.h similarity index 89% rename from libs/apr/include/arch/os2/apr_arch_thread_mutex.h rename to libs/apr/include/arch/os2/fspr_arch_thread_mutex.h index 3ae2a41db7..fc6aeed45a 100644 --- a/libs/apr/include/arch/os2/apr_arch_thread_mutex.h +++ b/libs/apr/include/arch/os2/fspr_arch_thread_mutex.h @@ -17,11 +17,11 @@ #ifndef THREAD_MUTEX_H #define THREAD_MUTEX_H -#include "apr_thread_mutex.h" -#include "apr_file_io.h" +#include "fspr_thread_mutex.h" +#include "fspr_file_io.h" -struct apr_thread_mutex_t { - apr_pool_t *pool; +struct fspr_thread_mutex_t { + fspr_pool_t *pool; HMTX hMutex; }; diff --git a/libs/apr/include/arch/os2/apr_arch_thread_rwlock.h b/libs/apr/include/arch/os2/fspr_arch_thread_rwlock.h similarity index 89% rename from libs/apr/include/arch/os2/apr_arch_thread_rwlock.h rename to libs/apr/include/arch/os2/fspr_arch_thread_rwlock.h index 7187d5cb2e..fa721bf5a2 100644 --- a/libs/apr/include/arch/os2/apr_arch_thread_rwlock.h +++ b/libs/apr/include/arch/os2/fspr_arch_thread_rwlock.h @@ -17,11 +17,11 @@ #ifndef THREAD_RWLOCK_H #define THREAD_RWLOCK_H -#include "apr_thread_rwlock.h" -#include "apr_file_io.h" +#include "fspr_thread_rwlock.h" +#include "fspr_file_io.h" -struct apr_thread_rwlock_t { - apr_pool_t *pool; +struct fspr_thread_rwlock_t { + fspr_pool_t *pool; int readers; HMTX write_lock; HEV read_done; diff --git a/libs/apr/include/arch/os2/apr_arch_threadproc.h b/libs/apr/include/arch/os2/fspr_arch_threadproc.h similarity index 64% rename from libs/apr/include/arch/os2/apr_arch_threadproc.h rename to libs/apr/include/arch/os2/fspr_arch_threadproc.h index c8017adbff..ac1aa39c10 100644 --- a/libs/apr/include/arch/os2/apr_arch_threadproc.h +++ b/libs/apr/include/arch/os2/fspr_arch_threadproc.h @@ -14,8 +14,8 @@ * limitations under the License. */ -#include "apr_thread_proc.h" -#include "apr_file_io.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" #ifndef THREAD_PROC_H #define THREAD_PROC_H @@ -25,40 +25,40 @@ #define SHELL_PATH "cmd.exe" #define APR_THREAD_STACKSIZE 65536 -struct apr_threadattr_t { - apr_pool_t *pool; +struct fspr_threadattr_t { + fspr_pool_t *pool; unsigned long attr; - apr_size_t stacksize; + fspr_size_t stacksize; }; -struct apr_thread_t { - apr_pool_t *pool; - struct apr_threadattr_t *attr; +struct fspr_thread_t { + fspr_pool_t *pool; + struct fspr_threadattr_t *attr; unsigned long tid; - apr_thread_start_t func; + fspr_thread_start_t func; void *data; - apr_status_t exitval; + fspr_status_t exitval; }; -struct apr_threadkey_t { - apr_pool_t *pool; +struct fspr_threadkey_t { + fspr_pool_t *pool; unsigned long *key; }; -struct apr_procattr_t { - apr_pool_t *pool; - apr_file_t *parent_in; - apr_file_t *child_in; - apr_file_t *parent_out; - apr_file_t *child_out; - apr_file_t *parent_err; - apr_file_t *child_err; +struct fspr_procattr_t { + fspr_pool_t *pool; + fspr_file_t *parent_in; + fspr_file_t *child_in; + fspr_file_t *parent_out; + fspr_file_t *child_out; + fspr_file_t *parent_err; + fspr_file_t *child_err; char *currdir; - apr_int32_t cmdtype; - apr_int32_t detached; + fspr_int32_t cmdtype; + fspr_int32_t detached; }; -struct apr_thread_once_t { +struct fspr_thread_once_t { unsigned long sem; char hit; }; diff --git a/libs/apr/include/arch/os390/apr_arch_dso.h b/libs/apr/include/arch/os390/fspr_arch_dso.h similarity index 86% rename from libs/apr/include/arch/os390/apr_arch_dso.h rename to libs/apr/include/arch/os390/fspr_arch_dso.h index 4263297b40..5fb8845ff6 100644 --- a/libs/apr/include/arch/os390/apr_arch_dso.h +++ b/libs/apr/include/arch/os390/fspr_arch_dso.h @@ -17,21 +17,21 @@ #ifndef DSO_H #define DSO_H -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_dso.h" -#include "apr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_dso.h" +#include "fspr.h" #if APR_HAS_DSO #include -struct apr_dso_handle_t { +struct fspr_dso_handle_t { dllhandle *handle; /* Handle to the DSO loaded */ int failing_errno; /* Don't save the buffer returned by strerror(); it gets reused */ - apr_pool_t *pool; + fspr_pool_t *pool; }; #endif diff --git a/libs/apr/include/arch/unix/apr_arch_dso.h b/libs/apr/include/arch/unix/fspr_arch_dso.h similarity index 88% rename from libs/apr/include/arch/unix/apr_arch_dso.h rename to libs/apr/include/arch/unix/fspr_arch_dso.h index d82182d48b..c65ccfccca 100644 --- a/libs/apr/include/arch/unix/apr_arch_dso.h +++ b/libs/apr/include/arch/unix/fspr_arch_dso.h @@ -17,11 +17,11 @@ #ifndef DSO_H #define DSO_H -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_dso.h" -#include "apr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_dso.h" +#include "fspr.h" #if APR_HAS_DSO @@ -52,8 +52,8 @@ #define DLSYM_NEEDS_UNDERSCORE #endif -struct apr_dso_handle_t { - apr_pool_t *pool; +struct fspr_dso_handle_t { + fspr_pool_t *pool; void *handle; const char *errormsg; }; diff --git a/libs/apr/include/arch/unix/apr_arch_file_io.h b/libs/apr/include/arch/unix/fspr_arch_file_io.h similarity index 80% rename from libs/apr/include/arch/unix/apr_arch_file_io.h rename to libs/apr/include/arch/unix/fspr_arch_file_io.h index 05ef8ed741..70a1cf9984 100644 --- a/libs/apr/include/arch/unix/apr_arch_file_io.h +++ b/libs/apr/include/arch/unix/fspr_arch_file_io.h @@ -17,17 +17,17 @@ #ifndef FILE_IO_H #define FILE_IO_H -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_tables.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_lib.h" -#include "apr_thread_mutex.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_tables.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_lib.h" +#include "fspr_thread_mutex.h" #ifndef WAITIO_USES_POLL -#include "apr_poll.h" +#include "fspr_poll.h" #endif /* System headers the file I/O library needs */ @@ -84,29 +84,29 @@ #define APR_FILE_BUFSIZE 4096 -struct apr_file_t { - apr_pool_t *pool; +struct fspr_file_t { + fspr_pool_t *pool; int filedes; char *fname; - apr_int32_t flags; + fspr_int32_t flags; int eof_hit; int is_pipe; - apr_interval_time_t timeout; + fspr_interval_time_t timeout; int buffered; enum {BLK_UNKNOWN, BLK_OFF, BLK_ON } blocking; int ungetchar; /* Last char provided by an unget op. (-1 = no char)*/ #ifndef WAITIO_USES_POLL /* if there is a timeout set, then this pollset is used */ - apr_pollset_t *pollset; + fspr_pollset_t *pollset; #endif /* Stuff for buffered mode */ char *buffer; int bufpos; /* Read/Write position in buffer */ unsigned long dataRead; /* amount of valid data read into buffer */ int direction; /* buffer being used for 0 = read, 1 = write */ - apr_off_t filePtr; /* position in file of handle */ + fspr_off_t filePtr; /* position in file of handle */ #if APR_HAS_THREADS - struct apr_thread_mutex_t *thlock; + struct fspr_thread_mutex_t *thlock; #endif }; @@ -121,17 +121,17 @@ typedef struct stat64 struct_stat; typedef struct stat struct_stat; #endif -struct apr_dir_t { - apr_pool_t *pool; +struct fspr_dir_t { + fspr_pool_t *pool; char *dirname; DIR *dirstruct; struct dirent *entry; }; -apr_status_t apr_unix_file_cleanup(void *); +fspr_status_t fspr_unix_file_cleanup(void *); -mode_t apr_unix_perms2mode(apr_fileperms_t perms); -apr_fileperms_t apr_unix_mode2perms(mode_t mode); +mode_t fspr_unix_perms2mode(fspr_fileperms_t perms); +fspr_fileperms_t fspr_unix_mode2perms(mode_t mode); #endif /* ! FILE_IO_H */ diff --git a/libs/apr/include/arch/unix/apr_arch_global_mutex.h b/libs/apr/include/arch/unix/fspr_arch_global_mutex.h similarity index 74% rename from libs/apr/include/arch/unix/apr_arch_global_mutex.h rename to libs/apr/include/arch/unix/fspr_arch_global_mutex.h index 3add9ecfa7..85c8c68745 100644 --- a/libs/apr/include/arch/unix/apr_arch_global_mutex.h +++ b/libs/apr/include/arch/unix/fspr_arch_global_mutex.h @@ -17,19 +17,19 @@ #ifndef GLOBAL_MUTEX_H #define GLOBAL_MUTEX_H -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_global_mutex.h" -#include "apr_arch_proc_mutex.h" -#include "apr_arch_thread_mutex.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_global_mutex.h" +#include "fspr_arch_proc_mutex.h" +#include "fspr_arch_thread_mutex.h" -struct apr_global_mutex_t { - apr_pool_t *pool; - apr_proc_mutex_t *proc_mutex; +struct fspr_global_mutex_t { + fspr_pool_t *pool; + fspr_proc_mutex_t *proc_mutex; #if APR_HAS_THREADS - apr_thread_mutex_t *thread_mutex; + fspr_thread_mutex_t *thread_mutex; #endif /* APR_HAS_THREADS */ }; diff --git a/libs/apr/include/arch/unix/apr_arch_inherit.h b/libs/apr/include/arch/unix/fspr_arch_inherit.h similarity index 85% rename from libs/apr/include/arch/unix/apr_arch_inherit.h rename to libs/apr/include/arch/unix/fspr_arch_inherit.h index 9a6bdbca58..50c9ca9c19 100644 --- a/libs/apr/include/arch/unix/apr_arch_inherit.h +++ b/libs/apr/include/arch/unix/fspr_arch_inherit.h @@ -17,32 +17,32 @@ #ifndef INHERIT_H #define INHERIT_H -#include "apr_inherit.h" +#include "fspr_inherit.h" #define APR_INHERIT (1 << 24) /* Must not conflict with other bits */ #define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup) \ -apr_status_t apr_##name##_inherit_set(apr_##name##_t *the##name) \ +fspr_status_t fspr_##name##_inherit_set(fspr_##name##_t *the##name) \ { \ if (the##name->flag & APR_FILE_NOCLEANUP) \ return APR_EINVAL; \ if (!(the##name->flag & APR_INHERIT)) { \ the##name->flag |= APR_INHERIT; \ - apr_pool_child_cleanup_set(the##name->pool, \ + fspr_pool_child_cleanup_set(the##name->pool, \ (void *)the##name, \ - cleanup, apr_pool_cleanup_null); \ + cleanup, fspr_pool_cleanup_null); \ } \ return APR_SUCCESS; \ } #define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup) \ -apr_status_t apr_##name##_inherit_unset(apr_##name##_t *the##name) \ +fspr_status_t fspr_##name##_inherit_unset(fspr_##name##_t *the##name) \ { \ if (the##name->flag & APR_FILE_NOCLEANUP) \ return APR_EINVAL; \ if (the##name->flag & APR_INHERIT) { \ the##name->flag &= ~APR_INHERIT; \ - apr_pool_child_cleanup_set(the##name->pool, \ + fspr_pool_child_cleanup_set(the##name->pool, \ (void *)the##name, \ cleanup, cleanup); \ } \ diff --git a/libs/apr/include/arch/unix/apr_arch_internal_time.h b/libs/apr/include/arch/unix/fspr_arch_internal_time.h similarity index 94% rename from libs/apr/include/arch/unix/apr_arch_internal_time.h rename to libs/apr/include/arch/unix/fspr_arch_internal_time.h index 6e12c67439..4ea5d3e95d 100644 --- a/libs/apr/include/arch/unix/apr_arch_internal_time.h +++ b/libs/apr/include/arch/unix/fspr_arch_internal_time.h @@ -17,8 +17,8 @@ #ifndef TIME_INTERNAL_H #define TIME_INTERNAL_H -#include "apr.h" +#include "fspr.h" -void apr_unix_setup_time(void); +void fspr_unix_setup_time(void); #endif /* TIME_INTERNAL_H */ diff --git a/libs/apr/include/arch/unix/apr_arch_misc.h b/libs/apr/include/arch/unix/fspr_arch_misc.h similarity index 76% rename from libs/apr/include/arch/unix/apr_arch_misc.h rename to libs/apr/include/arch/unix/fspr_arch_misc.h index 823512506c..70b3b5531d 100644 --- a/libs/apr/include/arch/unix/apr_arch_misc.h +++ b/libs/apr/include/arch/unix/fspr_arch_misc.h @@ -17,16 +17,16 @@ #ifndef MISC_H #define MISC_H -#include "apr.h" -#include "apr_portable.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_getopt.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_errno.h" -#include "apr_getopt.h" +#include "fspr.h" +#include "fspr_portable.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_getopt.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_errno.h" +#include "fspr_getopt.h" #if APR_HAVE_STDIO_H #include @@ -49,13 +49,13 @@ #include #endif -struct apr_other_child_rec_t { - apr_pool_t *p; - struct apr_other_child_rec_t *next; - apr_proc_t *proc; +struct fspr_other_child_rec_t { + fspr_pool_t *p; + struct fspr_other_child_rec_t *next; + fspr_proc_t *proc; void (*maintenance) (int, void *, int); void *data; - apr_os_file_t write_fd; + fspr_os_file_t write_fd; }; #if defined(WIN32) || defined(NETWARE) diff --git a/libs/apr/include/arch/unix/apr_arch_networkio.h b/libs/apr/include/arch/unix/fspr_arch_networkio.h similarity index 80% rename from libs/apr/include/arch/unix/apr_arch_networkio.h rename to libs/apr/include/arch/unix/fspr_arch_networkio.h index 91018f7c6b..facbfe4382 100644 --- a/libs/apr/include/arch/unix/apr_arch_networkio.h +++ b/libs/apr/include/arch/unix/fspr_arch_networkio.h @@ -17,14 +17,14 @@ #ifndef NETWORK_IO_H #define NETWORK_IO_H -#include "apr.h" -#include "apr_private.h" -#include "apr_network_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_network_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" #ifndef WAITIO_USES_POLL -#include "apr_poll.h" +#include "fspr_poll.h" #endif /* System headers the network I/O library needs */ @@ -100,37 +100,37 @@ struct sock_userdata_t { void *data; }; -struct apr_socket_t { - apr_pool_t *pool; +struct fspr_socket_t { + fspr_pool_t *pool; int socketdes; int type; int protocol; - apr_sockaddr_t *local_addr; - apr_sockaddr_t *remote_addr; - apr_interval_time_t timeout; + fspr_sockaddr_t *local_addr; + fspr_sockaddr_t *remote_addr; + fspr_interval_time_t timeout; #ifndef HAVE_POLL int connected; #endif int local_port_unknown; int local_interface_unknown; int remote_addr_unknown; - apr_int32_t options; - apr_int32_t inherit; + fspr_int32_t options; + fspr_int32_t inherit; sock_userdata_t *userdata; #ifndef WAITIO_USES_POLL /* if there is a timeout set, then this pollset is used */ - apr_pollset_t *pollset; + fspr_pollset_t *pollset; #endif }; -const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size); -int apr_inet_pton(int af, const char *src, void *dst); -void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t); +const char *fspr_inet_ntop(int af, const void *src, char *dst, fspr_size_t size); +int fspr_inet_pton(int af, const char *src, void *dst); +void fspr_sockaddr_vars_set(fspr_sockaddr_t *, int, fspr_port_t); -#define apr_is_option_set(skt, option) \ +#define fspr_is_option_set(skt, option) \ (((skt)->options & (option)) == (option)) -#define apr_set_option(skt, option, on) \ +#define fspr_set_option(skt, option, on) \ do { \ if (on) \ (skt)->options |= (option); \ diff --git a/libs/apr/include/arch/unix/apr_arch_poll_private.h b/libs/apr/include/arch/unix/fspr_arch_poll_private.h similarity index 83% rename from libs/apr/include/arch/unix/apr_arch_poll_private.h rename to libs/apr/include/arch/unix/fspr_arch_poll_private.h index f176eac0e5..93ad7b891c 100644 --- a/libs/apr/include/arch/unix/apr_arch_poll_private.h +++ b/libs/apr/include/arch/unix/fspr_arch_poll_private.h @@ -17,12 +17,12 @@ #ifndef APR_ARCH_POLL_PRIVATE_H #define APR_ARCH_POLL_PRIVATE_H -#include "apr.h" -#include "apr_poll.h" -#include "apr_time.h" -#include "apr_portable.h" -#include "apr_arch_networkio.h" -#include "apr_arch_file_io.h" +#include "fspr.h" +#include "fspr_poll.h" +#include "fspr_time.h" +#include "fspr_portable.h" +#include "fspr_arch_networkio.h" +#include "fspr_arch_file_io.h" #if HAVE_POLL_H #include @@ -52,7 +52,7 @@ #define HAS_PIPES(dt) (dt == APR_POLL_FILE) ? 1 : 0 #endif -/* Choose the best method platform specific to use in apr_pollset */ +/* Choose the best method platform specific to use in fspr_pollset */ #ifdef HAVE_KQUEUE #define POLLSET_USES_KQUEUE #elif defined(HAVE_PORT_CREATE) @@ -73,16 +73,16 @@ #if defined(POLLSET_USES_KQUEUE) || defined(POLLSET_USES_EPOLL) || defined(POLLSET_USES_PORT) -#include "apr_ring.h" +#include "fspr_ring.h" #if APR_HAS_THREADS -#include "apr_thread_mutex.h" +#include "fspr_thread_mutex.h" #define pollset_lock_rings() \ if (pollset->flags & APR_POLLSET_THREADSAFE) \ - apr_thread_mutex_lock(pollset->ring_lock); + fspr_thread_mutex_lock(pollset->ring_lock); #define pollset_unlock_rings() \ if (pollset->flags & APR_POLLSET_THREADSAFE) \ - apr_thread_mutex_unlock(pollset->ring_lock); + fspr_thread_mutex_unlock(pollset->ring_lock); #else #define pollset_lock_rings() #define pollset_unlock_rings() @@ -92,7 +92,7 @@ typedef struct pfd_elem_t pfd_elem_t; struct pfd_elem_t { APR_RING_ENTRY(pfd_elem_t) link; - apr_pollfd_t pfd; + fspr_pollfd_t pfd; }; #endif diff --git a/libs/apr/include/arch/unix/apr_arch_proc_mutex.h b/libs/apr/include/arch/unix/fspr_arch_proc_mutex.h similarity index 68% rename from libs/apr/include/arch/unix/apr_arch_proc_mutex.h rename to libs/apr/include/arch/unix/fspr_arch_proc_mutex.h index a307d94657..8f21801c7a 100644 --- a/libs/apr/include/arch/unix/apr_arch_proc_mutex.h +++ b/libs/apr/include/arch/unix/fspr_arch_proc_mutex.h @@ -23,15 +23,15 @@ #endif #endif -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_proc_mutex.h" -#include "apr_pools.h" -#include "apr_portable.h" -#include "apr_file_io.h" -#include "apr_arch_file_io.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_proc_mutex.h" +#include "fspr_pools.h" +#include "fspr_portable.h" +#include "fspr_file_io.h" +#include "fspr_arch_file_io.h" /* System headers required by Locks library */ #if APR_HAVE_SYS_TYPES_H @@ -73,19 +73,19 @@ #endif /* End System Headers */ -struct apr_proc_mutex_unix_lock_methods_t { +struct fspr_proc_mutex_unix_lock_methods_t { unsigned int flags; - apr_status_t (*create)(apr_proc_mutex_t *, const char *); - apr_status_t (*acquire)(apr_proc_mutex_t *); - apr_status_t (*tryacquire)(apr_proc_mutex_t *); - apr_status_t (*release)(apr_proc_mutex_t *); - apr_status_t (*cleanup)(void *); - apr_status_t (*child_init)(apr_proc_mutex_t **, apr_pool_t *, const char *); + fspr_status_t (*create)(fspr_proc_mutex_t *, const char *); + fspr_status_t (*acquire)(fspr_proc_mutex_t *); + fspr_status_t (*tryacquire)(fspr_proc_mutex_t *); + fspr_status_t (*release)(fspr_proc_mutex_t *); + fspr_status_t (*cleanup)(void *); + fspr_status_t (*child_init)(fspr_proc_mutex_t **, fspr_pool_t *, const char *); const char *name; }; -typedef struct apr_proc_mutex_unix_lock_methods_t apr_proc_mutex_unix_lock_methods_t; +typedef struct fspr_proc_mutex_unix_lock_methods_t fspr_proc_mutex_unix_lock_methods_t; -/* bit values for flags field in apr_unix_lock_methods_t */ +/* bit values for flags field in fspr_unix_lock_methods_t */ #define APR_PROCESS_LOCK_MECH_IS_GLOBAL 1 #if !APR_HAVE_UNION_SEMUN && defined(APR_HAS_SYSVSEM_SERIALIZE) @@ -96,14 +96,14 @@ union semun { }; #endif -struct apr_proc_mutex_t { - apr_pool_t *pool; - const apr_proc_mutex_unix_lock_methods_t *meth; - const apr_proc_mutex_unix_lock_methods_t *inter_meth; +struct fspr_proc_mutex_t { + fspr_pool_t *pool; + const fspr_proc_mutex_unix_lock_methods_t *meth; + const fspr_proc_mutex_unix_lock_methods_t *inter_meth; int curr_locked; char *fname; #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE - apr_file_t *interproc; + fspr_file_t *interproc; #endif #if APR_HAS_POSIXSEM_SERIALIZE sem_t *psem_interproc; @@ -113,7 +113,7 @@ struct apr_proc_mutex_t { #endif }; -void apr_proc_mutex_unix_setup_lock(void); +void fspr_proc_mutex_unix_setup_lock(void); #endif /* PROC_MUTEX_H */ diff --git a/libs/apr/include/arch/unix/apr_arch_shm.h b/libs/apr/include/arch/unix/fspr_arch_shm.h similarity index 81% rename from libs/apr/include/arch/unix/apr_arch_shm.h rename to libs/apr/include/arch/unix/fspr_arch_shm.h index dbd9b9bc5c..39b344ccdf 100644 --- a/libs/apr/include/arch/unix/apr_arch_shm.h +++ b/libs/apr/include/arch/unix/fspr_arch_shm.h @@ -17,15 +17,15 @@ #ifndef SHM_H #define SHM_H -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_shm.h" -#include "apr_pools.h" -#include "apr_file_io.h" -#include "apr_network_io.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_shm.h" +#include "fspr_pools.h" +#include "fspr_file_io.h" +#include "fspr_network_io.h" +#include "fspr_portable.h" #ifdef HAVE_SYS_MMAN_H #include @@ -55,12 +55,12 @@ #define MAP_FAILED ((void *)-1) #endif -struct apr_shm_t { - apr_pool_t *pool; +struct fspr_shm_t { + fspr_pool_t *pool; void *base; /* base real address */ void *usable; /* base usable address */ - apr_size_t reqsize; /* requested segment size */ - apr_size_t realsize; /* actual segment size */ + fspr_size_t reqsize; /* requested segment size */ + fspr_size_t realsize; /* actual segment size */ const char *filename; /* NULL if anonymous */ #if APR_USE_SHMEM_SHMGET || APR_USE_SHMEM_SHMGET_ANON int shmid; /* shmem ID returned from shmget() */ diff --git a/libs/apr/include/arch/unix/apr_arch_thread_cond.h b/libs/apr/include/arch/unix/fspr_arch_thread_cond.h similarity index 82% rename from libs/apr/include/arch/unix/apr_arch_thread_cond.h rename to libs/apr/include/arch/unix/fspr_arch_thread_cond.h index 5c2b51d1f4..369bc23b17 100644 --- a/libs/apr/include/arch/unix/apr_arch_thread_cond.h +++ b/libs/apr/include/arch/unix/fspr_arch_thread_cond.h @@ -17,13 +17,13 @@ #ifndef THREAD_COND_H #define THREAD_COND_H -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_thread_mutex.h" -#include "apr_thread_cond.h" -#include "apr_pools.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_thread_mutex.h" +#include "fspr_thread_cond.h" +#include "fspr_pools.h" #if APR_HAVE_PTHREAD_H #include @@ -32,8 +32,8 @@ /* XXX: Should we have a better autoconf search, something like * APR_HAS_PTHREAD_COND? -aaron */ #if APR_HAS_THREADS -struct apr_thread_cond_t { - apr_pool_t *pool; +struct fspr_thread_cond_t { + fspr_pool_t *pool; pthread_cond_t cond; }; #endif diff --git a/libs/apr/include/arch/unix/apr_arch_thread_mutex.h b/libs/apr/include/arch/unix/fspr_arch_thread_mutex.h similarity index 83% rename from libs/apr/include/arch/unix/apr_arch_thread_mutex.h rename to libs/apr/include/arch/unix/fspr_arch_thread_mutex.h index 0f9798701e..b11bd4ae1b 100644 --- a/libs/apr/include/arch/unix/apr_arch_thread_mutex.h +++ b/libs/apr/include/arch/unix/fspr_arch_thread_mutex.h @@ -23,20 +23,20 @@ #endif #endif -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_thread_mutex.h" -#include "apr_portable.h" -#include "apr_atomic.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_thread_mutex.h" +#include "fspr_portable.h" +#include "fspr_atomic.h" #if APR_HAVE_PTHREAD_H #include #endif #if APR_HAS_THREADS -struct apr_thread_mutex_t { - apr_pool_t *pool; +struct fspr_thread_mutex_t { + fspr_pool_t *pool; pthread_mutex_t mutex; }; #endif diff --git a/libs/apr/include/arch/unix/apr_arch_thread_rwlock.h b/libs/apr/include/arch/unix/fspr_arch_thread_rwlock.h similarity index 82% rename from libs/apr/include/arch/unix/apr_arch_thread_rwlock.h rename to libs/apr/include/arch/unix/fspr_arch_thread_rwlock.h index 2cb43af6a3..06a7e2a232 100644 --- a/libs/apr/include/arch/unix/apr_arch_thread_rwlock.h +++ b/libs/apr/include/arch/unix/fspr_arch_thread_rwlock.h @@ -17,11 +17,11 @@ #ifndef THREAD_RWLOCK_H #define THREAD_RWLOCK_H -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_thread_rwlock.h" -#include "apr_pools.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_thread_rwlock.h" +#include "fspr_pools.h" #if APR_HAVE_PTHREAD_H /* this gives us pthread_rwlock_t */ @@ -31,15 +31,15 @@ #if APR_HAS_THREADS #ifdef HAVE_PTHREAD_RWLOCKS -struct apr_thread_rwlock_t { - apr_pool_t *pool; +struct fspr_thread_rwlock_t { + fspr_pool_t *pool; pthread_rwlock_t rwlock; }; #else -struct apr_thread_rwlock_t { - apr_pool_t *pool; +struct fspr_thread_rwlock_t { + fspr_pool_t *pool; }; #endif diff --git a/libs/apr/include/arch/unix/apr_arch_threadproc.h b/libs/apr/include/arch/unix/fspr_arch_threadproc.h similarity index 71% rename from libs/apr/include/arch/unix/apr_arch_threadproc.h rename to libs/apr/include/arch/unix/fspr_arch_threadproc.h index 348c6c55d3..2573421b50 100644 --- a/libs/apr/include/arch/unix/apr_arch_threadproc.h +++ b/libs/apr/include/arch/unix/fspr_arch_threadproc.h @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_arch_file_io.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_arch_file_io.h" /* System headers required for thread/process library */ #if APR_HAVE_PTHREAD_H @@ -49,43 +49,43 @@ #if APR_HAS_THREADS -struct apr_thread_t { - apr_pool_t *pool; +struct fspr_thread_t { + fspr_pool_t *pool; pthread_t *td; void *data; - apr_thread_start_t func; - apr_status_t exitval; + fspr_thread_start_t func; + fspr_status_t exitval; int priority; }; -struct apr_threadattr_t { - apr_pool_t *pool; +struct fspr_threadattr_t { + fspr_pool_t *pool; pthread_attr_t attr; int priority; }; -struct apr_threadkey_t { - apr_pool_t *pool; +struct fspr_threadkey_t { + fspr_pool_t *pool; pthread_key_t key; }; -struct apr_thread_once_t { +struct fspr_thread_once_t { pthread_once_t once; }; #endif -struct apr_procattr_t { - apr_pool_t *pool; - apr_file_t *parent_in; - apr_file_t *child_in; - apr_file_t *parent_out; - apr_file_t *child_out; - apr_file_t *parent_err; - apr_file_t *child_err; +struct fspr_procattr_t { + fspr_pool_t *pool; + fspr_file_t *parent_in; + fspr_file_t *child_in; + fspr_file_t *parent_out; + fspr_file_t *child_out; + fspr_file_t *parent_err; + fspr_file_t *child_err; char *currdir; - apr_int32_t cmdtype; - apr_int32_t detached; + fspr_int32_t cmdtype; + fspr_int32_t detached; #ifdef RLIMIT_CPU struct rlimit *limit_cpu; #endif @@ -98,10 +98,10 @@ struct apr_procattr_t { #ifdef RLIMIT_NOFILE struct rlimit *limit_nofile; #endif - apr_child_errfn_t *errfn; - apr_int32_t errchk; - apr_uid_t uid; - apr_gid_t gid; + fspr_child_errfn_t *errfn; + fspr_int32_t errchk; + fspr_uid_t uid; + fspr_gid_t gid; }; #endif /* ! THREAD_PROC_H */ diff --git a/libs/apr/include/arch/win32/apr_arch_atime.h b/libs/apr/include/arch/win32/fspr_arch_atime.h similarity index 87% rename from libs/apr/include/arch/win32/apr_arch_atime.h rename to libs/apr/include/arch/win32/fspr_arch_atime.h index 47b75a9565..c1a47d12a9 100644 --- a/libs/apr/include/arch/win32/apr_arch_atime.h +++ b/libs/apr/include/arch/win32/fspr_arch_atime.h @@ -17,15 +17,15 @@ #ifndef ATIME_H #define ATIME_H -#include "apr_private.h" -#include "apr_time.h" +#include "fspr_private.h" +#include "fspr_time.h" #if APR_HAVE_TIME_H #include #endif struct atime_t { - apr_pool_t *cntxt; - apr_time_t currtime; + fspr_pool_t *cntxt; + fspr_time_t currtime; SYSTEMTIME *explodedtime; }; @@ -36,7 +36,7 @@ struct atime_t { #define APR_DELTA_EPOCH_IN_USEC APR_TIME_C(11644473600000000); -__inline void FileTimeToAprTime(apr_time_t *result, FILETIME *input) +__inline void FileTimeToAprTime(fspr_time_t *result, FILETIME *input) { /* Convert FILETIME one 64 bit number so we can work with it. */ *result = input->dwHighDateTime; @@ -48,7 +48,7 @@ __inline void FileTimeToAprTime(apr_time_t *result, FILETIME *input) } -__inline void AprTimeToFileTime(LPFILETIME pft, apr_time_t t) +__inline void AprTimeToFileTime(LPFILETIME pft, fspr_time_t t) { LONGLONG ll; t += APR_DELTA_EPOCH_IN_USEC; diff --git a/libs/apr/include/arch/win32/apr_arch_dso.h b/libs/apr/include/arch/win32/fspr_arch_dso.h similarity index 81% rename from libs/apr/include/arch/win32/apr_arch_dso.h rename to libs/apr/include/arch/win32/fspr_arch_dso.h index e2e4e40f2e..983b42eca7 100644 --- a/libs/apr/include/arch/win32/apr_arch_dso.h +++ b/libs/apr/include/arch/win32/fspr_arch_dso.h @@ -17,18 +17,18 @@ #ifndef DSO_H #define DSO_H -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_dso.h" -#include "apr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_dso.h" +#include "fspr.h" #if APR_HAS_DSO -struct apr_dso_handle_t { - apr_pool_t *cont; +struct fspr_dso_handle_t { + fspr_pool_t *cont; void *handle; - apr_status_t load_error; + fspr_status_t load_error; }; #endif diff --git a/libs/apr/include/arch/win32/apr_arch_file_io.h b/libs/apr/include/arch/win32/fspr_arch_file_io.h similarity index 72% rename from libs/apr/include/arch/win32/apr_arch_file_io.h rename to libs/apr/include/arch/win32/fspr_arch_file_io.h index 35c3c072ec..852d89dd65 100644 --- a/libs/apr/include/arch/win32/apr_arch_file_io.h +++ b/libs/apr/include/arch/win32/fspr_arch_file_io.h @@ -17,17 +17,17 @@ #ifndef FILE_IO_H #define FILE_IO_H -#include "apr.h" -#include "apr_private.h" -#include "apr_pools.h" -#include "apr_general.h" -#include "apr_tables.h" -#include "apr_thread_mutex.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_arch_misc.h" -#include "apr_poll.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_pools.h" +#include "fspr_general.h" +#include "fspr_tables.h" +#include "fspr_thread_mutex.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_arch_misc.h" +#include "fspr_poll.h" #ifdef HAVE_SYS_STAT_H #include @@ -49,10 +49,10 @@ #endif #if APR_HAS_UNICODE_FS -#include "arch/win32/apr_arch_utf8.h" +#include "arch/win32/fspr_arch_utf8.h" #include -typedef apr_uint16_t apr_wchar_t; +typedef fspr_uint16_t fspr_wchar_t; /* Helper functions for the WinNT ApiW() functions. APR treats all * resource identifiers (files, etc) by their UTF-8 name, to provide @@ -66,10 +66,10 @@ typedef apr_uint16_t apr_wchar_t; * Ascii API calls. So we tack them on in utf8_to_unicode_path, and * strip them right back off in unicode_to_utf8_path. */ -apr_status_t utf8_to_unicode_path(apr_wchar_t* dststr, apr_size_t dstchars, +fspr_status_t utf8_to_unicode_path(fspr_wchar_t* dststr, fspr_size_t dstchars, const char* srcstr); -apr_status_t unicode_to_utf8_path(char* dststr, apr_size_t dstchars, - const apr_wchar_t* srcstr); +fspr_status_t unicode_to_utf8_path(char* dststr, fspr_size_t dstchars, + const fspr_wchar_t* srcstr); #endif /* APR_HAS_UNICODE_FS */ @@ -80,7 +80,7 @@ apr_status_t unicode_to_utf8_path(char* dststr, apr_size_t dstchars, * and return the appropriate char* or wchar* for ApiA or ApiW calls. */ -void *res_name_from_filename(const char *file, int global, apr_pool_t *pool); +void *res_name_from_filename(const char *file, int global, fspr_pool_t *pool); #define APR_FILE_MAX MAX_PATH @@ -95,7 +95,7 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool); #define S_IFWHT 0160000 /* Whiteout */ #endif -/* Internal Flags for apr_file_open */ +/* Internal Flags for fspr_file_open */ #define APR_OPENINFO 0x00100000 /* Open without READ or WRITE access */ #define APR_OPENLINK 0x00200000 /* Open a link itself, if supported */ #define APR_READCONTROL 0x00400000 /* Read the file's owner/perms */ @@ -128,20 +128,20 @@ void *res_name_from_filename(const char *file, int global, apr_pool_t *pool); /* Sneak the Readonly bit through finfo->protection for internal use _only_ */ #define APR_FREADONLY 0x10000000 -/* Private function for apr_stat/lstat/getfileinfo/dir_read */ -int fillin_fileinfo(apr_finfo_t *finfo, WIN32_FILE_ATTRIBUTE_DATA *wininfo, - int byhandle, apr_int32_t wanted); +/* Private function for fspr_stat/lstat/getfileinfo/dir_read */ +int fillin_fileinfo(fspr_finfo_t *finfo, WIN32_FILE_ATTRIBUTE_DATA *wininfo, + int byhandle, fspr_int32_t wanted); -/* Private function that extends apr_stat/lstat/getfileinfo/dir_read */ -apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile, - apr_int32_t wanted, int whatfile); +/* Private function that extends fspr_stat/lstat/getfileinfo/dir_read */ +fspr_status_t more_finfo(fspr_finfo_t *finfo, const void *ufile, + fspr_int32_t wanted, int whatfile); /* whatfile types for the ufile arg */ #define MORE_OF_HANDLE 0 #define MORE_OF_FSPEC 1 #define MORE_OF_WFSPEC 2 -/* quick run-down of fields in windows' apr_file_t structure that may have +/* quick run-down of fields in windows' fspr_file_t structure that may have * obvious uses. * fname -- the filename as passed to the open call. * dwFileAttricutes -- Attributes used to open the file. @@ -150,19 +150,19 @@ apr_status_t more_finfo(apr_finfo_t *finfo, const void *ufile, * correctly when writing to a file with this flag set TRUE. */ -// for apr_poll.c; +// for fspr_poll.c; #define filedes filehand -struct apr_file_t { - apr_pool_t *pool; +struct fspr_file_t { + fspr_pool_t *pool; HANDLE filehand; BOOLEAN pipe; // Is this a pipe of a file? OVERLAPPED *pOverlapped; - apr_interval_time_t timeout; - apr_int32_t flags; + fspr_interval_time_t timeout; + fspr_int32_t flags; /* File specific info */ - apr_finfo_t *finfo; + fspr_finfo_t *finfo; char *fname; DWORD dwFileAttributes; int eof_hit; @@ -172,22 +172,22 @@ struct apr_file_t { /* Stuff for buffered mode */ char *buffer; - apr_size_t bufpos; // Read/Write position in buffer - apr_size_t dataRead; // amount of valid data read into buffer + fspr_size_t bufpos; // Read/Write position in buffer + fspr_size_t dataRead; // amount of valid data read into buffer int direction; // buffer being used for 0 = read, 1 = write - apr_off_t filePtr; // position in file of handle - apr_thread_mutex_t *mutex; // mutex semaphore, must be owned to access the above fields + fspr_off_t filePtr; // position in file of handle + fspr_thread_mutex_t *mutex; // mutex semaphore, must be owned to access the above fields /* if there is a timeout set, then this pollset is used */ - apr_pollset_t *pollset; + fspr_pollset_t *pollset; /* Pipe specific info */ }; -struct apr_dir_t { - apr_pool_t *pool; +struct fspr_dir_t { + fspr_pool_t *pool; HANDLE dirhand; - apr_size_t rootlen; + fspr_size_t rootlen; char *dirname; char *name; union { @@ -209,21 +209,21 @@ struct apr_dir_t { * or can confound the cmd.exe shell. Here's the list * [declared in filesys.c] */ -extern const char apr_c_is_fnchar[256]; +extern const char fspr_c_is_fnchar[256]; -#define IS_FNCHAR(c) (apr_c_is_fnchar[(unsigned char)(c)] & 1) -#define IS_SHCHAR(c) ((apr_c_is_fnchar[(unsigned char)(c)] & 2) == 2) +#define IS_FNCHAR(c) (fspr_c_is_fnchar[(unsigned char)(c)] & 1) +#define IS_SHCHAR(c) ((fspr_c_is_fnchar[(unsigned char)(c)] & 2) == 2) /* If the user passes APR_FILEPATH_TRUENAME to either - * apr_filepath_root or apr_filepath_merge, this fn determines + * fspr_filepath_root or fspr_filepath_merge, this fn determines * that the root really exists. It's expensive, wouldn't want * to do this too frequenly. */ -apr_status_t filepath_root_test(char *path, apr_pool_t *p); +fspr_status_t filepath_root_test(char *path, fspr_pool_t *p); -/* The apr_filepath_merge wants to canonicalize the cwd to the +/* The fspr_filepath_merge wants to canonicalize the cwd to the * addpath if the user passes NULL as the old root path (this * isn't true of an empty string "", which won't be concatenated. * @@ -233,18 +233,18 @@ apr_status_t filepath_root_test(char *path, apr_pool_t *p); * If flags includes the bit APR_FILEPATH_NATIVE, the path returned * is in the os-native format. */ -apr_status_t filepath_drive_get(char **rootpath, char drive, - apr_int32_t flags, apr_pool_t *p); +fspr_status_t filepath_drive_get(char **rootpath, char drive, + fspr_int32_t flags, fspr_pool_t *p); /* If the user passes d: vs. D: (or //mach/share vs. //MACH/SHARE), * we need to fold the case to canonical form. This function is * supposed to do so. */ -apr_status_t filepath_root_case(char **rootpath, char *root, apr_pool_t *p); +fspr_status_t filepath_root_case(char **rootpath, char *root, fspr_pool_t *p); -apr_status_t file_cleanup(void *); +fspr_status_t file_cleanup(void *); /** * Internal function to create a Win32/NT pipe that respects some async @@ -259,20 +259,20 @@ apr_status_t file_cleanup(void *); * APR_FULL_NONBLOCK * * @remark It so happens that APR_FULL_BLOCK and APR_FULL_NONBLOCK - * are common to apr_procattr_io_set() in, out and err modes. + * are common to fspr_procattr_io_set() in, out and err modes. * Because APR_CHILD_BLOCK and APR_WRITE_BLOCK share the same value, * as do APR_PARENT_BLOCK and APR_READ_BLOCK, it's possible to use * that value directly for creating the stdout/stderr pipes. When * creating the stdin pipe, the values must be transposed. - * @see apr_procattr_io_set + * @see fspr_procattr_io_set */ -apr_status_t apr_create_nt_pipe(apr_file_t **in, apr_file_t **out, - apr_int32_t blocking_mode, - apr_pool_t *p); +fspr_status_t fspr_create_nt_pipe(fspr_file_t **in, fspr_file_t **out, + fspr_int32_t blocking_mode, + fspr_pool_t *p); -/** @see apr_create_nt_pipe */ +/** @see fspr_create_nt_pipe */ #define APR_READ_BLOCK 3 -/** @see apr_create_nt_pipe */ +/** @see fspr_create_nt_pipe */ #define APR_WRITE_BLOCK 4 #endif /* ! FILE_IO_H */ diff --git a/libs/apr/include/arch/win32/apr_arch_inherit.h b/libs/apr/include/arch/win32/fspr_arch_inherit.h similarity index 87% rename from libs/apr/include/arch/win32/apr_arch_inherit.h rename to libs/apr/include/arch/win32/fspr_arch_inherit.h index 97c7d05d0a..02d9e05506 100644 --- a/libs/apr/include/arch/win32/apr_arch_inherit.h +++ b/libs/apr/include/arch/win32/fspr_arch_inherit.h @@ -17,19 +17,19 @@ #ifndef INHERIT_H #define INHERIT_H -#include "apr_inherit.h" +#include "fspr_inherit.h" #define APR_INHERIT (1 << 24) /* Must not conflict with other bits */ #define APR_IMPLEMENT_INHERIT_SET(name, flag, pool, cleanup) \ -APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \ +APR_DECLARE(fspr_status_t) fspr_##name##_inherit_set(fspr_##name##_t *the##name) \ { \ IF_WIN_OS_IS_UNICODE \ { \ if (!SetHandleInformation(the##name->filehand, \ HANDLE_FLAG_INHERIT, \ HANDLE_FLAG_INHERIT)) \ - return apr_get_os_error(); \ + return fspr_get_os_error(); \ } \ ELSE_WIN_OS_IS_ANSI \ { \ @@ -37,7 +37,7 @@ APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \ if (!DuplicateHandle(hproc, the##name->filehand, \ hproc, &temp, 0, TRUE, \ DUPLICATE_SAME_ACCESS)) \ - return apr_get_os_error(); \ + return fspr_get_os_error(); \ CloseHandle(the##name->filehand); \ the##name->filehand = temp; \ } \ @@ -45,13 +45,13 @@ APR_DECLARE(apr_status_t) apr_##name##_inherit_set(apr_##name##_t *the##name) \ } #define APR_IMPLEMENT_INHERIT_UNSET(name, flag, pool, cleanup) \ -APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *the##name)\ +APR_DECLARE(fspr_status_t) fspr_##name##_inherit_unset(fspr_##name##_t *the##name)\ { \ IF_WIN_OS_IS_UNICODE \ { \ if (!SetHandleInformation(the##name->filehand, \ HANDLE_FLAG_INHERIT, 0)) \ - return apr_get_os_error(); \ + return fspr_get_os_error(); \ } \ ELSE_WIN_OS_IS_ANSI \ { \ @@ -59,7 +59,7 @@ APR_DECLARE(apr_status_t) apr_##name##_inherit_unset(apr_##name##_t *the##name)\ if (!DuplicateHandle(hproc, the##name->filehand, \ hproc, &temp, 0, FALSE, \ DUPLICATE_SAME_ACCESS)) \ - return apr_get_os_error(); \ + return fspr_get_os_error(); \ CloseHandle(the##name->filehand); \ the##name->filehand = temp; \ } \ diff --git a/libs/apr/include/arch/win32/apr_arch_misc.h b/libs/apr/include/arch/win32/fspr_arch_misc.h similarity index 78% rename from libs/apr/include/arch/win32/apr_arch_misc.h rename to libs/apr/include/arch/win32/fspr_arch_misc.h index 6db6a1b9d2..89f01d1f6d 100644 --- a/libs/apr/include/arch/win32/apr_arch_misc.h +++ b/libs/apr/include/arch/win32/fspr_arch_misc.h @@ -17,16 +17,16 @@ #ifndef MISC_H #define MISC_H -#include "apr.h" -#include "apr_portable.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_getopt.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_errno.h" -#include "apr_getopt.h" +#include "fspr.h" +#include "fspr_portable.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_getopt.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_errno.h" +#include "fspr_getopt.h" #if APR_HAVE_STDIO_H #include @@ -46,26 +46,26 @@ #include #endif -struct apr_other_child_rec_t { - apr_pool_t *p; - struct apr_other_child_rec_t *next; - apr_proc_t *proc; +struct fspr_other_child_rec_t { + fspr_pool_t *p; + struct fspr_other_child_rec_t *next; + fspr_proc_t *proc; void (*maintenance) (int, void *, int); void *data; - apr_os_file_t write_fd; + fspr_os_file_t write_fd; }; #define WSAHighByte 2 #define WSALowByte 0 -/* start.c and apr_app.c helpers and communication within misc.c +/* start.c and fspr_app.c helpers and communication within misc.c * - * They are not for public consumption, although apr_app_init_complete + * They are not for public consumption, although fspr_app_init_complete * must be an exported symbol to avoid reinitialization. */ -extern int APR_DECLARE_DATA apr_app_init_complete; +extern int APR_DECLARE_DATA fspr_app_init_complete; -int apr_wastrtoastr(char const * const * *retarr, +int fspr_wastrtoastr(char const * const * *retarr, wchar_t const * const *arr, int args); /* Platform specific designation of run time os version. @@ -104,11 +104,11 @@ typedef enum { APR_WIN_XP_SP1 = 61, APR_WIN_XP_SP2 = 62, APR_WIN_2003 = 70 -} apr_oslevel_e; +} fspr_oslevel_e; -extern APR_DECLARE_DATA apr_oslevel_e apr_os_level; +extern APR_DECLARE_DATA fspr_oslevel_e fspr_os_level; -apr_status_t apr_get_oslevel(apr_oslevel_e *); +fspr_status_t fspr_get_oslevel(fspr_oslevel_e *); /* The APR_HAS_ANSI_FS symbol is PRIVATE, and internal to APR. * APR only supports char data for filenames. Like most applications, @@ -131,7 +131,7 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *); * build which supports only WINNT or WCE. */ #if APR_HAS_ANSI_FS && APR_HAS_UNICODE_FS -#define IF_WIN_OS_IS_UNICODE if (apr_os_level >= APR_WIN_UNICODE) +#define IF_WIN_OS_IS_UNICODE if (fspr_os_level >= APR_WIN_UNICODE) #define ELSE_WIN_OS_IS_ANSI else #else /* APR_HAS_UNICODE_FS */ #define IF_WIN_OS_IS_UNICODE @@ -146,26 +146,26 @@ typedef enum { DLL_SHSTDAPI = 4, // shell32 From ShellAPI.h DLL_NTDLL = 5, // shell32 From our real kernel DLL_defined = 6 // must define as last idx_ + 1 -} apr_dlltoken_e; +} fspr_dlltoken_e; -FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char *fnName, int ordinal); +FARPROC fspr_load_dll_func(fspr_dlltoken_e fnLib, char *fnName, int ordinal); -/* The apr_load_dll_func call WILL fault if the function cannot be loaded */ +/* The fspr_load_dll_func call WILL fault if the function cannot be loaded */ #define APR_DECLARE_LATE_DLL_FUNC(lib, rettype, calltype, fn, ord, args, names) \ - typedef rettype (calltype *apr_winapi_fpt_##fn) args; \ - static apr_winapi_fpt_##fn apr_winapi_pfn_##fn = NULL; \ - __inline rettype apr_winapi_##fn args \ - { if (!apr_winapi_pfn_##fn) \ - apr_winapi_pfn_##fn = (apr_winapi_fpt_##fn) \ - apr_load_dll_func(lib, #fn, ord); \ - return (*(apr_winapi_pfn_##fn)) names; }; \ + typedef rettype (calltype *fspr_winapi_fpt_##fn) args; \ + static fspr_winapi_fpt_##fn fspr_winapi_pfn_##fn = NULL; \ + __inline rettype fspr_winapi_##fn args \ + { if (!fspr_winapi_pfn_##fn) \ + fspr_winapi_pfn_##fn = (fspr_winapi_fpt_##fn) \ + fspr_load_dll_func(lib, #fn, ord); \ + return (*(fspr_winapi_pfn_##fn)) names; }; \ /* Provide late bound declarations of every API function missing from * one or more supported releases of the Win32 API * - * lib is the enumerated token from apr_dlltoken_e, and must correspond - * to the string table entry in start.c used by the apr_load_dll_func(). + * lib is the enumerated token from fspr_dlltoken_e, and must correspond + * to the string table entry in start.c used by the fspr_load_dll_func(). * Token names (attempt to) follow Windows.h declarations prefixed by DLL_ * in order to facilitate comparison. Use the exact declaration syntax * and names from Windows.h to prevent ambigutity and bugs. @@ -190,9 +190,9 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, GetFileAttributesExA, 0, IN GET_FILEEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFileInformation), (lpFileName, fInfoLevelId, lpFileInformation)); -#define GetFileAttributesExA apr_winapi_GetFileAttributesExA +#define GetFileAttributesExA fspr_winapi_GetFileAttributesExA #undef GetFileAttributesEx -#define GetFileAttributesEx apr_winapi_GetFileAttributesExA +#define GetFileAttributesEx fspr_winapi_GetFileAttributesExA #ifdef GetFileAttributesExW #undef GetFileAttributesExW @@ -202,29 +202,29 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, GetFileAttributesExW, 0, IN GET_FILEEX_INFO_LEVELS fInfoLevelId, OUT LPVOID lpFileInformation), (lpFileName, fInfoLevelId, lpFileInformation)); -#define GetFileAttributesExW apr_winapi_GetFileAttributesExW +#define GetFileAttributesExW fspr_winapi_GetFileAttributesExW APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, CancelIo, 0, ( IN HANDLE hFile), (hFile)); -#define CancelIo apr_winapi_CancelIo +#define CancelIo fspr_winapi_CancelIo APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, TryEnterCriticalSection, 0, ( LPCRITICAL_SECTION lpCriticalSection), (lpCriticalSection)); -#define TryEnterCriticalSection apr_winapi_TryEnterCriticalSection +#define TryEnterCriticalSection fspr_winapi_TryEnterCriticalSection APR_DECLARE_LATE_DLL_FUNC(DLL_WINBASEAPI, BOOL, WINAPI, SwitchToThread, 0, ( void), ()); -#define SwitchToThread apr_winapi_SwitchToThread +#define SwitchToThread fspr_winapi_SwitchToThread APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetEffectiveRightsFromAclW, 0, ( IN PACL pacl, IN PTRUSTEE_W pTrustee, OUT PACCESS_MASK pAccessRights), (pacl, pTrustee, pAccessRights)); -#define GetEffectiveRightsFromAclW apr_winapi_GetEffectiveRightsFromAclW +#define GetEffectiveRightsFromAclW fspr_winapi_GetEffectiveRightsFromAclW APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetNamedSecurityInfoW, 0, ( IN LPWSTR pObjectName, @@ -237,7 +237,7 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetNamedSecurityInfoW, 0, OUT PSECURITY_DESCRIPTOR *ppSecurityDescriptor), (pObjectName, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor)); -#define GetNamedSecurityInfoW apr_winapi_GetNamedSecurityInfoW +#define GetNamedSecurityInfoW fspr_winapi_GetNamedSecurityInfoW APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetNamedSecurityInfoA, 0, ( IN LPSTR pObjectName, @@ -250,9 +250,9 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetNamedSecurityInfoA, 0, OUT PSECURITY_DESCRIPTOR *ppSecurityDescriptor), (pObjectName, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor)); -#define GetNamedSecurityInfoA apr_winapi_GetNamedSecurityInfoA +#define GetNamedSecurityInfoA fspr_winapi_GetNamedSecurityInfoA #undef GetNamedSecurityInfo -#define GetNamedSecurityInfo apr_winapi_GetNamedSecurityInfoA +#define GetNamedSecurityInfo fspr_winapi_GetNamedSecurityInfoA APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetSecurityInfo, 0, ( IN HANDLE handle, @@ -265,13 +265,13 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_WINADVAPI, BOOL, WINAPI, GetSecurityInfo, 0, ( OUT PSECURITY_DESCRIPTOR *ppSecurityDescriptor), (handle, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor)); -#define GetSecurityInfo apr_winapi_GetSecurityInfo +#define GetSecurityInfo fspr_winapi_GetSecurityInfo APR_DECLARE_LATE_DLL_FUNC(DLL_SHSTDAPI, LPWSTR *, WINAPI, CommandLineToArgvW, 0, ( LPCWSTR lpCmdLine, int *pNumArgs), (lpCmdLine, pNumArgs)); -#define CommandLineToArgvW apr_winapi_CommandLineToArgvW +#define CommandLineToArgvW fspr_winapi_CommandLineToArgvW #endif /* !defined(_WIN32_WCE) && !defined(WINNT) */ @@ -282,14 +282,14 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryTimerResolution, 0, ( ULONG *pMinRes, /* Maximum NS Resolution */ ULONG *pCurRes), /* Current NS Resolution */ (pMaxRes, pMinRes, pCurRes)); -#define QueryTimerResolution apr_winapi_NtQueryTimerResolution +#define QueryTimerResolution fspr_winapi_NtQueryTimerResolution APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtSetTimerResolution, 0, ( ULONG ReqRes, /* Requested NS Clock Resolution */ BOOL Acquire, /* Aquire (1) or Release (0) our interest */ ULONG *pNewRes), /* The NS Clock Resolution granted */ (ReqRes, Acquire, pNewRes)); -#define SetTimerResolution apr_winapi_NtSetTimerResolution +#define SetTimerResolution fspr_winapi_NtSetTimerResolution /* ### These are ULONG_PTR values, but that's int32 for all we care * until the Win64 port is prepared. @@ -310,7 +310,7 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryInformationProcess, 0 ULONG LenPI, /* Use sizeof(PBI) */ ULONG *pSizePI), /* returns pPI buffer used (may pass NULL) */ (hProcess, info, pPI, LenPI, pSizePI)); -#define QueryInformationProcess apr_winapi_NtQueryInformationProcess +#define QueryInformationProcess fspr_winapi_NtQueryInformationProcess APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryObject, 0, ( HANDLE hObject, /* Obvious */ @@ -319,7 +319,7 @@ APR_DECLARE_LATE_DLL_FUNC(DLL_NTDLL, DWORD, WINAPI, NtQueryObject, 0, ( ULONG LenOI, /* Use sizeof(PBI) */ ULONG *pSizeOI), /* returns pPI buffer used (may pass NULL) */ (hObject, info, pOI, LenOI, pSizeOI)); -#define QueryObject apr_winapi_NtQueryObject +#define QueryObject fspr_winapi_NtQueryObject #endif /* !defined(_WIN32_WCE) */ diff --git a/libs/apr/include/arch/win32/apr_arch_networkio.h b/libs/apr/include/arch/win32/fspr_arch_networkio.h similarity index 74% rename from libs/apr/include/arch/win32/apr_arch_networkio.h rename to libs/apr/include/arch/win32/fspr_arch_networkio.h index bb58dde224..d125adc067 100644 --- a/libs/apr/include/arch/win32/apr_arch_networkio.h +++ b/libs/apr/include/arch/win32/fspr_arch_networkio.h @@ -17,9 +17,9 @@ #ifndef NETWORK_IO_H #define NETWORK_IO_H -#include "apr_network_io.h" -#include "apr_general.h" -#include "apr_poll.h" +#include "fspr_network_io.h" +#include "fspr_general.h" +#include "fspr_poll.h" #ifdef _MSC_VER #undef MCAST_JOIN_SOURCE_GROUP #endif @@ -31,24 +31,24 @@ struct sock_userdata_t { void *data; }; -struct apr_socket_t { - apr_pool_t *pool; +struct fspr_socket_t { + fspr_pool_t *pool; SOCKET socketdes; int type; /* SOCK_STREAM, SOCK_DGRAM */ int protocol; - apr_sockaddr_t *local_addr; - apr_sockaddr_t *remote_addr; + fspr_sockaddr_t *local_addr; + fspr_sockaddr_t *remote_addr; int timeout_ms; /* MUST MATCH if timeout > 0 */ - apr_interval_time_t timeout; - apr_int32_t disconnected; + fspr_interval_time_t timeout; + fspr_int32_t disconnected; int local_port_unknown; int local_interface_unknown; int remote_addr_unknown; - apr_int32_t options; - apr_int32_t inherit; + fspr_int32_t options; + fspr_int32_t inherit; #if APR_HAS_SENDFILE /* As of 07.20.04, the overlapped structure is only used by - * apr_socket_sendfile and that's where it will be allocated + * fspr_socket_sendfile and that's where it will be allocated * and initialized. */ OVERLAPPED *overlapped; @@ -56,7 +56,7 @@ struct apr_socket_t { sock_userdata_t *userdata; /* if there is a timeout set, then this pollset is used */ - apr_pollset_t *pollset; + fspr_pollset_t *pollset; }; #ifdef _WIN32_WCE @@ -71,16 +71,16 @@ typedef struct _WSABUF { #define HAVE_STRUCT_IPMREQ #endif -apr_status_t status_from_res_error(int); +fspr_status_t status_from_res_error(int); -const char *apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size); -int apr_inet_pton(int af, const char *src, void *dst); -void apr_sockaddr_vars_set(apr_sockaddr_t *, int, apr_port_t); +const char *fspr_inet_ntop(int af, const void *src, char *dst, fspr_size_t size); +int fspr_inet_pton(int af, const char *src, void *dst); +void fspr_sockaddr_vars_set(fspr_sockaddr_t *, int, fspr_port_t); -#define apr_is_option_set(skt, option) \ +#define fspr_is_option_set(skt, option) \ (((skt)->options & (option)) == (option)) -#define apr_set_option(skt, option, on) \ +#define fspr_set_option(skt, option, on) \ do { \ if (on) \ (skt)->options |= (option); \ diff --git a/libs/apr/include/arch/win32/apr_arch_proc_mutex.h b/libs/apr/include/arch/win32/fspr_arch_proc_mutex.h similarity index 92% rename from libs/apr/include/arch/win32/apr_arch_proc_mutex.h rename to libs/apr/include/arch/win32/fspr_arch_proc_mutex.h index 4e3e399399..cde7698a09 100644 --- a/libs/apr/include/arch/win32/apr_arch_proc_mutex.h +++ b/libs/apr/include/arch/win32/fspr_arch_proc_mutex.h @@ -17,10 +17,10 @@ #ifndef PROC_MUTEX_H #define PROC_MUTEX_H -#include "apr_proc_mutex.h" +#include "fspr_proc_mutex.h" -struct apr_proc_mutex_t { - apr_pool_t *pool; +struct fspr_proc_mutex_t { + fspr_pool_t *pool; HANDLE handle; const char *fname; }; diff --git a/libs/apr/include/arch/win32/apr_arch_thread_cond.h b/libs/apr/include/arch/win32/fspr_arch_thread_cond.h similarity index 92% rename from libs/apr/include/arch/win32/apr_arch_thread_cond.h rename to libs/apr/include/arch/win32/fspr_arch_thread_cond.h index c7f69f8064..482ddf4021 100644 --- a/libs/apr/include/arch/win32/apr_arch_thread_cond.h +++ b/libs/apr/include/arch/win32/fspr_arch_thread_cond.h @@ -17,10 +17,10 @@ #ifndef THREAD_COND_H #define THREAD_COND_H -#include "apr_thread_cond.h" +#include "fspr_thread_cond.h" -struct apr_thread_cond_t { - apr_pool_t *pool; +struct fspr_thread_cond_t { + fspr_pool_t *pool; HANDLE semaphore; CRITICAL_SECTION csection; unsigned long num_waiting; diff --git a/libs/apr/include/arch/win32/apr_arch_thread_mutex.h b/libs/apr/include/arch/win32/fspr_arch_thread_mutex.h similarity index 94% rename from libs/apr/include/arch/win32/apr_arch_thread_mutex.h rename to libs/apr/include/arch/win32/fspr_arch_thread_mutex.h index 13d3c1cbd5..c74255b86f 100644 --- a/libs/apr/include/arch/win32/apr_arch_thread_mutex.h +++ b/libs/apr/include/arch/win32/fspr_arch_thread_mutex.h @@ -17,7 +17,7 @@ #ifndef THREAD_MUTEX_H #define THREAD_MUTEX_H -#include "apr_pools.h" +#include "fspr_pools.h" typedef enum thread_mutex_type { thread_mutex_critical_section, @@ -29,8 +29,8 @@ typedef enum thread_mutex_type { * and nested_mutex on Win9x only. Otherwise critical_section * is used for NT nexted mutexes providing optimal performance. */ -struct apr_thread_mutex_t { - apr_pool_t *pool; +struct fspr_thread_mutex_t { + fspr_pool_t *pool; thread_mutex_type type; HANDLE handle; CRITICAL_SECTION section; diff --git a/libs/apr/include/arch/win32/apr_arch_thread_rwlock.h b/libs/apr/include/arch/win32/fspr_arch_thread_rwlock.h similarity index 92% rename from libs/apr/include/arch/win32/apr_arch_thread_rwlock.h rename to libs/apr/include/arch/win32/fspr_arch_thread_rwlock.h index 0a6889df83..28e8f953fe 100644 --- a/libs/apr/include/arch/win32/apr_arch_thread_rwlock.h +++ b/libs/apr/include/arch/win32/fspr_arch_thread_rwlock.h @@ -17,10 +17,10 @@ #ifndef THREAD_RWLOCK_H #define THREAD_RWLOCK_H -#include "apr_thread_rwlock.h" +#include "fspr_thread_rwlock.h" -struct apr_thread_rwlock_t { - apr_pool_t *pool; +struct fspr_thread_rwlock_t { + fspr_pool_t *pool; HANDLE write_mutex; HANDLE read_event; LONG readers; diff --git a/libs/apr/include/arch/win32/apr_arch_threadproc.h b/libs/apr/include/arch/win32/fspr_arch_threadproc.h similarity index 60% rename from libs/apr/include/arch/win32/apr_arch_threadproc.h rename to libs/apr/include/arch/win32/fspr_arch_threadproc.h index 056090bf11..47d9cff910 100644 --- a/libs/apr/include/arch/win32/apr_arch_threadproc.h +++ b/libs/apr/include/arch/win32/fspr_arch_threadproc.h @@ -14,50 +14,50 @@ * limitations under the License. */ -#include "apr_private.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" +#include "fspr_private.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" #ifndef THREAD_PROC_H #define THREAD_PROC_H #define SHELL_PATH "cmd.exe" -struct apr_thread_t { - apr_pool_t *pool; +struct fspr_thread_t { + fspr_pool_t *pool; HANDLE td; - apr_int32_t cancel; - apr_int32_t cancel_how; + fspr_int32_t cancel; + fspr_int32_t cancel_how; void *data; - apr_thread_start_t func; - apr_status_t exitval; + fspr_thread_start_t func; + fspr_status_t exitval; }; -struct apr_threadattr_t { - apr_pool_t *pool; - apr_int32_t detach; - apr_size_t stacksize; +struct fspr_threadattr_t { + fspr_pool_t *pool; + fspr_int32_t detach; + fspr_size_t stacksize; int priority; }; -struct apr_threadkey_t { - apr_pool_t *pool; +struct fspr_threadkey_t { + fspr_pool_t *pool; DWORD key; }; -struct apr_procattr_t { - apr_pool_t *pool; - apr_file_t *parent_in; - apr_file_t *child_in; - apr_file_t *parent_out; - apr_file_t *child_out; - apr_file_t *parent_err; - apr_file_t *child_err; +struct fspr_procattr_t { + fspr_pool_t *pool; + fspr_file_t *parent_in; + fspr_file_t *child_in; + fspr_file_t *parent_out; + fspr_file_t *child_out; + fspr_file_t *parent_err; + fspr_file_t *child_err; char *currdir; - apr_int32_t cmdtype; - apr_int32_t detached; - apr_child_errfn_t *errfn; - apr_int32_t errchk; + fspr_int32_t cmdtype; + fspr_int32_t detached; + fspr_child_errfn_t *errfn; + fspr_int32_t errchk; #ifndef _WIN32_WCE HANDLE user_token; LPSECURITY_ATTRIBUTES sa; @@ -65,7 +65,7 @@ struct apr_procattr_t { #endif }; -struct apr_thread_once_t { +struct fspr_thread_once_t { long value; }; diff --git a/libs/apr/include/arch/win32/apr_arch_utf8.h b/libs/apr/include/arch/win32/fspr_arch_utf8.h similarity index 76% rename from libs/apr/include/arch/win32/apr_arch_utf8.h rename to libs/apr/include/arch/win32/fspr_arch_utf8.h index 84f8bf775e..435ee03006 100644 --- a/libs/apr/include/arch/win32/apr_arch_utf8.h +++ b/libs/apr/include/arch/win32/fspr_arch_utf8.h @@ -17,13 +17,13 @@ #ifndef UTF8_H #define UTF8_H -#include "apr.h" -#include "apr_lib.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_lib.h" +#include "fspr_errno.h" /* If we ever support anything more exciting than char... this could move. */ -typedef apr_uint16_t apr_wchar_t; +typedef fspr_uint16_t fspr_wchar_t; /** * An APR internal function for fast utf-8 octet-encoded Unicode conversion @@ -34,10 +34,10 @@ typedef apr_uint16_t apr_wchar_t; * when the character code is invalid (in or out of context) and the later * when more characters were expected, but insufficient characters remain. */ -APR_DECLARE(apr_status_t) apr_conv_utf8_to_ucs2(const char *in, - apr_size_t *inbytes, - apr_wchar_t *out, - apr_size_t *outwords); +APR_DECLARE(fspr_status_t) fspr_conv_utf8_to_ucs2(const char *in, + fspr_size_t *inbytes, + fspr_wchar_t *out, + fspr_size_t *outwords); /** * An APR internal function for fast ucs-2 wide Unicode format conversion to @@ -48,9 +48,9 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_to_ucs2(const char *in, * when the character code is invalid (in or out of context) and the later * when more words were expected, but insufficient words remain. */ -APR_DECLARE(apr_status_t) apr_conv_ucs2_to_utf8(const apr_wchar_t *in, - apr_size_t *inwords, +APR_DECLARE(fspr_status_t) fspr_conv_ucs2_to_utf8(const fspr_wchar_t *in, + fspr_size_t *inwords, char *out, - apr_size_t *outbytes); + fspr_size_t *outbytes); #endif /* def UTF8_H */ diff --git a/libs/apr/include/arch/win32/apr_dbg_win32_handles.h b/libs/apr/include/arch/win32/fspr_dbg_win32_handles.h similarity index 62% rename from libs/apr/include/arch/win32/apr_dbg_win32_handles.h rename to libs/apr/include/arch/win32/fspr_dbg_win32_handles.h index 471cd66dbf..ba576016a8 100644 --- a/libs/apr/include/arch/win32/apr_dbg_win32_handles.h +++ b/libs/apr/include/arch/win32/fspr_dbg_win32_handles.h @@ -23,18 +23,18 @@ extern "C" { /* USAGE: * - * Add the following include to apr_private.h for internal debugging, + * Add the following include to fspr_private.h for internal debugging, * or copy this header into apr/include add the include below to apr.h * for really global debugging; * - * #include "apr_dbg_win32_handles.h" + * #include "fspr_dbg_win32_handles.h" * - * apr_dbg_log is the crux of this function ... it uses Win32 API and + * fspr_dbg_log is the crux of this function ... it uses Win32 API and * no apr calls itself to log all activity to a file named for the * executing application with a .pid suffix. Ergo several instances * may be executing and logged at once. * - * HANDLE apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, int nh + * HANDLE fspr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, int nh * [, HANDLE *hv, char *dsc...]) * * returns: the handle passed in ha, which is cast back to the real return type. @@ -42,7 +42,7 @@ extern "C" { * formats one line into the debug log file if nh is zero; * ha (hex) seq(hex) tid(hex) fn fl ln * xxxxxxxx xxxxxxxx xxxxxxxx func() sourcefile:lineno - * The macro apr_dbg_rv makes this simple to implement for many APIs + * The macro fspr_dbg_rv makes this simple to implement for many APIs * that simply take args that don't interest us, and return a handle. * * formats multiple lines (nh) into the debug log file for each hv/dsc pair @@ -53,67 +53,67 @@ extern "C" { * treated as a handle. */ -APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, +APR_DECLARE_NONSTD(HANDLE) fspr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, int nh,/* HANDLE *hv, char *dsc */...); -#define apr_dbg_rv(fn, args) (apr_dbg_log(#fn,(fn) args,__FILE__,__LINE__,0)) +#define fspr_dbg_rv(fn, args) (fspr_dbg_log(#fn,(fn) args,__FILE__,__LINE__,0)) #define CloseHandle(h) \ - ((BOOL)apr_dbg_log("CloseHandle", \ + ((BOOL)fspr_dbg_log("CloseHandle", \ (HANDLE)(CloseHandle)(h), \ __FILE__,__LINE__,1, \ &(h),"")) -#define CreateEventA(sd,b1,b2,nm) apr_dbg_rv(CreateEventA,(sd,b1,b2,nm)) -#define CreateEventW(sd,b1,b2,nm) apr_dbg_rv(CreateEventW,(sd,b1,b2,nm)) +#define CreateEventA(sd,b1,b2,nm) fspr_dbg_rv(CreateEventA,(sd,b1,b2,nm)) +#define CreateEventW(sd,b1,b2,nm) fspr_dbg_rv(CreateEventW,(sd,b1,b2,nm)) -#define CreateFileA(nm,d1,d2,sd,d3,d4,h) apr_dbg_rv(CreateFileA,(nm,d1,d2,sd,d3,d4,h)) -#define CreateFileW(nm,d1,d2,sd,d3,d4,h) apr_dbg_rv(CreateFileW,(nm,d1,d2,sd,d3,d4,h)) +#define CreateFileA(nm,d1,d2,sd,d3,d4,h) fspr_dbg_rv(CreateFileA,(nm,d1,d2,sd,d3,d4,h)) +#define CreateFileW(nm,d1,d2,sd,d3,d4,h) fspr_dbg_rv(CreateFileW,(nm,d1,d2,sd,d3,d4,h)) -#define CreateFileMappingA(fh,sd,d1,d2,d3,nm) apr_dbg_rv(CreateFileMappingA,(fh,sd,d1,d2,d3,nm)) -#define CreateFileMappingW(fh,sd,d1,d2,d3,nm) apr_dbg_rv(CreateFileMappingW,(fh,sd,d1,d2,d3,nm)) +#define CreateFileMappingA(fh,sd,d1,d2,d3,nm) fspr_dbg_rv(CreateFileMappingA,(fh,sd,d1,d2,d3,nm)) +#define CreateFileMappingW(fh,sd,d1,d2,d3,nm) fspr_dbg_rv(CreateFileMappingW,(fh,sd,d1,d2,d3,nm)) -#define CreateMutexA(sd,b,nm) apr_dbg_rv(CreateMutexA,(sd,b,nm)) -#define CreateMutexW(sd,b,nm) apr_dbg_rv(CreateMutexW,(sd,b,nm)) +#define CreateMutexA(sd,b,nm) fspr_dbg_rv(CreateMutexA,(sd,b,nm)) +#define CreateMutexW(sd,b,nm) fspr_dbg_rv(CreateMutexW,(sd,b,nm)) -#define CreateIoCompletionPort(h1,h2,pd1,d2) apr_dbg_rv(CreateIoCompletionPort,(h1,h2,pd1,d2)) +#define CreateIoCompletionPort(h1,h2,pd1,d2) fspr_dbg_rv(CreateIoCompletionPort,(h1,h2,pd1,d2)) -#define CreateNamedPipeA(nm,d1,d2,d3,d4,d5,d6,sd) apr_dbg_rv(CreateNamedPipeA,(nm,d1,d2,d3,d4,d5,d6,sd)) -#define CreateNamedPipeW(nm,d1,d2,d3,d4,d5,d6,sd) apr_dbg_rv(CreateNamedPipeW,(nm,d1,d2,d3,d4,d5,d6,sd)) +#define CreateNamedPipeA(nm,d1,d2,d3,d4,d5,d6,sd) fspr_dbg_rv(CreateNamedPipeA,(nm,d1,d2,d3,d4,d5,d6,sd)) +#define CreateNamedPipeW(nm,d1,d2,d3,d4,d5,d6,sd) fspr_dbg_rv(CreateNamedPipeW,(nm,d1,d2,d3,d4,d5,d6,sd)) #define CreatePipe(ph1,ph2,sd,d) \ - ((BOOL)apr_dbg_log("CreatePipe", \ + ((BOOL)fspr_dbg_log("CreatePipe", \ (HANDLE)(CreatePipe)(ph1,ph2,sd,d), \ __FILE__,__LINE__,2, \ (ph1),"hRead", \ (ph2),"hWrite")) #define CreateProcessA(s1,s2,sd1,sd2,b,d1,s3,s4,pd2,hr) \ - ((BOOL)apr_dbg_log("CreateProcessA", \ + ((BOOL)fspr_dbg_log("CreateProcessA", \ (HANDLE)(CreateProcessA)(s1,s2,sd1,sd2,b,d1,s3,s4,pd2,hr), \ __FILE__,__LINE__,2, \ &((hr)->hProcess),"hProcess", \ &((hr)->hThread),"hThread")) #define CreateProcessW(s1,s2,sd1,sd2,b,d1,s3,s4,pd2,hr) \ - ((BOOL)apr_dbg_log("CreateProcessW", \ + ((BOOL)fspr_dbg_log("CreateProcessW", \ (HANDLE)(CreateProcessW)(s1,s2,sd1,sd2,b,d1,s3,s4,pd2,hr), \ __FILE__,__LINE__,2, \ &((hr)->hProcess),"hProcess", \ &((hr)->hThread),"hThread")) -#define CreateSemaphoreA(sd,d1,d2,nm) apr_dbg_rv(CreateSemaphoreA,(sd,d1,d2,nm)) -#define CreateSemaphoreW(sd,d1,d2,nm) apr_dbg_rv(CreateSemaphoreW,(sd,d1,d2,nm)) +#define CreateSemaphoreA(sd,d1,d2,nm) fspr_dbg_rv(CreateSemaphoreA,(sd,d1,d2,nm)) +#define CreateSemaphoreW(sd,d1,d2,nm) fspr_dbg_rv(CreateSemaphoreW,(sd,d1,d2,nm)) -#define CreateThread(sd,d1,fn,pv,d2,pd3) apr_dbg_rv(CreateThread,(sd,d1,fn,pv,d2,pd3)) +#define CreateThread(sd,d1,fn,pv,d2,pd3) fspr_dbg_rv(CreateThread,(sd,d1,fn,pv,d2,pd3)) #define DeregisterEventSource(h) \ - ((BOOL)apr_dbg_log("DeregisterEventSource", \ + ((BOOL)fspr_dbg_log("DeregisterEventSource", \ (HANDLE)(DeregisterEventSource)(h), \ __FILE__,__LINE__,1, \ &(h),"")) #define DuplicateHandle(h1,h2,h3,ph4,d1,b,d2) \ - ((BOOL)apr_dbg_log("DuplicateHandle", \ + ((BOOL)fspr_dbg_log("DuplicateHandle", \ (HANDLE)(DuplicateHandle)(h1,h2,h3,ph4,d1,b,d2), \ __FILE__,__LINE__,2, \ (ph4),((h3)==GetCurrentProcess()) \ @@ -122,91 +122,91 @@ APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, ? "Source" : "EXTERN Source")) #define GetCurrentProcess() \ - (apr_dbg_log("GetCurrentProcess", \ + (fspr_dbg_log("GetCurrentProcess", \ (GetCurrentProcess)(),__FILE__,__LINE__,0)) #define GetCurrentThread() \ - (apr_dbg_log("GetCurrentThread", \ + (fspr_dbg_log("GetCurrentThread", \ (GetCurrentThread)(),__FILE__,__LINE__,0)) -#define GetModuleHandleA(nm) apr_dbg_rv(GetModuleHandleA,(nm)) -#define GetModuleHandleW(nm) apr_dbg_rv(GetModuleHandleW,(nm)) +#define GetModuleHandleA(nm) fspr_dbg_rv(GetModuleHandleA,(nm)) +#define GetModuleHandleW(nm) fspr_dbg_rv(GetModuleHandleW,(nm)) -#define GetStdHandle(d) apr_dbg_rv(GetStdHandle,(d)) +#define GetStdHandle(d) fspr_dbg_rv(GetStdHandle,(d)) -#define LoadLibraryA(nm) apr_dbg_rv(LoadLibraryA,(nm)) -#define LoadLibraryW(nm) apr_dbg_rv(LoadLibraryW,(nm)) +#define LoadLibraryA(nm) fspr_dbg_rv(LoadLibraryA,(nm)) +#define LoadLibraryW(nm) fspr_dbg_rv(LoadLibraryW,(nm)) -#define LoadLibraryExA(nm,h,d) apr_dbg_rv(LoadLibraryExA,(nm,h,d)) -#define LoadLibraryExW(nm,h,d) apr_dbg_rv(LoadLibraryExW,(nm,h,d)) +#define LoadLibraryExA(nm,h,d) fspr_dbg_rv(LoadLibraryExA,(nm,h,d)) +#define LoadLibraryExW(nm,h,d) fspr_dbg_rv(LoadLibraryExW,(nm,h,d)) -#define OpenEventA(d,b,nm) apr_dbg_rv(OpenEventA,(d,b,nm)) -#define OpenEventW(d,b,nm) apr_dbg_rv(OpenEventW,(d,b,nm)) +#define OpenEventA(d,b,nm) fspr_dbg_rv(OpenEventA,(d,b,nm)) +#define OpenEventW(d,b,nm) fspr_dbg_rv(OpenEventW,(d,b,nm)) -#define OpenFileMappingA(d,b,nm) apr_dbg_rv(OpenFileMappingA,(d,b,nm)) -#define OpenFileMappingW(d,b,nm) apr_dbg_rv(OpenFileMappingW,(d,b,nm)) +#define OpenFileMappingA(d,b,nm) fspr_dbg_rv(OpenFileMappingA,(d,b,nm)) +#define OpenFileMappingW(d,b,nm) fspr_dbg_rv(OpenFileMappingW,(d,b,nm)) -#define RegisterEventSourceA(s1,s2) apr_dbg_rv(RegisterEventSourceA,(s1,s2)) -#define RegisterEventSourceW(s1,s2) apr_dbg_rv(RegisterEventSourceW,(s1,s2)) +#define RegisterEventSourceA(s1,s2) fspr_dbg_rv(RegisterEventSourceA,(s1,s2)) +#define RegisterEventSourceW(s1,s2) fspr_dbg_rv(RegisterEventSourceW,(s1,s2)) #define SetEvent(h) \ - ((BOOL)apr_dbg_log("SetEvent", \ + ((BOOL)fspr_dbg_log("SetEvent", \ (HANDLE)(SetEvent)(h), \ __FILE__,__LINE__,1, \ &(h),"")) #define SetStdHandle(d,h) \ - ((BOOL)apr_dbg_log("SetStdHandle", \ + ((BOOL)fspr_dbg_log("SetStdHandle", \ (HANDLE)(SetStdHandle)(d,h), \ __FILE__,__LINE__,1,&(h),"")) #define socket(i1,i2,i3) \ - ((SOCKET)apr_dbg_log("socket", \ + ((SOCKET)fspr_dbg_log("socket", \ (HANDLE)(socket)(i1,i2,i3), \ __FILE__,__LINE__,0)) #define WaitForSingleObject(h,d) \ - ((DWORD)apr_dbg_log("WaitForSingleObject", \ + ((DWORD)fspr_dbg_log("WaitForSingleObject", \ (HANDLE)(WaitForSingleObject)(h,d), \ __FILE__,__LINE__,1,&(h),"Signaled")) #define WaitForSingleObjectEx(h,d,b) \ - ((DWORD)apr_dbg_log("WaitForSingleObjectEx", \ + ((DWORD)fspr_dbg_log("WaitForSingleObjectEx", \ (HANDLE)(WaitForSingleObjectEx)(h,d,b), \ __FILE__,__LINE__,1,&(h),"Signaled")) #define WaitForMultipleObjects(d1,ah,b,d2) \ - ((DWORD)apr_dbg_log("WaitForMultipleObjects", \ + ((DWORD)fspr_dbg_log("WaitForMultipleObjects", \ (HANDLE)(WaitForMultipleObjects)(d1,ah,b,d2), \ __FILE__,__LINE__,1,ah,"Signaled")) #define WaitForMultipleObjectsEx(d1,ah,b1,d2,b2) \ - ((DWORD)apr_dbg_log("WaitForMultipleObjectsEx", \ + ((DWORD)fspr_dbg_log("WaitForMultipleObjectsEx", \ (HANDLE)(WaitForMultipleObjectsEx)(d1,ah,b1,d2,b2), \ __FILE__,__LINE__,1,ah,"Signaled")) #define WSASocketA(i1,i2,i3,pi,g,dw) \ - ((SOCKET)apr_dbg_log("WSASocketA", \ + ((SOCKET)fspr_dbg_log("WSASocketA", \ (HANDLE)(WSASocketA)(i1,i2,i3,pi,g,dw), \ __FILE__,__LINE__,0)) #define WSASocketW(i1,i2,i3,pi,g,dw) \ - ((SOCKET)apr_dbg_log("WSASocketW", \ + ((SOCKET)fspr_dbg_log("WSASocketW", \ (HANDLE)(WSASocketW)(i1,i2,i3,pi,g,dw), \ __FILE__,__LINE__,0)) #define closesocket(sh) \ - ((int)apr_dbg_log("closesocket", \ + ((int)fspr_dbg_log("closesocket", \ (HANDLE)(closesocket)(sh), \ __FILE__,__LINE__,1,&(sh),"")) #define _beginthread(fn,d,pv) \ - ((unsigned long)apr_dbg_log("_beginthread", \ + ((unsigned long)fspr_dbg_log("_beginthread", \ (HANDLE)(_beginthread)(fn,d,pv), \ __FILE__,__LINE__,0)) #define _beginthreadex(sd,d1,fn,pv,d2,pd3) \ - ((unsigned long)apr_dbg_log("_beginthreadex", \ + ((unsigned long)fspr_dbg_log("_beginthreadex", \ (HANDLE)(_beginthreadex)(sd,d1,fn,pv,d2,pd3), \ __FILE__,__LINE__,0)) diff --git a/libs/apr/include/arch/win32/apr_private.h b/libs/apr/include/arch/win32/fspr_private.h similarity index 97% rename from libs/apr/include/arch/win32/apr_private.h rename to libs/apr/include/arch/win32/fspr_private.h index 0dc5f98963..53af7067ef 100644 --- a/libs/apr/include/arch/win32/apr_private.h +++ b/libs/apr/include/arch/win32/fspr_private.h @@ -28,7 +28,7 @@ /* Include the public APR symbols, include our idea of the 'right' * subset of the Windows.h header. This saves us repetition. */ -#include "apr.h" +#include "fspr.h" /* * Add a _very_few_ declarations missing from the restricted set of headers @@ -153,7 +153,7 @@ APR_DECLARE_DATA int errno; #ifdef APR_INT64_STRFN #define APR_OFF_T_STRFN APR_INT64_STRFN #else -#define APR_OFF_T_STRFN apr_strtoi64 +#define APR_OFF_T_STRFN fspr_strtoi64 #endif #else #define APR_OFF_T_STRFN strtoi @@ -165,7 +165,7 @@ APR_DECLARE_DATA int errno; /* * Include common private declarations. */ -#include "../apr_private_common.h" +#include "../fspr_private_common.h" #endif /*APR_PRIVATE_H*/ #endif /*WIN32*/ diff --git a/libs/apr/include/apr.h.in b/libs/apr/include/fspr.h.in similarity index 92% rename from libs/apr/include/apr.h.in rename to libs/apr/include/fspr.h.in index 2a916184b7..4c0e80b400 100644 --- a/libs/apr/include/apr.h.in +++ b/libs/apr/include/fspr.h.in @@ -38,7 +38,7 @@ * @{ */ /** - * @defgroup apr_platform Platform Definitions + * @defgroup fspr_platform Platform Definitions * @{ */ @@ -152,7 +152,7 @@ extern "C" { #endif /** - * @addtogroup apr_platform + * @addtogroup fspr_platform * @ingroup APR * @{ */ @@ -254,21 +254,21 @@ extern "C" { /* Typedefs that APR needs. */ -typedef unsigned char apr_byte_t; +typedef unsigned char fspr_byte_t; -typedef @short_value@ apr_int16_t; -typedef unsigned @short_value@ apr_uint16_t; +typedef @short_value@ fspr_int16_t; +typedef unsigned @short_value@ fspr_uint16_t; -typedef @int_value@ apr_int32_t; -typedef unsigned @int_value@ apr_uint32_t; +typedef @int_value@ fspr_int32_t; +typedef unsigned @int_value@ fspr_uint32_t; -typedef @long_value@ apr_int64_t; -typedef unsigned @long_value@ apr_uint64_t; +typedef @long_value@ fspr_int64_t; +typedef unsigned @long_value@ fspr_uint64_t; -typedef @size_t_value@ apr_size_t; -typedef @ssize_t_value@ apr_ssize_t; -typedef @off_t_value@ apr_off_t; -typedef @socklen_t_value@ apr_socklen_t; +typedef @size_t_value@ fspr_size_t; +typedef @ssize_t_value@ fspr_ssize_t; +typedef @off_t_value@ fspr_off_t; +typedef @socklen_t_value@ fspr_socklen_t; #define APR_SIZEOF_VOIDP @voidp_size@ @@ -286,7 +286,7 @@ typedef @socklen_t_value@ apr_socklen_t; * so that they follow the platform's calling convention. * @example */ -/** void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data); +/** void* APR_THREAD_FUNC my_thread_entry_fn(fspr_thread_t *thd, void *data); */ #define APR_THREAD_FUNC @@ -298,7 +298,7 @@ typedef @socklen_t_value@ apr_socklen_t; * @remark Both the declaration and implementations must use the same macro. * @example */ -/** APR_DECLARE(rettype) apr_func(args) +/** APR_DECLARE(rettype) fspr_func(args) * @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA * @remark Note that when APR compiles the library itself, it passes the * symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32) @@ -319,7 +319,7 @@ typedef @socklen_t_value@ apr_socklen_t; * @remark Both the declaration and implementations must use the same macro. * @example */ -/** APR_DECLARE_NONSTD(rettype) apr_func(args, ...); +/** APR_DECLARE_NONSTD(rettype) fspr_func(args, ...); */ #define APR_DECLARE_NONSTD(type) type @@ -331,8 +331,8 @@ typedef @socklen_t_value@ apr_socklen_t; * but both must include the macro. * @example */ -/** extern APR_DECLARE_DATA type apr_variable;\n - * APR_DECLARE_DATA type apr_variable = value; +/** extern APR_DECLARE_DATA type fspr_variable;\n + * APR_DECLARE_DATA type fspr_variable = value; */ #define APR_DECLARE_DATA @@ -373,9 +373,9 @@ typedef @socklen_t_value@ apr_socklen_t; #if APR_HAVE_SYS_WAIT_H #ifdef WEXITSTATUS -#define apr_wait_t int +#define fspr_wait_t int #else -#define apr_wait_t union wait +#define fspr_wait_t union wait #define WEXITSTATUS(status) (int)((status).w_retcode) #define WTERMSIG(status) (int)((status).w_termsig) #endif /* !WEXITSTATUS */ diff --git a/libs/apr/include/apr.hnw b/libs/apr/include/fspr.hnw similarity index 91% rename from libs/apr/include/apr.hnw rename to libs/apr/include/fspr.hnw index 6f1e1559e5..774103f835 100644 --- a/libs/apr/include/apr.hnw +++ b/libs/apr/include/fspr.hnw @@ -73,7 +73,7 @@ extern "C" { #endif /** - * @defgroup apr_platform Platform Definitions + * @defgroup fspr_platform Platform Definitions * @ingroup APR * @{ */ @@ -232,28 +232,28 @@ extern "C" { /* Typedefs that APR needs. */ -typedef unsigned char apr_byte_t; +typedef unsigned char fspr_byte_t; -typedef short apr_int16_t; -typedef unsigned short apr_uint16_t; +typedef short fspr_int16_t; +typedef unsigned short fspr_uint16_t; -typedef int apr_int32_t; -typedef unsigned int apr_uint32_t; +typedef int fspr_int32_t; +typedef unsigned int fspr_uint32_t; -typedef long long apr_int64_t; -typedef unsigned long long apr_uint64_t; +typedef long long fspr_int64_t; +typedef unsigned long long fspr_uint64_t; -typedef size_t apr_size_t; -typedef ssize_t apr_ssize_t; +typedef size_t fspr_size_t; +typedef ssize_t fspr_ssize_t; #if APR_HAS_LARGE_FILES -typedef off64_t apr_off_t; +typedef off64_t fspr_off_t; #else -typedef off_t apr_off_t; +typedef off_t fspr_off_t; #endif #ifdef USE_WINSOCK -typedef int apr_socklen_t; +typedef int fspr_socklen_t; #else -typedef size_t apr_socklen_t; +typedef size_t fspr_socklen_t; #endif /* Are we big endian? */ @@ -280,7 +280,7 @@ typedef size_t apr_socklen_t; * so that they follow the platform's calling convention. * @example */ -/** void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data); +/** void* APR_THREAD_FUNC my_thread_entry_fn(fspr_thread_t *thd, void *data); */ #define APR_THREAD_FUNC @@ -292,7 +292,7 @@ typedef size_t apr_socklen_t; * @remark Both the declaration and implementations must use the same macro. * @example */ -/** APR_DECLARE(rettype) apr_func(args) +/** APR_DECLARE(rettype) fspr_func(args) * @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA * @remark Note that when APR compiles the library itself, it passes the * symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32) @@ -313,7 +313,7 @@ typedef size_t apr_socklen_t; * @remark Both the declaration and implementations must use the same macro. * @example */ -/** APR_DECLARE_NONSTD(rettype) apr_func(args, ...); +/** APR_DECLARE_NONSTD(rettype) fspr_func(args, ...); */ #define APR_DECLARE_NONSTD(type) type @@ -325,8 +325,8 @@ typedef size_t apr_socklen_t; * but both must include the macro. * @example */ -/** extern APR_DECLARE_DATA type apr_variable;\n - * APR_DECLARE_DATA type apr_variable = value; +/** extern APR_DECLARE_DATA type fspr_variable;\n + * APR_DECLARE_DATA type fspr_variable = value; */ #define APR_DECLARE_DATA @@ -345,7 +345,7 @@ typedef size_t apr_socklen_t; /* Local machine definition for console and log output. */ #define APR_EOL_STR "\r\n" -typedef int apr_wait_t; +typedef int fspr_wait_t; #define APR_PATH_MAX PATH_MAX diff --git a/libs/apr/include/apr.hw b/libs/apr/include/fspr.hw similarity index 92% rename from libs/apr/include/apr.hw rename to libs/apr/include/fspr.hw index aa47ec0374..e061ae49bf 100644 --- a/libs/apr/include/apr.hw +++ b/libs/apr/include/fspr.hw @@ -106,7 +106,7 @@ #endif /* !_WINDOWS_ */ /** - * @defgroup apr_platform Platform Definitions + * @defgroup fspr_platform Platform Definitions * @ingroup APR * @{ */ @@ -275,7 +275,7 @@ extern "C" { #endif /** - * @addtogroup apr_platform + * @addtogroup fspr_platform * @ingroup APR * @{ */ @@ -322,29 +322,29 @@ extern "C" { /* Typedefs that APR needs. */ -typedef unsigned char apr_byte_t; +typedef unsigned char fspr_byte_t; -typedef short apr_int16_t; -typedef unsigned short apr_uint16_t; +typedef short fspr_int16_t; +typedef unsigned short fspr_uint16_t; -typedef int apr_int32_t; -typedef unsigned int apr_uint32_t; +typedef int fspr_int32_t; +typedef unsigned int fspr_uint32_t; -typedef __int64 apr_int64_t; -typedef unsigned __int64 apr_uint64_t; +typedef __int64 fspr_int64_t; +typedef unsigned __int64 fspr_uint64_t; -typedef size_t apr_size_t; +typedef size_t fspr_size_t; #if APR_HAVE_STDDEF_H -typedef ptrdiff_t apr_ssize_t; +typedef ptrdiff_t fspr_ssize_t; #else -typedef int apr_ssize_t; +typedef int fspr_ssize_t; #endif #if APR_HAS_LARGE_FILES -typedef __int64 apr_off_t; +typedef __int64 fspr_off_t; #else -typedef int apr_off_t; +typedef int fspr_off_t; #endif -typedef int apr_socklen_t; +typedef int fspr_socklen_t; /* Are we big endian? */ /* XXX: Fatal assumption on Alpha platforms */ @@ -356,7 +356,7 @@ typedef int apr_socklen_t; #define APR_SIZEOF_VOIDP 4 #endif -/* XXX These simply don't belong here, perhaps in apr_portable.h +/* XXX These simply don't belong here, perhaps in fspr_portable.h * based on some APR_HAVE_PID/GID/UID? */ typedef int pid_t; @@ -378,8 +378,8 @@ typedef int gid_t; #ifndef WS2TCPIP_INLINE #define IN6_IS_ADDR_V4MAPPED(a) \ - ( (*(const apr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \ - && (*(const apr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) + ( (*(const fspr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \ + && (*(const fspr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff))) #endif #endif /* APR_HAS_IPV6 */ @@ -391,7 +391,7 @@ typedef int gid_t; * so that they follow the platform's calling convention. * @example */ -/** void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data); +/** void* APR_THREAD_FUNC my_thread_entry_fn(fspr_thread_t *thd, void *data); */ #define APR_THREAD_FUNC __stdcall @@ -406,7 +406,7 @@ typedef int gid_t; * @remark Both the declaration and implementations must use the same macro. * @example */ -/** APR_DECLARE(rettype) apr_func(args) +/** APR_DECLARE(rettype) fspr_func(args) * @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA * @remark Note that when APR compiles the library itself, it passes the * symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32) @@ -427,7 +427,7 @@ typedef int gid_t; * @remark Both the declaration and implementations must use the same macro. * @example */ -/** APR_DECLARE_NONSTD(rettype) apr_func(args, ...); +/** APR_DECLARE_NONSTD(rettype) fspr_func(args, ...); */ #define APR_DECLARE_NONSTD(type) type @@ -439,8 +439,8 @@ typedef int gid_t; * but both must include the macro. * @example */ -/** extern APR_DECLARE_DATA type apr_variable;\n - * APR_DECLARE_DATA type apr_variable = value; +/** extern APR_DECLARE_DATA type fspr_variable;\n + * APR_DECLARE_DATA type fspr_variable = value; */ #define APR_DECLARE_DATA @@ -484,12 +484,12 @@ typedef int gid_t; /* No difference between PROC and GLOBAL mutex */ #define APR_PROC_MUTEX_IS_GLOBAL 1 -typedef int apr_wait_t; +typedef int fspr_wait_t; /* struct iovec is needed to emulate Unix writev */ struct iovec { char* iov_base; - apr_size_t iov_len; + fspr_size_t iov_len; }; /* Nasty Win32 .h ommissions we really need */ diff --git a/libs/apr/include/apr_allocator.h b/libs/apr/include/fspr_allocator.h similarity index 65% rename from libs/apr/include/apr_allocator.h rename to libs/apr/include/fspr_allocator.h index 5aaeb1b2fa..17de2cb285 100644 --- a/libs/apr/include/apr_allocator.h +++ b/libs/apr/include/fspr_allocator.h @@ -18,50 +18,50 @@ #define APR_ALLOCATOR_H /** - * @file apr_allocator.h + * @file fspr_allocator.h * @brief APR Internal Memory Allocation */ -#include "apr.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_errno.h" #define APR_WANT_MEMFUNC /**< For no good reason? */ -#include "apr_want.h" +#include "fspr_want.h" #ifdef __cplusplus extern "C" { #endif /** - * @defgroup apr_allocator Internal Memory Allocation + * @defgroup fspr_allocator Internal Memory Allocation * @ingroup APR * @{ */ /** the allocator structure */ -typedef struct apr_allocator_t apr_allocator_t; +typedef struct fspr_allocator_t fspr_allocator_t; /** the structure which holds information about the allocation */ -typedef struct apr_memnode_t apr_memnode_t; +typedef struct fspr_memnode_t fspr_memnode_t; /** basic memory node structure * @note The next, ref and first_avail fields are available for use by the - * caller of apr_allocator_alloc(), the remaining fields are read-only. + * caller of fspr_allocator_alloc(), the remaining fields are read-only. * The next field has to be used with caution and sensibly set when the - * memnode is passed back to apr_allocator_free(). See apr_allocator_free() + * memnode is passed back to fspr_allocator_free(). See fspr_allocator_free() * for details. * The ref and first_avail fields will be properly restored by - * apr_allocator_free(). + * fspr_allocator_free(). */ -struct apr_memnode_t { - apr_memnode_t *next; /**< next memnode */ - apr_memnode_t **ref; /**< reference to self */ - apr_uint32_t index; /**< size */ - apr_uint32_t free_index; /**< how much free */ +struct fspr_memnode_t { + fspr_memnode_t *next; /**< next memnode */ + fspr_memnode_t **ref; /**< reference to self */ + fspr_uint32_t index; /**< size */ + fspr_uint32_t free_index; /**< how much free */ char *first_avail; /**< pointer to first free memory */ char *endp; /**< pointer to end of free memory */ }; /** The base size of a memory node - aligned. */ -#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(apr_memnode_t)) +#define APR_MEMNODE_T_SIZE APR_ALIGN_DEFAULT(sizeof(fspr_memnode_t)) /** Symbolic constants */ #define APR_ALLOCATOR_MAX_FREE_UNLIMITED 0 @@ -71,7 +71,7 @@ struct apr_memnode_t { * @param allocator The allocator we have just created. * */ -APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator); +APR_DECLARE(fspr_status_t) fspr_allocator_create(fspr_allocator_t **allocator); /** * Destroy an allocator @@ -79,7 +79,7 @@ APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator); * @remark Any memnodes not given back to the allocator prior to destroying * will _not_ be free()d. */ -APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator); +APR_DECLARE(void) fspr_allocator_destroy(fspr_allocator_t *allocator); /** * Allocate a block of mem from the allocator @@ -87,8 +87,8 @@ APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator); * @param size The size of the mem to allocate (excluding the * memnode structure) */ -APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator, - apr_size_t size); +APR_DECLARE(fspr_memnode_t *) fspr_allocator_alloc(fspr_allocator_t *allocator, + fspr_size_t size); /** * Free a list of blocks of mem, giving them back to the allocator. @@ -97,10 +97,10 @@ APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator, * @param allocator The allocator to give the mem back to * @param memnode The memory node to return */ -APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator, - apr_memnode_t *memnode); +APR_DECLARE(void) fspr_allocator_free(fspr_allocator_t *allocator, + fspr_memnode_t *memnode); -#include "apr_pools.h" +#include "fspr_pools.h" /** * Set the owner of the allocator @@ -113,14 +113,14 @@ APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator, * you can make a pool an owner, but if the pool doesn't use the allocator * the allocator will never be destroyed. */ -APR_DECLARE(void) apr_allocator_owner_set(apr_allocator_t *allocator, - apr_pool_t *pool); +APR_DECLARE(void) fspr_allocator_owner_set(fspr_allocator_t *allocator, + fspr_pool_t *pool); /** * Get the current owner of the allocator * @param allocator The allocator to get the owner from */ -APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator); +APR_DECLARE(fspr_pool_t *) fspr_allocator_owner_get(fspr_allocator_t *allocator); /** * Set the current threshold at which the allocator should start @@ -128,10 +128,10 @@ APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator); * @param allocator The allocator the set the threshold on * @param size The threshold. 0 == unlimited. */ -APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator, - apr_size_t size); +APR_DECLARE(void) fspr_allocator_max_free_set(fspr_allocator_t *allocator, + fspr_size_t size); -#include "apr_thread_mutex.h" +#include "fspr_thread_mutex.h" #if APR_HAS_THREADS /** @@ -139,15 +139,15 @@ APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator, * @param allocator The allocator to set the mutex for * @param mutex The mutex */ -APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator, - apr_thread_mutex_t *mutex); +APR_DECLARE(void) fspr_allocator_mutex_set(fspr_allocator_t *allocator, + fspr_thread_mutex_t *mutex); /** * Get the mutex currently set for the allocator * @param allocator The allocator */ -APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get( - apr_allocator_t *allocator); +APR_DECLARE(fspr_thread_mutex_t *) fspr_allocator_mutex_get( + fspr_allocator_t *allocator); #endif /* APR_HAS_THREADS */ diff --git a/libs/apr/include/apr_atomic.h b/libs/apr/include/fspr_atomic.h similarity index 64% rename from libs/apr/include/apr_atomic.h rename to libs/apr/include/fspr_atomic.h index b169ff3dc1..c06069ccc9 100644 --- a/libs/apr/include/apr_atomic.h +++ b/libs/apr/include/fspr_atomic.h @@ -18,19 +18,19 @@ #define APR_ATOMIC_H /** - * @file apr_atomic.h + * @file fspr_atomic.h * @brief APR Atomic Operations */ -#include "apr.h" -#include "apr_pools.h" +#include "fspr.h" +#include "fspr_pools.h" #ifdef __cplusplus extern "C" { #endif /** - * @defgroup apr_atomic Atomic Operations + * @defgroup fspr_atomic Atomic Operations * @ingroup APR * @{ */ @@ -41,7 +41,7 @@ extern "C" { * @param p pool * @return APR_SUCCESS on successful completion */ -APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_atomic_init(fspr_pool_t *p); /* * Atomic operations on 32-bit values @@ -50,65 +50,65 @@ APR_DECLARE(apr_status_t) apr_atomic_init(apr_pool_t *p); */ /** - * atomically read an apr_uint32_t from memory + * atomically read an fspr_uint32_t from memory * @param mem the pointer */ -APR_DECLARE(apr_uint32_t) apr_atomic_read32(volatile apr_uint32_t *mem); +APR_DECLARE(fspr_uint32_t) fspr_atomic_read32(volatile fspr_uint32_t *mem); /** - * atomically set an apr_uint32_t in memory + * atomically set an fspr_uint32_t in memory * @param mem pointer to the object * @param val value that the object will assume */ -APR_DECLARE(void) apr_atomic_set32(volatile apr_uint32_t *mem, apr_uint32_t val); +APR_DECLARE(void) fspr_atomic_set32(volatile fspr_uint32_t *mem, fspr_uint32_t val); /** - * atomically add 'val' to an apr_uint32_t + * atomically add 'val' to an fspr_uint32_t * @param mem pointer to the object * @param val amount to add * @return old value pointed to by mem */ -APR_DECLARE(apr_uint32_t) apr_atomic_add32(volatile apr_uint32_t *mem, apr_uint32_t val); +APR_DECLARE(fspr_uint32_t) fspr_atomic_add32(volatile fspr_uint32_t *mem, fspr_uint32_t val); /** - * atomically subtract 'val' from an apr_uint32_t + * atomically subtract 'val' from an fspr_uint32_t * @param mem pointer to the object * @param val amount to subtract */ -APR_DECLARE(void) apr_atomic_sub32(volatile apr_uint32_t *mem, apr_uint32_t val); +APR_DECLARE(void) fspr_atomic_sub32(volatile fspr_uint32_t *mem, fspr_uint32_t val); /** - * atomically increment an apr_uint32_t by 1 + * atomically increment an fspr_uint32_t by 1 * @param mem pointer to the object * @return old value pointed to by mem */ -APR_DECLARE(apr_uint32_t) apr_atomic_inc32(volatile apr_uint32_t *mem); +APR_DECLARE(fspr_uint32_t) fspr_atomic_inc32(volatile fspr_uint32_t *mem); /** - * atomically decrement an apr_uint32_t by 1 + * atomically decrement an fspr_uint32_t by 1 * @param mem pointer to the atomic value * @return zero if the value becomes zero on decrement, otherwise non-zero */ -APR_DECLARE(int) apr_atomic_dec32(volatile apr_uint32_t *mem); +APR_DECLARE(int) fspr_atomic_dec32(volatile fspr_uint32_t *mem); /** - * compare an apr_uint32_t's value with 'cmp'. + * compare an fspr_uint32_t's value with 'cmp'. * If they are the same swap the value with 'with' * @param mem pointer to the value * @param with what to swap it with * @param cmp the value to compare it to * @return the old value of *mem */ -APR_DECLARE(apr_uint32_t) apr_atomic_cas32(volatile apr_uint32_t *mem, apr_uint32_t with, - apr_uint32_t cmp); +APR_DECLARE(fspr_uint32_t) fspr_atomic_cas32(volatile fspr_uint32_t *mem, fspr_uint32_t with, + fspr_uint32_t cmp); /** - * exchange an apr_uint32_t's value with 'val'. + * exchange an fspr_uint32_t's value with 'val'. * @param mem pointer to the value * @param val what to swap it with * @return the old value of *mem */ -APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint32_t val); +APR_DECLARE(fspr_uint32_t) fspr_atomic_xchg32(volatile fspr_uint32_t *mem, fspr_uint32_t val); /** * compare the pointer's value with cmp. @@ -118,7 +118,7 @@ APR_DECLARE(apr_uint32_t) apr_atomic_xchg32(volatile apr_uint32_t *mem, apr_uint * @param cmp the value to compare it to * @return the old value of the pointer */ -APR_DECLARE(void*) apr_atomic_casptr(volatile void **mem, void *with, const void *cmp); +APR_DECLARE(void*) fspr_atomic_casptr(volatile void **mem, void *with, const void *cmp); /** @} */ diff --git a/libs/apr/include/apr_dso.h b/libs/apr/include/fspr_dso.h similarity index 74% rename from libs/apr/include/apr_dso.h rename to libs/apr/include/fspr_dso.h index ac701cfdf5..b43ad24040 100644 --- a/libs/apr/include/apr_dso.h +++ b/libs/apr/include/fspr_dso.h @@ -18,20 +18,20 @@ #define APR_DSO_DOT_H /** - * @file apr_dso.h + * @file fspr_dso.h * @brief APR Dynamic Object Handling Routines */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" #ifdef __cplusplus extern "C" { #endif /** - * @defgroup apr_dso Dynamic Object Handling + * @defgroup fspr_dso Dynamic Object Handling * @ingroup APR * @{ */ @@ -41,12 +41,12 @@ extern "C" { /** * Structure for referencing dynamic objects */ -typedef struct apr_dso_handle_t apr_dso_handle_t; +typedef struct fspr_dso_handle_t fspr_dso_handle_t; /** * Structure for referencing symbols from dynamic objects */ -typedef void * apr_dso_handle_sym_t; +typedef void * fspr_dso_handle_sym_t; /** * Load a DSO library. @@ -56,14 +56,14 @@ typedef void * apr_dso_handle_sym_t; * @bug We aught to provide an alternative to RTLD_GLOBAL, which * is the only supported method of loading DSOs today. */ -APR_DECLARE(apr_status_t) apr_dso_load(apr_dso_handle_t **res_handle, - const char *path, apr_pool_t *ctx); +APR_DECLARE(fspr_status_t) fspr_dso_load(fspr_dso_handle_t **res_handle, + const char *path, fspr_pool_t *ctx); /** * Close a DSO library. * @param handle handle to close. */ -APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle); +APR_DECLARE(fspr_status_t) fspr_dso_unload(fspr_dso_handle_t *handle); /** * Load a symbol from a DSO handle. @@ -71,8 +71,8 @@ APR_DECLARE(apr_status_t) apr_dso_unload(apr_dso_handle_t *handle); * @param handle handle to load the symbol from. * @param symname Name of the symbol to load. */ -APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, - apr_dso_handle_t *handle, +APR_DECLARE(fspr_status_t) fspr_dso_sym(fspr_dso_handle_sym_t *ressym, + fspr_dso_handle_t *handle, const char *symname); /** @@ -81,7 +81,7 @@ APR_DECLARE(apr_status_t) apr_dso_sym(apr_dso_handle_sym_t *ressym, * @param buf Location to store the dso error * @param bufsize The size of the provided buffer */ -APR_DECLARE(const char *) apr_dso_error(apr_dso_handle_t *dso, char *buf, apr_size_t bufsize); +APR_DECLARE(const char *) fspr_dso_error(fspr_dso_handle_t *dso, char *buf, fspr_size_t bufsize); #endif /* APR_HAS_DSO */ diff --git a/libs/apr/include/apr_env.h b/libs/apr/include/fspr_env.h similarity index 77% rename from libs/apr/include/apr_env.h rename to libs/apr/include/fspr_env.h index 05419c37c1..d6f7ad6750 100644 --- a/libs/apr/include/apr_env.h +++ b/libs/apr/include/fspr_env.h @@ -17,18 +17,18 @@ #ifndef APR_ENV_H #define APR_ENV_H /** - * @file apr_env.h + * @file fspr_env.h * @brief APR Environment functions */ -#include "apr_errno.h" -#include "apr_pools.h" +#include "fspr_errno.h" +#include "fspr_pools.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_env Functions for manupulating the environment + * @defgroup fspr_env Functions for manupulating the environment * @ingroup APR * @{ */ @@ -39,8 +39,8 @@ extern "C" { * @param envvar the name of the environment variable * @param pool where to allocate @a value and any temporary storage from */ -APR_DECLARE(apr_status_t) apr_env_get(char **value, const char *envvar, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_env_get(char **value, const char *envvar, + fspr_pool_t *pool); /** * Set the value of an environment variable @@ -48,15 +48,15 @@ APR_DECLARE(apr_status_t) apr_env_get(char **value, const char *envvar, * @param value the value to set * @param pool where to allocate temporary storage from */ -APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, const char *value, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_env_set(const char *envvar, const char *value, + fspr_pool_t *pool); /** * Delete a variable from the environment * @param envvar the name of the environment variable * @param pool where to allocate temporary storage from */ -APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_env_delete(const char *envvar, fspr_pool_t *pool); /** @} */ diff --git a/libs/apr/include/apr_errno.h b/libs/apr/include/fspr_errno.h similarity index 95% rename from libs/apr/include/apr_errno.h rename to libs/apr/include/fspr_errno.h index c74e44df95..13441ae324 100644 --- a/libs/apr/include/apr_errno.h +++ b/libs/apr/include/fspr_errno.h @@ -18,11 +18,11 @@ #define APR_ERRNO_H /** - * @file apr_errno.h + * @file fspr_errno.h * @brief APR Error Codes */ -#include "apr.h" +#include "fspr.h" #if APR_HAVE_ERRNO_H #include @@ -33,7 +33,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_errno Error Codes + * @defgroup fspr_errno Error Codes * @ingroup APR * @{ */ @@ -41,7 +41,7 @@ extern "C" { /** * Type for specifying an error or status code. */ -typedef int apr_status_t; +typedef int fspr_status_t; /** * Return a human readable string describing the specified error. @@ -49,14 +49,14 @@ typedef int apr_status_t; * @param buf A buffer to hold the error string. * @param bufsize Size of the buffer to hold the string. */ -APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, - apr_size_t bufsize); +APR_DECLARE(char *) fspr_strerror(fspr_status_t statcode, char *buf, + fspr_size_t bufsize); #if defined(DOXYGEN) /** * @def APR_FROM_OS_ERROR(os_err_type syserr) - * Fold a platform specific error into an apr_status_t code. - * @return apr_status_t + * Fold a platform specific error into an fspr_status_t code. + * @return fspr_status_t * @param e The platform os error code. * @warning macro implementation; the syserr argument may be evaluated * multiple times. @@ -64,46 +64,46 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR) /** - * @def APR_TO_OS_ERROR(apr_status_t statcode) + * @def APR_TO_OS_ERROR(fspr_status_t statcode) * @return os_err_type - * Fold an apr_status_t code back to the native platform defined error. - * @param e The apr_status_t folded platform os error code. + * Fold an fspr_status_t code back to the native platform defined error. + * @param e The fspr_status_t folded platform os error code. * @warning macro implementation; the statcode argument may be evaluated - * multiple times. If the statcode was not created by apr_get_os_error + * multiple times. If the statcode was not created by fspr_get_os_error * or APR_FROM_OS_ERROR, the results are undefined. */ #define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR) -/** @def apr_get_os_error() - * @return apr_status_t the last platform error, folded into apr_status_t, on most platforms +/** @def fspr_get_os_error() + * @return fspr_status_t the last platform error, folded into fspr_status_t, on most platforms * @remark This retrieves errno, or calls a GetLastError() style function, and * folds it with APR_FROM_OS_ERROR. Some platforms (such as OS2) have no * such mechanism, so this call may be unsupported. Do NOT use this * call for socket errors from socket, send, recv etc! */ -/** @def apr_set_os_error(e) - * Reset the last platform error, unfolded from an apr_status_t, on some platforms +/** @def fspr_set_os_error(e) + * Reset the last platform error, unfolded from an fspr_status_t, on some platforms * @param e The OS error folded in a prior call to APR_FROM_OS_ERROR() * @warning This is a macro implementation; the statcode argument may be evaluated - * multiple times. If the statcode was not created by apr_get_os_error + * multiple times. If the statcode was not created by fspr_get_os_error * or APR_FROM_OS_ERROR, the results are undefined. This macro sets * errno, or calls a SetLastError() style function, unfolding statcode * with APR_TO_OS_ERROR. Some platforms (such as OS2) have no such * mechanism, so this call may be unsupported. */ -/** @def apr_get_netos_error() - * Return the last socket error, folded into apr_status_t, on all platforms +/** @def fspr_get_netos_error() + * Return the last socket error, folded into fspr_status_t, on all platforms * @remark This retrieves errno or calls a GetLastSocketError() style function, * and folds it with APR_FROM_OS_ERROR. */ -/** @def apr_set_netos_error(e) - * Reset the last socket error, unfolded from an apr_status_t +/** @def fspr_set_netos_error(e) + * Reset the last socket error, unfolded from an fspr_status_t * @param e The socket error folded in a prior call to APR_FROM_OS_ERROR() * @warning This is a macro implementation; the statcode argument may be evaluated - * multiple times. If the statcode was not created by apr_get_os_error + * multiple times. If the statcode was not created by fspr_get_os_error * or APR_FROM_OS_ERROR, the results are undefined. This macro sets * errno, or calls a WSASetLastError() style function, unfolding * socketcode with APR_TO_OS_ERROR. @@ -146,12 +146,12 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, + (APR_OS_ERRSPACE_SIZE * 10)) /** * APR_OS_START_EAIERR folds EAI_ error codes from getaddrinfo() into - * apr_status_t values. + * fspr_status_t values. */ #define APR_OS_START_EAIERR (APR_OS_START_CANONERR + APR_OS_ERRSPACE_SIZE) /** * APR_OS_START_SYSERR folds platform-specific system error values into - * apr_status_t values. + * fspr_status_t values. */ #define APR_OS_START_SYSERR (APR_OS_START_EAIERR + APR_OS_ERRSPACE_SIZE) @@ -176,7 +176,7 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, * APR_ENOTHDKEY APR was not given a thread key structure * APR_ENOSHMAVAIL There is no more shared memory available * APR_EDSOOPEN APR was unable to open the dso object. For more - * information call apr_dso_error(). + * information call fspr_dso_error(). * APR_EGENERAL General failure (specific information not available) * APR_EBADIP The specified IP address is invalid * APR_EBADMASK The specified netmask is invalid @@ -327,7 +327,7 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, /* empty slot: +18 */ /** * APR was unable to open the dso object. - * For more information call apr_dso_error(). + * For more information call fspr_dso_error(). */ #if defined(WIN32) #define APR_STATUS_IS_EDSOOPEN(s) ((s) == APR_EDSOOPEN \ @@ -348,7 +348,7 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, /** The given path contained wildcards. */ #define APR_STATUS_IS_EPATHWILD(s) ((s) == APR_EPATHWILD) /** Could not find the requested symbol. - * For more information call apr_dso_error(). + * For more information call fspr_dso_error(). */ #if defined(WIN32) #define APR_STATUS_IS_ESYMNOTFOUND(s) ((s) == APR_ESYMNOTFOUND \ @@ -775,14 +775,14 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, * The API calls always return a result codes which * should be filtered through APR_FROM_OS_ERROR(). * - * #define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError())) - * #define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e))) + * #define fspr_get_os_error() (APR_FROM_OS_ERROR(GetLastError())) + * #define fspr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e))) */ /* A special case, only socket calls require this; */ -#define apr_get_netos_error() (APR_FROM_OS_ERROR(errno)) -#define apr_set_netos_error(e) (errno = APR_TO_OS_ERROR(e)) +#define fspr_get_netos_error() (APR_FROM_OS_ERROR(errno)) +#define fspr_set_netos_error(e) (errno = APR_TO_OS_ERROR(e)) /* And this needs to be greped away for good: */ @@ -938,13 +938,13 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR) #define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR) -#define apr_get_os_error() (APR_FROM_OS_ERROR(GetLastError())) -#define apr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e))) +#define fspr_get_os_error() (APR_FROM_OS_ERROR(GetLastError())) +#define fspr_set_os_error(e) (SetLastError(APR_TO_OS_ERROR(e))) /* A special case, only socket calls require this: */ -#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError())) -#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e))) +#define fspr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError())) +#define fspr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e))) /* APR CANONICAL ERROR TESTS */ #define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES \ @@ -1051,12 +1051,12 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, #define APR_FROM_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e + APR_OS_START_SYSERR) #define APR_TO_OS_ERROR(e) (e == 0 ? APR_SUCCESS : e - APR_OS_START_SYSERR) -#define apr_get_os_error() (errno) -#define apr_set_os_error(e) (errno = (e)) +#define fspr_get_os_error() (errno) +#define fspr_set_os_error(e) (errno = (e)) /* A special case, only socket calls require this: */ -#define apr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError())) -#define apr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e))) +#define fspr_get_netos_error() (APR_FROM_OS_ERROR(WSAGetLastError())) +#define fspr_set_netos_error(e) (WSASetLastError(APR_TO_OS_ERROR(e))) /* APR CANONICAL ERROR TESTS */ #define APR_STATUS_IS_EACCES(s) ((s) == APR_EACCES) @@ -1113,13 +1113,13 @@ APR_DECLARE(char *) apr_strerror(apr_status_t statcode, char *buf, #define APR_FROM_OS_ERROR(e) (e) #define APR_TO_OS_ERROR(e) (e) -#define apr_get_os_error() (errno) -#define apr_set_os_error(e) (errno = (e)) +#define fspr_get_os_error() (errno) +#define fspr_set_os_error(e) (errno = (e)) /* A special case, only socket calls require this: */ -#define apr_get_netos_error() (errno) -#define apr_set_netos_error(e) (errno = (e)) +#define fspr_get_netos_error() (errno) +#define fspr_set_netos_error(e) (errno = (e)) /** * @addtogroup APR_STATUS_IS diff --git a/libs/apr/include/apr_file_info.h b/libs/apr/include/fspr_file_info.h similarity index 78% rename from libs/apr/include/apr_file_info.h rename to libs/apr/include/fspr_file_info.h index 94146f0ae3..44a75ee348 100644 --- a/libs/apr/include/apr_file_info.h +++ b/libs/apr/include/fspr_file_info.h @@ -18,16 +18,16 @@ #define APR_FILE_INFO_H /** - * @file apr_file_info.h + * @file fspr_file_info.h * @brief APR File Information */ -#include "apr.h" -#include "apr_user.h" -#include "apr_pools.h" -#include "apr_tables.h" -#include "apr_time.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_user.h" +#include "fspr_pools.h" +#include "fspr_tables.h" +#include "fspr_time.h" +#include "fspr_errno.h" #if APR_HAVE_SYS_UIO_H #include @@ -38,7 +38,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_file_info File Information + * @defgroup fspr_file_info File Information * @ingroup APR * @{ */ @@ -48,8 +48,8 @@ extern "C" { * so the APR_NOFILE value must be distinct from APR_UNKFILE. */ -/** apr_filetype_e values for the filetype member of the - * apr_file_info_t structure +/** fspr_filetype_e values for the filetype member of the + * fspr_file_info_t structure * @warning: Not all of the filetypes below can be determined. * For example, a given platform might not correctly report * a socket descriptor as APR_SOCK if that type isn't @@ -69,10 +69,10 @@ typedef enum { APR_LNK, /**< a symbolic link */ APR_SOCK, /**< a [unix domain] socket */ APR_UNKFILE = 127 /**< a file of some other unknown type */ -} apr_filetype_e; +} fspr_filetype_e; /** - * @defgroup apr_file_permissions File Permissions flags + * @defgroup fspr_file_permissions File Permissions flags * @{ */ @@ -93,7 +93,7 @@ typedef enum { #define APR_FPROT_OS_DEFAULT 0x0FFF /**< use OS's default permissions */ -/* additional permission flags for apr_file_copy and apr_file_append */ +/* additional permission flags for fspr_file_copy and fspr_file_append */ #define APR_FPROT_FILE_SOURCE_PERMS 0x1000 /**< Copy source file's permissions */ /* backcompat */ @@ -118,35 +118,35 @@ typedef enum { /** * Structure for referencing directories. */ -typedef struct apr_dir_t apr_dir_t; +typedef struct fspr_dir_t fspr_dir_t; /** * Structure for determining file permissions. */ -typedef apr_int32_t apr_fileperms_t; +typedef fspr_int32_t fspr_fileperms_t; #if (defined WIN32) || (defined NETWARE) /** * Structure for determining the inode of the file. */ -typedef apr_uint64_t apr_ino_t; +typedef fspr_uint64_t fspr_ino_t; /** * Structure for determining the device the file is on. */ -typedef apr_uint32_t apr_dev_t; +typedef fspr_uint32_t fspr_dev_t; #else /** The inode of the file. */ -typedef ino_t apr_ino_t; +typedef ino_t fspr_ino_t; /** * Structure for determining the device the file is on. */ -typedef dev_t apr_dev_t; +typedef dev_t fspr_dev_t; #endif /** - * @defgroup apr_file_stat Stat Functions + * @defgroup fspr_file_stat Stat Functions * @{ */ /** file info structure */ -typedef struct apr_finfo_t apr_finfo_t; +typedef struct fspr_finfo_t fspr_finfo_t; #define APR_FINFO_LINK 0x00000001 /**< Stat the link not the file itself if it is a link */ #define APR_FINFO_MTIME 0x00000010 /**< Modification Time */ @@ -170,52 +170,52 @@ typedef struct apr_finfo_t apr_finfo_t; #define APR_FINFO_IDENT 0x00003000 /**< dev and inode */ #define APR_FINFO_OWNER 0x00030000 /**< user and group */ #define APR_FINFO_PROT 0x00700000 /**< all protections */ -#define APR_FINFO_NORM 0x0073b170 /**< an atomic unix apr_stat() */ -#define APR_FINFO_DIRENT 0x02000000 /**< an atomic unix apr_dir_read() */ +#define APR_FINFO_NORM 0x0073b170 /**< an atomic unix fspr_stat() */ +#define APR_FINFO_DIRENT 0x02000000 /**< an atomic unix fspr_dir_read() */ /** * The file information structure. This is analogous to the POSIX * stat structure. */ -struct apr_finfo_t { +struct fspr_finfo_t { /** Allocates memory and closes lingering handles in the specified pool */ - apr_pool_t *pool; - /** The bitmask describing valid fields of this apr_finfo_t structure + fspr_pool_t *pool; + /** The bitmask describing valid fields of this fspr_finfo_t structure * including all available 'wanted' fields and potentially more */ - apr_int32_t valid; + fspr_int32_t valid; /** The access permissions of the file. Mimics Unix access rights. */ - apr_fileperms_t protection; + fspr_fileperms_t protection; /** The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE, * APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE. * If the type cannot be determined, the value is APR_UNKFILE. */ - apr_filetype_e filetype; + fspr_filetype_e filetype; /** The user id that owns the file */ - apr_uid_t user; + fspr_uid_t user; /** The group id that owns the file */ - apr_gid_t group; + fspr_gid_t group; /** The inode of the file. */ - apr_ino_t inode; + fspr_ino_t inode; /** The id of the device the file is on. */ - apr_dev_t device; + fspr_dev_t device; /** The number of hard links to the file. */ - apr_int32_t nlink; + fspr_int32_t nlink; /** The size of the file */ - apr_off_t size; + fspr_off_t size; /** The storage size consumed by the file */ - apr_off_t csize; + fspr_off_t csize; /** The time the file was last accessed */ - apr_time_t atime; + fspr_time_t atime; /** The time the file was last modified */ - apr_time_t mtime; + fspr_time_t mtime; /** The time the file was created, or the inode was last changed */ - apr_time_t ctime; + fspr_time_t ctime; /** The pathname of the file (possibly unrooted) */ const char *fname; /** The file's name (no path) in filesystem case */ const char *name; - /** The file's handle, if accessed (can be submitted to apr_duphandle) */ - struct apr_file_t *filehand; + /** The file's handle, if accessed (can be submitted to fspr_duphandle) */ + struct fspr_file_t *filehand; }; /** @@ -224,7 +224,7 @@ struct apr_finfo_t { * @param finfo Where to store the information about the file, which is * never touched if the call fails. * @param fname The name of the file to stat. - * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ + * @param wanted The desired fspr_finfo_t fields, as a bit flag of APR_FINFO_ values * @param pool the pool to use to allocate the new file. * @@ -232,12 +232,12 @@ struct apr_finfo_t { * not be filled in, and you need to check the @c finfo->valid bitmask * to verify that what you're looking for is there. */ -APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, - apr_int32_t wanted, apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_stat(fspr_finfo_t *finfo, const char *fname, + fspr_int32_t wanted, fspr_pool_t *pool); /** @} */ /** - * @defgroup apr_dir Directory Manipulation Functions + * @defgroup fspr_dir Directory Manipulation Functions * @{ */ @@ -247,58 +247,58 @@ APR_DECLARE(apr_status_t) apr_stat(apr_finfo_t *finfo, const char *fname, * @param dirname The full path to the directory (use / on all systems) * @param pool The pool to use. */ -APR_DECLARE(apr_status_t) apr_dir_open(apr_dir_t **new_dir, +APR_DECLARE(fspr_status_t) fspr_dir_open(fspr_dir_t **new_dir, const char *dirname, - apr_pool_t *pool); + fspr_pool_t *pool); /** * close the specified directory. * @param thedir the directory descriptor to close. */ -APR_DECLARE(apr_status_t) apr_dir_close(apr_dir_t *thedir); +APR_DECLARE(fspr_status_t) fspr_dir_close(fspr_dir_t *thedir); /** * Read the next entry from the specified directory. - * @param finfo the file info structure and filled in by apr_dir_read - * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ + * @param finfo the file info structure and filled in by fspr_dir_read + * @param wanted The desired fspr_finfo_t fields, as a bit flag of APR_FINFO_ values - * @param thedir the directory descriptor returned from apr_dir_open + * @param thedir the directory descriptor returned from fspr_dir_open * @remark No ordering is guaranteed for the entries read. * * @note If @c APR_INCOMPLETE is returned all the fields in @a finfo may * not be filled in, and you need to check the @c finfo->valid bitmask * to verify that what you're looking for is there. */ -APR_DECLARE(apr_status_t) apr_dir_read(apr_finfo_t *finfo, apr_int32_t wanted, - apr_dir_t *thedir); +APR_DECLARE(fspr_status_t) fspr_dir_read(fspr_finfo_t *finfo, fspr_int32_t wanted, + fspr_dir_t *thedir); /** * Rewind the directory to the first entry. * @param thedir the directory descriptor to rewind. */ -APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir); +APR_DECLARE(fspr_status_t) fspr_dir_rewind(fspr_dir_t *thedir); /** @} */ /** - * @defgroup apr_filepath Filepath Manipulation Functions + * @defgroup fspr_filepath Filepath Manipulation Functions * @{ */ -/** Cause apr_filepath_merge to fail if addpath is above rootpath */ +/** Cause fspr_filepath_merge to fail if addpath is above rootpath */ #define APR_FILEPATH_NOTABOVEROOT 0x01 /** internal: Only meaningful with APR_FILEPATH_NOTABOVEROOT */ #define APR_FILEPATH_SECUREROOTTEST 0x02 -/** Cause apr_filepath_merge to fail if addpath is above rootpath, +/** Cause fspr_filepath_merge to fail if addpath is above rootpath, * even given a rootpath /foo/bar and an addpath ../bar/bash */ #define APR_FILEPATH_SECUREROOT 0x03 -/** Fail apr_filepath_merge if the merged path is relative */ +/** Fail fspr_filepath_merge if the merged path is relative */ #define APR_FILEPATH_NOTRELATIVE 0x04 -/** Fail apr_filepath_merge if the merged path is absolute */ +/** Fail fspr_filepath_merge if the merged path is absolute */ #define APR_FILEPATH_NOTABSOLUTE 0x08 /** Return the file system's native path format (e.g. path delimiters @@ -334,10 +334,10 @@ APR_DECLARE(apr_status_t) apr_dir_rewind(apr_dir_t *thedir); * the drive letter), or APR_EBADPATH if the root is simply invalid. * APR_SUCCESS is returned if filepath is an absolute path. */ -APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, +APR_DECLARE(fspr_status_t) fspr_filepath_root(const char **rootpath, const char **filepath, - apr_int32_t flags, - apr_pool_t *p); + fspr_int32_t flags, + fspr_pool_t *p); /** * Merge additional file path onto the previously processed rootpath @@ -352,11 +352,11 @@ APR_DECLARE(apr_status_t) apr_filepath_root(const char **rootpath, * result code will be APR_EPATHWILD, and all further segments will not * reflect the true filenames including the wildcard and following segments. */ -APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, +APR_DECLARE(fspr_status_t) fspr_filepath_merge(char **newpath, const char *rootpath, const char *addpath, - apr_int32_t flags, - apr_pool_t *p); + fspr_int32_t flags, + fspr_pool_t *p); /** * Split a search path into separate components @@ -367,9 +367,9 @@ APR_DECLARE(apr_status_t) apr_filepath_merge(char **newpath, * @remark the path separator in @a liststr is system specific; * e.g., ':' on Unix, ';' on Windows, etc. */ -APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts, +APR_DECLARE(fspr_status_t) fspr_filepath_list_split(fspr_array_header_t **pathelts, const char *liststr, - apr_pool_t *p); + fspr_pool_t *p); /** * Merge a list of search path components into a single search path @@ -380,9 +380,9 @@ APR_DECLARE(apr_status_t) apr_filepath_list_split(apr_array_header_t **pathelts, * @remark the path separator in @a liststr is system specific; * e.g., ':' on Unix, ';' on Windows, etc. */ -APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr, - apr_array_header_t *pathelts, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_filepath_list_merge(char **liststr, + fspr_array_header_t *pathelts, + fspr_pool_t *p); /** * Return the default file path (for relative file names) @@ -391,15 +391,15 @@ APR_DECLARE(apr_status_t) apr_filepath_list_merge(char **liststr, * default file path in os-native format. * @param p the pool to allocate the default path string from */ -APR_DECLARE(apr_status_t) apr_filepath_get(char **path, apr_int32_t flags, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_filepath_get(char **path, fspr_int32_t flags, + fspr_pool_t *p); /** * Set the default file path (for relative file names) * @param path the default path returned * @param p the pool to allocate any working storage */ -APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_filepath_set(const char *path, fspr_pool_t *p); /** The FilePath character encoding is unknown */ #define APR_FILEPATH_ENCODING_UNKNOWN 0 @@ -414,10 +414,10 @@ APR_DECLARE(apr_status_t) apr_filepath_set(const char *path, apr_pool_t *p); * Determine the encoding used internally by the FilePath functions * @param style points to a variable which receives the encoding style flag * @param p the pool to allocate any working storage - * @remark Use @c apr_os_locale_encoding and/or @c apr_os_default_encoding + * @remark Use @c fspr_os_locale_encoding and/or @c fspr_os_default_encoding * to get the name of the path encoding if it's not UTF-8. */ -APR_DECLARE(apr_status_t) apr_filepath_encoding(int *style, apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_filepath_encoding(int *style, fspr_pool_t *p); /** @} */ /** @} */ diff --git a/libs/apr/include/apr_file_io.h b/libs/apr/include/fspr_file_io.h similarity index 72% rename from libs/apr/include/apr_file_io.h rename to libs/apr/include/fspr_file_io.h index b8146eea65..d19901e2b8 100644 --- a/libs/apr/include/apr_file_io.h +++ b/libs/apr/include/fspr_file_io.h @@ -18,33 +18,33 @@ #define APR_FILE_IO_H /** - * @file apr_file_io.h + * @file fspr_file_io.h * @brief APR File I/O Handling */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_time.h" -#include "apr_errno.h" -#include "apr_file_info.h" -#include "apr_inherit.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_time.h" +#include "fspr_errno.h" +#include "fspr_file_info.h" +#include "fspr_inherit.h" #define APR_WANT_STDIO /**< for SEEK_* */ -#define APR_WANT_IOVEC /**< for apr_file_writev */ -#include "apr_want.h" +#define APR_WANT_IOVEC /**< for fspr_file_writev */ +#include "fspr_want.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_file_io File I/O Handling Functions + * @defgroup fspr_file_io File I/O Handling Functions * @ingroup APR * @{ */ /** - * @defgroup apr_file_open_flags File Open Flags/Routines + * @defgroup fspr_file_open_flags File Open Flags/Routines * @{ */ @@ -73,7 +73,7 @@ extern "C" { when the file is opened */ #define APR_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this file should support - apr_socket_sendfile operation */ + fspr_socket_sendfile operation */ #define APR_FOPEN_LARGEFILE 0x04000 /**< Platform dependent flag to enable large file support; WARNING see below. */ @@ -94,12 +94,12 @@ extern "C" { #define APR_LARGEFILE APR_FOPEN_LARGEFILE /**< @deprecated @see APR_FOPEN_LARGEFILE */ /** @warning The APR_LARGEFILE flag only has effect on some platforms - * where sizeof(apr_off_t) == 4. Where implemented, it allows opening + * where sizeof(fspr_off_t) == 4. Where implemented, it allows opening * and writing to a file which exceeds the size which can be - * represented by apr_off_t (2 gigabytes). When a file's size does - * exceed 2Gb, apr_file_info_get() will fail with an error on the - * descriptor, likewise apr_stat()/apr_lstat() will fail on the - * filename. apr_dir_read() will fail with APR_INCOMPLETE on a + * represented by fspr_off_t (2 gigabytes). When a file's size does + * exceed 2Gb, fspr_file_info_get() will fail with an error on the + * descriptor, likewise fspr_stat()/fspr_lstat() will fail on the + * filename. fspr_dir_read() will fail with APR_INCOMPLETE on a * directory entry for a large file depending on the particular * APR_FINFO_* flags. Generally, it is not recommended to use this * flag. */ @@ -107,11 +107,11 @@ extern "C" { /** @} */ /** - * @defgroup apr_file_seek_flags File Seek Flags + * @defgroup fspr_file_seek_flags File Seek Flags * @{ */ -/* flags for apr_file_seek */ +/* flags for fspr_file_seek */ /** Set the file position */ #define APR_SET SEEK_SET /** Current */ @@ -121,18 +121,18 @@ extern "C" { /** @} */ /** - * @defgroup apr_file_attrs_set_flags File Attribute Flags + * @defgroup fspr_file_attrs_set_flags File Attribute Flags * @{ */ -/* flags for apr_file_attrs_set */ +/* flags for fspr_file_attrs_set */ #define APR_FILE_ATTR_READONLY 0x01 /**< File is read-only */ #define APR_FILE_ATTR_EXECUTABLE 0x02 /**< File is executable */ #define APR_FILE_ATTR_HIDDEN 0x04 /**< File is hidden */ /** @} */ /** - * @defgroup apr_file_writev{_full} max iovec size + * @defgroup fspr_file_writev{_full} max iovec size * @{ */ #if defined(DOXYGEN) @@ -148,19 +148,19 @@ extern "C" { /** @} */ /** File attributes */ -typedef apr_uint32_t apr_fileattrs_t; +typedef fspr_uint32_t fspr_fileattrs_t; -/** Type to pass as whence argument to apr_file_seek. */ -typedef int apr_seek_where_t; +/** Type to pass as whence argument to fspr_file_seek. */ +typedef int fspr_seek_where_t; /** * Structure for referencing files. */ -typedef struct apr_file_t apr_file_t; +typedef struct fspr_file_t fspr_file_t; /* File lock types/flags */ /** - * @defgroup apr_file_lock_types File Lock Types + * @defgroup fspr_file_lock_types File Lock Types * @{ */ @@ -203,29 +203,29 @@ typedef struct apr_file_t apr_file_t; * writes across process/machines * APR_FILE_NOCLEANUP Do not register a cleanup with the pool * passed in on the pool argument (see below). - * The apr_os_file_t handle in apr_file_t will not + * The fspr_os_file_t handle in fspr_file_t will not * be closed when the pool is destroyed. * APR_SENDFILE_ENABLED Open with appropriate platform semantics * for sendfile operations. Advisory only, - * apr_socket_sendfile does not check this flag. + * fspr_socket_sendfile does not check this flag. * * @param perm Access permissions for file. * @param pool The pool to use. * @remark If perm is APR_OS_DEFAULT and the file is being created, * appropriate default permissions will be used. * @remark By default, the returned file descriptor will not be - * inherited by child processes created by apr_proc_create(). This - * can be changed using apr_file_inherit_set(). + * inherited by child processes created by fspr_proc_create(). This + * can be changed using fspr_file_inherit_set(). */ -APR_DECLARE(apr_status_t) apr_file_open(apr_file_t **newf, const char *fname, - apr_int32_t flag, apr_fileperms_t perm, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_open(fspr_file_t **newf, const char *fname, + fspr_int32_t flag, fspr_fileperms_t perm, + fspr_pool_t *pool); /** * Close the specified file. * @param file The file descriptor to close. */ -APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file); +APR_DECLARE(fspr_status_t) fspr_file_close(fspr_file_t *file); /** * Delete the specified file. @@ -234,7 +234,7 @@ APR_DECLARE(apr_status_t) apr_file_close(apr_file_t *file); * @remark If the file is open, it won't be removed until all * instances are closed. */ -APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_remove(const char *path, fspr_pool_t *pool); /** * Rename the specified file. @@ -245,9 +245,9 @@ APR_DECLARE(apr_status_t) apr_file_remove(const char *path, apr_pool_t *pool); * overwritten. Moving files or directories across devices may not be * possible. */ -APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, +APR_DECLARE(fspr_status_t) fspr_file_rename(const char *from_path, const char *to_path, - apr_pool_t *pool); + fspr_pool_t *pool); /** * Copy the specified file to another file. @@ -261,10 +261,10 @@ APR_DECLARE(apr_status_t) apr_file_rename(const char *from_path, * @remark The new file does not need to exist, it will be created if required. * @warning If the new file already exists, its contents will be overwritten. */ -APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path, +APR_DECLARE(fspr_status_t) fspr_file_copy(const char *from_path, const char *to_path, - apr_fileperms_t perms, - apr_pool_t *pool); + fspr_fileperms_t perms, + fspr_pool_t *pool); /** * Append the specified file to another file. @@ -277,55 +277,55 @@ APR_DECLARE(apr_status_t) apr_file_copy(const char *from_path, * @param pool The pool to use. * @remark The new file does not need to exist, it will be created if required. */ -APR_DECLARE(apr_status_t) apr_file_append(const char *from_path, +APR_DECLARE(fspr_status_t) fspr_file_append(const char *from_path, const char *to_path, - apr_fileperms_t perms, - apr_pool_t *pool); + fspr_fileperms_t perms, + fspr_pool_t *pool); /** * Are we at the end of the file * @param fptr The apr file we are testing. * @remark Returns APR_EOF if we are at the end of file, APR_SUCCESS otherwise. */ -APR_DECLARE(apr_status_t) apr_file_eof(apr_file_t *fptr); +APR_DECLARE(fspr_status_t) fspr_file_eof(fspr_file_t *fptr); /** * Open standard error as an apr file pointer. * @param thefile The apr file to use as stderr. * @param pool The pool to allocate the file out of. * - * @remark The only reason that the apr_file_open_std* functions exist + * @remark The only reason that the fspr_file_open_std* functions exist * is that you may not always have a stderr/out/in on Windows. This * is generally a problem with newer versions of Windows and services. * * @remark The other problem is that the C library functions generally work - * differently on Windows and Unix. So, by using apr_file_open_std* + * differently on Windows and Unix. So, by using fspr_file_open_std* * functions, you can get a handle to an APR struct that works with * the APR functions which are supposed to work identically on all * platforms. */ -APR_DECLARE(apr_status_t) apr_file_open_stderr(apr_file_t **thefile, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_open_stderr(fspr_file_t **thefile, + fspr_pool_t *pool); /** * open standard output as an apr file pointer. * @param thefile The apr file to use as stdout. * @param pool The pool to allocate the file out of. * - * @remark See remarks for apr_file_open_stdout. + * @remark See remarks for fspr_file_open_stdout. */ -APR_DECLARE(apr_status_t) apr_file_open_stdout(apr_file_t **thefile, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_open_stdout(fspr_file_t **thefile, + fspr_pool_t *pool); /** * open standard input as an apr file pointer. * @param thefile The apr file to use as stdin. * @param pool The pool to allocate the file out of. * - * @remark See remarks for apr_file_open_stdout. + * @remark See remarks for fspr_file_open_stdout. */ -APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_open_stdin(fspr_file_t **thefile, + fspr_pool_t *pool); /** * Read data from the specified file. @@ -334,7 +334,7 @@ APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, * @param nbytes On entry, the number of bytes to read; on exit, the number * of bytes read. * - * @remark apr_file_read will read up to the specified number of + * @remark fspr_file_read will read up to the specified number of * bytes, but never more. If there isn't enough data to fill that * number of bytes, all of the available data is read. The third * argument is modified to reflect the number of bytes read. If a @@ -344,8 +344,8 @@ APR_DECLARE(apr_status_t) apr_file_open_stdin(apr_file_t **thefile, * @remark It is not possible for both bytes to be read and an APR_EOF * or other error to be returned. APR_EINTR is never returned. */ -APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, - apr_size_t *nbytes); +APR_DECLARE(fspr_status_t) fspr_file_read(fspr_file_t *thefile, void *buf, + fspr_size_t *nbytes); /** * Write data to the specified file. @@ -354,7 +354,7 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, * @param nbytes On entry, the number of bytes to write; on exit, the number * of bytes written. * - * @remark apr_file_write will write up to the specified number of + * @remark fspr_file_write will write up to the specified number of * bytes, but never more. If the OS cannot write that many bytes, it * will write as many as it can. The third argument is modified to * reflect the * number of bytes written. @@ -362,8 +362,8 @@ APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *thefile, void *buf, * @remark It is possible for both bytes to be written and an error to * be returned. APR_EINTR is never returned. */ -APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, - apr_size_t *nbytes); +APR_DECLARE(fspr_status_t) fspr_file_write(fspr_file_t *thefile, const void *buf, + fspr_size_t *nbytes); /** * Write data from iovec array to the specified file. @@ -377,12 +377,12 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, * @remark It is possible for both bytes to be written and an error to * be returned. APR_EINTR is never returned. * - * @remark apr_file_writev is available even if the underlying + * @remark fspr_file_writev is available even if the underlying * operating system doesn't provide writev(). */ -APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_file_writev(fspr_file_t *thefile, const struct iovec *vec, - apr_size_t nvec, apr_size_t *nbytes); + fspr_size_t nvec, fspr_size_t *nbytes); /** * Read data from the specified file, ensuring that the buffer is filled @@ -392,7 +392,7 @@ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, * @param nbytes The number of bytes to read. * @param bytes_read If non-NULL, this will contain the number of bytes read. * - * @remark apr_file_read will read up to the specified number of + * @remark fspr_file_read will read up to the specified number of * bytes, but never more. If there isn't enough data to fill that * number of bytes, then the process/thread will block until it is * available or EOF is reached. If a char was put back into the @@ -404,9 +404,9 @@ APR_DECLARE(apr_status_t) apr_file_writev(apr_file_t *thefile, * * @remark APR_EINTR is never returned. */ -APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf, - apr_size_t nbytes, - apr_size_t *bytes_read); +APR_DECLARE(fspr_status_t) fspr_file_read_full(fspr_file_t *thefile, void *buf, + fspr_size_t nbytes, + fspr_size_t *bytes_read); /** * Write data to the specified file, ensuring that all of the data is @@ -416,7 +416,7 @@ APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf, * @param nbytes The number of bytes to write. * @param bytes_written If non-NULL, set to the number of bytes written. * - * @remark apr_file_write will write up to the specified number of + * @remark fspr_file_write will write up to the specified number of * bytes, but never more. If the OS cannot write that many bytes, the * process/thread will block until they can be written. Exceptional * error such as "out of space" or "pipe closed" will terminate with @@ -428,10 +428,10 @@ APR_DECLARE(apr_status_t) apr_file_read_full(apr_file_t *thefile, void *buf, * * @remark APR_EINTR is never returned. */ -APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_file_write_full(fspr_file_t *thefile, const void *buf, - apr_size_t nbytes, - apr_size_t *bytes_written); + fspr_size_t nbytes, + fspr_size_t *bytes_written); /** @@ -444,33 +444,33 @@ APR_DECLARE(apr_status_t) apr_file_write_full(apr_file_t *thefile, * will fail with APR_EINVAL. * @param nbytes The number of bytes written. * - * @remark apr_file_writev_full is available even if the underlying + * @remark fspr_file_writev_full is available even if the underlying * operating system doesn't provide writev(). */ -APR_DECLARE(apr_status_t) apr_file_writev_full(apr_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_file_writev_full(fspr_file_t *thefile, const struct iovec *vec, - apr_size_t nvec, - apr_size_t *nbytes); + fspr_size_t nvec, + fspr_size_t *nbytes); /** * Write a character into the specified file. * @param ch The character to write. * @param thefile The file descriptor to write to */ -APR_DECLARE(apr_status_t) apr_file_putc(char ch, apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_putc(char ch, fspr_file_t *thefile); /** * Read a character from the specified file. * @param ch The character to read into * @param thefile The file descriptor to read from */ -APR_DECLARE(apr_status_t) apr_file_getc(char *ch, apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_getc(char *ch, fspr_file_t *thefile); /** * Put a character back onto a specified stream. * @param ch The character to write. * @param thefile The file descriptor to write to */ -APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_ungetc(char ch, fspr_file_t *thefile); /** * Read a string from the specified file. @@ -479,32 +479,32 @@ APR_DECLARE(apr_status_t) apr_file_ungetc(char ch, apr_file_t *thefile); * @param thefile The file descriptor to read from * @remark The buffer will be NUL-terminated if any characters are stored. */ -APR_DECLARE(apr_status_t) apr_file_gets(char *str, int len, - apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_gets(char *str, int len, + fspr_file_t *thefile); /** * Write the string into the specified file. * @param str The string to write. * @param thefile The file descriptor to write to */ -APR_DECLARE(apr_status_t) apr_file_puts(const char *str, apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_puts(const char *str, fspr_file_t *thefile); /** * Flush the file's buffer. * @param thefile The file descriptor to flush */ -APR_DECLARE(apr_status_t) apr_file_flush(apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_flush(fspr_file_t *thefile); /** * Duplicate the specified file descriptor. * @param new_file The structure to duplicate into. * @param old_file The file to duplicate. * @param p The pool to use for the new file. - * @remark *new_file must point to a valid apr_file_t, or point to NULL. + * @remark *new_file must point to a valid fspr_file_t, or point to NULL. */ -APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, - apr_file_t *old_file, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_file_dup(fspr_file_t **new_file, + fspr_file_t *old_file, + fspr_pool_t *p); /** * Duplicate the specified file descriptor and close the original @@ -512,26 +512,26 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file, * @param old_file The file to duplicate * @param p The pool to use for the new file * - * @remark new_file MUST point at a valid apr_file_t. It cannot be NULL. + * @remark new_file MUST point at a valid fspr_file_t. It cannot be NULL. */ -APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file, - apr_file_t *old_file, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_file_dup2(fspr_file_t *new_file, + fspr_file_t *old_file, + fspr_pool_t *p); /** * Move the specified file descriptor to a new pool - * @param new_file Pointer in which to return the new apr_file_t + * @param new_file Pointer in which to return the new fspr_file_t * @param old_file The file to move * @param p The pool to which the descriptor is to be moved - * @remark Unlike apr_file_dup2(), this function doesn't do an + * @remark Unlike fspr_file_dup2(), this function doesn't do an * OS dup() operation on the underlying descriptor; it just - * moves the descriptor's apr_file_t wrapper to a new pool. + * moves the descriptor's fspr_file_t wrapper to a new pool. * @remark The new pool need not be an ancestor of old_file's pool. * @remark After calling this function, old_file may not be used */ -APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, - apr_file_t *old_file, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_file_setaside(fspr_file_t **new_file, + fspr_file_t *old_file, + fspr_pool_t *p); /** * Move the read/write file offset to a specified byte within a file. @@ -546,9 +546,9 @@ APR_DECLARE(apr_status_t) apr_file_setaside(apr_file_t **new_file, * @remark The third argument is modified to be the offset the pointer was actually moved to. */ -APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, - apr_seek_where_t where, - apr_off_t *offset); +APR_DECLARE(fspr_status_t) fspr_file_seek(fspr_file_t *thefile, + fspr_seek_where_t where, + fspr_off_t *offset); /** * Create an anonymous pipe. @@ -556,12 +556,12 @@ APR_DECLARE(apr_status_t) apr_file_seek(apr_file_t *thefile, * @param out The file descriptor to use as output from the pipe. * @param pool The pool to operate on. * @remark By default, the returned file descriptors will be inherited - * by child processes created using apr_proc_create(). This can be - * changed using apr_file_inherit_unset(). + * by child processes created using fspr_proc_create(). This can be + * changed using fspr_file_inherit_unset(). */ -APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, - apr_file_t **out, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_pipe_create(fspr_file_t **in, + fspr_file_t **out, + fspr_pool_t *pool); /** * Create a named pipe. @@ -569,17 +569,17 @@ APR_DECLARE(apr_status_t) apr_file_pipe_create(apr_file_t **in, * @param perm The permissions for the newly created pipe. * @param pool The pool to operate on. */ -APR_DECLARE(apr_status_t) apr_file_namedpipe_create(const char *filename, - apr_fileperms_t perm, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_namedpipe_create(const char *filename, + fspr_fileperms_t perm, + fspr_pool_t *pool); /** * Get the timeout value for a pipe or manipulate the blocking state. * @param thepipe The pipe we are getting a timeout for. * @param timeout The current timeout value in microseconds. */ -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, - apr_interval_time_t *timeout); +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_get(fspr_file_t *thepipe, + fspr_interval_time_t *timeout); /** * Set the timeout value for a pipe or manipulate the blocking state. @@ -587,8 +587,8 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_get(apr_file_t *thepipe, * @param timeout The timeout value in microseconds. Values < 0 mean wait * forever, 0 means do not wait at all. */ -APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, - apr_interval_time_t timeout); +APR_DECLARE(fspr_status_t) fspr_file_pipe_timeout_set(fspr_file_t *thepipe, + fspr_interval_time_t timeout); /** file (un)locking functions. */ @@ -601,13 +601,13 @@ APR_DECLARE(apr_status_t) apr_file_pipe_timeout_set(apr_file_t *thepipe, * @param thefile The file to lock. * @param type The type of lock to establish on the file. */ -APR_DECLARE(apr_status_t) apr_file_lock(apr_file_t *thefile, int type); +APR_DECLARE(fspr_status_t) fspr_file_lock(fspr_file_t *thefile, int type); /** * Remove any outstanding locks on the file. * @param thefile The file to unlock. */ -APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_unlock(fspr_file_t *thefile); /**accessor and general file_io functions. */ @@ -616,8 +616,8 @@ APR_DECLARE(apr_status_t) apr_file_unlock(apr_file_t *thefile); * @param new_path The path of the file. * @param thefile The currently open file. */ -APR_DECLARE(apr_status_t) apr_file_name_get(const char **new_path, - apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_name_get(const char **new_path, + fspr_file_t *thefile); /** * Return the data associated with the current file. @@ -625,8 +625,8 @@ APR_DECLARE(apr_status_t) apr_file_name_get(const char **new_path, * @param key The key to use for retreiving data associated with this file. * @param file The currently open file. */ -APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key, - apr_file_t *file); +APR_DECLARE(fspr_status_t) fspr_file_data_get(void **data, const char *key, + fspr_file_t *file); /** * Set the data associated with the current file. @@ -635,9 +635,9 @@ APR_DECLARE(apr_status_t) apr_file_data_get(void **data, const char *key, * @param key The key to use for assocaiteing data with the file. * @param cleanup The cleanup routine to use when the file is destroyed. */ -APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data, +APR_DECLARE(fspr_status_t) fspr_file_data_set(fspr_file_t *file, void *data, const char *key, - apr_status_t (*cleanup)(void *)); + fspr_status_t (*cleanup)(void *)); /** * Write a string to a file using a printf format. @@ -646,7 +646,7 @@ APR_DECLARE(apr_status_t) apr_file_data_set(apr_file_t *file, void *data, * @param ... The values to substitute in the format string * @return The number of bytes written */ -APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, +APR_DECLARE_NONSTD(int) fspr_file_printf(fspr_file_t *fptr, const char *format, ...) __attribute__((format(printf,2,3))); @@ -662,8 +662,8 @@ APR_DECLARE_NONSTD(int) apr_file_printf(apr_file_t *fptr, * @warning Platforms which do not implement this feature will return * APR_ENOTIMPL. */ -APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, - apr_fileperms_t perms); +APR_DECLARE(fspr_status_t) fspr_file_perms_set(const char *fname, + fspr_fileperms_t perms); /** * Set attributes of the specified file. @@ -683,10 +683,10 @@ APR_DECLARE(apr_status_t) apr_file_perms_set(const char *fname, * @warning Platforms which do not implement this feature will return * APR_ENOTIMPL. */ -APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, - apr_fileattrs_t attributes, - apr_fileattrs_t attr_mask, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_attrs_set(const char *fname, + fspr_fileattrs_t attributes, + fspr_fileattrs_t attr_mask, + fspr_pool_t *pool); /** * Set the mtime of the specified file. @@ -696,9 +696,9 @@ APR_DECLARE(apr_status_t) apr_file_attrs_set(const char *fname, * @warning Platforms which do not implement this feature will return * APR_ENOTIMPL. */ -APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, - apr_time_t mtime, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_file_mtime_set(const char *fname, + fspr_time_t mtime, + fspr_pool_t *pool); /** * Create a new directory on the file system. @@ -706,8 +706,8 @@ APR_DECLARE(apr_status_t) apr_file_mtime_set(const char *fname, * @param perm Permissions for the new direcoty. * @param pool the pool to use. */ -APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_dir_make(const char *path, fspr_fileperms_t perm, + fspr_pool_t *pool); /** Creates a new directory on the file system, but behaves like * 'mkdir -p'. Creates intermediate directories as required. No error @@ -716,26 +716,26 @@ APR_DECLARE(apr_status_t) apr_dir_make(const char *path, apr_fileperms_t perm, * @param perm Permissions for the new direcoty. * @param pool the pool to use. */ -APR_DECLARE(apr_status_t) apr_dir_make_recursive(const char *path, - apr_fileperms_t perm, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_dir_make_recursive(const char *path, + fspr_fileperms_t perm, + fspr_pool_t *pool); /** * Remove directory from the file system. * @param path the path for the directory to be removed. (use / on all systems) * @param pool the pool to use. */ -APR_DECLARE(apr_status_t) apr_dir_remove(const char *path, apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_dir_remove(const char *path, fspr_pool_t *pool); /** * get the specified file's stats. * @param finfo Where to store the information about the file. - * @param wanted The desired apr_finfo_t fields, as a bit flag of APR_FINFO_ values + * @param wanted The desired fspr_finfo_t fields, as a bit flag of APR_FINFO_ values * @param thefile The file to get information about. */ -APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, - apr_int32_t wanted, - apr_file_t *thefile); +APR_DECLARE(fspr_status_t) fspr_file_info_get(fspr_finfo_t *finfo, + fspr_int32_t wanted, + fspr_file_t *thefile); /** @@ -743,14 +743,14 @@ APR_DECLARE(apr_status_t) apr_file_info_get(apr_finfo_t *finfo, * @param fp The file to truncate * @param offset The offset to truncate to. */ -APR_DECLARE(apr_status_t) apr_file_trunc(apr_file_t *fp, apr_off_t offset); +APR_DECLARE(fspr_status_t) fspr_file_trunc(fspr_file_t *fp, fspr_off_t offset); /** - * Retrieve the flags that were passed into apr_file_open() + * Retrieve the flags that were passed into fspr_file_open() * when the file was opened. - * @return apr_int32_t the flags + * @return fspr_int32_t the flags */ -APR_DECLARE(apr_int32_t) apr_file_flags_get(apr_file_t *f); +APR_DECLARE(fspr_int32_t) fspr_file_flags_get(fspr_file_t *f); /** * Get the pool used by the file. @@ -784,8 +784,8 @@ APR_DECLARE_INHERIT_UNSET(file); * array. * */ -APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *templ, - apr_int32_t flags, apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_file_mktemp(fspr_file_t **fp, char *templ, + fspr_int32_t flags, fspr_pool_t *p); /** @@ -800,8 +800,8 @@ APR_DECLARE(apr_status_t) apr_file_mktemp(apr_file_t **fp, char *templ, * is successful. * */ -APR_DECLARE(apr_status_t) apr_temp_dir_get(const char **temp_dir, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_temp_dir_get(const char **temp_dir, + fspr_pool_t *p); /** @} */ diff --git a/libs/apr/include/apr_fnmatch.h b/libs/apr/include/fspr_fnmatch.h similarity index 89% rename from libs/apr/include/apr_fnmatch.h rename to libs/apr/include/fspr_fnmatch.h index 7a2811aac8..18c0f138d7 100644 --- a/libs/apr/include/apr_fnmatch.h +++ b/libs/apr/include/fspr_fnmatch.h @@ -38,19 +38,19 @@ #define _APR_FNMATCH_H_ /** - * @file apr_fnmatch.h + * @file fspr_fnmatch.h * @brief APR FNMatch Functions */ -#include "apr_errno.h" -#include "apr_tables.h" +#include "fspr_errno.h" +#include "fspr_tables.h" #ifdef __cplusplus extern "C" { #endif /** - * @defgroup apr_fnmatch Filename Matching Functions + * @defgroup fspr_fnmatch Filename Matching Functions * @ingroup APR * @{ */ @@ -78,7 +78,7 @@ extern "C" { * */ -APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern, +APR_DECLARE(fspr_status_t) fspr_fnmatch(const char *pattern, const char *strings, int flags); /** @@ -86,7 +86,7 @@ APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern, * @param pattern The pattern to search for glob characters. * @return non-zero if pattern has any glob characters in it */ -APR_DECLARE(int) apr_fnmatch_test(const char *pattern); +APR_DECLARE(int) fspr_fnmatch_test(const char *pattern); /** * Find all files that match a specified pattern. @@ -95,9 +95,9 @@ APR_DECLARE(int) apr_fnmatch_test(const char *pattern); * @param p The pool to use. * @return non-zero if pattern has any glob characters in it */ -APR_DECLARE(apr_status_t) apr_match_glob(const char *pattern, - apr_array_header_t **result, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_match_glob(const char *pattern, + fspr_array_header_t **result, + fspr_pool_t *p); /** @} */ diff --git a/libs/apr/include/apr_general.h b/libs/apr/include/fspr_general.h similarity index 80% rename from libs/apr/include/apr_general.h rename to libs/apr/include/fspr_general.h index 3a956288e3..103f69f1df 100644 --- a/libs/apr/include/apr_general.h +++ b/libs/apr/include/fspr_general.h @@ -18,16 +18,16 @@ #define APR_GENERAL_H /** - * @file apr_general.h + * @file fspr_general.h * This is collection of oddballs that didn't fit anywhere else, * and might move to more appropriate headers with the release * of APR 1.0. * @brief APR Miscellaneous library routines */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" #if !defined(_ANSI_SOURCE) && defined(_DARWIN_C_SOURCE) #define NSIG __DARWIN_NSIG @@ -42,7 +42,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_general Miscellaneous library routines + * @defgroup fspr_general Miscellaneous library routines * @ingroup APR * This is collection of oddballs that didn't fit anywhere else, * and might move to more appropriate headers with the release @@ -69,7 +69,7 @@ extern "C" { #define APR_ASCII_TAB '\011' /** signal numbers typedef */ -typedef int apr_signum_t; +typedef int fspr_signum_t; /** * Finding offsets of elements within structures. @@ -148,7 +148,7 @@ int strncasecmp(const char *a, const char *b, size_t n); * String and memory functions */ -/* APR_STRINGIFY is defined here, and also in apr_release.h, so wrap it */ +/* APR_STRINGIFY is defined here, and also in fspr_release.h, so wrap it */ #ifndef APR_STRINGIFY /** Properly quote a value as a string in the C preprocessor */ #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n) @@ -167,17 +167,17 @@ void *memchr(const void *s, int c, size_t n); /** @} */ /** - * @defgroup apr_library Library initialization and termination + * @defgroup fspr_library Library initialization and termination * @{ */ /** * Setup any APR internal data structures. This MUST be the first function * called for any APR library. - * @remark See apr_app_initialize if this is an application, rather than + * @remark See fspr_app_initialize if this is an application, rather than * a library consumer of apr. */ -APR_DECLARE(apr_status_t) apr_initialize(void); +APR_DECLARE(fspr_status_t) fspr_initialize(void); /** * Set up an application with normalized argc, argv (and optionally env) in @@ -187,11 +187,11 @@ APR_DECLARE(apr_status_t) apr_initialize(void); * @param argc Pointer to the argc that may be corrected * @param argv Pointer to the argv that may be corrected * @param env Pointer to the env that may be corrected, may be NULL - * @remark See apr_initialize if this is a library consumer of apr. - * Otherwise, this call is identical to apr_initialize, and must be closed - * with a call to apr_terminate at the end of program execution. + * @remark See fspr_initialize if this is a library consumer of apr. + * Otherwise, this call is identical to fspr_initialize, and must be closed + * with a call to fspr_terminate at the end of program execution. */ -APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, +APR_DECLARE(fspr_status_t) fspr_app_initialize(int *argc, char const * const * *argv, char const * const * *env); @@ -202,25 +202,25 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, * has stopped using APR services. The APR developers suggest using * atexit to ensure this is called. When using APR from a language * other than C that has problems with the calling convention, use - * apr_terminate2() instead. + * fspr_terminate2() instead. */ -APR_DECLARE_NONSTD(void) apr_terminate(void); +APR_DECLARE_NONSTD(void) fspr_terminate(void); /** * Tear down any APR internal data structures which aren't torn down - * automatically, same as apr_terminate - * @remark An APR program must call either the apr_terminate or apr_terminate2 + * automatically, same as fspr_terminate + * @remark An APR program must call either the fspr_terminate or fspr_terminate2 * function once it it has finished using APR services. The APR - * developers suggest using atexit(apr_terminate) to ensure this is done. - * apr_terminate2 exists to allow non-c language apps to tear down apr, - * while apr_terminate is recommended from c language applications. + * developers suggest using atexit(fspr_terminate) to ensure this is done. + * fspr_terminate2 exists to allow non-c language apps to tear down apr, + * while fspr_terminate is recommended from c language applications. */ -APR_DECLARE(void) apr_terminate2(void); +APR_DECLARE(void) fspr_terminate2(void); /** @} */ /** - * @defgroup apr_random Random Functions + * @defgroup fspr_random Random Functions * @{ */ @@ -232,8 +232,8 @@ APR_DECLARE(void) apr_terminate2(void); * @param buf Buffer to fill with random bytes * @param length Length of buffer in bytes */ -APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf, - apr_size_t length); +APR_DECLARE(fspr_status_t) fspr_generate_random_bytes(unsigned char * buf, + fspr_size_t length); #endif /** @} */ diff --git a/libs/apr/include/apr_getopt.h b/libs/apr/include/fspr_getopt.h similarity index 78% rename from libs/apr/include/apr_getopt.h rename to libs/apr/include/fspr_getopt.h index 131aa4b38d..5299fa7ae3 100644 --- a/libs/apr/include/apr_getopt.h +++ b/libs/apr/include/fspr_getopt.h @@ -18,18 +18,18 @@ #define APR_GETOPT_H /** - * @file apr_getopt.h + * @file fspr_getopt.h * @brief APR Command Arguments (getopt) */ -#include "apr_pools.h" +#include "fspr_pools.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_getopt Command Argument Parsing + * @defgroup fspr_getopt Command Argument Parsing * @ingroup APR * @{ */ @@ -37,19 +37,19 @@ extern "C" { /** * defintion of a error function */ -typedef void (apr_getopt_err_fn_t)(void *arg, const char *err, ...); +typedef void (fspr_getopt_err_fn_t)(void *arg, const char *err, ...); -/** @see apr_getopt_t */ -typedef struct apr_getopt_t apr_getopt_t; +/** @see fspr_getopt_t */ +typedef struct fspr_getopt_t fspr_getopt_t; /** * Structure to store command line argument information. */ -struct apr_getopt_t { +struct fspr_getopt_t { /** context for processing */ - apr_pool_t *cont; + fspr_pool_t *cont; /** function to print error message (NULL == no messages) */ - apr_getopt_err_fn_t *errfn; + fspr_getopt_err_fn_t *errfn; /** user defined first arg to pass to error message */ void *errarg; /** index into parent argv vector */ @@ -72,13 +72,13 @@ struct apr_getopt_t { int skip_end; }; -/** @see apr_getopt_option_t */ -typedef struct apr_getopt_option_t apr_getopt_option_t; +/** @see fspr_getopt_option_t */ +typedef struct fspr_getopt_option_t fspr_getopt_option_t; /** * Structure used to describe options that getopt should search for. */ -struct apr_getopt_option_t { +struct fspr_getopt_option_t { /** long option name, or NULL if option has no long name */ const char *name; /** option letter, or a value greater than 255 if option has no letter */ @@ -90,20 +90,20 @@ struct apr_getopt_option_t { }; /** - * Initialize the arguments for parsing by apr_getopt(). - * @param os The options structure created for apr_getopt() + * Initialize the arguments for parsing by fspr_getopt(). + * @param os The options structure created for fspr_getopt() * @param cont The pool to operate on * @param argc The number of arguments to parse * @param argv The array of arguments to parse * @remark Arguments 2 and 3 are most commonly argc and argv from main(argc, argv) * The errfn is initialized to fprintf(stderr... but may be overridden. */ -APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont, +APR_DECLARE(fspr_status_t) fspr_getopt_init(fspr_getopt_t **os, fspr_pool_t *cont, int argc, const char * const *argv); /** - * Parse the options initialized by apr_getopt_init(). - * @param os The apr_opt_t structure returned by apr_getopt_init() + * Parse the options initialized by fspr_getopt_init(). + * @param os The fspr_opt_t structure returned by fspr_getopt_init() * @param opts A string of characters that are acceptable options to the * program. Characters followed by ":" are required to have an * option associated @@ -117,19 +117,19 @@ APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont, * APR_SUCCESS -- The next option was found. * */ -APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, +APR_DECLARE(fspr_status_t) fspr_getopt(fspr_getopt_t *os, const char *opts, char *option_ch, const char **option_arg); /** - * Parse the options initialized by apr_getopt_init(), accepting long + * Parse the options initialized by fspr_getopt_init(), accepting long * options beginning with "--" in addition to single-character * options beginning with "-". - * @param os The apr_getopt_t structure created by apr_getopt_init() - * @param opts A pointer to a list of apr_getopt_option_t structures, which + * @param os The fspr_getopt_t structure created by fspr_getopt_init() + * @param opts A pointer to a list of fspr_getopt_option_t structures, which * can be initialized with { "name", optch, has_args }. has_args * is nonzero if the option requires an argument. A structure * with an optch value of 0 terminates the list. - * @param option_ch Receives the value of "optch" from the apr_getopt_option_t + * @param option_ch Receives the value of "optch" from the fspr_getopt_option_t * structure corresponding to the next option matched. * @param option_arg Receives the argument following the option, if any. * @return There are four potential status values on exit. They are: @@ -145,8 +145,8 @@ APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, * after arguments, and os->argv will be permuted to leave non-option arguments * at the end (the original argv is unaffected). */ -APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os, - const apr_getopt_option_t *opts, +APR_DECLARE(fspr_status_t) fspr_getopt_long(fspr_getopt_t *os, + const fspr_getopt_option_t *opts, int *option_ch, const char **option_arg); /** @} */ diff --git a/libs/apr/include/apr_global_mutex.h b/libs/apr/include/fspr_global_mutex.h similarity index 71% rename from libs/apr/include/apr_global_mutex.h rename to libs/apr/include/fspr_global_mutex.h index 9316001ce6..3e82a3e7dd 100644 --- a/libs/apr/include/apr_global_mutex.h +++ b/libs/apr/include/fspr_global_mutex.h @@ -18,16 +18,16 @@ #define APR_GLOBAL_MUTEX_H /** - * @file apr_global_mutex.h + * @file fspr_global_mutex.h * @brief APR Global Locking Routines */ -#include "apr.h" -#include "apr_proc_mutex.h" /* only for apr_lockmech_e */ -#include "apr_pools.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_proc_mutex.h" /* only for fspr_lockmech_e */ +#include "fspr_pools.h" +#include "fspr_errno.h" #if APR_PROC_MUTEX_IS_GLOBAL -#include "apr_proc_mutex.h" +#include "fspr_proc_mutex.h" #endif #ifdef __cplusplus @@ -43,7 +43,7 @@ extern "C" { #if !APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN) /** Opaque global mutex structure. */ -typedef struct apr_global_mutex_t apr_global_mutex_t; +typedef struct fspr_global_mutex_t fspr_global_mutex_t; /* Function definitions */ @@ -51,7 +51,7 @@ typedef struct apr_global_mutex_t apr_global_mutex_t; * Create and initialize a mutex that can be used to synchronize both * processes and threads. Note: There is considerable overhead in using * this API if only cross-process or cross-thread mutual exclusion is - * required. See apr_proc_mutex.h and apr_thread_mutex.h for more + * required. See fspr_proc_mutex.h and fspr_thread_mutex.h for more * specialized lock routines. * @param mutex the memory address where the newly created mutex will be * stored. @@ -71,10 +71,10 @@ typedef struct apr_global_mutex_t apr_global_mutex_t; * @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports * APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable. */ -APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_global_mutex_create(fspr_global_mutex_t **mutex, const char *fname, - apr_lockmech_e mech, - apr_pool_t *pool); + fspr_lockmech_e mech, + fspr_pool_t *pool); /** * Re-open a mutex in a child process. @@ -82,22 +82,22 @@ APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex, * @param fname A file name to use if the mutex mechanism requires one. This * argument should always be provided. The mutex code itself will * determine if it should be used. This filename should be the - * same one that was passed to apr_global_mutex_create(). + * same one that was passed to fspr_global_mutex_create(). * @param pool The pool to operate on. * @remark This function must be called to maintain portability, even * if the underlying lock mechanism does not require it. */ -APR_DECLARE(apr_status_t) apr_global_mutex_child_init( - apr_global_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_global_mutex_child_init( + fspr_global_mutex_t **mutex, const char *fname, - apr_pool_t *pool); + fspr_pool_t *pool); /** * Acquire the lock for the given mutex. If the mutex is already locked, * the current thread will be put to sleep until the lock becomes available. * @param mutex the mutex on which to acquire the lock. */ -APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_global_mutex_lock(fspr_global_mutex_t *mutex); /** * Attempt to acquire the lock for the given mutex. If the mutex has already @@ -106,23 +106,23 @@ APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex); * if the return value was APR_EBUSY, for portability reasons. * @param mutex the mutex on which to attempt the lock acquiring. */ -APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_global_mutex_trylock(fspr_global_mutex_t *mutex); /** * Release the lock for the given mutex. * @param mutex the mutex from which to release the lock. */ -APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_global_mutex_unlock(fspr_global_mutex_t *mutex); /** * Destroy the mutex and free the memory associated with the lock. * @param mutex the mutex to destroy. */ -APR_DECLARE(apr_status_t) apr_global_mutex_destroy(apr_global_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_global_mutex_destroy(fspr_global_mutex_t *mutex); /** * Get the pool used by this global_mutex. - * @return apr_pool_t the pool + * @return fspr_pool_t the pool */ APR_POOL_DECLARE_ACCESSOR(global_mutex); @@ -130,17 +130,17 @@ APR_POOL_DECLARE_ACCESSOR(global_mutex); /* Some platforms [e.g. Win32] have cross process locks that are truly * global locks, since there isn't the concept of cross-process locks. - * Define these platforms in terms of an apr_proc_mutex_t. + * Define these platforms in terms of an fspr_proc_mutex_t. */ -#define apr_global_mutex_t apr_proc_mutex_t -#define apr_global_mutex_create apr_proc_mutex_create -#define apr_global_mutex_child_init apr_proc_mutex_child_init -#define apr_global_mutex_lock apr_proc_mutex_lock -#define apr_global_mutex_trylock apr_proc_mutex_trylock -#define apr_global_mutex_unlock apr_proc_mutex_unlock -#define apr_global_mutex_destroy apr_proc_mutex_destroy -#define apr_global_mutex_pool_get apr_proc_mutex_pool_get +#define fspr_global_mutex_t fspr_proc_mutex_t +#define fspr_global_mutex_create fspr_proc_mutex_create +#define fspr_global_mutex_child_init fspr_proc_mutex_child_init +#define fspr_global_mutex_lock fspr_proc_mutex_lock +#define fspr_global_mutex_trylock fspr_proc_mutex_trylock +#define fspr_global_mutex_unlock fspr_proc_mutex_unlock +#define fspr_global_mutex_destroy fspr_proc_mutex_destroy +#define fspr_global_mutex_pool_get fspr_proc_mutex_pool_get #endif diff --git a/libs/apr/include/apr_hash.h b/libs/apr/include/fspr_hash.h similarity index 69% rename from libs/apr/include/apr_hash.h rename to libs/apr/include/fspr_hash.h index 353709b145..fca4458cb3 100644 --- a/libs/apr/include/apr_hash.h +++ b/libs/apr/include/fspr_hash.h @@ -18,43 +18,43 @@ #define APR_HASH_H /** - * @file apr_hash.h + * @file fspr_hash.h * @brief APR Hash Tables */ -#include "apr_pools.h" +#include "fspr_pools.h" #ifdef __cplusplus extern "C" { #endif /** - * @defgroup apr_hash Hash Tables + * @defgroup fspr_hash Hash Tables * @ingroup APR * @{ */ /** - * When passing a key to apr_hash_set or apr_hash_get, this value can be - * passed to indicate a string-valued key, and have apr_hash compute the + * When passing a key to fspr_hash_set or fspr_hash_get, this value can be + * passed to indicate a string-valued key, and have fspr_hash compute the * length automatically. * - * @remark apr_hash will use strlen(key) for the length. The NUL terminator + * @remark fspr_hash will use strlen(key) for the length. The NUL terminator * is not included in the hash value (why throw a constant in?). * Since the hash table merely references the provided key (rather - * than copying it), apr_hash_this() will return the NUL-term'd key. + * than copying it), fspr_hash_this() will return the NUL-term'd key. */ #define APR_HASH_KEY_STRING (-1) /** * Abstract type for hash tables. */ -typedef struct apr_hash_t apr_hash_t; +typedef struct fspr_hash_t fspr_hash_t; /** * Abstract type for scanning hash tables. */ -typedef struct apr_hash_index_t apr_hash_index_t; +typedef struct fspr_hash_index_t fspr_hash_index_t; /** * Callback functions for calculating hash values. @@ -62,20 +62,20 @@ typedef struct apr_hash_index_t apr_hash_index_t; * @param klen The length of the key, or APR_HASH_KEY_STRING to use the string * length. If APR_HASH_KEY_STRING then returns the actual key length. */ -typedef unsigned int (*apr_hashfunc_t)(const char *key, apr_ssize_t *klen); +typedef unsigned int (*fspr_hashfunc_t)(const char *key, fspr_ssize_t *klen); /** * The default hash function. */ -APR_DECLARE_NONSTD(unsigned int) apr_hashfunc_default(const char *key, - apr_ssize_t *klen); +APR_DECLARE_NONSTD(unsigned int) fspr_hashfunc_default(const char *key, + fspr_ssize_t *klen); /** * Create a hash table. * @param pool The pool to allocate the hash table out of * @return The hash table just created */ -APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool); +APR_DECLARE(fspr_hash_t *) fspr_hash_make(fspr_pool_t *pool); /** * Create a hash table with a custom hash function @@ -83,8 +83,8 @@ APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool); * @param hash_func A custom hash function. * @return The hash table just created */ -APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool, - apr_hashfunc_t hash_func); +APR_DECLARE(fspr_hash_t *) fspr_hash_make_custom(fspr_pool_t *pool, + fspr_hashfunc_t hash_func); /** * Make a copy of a hash table @@ -93,8 +93,8 @@ APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool, * @return The hash table just created * @remark Makes a shallow copy */ -APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool, - const apr_hash_t *h); +APR_DECLARE(fspr_hash_t *) fspr_hash_copy(fspr_pool_t *pool, + const fspr_hash_t *h); /** * Associate a value with a key in a hash table. @@ -104,8 +104,8 @@ APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool, * @param val Value to associate with the key * @remark If the value is NULL the hash entry is deleted. */ -APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, const void *key, - apr_ssize_t klen, const void *val); +APR_DECLARE(void) fspr_hash_set(fspr_hash_t *ht, const void *key, + fspr_ssize_t klen, const void *val); /** * Look up the value associated with a key in a hash table. @@ -114,12 +114,12 @@ APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, const void *key, * @param klen Length of the key. Can be APR_HASH_KEY_STRING to use the string length. * @return Returns NULL if the key is not present. */ -APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht, const void *key, - apr_ssize_t klen); +APR_DECLARE(void *) fspr_hash_get(fspr_hash_t *ht, const void *key, + fspr_ssize_t klen); /** * Start iterating over the entries in a hash table. - * @param p The pool to allocate the apr_hash_index_t iterator. If this + * @param p The pool to allocate the fspr_hash_index_t iterator. If this * pool is NULL, then an internal, non-thread-safe iterator is used. * @param ht The hash table * @remark There is no restriction on adding or deleting hash entries during @@ -132,20 +132,20 @@ APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht, const void *key, /** *

      * 
    - * int sum_values(apr_pool_t *p, apr_hash_t *ht)
    + * int sum_values(fspr_pool_t *p, fspr_hash_t *ht)
      * {
    - *     apr_hash_index_t *hi;
    + *     fspr_hash_index_t *hi;
      *     void *val;
      *     int sum = 0;
    - *     for (hi = apr_hash_first(p, ht); hi; hi = apr_hash_next(hi)) {
    - *         apr_hash_this(hi, NULL, NULL, &val);
    + *     for (hi = fspr_hash_first(p, ht); hi; hi = fspr_hash_next(hi)) {
    + *         fspr_hash_this(hi, NULL, NULL, &val);
      *         sum += *(int *)val;
      *     }
      *     return sum;
      * }
      * 
    */ -APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht); +APR_DECLARE(fspr_hash_index_t *) fspr_hash_first(fspr_pool_t *p, fspr_hash_t *ht); /** * Continue iterating over the entries in a hash table. @@ -153,7 +153,7 @@ APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht); * @return a pointer to the updated iteration state. NULL if there are no more * entries. */ -APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi); +APR_DECLARE(fspr_hash_index_t *) fspr_hash_next(fspr_hash_index_t *hi); /** * Get the current entry's details from the iteration state. @@ -164,21 +164,21 @@ APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi); * @remark The return pointers should point to a variable that will be set to the * corresponding data, or they may be NULL if the data isn't interesting. */ -APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, const void **key, - apr_ssize_t *klen, void **val); +APR_DECLARE(void) fspr_hash_this(fspr_hash_index_t *hi, const void **key, + fspr_ssize_t *klen, void **val); /** * Get the number of key/value pairs in the hash table. * @param ht The hash table * @return The number of key/value pairs in the hash table. */ -APR_DECLARE(unsigned int) apr_hash_count(apr_hash_t *ht); +APR_DECLARE(unsigned int) fspr_hash_count(fspr_hash_t *ht); /** * Clear any key/value pairs in the hash table. * @param ht The hash table */ -APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht); +APR_DECLARE(void) fspr_hash_clear(fspr_hash_t *ht); /** * Merge two hash tables into one new hash table. The values of the overlay @@ -189,9 +189,9 @@ APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht); * @param base The table that represents the initial values of the new table * @return A new hash table containing all of the data from the two passed in */ -APR_DECLARE(apr_hash_t *) apr_hash_overlay(apr_pool_t *p, - const apr_hash_t *overlay, - const apr_hash_t *base); +APR_DECLARE(fspr_hash_t *) fspr_hash_overlay(fspr_pool_t *p, + const fspr_hash_t *overlay, + const fspr_hash_t *base); /** * Merge two hash tables into one new hash table. If the same key @@ -203,16 +203,16 @@ APR_DECLARE(apr_hash_t *) apr_hash_overlay(apr_pool_t *p, * @param h2 The second of the tables to merge * @param merger A callback function to merge values, or NULL to * make values from h1 override values from h2 (same semantics as - * apr_hash_overlay()) + * fspr_hash_overlay()) * @param data Client data to pass to the merger function * @return A new hash table containing all of the data from the two passed in */ -APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p, - const apr_hash_t *h1, - const apr_hash_t *h2, - void * (*merger)(apr_pool_t *p, +APR_DECLARE(fspr_hash_t *) fspr_hash_merge(fspr_pool_t *p, + const fspr_hash_t *h1, + const fspr_hash_t *h2, + void * (*merger)(fspr_pool_t *p, const void *key, - apr_ssize_t klen, + fspr_ssize_t klen, const void *h1_val, const void *h2_val, const void *data), diff --git a/libs/apr/include/apr_inherit.h b/libs/apr/include/fspr_inherit.h similarity index 70% rename from libs/apr/include/apr_inherit.h rename to libs/apr/include/fspr_inherit.h index b7f7480f1f..c73cd8aa60 100644 --- a/libs/apr/include/apr_inherit.h +++ b/libs/apr/include/fspr_inherit.h @@ -18,34 +18,34 @@ #define APR_INHERIT_H /** - * @file apr_inherit.h + * @file fspr_inherit.h * @brief APR File Handle Inheritance Helpers * @remark This internal header includes internal declaration helpers - * for other headers to declare apr_foo_inherit_[un]set functions. + * for other headers to declare fspr_foo_inherit_[un]set functions. */ /** - * Prototype for type-specific declarations of apr_foo_inherit_set + * Prototype for type-specific declarations of fspr_foo_inherit_set * functions. * @remark Doxygen unwraps this macro (via doxygen.conf) to provide - * actual help for each specific occurance of apr_foo_inherit_set. + * actual help for each specific occurance of fspr_foo_inherit_set. * @remark the linkage is specified for APR. It would be possible to expand * the macros to support other linkages. */ #define APR_DECLARE_INHERIT_SET(type) \ - APR_DECLARE(apr_status_t) apr_##type##_inherit_set( \ - apr_##type##_t *the##type) + APR_DECLARE(fspr_status_t) fspr_##type##_inherit_set( \ + fspr_##type##_t *the##type) /** - * Prototype for type-specific declarations of apr_foo_inherit_unset + * Prototype for type-specific declarations of fspr_foo_inherit_unset * functions. * @remark Doxygen unwraps this macro (via doxygen.conf) to provide - * actual help for each specific occurance of apr_foo_inherit_unset. + * actual help for each specific occurance of fspr_foo_inherit_unset. * @remark the linkage is specified for APR. It would be possible to expand * the macros to support other linkages. */ #define APR_DECLARE_INHERIT_UNSET(type) \ - APR_DECLARE(apr_status_t) apr_##type##_inherit_unset( \ - apr_##type##_t *the##type) + APR_DECLARE(fspr_status_t) fspr_##type##_inherit_unset( \ + fspr_##type##_t *the##type) #endif /* ! APR_INHERIT_H */ diff --git a/libs/apr/include/apr_lib.h b/libs/apr/include/fspr_lib.h similarity index 65% rename from libs/apr/include/apr_lib.h rename to libs/apr/include/fspr_lib.h index ed25d869f5..6642950ecf 100644 --- a/libs/apr/include/apr_lib.h +++ b/libs/apr/include/fspr_lib.h @@ -18,15 +18,15 @@ #define APR_LIB_H /** - * @file apr_lib.h + * @file fspr_lib.h * This is collection of oddballs that didn't fit anywhere else, * and might move to more appropriate headers with the release * of APR 1.0. * @brief APR general purpose library routines */ -#include "apr.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_errno.h" #if APR_HAVE_CTYPE_H #include @@ -40,7 +40,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_lib General Purpose Library Routines + * @defgroup fspr_lib General Purpose Library Routines * @ingroup APR * This is collection of oddballs that didn't fit anywhere else, * and might move to more appropriate headers with the release @@ -55,13 +55,13 @@ extern "C" { * Define the structures used by the APR general-purpose library. */ -/** @see apr_vformatter_buff_t */ -typedef struct apr_vformatter_buff_t apr_vformatter_buff_t; +/** @see fspr_vformatter_buff_t */ +typedef struct fspr_vformatter_buff_t fspr_vformatter_buff_t; /** * Structure used by the variable-formatter routines. */ -struct apr_vformatter_buff_t { +struct fspr_vformatter_buff_t { /** The current position */ char *curpos; /** The end position of the format string */ @@ -81,26 +81,26 @@ struct apr_vformatter_buff_t { * "bs\\path\\stuff" -> "stuff" * */ -APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname); +APR_DECLARE(const char *) fspr_filepath_name_get(const char *pathname); /** - * apr_killpg + * fspr_killpg * Small utility macros to make things easier to read. Not usually a * goal, to be sure.. */ #ifdef WIN32 -#define apr_killpg(x, y) +#define fspr_killpg(x, y) #else /* WIN32 */ #ifdef NO_KILLPG -#define apr_killpg(x, y) (kill (-(x), (y))) +#define fspr_killpg(x, y) (kill (-(x), (y))) #else /* NO_KILLPG */ -#define apr_killpg(x, y) (killpg ((x), (y))) +#define fspr_killpg(x, y) (killpg ((x), (y))) #endif /* NO_KILLPG */ #endif /* WIN32 */ /** - * apr_vformatter() is a generic printf-style formatting routine + * fspr_vformatter() is a generic printf-style formatting routine * with some extensions. * @param flush_func The function to call when the buffer is full * @param c The buffer to write to @@ -112,11 +112,11 @@ APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname); * The extensions are: * * %%pA takes a struct in_addr *, and prints it as a.b.c.d - * %%pI takes an apr_sockaddr_t * and prints it as a.b.c.d:port or + * %%pI takes an fspr_sockaddr_t * and prints it as a.b.c.d:port or * [ipv6-address]:port - * %%pT takes an apr_os_thread_t * and prints it in decimal + * %%pT takes an fspr_os_thread_t * and prints it in decimal * ('0' is printed if !APR_HAS_THREADS) - * %%pt takes an apr_os_thread_t * and prints it in hexadecimal + * %%pt takes an fspr_os_thread_t * and prints it in hexadecimal * ('0' is printed if !APR_HAS_THREADS) * %%pp takes a void * and outputs it in hex * @@ -126,44 +126,44 @@ APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname); * work as expected at all, but that seems to be a fair trade-off * for the increased robustness of having printf-warnings work. * - * Additionally, apr_vformatter allows for arbitrary output methods - * using the apr_vformatter_buff and flush_func. + * Additionally, fspr_vformatter allows for arbitrary output methods + * using the fspr_vformatter_buff and flush_func. * - * The apr_vformatter_buff has two elements curpos and endpos. - * curpos is where apr_vformatter will write the next byte of output. + * The fspr_vformatter_buff has two elements curpos and endpos. + * curpos is where fspr_vformatter will write the next byte of output. * It proceeds writing output to curpos, and updating curpos, until * either the end of output is reached, or curpos == endpos (i.e. the * buffer is full). * - * If the end of output is reached, apr_vformatter returns the + * If the end of output is reached, fspr_vformatter returns the * number of bytes written. * * When the buffer is full, the flush_func is called. The flush_func * can return -1 to indicate that no further output should be attempted, - * and apr_vformatter will return immediately with -1. Otherwise + * and fspr_vformatter will return immediately with -1. Otherwise * the flush_func should flush the buffer in whatever manner is - * appropriate, re apr_pool_t nitialize curpos and endpos, and return 0. + * appropriate, re fspr_pool_t nitialize curpos and endpos, and return 0. * * Note that flush_func is only invoked as a result of attempting to * write another byte at curpos when curpos >= endpos. So for * example, it's possible when the output exactly matches the buffer * space available that curpos == endpos will be true when - * apr_vformatter returns. + * fspr_vformatter returns. * - * apr_vformatter does not call out to any other code, it is entirely + * fspr_vformatter does not call out to any other code, it is entirely * self-contained. This allows the callers to do things which are - * otherwise "unsafe". For example, apr_psprintf uses the "scratch" + * otherwise "unsafe". For example, fspr_psprintf uses the "scratch" * space at the unallocated end of a block, and doesn't actually - * complete the allocation until apr_vformatter returns. apr_psprintf - * would be completely broken if apr_vformatter were to call anything + * complete the allocation until fspr_vformatter returns. fspr_psprintf + * would be completely broken if fspr_vformatter were to call anything * that used this same pool. Similarly http_bprintf() uses the "scratch" * space at the end of its output buffer, and doesn't actually note * that the space is in use until it either has to flush the buffer - * or until apr_vformatter returns. + * or until fspr_vformatter returns. * */ -APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *b), - apr_vformatter_buff_t *c, const char *fmt, +APR_DECLARE(int) fspr_vformatter(int (*flush_func)(fspr_vformatter_buff_t *b), + fspr_vformatter_buff_t *c, const char *fmt, va_list ap); /** @@ -174,16 +174,16 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *b), * @remark If the password entered must be truncated to fit in * the provided buffer, APR_ENAMETOOLONG will be returned. * Note that the bufsize paramater is passed by reference for no - * reason; its value will never be modified by the apr_password_get() + * reason; its value will never be modified by the fspr_password_get() * function. */ -APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf, - apr_size_t *bufsize); +APR_DECLARE(fspr_status_t) fspr_password_get(const char *prompt, char *pwbuf, + fspr_size_t *bufsize); /** @} */ /** - * @defgroup apr_ctype ctype functions + * @defgroup fspr_ctype ctype functions * These macros allow correct support of 8-bit characters on systems which * support 8-bit characters. Pretty dumb how the cast is required, but * that's legacy libc for ya. These new macros do not support EOF like @@ -191,37 +191,37 @@ APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf, * @{ */ /** @see isalnum */ -#define apr_isalnum(c) (isalnum(((unsigned char)(c)))) +#define fspr_isalnum(c) (isalnum(((unsigned char)(c)))) /** @see isalpha */ -#define apr_isalpha(c) (isalpha(((unsigned char)(c)))) +#define fspr_isalpha(c) (isalpha(((unsigned char)(c)))) /** @see iscntrl */ -#define apr_iscntrl(c) (iscntrl(((unsigned char)(c)))) +#define fspr_iscntrl(c) (iscntrl(((unsigned char)(c)))) /** @see isdigit */ -#define apr_isdigit(c) (isdigit(((unsigned char)(c)))) +#define fspr_isdigit(c) (isdigit(((unsigned char)(c)))) /** @see isgraph */ -#define apr_isgraph(c) (isgraph(((unsigned char)(c)))) +#define fspr_isgraph(c) (isgraph(((unsigned char)(c)))) /** @see islower*/ -#define apr_islower(c) (islower(((unsigned char)(c)))) +#define fspr_islower(c) (islower(((unsigned char)(c)))) /** @see isascii */ #ifdef isascii -#define apr_isascii(c) (isascii(((unsigned char)(c)))) +#define fspr_isascii(c) (isascii(((unsigned char)(c)))) #else -#define apr_isascii(c) (((c) & ~0x7f)==0) +#define fspr_isascii(c) (((c) & ~0x7f)==0) #endif /** @see isprint */ -#define apr_isprint(c) (isprint(((unsigned char)(c)))) +#define fspr_isprint(c) (isprint(((unsigned char)(c)))) /** @see ispunct */ -#define apr_ispunct(c) (ispunct(((unsigned char)(c)))) +#define fspr_ispunct(c) (ispunct(((unsigned char)(c)))) /** @see isspace */ -#define apr_isspace(c) (isspace(((unsigned char)(c)))) +#define fspr_isspace(c) (isspace(((unsigned char)(c)))) /** @see isupper */ -#define apr_isupper(c) (isupper(((unsigned char)(c)))) +#define fspr_isupper(c) (isupper(((unsigned char)(c)))) /** @see isxdigit */ -#define apr_isxdigit(c) (isxdigit(((unsigned char)(c)))) +#define fspr_isxdigit(c) (isxdigit(((unsigned char)(c)))) /** @see tolower */ -#define apr_tolower(c) (tolower(((unsigned char)(c)))) +#define fspr_tolower(c) (tolower(((unsigned char)(c)))) /** @see toupper */ -#define apr_toupper(c) (toupper(((unsigned char)(c)))) +#define fspr_toupper(c) (toupper(((unsigned char)(c)))) /** @} */ diff --git a/libs/apr/include/apr_mmap.h b/libs/apr/include/fspr_mmap.h similarity index 76% rename from libs/apr/include/apr_mmap.h rename to libs/apr/include/fspr_mmap.h index 77d697f5b5..88b99b8fe1 100644 --- a/libs/apr/include/apr_mmap.h +++ b/libs/apr/include/fspr_mmap.h @@ -18,15 +18,15 @@ #define APR_MMAP_H /** - * @file apr_mmap.h + * @file fspr_mmap.h * @brief APR MMAP routines */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_ring.h" -#include "apr_file_io.h" /* for apr_file_t */ +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" +#include "fspr_ring.h" +#include "fspr_file_io.h" /* for fspr_file_t */ #ifdef BEOS #include @@ -37,7 +37,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_mmap MMAP (Memory Map) Routines + * @defgroup fspr_mmap MMAP (Memory Map) Routines * @ingroup APR * @{ */ @@ -47,8 +47,8 @@ extern "C" { /** MMap opened for writing */ #define APR_MMAP_WRITE 2 -/** @see apr_mmap_t */ -typedef struct apr_mmap_t apr_mmap_t; +/** @see fspr_mmap_t */ +typedef struct fspr_mmap_t fspr_mmap_t; /** * @remark @@ -59,9 +59,9 @@ typedef struct apr_mmap_t apr_mmap_t; * Apache. */ /** The MMAP structure */ -struct apr_mmap_t { +struct fspr_mmap_t { /** The pool the mmap structure was allocated out of. */ - apr_pool_t *cntxt; + fspr_pool_t *cntxt; #ifdef BEOS /** An area ID. Only valid on BeOS */ area_id area; @@ -72,17 +72,17 @@ struct apr_mmap_t { /** The start of the real memory page area (mapped view) */ void *mv; /** The physical start, size and offset */ - apr_off_t pstart; - apr_size_t psize; - apr_off_t poffset; + fspr_off_t pstart; + fspr_size_t psize; + fspr_off_t poffset; #endif /** The start of the memory mapped area */ void *mm; /** The amount of data in the mmap */ - apr_size_t size; - /** ring of apr_mmap_t's that reference the same + fspr_size_t size; + /** ring of fspr_mmap_t's that reference the same * mmap'ed region; acts in place of a reference count */ - APR_RING_ENTRY(apr_mmap_t) link; + APR_RING_ENTRY(fspr_mmap_t) link; }; #if APR_HAS_MMAP || defined(DOXYGEN) @@ -130,10 +130,10 @@ struct apr_mmap_t { * * @param cntxt The pool to use when creating the mmap. */ -APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **newmmap, - apr_file_t *file, apr_off_t offset, - apr_size_t size, apr_int32_t flag, - apr_pool_t *cntxt); +APR_DECLARE(fspr_status_t) fspr_mmap_create(fspr_mmap_t **newmmap, + fspr_file_t *file, fspr_off_t offset, + fspr_size_t size, fspr_int32_t flag, + fspr_pool_t *cntxt); /** * Duplicate the specified MMAP. @@ -141,15 +141,15 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **newmmap, * @param old_mmap The mmap to duplicate. * @param p The pool to use for new_mmap. */ -APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap, - apr_mmap_t *old_mmap, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_mmap_dup(fspr_mmap_t **new_mmap, + fspr_mmap_t *old_mmap, + fspr_pool_t *p); /** * Remove a mmap'ed. * @param mm The mmap'ed file. */ -APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm); +APR_DECLARE(fspr_status_t) fspr_mmap_delete(fspr_mmap_t *mm); /** * Move the pointer into the mmap'ed file to the specified offset. @@ -157,8 +157,8 @@ APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm); * @param mm The mmap'ed file. * @param offset The offset to move to. */ -APR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mm, - apr_off_t offset); +APR_DECLARE(fspr_status_t) fspr_mmap_offset(void **addr, fspr_mmap_t *mm, + fspr_off_t offset); #endif /* APR_HAS_MMAP */ diff --git a/libs/apr/include/apr_network_io.h b/libs/apr/include/fspr_network_io.h similarity index 72% rename from libs/apr/include/apr_network_io.h rename to libs/apr/include/fspr_network_io.h index 1d65f1cb09..384b329143 100644 --- a/libs/apr/include/apr_network_io.h +++ b/libs/apr/include/fspr_network_io.h @@ -17,15 +17,15 @@ #ifndef APR_NETWORK_IO_H #define APR_NETWORK_IO_H /** - * @file apr_network_io.h + * @file fspr_network_io.h * @brief APR Network library */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_file_io.h" -#include "apr_errno.h" -#include "apr_inherit.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_file_io.h" +#include "fspr_errno.h" +#include "fspr_inherit.h" #if APR_HAVE_NETINET_IN_H #include @@ -36,7 +36,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_network_io Network Routines + * @defgroup fspr_network_io Network Routines * @ingroup APR * @{ */ @@ -57,7 +57,7 @@ extern "C" { #endif /** - * @defgroup apr_sockopt Socket option definitions + * @defgroup fspr_sockopt Socket option definitions * @{ */ #define APR_SO_LINGER 1 /**< Linger */ @@ -81,7 +81,7 @@ extern "C" { #define APR_INCOMPLETE_READ 4096 /**< Set on non-blocking sockets * (timeout != 0) on which the * previous read() did not fill a buffer - * completely. the next apr_socket_recv() + * completely. the next fspr_socket_recv() * will first call select()/poll() rather than * going straight into read(). (Can also * be set by an application to force a @@ -97,7 +97,7 @@ extern "C" { */ #define APR_TCP_DEFER_ACCEPT 32768 /**< Delay accepting of new connections * until data is available. - * @see apr_socket_accept_filter + * @see fspr_socket_accept_filter */ /** @} */ @@ -107,10 +107,10 @@ typedef enum { APR_SHUTDOWN_READ, /**< no longer allow read request */ APR_SHUTDOWN_WRITE, /**< no longer allow write requests */ APR_SHUTDOWN_READWRITE /**< no longer allow read or write requests */ -} apr_shutdown_how_e; +} fspr_shutdown_how_e; -#define APR_IPV4_ADDR_OK 0x01 /**< @see apr_sockaddr_info_get() */ -#define APR_IPV6_ADDR_OK 0x02 /**< @see apr_sockaddr_info_get() */ +#define APR_IPV4_ADDR_OK 0x01 /**< @see fspr_sockaddr_info_get() */ +#define APR_IPV6_ADDR_OK 0x02 /**< @see fspr_sockaddr_info_get() */ #if (!APR_HAVE_IN_ADDR) /** @@ -118,7 +118,7 @@ typedef enum { * define it ourselves, if the platform doesn't provide it. */ struct in_addr { - apr_uint32_t s_addr; /**< storage to hold the IP# */ + fspr_uint32_t s_addr; /**< storage to hold the IP# */ }; #endif @@ -169,7 +169,7 @@ struct in_addr { typedef enum { APR_LOCAL, APR_REMOTE -} apr_interface_e; +} fspr_interface_e; /** * The specific declaration of inet_addr's ... some platforms fall back @@ -177,49 +177,49 @@ typedef enum { */ #if APR_HAVE_INET_ADDR -#define apr_inet_addr inet_addr +#define fspr_inet_addr inet_addr #elif APR_HAVE_INET_NETWORK /* only DGUX, as far as I know */ /** * @warning * not generally safe... inet_network() and inet_addr() perform * different functions */ -#define apr_inet_addr inet_network +#define fspr_inet_addr inet_network #endif /** A structure to represent sockets */ -typedef struct apr_socket_t apr_socket_t; +typedef struct fspr_socket_t fspr_socket_t; /** - * A structure to encapsulate headers and trailers for apr_socket_sendfile + * A structure to encapsulate headers and trailers for fspr_socket_sendfile */ -typedef struct apr_hdtr_t apr_hdtr_t; +typedef struct fspr_hdtr_t fspr_hdtr_t; /** A structure to represent in_addr */ -typedef struct in_addr apr_in_addr_t; +typedef struct in_addr fspr_in_addr_t; /** A structure to represent an IP subnet */ -typedef struct apr_ipsubnet_t apr_ipsubnet_t; +typedef struct fspr_ipsubnet_t fspr_ipsubnet_t; -/** @remark use apr_uint16_t just in case some system has a short that isn't 16 bits... */ -typedef apr_uint16_t apr_port_t; +/** @remark use fspr_uint16_t just in case some system has a short that isn't 16 bits... */ +typedef fspr_uint16_t fspr_port_t; /** @remark It's defined here as I think it should all be platform safe... - * @see apr_sockaddr_t + * @see fspr_sockaddr_t */ -typedef struct apr_sockaddr_t apr_sockaddr_t; +typedef struct fspr_sockaddr_t fspr_sockaddr_t; /** * APRs socket address type, used to ensure protocol independence */ -struct apr_sockaddr_t { +struct fspr_sockaddr_t { /** The pool to use... */ - apr_pool_t *pool; + fspr_pool_t *pool; /** The hostname */ char *hostname; /** Either a string of the port number or the service name for the port */ char *servname; /** The numeric port */ - apr_port_t port; + fspr_port_t port; /** The family */ - apr_int32_t family; + fspr_int32_t family; /** How big is the sockaddr we're using? */ - apr_socklen_t salen; + fspr_socklen_t salen; /** How big is the ip address structure we're using? */ int ipaddr_len; /** How big should the address buffer be? 16 for v4 or 46 for v6 @@ -228,9 +228,9 @@ struct apr_sockaddr_t { /** This points to the IP address structure within the appropriate * sockaddr structure. */ void *ipaddr_ptr; - /** If multiple addresses were found by apr_sockaddr_info_get(), this + /** If multiple addresses were found by fspr_sockaddr_info_get(), this * points to a representation of the next address. */ - apr_sockaddr_t *next; + fspr_sockaddr_t *next; /** Union of either IPv4 or IPv6 sockaddr. */ union { /** IPv4 sockaddr structure */ @@ -251,13 +251,13 @@ struct apr_sockaddr_t { /** * Support reusing the socket on platforms which support it (from disconnect, * specifically Win32. - * @remark Optional flag passed into apr_socket_sendfile() + * @remark Optional flag passed into fspr_socket_sendfile() */ #define APR_SENDFILE_DISCONNECT_SOCKET 1 #endif -/** A structure to encapsulate headers and trailers for apr_socket_sendfile */ -struct apr_hdtr_t { +/** A structure to encapsulate headers and trailers for fspr_socket_sendfile */ +struct fspr_hdtr_t { /** An iovec to store the headers sent before the file. */ struct iovec* headers; /** number of headers in the iovec */ @@ -278,10 +278,10 @@ struct apr_hdtr_t { * @param protocol The protocol of the socket (e.g., APR_PROTO_TCP). * @param cont The pool to use */ -APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new_sock, +APR_DECLARE(fspr_status_t) fspr_socket_create(fspr_socket_t **new_sock, int family, int type, int protocol, - apr_pool_t *cont); + fspr_pool_t *cont); /** * Shutdown either reading, writing, or both sides of a socket. @@ -292,18 +292,18 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new_sock, * APR_SHUTDOWN_WRITE no longer allow write requests * APR_SHUTDOWN_READWRITE no longer allow read or write requests * - * @see apr_shutdown_how_e + * @see fspr_shutdown_how_e * @remark This does not actually close the socket descriptor, it just * controls which calls are still valid on the socket. */ -APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, - apr_shutdown_how_e how); +APR_DECLARE(fspr_status_t) fspr_socket_shutdown(fspr_socket_t *thesocket, + fspr_shutdown_how_e how); /** * Close a socket. * @param thesocket The socket to close */ -APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket); +APR_DECLARE(fspr_status_t) fspr_socket_close(fspr_socket_t *thesocket); /** * Bind the socket to its associated port @@ -312,8 +312,8 @@ APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket); * @remark This may be where we will find out if there is any other process * using the selected port. */ -APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, - apr_sockaddr_t *sa); +APR_DECLARE(fspr_status_t) fspr_socket_bind(fspr_socket_t *sock, + fspr_sockaddr_t *sa); /** * Listen to a bound socket for connections. @@ -322,8 +322,8 @@ APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, * listen queue. If this value is less than zero, the listen * queue size is set to zero. */ -APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, - apr_int32_t backlog); +APR_DECLARE(fspr_status_t) fspr_socket_listen(fspr_socket_t *sock, + fspr_int32_t backlog); /** * Accept a new connection request @@ -333,9 +333,9 @@ APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, * @param sock The socket we are listening on. * @param connection_pool The pool for the new socket. */ -APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new_sock, - apr_socket_t *sock, - apr_pool_t *connection_pool); +APR_DECLARE(fspr_status_t) fspr_socket_accept(fspr_socket_t **new_sock, + fspr_socket_t *sock, + fspr_pool_t *connection_pool); /** * Issue a connection request to a socket either on the same machine @@ -343,12 +343,12 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new_sock, * @param sock The socket we wish to use for our side of the connection * @param sa The address of the machine we wish to connect to. */ -APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, - apr_sockaddr_t *sa); +APR_DECLARE(fspr_status_t) fspr_socket_connect(fspr_socket_t *sock, + fspr_sockaddr_t *sa); /** - * Create apr_sockaddr_t from hostname, address family, and port. - * @param sa The new apr_sockaddr_t. + * Create fspr_sockaddr_t from hostname, address family, and port. + * @param sa The new fspr_sockaddr_t. * @param hostname The hostname or numeric address string to resolve/parse, or * NULL to build an address that corresponds to 0.0.0.0 or :: * @param family The address family to use, or APR_UNSPEC if the system should @@ -367,24 +367,24 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, * isn't NULL and APR_HAVE_IPV6; mutually exclusive * with APR_IPV4_ADDR_OK * - * @param p The pool for the apr_sockaddr_t and associated storage. + * @param p The pool for the fspr_sockaddr_t and associated storage. */ -APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa, +APR_DECLARE(fspr_status_t) fspr_sockaddr_info_get(fspr_sockaddr_t **sa, const char *hostname, - apr_int32_t family, - apr_port_t port, - apr_int32_t flags, - apr_pool_t *p); + fspr_int32_t family, + fspr_port_t port, + fspr_int32_t flags, + fspr_pool_t *p); /** - * Look up the host name from an apr_sockaddr_t. + * Look up the host name from an fspr_sockaddr_t. * @param hostname The hostname. - * @param sa The apr_sockaddr_t. + * @param sa The fspr_sockaddr_t. * @param flags Special processing flags. */ -APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, - apr_sockaddr_t *sa, - apr_int32_t flags); +APR_DECLARE(fspr_status_t) fspr_getnameinfo(char **hostname, + fspr_sockaddr_t *sa, + fspr_int32_t flags); /** * Parse hostname/IP address with scope id and port. @@ -416,11 +416,11 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, * required, check for addr == NULL in addition to checking the * return code. */ -APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, +APR_DECLARE(fspr_status_t) fspr_parse_addr_port(char **addr, char **scope_id, - apr_port_t *port, + fspr_port_t *port, const char *str, - apr_pool_t *p); + fspr_pool_t *p); /** * Get name of the current machine @@ -430,7 +430,7 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, * @param cont The pool to use. * @remark If the buffer was not large enough, an error will be returned. */ -APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len, apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_gethostname(char *buf, int len, fspr_pool_t *cont); /** * Return the data associated with the current socket @@ -438,8 +438,8 @@ APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len, apr_pool_t *cont); * @param key The key to associate with the user data. * @param sock The currently open socket. */ -APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key, - apr_socket_t *sock); +APR_DECLARE(fspr_status_t) fspr_socket_data_get(void **data, const char *key, + fspr_socket_t *sock); /** * Set the data associated with the current socket. @@ -448,9 +448,9 @@ APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key, * @param key The key to associate with the data. * @param cleanup The cleanup to call when the socket is destroyed. */ -APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data, +APR_DECLARE(fspr_status_t) fspr_socket_data_set(fspr_socket_t *sock, void *data, const char *key, - apr_status_t (*cleanup)(void*)); + fspr_status_t (*cleanup)(void*)); /** * Send data over a network. @@ -461,7 +461,7 @@ APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data, * @remark *
      * This functions acts like a blocking write by default.  To change 
    - * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
    + * this behavior, use fspr_socket_timeout_set() or the APR_SO_NONBLOCK
      * socket option.
      *
      * It is possible for both bytes to be sent and an error to be returned.
    @@ -469,8 +469,8 @@ APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data,
      * APR_EINTR is never returned.
      * 
    */ -APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, - apr_size_t *len); +APR_DECLARE(fspr_status_t) fspr_socket_send(fspr_socket_t *sock, const char *buf, + fspr_size_t *len); /** * Send multiple packets of data over a network. @@ -481,7 +481,7 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, * @remark *
      * This functions acts like a blocking write by default.  To change 
    - * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
    + * this behavior, use fspr_socket_timeout_set() or the APR_SO_NONBLOCK
      * socket option.
      * The number of bytes actually sent is stored in argument 3.
      *
    @@ -490,34 +490,34 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf,
      * APR_EINTR is never returned.
      * 
    */ -APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, +APR_DECLARE(fspr_status_t) fspr_socket_sendv(fspr_socket_t *sock, const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len); + fspr_int32_t nvec, fspr_size_t *len); /** * @param sock The socket to send from - * @param where The apr_sockaddr_t describing where to send the data + * @param where The fspr_sockaddr_t describing where to send the data * @param flags The flags to use * @param buf The data to send * @param len The length of the data to send */ -APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, - apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, - apr_size_t *len); +APR_DECLARE(fspr_status_t) fspr_socket_sendto(fspr_socket_t *sock, + fspr_sockaddr_t *where, + fspr_int32_t flags, const char *buf, + fspr_size_t *len); /** - * @param from The apr_sockaddr_t to fill in the recipient info + * @param from The fspr_sockaddr_t to fill in the recipient info * @param sock The socket to use * @param flags The flags to use * @param buf The buffer to use * @param len The length of the available buffer */ -APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, - apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len); +APR_DECLARE(fspr_status_t) fspr_socket_recvfrom(fspr_sockaddr_t *from, + fspr_socket_t *sock, + fspr_int32_t flags, char *buf, + fspr_size_t *len); #if APR_HAS_SENDFILE || defined(DOXYGEN) @@ -533,18 +533,18 @@ APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, * including headers, file, and trailers * @param flags APR flags that are mapped to OS specific flags * @remark This functions acts like a blocking write by default. To change - * this behavior, use apr_socket_timeout_set() or the + * this behavior, use fspr_socket_timeout_set() or the * APR_SO_NONBLOCK socket option. * The number of bytes actually sent is stored in the len parameter. * The offset parameter is passed by reference for no reason; its - * value will never be modified by the apr_socket_sendfile() function. + * value will never be modified by the fspr_socket_sendfile() function. */ -APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, - apr_file_t *file, - apr_hdtr_t *hdtr, - apr_off_t *offset, - apr_size_t *len, - apr_int32_t flags); +APR_DECLARE(fspr_status_t) fspr_socket_sendfile(fspr_socket_t *sock, + fspr_file_t *file, + fspr_hdtr_t *hdtr, + fspr_off_t *offset, + fspr_size_t *len, + fspr_int32_t flags); #endif /* APR_HAS_SENDFILE */ @@ -557,7 +557,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, * @remark *
      * This functions acts like a blocking read by default.  To change 
    - * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
    + * this behavior, use fspr_socket_timeout_set() or the APR_SO_NONBLOCK
      * socket option.
      * The number of bytes actually received is stored in argument 3.
      *
    @@ -567,8 +567,8 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock,
      * APR_EINTR is never returned.
      * 
    */ -APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, - char *buf, apr_size_t *len); +APR_DECLARE(fspr_status_t) fspr_socket_recv(fspr_socket_t *sock, + char *buf, fspr_size_t *len); /** * Setup socket options for the specified socket @@ -592,8 +592,8 @@ APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, * * @param on Value for the option. */ -APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, - apr_int32_t opt, apr_int32_t on); +APR_DECLARE(fspr_status_t) fspr_socket_opt_set(fspr_socket_t *sock, + fspr_int32_t opt, fspr_int32_t on); /** * Setup socket timeout for the specified socket @@ -606,8 +606,8 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, * t < 0 -- read and write calls block * */ -APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, - apr_interval_time_t t); +APR_DECLARE(fspr_status_t) fspr_socket_timeout_set(fspr_socket_t *sock, + fspr_interval_time_t t); /** * Query socket options for the specified socket @@ -628,14 +628,14 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, * * @param on Socket option returned on the call. */ -APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, - apr_int32_t opt, apr_int32_t *on); +APR_DECLARE(fspr_status_t) fspr_socket_opt_get(fspr_socket_t *sock, + fspr_int32_t opt, fspr_int32_t *on); /** * Get Socket fd for the socket passed * @param sock The socket to quesry for the socket fd */ -APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock); +APR_DECLARE(int) fspr_socket_fd_get(fspr_socket_t *sock); /** @@ -643,8 +643,8 @@ APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock); * @param sock The socket to query * @param t Socket timeout returned from the query. */ -APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock, - apr_interval_time_t *t); +APR_DECLARE(fspr_status_t) fspr_socket_timeout_get(fspr_socket_t *sock, + fspr_interval_time_t *t); /** * Query the specified socket if at the OOB/Urgent data mark @@ -652,28 +652,28 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock, * @param atmark Is set to true if socket is at the OOB/urgent mark, * otherwise is set to false. */ -APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, +APR_DECLARE(fspr_status_t) fspr_socket_atmark(fspr_socket_t *sock, int *atmark); /** - * Return an apr_sockaddr_t from an apr_socket_t - * @param sa The returned apr_sockaddr_t. - * @param which Which interface do we want the apr_sockaddr_t for? + * Return an fspr_sockaddr_t from an fspr_socket_t + * @param sa The returned fspr_sockaddr_t. + * @param which Which interface do we want the fspr_sockaddr_t for? * @param sock The socket to use */ -APR_DECLARE(apr_status_t) apr_socket_addr_get(apr_sockaddr_t **sa, - apr_interface_e which, - apr_socket_t *sock); +APR_DECLARE(fspr_status_t) fspr_socket_addr_get(fspr_sockaddr_t **sa, + fspr_interface_e which, + fspr_socket_t *sock); /** * Return the IP address (in numeric address string format) in * an APR socket address. APR will allocate storage for the IP address - * string from the pool of the apr_sockaddr_t. + * string from the pool of the fspr_sockaddr_t. * @param addr The IP address. * @param sockaddr The socket address to reference. */ -APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr, - apr_sockaddr_t *sockaddr); +APR_DECLARE(fspr_status_t) fspr_sockaddr_ip_get(char **addr, + fspr_sockaddr_t *sockaddr); /** * See if the IP addresses in two APR socket addresses are @@ -685,23 +685,23 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr, * @remark The return value will be non-zero if the addresses * are equivalent. */ -APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1, - const apr_sockaddr_t *addr2); +APR_DECLARE(int) fspr_sockaddr_equal(const fspr_sockaddr_t *addr1, + const fspr_sockaddr_t *addr2); /** * Return the type of the socket. * @param sock The socket to query. * @param type The returned type (e.g., SOCK_STREAM). */ -APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock, +APR_DECLARE(fspr_status_t) fspr_socket_type_get(fspr_socket_t *sock, int *type); /** - * Given an apr_sockaddr_t and a service name, set the port for the service - * @param sockaddr The apr_sockaddr_t that will have its port set + * Given an fspr_sockaddr_t and a service name, set the port for the service + * @param sockaddr The fspr_sockaddr_t that will have its port set * @param servname The name of the service you wish to use */ -APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr, +APR_DECLARE(fspr_status_t) fspr_getservbyname(fspr_sockaddr_t *sockaddr, const char *servname); /** * Build an ip-subnet representation from an IP address and optional netmask or @@ -711,19 +711,19 @@ APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr, * @param mask_or_numbits The input netmask or number-of-bits string, or NULL * @param p The pool to allocate from */ -APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, +APR_DECLARE(fspr_status_t) fspr_ipsubnet_create(fspr_ipsubnet_t **ipsub, const char *ipstr, const char *mask_or_numbits, - apr_pool_t *p); + fspr_pool_t *p); /** - * Test the IP address in an apr_sockaddr_t against a pre-built ip-subnet + * Test the IP address in an fspr_sockaddr_t against a pre-built ip-subnet * representation. * @param ipsub The ip-subnet representation * @param sa The socket address to test * @return non-zero if the socket address is within the subnet, 0 otherwise */ -APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa); +APR_DECLARE(int) fspr_ipsubnet_test(fspr_ipsubnet_t *ipsub, fspr_sockaddr_t *sa); #if APR_HAS_SO_ACCEPTFILTER || defined(DOXYGEN) /** @@ -733,7 +733,7 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa); * @param args Any extra args to the accept filter. Passing NULL here removes * the accept filter. */ -apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name, +fspr_status_t fspr_socket_accept_filter(fspr_socket_t *sock, char *name, char *args); #endif @@ -742,7 +742,7 @@ apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name, * @param sock The socket to query. * @param protocol The returned protocol (e.g., APR_PROTO_TCP). */ -APR_DECLARE(apr_status_t) apr_socket_protocol_get(apr_socket_t *sock, +APR_DECLARE(fspr_status_t) fspr_socket_protocol_get(fspr_socket_t *sock, int *protocol); /** @@ -761,7 +761,7 @@ APR_DECLARE_INHERIT_SET(socket); APR_DECLARE_INHERIT_UNSET(socket); /** - * @defgroup apr_mcast IP Multicast + * @defgroup fspr_mcast IP Multicast * @{ */ @@ -774,14 +774,14 @@ APR_DECLARE_INHERIT_UNSET(socket); * @param source Source Address to accept transmissions from (non-NULL * implies Source-Specific Multicast) */ -APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock, - apr_sockaddr_t *join, - apr_sockaddr_t *iface, - apr_sockaddr_t *source); +APR_DECLARE(fspr_status_t) fspr_mcast_join(fspr_socket_t *sock, + fspr_sockaddr_t *join, + fspr_sockaddr_t *iface, + fspr_sockaddr_t *source); /** * Leave a Multicast Group. All arguments must be the same as - * apr_mcast_join. + * fspr_mcast_join. * @param sock The socket to leave a multicast group * @param addr The address of the multicast group to leave * @param iface Address of the interface to use. If NULL is passed, the @@ -789,10 +789,10 @@ APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock, * @param source Source Address to accept transmissions from (non-NULL * implies Source-Specific Multicast) */ -APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock, - apr_sockaddr_t *addr, - apr_sockaddr_t *iface, - apr_sockaddr_t *source); +APR_DECLARE(fspr_status_t) fspr_mcast_leave(fspr_socket_t *sock, + fspr_sockaddr_t *addr, + fspr_sockaddr_t *iface, + fspr_sockaddr_t *source); /** * Set the Multicast Time to Live (ttl) for a multicast transmission. @@ -801,16 +801,16 @@ APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock, * @remark If the TTL is 0, packets will only be seen by sockets on * the local machine, and only when multicast loopback is enabled. */ -APR_DECLARE(apr_status_t) apr_mcast_hops(apr_socket_t *sock, - apr_byte_t ttl); +APR_DECLARE(fspr_status_t) fspr_mcast_hops(fspr_socket_t *sock, + fspr_byte_t ttl); /** * Toggle IP Multicast Loopback * @param sock The socket to set multicast loopback * @param opt 0=disable, 1=enable */ -APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock, - apr_byte_t opt); +APR_DECLARE(fspr_status_t) fspr_mcast_loopback(fspr_socket_t *sock, + fspr_byte_t opt); /** @@ -818,8 +818,8 @@ APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock, * @param sock The socket to set the multicast interface on * @param iface Address of the interface to use for Multicast */ -APR_DECLARE(apr_status_t) apr_mcast_interface(apr_socket_t *sock, - apr_sockaddr_t *iface); +APR_DECLARE(fspr_status_t) fspr_mcast_interface(fspr_socket_t *sock, + fspr_sockaddr_t *iface); /** @} */ diff --git a/libs/apr/include/apr_poll.h b/libs/apr/include/fspr_poll.h similarity index 65% rename from libs/apr/include/apr_poll.h rename to libs/apr/include/fspr_poll.h index c5266495f9..a3fa5c42f2 100644 --- a/libs/apr/include/apr_poll.h +++ b/libs/apr/include/fspr_poll.h @@ -17,15 +17,15 @@ #ifndef APR_POLL_H #define APR_POLL_H /** - * @file apr_poll.h + * @file fspr_poll.h * @brief APR Poll interface */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_inherit.h" -#include "apr_file_io.h" -#include "apr_network_io.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" +#include "fspr_inherit.h" +#include "fspr_file_io.h" +#include "fspr_network_io.h" #if APR_HAVE_NETINET_IN_H #include @@ -36,7 +36,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_poll Poll Routines + * @defgroup fspr_poll Poll Routines * @ingroup APR * @{ */ @@ -56,30 +56,30 @@ extern "C" { */ #define APR_POLLSET_THREADSAFE 0x001 /**< Adding or Removing a Descriptor is thread safe */ -/** Used in apr_pollfd_t to determine what the apr_descriptor is */ +/** Used in fspr_pollfd_t to determine what the fspr_descriptor is */ typedef enum { APR_NO_DESC, /**< nothing here */ APR_POLL_SOCKET, /**< descriptor refers to a socket */ APR_POLL_FILE, /**< descriptor refers to a file */ APR_POLL_LASTDESC /**< descriptor is the last one in the list */ -} apr_datatype_e ; +} fspr_datatype_e ; /** Union of either an APR file or socket. */ typedef union { - apr_file_t *f; /**< file */ - apr_socket_t *s; /**< socket */ -} apr_descriptor; + fspr_file_t *f; /**< file */ + fspr_socket_t *s; /**< socket */ +} fspr_descriptor; -/** @see apr_pollfd_t */ -typedef struct apr_pollfd_t apr_pollfd_t; +/** @see fspr_pollfd_t */ +typedef struct fspr_pollfd_t fspr_pollfd_t; /** Poll descriptor set. */ -struct apr_pollfd_t { - apr_pool_t *p; /**< associated pool */ - apr_datatype_e desc_type; /**< descriptor type */ - apr_int16_t reqevents; /**< requested events */ - apr_int16_t rtnevents; /**< returned events */ - apr_descriptor desc; /**< @see apr_descriptor */ +struct fspr_pollfd_t { + fspr_pool_t *p; /**< associated pool */ + fspr_datatype_e desc_type; /**< descriptor type */ + fspr_int16_t reqevents; /**< requested events */ + fspr_int16_t rtnevents; /**< returned events */ + fspr_descriptor desc; /**< @see fspr_descriptor */ void *client_data; /**< allows app to associate context */ }; @@ -89,7 +89,7 @@ struct apr_pollfd_t { */ /** Opaque structure used for pollset API */ -typedef struct apr_pollset_t apr_pollset_t; +typedef struct fspr_pollset_t fspr_pollset_t; /** * Setup a pollset object @@ -100,21 +100,21 @@ typedef struct apr_pollset_t apr_pollset_t; * * @remark If flags equals APR_POLLSET_THREADSAFE, then a pollset is * created on which it is safe to make concurrent calls to - * apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll() from + * fspr_pollset_add(), fspr_pollset_remove() and fspr_pollset_poll() from * separate threads. This feature is only supported on some - * platforms; the apr_pollset_create() call will fail with + * platforms; the fspr_pollset_create() call will fail with * APR_ENOTIMPL on platforms where it is not supported. */ -APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, - apr_uint32_t size, - apr_pool_t *p, - apr_uint32_t flags); +APR_DECLARE(fspr_status_t) fspr_pollset_create(fspr_pollset_t **pollset, + fspr_uint32_t size, + fspr_pool_t *p, + fspr_uint32_t flags); /** * Destroy a pollset object * @param pollset The pollset to destroy */ -APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset); +APR_DECLARE(fspr_status_t) fspr_pollset_destroy(fspr_pollset_t *pollset); /** * Add a socket or file descriptor to a pollset @@ -122,36 +122,36 @@ APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset); * @param descriptor The descriptor to add * @remark If you set client_data in the descriptor, that value * will be returned in the client_data field whenever this - * descriptor is signalled in apr_pollset_poll(). + * descriptor is signalled in fspr_pollset_poll(). * @remark If the pollset has been created with APR_POLLSET_THREADSAFE - * and thread T1 is blocked in a call to apr_pollset_poll() for - * this same pollset that is being modified via apr_pollset_add() - * in thread T2, the currently executing apr_pollset_poll() call in + * and thread T1 is blocked in a call to fspr_pollset_poll() for + * this same pollset that is being modified via fspr_pollset_add() + * in thread T2, the currently executing fspr_pollset_poll() call in * T1 will either: (1) automatically include the newly added descriptor * in the set of descriptors it is watching or (2) return immediately * with APR_EINTR. Option (1) is recommended, but option (2) is * allowed for implementations where option (1) is impossible * or impractical. */ -APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor); +APR_DECLARE(fspr_status_t) fspr_pollset_add(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor); /** * Remove a descriptor from a pollset * @param pollset The pollset from which to remove the descriptor * @param descriptor The descriptor to remove * @remark If the pollset has been created with APR_POLLSET_THREADSAFE - * and thread T1 is blocked in a call to apr_pollset_poll() for - * this same pollset that is being modified via apr_pollset_remove() - * in thread T2, the currently executing apr_pollset_poll() call in + * and thread T1 is blocked in a call to fspr_pollset_poll() for + * this same pollset that is being modified via fspr_pollset_remove() + * in thread T2, the currently executing fspr_pollset_poll() call in * T1 will either: (1) automatically exclude the newly added descriptor * in the set of descriptors it is watching or (2) return immediately * with APR_EINTR. Option (1) is recommended, but option (2) is * allowed for implementations where option (1) is impossible * or impractical. */ -APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor); +APR_DECLARE(fspr_status_t) fspr_pollset_remove(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor); /** * Block for activity on the descriptor(s) in a pollset @@ -160,10 +160,10 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, * @param num Number of signalled descriptors (output parameter) * @param descriptors Array of signalled descriptors (output parameter) */ -APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors); +APR_DECLARE(fspr_status_t) fspr_pollset_poll(fspr_pollset_t *pollset, + fspr_interval_time_t timeout, + fspr_int32_t *num, + const fspr_pollfd_t **descriptors); /** @@ -178,12 +178,12 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, * @remark The number of descriptors signalled is returned in the third argument. * This is a blocking call, and it will not return until either a * descriptor has been signalled, or the timeout has expired. - * @remark The rtnevents field in the apr_pollfd_t array will only be filled- + * @remark The rtnevents field in the fspr_pollfd_t array will only be filled- * in if the return value is APR_SUCCESS. */ -APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t numsock, - apr_int32_t *nsds, - apr_interval_time_t timeout); +APR_DECLARE(fspr_status_t) fspr_poll(fspr_pollfd_t *aprset, fspr_int32_t numsock, + fspr_int32_t *nsds, + fspr_interval_time_t timeout); /** @} */ diff --git a/libs/apr/include/apr_pools.h b/libs/apr/include/fspr_pools.h similarity index 70% rename from libs/apr/include/apr_pools.h rename to libs/apr/include/fspr_pools.h index 9b7f15685a..5764b96d16 100644 --- a/libs/apr/include/apr_pools.h +++ b/libs/apr/include/fspr_pools.h @@ -18,7 +18,7 @@ #define APR_POOLS_H /** - * @file apr_pools.h + * @file fspr_pools.h * @brief APR memory allocation * * Resource allocation routines... @@ -30,61 +30,61 @@ * Instead, we maintain pools, and allocate items (both memory and I/O * handlers) from the pools --- currently there are two, one for per * transaction info, and one for config info. When a transaction is over, - * we can delete everything in the per-transaction apr_pool_t without fear, + * we can delete everything in the per-transaction fspr_pool_t without fear, * and without thinking too hard about it either. */ -#include "apr.h" -#include "apr_errno.h" -#include "apr_general.h" /* for APR_STRINGIFY */ +#include "fspr.h" +#include "fspr_errno.h" +#include "fspr_general.h" /* for APR_STRINGIFY */ #define APR_WANT_MEMFUNC /**< for no good reason? */ -#include "apr_want.h" +#include "fspr_want.h" #ifdef __cplusplus extern "C" { #endif /** - * @defgroup apr_pools Memory Pool Functions + * @defgroup fspr_pools Memory Pool Functions * @ingroup APR * @{ */ /** The fundamental pool type */ -typedef struct apr_pool_t apr_pool_t; +typedef struct fspr_pool_t fspr_pool_t; /** - * Declaration helper macro to construct apr_foo_pool_get()s. + * Declaration helper macro to construct fspr_foo_pool_get()s. * * This standardized macro is used by opaque (APR) data types to return - * the apr_pool_t that is associated with the data type. + * the fspr_pool_t that is associated with the data type. * * APR_POOL_DECLARE_ACCESSOR() is used in a header file to declare the * accessor function. A typical usage and result would be: *
      *    APR_POOL_DECLARE_ACCESSOR(file);
      * becomes:
    - *    APR_DECLARE(apr_pool_t *) apr_file_pool_get(apr_file_t *ob);
    + *    APR_DECLARE(fspr_pool_t *) fspr_file_pool_get(fspr_file_t *ob);
      * 
    * @remark Doxygen unwraps this macro (via doxygen.conf) to provide - * actual help for each specific occurance of apr_foo_pool_get. + * actual help for each specific occurance of fspr_foo_pool_get. * @remark the linkage is specified for APR. It would be possible to expand * the macros to support other linkages. */ #define APR_POOL_DECLARE_ACCESSOR(type) \ - APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \ - (const apr_##type##_t *the##type) + APR_DECLARE(fspr_pool_t *) fspr_##type##_pool_get \ + (const fspr_##type##_t *the##type) /** - * Implementation helper macro to provide apr_foo_pool_get()s. + * Implementation helper macro to provide fspr_foo_pool_get()s. * * In the implementation, the APR_POOL_IMPLEMENT_ACCESSOR() is used to * actually define the function. It assumes the field is named "pool". */ #define APR_POOL_IMPLEMENT_ACCESSOR(type) \ - APR_DECLARE(apr_pool_t *) apr_##type##_pool_get \ - (const apr_##type##_t *the##type) \ + APR_DECLARE(fspr_pool_t *) fspr_##type##_pool_get \ + (const fspr_##type##_t *the##type) \ { return the##type->pool; } @@ -116,7 +116,7 @@ typedef struct apr_pool_t apr_pool_t; * combination with the verbose flag above, * it will output OWNER in such an event * prior to aborting. Use the debug - * function apr_pool_owner_set() to switch + * function fspr_pool_owner_set() to switch * a pools ownership. * * When no debug level was specified, assume general debug mode. @@ -139,7 +139,7 @@ typedef struct apr_pool_t apr_pool_t; /** A function that is called when allocation fails. */ -typedef int (*apr_abortfunc_t)(int retcode); +typedef int (*fspr_abortfunc_t)(int retcode); /* * APR memory structure manipulators (pools, tables, and arrays). @@ -152,74 +152,74 @@ typedef int (*apr_abortfunc_t)(int retcode); /** * Setup all of the internal structures required to use pools * @remark Programs do NOT need to call this directly. APR will call this - * automatically from apr_initialize. + * automatically from fspr_initialize. * @internal */ -APR_DECLARE(apr_status_t) apr_pool_initialize(void); +APR_DECLARE(fspr_status_t) fspr_pool_initialize(void); /** * Tear down all of the internal structures required to use pools * @remark Programs do NOT need to call this directly. APR will call this - * automatically from apr_terminate. + * automatically from fspr_terminate. * @internal */ -APR_DECLARE(void) apr_pool_terminate(void); +APR_DECLARE(void) fspr_pool_terminate(void); /* * Pool creation/destruction */ -#include "apr_allocator.h" +#include "fspr_allocator.h" /** * Create a new pool. * @param newpool The pool we have just created. * @param parent The parent pool. If this is NULL, the new pool is a root * pool. If it is non-NULL, the new pool will inherit all - * of its parent pool's attributes, except the apr_pool_t will + * of its parent pool's attributes, except the fspr_pool_t will * be a sub-pool. * @param abort_fn A function to use if the pool cannot allocate more memory. * @param allocator The allocator to use with the new pool. If NULL the * allocator of the parent pool will be used. */ -APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, - apr_pool_t *parent, - apr_abortfunc_t abort_fn, - apr_allocator_t *allocator); +APR_DECLARE(fspr_status_t) fspr_pool_create_ex(fspr_pool_t **newpool, + fspr_pool_t *parent, + fspr_abortfunc_t abort_fn, + fspr_allocator_t *allocator); /** - * Debug version of apr_pool_create_ex. - * @param newpool @see apr_pool_create. - * @param parent @see apr_pool_create. - * @param abort_fn @see apr_pool_create. - * @param allocator @see apr_pool_create. + * Debug version of fspr_pool_create_ex. + * @param newpool @see fspr_pool_create. + * @param parent @see fspr_pool_create. + * @param abort_fn @see fspr_pool_create. + * @param allocator @see fspr_pool_create. * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. * @remark Only available when APR_POOL_DEBUG is defined. - * Call this directly if you have you apr_pool_create_ex + * Call this directly if you have you fspr_pool_create_ex * calls in a wrapper function and wish to override * the file_line argument to reflect the caller of * your wrapper function. If you do not have - * apr_pool_create_ex in a wrapper, trust the macro - * and don't call apr_pool_create_ex_debug directly. + * fspr_pool_create_ex in a wrapper, trust the macro + * and don't call fspr_pool_create_ex_debug directly. */ -APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, - apr_pool_t *parent, - apr_abortfunc_t abort_fn, - apr_allocator_t *allocator, +APR_DECLARE(fspr_status_t) fspr_pool_create_ex_debug(fspr_pool_t **newpool, + fspr_pool_t *parent, + fspr_abortfunc_t abort_fn, + fspr_allocator_t *allocator, const char *file_line); #if APR_POOL_DEBUG -#define apr_pool_create_ex(newpool, parent, abort_fn, allocator) \ - apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \ +#define fspr_pool_create_ex(newpool, parent, abort_fn, allocator) \ + fspr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \ APR_POOL__FILE_LINE__) -APR_DECLARE(int) apr_pool_walk_tree_debug(apr_pool_t *pool, - int(*fn)(apr_pool_t *pool, void *data), +APR_DECLARE(int) fspr_pool_walk_tree_debug(fspr_pool_t *pool, + int(*fn)(fspr_pool_t *pool, void *data), void *data); -APR_DECLARE(void) apr_pool_get_stats(apr_pool_t *pool, unsigned int *alloc, unsigned int *total_alloc, unsigned int *clear); +APR_DECLARE(void) fspr_pool_get_stats(fspr_pool_t *pool, unsigned int *alloc, unsigned int *total_alloc, unsigned int *clear); #endif /** @@ -227,20 +227,20 @@ APR_DECLARE(void) apr_pool_get_stats(apr_pool_t *pool, unsigned int *alloc, unsi * @param newpool The pool we have just created. * @param parent The parent pool. If this is NULL, the new pool is a root * pool. If it is non-NULL, the new pool will inherit all - * of its parent pool's attributes, except the apr_pool_t will + * of its parent pool's attributes, except the fspr_pool_t will * be a sub-pool. */ #if defined(DOXYGEN) -APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool, - apr_pool_t *parent); +APR_DECLARE(fspr_status_t) fspr_pool_create(fspr_pool_t **newpool, + fspr_pool_t *parent); #else #if APR_POOL_DEBUG -#define apr_pool_create(newpool, parent) \ - apr_pool_create_ex_debug(newpool, parent, NULL, NULL, \ +#define fspr_pool_create(newpool, parent) \ + fspr_pool_create_ex_debug(newpool, parent, NULL, NULL, \ APR_POOL__FILE_LINE__) #else -#define apr_pool_create(newpool, parent) \ - apr_pool_create_ex(newpool, parent, NULL, NULL) +#define fspr_pool_create(newpool, parent) \ + fspr_pool_create_ex(newpool, parent, NULL, NULL) #endif #endif @@ -248,7 +248,7 @@ APR_DECLARE(apr_status_t) apr_pool_create(apr_pool_t **newpool, * Find the pools allocator * @param pool The pool to get the allocator from. */ -APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool); +APR_DECLARE(fspr_allocator_t *) fspr_pool_allocator_get(fspr_pool_t *pool); /** * Clear all memory in the pool and run all the cleanups. This also destroys all @@ -256,58 +256,58 @@ APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool); * @param p The pool to clear * @remark This does not actually free the memory, it just allows the pool * to re-use this memory for the next allocation. - * @see apr_pool_destroy() + * @see fspr_pool_destroy() */ -APR_DECLARE(void) apr_pool_clear(apr_pool_t *p); +APR_DECLARE(void) fspr_pool_clear(fspr_pool_t *p); /** - * Debug version of apr_pool_clear. - * @param p See: apr_pool_clear. + * Debug version of fspr_pool_clear. + * @param p See: fspr_pool_clear. * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. * @remark Only available when APR_POOL_DEBUG is defined. - * Call this directly if you have you apr_pool_clear + * Call this directly if you have you fspr_pool_clear * calls in a wrapper function and wish to override * the file_line argument to reflect the caller of * your wrapper function. If you do not have - * apr_pool_clear in a wrapper, trust the macro - * and don't call apr_pool_destroy_clear directly. + * fspr_pool_clear in a wrapper, trust the macro + * and don't call fspr_pool_destroy_clear directly. */ -APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p, +APR_DECLARE(void) fspr_pool_clear_debug(fspr_pool_t *p, const char *file_line); #if APR_POOL_DEBUG -#define apr_pool_clear(p) \ - apr_pool_clear_debug(p, APR_POOL__FILE_LINE__) +#define fspr_pool_clear(p) \ + fspr_pool_clear_debug(p, APR_POOL__FILE_LINE__) #endif /** - * Destroy the pool. This takes similar action as apr_pool_clear() and then + * Destroy the pool. This takes similar action as fspr_pool_clear() and then * frees all the memory. * @param p The pool to destroy * @remark This will actually free the memory */ -APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p); +APR_DECLARE(void) fspr_pool_destroy(fspr_pool_t *p); /** - * Debug version of apr_pool_destroy. - * @param p See: apr_pool_destroy. + * Debug version of fspr_pool_destroy. + * @param p See: fspr_pool_destroy. * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. * @remark Only available when APR_POOL_DEBUG is defined. - * Call this directly if you have you apr_pool_destroy + * Call this directly if you have you fspr_pool_destroy * calls in a wrapper function and wish to override * the file_line argument to reflect the caller of * your wrapper function. If you do not have - * apr_pool_destroy in a wrapper, trust the macro - * and don't call apr_pool_destroy_debug directly. + * fspr_pool_destroy in a wrapper, trust the macro + * and don't call fspr_pool_destroy_debug directly. */ -APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p, +APR_DECLARE(void) fspr_pool_destroy_debug(fspr_pool_t *p, const char *file_line); #if APR_POOL_DEBUG -#define apr_pool_destroy(p) \ - apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__) +#define fspr_pool_destroy(p) \ + fspr_pool_destroy_debug(p, APR_POOL__FILE_LINE__) #endif @@ -321,22 +321,22 @@ APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p, * @param size The amount of memory to allocate * @return The allocated memory */ -APR_DECLARE(void *) apr_palloc(apr_pool_t *p, apr_size_t size); +APR_DECLARE(void *) fspr_palloc(fspr_pool_t *p, fspr_size_t size); /** - * Debug version of apr_palloc - * @param p See: apr_palloc - * @param size See: apr_palloc + * Debug version of fspr_palloc + * @param p See: fspr_palloc + * @param size See: fspr_palloc * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. - * @return See: apr_palloc + * @return See: fspr_palloc */ -APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size, +APR_DECLARE(void *) fspr_palloc_debug(fspr_pool_t *p, fspr_size_t size, const char *file_line); #if APR_POOL_DEBUG -#define apr_palloc(p, size) \ - apr_palloc_debug(p, size, APR_POOL__FILE_LINE__) +#define fspr_palloc(p, size) \ + fspr_palloc_debug(p, size, APR_POOL__FILE_LINE__) #endif /** @@ -346,25 +346,25 @@ APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *p, apr_size_t size, * @return The allocated memory */ #if defined(DOXYGEN) -APR_DECLARE(void *) apr_pcalloc(apr_pool_t *p, apr_size_t size); +APR_DECLARE(void *) fspr_pcalloc(fspr_pool_t *p, fspr_size_t size); #elif !APR_POOL_DEBUG -#define apr_pcalloc(p, size) memset(apr_palloc(p, size), 0, size) +#define fspr_pcalloc(p, size) memset(fspr_palloc(p, size), 0, size) #endif /** - * Debug version of apr_pcalloc - * @param p See: apr_pcalloc - * @param size See: apr_pcalloc + * Debug version of fspr_pcalloc + * @param p See: fspr_pcalloc + * @param size See: fspr_pcalloc * @param file_line Where the function is called from. * This is usually APR_POOL__FILE_LINE__. - * @return See: apr_pcalloc + * @return See: fspr_pcalloc */ -APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size, +APR_DECLARE(void *) fspr_pcalloc_debug(fspr_pool_t *p, fspr_size_t size, const char *file_line); #if APR_POOL_DEBUG -#define apr_pcalloc(p, size) \ - apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__) +#define fspr_pcalloc(p, size) \ + fspr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__) #endif @@ -380,22 +380,22 @@ APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *p, apr_size_t size, * then APR will return an error and expect the calling program to * deal with the error accordingly. */ -APR_DECLARE(void) apr_pool_abort_set(apr_abortfunc_t abortfunc, - apr_pool_t *pool); +APR_DECLARE(void) fspr_pool_abort_set(fspr_abortfunc_t abortfunc, + fspr_pool_t *pool); /** * Get the abort function associated with the specified pool. * @param pool The pool for retrieving the abort function. * @return The abort function for the given pool. */ -APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool); +APR_DECLARE(fspr_abortfunc_t) fspr_pool_abort_get(fspr_pool_t *pool); /** * Get the parent pool of the specified pool. * @param pool The pool for retrieving the parent pool. * @return The parent of the given pool. */ -APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool); +APR_DECLARE(fspr_pool_t *) fspr_pool_parent_get(fspr_pool_t *pool); /** * Determine if pool a is an ancestor of pool b. @@ -405,17 +405,17 @@ APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool); * of all pools. * @remark if compiled with APR_POOL_DEBUG, this function will also * return true if A is a pool which has been guaranteed by the caller - * (using apr_pool_join) to have a lifetime at least as long as some + * (using fspr_pool_join) to have a lifetime at least as long as some * ancestor of pool B. */ -APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b); +APR_DECLARE(int) fspr_pool_is_ancestor(fspr_pool_t *a, fspr_pool_t *b); /** * Tag a pool (give it a name) * @param pool The pool to tag * @param tag The tag */ -APR_DECLARE(const char *) apr_pool_tag(apr_pool_t *pool, const char *tag); +APR_DECLARE(const char *) fspr_pool_tag(fspr_pool_t *pool, const char *tag); #if APR_HAS_THREADS /** @@ -424,8 +424,8 @@ APR_DECLARE(const char *) apr_pool_tag(apr_pool_t *pool, const char *tag); * @param mutex The mutex * @remark The mutex does not protect the destroy operation just the low level allocs. */ -APR_DECLARE(void) apr_pool_mutex_set(apr_pool_t *pool, - apr_thread_mutex_t *mutex); +APR_DECLARE(void) fspr_pool_mutex_set(fspr_pool_t *pool, + fspr_thread_mutex_t *mutex); #endif @@ -453,11 +453,11 @@ APR_DECLARE(void) apr_pool_mutex_set(apr_pool_t *pool, * */ -APR_DECLARE(apr_status_t) apr_pool_userdata_set( +APR_DECLARE(fspr_status_t) fspr_pool_userdata_set( const void *data, const char *key, - apr_status_t (*cleanup)(void *), - apr_pool_t *pool); + fspr_status_t (*cleanup)(void *), + fspr_pool_t *pool); /** * Set the data associated with the current pool @@ -465,24 +465,24 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_set( * @param key The key to use for association * @param cleanup The cleanup program to use to cleanup the data (NULL if none) * @param pool The current pool - * @note same as apr_pool_userdata_set(), except that this version doesn't + * @note same as fspr_pool_userdata_set(), except that this version doesn't * make a copy of the key (this function is useful, for example, when * the key is a string literal) * @warning This should NOT be used if the key could change addresses by - * any means between the apr_pool_userdata_setn() call and a - * subsequent apr_pool_userdata_get() on that key, such as if a + * any means between the fspr_pool_userdata_setn() call and a + * subsequent fspr_pool_userdata_get() on that key, such as if a * static string is used as a userdata key in a DSO and the DSO could * be unloaded and reloaded between the _setn() and the _get(). You - * MUST use apr_pool_userdata_set() in such cases. + * MUST use fspr_pool_userdata_set() in such cases. * @warning More generally, the key and the data to be attached to the * pool should have a life span at least as long as the pool itself. * */ -APR_DECLARE(apr_status_t) apr_pool_userdata_setn( +APR_DECLARE(fspr_status_t) fspr_pool_userdata_setn( const void *data, const char *key, - apr_status_t (*cleanup)(void *), - apr_pool_t *pool); + fspr_status_t (*cleanup)(void *), + fspr_pool_t *pool); /** * Return the data associated with the current pool. @@ -490,8 +490,8 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_setn( * @param key The key for the data to retrieve * @param pool The current pool. */ -APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_pool_userdata_get(void **data, const char *key, + fspr_pool_t *pool); /** @@ -517,11 +517,11 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key, * @param child_cleanup The function to call when a child process is about * to exec - this function is called in the child, obviously! */ -APR_DECLARE(void) apr_pool_cleanup_register( - apr_pool_t *p, +APR_DECLARE(void) fspr_pool_cleanup_register( + fspr_pool_t *p, const void *data, - apr_status_t (*plain_cleanup)(void *), - apr_status_t (*child_cleanup)(void *)); + fspr_status_t (*plain_cleanup)(void *), + fspr_status_t (*child_cleanup)(void *)); /** * Remove a previously registered cleanup function. @@ -535,8 +535,8 @@ APR_DECLARE(void) apr_pool_cleanup_register( * @remarks For some strange reason only the plain_cleanup is handled by this * function */ -APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data, - apr_status_t (*cleanup)(void *)); +APR_DECLARE(void) fspr_pool_cleanup_kill(fspr_pool_t *p, const void *data, + fspr_status_t (*cleanup)(void *)); /** * Replace the child cleanup function of a previously registered cleanup. @@ -550,11 +550,11 @@ APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data, * @param plain_cleanup The plain cleanup function of the registered cleanup * @param child_cleanup The function to register as the child cleanup */ -APR_DECLARE(void) apr_pool_child_cleanup_set( - apr_pool_t *p, +APR_DECLARE(void) fspr_pool_child_cleanup_set( + fspr_pool_t *p, const void *data, - apr_status_t (*plain_cleanup)(void *), - apr_status_t (*child_cleanup)(void *)); + fspr_status_t (*plain_cleanup)(void *), + fspr_status_t (*child_cleanup)(void *)); /** * Run the specified cleanup function immediately and unregister it. @@ -567,19 +567,19 @@ APR_DECLARE(void) apr_pool_child_cleanup_set( * @param data The data to remove from cleanup * @param cleanup The function to remove from cleanup */ -APR_DECLARE(apr_status_t) apr_pool_cleanup_run( - apr_pool_t *p, +APR_DECLARE(fspr_status_t) fspr_pool_cleanup_run( + fspr_pool_t *p, void *data, - apr_status_t (*cleanup)(void *)); + fspr_status_t (*cleanup)(void *)); /** * An empty cleanup function. * - * Passed to apr_pool_cleanup_register() when no cleanup is required. + * Passed to fspr_pool_cleanup_register() when no cleanup is required. * * @param data The data to cleanup, will not be used by this function. */ -APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data); +APR_DECLARE_NONSTD(fspr_status_t) fspr_pool_cleanup_null(void *data); /** * Run all registered child cleanups, in preparation for an exec() @@ -587,7 +587,7 @@ APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data); * buffers, *don't* wait for subprocesses, and *don't* free any * memory. */ -APR_DECLARE(void) apr_pool_cleanup_for_exec(void); +APR_DECLARE(void) fspr_pool_cleanup_for_exec(void); /** @} */ @@ -615,7 +615,7 @@ APR_DECLARE(void) apr_pool_cleanup_for_exec(void); * if the data is allocated in any ancestor of T's pool. This is the * basis on which the APR_POOL_DEBUG code works -- it tests these ancestor * relationships for all data inserted into tables. APR_POOL_DEBUG also - * provides tools (apr_pool_find, and apr_pool_is_ancestor) for other + * provides tools (fspr_pool_find, and fspr_pool_is_ancestor) for other * folks to implement similar restrictions for their own data * structures. * @@ -626,7 +626,7 @@ APR_DECLARE(void) apr_pool_cleanup_for_exec(void); * is, the caller guarantees they won't destroy the sub pool * individually prior to destroying the parent pool. * - * In this case the caller must call apr_pool_join() to indicate this + * In this case the caller must call fspr_pool_join() to indicate this * guarantee to the APR_POOL_DEBUG code. * * These functions are only implemented when #APR_POOL_DEBUG is set. @@ -639,14 +639,14 @@ APR_DECLARE(void) apr_pool_cleanup_for_exec(void); * @param p The parent pool * @param sub The subpool */ -APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub); +APR_DECLARE(void) fspr_pool_join(fspr_pool_t *p, fspr_pool_t *sub); /** * Find a pool from something allocated in it. * @param mem The thing allocated in the pool * @return The pool it is allocated in */ -APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem); +APR_DECLARE(fspr_pool_t *) fspr_pool_find(const void *mem); /** * Report the number of bytes currently in the pool @@ -654,28 +654,28 @@ APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem); * @param recurse Recurse/include the subpools' sizes * @return The number of bytes */ -APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *p, int recurse); +APR_DECLARE(fspr_size_t) fspr_pool_num_bytes(fspr_pool_t *p, int recurse); /** * Lock a pool * @param pool The pool to lock * @param flag The flag */ -APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag); +APR_DECLARE(void) fspr_pool_lock(fspr_pool_t *pool, int flag); /* @} */ #else /* APR_POOL_DEBUG or DOXYGEN */ -#ifdef apr_pool_join -#undef apr_pool_join +#ifdef fspr_pool_join +#undef fspr_pool_join #endif -#define apr_pool_join(a,b) +#define fspr_pool_join(a,b) -#ifdef apr_pool_lock -#undef apr_pool_lock +#ifdef fspr_pool_lock +#undef fspr_pool_lock #endif -#define apr_pool_lock(pool, lock) +#define fspr_pool_lock(pool, lock) #endif /* APR_POOL_DEBUG or DOXYGEN */ diff --git a/libs/apr/include/apr_portable.h b/libs/apr/include/fspr_portable.h similarity index 51% rename from libs/apr/include/apr_portable.h rename to libs/apr/include/fspr_portable.h index b1b21e37b7..d4118d0cfe 100644 --- a/libs/apr/include/apr_portable.h +++ b/libs/apr/include/fspr_portable.h @@ -21,21 +21,21 @@ #ifndef APR_PORTABLE_H #define APR_PORTABLE_H /** - * @file apr_portable.h + * @file fspr_portable.h * @brief APR Portability Routines */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_network_io.h" -#include "apr_errno.h" -#include "apr_global_mutex.h" -#include "apr_proc_mutex.h" -#include "apr_time.h" -#include "apr_dso.h" -#include "apr_shm.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_network_io.h" +#include "fspr_errno.h" +#include "fspr_global_mutex.h" +#include "fspr_proc_mutex.h" +#include "fspr_time.h" +#include "fspr_dso.h" +#include "fspr_shm.h" #if APR_HAVE_DIRENT_H #include @@ -52,71 +52,71 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_portabile Portability Routines + * @defgroup fspr_portabile Portability Routines * @ingroup APR * @{ */ #ifdef WIN32 /* The primitives for Windows types */ -typedef HANDLE apr_os_file_t; -typedef HANDLE apr_os_dir_t; -typedef SOCKET apr_os_sock_t; -typedef HANDLE apr_os_proc_mutex_t; -typedef HANDLE apr_os_thread_t; -typedef HANDLE apr_os_proc_t; -typedef DWORD apr_os_threadkey_t; -typedef FILETIME apr_os_imp_time_t; -typedef SYSTEMTIME apr_os_exp_time_t; -typedef HANDLE apr_os_dso_handle_t; -typedef HANDLE apr_os_shm_t; +typedef HANDLE fspr_os_file_t; +typedef HANDLE fspr_os_dir_t; +typedef SOCKET fspr_os_sock_t; +typedef HANDLE fspr_os_proc_mutex_t; +typedef HANDLE fspr_os_thread_t; +typedef HANDLE fspr_os_proc_t; +typedef DWORD fspr_os_threadkey_t; +typedef FILETIME fspr_os_imp_time_t; +typedef SYSTEMTIME fspr_os_exp_time_t; +typedef HANDLE fspr_os_dso_handle_t; +typedef HANDLE fspr_os_shm_t; #elif defined(OS2) -typedef HFILE apr_os_file_t; -typedef HDIR apr_os_dir_t; -typedef int apr_os_sock_t; -typedef HMTX apr_os_proc_mutex_t; -typedef TID apr_os_thread_t; -typedef PID apr_os_proc_t; -typedef PULONG apr_os_threadkey_t; -typedef struct timeval apr_os_imp_time_t; -typedef struct tm apr_os_exp_time_t; -typedef HMODULE apr_os_dso_handle_t; -typedef void* apr_os_shm_t; +typedef HFILE fspr_os_file_t; +typedef HDIR fspr_os_dir_t; +typedef int fspr_os_sock_t; +typedef HMTX fspr_os_proc_mutex_t; +typedef TID fspr_os_thread_t; +typedef PID fspr_os_proc_t; +typedef PULONG fspr_os_threadkey_t; +typedef struct timeval fspr_os_imp_time_t; +typedef struct tm fspr_os_exp_time_t; +typedef HMODULE fspr_os_dso_handle_t; +typedef void* fspr_os_shm_t; #elif defined(__BEOS__) #include #include -struct apr_os_proc_mutex_t { +struct fspr_os_proc_mutex_t { sem_id sem; int32 ben; }; -typedef int apr_os_file_t; -typedef DIR apr_os_dir_t; -typedef int apr_os_sock_t; -typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; -typedef thread_id apr_os_thread_t; -typedef thread_id apr_os_proc_t; -typedef int apr_os_threadkey_t; -typedef struct timeval apr_os_imp_time_t; -typedef struct tm apr_os_exp_time_t; -typedef image_id apr_os_dso_handle_t; -typedef void* apr_os_shm_t; +typedef int fspr_os_file_t; +typedef DIR fspr_os_dir_t; +typedef int fspr_os_sock_t; +typedef struct fspr_os_proc_mutex_t fspr_os_proc_mutex_t; +typedef thread_id fspr_os_thread_t; +typedef thread_id fspr_os_proc_t; +typedef int fspr_os_threadkey_t; +typedef struct timeval fspr_os_imp_time_t; +typedef struct tm fspr_os_exp_time_t; +typedef image_id fspr_os_dso_handle_t; +typedef void* fspr_os_shm_t; #elif defined(NETWARE) -typedef int apr_os_file_t; -typedef DIR apr_os_dir_t; -typedef int apr_os_sock_t; -typedef NXMutex_t apr_os_proc_mutex_t; -typedef NXThreadId_t apr_os_thread_t; -typedef long apr_os_proc_t; -typedef NXKey_t apr_os_threadkey_t; -typedef struct timeval apr_os_imp_time_t; -typedef struct tm apr_os_exp_time_t; -typedef void * apr_os_dso_handle_t; -typedef void* apr_os_shm_t; +typedef int fspr_os_file_t; +typedef DIR fspr_os_dir_t; +typedef int fspr_os_sock_t; +typedef NXMutex_t fspr_os_proc_mutex_t; +typedef NXThreadId_t fspr_os_thread_t; +typedef long fspr_os_proc_t; +typedef NXKey_t fspr_os_threadkey_t; +typedef struct timeval fspr_os_imp_time_t; +typedef struct tm fspr_os_exp_time_t; +typedef void * fspr_os_dso_handle_t; +typedef void* fspr_os_shm_t; #else /* Any other OS should go above this one. This is the lowest common @@ -124,7 +124,7 @@ typedef void* apr_os_shm_t; */ /** Basic OS process mutex structure. */ -struct apr_os_proc_mutex_t { +struct fspr_os_proc_mutex_t { #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE /** Value used for SYS V Semaphore, FCNTL and FLOCK serialization */ int crossproc; @@ -142,46 +142,46 @@ struct apr_os_proc_mutex_t { #endif }; -typedef int apr_os_file_t; /**< native file */ -typedef DIR apr_os_dir_t; /**< native dir */ -typedef int apr_os_sock_t; /**< native dir */ -typedef struct apr_os_proc_mutex_t apr_os_proc_mutex_t; /**< native proces +typedef int fspr_os_file_t; /**< native file */ +typedef DIR fspr_os_dir_t; /**< native dir */ +typedef int fspr_os_sock_t; /**< native dir */ +typedef struct fspr_os_proc_mutex_t fspr_os_proc_mutex_t; /**< native proces * mutex */ #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H -typedef pthread_t apr_os_thread_t; /**< native thread */ -typedef pthread_key_t apr_os_threadkey_t; /**< native thread address +typedef pthread_t fspr_os_thread_t; /**< native thread */ +typedef pthread_key_t fspr_os_threadkey_t; /**< native thread address * space */ #endif -typedef pid_t apr_os_proc_t; /**< native pid */ -typedef struct timeval apr_os_imp_time_t; /**< native timeval */ -typedef struct tm apr_os_exp_time_t; /**< native tm */ -/** @var apr_os_dso_handle_t +typedef pid_t fspr_os_proc_t; /**< native pid */ +typedef struct timeval fspr_os_imp_time_t; /**< native timeval */ +typedef struct tm fspr_os_exp_time_t; /**< native tm */ +/** @var fspr_os_dso_handle_t * native dso types */ #if defined(HPUX) || defined(HPUX10) || defined(HPUX11) #include -typedef shl_t apr_os_dso_handle_t; +typedef shl_t fspr_os_dso_handle_t; #elif defined(DARWIN) #include -typedef NSModule apr_os_dso_handle_t; +typedef NSModule fspr_os_dso_handle_t; #else -typedef void * apr_os_dso_handle_t; +typedef void * fspr_os_dso_handle_t; #endif -typedef void* apr_os_shm_t; /**< native SHM */ +typedef void* fspr_os_shm_t; /**< native SHM */ #endif /** - * @typedef apr_os_sock_info_t + * @typedef fspr_os_sock_info_t * @brief alias for local OS socket */ /** * everything APR needs to know about an active socket to construct * an APR socket from it; currently, this is platform-independent */ -struct apr_os_sock_info_t { - apr_os_sock_t *os_sock; /**< always required */ +struct fspr_os_sock_info_t { + fspr_os_sock_t *os_sock; /**< always required */ struct sockaddr *local; /**< NULL if not yet bound */ struct sockaddr *remote; /**< NULL if not connected */ int family; /**< always required (APR_INET, APR_INET6, etc.) */ @@ -189,28 +189,28 @@ struct apr_os_sock_info_t { int protocol; /**< 0 or actual protocol (APR_PROTO_SCTP, APR_PROTO_TCP, etc.) */ }; -typedef struct apr_os_sock_info_t apr_os_sock_info_t; +typedef struct fspr_os_sock_info_t fspr_os_sock_info_t; #if APR_PROC_MUTEX_IS_GLOBAL || defined(DOXYGEN) /** Opaque global mutex type */ -#define apr_os_global_mutex_t apr_os_proc_mutex_t -/** @return apr_os_global_mutex */ -#define apr_os_global_mutex_get apr_os_proc_mutex_get +#define fspr_os_global_mutex_t fspr_os_proc_mutex_t +/** @return fspr_os_global_mutex */ +#define fspr_os_global_mutex_get fspr_os_proc_mutex_get #else /** Thread and process mutex for those platforms where process mutexes * are not held in threads. */ - struct apr_os_global_mutex_t { - apr_pool_t *pool; - apr_proc_mutex_t *proc_mutex; + struct fspr_os_global_mutex_t { + fspr_pool_t *pool; + fspr_proc_mutex_t *proc_mutex; #if APR_HAS_THREADS - apr_thread_mutex_t *thread_mutex; + fspr_thread_mutex_t *thread_mutex; #endif /* APR_HAS_THREADS */ }; - typedef struct apr_os_global_mutex_t apr_os_global_mutex_t; + typedef struct fspr_os_global_mutex_t fspr_os_global_mutex_t; -APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex, - apr_global_mutex_t *pmutex); +APR_DECLARE(fspr_status_t) fspr_os_global_mutex_get(fspr_os_global_mutex_t *ospmutex, + fspr_global_mutex_t *pmutex); #endif @@ -221,60 +221,60 @@ APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmute * @remark On Unix, it is only possible to get a file descriptor from * an apr file type. */ -APR_DECLARE(apr_status_t) apr_os_file_get(apr_os_file_t *thefile, - apr_file_t *file); +APR_DECLARE(fspr_status_t) fspr_os_file_get(fspr_os_file_t *thefile, + fspr_file_t *file); /** * convert the dir from apr type to os specific type. * @param thedir The os specific dir we are converting to * @param dir The apr dir to convert. */ -APR_DECLARE(apr_status_t) apr_os_dir_get(apr_os_dir_t **thedir, - apr_dir_t *dir); +APR_DECLARE(fspr_status_t) fspr_os_dir_get(fspr_os_dir_t **thedir, + fspr_dir_t *dir); /** * Convert the socket from an apr type to an OS specific socket * @param thesock The socket to convert. * @param sock The os specifc equivelant of the apr socket.. */ -APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock, - apr_socket_t *sock); +APR_DECLARE(fspr_status_t) fspr_os_sock_get(fspr_os_sock_t *thesock, + fspr_socket_t *sock); /** * Convert the proc mutex from os specific type to apr type * @param ospmutex The os specific proc mutex we are converting to. * @param pmutex The apr proc mutex to convert. */ -APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, - apr_proc_mutex_t *pmutex); +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_get(fspr_os_proc_mutex_t *ospmutex, + fspr_proc_mutex_t *pmutex); /** * Get the exploded time in the platforms native format. * @param ostime the native time format * @param aprtime the time to convert */ -APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime, - apr_time_exp_t *aprtime); +APR_DECLARE(fspr_status_t) fspr_os_exp_time_get(fspr_os_exp_time_t **ostime, + fspr_time_exp_t *aprtime); /** * Get the imploded time in the platforms native format. * @param ostime the native time format * @param aprtime the time to convert */ -APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime, - apr_time_t *aprtime); +APR_DECLARE(fspr_status_t) fspr_os_imp_time_get(fspr_os_imp_time_t **ostime, + fspr_time_t *aprtime); /** * convert the shm from apr type to os specific type. * @param osshm The os specific shm representation * @param shm The apr shm to convert. */ -APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm, - apr_shm_t *shm); +APR_DECLARE(fspr_status_t) fspr_os_shm_get(fspr_os_shm_t *osshm, + fspr_shm_t *shm); #if APR_HAS_THREADS || defined(DOXYGEN) /** - * @defgroup apr_os_thread Thread portability Routines + * @defgroup fspr_os_thread Thread portability Routines * @{ */ /** @@ -282,16 +282,16 @@ APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm, * @param thethd The apr thread to convert * @param thd The os specific thread we are converting to */ -APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, - apr_thread_t *thd); +APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd, + fspr_thread_t *thd); /** * convert the thread private memory key to os specific type from an apr type. * @param thekey The apr handle we are converting from. * @param key The os specific handle we are converting to. */ -APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, - apr_threadkey_t *key); +APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey, + fspr_threadkey_t *key); /** * convert the thread from os specific type to apr type. @@ -299,9 +299,9 @@ APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, * @param thethd The os specific thread to convert * @param cont The pool to use if it is needed. */ -APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, - apr_os_thread_t *thethd, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd, + fspr_os_thread_t *thethd, + fspr_pool_t *cont); /** * convert the thread private memory key from os specific type to apr type. @@ -309,21 +309,21 @@ APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, * @param thekey The os specific handle to convert * @param cont The pool to use if it is needed. */ -APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, - apr_os_threadkey_t *thekey, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key, + fspr_os_threadkey_t *thekey, + fspr_pool_t *cont); /** * Get the thread ID */ -APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void); +APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current(void); /** * Compare two thread id's * @param tid1 1st Thread ID to compare * @param tid2 2nd Thread ID to compare */ -APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1, - apr_os_thread_t tid2); +APR_DECLARE(int) fspr_os_thread_equal(fspr_os_thread_t tid1, + fspr_os_thread_t tid2); /** @} */ #endif /* APR_HAS_THREADS */ @@ -337,9 +337,9 @@ APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1, * @remark On Unix, it is only possible to put a file descriptor into * an apr file type. */ -APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, - apr_os_file_t *thefile, - apr_int32_t flags, apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_file_put(fspr_file_t **file, + fspr_os_file_t *thefile, + fspr_int32_t flags, fspr_pool_t *cont); /** * convert the file from os specific type to apr type. @@ -349,24 +349,24 @@ APR_DECLARE(apr_status_t) apr_os_file_put(apr_file_t **file, * @remark On Unix, it is only possible to put a file descriptor into * an apr file type. */ -APR_DECLARE(apr_status_t) apr_os_pipe_put(apr_file_t **file, - apr_os_file_t *thefile, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_pipe_put(fspr_file_t **file, + fspr_os_file_t *thefile, + fspr_pool_t *cont); /** * convert the file from os specific type to apr type. * @param file The apr file we are converting to. * @param thefile The os specific pipe to convert - * @param register_cleanup A cleanup will be registered on the apr_file_t - * to issue apr_file_close(). + * @param register_cleanup A cleanup will be registered on the fspr_file_t + * to issue fspr_file_close(). * @param cont The pool to use if it is needed. * @remark On Unix, it is only possible to put a file descriptor into * an apr file type. */ -APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, - apr_os_file_t *thefile, +APR_DECLARE(fspr_status_t) fspr_os_pipe_put_ex(fspr_file_t **file, + fspr_os_file_t *thefile, int register_cleanup, - apr_pool_t *cont); + fspr_pool_t *cont); /** * convert the dir from os specific type to apr type. @@ -374,35 +374,35 @@ APR_DECLARE(apr_status_t) apr_os_pipe_put_ex(apr_file_t **file, * @param thedir The os specific dir to convert * @param cont The pool to use when creating to apr directory. */ -APR_DECLARE(apr_status_t) apr_os_dir_put(apr_dir_t **dir, - apr_os_dir_t *thedir, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_dir_put(fspr_dir_t **dir, + fspr_os_dir_t *thedir, + fspr_pool_t *cont); /** * Convert a socket from the os specific type to the apr type * @param sock The pool to use. * @param thesock The socket to convert to. * @param cont The socket we are converting to an apr type. - * @remark If it is a true socket, it is best to call apr_os_sock_make() + * @remark If it is a true socket, it is best to call fspr_os_sock_make() * and provide APR with more information about the socket. */ -APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, - apr_os_sock_t *thesock, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_sock_put(fspr_socket_t **sock, + fspr_os_sock_t *thesock, + fspr_pool_t *cont); /** * Create a socket from an existing descriptor and local and remote * socket addresses. - * @param apr_sock The new socket that has been set up + * @param fspr_sock The new socket that has been set up * @param os_sock_info The os representation of the socket handle and * other characteristics of the socket * @param cont The pool to use * @remark If you only know the descriptor/handle or if it isn't really - * a true socket, use apr_os_sock_put() instead. + * a true socket, use fspr_os_sock_put() instead. */ -APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, - apr_os_sock_info_t *os_sock_info, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_sock_make(fspr_socket_t **fspr_sock, + fspr_os_sock_info_t *os_sock_info, + fspr_pool_t *cont); /** * Convert the proc mutex from os specific type to apr type @@ -410,9 +410,9 @@ APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, * @param ospmutex The os specific proc mutex to convert. * @param cont The pool to use if it is needed. */ -APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, - apr_os_proc_mutex_t *ospmutex, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_put(fspr_proc_mutex_t **pmutex, + fspr_os_proc_mutex_t *ospmutex, + fspr_pool_t *cont); /** * Put the imploded time in the APR format. @@ -420,9 +420,9 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, * @param ostime the time to convert * @param cont the pool to use if necessary */ -APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime, - apr_os_imp_time_t **ostime, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_imp_time_put(fspr_time_t *aprtime, + fspr_os_imp_time_t **ostime, + fspr_pool_t *cont); /** * Put the exploded time in the APR format. @@ -430,9 +430,9 @@ APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime, * @param ostime the time to convert * @param cont the pool to use if necessary */ -APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime, - apr_os_exp_time_t **ostime, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_exp_time_put(fspr_time_exp_t *aprtime, + fspr_os_exp_time_t **ostime, + fspr_pool_t *cont); /** * convert the shared memory from os specific type to apr type. @@ -443,14 +443,14 @@ APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime, * the memory block mapped. On non-fork architectures, this is typically * some internal handle to pass the mapping from process to process. */ -APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **shm, - apr_os_shm_t *osshm, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_os_shm_put(fspr_shm_t **shm, + fspr_os_shm_t *osshm, + fspr_pool_t *cont); #if APR_HAS_DSO || defined(DOXYGEN) /** - * @defgroup apr_os_dso DSO (Dynamic Loading) Portabiliity Routines + * @defgroup fspr_os_dso DSO (Dynamic Loading) Portabiliity Routines * @{ */ /** @@ -459,23 +459,23 @@ APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **shm, * @param thedso the os specific handle to convert * @param pool the pool to use if it is needed */ -APR_DECLARE(apr_status_t) apr_os_dso_handle_put(apr_dso_handle_t **dso, - apr_os_dso_handle_t thedso, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_put(fspr_dso_handle_t **dso, + fspr_os_dso_handle_t thedso, + fspr_pool_t *pool); /** * convert the apr dso handle into an os specific one * @param aprdso The apr dso handle to convert * @param dso The os specific dso to return */ -APR_DECLARE(apr_status_t) apr_os_dso_handle_get(apr_os_dso_handle_t *dso, - apr_dso_handle_t *aprdso); +APR_DECLARE(fspr_status_t) fspr_os_dso_handle_get(fspr_os_dso_handle_t *dso, + fspr_dso_handle_t *aprdso); #if APR_HAS_OS_UUID /** - * Private: apr-util's apr_uuid module when supported by the platform + * Private: apr-util's fspr_uuid module when supported by the platform */ -APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data); +APR_DECLARE(fspr_status_t) fspr_os_uuid_get(unsigned char *uuid_data); #endif /** @} */ @@ -486,16 +486,16 @@ APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data); * Get the name of the system default characer set. * @param pool the pool to allocate the name from, if needed */ -APR_DECLARE(const char*) apr_os_default_encoding(apr_pool_t *pool); +APR_DECLARE(const char*) fspr_os_default_encoding(fspr_pool_t *pool); /** * Get the name of the current locale character set. * @param pool the pool to allocate the name from, if needed - * @remark Defers to apr_os_default_encoding if the current locale's + * @remark Defers to fspr_os_default_encoding if the current locale's * data can't be retreved on this system. */ -APR_DECLARE(const char*) apr_os_locale_encoding(apr_pool_t *pool); +APR_DECLARE(const char*) fspr_os_locale_encoding(fspr_pool_t *pool); /** @} */ diff --git a/libs/apr/include/apr_proc_mutex.h b/libs/apr/include/fspr_proc_mutex.h similarity index 78% rename from libs/apr/include/apr_proc_mutex.h rename to libs/apr/include/fspr_proc_mutex.h index ceb9c82a8d..9e1b6d6b48 100644 --- a/libs/apr/include/apr_proc_mutex.h +++ b/libs/apr/include/fspr_proc_mutex.h @@ -18,20 +18,20 @@ #define APR_PROC_MUTEX_H /** - * @file apr_proc_mutex.h + * @file fspr_proc_mutex.h * @brief APR Process Locking Routines */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_proc_mutex Process Locking Routines + * @defgroup fspr_proc_mutex Process Locking Routines * @ingroup APR * @{ */ @@ -48,10 +48,10 @@ typedef enum { APR_LOCK_PROC_PTHREAD, /**< POSIX pthread process-based locking */ APR_LOCK_POSIXSEM, /**< POSIX semaphore process-based locking */ APR_LOCK_DEFAULT /**< Use the default process lock */ -} apr_lockmech_e; +} fspr_lockmech_e; /** Opaque structure representing a process mutex. */ -typedef struct apr_proc_mutex_t apr_proc_mutex_t; +typedef struct fspr_proc_mutex_t fspr_proc_mutex_t; /* Function definitions */ @@ -72,14 +72,14 @@ typedef struct apr_proc_mutex_t apr_proc_mutex_t; * APR_LOCK_DEFAULT pick the default mechanism for the platform * * @param pool the pool from which to allocate the mutex. - * @see apr_lockmech_e + * @see fspr_lockmech_e * @warning Check APR_HAS_foo_SERIALIZE defines to see if the platform supports * APR_LOCK_foo. Only APR_LOCK_DEFAULT is portable. */ -APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_create(fspr_proc_mutex_t **mutex, const char *fname, - apr_lockmech_e mech, - apr_pool_t *pool); + fspr_lockmech_e mech, + fspr_pool_t *pool); /** * Re-open a mutex in a child process. @@ -87,21 +87,21 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, * @param fname A file name to use if the mutex mechanism requires one. This * argument should always be provided. The mutex code itself will * determine if it should be used. This filename should be the - * same one that was passed to apr_proc_mutex_create(). + * same one that was passed to fspr_proc_mutex_create(). * @param pool The pool to operate on. * @remark This function must be called to maintain portability, even * if the underlying lock mechanism does not require it. */ -APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_child_init(fspr_proc_mutex_t **mutex, const char *fname, - apr_pool_t *pool); + fspr_pool_t *pool); /** * Acquire the lock for the given mutex. If the mutex is already locked, * the current thread will be put to sleep until the lock becomes available. * @param mutex the mutex on which to acquire the lock. */ -APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_proc_mutex_lock(fspr_proc_mutex_t *mutex); /** * Attempt to acquire the lock for the given mutex. If the mutex has already @@ -110,19 +110,19 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex); * if the return value was APR_EBUSY, for portability reasons. * @param mutex the mutex on which to attempt the lock acquiring. */ -APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_proc_mutex_trylock(fspr_proc_mutex_t *mutex); /** * Release the lock for the given mutex. * @param mutex the mutex from which to release the lock. */ -APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_proc_mutex_unlock(fspr_proc_mutex_t *mutex); /** * Destroy the mutex and free the memory associated with the lock. * @param mutex the mutex to destroy. */ -APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_proc_mutex_destroy(fspr_proc_mutex_t *mutex); /** * Destroy the mutex and free the memory associated with the lock. @@ -130,30 +130,30 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex); * @note This function is generally used to kill a cleanup on an already * created mutex */ -APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex); +APR_DECLARE(fspr_status_t) fspr_proc_mutex_cleanup(void *mutex); /** * Return the name of the lockfile for the mutex, or NULL * if the mutex doesn't use a lock file */ -APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex); +APR_DECLARE(const char *) fspr_proc_mutex_lockfile(fspr_proc_mutex_t *mutex); /** * Display the name of the mutex, as it relates to the actual method used. * This matches the valid options for Apache's AcceptMutex directive * @param mutex the name of the mutex */ -APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex); +APR_DECLARE(const char *) fspr_proc_mutex_name(fspr_proc_mutex_t *mutex); /** * Display the name of the default mutex: APR_LOCK_DEFAULT */ -APR_DECLARE(const char *) apr_proc_mutex_defname(void); +APR_DECLARE(const char *) fspr_proc_mutex_defname(void); /** * Get the pool used by this proc_mutex. - * @return apr_pool_t the pool + * @return fspr_pool_t the pool */ APR_POOL_DECLARE_ACCESSOR(proc_mutex); diff --git a/libs/apr/include/fspr_random.h b/libs/apr/include/fspr_random.h new file mode 100644 index 0000000000..7ba2c78dbf --- /dev/null +++ b/libs/apr/include/fspr_random.h @@ -0,0 +1,74 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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. + */ + +#ifndef APR_RANDOM_H +#define APR_RANDOM_H + +#include + +typedef struct fspr_crypto_hash_t fspr_crypto_hash_t; + +typedef void fspr_crypto_hash_init_t(fspr_crypto_hash_t *hash); +typedef void fspr_crypto_hash_add_t(fspr_crypto_hash_t *hash,const void *data, + fspr_size_t bytes); +typedef void fspr_crypto_hash_finish_t(fspr_crypto_hash_t *hash, + unsigned char *result); + +/* FIXME: make this opaque */ +struct fspr_crypto_hash_t { + fspr_crypto_hash_init_t *init; + fspr_crypto_hash_add_t *add; + fspr_crypto_hash_finish_t *finish; + fspr_size_t size; + void *data; +}; + +APR_DECLARE(fspr_crypto_hash_t *) fspr_crypto_sha256_new(fspr_pool_t *p); + +typedef struct fspr_random_t fspr_random_t; + +APR_DECLARE(void) fspr_random_init(fspr_random_t *g,fspr_pool_t *p, + fspr_crypto_hash_t *pool_hash, + fspr_crypto_hash_t *key_hash, + fspr_crypto_hash_t *prng_hash); +APR_DECLARE(fspr_random_t *) fspr_random_standard_new(fspr_pool_t *p); +APR_DECLARE(void) fspr_random_add_entropy(fspr_random_t *g, + const void *entropy_, + fspr_size_t bytes); +APR_DECLARE(fspr_status_t) fspr_random_insecure_bytes(fspr_random_t *g, + void *random, + fspr_size_t bytes); +APR_DECLARE(fspr_status_t) fspr_random_secure_bytes(fspr_random_t *g, + void *random, + fspr_size_t bytes); +APR_DECLARE(void) fspr_random_barrier(fspr_random_t *g); +APR_DECLARE(fspr_status_t) fspr_random_secure_ready(fspr_random_t *r); +APR_DECLARE(fspr_status_t) fspr_random_insecure_ready(fspr_random_t *r); + +/* Call this in the child after forking to mix the randomness + pools. Note that its generally a bad idea to fork a process with a + real PRNG in it - better to have the PRNG externally and get the + randomness from there. However, if you really must do it, then you + should supply all your entropy to all the PRNGs - don't worry, they + won't produce the same output. + + Note that fspr_proc_fork() calls this for you, so only weird + applications need ever call it themselves. +*/ +struct fspr_proc_t; +APR_DECLARE(void) fspr_random_after_fork(struct fspr_proc_t *proc); + +#endif /* ndef APR_RANDOM_H */ diff --git a/libs/apr/include/apr_ring.h b/libs/apr/include/fspr_ring.h similarity index 99% rename from libs/apr/include/apr_ring.h rename to libs/apr/include/fspr_ring.h index a360254a38..4af513b41e 100644 --- a/libs/apr/include/apr_ring.h +++ b/libs/apr/include/fspr_ring.h @@ -28,17 +28,17 @@ #define APR_RING_H /** - * @file apr_ring.h + * @file fspr_ring.h * @brief APR Rings */ /* * for offsetof() */ -#include "apr_general.h" +#include "fspr_general.h" /** - * @defgroup apr_ring Ring Macro Implementations + * @defgroup fspr_ring Ring Macro Implementations * @ingroup APR * A ring is a kind of doubly-linked list that can be manipulated * without knowing where its head is. diff --git a/libs/apr/include/apr_shm.h b/libs/apr/include/fspr_shm.h similarity index 81% rename from libs/apr/include/apr_shm.h rename to libs/apr/include/fspr_shm.h index 4875ee1ff8..81bfd994ab 100644 --- a/libs/apr/include/apr_shm.h +++ b/libs/apr/include/fspr_shm.h @@ -18,20 +18,20 @@ #define APR_SHM_H /** - * @file apr_shm.h + * @file fspr_shm.h * @brief APR Shared Memory Routines */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_shm Shared Memory Routines + * @defgroup fspr_shm Shared Memory Routines * @ingroup APR * @{ */ @@ -40,7 +40,7 @@ extern "C" { * Private, platform-specific data struture representing a shared memory * segment. */ -typedef struct apr_shm_t apr_shm_t; +typedef struct fspr_shm_t fspr_shm_t; /** * Create and make accessable a shared memory segment. @@ -61,14 +61,14 @@ typedef struct apr_shm_t apr_shm_t; * about the segment within the actual segment. In order to supply * the caller with the requested size it may be necessary for the * implementation to request a slightly greater segment length - * from the subsystem. In all cases, the apr_shm_baseaddr_get() + * from the subsystem. In all cases, the fspr_shm_baseaddr_get() * function will return the first usable byte of memory. * */ -APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, - apr_size_t reqsize, +APR_DECLARE(fspr_status_t) fspr_shm_create(fspr_shm_t **m, + fspr_size_t reqsize, const char *filename, - apr_pool_t *pool); + fspr_pool_t *pool); /** * Remove shared memory segment associated with a filename. @@ -79,14 +79,14 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, * name-based shared memory segments, and will return APR_ENOTIMPL on * platforms without such support. */ -APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_shm_remove(const char *filename, + fspr_pool_t *pool); /** * Destroy a shared memory segment and associated memory. * @param m The shared memory segment structure to destroy. */ -APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m); +APR_DECLARE(fspr_status_t) fspr_shm_destroy(fspr_shm_t *m); /** * Attach to a shared memory segment that was created @@ -97,16 +97,16 @@ APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m); * @param pool the pool from which to allocate the shared memory * structure for this process. */ -APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, +APR_DECLARE(fspr_status_t) fspr_shm_attach(fspr_shm_t **m, const char *filename, - apr_pool_t *pool); + fspr_pool_t *pool); /** * Detach from a shared memory segment without destroying it. * @param m The shared memory structure representing the segment * to detach from. */ -APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m); +APR_DECLARE(fspr_status_t) fspr_shm_detach(fspr_shm_t *m); /** * Retrieve the base address of the shared memory segment. @@ -117,14 +117,14 @@ APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m); * the base address. * @return address, aligned by APR_ALIGN_DEFAULT. */ -APR_DECLARE(void *) apr_shm_baseaddr_get(const apr_shm_t *m); +APR_DECLARE(void *) fspr_shm_baseaddr_get(const fspr_shm_t *m); /** * Retrieve the length of a shared memory segment in bytes. * @param m The shared memory segment from which to retrieve * the segment length. */ -APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m); +APR_DECLARE(fspr_size_t) fspr_shm_size_get(const fspr_shm_t *m); /** * Get the pool used by this shared memory segment. diff --git a/libs/apr/include/apr_signal.h b/libs/apr/include/fspr_signal.h similarity index 81% rename from libs/apr/include/apr_signal.h rename to libs/apr/include/fspr_signal.h index 991cbadbae..6a53efa24d 100644 --- a/libs/apr/include/apr_signal.h +++ b/libs/apr/include/fspr_signal.h @@ -18,12 +18,12 @@ #define APR_SIGNAL_H /** - * @file apr_signal.h + * @file fspr_signal.h * @brief APR Signal Handling */ -#include "apr.h" -#include "apr_pools.h" +#include "fspr.h" +#include "fspr_pools.h" #if APR_HAVE_SIGNAL_H #include @@ -34,7 +34,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_signal Handling + * @defgroup fspr_signal Handling * @ingroup APR * @{ */ @@ -54,21 +54,21 @@ extern "C" { #endif /** Function prototype for signal handlers */ -typedef void apr_sigfunc_t(int); +typedef void fspr_sigfunc_t(int); /** * Set the signal handler function for a given signal * @param signo The signal (eg... SIGWINCH) * @param func the function to get called */ -APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func); +APR_DECLARE(fspr_sigfunc_t *) fspr_signal(int signo, fspr_sigfunc_t * func); #if defined(SIG_IGN) && !defined(SIG_ERR) -#define SIG_ERR ((apr_sigfunc_t *) -1) +#define SIG_ERR ((fspr_sigfunc_t *) -1) #endif #else /* !APR_HAVE_SIGACTION */ -#define apr_signal(a, b) signal(a, b) +#define fspr_signal(a, b) signal(a, b) #endif @@ -77,28 +77,28 @@ APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func); * @param signum The signal number * @return The description of the signal */ -APR_DECLARE(const char *) apr_signal_description_get(int signum); +APR_DECLARE(const char *) fspr_signal_description_get(int signum); /** * APR-private function for initializing the signal package * @internal * @param pglobal The internal, global pool */ -void apr_signal_init(apr_pool_t *pglobal); +void fspr_signal_init(fspr_pool_t *pglobal); /** * Block the delivery of a particular signal * @param signum The signal number * @return status */ -APR_DECLARE(apr_status_t) apr_signal_block(int signum); +APR_DECLARE(fspr_status_t) fspr_signal_block(int signum); /** * Enable the delivery of a particular signal * @param signum The signal number * @return status */ -APR_DECLARE(apr_status_t) apr_signal_unblock(int signum); +APR_DECLARE(fspr_status_t) fspr_signal_unblock(int signum); /** @} */ diff --git a/libs/apr/include/apr_strings.h b/libs/apr/include/fspr_strings.h similarity index 77% rename from libs/apr/include/apr_strings.h rename to libs/apr/include/fspr_strings.h index fcfb7777a2..27a15bdb79 100644 --- a/libs/apr/include/apr_strings.h +++ b/libs/apr/include/fspr_strings.h @@ -41,15 +41,15 @@ #define APR_STRINGS_H /** - * @file apr_strings.h + * @file fspr_strings.h * @brief APR Strings library */ -#include "apr.h" -#include "apr_errno.h" -#include "apr_pools.h" +#include "fspr.h" +#include "fspr_errno.h" +#include "fspr_pools.h" #define APR_WANT_IOVEC -#include "apr_want.h" +#include "fspr_want.h" #if APR_HAVE_STDARG_H #include @@ -60,7 +60,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_strings String routines + * @defgroup fspr_strings String routines * @ingroup APR * @{ */ @@ -73,7 +73,7 @@ extern "C" { * this returns <0, if they are equivalent it returns 0, and if the * first string is greater than second string it retuns >0. */ -APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b); +APR_DECLARE(int) fspr_strnatcmp(char const *a, char const *b); /** * Do a natural order comparison of two strings ignoring the case of the @@ -84,7 +84,7 @@ APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b); * this returns <0, if they are equivalent it returns 0, and if the * first string is greater than second string it retuns >0. */ -APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b); +APR_DECLARE(int) fspr_strnatcasecmp(char const *a, char const *b); /** * duplicate a string into memory allocated out of a pool @@ -92,7 +92,7 @@ APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b); * @param s The string to duplicate * @return The new string */ -APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s); +APR_DECLARE(char *) fspr_pstrdup(fspr_pool_t *p, const char *s); /** * Create a null-terminated string by making a copy of a sequence @@ -101,12 +101,12 @@ APR_DECLARE(char *) apr_pstrdup(apr_pool_t *p, const char *s); * @param s The block of characters to duplicate * @param n The number of characters to duplicate * @return The new string - * @remark This is a faster alternative to apr_pstrndup, for use + * @remark This is a faster alternative to fspr_pstrndup, for use * when you know that the string being duplicated really * has 'n' or more characters. If the string might contain - * fewer characters, use apr_pstrndup. + * fewer characters, use fspr_pstrndup. */ -APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n); +APR_DECLARE(char *) fspr_pstrmemdup(fspr_pool_t *p, const char *s, fspr_size_t n); /** * Duplicate at most n characters of a string into memory allocated @@ -118,7 +118,7 @@ APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *p, const char *s, apr_size_t n); * @remark The amount of memory allocated from the pool is the length * of the returned string including the NUL terminator */ -APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n); +APR_DECLARE(char *) fspr_pstrndup(fspr_pool_t *p, const char *s, fspr_size_t n); /** * Duplicate a block of memory. @@ -128,7 +128,7 @@ APR_DECLARE(char *) apr_pstrndup(apr_pool_t *p, const char *s, apr_size_t n); * @param n The number of bytes to duplicate * @return The new block of memory */ -APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n); +APR_DECLARE(void *) fspr_pmemdup(fspr_pool_t *p, const void *m, fspr_size_t n); /** * Concatenate multiple strings, allocating memory out a pool @@ -136,7 +136,7 @@ APR_DECLARE(void *) apr_pmemdup(apr_pool_t *p, const void *m, apr_size_t n); * @param ... The strings to concatenate. The final string must be NULL * @return The new string */ -APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *p, ...); +APR_DECLARE_NONSTD(char *) fspr_pstrcat(fspr_pool_t *p, ...); /** * Concatenate multiple strings specified in a writev-style vector @@ -146,8 +146,8 @@ APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *p, ...); * @param nbytes (output) strlen of new string (pass in NULL to omit) * @return The new string */ -APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec, - apr_size_t nvec, apr_size_t *nbytes); +APR_DECLARE(char *) fspr_pstrcatv(fspr_pool_t *p, const struct iovec *vec, + fspr_size_t nvec, fspr_size_t *nbytes); /** * printf-style style printing routine. The data is output to a string @@ -157,7 +157,7 @@ APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *p, const struct iovec *vec, * @param ap The arguments to use while printing the data * @return The new string */ -APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap); +APR_DECLARE(char *) fspr_pvsprintf(fspr_pool_t *p, const char *fmt, va_list ap); /** * printf-style style printing routine. The data is output to a string @@ -167,7 +167,7 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *p, const char *fmt, va_list ap); * @param ... The arguments to use while printing the data * @return The new string */ -APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...) +APR_DECLARE_NONSTD(char *) fspr_psprintf(fspr_pool_t *p, const char *fmt, ...) __attribute__((format(printf,2,3))); /** @@ -184,16 +184,16 @@ APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...) * @remark *
      * Note the differences between this function and strncpy():
    - *  1) strncpy() doesn't always NUL terminate; apr_cpystrn() does.
    + *  1) strncpy() doesn't always NUL terminate; fspr_cpystrn() does.
      *  2) strncpy() pads the destination string with NULs, which is often 
    - *     unnecessary; apr_cpystrn() does not.
    + *     unnecessary; fspr_cpystrn() does not.
      *  3) strncpy() returns a pointer to the beginning of the dst string;
    - *     apr_cpystrn() returns a pointer to the NUL terminator of dst, 
    + *     fspr_cpystrn() returns a pointer to the NUL terminator of dst, 
      *     to allow a check for truncation.
      * 
    */ -APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src, - apr_size_t dst_size); +APR_DECLARE(char *) fspr_cpystrn(char *dst, const char *src, + fspr_size_t dst_size); /** * Strip spaces from a string @@ -202,7 +202,7 @@ APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src, * @param src The string to rid the spaces from. * @return The destination string, dest. */ -APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src); +APR_DECLARE(char *) fspr_collapse_spaces(char *dest, const char *src); /** * Convert the arguments to a program from one string to an array of @@ -211,66 +211,66 @@ APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src); * @param argv_out Output location. This is a pointer to an array of strings. * @param token_context Pool to use. */ -APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, +APR_DECLARE(fspr_status_t) fspr_tokenize_to_argv(const char *arg_str, char ***argv_out, - apr_pool_t *token_context); + fspr_pool_t *token_context); /** * Split a string into separate null-terminated tokens. The tokens are * delimited in the string by one or more characters from the sep * argument. * @param str The string to separate; this should be specified on the - * first call to apr_strtok() for a given string, and NULL + * first call to fspr_strtok() for a given string, and NULL * on subsequent calls. * @param sep The set of delimiters - * @param last Internal state saved by apr_strtok() between calls. + * @param last Internal state saved by fspr_strtok() between calls. * @return The next token from the string */ -APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last); +APR_DECLARE(char *) fspr_strtok(char *str, const char *sep, char **last); /** * @defgroup APR_Strings_Snprintf snprintf implementations * @warning - * These are snprintf implementations based on apr_vformatter(). + * These are snprintf implementations based on fspr_vformatter(). * * Note that various standards and implementations disagree on the return * value of snprintf, and side-effects due to %n in the formatting string. - * apr_snprintf (and apr_vsnprintf) behaves as follows: + * fspr_snprintf (and fspr_vsnprintf) behaves as follows: * * Process the format string until the entire string is exhausted, or * the buffer fills. If the buffer fills then stop processing immediately * (so no further %n arguments are processed), and return the buffer * length. In all cases the buffer is NUL terminated. It will return the * number of characters inserted into the buffer, not including the - * terminating NUL. As a special case, if len is 0, apr_snprintf will + * terminating NUL. As a special case, if len is 0, fspr_snprintf will * return the number of characters that would have been inserted if * the buffer had been infinite (in this case, *buffer can be NULL) * - * In no event does apr_snprintf return a negative number. + * In no event does fspr_snprintf return a negative number. * @{ */ /** - * snprintf routine based on apr_vformatter. This means it understands the + * snprintf routine based on fspr_vformatter. This means it understands the * same extensions. * @param buf The buffer to write to * @param len The size of the buffer * @param format The format string * @param ... The arguments to use to fill out the format string. */ -APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len, +APR_DECLARE_NONSTD(int) fspr_snprintf(char *buf, fspr_size_t len, const char *format, ...) __attribute__((format(printf,3,4))); /** - * vsnprintf routine based on apr_vformatter. This means it understands the + * vsnprintf routine based on fspr_vformatter. This means it understands the * same extensions. * @param buf The buffer to write to * @param len The size of the buffer * @param format The format string * @param ap The arguments to use to fill out the format string. */ -APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format, +APR_DECLARE(int) fspr_vsnprintf(char *buf, fspr_size_t len, const char *format, va_list ap); /** @} */ @@ -280,7 +280,7 @@ APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format, * @param n The number to format * @return The string representation of the number */ -APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n); +APR_DECLARE(char *) fspr_itoa(fspr_pool_t *p, int n); /** * create a string representation of a long, allocated from a pool @@ -288,18 +288,18 @@ APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n); * @param n The number to format * @return The string representation of the number */ -APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n); +APR_DECLARE(char *) fspr_ltoa(fspr_pool_t *p, long n); /** - * create a string representation of an apr_off_t, allocated from a pool + * create a string representation of an fspr_off_t, allocated from a pool * @param p The pool from which to allocate * @param n The number to format * @return The string representation of the number */ -APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n); +APR_DECLARE(char *) fspr_off_t_toa(fspr_pool_t *p, fspr_off_t n); /** - * Convert a numeric string into an apr_off_t numeric value. + * Convert a numeric string into an fspr_off_t numeric value. * @param offset The value of the parsed string. * @param buf The string to parse. It may contain optional whitespace, * followed by an optional '+' (positive, default) or '-' (negative) @@ -312,7 +312,7 @@ APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n); * digits are prefixed with '0x', in which case it will be treated as * base 16. */ -APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf, +APR_DECLARE(fspr_status_t) fspr_strtoff(fspr_off_t *offset, const char *buf, char **end, int base); /** @@ -330,25 +330,25 @@ APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *buf, * @return The numeric value of the string. On overflow, errno is set * to ERANGE. */ -APR_DECLARE(apr_int64_t) apr_strtoi64(const char *buf, char **end, int base); +APR_DECLARE(fspr_int64_t) fspr_strtoi64(const char *buf, char **end, int base); /** * parse a base-10 numeric string into a 64-bit numeric value. - * Equivalent to apr_strtoi64(buf, (char**)NULL, 10). + * Equivalent to fspr_strtoi64(buf, (char**)NULL, 10). * @param buf The string to parse * @return The numeric value of the string */ -APR_DECLARE(apr_int64_t) apr_atoi64(const char *buf); +APR_DECLARE(fspr_int64_t) fspr_atoi64(const char *buf); /** - * Format a binary size (magnitiudes are 2^10 rather than 10^3) from an apr_off_t, + * Format a binary size (magnitiudes are 2^10 rather than 10^3) from an fspr_off_t, * as bytes, K, M, T, etc, to a four character compacted human readable string. * @param size The size to format * @param buf The 5 byte text buffer (counting the trailing null) - * @return The buf passed to apr_strfsize() - * @remark All negative sizes report ' - ', apr_strfsize only formats positive values. + * @return The buf passed to fspr_strfsize() + * @remark All negative sizes report ' - ', fspr_strfsize only formats positive values. */ -APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf); +APR_DECLARE(char *) fspr_strfsize(fspr_off_t size, char *buf); /** @} */ diff --git a/libs/apr/include/apr_support.h b/libs/apr/include/fspr_support.h similarity index 83% rename from libs/apr/include/apr_support.h rename to libs/apr/include/fspr_support.h index a6115172d1..3fa0611d28 100644 --- a/libs/apr/include/apr_support.h +++ b/libs/apr/include/fspr_support.h @@ -18,20 +18,20 @@ #define APR_SUPPORT_H /** - * @file apr_support.h + * @file fspr_support.h * @brief APR Support functions */ -#include "apr.h" -#include "apr_network_io.h" -#include "apr_file_io.h" +#include "fspr.h" +#include "fspr_network_io.h" +#include "fspr_file_io.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_support Internal APR support functions + * @defgroup fspr_support Internal APR support functions * @ingroup APR * @{ */ @@ -41,7 +41,7 @@ extern "C" { * * Uses POOL for temporary allocations. */ -apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s, +fspr_status_t fspr_wait_for_io_or_timeout(fspr_file_t *f, fspr_socket_t *s, int for_read); /** @} */ diff --git a/libs/apr/include/apr_tables.h b/libs/apr/include/fspr_tables.h similarity index 74% rename from libs/apr/include/apr_tables.h rename to libs/apr/include/fspr_tables.h index 632f5b71b4..93d7f3bf87 100644 --- a/libs/apr/include/apr_tables.h +++ b/libs/apr/include/fspr_tables.h @@ -18,12 +18,12 @@ #define APR_TABLES_H /** - * @file apr_tables.h + * @file fspr_tables.h * @brief APR Table library */ -#include "apr.h" -#include "apr_pools.h" +#include "fspr.h" +#include "fspr_pools.h" #if APR_HAVE_STDARG_H #include /* for va_list */ @@ -34,7 +34,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_tables Table and Array Functions + * @defgroup fspr_tables Table and Array Functions * @ingroup APR * Tables are used to store entirely opaque structures * for applications, while Arrays are usually used to @@ -43,15 +43,15 @@ extern "C" { */ /** the table abstract data type */ -typedef struct apr_table_t apr_table_t; +typedef struct fspr_table_t fspr_table_t; -/** @see apr_array_header_t */ -typedef struct apr_array_header_t apr_array_header_t; +/** @see fspr_array_header_t */ +typedef struct fspr_array_header_t fspr_array_header_t; /** An opaque array type */ -struct apr_array_header_t { +struct fspr_array_header_t { /** The pool the array is allocated out of */ - apr_pool_t *pool; + fspr_pool_t *pool; /** The amount of memory allocated for each element of the array */ int elt_size; /** The number of active elements in the array */ @@ -65,10 +65,10 @@ struct apr_array_header_t { /** * The (opaque) structure for string-content tables. */ -typedef struct apr_table_entry_t apr_table_entry_t; +typedef struct fspr_table_entry_t fspr_table_entry_t; /** The type for each entry in a string-content table */ -struct apr_table_entry_t { +struct fspr_table_entry_t { /** The key for the current table entry */ char *key; /* maybe NULL in future; * check when iterating thru table_elts @@ -76,8 +76,8 @@ struct apr_table_entry_t { /** The value for the current table entry */ char *val; - /** A checksum for the key, for use by the apr_table internals */ - apr_uint32_t key_checksum; + /** A checksum for the key, for use by the fspr_table internals */ + fspr_uint32_t key_checksum; }; /** @@ -85,21 +85,21 @@ struct apr_table_entry_t { * @param t The table * @return An array containing the contents of the table */ -APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t); +APR_DECLARE(const fspr_array_header_t *) fspr_table_elts(const fspr_table_t *t); /** * Determine if the table is empty * @param t The table to check * @return True if empty, False otherwise */ -APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t); +APR_DECLARE(int) fspr_is_empty_table(const fspr_table_t *t); /** * Determine if the array is empty * @param a The array to check * @return True if empty, False otherwise */ -APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a); +APR_DECLARE(int) fspr_is_empty_array(const fspr_array_header_t *a); /** * Create an array @@ -108,7 +108,7 @@ APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a); * @param elt_size The size of each element in the array. * @return The new array */ -APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p, +APR_DECLARE(fspr_array_header_t *) fspr_array_make(fspr_pool_t *p, int nelts, int elt_size); /** @@ -118,7 +118,7 @@ APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p, * @remark If there are no free spots in the array, then this function will * allocate new space for the new element. */ -APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr); +APR_DECLARE(void *) fspr_array_push(fspr_array_header_t *arr); /** A helper macro for accessing a member of an APR array. * @@ -137,7 +137,7 @@ APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr); * * @return the location where the new object should be placed */ -#define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary))) +#define APR_ARRAY_PUSH(ary,type) (*((type *)fspr_array_push(ary))) /** * Remove an element from an array (as a first-in, last-out stack) @@ -145,7 +145,7 @@ APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr); * @return Location of the element in the array. * @remark If there are no elements in the array, NULL is returned. */ -APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr); +APR_DECLARE(void *) fspr_array_pop(fspr_array_header_t *arr); /** * Remove all elements from an array. @@ -153,7 +153,7 @@ APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr); * @remark As the underlying storage is allocated from a pool, no * memory is freed by this operation, but is available for reuse. */ -APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr); +APR_DECLARE(void) fspr_array_clear(fspr_array_header_t *arr); /** * Concatenate two arrays together @@ -161,30 +161,30 @@ APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr); * array * @param src The source array to add to the destination array */ -APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst, - const apr_array_header_t *src); +APR_DECLARE(void) fspr_array_cat(fspr_array_header_t *dst, + const fspr_array_header_t *src); /** * Copy the entire array * @param p The pool to allocate the copy of the array out of * @param arr The array to copy * @return An exact copy of the array passed in - * @remark The alternate apr_array_copy_hdr copies only the header, and arranges + * @remark The alternate fspr_array_copy_hdr copies only the header, and arranges * for the elements to be copied if (and only if) the code subsequently * does a push or arraycat. */ -APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p, - const apr_array_header_t *arr); +APR_DECLARE(fspr_array_header_t *) fspr_array_copy(fspr_pool_t *p, + const fspr_array_header_t *arr); /** * Copy the headers of the array, and arrange for the elements to be copied if * and only if the code subsequently does a push or arraycat. * @param p The pool to allocate the copy of the array out of * @param arr The array to copy * @return An exact copy of the array passed in - * @remark The alternate apr_array_copy copies the *entire* array. + * @remark The alternate fspr_array_copy copies the *entire* array. */ -APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p, - const apr_array_header_t *arr); +APR_DECLARE(fspr_array_header_t *) fspr_array_copy_hdr(fspr_pool_t *p, + const fspr_array_header_t *arr); /** * Append one array to the end of another, creating a new array in the process. @@ -193,12 +193,12 @@ APR_DECLARE(apr_array_header_t *) apr_array_copy_hdr(apr_pool_t *p, * @param second The array to put second in the new array. * @return A new array containing the data from the two arrays passed in. */ -APR_DECLARE(apr_array_header_t *) apr_array_append(apr_pool_t *p, - const apr_array_header_t *first, - const apr_array_header_t *second); +APR_DECLARE(fspr_array_header_t *) fspr_array_append(fspr_pool_t *p, + const fspr_array_header_t *first, + const fspr_array_header_t *second); /** - * Generates a new string from the apr_pool_t containing the concatenated + * Generates a new string from the fspr_pool_t containing the concatenated * sequence of substrings referenced as elements within the array. The string * will be empty if all substrings are empty or null, or if there are no * elements in the array. If sep is non-NUL, it will be inserted between @@ -208,8 +208,8 @@ APR_DECLARE(apr_array_header_t *) apr_array_append(apr_pool_t *p, * @param sep The separator to use * @return A string containing all of the data in the array. */ -APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p, - const apr_array_header_t *arr, +APR_DECLARE(char *) fspr_array_pstrcat(fspr_pool_t *p, + const fspr_array_header_t *arr, const char sep); /** @@ -219,7 +219,7 @@ APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p, * @return The new table. * @warning This table can only store text data */ -APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts); +APR_DECLARE(fspr_table_t *) fspr_table_make(fspr_pool_t *p, int nelts); /** * Create a new table and copy another table into it @@ -227,14 +227,14 @@ APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts); * @param t The table to copy * @return A copy of the table passed in */ -APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p, - const apr_table_t *t); +APR_DECLARE(fspr_table_t *) fspr_table_copy(fspr_pool_t *p, + const fspr_table_t *t); /** * Delete all of the elements from a table * @param t The table to clear */ -APR_DECLARE(void) apr_table_clear(apr_table_t *t); +APR_DECLARE(void) fspr_table_clear(fspr_table_t *t); /** * Get the value associated with a given key from the table. After this call, @@ -243,7 +243,7 @@ APR_DECLARE(void) apr_table_clear(apr_table_t *t); * @param key The key to search for * @return The value associated with the key, or NULL if the key does not exist. */ -APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key); +APR_DECLARE(const char *) fspr_table_get(const fspr_table_t *t, const char *key); /** * Add a key/value pair to a table, if another element already exists with the @@ -254,7 +254,7 @@ APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key); * @remark When adding data, this function makes a copy of both the key and the * value. */ -APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_set(fspr_table_t *t, const char *key, const char *val); /** @@ -267,7 +267,7 @@ APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, * the value, so care should be taken to ensure that the values will * not change after they have been added.. */ -APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_setn(fspr_table_t *t, const char *key, const char *val); /** @@ -275,7 +275,7 @@ APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, * @param t The table to remove data from * @param key The key of the data being removed */ -APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key); +APR_DECLARE(void) fspr_table_unset(fspr_table_t *t, const char *key); /** * Add data to a table by merging the value with data that has already been @@ -283,9 +283,9 @@ APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key); * @param t The table to search for the data * @param key The key to merge data for * @param val The data to add - * @remark If the key is not found, then this function acts like apr_table_add + * @remark If the key is not found, then this function acts like fspr_table_add */ -APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_merge(fspr_table_t *t, const char *key, const char *val); /** @@ -294,9 +294,9 @@ APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key, * @param t The table to search for the data * @param key The key to merge data for * @param val The data to add - * @remark If the key is not found, then this function acts like apr_table_addn + * @remark If the key is not found, then this function acts like fspr_table_addn */ -APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_mergen(fspr_table_t *t, const char *key, const char *val); /** @@ -308,7 +308,7 @@ APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key, * @remark When adding data, this function makes a copy of both the key and the * value. */ -APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_add(fspr_table_t *t, const char *key, const char *val); /** @@ -321,7 +321,7 @@ APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key, * value, so care should be taken to ensure that the values will not * change after they have been added.. */ -APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_addn(fspr_table_t *t, const char *key, const char *val); /** @@ -331,21 +331,21 @@ APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key, * @param base The table to add at the end of the new table * @return A new table containing all of the data from the two passed in */ -APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p, - const apr_table_t *overlay, - const apr_table_t *base); +APR_DECLARE(fspr_table_t *) fspr_table_overlay(fspr_pool_t *p, + const fspr_table_t *overlay, + const fspr_table_t *base); /** - * Declaration prototype for the iterator callback function of apr_table_do() - * and apr_table_vdo(). - * @param rec The data passed as the first argument to apr_table_[v]do() + * Declaration prototype for the iterator callback function of fspr_table_do() + * and fspr_table_vdo(). + * @param rec The data passed as the first argument to fspr_table_[v]do() * @param key The key from this iteration of the table * @param value The value from this iteration of the table * @remark Iteration continues while this callback function returns non-zero. - * To export the callback function for apr_table_[v]do() it must be declared + * To export the callback function for fspr_table_[v]do() it must be declared * in the _NONSTD convention. */ -typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key, +typedef int (fspr_table_do_callback_fn_t)(void *rec, const char *key, const char *value); /** @@ -362,10 +362,10 @@ typedef int (apr_table_do_callback_fn_t)(void *rec, const char *key, * are run. * @return FALSE if one of the comp() iterations returned zero; TRUE if all * iterations returned non-zero - * @see apr_table_do_callback_fn_t + * @see fspr_table_do_callback_fn_t */ -APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp, - void *rec, const apr_table_t *t, ...); +APR_DECLARE_NONSTD(int) fspr_table_do(fspr_table_do_callback_fn_t *comp, + void *rec, const fspr_table_t *t, ...); /** * Iterate over a table running the provided function once for every @@ -381,14 +381,14 @@ APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp, * whose key matches are run. * @return FALSE if one of the comp() iterations returned zero; TRUE if all * iterations returned non-zero - * @see apr_table_do_callback_fn_t + * @see fspr_table_do_callback_fn_t */ -APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp, - void *rec, const apr_table_t *t, va_list vp); +APR_DECLARE(int) fspr_table_vdo(fspr_table_do_callback_fn_t *comp, + void *rec, const fspr_table_t *t, va_list vp); -/** flag for overlap to use apr_table_setn */ +/** flag for overlap to use fspr_table_setn */ #define APR_OVERLAP_TABLES_SET (0) -/** flag for overlap to use apr_table_mergen */ +/** flag for overlap to use fspr_table_mergen */ #define APR_OVERLAP_TABLES_MERGE (1) /** * For each element in table b, either use setn or mergen to add the data @@ -396,25 +396,25 @@ APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp, * @param a The table to add the data to. * @param b The table to iterate over, adding its data to table a * @param flags How to add the table to table a. One of: - * APR_OVERLAP_TABLES_SET Use apr_table_setn - * APR_OVERLAP_TABLES_MERGE Use apr_table_mergen + * APR_OVERLAP_TABLES_SET Use fspr_table_setn + * APR_OVERLAP_TABLES_MERGE Use fspr_table_mergen * @remark This function is highly optimized, and uses less memory and CPU cycles * than a function that just loops through table b calling other functions. */ /** *
    - * Conceptually, apr_table_overlap does this:
    + * Conceptually, fspr_table_overlap does this:
      *
    - *  apr_array_header_t *barr = apr_table_elts(b);
    - *  apr_table_entry_t *belt = (apr_table_entry_t *)barr->elts;
    + *  fspr_array_header_t *barr = fspr_table_elts(b);
    + *  fspr_table_entry_t *belt = (fspr_table_entry_t *)barr->elts;
      *  int i;
      *
      *  for (i = 0; i < barr->nelts; ++i) {
      *      if (flags & APR_OVERLAP_TABLES_MERGE) {
    - *          apr_table_mergen(a, belt[i].key, belt[i].val);
    + *          fspr_table_mergen(a, belt[i].key, belt[i].val);
      *      }
      *      else {
    - *          apr_table_setn(a, belt[i].key, belt[i].val);
    + *          fspr_table_setn(a, belt[i].key, belt[i].val);
      *      }
      *  }
      *
    @@ -427,7 +427,7 @@ APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp,
      * 
    */ -APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b, +APR_DECLARE(void) fspr_table_overlap(fspr_table_t *a, const fspr_table_t *b, unsigned flags); /** @@ -438,7 +438,7 @@ APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b, * @param flags APR_OVERLAP_TABLES_MERGE to merge, or * APR_OVERLAP_TABLES_SET to overwrite */ -APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags); +APR_DECLARE(void) fspr_table_compress(fspr_table_t *t, unsigned flags); /** @} */ diff --git a/libs/apr/include/apr_thread_cond.h b/libs/apr/include/fspr_thread_cond.h similarity index 79% rename from libs/apr/include/apr_thread_cond.h rename to libs/apr/include/fspr_thread_cond.h index 3744b09042..7ece46e281 100644 --- a/libs/apr/include/apr_thread_cond.h +++ b/libs/apr/include/fspr_thread_cond.h @@ -18,15 +18,15 @@ #define APR_THREAD_COND_H /** - * @file apr_thread_cond.h + * @file fspr_thread_cond.h * @brief APR Condition Variable Routines */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_time.h" -#include "apr_thread_mutex.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" +#include "fspr_time.h" +#include "fspr_thread_mutex.h" #ifdef __cplusplus extern "C" { @@ -35,13 +35,13 @@ extern "C" { #if APR_HAS_THREADS || defined(DOXYGEN) /** - * @defgroup apr_thread_cond Condition Variable Routines + * @defgroup fspr_thread_cond Condition Variable Routines * @ingroup APR * @{ */ /** Opaque structure for thread condition variables */ -typedef struct apr_thread_cond_t apr_thread_cond_t; +typedef struct fspr_thread_cond_t fspr_thread_cond_t; /** * Note: destroying a condition variable (or likewise, destroying or @@ -56,8 +56,8 @@ typedef struct apr_thread_cond_t apr_thread_cond_t; * will be stored. * @param pool the pool from which to allocate the mutex. */ -APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_thread_cond_create(fspr_thread_cond_t **cond, + fspr_pool_t *pool); /** * Put the active calling thread to sleep until signaled to wake up. Each @@ -71,8 +71,8 @@ APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, * is released while the thread is asleep, and is again acquired before * returning from this function. */ -APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_thread_cond_wait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex); /** * Put the active calling thread to sleep until signaled to wake up or @@ -90,9 +90,9 @@ APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond, * will wake up before this time, otherwise the error APR_TIMEUP * is returned. */ -APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex, - apr_interval_time_t timeout); +APR_DECLARE(fspr_status_t) fspr_thread_cond_timedwait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex, + fspr_interval_time_t timeout); /** * Signals a single thread, if one exists, that is blocking on the given @@ -101,7 +101,7 @@ APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, * is desired, that mutex must be locked while calling this function. * @param cond the condition variable on which to produce the signal. */ -APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond); +APR_DECLARE(fspr_status_t) fspr_thread_cond_signal(fspr_thread_cond_t *cond); /** * Signals all threads blocking on the given condition variable. @@ -109,17 +109,17 @@ APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond); * the associated mutex. This will happen in a serialized manner. * @param cond the condition variable on which to produce the broadcast. */ -APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond); +APR_DECLARE(fspr_status_t) fspr_thread_cond_broadcast(fspr_thread_cond_t *cond); /** * Destroy the condition variable and free the associated memory. * @param cond the condition variable to destroy. */ -APR_DECLARE(apr_status_t) apr_thread_cond_destroy(apr_thread_cond_t *cond); +APR_DECLARE(fspr_status_t) fspr_thread_cond_destroy(fspr_thread_cond_t *cond); /** * Get the pool used by this thread_cond. - * @return apr_pool_t the pool + * @return fspr_pool_t the pool */ APR_POOL_DECLARE_ACCESSOR(thread_cond); diff --git a/libs/apr/include/apr_thread_mutex.h b/libs/apr/include/fspr_thread_mutex.h similarity index 81% rename from libs/apr/include/apr_thread_mutex.h rename to libs/apr/include/fspr_thread_mutex.h index 4596dce5d2..0edf7942d6 100644 --- a/libs/apr/include/apr_thread_mutex.h +++ b/libs/apr/include/fspr_thread_mutex.h @@ -18,12 +18,12 @@ #define APR_THREAD_MUTEX_H /** - * @file apr_thread_mutex.h + * @file fspr_thread_mutex.h * @brief APR Thread Mutex Routines */ -#include "apr.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_errno.h" #ifdef __cplusplus extern "C" { @@ -32,20 +32,20 @@ extern "C" { #if APR_HAS_THREADS || defined(DOXYGEN) /** - * @defgroup apr_thread_mutex Thread Mutex Routines + * @defgroup fspr_thread_mutex Thread Mutex Routines * @ingroup APR * @{ */ /** Opaque thread-local mutex structure */ -typedef struct apr_thread_mutex_t apr_thread_mutex_t; +typedef struct fspr_thread_mutex_t fspr_thread_mutex_t; #define APR_THREAD_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */ #define APR_THREAD_MUTEX_NESTED 0x1 /**< enable nested (recursive) locks */ #define APR_THREAD_MUTEX_UNNESTED 0x2 /**< disable nested locks */ /* Delayed the include to avoid a circular reference */ -#include "apr_pools.h" +#include "fspr_pools.h" /** * Create and initialize a mutex that can be used to synchronize threads. @@ -62,15 +62,15 @@ typedef struct apr_thread_mutex_t apr_thread_mutex_t; * most optimial mutex based on a given platform's performance charateristics, * it will behave as either a nested or an unnested lock. */ -APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_thread_mutex_create(fspr_thread_mutex_t **mutex, unsigned int flags, - apr_pool_t *pool); + fspr_pool_t *pool); /** * Acquire the lock for the given mutex. If the mutex is already locked, * the current thread will be put to sleep until the lock becomes available. * @param mutex the mutex on which to acquire the lock. */ -APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_thread_mutex_lock(fspr_thread_mutex_t *mutex); /** * Attempt to acquire the lock for the given mutex. If the mutex has already @@ -79,23 +79,23 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex); * if the return value was APR_EBUSY, for portability reasons. * @param mutex the mutex on which to attempt the lock acquiring. */ -APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_thread_mutex_trylock(fspr_thread_mutex_t *mutex); /** * Release the lock for the given mutex. * @param mutex the mutex from which to release the lock. */ -APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_thread_mutex_unlock(fspr_thread_mutex_t *mutex); /** * Destroy the mutex and free the memory associated with the lock. * @param mutex the mutex to destroy. */ -APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex); +APR_DECLARE(fspr_status_t) fspr_thread_mutex_destroy(fspr_thread_mutex_t *mutex); /** * Get the pool used by this thread_mutex. - * @return apr_pool_t the pool + * @return fspr_pool_t the pool */ APR_POOL_DECLARE_ACCESSOR(thread_mutex); diff --git a/libs/apr/include/apr_thread_proc.h b/libs/apr/include/fspr_thread_proc.h similarity index 71% rename from libs/apr/include/apr_thread_proc.h rename to libs/apr/include/fspr_thread_proc.h index c7930901b2..842f045092 100644 --- a/libs/apr/include/apr_thread_proc.h +++ b/libs/apr/include/fspr_thread_proc.h @@ -18,14 +18,14 @@ #define APR_THREAD_PROC_H /** - * @file apr_thread_proc.h + * @file fspr_thread_proc.h * @brief APR Thread and Process Library */ -#include "apr.h" -#include "apr_file_io.h" -#include "apr_pools.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_file_io.h" +#include "fspr_pools.h" +#include "fspr_errno.h" #if APR_HAVE_STRUCT_RLIMIT #include @@ -37,7 +37,7 @@ extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_thread_proc Threads and Process Functions + * @defgroup fspr_thread_proc Threads and Process Functions * @ingroup APR * @{ */ @@ -50,12 +50,12 @@ typedef enum { APR_SHELLCMD_ENV /**< use the shell to invoke the program, * replicating our environment */ -} apr_cmdtype_e; +} fspr_cmdtype_e; typedef enum { APR_WAIT, /**< wait for the specified process to finish */ APR_NOWAIT /**< do not wait -- just see if it has finished */ -} apr_wait_how_e; +} fspr_wait_how_e; /* I am specifically calling out the values so that the macros below make * more sense. Yes, I know I don't need to, but I am hoping this makes what @@ -66,7 +66,7 @@ typedef enum { APR_PROC_EXIT = 1, /**< process exited normally */ APR_PROC_SIGNAL = 2, /**< process exited due to a signal */ APR_PROC_SIGNAL_CORE = 4 /**< process exited and dumped a core file */ -} apr_exit_why_e; +} fspr_exit_why_e; /** did we exit the process */ #define APR_PROC_CHECK_EXIT(x) (x & APR_PROC_EXIT) @@ -75,25 +75,25 @@ typedef enum { /** did we get core */ #define APR_PROC_CHECK_CORE_DUMP(x) (x & APR_PROC_SIGNAL_CORE) -/** @see apr_procattr_io_set */ +/** @see fspr_procattr_io_set */ #define APR_NO_PIPE 0 -/** @see apr_procattr_io_set */ +/** @see fspr_procattr_io_set */ #define APR_FULL_BLOCK 1 -/** @see apr_procattr_io_set */ +/** @see fspr_procattr_io_set */ #define APR_FULL_NONBLOCK 2 -/** @see apr_procattr_io_set */ +/** @see fspr_procattr_io_set */ #define APR_PARENT_BLOCK 3 -/** @see apr_procattr_io_set */ +/** @see fspr_procattr_io_set */ #define APR_CHILD_BLOCK 4 -/** @see apr_procattr_limit_set */ +/** @see fspr_procattr_limit_set */ #define APR_LIMIT_CPU 0 -/** @see apr_procattr_limit_set */ +/** @see fspr_procattr_limit_set */ #define APR_LIMIT_MEM 1 -/** @see apr_procattr_limit_set */ +/** @see fspr_procattr_limit_set */ #define APR_LIMIT_NPROC 2 -/** @see apr_procattr_limit_set */ +/** @see fspr_procattr_limit_set */ #define APR_LIMIT_NOFILE 3 /** @@ -119,15 +119,15 @@ typedef enum { /** @} */ /** The APR process type */ -typedef struct apr_proc_t { +typedef struct fspr_proc_t { /** The process ID */ pid_t pid; /** Parent's side of pipe to child's stdin */ - apr_file_t *in; + fspr_file_t *in; /** Parent's side of pipe to child's stdout */ - apr_file_t *out; + fspr_file_t *out; /** Parent's side of pipe to child's stdouterr */ - apr_file_t *err; + fspr_file_t *err; #if APR_HAS_PROC_INVOKED || defined(DOXYGEN) /** Diagnositics/debugging string of the command invoked for * this process [only present if APR_HAS_PROC_INVOKED is true] @@ -147,51 +147,51 @@ typedef struct apr_proc_t { */ HANDLE hproc; #endif -} apr_proc_t; +} fspr_proc_t; /** * The prototype for APR child errfn functions. (See the description - * of apr_procattr_child_errfn_set() for more information.) + * of fspr_procattr_child_errfn_set() for more information.) * It is passed the following parameters: - * @param pool Pool associated with the apr_proc_t. If your child + * @param pool Pool associated with the fspr_proc_t. If your child * error function needs user data, associate it with this * pool. * @param err APR error code describing the error * @param description Text description of type of processing which failed */ -typedef void (apr_child_errfn_t)(apr_pool_t *proc, apr_status_t err, +typedef void (fspr_child_errfn_t)(fspr_pool_t *proc, fspr_status_t err, const char *description); /** Opaque Thread structure. */ -typedef struct apr_thread_t apr_thread_t; +typedef struct fspr_thread_t fspr_thread_t; /** Opaque Thread attributes structure. */ -typedef struct apr_threadattr_t apr_threadattr_t; +typedef struct fspr_threadattr_t fspr_threadattr_t; /** Opaque Process attributes structure. */ -typedef struct apr_procattr_t apr_procattr_t; +typedef struct fspr_procattr_t fspr_procattr_t; /** Opaque control variable for one-time atomic variables. */ -typedef struct apr_thread_once_t apr_thread_once_t; +typedef struct fspr_thread_once_t fspr_thread_once_t; /** Opaque thread private address space. */ -typedef struct apr_threadkey_t apr_threadkey_t; +typedef struct fspr_threadkey_t fspr_threadkey_t; /** Opaque record of child process. */ -typedef struct apr_other_child_rec_t apr_other_child_rec_t; +typedef struct fspr_other_child_rec_t fspr_other_child_rec_t; /** * The prototype for any APR thread worker functions. */ -typedef void *(APR_THREAD_FUNC *apr_thread_start_t)(apr_thread_t*, void*); +typedef void *(APR_THREAD_FUNC *fspr_thread_start_t)(fspr_thread_t*, void*); typedef enum { APR_KILL_NEVER, /**< process is never sent any signals */ - APR_KILL_ALWAYS, /**< process is sent SIGKILL on apr_pool_t cleanup */ + APR_KILL_ALWAYS, /**< process is sent SIGKILL on fspr_pool_t cleanup */ APR_KILL_AFTER_TIMEOUT, /**< SIGTERM, wait 3 seconds, SIGKILL */ APR_JUST_WAIT, /**< wait forever for the process to complete */ APR_KILL_ONLY_ONCE /**< send SIGTERM and then wait */ -} apr_kill_conditions_e; +} fspr_kill_conditions_e; /* Thread Function definitions */ @@ -202,16 +202,16 @@ typedef enum { * @param new_attr The newly created threadattr. * @param cont The pool to use */ -APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new_attr, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new_attr, + fspr_pool_t *cont); /** * Set if newly created threads should be created in detached state. * @param attr The threadattr to affect * @param on Non-zero if detached threads should be created. */ -APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, - apr_int32_t on); +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr, + fspr_int32_t on); /** * Get the detach state for this threadattr. @@ -219,15 +219,15 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, * @return APR_DETACH if threads are to be detached, or APR_NOTDETACH * if threads are to be joinable. */ -APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr); +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr); /** * Set the stack size of newly created threads. * @param attr The threadattr to affect * @param stacksize The stack size in bytes */ -APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, - apr_size_t stacksize); +APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr, + fspr_size_t stacksize); /** * Set the stack guard area size of newly created threads. @@ -239,8 +239,8 @@ APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, * and increases memory management overhead. Setting the guard area * size to zero hence trades off reliable behaviour on stack overflow * for performance. */ -APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, - apr_size_t guardsize); +APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr, + fspr_size_t guardsize); /** * Create a new thread of execution @@ -250,40 +250,40 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, * @param data Any data to be passed to the starting function * @param cont The pool to use */ -APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new_thread, - apr_threadattr_t *attr, - apr_thread_start_t func, - void *data, apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new_thread, + fspr_threadattr_t *attr, + fspr_thread_start_t func, + void *data, fspr_pool_t *cont); /** * stop the current thread * @param thd The thread to stop * @param retval The return value to pass back to any thread that cares */ -APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, - apr_status_t retval); +APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd, + fspr_status_t retval); /** * block until the desired thread stops executing. * @param retval The return value from the dead thread. * @param thd The thread to join */ -APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, - apr_thread_t *thd); +APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval, + fspr_thread_t *thd); /** * force the current thread to yield the processor */ -APR_DECLARE(void) apr_thread_yield(void); +APR_DECLARE(void) fspr_thread_yield(void); /** - * Initialize the control variable for apr_thread_once. If this isn't - * called, apr_initialize won't work. + * Initialize the control variable for fspr_thread_once. If this isn't + * called, fspr_initialize won't work. * @param control The control variable to initialize * @param p The pool to allocate data from. */ -APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control, + fspr_pool_t *p); /** * Run the specified function one time, regardless of how many threads @@ -294,14 +294,14 @@ APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, * if the function has ever been called before. * @param func The function to call. */ -APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, +APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control, void (*func)(void)); /** * detach a thread * @param thd The thread to detach */ -APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd); +APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd); /** * Return the pool associated with the current thread. @@ -309,8 +309,8 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd); * @param key The key to associate with the data * @param thread The currently open thread. */ -APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, - apr_thread_t *thread); +APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key, + fspr_thread_t *thread); /** * Return the pool associated with the current thread. @@ -319,9 +319,9 @@ APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, * @param cleanup The cleanup routine to use when the thread is destroyed. * @param thread The currently open thread. */ -APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_thread_t *thread); +APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_thread_t *thread); /** * Create and initialize a new thread private address space @@ -329,31 +329,31 @@ APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key, * @param dest The destructor to use when freeing the private memory. * @param cont The pool to use */ -APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, +APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key, void (*dest)(void *), - apr_pool_t *cont); + fspr_pool_t *cont); /** * Get a pointer to the thread private memory * @param new_mem The data stored in private memory * @param key The handle for the desired thread private memory */ -APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new_mem, - apr_threadkey_t *key); +APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new_mem, + fspr_threadkey_t *key); /** * Set the data to be stored in thread private memory * @param priv The data to be stored in private memory * @param key The handle for the desired thread private memory */ -APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, - apr_threadkey_t *key); +APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv, + fspr_threadkey_t *key); /** * Free the thread private memory * @param key The handle for the desired thread private memory */ -APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key); +APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key); /** * Return the pool associated with the current threadkey. @@ -361,8 +361,8 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key); * @param key The key associated with the data * @param threadkey The currently open threadkey. */ -APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key, - apr_threadkey_t *threadkey); +APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key, + fspr_threadkey_t *threadkey); /** * Return the pool associated with the current threadkey. @@ -371,9 +371,9 @@ APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key, * @param cleanup The cleanup routine to use when the file is destroyed. * @param threadkey The currently open threadkey. */ -APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_threadkey_t *threadkey); +APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_threadkey_t *threadkey); #endif @@ -382,8 +382,8 @@ APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key, * @param new_attr The newly created procattr. * @param cont The pool to use */ -APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new_attr, - apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new_attr, + fspr_pool_t *cont); /** * Determine if any of stdin, stdout, or stderr should be linked to pipes @@ -393,15 +393,15 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new_attr, * @param out Should stdout be a pipe back to the parent? * @param err Should stderr be a pipe back to the parent? */ -APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, - apr_int32_t in, apr_int32_t out, - apr_int32_t err); +APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, + fspr_int32_t in, fspr_int32_t out, + fspr_int32_t err); /** - * Set the child_in and/or parent_in values to existing apr_file_t values. + * Set the child_in and/or parent_in values to existing fspr_file_t values. * @param attr The procattr we care about. - * @param child_in apr_file_t value to use as child_in. Must be a valid file. - * @param parent_in apr_file_t value to use as parent_in. Must be a valid file. + * @param child_in fspr_file_t value to use as child_in. Must be a valid file. + * @param parent_in fspr_file_t value to use as parent_in. Must be a valid file. * @remark This is NOT a required initializer function. This is * useful if you have already opened a pipe (or multiple files) * that you wish to use, perhaps persistently across multiple @@ -409,37 +409,37 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, * extra function calls by not creating your own pipe since this * creates one in the process space for you. */ -APR_DECLARE(apr_status_t) apr_procattr_child_in_set(struct apr_procattr_t *attr, - apr_file_t *child_in, - apr_file_t *parent_in); +APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(struct fspr_procattr_t *attr, + fspr_file_t *child_in, + fspr_file_t *parent_in); /** - * Set the child_out and parent_out values to existing apr_file_t values. + * Set the child_out and parent_out values to existing fspr_file_t values. * @param attr The procattr we care about. - * @param child_out apr_file_t value to use as child_out. Must be a valid file. - * @param parent_out apr_file_t value to use as parent_out. Must be a valid file. + * @param child_out fspr_file_t value to use as child_out. Must be a valid file. + * @param parent_out fspr_file_t value to use as parent_out. Must be a valid file. * @remark This is NOT a required initializer function. This is * useful if you have already opened a pipe (or multiple files) * that you wish to use, perhaps persistently across multiple * process invocations - such as a log file. */ -APR_DECLARE(apr_status_t) apr_procattr_child_out_set(struct apr_procattr_t *attr, - apr_file_t *child_out, - apr_file_t *parent_out); +APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(struct fspr_procattr_t *attr, + fspr_file_t *child_out, + fspr_file_t *parent_out); /** - * Set the child_err and parent_err values to existing apr_file_t values. + * Set the child_err and parent_err values to existing fspr_file_t values. * @param attr The procattr we care about. - * @param child_err apr_file_t value to use as child_err. Must be a valid file. - * @param parent_err apr_file_t value to use as parent_err. Must be a valid file. + * @param child_err fspr_file_t value to use as child_err. Must be a valid file. + * @param parent_err fspr_file_t value to use as parent_err. Must be a valid file. * @remark This is NOT a required initializer function. This is * useful if you have already opened a pipe (or multiple files) * that you wish to use, perhaps persistently across multiple * process invocations - such as a log file. */ -APR_DECLARE(apr_status_t) apr_procattr_child_err_set(struct apr_procattr_t *attr, - apr_file_t *child_err, - apr_file_t *parent_err); +APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(struct fspr_procattr_t *attr, + fspr_file_t *child_err, + fspr_file_t *parent_err); /** * Set which directory the child process should start executing in. @@ -448,7 +448,7 @@ APR_DECLARE(apr_status_t) apr_procattr_child_err_set(struct apr_procattr_t *attr * the parent currently resides in, when the createprocess call * is made. */ -APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr, const char *dir); /** @@ -462,16 +462,16 @@ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, * APR_PROGRAM_PATH -- Executable program on PATH, copy env * */ -APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd); +APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr, + fspr_cmdtype_e cmd); /** * Determine if the child should start in detached state. * @param attr The procattr we care about. * @param detach Should the child start in detached state? Default is no. */ -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, - apr_int32_t detach); +APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, + fspr_int32_t detach); #if APR_HAVE_STRUCT_RLIMIT /** @@ -486,8 +486,8 @@ APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, * * @param limit Value to set the limit to. */ -APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, - apr_int32_t what, +APR_DECLARE(fspr_status_t) fspr_procattr_limit_set(fspr_procattr_t *attr, + fspr_int32_t what, struct rlimit *limit); #endif @@ -496,29 +496,29 @@ APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, * encounters an error in the child prior to running the specified program. * @param attr The procattr describing the child process to be created. * @param errfn The function to call in the child process. - * @remark At the present time, it will only be called from apr_proc_create() + * @remark At the present time, it will only be called from fspr_proc_create() * on platforms where fork() is used. It will never be called on other - * platforms, on those platforms apr_proc_create() will return the error + * platforms, on those platforms fspr_proc_create() will return the error * in the parent process rather than invoke the callback in the now-forked * child process. */ -APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, - apr_child_errfn_t *errfn); +APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr, + fspr_child_errfn_t *errfn); /** - * Specify that apr_proc_create() should do whatever it can to report - * failures to the caller of apr_proc_create(), rather than find out in + * Specify that fspr_proc_create() should do whatever it can to report + * failures to the caller of fspr_proc_create(), rather than find out in * the child. * @param attr The procattr describing the child process to be created. * @param chk Flag to indicate whether or not extra work should be done * to try to report failures to the caller. - * @remark This flag only affects apr_proc_create() on platforms where + * @remark This flag only affects fspr_proc_create() on platforms where * fork() is used. This leads to extra overhead in the calling * process, but that may help the application handle such * errors more gracefully. */ -APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, - apr_int32_t chk); +APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr, + fspr_int32_t chk); /** * Determine if the child should start in its own address space or using the @@ -527,8 +527,8 @@ APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, * @param addrspace Should the child start in its own address space? Default * is no on NetWare and yes on other platforms. */ -APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, - apr_int32_t addrspace); +APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr, + fspr_int32_t addrspace); /** * Set the username used for running process @@ -538,7 +538,7 @@ APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, * or any other platform having * APR_PROCATTR_USER_SET_REQUIRES_PASSWORD set. */ -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr, const char *username, const char *password); @@ -547,7 +547,7 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, * @param attr The procattr we care about. * @param groupname The group name used */ -APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr, const char *groupname); @@ -560,7 +560,7 @@ APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, * @remark returns APR_INCHILD for the child, and APR_INPARENT for the parent * or an error. */ -APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *cont); +APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *cont); #endif /** @@ -577,14 +577,14 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *cont); * process * @param pool The pool to use. * @note This function returns without waiting for the new process to terminate; - * use apr_proc_wait for that. + * use fspr_proc_wait for that. */ -APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new_proc, +APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *new_proc, const char *progname, const char * const *args, const char * const *env, - apr_procattr_t *attr, - apr_pool_t *pool); + fspr_procattr_t *attr, + fspr_pool_t *pool); /** * Wait for a child process to die @@ -612,9 +612,9 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new_proc, * APR_CHILD_NOTDONE -- child is still running. * */ -APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, - int *exitcode, apr_exit_why_e *exitwhy, - apr_wait_how_e waithow); +APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc, + int *exitcode, fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow); /** * Wait for any current child process to die and return information @@ -642,11 +642,11 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, * @bug Passing proc as a *proc rather than **proc was an odd choice * for some platforms... this should be revisited in 1.0 */ -APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc, int *exitcode, - apr_exit_why_e *exitwhy, - apr_wait_how_e waithow, - apr_pool_t *p); + fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow, + fspr_pool_t *p); #define APR_PROC_DETACH_FOREGROUND 0 /**< Do not detach */ #define APR_PROC_DETACH_DAEMONIZE 1 /**< Detach */ @@ -657,7 +657,7 @@ APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, * and become a background process, else it will * stay in the foreground. */ -APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize); +APR_DECLARE(fspr_status_t) fspr_proc_detach(int daemonize); /** * Register an other_child -- a child associated to its registered @@ -676,12 +676,12 @@ APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize); * proc->in/out/err handles should be health checked. * @bug no platform currently tests the pipes health. */ -APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc, +APR_DECLARE(void) fspr_proc_other_child_register(fspr_proc_t *proc, void (*maintenance) (int reason, void *, int status), - void *data, apr_file_t *write_fd, - apr_pool_t *p); + void *data, fspr_file_t *write_fd, + fspr_pool_t *p); /** * Stop watching the specified other child. @@ -692,7 +692,7 @@ APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc, * themself by loading ocr->next before calling any maintenance * function. */ -APR_DECLARE(void) apr_proc_other_child_unregister(void *data); +APR_DECLARE(void) fspr_proc_other_child_unregister(void *data); /** * Notify the maintenance callback of a registered other child process @@ -702,10 +702,10 @@ APR_DECLARE(void) apr_proc_other_child_unregister(void *data); * @param status The status to pass to the maintenance function * @remark An example of code using this behavior; *
    - * rv = apr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p);
    + * rv = fspr_proc_wait_all_procs(&proc, &exitcode, &status, APR_WAIT, p);
      * if (APR_STATUS_IS_CHILD_DONE(rv)) {
      * #if APR_HAS_OTHER_CHILD
    - *     if (apr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status)
    + *     if (fspr_proc_other_child_alert(&proc, APR_OC_REASON_DEATH, status)
      *             == APR_SUCCESS) {
      *         ;  (already handled)
      *     }
    @@ -714,7 +714,7 @@ APR_DECLARE(void) apr_proc_other_child_unregister(void *data);
      *         [... handling non-otherchild processes death ...]
      * 
    */ -APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_other_child_alert(fspr_proc_t *proc, int reason, int status); @@ -725,7 +725,7 @@ APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc, * @param ocr The registered other child * @param reason The reason code (e.g. APR_OC_REASON_RESTART) if still running */ -APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, +APR_DECLARE(void) fspr_proc_other_child_refresh(fspr_other_child_rec_t *ocr, int reason); /** @@ -734,14 +734,14 @@ APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, * code if the process is no longer healthy. * @param reason The reason code (e.g. APR_OC_REASON_RESTART) to running processes */ -APR_DECLARE(void) apr_proc_other_child_refresh_all(int reason); +APR_DECLARE(void) fspr_proc_other_child_refresh_all(int reason); /** * Terminate a process. * @param proc The process to terminate. * @param sig How to kill the process. */ -APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int sig); +APR_DECLARE(fspr_status_t) fspr_proc_kill(fspr_proc_t *proc, int sig); /** * Register a process to be killed when a pool dies. @@ -750,14 +750,14 @@ APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int sig); * @param how How to kill the process, one of: *
      *         APR_KILL_NEVER         -- process is never sent any signals
    - *         APR_KILL_ALWAYS        -- process is sent SIGKILL on apr_pool_t cleanup
    + *         APR_KILL_ALWAYS        -- process is sent SIGKILL on fspr_pool_t cleanup
      *         APR_KILL_AFTER_TIMEOUT -- SIGTERM, wait 3 seconds, SIGKILL
      *         APR_JUST_WAIT          -- wait forever for the process to complete
      *         APR_KILL_ONLY_ONCE     -- send SIGTERM and then wait
      * 
    */ -APR_DECLARE(void) apr_pool_note_subprocess(apr_pool_t *a, apr_proc_t *proc, - apr_kill_conditions_e how); +APR_DECLARE(void) fspr_pool_note_subprocess(fspr_pool_t *a, fspr_proc_t *proc, + fspr_kill_conditions_e how); #if APR_HAS_THREADS @@ -767,22 +767,22 @@ APR_DECLARE(void) apr_pool_note_subprocess(apr_pool_t *a, apr_proc_t *proc, * Setup the process for a single thread to be used for all signal handling. * @warning This must be called before any threads are created */ -APR_DECLARE(apr_status_t) apr_setup_signal_thread(void); +APR_DECLARE(fspr_status_t) fspr_setup_signal_thread(void); /** * Make the current thread listen for signals. This thread will loop * forever, calling a provided function whenever it receives a signal. That * functions should return 1 if the signal has been handled, 0 otherwise. * @param signal_handler The function to call when a signal is received - * apr_status_t apr_signal_thread((int)(*signal_handler)(int signum)) + * fspr_status_t fspr_signal_thread((int)(*signal_handler)(int signum)) */ -APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum)); +APR_DECLARE(fspr_status_t) fspr_signal_thread(int(*signal_handler)(int signum)); #endif /* (APR_HAVE_SIGWAIT || APR_HAVE_SIGSUSPEND) && !defined(OS2) */ /** * Get the child-pool used by the thread from the thread info. - * @return apr_pool_t the pool + * @return fspr_pool_t the pool */ APR_POOL_DECLARE_ACCESSOR(thread); diff --git a/libs/apr/include/apr_thread_rwlock.h b/libs/apr/include/fspr_thread_rwlock.h similarity index 78% rename from libs/apr/include/apr_thread_rwlock.h rename to libs/apr/include/fspr_thread_rwlock.h index 0bd958fbfa..57f36fce31 100644 --- a/libs/apr/include/apr_thread_rwlock.h +++ b/libs/apr/include/fspr_thread_rwlock.h @@ -18,13 +18,13 @@ #define APR_THREAD_RWLOCK_H /** - * @file apr_thread_rwlock.h + * @file fspr_thread_rwlock.h * @brief APR Reader/Writer Lock Routines */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" #ifdef __cplusplus extern "C" { @@ -33,13 +33,13 @@ extern "C" { #if APR_HAS_THREADS /** - * @defgroup apr_thread_rwlock Reader/Writer Lock Routines + * @defgroup fspr_thread_rwlock Reader/Writer Lock Routines * @ingroup APR * @{ */ /** Opaque read-write thread-safe lock. */ -typedef struct apr_thread_rwlock_t apr_thread_rwlock_t; +typedef struct fspr_thread_rwlock_t fspr_thread_rwlock_t; /** * Note: The following operations have undefined results: unlocking a @@ -57,19 +57,19 @@ typedef struct apr_thread_rwlock_t apr_thread_rwlock_t; * will be stored. * @param pool the pool from which to allocate the mutex. */ -APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, - apr_pool_t *pool); +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_create(fspr_thread_rwlock_t **rwlock, + fspr_pool_t *pool); /** * Acquire a shared-read lock on the given read-write lock. This will allow * multiple threads to enter the same critical section while they have acquired * the read lock. * @param rwlock the read-write lock on which to acquire the shared read. */ -APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock); +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_rdlock(fspr_thread_rwlock_t *rwlock); /** * Attempt to acquire the shared-read lock on the given read-write lock. This - * is the same as apr_thread_rwlock_rdlock(), only that the function fails + * is the same as fspr_thread_rwlock_rdlock(), only that the function fails * if there is another thread holding the write lock, or if there are any * write threads blocking on the lock. If the function fails for this case, * APR_EBUSY will be returned. Note: it is important that the @@ -77,7 +77,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock); * APR_EBUSY, for portability reasons. * @param rwlock the rwlock on which to attempt the shared read. */ -APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock); +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_tryrdlock(fspr_thread_rwlock_t *rwlock); /** * Acquire an exclusive-write lock on the given read-write lock. This will @@ -86,35 +86,35 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwloc * sleep until it can have exclusive access to the lock. * @param rwlock the read-write lock on which to acquire the exclusive write. */ -APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock); +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_wrlock(fspr_thread_rwlock_t *rwlock); /** * Attempt to acquire the exclusive-write lock on the given read-write lock. - * This is the same as apr_thread_rwlock_wrlock(), only that the function fails + * This is the same as fspr_thread_rwlock_wrlock(), only that the function fails * if there is any other thread holding the lock (for reading or writing), * in which case the function will return APR_EBUSY. Note: it is important * that the APR_STATUS_IS_EBUSY(s) macro be used to determine if the return * value was APR_EBUSY, for portability reasons. * @param rwlock the rwlock on which to attempt the exclusive write. */ -APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock); +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_trywrlock(fspr_thread_rwlock_t *rwlock); /** * Release either the read or write lock currently held by the calling thread * associated with the given read-write lock. * @param rwlock the read-write lock to be released (unlocked). */ -APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock); +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_unlock(fspr_thread_rwlock_t *rwlock); /** * Destroy the read-write lock and free the associated memory. * @param rwlock the rwlock to destroy. */ -APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock); +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_destroy(fspr_thread_rwlock_t *rwlock); /** * Get the pool used by this thread_rwlock. - * @return apr_pool_t the pool + * @return fspr_pool_t the pool */ APR_POOL_DECLARE_ACCESSOR(thread_rwlock); diff --git a/libs/apr/include/apr_time.h b/libs/apr/include/fspr_time.h similarity index 56% rename from libs/apr/include/apr_time.h rename to libs/apr/include/fspr_time.h index 253aa72b4a..acf6686469 100644 --- a/libs/apr/include/apr_time.h +++ b/libs/apr/include/fspr_time.h @@ -18,111 +18,111 @@ #define APR_TIME_H /** - * @file apr_time.h + * @file fspr_time.h * @brief APR Time Library */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_errno.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_time Time Routines + * @defgroup fspr_time Time Routines * @ingroup APR * @{ */ /** month names */ -APR_DECLARE_DATA extern const char apr_month_snames[12][4]; +APR_DECLARE_DATA extern const char fspr_month_snames[12][4]; /** day names */ -APR_DECLARE_DATA extern const char apr_day_snames[7][4]; +APR_DECLARE_DATA extern const char fspr_day_snames[7][4]; /** number of microseconds since 00:00:00 january 1, 1970 UTC */ -typedef apr_int64_t apr_time_t; +typedef fspr_int64_t fspr_time_t; -/** mechanism to properly type apr_time_t literals */ +/** mechanism to properly type fspr_time_t literals */ #define APR_TIME_C(val) APR_INT64_C(val) -/** mechanism to properly print apr_time_t values */ +/** mechanism to properly print fspr_time_t values */ #define APR_TIME_T_FMT APR_INT64_T_FMT /** intervals for I/O timeouts, in microseconds */ -typedef apr_int64_t apr_interval_time_t; +typedef fspr_int64_t fspr_interval_time_t; /** short interval for I/O timeouts, in microseconds */ -typedef apr_int32_t apr_short_interval_time_t; +typedef fspr_int32_t fspr_short_interval_time_t; /** number of microseconds per second */ #define APR_USEC_PER_SEC APR_TIME_C(1000000) -/** @return apr_time_t as a second */ -#define apr_time_sec(time) ((time) / APR_USEC_PER_SEC) +/** @return fspr_time_t as a second */ +#define fspr_time_sec(time) ((time) / APR_USEC_PER_SEC) -/** @return apr_time_t as a usec */ -#define apr_time_usec(time) ((time) % APR_USEC_PER_SEC) +/** @return fspr_time_t as a usec */ +#define fspr_time_usec(time) ((time) % APR_USEC_PER_SEC) -/** @return apr_time_t as a msec */ -#define apr_time_msec(time) (((time) / 1000) % 1000) +/** @return fspr_time_t as a msec */ +#define fspr_time_msec(time) (((time) / 1000) % 1000) -/** @return apr_time_t as a msec */ -#define apr_time_as_msec(time) ((time) / 1000) +/** @return fspr_time_t as a msec */ +#define fspr_time_as_msec(time) ((time) / 1000) -/** @return a second as an apr_time_t */ -#define apr_time_from_sec(sec) ((apr_time_t)(sec) * APR_USEC_PER_SEC) +/** @return a second as an fspr_time_t */ +#define fspr_time_from_sec(sec) ((fspr_time_t)(sec) * APR_USEC_PER_SEC) -/** @return a second and usec combination as an apr_time_t */ -#define apr_time_make(sec, usec) ((apr_time_t)(sec) * APR_USEC_PER_SEC \ - + (apr_time_t)(usec)) +/** @return a second and usec combination as an fspr_time_t */ +#define fspr_time_make(sec, usec) ((fspr_time_t)(sec) * APR_USEC_PER_SEC \ + + (fspr_time_t)(usec)) /** * @return the current time */ -APR_DECLARE(apr_time_t) apr_time_now(void); +APR_DECLARE(fspr_time_t) fspr_time_now(void); -/** @see apr_time_exp_t */ -typedef struct apr_time_exp_t apr_time_exp_t; +/** @see fspr_time_exp_t */ +typedef struct fspr_time_exp_t fspr_time_exp_t; /** * a structure similar to ANSI struct tm with the following differences: * - tm_usec isn't an ANSI field * - tm_gmtoff isn't an ANSI field (it's a bsdism) */ -struct apr_time_exp_t { +struct fspr_time_exp_t { /** microseconds past tm_sec */ - apr_int32_t tm_usec; + fspr_int32_t tm_usec; /** (0-61) seconds past tm_min */ - apr_int32_t tm_sec; + fspr_int32_t tm_sec; /** (0-59) minutes past tm_hour */ - apr_int32_t tm_min; + fspr_int32_t tm_min; /** (0-23) hours past midnight */ - apr_int32_t tm_hour; + fspr_int32_t tm_hour; /** (1-31) day of the month */ - apr_int32_t tm_mday; + fspr_int32_t tm_mday; /** (0-11) month of the year */ - apr_int32_t tm_mon; + fspr_int32_t tm_mon; /** year since 1900 */ - apr_int32_t tm_year; + fspr_int32_t tm_year; /** (0-6) days since sunday */ - apr_int32_t tm_wday; + fspr_int32_t tm_wday; /** (0-365) days since jan 1 */ - apr_int32_t tm_yday; + fspr_int32_t tm_yday; /** daylight saving time */ - apr_int32_t tm_isdst; + fspr_int32_t tm_isdst; /** seconds east of UTC */ - apr_int32_t tm_gmtoff; + fspr_int32_t tm_gmtoff; }; /** - * convert an ansi time_t to an apr_time_t - * @param result the resulting apr_time_t + * convert an ansi time_t to an fspr_time_t + * @param result the resulting fspr_time_t * @param input the time_t to convert */ -APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result, +APR_DECLARE(fspr_status_t) fspr_time_ansi_put(fspr_time_t *result, time_t input); /** @@ -132,76 +132,76 @@ APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result, * @param input the time to explode * @param offs the number of seconds offset to apply */ -APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result, - apr_time_t input, - apr_int32_t offs); +APR_DECLARE(fspr_status_t) fspr_time_exp_tz(fspr_time_exp_t *result, + fspr_time_t input, + fspr_int32_t offs); /** * convert a time to its human readable components in GMT timezone * @param result the exploded time * @param input the time to explode */ -APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result, - apr_time_t input); +APR_DECLARE(fspr_status_t) fspr_time_exp_gmt(fspr_time_exp_t *result, + fspr_time_t input); /** * convert a time to its human readable components in local timezone * @param result the exploded time * @param input the time to explode */ -APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, - apr_time_t input); +APR_DECLARE(fspr_status_t) fspr_time_exp_lt(fspr_time_exp_t *result, + fspr_time_t input); /** - * Convert time value from human readable format to a numeric apr_time_t + * Convert time value from human readable format to a numeric fspr_time_t * e.g. elapsed usec since epoch * @param result the resulting imploded time * @param input the input exploded time */ -APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *result, - apr_time_exp_t *input); +APR_DECLARE(fspr_status_t) fspr_time_exp_get(fspr_time_t *result, + fspr_time_exp_t *input); /** - * Convert time value from human readable format to a numeric apr_time_t that + * Convert time value from human readable format to a numeric fspr_time_t that * always represents GMT * @param result the resulting imploded time * @param input the input exploded time */ -APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *result, - apr_time_exp_t *input); +APR_DECLARE(fspr_status_t) fspr_time_exp_gmt_get(fspr_time_t *result, + fspr_time_exp_t *input); /** * Sleep for the specified number of micro-seconds. * @param t desired amount of time to sleep. * @warning May sleep for longer than the specified time. */ -APR_DECLARE(void) apr_sleep(apr_interval_time_t t); +APR_DECLARE(void) fspr_sleep(fspr_interval_time_t t); /** length of a RFC822 Date */ #define APR_RFC822_DATE_LEN (30) /** - * apr_rfc822_date formats dates in the RFC822 + * fspr_rfc822_date formats dates in the RFC822 * format in an efficient manner. It is a fixed length * format which requires the indicated amount of storage, * including the trailing NUL terminator. * @param date_str String to write to. * @param t the time to convert */ -APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t); +APR_DECLARE(fspr_status_t) fspr_rfc822_date(char *date_str, fspr_time_t t); /** length of a CTIME date */ #define APR_CTIME_LEN (25) /** - * apr_ctime formats dates in the ctime() format + * fspr_ctime formats dates in the ctime() format * in an efficient manner. it is a fixed length format * and requires the indicated amount of storage including * the trailing NUL terminator. - * Unlike ANSI/ISO C ctime(), apr_ctime() does not include + * Unlike ANSI/ISO C ctime(), fspr_ctime() does not include * a \n at the end of the string. * @param date_str String to write to. * @param t the time to convert */ -APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t); +APR_DECLARE(fspr_status_t) fspr_ctime(char *date_str, fspr_time_t t); /** * formats the exploded time according to the format specified @@ -211,9 +211,9 @@ APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t); * @param format The format for the time string * @param tm The time to convert */ -APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize, - apr_size_t max, const char *format, - apr_time_exp_t *tm); +APR_DECLARE(fspr_status_t) fspr_strftime(char *s, fspr_size_t *retsize, + fspr_size_t max, const char *format, + fspr_time_exp_t *tm); /** * Improve the clock resolution for the lifetime of the given pool. @@ -221,7 +221,7 @@ APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize, * time-sensitive applications, and has no impact on most platforms. * @param p The pool to associate the finer clock resolution */ -APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p); +APR_DECLARE(void) fspr_time_clock_hires(fspr_pool_t *p); /** @} */ diff --git a/libs/apr/include/apr_user.h b/libs/apr/include/fspr_user.h similarity index 65% rename from libs/apr/include/apr_user.h rename to libs/apr/include/fspr_user.h index 0179e22644..68c7c753de 100644 --- a/libs/apr/include/apr_user.h +++ b/libs/apr/include/fspr_user.h @@ -18,20 +18,20 @@ #define APR_USER_H /** - * @file apr_user.h + * @file fspr_user.h * @brief APR User ID Services */ -#include "apr.h" -#include "apr_errno.h" -#include "apr_pools.h" +#include "fspr.h" +#include "fspr_errno.h" +#include "fspr_pools.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** - * @defgroup apr_user User and Group ID Services + * @defgroup fspr_user User and Group ID Services * @ingroup APR * @{ */ @@ -40,18 +40,18 @@ extern "C" { * Structure for determining user ownership. */ #ifdef WIN32 -typedef PSID apr_uid_t; +typedef PSID fspr_uid_t; #else -typedef uid_t apr_uid_t; +typedef uid_t fspr_uid_t; #endif /** * Structure for determining group ownership. */ #ifdef WIN32 -typedef PSID apr_gid_t; +typedef PSID fspr_gid_t; #else -typedef gid_t apr_gid_t; +typedef gid_t fspr_gid_t; #endif #if APR_HAS_USER @@ -63,9 +63,9 @@ typedef gid_t apr_gid_t; * @param p The pool from which to allocate working space * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *userid, - apr_gid_t *groupid, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_uid_current(fspr_uid_t *userid, + fspr_gid_t *groupid, + fspr_pool_t *p); /** * Get the user name for a specified userid @@ -74,8 +74,8 @@ APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *userid, * @param p The pool from which to allocate the string * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, - apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_uid_name_get(char **username, fspr_uid_t userid, + fspr_pool_t *p); /** * Get the userid (and groupid) for the specified username @@ -85,8 +85,8 @@ APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, * @param p The pool from which to allocate working space * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *userid, apr_gid_t *groupid, - const char *username, apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_uid_get(fspr_uid_t *userid, fspr_gid_t *groupid, + const char *username, fspr_pool_t *p); /** * Get the home directory for the named user @@ -95,22 +95,22 @@ APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *userid, apr_gid_t *groupid, * @param p The pool from which to allocate the string * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, +APR_DECLARE(fspr_status_t) fspr_uid_homepath_get(char **dirname, const char *username, - apr_pool_t *p); + fspr_pool_t *p); /** * Compare two user identifiers for equality. * @param left One uid to test * @param right Another uid to test - * @return APR_SUCCESS if the apr_uid_t strutures identify the same user, - * APR_EMISMATCH if not, APR_BADARG if an apr_uid_t is invalid. + * @return APR_SUCCESS if the fspr_uid_t strutures identify the same user, + * APR_EMISMATCH if not, APR_BADARG if an fspr_uid_t is invalid. * @remark This function is available only if APR_HAS_USER is defined. */ #if defined(WIN32) -APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right); +APR_DECLARE(fspr_status_t) fspr_uid_compare(fspr_uid_t left, fspr_uid_t right); #else -#define apr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH) +#define fspr_uid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH) #endif /** @@ -120,8 +120,8 @@ APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right); * @param p The pool from which to allocate the string * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, - apr_gid_t groupid, apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_gid_name_get(char **groupname, + fspr_gid_t groupid, fspr_pool_t *p); /** * Get the groupid for a specified group name @@ -130,21 +130,21 @@ APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, * @param p The pool from which to allocate the string * @remark This function is available only if APR_HAS_USER is defined. */ -APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid, - const char *groupname, apr_pool_t *p); +APR_DECLARE(fspr_status_t) fspr_gid_get(fspr_gid_t *groupid, + const char *groupname, fspr_pool_t *p); /** * Compare two group identifiers for equality. * @param left One gid to test * @param right Another gid to test - * @return APR_SUCCESS if the apr_gid_t strutures identify the same group, - * APR_EMISMATCH if not, APR_BADARG if an apr_gid_t is invalid. + * @return APR_SUCCESS if the fspr_gid_t strutures identify the same group, + * APR_EMISMATCH if not, APR_BADARG if an fspr_gid_t is invalid. * @remark This function is available only if APR_HAS_USER is defined. */ #if defined(WIN32) -APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right); +APR_DECLARE(fspr_status_t) fspr_gid_compare(fspr_gid_t left, fspr_gid_t right); #else -#define apr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH) +#define fspr_gid_compare(left,right) (((left) == (right)) ? APR_SUCCESS : APR_EMISMATCH) #endif #endif /* ! APR_HAS_USER */ diff --git a/libs/apr/include/apr_version.h b/libs/apr/include/fspr_version.h similarity index 93% rename from libs/apr/include/apr_version.h rename to libs/apr/include/fspr_version.h index a3bd6b893b..7d5b05f77c 100644 --- a/libs/apr/include/apr_version.h +++ b/libs/apr/include/fspr_version.h @@ -18,7 +18,7 @@ #define APR_VERSION_H /** - * @file apr_version.h + * @file fspr_version.h * @brief APR Versioning Interface * * APR's Version @@ -76,7 +76,7 @@ #define APR_IS_DEV_STRING "" #endif -/* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */ +/* APR_STRINGIFY is defined here, and also in fspr_general.h, so wrap it */ #ifndef APR_STRINGIFY /** Properly quote a value as a string in the C preprocessor */ #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n) @@ -102,11 +102,11 @@ /* The C language API to access the version at run time, * as opposed to compile time. APR_VERSION_ONLY may be defined - * externally when preprocessing apr_version.h to obtain strictly + * externally when preprocessing fspr_version.h to obtain strictly * the C Preprocessor macro declarations. */ -#include "apr.h" +#include "fspr.h" #ifdef __cplusplus extern "C" { @@ -121,7 +121,7 @@ typedef struct { int minor; /**< minor number */ int patch; /**< patch number */ int is_dev; /**< is development (1 or 0) */ -} apr_version_t; +} fspr_version_t; /** * Return APR's version information information in a numeric form. @@ -129,10 +129,10 @@ typedef struct { * @param pvsn Pointer to a version structure for returning the version * information. */ -APR_DECLARE(void) apr_version(apr_version_t *pvsn); +APR_DECLARE(void) fspr_version(fspr_version_t *pvsn); /** Return APR's version information as a string. */ -APR_DECLARE(const char *) apr_version_string(void); +APR_DECLARE(const char *) fspr_version_string(void); #ifdef __cplusplus } diff --git a/libs/apr/include/apr_want.h b/libs/apr/include/fspr_want.h similarity index 94% rename from libs/apr/include/apr_want.h rename to libs/apr/include/fspr_want.h index 39cc4fcb6b..238c2b1a2f 100644 --- a/libs/apr/include/apr_want.h +++ b/libs/apr/include/fspr_want.h @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr.h" /* configuration data */ +#include "fspr.h" /* configuration data */ /** - * @file apr_want.h + * @file fspr_want.h * @brief APR Standard Headers Support * *
    @@ -32,12 +32,12 @@
      *
      *   #define APR_WANT_STRFUNC
      *   #define APR_WANT_MEMFUNC
    - *   #include "apr_want.h"
    + *   #include "fspr_want.h"
      *
      * The appropriate headers will be included.
      *
      * Note: it is safe to use this in a header (it won't interfere with other
    - *       headers' or source files' use of apr_want.h)
    + *       headers' or source files' use of fspr_want.h)
      * 
    */ diff --git a/libs/apr/libapr.dsp b/libs/apr/libapr.dsp index be347a7767..b4dbace5a9 100644 --- a/libs/apr/libapr.dsp +++ b/libs/apr/libapr.dsp @@ -43,7 +43,7 @@ RSC=rc.exe # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fd"Release\libapr_src" /FD /c +# ADD CPP /nologo /MD /W3 /O2 /Oy- /Zi /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "NDEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fd"Release\libfspr_src" /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /o /win32 "NUL" # ADD BASE RSC /l 0x409 /d "NDEBUG" @@ -75,7 +75,7 @@ PostBuild_Cmds=if exist $(OUTDIR)\libapr-1.dll.manifest mt.exe -manifest $(OUTDI # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MDd /W3 /EHsc /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /FD /c -# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fd"Debug\libapr_src" /FD /c +# ADD CPP /nologo /MDd /W3 /EHsc /Zi /Od /I "./include" /I "./include/arch" /I "./include/arch/win32" /I "./include/arch/unix" /D "_DEBUG" /D "APR_DECLARE_EXPORT" /D "WIN32" /D "_WINDOWS" /Fd"Debug\libfspr_src" /FD /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /o /win32 "NUL" # ADD BASE RSC /l 0x409 /d "_DEBUG" @@ -107,7 +107,7 @@ PostBuild_Cmds=if exist $(OUTDIR)\libapr-1.dll.manifest mt.exe -manifest $(OUTDI # PROP Default_Filter "" # Begin Source File -SOURCE=.\atomic\win32\apr_atomic.c +SOURCE=.\atomic\win32\fspr_atomic.c # End Source File # End Group # Begin Group "dso" @@ -211,7 +211,7 @@ SOURCE=.\locks\win32\thread_rwlock.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\memory\unix\apr_pools.c +SOURCE=.\memory\unix\fspr_pools.c # End Source File # End Group # Begin Group "misc" @@ -219,7 +219,7 @@ SOURCE=.\memory\unix\apr_pools.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\misc\win32\apr_app.c +SOURCE=.\misc\win32\fspr_app.c # PROP Exclude_From_Build 1 # End Source File # Begin Source File @@ -320,7 +320,7 @@ SOURCE=.\network_io\win32\sockopt.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\passwd\apr_getpass.c +SOURCE=.\passwd\fspr_getpass.c # End Source File # End Group # Begin Group "random" @@ -328,7 +328,7 @@ SOURCE=.\passwd\apr_getpass.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\random\unix\apr_random.c +SOURCE=.\random\unix\fspr_random.c # End Source File # Begin Source File @@ -352,27 +352,27 @@ SOURCE=.\shmem\win32\shm.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\strings\apr_cpystrn.c +SOURCE=.\strings\fspr_cpystrn.c # End Source File # Begin Source File -SOURCE=.\strings\apr_fnmatch.c +SOURCE=.\strings\fspr_fnmatch.c # End Source File # Begin Source File -SOURCE=.\strings\apr_snprintf.c +SOURCE=.\strings\fspr_snprintf.c # End Source File # Begin Source File -SOURCE=.\strings\apr_strings.c +SOURCE=.\strings\fspr_strings.c # End Source File # Begin Source File -SOURCE=.\strings\apr_strnatcmp.c +SOURCE=.\strings\fspr_strnatcmp.c # End Source File # Begin Source File -SOURCE=.\strings\apr_strtok.c +SOURCE=.\strings\fspr_strtok.c # End Source File # End Group # Begin Group "tables" @@ -380,11 +380,11 @@ SOURCE=.\strings\apr_strtok.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\tables\apr_hash.c +SOURCE=.\tables\fspr_hash.c # End Source File # Begin Source File -SOURCE=.\tables\apr_tables.c +SOURCE=.\tables\fspr_tables.c # End Source File # End Group # Begin Group "threadproc" @@ -441,51 +441,51 @@ SOURCE=.\user\win32\userinfo.c # PROP Default_Filter "" # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_atime.h +SOURCE=.\include\arch\win32\fspr_arch_atime.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_dso.h +SOURCE=.\include\arch\win32\fspr_arch_dso.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_file_io.h +SOURCE=.\include\arch\win32\fspr_arch_file_io.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_inherit.h +SOURCE=.\include\arch\win32\fspr_arch_inherit.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_misc.h +SOURCE=.\include\arch\win32\fspr_arch_misc.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_networkio.h +SOURCE=.\include\arch\win32\fspr_arch_networkio.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_thread_mutex.h +SOURCE=.\include\arch\win32\fspr_arch_thread_mutex.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_thread_rwlock.h +SOURCE=.\include\arch\win32\fspr_arch_thread_rwlock.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_threadproc.h +SOURCE=.\include\arch\win32\fspr_arch_threadproc.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_arch_utf8.h +SOURCE=.\include\arch\win32\fspr_arch_utf8.h # End Source File # Begin Source File -SOURCE=.\include\arch\win32\apr_private.h +SOURCE=.\include\arch\win32\fspr_private.h # End Source File # Begin Source File -SOURCE=.\include\arch\apr_private_common.h +SOURCE=.\include\arch\fspr_private_common.h # End Source File # End Group # Begin Group "Public Header Files" @@ -493,35 +493,35 @@ SOURCE=.\include\arch\apr_private_common.h # PROP Default_Filter "" # Begin Source File -SOURCE=.\include\apr.h.in +SOURCE=.\include\fspr.h.in # PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=.\include\apr.hnw +SOURCE=.\include\fspr.hnw # PROP Exclude_From_Build 1 # End Source File # Begin Source File -SOURCE=.\include\apr.hw +SOURCE=.\include\fspr.hw !IF "$(CFG)" == "libapr - Win32 Release" # Begin Custom Build - Creating apr.h from apr.hw -InputPath=.\include\apr.hw +InputPath=.\include\fspr.hw -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apr.hw > .\include\apr.h +".\include\fspr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\fspr.hw > .\include\fspr.h # End Custom Build !ELSEIF "$(CFG)" == "libapr - Win32 Debug" # Begin Custom Build - Creating apr.h from apr.hw -InputPath=.\include\apr.hw +InputPath=.\include\fspr.hw -".\include\apr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - type .\include\apr.hw > .\include\apr.h +".\include\fspr.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" + type .\include\fspr.hw > .\include\fspr.h # End Custom Build @@ -530,139 +530,139 @@ InputPath=.\include\apr.hw # End Source File # Begin Source File -SOURCE=.\include\apr_allocator.h +SOURCE=.\include\fspr_allocator.h # End Source File # Begin Source File -SOURCE=.\include\apr_atomic.h +SOURCE=.\include\fspr_atomic.h # End Source File # Begin Source File -SOURCE=.\include\apr_dso.h +SOURCE=.\include\fspr_dso.h # End Source File # Begin Source File -SOURCE=.\include\apr_env.h +SOURCE=.\include\fspr_env.h # End Source File # Begin Source File -SOURCE=.\include\apr_errno.h +SOURCE=.\include\fspr_errno.h # End Source File # Begin Source File -SOURCE=.\include\apr_file_info.h +SOURCE=.\include\fspr_file_info.h # End Source File # Begin Source File -SOURCE=.\include\apr_file_io.h +SOURCE=.\include\fspr_file_io.h # End Source File # Begin Source File -SOURCE=.\include\apr_fnmatch.h +SOURCE=.\include\fspr_fnmatch.h # End Source File # Begin Source File -SOURCE=.\include\apr_general.h +SOURCE=.\include\fspr_general.h # End Source File # Begin Source File -SOURCE=.\include\apr_getopt.h +SOURCE=.\include\fspr_getopt.h # End Source File # Begin Source File -SOURCE=.\include\apr_global_mutex.h +SOURCE=.\include\fspr_global_mutex.h # End Source File # Begin Source File -SOURCE=.\include\apr_hash.h +SOURCE=.\include\fspr_hash.h # End Source File # Begin Source File -SOURCE=.\include\apr_inherit.h +SOURCE=.\include\fspr_inherit.h # End Source File # Begin Source File -SOURCE=.\include\apr_lib.h +SOURCE=.\include\fspr_lib.h # End Source File # Begin Source File -SOURCE=.\include\apr_mmap.h +SOURCE=.\include\fspr_mmap.h # End Source File # Begin Source File -SOURCE=.\include\apr_network_io.h +SOURCE=.\include\fspr_network_io.h # End Source File # Begin Source File -SOURCE=.\include\apr_poll.h +SOURCE=.\include\fspr_poll.h # End Source File # Begin Source File -SOURCE=.\include\apr_pools.h +SOURCE=.\include\fspr_pools.h # End Source File # Begin Source File -SOURCE=.\include\apr_portable.h +SOURCE=.\include\fspr_portable.h # End Source File # Begin Source File -SOURCE=.\include\apr_proc_mutex.h +SOURCE=.\include\fspr_proc_mutex.h # End Source File # Begin Source File -SOURCE=.\include\apr_ring.h +SOURCE=.\include\fspr_ring.h # End Source File # Begin Source File -SOURCE=.\include\apr_shm.h +SOURCE=.\include\fspr_shm.h # End Source File # Begin Source File -SOURCE=.\include\apr_signal.h +SOURCE=.\include\fspr_signal.h # End Source File # Begin Source File -SOURCE=.\include\apr_strings.h +SOURCE=.\include\fspr_strings.h # End Source File # Begin Source File -SOURCE=.\include\apr_support.h +SOURCE=.\include\fspr_support.h # End Source File # Begin Source File -SOURCE=.\include\apr_tables.h +SOURCE=.\include\fspr_tables.h # End Source File # Begin Source File -SOURCE=.\include\apr_thread_cond.h +SOURCE=.\include\fspr_thread_cond.h # End Source File # Begin Source File -SOURCE=.\include\apr_thread_mutex.h +SOURCE=.\include\fspr_thread_mutex.h # End Source File # Begin Source File -SOURCE=.\include\apr_thread_proc.h +SOURCE=.\include\fspr_thread_proc.h # End Source File # Begin Source File -SOURCE=.\include\apr_thread_rwlock.h +SOURCE=.\include\fspr_thread_rwlock.h # End Source File # Begin Source File -SOURCE=.\include\apr_time.h +SOURCE=.\include\fspr_time.h # End Source File # Begin Source File -SOURCE=.\include\apr_user.h +SOURCE=.\include\fspr_user.h # End Source File # Begin Source File -SOURCE=.\include\apr_version.h +SOURCE=.\include\fspr_version.h # End Source File # Begin Source File -SOURCE=.\include\apr_want.h +SOURCE=.\include\fspr_want.h # End Source File # End Group # Begin Source File diff --git a/libs/apr/locks/beos/proc_mutex.c b/libs/apr/locks/beos/proc_mutex.c index ce2a580bac..b7227d2ff2 100644 --- a/libs/apr/locks/beos/proc_mutex.c +++ b/libs/apr/locks/beos/proc_mutex.c @@ -18,13 +18,13 @@ * Stephen Beaulieu */ -#include "apr_arch_proc_mutex.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_proc_mutex.h" +#include "fspr_strings.h" +#include "fspr_portable.h" -static apr_status_t _proc_mutex_cleanup(void * data) +static fspr_status_t _proc_mutex_cleanup(void * data) { - apr_proc_mutex_t *lock = (apr_proc_mutex_t*)data; + fspr_proc_mutex_t *lock = (fspr_proc_mutex_t*)data; if (lock->LockCount != 0) { /* we're still locked... */ while (atomic_add(&lock->LockCount , -1) > 1){ @@ -39,19 +39,19 @@ static apr_status_t _proc_mutex_cleanup(void * data) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_create(fspr_proc_mutex_t **mutex, const char *fname, - apr_lockmech_e mech, - apr_pool_t *pool) + fspr_lockmech_e mech, + fspr_pool_t *pool) { - apr_proc_mutex_t *new; - apr_status_t stat = APR_SUCCESS; + fspr_proc_mutex_t *new; + fspr_status_t stat = APR_SUCCESS; if (mech != APR_LOCK_DEFAULT) { return APR_ENOTIMPL; } - new = (apr_proc_mutex_t *)apr_pcalloc(pool, sizeof(apr_proc_mutex_t)); + new = (fspr_proc_mutex_t *)fspr_pcalloc(pool, sizeof(fspr_proc_mutex_t)); if (new == NULL){ return APR_ENOMEM; } @@ -64,21 +64,21 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, new->Lock = stat; new->pool = pool; - apr_pool_cleanup_register(new->pool, (void *)new, _proc_mutex_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new->pool, (void *)new, _proc_mutex_cleanup, + fspr_pool_cleanup_null); (*mutex) = new; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_child_init(fspr_proc_mutex_t **mutex, const char *fname, - apr_pool_t *pool) + fspr_pool_t *pool) { return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_lock(fspr_proc_mutex_t *mutex) { int32 stat; @@ -91,12 +91,12 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_trylock(fspr_proc_mutex_t *mutex) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_unlock(fspr_proc_mutex_t *mutex) { int32 stat; @@ -109,58 +109,58 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_destroy(fspr_proc_mutex_t *mutex) { - apr_status_t stat; + fspr_status_t stat; if ((stat = _proc_mutex_cleanup(mutex)) == APR_SUCCESS) { - apr_pool_cleanup_kill(mutex->pool, mutex, _proc_mutex_cleanup); + fspr_pool_cleanup_kill(mutex->pool, mutex, _proc_mutex_cleanup); return APR_SUCCESS; } return stat; } -APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_cleanup(void *mutex) { return _proc_mutex_cleanup(mutex); } -APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_lockfile(fspr_proc_mutex_t *mutex) { return NULL; } -APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_name(fspr_proc_mutex_t *mutex) { return "beossem"; } -APR_DECLARE(const char *) apr_proc_mutex_defname(void) +APR_DECLARE(const char *) fspr_proc_mutex_defname(void) { return "beossem"; } APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex) -/* Implement OS-specific accessors defined in apr_portable.h */ +/* Implement OS-specific accessors defined in fspr_portable.h */ -APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, - apr_proc_mutex_t *pmutex) +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_get(fspr_os_proc_mutex_t *ospmutex, + fspr_proc_mutex_t *pmutex) { ospmutex->sem = pmutex->Lock; ospmutex->ben = pmutex->LockCount; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, - apr_os_proc_mutex_t *ospmutex, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_put(fspr_proc_mutex_t **pmutex, + fspr_os_proc_mutex_t *ospmutex, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*pmutex) == NULL) { - (*pmutex) = (apr_proc_mutex_t *)apr_pcalloc(pool, sizeof(apr_proc_mutex_t)); + (*pmutex) = (fspr_proc_mutex_t *)fspr_pcalloc(pool, sizeof(fspr_proc_mutex_t)); (*pmutex)->pool = pool; } (*pmutex)->Lock = ospmutex->sem; diff --git a/libs/apr/locks/beos/thread_cond.c b/libs/apr/locks/beos/thread_cond.c index e3ea460003..6585f61f12 100644 --- a/libs/apr/locks/beos/thread_cond.c +++ b/libs/apr/locks/beos/thread_cond.c @@ -14,15 +14,15 @@ * limitations under the License. */ -#include "apr_arch_thread_mutex.h" -#include "apr_arch_thread_cond.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_arch_thread_cond.h" +#include "fspr_strings.h" +#include "fspr_portable.h" -static apr_status_t thread_cond_cleanup(void *data) +static fspr_status_t thread_cond_cleanup(void *data) { struct waiter *w; - apr_thread_cond_t *cond = (apr_thread_cond_t *)data; + fspr_thread_cond_t *cond = (fspr_thread_cond_t *)data; acquire_sem(cond->lock); delete_sem(cond->lock); @@ -30,10 +30,10 @@ static apr_status_t thread_cond_cleanup(void *data) return APR_SUCCESS; } -static struct waiter_t *make_waiter(apr_pool_t *pool) +static struct waiter_t *make_waiter(fspr_pool_t *pool) { struct waiter_t *w = (struct waiter_t*) - apr_palloc(pool, sizeof(struct waiter_t)); + fspr_palloc(pool, sizeof(struct waiter_t)); if (w == NULL) return NULL; @@ -46,14 +46,14 @@ static struct waiter_t *make_waiter(apr_pool_t *pool) return w; } -APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_cond_create(fspr_thread_cond_t **cond, + fspr_pool_t *pool) { - apr_thread_cond_t *new_cond; + fspr_thread_cond_t *new_cond; sem_id rv; int i; - new_cond = (apr_thread_cond_t *)apr_palloc(pool, sizeof(apr_thread_cond_t)); + new_cond = (fspr_thread_cond_t *)fspr_palloc(pool, sizeof(fspr_thread_cond_t)); if (new_cond == NULL) return APR_ENOMEM; @@ -71,21 +71,21 @@ APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, APR_RING_INSERT_TAIL(&new_cond->flist, nw, waiter_t, link); } - apr_pool_cleanup_register(new_cond->pool, + fspr_pool_cleanup_register(new_cond->pool, (void *)new_cond, thread_cond_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_null); *cond = new_cond; return APR_SUCCESS; } -static apr_status_t do_wait(apr_thread_cond_t *cond, apr_thread_mutex_t *mutex, +static fspr_status_t do_wait(fspr_thread_cond_t *cond, fspr_thread_mutex_t *mutex, int timeout) { struct waiter_t *wait; thread_id cth = find_thread(NULL); - apr_status_t rv; + fspr_status_t rv; int flags = B_RELATIVE_TIMEOUT; /* We must be the owner of the mutex or we can't do this... */ @@ -104,14 +104,14 @@ static apr_status_t do_wait(apr_thread_cond_t *cond, apr_thread_mutex_t *mutex, cond->condlock = mutex; release_sem(cond->lock); - apr_thread_mutex_unlock(cond->condlock); + fspr_thread_mutex_unlock(cond->condlock); if (timeout == 0) flags = 0; rv = acquire_sem_etc(wait->sem, 1, flags, timeout); - apr_thread_mutex_lock(cond->condlock); + fspr_thread_mutex_lock(cond->condlock); if (rv != B_OK) if (rv == B_TIMED_OUT) @@ -126,20 +126,20 @@ static apr_status_t do_wait(apr_thread_cond_t *cond, apr_thread_mutex_t *mutex, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_cond_wait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex) { return do_wait(cond, mutex, 0); } -APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex, - apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_thread_cond_timedwait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex, + fspr_interval_time_t timeout) { return do_wait(cond, mutex, timeout); } -APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_signal(fspr_thread_cond_t *cond) { struct waiter_t *wake; @@ -155,7 +155,7 @@ APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_broadcast(fspr_thread_cond_t *cond) { struct waiter_t *wake; @@ -171,11 +171,11 @@ APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_destroy(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_destroy(fspr_thread_cond_t *cond) { - apr_status_t stat; + fspr_status_t stat; if ((stat = thread_cond_cleanup(cond)) == APR_SUCCESS) { - apr_pool_cleanup_kill(cond->pool, cond, thread_cond_cleanup); + fspr_pool_cleanup_kill(cond->pool, cond, thread_cond_cleanup); return APR_SUCCESS; } return stat; diff --git a/libs/apr/locks/beos/thread_mutex.c b/libs/apr/locks/beos/thread_mutex.c index b87f76606f..4604939802 100644 --- a/libs/apr/locks/beos/thread_mutex.c +++ b/libs/apr/locks/beos/thread_mutex.c @@ -18,13 +18,13 @@ * Stephen Beaulieu */ -#include "apr_arch_thread_mutex.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_strings.h" +#include "fspr_portable.h" -static apr_status_t _thread_mutex_cleanup(void * data) +static fspr_status_t _thread_mutex_cleanup(void * data) { - apr_thread_mutex_t *lock = (apr_thread_mutex_t*)data; + fspr_thread_mutex_t *lock = (fspr_thread_mutex_t*)data; if (lock->LockCount != 0) { /* we're still locked... */ while (atomic_add(&lock->LockCount , -1) > 1){ @@ -39,14 +39,14 @@ static apr_status_t _thread_mutex_cleanup(void * data) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_thread_mutex_create(fspr_thread_mutex_t **mutex, unsigned int flags, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_thread_mutex_t *new_m; - apr_status_t stat = APR_SUCCESS; + fspr_thread_mutex_t *new_m; + fspr_status_t stat = APR_SUCCESS; - new_m = (apr_thread_mutex_t *)apr_pcalloc(pool, sizeof(apr_thread_mutex_t)); + new_m = (fspr_thread_mutex_t *)fspr_pcalloc(pool, sizeof(fspr_thread_mutex_t)); if (new_m == NULL){ return APR_ENOMEM; } @@ -64,24 +64,24 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, */ new_m->nested = flags & APR_THREAD_MUTEX_NESTED; - apr_pool_cleanup_register(new_m->pool, (void *)new_m, _thread_mutex_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_m->pool, (void *)new_m, _thread_mutex_cleanup, + fspr_pool_cleanup_null); (*mutex) = new_m; return APR_SUCCESS; } #if APR_HAS_CREATE_LOCKS_NP -APR_DECLARE(apr_status_t) apr_thread_mutex_create_np(apr_thread_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_thread_mutex_create_np(fspr_thread_mutex_t **mutex, const char *fname, - apr_lockmech_e_np mech, - apr_pool_t *pool) + fspr_lockmech_e_np mech, + fspr_pool_t *pool) { return APR_ENOTIMPL; } #endif -APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_lock(fspr_thread_mutex_t *mutex) { int32 stat; thread_id me = find_thread(NULL); @@ -105,12 +105,12 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_trylock(fspr_thread_mutex_t *mutex) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_unlock(fspr_thread_mutex_t *mutex) { int32 stat; @@ -133,11 +133,11 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_destroy(fspr_thread_mutex_t *mutex) { - apr_status_t stat; + fspr_status_t stat; if ((stat = _thread_mutex_cleanup(mutex)) == APR_SUCCESS) { - apr_pool_cleanup_kill(mutex->pool, mutex, _thread_mutex_cleanup); + fspr_pool_cleanup_kill(mutex->pool, mutex, _thread_mutex_cleanup); return APR_SUCCESS; } return stat; diff --git a/libs/apr/locks/beos/thread_rwlock.c b/libs/apr/locks/beos/thread_rwlock.c index a540b44557..d006b3183a 100644 --- a/libs/apr/locks/beos/thread_rwlock.c +++ b/libs/apr/locks/beos/thread_rwlock.c @@ -18,15 +18,15 @@ * Stephen Beaulieu */ -#include "apr_arch_thread_rwlock.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_thread_rwlock.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #define BIG_NUM 100000 -static apr_status_t _thread_rw_cleanup(void * data) +static fspr_status_t _thread_rw_cleanup(void * data) { - apr_thread_rwlock_t *mutex = (apr_thread_rwlock_t*)data; + fspr_thread_rwlock_t *mutex = (fspr_thread_rwlock_t*)data; if (mutex->ReadCount != 0) { while (atomic_add(&mutex->ReadCount , -1) > 1){ @@ -50,12 +50,12 @@ static apr_status_t _thread_rw_cleanup(void * data) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_create(fspr_thread_rwlock_t **rwlock, + fspr_pool_t *pool) { - apr_thread_rwlock_t *new; + fspr_thread_rwlock_t *new; - new = (apr_thread_rwlock_t *)apr_pcalloc(pool, sizeof(apr_thread_rwlock_t)); + new = (fspr_thread_rwlock_t *)fspr_pcalloc(pool, sizeof(fspr_thread_rwlock_t)); if (new == NULL){ return APR_ENOMEM; } @@ -74,13 +74,13 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, return -1; } - apr_pool_cleanup_register(new->pool, (void *)new, _thread_rw_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new->pool, (void *)new, _thread_rw_cleanup, + fspr_pool_cleanup_null); (*rwlock) = new; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_rdlock(fspr_thread_rwlock_t *rwlock) { int32 rv = APR_SUCCESS; @@ -100,12 +100,12 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) return rv; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_tryrdlock(fspr_thread_rwlock_t *rwlock) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_wrlock(fspr_thread_rwlock_t *rwlock) { int rv = APR_SUCCESS; @@ -136,14 +136,14 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) return rv; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_trywrlock(fspr_thread_rwlock_t *rwlock) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_unlock(fspr_thread_rwlock_t *rwlock) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; int32 readers; /* we know we hold the lock, so don't check it :) */ @@ -176,11 +176,11 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) return rv; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_destroy(fspr_thread_rwlock_t *rwlock) { - apr_status_t stat; + fspr_status_t stat; if ((stat = _thread_rw_cleanup(rwlock)) == APR_SUCCESS) { - apr_pool_cleanup_kill(rwlock->pool, rwlock, _thread_rw_cleanup); + fspr_pool_cleanup_kill(rwlock->pool, rwlock, _thread_rw_cleanup); return APR_SUCCESS; } return stat; diff --git a/libs/apr/locks/netware/proc_mutex.c b/libs/apr/locks/netware/proc_mutex.c index 77411d0bf2..31bbd9ca05 100644 --- a/libs/apr/locks/netware/proc_mutex.c +++ b/libs/apr/locks/netware/proc_mutex.c @@ -14,27 +14,27 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_portable.h" -#include "apr_arch_proc_mutex.h" -#include "apr_arch_thread_mutex.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_portable.h" +#include "fspr_arch_proc_mutex.h" +#include "fspr_arch_thread_mutex.h" -APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_create(fspr_proc_mutex_t **mutex, const char *fname, - apr_lockmech_e mech, - apr_pool_t *pool) + fspr_lockmech_e mech, + fspr_pool_t *pool) { - apr_status_t ret; - apr_proc_mutex_t *new_mutex = NULL; - new_mutex = (apr_proc_mutex_t *)apr_pcalloc(pool, sizeof(apr_proc_mutex_t)); + fspr_status_t ret; + fspr_proc_mutex_t *new_mutex = NULL; + new_mutex = (fspr_proc_mutex_t *)fspr_pcalloc(pool, sizeof(fspr_proc_mutex_t)); if(new_mutex ==NULL) { return APR_ENOMEM; } new_mutex->pool = pool; - ret = apr_thread_mutex_create(&(new_mutex->mutex), APR_THREAD_MUTEX_DEFAULT, pool); + ret = fspr_thread_mutex_create(&(new_mutex->mutex), APR_THREAD_MUTEX_DEFAULT, pool); if (ret == APR_SUCCESS) *mutex = new_mutex; @@ -42,76 +42,76 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, return ret; } -APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_child_init(fspr_proc_mutex_t **mutex, const char *fname, - apr_pool_t *pool) + fspr_pool_t *pool) { return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_lock(fspr_proc_mutex_t *mutex) { if (mutex) - return apr_thread_mutex_lock(mutex->mutex); + return fspr_thread_mutex_lock(mutex->mutex); return APR_ENOLOCK; } -APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_trylock(fspr_proc_mutex_t *mutex) { if (mutex) - return apr_thread_mutex_trylock(mutex->mutex); + return fspr_thread_mutex_trylock(mutex->mutex); return APR_ENOLOCK; } -APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_unlock(fspr_proc_mutex_t *mutex) { if (mutex) - return apr_thread_mutex_unlock(mutex->mutex); + return fspr_thread_mutex_unlock(mutex->mutex); return APR_ENOLOCK; } -APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_cleanup(void *mutex) { - return apr_proc_mutex_destroy(mutex); + return fspr_proc_mutex_destroy(mutex); } -APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_destroy(fspr_proc_mutex_t *mutex) { if (mutex) - return apr_thread_mutex_destroy(mutex->mutex); + return fspr_thread_mutex_destroy(mutex->mutex); return APR_ENOLOCK; } -APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_lockfile(fspr_proc_mutex_t *mutex) { return NULL; } -APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_name(fspr_proc_mutex_t *mutex) { return "netwarethread"; } -APR_DECLARE(const char *) apr_proc_mutex_defname(void) +APR_DECLARE(const char *) fspr_proc_mutex_defname(void) { return "netwarethread"; } APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex) -/* Implement OS-specific accessors defined in apr_portable.h */ +/* Implement OS-specific accessors defined in fspr_portable.h */ -apr_status_t apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, - apr_proc_mutex_t *pmutex) +fspr_status_t fspr_os_proc_mutex_get(fspr_os_proc_mutex_t *ospmutex, + fspr_proc_mutex_t *pmutex) { if (pmutex) ospmutex = pmutex->mutex->mutex; return APR_ENOLOCK; } -apr_status_t apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, - apr_os_proc_mutex_t *ospmutex, - apr_pool_t *pool) +fspr_status_t fspr_os_proc_mutex_put(fspr_proc_mutex_t **pmutex, + fspr_os_proc_mutex_t *ospmutex, + fspr_pool_t *pool) { return APR_ENOTIMPL; } diff --git a/libs/apr/locks/netware/thread_cond.c b/libs/apr/locks/netware/thread_cond.c index dcb21edc9e..19f4649fe5 100644 --- a/libs/apr/locks/netware/thread_cond.c +++ b/libs/apr/locks/netware/thread_cond.c @@ -16,28 +16,28 @@ #include -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_arch_thread_mutex.h" -#include "apr_arch_thread_cond.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_arch_thread_cond.h" +#include "fspr_portable.h" -static apr_status_t thread_cond_cleanup(void *data) +static fspr_status_t thread_cond_cleanup(void *data) { - apr_thread_cond_t *cond = (apr_thread_cond_t *)data; + fspr_thread_cond_t *cond = (fspr_thread_cond_t *)data; NXCondFree(cond->cond); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_cond_create(fspr_thread_cond_t **cond, + fspr_pool_t *pool) { - apr_thread_cond_t *new_cond = NULL; + fspr_thread_cond_t *new_cond = NULL; - new_cond = (apr_thread_cond_t *)apr_pcalloc(pool, sizeof(apr_thread_cond_t)); + new_cond = (fspr_thread_cond_t *)fspr_pcalloc(pool, sizeof(fspr_thread_cond_t)); if(new_cond ==NULL) { return APR_ENOMEM; @@ -49,24 +49,24 @@ APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, if(new_cond->cond == NULL) return APR_ENOMEM; - apr_pool_cleanup_register(new_cond->pool, new_cond, + fspr_pool_cleanup_register(new_cond->pool, new_cond, (void*)thread_cond_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_null); *cond = new_cond; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_cond_wait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex) { if (NXCondWait(cond->cond, mutex->mutex) != 0) return APR_EINTR; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex, - apr_interval_time_t timeout){ +APR_DECLARE(fspr_status_t) fspr_thread_cond_timedwait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex, + fspr_interval_time_t timeout){ if (NXCondTimedWait(cond->cond, mutex->mutex, (timeout*1000)/NXGetSystemTick()) == NX_ETIMEDOUT) { return APR_TIMEUP; @@ -74,23 +74,23 @@ APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_signal(fspr_thread_cond_t *cond) { NXCondSignal(cond->cond); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_broadcast(fspr_thread_cond_t *cond) { NXCondBroadcast(cond->cond); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_destroy(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_destroy(fspr_thread_cond_t *cond) { - apr_status_t stat; + fspr_status_t stat; if ((stat = thread_cond_cleanup(cond)) == APR_SUCCESS) { - apr_pool_cleanup_kill(cond->pool, cond, thread_cond_cleanup); + fspr_pool_cleanup_kill(cond->pool, cond, thread_cond_cleanup); return APR_SUCCESS; } return stat; diff --git a/libs/apr/locks/netware/thread_mutex.c b/libs/apr/locks/netware/thread_mutex.c index 98bf33bd22..8607211a4b 100644 --- a/libs/apr/locks/netware/thread_mutex.c +++ b/libs/apr/locks/netware/thread_mutex.c @@ -14,33 +14,33 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_arch_thread_mutex.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_portable.h" -static apr_status_t thread_mutex_cleanup(void *data) +static fspr_status_t thread_mutex_cleanup(void *data) { - apr_thread_mutex_t *mutex = (apr_thread_mutex_t *)data; + fspr_thread_mutex_t *mutex = (fspr_thread_mutex_t *)data; NXMutexFree(mutex->mutex); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_thread_mutex_create(fspr_thread_mutex_t **mutex, unsigned int flags, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_thread_mutex_t *new_mutex = NULL; + fspr_thread_mutex_t *new_mutex = NULL; /* XXX: Implement _UNNESTED flavor and favor _DEFAULT for performance */ if (flags & APR_THREAD_MUTEX_UNNESTED) { return APR_ENOTIMPL; } - new_mutex = (apr_thread_mutex_t *)apr_pcalloc(pool, sizeof(apr_thread_mutex_t)); + new_mutex = (fspr_thread_mutex_t *)fspr_pcalloc(pool, sizeof(fspr_thread_mutex_t)); if(new_mutex ==NULL) { return APR_ENOMEM; @@ -52,37 +52,37 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, if(new_mutex->mutex == NULL) return APR_ENOMEM; - apr_pool_cleanup_register(new_mutex->pool, new_mutex, + fspr_pool_cleanup_register(new_mutex->pool, new_mutex, (void*)thread_mutex_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_null); *mutex = new_mutex; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_lock(fspr_thread_mutex_t *mutex) { NXLock(mutex->mutex); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_trylock(fspr_thread_mutex_t *mutex) { if (!NXTryLock(mutex->mutex)) return APR_EBUSY; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_unlock(fspr_thread_mutex_t *mutex) { NXUnlock(mutex->mutex); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_destroy(fspr_thread_mutex_t *mutex) { - apr_status_t stat; + fspr_status_t stat; if ((stat = thread_mutex_cleanup(mutex)) == APR_SUCCESS) { - apr_pool_cleanup_kill(mutex->pool, mutex, thread_mutex_cleanup); + fspr_pool_cleanup_kill(mutex->pool, mutex, thread_mutex_cleanup); return APR_SUCCESS; } return stat; diff --git a/libs/apr/locks/netware/thread_rwlock.c b/libs/apr/locks/netware/thread_rwlock.c index d0bf3ddf34..d0f094d2df 100644 --- a/libs/apr/locks/netware/thread_rwlock.c +++ b/libs/apr/locks/netware/thread_rwlock.c @@ -14,85 +14,85 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_arch_thread_rwlock.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_arch_thread_rwlock.h" +#include "fspr_portable.h" -static apr_status_t thread_rwlock_cleanup(void *data) +static fspr_status_t thread_rwlock_cleanup(void *data) { - apr_thread_rwlock_t *rwlock = (apr_thread_rwlock_t *)data; + fspr_thread_rwlock_t *rwlock = (fspr_thread_rwlock_t *)data; NXRwLockFree (rwlock->rwlock); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_create(fspr_thread_rwlock_t **rwlock, + fspr_pool_t *pool) { - apr_thread_rwlock_t *new_rwlock = NULL; + fspr_thread_rwlock_t *new_rwlock = NULL; NXHierarchy_t hierarchy = 1; //for libc NKS NXRwLockAlloc NXLockInfo_t *info; //for libc NKS NXRwLockAlloc - new_rwlock = (apr_thread_rwlock_t *)apr_pcalloc(pool, sizeof(apr_thread_rwlock_t)); + new_rwlock = (fspr_thread_rwlock_t *)fspr_pcalloc(pool, sizeof(fspr_thread_rwlock_t)); if(new_rwlock ==NULL) { return APR_ENOMEM; } new_rwlock->pool = pool; - info = (NXLockInfo_t *)apr_pcalloc(pool, sizeof(NXLockInfo_t)); + info = (NXLockInfo_t *)fspr_pcalloc(pool, sizeof(NXLockInfo_t)); new_rwlock->rwlock = NXRwLockAlloc(hierarchy, info); if(new_rwlock->rwlock == NULL) return APR_ENOMEM; - apr_pool_cleanup_register(new_rwlock->pool, new_rwlock, thread_rwlock_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_rwlock->pool, new_rwlock, thread_rwlock_cleanup, + fspr_pool_cleanup_null); *rwlock = new_rwlock; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_rdlock(fspr_thread_rwlock_t *rwlock) { NXRdLock(rwlock->rwlock); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_tryrdlock(fspr_thread_rwlock_t *rwlock) { if (!NXTryRdLock(rwlock->rwlock)) return APR_EBUSY; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_wrlock(fspr_thread_rwlock_t *rwlock) { NXWrLock(rwlock->rwlock); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_trywrlock(fspr_thread_rwlock_t *rwlock) { if (!NXTryWrLock(rwlock->rwlock)) return APR_EBUSY; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_unlock(fspr_thread_rwlock_t *rwlock) { NXRwUnlock(rwlock->rwlock); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_destroy(fspr_thread_rwlock_t *rwlock) { - apr_status_t stat; + fspr_status_t stat; if ((stat = thread_rwlock_cleanup(rwlock)) == APR_SUCCESS) { - apr_pool_cleanup_kill(rwlock->pool, rwlock, thread_rwlock_cleanup); + fspr_pool_cleanup_kill(rwlock->pool, rwlock, thread_rwlock_cleanup); return APR_SUCCESS; } return stat; diff --git a/libs/apr/locks/os2/proc_mutex.c b/libs/apr/locks/os2/proc_mutex.c index 5a49356355..695dc0931e 100644 --- a/libs/apr/locks/os2/proc_mutex.c +++ b/libs/apr/locks/os2/proc_mutex.c @@ -14,18 +14,18 @@ * limitations under the License. */ -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_arch_proc_mutex.h" -#include "apr_arch_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_arch_proc_mutex.h" +#include "fspr_arch_file_io.h" #include #include #define CurrentTid (*_threadid) -static char *fixed_name(const char *fname, apr_pool_t *pool) +static char *fixed_name(const char *fname, fspr_pool_t *pool) { char *semname; @@ -37,7 +37,7 @@ static char *fixed_name(const char *fname, apr_pool_t *pool) fname++; } - semname = apr_pstrcat(pool, "/SEM32/", fname, NULL); + semname = fspr_pstrcat(pool, "/SEM32/", fname, NULL); if (semname[8] == ':') { semname[8] = '$'; @@ -49,34 +49,34 @@ static char *fixed_name(const char *fname, apr_pool_t *pool) -APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *vmutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_cleanup(void *vmutex) { - apr_proc_mutex_t *mutex = vmutex; - return apr_proc_mutex_destroy(mutex); + fspr_proc_mutex_t *mutex = vmutex; + return fspr_proc_mutex_destroy(mutex); } -APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_lockfile(fspr_proc_mutex_t *mutex) { return NULL; } -APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_name(fspr_proc_mutex_t *mutex) { return "os2sem"; } -APR_DECLARE(const char *) apr_proc_mutex_defname(void) +APR_DECLARE(const char *) fspr_proc_mutex_defname(void) { return "os2sem"; } -APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_create(fspr_proc_mutex_t **mutex, const char *fname, - apr_lockmech_e mech, - apr_pool_t *pool) + fspr_lockmech_e mech, + fspr_pool_t *pool) { - apr_proc_mutex_t *new; + fspr_proc_mutex_t *new; ULONG rc; char *semname; @@ -84,7 +84,7 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, return APR_ENOTIMPL; } - new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t)); + new = (fspr_proc_mutex_t *)fspr_palloc(pool, sizeof(fspr_proc_mutex_t)); new->pool = pool; new->owner = 0; new->lock_count = 0; @@ -94,7 +94,7 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, rc = DosCreateMutexSem(semname, &(new->hMutex), DC_SEM_SHARED, FALSE); if (!rc) { - apr_pool_cleanup_register(pool, new, apr_proc_mutex_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, new, fspr_proc_mutex_cleanup, fspr_pool_cleanup_null); } return APR_FROM_OS_ERROR(rc); @@ -102,15 +102,15 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, -APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_child_init(fspr_proc_mutex_t **mutex, const char *fname, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_proc_mutex_t *new; + fspr_proc_mutex_t *new; ULONG rc; char *semname; - new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t)); + new = (fspr_proc_mutex_t *)fspr_palloc(pool, sizeof(fspr_proc_mutex_t)); new->pool = pool; new->owner = 0; new->lock_count = 0; @@ -120,7 +120,7 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, *mutex = new; if (!rc) { - apr_pool_cleanup_register(pool, new, apr_proc_mutex_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, new, fspr_proc_mutex_cleanup, fspr_pool_cleanup_null); } return APR_FROM_OS_ERROR(rc); @@ -128,7 +128,7 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, -APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_lock(fspr_proc_mutex_t *mutex) { ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_INDEFINITE_WAIT); @@ -142,7 +142,7 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex) -APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_trylock(fspr_proc_mutex_t *mutex) { ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_IMMEDIATE_RETURN); @@ -156,7 +156,7 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) -APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_unlock(fspr_proc_mutex_t *mutex) { ULONG rc; @@ -171,14 +171,14 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) -APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_destroy(fspr_proc_mutex_t *mutex) { ULONG rc; - apr_status_t status = APR_SUCCESS; + fspr_status_t status = APR_SUCCESS; if (mutex->owner == CurrentTid) { while (mutex->lock_count > 0 && status == APR_SUCCESS) { - status = apr_proc_mutex_unlock(mutex); + status = fspr_proc_mutex_unlock(mutex); } } @@ -205,10 +205,10 @@ APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex) -/* Implement OS-specific accessors defined in apr_portable.h */ +/* Implement OS-specific accessors defined in fspr_portable.h */ -APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, - apr_proc_mutex_t *pmutex) +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_get(fspr_os_proc_mutex_t *ospmutex, + fspr_proc_mutex_t *pmutex) { *ospmutex = pmutex->hMutex; return APR_ENOTIMPL; @@ -216,13 +216,13 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, -APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, - apr_os_proc_mutex_t *ospmutex, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_put(fspr_proc_mutex_t **pmutex, + fspr_os_proc_mutex_t *ospmutex, + fspr_pool_t *pool) { - apr_proc_mutex_t *new; + fspr_proc_mutex_t *new; - new = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t)); + new = (fspr_proc_mutex_t *)fspr_palloc(pool, sizeof(fspr_proc_mutex_t)); new->pool = pool; new->owner = 0; new->lock_count = 0; diff --git a/libs/apr/locks/os2/thread_cond.c b/libs/apr/locks/os2/thread_cond.c index ec6034f55d..509d159363 100644 --- a/libs/apr/locks/os2/thread_cond.c +++ b/libs/apr/locks/os2/thread_cond.c @@ -14,44 +14,44 @@ * limitations under the License. */ -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_arch_thread_mutex.h" -#include "apr_arch_thread_cond.h" -#include "apr_arch_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_arch_thread_cond.h" +#include "fspr_arch_file_io.h" #include -APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_cond_create(fspr_thread_cond_t **cond, + fspr_pool_t *pool) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_cond_wait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex, - apr_interval_time_t timeout){ +APR_DECLARE(fspr_status_t) fspr_thread_cond_timedwait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex, + fspr_interval_time_t timeout){ return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_signal(fspr_thread_cond_t *cond) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_broadcast(fspr_thread_cond_t *cond) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_cond_destroy(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_destroy(fspr_thread_cond_t *cond) { return APR_ENOTIMPL; } diff --git a/libs/apr/locks/os2/thread_mutex.c b/libs/apr/locks/os2/thread_mutex.c index 5d8436be4f..873820ded2 100644 --- a/libs/apr/locks/os2/thread_mutex.c +++ b/libs/apr/locks/os2/thread_mutex.c @@ -14,19 +14,19 @@ * limitations under the License. */ -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_arch_thread_mutex.h" -#include "apr_arch_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_arch_file_io.h" #include #include -static apr_status_t thread_mutex_cleanup(void *themutex) +static fspr_status_t thread_mutex_cleanup(void *themutex) { - apr_thread_mutex_t *mutex = themutex; - return apr_thread_mutex_destroy(mutex); + fspr_thread_mutex_t *mutex = themutex; + return fspr_thread_mutex_destroy(mutex); } @@ -34,28 +34,28 @@ static apr_status_t thread_mutex_cleanup(void *themutex) /* XXX: Need to respect APR_THREAD_MUTEX_[UN]NESTED flags argument * or return APR_ENOTIMPL!!! */ -APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_thread_mutex_create(fspr_thread_mutex_t **mutex, unsigned int flags, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_thread_mutex_t *new_mutex; + fspr_thread_mutex_t *new_mutex; ULONG rc; - new_mutex = (apr_thread_mutex_t *)apr_palloc(pool, sizeof(apr_thread_mutex_t)); + new_mutex = (fspr_thread_mutex_t *)fspr_palloc(pool, sizeof(fspr_thread_mutex_t)); new_mutex->pool = pool; rc = DosCreateMutexSem(NULL, &(new_mutex->hMutex), 0, FALSE); *mutex = new_mutex; if (!rc) - apr_pool_cleanup_register(pool, new_mutex, thread_mutex_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, new_mutex, thread_mutex_cleanup, fspr_pool_cleanup_null); return APR_OS2_STATUS(rc); } -APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_lock(fspr_thread_mutex_t *mutex) { ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_INDEFINITE_WAIT); return APR_OS2_STATUS(rc); @@ -63,7 +63,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) -APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_trylock(fspr_thread_mutex_t *mutex) { ULONG rc = DosRequestMutexSem(mutex->hMutex, SEM_IMMEDIATE_RETURN); return APR_OS2_STATUS(rc); @@ -71,7 +71,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) -APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_unlock(fspr_thread_mutex_t *mutex) { ULONG rc = DosReleaseMutexSem(mutex->hMutex); return APR_OS2_STATUS(rc); @@ -79,7 +79,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) -APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_destroy(fspr_thread_mutex_t *mutex) { ULONG rc; diff --git a/libs/apr/locks/os2/thread_rwlock.c b/libs/apr/locks/os2/thread_rwlock.c index 195a56bda3..6d7ad2280f 100644 --- a/libs/apr/locks/os2/thread_rwlock.c +++ b/libs/apr/locks/os2/thread_rwlock.c @@ -14,29 +14,29 @@ * limitations under the License. */ -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_arch_thread_rwlock.h" -#include "apr_arch_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_arch_thread_rwlock.h" +#include "fspr_arch_file_io.h" #include -static apr_status_t thread_rwlock_cleanup(void *therwlock) +static fspr_status_t thread_rwlock_cleanup(void *therwlock) { - apr_thread_rwlock_t *rwlock = therwlock; - return apr_thread_rwlock_destroy(rwlock); + fspr_thread_rwlock_t *rwlock = therwlock; + return fspr_thread_rwlock_destroy(rwlock); } -APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_create(fspr_thread_rwlock_t **rwlock, + fspr_pool_t *pool) { - apr_thread_rwlock_t *new_rwlock; + fspr_thread_rwlock_t *new_rwlock; ULONG rc; - new_rwlock = (apr_thread_rwlock_t *)apr_palloc(pool, sizeof(apr_thread_rwlock_t)); + new_rwlock = (fspr_thread_rwlock_t *)fspr_palloc(pool, sizeof(fspr_thread_rwlock_t)); new_rwlock->pool = pool; new_rwlock->readers = 0; @@ -53,15 +53,15 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, *rwlock = new_rwlock; if (!rc) - apr_pool_cleanup_register(pool, new_rwlock, thread_rwlock_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, new_rwlock, thread_rwlock_cleanup, + fspr_pool_cleanup_null); return APR_FROM_OS_ERROR(rc); } -APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_rdlock(fspr_thread_rwlock_t *rwlock) { ULONG rc, posts; @@ -82,7 +82,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) -APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_tryrdlock(fspr_thread_rwlock_t *rwlock) { /* As above but with different wait time */ ULONG rc, posts; @@ -100,7 +100,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwloc -APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_wrlock(fspr_thread_rwlock_t *rwlock) { ULONG rc; @@ -125,7 +125,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) -APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_trywrlock(fspr_thread_rwlock_t *rwlock) { ULONG rc; @@ -149,7 +149,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwloc -APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_unlock(fspr_thread_rwlock_t *rwlock) { ULONG rc; @@ -176,7 +176,7 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) -APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_destroy(fspr_thread_rwlock_t *rwlock) { ULONG rc; diff --git a/libs/apr/locks/unix/global_mutex.c b/libs/apr/locks/unix/global_mutex.c index bfe360aa99..193482a62d 100644 --- a/libs/apr/locks/unix/global_mutex.c +++ b/libs/apr/locks/unix/global_mutex.c @@ -14,27 +14,27 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_strings.h" -#include "apr_arch_global_mutex.h" -#include "apr_proc_mutex.h" -#include "apr_thread_mutex.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_strings.h" +#include "fspr_arch_global_mutex.h" +#include "fspr_proc_mutex.h" +#include "fspr_thread_mutex.h" +#include "fspr_portable.h" -static apr_status_t global_mutex_cleanup(void *data) +static fspr_status_t global_mutex_cleanup(void *data) { - apr_global_mutex_t *m = (apr_global_mutex_t *)data; - apr_status_t rv; + fspr_global_mutex_t *m = (fspr_global_mutex_t *)data; + fspr_status_t rv; - rv = apr_proc_mutex_destroy(m->proc_mutex); + rv = fspr_proc_mutex_destroy(m->proc_mutex); #if APR_HAS_THREADS if (m->thread_mutex) { if (rv != APR_SUCCESS) { - (void)apr_thread_mutex_destroy(m->thread_mutex); + (void)fspr_thread_mutex_destroy(m->thread_mutex); } else { - rv = apr_thread_mutex_destroy(m->thread_mutex); + rv = fspr_thread_mutex_destroy(m->thread_mutex); } } #endif /* APR_HAS_THREADS */ @@ -42,18 +42,18 @@ static apr_status_t global_mutex_cleanup(void *data) return rv; } -APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_global_mutex_create(fspr_global_mutex_t **mutex, const char *fname, - apr_lockmech_e mech, - apr_pool_t *pool) + fspr_lockmech_e mech, + fspr_pool_t *pool) { - apr_status_t rv; - apr_global_mutex_t *m; + fspr_status_t rv; + fspr_global_mutex_t *m; - m = (apr_global_mutex_t *)apr_palloc(pool, sizeof(*m)); + m = (fspr_global_mutex_t *)fspr_palloc(pool, sizeof(*m)); m->pool = pool; - rv = apr_proc_mutex_create(&m->proc_mutex, fname, mech, m->pool); + rv = fspr_proc_mutex_create(&m->proc_mutex, fname, mech, m->pool); if (rv != APR_SUCCESS) { return rv; } @@ -63,51 +63,51 @@ APR_DECLARE(apr_status_t) apr_global_mutex_create(apr_global_mutex_t **mutex, m->thread_mutex = NULL; /* We don't need a thread lock. */ } else { - rv = apr_thread_mutex_create(&m->thread_mutex, + rv = fspr_thread_mutex_create(&m->thread_mutex, APR_THREAD_MUTEX_DEFAULT, m->pool); if (rv != APR_SUCCESS) { - rv = apr_proc_mutex_destroy(m->proc_mutex); + rv = fspr_proc_mutex_destroy(m->proc_mutex); return rv; } } #endif /* APR_HAS_THREADS */ - apr_pool_cleanup_register(m->pool, (void *)m, - global_mutex_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(m->pool, (void *)m, + global_mutex_cleanup, fspr_pool_cleanup_null); *mutex = m; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_global_mutex_child_init( - apr_global_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_global_mutex_child_init( + fspr_global_mutex_t **mutex, const char *fname, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_proc_mutex_child_init(&((*mutex)->proc_mutex), fname, pool); + rv = fspr_proc_mutex_child_init(&((*mutex)->proc_mutex), fname, pool); return rv; } -APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_global_mutex_lock(fspr_global_mutex_t *mutex) { - apr_status_t rv; + fspr_status_t rv; #if APR_HAS_THREADS if (mutex->thread_mutex) { - rv = apr_thread_mutex_lock(mutex->thread_mutex); + rv = fspr_thread_mutex_lock(mutex->thread_mutex); if (rv != APR_SUCCESS) { return rv; } } #endif /* APR_HAS_THREADS */ - rv = apr_proc_mutex_lock(mutex->proc_mutex); + rv = fspr_proc_mutex_lock(mutex->proc_mutex); #if APR_HAS_THREADS if (rv != APR_SUCCESS) { if (mutex->thread_mutex) { - (void)apr_thread_mutex_unlock(mutex->thread_mutex); + (void)fspr_thread_mutex_unlock(mutex->thread_mutex); } } #endif /* APR_HAS_THREADS */ @@ -115,25 +115,25 @@ APR_DECLARE(apr_status_t) apr_global_mutex_lock(apr_global_mutex_t *mutex) return rv; } -APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_global_mutex_trylock(fspr_global_mutex_t *mutex) { - apr_status_t rv; + fspr_status_t rv; #if APR_HAS_THREADS if (mutex->thread_mutex) { - rv = apr_thread_mutex_trylock(mutex->thread_mutex); + rv = fspr_thread_mutex_trylock(mutex->thread_mutex); if (rv != APR_SUCCESS) { return rv; } } #endif /* APR_HAS_THREADS */ - rv = apr_proc_mutex_trylock(mutex->proc_mutex); + rv = fspr_proc_mutex_trylock(mutex->proc_mutex); #if APR_HAS_THREADS if (rv != APR_SUCCESS) { if (mutex->thread_mutex) { - (void)apr_thread_mutex_unlock(mutex->thread_mutex); + (void)fspr_thread_mutex_unlock(mutex->thread_mutex); } } #endif /* APR_HAS_THREADS */ @@ -141,26 +141,26 @@ APR_DECLARE(apr_status_t) apr_global_mutex_trylock(apr_global_mutex_t *mutex) return rv; } -APR_DECLARE(apr_status_t) apr_global_mutex_unlock(apr_global_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_global_mutex_unlock(fspr_global_mutex_t *mutex) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_proc_mutex_unlock(mutex->proc_mutex); + rv = fspr_proc_mutex_unlock(mutex->proc_mutex); #if APR_HAS_THREADS if (mutex->thread_mutex) { if (rv != APR_SUCCESS) { - (void)apr_thread_mutex_unlock(mutex->thread_mutex); + (void)fspr_thread_mutex_unlock(mutex->thread_mutex); } else { - rv = apr_thread_mutex_unlock(mutex->thread_mutex); + rv = fspr_thread_mutex_unlock(mutex->thread_mutex); } } #endif /* APR_HAS_THREADS */ return rv; } -APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmutex, - apr_global_mutex_t *pmutex) +APR_DECLARE(fspr_status_t) fspr_os_global_mutex_get(fspr_os_global_mutex_t *ospmutex, + fspr_global_mutex_t *pmutex) { ospmutex->pool = pmutex->pool; ospmutex->proc_mutex = pmutex->proc_mutex; @@ -170,9 +170,9 @@ APR_DECLARE(apr_status_t) apr_os_global_mutex_get(apr_os_global_mutex_t *ospmute return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_global_mutex_destroy(apr_global_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_global_mutex_destroy(fspr_global_mutex_t *mutex) { - return apr_pool_cleanup_run(mutex->pool, mutex, global_mutex_cleanup); + return fspr_pool_cleanup_run(mutex->pool, mutex, global_mutex_cleanup); } APR_POOL_IMPLEMENT_ACCESSOR(global_mutex) diff --git a/libs/apr/locks/unix/proc_mutex.c b/libs/apr/locks/unix/proc_mutex.c index 579bb8af4d..cebceadf7c 100644 --- a/libs/apr/locks/unix/proc_mutex.c +++ b/libs/apr/locks/unix/proc_mutex.c @@ -14,25 +14,25 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_strings.h" -#include "apr_arch_proc_mutex.h" -#include "apr_arch_file_io.h" /* for apr_mkstemp() */ +#include "fspr.h" +#include "fspr_strings.h" +#include "fspr_arch_proc_mutex.h" +#include "fspr_arch_file_io.h" /* for fspr_mkstemp() */ -APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_destroy(fspr_proc_mutex_t *mutex) { - return apr_pool_cleanup_run(mutex->pool, mutex, apr_proc_mutex_cleanup); + return fspr_pool_cleanup_run(mutex->pool, mutex, fspr_proc_mutex_cleanup); } -static apr_status_t proc_mutex_no_tryacquire(apr_proc_mutex_t *new_mutex) +static fspr_status_t proc_mutex_no_tryacquire(fspr_proc_mutex_t *new_mutex) { return APR_ENOTIMPL; } #if APR_HAS_POSIXSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || \ APR_HAS_PROC_PTHREAD_SERIALIZE || APR_HAS_SYSVSEM_SERIALIZE -static apr_status_t proc_mutex_no_child_init(apr_proc_mutex_t **mutex, - apr_pool_t *cont, +static fspr_status_t proc_mutex_no_child_init(fspr_proc_mutex_t **mutex, + fspr_pool_t *cont, const char *fname) { return APR_SUCCESS; @@ -45,9 +45,9 @@ static apr_status_t proc_mutex_no_child_init(apr_proc_mutex_t **mutex, #define SEM_FAILED (-1) #endif -static apr_status_t proc_mutex_posix_cleanup(void *mutex_) +static fspr_status_t proc_mutex_posix_cleanup(void *mutex_) { - apr_proc_mutex_t *mutex = mutex_; + fspr_proc_mutex_t *mutex = mutex_; if (sem_close(mutex->psem_interproc) < 0) { return errno; @@ -56,16 +56,16 @@ static apr_status_t proc_mutex_posix_cleanup(void *mutex_) return APR_SUCCESS; } -static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex, +static fspr_status_t proc_mutex_posix_create(fspr_proc_mutex_t *new_mutex, const char *fname) { sem_t *psem; char semname[31]; - apr_time_t now; + fspr_time_t now; unsigned long sec; unsigned long usec; - new_mutex->interproc = apr_palloc(new_mutex->pool, + new_mutex->interproc = fspr_palloc(new_mutex->pool, sizeof(*new_mutex->interproc)); /* * This bogusness is to follow what appears to be the @@ -92,10 +92,10 @@ static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex, * help here however... * */ - now = apr_time_now(); - sec = apr_time_sec(now); - usec = apr_time_usec(now); - apr_snprintf(semname, sizeof(semname), "/ApR.%lxZ%lx", sec, usec); + now = fspr_time_now(); + sec = fspr_time_sec(now); + usec = fspr_time_usec(now); + fspr_snprintf(semname, sizeof(semname), "/ApR.%lxZ%lx", sec, usec); psem = sem_open(semname, O_CREAT, 0644, 1); if ((psem == (sem_t *)SEM_FAILED) && (errno == ENAMETOOLONG)) { /* Oh well, good try */ @@ -109,14 +109,14 @@ static apr_status_t proc_mutex_posix_create(apr_proc_mutex_t *new_mutex, /* Ahhh. The joys of Posix sems. Predelete it... */ sem_unlink(semname); new_mutex->psem_interproc = psem; - new_mutex->fname = apr_pstrdup(new_mutex->pool, semname); - apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex, - apr_proc_mutex_cleanup, - apr_pool_cleanup_null); + new_mutex->fname = fspr_pstrdup(new_mutex->pool, semname); + fspr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex, + fspr_proc_mutex_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -static apr_status_t proc_mutex_posix_acquire(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_posix_acquire(fspr_proc_mutex_t *mutex) { if (sem_wait(mutex->psem_interproc) < 0) { return errno; @@ -125,7 +125,7 @@ static apr_status_t proc_mutex_posix_acquire(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static apr_status_t proc_mutex_posix_release(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_posix_release(fspr_proc_mutex_t *mutex) { mutex->curr_locked = 0; if (sem_post(mutex->psem_interproc) < 0) { @@ -136,7 +136,7 @@ static apr_status_t proc_mutex_posix_release(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static const apr_proc_mutex_unix_lock_methods_t mutex_posixsem_methods = +static const fspr_proc_mutex_unix_lock_methods_t mutex_posixsem_methods = { #if APR_PROCESS_LOCK_IS_GLOBAL || !APR_HAS_THREADS || defined(POSIXSEM_IS_GLOBAL) APR_PROCESS_LOCK_MECH_IS_GLOBAL, @@ -169,9 +169,9 @@ static void proc_mutex_sysv_setup(void) proc_mutex_op_off.sem_flg = SEM_UNDO; } -static apr_status_t proc_mutex_sysv_cleanup(void *mutex_) +static fspr_status_t proc_mutex_sysv_cleanup(void *mutex_) { - apr_proc_mutex_t *mutex=mutex_; + fspr_proc_mutex_t *mutex=mutex_; union semun ick; if (mutex->interproc->filedes != -1) { @@ -181,13 +181,13 @@ static apr_status_t proc_mutex_sysv_cleanup(void *mutex_) return APR_SUCCESS; } -static apr_status_t proc_mutex_sysv_create(apr_proc_mutex_t *new_mutex, +static fspr_status_t proc_mutex_sysv_create(fspr_proc_mutex_t *new_mutex, const char *fname) { union semun ick; - apr_status_t rv; + fspr_status_t rv; - new_mutex->interproc = apr_palloc(new_mutex->pool, sizeof(*new_mutex->interproc)); + new_mutex->interproc = fspr_palloc(new_mutex->pool, sizeof(*new_mutex->interproc)); new_mutex->interproc->filedes = semget(IPC_PRIVATE, 1, IPC_CREAT | 0600); if (new_mutex->interproc->filedes < 0) { @@ -202,13 +202,13 @@ static apr_status_t proc_mutex_sysv_create(apr_proc_mutex_t *new_mutex, return rv; } new_mutex->curr_locked = 0; - apr_pool_cleanup_register(new_mutex->pool, - (void *)new_mutex, apr_proc_mutex_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_mutex->pool, + (void *)new_mutex, fspr_proc_mutex_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -static apr_status_t proc_mutex_sysv_acquire(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_sysv_acquire(fspr_proc_mutex_t *mutex) { int rc; @@ -222,7 +222,7 @@ static apr_status_t proc_mutex_sysv_acquire(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static apr_status_t proc_mutex_sysv_release(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_sysv_release(fspr_proc_mutex_t *mutex) { int rc; @@ -236,7 +236,7 @@ static apr_status_t proc_mutex_sysv_release(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static const apr_proc_mutex_unix_lock_methods_t mutex_sysv_methods = +static const fspr_proc_mutex_unix_lock_methods_t mutex_sysv_methods = { #if APR_PROCESS_LOCK_IS_GLOBAL || !APR_HAS_THREADS || defined(SYSVSEM_IS_GLOBAL) APR_PROCESS_LOCK_MECH_IS_GLOBAL, @@ -256,10 +256,10 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_sysv_methods = #if APR_HAS_PROC_PTHREAD_SERIALIZE -static apr_status_t proc_mutex_proc_pthread_cleanup(void *mutex_) +static fspr_status_t proc_mutex_proc_pthread_cleanup(void *mutex_) { - apr_proc_mutex_t *mutex=mutex_; - apr_status_t rv; + fspr_proc_mutex_t *mutex=mutex_; + fspr_status_t rv; if (mutex->curr_locked == 1) { if ((rv = pthread_mutex_unlock(mutex->pthread_interproc))) { @@ -284,10 +284,10 @@ static apr_status_t proc_mutex_proc_pthread_cleanup(void *mutex_) return APR_SUCCESS; } -static apr_status_t proc_mutex_proc_pthread_create(apr_proc_mutex_t *new_mutex, +static fspr_status_t proc_mutex_proc_pthread_create(fspr_proc_mutex_t *new_mutex, const char *fname) { - apr_status_t rv; + fspr_status_t rv; int fd; pthread_mutexattr_t mattr; @@ -364,16 +364,16 @@ static apr_status_t proc_mutex_proc_pthread_create(apr_proc_mutex_t *new_mutex, return rv; } - apr_pool_cleanup_register(new_mutex->pool, + fspr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex, - apr_proc_mutex_cleanup, - apr_pool_cleanup_null); + fspr_proc_mutex_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -static apr_status_t proc_mutex_proc_pthread_acquire(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_proc_pthread_acquire(fspr_proc_mutex_t *mutex) { - apr_status_t rv; + fspr_status_t rv; if ((rv = pthread_mutex_lock(mutex->pthread_interproc))) { #ifdef PTHREAD_SETS_ERRNO @@ -394,11 +394,11 @@ static apr_status_t proc_mutex_proc_pthread_acquire(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -/* TODO: Add proc_mutex_proc_pthread_tryacquire(apr_proc_mutex_t *mutex) */ +/* TODO: Add proc_mutex_proc_pthread_tryacquire(fspr_proc_mutex_t *mutex) */ -static apr_status_t proc_mutex_proc_pthread_release(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_proc_pthread_release(fspr_proc_mutex_t *mutex) { - apr_status_t rv; + fspr_status_t rv; mutex->curr_locked = 0; if ((rv = pthread_mutex_unlock(mutex->pthread_interproc))) { @@ -410,7 +410,7 @@ static apr_status_t proc_mutex_proc_pthread_release(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static const apr_proc_mutex_unix_lock_methods_t mutex_proc_pthread_methods = +static const fspr_proc_mutex_unix_lock_methods_t mutex_proc_pthread_methods = { APR_PROCESS_LOCK_MECH_IS_GLOBAL, proc_mutex_proc_pthread_create, @@ -429,7 +429,7 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_proc_pthread_methods = static struct flock proc_mutex_lock_it; static struct flock proc_mutex_unlock_it; -static apr_status_t proc_mutex_fcntl_release(apr_proc_mutex_t *); +static fspr_status_t proc_mutex_fcntl_release(fspr_proc_mutex_t *); static void proc_mutex_fcntl_setup(void) { @@ -445,10 +445,10 @@ static void proc_mutex_fcntl_setup(void) proc_mutex_unlock_it.l_pid = 0; /* pid not actually interesting */ } -static apr_status_t proc_mutex_fcntl_cleanup(void *mutex_) +static fspr_status_t proc_mutex_fcntl_cleanup(void *mutex_) { - apr_status_t status; - apr_proc_mutex_t *mutex=mutex_; + fspr_status_t status; + fspr_proc_mutex_t *mutex=mutex_; if (mutex->curr_locked == 1) { status = proc_mutex_fcntl_release(mutex); @@ -456,24 +456,24 @@ static apr_status_t proc_mutex_fcntl_cleanup(void *mutex_) return status; } - return apr_file_close(mutex->interproc); + return fspr_file_close(mutex->interproc); } -static apr_status_t proc_mutex_fcntl_create(apr_proc_mutex_t *new_mutex, +static fspr_status_t proc_mutex_fcntl_create(fspr_proc_mutex_t *new_mutex, const char *fname) { int rv; if (fname) { - new_mutex->fname = apr_pstrdup(new_mutex->pool, fname); - rv = apr_file_open(&new_mutex->interproc, new_mutex->fname, + new_mutex->fname = fspr_pstrdup(new_mutex->pool, fname); + rv = fspr_file_open(&new_mutex->interproc, new_mutex->fname, APR_CREATE | APR_WRITE | APR_EXCL, APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD, new_mutex->pool); } else { - new_mutex->fname = apr_pstrdup(new_mutex->pool, "/tmp/aprXXXXXX"); - rv = apr_file_mktemp(&new_mutex->interproc, new_mutex->fname, + new_mutex->fname = fspr_pstrdup(new_mutex->pool, "/tmp/aprXXXXXX"); + rv = fspr_file_mktemp(&new_mutex->interproc, new_mutex->fname, APR_CREATE | APR_WRITE | APR_EXCL, new_mutex->pool); } @@ -484,14 +484,14 @@ static apr_status_t proc_mutex_fcntl_create(apr_proc_mutex_t *new_mutex, new_mutex->curr_locked = 0; unlink(new_mutex->fname); - apr_pool_cleanup_register(new_mutex->pool, + fspr_pool_cleanup_register(new_mutex->pool, (void*)new_mutex, - apr_proc_mutex_cleanup, - apr_pool_cleanup_null); + fspr_proc_mutex_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -static apr_status_t proc_mutex_fcntl_acquire(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_fcntl_acquire(fspr_proc_mutex_t *mutex) { int rc; @@ -505,7 +505,7 @@ static apr_status_t proc_mutex_fcntl_acquire(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static apr_status_t proc_mutex_fcntl_release(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_fcntl_release(fspr_proc_mutex_t *mutex) { int rc; @@ -519,7 +519,7 @@ static apr_status_t proc_mutex_fcntl_release(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static const apr_proc_mutex_unix_lock_methods_t mutex_fcntl_methods = +static const fspr_proc_mutex_unix_lock_methods_t mutex_fcntl_methods = { #if APR_PROCESS_LOCK_IS_GLOBAL || !APR_HAS_THREADS || defined(FCNTL_IS_GLOBAL) APR_PROCESS_LOCK_MECH_IS_GLOBAL, @@ -539,12 +539,12 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_fcntl_methods = #if APR_HAS_FLOCK_SERIALIZE -static apr_status_t proc_mutex_flock_release(apr_proc_mutex_t *); +static fspr_status_t proc_mutex_flock_release(fspr_proc_mutex_t *); -static apr_status_t proc_mutex_flock_cleanup(void *mutex_) +static fspr_status_t proc_mutex_flock_cleanup(void *mutex_) { - apr_status_t status; - apr_proc_mutex_t *mutex=mutex_; + fspr_status_t status; + fspr_proc_mutex_t *mutex=mutex_; if (mutex->curr_locked == 1) { status = proc_mutex_flock_release(mutex); @@ -552,27 +552,27 @@ static apr_status_t proc_mutex_flock_cleanup(void *mutex_) return status; } if (mutex->interproc) { /* if it was opened properly */ - apr_file_close(mutex->interproc); + fspr_file_close(mutex->interproc); } unlink(mutex->fname); return APR_SUCCESS; } -static apr_status_t proc_mutex_flock_create(apr_proc_mutex_t *new_mutex, +static fspr_status_t proc_mutex_flock_create(fspr_proc_mutex_t *new_mutex, const char *fname) { int rv; if (fname) { - new_mutex->fname = apr_pstrdup(new_mutex->pool, fname); - rv = apr_file_open(&new_mutex->interproc, new_mutex->fname, + new_mutex->fname = fspr_pstrdup(new_mutex->pool, fname); + rv = fspr_file_open(&new_mutex->interproc, new_mutex->fname, APR_CREATE | APR_WRITE | APR_EXCL, APR_UREAD | APR_UWRITE, new_mutex->pool); } else { - new_mutex->fname = apr_pstrdup(new_mutex->pool, "/tmp/aprXXXXXX"); - rv = apr_file_mktemp(&new_mutex->interproc, new_mutex->fname, + new_mutex->fname = fspr_pstrdup(new_mutex->pool, "/tmp/aprXXXXXX"); + rv = fspr_file_mktemp(&new_mutex->interproc, new_mutex->fname, APR_CREATE | APR_WRITE | APR_EXCL, new_mutex->pool); } @@ -582,13 +582,13 @@ static apr_status_t proc_mutex_flock_create(apr_proc_mutex_t *new_mutex, return errno; } new_mutex->curr_locked = 0; - apr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex, - apr_proc_mutex_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_mutex->pool, (void *)new_mutex, + fspr_proc_mutex_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -static apr_status_t proc_mutex_flock_acquire(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_flock_acquire(fspr_proc_mutex_t *mutex) { int rc; @@ -602,7 +602,7 @@ static apr_status_t proc_mutex_flock_acquire(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static apr_status_t proc_mutex_flock_release(apr_proc_mutex_t *mutex) +static fspr_status_t proc_mutex_flock_release(fspr_proc_mutex_t *mutex) { int rc; @@ -616,22 +616,22 @@ static apr_status_t proc_mutex_flock_release(apr_proc_mutex_t *mutex) return APR_SUCCESS; } -static apr_status_t proc_mutex_flock_child_init(apr_proc_mutex_t **mutex, - apr_pool_t *pool, +static fspr_status_t proc_mutex_flock_child_init(fspr_proc_mutex_t **mutex, + fspr_pool_t *pool, const char *fname) { - apr_proc_mutex_t *new_mutex; + fspr_proc_mutex_t *new_mutex; int rv; - new_mutex = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t)); + new_mutex = (fspr_proc_mutex_t *)fspr_palloc(pool, sizeof(fspr_proc_mutex_t)); memcpy(new_mutex, *mutex, sizeof *new_mutex); new_mutex->pool = pool; if (!fname) { fname = (*mutex)->fname; } - new_mutex->fname = apr_pstrdup(pool, fname); - rv = apr_file_open(&new_mutex->interproc, new_mutex->fname, + new_mutex->fname = fspr_pstrdup(pool, fname); + rv = fspr_file_open(&new_mutex->interproc, new_mutex->fname, APR_WRITE, 0, new_mutex->pool); if (rv != APR_SUCCESS) { return rv; @@ -640,7 +640,7 @@ static apr_status_t proc_mutex_flock_child_init(apr_proc_mutex_t **mutex, return APR_SUCCESS; } -static const apr_proc_mutex_unix_lock_methods_t mutex_flock_methods = +static const fspr_proc_mutex_unix_lock_methods_t mutex_flock_methods = { #if APR_PROCESS_LOCK_IS_GLOBAL || !APR_HAS_THREADS || defined(FLOCK_IS_GLOBAL) APR_PROCESS_LOCK_MECH_IS_GLOBAL, @@ -658,7 +658,7 @@ static const apr_proc_mutex_unix_lock_methods_t mutex_flock_methods = #endif /* flock implementation */ -void apr_proc_mutex_unix_setup_lock(void) +void fspr_proc_mutex_unix_setup_lock(void) { /* setup only needed for sysvsem and fnctl */ #if APR_HAS_SYSVSEM_SERIALIZE @@ -669,7 +669,7 @@ void apr_proc_mutex_unix_setup_lock(void) #endif } -static apr_status_t proc_mutex_choose_method(apr_proc_mutex_t *new_mutex, apr_lockmech_e mech) +static fspr_status_t proc_mutex_choose_method(fspr_proc_mutex_t *new_mutex, fspr_lockmech_e mech) { switch (mech) { case APR_LOCK_FCNTL: @@ -728,21 +728,21 @@ static apr_status_t proc_mutex_choose_method(apr_proc_mutex_t *new_mutex, apr_lo return APR_SUCCESS; } -APR_DECLARE(const char *) apr_proc_mutex_defname(void) +APR_DECLARE(const char *) fspr_proc_mutex_defname(void) { - apr_proc_mutex_t mutex; + fspr_proc_mutex_t mutex; if (proc_mutex_choose_method(&mutex, APR_LOCK_DEFAULT) != APR_SUCCESS) { return "unknown"; } mutex.meth = mutex.inter_meth; - return apr_proc_mutex_name(&mutex); + return fspr_proc_mutex_name(&mutex); } -static apr_status_t proc_mutex_create(apr_proc_mutex_t *new_mutex, apr_lockmech_e mech, const char *fname) +static fspr_status_t proc_mutex_create(fspr_proc_mutex_t *new_mutex, fspr_lockmech_e mech, const char *fname) { - apr_status_t rv; + fspr_status_t rv; if ((rv = proc_mutex_choose_method(new_mutex, mech)) != APR_SUCCESS) { return rv; @@ -757,15 +757,15 @@ static apr_status_t proc_mutex_create(apr_proc_mutex_t *new_mutex, apr_lockmech_ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_create(fspr_proc_mutex_t **mutex, const char *fname, - apr_lockmech_e mech, - apr_pool_t *pool) + fspr_lockmech_e mech, + fspr_pool_t *pool) { - apr_proc_mutex_t *new_mutex; - apr_status_t rv; + fspr_proc_mutex_t *new_mutex; + fspr_status_t rv; - new_mutex = apr_pcalloc(pool, sizeof(apr_proc_mutex_t)); + new_mutex = fspr_pcalloc(pool, sizeof(fspr_proc_mutex_t)); new_mutex->pool = pool; if ((rv = proc_mutex_create(new_mutex, mech, fname)) != APR_SUCCESS) @@ -775,39 +775,39 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_child_init(fspr_proc_mutex_t **mutex, const char *fname, - apr_pool_t *pool) + fspr_pool_t *pool) { return (*mutex)->meth->child_init(mutex, pool, fname); } -APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_lock(fspr_proc_mutex_t *mutex) { return mutex->meth->acquire(mutex); } -APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_trylock(fspr_proc_mutex_t *mutex) { return mutex->meth->tryacquire(mutex); } -APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_unlock(fspr_proc_mutex_t *mutex) { return mutex->meth->release(mutex); } -APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_cleanup(void *mutex) { - return ((apr_proc_mutex_t *)mutex)->meth->cleanup(mutex); + return ((fspr_proc_mutex_t *)mutex)->meth->cleanup(mutex); } -APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_name(fspr_proc_mutex_t *mutex) { return mutex->meth->name; } -APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_lockfile(fspr_proc_mutex_t *mutex) { /* POSIX sems use the fname field but don't use a file, * so be careful. */ @@ -826,10 +826,10 @@ APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex) APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex) -/* Implement OS-specific accessors defined in apr_portable.h */ +/* Implement OS-specific accessors defined in fspr_portable.h */ -APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, - apr_proc_mutex_t *pmutex) +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_get(fspr_os_proc_mutex_t *ospmutex, + fspr_proc_mutex_t *pmutex) { #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE || APR_HAS_POSIXSEM_SERIALIZE ospmutex->crossproc = pmutex->interproc->filedes; @@ -840,20 +840,20 @@ APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, - apr_os_proc_mutex_t *ospmutex, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_put(fspr_proc_mutex_t **pmutex, + fspr_os_proc_mutex_t *ospmutex, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*pmutex) == NULL) { - (*pmutex) = (apr_proc_mutex_t *)apr_pcalloc(pool, - sizeof(apr_proc_mutex_t)); + (*pmutex) = (fspr_proc_mutex_t *)fspr_pcalloc(pool, + sizeof(fspr_proc_mutex_t)); (*pmutex)->pool = pool; } #if APR_HAS_SYSVSEM_SERIALIZE || APR_HAS_FCNTL_SERIALIZE || APR_HAS_FLOCK_SERIALIZE || APR_HAS_POSIXSEM_SERIALIZE - apr_os_file_put(&(*pmutex)->interproc, &ospmutex->crossproc, 0, pool); + fspr_os_file_put(&(*pmutex)->interproc, &ospmutex->crossproc, 0, pool); #endif #if APR_HAS_PROC_PTHREAD_SERIALIZE (*pmutex)->pthread_interproc = ospmutex->pthread_interproc; diff --git a/libs/apr/locks/unix/thread_cond.c b/libs/apr/locks/unix/thread_cond.c index 227c1d7f64..46f5e88e89 100644 --- a/libs/apr/locks/unix/thread_cond.c +++ b/libs/apr/locks/unix/thread_cond.c @@ -14,17 +14,17 @@ * limitations under the License. */ -#include "apr.h" +#include "fspr.h" #if APR_HAS_THREADS -#include "apr_arch_thread_mutex.h" -#include "apr_arch_thread_cond.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_arch_thread_cond.h" -static apr_status_t thread_cond_cleanup(void *data) +static fspr_status_t thread_cond_cleanup(void *data) { - apr_thread_cond_t *cond = (apr_thread_cond_t *)data; - apr_status_t rv; + fspr_thread_cond_t *cond = (fspr_thread_cond_t *)data; + fspr_status_t rv; rv = pthread_cond_destroy(&cond->cond); #ifdef PTHREAD_SETS_ERRNO @@ -35,13 +35,13 @@ static apr_status_t thread_cond_cleanup(void *data) return rv; } -APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_cond_create(fspr_thread_cond_t **cond, + fspr_pool_t *pool) { - apr_thread_cond_t *new_cond; - apr_status_t rv; + fspr_thread_cond_t *new_cond; + fspr_status_t rv; - new_cond = apr_palloc(pool, sizeof(apr_thread_cond_t)); + new_cond = fspr_palloc(pool, sizeof(fspr_thread_cond_t)); new_cond->pool = pool; @@ -52,18 +52,18 @@ APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, return rv; } - apr_pool_cleanup_register(new_cond->pool, + fspr_pool_cleanup_register(new_cond->pool, (void *)new_cond, thread_cond_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_null); *cond = new_cond; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_cond_wait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex) { - apr_status_t rv; + fspr_status_t rv; rv = pthread_cond_wait(&cond->cond, &mutex->mutex); #ifdef PTHREAD_SETS_ERRNO @@ -74,17 +74,17 @@ APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond, return rv; } -APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex, - apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_thread_cond_timedwait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex, + fspr_interval_time_t timeout) { - apr_status_t rv; - apr_time_t then; + fspr_status_t rv; + fspr_time_t then; struct timespec abstime; - then = apr_time_now() + timeout; - abstime.tv_sec = apr_time_sec(then); - abstime.tv_nsec = apr_time_usec(then) * 1000; /* nanoseconds */ + then = fspr_time_now() + timeout; + abstime.tv_sec = fspr_time_sec(then); + abstime.tv_nsec = fspr_time_usec(then) * 1000; /* nanoseconds */ rv = pthread_cond_timedwait(&cond->cond, &mutex->mutex, &abstime); #ifdef PTHREAD_SETS_ERRNO @@ -99,9 +99,9 @@ APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, } -APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_signal(fspr_thread_cond_t *cond) { - apr_status_t rv; + fspr_status_t rv; rv = pthread_cond_signal(&cond->cond); #ifdef PTHREAD_SETS_ERRNO @@ -112,9 +112,9 @@ APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond) return rv; } -APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_broadcast(fspr_thread_cond_t *cond) { - apr_status_t rv; + fspr_status_t rv; rv = pthread_cond_broadcast(&cond->cond); #ifdef PTHREAD_SETS_ERRNO @@ -125,9 +125,9 @@ APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond) return rv; } -APR_DECLARE(apr_status_t) apr_thread_cond_destroy(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_destroy(fspr_thread_cond_t *cond) { - return apr_pool_cleanup_run(cond->pool, cond, thread_cond_cleanup); + return fspr_pool_cleanup_run(cond->pool, cond, thread_cond_cleanup); } APR_POOL_IMPLEMENT_ACCESSOR(thread_cond) diff --git a/libs/apr/locks/unix/thread_mutex.c b/libs/apr/locks/unix/thread_mutex.c index e146a28f59..30786f883f 100644 --- a/libs/apr/locks/unix/thread_mutex.c +++ b/libs/apr/locks/unix/thread_mutex.c @@ -14,16 +14,16 @@ * limitations under the License. */ -#include "apr_arch_thread_mutex.h" +#include "fspr_arch_thread_mutex.h" #define APR_WANT_MEMFUNC -#include "apr_want.h" +#include "fspr_want.h" #if APR_HAS_THREADS -static apr_status_t thread_mutex_cleanup(void *data) +static fspr_status_t thread_mutex_cleanup(void *data) { - apr_thread_mutex_t *mutex = data; - apr_status_t rv; + fspr_thread_mutex_t *mutex = data; + fspr_status_t rv; rv = pthread_mutex_destroy(&mutex->mutex); #ifdef PTHREAD_SETS_ERRNO @@ -34,12 +34,12 @@ static apr_status_t thread_mutex_cleanup(void *data) return rv; } -APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_thread_mutex_create(fspr_thread_mutex_t **mutex, unsigned int flags, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_thread_mutex_t *new_mutex; - apr_status_t rv; + fspr_thread_mutex_t *new_mutex; + fspr_status_t rv; #ifndef HAVE_PTHREAD_MUTEX_RECURSIVE if (flags & APR_THREAD_MUTEX_NESTED) { @@ -47,7 +47,7 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, } #endif - new_mutex = apr_pcalloc(pool, sizeof(apr_thread_mutex_t)); + new_mutex = fspr_pcalloc(pool, sizeof(fspr_thread_mutex_t)); new_mutex->pool = pool; #ifdef HAVE_PTHREAD_MUTEX_RECURSIVE @@ -77,17 +77,17 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, return rv; } - apr_pool_cleanup_register(new_mutex->pool, + fspr_pool_cleanup_register(new_mutex->pool, new_mutex, thread_mutex_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_null); *mutex = new_mutex; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_lock(fspr_thread_mutex_t *mutex) { - apr_status_t rv; + fspr_status_t rv; rv = pthread_mutex_lock(&mutex->mutex); #ifdef PTHREAD_SETS_ERRNO @@ -99,9 +99,9 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) return rv; } -APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_trylock(fspr_thread_mutex_t *mutex) { - apr_status_t rv; + fspr_status_t rv; rv = pthread_mutex_trylock(&mutex->mutex); if (rv) { @@ -114,9 +114,9 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_unlock(fspr_thread_mutex_t *mutex) { - apr_status_t status; + fspr_status_t status; status = pthread_mutex_unlock(&mutex->mutex); #ifdef PTHREAD_SETS_ERRNO @@ -128,9 +128,9 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) return status; } -APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_destroy(fspr_thread_mutex_t *mutex) { - return apr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup); + return fspr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup); } APR_POOL_IMPLEMENT_ACCESSOR(thread_mutex) diff --git a/libs/apr/locks/unix/thread_rwlock.c b/libs/apr/locks/unix/thread_rwlock.c index 4b28bb618c..533174cff9 100644 --- a/libs/apr/locks/unix/thread_rwlock.c +++ b/libs/apr/locks/unix/thread_rwlock.c @@ -14,8 +14,8 @@ * limitations under the License. */ -#include "apr_arch_thread_rwlock.h" -#include "apr_private.h" +#include "fspr_arch_thread_rwlock.h" +#include "fspr_private.h" #if APR_HAS_THREADS @@ -23,10 +23,10 @@ /* The rwlock must be initialized but not locked by any thread when * cleanup is called. */ -static apr_status_t thread_rwlock_cleanup(void *data) +static fspr_status_t thread_rwlock_cleanup(void *data) { - apr_thread_rwlock_t *rwlock = (apr_thread_rwlock_t *)data; - apr_status_t stat; + fspr_thread_rwlock_t *rwlock = (fspr_thread_rwlock_t *)data; + fspr_status_t stat; stat = pthread_rwlock_destroy(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO @@ -37,13 +37,13 @@ static apr_status_t thread_rwlock_cleanup(void *data) return stat; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_create(fspr_thread_rwlock_t **rwlock, + fspr_pool_t *pool) { - apr_thread_rwlock_t *new_rwlock; - apr_status_t stat; + fspr_thread_rwlock_t *new_rwlock; + fspr_status_t stat; - new_rwlock = apr_palloc(pool, sizeof(apr_thread_rwlock_t)); + new_rwlock = fspr_palloc(pool, sizeof(fspr_thread_rwlock_t)); new_rwlock->pool = pool; if ((stat = pthread_rwlock_init(&new_rwlock->rwlock, NULL))) { @@ -53,17 +53,17 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, return stat; } - apr_pool_cleanup_register(new_rwlock->pool, + fspr_pool_cleanup_register(new_rwlock->pool, (void *)new_rwlock, thread_rwlock_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_null); *rwlock = new_rwlock; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_rdlock(fspr_thread_rwlock_t *rwlock) { - apr_status_t stat; + fspr_status_t stat; stat = pthread_rwlock_rdlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO @@ -74,9 +74,9 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) return stat; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_tryrdlock(fspr_thread_rwlock_t *rwlock) { - apr_status_t stat; + fspr_status_t stat; stat = pthread_rwlock_tryrdlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO @@ -90,9 +90,9 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwloc return stat; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_wrlock(fspr_thread_rwlock_t *rwlock) { - apr_status_t stat; + fspr_status_t stat; stat = pthread_rwlock_wrlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO @@ -103,9 +103,9 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) return stat; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_trywrlock(fspr_thread_rwlock_t *rwlock) { - apr_status_t stat; + fspr_status_t stat; stat = pthread_rwlock_trywrlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO @@ -119,9 +119,9 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwloc return stat; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_unlock(fspr_thread_rwlock_t *rwlock) { - apr_status_t stat; + fspr_status_t stat; stat = pthread_rwlock_unlock(&rwlock->rwlock); #ifdef PTHREAD_SETS_ERRNO @@ -132,45 +132,45 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) return stat; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_destroy(fspr_thread_rwlock_t *rwlock) { - return apr_pool_cleanup_run(rwlock->pool, rwlock, thread_rwlock_cleanup); + return fspr_pool_cleanup_run(rwlock->pool, rwlock, thread_rwlock_cleanup); } #else /* HAVE_PTHREAD_RWLOCKS */ -APR_DECLARE(apr_status_t) apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_create(fspr_thread_rwlock_t **rwlock, + fspr_pool_t *pool) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_rdlock(fspr_thread_rwlock_t *rwlock) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_tryrdlock(fspr_thread_rwlock_t *rwlock) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_wrlock(fspr_thread_rwlock_t *rwlock) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_trywrlock(fspr_thread_rwlock_t *rwlock) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_unlock(fspr_thread_rwlock_t *rwlock) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_destroy(fspr_thread_rwlock_t *rwlock) { return APR_ENOTIMPL; } diff --git a/libs/apr/locks/win32/proc_mutex.c b/libs/apr/locks/win32/proc_mutex.c index 9620a60d00..94e497e92a 100644 --- a/libs/apr/locks/win32/proc_mutex.c +++ b/libs/apr/locks/win32/proc_mutex.c @@ -14,31 +14,31 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_arch_file_io.h" -#include "apr_arch_proc_mutex.h" -#include "apr_arch_misc.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_arch_file_io.h" +#include "fspr_arch_proc_mutex.h" +#include "fspr_arch_misc.h" -static apr_status_t proc_mutex_cleanup(void *mutex_) +static fspr_status_t proc_mutex_cleanup(void *mutex_) { - apr_proc_mutex_t *mutex = mutex_; + fspr_proc_mutex_t *mutex = mutex_; if (mutex->handle) { if (CloseHandle(mutex->handle) == 0) { - return apr_get_os_error(); + return fspr_get_os_error(); } } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_create(fspr_proc_mutex_t **mutex, const char *fname, - apr_lockmech_e mech, - apr_pool_t *pool) + fspr_lockmech_e mech, + fspr_pool_t *pool) { HANDLE hMutex; void *mutexkey; @@ -68,21 +68,21 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex, #endif if (!hMutex) { - return apr_get_os_error(); + return fspr_get_os_error(); } - *mutex = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t)); + *mutex = (fspr_proc_mutex_t *)fspr_palloc(pool, sizeof(fspr_proc_mutex_t)); (*mutex)->pool = pool; (*mutex)->handle = hMutex; (*mutex)->fname = fname; - apr_pool_cleanup_register((*mutex)->pool, *mutex, - proc_mutex_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*mutex)->pool, *mutex, + proc_mutex_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_proc_mutex_child_init(fspr_proc_mutex_t **mutex, const char *fname, - apr_pool_t *pool) + fspr_pool_t *pool) { HANDLE hMutex; void *mutexkey; @@ -112,19 +112,19 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_child_init(apr_proc_mutex_t **mutex, #endif if (!hMutex) { - return apr_get_os_error(); + return fspr_get_os_error(); } - *mutex = (apr_proc_mutex_t *)apr_palloc(pool, sizeof(apr_proc_mutex_t)); + *mutex = (fspr_proc_mutex_t *)fspr_palloc(pool, sizeof(fspr_proc_mutex_t)); (*mutex)->pool = pool; (*mutex)->handle = hMutex; (*mutex)->fname = fname; - apr_pool_cleanup_register((*mutex)->pool, *mutex, - proc_mutex_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*mutex)->pool, *mutex, + proc_mutex_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_lock(fspr_proc_mutex_t *mutex) { DWORD rv; @@ -136,10 +136,10 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_lock(apr_proc_mutex_t *mutex) else if (rv == WAIT_TIMEOUT) { return APR_EBUSY; } - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_trylock(fspr_proc_mutex_t *mutex) { DWORD rv; @@ -151,69 +151,69 @@ APR_DECLARE(apr_status_t) apr_proc_mutex_trylock(apr_proc_mutex_t *mutex) else if (rv == WAIT_TIMEOUT) { return APR_EBUSY; } - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_proc_mutex_unlock(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_unlock(fspr_proc_mutex_t *mutex) { if (ReleaseMutex(mutex->handle) == 0) { - return apr_get_os_error(); + return fspr_get_os_error(); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_mutex_destroy(apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_destroy(fspr_proc_mutex_t *mutex) { - apr_status_t stat; + fspr_status_t stat; stat = proc_mutex_cleanup(mutex); if (stat == APR_SUCCESS) { - apr_pool_cleanup_kill(mutex->pool, mutex, proc_mutex_cleanup); + fspr_pool_cleanup_kill(mutex->pool, mutex, proc_mutex_cleanup); } return stat; } -APR_DECLARE(apr_status_t) apr_proc_mutex_cleanup(void *mutex) +APR_DECLARE(fspr_status_t) fspr_proc_mutex_cleanup(void *mutex) { - return apr_proc_mutex_destroy((apr_proc_mutex_t *)mutex); + return fspr_proc_mutex_destroy((fspr_proc_mutex_t *)mutex); } -APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_lockfile(fspr_proc_mutex_t *mutex) { return NULL; } -APR_DECLARE(const char *) apr_proc_mutex_name(apr_proc_mutex_t *mutex) +APR_DECLARE(const char *) fspr_proc_mutex_name(fspr_proc_mutex_t *mutex) { return mutex->fname; } -APR_DECLARE(const char *) apr_proc_mutex_defname(void) +APR_DECLARE(const char *) fspr_proc_mutex_defname(void) { return "win32mutex"; } APR_POOL_IMPLEMENT_ACCESSOR(proc_mutex) -/* Implement OS-specific accessors defined in apr_portable.h */ +/* Implement OS-specific accessors defined in fspr_portable.h */ -APR_DECLARE(apr_status_t) apr_os_proc_mutex_get(apr_os_proc_mutex_t *ospmutex, - apr_proc_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_get(fspr_os_proc_mutex_t *ospmutex, + fspr_proc_mutex_t *mutex) { *ospmutex = mutex->handle; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_proc_mutex_put(apr_proc_mutex_t **pmutex, - apr_os_proc_mutex_t *ospmutex, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_proc_mutex_put(fspr_proc_mutex_t **pmutex, + fspr_os_proc_mutex_t *ospmutex, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*pmutex) == NULL) { - (*pmutex) = (apr_proc_mutex_t *)apr_palloc(pool, - sizeof(apr_proc_mutex_t)); + (*pmutex) = (fspr_proc_mutex_t *)fspr_palloc(pool, + sizeof(fspr_proc_mutex_t)); (*pmutex)->pool = pool; } (*pmutex)->handle = *ospmutex; diff --git a/libs/apr/locks/win32/thread_cond.c b/libs/apr/locks/win32/thread_cond.c index 60286e542d..dbcca776fa 100644 --- a/libs/apr/locks/win32/thread_cond.c +++ b/libs/apr/locks/win32/thread_cond.c @@ -14,59 +14,59 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_arch_thread_mutex.h" -#include "apr_arch_thread_cond.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_arch_thread_cond.h" +#include "fspr_portable.h" #include -static apr_status_t thread_cond_cleanup(void *data) +static fspr_status_t thread_cond_cleanup(void *data) { - apr_thread_cond_t *cond = data; + fspr_thread_cond_t *cond = data; CloseHandle(cond->semaphore); DeleteCriticalSection(&cond->csection); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_create(apr_thread_cond_t **cond, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_cond_create(fspr_thread_cond_t **cond, + fspr_pool_t *pool) { - apr_thread_cond_t *cv; + fspr_thread_cond_t *cv; - cv = apr_pcalloc(pool, sizeof(**cond)); + cv = fspr_pcalloc(pool, sizeof(**cond)); if (cv == NULL) { return APR_ENOMEM; } cv->semaphore = CreateSemaphore(NULL, 0, LONG_MAX, NULL); if (cv->semaphore == NULL) { - return apr_get_os_error(); + return fspr_get_os_error(); } *cond = cv; cv->pool = pool; InitializeCriticalSection(&cv->csection); - apr_pool_cleanup_register(cv->pool, cv, thread_cond_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(cv->pool, cv, thread_cond_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_destroy(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_destroy(fspr_thread_cond_t *cond) { - return apr_pool_cleanup_run(cond->pool, cond, thread_cond_cleanup); + return fspr_pool_cleanup_run(cond->pool, cond, thread_cond_cleanup); } -static APR_INLINE apr_status_t _thread_cond_timedwait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex, +static APR_INLINE fspr_status_t _thread_cond_timedwait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex, DWORD timeout_ms ) { DWORD res; - apr_status_t rv; + fspr_status_t rv; unsigned int wake = 0; unsigned long generation; @@ -75,7 +75,7 @@ static APR_INLINE apr_status_t _thread_cond_timedwait(apr_thread_cond_t *cond, generation = cond->generation; LeaveCriticalSection(&cond->csection); - apr_thread_mutex_unlock(mutex); + fspr_thread_mutex_unlock(mutex); do { res = WaitForSingleObject(cond->semaphore, timeout_ms); @@ -107,27 +107,27 @@ static APR_INLINE apr_status_t _thread_cond_timedwait(apr_thread_cond_t *cond, } while (1); LeaveCriticalSection(&cond->csection); - apr_thread_mutex_lock(mutex); + fspr_thread_mutex_lock(mutex); return rv; } -APR_DECLARE(apr_status_t) apr_thread_cond_wait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_cond_wait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex) { return _thread_cond_timedwait(cond, mutex, INFINITE); } -APR_DECLARE(apr_status_t) apr_thread_cond_timedwait(apr_thread_cond_t *cond, - apr_thread_mutex_t *mutex, - apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_thread_cond_timedwait(fspr_thread_cond_t *cond, + fspr_thread_mutex_t *mutex, + fspr_interval_time_t timeout) { - DWORD timeout_ms = (DWORD) apr_time_as_msec(timeout); + DWORD timeout_ms = (DWORD) fspr_time_as_msec(timeout); return _thread_cond_timedwait(cond, mutex, timeout_ms); } -APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_signal(fspr_thread_cond_t *cond) { unsigned int wake = 0; @@ -146,7 +146,7 @@ APR_DECLARE(apr_status_t) apr_thread_cond_signal(apr_thread_cond_t *cond) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_cond_broadcast(apr_thread_cond_t *cond) +APR_DECLARE(fspr_status_t) fspr_thread_cond_broadcast(fspr_thread_cond_t *cond) { unsigned long num_wake = 0; diff --git a/libs/apr/locks/win32/thread_mutex.c b/libs/apr/locks/win32/thread_mutex.c index 9b10d7278d..6f86edb782 100644 --- a/libs/apr/locks/win32/thread_mutex.c +++ b/libs/apr/locks/win32/thread_mutex.c @@ -14,18 +14,18 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_arch_thread_mutex.h" -#include "apr_thread_mutex.h" -#include "apr_portable.h" -#include "apr_arch_misc.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_arch_thread_mutex.h" +#include "fspr_thread_mutex.h" +#include "fspr_portable.h" +#include "fspr_arch_misc.h" -static apr_status_t thread_mutex_cleanup(void *data) +static fspr_status_t thread_mutex_cleanup(void *data) { - apr_thread_mutex_t *lock = data; + fspr_thread_mutex_t *lock = data; if (lock->type == thread_mutex_critical_section) { lock->type = -1; @@ -33,17 +33,17 @@ static apr_status_t thread_mutex_cleanup(void *data) } else { if (!CloseHandle(lock->handle)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, +APR_DECLARE(fspr_status_t) fspr_thread_mutex_create(fspr_thread_mutex_t **mutex, unsigned int flags, - apr_pool_t *pool) + fspr_pool_t *pool) { - (*mutex) = (apr_thread_mutex_t *)apr_palloc(pool, sizeof(**mutex)); + (*mutex) = (fspr_thread_mutex_t *)fspr_palloc(pool, sizeof(**mutex)); (*mutex)->pool = pool; @@ -74,12 +74,12 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_create(apr_thread_mutex_t **mutex, #endif } - apr_pool_cleanup_register((*mutex)->pool, (*mutex), thread_mutex_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*mutex)->pool, (*mutex), thread_mutex_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_lock(fspr_thread_mutex_t *mutex) { if (mutex->type == thread_mutex_critical_section) { EnterCriticalSection(&mutex->section); @@ -87,13 +87,13 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_lock(apr_thread_mutex_t *mutex) else { DWORD rv = WaitForSingleObject(mutex->handle, INFINITE); if ((rv != WAIT_OBJECT_0) && (rv != WAIT_ABANDONED)) { - return (rv == WAIT_TIMEOUT) ? APR_EBUSY : apr_get_os_error(); + return (rv == WAIT_TIMEOUT) ? APR_EBUSY : fspr_get_os_error(); } } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_trylock(fspr_thread_mutex_t *mutex) { if (mutex->type == thread_mutex_critical_section) { if (!TryEnterCriticalSection(&mutex->section)) { @@ -103,33 +103,33 @@ APR_DECLARE(apr_status_t) apr_thread_mutex_trylock(apr_thread_mutex_t *mutex) else { DWORD rv = WaitForSingleObject(mutex->handle, 0); if ((rv != WAIT_OBJECT_0) && (rv != WAIT_ABANDONED)) { - return (rv == WAIT_TIMEOUT) ? APR_EBUSY : apr_get_os_error(); + return (rv == WAIT_TIMEOUT) ? APR_EBUSY : fspr_get_os_error(); } } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_unlock(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_unlock(fspr_thread_mutex_t *mutex) { if (mutex->type == thread_mutex_critical_section) { LeaveCriticalSection(&mutex->section); } else if (mutex->type == thread_mutex_unnested_event) { if (!SetEvent(mutex->handle)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } else if (mutex->type == thread_mutex_nested_mutex) { if (!ReleaseMutex(mutex->handle)) { - return apr_get_os_error(); + return fspr_get_os_error(); } } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_mutex_destroy(apr_thread_mutex_t *mutex) +APR_DECLARE(fspr_status_t) fspr_thread_mutex_destroy(fspr_thread_mutex_t *mutex) { - return apr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup); + return fspr_pool_cleanup_run(mutex->pool, mutex, thread_mutex_cleanup); } APR_POOL_IMPLEMENT_ACCESSOR(thread_mutex) diff --git a/libs/apr/locks/win32/thread_rwlock.c b/libs/apr/locks/win32/thread_rwlock.c index 4995ca2dee..c8242adb85 100644 --- a/libs/apr/locks/win32/thread_rwlock.c +++ b/libs/apr/locks/win32/thread_rwlock.c @@ -14,56 +14,56 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "win32/apr_arch_thread_rwlock.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "win32/fspr_arch_thread_rwlock.h" +#include "fspr_portable.h" -static apr_status_t thread_rwlock_cleanup(void *data) +static fspr_status_t thread_rwlock_cleanup(void *data) { - apr_thread_rwlock_t *rwlock = data; + fspr_thread_rwlock_t *rwlock = data; if (! CloseHandle(rwlock->read_event)) - return apr_get_os_error(); + return fspr_get_os_error(); DeleteCriticalSection(&rwlock->read_section); if (! CloseHandle(rwlock->write_mutex)) - return apr_get_os_error(); + return fspr_get_os_error(); return APR_SUCCESS; } -APR_DECLARE(apr_status_t)apr_thread_rwlock_create(apr_thread_rwlock_t **rwlock, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t)fspr_thread_rwlock_create(fspr_thread_rwlock_t **rwlock, + fspr_pool_t *pool) { - *rwlock = apr_palloc(pool, sizeof(**rwlock)); + *rwlock = fspr_palloc(pool, sizeof(**rwlock)); (*rwlock)->pool = pool; (*rwlock)->readers = 0; if (! ((*rwlock)->read_event = CreateEvent(NULL, TRUE, FALSE, NULL))) { *rwlock = NULL; - return apr_get_os_error(); + return fspr_get_os_error(); } if (! ((*rwlock)->write_mutex = CreateMutex(NULL, FALSE, NULL))) { CloseHandle((*rwlock)->read_event); *rwlock = NULL; - return apr_get_os_error(); + return fspr_get_os_error(); } InitializeCriticalSection(&(*rwlock)->read_section); - apr_pool_cleanup_register(pool, *rwlock, thread_rwlock_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *rwlock, thread_rwlock_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -static apr_status_t apr_thread_rwlock_rdlock_core(apr_thread_rwlock_t *rwlock, +static fspr_status_t fspr_thread_rwlock_rdlock_core(fspr_thread_rwlock_t *rwlock, DWORD milliseconds) { DWORD code; @@ -83,31 +83,31 @@ static apr_status_t apr_thread_rwlock_rdlock_core(apr_thread_rwlock_t *rwlock, if (! ResetEvent(rwlock->read_event)) { LeaveCriticalSection(&rwlock->read_section); - return apr_get_os_error(); + return fspr_get_os_error(); } if (! ReleaseMutex(rwlock->write_mutex)) { LeaveCriticalSection(&rwlock->read_section); - return apr_get_os_error(); + return fspr_get_os_error(); } LeaveCriticalSection(&rwlock->read_section); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_rdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_rdlock(fspr_thread_rwlock_t *rwlock) { - return apr_thread_rwlock_rdlock_core(rwlock, INFINITE); + return fspr_thread_rwlock_rdlock_core(rwlock, INFINITE); } -APR_DECLARE(apr_status_t) -apr_thread_rwlock_tryrdlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) +fspr_thread_rwlock_tryrdlock(fspr_thread_rwlock_t *rwlock) { - return apr_thread_rwlock_rdlock_core(rwlock, 0); + return fspr_thread_rwlock_rdlock_core(rwlock, 0); } -static apr_status_t -apr_thread_rwlock_wrlock_core(apr_thread_rwlock_t *rwlock, DWORD milliseconds) +static fspr_status_t +fspr_thread_rwlock_wrlock_core(fspr_thread_rwlock_t *rwlock, DWORD milliseconds) { DWORD code = WaitForSingleObject(rwlock->write_mutex, milliseconds); @@ -128,7 +128,7 @@ apr_thread_rwlock_wrlock_core(apr_thread_rwlock_t *rwlock, DWORD milliseconds) if (code == WAIT_FAILED || code == WAIT_TIMEOUT) { /* Unable to wait for readers to finish, release write lock: */ if (! ReleaseMutex(rwlock->write_mutex)) - return apr_get_os_error(); + return fspr_get_os_error(); return APR_FROM_OS_ERROR(code); } @@ -137,30 +137,30 @@ apr_thread_rwlock_wrlock_core(apr_thread_rwlock_t *rwlock, DWORD milliseconds) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_wrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_wrlock(fspr_thread_rwlock_t *rwlock) { - return apr_thread_rwlock_wrlock_core(rwlock, INFINITE); + return fspr_thread_rwlock_wrlock_core(rwlock, INFINITE); } -APR_DECLARE(apr_status_t)apr_thread_rwlock_trywrlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t)fspr_thread_rwlock_trywrlock(fspr_thread_rwlock_t *rwlock) { - return apr_thread_rwlock_wrlock_core(rwlock, 0); + return fspr_thread_rwlock_wrlock_core(rwlock, 0); } -APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_unlock(fspr_thread_rwlock_t *rwlock) { - apr_status_t rv = 0; + fspr_status_t rv = 0; /* First, guess that we're unlocking a writer */ if (! ReleaseMutex(rwlock->write_mutex)) - rv = apr_get_os_error(); + rv = fspr_get_os_error(); if (rv == APR_FROM_OS_ERROR(ERROR_NOT_OWNER)) { /* Nope, we must have a read lock */ if (rwlock->readers && ! InterlockedDecrement(&rwlock->readers) && ! SetEvent(rwlock->read_event)) { - rv = apr_get_os_error(); + rv = fspr_get_os_error(); } else { rv = 0; @@ -170,9 +170,9 @@ APR_DECLARE(apr_status_t) apr_thread_rwlock_unlock(apr_thread_rwlock_t *rwlock) return rv; } -APR_DECLARE(apr_status_t) apr_thread_rwlock_destroy(apr_thread_rwlock_t *rwlock) +APR_DECLARE(fspr_status_t) fspr_thread_rwlock_destroy(fspr_thread_rwlock_t *rwlock) { - return apr_pool_cleanup_run(rwlock->pool, rwlock, thread_rwlock_cleanup); + return fspr_pool_cleanup_run(rwlock->pool, rwlock, thread_rwlock_cleanup); } APR_POOL_IMPLEMENT_ACCESSOR(thread_rwlock) diff --git a/libs/apr/memory/unix/apr_pools.c b/libs/apr/memory/unix/fspr_pools.c similarity index 67% rename from libs/apr/memory/unix/apr_pools.c rename to libs/apr/memory/unix/fspr_pools.c index acd8512ca1..9f67b7ec53 100644 --- a/libs/apr/memory/unix/apr_pools.c +++ b/libs/apr/memory/unix/fspr_pools.c @@ -14,22 +14,22 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" +#include "fspr.h" +#include "fspr_private.h" -#include "apr_atomic.h" -#include "apr_portable.h" /* for get_os_proc */ -#include "apr_strings.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_allocator.h" -#include "apr_lib.h" -#include "apr_thread_mutex.h" -#include "apr_hash.h" -#include "apr_time.h" +#include "fspr_atomic.h" +#include "fspr_portable.h" /* for get_os_proc */ +#include "fspr_strings.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_allocator.h" +#include "fspr_lib.h" +#include "fspr_thread_mutex.h" +#include "fspr_hash.h" +#include "fspr_time.h" #define APR_WANT_MEMFUNC -#include "apr_want.h" -#include "apr_env.h" +#include "fspr_want.h" +#include "fspr_env.h" #if APR_HAVE_STDLIB_H #include /* for malloc, free and abort */ @@ -64,27 +64,27 @@ * Allocator */ -struct apr_allocator_t { - apr_uint32_t max_index; - apr_uint32_t max_free_index; - apr_uint32_t current_free_index; +struct fspr_allocator_t { + fspr_uint32_t max_index; + fspr_uint32_t max_free_index; + fspr_uint32_t current_free_index; #if APR_HAS_THREADS - apr_thread_mutex_t *mutex; + fspr_thread_mutex_t *mutex; #endif /* APR_HAS_THREADS */ - apr_pool_t *owner; - apr_memnode_t *free[MAX_INDEX]; + fspr_pool_t *owner; + fspr_memnode_t *free[MAX_INDEX]; }; -#define SIZEOF_ALLOCATOR_T APR_ALIGN_DEFAULT(sizeof(apr_allocator_t)) +#define SIZEOF_ALLOCATOR_T APR_ALIGN_DEFAULT(sizeof(fspr_allocator_t)) /* * Allocator */ -APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator) +APR_DECLARE(fspr_status_t) fspr_allocator_create(fspr_allocator_t **allocator) { - apr_allocator_t *new_allocator; + fspr_allocator_t *new_allocator; *allocator = NULL; @@ -99,10 +99,10 @@ APR_DECLARE(apr_status_t) apr_allocator_create(apr_allocator_t **allocator) return APR_SUCCESS; } -APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator) +APR_DECLARE(void) fspr_allocator_destroy(fspr_allocator_t *allocator) { - apr_uint32_t index; - apr_memnode_t *node, **ref; + fspr_uint32_t index; + fspr_memnode_t *node, **ref; for (index = 0; index < MAX_INDEX; index++) { ref = &allocator->free[index]; @@ -116,42 +116,42 @@ APR_DECLARE(void) apr_allocator_destroy(apr_allocator_t *allocator) } #if APR_HAS_THREADS -APR_DECLARE(void) apr_allocator_mutex_set(apr_allocator_t *allocator, - apr_thread_mutex_t *mutex) +APR_DECLARE(void) fspr_allocator_mutex_set(fspr_allocator_t *allocator, + fspr_thread_mutex_t *mutex) { allocator->mutex = mutex; } -APR_DECLARE(apr_thread_mutex_t *) apr_allocator_mutex_get( - apr_allocator_t *allocator) +APR_DECLARE(fspr_thread_mutex_t *) fspr_allocator_mutex_get( + fspr_allocator_t *allocator) { return allocator->mutex; } #endif /* APR_HAS_THREADS */ -APR_DECLARE(void) apr_allocator_owner_set(apr_allocator_t *allocator, - apr_pool_t *pool) +APR_DECLARE(void) fspr_allocator_owner_set(fspr_allocator_t *allocator, + fspr_pool_t *pool) { allocator->owner = pool; } -APR_DECLARE(apr_pool_t *) apr_allocator_owner_get(apr_allocator_t *allocator) +APR_DECLARE(fspr_pool_t *) fspr_allocator_owner_get(fspr_allocator_t *allocator) { return allocator->owner; } -APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator, - apr_size_t in_size) +APR_DECLARE(void) fspr_allocator_max_free_set(fspr_allocator_t *allocator, + fspr_size_t in_size) { - apr_uint32_t max_free_index; - apr_uint32_t size = (APR_UINT32_TRUNC_CAST)in_size; + fspr_uint32_t max_free_index; + fspr_uint32_t size = (APR_UINT32_TRUNC_CAST)in_size; #if APR_HAS_THREADS - apr_thread_mutex_t *mutex; + fspr_thread_mutex_t *mutex; - mutex = apr_allocator_mutex_get(allocator); + mutex = fspr_allocator_mutex_get(allocator); if (mutex != NULL) - apr_thread_mutex_lock(mutex); + fspr_thread_mutex_lock(mutex); #endif /* APR_HAS_THREADS */ max_free_index = APR_ALIGN(size, BOUNDARY_SIZE) >> BOUNDARY_INDEX; @@ -163,16 +163,16 @@ APR_DECLARE(void) apr_allocator_max_free_set(apr_allocator_t *allocator, #if APR_HAS_THREADS if (mutex != NULL) - apr_thread_mutex_unlock(mutex); + fspr_thread_mutex_unlock(mutex); #endif } static APR_INLINE -apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) +fspr_memnode_t *allocator_alloc(fspr_allocator_t *allocator, fspr_size_t size) { - apr_memnode_t *node, **ref; - apr_uint32_t max_index; - apr_size_t i, index; + fspr_memnode_t *node, **ref; + fspr_uint32_t max_index; + fspr_size_t i, index; /* Round up the block size to the next boundary, but always * allocate at least a certain size (MIN_ALLOC). @@ -196,7 +196,7 @@ apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) if (index <= allocator->max_index) { #if APR_HAS_THREADS if (allocator->mutex) - apr_thread_mutex_lock(allocator->mutex); + fspr_thread_mutex_lock(allocator->mutex); #endif /* APR_HAS_THREADS */ /* Walk the free list to see if there are @@ -239,7 +239,7 @@ apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) #if APR_HAS_THREADS if (allocator->mutex) - apr_thread_mutex_unlock(allocator->mutex); + fspr_thread_mutex_unlock(allocator->mutex); #endif /* APR_HAS_THREADS */ node->next = NULL; @@ -250,7 +250,7 @@ apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) #if APR_HAS_THREADS if (allocator->mutex) - apr_thread_mutex_unlock(allocator->mutex); + fspr_thread_mutex_unlock(allocator->mutex); #endif /* APR_HAS_THREADS */ } @@ -260,7 +260,7 @@ apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) else if (allocator->free[0]) { #if APR_HAS_THREADS if (allocator->mutex) - apr_thread_mutex_lock(allocator->mutex); + fspr_thread_mutex_lock(allocator->mutex); #endif /* APR_HAS_THREADS */ /* Walk the free list to see if there are @@ -279,7 +279,7 @@ apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) #if APR_HAS_THREADS if (allocator->mutex) - apr_thread_mutex_unlock(allocator->mutex); + fspr_thread_mutex_unlock(allocator->mutex); #endif /* APR_HAS_THREADS */ node->next = NULL; @@ -290,7 +290,7 @@ apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) #if APR_HAS_THREADS if (allocator->mutex) - apr_thread_mutex_unlock(allocator->mutex); + fspr_thread_mutex_unlock(allocator->mutex); #endif /* APR_HAS_THREADS */ } @@ -309,15 +309,15 @@ apr_memnode_t *allocator_alloc(apr_allocator_t *allocator, apr_size_t size) } static APR_INLINE -void allocator_free(apr_allocator_t *allocator, apr_memnode_t *node) +void allocator_free(fspr_allocator_t *allocator, fspr_memnode_t *node) { - apr_memnode_t *next, *freelist = NULL; - apr_uint32_t index, max_index; - apr_uint32_t max_free_index, current_free_index; + fspr_memnode_t *next, *freelist = NULL; + fspr_uint32_t index, max_index; + fspr_uint32_t max_free_index, current_free_index; #if APR_HAS_THREADS if (allocator->mutex) - apr_thread_mutex_lock(allocator->mutex); + fspr_thread_mutex_lock(allocator->mutex); #endif /* APR_HAS_THREADS */ max_index = allocator->max_index; @@ -362,7 +362,7 @@ void allocator_free(apr_allocator_t *allocator, apr_memnode_t *node) #if APR_HAS_THREADS if (allocator->mutex) - apr_thread_mutex_unlock(allocator->mutex); + fspr_thread_mutex_unlock(allocator->mutex); #endif /* APR_HAS_THREADS */ while (freelist != NULL) { @@ -372,14 +372,14 @@ void allocator_free(apr_allocator_t *allocator, apr_memnode_t *node) } } -APR_DECLARE(apr_memnode_t *) apr_allocator_alloc(apr_allocator_t *allocator, - apr_size_t size) +APR_DECLARE(fspr_memnode_t *) fspr_allocator_alloc(fspr_allocator_t *allocator, + fspr_size_t size) { return allocator_alloc(allocator, size); } -APR_DECLARE(void) apr_allocator_free(apr_allocator_t *allocator, - apr_memnode_t *node) +APR_DECLARE(void) fspr_allocator_free(fspr_allocator_t *allocator, + fspr_memnode_t *node) { allocator_free(allocator, node); } @@ -409,8 +409,8 @@ typedef struct cleanup_t cleanup_t; /** A list of processes */ struct process_chain { /** The process ID */ - apr_proc_t *proc; - apr_kill_conditions_e kill_how; + fspr_proc_t *proc; + fspr_kill_conditions_e kill_how; /** The next process in the list */ struct process_chain *next; }; @@ -422,7 +422,7 @@ typedef struct debug_node_t debug_node_t; struct debug_node_t { debug_node_t *next; - apr_uint32_t index; + fspr_uint32_t index; void *beginp[64]; void *endp[64]; }; @@ -431,68 +431,68 @@ struct debug_node_t { #endif /* APR_POOL_DEBUG */ -/* The ref field in the apr_pool_t struct holds a +/* The ref field in the fspr_pool_t struct holds a * pointer to the pointer referencing this pool. * It is used for parent, child, sibling management. - * Look at apr_pool_create_ex() and apr_pool_destroy() + * Look at fspr_pool_create_ex() and fspr_pool_destroy() * to see how it is used. */ -struct apr_pool_t { - apr_pool_t *parent; - apr_pool_t *child; - apr_pool_t *sibling; - apr_pool_t **ref; +struct fspr_pool_t { + fspr_pool_t *parent; + fspr_pool_t *child; + fspr_pool_t *sibling; + fspr_pool_t **ref; cleanup_t *cleanups; cleanup_t *free_cleanups; - apr_allocator_t *allocator; + fspr_allocator_t *allocator; struct process_chain *subprocesses; - apr_abortfunc_t abort_fn; - apr_hash_t *user_data; + fspr_abortfunc_t abort_fn; + fspr_hash_t *user_data; const char *tag; #if APR_HAS_THREADS - apr_thread_mutex_t *user_mutex; + fspr_thread_mutex_t *user_mutex; #endif #if !APR_POOL_DEBUG - apr_memnode_t *active; - apr_memnode_t *self; /* The node containing the pool itself */ + fspr_memnode_t *active; + fspr_memnode_t *self; /* The node containing the pool itself */ char *self_first_avail; #else /* APR_POOL_DEBUG */ - apr_pool_t *joined; /* the caller has guaranteed that this pool + fspr_pool_t *joined; /* the caller has guaranteed that this pool * will survive as long as ->joined */ debug_node_t *nodes; const char *file_line; - apr_uint32_t creation_flags; + fspr_uint32_t creation_flags; unsigned int stat_alloc; unsigned int stat_total_alloc; unsigned int stat_clear; #if APR_HAS_THREADS - apr_os_thread_t owner; - apr_thread_mutex_t *mutex; + fspr_os_thread_t owner; + fspr_thread_mutex_t *mutex; #endif /* APR_HAS_THREADS */ #endif /* APR_POOL_DEBUG */ #ifdef NETWARE - apr_os_proc_t owner_proc; + fspr_os_proc_t owner_proc; #endif /* defined(NETWARE) */ }; -#define SIZEOF_POOL_T APR_ALIGN_DEFAULT(sizeof(apr_pool_t)) +#define SIZEOF_POOL_T APR_ALIGN_DEFAULT(sizeof(fspr_pool_t)) /* * Variables */ -static apr_byte_t apr_pools_initialized = 0; -static apr_pool_t *global_pool = NULL; +static fspr_byte_t fspr_pools_initialized = 0; +static fspr_pool_t *global_pool = NULL; #if !APR_POOL_DEBUG -static apr_allocator_t *global_allocator = NULL; +static fspr_allocator_t *global_allocator = NULL; #endif /* !APR_POOL_DEBUG */ #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) -static apr_file_t *file_stderr = NULL; +static fspr_file_t *file_stderr = NULL; #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */ /* @@ -504,13 +504,13 @@ static void run_child_cleanups(cleanup_t **c); static void free_proc_chain(struct process_chain *procs); #if APR_POOL_DEBUG -static void pool_destroy_debug(apr_pool_t *pool, const char *file_line); +static void pool_destroy_debug(fspr_pool_t *pool, const char *file_line); #endif #if APR_HAS_THREADS -APR_DECLARE(void) apr_pool_mutex_set(apr_pool_t *pool, - apr_thread_mutex_t *mutex) +APR_DECLARE(void) fspr_pool_mutex_set(fspr_pool_t *pool, + fspr_thread_mutex_t *mutex) { pool->user_mutex = mutex; } @@ -522,63 +522,63 @@ APR_DECLARE(void) apr_pool_mutex_set(apr_pool_t *pool, * Initialization */ -APR_DECLARE(apr_status_t) apr_pool_initialize(void) +APR_DECLARE(fspr_status_t) fspr_pool_initialize(void) { - apr_status_t rv; + fspr_status_t rv; - if (apr_pools_initialized++) + if (fspr_pools_initialized++) return APR_SUCCESS; - if ((rv = apr_allocator_create(&global_allocator)) != APR_SUCCESS) { - apr_pools_initialized = 0; + if ((rv = fspr_allocator_create(&global_allocator)) != APR_SUCCESS) { + fspr_pools_initialized = 0; return rv; } - if ((rv = apr_pool_create_ex(&global_pool, NULL, NULL, + if ((rv = fspr_pool_create_ex(&global_pool, NULL, NULL, global_allocator)) != APR_SUCCESS) { - apr_allocator_destroy(global_allocator); + fspr_allocator_destroy(global_allocator); global_allocator = NULL; - apr_pools_initialized = 0; + fspr_pools_initialized = 0; return rv; } - apr_pool_tag(global_pool, "apr_global_pool"); + fspr_pool_tag(global_pool, "fspr_global_pool"); /* This has to happen here because mutexes might be backed by - * atomics. It used to be snug and safe in apr_initialize(). + * atomics. It used to be snug and safe in fspr_initialize(). */ - if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) { + if ((rv = fspr_atomic_init(global_pool)) != APR_SUCCESS) { return rv; } #if APR_HAS_THREADS { - apr_thread_mutex_t *mutex; + fspr_thread_mutex_t *mutex; - if ((rv = apr_thread_mutex_create(&mutex, + if ((rv = fspr_thread_mutex_create(&mutex, APR_THREAD_MUTEX_DEFAULT, global_pool)) != APR_SUCCESS) { return rv; } - apr_allocator_mutex_set(global_allocator, mutex); + fspr_allocator_mutex_set(global_allocator, mutex); } #endif /* APR_HAS_THREADS */ - apr_allocator_owner_set(global_allocator, global_pool); + fspr_allocator_owner_set(global_allocator, global_pool); return APR_SUCCESS; } -APR_DECLARE(void) apr_pool_terminate(void) +APR_DECLARE(void) fspr_pool_terminate(void) { - if (!apr_pools_initialized) + if (!fspr_pools_initialized) return; - if (--apr_pools_initialized) + if (--fspr_pools_initialized) return; - apr_pool_destroy(global_pool); /* This will also destroy the mutex */ + fspr_pool_destroy(global_pool); /* This will also destroy the mutex */ global_pool = NULL; global_allocator = NULL; @@ -604,19 +604,19 @@ APR_DECLARE(void) apr_pool_terminate(void) * Memory allocation */ -APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size) +APR_DECLARE(void *) fspr_palloc(fspr_pool_t *pool, fspr_size_t size) { - apr_memnode_t *active, *node; + fspr_memnode_t *active, *node; void *mem = NULL; - apr_size_t free_index; + fspr_size_t free_index; #if APR_HAS_THREADS - if (pool->user_mutex) apr_thread_mutex_lock(pool->user_mutex); + if (pool->user_mutex) fspr_thread_mutex_lock(pool->user_mutex); #endif size = APR_ALIGN_DEFAULT(size); active = pool->active; /* If the active node has enough bytes left, use it. */ - if (size < (apr_size_t)(active->endp - active->first_avail)) { + if (size < (fspr_size_t)(active->endp - active->first_avail)) { mem = active->first_avail; active->first_avail += size; @@ -624,7 +624,7 @@ APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size) } node = active->next; - if (size < (apr_size_t)(node->endp - node->first_avail)) { + if (size < (fspr_size_t)(node->endp - node->first_avail)) { list_remove(node); } else { @@ -664,26 +664,26 @@ APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size) end: #if APR_HAS_THREADS - if (pool->user_mutex) apr_thread_mutex_unlock(pool->user_mutex); + if (pool->user_mutex) fspr_thread_mutex_unlock(pool->user_mutex); #endif return mem; } -/* Provide an implementation of apr_pcalloc for backward compatibility - * with code built before apr_pcalloc was a macro +/* Provide an implementation of fspr_pcalloc for backward compatibility + * with code built before fspr_pcalloc was a macro */ -#ifdef apr_pcalloc -#undef apr_pcalloc +#ifdef fspr_pcalloc +#undef fspr_pcalloc #endif -APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size); -APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size) +APR_DECLARE(void *) fspr_pcalloc(fspr_pool_t *pool, fspr_size_t size); +APR_DECLARE(void *) fspr_pcalloc(fspr_pool_t *pool, fspr_size_t size) { void *mem; size = APR_ALIGN_DEFAULT(size); - if ((mem = apr_palloc(pool, size)) != NULL) { + if ((mem = fspr_palloc(pool, size)) != NULL) { memset(mem, 0, size); } @@ -695,17 +695,17 @@ APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size) * Pool creation/destruction */ -APR_DECLARE(void) apr_pool_clear(apr_pool_t *pool) +APR_DECLARE(void) fspr_pool_clear(fspr_pool_t *pool) { - apr_memnode_t *active; + fspr_memnode_t *active; #if APR_HAS_THREADS - if (pool->user_mutex) apr_thread_mutex_lock(pool->user_mutex); + if (pool->user_mutex) fspr_thread_mutex_lock(pool->user_mutex); #endif /* Destroy the subpools. The subpools will detach themselves from * this pool thus this loop is safe and easy. */ while (pool->child) - apr_pool_destroy(pool->child); + fspr_pool_destroy(pool->child); /* Run cleanups */ run_cleanups(&pool->cleanups); @@ -735,20 +735,20 @@ APR_DECLARE(void) apr_pool_clear(apr_pool_t *pool) end: #if APR_HAS_THREADS - if (pool->user_mutex) apr_thread_mutex_unlock(pool->user_mutex); + if (pool->user_mutex) fspr_thread_mutex_unlock(pool->user_mutex); #endif } -APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool) +APR_DECLARE(void) fspr_pool_destroy(fspr_pool_t *pool) { - apr_memnode_t *active; - apr_allocator_t *allocator; + fspr_memnode_t *active; + fspr_allocator_t *allocator; /* Destroy the subpools. The subpools will detach themselve from * this pool thus this loop is safe and easy. */ while (pool->child) - apr_pool_destroy(pool->child); + fspr_pool_destroy(pool->child); /* Run cleanups */ run_cleanups(&pool->cleanups); @@ -759,10 +759,10 @@ APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool) /* Remove the pool from the parents child list */ if (pool->parent) { #if APR_HAS_THREADS - apr_thread_mutex_t *mutex; + fspr_thread_mutex_t *mutex; - if ((mutex = apr_allocator_mutex_get(pool->parent->allocator)) != NULL) - apr_thread_mutex_lock(mutex); + if ((mutex = fspr_allocator_mutex_get(pool->parent->allocator)) != NULL) + fspr_thread_mutex_lock(mutex); #endif /* APR_HAS_THREADS */ if ((*pool->ref = pool->sibling) != NULL) @@ -770,7 +770,7 @@ APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool) #if APR_HAS_THREADS if (mutex) - apr_thread_mutex_unlock(mutex); + fspr_thread_mutex_unlock(mutex); #endif /* APR_HAS_THREADS */ } @@ -782,11 +782,11 @@ APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool) *active->ref = NULL; #if APR_HAS_THREADS - if (apr_allocator_owner_get(allocator) == pool) { + if (fspr_allocator_owner_get(allocator) == pool) { /* Make sure to remove the lock, since it is highly likely to * be invalid now. */ - apr_allocator_mutex_set(allocator, NULL); + fspr_allocator_mutex_set(allocator, NULL); } #endif /* APR_HAS_THREADS */ @@ -800,18 +800,18 @@ APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool) * and the allocator). Don't worry about destroying the optional mutex * in the allocator, it will have been destroyed by the cleanup function. */ - if (apr_allocator_owner_get(allocator) == pool) { - apr_allocator_destroy(allocator); + if (fspr_allocator_owner_get(allocator) == pool) { + fspr_allocator_destroy(allocator); } } -APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, - apr_pool_t *parent, - apr_abortfunc_t abort_fn, - apr_allocator_t *allocator) +APR_DECLARE(fspr_status_t) fspr_pool_create_ex(fspr_pool_t **newpool, + fspr_pool_t *parent, + fspr_abortfunc_t abort_fn, + fspr_allocator_t *allocator) { - apr_pool_t *pool; - apr_memnode_t *node; + fspr_pool_t *pool; + fspr_memnode_t *node; *newpool = NULL; @@ -844,7 +844,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, node->next = node; node->ref = &node->next; - pool = (apr_pool_t *)node->first_avail; + pool = (fspr_pool_t *)node->first_avail; node->first_avail = pool->self_first_avail = (char *)pool + SIZEOF_POOL_T; pool->allocator = allocator; @@ -860,15 +860,15 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, pool->user_mutex = NULL; #endif #ifdef NETWARE - pool->owner_proc = (apr_os_proc_t)getnlmhandle(); + pool->owner_proc = (fspr_os_proc_t)getnlmhandle(); #endif /* defined(NETWARE) */ if ((pool->parent = parent) != NULL) { #if APR_HAS_THREADS - apr_thread_mutex_t *mutex; + fspr_thread_mutex_t *mutex; - if ((mutex = apr_allocator_mutex_get(parent->allocator)) != NULL) - apr_thread_mutex_lock(mutex); + if ((mutex = fspr_allocator_mutex_get(parent->allocator)) != NULL) + fspr_thread_mutex_lock(mutex); #endif /* APR_HAS_THREADS */ if ((pool->sibling = parent->child) != NULL) @@ -879,7 +879,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, #if APR_HAS_THREADS if (mutex) - apr_thread_mutex_unlock(mutex); + fspr_thread_mutex_unlock(mutex); #endif /* APR_HAS_THREADS */ } else { @@ -898,37 +898,37 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, */ /* - * apr_psprintf is implemented by writing directly into the current + * fspr_psprintf is implemented by writing directly into the current * block of the pool, starting right at first_avail. If there's * insufficient room, then a new block is allocated and the earlier * output is copied over. The new block isn't linked into the pool * until all the output is done. * * Note that this is completely safe because nothing else can - * allocate in this apr_pool_t while apr_psprintf is running. alarms are - * blocked, and the only thing outside of apr_pools.c that's invoked - * is apr_vformatter -- which was purposefully written to be + * allocate in this fspr_pool_t while fspr_psprintf is running. alarms are + * blocked, and the only thing outside of fspr_pools.c that's invoked + * is fspr_vformatter -- which was purposefully written to be * self-contained with no callouts. */ struct psprintf_data { - apr_vformatter_buff_t vbuff; - apr_memnode_t *node; - apr_pool_t *pool; - apr_byte_t got_a_new_node; - apr_memnode_t *free; + fspr_vformatter_buff_t vbuff; + fspr_memnode_t *node; + fspr_pool_t *pool; + fspr_byte_t got_a_new_node; + fspr_memnode_t *free; }; #define APR_PSPRINTF_MIN_STRINGSIZE 32 -static int psprintf_flush(apr_vformatter_buff_t *vbuff) +static int psprintf_flush(fspr_vformatter_buff_t *vbuff) { struct psprintf_data *ps = (struct psprintf_data *)vbuff; - apr_memnode_t *node, *active; - apr_size_t cur_len, size; + fspr_memnode_t *node, *active; + fspr_size_t cur_len, size; char *strp; - apr_pool_t *pool; - apr_size_t free_index; + fspr_pool_t *pool; + fspr_size_t free_index; pool = ps->pool; active = ps->node; @@ -946,7 +946,7 @@ static int psprintf_flush(apr_vformatter_buff_t *vbuff) node = active->next; if (!ps->got_a_new_node - && size < (apr_size_t)(node->endp - node->first_avail)) { + && size < (fspr_size_t)(node->endp - node->first_avail)) { list_remove(node); list_insert(node, active); @@ -993,16 +993,16 @@ static int psprintf_flush(apr_vformatter_buff_t *vbuff) return 0; } -APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) +APR_DECLARE(char *) fspr_pvsprintf(fspr_pool_t *pool, const char *fmt, va_list ap) { struct psprintf_data ps; char *strp; - apr_size_t size; - apr_memnode_t *active, *node; - apr_size_t free_index; + fspr_size_t size; + fspr_memnode_t *active, *node; + fspr_size_t free_index; #if APR_HAS_THREADS - if (pool->user_mutex) apr_thread_mutex_lock(pool->user_mutex); + if (pool->user_mutex) fspr_thread_mutex_lock(pool->user_mutex); #endif ps.node = pool->active; @@ -1014,7 +1014,7 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) ps.got_a_new_node = 0; ps.free = NULL; - /* Make sure that the first node passed to apr_vformatter has at least + /* Make sure that the first node passed to fspr_vformatter has at least * room to hold the NUL terminator. */ if (ps.node->first_avail == ps.node->endp) { @@ -1028,7 +1028,7 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) } } - if (apr_vformatter(psprintf_flush, &ps.vbuff, fmt, ap) == -1) { + if (fspr_vformatter(psprintf_flush, &ps.vbuff, fmt, ap) == -1) { if (pool->abort_fn) pool->abort_fn(APR_ENOMEM); @@ -1082,7 +1082,7 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) end: #if APR_HAS_THREADS - if (pool->user_mutex) apr_thread_mutex_unlock(pool->user_mutex); + if (pool->user_mutex) fspr_thread_mutex_unlock(pool->user_mutex); #endif return strp; @@ -1100,12 +1100,12 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) * anything other than 0, abort the traversal and return the value * returned by fn. */ -static int apr_pool_walk_tree(apr_pool_t *pool, - int (*fn)(apr_pool_t *pool, void *data), +static int fspr_pool_walk_tree(fspr_pool_t *pool, + int (*fn)(fspr_pool_t *pool, void *data), void *data) { int rv; - apr_pool_t *child; + fspr_pool_t *child; rv = fn(pool, data); if (rv) @@ -1113,13 +1113,13 @@ static int apr_pool_walk_tree(apr_pool_t *pool, #if APR_HAS_THREADS if (pool->mutex) { - apr_thread_mutex_lock(pool->mutex); + fspr_thread_mutex_lock(pool->mutex); } #endif /* APR_HAS_THREADS */ child = pool->child; while (child) { - rv = apr_pool_walk_tree(child, fn, data); + rv = fspr_pool_walk_tree(child, fn, data); if (rv) break; @@ -1128,21 +1128,21 @@ static int apr_pool_walk_tree(apr_pool_t *pool, #if APR_HAS_THREADS if (pool->mutex) { - apr_thread_mutex_unlock(pool->mutex); + fspr_thread_mutex_unlock(pool->mutex); } #endif /* APR_HAS_THREADS */ return rv; } -APR_DECLARE(int) apr_pool_walk_tree_debug(apr_pool_t *pool, - int(*fn)(apr_pool_t *pool, void *data), +APR_DECLARE(int) fspr_pool_walk_tree_debug(fspr_pool_t *pool, + int(*fn)(fspr_pool_t *pool, void *data), void *data) { - return apr_pool_walk_tree(pool, fn, data); + return fspr_pool_walk_tree(pool, fn, data); } -APR_DECLARE(void) apr_pool_get_stats(apr_pool_t *pool, unsigned int *alloc, unsigned int *total_alloc, unsigned int *clear) +APR_DECLARE(void) fspr_pool_get_stats(fspr_pool_t *pool, unsigned int *alloc, unsigned int *total_alloc, unsigned int *clear) { if (pool) { *alloc = pool->stat_alloc; @@ -1152,12 +1152,12 @@ APR_DECLARE(void) apr_pool_get_stats(apr_pool_t *pool, unsigned int *alloc, unsi } #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) -static void apr_pool_log_event(apr_pool_t *pool, const char *event, +static void fspr_pool_log_event(fspr_pool_t *pool, const char *event, const char *file_line, int deref) { if (file_stderr) { if (deref) { - apr_file_printf(file_stderr, + fspr_file_printf(file_stderr, "POOL DEBUG: " "[%lu" #if APR_HAS_THREADS @@ -1172,18 +1172,18 @@ static void apr_pool_log_event(apr_pool_t *pool, const char *event, "\n", (unsigned long)getpid(), #if APR_HAS_THREADS - (unsigned long)apr_os_thread_current(), + (unsigned long)fspr_os_thread_current(), #endif /* APR_HAS_THREADS */ event, - (unsigned long)apr_pool_num_bytes(pool, 0), - (unsigned long)apr_pool_num_bytes(pool, 1), - (unsigned long)apr_pool_num_bytes(global_pool, 1), + (unsigned long)fspr_pool_num_bytes(pool, 0), + (unsigned long)fspr_pool_num_bytes(pool, 1), + (unsigned long)fspr_pool_num_bytes(global_pool, 1), (unsigned int)pool, pool->tag, file_line, pool->stat_alloc, pool->stat_total_alloc, pool->stat_clear); } else { - apr_file_printf(file_stderr, + fspr_file_printf(file_stderr, "POOL DEBUG: " "[%lu" #if APR_HAS_THREADS @@ -1197,7 +1197,7 @@ static void apr_pool_log_event(apr_pool_t *pool, const char *event, "\n", (unsigned long)getpid(), #if APR_HAS_THREADS - (unsigned long)apr_os_thread_current(), + (unsigned long)fspr_os_thread_current(), #endif /* APR_HAS_THREADS */ event, (unsigned int)pool, @@ -1208,26 +1208,26 @@ static void apr_pool_log_event(apr_pool_t *pool, const char *event, #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */ #if (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME) -static int pool_is_child_of(apr_pool_t *parent, void *data) +static int pool_is_child_of(fspr_pool_t *parent, void *data) { - apr_pool_t *pool = (apr_pool_t *)data; + fspr_pool_t *pool = (fspr_pool_t *)data; return (pool == parent); } -static int apr_pool_is_child_of(apr_pool_t *pool, apr_pool_t *parent) +static int fspr_pool_is_child_of(fspr_pool_t *pool, fspr_pool_t *parent) { if (parent == NULL) return 0; - return apr_pool_walk_tree(parent, pool_is_child_of, pool); + return fspr_pool_walk_tree(parent, pool_is_child_of, pool); } #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME) */ -static void apr_pool_check_integrity(apr_pool_t *pool) +static void fspr_pool_check_integrity(fspr_pool_t *pool) { /* Rule of thumb: use of the global pool is always - * ok, since the only user is apr_pools.c. Unless + * ok, since the only user is fspr_pools.c. Unless * people have searched for the top level parent and * started to use that... */ @@ -1240,10 +1240,10 @@ static void apr_pool_check_integrity(apr_pool_t *pool) * destroyed, in which case we abort(). */ #if (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME) - if (!apr_pool_is_child_of(pool, global_pool)) { + if (!fspr_pool_is_child_of(pool, global_pool)) { #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) - apr_pool_log_event(pool, "LIFE", - __FILE__ ":apr_pool_integrity check", 0); + fspr_pool_log_event(pool, "LIFE", + __FILE__ ":fspr_pool_integrity check", 0); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */ abort(); } @@ -1251,10 +1251,10 @@ static void apr_pool_check_integrity(apr_pool_t *pool) #if (APR_POOL_DEBUG & APR_POOL_DEBUG_OWNER) #if APR_HAS_THREADS - if (!apr_os_thread_equal(pool->owner, apr_os_thread_current())) { + if (!fspr_os_thread_equal(pool->owner, fspr_os_thread_current())) { #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) - apr_pool_log_event(pool, "THREAD", - __FILE__ ":apr_pool_integrity check", 0); + fspr_pool_log_event(pool, "THREAD", + __FILE__ ":fspr_pool_integrity check", 0); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */ abort(); } @@ -1267,14 +1267,14 @@ static void apr_pool_check_integrity(apr_pool_t *pool) * Initialization (debug) */ -APR_DECLARE(apr_status_t) apr_pool_initialize(void) +APR_DECLARE(fspr_status_t) fspr_pool_initialize(void) { - apr_status_t rv; + fspr_status_t rv; #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) char *logpath; #endif - if (apr_pools_initialized++) + if (fspr_pools_initialized++) return APR_SUCCESS; /* Since the debug code works a bit differently then the @@ -1282,35 +1282,35 @@ APR_DECLARE(apr_status_t) apr_pool_initialize(void) * pools code has got this lock embedded in the global * allocator, a concept unknown to debug mode. */ - if ((rv = apr_pool_create_ex(&global_pool, NULL, NULL, + if ((rv = fspr_pool_create_ex(&global_pool, NULL, NULL, NULL)) != APR_SUCCESS) { return rv; } - apr_pool_tag(global_pool, "APR global pool"); + fspr_pool_tag(global_pool, "APR global pool"); - apr_pools_initialized = 1; + fspr_pools_initialized = 1; /* This has to happen here because mutexes might be backed by - * atomics. It used to be snug and safe in apr_initialize(). + * atomics. It used to be snug and safe in fspr_initialize(). */ - if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) { + if ((rv = fspr_atomic_init(global_pool)) != APR_SUCCESS) { return rv; } #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) - rv = apr_env_get(&logpath, "APR_POOL_DEBUG_LOG", global_pool); + rv = fspr_env_get(&logpath, "APR_POOL_DEBUG_LOG", global_pool); if (rv == APR_SUCCESS) { - apr_file_open(&file_stderr, logpath, APR_APPEND|APR_WRITE|APR_CREATE, + fspr_file_open(&file_stderr, logpath, APR_APPEND|APR_WRITE|APR_CREATE, APR_OS_DEFAULT, global_pool); } else { - apr_file_open_stderr(&file_stderr, global_pool); + fspr_file_open_stderr(&file_stderr, global_pool); } if (file_stderr) { - apr_file_printf(file_stderr, + fspr_file_printf(file_stderr, "POOL DEBUG: [PID" #if APR_HAS_THREADS "/TID" @@ -1318,21 +1318,21 @@ APR_DECLARE(apr_status_t) apr_pool_initialize(void) "] ACTION (SIZE /POOL SIZE /TOTAL SIZE) " "POOL \"TAG\" <__FILE__:__LINE__> (ALLOCS/TOTAL ALLOCS/CLEARS)\n"); - apr_pool_log_event(global_pool, "GLOBAL", __FILE__ ":apr_pool_initialize", 0); + fspr_pool_log_event(global_pool, "GLOBAL", __FILE__ ":fspr_pool_initialize", 0); } #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */ return APR_SUCCESS; } -APR_DECLARE(void) apr_pool_terminate(void) +APR_DECLARE(void) fspr_pool_terminate(void) { - if (!apr_pools_initialized) + if (!fspr_pools_initialized) return; - apr_pools_initialized = 0; + fspr_pools_initialized = 0; - apr_pool_destroy(global_pool); /* This will also destroy the mutex */ + fspr_pool_destroy(global_pool); /* This will also destroy the mutex */ global_pool = NULL; #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) @@ -1345,7 +1345,7 @@ APR_DECLARE(void) apr_pool_terminate(void) * Memory allocation (debug) */ -static void *pool_alloc(apr_pool_t *pool, apr_size_t size) +static void *pool_alloc(fspr_pool_t *pool, fspr_size_t size) { debug_node_t *node; void *mem; @@ -1383,34 +1383,34 @@ static void *pool_alloc(apr_pool_t *pool, apr_size_t size) return mem; } -APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *pool, apr_size_t size, +APR_DECLARE(void *) fspr_palloc_debug(fspr_pool_t *pool, fspr_size_t size, const char *file_line) { void *mem; - apr_pool_check_integrity(pool); + fspr_pool_check_integrity(pool); mem = pool_alloc(pool, size); #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC) - apr_pool_log_event(pool, "PALLOC", file_line, 1); + fspr_pool_log_event(pool, "PALLOC", file_line, 1); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC) */ return mem; } -APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *pool, apr_size_t size, +APR_DECLARE(void *) fspr_pcalloc_debug(fspr_pool_t *pool, fspr_size_t size, const char *file_line) { void *mem; - apr_pool_check_integrity(pool); + fspr_pool_check_integrity(pool); mem = pool_alloc(pool, size); memset(mem, 0, size); #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC) - apr_pool_log_event(pool, "PCALLOC", file_line, 1); + fspr_pool_log_event(pool, "PCALLOC", file_line, 1); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC) */ return mem; @@ -1423,10 +1423,10 @@ APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *pool, apr_size_t size, #define POOL_POISON_BYTE 'A' -static void pool_clear_debug(apr_pool_t *pool, const char *file_line) +static void pool_clear_debug(fspr_pool_t *pool, const char *file_line) { debug_node_t *node; - apr_uint32_t index; + fspr_uint32_t index; /* Destroy the subpools. The subpools will detach themselves from * this pool thus this loop is safe and easy. @@ -1469,17 +1469,17 @@ static void pool_clear_debug(apr_pool_t *pool, const char *file_line) pool->stat_clear++; } -APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool, +APR_DECLARE(void) fspr_pool_clear_debug(fspr_pool_t *pool, const char *file_line) { #if APR_HAS_THREADS - apr_thread_mutex_t *mutex = NULL; + fspr_thread_mutex_t *mutex = NULL; #endif - apr_pool_check_integrity(pool); + fspr_pool_check_integrity(pool); #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) - apr_pool_log_event(pool, "CLEAR", file_line, 1); + fspr_pool_log_event(pool, "CLEAR", file_line, 1); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */ #if APR_HAS_THREADS @@ -1487,11 +1487,11 @@ APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool, mutex = pool->parent->mutex; /* Lock the parent mutex before clearing so that if we have our - * own mutex it won't be accessed by apr_pool_walk_tree after + * own mutex it won't be accessed by fspr_pool_walk_tree after * it has been destroyed. */ if (mutex != NULL && mutex != pool->mutex) { - apr_thread_mutex_lock(mutex); + fspr_thread_mutex_lock(mutex); } #endif @@ -1503,21 +1503,21 @@ APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool, * the mutex we obtained above. */ if (mutex != pool->mutex) { - (void)apr_thread_mutex_create(&pool->mutex, + (void)fspr_thread_mutex_create(&pool->mutex, APR_THREAD_MUTEX_NESTED, pool); if (mutex != NULL) - (void)apr_thread_mutex_unlock(mutex); + (void)fspr_thread_mutex_unlock(mutex); } #endif /* APR_HAS_THREADS */ } -static void pool_destroy_debug(apr_pool_t *pool, const char *file_line) +static void pool_destroy_debug(fspr_pool_t *pool, const char *file_line) { - apr_pool_check_integrity(pool); + fspr_pool_check_integrity(pool); #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) - apr_pool_log_event(pool, "DESTROY", file_line, 1); + fspr_pool_log_event(pool, "DESTROY", file_line, 1); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */ pool_clear_debug(pool, file_line); @@ -1525,10 +1525,10 @@ static void pool_destroy_debug(apr_pool_t *pool, const char *file_line) /* Remove the pool from the parents child list */ if (pool->parent) { #if APR_HAS_THREADS - apr_thread_mutex_t *mutex; + fspr_thread_mutex_t *mutex; if ((mutex = pool->parent->mutex) != NULL) - apr_thread_mutex_lock(mutex); + fspr_thread_mutex_lock(mutex); #endif /* APR_HAS_THREADS */ if ((*pool->ref = pool->sibling) != NULL) @@ -1536,28 +1536,28 @@ static void pool_destroy_debug(apr_pool_t *pool, const char *file_line) #if APR_HAS_THREADS if (mutex) - apr_thread_mutex_unlock(mutex); + fspr_thread_mutex_unlock(mutex); #endif /* APR_HAS_THREADS */ } if (pool->allocator != NULL - && apr_allocator_owner_get(pool->allocator) == pool) { - apr_allocator_destroy(pool->allocator); + && fspr_allocator_owner_get(pool->allocator) == pool) { + fspr_allocator_destroy(pool->allocator); } /* Free the pool itself */ free(pool); } -APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *pool, +APR_DECLARE(void) fspr_pool_destroy_debug(fspr_pool_t *pool, const char *file_line) { if (pool->joined) { /* Joined pools must not be explicitly destroyed; the caller * has broken the guarantee. */ #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) - apr_pool_log_event(pool, "LIFE", - __FILE__ ":apr_pool_destroy abort on joined", 0); + fspr_pool_log_event(pool, "LIFE", + __FILE__ ":fspr_pool_destroy abort on joined", 0); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */ abort(); @@ -1565,13 +1565,13 @@ APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *pool, pool_destroy_debug(pool, file_line); } -APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, - apr_pool_t *parent, - apr_abortfunc_t abort_fn, - apr_allocator_t *allocator, +APR_DECLARE(fspr_status_t) fspr_pool_create_ex_debug(fspr_pool_t **newpool, + fspr_pool_t *parent, + fspr_abortfunc_t abort_fn, + fspr_allocator_t *allocator, const char *file_line) { - apr_pool_t *pool; + fspr_pool_t *pool; *newpool = NULL; @@ -1579,7 +1579,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, parent = global_pool; } else { - apr_pool_check_integrity(parent); + fspr_pool_check_integrity(parent); if (!allocator) allocator = parent->allocator; @@ -1605,7 +1605,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, if ((pool->parent = parent) != NULL) { #if APR_HAS_THREADS if (parent->mutex) - apr_thread_mutex_lock(parent->mutex); + fspr_thread_mutex_lock(parent->mutex); #endif /* APR_HAS_THREADS */ if ((pool->sibling = parent->child) != NULL) pool->sibling->ref = &pool->sibling; @@ -1615,7 +1615,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, #if APR_HAS_THREADS if (parent->mutex) - apr_thread_mutex_unlock(parent->mutex); + fspr_thread_mutex_unlock(parent->mutex); #endif /* APR_HAS_THREADS */ } else { @@ -1624,26 +1624,26 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, } #if APR_HAS_THREADS - pool->owner = apr_os_thread_current(); + pool->owner = fspr_os_thread_current(); #endif /* APR_HAS_THREADS */ #ifdef NETWARE - pool->owner_proc = (apr_os_proc_t)getnlmhandle(); + pool->owner_proc = (fspr_os_proc_t)getnlmhandle(); #endif /* defined(NETWARE) */ if (parent == NULL || parent->allocator != allocator) { #if APR_HAS_THREADS - apr_status_t rv; + fspr_status_t rv; /* No matter what the creation flags say, always create - * a lock. Without it integrity_check and apr_pool_num_bytes + * a lock. Without it integrity_check and fspr_pool_num_bytes * blow up (because they traverse pools child lists that * possibly belong to another thread, in combination with * the pool having no lock). However, this might actually * hide problems like creating a child pool of a pool * belonging to another thread. */ - if ((rv = apr_thread_mutex_create(&pool->mutex, + if ((rv = fspr_thread_mutex_create(&pool->mutex, APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) { free(pool); return rv; @@ -1660,7 +1660,7 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, *newpool = pool; #if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) - apr_pool_log_event(pool, "CREATE", file_line, 1); + fspr_pool_log_event(pool, "CREATE", file_line, 1); #endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */ return APR_SUCCESS; @@ -1672,15 +1672,15 @@ APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, */ struct psprintf_data { - apr_vformatter_buff_t vbuff; + fspr_vformatter_buff_t vbuff; char *mem; - apr_size_t size; + fspr_size_t size; }; -static int psprintf_flush(apr_vformatter_buff_t *vbuff) +static int psprintf_flush(fspr_vformatter_buff_t *vbuff) { struct psprintf_data *ps = (struct psprintf_data *)vbuff; - apr_size_t size; + fspr_size_t size; size = ps->vbuff.curpos - ps->mem; @@ -1694,12 +1694,12 @@ static int psprintf_flush(apr_vformatter_buff_t *vbuff) return 0; } -APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) +APR_DECLARE(char *) fspr_pvsprintf(fspr_pool_t *pool, const char *fmt, va_list ap) { struct psprintf_data ps; debug_node_t *node; - apr_pool_check_integrity(pool); + fspr_pool_check_integrity(pool); ps.size = 64; ps.mem = malloc(ps.size); @@ -1708,7 +1708,7 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) /* Save a byte for the NUL terminator */ ps.vbuff.endpos = ps.mem + ps.size - 1; - if (apr_vformatter(psprintf_flush, &ps.vbuff, fmt, ap) == -1) { + if (fspr_vformatter(psprintf_flush, &ps.vbuff, fmt, ap) == -1) { if (pool->abort_fn) pool->abort_fn(APR_ENOMEM); @@ -1746,7 +1746,7 @@ APR_DECLARE(char *) apr_pvsprintf(apr_pool_t *pool, const char *fmt, va_list ap) * Debug functions */ -APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub) +APR_DECLARE(void) fspr_pool_join(fspr_pool_t *p, fspr_pool_t *sub) { #if APR_POOL_DEBUG if (sub->parent != p) { @@ -1756,11 +1756,11 @@ APR_DECLARE(void) apr_pool_join(apr_pool_t *p, apr_pool_t *sub) #endif } -static int pool_find(apr_pool_t *pool, void *data) +static int pool_find(fspr_pool_t *pool, void *data) { void **pmem = (void **)data; debug_node_t *node; - apr_uint32_t index; + fspr_uint32_t index; node = pool->nodes; @@ -1779,21 +1779,21 @@ static int pool_find(apr_pool_t *pool, void *data) return 0; } -APR_DECLARE(apr_pool_t *) apr_pool_find(const void *mem) +APR_DECLARE(fspr_pool_t *) fspr_pool_find(const void *mem) { void *pool = (void *)mem; - if (apr_pool_walk_tree(global_pool, pool_find, &pool)) + if (fspr_pool_walk_tree(global_pool, pool_find, &pool)) return pool; return NULL; } -static int pool_num_bytes(apr_pool_t *pool, void *data) +static int pool_num_bytes(fspr_pool_t *pool, void *data) { - apr_size_t *psize = (apr_size_t *)data; + fspr_size_t *psize = (fspr_size_t *)data; debug_node_t *node; - apr_uint32_t index; + fspr_uint32_t index; node = pool->nodes; @@ -1808,9 +1808,9 @@ static int pool_num_bytes(apr_pool_t *pool, void *data) return 0; } -APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *pool, int recurse) +APR_DECLARE(fspr_size_t) fspr_pool_num_bytes(fspr_pool_t *pool, int recurse) { - apr_size_t size = 0; + fspr_size_t size = 0; if (!recurse) { pool_num_bytes(pool, &size); @@ -1818,12 +1818,12 @@ APR_DECLARE(apr_size_t) apr_pool_num_bytes(apr_pool_t *pool, int recurse) return size; } - apr_pool_walk_tree(pool, pool_num_bytes, &size); + fspr_pool_walk_tree(pool, pool_num_bytes, &size); return size; } -APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag) +APR_DECLARE(void) fspr_pool_lock(fspr_pool_t *pool, int flag) { } @@ -1832,12 +1832,12 @@ APR_DECLARE(void) apr_pool_lock(apr_pool_t *pool, int flag) #ifdef NETWARE void netware_pool_proc_cleanup () { - apr_pool_t *pool = global_pool->child; - apr_os_proc_t owner_proc = (apr_os_proc_t)getnlmhandle(); + fspr_pool_t *pool = global_pool->child; + fspr_os_proc_t owner_proc = (fspr_os_proc_t)getnlmhandle(); while (pool) { if (pool->owner_proc == owner_proc) { - apr_pool_destroy (pool); + fspr_pool_destroy (pool); pool = global_pool->child; } else { @@ -1853,13 +1853,13 @@ void netware_pool_proc_cleanup () * "Print" functions (common) */ -APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...) +APR_DECLARE_NONSTD(char *) fspr_psprintf(fspr_pool_t *p, const char *fmt, ...) { va_list ap; char *res; va_start(ap, fmt); - res = apr_pvsprintf(p, fmt, ap); + res = fspr_pvsprintf(p, fmt, ap); va_end(ap); return res; } @@ -1868,18 +1868,18 @@ APR_DECLARE_NONSTD(char *) apr_psprintf(apr_pool_t *p, const char *fmt, ...) * Pool Properties */ -APR_DECLARE(void) apr_pool_abort_set(apr_abortfunc_t abort_fn, - apr_pool_t *pool) +APR_DECLARE(void) fspr_pool_abort_set(fspr_abortfunc_t abort_fn, + fspr_pool_t *pool) { pool->abort_fn = abort_fn; } -APR_DECLARE(apr_abortfunc_t) apr_pool_abort_get(apr_pool_t *pool) +APR_DECLARE(fspr_abortfunc_t) fspr_pool_abort_get(fspr_pool_t *pool) { return pool->abort_fn; } -APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool) +APR_DECLARE(fspr_pool_t *) fspr_pool_parent_get(fspr_pool_t *pool) { #ifdef NETWARE /* On NetWare, don't return the global_pool, return the application pool @@ -1891,7 +1891,7 @@ APR_DECLARE(apr_pool_t *) apr_pool_parent_get(apr_pool_t *pool) return pool->parent; } -APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool) +APR_DECLARE(fspr_allocator_t *) fspr_pool_allocator_get(fspr_pool_t *pool) { return pool->allocator; } @@ -1899,7 +1899,7 @@ APR_DECLARE(apr_allocator_t *) apr_pool_allocator_get(apr_pool_t *pool) /* return TRUE if a is an ancestor of b * NULL is considered an ancestor of all pools */ -APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b) +APR_DECLARE(int) fspr_pool_is_ancestor(fspr_pool_t *a, fspr_pool_t *b) { if (a == NULL) return 1; @@ -1922,7 +1922,7 @@ APR_DECLARE(int) apr_pool_is_ancestor(apr_pool_t *a, apr_pool_t *b) return 0; } -APR_DECLARE(const char *) apr_pool_tag(apr_pool_t *pool, const char *tag) +APR_DECLARE(const char *) fspr_pool_tag(fspr_pool_t *pool, const char *tag) { if (tag) { pool->tag = tag; @@ -1936,63 +1936,63 @@ APR_DECLARE(const char *) apr_pool_tag(apr_pool_t *pool, const char *tag) * User data management */ -APR_DECLARE(apr_status_t) apr_pool_userdata_set(const void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_pool_userdata_set(const void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_pool_t *pool) { #if APR_POOL_DEBUG - apr_pool_check_integrity(pool); + fspr_pool_check_integrity(pool); #endif /* APR_POOL_DEBUG */ if (pool->user_data == NULL) - pool->user_data = apr_hash_make(pool); + pool->user_data = fspr_hash_make(pool); - if (apr_hash_get(pool->user_data, key, APR_HASH_KEY_STRING) == NULL) { - char *new_key = apr_pstrdup(pool, key); - apr_hash_set(pool->user_data, new_key, APR_HASH_KEY_STRING, data); + if (fspr_hash_get(pool->user_data, key, APR_HASH_KEY_STRING) == NULL) { + char *new_key = fspr_pstrdup(pool, key); + fspr_hash_set(pool->user_data, new_key, APR_HASH_KEY_STRING, data); } else { - apr_hash_set(pool->user_data, key, APR_HASH_KEY_STRING, data); + fspr_hash_set(pool->user_data, key, APR_HASH_KEY_STRING, data); } if (cleanup) - apr_pool_cleanup_register(pool, data, cleanup, cleanup); + fspr_pool_cleanup_register(pool, data, cleanup, cleanup); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pool_userdata_setn(const void *data, +APR_DECLARE(fspr_status_t) fspr_pool_userdata_setn(const void *data, const char *key, - apr_status_t (*cleanup)(void *), - apr_pool_t *pool) + fspr_status_t (*cleanup)(void *), + fspr_pool_t *pool) { #if APR_POOL_DEBUG - apr_pool_check_integrity(pool); + fspr_pool_check_integrity(pool); #endif /* APR_POOL_DEBUG */ if (pool->user_data == NULL) - pool->user_data = apr_hash_make(pool); + pool->user_data = fspr_hash_make(pool); - apr_hash_set(pool->user_data, key, APR_HASH_KEY_STRING, data); + fspr_hash_set(pool->user_data, key, APR_HASH_KEY_STRING, data); if (cleanup) - apr_pool_cleanup_register(pool, data, cleanup, cleanup); + fspr_pool_cleanup_register(pool, data, cleanup, cleanup); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_pool_userdata_get(void **data, const char *key, + fspr_pool_t *pool) { #if APR_POOL_DEBUG - apr_pool_check_integrity(pool); + fspr_pool_check_integrity(pool); #endif /* APR_POOL_DEBUG */ if (pool->user_data == NULL) { *data = NULL; } else { - *data = apr_hash_get(pool->user_data, key, APR_HASH_KEY_STRING); + *data = fspr_hash_get(pool->user_data, key, APR_HASH_KEY_STRING); } return APR_SUCCESS; @@ -2006,18 +2006,18 @@ APR_DECLARE(apr_status_t) apr_pool_userdata_get(void **data, const char *key, struct cleanup_t { struct cleanup_t *next; const void *data; - apr_status_t (*plain_cleanup_fn)(void *data); - apr_status_t (*child_cleanup_fn)(void *data); + fspr_status_t (*plain_cleanup_fn)(void *data); + fspr_status_t (*child_cleanup_fn)(void *data); }; -APR_DECLARE(void) apr_pool_cleanup_register(apr_pool_t *p, const void *data, - apr_status_t (*plain_cleanup_fn)(void *data), - apr_status_t (*child_cleanup_fn)(void *data)) +APR_DECLARE(void) fspr_pool_cleanup_register(fspr_pool_t *p, const void *data, + fspr_status_t (*plain_cleanup_fn)(void *data), + fspr_status_t (*child_cleanup_fn)(void *data)) { cleanup_t *c; #if APR_POOL_DEBUG - apr_pool_check_integrity(p); + fspr_pool_check_integrity(p); #endif /* APR_POOL_DEBUG */ if (p != NULL) { @@ -2026,7 +2026,7 @@ APR_DECLARE(void) apr_pool_cleanup_register(apr_pool_t *p, const void *data, c = p->free_cleanups; p->free_cleanups = c->next; } else { - c = apr_palloc(p, sizeof(cleanup_t)); + c = fspr_palloc(p, sizeof(cleanup_t)); } c->data = data; c->plain_cleanup_fn = plain_cleanup_fn; @@ -2036,13 +2036,13 @@ APR_DECLARE(void) apr_pool_cleanup_register(apr_pool_t *p, const void *data, } } -APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data, - apr_status_t (*cleanup_fn)(void *)) +APR_DECLARE(void) fspr_pool_cleanup_kill(fspr_pool_t *p, const void *data, + fspr_status_t (*cleanup_fn)(void *)) { cleanup_t *c, **lastp; #if APR_POOL_DEBUG - apr_pool_check_integrity(p); + fspr_pool_check_integrity(p); #endif /* APR_POOL_DEBUG */ if (p == NULL) @@ -2069,14 +2069,14 @@ APR_DECLARE(void) apr_pool_cleanup_kill(apr_pool_t *p, const void *data, } } -APR_DECLARE(void) apr_pool_child_cleanup_set(apr_pool_t *p, const void *data, - apr_status_t (*plain_cleanup_fn)(void *), - apr_status_t (*child_cleanup_fn)(void *)) +APR_DECLARE(void) fspr_pool_child_cleanup_set(fspr_pool_t *p, const void *data, + fspr_status_t (*plain_cleanup_fn)(void *), + fspr_status_t (*child_cleanup_fn)(void *)) { cleanup_t *c; #if APR_POOL_DEBUG - apr_pool_check_integrity(p); + fspr_pool_check_integrity(p); #endif /* APR_POOL_DEBUG */ if (p == NULL) @@ -2093,10 +2093,10 @@ APR_DECLARE(void) apr_pool_child_cleanup_set(apr_pool_t *p, const void *data, } } -APR_DECLARE(apr_status_t) apr_pool_cleanup_run(apr_pool_t *p, void *data, - apr_status_t (*cleanup_fn)(void *)) +APR_DECLARE(fspr_status_t) fspr_pool_cleanup_run(fspr_pool_t *p, void *data, + fspr_status_t (*cleanup_fn)(void *)) { - apr_pool_cleanup_kill(p, data, cleanup_fn); + fspr_pool_cleanup_kill(p, data, cleanup_fn); return (*cleanup_fn)(data); } @@ -2122,7 +2122,7 @@ static void run_child_cleanups(cleanup_t **cref) } } -static void cleanup_pool_for_exec(apr_pool_t *p) +static void cleanup_pool_for_exec(fspr_pool_t *p) { run_child_cleanups(&p->cleanups); @@ -2130,7 +2130,7 @@ static void cleanup_pool_for_exec(apr_pool_t *p) cleanup_pool_for_exec(p); } -APR_DECLARE(void) apr_pool_cleanup_for_exec(void) +APR_DECLARE(void) fspr_pool_cleanup_for_exec(void) { #if !defined(WIN32) && !defined(OS2) /* @@ -2146,7 +2146,7 @@ APR_DECLARE(void) apr_pool_cleanup_for_exec(void) #endif /* !defined(WIN32) && !defined(OS2) */ } -APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data) +APR_DECLARE_NONSTD(fspr_status_t) fspr_pool_cleanup_null(void *data) { /* do nothing cleanup routine */ return APR_SUCCESS; @@ -2159,10 +2159,10 @@ APR_DECLARE_NONSTD(apr_status_t) apr_pool_cleanup_null(void *data) * we might want to fold support for that into the generic interface. * For now, it's a special case. */ -APR_DECLARE(void) apr_pool_note_subprocess(apr_pool_t *pool, apr_proc_t *proc, - apr_kill_conditions_e how) +APR_DECLARE(void) fspr_pool_note_subprocess(fspr_pool_t *pool, fspr_proc_t *proc, + fspr_kill_conditions_e how) { - struct process_chain *pc = apr_palloc(pool, sizeof(struct process_chain)); + struct process_chain *pc = fspr_palloc(pool, sizeof(struct process_chain)); pc->proc = proc; pc->kill_how = how; @@ -2178,7 +2178,7 @@ static void free_proc_chain(struct process_chain *procs) */ struct process_chain *pc; int need_timeout = 0; - apr_time_t timeout_interval; + fspr_time_t timeout_interval; if (!procs) return; /* No work. Whew! */ @@ -2193,7 +2193,7 @@ static void free_proc_chain(struct process_chain *procs) #ifndef NEED_WAITPID /* Pick up all defunct processes */ for (pc = procs; pc; pc = pc->next) { - if (apr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT) != APR_CHILD_NOTDONE) + if (fspr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT) != APR_CHILD_NOTDONE) pc->kill_how = APR_KILL_NEVER; } #endif /* !defined(NEED_WAITPID) */ @@ -2204,11 +2204,11 @@ static void free_proc_chain(struct process_chain *procs) || (pc->kill_how == APR_KILL_ONLY_ONCE)) { /* * Subprocess may be dead already. Only need the timeout if not. - * Note: apr_proc_kill on Windows is TerminateProcess(), which is + * Note: fspr_proc_kill on Windows is TerminateProcess(), which is * similar to a SIGKILL, so always give the process a timeout * under Windows before killing it. */ - if (apr_proc_kill(pc->proc, SIGTERM) == APR_SUCCESS) + if (fspr_proc_kill(pc->proc, SIGTERM) == APR_SUCCESS) need_timeout = 1; } else if (pc->kill_how == APR_KILL_ALWAYS) { @@ -2217,7 +2217,7 @@ static void free_proc_chain(struct process_chain *procs) need_timeout = 1; pc->kill_how = APR_KILL_ALWAYS; #endif - apr_proc_kill(pc->proc, SIGKILL); + fspr_proc_kill(pc->proc, SIGKILL); } } @@ -2227,14 +2227,14 @@ static void free_proc_chain(struct process_chain *procs) */ if (need_timeout) { timeout_interval = TIMEOUT_INTERVAL; - apr_sleep(timeout_interval); + fspr_sleep(timeout_interval); do { /* check the status of the subprocesses */ need_timeout = 0; for (pc = procs; pc; pc = pc->next) { if (pc->kill_how == APR_KILL_AFTER_TIMEOUT) { - if (apr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT) + if (fspr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT) == APR_CHILD_NOTDONE) need_timeout = 1; /* subprocess is still active */ else @@ -2245,7 +2245,7 @@ static void free_proc_chain(struct process_chain *procs) if (timeout_interval >= TIMEOUT_USECS) { break; } - apr_sleep(timeout_interval); + fspr_sleep(timeout_interval); timeout_interval *= 2; } } while (need_timeout); @@ -2257,13 +2257,13 @@ static void free_proc_chain(struct process_chain *procs) */ for (pc = procs; pc; pc = pc->next) { if (pc->kill_how == APR_KILL_AFTER_TIMEOUT) - apr_proc_kill(pc->proc, SIGKILL); + fspr_proc_kill(pc->proc, SIGKILL); } /* Now wait for all the signaled processes to die */ for (pc = procs; pc; pc = pc->next) { if (pc->kill_how != APR_KILL_NEVER) - (void)apr_proc_wait(pc->proc, NULL, NULL, APR_WAIT); + (void)fspr_proc_wait(pc->proc, NULL, NULL, APR_WAIT); } } @@ -2274,85 +2274,85 @@ static void free_proc_chain(struct process_chain *procs) */ #if !APR_POOL_DEBUG -APR_DECLARE(void *) apr_palloc_debug(apr_pool_t *pool, apr_size_t size, +APR_DECLARE(void *) fspr_palloc_debug(fspr_pool_t *pool, fspr_size_t size, const char *file_line) { - return apr_palloc(pool, size); + return fspr_palloc(pool, size); } -APR_DECLARE(void *) apr_pcalloc_debug(apr_pool_t *pool, apr_size_t size, +APR_DECLARE(void *) fspr_pcalloc_debug(fspr_pool_t *pool, fspr_size_t size, const char *file_line) { - return apr_pcalloc(pool, size); + return fspr_pcalloc(pool, size); } -APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool, +APR_DECLARE(void) fspr_pool_clear_debug(fspr_pool_t *pool, const char *file_line) { - apr_pool_clear(pool); + fspr_pool_clear(pool); } -APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *pool, +APR_DECLARE(void) fspr_pool_destroy_debug(fspr_pool_t *pool, const char *file_line) { - apr_pool_destroy(pool); + fspr_pool_destroy(pool); } -APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool, - apr_pool_t *parent, - apr_abortfunc_t abort_fn, - apr_allocator_t *allocator, +APR_DECLARE(fspr_status_t) fspr_pool_create_ex_debug(fspr_pool_t **newpool, + fspr_pool_t *parent, + fspr_abortfunc_t abort_fn, + fspr_allocator_t *allocator, const char *file_line) { - return apr_pool_create_ex(newpool, parent, abort_fn, allocator); + return fspr_pool_create_ex(newpool, parent, abort_fn, allocator); } #else /* APR_POOL_DEBUG */ -#undef apr_palloc -APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size); +#undef fspr_palloc +APR_DECLARE(void *) fspr_palloc(fspr_pool_t *pool, fspr_size_t size); -APR_DECLARE(void *) apr_palloc(apr_pool_t *pool, apr_size_t size) +APR_DECLARE(void *) fspr_palloc(fspr_pool_t *pool, fspr_size_t size) { - return apr_palloc_debug(pool, size, "undefined"); + return fspr_palloc_debug(pool, size, "undefined"); } -#undef apr_pcalloc -APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size); +#undef fspr_pcalloc +APR_DECLARE(void *) fspr_pcalloc(fspr_pool_t *pool, fspr_size_t size); -APR_DECLARE(void *) apr_pcalloc(apr_pool_t *pool, apr_size_t size) +APR_DECLARE(void *) fspr_pcalloc(fspr_pool_t *pool, fspr_size_t size) { - return apr_pcalloc_debug(pool, size, "undefined"); + return fspr_pcalloc_debug(pool, size, "undefined"); } -#undef apr_pool_clear -APR_DECLARE(void) apr_pool_clear(apr_pool_t *pool); +#undef fspr_pool_clear +APR_DECLARE(void) fspr_pool_clear(fspr_pool_t *pool); -APR_DECLARE(void) apr_pool_clear(apr_pool_t *pool) +APR_DECLARE(void) fspr_pool_clear(fspr_pool_t *pool) { - apr_pool_clear_debug(pool, "undefined"); + fspr_pool_clear_debug(pool, "undefined"); } -#undef apr_pool_destroy -APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool); +#undef fspr_pool_destroy +APR_DECLARE(void) fspr_pool_destroy(fspr_pool_t *pool); -APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool) +APR_DECLARE(void) fspr_pool_destroy(fspr_pool_t *pool) { - apr_pool_destroy_debug(pool, "undefined"); + fspr_pool_destroy_debug(pool, "undefined"); } -#undef apr_pool_create_ex -APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, - apr_pool_t *parent, - apr_abortfunc_t abort_fn, - apr_allocator_t *allocator); +#undef fspr_pool_create_ex +APR_DECLARE(fspr_status_t) fspr_pool_create_ex(fspr_pool_t **newpool, + fspr_pool_t *parent, + fspr_abortfunc_t abort_fn, + fspr_allocator_t *allocator); -APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool, - apr_pool_t *parent, - apr_abortfunc_t abort_fn, - apr_allocator_t *allocator) +APR_DECLARE(fspr_status_t) fspr_pool_create_ex(fspr_pool_t **newpool, + fspr_pool_t *parent, + fspr_abortfunc_t abort_fn, + fspr_allocator_t *allocator) { - return apr_pool_create_ex_debug(newpool, parent, + return fspr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, "undefined"); } diff --git a/libs/apr/misc/netware/charset.c b/libs/apr/misc/netware/charset.c index b79add10b5..f8f376d86b 100644 --- a/libs/apr/misc/netware/charset.c +++ b/libs/apr/misc/netware/charset.c @@ -14,21 +14,21 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_strings.h" +#include "fspr_portable.h" /* static struct utsname sysinfo; */ /* XXX This needs to be fixed to produce the correct system language */ -APR_DECLARE(const char*) apr_os_default_encoding (apr_pool_t *pool) +APR_DECLARE(const char*) fspr_os_default_encoding (fspr_pool_t *pool) { - return apr_pstrdup(pool, "CP1252"); + return fspr_pstrdup(pool, "CP1252"); } -APR_DECLARE(const char*) apr_os_locale_encoding (apr_pool_t *pool) +APR_DECLARE(const char*) fspr_os_locale_encoding (fspr_pool_t *pool) { - return apr_os_default_encoding(pool); + return fspr_os_default_encoding(pool); } diff --git a/libs/apr/misc/netware/libprews.c b/libs/apr/misc/netware/libprews.c index 624bf22cfa..11fec7e7bc 100644 --- a/libs/apr/misc/netware/libprews.c +++ b/libs/apr/misc/netware/libprews.c @@ -20,8 +20,8 @@ #include "novsock2.h" #endif -#include "apr_pools.h" -#include "apr_private.h" +#include "fspr_pools.h" +#include "fspr_private.h" /* library-private data...*/ @@ -51,7 +51,7 @@ int _NonAppStart #ifdef USE_WINSOCK WSADATA wsaData; #endif - apr_status_t status; + fspr_status_t status; NX_LOCK_INFO_ALLOC(liblock, "Per-Application Data Lock", 0); @@ -83,9 +83,9 @@ int _NonAppStart return -1; } - apr_netware_setup_time(); + fspr_netware_setup_time(); - if ((status = apr_pool_initialize()) != APR_SUCCESS) + if ((status = fspr_pool_initialize()) != APR_SUCCESS) return status; #ifdef USE_WINSOCK @@ -97,7 +97,7 @@ int _NonAppStart void _NonAppStop( void ) { - apr_pool_terminate(); + fspr_pool_terminate(); #ifdef USE_WINSOCK WSACleanup(); diff --git a/libs/apr/misc/netware/rand.c b/libs/apr/misc/netware/rand.c index a2baae7ecd..f9bee2153a 100644 --- a/libs/apr/misc/netware/rand.c +++ b/libs/apr/misc/netware/rand.c @@ -15,9 +15,9 @@ */ #define APR_WANT_MEMFUNC -#include "apr_want.h" -#include "apr_general.h" -#include "apr_private.h" +#include "fspr_want.h" +#include "fspr_general.h" +#include "fspr_private.h" #if APR_HAS_RANDOM @@ -56,8 +56,8 @@ static int NXSeedRandomInternal( size_t width, void *seed ) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, - apr_size_t length) +APR_DECLARE(fspr_status_t) fspr_generate_random_bytes(unsigned char *buf, + fspr_size_t length) { if (NXSeedRandom(length, buf) != 0) { return NXSeedRandomInternal (length, buf); diff --git a/libs/apr/misc/netware/start.c b/libs/apr/misc/netware/start.c index c8ccc1c1c4..7636b2beea 100644 --- a/libs/apr/misc/netware/start.c +++ b/libs/apr/misc/netware/start.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_signal.h" +#include "fspr.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_signal.h" -#include "apr_arch_misc.h" /* for WSAHighByte / WSALowByte */ -#include "apr_arch_proc_mutex.h" /* for apr_proc_mutex_unix_setup_lock() */ -#include "apr_arch_internal_time.h" +#include "fspr_arch_misc.h" /* for WSAHighByte / WSALowByte */ +#include "fspr_arch_proc_mutex.h" /* for fspr_proc_mutex_unix_setup_lock() */ +#include "fspr_arch_internal_time.h" #ifdef USE_WINSOCK /* @@ -108,7 +108,7 @@ static int RegisterAppWithWinSock (void *nlm_handle) -APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, +APR_DECLARE(fspr_status_t) fspr_app_initialize(int *argc, const char * const * *argv, const char * const * *env) { @@ -117,12 +117,12 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, * control manager into the process, and it's required to fix the char* * data passed in from win32 unicode into utf-8, win32's apr internal fmt. */ - return apr_initialize(); + return fspr_initialize(); } -APR_DECLARE(apr_status_t) apr_initialize(void) +APR_DECLARE(fspr_status_t) fspr_initialize(void) { - apr_pool_t *pool; + fspr_pool_t *pool; int err; void *nlmhandle = getnlmhandle(); @@ -132,15 +132,15 @@ APR_DECLARE(apr_status_t) apr_initialize(void) return APR_SUCCESS; } - /* apr_pool_initialize() is being called from the library + /* fspr_pool_initialize() is being called from the library startup code since all of the memory resources belong to the library rather than the application. */ - if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { + if (fspr_pool_create(&pool, NULL) != APR_SUCCESS) { return APR_ENOPOOL; } - apr_pool_tag(pool, "apr_initilialize"); + fspr_pool_tag(pool, "fspr_initilialize"); #ifdef USE_WINSOCK err = RegisterAppWithWinSock (nlmhandle); @@ -150,12 +150,12 @@ APR_DECLARE(apr_status_t) apr_initialize(void) } #endif - apr_signal_init(pool); + fspr_signal_init(pool); return APR_SUCCESS; } -APR_DECLARE_NONSTD(void) apr_terminate(void) +APR_DECLARE_NONSTD(void) fspr_terminate(void) { APP_DATA *app_data; @@ -169,7 +169,7 @@ APR_DECLARE_NONSTD(void) apr_terminate(void) return; } - /* apr_pool_terminate() is being called from the + /* fspr_pool_terminate() is being called from the library shutdown code since the memory resources belong to the library rather than the application */ @@ -182,7 +182,7 @@ APR_DECLARE_NONSTD(void) apr_terminate(void) #endif } -APR_DECLARE(void) apr_terminate2(void) +APR_DECLARE(void) fspr_terminate2(void) { - apr_terminate(); + fspr_terminate(); } diff --git a/libs/apr/misc/unix/charset.c b/libs/apr/misc/unix/charset.c index a66724d720..02991a7d78 100644 --- a/libs/apr/misc/unix/charset.c +++ b/libs/apr/misc/unix/charset.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #ifdef HAVE_LANGINFO_H #include @@ -33,7 +33,7 @@ * unpacked. */ -APR_DECLARE(const char*) apr_os_default_encoding (apr_pool_t *pool) +APR_DECLARE(const char*) fspr_os_default_encoding (fspr_pool_t *pool) { #ifdef __MVS__ # ifdef __CODESET__ @@ -63,7 +63,7 @@ APR_DECLARE(const char*) apr_os_default_encoding (apr_pool_t *pool) } -APR_DECLARE(const char*) apr_os_locale_encoding (apr_pool_t *pool) +APR_DECLARE(const char*) fspr_os_locale_encoding (fspr_pool_t *pool) { #if defined(HAVE_NL_LANGINFO) && defined(CODESET) const char *charset; @@ -72,12 +72,12 @@ APR_DECLARE(const char*) apr_os_locale_encoding (apr_pool_t *pool) if (charset && *charset) { #ifdef _OSD_POSIX /* Bug workaround - delete as soon as fixed in OSD_POSIX */ /* Some versions of OSD_POSIX return nl_langinfo(CODESET)="^[nN]" */ - /* Ignore the bogus information and use apr_os_default_encoding() */ + /* Ignore the bogus information and use fspr_os_default_encoding() */ if (charset[0] != '^') #endif return charset; } #endif - return apr_os_default_encoding(pool); + return fspr_os_default_encoding(pool); } diff --git a/libs/apr/misc/unix/env.c b/libs/apr/misc/unix/env.c index 9ba6b61e78..37b64f107d 100644 --- a/libs/apr/misc/unix/env.c +++ b/libs/apr/misc/unix/env.c @@ -15,10 +15,10 @@ */ #define APR_WANT_STRFUNC -#include "apr_want.h" -#include "apr.h" -#include "apr_private.h" -#include "apr_env.h" +#include "fspr_want.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_env.h" #if APR_HAVE_UNISTD_H #include @@ -27,9 +27,9 @@ #include #endif -APR_DECLARE(apr_status_t) apr_env_get(char **value, +APR_DECLARE(fspr_status_t) fspr_env_get(char **value, const char *envvar, - apr_pool_t *pool) + fspr_pool_t *pool) { #ifdef HAVE_GETENV @@ -45,9 +45,9 @@ APR_DECLARE(apr_status_t) apr_env_get(char **value, } -APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, +APR_DECLARE(fspr_status_t) fspr_env_set(const char *envvar, const char *value, - apr_pool_t *pool) + fspr_pool_t *pool) { #if defined(HAVE_SETENV) @@ -57,9 +57,9 @@ APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, #elif defined(HAVE_PUTENV) - apr_size_t elen = strlen(envvar); - apr_size_t vlen = strlen(value); - char *env = apr_palloc(pool, elen + vlen + 2); + fspr_size_t elen = strlen(envvar); + fspr_size_t vlen = strlen(value); + char *env = fspr_palloc(pool, elen + vlen + 2); char *p = env + elen; memcpy(env, envvar, elen); @@ -77,7 +77,7 @@ APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, } -APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_env_delete(const char *envvar, fspr_pool_t *pool) { #ifdef HAVE_UNSETENV diff --git a/libs/apr/misc/unix/errorcodes.c b/libs/apr/misc/unix/errorcodes.c index e953d10927..3be0b25b93 100644 --- a/libs/apr/misc/unix/errorcodes.c +++ b/libs/apr/misc/unix/errorcodes.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_arch_misc.h" -#include "apr_strings.h" -#include "apr_lib.h" -#include "apr_dso.h" +#include "fspr_arch_misc.h" +#include "fspr_strings.h" +#include "fspr_lib.h" +#include "fspr_dso.h" #if APR_HAVE_NETDB_H #include @@ -27,16 +27,16 @@ #endif /* - * stuffbuffer - like apr_cpystrn() but returns the address of the + * stuffbuffer - like fspr_cpystrn() but returns the address of the * dest buffer instead of the address of the terminating '\0' */ -static char *stuffbuffer(char *buf, apr_size_t bufsize, const char *s) +static char *stuffbuffer(char *buf, fspr_size_t bufsize, const char *s) { - apr_cpystrn(buf,s,bufsize); + fspr_cpystrn(buf,s,bufsize); return buf; } -static char *apr_error_string(apr_status_t statcode) +static char *fspr_error_string(fspr_status_t statcode) { switch (statcode) { case APR_ENOPOOL: @@ -141,9 +141,9 @@ static char *apr_error_string(apr_status_t statcode) #ifdef OS2 #include -int apr_canonical_error(apr_status_t err); +int fspr_canonical_error(fspr_status_t err); -static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) +static char *fspr_os_strerror(char* buf, fspr_size_t bufsize, int err) { char result[200]; unsigned char message[HUGE_STRING_LEN]; @@ -153,7 +153,7 @@ static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) if (err >= 10000 && err < 12000) { /* socket error codes */ return stuffbuffer(buf, bufsize, - strerror(apr_canonical_error(err+APR_OS_START_SYSERR))); + strerror(fspr_canonical_error(err+APR_OS_START_SYSERR))); } else if (DosGetMessage(NULL, 0, message, HUGE_STRING_LEN, err, "OSO001.MSG", &len) == 0) { @@ -166,9 +166,9 @@ static char *apr_os_strerror(char* buf, apr_size_t bufsize, int err) for (c=0; ccont = cont; (*os)->reset = 0; - (*os)->errfn = (apr_getopt_err_fn_t*)(fprintf); + (*os)->errfn = (fspr_getopt_err_fn_t*)(fprintf); (*os)->errarg = (void*)(stderr); (*os)->place = EMSG; @@ -55,7 +55,7 @@ APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont, that's the primary purpose of this function. But people might want to use this function with arrays other than the main argv, and we shouldn't touch the caller's data. So we copy. */ - argv_buff = apr_palloc(cont, (argc + 1) * sizeof(const char *)); + argv_buff = fspr_palloc(cont, (argc + 1) * sizeof(const char *)); memcpy(argv_buff, argv, argc * sizeof(const char *)); (*os)->argv = argv_buff; (*os)->argv[argc] = NULL; @@ -68,7 +68,7 @@ APR_DECLARE(apr_status_t) apr_getopt_init(apr_getopt_t **os, apr_pool_t *cont, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, +APR_DECLARE(fspr_status_t) fspr_getopt(fspr_getopt_t *os, const char *opts, char *optch, const char **optarg) { const char *oli; /* option letter list index */ @@ -101,7 +101,7 @@ APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, ++os->ind; if (os->errfn && *opts != ':') { (os->errfn)(os->errarg, "%s: illegal option -- %c\n", - apr_filepath_name_get(*os->argv), os->opt); + fspr_filepath_name_get(*os->argv), os->opt); } *optch = os->opt; return (APR_BADCH); @@ -123,7 +123,7 @@ APR_DECLARE(apr_status_t) apr_getopt(apr_getopt_t *os, const char *opts, if (os->errfn) { (os->errfn)(os->errarg, "%s: option requires an argument -- %c\n", - apr_filepath_name_get(*os->argv), os->opt); + fspr_filepath_name_get(*os->argv), os->opt); } *optch = os->opt; return (APR_BADCH); @@ -155,7 +155,7 @@ static void reverse(const char **argv, int start, int len) * non-option arguments, os->skip_end is where we stopped, and os->ind * is where we are now. */ -static void permute(apr_getopt_t *os) +static void permute(fspr_getopt_t *os) { int len1 = os->skip_end - os->skip_start; int len2 = os->ind - os->skip_end; @@ -178,27 +178,27 @@ static void permute(apr_getopt_t *os) } /* Helper function to print out an error involving a long option */ -static apr_status_t serr(apr_getopt_t *os, const char *err, const char *str, - apr_status_t status) +static fspr_status_t serr(fspr_getopt_t *os, const char *err, const char *str, + fspr_status_t status) { if (os->errfn) (os->errfn)(os->errarg, "%s: %s: %s\n", - apr_filepath_name_get(*os->argv), err, str); + fspr_filepath_name_get(*os->argv), err, str); return status; } /* Helper function to print out an error involving a short option */ -static apr_status_t cerr(apr_getopt_t *os, const char *err, int ch, - apr_status_t status) +static fspr_status_t cerr(fspr_getopt_t *os, const char *err, int ch, + fspr_status_t status) { if (os->errfn) (os->errfn)(os->errarg, "%s: %s: %c\n", - apr_filepath_name_get(*os->argv), err, ch); + fspr_filepath_name_get(*os->argv), err, ch); return status; } -APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os, - const apr_getopt_option_t *opts, +APR_DECLARE(fspr_status_t) fspr_getopt_long(fspr_getopt_t *os, + const fspr_getopt_option_t *opts, int *optch, const char **optarg) { const char *p; @@ -232,7 +232,7 @@ APR_DECLARE(apr_status_t) apr_getopt_long(apr_getopt_t *os, p = os->argv[os->ind++] + 1; if (*p == '-' && p[1] != '\0') { /* Long option */ /* Search for the long option name in the caller's table. */ - apr_size_t len = 0; + fspr_size_t len = 0; p++; for (i = 0; ; i++) { diff --git a/libs/apr/misc/unix/otherchild.c b/libs/apr/misc/unix/otherchild.c index c97cfdd644..147ff6b808 100644 --- a/libs/apr/misc/unix/otherchild.c +++ b/libs/apr/misc/unix/otherchild.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_arch_misc.h" -#include "apr_arch_threadproc.h" -#include "apr_arch_file_io.h" +#include "fspr.h" +#include "fspr_arch_misc.h" +#include "fspr_arch_threadproc.h" +#include "fspr_arch_file_io.h" #if APR_HAS_OTHER_CHILD @@ -34,11 +34,11 @@ #include /* for fd_set definition! */ #endif -static apr_other_child_rec_t *other_children = NULL; +static fspr_other_child_rec_t *other_children = NULL; -static apr_status_t other_child_cleanup(void *data) +static fspr_status_t other_child_cleanup(void *data) { - apr_other_child_rec_t **pocr, *nocr; + fspr_other_child_rec_t **pocr, *nocr; for (pocr = &other_children; *pocr; pocr = &(*pocr)->next) { if ((*pocr)->data == data) { @@ -52,24 +52,24 @@ static apr_status_t other_child_cleanup(void *data) return APR_SUCCESS; } -APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc, +APR_DECLARE(void) fspr_proc_other_child_register(fspr_proc_t *proc, void (*maintenance) (int reason, void *, int status), - void *data, apr_file_t *write_fd, apr_pool_t *p) + void *data, fspr_file_t *write_fd, fspr_pool_t *p) { - apr_other_child_rec_t *ocr; + fspr_other_child_rec_t *ocr; - ocr = apr_palloc(p, sizeof(*ocr)); + ocr = fspr_palloc(p, sizeof(*ocr)); ocr->p = p; ocr->proc = proc; ocr->maintenance = maintenance; ocr->data = data; if (write_fd == NULL) { - ocr->write_fd = (apr_os_file_t) -1; + ocr->write_fd = (fspr_os_file_t) -1; } else { #ifdef WIN32 - /* This should either go away as part of eliminating apr_proc_probe_writable_fds - * or write_fd should point to an apr_file_t + /* This should either go away as part of eliminating fspr_proc_probe_writable_fds + * or write_fd should point to an fspr_file_t */ ocr->write_fd = write_fd->filehand; #else @@ -79,13 +79,13 @@ APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc, } ocr->next = other_children; other_children = ocr; - apr_pool_cleanup_register(p, ocr->data, other_child_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(p, ocr->data, other_child_cleanup, + fspr_pool_cleanup_null); } -APR_DECLARE(void) apr_proc_other_child_unregister(void *data) +APR_DECLARE(void) fspr_proc_other_child_unregister(void *data) { - apr_other_child_rec_t *cur; + fspr_other_child_rec_t *cur; cur = other_children; while (cur) { @@ -96,15 +96,15 @@ APR_DECLARE(void) apr_proc_other_child_unregister(void *data) } /* segfault if this function called with invalid parm */ - if (cur) apr_pool_cleanup_kill(cur->p, cur->data, other_child_cleanup); + if (cur) fspr_pool_cleanup_kill(cur->p, cur->data, other_child_cleanup); other_child_cleanup(data); } -APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_other_child_alert(fspr_proc_t *proc, int reason, int status) { - apr_other_child_rec_t *ocr, *nocr; + fspr_other_child_rec_t *ocr, *nocr; for (ocr = other_children; ocr; ocr = nocr) { nocr = ocr->next; @@ -118,7 +118,7 @@ APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc, return APR_EPROC_UNKNOWN; } -APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, +APR_DECLARE(void) fspr_proc_other_child_refresh(fspr_other_child_rec_t *ocr, int reason) { /* Todo: @@ -131,7 +131,7 @@ APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, return; if (!ocr->proc->hproc) { - /* Already mopped up, perhaps we apr_proc_kill'ed it, + /* Already mopped up, perhaps we fspr_proc_kill'ed it, * they should have already unregistered! */ ocr->proc = NULL; @@ -176,44 +176,44 @@ APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, #endif } -APR_DECLARE(void) apr_proc_other_child_refresh_all(int reason) +APR_DECLARE(void) fspr_proc_other_child_refresh_all(int reason) { - apr_other_child_rec_t *ocr, *next_ocr; + fspr_other_child_rec_t *ocr, *next_ocr; for (ocr = other_children; ocr; ocr = next_ocr) { next_ocr = ocr->next; - apr_proc_other_child_refresh(ocr, reason); + fspr_proc_other_child_refresh(ocr, reason); } } #else /* !APR_HAS_OTHER_CHILD */ -APR_DECLARE(void) apr_proc_other_child_register(apr_proc_t *proc, +APR_DECLARE(void) fspr_proc_other_child_register(fspr_proc_t *proc, void (*maintenance) (int reason, void *, int status), - void *data, apr_file_t *write_fd, apr_pool_t *p) + void *data, fspr_file_t *write_fd, fspr_pool_t *p) { return; } -APR_DECLARE(void) apr_proc_other_child_unregister(void *data) +APR_DECLARE(void) fspr_proc_other_child_unregister(void *data) { return; } -APR_DECLARE(apr_status_t) apr_proc_other_child_alert(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_other_child_alert(fspr_proc_t *proc, int reason, int status) { return APR_ENOTIMPL; } -APR_DECLARE(void) apr_proc_other_child_refresh(apr_other_child_rec_t *ocr, +APR_DECLARE(void) fspr_proc_other_child_refresh(fspr_other_child_rec_t *ocr, int reason) { return; } -APR_DECLARE(void) apr_proc_other_child_refresh_all(int reason) +APR_DECLARE(void) fspr_proc_other_child_refresh_all(int reason) { return; } diff --git a/libs/apr/misc/unix/rand.c b/libs/apr/misc/unix/rand.c index 7af77eb5af..d0b5cc1294 100644 --- a/libs/apr/misc/unix/rand.c +++ b/libs/apr/misc/unix/rand.c @@ -15,10 +15,10 @@ */ #define APR_WANT_MEMFUNC -#include "apr_want.h" -#include "apr_general.h" +#include "fspr_want.h" +#include "fspr_general.h" -#include "apr_arch_misc.h" +#include "fspr_arch_misc.h" #include #if APR_HAVE_SYS_TYPES_H #include @@ -51,7 +51,7 @@ #if defined(HAVE_UUID_CREATE) -APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) +APR_DECLARE(fspr_status_t) fspr_os_uuid_get(unsigned char *uuid_data) { uint32_t rv; uuid_t g; @@ -68,7 +68,7 @@ APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) #elif defined(HAVE_UUID_GENERATE) -APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) +APR_DECLARE(fspr_status_t) fspr_os_uuid_get(unsigned char *uuid_data) { uuid_t g; @@ -84,8 +84,8 @@ APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) #if APR_HAS_RANDOM -APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, - apr_size_t length) +APR_DECLARE(fspr_status_t) fspr_generate_random_bytes(unsigned char *buf, + fspr_size_t length) { #ifdef DEV_RANDOM @@ -95,7 +95,7 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, * gives EOF, so reading 'length' bytes may require opening the * device several times. */ do { - apr_ssize_t rc; + fspr_ssize_t rc; if (fd == -1) if ((fd = open(DEV_RANDOM, O_RDONLY)) == -1) @@ -145,8 +145,8 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, int egd_socket, egd_path_len, rv, bad_errno; struct sockaddr_un addr; - apr_socklen_t egd_addr_len; - apr_size_t resp_expected; + fspr_socklen_t egd_addr_len; + fspr_size_t resp_expected; unsigned char req[2], resp[255]; unsigned char *curbuf = buf; @@ -178,7 +178,7 @@ APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char *buf, /* EGD can only return 255 bytes of data at a time. Silly. */ while (length > 0) { - apr_ssize_t srv; + fspr_ssize_t srv; req[0] = 2; /* We'll block for now. */ req[1] = length > 255 ? 255: length; diff --git a/libs/apr/misc/unix/start.c b/libs/apr/misc/unix/start.c index 4b8ad990de..b7b239587c 100644 --- a/libs/apr/misc/unix/start.c +++ b/libs/apr/misc/unix/start.c @@ -14,17 +14,17 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_signal.h" -#include "apr_atomic.h" +#include "fspr.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_signal.h" +#include "fspr_atomic.h" -#include "apr_arch_proc_mutex.h" /* for apr_proc_mutex_unix_setup_lock() */ -#include "apr_arch_internal_time.h" +#include "fspr_arch_proc_mutex.h" /* for fspr_proc_mutex_unix_setup_lock() */ +#include "fspr_arch_internal_time.h" -APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, +APR_DECLARE(fspr_status_t) fspr_app_initialize(int *argc, const char * const * *argv, const char * const * *env) { @@ -33,57 +33,57 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, * control manager into the process, and it's required to fix the char* * data passed in from win32 unicode into utf-8, win32's apr internal fmt. */ - return apr_initialize(); + return fspr_initialize(); } static int initialized = 0; -APR_DECLARE(apr_status_t) apr_initialize(void) +APR_DECLARE(fspr_status_t) fspr_initialize(void) { - apr_pool_t *pool; - apr_status_t status; + fspr_pool_t *pool; + fspr_status_t status; if (initialized++) { return APR_SUCCESS; } #if !defined(BEOS) && !defined(OS2) - apr_proc_mutex_unix_setup_lock(); - apr_unix_setup_time(); + fspr_proc_mutex_unix_setup_lock(); + fspr_unix_setup_time(); #endif - if ((status = apr_pool_initialize()) != APR_SUCCESS) + if ((status = fspr_pool_initialize()) != APR_SUCCESS) return status; - if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { + if (fspr_pool_create(&pool, NULL) != APR_SUCCESS) { return APR_ENOPOOL; } - apr_pool_tag(pool, "apr_initialize"); + fspr_pool_tag(pool, "fspr_initialize"); - /* apr_atomic_init() used to be called from here aswell. + /* fspr_atomic_init() used to be called from here aswell. * Pools rely on mutexes though, which can be backed by * atomics. Due to this circular dependency - * apr_pool_initialize() is taking care of calling - * apr_atomic_init() at the correct time. + * fspr_pool_initialize() is taking care of calling + * fspr_atomic_init() at the correct time. */ - apr_signal_init(pool); + fspr_signal_init(pool); return APR_SUCCESS; } -APR_DECLARE_NONSTD(void) apr_terminate(void) +APR_DECLARE_NONSTD(void) fspr_terminate(void) { initialized--; if (initialized) { return; } - apr_pool_terminate(); + fspr_pool_terminate(); } -APR_DECLARE(void) apr_terminate2(void) +APR_DECLARE(void) fspr_terminate2(void) { - apr_terminate(); + fspr_terminate(); } diff --git a/libs/apr/misc/unix/version.c b/libs/apr/misc/unix/version.c index 2f111bf9dc..39fb71c5b3 100644 --- a/libs/apr/misc/unix/version.c +++ b/libs/apr/misc/unix/version.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_version.h" -#include "apr_general.h" /* for APR_STRINGIFY */ +#include "fspr_version.h" +#include "fspr_general.h" /* for APR_STRINGIFY */ -APR_DECLARE(void) apr_version(apr_version_t *pvsn) +APR_DECLARE(void) fspr_version(fspr_version_t *pvsn) { pvsn->major = APR_MAJOR_VERSION; pvsn->minor = APR_MINOR_VERSION; @@ -29,7 +29,7 @@ APR_DECLARE(void) apr_version(apr_version_t *pvsn) #endif } -APR_DECLARE(const char *) apr_version_string(void) +APR_DECLARE(const char *) fspr_version_string(void) { return APR_VERSION_STRING; } diff --git a/libs/apr/misc/win32/charset.c b/libs/apr/misc/win32/charset.c index d54d6e645c..041b60bd09 100644 --- a/libs/apr/misc/win32/charset.c +++ b/libs/apr/misc/win32/charset.c @@ -14,22 +14,22 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_strings.h" +#include "fspr_portable.h" -APR_DECLARE(const char*) apr_os_default_encoding (apr_pool_t *pool) +APR_DECLARE(const char*) fspr_os_default_encoding (fspr_pool_t *pool) { - return apr_psprintf(pool, "CP%u", (unsigned) GetACP()); + return fspr_psprintf(pool, "CP%u", (unsigned) GetACP()); } -APR_DECLARE(const char*) apr_os_locale_encoding (apr_pool_t *pool) +APR_DECLARE(const char*) fspr_os_locale_encoding (fspr_pool_t *pool) { LCID locale = GetThreadLocale(); int len = GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE, NULL, 0); - char *cp = apr_palloc(pool, len + 2); + char *cp = fspr_palloc(pool, len + 2); if (0 < GetLocaleInfo(locale, LOCALE_IDEFAULTANSICODEPAGE, cp + 2, len)) { /* Fix up the returned number to make a valid codepage name of @@ -39,5 +39,5 @@ APR_DECLARE(const char*) apr_os_locale_encoding (apr_pool_t *pool) return cp; } - return apr_os_default_encoding(pool); + return fspr_os_default_encoding(pool); } diff --git a/libs/apr/misc/win32/env.c b/libs/apr/misc/win32/env.c index e99ff8d476..7b174bba1d 100644 --- a/libs/apr/misc/win32/env.c +++ b/libs/apr/misc/win32/env.c @@ -15,26 +15,26 @@ */ #define APR_WANT_STRFUNC -#include "apr_want.h" -#include "apr.h" -#include "apr_arch_misc.h" -#include "apr_arch_utf8.h" -#include "apr_env.h" -#include "apr_errno.h" -#include "apr_pools.h" -#include "apr_strings.h" +#include "fspr_want.h" +#include "fspr.h" +#include "fspr_arch_misc.h" +#include "fspr_arch_utf8.h" +#include "fspr_env.h" +#include "fspr_errno.h" +#include "fspr_pools.h" +#include "fspr_strings.h" #if APR_HAS_UNICODE_FS -static apr_status_t widen_envvar_name (apr_wchar_t *buffer, - apr_size_t bufflen, +static fspr_status_t widen_envvar_name (fspr_wchar_t *buffer, + fspr_size_t bufflen, const char *envvar) { - apr_size_t inchars; - apr_status_t status; + fspr_size_t inchars; + fspr_status_t status; inchars = strlen(envvar) + 1; - status = apr_conv_utf8_to_ucs2(envvar, &inchars, buffer, &bufflen); + status = fspr_conv_utf8_to_ucs2(envvar, &inchars, buffer, &bufflen); if (status == APR_INCOMPLETE) status = APR_ENAMETOOLONG; @@ -43,9 +43,9 @@ static apr_status_t widen_envvar_name (apr_wchar_t *buffer, #endif -APR_DECLARE(apr_status_t) apr_env_get(char **value, +APR_DECLARE(fspr_status_t) fspr_env_get(char **value, const char *envvar, - apr_pool_t *pool) + fspr_pool_t *pool) { char *val = NULL; DWORD size; @@ -53,10 +53,10 @@ APR_DECLARE(apr_status_t) apr_env_get(char **value, #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wenvvar[APR_PATH_MAX]; - apr_size_t inchars, outchars; - apr_wchar_t *wvalue, dummy; - apr_status_t status; + fspr_wchar_t wenvvar[APR_PATH_MAX]; + fspr_size_t inchars, outchars; + fspr_wchar_t *wvalue, dummy; + fspr_status_t status; status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); if (status) @@ -70,11 +70,11 @@ APR_DECLARE(apr_status_t) apr_env_get(char **value, if (size == 0) { /* The environment value exists, but is zero-length. */ - *value = apr_pstrdup(pool, ""); + *value = fspr_pstrdup(pool, ""); return APR_SUCCESS; } - wvalue = apr_palloc(pool, size * sizeof(*wvalue)); + wvalue = fspr_palloc(pool, size * sizeof(*wvalue)); size = GetEnvironmentVariableW(wenvvar, wvalue, size); if (size == 0) /* Mid-air collision?. Somebody must've changed the env. var. */ @@ -82,8 +82,8 @@ APR_DECLARE(apr_status_t) apr_env_get(char **value, inchars = wcslen(wvalue) + 1; outchars = 3 * inchars; /* Enougn for any UTF-8 representation */ - val = apr_palloc(pool, outchars); - status = apr_conv_ucs2_to_utf8(wvalue, &inchars, val, &outchars); + val = fspr_palloc(pool, outchars); + status = fspr_conv_ucs2_to_utf8(wvalue, &inchars, val, &outchars); if (status) return status; } @@ -101,11 +101,11 @@ APR_DECLARE(apr_status_t) apr_env_get(char **value, if (size == 0) { /* The environment value exists, but is zero-length. */ - *value = apr_pstrdup(pool, ""); + *value = fspr_pstrdup(pool, ""); return APR_SUCCESS; } - val = apr_palloc(pool, size); + val = fspr_palloc(pool, size); size = GetEnvironmentVariableA(envvar, val, size); if (size == 0) /* Mid-air collision?. Somebody must've changed the env. var. */ @@ -118,37 +118,37 @@ APR_DECLARE(apr_status_t) apr_env_get(char **value, } -APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, +APR_DECLARE(fspr_status_t) fspr_env_set(const char *envvar, const char *value, - apr_pool_t *pool) + fspr_pool_t *pool) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wenvvar[APR_PATH_MAX]; - apr_wchar_t *wvalue; - apr_size_t inchars, outchars; - apr_status_t status; + fspr_wchar_t wenvvar[APR_PATH_MAX]; + fspr_wchar_t *wvalue; + fspr_size_t inchars, outchars; + fspr_status_t status; status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); if (status) return status; outchars = inchars = strlen(value) + 1; - wvalue = apr_palloc(pool, outchars * sizeof(*wvalue)); - status = apr_conv_utf8_to_ucs2(value, &inchars, wvalue, &outchars); + wvalue = fspr_palloc(pool, outchars * sizeof(*wvalue)); + status = fspr_conv_utf8_to_ucs2(value, &inchars, wvalue, &outchars); if (status) return status; if (!SetEnvironmentVariableW(wenvvar, wvalue)) - return apr_get_os_error(); + return fspr_get_os_error(); } #endif #if APR_HAS_ANSI_FS ELSE_WIN_OS_IS_ANSI { if (!SetEnvironmentVariableA(envvar, value)) - return apr_get_os_error(); + return fspr_get_os_error(); } #endif @@ -156,27 +156,27 @@ APR_DECLARE(apr_status_t) apr_env_set(const char *envvar, } -APR_DECLARE(apr_status_t) apr_env_delete(const char *envvar, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_env_delete(const char *envvar, fspr_pool_t *pool) { #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t wenvvar[APR_PATH_MAX]; - apr_status_t status; + fspr_wchar_t wenvvar[APR_PATH_MAX]; + fspr_status_t status; status = widen_envvar_name(wenvvar, APR_PATH_MAX, envvar); if (status) return status; if (!SetEnvironmentVariableW(wenvvar, NULL)) - return apr_get_os_error(); + return fspr_get_os_error(); } #endif #if APR_HAS_ANSI_FS ELSE_WIN_OS_IS_ANSI { if (!SetEnvironmentVariableA(envvar, NULL)) - return apr_get_os_error(); + return fspr_get_os_error(); } #endif diff --git a/libs/apr/misc/win32/apr_app.c b/libs/apr/misc/win32/fspr_app.c similarity index 90% rename from libs/apr/misc/win32/apr_app.c rename to libs/apr/misc/win32/fspr_app.c index baac96e811..d6b580c007 100644 --- a/libs/apr/misc/win32/apr_app.c +++ b/libs/apr/misc/win32/fspr_app.c @@ -24,7 +24,7 @@ * * This module is only compatible with Unicode-only executables. * Mixed (Win9x backwards compatible) binaries should refer instead - * to the apr_startup.c module. + * to the fspr_startup.c module. * * _dbg_malloc/realloc is used in place of the usual API, in order * to convince the MSVCRT that they created these entities. If we @@ -33,14 +33,14 @@ * since we are single threaded [so far]. */ -#include "apr_general.h" +#include "fspr_general.h" #include "ShellAPI.h" #include "crtdbg.h" #include "wchar.h" -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" #include "assert.h" -#include "apr_private.h" -#include "apr_arch_misc.h" +#include "fspr_private.h" +#include "fspr_arch_misc.h" /* This symbol is _private_, although it must be exported. */ @@ -53,9 +53,9 @@ int wmain(int argc, const wchar_t **wargv, const wchar_t **wenv) char **env; int dupenv; - (void)apr_wastrtoastr(&argv, wargv, argc); + (void)fspr_wastrtoastr(&argv, wargv, argc); - dupenv = apr_wastrtoastr(&env, wenv, -1); + dupenv = fspr_wastrtoastr(&env, wenv, -1); _environ = _malloc_dbg((dupenv + 1) * sizeof (char *), _CRT_BLOCK, __FILE__, __LINE__ ); @@ -74,7 +74,7 @@ int wmain(int argc, const wchar_t **wargv, const wchar_t **wenv) free((wchar_t **)wenv); } - apr_app_init_complete = 1; + fspr_app_init_complete = 1; return main(argc, argv, env); } diff --git a/libs/apr/misc/win32/internal.c b/libs/apr/misc/win32/internal.c index b045bd4258..22c9122a65 100644 --- a/libs/apr/misc/win32/internal.c +++ b/libs/apr/misc/win32/internal.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_private.h" +#include "fspr_private.h" -#include "apr_arch_misc.h" -#include "apr_arch_file_io.h" +#include "fspr_arch_misc.h" +#include "fspr_arch_file_io.h" #include #include @@ -30,7 +30,7 @@ */ -/* Shared by apr_app.c and start.c +/* Shared by fspr_app.c and start.c * * An internal apr function to convert an array of strings (either * a counted or NULL terminated list, such as an argv[argc] or env[] @@ -38,10 +38,10 @@ * These are allocated from the MSVCRT's _CRT_BLOCK to trick the system * into trusting our store. */ -int apr_wastrtoastr(char const * const * *retarr, +int fspr_wastrtoastr(char const * const * *retarr, wchar_t const * const *arr, int args) { - apr_size_t elesize = 0; + fspr_size_t elesize = 0; char **newarr; char *elements; char *ele; @@ -57,7 +57,7 @@ int apr_wastrtoastr(char const * const * *retarr, for (arg = 0; arg < args; ++arg) { newarr[arg] = (void*)(wcslen(arr[arg]) + 1); - elesize += (apr_size_t)newarr[arg]; + elesize += (fspr_size_t)newarr[arg]; } /* This is a safe max allocation, we will realloc after @@ -70,11 +70,11 @@ int apr_wastrtoastr(char const * const * *retarr, _CRT_BLOCK, __FILE__, __LINE__); for (arg = 0; arg < args; ++arg) { - apr_size_t len = (apr_size_t)newarr[arg]; - apr_size_t newlen = elesize; + fspr_size_t len = (fspr_size_t)newarr[arg]; + fspr_size_t newlen = elesize; newarr[arg] = ele; - (void)apr_conv_ucs2_to_utf8(arr[arg], &len, + (void)fspr_conv_ucs2_to_utf8(arr[arg], &len, newarr[arg], &elesize); newlen -= elesize; @@ -91,7 +91,7 @@ int apr_wastrtoastr(char const * const * *retarr, _CRT_BLOCK, __FILE__, __LINE__); if (ele != elements) { - apr_size_t diff = ele - elements; + fspr_size_t diff = ele - elements; for (arg = 0; arg < args; ++arg) { newarr[arg] += diff; } diff --git a/libs/apr/misc/win32/misc.c b/libs/apr/misc/win32/misc.c index 9975eef613..ad7bfdfbcb 100644 --- a/libs/apr/misc/win32/misc.c +++ b/libs/apr/misc/win32/misc.c @@ -14,18 +14,18 @@ * limitations under the License. */ -#include "apr_private.h" -#include "apr_arch_misc.h" +#include "fspr_private.h" +#include "fspr_arch_misc.h" #include "crtdbg.h" -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" #include "assert.h" -#include "apr_lib.h" +#include "fspr_lib.h" -APR_DECLARE_DATA apr_oslevel_e apr_os_level = APR_WIN_UNK; +APR_DECLARE_DATA fspr_oslevel_e fspr_os_level = APR_WIN_UNK; -apr_status_t apr_get_oslevel(apr_oslevel_e *level) +fspr_status_t fspr_get_oslevel(fspr_oslevel_e *level) { - if (apr_os_level == APR_WIN_UNK) + if (fspr_os_level == APR_WIN_UNK) { static OSVERSIONINFO oslev; oslev.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); @@ -36,7 +36,7 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *level) static unsigned int servpack = 0; char *pservpack; if (pservpack = oslev.szCSDVersion) { - while (*pservpack && !apr_isdigit(*pservpack)) { + while (*pservpack && !fspr_isdigit(*pservpack)) { pservpack++; } if (*pservpack) @@ -44,63 +44,63 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *level) } if (oslev.dwMajorVersion < 3) { - apr_os_level = APR_WIN_UNSUP; + fspr_os_level = APR_WIN_UNSUP; } else if (oslev.dwMajorVersion == 3) { if (oslev.dwMajorVersion < 50) { - apr_os_level = APR_WIN_UNSUP; + fspr_os_level = APR_WIN_UNSUP; } else if (oslev.dwMajorVersion == 50) { - apr_os_level = APR_WIN_NT_3_5; + fspr_os_level = APR_WIN_NT_3_5; } else { - apr_os_level = APR_WIN_NT_3_51; + fspr_os_level = APR_WIN_NT_3_51; } } else if (oslev.dwMajorVersion == 4) { if (servpack < 2) - apr_os_level = APR_WIN_NT_4; + fspr_os_level = APR_WIN_NT_4; else if (servpack <= 2) - apr_os_level = APR_WIN_NT_4_SP2; + fspr_os_level = APR_WIN_NT_4_SP2; else if (servpack <= 3) - apr_os_level = APR_WIN_NT_4_SP3; + fspr_os_level = APR_WIN_NT_4_SP3; else if (servpack <= 4) - apr_os_level = APR_WIN_NT_4_SP4; + fspr_os_level = APR_WIN_NT_4_SP4; else if (servpack <= 5) - apr_os_level = APR_WIN_NT_4_SP5; + fspr_os_level = APR_WIN_NT_4_SP5; else - apr_os_level = APR_WIN_NT_4_SP6; + fspr_os_level = APR_WIN_NT_4_SP6; } else if (oslev.dwMajorVersion == 5) { if (oslev.dwMinorVersion == 0) { if (servpack == 0) - apr_os_level = APR_WIN_2000; + fspr_os_level = APR_WIN_2000; else if (servpack == 1) - apr_os_level = APR_WIN_2000_SP1; + fspr_os_level = APR_WIN_2000_SP1; else - apr_os_level = APR_WIN_2000_SP2; + fspr_os_level = APR_WIN_2000_SP2; } else if (oslev.dwMinorVersion == 2) { - apr_os_level = APR_WIN_2003; + fspr_os_level = APR_WIN_2003; } else { if (servpack < 1) - apr_os_level = APR_WIN_XP; + fspr_os_level = APR_WIN_XP; else if (servpack == 1) - apr_os_level = APR_WIN_XP_SP1; + fspr_os_level = APR_WIN_XP_SP1; else - apr_os_level = APR_WIN_XP_SP2; + fspr_os_level = APR_WIN_XP_SP2; } } else { - apr_os_level = APR_WIN_XP; + fspr_os_level = APR_WIN_XP; } } #ifndef WINNT else if (oslev.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) { char *prevision; if (prevision = oslev.szCSDVersion) { - while (*prevision && !apr_isupper(*prevision)) { + while (*prevision && !fspr_isupper(*prevision)) { prevision++; } } @@ -108,18 +108,18 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *level) if (oslev.dwMinorVersion < 10) { if (*prevision < 'C') - apr_os_level = APR_WIN_95; + fspr_os_level = APR_WIN_95; else - apr_os_level = APR_WIN_95_OSR2; + fspr_os_level = APR_WIN_95_OSR2; } else if (oslev.dwMinorVersion < 90) { if (*prevision < 'A') - apr_os_level = APR_WIN_98; + fspr_os_level = APR_WIN_98; else - apr_os_level = APR_WIN_98_SE; + fspr_os_level = APR_WIN_98_SE; } else { - apr_os_level = APR_WIN_ME; + fspr_os_level = APR_WIN_ME; } } #endif @@ -127,21 +127,21 @@ apr_status_t apr_get_oslevel(apr_oslevel_e *level) else if (oslev.dwPlatformId == VER_PLATFORM_WIN32_CE) { if (oslev.dwMajorVersion < 3) { - apr_os_level = APR_WIN_UNSUP; + fspr_os_level = APR_WIN_UNSUP; } else { - apr_os_level = APR_WIN_CE_3; + fspr_os_level = APR_WIN_CE_3; } } #endif else { - apr_os_level = APR_WIN_UNSUP; + fspr_os_level = APR_WIN_UNSUP; } } - *level = apr_os_level; + *level = fspr_os_level; - if (apr_os_level < APR_WIN_UNSUP) { + if (fspr_os_level < APR_WIN_UNSUP) { return APR_EGENERAL; } @@ -158,7 +158,7 @@ static const char* const lateDllName[DLL_defined] = { static HMODULE lateDllHandle[DLL_defined] = { NULL, NULL, NULL, NULL, NULL, NULL }; -FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char* fnName, int ordinal) +FARPROC fspr_load_dll_func(fspr_dlltoken_e fnLib, char* fnName, int ordinal) { if (!lateDllHandle[fnLib]) { lateDllHandle[fnLib] = LoadLibrary(lateDllName[fnLib]); @@ -171,9 +171,9 @@ FARPROC apr_load_dll_func(apr_dlltoken_e fnLib, char* fnName, int ordinal) return GetProcAddress(lateDllHandle[fnLib], fnName); } -/* Declared in include/arch/win32/apr_dbg_win32_handles.h +/* Declared in include/arch/win32/fspr_dbg_win32_handles.h */ -APR_DECLARE_NONSTD(HANDLE) apr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, +APR_DECLARE_NONSTD(HANDLE) fspr_dbg_log(char* fn, HANDLE ha, char* fl, int ln, int nh, /* HANDLE hv, char *dsc */...) { static DWORD tlsid = 0xFFFFFFFF; diff --git a/libs/apr/misc/win32/rand.c b/libs/apr/misc/win32/rand.c index fb50fb9b32..130c87b85b 100644 --- a/libs/apr/misc/win32/rand.c +++ b/libs/apr/misc/win32/rand.c @@ -14,42 +14,42 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_portable.h" -#include "apr_arch_misc.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_portable.h" +#include "fspr_arch_misc.h" #include -APR_DECLARE(apr_status_t) apr_generate_random_bytes(unsigned char * buf, - apr_size_t length) +APR_DECLARE(fspr_status_t) fspr_generate_random_bytes(unsigned char * buf, + fspr_size_t length) { HCRYPTPROV hProv; - apr_status_t res = APR_SUCCESS; + fspr_status_t res = APR_SUCCESS; /* 0x40 bit = CRYPT_SILENT, only introduced in more recent PSDKs * and will only work for Win2K and later. */ DWORD flags = CRYPT_VERIFYCONTEXT - | ((apr_os_level >= APR_WIN_2000) ? 0x40 : 0); + | ((fspr_os_level >= APR_WIN_2000) ? 0x40 : 0); if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, flags)) { - return apr_get_os_error(); + return fspr_get_os_error(); } /* XXX: An ugly hack for Win64, randomness is such that noone should * ever expect > 2^31 bytes of data at once without the prng * coming to a complete halt. */ if (!CryptGenRandom(hProv, (DWORD)length, buf)) { - res = apr_get_os_error(); + res = fspr_get_os_error(); } CryptReleaseContext(hProv, 0); return res; } -APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) +APR_DECLARE(fspr_status_t) fspr_os_uuid_get(unsigned char *uuid_data) { /* Note: this call doesn't actually require CoInitialize() first * @@ -59,7 +59,7 @@ APR_DECLARE(apr_status_t) apr_os_uuid_get(unsigned char *uuid_data) * be appropriate in all cases. * * Note that Win2000, XP and later no longer suffer from this problem, - * a scrambling fix is only needed for (apr_os_level < APR_WIN_2000) + * a scrambling fix is only needed for (fspr_os_level < APR_WIN_2000) */ if (FAILED(UuidCreate((UUID *)uuid_data))) { return APR_EGENERAL; diff --git a/libs/apr/misc/win32/start.c b/libs/apr/misc/win32/start.c index f51b749d2c..4a87e23c1e 100644 --- a/libs/apr/misc/win32/start.c +++ b/libs/apr/misc/win32/start.c @@ -14,23 +14,23 @@ * limitations under the License. */ -#include "apr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_signal.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_signal.h" #include "ShellAPI.h" -#include "apr_arch_misc.h" /* for WSAHighByte / WSALowByte */ +#include "fspr_arch_misc.h" /* for WSAHighByte / WSALowByte */ #include "wchar.h" -#include "apr_arch_file_io.h" +#include "fspr_arch_file_io.h" #include "crtdbg.h" #include "assert.h" /* This symbol is _private_, although it must be exported. */ -int APR_DECLARE_DATA apr_app_init_complete = 0; +int APR_DECLARE_DATA fspr_app_init_complete = 0; -/* Used by apr_app_initialize to reprocess the environment +/* Used by fspr_app_initialize to reprocess the environment * * An internal apr function to convert a double-null terminated set * of single-null terminated strings from wide Unicode to narrow utf-8 @@ -40,10 +40,10 @@ int APR_DECLARE_DATA apr_app_init_complete = 0; static int warrsztoastr(const char * const * *retarr, const wchar_t * arrsz, int args) { - const apr_wchar_t *wch; - apr_size_t totlen; - apr_size_t newlen; - apr_size_t wsize; + const fspr_wchar_t *wch; + fspr_size_t totlen; + fspr_size_t newlen; + fspr_size_t wsize; char **newarr; int arg; @@ -66,7 +66,7 @@ static int warrsztoastr(const char * const * *retarr, newarr[0] = _malloc_dbg(newlen * sizeof(char), _CRT_BLOCK, __FILE__, __LINE__); - (void)apr_conv_ucs2_to_utf8(arrsz, &wsize, + (void)fspr_conv_ucs2_to_utf8(arrsz, &wsize, newarr[0], &newlen); assert(newlen && !wsize); @@ -91,11 +91,11 @@ static int warrsztoastr(const char * const * *retarr, /* Reprocess the arguments to main() for a completely apr-ized application */ -APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, +APR_DECLARE(fspr_status_t) fspr_app_initialize(int *argc, const char * const * *argv, const char * const * *env) { - apr_status_t rv = apr_initialize(); + fspr_status_t rv = fspr_initialize(); if (rv != APR_SUCCESS) { return rv; @@ -104,22 +104,22 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t **wstrs; - apr_wchar_t *sysstr; + fspr_wchar_t **wstrs; + fspr_wchar_t *sysstr; int wstrc; int dupenv; - if (apr_app_init_complete) { + if (fspr_app_init_complete) { return rv; } - apr_app_init_complete = 1; + fspr_app_init_complete = 1; sysstr = GetCommandLineW(); if (sysstr) { wstrs = CommandLineToArgvW(sysstr, &wstrc); if (wstrs) { - *argc = apr_wastrtoastr(argv, wstrs, wstrc); + *argc = fspr_wastrtoastr(argv, wstrs, wstrc); GlobalFree(wstrs); } } @@ -145,7 +145,7 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, * Reset _wenviron for good measure. */ if (_wenviron) { - apr_wchar_t **wenv = _wenviron; + fspr_wchar_t **wenv = _wenviron; _wenviron = NULL; free(wenv); } @@ -158,35 +158,35 @@ APR_DECLARE(apr_status_t) apr_app_initialize(int *argc, static int initialized = 0; /* Provide to win32/thread.c */ -extern DWORD tls_apr_thread; +extern DWORD tls_fspr_thread; -APR_DECLARE(apr_status_t) apr_initialize(void) +APR_DECLARE(fspr_status_t) fspr_initialize(void) { - apr_pool_t *pool; - apr_status_t status; + fspr_pool_t *pool; + fspr_status_t status; int iVersionRequested; WSADATA wsaData; int err; - apr_oslevel_e osver; + fspr_oslevel_e osver; if (initialized++) { return APR_SUCCESS; } - /* Initialize apr_os_level global */ - if (apr_get_oslevel(&osver) != APR_SUCCESS) { + /* Initialize fspr_os_level global */ + if (fspr_get_oslevel(&osver) != APR_SUCCESS) { return APR_EEXIST; } - tls_apr_thread = TlsAlloc(); - if ((status = apr_pool_initialize()) != APR_SUCCESS) + tls_fspr_thread = TlsAlloc(); + if ((status = fspr_pool_initialize()) != APR_SUCCESS) return status; - if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { + if (fspr_pool_create(&pool, NULL) != APR_SUCCESS) { return APR_ENOPOOL; } - apr_pool_tag(pool, "apr_initialize"); + fspr_pool_tag(pool, "fspr_initialize"); iVersionRequested = MAKEWORD(WSAHighByte, WSALowByte); err = WSAStartup((WORD) iVersionRequested, &wsaData); @@ -199,25 +199,25 @@ APR_DECLARE(apr_status_t) apr_initialize(void) return APR_EEXIST; } - apr_signal_init(pool); + fspr_signal_init(pool); return APR_SUCCESS; } -APR_DECLARE_NONSTD(void) apr_terminate(void) +APR_DECLARE_NONSTD(void) fspr_terminate(void) { initialized--; if (initialized) { return; } - apr_pool_terminate(); + fspr_pool_terminate(); WSACleanup(); - TlsFree(tls_apr_thread); + TlsFree(tls_fspr_thread); } -APR_DECLARE(void) apr_terminate2(void) +APR_DECLARE(void) fspr_terminate2(void) { - apr_terminate(); + fspr_terminate(); } diff --git a/libs/apr/misc/win32/utf8.c b/libs/apr/misc/win32/utf8.c index b37dba44da..57167235c4 100644 --- a/libs/apr/misc/win32/utf8.c +++ b/libs/apr/misc/win32/utf8.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_errno.h" -#include "apr_arch_utf8.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_errno.h" +#include "fspr_arch_utf8.h" /* Implement the design principal specified by RFC 2718 2.2.5 * Guidelines for new URL Schemes - within the APR. @@ -58,18 +58,18 @@ * W1 = 110110yyyyyyyyyy * W2 = 110111xxxxxxxxxx * - * apr_conv_utf8_to_ucs2 out bytes:sizeof(in) * 1 <= Req <= sizeof(in) * 2 + * fspr_conv_utf8_to_ucs2 out bytes:sizeof(in) * 1 <= Req <= sizeof(in) * 2 * - * apr_conv_ucs2_to_utf8 out words:sizeof(in) / 2 <= Req <= sizeof(in) * 3 / 2 + * fspr_conv_ucs2_to_utf8 out words:sizeof(in) / 2 <= Req <= sizeof(in) * 3 / 2 */ -APR_DECLARE(apr_status_t) apr_conv_utf8_to_ucs2(const char *in, - apr_size_t *inbytes, - apr_wchar_t *out, - apr_size_t *outwords) +APR_DECLARE(fspr_status_t) fspr_conv_utf8_to_ucs2(const char *in, + fspr_size_t *inbytes, + fspr_wchar_t *out, + fspr_size_t *outwords) { - apr_int64_t newch, mask; - apr_size_t expect, eating; + fspr_int64_t newch, mask; + fspr_size_t expect, eating; int ch; while (*inbytes && *outwords) @@ -138,7 +138,7 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_to_ucs2(const char *in, /* Where the boolean (expect > 2) is true, we will need * an extra word for the output. */ - if (*outwords < (apr_size_t)(expect > 2) + 1) + if (*outwords < (fspr_size_t)(expect > 2) + 1) break; /* buffer full */ while (expect--) { @@ -156,14 +156,14 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_to_ucs2(const char *in, if (newch < 0x10000) { --*outwords; - *(out++) = (apr_wchar_t) newch; + *(out++) = (fspr_wchar_t) newch; } else { *outwords -= 2; newch -= 0x10000; - *(out++) = (apr_wchar_t) (0xD800 | (newch >> 10)); - *(out++) = (apr_wchar_t) (0xDC00 | (newch & 0x03FF)); + *(out++) = (fspr_wchar_t) (0xD800 | (newch >> 10)); + *(out++) = (fspr_wchar_t) (0xDC00 | (newch & 0x03FF)); } } } @@ -174,13 +174,13 @@ APR_DECLARE(apr_status_t) apr_conv_utf8_to_ucs2(const char *in, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_conv_ucs2_to_utf8(const apr_wchar_t *in, - apr_size_t *inwords, +APR_DECLARE(fspr_status_t) fspr_conv_ucs2_to_utf8(const fspr_wchar_t *in, + fspr_size_t *inwords, char *out, - apr_size_t *outbytes) + fspr_size_t *outbytes) { - apr_int64_t newch, require; - apr_size_t need; + fspr_int64_t newch, require; + fspr_size_t need; char *invout; int ch; diff --git a/libs/apr/mmap/unix/common.c b/libs/apr/mmap/unix/common.c index a978992880..a9b0b4c2f6 100644 --- a/libs/apr/mmap/unix/common.c +++ b/libs/apr/mmap/unix/common.c @@ -23,15 +23,15 @@ * */ -#include "apr.h" -#include "apr_private.h" -#include "apr_mmap.h" -#include "apr_errno.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_mmap.h" +#include "fspr_errno.h" #if APR_HAS_MMAP || defined(BEOS) -APR_DECLARE(apr_status_t) apr_mmap_offset(void **addr, apr_mmap_t *mmap, - apr_off_t offset) +APR_DECLARE(fspr_status_t) fspr_mmap_offset(void **addr, fspr_mmap_t *mmap, + fspr_off_t offset) { if (offset < 0 || offset > mmap->size) return APR_EINVAL; diff --git a/libs/apr/mmap/unix/mmap.c b/libs/apr/mmap/unix/mmap.c index 6719570967..e86938bde5 100644 --- a/libs/apr/mmap/unix/mmap.c +++ b/libs/apr/mmap/unix/mmap.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_mmap.h" -#include "apr_errno.h" -#include "apr_arch_file_io.h" -#include "apr_portable.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_mmap.h" +#include "fspr_errno.h" +#include "fspr_arch_file_io.h" +#include "fspr_portable.h" /* System headers required for the mmap library */ #ifdef BEOS @@ -42,10 +42,10 @@ #if APR_HAS_MMAP || defined(BEOS) -static apr_status_t mmap_cleanup(void *themmap) +static fspr_status_t mmap_cleanup(void *themmap) { - apr_mmap_t *mm = themmap; - apr_mmap_t *next = APR_RING_NEXT(mm,link); + fspr_mmap_t *mm = themmap; + fspr_mmap_t *next = APR_RING_NEXT(mm,link); int rv = 0; /* we no longer refer to the mmaped region */ @@ -71,24 +71,24 @@ static apr_status_t mmap_cleanup(void *themmap) return errno; } -APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, - apr_file_t *file, apr_off_t offset, - apr_size_t size, apr_int32_t flag, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_mmap_create(fspr_mmap_t **new, + fspr_file_t *file, fspr_off_t offset, + fspr_size_t size, fspr_int32_t flag, + fspr_pool_t *cont) { void *mm; #ifdef BEOS area_id aid = -1; uint32 pages = 0; #else - apr_int32_t native_flags = 0; + fspr_int32_t native_flags = 0; #endif #if APR_HAS_LARGE_FILES && defined(HAVE_MMAP64) #define mmap mmap64 #elif APR_HAS_LARGE_FILES && SIZEOF_OFF_T == 4 /* LFS but no mmap64: check for overflow */ - if ((apr_int64_t)offset + size > INT_MAX) + if ((fspr_int64_t)offset + size > INT_MAX) return APR_EINVAL; #endif @@ -97,18 +97,18 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, if (file == NULL || file->filedes == -1 || file->buffered) return APR_EBADF; - (*new) = (apr_mmap_t *)apr_pcalloc(cont, sizeof(apr_mmap_t)); + (*new) = (fspr_mmap_t *)fspr_pcalloc(cont, sizeof(fspr_mmap_t)); #ifdef BEOS /* XXX: mmap shouldn't really change the seek offset */ - apr_file_seek(file, APR_SET, &offset); + fspr_file_seek(file, APR_SET, &offset); /* There seems to be some strange interactions that mean our area must * be set as READ & WRITE or writev will fail! Go figure... * So we ignore the value in flags and always ask for both READ and WRITE */ pages = (size + B_PAGE_SIZE -1) / B_PAGE_SIZE; - aid = create_area("apr_mmap", &mm , B_ANY_ADDRESS, pages * B_PAGE_SIZE, + aid = create_area("fspr_mmap", &mm , B_ANY_ADDRESS, pages * B_PAGE_SIZE, B_NO_LOCK, B_WRITE_AREA|B_READ_AREA); if (aid < B_NO_ERROR) { @@ -145,28 +145,28 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, APR_RING_ELEM_INIT(*new, link); /* register the cleanup... */ - apr_pool_cleanup_register((*new)->cntxt, (void*)(*new), mmap_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->cntxt, (void*)(*new), mmap_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap, - apr_mmap_t *old_mmap, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_mmap_dup(fspr_mmap_t **new_mmap, + fspr_mmap_t *old_mmap, + fspr_pool_t *p) { - *new_mmap = (apr_mmap_t *)apr_pmemdup(p, old_mmap, sizeof(apr_mmap_t)); + *new_mmap = (fspr_mmap_t *)fspr_pmemdup(p, old_mmap, sizeof(fspr_mmap_t)); (*new_mmap)->cntxt = p; APR_RING_INSERT_AFTER(old_mmap, *new_mmap, link); - apr_pool_cleanup_register(p, *new_mmap, mmap_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(p, *new_mmap, mmap_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm) +APR_DECLARE(fspr_status_t) fspr_mmap_delete(fspr_mmap_t *mm) { - return apr_pool_cleanup_run(mm->cntxt, mm, mmap_cleanup); + return fspr_pool_cleanup_run(mm->cntxt, mm, mmap_cleanup); } #endif diff --git a/libs/apr/mmap/win32/mmap.c b/libs/apr/mmap/win32/mmap.c index 134417707f..495b168438 100644 --- a/libs/apr/mmap/win32/mmap.c +++ b/libs/apr/mmap/win32/mmap.c @@ -14,22 +14,22 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" -#include "apr_general.h" -#include "apr_mmap.h" -#include "apr_errno.h" -#include "apr_arch_file_io.h" -#include "apr_portable.h" -#include "apr_strings.h" +#include "fspr.h" +#include "fspr_private.h" +#include "fspr_general.h" +#include "fspr_mmap.h" +#include "fspr_errno.h" +#include "fspr_arch_file_io.h" +#include "fspr_portable.h" +#include "fspr_strings.h" #if APR_HAS_MMAP -static apr_status_t mmap_cleanup(void *themmap) +static fspr_status_t mmap_cleanup(void *themmap) { - apr_mmap_t *mm = themmap; - apr_mmap_t *next = APR_RING_NEXT(mm,link); - apr_status_t rv = 0; + fspr_mmap_t *mm = themmap; + fspr_mmap_t *next = APR_RING_NEXT(mm,link); + fspr_status_t rv = 0; /* we no longer refer to the mmaped region */ APR_RING_REMOVE(mm,link); @@ -44,7 +44,7 @@ static apr_status_t mmap_cleanup(void *themmap) if (mm->mv) { if (!UnmapViewOfFile(mm->mv)) { - apr_status_t rv = apr_get_os_error(); + fspr_status_t rv = fspr_get_os_error(); CloseHandle(mm->mhandle); mm->mv = NULL; mm->mhandle = NULL; @@ -56,7 +56,7 @@ static apr_status_t mmap_cleanup(void *themmap) { if (!CloseHandle(mm->mhandle)) { - apr_status_t rv = apr_get_os_error(); + fspr_status_t rv = fspr_get_os_error(); CloseHandle(mm->mhandle); mm->mhandle = NULL; return rv; @@ -66,9 +66,9 @@ static apr_status_t mmap_cleanup(void *themmap) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, apr_file_t *file, - apr_off_t offset, apr_size_t size, - apr_int32_t flag, apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_mmap_create(fspr_mmap_t **new, fspr_file_t *file, + fspr_off_t offset, fspr_size_t size, + fspr_int32_t flag, fspr_pool_t *cont) { static DWORD memblock = 0; DWORD fmaccess = 0; @@ -100,10 +100,10 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, apr_file_t *file, memblock = si.dwAllocationGranularity; } - *new = apr_pcalloc(cont, sizeof(apr_mmap_t)); + *new = fspr_pcalloc(cont, sizeof(fspr_mmap_t)); (*new)->pstart = (offset / memblock) * memblock; (*new)->poffset = offset - (*new)->pstart; - (*new)->psize = (apr_size_t)((*new)->poffset) + size; + (*new)->psize = (fspr_size_t)((*new)->poffset) + size; /* The size of the CreateFileMapping object is the current size * of the size of the mmap object (e.g. file size), not the size * of the mapped region! @@ -114,7 +114,7 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, apr_file_t *file, if (!(*new)->mhandle || (*new)->mhandle == INVALID_HANDLE_VALUE) { *new = NULL; - return apr_get_os_error(); + return fspr_get_os_error(); } offlo = (DWORD)(*new)->pstart; @@ -123,7 +123,7 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, apr_file_t *file, offlo, (*new)->psize); if (!(*new)->mv) { - apr_status_t rv = apr_get_os_error(); + fspr_status_t rv = fspr_get_os_error(); CloseHandle((*new)->mhandle); *new = NULL; return rv; @@ -135,28 +135,28 @@ APR_DECLARE(apr_status_t) apr_mmap_create(apr_mmap_t **new, apr_file_t *file, APR_RING_ELEM_INIT(*new, link); /* register the cleanup... */ - apr_pool_cleanup_register((*new)->cntxt, (void*)(*new), mmap_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->cntxt, (void*)(*new), mmap_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_mmap_dup(apr_mmap_t **new_mmap, - apr_mmap_t *old_mmap, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_mmap_dup(fspr_mmap_t **new_mmap, + fspr_mmap_t *old_mmap, + fspr_pool_t *p) { - *new_mmap = (apr_mmap_t *)apr_pmemdup(p, old_mmap, sizeof(apr_mmap_t)); + *new_mmap = (fspr_mmap_t *)fspr_pmemdup(p, old_mmap, sizeof(fspr_mmap_t)); (*new_mmap)->cntxt = p; APR_RING_INSERT_AFTER(old_mmap, *new_mmap, link); - apr_pool_cleanup_register(p, *new_mmap, mmap_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(p, *new_mmap, mmap_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_mmap_delete(apr_mmap_t *mm) +APR_DECLARE(fspr_status_t) fspr_mmap_delete(fspr_mmap_t *mm) { - return apr_pool_cleanup_run(mm->cntxt, mm, mmap_cleanup); + return fspr_pool_cleanup_run(mm->cntxt, mm, mmap_cleanup); } #endif diff --git a/libs/apr/network_io/beos/sendrecv.c b/libs/apr/network_io/beos/sendrecv.c index 1aeb426e9c..618b2c6a8b 100644 --- a/libs/apr/network_io/beos/sendrecv.c +++ b/libs/apr/network_io/beos/sendrecv.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_private.h" +#include "fspr_private.h" #if BEOS_BONE /* BONE uses the unix code - woohoo */ #include "../unix/sendrecv.c" #else -#include "apr_arch_networkio.h" -#include "apr_time.h" +#include "fspr_arch_networkio.h" +#include "fspr_time.h" -static apr_status_t wait_for_io_or_timeout(apr_socket_t *sock, int for_read) +static fspr_status_t wait_for_io_or_timeout(fspr_socket_t *sock, int for_read) { struct timeval tv, *tvptr; fd_set fdset; @@ -57,23 +57,23 @@ static apr_status_t wait_for_io_or_timeout(apr_socket_t *sock, int for_read) #define SEND_WAIT APR_USEC_PER_SEC / 10 -APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_send(fspr_socket_t *sock, const char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; do { rv = send(sock->socketdes, buf, (*len), 0); } while (rv == -1 && errno == EINTR); if (rv == -1 && errno == EWOULDBLOCK && sock->timeout > 0) { - apr_int32_t snooze_val = SEND_WAIT; - apr_int32_t zzz = 0; + fspr_int32_t snooze_val = SEND_WAIT; + fspr_int32_t zzz = 0; do { rv = send(sock->socketdes, buf, (*len), 0); if (rv == -1 && errno == EWOULDBLOCK){ - apr_sleep (snooze_val); + fspr_sleep (snooze_val); zzz += snooze_val; snooze_val += SEND_WAIT; /* have we passed our timeout value */ @@ -91,17 +91,17 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_recv(fspr_socket_t *sock, char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; do { rv = recv(sock->socketdes, buf, (*len), 0); } while (rv == -1 && errno == EINTR); if (rv == -1 && errno == EWOULDBLOCK && sock->timeout > 0) { - apr_status_t arv = wait_for_io_or_timeout(sock, 1); + fspr_status_t arv = wait_for_io_or_timeout(sock, 1); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -124,20 +124,20 @@ APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, /* BeOS doesn't have writev for sockets so we use the following instead... */ -APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t * sock, +APR_DECLARE(fspr_status_t) fspr_socket_sendv(fspr_socket_t * sock, const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len) + fspr_int32_t nvec, fspr_size_t *len) { *len = vec[0].iov_len; - return apr_socket_send(sock, vec[0].iov_base, len); + return fspr_socket_send(sock, vec[0].iov_base, len); } -APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, - apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_sendto(fspr_socket_t *sock, + fspr_sockaddr_t *where, + fspr_int32_t flags, const char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; do { rv = sendto(sock->socketdes, buf, (*len), flags, @@ -147,7 +147,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && sock->timeout != 0) { - apr_status_t arv = wait_for_io_or_timeout(sock, 0); + fspr_status_t arv = wait_for_io_or_timeout(sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -167,12 +167,12 @@ APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, - apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_recvfrom(fspr_sockaddr_t *from, + fspr_socket_t *sock, + fspr_int32_t flags, char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; if (from == NULL){ return APR_ENOMEM; @@ -188,7 +188,7 @@ APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, if (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && sock->timeout != 0) { - apr_status_t arv = wait_for_io_or_timeout(sock, 1); + fspr_status_t arv = wait_for_io_or_timeout(sock, 1); if (arv != APR_SUCCESS) { *len = 0; return arv; diff --git a/libs/apr/network_io/os2/os2calls.c b/libs/apr/network_io/os2/os2calls.c index 6bf1fcd02e..b68e93e294 100644 --- a/libs/apr/network_io/os2/os2calls.c +++ b/libs/apr/network_io/os2/os2calls.c @@ -14,33 +14,33 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_network_io.h" -#include "apr_portable.h" -#include "apr_general.h" -#include "apr_lib.h" +#include "fspr_arch_networkio.h" +#include "fspr_network_io.h" +#include "fspr_portable.h" +#include "fspr_general.h" +#include "fspr_lib.h" static int os2_socket_init(int, int ,int); -int (*apr_os2_socket)(int, int, int) = os2_socket_init; -int (*apr_os2_select)(int *, int, int, int, long) = NULL; -int (*apr_os2_sock_errno)() = NULL; -int (*apr_os2_accept)(int, struct sockaddr *, int *) = NULL; -int (*apr_os2_bind)(int, struct sockaddr *, int) = NULL; -int (*apr_os2_connect)(int, struct sockaddr *, int) = NULL; -int (*apr_os2_getpeername)(int, struct sockaddr *, int *) = NULL; -int (*apr_os2_getsockname)(int, struct sockaddr *, int *) = NULL; -int (*apr_os2_getsockopt)(int, int, int, char *, int *) = NULL; -int (*apr_os2_ioctl)(int, int, caddr_t, int) = NULL; -int (*apr_os2_listen)(int, int) = NULL; -int (*apr_os2_recv)(int, char *, int, int) = NULL; -int (*apr_os2_send)(int, const char *, int, int) = NULL; -int (*apr_os2_setsockopt)(int, int, int, char *, int) = NULL; -int (*apr_os2_shutdown)(int, int) = NULL; -int (*apr_os2_soclose)(int) = NULL; -int (*apr_os2_writev)(int, struct iovec *, int) = NULL; -int (*apr_os2_sendto)(int, const char *, int, int, const struct sockaddr *, int); -int (*apr_os2_recvfrom)(int, char *, int, int, struct sockaddr *, int *); +int (*fspr_os2_socket)(int, int, int) = os2_socket_init; +int (*fspr_os2_select)(int *, int, int, int, long) = NULL; +int (*fspr_os2_sock_errno)() = NULL; +int (*fspr_os2_accept)(int, struct sockaddr *, int *) = NULL; +int (*fspr_os2_bind)(int, struct sockaddr *, int) = NULL; +int (*fspr_os2_connect)(int, struct sockaddr *, int) = NULL; +int (*fspr_os2_getpeername)(int, struct sockaddr *, int *) = NULL; +int (*fspr_os2_getsockname)(int, struct sockaddr *, int *) = NULL; +int (*fspr_os2_getsockopt)(int, int, int, char *, int *) = NULL; +int (*fspr_os2_ioctl)(int, int, caddr_t, int) = NULL; +int (*fspr_os2_listen)(int, int) = NULL; +int (*fspr_os2_recv)(int, char *, int, int) = NULL; +int (*fspr_os2_send)(int, const char *, int, int) = NULL; +int (*fspr_os2_setsockopt)(int, int, int, char *, int) = NULL; +int (*fspr_os2_shutdown)(int, int) = NULL; +int (*fspr_os2_soclose)(int) = NULL; +int (*fspr_os2_writev)(int, struct iovec *, int) = NULL; +int (*fspr_os2_sendto)(int, const char *, int, int, const struct sockaddr *, int); +int (*fspr_os2_recvfrom)(int, char *, int, int, struct sockaddr *, int *); static HMODULE hSO32DLL; @@ -48,7 +48,7 @@ static int os2_fn_link() { DosEnterCritSec(); /* Stop two threads doing this at the same time */ - if (apr_os2_socket == os2_socket_init) { + if (fspr_os2_socket == os2_socket_init) { ULONG rc; char errorstr[200]; @@ -57,61 +57,61 @@ static int os2_fn_link() if (rc) return APR_OS2_STATUS(rc); - rc = DosQueryProcAddr(hSO32DLL, 0, "SOCKET", &apr_os2_socket); + rc = DosQueryProcAddr(hSO32DLL, 0, "SOCKET", &fspr_os2_socket); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "SELECT", &apr_os2_select); + rc = DosQueryProcAddr(hSO32DLL, 0, "SELECT", &fspr_os2_select); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "SOCK_ERRNO", &apr_os2_sock_errno); + rc = DosQueryProcAddr(hSO32DLL, 0, "SOCK_ERRNO", &fspr_os2_sock_errno); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "ACCEPT", &apr_os2_accept); + rc = DosQueryProcAddr(hSO32DLL, 0, "ACCEPT", &fspr_os2_accept); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "BIND", &apr_os2_bind); + rc = DosQueryProcAddr(hSO32DLL, 0, "BIND", &fspr_os2_bind); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "CONNECT", &apr_os2_connect); + rc = DosQueryProcAddr(hSO32DLL, 0, "CONNECT", &fspr_os2_connect); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "GETPEERNAME", &apr_os2_getpeername); + rc = DosQueryProcAddr(hSO32DLL, 0, "GETPEERNAME", &fspr_os2_getpeername); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "GETSOCKNAME", &apr_os2_getsockname); + rc = DosQueryProcAddr(hSO32DLL, 0, "GETSOCKNAME", &fspr_os2_getsockname); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "GETSOCKOPT", &apr_os2_getsockopt); + rc = DosQueryProcAddr(hSO32DLL, 0, "GETSOCKOPT", &fspr_os2_getsockopt); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "IOCTL", &apr_os2_ioctl); + rc = DosQueryProcAddr(hSO32DLL, 0, "IOCTL", &fspr_os2_ioctl); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "LISTEN", &apr_os2_listen); + rc = DosQueryProcAddr(hSO32DLL, 0, "LISTEN", &fspr_os2_listen); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "RECV", &apr_os2_recv); + rc = DosQueryProcAddr(hSO32DLL, 0, "RECV", &fspr_os2_recv); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "SEND", &apr_os2_send); + rc = DosQueryProcAddr(hSO32DLL, 0, "SEND", &fspr_os2_send); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "SETSOCKOPT", &apr_os2_setsockopt); + rc = DosQueryProcAddr(hSO32DLL, 0, "SETSOCKOPT", &fspr_os2_setsockopt); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "SHUTDOWN", &apr_os2_shutdown); + rc = DosQueryProcAddr(hSO32DLL, 0, "SHUTDOWN", &fspr_os2_shutdown); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "SOCLOSE", &apr_os2_soclose); + rc = DosQueryProcAddr(hSO32DLL, 0, "SOCLOSE", &fspr_os2_soclose); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "WRITEV", &apr_os2_writev); + rc = DosQueryProcAddr(hSO32DLL, 0, "WRITEV", &fspr_os2_writev); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "SENDTO", &apr_os2_sendto); + rc = DosQueryProcAddr(hSO32DLL, 0, "SENDTO", &fspr_os2_sendto); if (!rc) - rc = DosQueryProcAddr(hSO32DLL, 0, "RECVFROM", &apr_os2_recvfrom); + rc = DosQueryProcAddr(hSO32DLL, 0, "RECVFROM", &fspr_os2_recvfrom); if (rc) return APR_OS2_STATUS(rc); @@ -127,6 +127,6 @@ static int os2_socket_init(int domain, int type, int protocol) { int rc = os2_fn_link(); if (rc == APR_SUCCESS) - return apr_os2_socket(domain, type, protocol); + return fspr_os2_socket(domain, type, protocol); return rc; } diff --git a/libs/apr/network_io/os2/sendrecv.c b/libs/apr/network_io/os2/sendrecv.c index 839ff3f831..8f0fbf805c 100644 --- a/libs/apr/network_io/os2/sendrecv.c +++ b/libs/apr/network_io/os2/sendrecv.c @@ -14,17 +14,17 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_network_io.h" -#include "apr_lib.h" +#include "fspr_arch_networkio.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_network_io.h" +#include "fspr_lib.h" #include -APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_send(fspr_socket_t *sock, const char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; int fds, err = 0; if (*len > 65536) { @@ -65,10 +65,10 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, -APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_recv(fspr_socket_t *sock, char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; int fds, err = 0; do { @@ -105,11 +105,11 @@ APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, -APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, +APR_DECLARE(fspr_status_t) fspr_socket_sendv(fspr_socket_t *sock, const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len) + fspr_int32_t nvec, fspr_size_t *len) { - apr_status_t rv; + fspr_status_t rv; struct iovec *tmpvec; int fds, err = 0; int nv_tosend, total = 0; diff --git a/libs/apr/network_io/os2/sendrecv_udp.c b/libs/apr/network_io/os2/sendrecv_udp.c index c0dcd8562e..7a8d0c36db 100644 --- a/libs/apr/network_io/os2/sendrecv_udp.c +++ b/libs/apr/network_io/os2/sendrecv_udp.c @@ -14,21 +14,21 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_network_io.h" -#include "apr_support.h" -#include "apr_lib.h" +#include "fspr_arch_networkio.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_network_io.h" +#include "fspr_support.h" +#include "fspr_lib.h" #include -APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, - apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_sendto(fspr_socket_t *sock, + fspr_sockaddr_t *where, + fspr_int32_t flags, const char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; int serrno; do { @@ -38,7 +38,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, } while (rv == -1 && (serrno = sock_errno()) == EINTR); if (rv == -1 && serrno == SOCEWOULDBLOCK && sock->timeout != 0) { - apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + fspr_status_t arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; @@ -63,12 +63,12 @@ APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, -APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, - apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_recvfrom(fspr_sockaddr_t *from, + fspr_socket_t *sock, + fspr_int32_t flags, char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; int serrno; do { @@ -77,7 +77,7 @@ APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, } while (rv == -1 && (serrno = sock_errno()) == EINTR); if (rv == -1 && serrno == SOCEWOULDBLOCK && sock->timeout != 0) { - apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 1); + fspr_status_t arv = fspr_wait_for_io_or_timeout(NULL, sock, 1); if (arv != APR_SUCCESS) { *len = 0; diff --git a/libs/apr/network_io/os2/sockets.c b/libs/apr/network_io/os2/sockets.c index bb951e4c86..1035889b4b 100644 --- a/libs/apr/network_io/os2/sockets.c +++ b/libs/apr/network_io/os2/sockets.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_arch_inherit.h" -#include "apr_network_io.h" -#include "apr_general.h" -#include "apr_portable.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_arch_networkio.h" +#include "fspr_arch_inherit.h" +#include "fspr_network_io.h" +#include "fspr_general.h" +#include "fspr_portable.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #include #include #include @@ -28,11 +28,11 @@ #include #include #include -#include "apr_arch_os2calls.h" +#include "fspr_arch_os2calls.h" -static apr_status_t socket_cleanup(void *sock) +static fspr_status_t socket_cleanup(void *sock) { - apr_socket_t *thesocket = sock; + fspr_socket_t *thesocket = sock; if (thesocket->socketdes < 0) { return APR_EINVALSOCK; @@ -47,43 +47,43 @@ static apr_status_t socket_cleanup(void *sock) } } -static void set_socket_vars(apr_socket_t *sock, int family, int type, int protocol) +static void set_socket_vars(fspr_socket_t *sock, int family, int type, int protocol) { sock->type = type; sock->protocol = protocol; - apr_sockaddr_vars_set(sock->local_addr, family, 0); - apr_sockaddr_vars_set(sock->remote_addr, family, 0); + fspr_sockaddr_vars_set(sock->local_addr, family, 0); + fspr_sockaddr_vars_set(sock->remote_addr, family, 0); } -static void alloc_socket(apr_socket_t **new, apr_pool_t *p) +static void alloc_socket(fspr_socket_t **new, fspr_pool_t *p) { - *new = (apr_socket_t *)apr_pcalloc(p, sizeof(apr_socket_t)); + *new = (fspr_socket_t *)fspr_pcalloc(p, sizeof(fspr_socket_t)); (*new)->pool = p; - (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, - sizeof(apr_sockaddr_t)); + (*new)->local_addr = (fspr_sockaddr_t *)fspr_pcalloc((*new)->pool, + sizeof(fspr_sockaddr_t)); (*new)->local_addr->pool = p; - (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, - sizeof(apr_sockaddr_t)); + (*new)->remote_addr = (fspr_sockaddr_t *)fspr_pcalloc((*new)->pool, + sizeof(fspr_sockaddr_t)); (*new)->remote_addr->pool = p; (*new)->remote_addr_unknown = 1; /* Create a pollset with room for one descriptor. */ /* ### check return codes */ - (void) apr_pollset_create(&(*new)->pollset, 1, p, 0); + (void) fspr_pollset_create(&(*new)->pollset, 1, p, 0); } -APR_DECLARE(apr_status_t) apr_socket_protocol_get(apr_socket_t *sock, int *protocol) +APR_DECLARE(fspr_status_t) fspr_socket_protocol_get(fspr_socket_t *sock, int *protocol) { *protocol = sock->protocol; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, int type, - int protocol, apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_socket_create(fspr_socket_t **new, int family, int type, + int protocol, fspr_pool_t *cont) { int downgrade = (family == AF_UNSPEC); - apr_pollfd_t pfd; + fspr_pollfd_t pfd; if (family == AF_UNSPEC) { #if APR_HAVE_IPV6 @@ -110,14 +110,14 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, int (*new)->timeout = -1; (*new)->nonblock = FALSE; - apr_pool_cleanup_register((*new)->pool, (void *)(*new), - socket_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), + socket_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, - apr_shutdown_how_e how) +APR_DECLARE(fspr_status_t) fspr_socket_shutdown(fspr_socket_t *thesocket, + fspr_shutdown_how_e how) { if (shutdown(thesocket->socketdes, how) == 0) { return APR_SUCCESS; @@ -127,14 +127,14 @@ APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, } } -APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) +APR_DECLARE(fspr_status_t) fspr_socket_close(fspr_socket_t *thesocket) { - apr_pool_cleanup_kill(thesocket->pool, thesocket, socket_cleanup); + fspr_pool_cleanup_kill(thesocket->pool, thesocket, socket_cleanup); return socket_cleanup(thesocket); } -APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, - apr_sockaddr_t *sa) +APR_DECLARE(fspr_status_t) fspr_socket_bind(fspr_socket_t *sock, + fspr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, @@ -150,8 +150,8 @@ APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, } } -APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, - apr_int32_t backlog) +APR_DECLARE(fspr_status_t) fspr_socket_listen(fspr_socket_t *sock, + fspr_int32_t backlog) { if (listen(sock->socketdes, backlog) == -1) return APR_OS2_STATUS(sock_errno()); @@ -159,9 +159,9 @@ APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, - apr_socket_t *sock, - apr_pool_t *connection_context) +APR_DECLARE(fspr_status_t) fspr_socket_accept(fspr_socket_t **new, + fspr_socket_t *sock, + fspr_pool_t *connection_context) { alloc_socket(new, connection_context); set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol); @@ -186,13 +186,13 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, (*new)->local_addr->ipaddr_ptr = &(*new)->local_addr->sa.sin.sin_addr; } - apr_pool_cleanup_register((*new)->pool, (void *)(*new), - socket_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), + socket_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, - apr_sockaddr_t *sa) +APR_DECLARE(fspr_status_t) fspr_socket_connect(fspr_socket_t *sock, + fspr_sockaddr_t *sa) { if ((connect(sock->socketdes, (struct sockaddr *)&sa->sa.sin, sa->salen) < 0) && @@ -208,14 +208,14 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, } } -APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock, int *type) +APR_DECLARE(fspr_status_t) fspr_socket_type_get(fspr_socket_t *sock, int *type) { *type = sock->type; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key, - apr_socket_t *sock) +APR_DECLARE(fspr_status_t) fspr_socket_data_get(void **data, const char *key, + fspr_socket_t *sock) { sock_userdata_t *cur = sock->userdata; @@ -234,65 +234,65 @@ APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key, -APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data, const char *key, - apr_status_t (*cleanup) (void *)) +APR_DECLARE(fspr_status_t) fspr_socket_data_set(fspr_socket_t *sock, void *data, const char *key, + fspr_status_t (*cleanup) (void *)) { - sock_userdata_t *new = apr_palloc(sock->pool, sizeof(sock_userdata_t)); + sock_userdata_t *new = fspr_palloc(sock->pool, sizeof(sock_userdata_t)); - new->key = apr_pstrdup(sock->pool, key); + new->key = fspr_pstrdup(sock->pool, key); new->data = data; new->next = sock->userdata; sock->userdata = new; if (cleanup) { - apr_pool_cleanup_register(sock->pool, data, cleanup, cleanup); + fspr_pool_cleanup_register(sock->pool, data, cleanup, cleanup); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t *sock) +APR_DECLARE(fspr_status_t) fspr_os_sock_get(fspr_os_sock_t *thesock, fspr_socket_t *sock) { *thesock = sock->socketdes; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, - apr_os_sock_info_t *os_sock_info, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_os_sock_make(fspr_socket_t **fspr_sock, + fspr_os_sock_info_t *os_sock_info, + fspr_pool_t *cont) { - alloc_socket(apr_sock, cont); - set_socket_vars(*apr_sock, os_sock_info->family, os_sock_info->type, os_sock_info->protocol); - (*apr_sock)->timeout = -1; - (*apr_sock)->socketdes = *os_sock_info->os_sock; + alloc_socket(fspr_sock, cont); + set_socket_vars(*fspr_sock, os_sock_info->family, os_sock_info->type, os_sock_info->protocol); + (*fspr_sock)->timeout = -1; + (*fspr_sock)->socketdes = *os_sock_info->os_sock; if (os_sock_info->local) { - memcpy(&(*apr_sock)->local_addr->sa.sin, + memcpy(&(*fspr_sock)->local_addr->sa.sin, os_sock_info->local, - (*apr_sock)->local_addr->salen); + (*fspr_sock)->local_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ - (*apr_sock)->local_addr->port = ntohs((*apr_sock)->local_addr->sa.sin.sin_port); + (*fspr_sock)->local_addr->port = ntohs((*fspr_sock)->local_addr->sa.sin.sin_port); } else { - (*apr_sock)->local_port_unknown = (*apr_sock)->local_interface_unknown = 1; + (*fspr_sock)->local_port_unknown = (*fspr_sock)->local_interface_unknown = 1; } if (os_sock_info->remote) { - memcpy(&(*apr_sock)->remote_addr->sa.sin, + memcpy(&(*fspr_sock)->remote_addr->sa.sin, os_sock_info->remote, - (*apr_sock)->remote_addr->salen); + (*fspr_sock)->remote_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ - (*apr_sock)->remote_addr->port = ntohs((*apr_sock)->remote_addr->sa.sin.sin_port); + (*fspr_sock)->remote_addr->port = ntohs((*fspr_sock)->remote_addr->sa.sin.sin_port); } else { - (*apr_sock)->remote_addr_unknown = 1; + (*fspr_sock)->remote_addr_unknown = 1; } - apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), - socket_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*fspr_sock)->pool, (void *)(*fspr_sock), + socket_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_os_sock_put(fspr_socket_t **sock, fspr_os_sock_t *thesock, fspr_pool_t *cont) { if (cont == NULL) { return APR_ENOPOOL; diff --git a/libs/apr/network_io/os2/sockopt.c b/libs/apr/network_io/os2/sockopt.c index 85ff35331a..4123de5eca 100644 --- a/libs/apr/network_io/os2/sockopt.c +++ b/libs/apr/network_io/os2/sockopt.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_network_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_arch_networkio.h" +#include "fspr_network_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #include #include #include @@ -29,16 +29,16 @@ #include -APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, - apr_interval_time_t t) +APR_DECLARE(fspr_status_t) fspr_socket_timeout_set(fspr_socket_t *sock, + fspr_interval_time_t t) { sock->timeout = t; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, - apr_int32_t opt, apr_int32_t on) +APR_DECLARE(fspr_status_t) fspr_socket_opt_set(fspr_socket_t *sock, + fspr_int32_t opt, fspr_int32_t on) { int one; struct linger li; @@ -91,16 +91,16 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock, - apr_interval_time_t *t) +APR_DECLARE(fspr_status_t) fspr_socket_timeout_get(fspr_socket_t *sock, + fspr_interval_time_t *t) { *t = sock->timeout; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, - apr_int32_t opt, apr_int32_t *on) +APR_DECLARE(fspr_status_t) fspr_socket_opt_get(fspr_socket_t *sock, + fspr_int32_t opt, fspr_int32_t *on) { switch(opt) { default: @@ -110,7 +110,7 @@ APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, } -APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock) +APR_DECLARE(int) fspr_socket_fd_get(fspr_socket_t *sock) { if (sock) { return sock->socketdes; @@ -120,7 +120,7 @@ APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock) } -APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark) +APR_DECLARE(fspr_status_t) fspr_socket_atmark(fspr_socket_t *sock, int *atmark) { int oobmark; @@ -134,8 +134,8 @@ APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark) } -APR_DECLARE(apr_status_t) apr_gethostname(char *buf, apr_int32_t len, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_gethostname(char *buf, fspr_int32_t len, + fspr_pool_t *cont) { if (gethostname(buf, len) == -1) { buf[0] = '\0'; diff --git a/libs/apr/network_io/unix/inet_ntop.c b/libs/apr/network_io/unix/inet_ntop.c index a96eb18f7a..cdf1d08176 100644 --- a/libs/apr/network_io/unix/inet_ntop.c +++ b/libs/apr/network_io/unix/inet_ntop.c @@ -14,9 +14,9 @@ * SOFTWARE. */ -#include "apr_private.h" -#include "apr_arch_networkio.h" -#include "apr_strings.h" +#include "fspr_private.h" +#include "fspr_arch_networkio.h" +#include "fspr_strings.h" #if APR_HAVE_SYS_TYPES_H #include @@ -41,7 +41,7 @@ #endif #ifndef INT16SZ -#define INT16SZ sizeof(apr_int16_t) +#define INT16SZ sizeof(fspr_int16_t) #endif #ifndef __P @@ -57,9 +57,9 @@ * sizeof(int) < 4. sizeof(int) > 4 is fine; all the world's not a VAX. */ -static const char *inet_ntop4 __P((const unsigned char *src, char *dst, apr_size_t size)); +static const char *inet_ntop4 __P((const unsigned char *src, char *dst, fspr_size_t size)); #if APR_HAVE_IPV6 -static const char *inet_ntop6 __P((const unsigned char *src, char *dst, apr_size_t size)); +static const char *inet_ntop6 __P((const unsigned char *src, char *dst, fspr_size_t size)); #endif /* char * @@ -71,7 +71,7 @@ static const char *inet_ntop6 __P((const unsigned char *src, char *dst, apr_size * Paul Vixie, 1996. */ const char * -apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size) +fspr_inet_ntop(int af, const void *src, char *dst, fspr_size_t size) { switch (af) { case AF_INET: @@ -99,9 +99,9 @@ apr_inet_ntop(int af, const void *src, char *dst, apr_size_t size) * Paul Vixie, 1996. */ static const char * -inet_ntop4(const unsigned char *src, char *dst, apr_size_t size) +inet_ntop4(const unsigned char *src, char *dst, fspr_size_t size) { - const apr_size_t MIN_SIZE = 16; /* space for 255.255.255.255\0 */ + const fspr_size_t MIN_SIZE = 16; /* space for 255.255.255.255\0 */ int n = 0; char *next = dst; @@ -137,7 +137,7 @@ inet_ntop4(const unsigned char *src, char *dst, apr_size_t size) * Paul Vixie, 1996. */ static const char * -inet_ntop6(const unsigned char *src, char *dst, apr_size_t size) +inet_ntop6(const unsigned char *src, char *dst, fspr_size_t size) { /* * Note that int32_t and int16_t need only be "at least" large enough @@ -224,7 +224,7 @@ inet_ntop6(const unsigned char *src, char *dst, apr_size_t size) tp += strlen(tp); break; } - tp += apr_snprintf(tp, sizeof tmp - (tp - tmp), "%x", words[i]); + tp += fspr_snprintf(tp, sizeof tmp - (tp - tmp), "%x", words[i]); i++; } /* Was it a trailing run of 0x00's? */ @@ -236,7 +236,7 @@ inet_ntop6(const unsigned char *src, char *dst, apr_size_t size) /* * Check for overflow, copy, and we're done. */ - if ((apr_size_t)(tp - tmp) > size) { + if ((fspr_size_t)(tp - tmp) > size) { errno = ENOSPC; return (NULL); } diff --git a/libs/apr/network_io/unix/inet_pton.c b/libs/apr/network_io/unix/inet_pton.c index 22b15390fc..890691b533 100644 --- a/libs/apr/network_io/unix/inet_pton.c +++ b/libs/apr/network_io/unix/inet_pton.c @@ -14,8 +14,8 @@ * SOFTWARE. */ -#include "apr_private.h" -#include "apr_arch_networkio.h" +#include "fspr_private.h" +#include "fspr_arch_networkio.h" #if APR_HAVE_SYS_TYPES_H #include @@ -39,7 +39,7 @@ #endif #ifndef INT16SZ -#define INT16SZ sizeof(apr_int16_t) +#define INT16SZ sizeof(fspr_int16_t) #endif #ifndef INADDRSZ @@ -76,7 +76,7 @@ static int inet_pton6 __P((const char *src, unsigned char *dst)); * Paul Vixie, 1996. */ int -apr_inet_pton(int af, const char *src, void *dst) +fspr_inet_pton(int af, const char *src, void *dst) { switch (af) { case AF_INET: diff --git a/libs/apr/network_io/unix/multicast.c b/libs/apr/network_io/unix/multicast.c index 7f8f759dd7..5047e3b928 100644 --- a/libs/apr/network_io/unix/multicast.c +++ b/libs/apr/network_io/unix/multicast.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_network_io.h" -#include "apr_support.h" -#include "apr_portable.h" -#include "apr_arch_inherit.h" +#include "fspr_arch_networkio.h" +#include "fspr_network_io.h" +#include "fspr_support.h" +#include "fspr_portable.h" +#include "fspr_arch_inherit.h" #ifdef HAVE_GETIFADDRS #include @@ -27,12 +27,12 @@ #ifdef HAVE_STRUCT_IPMREQ /* Only UDP and Raw Sockets can be used for Multicast */ -static apr_status_t mcast_check_type(apr_socket_t *sock) +static fspr_status_t mcast_check_type(fspr_socket_t *sock) { int type; - apr_status_t rv; + fspr_status_t rv; - rv = apr_socket_type_get(sock, &type); + rv = fspr_socket_type_get(sock, &type); if (rv != APR_SUCCESS) { return rv; @@ -45,8 +45,8 @@ static apr_status_t mcast_check_type(apr_socket_t *sock) } } -static void fill_mip_v4(struct ip_mreq *mip, apr_sockaddr_t *mcast, - apr_sockaddr_t *iface) +static void fill_mip_v4(struct ip_mreq *mip, fspr_sockaddr_t *mcast, + fspr_sockaddr_t *iface) { mip->imr_multiaddr = mcast->sa.sin.sin_addr; if (iface == NULL) { @@ -57,7 +57,7 @@ static void fill_mip_v4(struct ip_mreq *mip, apr_sockaddr_t *mcast, } } -static unsigned int find_if_index(const apr_sockaddr_t *iface) +static unsigned int find_if_index(const fspr_sockaddr_t *iface) { unsigned int index = 0; #if defined(HAVE_GETIFADDRS) && APR_HAVE_IPV6 @@ -92,8 +92,8 @@ static unsigned int find_if_index(const apr_sockaddr_t *iface) } #if APR_HAVE_IPV6 -static void fill_mip_v6(struct ipv6_mreq *mip, const apr_sockaddr_t *mcast, - const apr_sockaddr_t *iface) +static void fill_mip_v6(struct ipv6_mreq *mip, const fspr_sockaddr_t *mcast, + const fspr_sockaddr_t *iface) { memcpy(&mip->ipv6mr_multiaddr, mcast->ipaddr_ptr, sizeof(mip->ipv6mr_multiaddr)); @@ -107,7 +107,7 @@ static void fill_mip_v6(struct ipv6_mreq *mip, const apr_sockaddr_t *mcast, } #endif -static int sock_is_ipv4(apr_socket_t *sock) +static int sock_is_ipv4(fspr_socket_t *sock) { if (sock->local_addr->family == APR_INET) return 1; @@ -115,7 +115,7 @@ static int sock_is_ipv4(apr_socket_t *sock) } #if APR_HAVE_IPV6 -static int sock_is_ipv6(apr_socket_t *sock) +static int sock_is_ipv6(fspr_socket_t *sock) { if (sock->local_addr->family == APR_INET6) return 1; @@ -123,12 +123,12 @@ static int sock_is_ipv6(apr_socket_t *sock) } #endif -static apr_status_t do_mcast(int type, apr_socket_t *sock, - apr_sockaddr_t *mcast, apr_sockaddr_t *iface, - apr_sockaddr_t *source) +static fspr_status_t do_mcast(int type, fspr_socket_t *sock, + fspr_sockaddr_t *mcast, fspr_sockaddr_t *iface, + fspr_sockaddr_t *source) { struct ip_mreq mip4; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; #if APR_HAVE_IPV6 struct ipv6_mreq mip6; #endif @@ -214,10 +214,10 @@ static apr_status_t do_mcast(int type, apr_socket_t *sock, return rv; } -static apr_status_t do_mcast_opt(int type, apr_socket_t *sock, - apr_byte_t value) +static fspr_status_t do_mcast_opt(int type, fspr_socket_t *sock, + fspr_byte_t value) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; rv = mcast_check_type(sock); @@ -262,10 +262,10 @@ static apr_status_t do_mcast_opt(int type, apr_socket_t *sock, } #endif -APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock, - apr_sockaddr_t *join, - apr_sockaddr_t *iface, - apr_sockaddr_t *source) +APR_DECLARE(fspr_status_t) fspr_mcast_join(fspr_socket_t *sock, + fspr_sockaddr_t *join, + fspr_sockaddr_t *iface, + fspr_sockaddr_t *source) { #if defined(IP_ADD_MEMBERSHIP) && defined(HAVE_STRUCT_IPMREQ) return do_mcast(IP_ADD_MEMBERSHIP, sock, join, iface, source); @@ -274,10 +274,10 @@ APR_DECLARE(apr_status_t) apr_mcast_join(apr_socket_t *sock, #endif } -APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock, - apr_sockaddr_t *addr, - apr_sockaddr_t *iface, - apr_sockaddr_t *source) +APR_DECLARE(fspr_status_t) fspr_mcast_leave(fspr_socket_t *sock, + fspr_sockaddr_t *addr, + fspr_sockaddr_t *iface, + fspr_sockaddr_t *source) { #if defined(IP_DROP_MEMBERSHIP) && defined(HAVE_STRUCT_IPMREQ) return do_mcast(IP_DROP_MEMBERSHIP, sock, addr, iface, source); @@ -286,7 +286,7 @@ APR_DECLARE(apr_status_t) apr_mcast_leave(apr_socket_t *sock, #endif } -APR_DECLARE(apr_status_t) apr_mcast_hops(apr_socket_t *sock, apr_byte_t ttl) +APR_DECLARE(fspr_status_t) fspr_mcast_hops(fspr_socket_t *sock, fspr_byte_t ttl) { #if defined(IP_MULTICAST_TTL) && defined(HAVE_STRUCT_IPMREQ) return do_mcast_opt(IP_MULTICAST_TTL, sock, ttl); @@ -295,8 +295,8 @@ APR_DECLARE(apr_status_t) apr_mcast_hops(apr_socket_t *sock, apr_byte_t ttl) #endif } -APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock, - apr_byte_t opt) +APR_DECLARE(fspr_status_t) fspr_mcast_loopback(fspr_socket_t *sock, + fspr_byte_t opt) { #if defined(IP_MULTICAST_LOOP) && defined(HAVE_STRUCT_IPMREQ) return do_mcast_opt(IP_MULTICAST_LOOP, sock, opt); @@ -305,11 +305,11 @@ APR_DECLARE(apr_status_t) apr_mcast_loopback(apr_socket_t *sock, #endif } -APR_DECLARE(apr_status_t) apr_mcast_interface(apr_socket_t *sock, - apr_sockaddr_t *iface) +APR_DECLARE(fspr_status_t) fspr_mcast_interface(fspr_socket_t *sock, + fspr_sockaddr_t *iface) { #if defined(IP_MULTICAST_IF) && defined(HAVE_STRUCT_IPMREQ) - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (sock_is_ipv4(sock)) { if (setsockopt(sock->socketdes, IPPROTO_IP, IP_MULTICAST_IF, diff --git a/libs/apr/network_io/unix/sendrecv.c b/libs/apr/network_io/unix/sendrecv.c index ca7230accc..2015bf0bfc 100644 --- a/libs/apr/network_io/unix/sendrecv.c +++ b/libs/apr/network_io/unix/sendrecv.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_support.h" +#include "fspr_arch_networkio.h" +#include "fspr_support.h" #if APR_HAS_SENDFILE -/* This file is needed to allow us access to the apr_file_t internals. */ -#include "apr_arch_file_io.h" +/* This file is needed to allow us access to the fspr_file_t internals. */ +#include "fspr_arch_file_io.h" #endif /* APR_HAS_SENDFILE */ /* osreldate.h is only needed on FreeBSD for sendfile detection */ @@ -29,10 +29,10 @@ #include /* assert() */ -apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, - apr_size_t *len) +fspr_status_t fspr_socket_send(fspr_socket_t *sock, const char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; if (sock->options & APR_INCOMPLETE_WRITE) { sock->options &= ~APR_INCOMPLETE_WRITE; @@ -45,9 +45,9 @@ apr_status_t apr_socket_send(apr_socket_t *sock, const char *buf, while (rv == -1 && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { - apr_status_t arv; + fspr_status_t arv; do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -69,10 +69,10 @@ do_select: return APR_SUCCESS; } -apr_status_t apr_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len) +fspr_status_t fspr_socket_recv(fspr_socket_t *sock, char *buf, fspr_size_t *len) { - apr_ssize_t rv; - apr_status_t arv; + fspr_ssize_t rv; + fspr_status_t arv; if (sock->options & APR_INCOMPLETE_READ) { sock->options &= ~APR_INCOMPLETE_READ; @@ -86,7 +86,7 @@ apr_status_t apr_socket_recv(apr_socket_t *sock, char *buf, apr_size_t *len) while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 1); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 1); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -111,11 +111,11 @@ do_select: return APR_SUCCESS; } -apr_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, - apr_size_t *len) +fspr_status_t fspr_socket_sendto(fspr_socket_t *sock, fspr_sockaddr_t *where, + fspr_int32_t flags, const char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; do { rv = sendto(sock->socketdes, buf, (*len), flags, @@ -125,7 +125,7 @@ apr_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { - apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + fspr_status_t arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -145,11 +145,11 @@ apr_status_t apr_socket_sendto(apr_socket_t *sock, apr_sockaddr_t *where, return APR_SUCCESS; } -apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, - apr_int32_t flags, char *buf, - apr_size_t *len) +fspr_status_t fspr_socket_recvfrom(fspr_sockaddr_t *from, fspr_socket_t *sock, + fspr_int32_t flags, char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; from->salen = sizeof(from->sa); @@ -160,7 +160,7 @@ apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { - apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 1); + fspr_status_t arv = fspr_wait_for_io_or_timeout(NULL, sock, 1); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -176,7 +176,7 @@ apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, return errno; } - apr_sockaddr_vars_set(from, from->sa.sin.sin_family, ntohs(from->sa.sin.sin_port)); + fspr_sockaddr_vars_set(from, from->sa.sin.sin_family, ntohs(from->sa.sin.sin_port)); (*len) = rv; if (rv == 0 && sock->type == SOCK_STREAM) { @@ -186,13 +186,13 @@ apr_status_t apr_socket_recvfrom(apr_sockaddr_t *from, apr_socket_t *sock, return APR_SUCCESS; } -apr_status_t apr_socket_sendv(apr_socket_t * sock, const struct iovec *vec, - apr_int32_t nvec, apr_size_t *len) +fspr_status_t fspr_socket_sendv(fspr_socket_t * sock, const struct iovec *vec, + fspr_int32_t nvec, fspr_size_t *len) { #ifdef HAVE_WRITEV - apr_ssize_t rv; - apr_size_t requested_len = 0; - apr_int32_t i; + fspr_ssize_t rv; + fspr_size_t requested_len = 0; + fspr_int32_t i; for (i = 0; i < nvec; i++) { requested_len += vec[i].iov_len; @@ -209,9 +209,9 @@ apr_status_t apr_socket_sendv(apr_socket_t * sock, const struct iovec *vec, while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { - apr_status_t arv; + fspr_status_t arv; do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -233,7 +233,7 @@ do_select: return APR_SUCCESS; #else *len = vec[0].iov_len; - return apr_socket_send(sock, vec[0].iov_base, len); + return fspr_socket_send(sock, vec[0].iov_base, len); #endif } @@ -245,27 +245,27 @@ do_select: /* TODO: what should flags be? int_32? */ /* Define a structure to pass in when we have a NULL header value */ -static apr_hdtr_t no_hdtr; +static fspr_hdtr_t no_hdtr; #if defined(__linux__) && defined(HAVE_WRITEV) -apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, - apr_size_t *len, apr_int32_t flags) +fspr_status_t fspr_socket_sendfile(fspr_socket_t *sock, fspr_file_t *file, + fspr_hdtr_t *hdtr, fspr_off_t *offset, + fspr_size_t *len, fspr_int32_t flags) { int rv, nbytes = 0, total_hdrbytes, i; - apr_status_t arv; + fspr_status_t arv; #if APR_HAS_LARGE_FILES && defined(HAVE_SENDFILE64) - apr_off_t off = *offset; + fspr_off_t off = *offset; #define sendfile sendfile64 #elif APR_HAS_LARGE_FILES && SIZEOF_OFF_T == 4 - /* 64-bit apr_off_t but no sendfile64(): fail if trying to send + /* 64-bit fspr_off_t but no sendfile64(): fail if trying to send * past the 2Gb limit. */ off_t off; - if ((apr_int64_t)*offset + *len > INT_MAX) { + if ((fspr_int64_t)*offset + *len > INT_MAX) { return EINVAL; } @@ -292,16 +292,16 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, assert(flags==0); if (hdtr->numheaders > 0) { - apr_size_t hdrbytes; + fspr_size_t hdrbytes; /* cork before writing headers */ - rv = apr_socket_opt_set(sock, APR_TCP_NOPUSH, 1); + rv = fspr_socket_opt_set(sock, APR_TCP_NOPUSH, 1); if (rv != APR_SUCCESS) { return rv; } /* Now write the headers */ - arv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, + arv = fspr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, &hdrbytes); if (arv != APR_SUCCESS) { *len = 0; @@ -319,7 +319,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, } if (hdrbytes < total_hdrbytes) { *len = hdrbytes; - return apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); + return fspr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); } } @@ -338,7 +338,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -356,7 +356,7 @@ do_select: if (rv == -1) { *len = nbytes; rv = errno; - apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); + fspr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); return rv; } @@ -364,7 +364,7 @@ do_select: if (rv < *len) { *len = nbytes; - arv = apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); + arv = fspr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); if (rv > 0) { /* If this was a partial write, return now with the @@ -388,19 +388,19 @@ do_select: /* Now write the footers */ if (hdtr->numtrailers > 0) { - apr_size_t trbytes; - arv = apr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, + fspr_size_t trbytes; + arv = fspr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, &trbytes); nbytes += trbytes; if (arv != APR_SUCCESS) { *len = nbytes; rv = errno; - apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); + fspr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); return rv; } } - apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); + fspr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); (*len) = nbytes; return rv < 0 ? errno : APR_SUCCESS; @@ -409,11 +409,11 @@ do_select: #elif defined(DARWIN) /* OS/X Release 10.5 or greater */ -apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, - apr_hdtr_t * hdtr, apr_off_t * offset, - apr_size_t * len, apr_int32_t flags) +fspr_status_t fspr_socket_sendfile(fspr_socket_t * sock, fspr_file_t * file, + fspr_hdtr_t * hdtr, fspr_off_t * offset, + fspr_size_t * len, fspr_int32_t flags) { - apr_off_t nbytes = *len; + fspr_off_t nbytes = *len; int rv; struct sf_hdtr headerstruct; @@ -432,9 +432,9 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, /* BSD can send the headers/footers as part of the system call */ do { if (sock->options & APR_INCOMPLETE_WRITE) { - apr_status_t arv; + fspr_status_t arv; sock->options &= ~APR_INCOMPLETE_WRITE; - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -494,7 +494,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, } if ((rv == -1) && (errno == EAGAIN) && (sock->timeout > 0)) { - apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + fspr_status_t arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -512,9 +512,9 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, #elif defined(__FreeBSD__) || defined(__DragonFly__) /* Release 3.1 or greater */ -apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, - apr_hdtr_t * hdtr, apr_off_t * offset, - apr_size_t * len, apr_int32_t flags) +fspr_status_t fspr_socket_sendfile(fspr_socket_t * sock, fspr_file_t * file, + fspr_hdtr_t * hdtr, fspr_off_t * offset, + fspr_size_t * len, fspr_int32_t flags) { off_t nbytes = 0; int rv; @@ -522,7 +522,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, int i; #endif struct sf_hdtr headerstruct; - apr_size_t bytes_to_send = *len; + fspr_size_t bytes_to_send = *len; /* Ignore flags for now. */ flags = 0; @@ -555,9 +555,9 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, /* FreeBSD can send the headers/footers as part of the system call */ do { if (sock->options & APR_INCOMPLETE_WRITE) { - apr_status_t arv; + fspr_status_t arv; sock->options &= ~APR_INCOMPLETE_WRITE; - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -618,7 +618,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, } if ((rv == -1) && (errno == EAGAIN) && (sock->timeout > 0)) { - apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + fspr_status_t arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -639,13 +639,13 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, sendfile(int fd, int s, off_t offset, off_t *len, struct sf_hdtr *hdtr, int flags); */ -apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, - apr_hdtr_t * hdtr, apr_off_t * offset, - apr_size_t * len, apr_int32_t flags) +fspr_status_t fspr_socket_sendfile(fspr_socket_t * sock, fspr_file_t * file, + fspr_hdtr_t * hdtr, fspr_off_t * offset, + fspr_size_t * len, fspr_int32_t flags) { int rv, i; struct sf_hdtr headerstruct; - apr_off_t bytes_to_send = *len; + fspr_off_t bytes_to_send = *len; /* Ignore flags for now. */ flags = 0; @@ -670,9 +670,9 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, do { if (sock->options & APR_INCOMPLETE_WRITE) { - apr_status_t arv; + fspr_status_t arv; sock->options &= ~APR_INCOMPLETE_WRITE; - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -736,7 +736,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, } if ((rv == -1) && (errno == EAGAIN) && (sock->timeout > 0)) { - apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + fspr_status_t arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -767,32 +767,32 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, * if nbytes == 0, the rest of the file (from offset) is sent */ -apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, - apr_size_t *len, apr_int32_t flags) +fspr_status_t fspr_socket_sendfile(fspr_socket_t *sock, fspr_file_t *file, + fspr_hdtr_t *hdtr, fspr_off_t *offset, + fspr_size_t *len, fspr_int32_t flags) { int i; - apr_ssize_t rc; - apr_size_t nbytes = *len, headerlen, trailerlen; + fspr_ssize_t rc; + fspr_size_t nbytes = *len, headerlen, trailerlen; struct iovec hdtrarray[2]; char *headerbuf, *trailerbuf; #if APR_HAS_LARGE_FILES && defined(HAVE_SENDFILE64) /* later HP-UXes have a sendfile64() */ #define sendfile sendfile64 - apr_off_t off = *offset; + fspr_off_t off = *offset; #elif APR_HAS_LARGE_FILES && SIZEOF_OFF_T == 4 /* HP-UX 11.00 doesn't have a sendfile64(): fail if trying to send * past the 2Gb limit */ off_t off; - if ((apr_int64_t)*offset + *len > INT_MAX) { + if ((fspr_int64_t)*offset + *len > INT_MAX) { return EINVAL; } off = *offset; #else - apr_off_t off = *offset; + fspr_off_t off = *offset; #endif if (!hdtr) { @@ -821,7 +821,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, } /* XXX: BUHHH? wow, what a memory leak! */ - headerbuf = hdtrarray[0].iov_base = apr_palloc(sock->pool, headerlen); + headerbuf = hdtrarray[0].iov_base = fspr_palloc(sock->pool, headerlen); hdtrarray[0].iov_len = headerlen; for (i = 0; i < hdtr->numheaders; i++) { @@ -846,7 +846,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, } /* XXX: BUHHH? wow, what a memory leak! */ - trailerbuf = hdtrarray[1].iov_base = apr_palloc(sock->pool, trailerlen); + trailerbuf = hdtrarray[1].iov_base = fspr_palloc(sock->pool, trailerlen); hdtrarray[1].iov_len = trailerlen; for (i = 0; i < hdtr->numtrailers; i++) { @@ -872,7 +872,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, while ((rc == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { - apr_status_t arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + fspr_status_t arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; @@ -915,13 +915,13 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, * AIX - version 4.3.2 with APAR IX85388, or version 4.3.3 and above * OS/390 - V2R7 and above */ -apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, - apr_hdtr_t * hdtr, apr_off_t * offset, - apr_size_t * len, apr_int32_t flags) +fspr_status_t fspr_socket_sendfile(fspr_socket_t * sock, fspr_file_t * file, + fspr_hdtr_t * hdtr, fspr_off_t * offset, + fspr_size_t * len, fspr_int32_t flags) { int i, ptr, rv = 0; void * hbuf=NULL, * tbuf=NULL; - apr_status_t arv; + fspr_status_t arv; struct sf_parms parms; if (!hdtr) { @@ -951,13 +951,13 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, parms.header_length += hdtr->headers[i].iov_len; } #if 0 - /* Keepalives make apr_palloc a bad idea */ + /* Keepalives make fspr_palloc a bad idea */ hbuf = malloc(parms.header_length); #else /* but headers are small, so maybe we can hold on to the * memory for the life of the socket... */ - hbuf = apr_palloc(sock->pool, parms.header_length); + hbuf = fspr_palloc(sock->pool, parms.header_length); #endif ptr = 0; for (i = 0; i < hdtr->numheaders; i++) { @@ -980,10 +980,10 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, parms.trailer_length += hdtr->trailers[i].iov_len; } #if 0 - /* Keepalives make apr_palloc a bad idea */ + /* Keepalives make fspr_palloc a bad idea */ tbuf = malloc(parms.trailer_length); #else - tbuf = apr_palloc(sock->pool, parms.trailer_length); + tbuf = fspr_palloc(sock->pool, parms.trailer_length); #endif ptr = 0; for (i = 0; i < hdtr->numtrailers; i++) { @@ -1020,7 +1020,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t * sock, apr_file_t * file, while ((rv == -1) && (errno == EAGAIN || errno == EWOULDBLOCK) && (sock->timeout > 0)) { do_select: - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -1077,15 +1077,15 @@ do_select: #define sendfilev sendfilev64 #endif -apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, - apr_hdtr_t *hdtr, apr_off_t *offset, - apr_size_t *len, apr_int32_t flags) +fspr_status_t fspr_socket_sendfile(fspr_socket_t *sock, fspr_file_t *file, + fspr_hdtr_t *hdtr, fspr_off_t *offset, + fspr_size_t *len, fspr_int32_t flags) { - apr_status_t rv, arv; - apr_size_t nbytes; + fspr_status_t rv, arv; + fspr_size_t nbytes; sendfilevec_t *sfv; int vecs, curvec, i, repeat; - apr_size_t requested_len = 0; + fspr_size_t requested_len = 0; if (!hdtr) { hdtr = &no_hdtr; @@ -1096,7 +1096,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, /* Calculate how much space we need. */ vecs = hdtr->numheaders + hdtr->numtrailers + 1; - sfv = apr_palloc(sock->pool, sizeof(sendfilevec_t) * vecs); + sfv = fspr_palloc(sock->pool, sizeof(sendfilevec_t) * vecs); curvec = 0; @@ -1140,7 +1140,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, */ if (sock->options & APR_INCOMPLETE_WRITE) { sock->options &= ~APR_INCOMPLETE_WRITE; - arv = apr_wait_for_io_or_timeout(NULL, sock, 0); + arv = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (arv != APR_SUCCESS) { *len = 0; return arv; @@ -1170,7 +1170,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, rv = 0; } else if (!arv && (sock->timeout > 0)) { - apr_status_t t = apr_wait_for_io_or_timeout(NULL, sock, 0); + fspr_status_t t = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (t != APR_SUCCESS) { *len = 0; @@ -1198,7 +1198,7 @@ apr_status_t apr_socket_sendfile(apr_socket_t *sock, apr_file_t *file, #else #error APR has detected sendfile on your system, but nobody has written a #error version of it for APR yet. To get past this, either write -#error apr_socket_sendfile or change APR_HAS_SENDFILE in apr.h to 0. +#error fspr_socket_sendfile or change APR_HAS_SENDFILE in apr.h to 0. #endif /* __linux__, __FreeBSD__, __DragonFly__, __HPUX__, _AIX, __MVS__, Tru64/OSF1 */ diff --git a/libs/apr/network_io/unix/sockaddr.c b/libs/apr/network_io/unix/sockaddr.c index 33d2400a74..fd9aae8108 100644 --- a/libs/apr/network_io/unix/sockaddr.c +++ b/libs/apr/network_io/unix/sockaddr.c @@ -14,28 +14,28 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_strings.h" -#include "apr.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_private.h" +#include "fspr_arch_networkio.h" +#include "fspr_strings.h" +#include "fspr.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_private.h" #if APR_HAVE_STDLIB_H #include #endif #define APR_WANT_STRFUNC -#include "apr_want.h" +#include "fspr_want.h" -struct apr_ipsubnet_t { +struct fspr_ipsubnet_t { int family; #if APR_HAVE_IPV6 - apr_uint32_t sub[4]; /* big enough for IPv4 and IPv6 addresses */ - apr_uint32_t mask[4]; + fspr_uint32_t sub[4]; /* big enough for IPv4 and IPv6 addresses */ + fspr_uint32_t mask[4]; #else - apr_uint32_t sub[1]; - apr_uint32_t mask[1]; + fspr_uint32_t sub[1]; + fspr_uint32_t mask[1]; #endif }; @@ -68,12 +68,12 @@ static void *getservbyname(const char *name, const char *proto) } #endif -static apr_status_t get_local_addr(apr_socket_t *sock) +static fspr_status_t get_local_addr(fspr_socket_t *sock) { sock->local_addr->salen = sizeof(sock->local_addr->sa); if (getsockname(sock->socketdes, (struct sockaddr *)&sock->local_addr->sa, &sock->local_addr->salen) < 0) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } else { sock->local_port_unknown = sock->local_interface_unknown = 0; @@ -83,12 +83,12 @@ static apr_status_t get_local_addr(apr_socket_t *sock) } } -static apr_status_t get_remote_addr(apr_socket_t *sock) +static fspr_status_t get_remote_addr(fspr_socket_t *sock) { sock->remote_addr->salen = sizeof(sock->remote_addr->sa); if (getpeername(sock->socketdes, (struct sockaddr *)&sock->remote_addr->sa, &sock->remote_addr->salen) < 0) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } else { sock->remote_addr_unknown = 0; @@ -98,11 +98,11 @@ static apr_status_t get_remote_addr(apr_socket_t *sock) } } -APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr, - apr_sockaddr_t *sockaddr) +APR_DECLARE(fspr_status_t) fspr_sockaddr_ip_get(char **addr, + fspr_sockaddr_t *sockaddr) { - *addr = apr_palloc(sockaddr->pool, sockaddr->addr_str_len); - apr_inet_ntop(sockaddr->family, + *addr = fspr_palloc(sockaddr->pool, sockaddr->addr_str_len); + fspr_inet_ntop(sockaddr->family, sockaddr->ipaddr_ptr, *addr, sockaddr->addr_str_len); @@ -119,7 +119,7 @@ APR_DECLARE(apr_status_t) apr_sockaddr_ip_get(char **addr, return APR_SUCCESS; } -void apr_sockaddr_vars_set(apr_sockaddr_t *addr, int family, apr_port_t port) +void fspr_sockaddr_vars_set(fspr_sockaddr_t *addr, int family, fspr_port_t port) { addr->family = family; addr->sa.sin.sin_family = family; @@ -145,13 +145,13 @@ void apr_sockaddr_vars_set(apr_sockaddr_t *addr, int family, apr_port_t port) #endif } -APR_DECLARE(apr_status_t) apr_socket_addr_get(apr_sockaddr_t **sa, - apr_interface_e which, - apr_socket_t *sock) +APR_DECLARE(fspr_status_t) fspr_socket_addr_get(fspr_sockaddr_t **sa, + fspr_interface_e which, + fspr_socket_t *sock) { if (which == APR_LOCAL) { if (sock->local_interface_unknown || sock->local_port_unknown) { - apr_status_t rv = get_local_addr(sock); + fspr_status_t rv = get_local_addr(sock); if (rv != APR_SUCCESS) { return rv; @@ -161,7 +161,7 @@ APR_DECLARE(apr_status_t) apr_socket_addr_get(apr_sockaddr_t **sa, } else if (which == APR_REMOTE) { if (sock->remote_addr_unknown) { - apr_status_t rv = get_remote_addr(sock); + fspr_status_t rv = get_remote_addr(sock); if (rv != APR_SUCCESS) { return rv; @@ -176,15 +176,15 @@ APR_DECLARE(apr_status_t) apr_socket_addr_get(apr_sockaddr_t **sa, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, +APR_DECLARE(fspr_status_t) fspr_parse_addr_port(char **addr, char **scope_id, - apr_port_t *port, + fspr_port_t *port, const char *str, - apr_pool_t *p) + fspr_pool_t *p) { const char *ch, *lastchar; int big_port; - apr_size_t addrlen; + fspr_size_t addrlen; *addr = NULL; /* assume not specified */ *scope_id = NULL; /* assume not specified */ @@ -194,7 +194,7 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, * is specified in the string. */ ch = lastchar = str + strlen(str) - 1; - while (ch >= str && apr_isdigit(*ch)) { + while (ch >= str && fspr_isdigit(*ch)) { --ch; } @@ -245,7 +245,7 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, return APR_EINVAL; } addrlen = scope_delim - str - 1; - *scope_id = apr_palloc(p, end_bracket - scope_delim); + *scope_id = fspr_palloc(p, end_bracket - scope_delim); memcpy(*scope_id, scope_delim + 1, end_bracket - scope_delim - 1); (*scope_id)[end_bracket - scope_delim - 1] = '\0'; } @@ -253,12 +253,12 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, addrlen = addrlen - 2; /* minus 2 for '[' and ']' */ } - *addr = apr_palloc(p, addrlen + 1); + *addr = fspr_palloc(p, addrlen + 1); memcpy(*addr, str + 1, addrlen); (*addr)[addrlen] = '\0'; - if (apr_inet_pton(AF_INET6, *addr, &ipaddr) != 1) { + if (fspr_inet_pton(AF_INET6, *addr, &ipaddr) != 1) { *addr = NULL; *scope_id = NULL; *port = 0; @@ -271,7 +271,7 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, /* XXX If '%' is not a valid char in a DNS name, we *could* check * for bogus scope ids first. */ - *addr = apr_palloc(p, addrlen + 1); + *addr = fspr_palloc(p, addrlen + 1); memcpy(*addr, str, addrlen); (*addr)[addrlen] = '\0'; } @@ -280,13 +280,13 @@ APR_DECLARE(apr_status_t) apr_parse_addr_port(char **addr, #if defined(HAVE_GETADDRINFO) -static apr_status_t call_resolver(apr_sockaddr_t **sa, - const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, - apr_pool_t *p) +static fspr_status_t call_resolver(fspr_sockaddr_t **sa, + const char *hostname, fspr_int32_t family, + fspr_port_t port, fspr_int32_t flags, + fspr_pool_t *p) { struct addrinfo hints, *ai, *ai_list; - apr_sockaddr_t *prev_sa; + fspr_sockaddr_t *prev_sa; int error; char *servname = NULL; @@ -331,7 +331,7 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, } else #endif /* _AIX */ - servname = apr_itoa(p, port); + servname = fspr_itoa(p, port); #endif /* OSF1 */ } error = getaddrinfo(hostname, servname, &hints, &ai_list); @@ -365,7 +365,7 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, prev_sa = NULL; ai = ai_list; while (ai) { /* while more addresses to report */ - apr_sockaddr_t *new_sa; + fspr_sockaddr_t *new_sa; /* Ignore anything bogus: getaddrinfo in some old versions of * glibc will return AF_UNIX entries for APR_UNSPEC+AI_PASSIVE @@ -375,15 +375,15 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, continue; } - new_sa = apr_pcalloc(p, sizeof(apr_sockaddr_t)); + new_sa = fspr_pcalloc(p, sizeof(fspr_sockaddr_t)); new_sa->pool = p; memcpy(&new_sa->sa, ai->ai_addr, ai->ai_addrlen); - apr_sockaddr_vars_set(new_sa, ai->ai_family, port); + fspr_sockaddr_vars_set(new_sa, ai->ai_family, port); if (!prev_sa) { /* first element in new list */ if (hostname) { - new_sa->hostname = apr_pstrdup(p, hostname); + new_sa->hostname = fspr_pstrdup(p, hostname); } *sa = new_sa; } @@ -399,13 +399,13 @@ static apr_status_t call_resolver(apr_sockaddr_t **sa, return APR_SUCCESS; } -static apr_status_t find_addresses(apr_sockaddr_t **sa, - const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, - apr_pool_t *p) +static fspr_status_t find_addresses(fspr_sockaddr_t **sa, + const char *hostname, fspr_int32_t family, + fspr_port_t port, fspr_int32_t flags, + fspr_pool_t *p) { if (flags & APR_IPV4_ADDR_OK) { - apr_status_t error = call_resolver(sa, hostname, AF_INET, port, flags, p); + fspr_status_t error = call_resolver(sa, hostname, AF_INET, port, flags, p); #if APR_HAVE_IPV6 if (error) { @@ -417,7 +417,7 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, } #if APR_HAVE_IPV6 else if (flags & APR_IPV6_ADDR_OK) { - apr_status_t error = call_resolver(sa, hostname, AF_INET6, port, flags, p); + fspr_status_t error = call_resolver(sa, hostname, AF_INET6, port, flags, p); if (error) { family = AF_INET; /* try again */ @@ -433,13 +433,13 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, #else /* end of HAVE_GETADDRINFO code */ -static apr_status_t find_addresses(apr_sockaddr_t **sa, - const char *hostname, apr_int32_t family, - apr_port_t port, apr_int32_t flags, - apr_pool_t *p) +static fspr_status_t find_addresses(fspr_sockaddr_t **sa, + const char *hostname, fspr_int32_t family, + fspr_port_t port, fspr_int32_t flags, + fspr_pool_t *p) { struct hostent *hp; - apr_sockaddr_t *prev_sa; + fspr_sockaddr_t *prev_sa; int curaddr; #if APR_HAS_THREADS && !defined(GETHOSTBYNAME_IS_THREAD_SAFE) && \ defined(HAVE_GETHOSTBYNAME_R) && !defined(BEOS) @@ -498,7 +498,7 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, if (!hp) { #ifdef WIN32 - return apr_get_netos_error(); + return fspr_get_netos_error(); #else return (h_errno + APR_OS_START_SYSERR); #endif @@ -508,15 +508,15 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, prev_sa = NULL; curaddr = 0; while (hp->h_addr_list[curaddr]) { - apr_sockaddr_t *new_sa = apr_pcalloc(p, sizeof(apr_sockaddr_t)); + fspr_sockaddr_t *new_sa = fspr_pcalloc(p, sizeof(fspr_sockaddr_t)); new_sa->pool = p; new_sa->sa.sin.sin_addr = *(struct in_addr *)hp->h_addr_list[curaddr]; - apr_sockaddr_vars_set(new_sa, AF_INET, port); + fspr_sockaddr_vars_set(new_sa, AF_INET, port); if (!prev_sa) { /* first element in new list */ if (orig_hostname) { - new_sa->hostname = apr_pstrdup(p, orig_hostname); + new_sa->hostname = fspr_pstrdup(p, orig_hostname); } *sa = new_sa; } @@ -534,12 +534,12 @@ static apr_status_t find_addresses(apr_sockaddr_t **sa, #endif /* end of !HAVE_GETADDRINFO code */ -APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa, +APR_DECLARE(fspr_status_t) fspr_sockaddr_info_get(fspr_sockaddr_t **sa, const char *hostname, - apr_int32_t family, apr_port_t port, - apr_int32_t flags, apr_pool_t *p) + fspr_int32_t family, fspr_port_t port, + fspr_int32_t flags, fspr_pool_t *p) { - apr_int32_t masked; + fspr_int32_t masked; *sa = NULL; if ((masked = flags & (APR_IPV4_ADDR_OK | APR_IPV6_ADDR_OK))) { @@ -568,9 +568,9 @@ APR_DECLARE(apr_status_t) apr_sockaddr_info_get(apr_sockaddr_t **sa, return find_addresses(sa, hostname, family, port, flags, p); } -APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, - apr_sockaddr_t *sockaddr, - apr_int32_t flags) +APR_DECLARE(fspr_status_t) fspr_getnameinfo(char **hostname, + fspr_sockaddr_t *sockaddr, + fspr_int32_t flags) { #if defined(HAVE_GETNAMEINFO) int rc; @@ -597,7 +597,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, struct sockaddr_in tmpsa; tmpsa.sin_family = AF_INET; tmpsa.sin_port = 0; - tmpsa.sin_addr.s_addr = ((apr_uint32_t *)sockaddr->ipaddr_ptr)[3]; + tmpsa.sin_addr.s_addr = ((fspr_uint32_t *)sockaddr->ipaddr_ptr)[3]; #ifdef SIN6_LEN tmpsa.sin_len = sizeof(tmpsa); #endif @@ -635,7 +635,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, return rc + APR_OS_START_EAIERR; /* return the EAI_ error */ } } - *hostname = sockaddr->hostname = apr_pstrdup(sockaddr->pool, + *hostname = sockaddr->hostname = fspr_pstrdup(sockaddr->pool, tmphostname); return APR_SUCCESS; #else @@ -678,12 +678,12 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, #endif if (hptr) { - *hostname = sockaddr->hostname = apr_pstrdup(sockaddr->pool, hptr->h_name); + *hostname = sockaddr->hostname = fspr_pstrdup(sockaddr->pool, hptr->h_name); return APR_SUCCESS; } *hostname = NULL; #if defined(WIN32) - return apr_get_netos_error(); + return fspr_get_netos_error(); #elif defined(OS2) return h_errno; #else @@ -692,7 +692,7 @@ APR_DECLARE(apr_status_t) apr_getnameinfo(char **hostname, #endif } -APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr, +APR_DECLARE(fspr_status_t) fspr_getservbyname(fspr_sockaddr_t *sockaddr, const char *servname) { struct servent *se; @@ -702,7 +702,7 @@ APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr, if ((se = getservbyname(servname, NULL)) != NULL){ sockaddr->port = htons(se->s_port); - sockaddr->servname = apr_pstrdup(sockaddr->pool, servname); + sockaddr->servname = fspr_pstrdup(sockaddr->pool, servname); sockaddr->sa.sin.sin_port = se->s_port; return APR_SUCCESS; } @@ -717,8 +717,8 @@ APR_DECLARE(apr_status_t) apr_getservbyname(apr_sockaddr_t *sockaddr, &((struct in6_addr *)(b)->ipaddr_ptr)->s6_addr[12], \ (a)->ipaddr_len)) -APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1, - const apr_sockaddr_t *addr2) +APR_DECLARE(int) fspr_sockaddr_equal(const fspr_sockaddr_t *addr1, + const fspr_sockaddr_t *addr2) { if (addr1->ipaddr_len == addr2->ipaddr_len && !memcmp(addr1->ipaddr_ptr, addr2->ipaddr_ptr, addr1->ipaddr_len)) { @@ -735,7 +735,7 @@ APR_DECLARE(int) apr_sockaddr_equal(const apr_sockaddr_t *addr1, return 0; /* not equal */ } -static apr_status_t parse_network(apr_ipsubnet_t *ipsub, const char *network) +static fspr_status_t parse_network(fspr_ipsubnet_t *ipsub, const char *network) { /* legacy syntax for ip addrs: a.b.c. ==> a.b.c.0/24 for example */ int shift; @@ -757,10 +757,10 @@ static apr_status_t parse_network(apr_ipsubnet_t *ipsub, const char *network) shift = 24; while (*s) { t = s; - if (!apr_isdigit(*t)) { + if (!fspr_isdigit(*t)) { return APR_EBADIP; } - while (apr_isdigit(*t)) { + while (fspr_isdigit(*t)) { ++t; } if (*t == '.') { @@ -793,7 +793,7 @@ static apr_status_t parse_network(apr_ipsubnet_t *ipsub, const char *network) * APR_BADMASK mask portion is not valid */ -static apr_status_t parse_ip(apr_ipsubnet_t *ipsub, const char *ipstr, int network_allowed) +static fspr_status_t parse_ip(fspr_ipsubnet_t *ipsub, const char *ipstr, int network_allowed) { /* supported flavors of IP: * @@ -810,10 +810,10 @@ static apr_status_t parse_ip(apr_ipsubnet_t *ipsub, const char *ipstr, int netwo int rc; #if APR_HAVE_IPV6 - rc = apr_inet_pton(AF_INET6, ipstr, ipsub->sub); + rc = fspr_inet_pton(AF_INET6, ipstr, ipsub->sub); if (rc == 1) { if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ipsub->sub)) { - /* apr_ipsubnet_test() assumes that we don't create IPv4-mapped IPv6 + /* fspr_ipsubnet_test() assumes that we don't create IPv4-mapped IPv6 * addresses; this of course forces the user to specify IPv4 addresses * in a.b.c.d style instead of ::ffff:a.b.c.d style. */ @@ -824,7 +824,7 @@ static apr_status_t parse_ip(apr_ipsubnet_t *ipsub, const char *ipstr, int netwo else #endif { - rc = apr_inet_pton(AF_INET, ipstr, ipsub->sub); + rc = fspr_inet_pton(AF_INET, ipstr, ipsub->sub); if (rc == 1) { ipsub->family = AF_INET; } @@ -848,28 +848,28 @@ static int looks_like_ip(const char *ipstr) } /* simple IPv4 address string check */ - while ((*ipstr == '.') || apr_isdigit(*ipstr)) + while ((*ipstr == '.') || fspr_isdigit(*ipstr)) ipstr++; return (*ipstr == '\0'); } -static void fix_subnet(apr_ipsubnet_t *ipsub) +static void fix_subnet(fspr_ipsubnet_t *ipsub) { /* in case caller specified more bits in network address than are * valid according to the mask, turn off the extra bits */ int i; - for (i = 0; i < sizeof ipsub->mask / sizeof(apr_int32_t); i++) { + for (i = 0; i < sizeof ipsub->mask / sizeof(fspr_int32_t); i++) { ipsub->sub[i] &= ipsub->mask[i]; } } /* be sure not to store any IPv4 address as a v4-mapped IPv6 address */ -APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char *ipstr, - const char *mask_or_numbits, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_ipsubnet_create(fspr_ipsubnet_t **ipsub, const char *ipstr, + const char *mask_or_numbits, fspr_pool_t *p) { - apr_status_t rv; + fspr_status_t rv; char *endptr; long bits, maxbits = 32; @@ -882,7 +882,7 @@ APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char return APR_EINVAL; } - *ipsub = apr_pcalloc(p, sizeof(apr_ipsubnet_t)); + *ipsub = fspr_pcalloc(p, sizeof(fspr_ipsubnet_t)); /* assume ipstr is an individual IP address, not a subnet */ memset((*ipsub)->mask, 0xFF, sizeof (*ipsub)->mask); @@ -902,7 +902,7 @@ APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char if (*endptr == '\0' && bits > 0 && bits <= maxbits) { /* valid num-bits string; fill in mask appropriately */ int cur_entry = 0; - apr_int32_t cur_bit_value; + fspr_int32_t cur_bit_value; memset((*ipsub)->mask, 0, sizeof (*ipsub)->mask); while (bits > 32) { @@ -918,7 +918,7 @@ APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char } (*ipsub)->mask[cur_entry] = htonl((*ipsub)->mask[cur_entry]); } - else if (apr_inet_pton(AF_INET, mask_or_numbits, (*ipsub)->mask) == 1 && + else if (fspr_inet_pton(AF_INET, mask_or_numbits, (*ipsub)->mask) == 1 && (*ipsub)->family == AF_INET) { /* valid IPv4 netmask */ } @@ -932,7 +932,7 @@ APR_DECLARE(apr_status_t) apr_ipsubnet_create(apr_ipsubnet_t **ipsub, const char return APR_SUCCESS; } -APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa) +APR_DECLARE(int) fspr_ipsubnet_test(fspr_ipsubnet_t *ipsub, fspr_sockaddr_t *sa) { #if APR_HAVE_IPV6 /* XXX This line will segv on Win32 build with APR_HAVE_IPV6, @@ -946,12 +946,12 @@ APR_DECLARE(int) apr_ipsubnet_test(apr_ipsubnet_t *ipsub, apr_sockaddr_t *sa) } else if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)sa->ipaddr_ptr)) { if (ipsub->family == AF_INET && - (((apr_uint32_t *)sa->ipaddr_ptr)[3] & ipsub->mask[0]) == ipsub->sub[0]) { + (((fspr_uint32_t *)sa->ipaddr_ptr)[3] & ipsub->mask[0]) == ipsub->sub[0]) { return 1; } } else { - apr_uint32_t *addr = (apr_uint32_t *)sa->ipaddr_ptr; + fspr_uint32_t *addr = (fspr_uint32_t *)sa->ipaddr_ptr; if ((addr[0] & ipsub->mask[0]) == ipsub->sub[0] && (addr[1] & ipsub->mask[1]) == ipsub->sub[1] && diff --git a/libs/apr/network_io/unix/sockets.c b/libs/apr/network_io/unix/sockets.c index 72dab7b89c..6475599cfd 100644 --- a/libs/apr/network_io/unix/sockets.c +++ b/libs/apr/network_io/unix/sockets.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_network_io.h" -#include "apr_strings.h" -#include "apr_support.h" -#include "apr_portable.h" -#include "apr_arch_inherit.h" +#include "fspr_arch_networkio.h" +#include "fspr_network_io.h" +#include "fspr_strings.h" +#include "fspr_support.h" +#include "fspr_portable.h" +#include "fspr_arch_inherit.h" #ifdef BEOS_R5 #undef close @@ -28,9 +28,9 @@ static char generic_inaddr_any[16] = {0}; /* big enough for IPv4 or IPv6 */ -static apr_status_t socket_cleanup(void *sock) +static fspr_status_t socket_cleanup(void *sock) { - apr_socket_t *thesocket = sock; + fspr_socket_t *thesocket = sock; if (!thesocket) { return APR_ENOTSOCK; @@ -49,12 +49,12 @@ static apr_status_t socket_cleanup(void *sock) } } -static void set_socket_vars(apr_socket_t *sock, int family, int type, int protocol) +static void set_socket_vars(fspr_socket_t *sock, int family, int type, int protocol) { sock->type = type; sock->protocol = protocol; - apr_sockaddr_vars_set(sock->local_addr, family, 0); - apr_sockaddr_vars_set(sock->remote_addr, family, 0); + fspr_sockaddr_vars_set(sock->local_addr, family, 0); + fspr_sockaddr_vars_set(sock->remote_addr, family, 0); sock->options = 0; #if defined(BEOS) && !defined(BEOS_BONE) /* BeOS pre-BONE has TCP_NODELAY on by default and it can't be @@ -64,32 +64,32 @@ static void set_socket_vars(apr_socket_t *sock, int family, int type, int protoc #endif } -static void alloc_socket(apr_socket_t **new, apr_pool_t *p) +static void alloc_socket(fspr_socket_t **new, fspr_pool_t *p) { - *new = (apr_socket_t *)apr_pcalloc(p, sizeof(apr_socket_t)); + *new = (fspr_socket_t *)fspr_pcalloc(p, sizeof(fspr_socket_t)); (*new)->pool = p; - (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, - sizeof(apr_sockaddr_t)); + (*new)->local_addr = (fspr_sockaddr_t *)fspr_pcalloc((*new)->pool, + sizeof(fspr_sockaddr_t)); (*new)->local_addr->pool = p; - (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, - sizeof(apr_sockaddr_t)); + (*new)->remote_addr = (fspr_sockaddr_t *)fspr_pcalloc((*new)->pool, + sizeof(fspr_sockaddr_t)); (*new)->remote_addr->pool = p; (*new)->remote_addr_unknown = 1; #ifndef WAITIO_USES_POLL /* Create a pollset with room for one descriptor. */ /* ### check return codes */ - (void) apr_pollset_create(&(*new)->pollset, 1, p, 0); + (void) fspr_pollset_create(&(*new)->pollset, 1, p, 0); #endif } -apr_status_t apr_socket_protocol_get(apr_socket_t *sock, int *protocol) +fspr_status_t fspr_socket_protocol_get(fspr_socket_t *sock, int *protocol) { *protocol = sock->protocol; return APR_SUCCESS; } -apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type, - int protocol, apr_pool_t *cont) +fspr_status_t fspr_socket_create(fspr_socket_t **new, int ofamily, int type, + int protocol, fspr_pool_t *cont) { int family = ofamily; @@ -140,24 +140,24 @@ apr_status_t apr_socket_create(apr_socket_t **new, int ofamily, int type, (*new)->timeout = -1; (*new)->inherit = 0; - apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, socket_cleanup); return APR_SUCCESS; } -apr_status_t apr_socket_shutdown(apr_socket_t *thesocket, - apr_shutdown_how_e how) +fspr_status_t fspr_socket_shutdown(fspr_socket_t *thesocket, + fspr_shutdown_how_e how) { return (shutdown(thesocket->socketdes, how) == -1) ? errno : APR_SUCCESS; } -apr_status_t apr_socket_close(apr_socket_t *thesocket) +fspr_status_t fspr_socket_close(fspr_socket_t *thesocket) { - return apr_pool_cleanup_run(thesocket->pool, thesocket, socket_cleanup); + return fspr_pool_cleanup_run(thesocket->pool, thesocket, socket_cleanup); } -apr_status_t apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) +fspr_status_t fspr_socket_bind(fspr_socket_t *sock, fspr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, sa->salen) == -1) { @@ -173,7 +173,7 @@ apr_status_t apr_socket_bind(apr_socket_t *sock, apr_sockaddr_t *sa) } } -apr_status_t apr_socket_listen(apr_socket_t *sock, apr_int32_t backlog) +fspr_status_t fspr_socket_listen(fspr_socket_t *sock, fspr_int32_t backlog) { if (listen(sock->socketdes, backlog) == -1) return errno; @@ -181,8 +181,8 @@ apr_status_t apr_socket_listen(apr_socket_t *sock, apr_int32_t backlog) return APR_SUCCESS; } -apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, - apr_pool_t *connection_context) +fspr_status_t fspr_socket_accept(fspr_socket_t **new, fspr_socket_t *sock, + fspr_pool_t *connection_context) { alloc_socket(new, connection_context); set_socket_vars(*new, sock->local_addr->sa.sin.sin_family, SOCK_STREAM, sock->protocol); @@ -232,13 +232,13 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, } #if APR_TCP_NODELAY_INHERITED - if (apr_is_option_set(sock, APR_TCP_NODELAY) == 1) { - apr_set_option(*new, APR_TCP_NODELAY, 1); + if (fspr_is_option_set(sock, APR_TCP_NODELAY) == 1) { + fspr_set_option(*new, APR_TCP_NODELAY, 1); } #endif /* TCP_NODELAY_INHERITED */ #if APR_O_NONBLOCK_INHERITED - if (apr_is_option_set(sock, APR_SO_NONBLOCK) == 1) { - apr_set_option(*new, APR_SO_NONBLOCK, 1); + if (fspr_is_option_set(sock, APR_SO_NONBLOCK) == 1) { + fspr_set_option(*new, APR_SO_NONBLOCK, 1); } #endif /* APR_O_NONBLOCK_INHERITED */ @@ -256,12 +256,12 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, } (*new)->inherit = 0; - apr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), socket_cleanup, socket_cleanup); return APR_SUCCESS; } -apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) +fspr_status_t fspr_socket_connect(fspr_socket_t *sock, fspr_sockaddr_t *sa) { int rc; @@ -276,7 +276,7 @@ apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) */ if ((rc == -1) && (errno == EINPROGRESS || errno == EALREADY) && (sock->timeout > 0)) { - rc = apr_wait_for_io_or_timeout(NULL, sock, 0); + rc = fspr_wait_for_io_or_timeout(NULL, sock, 0); if (rc != APR_SUCCESS) { return rc; } @@ -284,7 +284,7 @@ apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) #ifdef SO_ERROR { int error; - apr_socklen_t len = sizeof(error); + fspr_socklen_t len = sizeof(error); if ((rc = getsockopt(sock->socketdes, SOL_SOCKET, SO_ERROR, (char *)&error, &len)) < 0) { return errno; @@ -328,13 +328,13 @@ apr_status_t apr_socket_connect(apr_socket_t *sock, apr_sockaddr_t *sa) return APR_SUCCESS; } -apr_status_t apr_socket_type_get(apr_socket_t *sock, int *type) +fspr_status_t fspr_socket_type_get(fspr_socket_t *sock, int *type) { *type = sock->type; return APR_SUCCESS; } -apr_status_t apr_socket_data_get(void **data, const char *key, apr_socket_t *sock) +fspr_status_t fspr_socket_data_get(void **data, const char *key, fspr_socket_t *sock) { sock_userdata_t *cur = sock->userdata; @@ -351,76 +351,76 @@ apr_status_t apr_socket_data_get(void **data, const char *key, apr_socket_t *soc return APR_SUCCESS; } -apr_status_t apr_socket_data_set(apr_socket_t *sock, void *data, const char *key, - apr_status_t (*cleanup) (void *)) +fspr_status_t fspr_socket_data_set(fspr_socket_t *sock, void *data, const char *key, + fspr_status_t (*cleanup) (void *)) { - sock_userdata_t *new = apr_palloc(sock->pool, sizeof(sock_userdata_t)); + sock_userdata_t *new = fspr_palloc(sock->pool, sizeof(sock_userdata_t)); - new->key = apr_pstrdup(sock->pool, key); + new->key = fspr_pstrdup(sock->pool, key); new->data = data; new->next = sock->userdata; sock->userdata = new; if (cleanup) { - apr_pool_cleanup_register(sock->pool, data, cleanup, cleanup); + fspr_pool_cleanup_register(sock->pool, data, cleanup, cleanup); } return APR_SUCCESS; } -apr_status_t apr_os_sock_get(apr_os_sock_t *thesock, apr_socket_t *sock) +fspr_status_t fspr_os_sock_get(fspr_os_sock_t *thesock, fspr_socket_t *sock) { *thesock = sock->socketdes; return APR_SUCCESS; } -apr_status_t apr_os_sock_make(apr_socket_t **apr_sock, - apr_os_sock_info_t *os_sock_info, - apr_pool_t *cont) +fspr_status_t fspr_os_sock_make(fspr_socket_t **fspr_sock, + fspr_os_sock_info_t *os_sock_info, + fspr_pool_t *cont) { - alloc_socket(apr_sock, cont); - set_socket_vars(*apr_sock, os_sock_info->family, os_sock_info->type, os_sock_info->protocol); - (*apr_sock)->timeout = -1; - (*apr_sock)->socketdes = *os_sock_info->os_sock; + alloc_socket(fspr_sock, cont); + set_socket_vars(*fspr_sock, os_sock_info->family, os_sock_info->type, os_sock_info->protocol); + (*fspr_sock)->timeout = -1; + (*fspr_sock)->socketdes = *os_sock_info->os_sock; if (os_sock_info->local) { - memcpy(&(*apr_sock)->local_addr->sa.sin, + memcpy(&(*fspr_sock)->local_addr->sa.sin, os_sock_info->local, - (*apr_sock)->local_addr->salen); + (*fspr_sock)->local_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ - (*apr_sock)->local_addr->port = ntohs((*apr_sock)->local_addr->sa.sin.sin_port); + (*fspr_sock)->local_addr->port = ntohs((*fspr_sock)->local_addr->sa.sin.sin_port); } else { - (*apr_sock)->local_port_unknown = (*apr_sock)->local_interface_unknown = 1; + (*fspr_sock)->local_port_unknown = (*fspr_sock)->local_interface_unknown = 1; } if (os_sock_info->remote) { #ifndef HAVE_POLL - (*apr_sock)->connected = 1; + (*fspr_sock)->connected = 1; #endif - memcpy(&(*apr_sock)->remote_addr->sa.sin, + memcpy(&(*fspr_sock)->remote_addr->sa.sin, os_sock_info->remote, - (*apr_sock)->remote_addr->salen); + (*fspr_sock)->remote_addr->salen); /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ - (*apr_sock)->remote_addr->port = ntohs((*apr_sock)->remote_addr->sa.sin.sin_port); + (*fspr_sock)->remote_addr->port = ntohs((*fspr_sock)->remote_addr->sa.sin.sin_port); } else { - (*apr_sock)->remote_addr_unknown = 1; + (*fspr_sock)->remote_addr_unknown = 1; } - (*apr_sock)->inherit = 0; - apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), + (*fspr_sock)->inherit = 0; + fspr_pool_cleanup_register((*fspr_sock)->pool, (void *)(*fspr_sock), socket_cleanup, socket_cleanup); return APR_SUCCESS; } -apr_status_t apr_os_sock_put(apr_socket_t **sock, apr_os_sock_t *thesock, - apr_pool_t *cont) +fspr_status_t fspr_os_sock_put(fspr_socket_t **sock, fspr_os_sock_t *thesock, + fspr_pool_t *cont) { /* XXX Bogus assumption that *sock points at anything legit */ if ((*sock) == NULL) { alloc_socket(sock, cont); /* XXX IPv6 figure out the family here! */ /* XXX figure out the actual socket type here */ - /* *or* just decide that apr_os_sock_put() has to be told the family and type */ + /* *or* just decide that fspr_os_sock_put() has to be told the family and type */ set_socket_vars(*sock, APR_INET, SOCK_STREAM, 0); (*sock)->timeout = -1; } diff --git a/libs/apr/network_io/unix/sockopt.c b/libs/apr/network_io/unix/sockopt.c index 344b0484b4..87f27f7014 100644 --- a/libs/apr/network_io/unix/sockopt.c +++ b/libs/apr/network_io/unix/sockopt.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_strings.h" +#include "fspr_arch_networkio.h" +#include "fspr_strings.h" -static apr_status_t soblock(int sd) +static fspr_status_t soblock(int sd) { /* BeOS uses setsockopt at present for non blocking... */ #ifndef BEOS @@ -45,7 +45,7 @@ static apr_status_t soblock(int sd) return APR_SUCCESS; } -static apr_status_t sononblock(int sd) +static fspr_status_t sononblock(int sd) { #ifndef BEOS int fd_flags; @@ -72,9 +72,9 @@ static apr_status_t sononblock(int sd) } -apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) +fspr_status_t fspr_socket_timeout_set(fspr_socket_t *sock, fspr_interval_time_t t) { - apr_status_t stat; + fspr_status_t stat; /* If our new timeout is non-negative and our old timeout was * negative, then we need to ensure that we are non-blocking. @@ -84,19 +84,19 @@ apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) * socket. */ if (t >= 0 && sock->timeout < 0) { - if (apr_is_option_set(sock, APR_SO_NONBLOCK) != 1) { + if (fspr_is_option_set(sock, APR_SO_NONBLOCK) != 1) { if ((stat = sononblock(sock->socketdes)) != APR_SUCCESS) { return stat; } - apr_set_option(sock, APR_SO_NONBLOCK, 1); + fspr_set_option(sock, APR_SO_NONBLOCK, 1); } } else if (t < 0 && sock->timeout >= 0) { - if (apr_is_option_set(sock, APR_SO_NONBLOCK) != 0) { + if (fspr_is_option_set(sock, APR_SO_NONBLOCK) != 0) { if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) { return stat; } - apr_set_option(sock, APR_SO_NONBLOCK, 0); + fspr_set_option(sock, APR_SO_NONBLOCK, 0); } } /* must disable the incomplete read support if we disable @@ -110,11 +110,11 @@ apr_status_t apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) } -apr_status_t apr_socket_opt_set(apr_socket_t *sock, - apr_int32_t opt, apr_int32_t on) +fspr_status_t fspr_socket_opt_set(fspr_socket_t *sock, + fspr_int32_t opt, fspr_int32_t on) { int one; - apr_status_t rv; + fspr_status_t rv; if (on) one = 1; @@ -123,30 +123,30 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, switch(opt) { case APR_SO_KEEPALIVE: #ifdef SO_KEEPALIVE - if (on != apr_is_option_set(sock, APR_SO_KEEPALIVE)) { + if (on != fspr_is_option_set(sock, APR_SO_KEEPALIVE)) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_KEEPALIVE, (void *)&one, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_SO_KEEPALIVE, on); + fspr_set_option(sock, APR_SO_KEEPALIVE, on); } #else return APR_ENOTIMPL; #endif break; case APR_SO_DEBUG: - if (on != apr_is_option_set(sock, APR_SO_DEBUG)) { + if (on != fspr_is_option_set(sock, APR_SO_DEBUG)) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, (void *)&one, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_SO_DEBUG, on); + fspr_set_option(sock, APR_SO_DEBUG, on); } break; case APR_SO_REUSEADDR: - if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) { + if (on != fspr_is_option_set(sock, APR_SO_REUSEADDR)) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_SO_REUSEADDR, on); + fspr_set_option(sock, APR_SO_REUSEADDR, on); } break; case APR_SO_SNDBUF: @@ -168,7 +168,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, #endif break; case APR_SO_NONBLOCK: - if (apr_is_option_set(sock, APR_SO_NONBLOCK) != on) { + if (fspr_is_option_set(sock, APR_SO_NONBLOCK) != on) { if (on) { if ((rv = sononblock(sock->socketdes)) != APR_SUCCESS) return rv; @@ -177,19 +177,19 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, if ((rv = soblock(sock->socketdes)) != APR_SUCCESS) return rv; } - apr_set_option(sock, APR_SO_NONBLOCK, on); + fspr_set_option(sock, APR_SO_NONBLOCK, on); } break; case APR_SO_LINGER: #ifdef SO_LINGER - if (apr_is_option_set(sock, APR_SO_LINGER) != on) { + if (fspr_is_option_set(sock, APR_SO_LINGER) != on) { struct linger li; li.l_onoff = on; li.l_linger = APR_MAX_SECS_TO_LINGER; if (setsockopt(sock->socketdes, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(struct linger)) == -1) { return errno; } - apr_set_option(sock, APR_SO_LINGER, on); + fspr_set_option(sock, APR_SO_LINGER, on); } #else return APR_ENOTIMPL; @@ -197,7 +197,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, break; case APR_TCP_DEFER_ACCEPT: #if defined(TCP_DEFER_ACCEPT) - if (apr_is_option_set(sock, APR_TCP_DEFER_ACCEPT) != on) { + if (fspr_is_option_set(sock, APR_TCP_DEFER_ACCEPT) != on) { int optlevel = IPPROTO_TCP; int optname = TCP_DEFER_ACCEPT; @@ -205,7 +205,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, (void *)&on, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_TCP_DEFER_ACCEPT, on); + fspr_set_option(sock, APR_TCP_DEFER_ACCEPT, on); } #else return APR_ENOTIMPL; @@ -213,7 +213,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, break; case APR_TCP_NODELAY: #if defined(TCP_NODELAY) - if (apr_is_option_set(sock, APR_TCP_NODELAY) != on) { + if (fspr_is_option_set(sock, APR_TCP_NODELAY) != on) { int optlevel = IPPROTO_TCP; int optname = TCP_NODELAY; @@ -226,7 +226,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, if (setsockopt(sock->socketdes, optlevel, optname, (void *)&on, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_TCP_NODELAY, on); + fspr_set_option(sock, APR_TCP_NODELAY, on); } #else /* BeOS pre-BONE has TCP_NODELAY set by default. @@ -248,7 +248,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, * and TCP_CORK takes preference, which is the desired * behaviour. On older kernels, TCP_NODELAY must be toggled * to "off" whilst TCP_CORK is in effect. */ - if (apr_is_option_set(sock, APR_TCP_NOPUSH) != on) { + if (fspr_is_option_set(sock, APR_TCP_NOPUSH) != on) { #ifndef HAVE_TCP_NODELAY_WITH_CORK int optlevel = IPPROTO_TCP; int optname = TCP_NODELAY; @@ -260,7 +260,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, } #endif /* OK we're going to change some settings here... */ - if (apr_is_option_set(sock, APR_TCP_NODELAY) == 1 && on) { + if (fspr_is_option_set(sock, APR_TCP_NODELAY) == 1 && on) { /* Now toggle TCP_NODELAY to off, if TCP_CORK is being * turned on: */ int tmpflag = 0; @@ -268,10 +268,10 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, (void*)&tmpflag, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_RESET_NODELAY, 1); - apr_set_option(sock, APR_TCP_NODELAY, 0); + fspr_set_option(sock, APR_RESET_NODELAY, 1); + fspr_set_option(sock, APR_TCP_NODELAY, 0); } else if (on) { - apr_set_option(sock, APR_RESET_NODELAY, 0); + fspr_set_option(sock, APR_RESET_NODELAY, 0); } #endif /* HAVE_TCP_NODELAY_WITH_CORK */ @@ -280,9 +280,9 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, (void*)&on, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_TCP_NOPUSH, on); + fspr_set_option(sock, APR_TCP_NOPUSH, on); #ifndef HAVE_TCP_NODELAY_WITH_CORK - if (!on && apr_is_option_set(sock, APR_RESET_NODELAY)) { + if (!on && fspr_is_option_set(sock, APR_RESET_NODELAY)) { /* Now, if TCP_CORK was just turned off, turn * TCP_NODELAY back on again if it was earlier toggled * to off: */ @@ -291,8 +291,8 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, (void*)&tmpflag, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_RESET_NODELAY,0); - apr_set_option(sock, APR_TCP_NODELAY, 1); + fspr_set_option(sock, APR_RESET_NODELAY,0); + fspr_set_option(sock, APR_TCP_NODELAY, 1); } #endif /* HAVE_TCP_NODELAY_WITH_CORK */ } @@ -301,7 +301,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, #endif break; case APR_INCOMPLETE_READ: - apr_set_option(sock, APR_INCOMPLETE_READ, on); + fspr_set_option(sock, APR_INCOMPLETE_READ, on); break; case APR_IPV6_V6ONLY: #if APR_HAVE_IPV6 && defined(IPV6_V6ONLY) @@ -313,7 +313,7 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, (void *)&on, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_IPV6_V6ONLY, on); + fspr_set_option(sock, APR_IPV6_V6ONLY, on); #else return APR_ENOTIMPL; #endif @@ -326,25 +326,25 @@ apr_status_t apr_socket_opt_set(apr_socket_t *sock, } -apr_status_t apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t) +fspr_status_t fspr_socket_timeout_get(fspr_socket_t *sock, fspr_interval_time_t *t) { *t = sock->timeout; return APR_SUCCESS; } -apr_status_t apr_socket_opt_get(apr_socket_t *sock, - apr_int32_t opt, apr_int32_t *on) +fspr_status_t fspr_socket_opt_get(fspr_socket_t *sock, + fspr_int32_t opt, fspr_int32_t *on) { switch(opt) { default: - *on = apr_is_option_set(sock, opt); + *on = fspr_is_option_set(sock, opt); } return APR_SUCCESS; } -int apr_socket_fd_get(apr_socket_t *sock) +int fspr_socket_fd_get(fspr_socket_t *sock) { if (sock) { return sock->socketdes; @@ -354,13 +354,13 @@ int apr_socket_fd_get(apr_socket_t *sock) } -apr_status_t apr_socket_atmark(apr_socket_t *sock, int *atmark) +fspr_status_t fspr_socket_atmark(fspr_socket_t *sock, int *atmark) { #ifndef BEOS_R5 int oobmark; if (ioctl(sock->socketdes, SIOCATMARK, (void*) &oobmark) < 0) - return apr_get_netos_error(); + return fspr_get_netos_error(); *atmark = (oobmark != 0); @@ -370,7 +370,7 @@ apr_status_t apr_socket_atmark(apr_socket_t *sock, int *atmark) #endif } -apr_status_t apr_gethostname(char *buf, apr_int32_t len, apr_pool_t *cont) +fspr_status_t fspr_gethostname(char *buf, fspr_int32_t len, fspr_pool_t *cont) { #ifdef BEOS_R5 if (gethostname(buf, len) == 0) { @@ -391,7 +391,7 @@ apr_status_t apr_gethostname(char *buf, apr_int32_t len, apr_pool_t *cont) } #if APR_HAS_SO_ACCEPTFILTER -apr_status_t apr_socket_accept_filter(apr_socket_t *sock, char *name, +fspr_status_t fspr_socket_accept_filter(fspr_socket_t *sock, char *name, char *args) { struct accept_filter_arg af; diff --git a/libs/apr/network_io/win32/sendrecv.c b/libs/apr/network_io/win32/sendrecv.c index faab51d492..63891a50c6 100644 --- a/libs/apr/network_io/win32/sendrecv.c +++ b/libs/apr/network_io/win32/sendrecv.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_network_io.h" -#include "apr_lib.h" -#include "apr_arch_file_io.h" +#include "fspr_arch_networkio.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_network_io.h" +#include "fspr_lib.h" +#include "fspr_arch_file_io.h" #if APR_HAVE_TIME_H #include #endif @@ -27,19 +27,19 @@ /* MAX_SEGMENT_SIZE is the maximum amount of data that will be sent to a client * in one call of TransmitFile. This number must be small enough to give the * slowest client time to receive the data before the socket timeout triggers. - * The same problem can exist with apr_socket_send(). In that case, we rely on + * The same problem can exist with fspr_socket_send(). In that case, we rely on * the application to adjust socket timeouts and max send segment * sizes appropriately. - * For example, Apache will in most cases call apr_socket_send() with less + * For example, Apache will in most cases call fspr_socket_send() with less * than 8193 bytes. */ #define MAX_SEGMENT_SIZE 65536 #define WSABUF_ON_STACK 50 -APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_send(fspr_socket_t *sock, const char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; WSABUF wsaData; int lasterror; DWORD dwBytes = 0; @@ -54,7 +54,7 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, dwBytes = rv; #endif if (rv == SOCKET_ERROR) { - lasterror = apr_get_netos_error(); + lasterror = fspr_get_netos_error(); *len = 0; return lasterror; } @@ -65,10 +65,10 @@ APR_DECLARE(apr_status_t) apr_socket_send(apr_socket_t *sock, const char *buf, } -APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_recv(fspr_socket_t *sock, char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; WSABUF wsaData; int lasterror; DWORD dwBytes = 0; @@ -84,7 +84,7 @@ APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, dwBytes = rv; #endif if (rv == SOCKET_ERROR) { - lasterror = apr_get_netos_error(); + lasterror = fspr_get_netos_error(); *len = 0; return lasterror; } @@ -94,14 +94,14 @@ APR_DECLARE(apr_status_t) apr_socket_recv(apr_socket_t *sock, char *buf, } -APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, +APR_DECLARE(fspr_status_t) fspr_socket_sendv(fspr_socket_t *sock, const struct iovec *vec, - apr_int32_t in_vec, apr_size_t *nbytes) + fspr_int32_t in_vec, fspr_size_t *nbytes) { - apr_status_t rc = APR_SUCCESS; - apr_ssize_t rv; - apr_size_t cur_len; - apr_int32_t nvec = 0; + fspr_status_t rc = APR_SUCCESS; + fspr_ssize_t rv; + fspr_size_t cur_len; + fspr_int32_t nvec = 0; int i, j = 0; DWORD dwBytes = 0; WSABUF *pWsaBuf; @@ -143,13 +143,13 @@ APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, #ifndef _WIN32_WCE rv = WSASend(sock->socketdes, pWsaBuf, nvec, &dwBytes, 0, NULL, NULL); if (rv == SOCKET_ERROR) { - rc = apr_get_netos_error(); + rc = fspr_get_netos_error(); } #else for (i = 0; i < nvec; i++) { rv = send(sock->socketdes, pWsaBuf[i].buf, pWsaBuf[i].len, 0); if (rv == SOCKET_ERROR) { - rc = apr_get_netos_error(); + rc = fspr_get_netos_error(); break; } dwBytes += rv; @@ -163,19 +163,19 @@ APR_DECLARE(apr_status_t) apr_socket_sendv(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, - apr_sockaddr_t *where, - apr_int32_t flags, const char *buf, - apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_sendto(fspr_socket_t *sock, + fspr_sockaddr_t *where, + fspr_int32_t flags, const char *buf, + fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; rv = sendto(sock->socketdes, buf, (int)*len, flags, (const struct sockaddr*)&where->sa, where->salen); if (rv == SOCKET_ERROR) { *len = 0; - return apr_get_netos_error(); + return fspr_get_netos_error(); } *len = rv; @@ -183,18 +183,18 @@ APR_DECLARE(apr_status_t) apr_socket_sendto(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, - apr_socket_t *sock, - apr_int32_t flags, - char *buf, apr_size_t *len) +APR_DECLARE(fspr_status_t) fspr_socket_recvfrom(fspr_sockaddr_t *from, + fspr_socket_t *sock, + fspr_int32_t flags, + char *buf, fspr_size_t *len) { - apr_ssize_t rv; + fspr_ssize_t rv; rv = recvfrom(sock->socketdes, buf, (int)*len, flags, (struct sockaddr*)&from->sa, &from->salen); if (rv == SOCKET_ERROR) { (*len) = 0; - return apr_get_netos_error(); + return fspr_get_netos_error(); } (*len) = rv; if (rv == 0 && sock->type == SOCK_STREAM) @@ -204,9 +204,9 @@ APR_DECLARE(apr_status_t) apr_socket_recvfrom(apr_sockaddr_t *from, } -static apr_status_t collapse_iovec(char **off, apr_size_t *len, +static fspr_status_t collapse_iovec(char **off, fspr_size_t *len, struct iovec *iovec, int numvec, - char *buf, apr_size_t buflen) + char *buf, fspr_size_t buflen) { if (numvec == 1) { *off = iovec[0].iov_base; @@ -236,8 +236,8 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, #if APR_HAS_SENDFILE /* - * apr_status_t apr_socket_sendfile(apr_socket_t *, apr_file_t *, apr_hdtr_t *, - * apr_off_t *, apr_size_t *, apr_int32_t flags) + * fspr_status_t fspr_socket_sendfile(fspr_socket_t *, fspr_file_t *, fspr_hdtr_t *, + * fspr_off_t *, fspr_size_t *, fspr_int32_t flags) * Send a file from an open file descriptor to a socket, along with * optional headers and trailers * arg 1) The socket to which we're writing @@ -247,26 +247,26 @@ static apr_status_t collapse_iovec(char **off, apr_size_t *len, * arg 5) Number of bytes to send out of the file * arg 6) APR flags that are mapped to OS specific flags */ -APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, - apr_file_t *file, - apr_hdtr_t *hdtr, - apr_off_t *offset, - apr_size_t *len, - apr_int32_t flags) +APR_DECLARE(fspr_status_t) fspr_socket_sendfile(fspr_socket_t *sock, + fspr_file_t *file, + fspr_hdtr_t *hdtr, + fspr_off_t *offset, + fspr_size_t *len, + fspr_int32_t flags) { - apr_status_t status = APR_SUCCESS; - apr_status_t rv; - apr_off_t curoff = *offset; + fspr_status_t status = APR_SUCCESS; + fspr_status_t rv; + fspr_off_t curoff = *offset; DWORD dwFlags = 0; - apr_size_t nbytes; + fspr_size_t nbytes; TRANSMIT_FILE_BUFFERS tfb, *ptfb = NULL; int ptr = 0; - apr_size_t bytes_to_send; /* Bytes to send out of the file (not including headers) */ + fspr_size_t bytes_to_send; /* Bytes to send out of the file (not including headers) */ int disconnected = 0; int sendv_trailers = 0; char hdtrbuf[4096]; - if (apr_os_level < APR_WIN_NT) { + if (fspr_os_level < APR_WIN_NT) { return APR_ENOTIMPL; } @@ -277,14 +277,14 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, /* Handle the goofy case of sending headers/trailers and a zero byte file */ if (!bytes_to_send && hdtr) { if (hdtr->numheaders) { - rv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, + rv = fspr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, &nbytes); if (rv != APR_SUCCESS) return rv; *len += nbytes; } if (hdtr->numtrailers) { - rv = apr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, + rv = fspr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, &nbytes); if (rv != APR_SUCCESS) return rv; @@ -297,7 +297,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, /* Collapse the headers into a single buffer */ if (hdtr && hdtr->numheaders) { - apr_size_t head_length = tfb.HeadLength; + fspr_size_t head_length = tfb.HeadLength; ptfb = &tfb; nbytes = 0; rv = collapse_iovec((char **)&ptfb->Head, &head_length, @@ -308,7 +308,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, /* If not enough buffer, punt to sendv */ if (rv == APR_INCOMPLETE) { - rv = apr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, &nbytes); + rv = fspr_socket_sendv(sock, hdtr->headers, hdtr->numheaders, &nbytes); if (rv != APR_SUCCESS) return rv; *len += nbytes; @@ -319,7 +319,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, /* Initialize the overlapped structure used on TransmitFile */ if (!sock->overlapped) { - sock->overlapped = apr_pcalloc(sock->pool, sizeof(OVERLAPPED)); + sock->overlapped = fspr_pcalloc(sock->pool, sizeof(OVERLAPPED)); sock->overlapped->hEvent = CreateEvent(NULL, FALSE, FALSE, NULL); } while (bytes_to_send) { @@ -333,7 +333,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, xmitbytes = (DWORD)bytes_to_send; /* Collapse the trailers into a single buffer */ if (hdtr && hdtr->numtrailers) { - apr_size_t tail_length = tfb.TailLength; + fspr_size_t tail_length = tfb.TailLength; ptfb = &tfb; rv = collapse_iovec((char**) &ptfb->Tail, &tail_length, hdtr->trailers, hdtr->numtrailers, @@ -369,7 +369,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, ptfb, /* header and trailer buffers */ dwFlags); /* flags to control various aspects of TransmitFile */ if (!rv) { - status = apr_get_netos_error(); + status = fspr_get_netos_error(); if ((status == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) || (status == APR_FROM_OS_ERROR(WSA_IO_PENDING))) { @@ -384,7 +384,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, &xmitbytes, FALSE, &dwFlags)) { - status = apr_get_netos_error(); + status = fspr_get_netos_error(); } /* Ugly code alert: WSAGetOverlappedResult returns * a count of all bytes sent. This loop only @@ -408,7 +408,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, status = APR_FROM_OS_ERROR(WAIT_TIMEOUT); } else - status = apr_get_os_error(); + status = fspr_get_os_error(); } } if (status != APR_SUCCESS) @@ -427,7 +427,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, if (status == APR_SUCCESS) { if (sendv_trailers) { - rv = apr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, &nbytes); + rv = fspr_socket_sendv(sock, hdtr->trailers, hdtr->numtrailers, &nbytes); if (rv != APR_SUCCESS) return rv; *len += nbytes; @@ -436,7 +436,7 @@ APR_DECLARE(apr_status_t) apr_socket_sendfile(apr_socket_t *sock, /* Mark the socket as disconnected, but do not close it. * Note: The application must have stored the socket prior to making - * the call to apr_socket_sendfile in order to either reuse it + * the call to fspr_socket_sendfile in order to either reuse it * or close it. */ if (disconnected) { diff --git a/libs/apr/network_io/win32/sockets.c b/libs/apr/network_io/win32/sockets.c index eed351b04a..0a649c6f2d 100644 --- a/libs/apr/network_io/win32/sockets.c +++ b/libs/apr/network_io/win32/sockets.c @@ -14,25 +14,25 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_network_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include "apr_strings.h" +#include "fspr_arch_networkio.h" +#include "fspr_network_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" +#include "fspr_strings.h" #include -#include "apr_arch_inherit.h" -#include "apr_arch_misc.h" +#include "fspr_arch_inherit.h" +#include "fspr_arch_misc.h" static char generic_inaddr_any[16] = {0}; /* big enough for IPv4 or IPv6 */ -static apr_status_t socket_cleanup(void *sock) +static fspr_status_t socket_cleanup(void *sock) { - apr_socket_t *thesocket = sock; + fspr_socket_t *thesocket = sock; if (thesocket->socketdes != INVALID_SOCKET) { if (closesocket(thesocket->socketdes) == SOCKET_ERROR) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } thesocket->socketdes = INVALID_SOCKET; } @@ -45,41 +45,41 @@ static apr_status_t socket_cleanup(void *sock) return APR_SUCCESS; } -static void set_socket_vars(apr_socket_t *sock, int family, int type, int protocol) +static void set_socket_vars(fspr_socket_t *sock, int family, int type, int protocol) { sock->type = type; sock->protocol = protocol; - apr_sockaddr_vars_set(sock->local_addr, family, 0); - apr_sockaddr_vars_set(sock->remote_addr, family, 0); + fspr_sockaddr_vars_set(sock->local_addr, family, 0); + fspr_sockaddr_vars_set(sock->remote_addr, family, 0); } -static void alloc_socket(apr_socket_t **new, apr_pool_t *p) +static void alloc_socket(fspr_socket_t **new, fspr_pool_t *p) { - *new = (apr_socket_t *)apr_pcalloc(p, sizeof(apr_socket_t)); + *new = (fspr_socket_t *)fspr_pcalloc(p, sizeof(fspr_socket_t)); (*new)->pool = p; - (*new)->local_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, - sizeof(apr_sockaddr_t)); + (*new)->local_addr = (fspr_sockaddr_t *)fspr_pcalloc((*new)->pool, + sizeof(fspr_sockaddr_t)); (*new)->local_addr->pool = p; - (*new)->remote_addr = (apr_sockaddr_t *)apr_pcalloc((*new)->pool, - sizeof(apr_sockaddr_t)); + (*new)->remote_addr = (fspr_sockaddr_t *)fspr_pcalloc((*new)->pool, + sizeof(fspr_sockaddr_t)); (*new)->remote_addr->pool = p; (*new)->remote_addr_unknown = 1; /* Create a pollset with room for one descriptor. */ /* ### check return codes */ - (void) apr_pollset_create(&(*new)->pollset, 1, p, 0); + (void) fspr_pollset_create(&(*new)->pollset, 1, p, 0); } -APR_DECLARE(apr_status_t) apr_socket_protocol_get(apr_socket_t *sock, +APR_DECLARE(fspr_status_t) fspr_socket_protocol_get(fspr_socket_t *sock, int *protocol) { *protocol = sock->protocol; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, +APR_DECLARE(fspr_status_t) fspr_socket_create(fspr_socket_t **new, int family, int type, int protocol, - apr_pool_t *cont) + fspr_pool_t *cont) { int downgrade = (family == AF_UNSPEC); @@ -105,7 +105,7 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, #endif if ((*new)->socketdes == INVALID_SOCKET) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } #ifdef WIN32 @@ -148,14 +148,14 @@ APR_DECLARE(apr_status_t) apr_socket_create(apr_socket_t **new, int family, (*new)->timeout = -1; (*new)->disconnected = 0; - apr_pool_cleanup_register((*new)->pool, (void *)(*new), - socket_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), + socket_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, - apr_shutdown_how_e how) +APR_DECLARE(fspr_status_t) fspr_socket_shutdown(fspr_socket_t *thesocket, + fspr_shutdown_how_e how) { int winhow = 0; @@ -181,23 +181,23 @@ APR_DECLARE(apr_status_t) apr_socket_shutdown(apr_socket_t *thesocket, return APR_SUCCESS; } else { - return apr_get_netos_error(); + return fspr_get_netos_error(); } } -APR_DECLARE(apr_status_t) apr_socket_close(apr_socket_t *thesocket) +APR_DECLARE(fspr_status_t) fspr_socket_close(fspr_socket_t *thesocket) { - apr_pool_cleanup_kill(thesocket->pool, thesocket, socket_cleanup); + fspr_pool_cleanup_kill(thesocket->pool, thesocket, socket_cleanup); return socket_cleanup(thesocket); } -APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, - apr_sockaddr_t *sa) +APR_DECLARE(fspr_status_t) fspr_socket_bind(fspr_socket_t *sock, + fspr_sockaddr_t *sa) { if (bind(sock->socketdes, (struct sockaddr *)&sa->sa, sa->salen) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } else { sock->local_addr = sa; @@ -208,17 +208,17 @@ APR_DECLARE(apr_status_t) apr_socket_bind(apr_socket_t *sock, } } -APR_DECLARE(apr_status_t) apr_socket_listen(apr_socket_t *sock, - apr_int32_t backlog) +APR_DECLARE(fspr_status_t) fspr_socket_listen(fspr_socket_t *sock, + fspr_int32_t backlog) { if (listen(sock->socketdes, backlog) == SOCKET_ERROR) - return apr_get_netos_error(); + return fspr_get_netos_error(); else return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, - apr_socket_t *sock, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_socket_accept(fspr_socket_t **new, + fspr_socket_t *sock, fspr_pool_t *p) { SOCKET s; #if APR_HAVE_IPV6 @@ -232,7 +232,7 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, us to work with nonblocking sockets. */ s = accept(sock->socketdes, (struct sockaddr *)&sa, &salen); if (s == INVALID_SOCKET) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } alloc_socket(new, p); @@ -270,13 +270,13 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, } #if APR_TCP_NODELAY_INHERITED - if (apr_is_option_set(sock, APR_TCP_NODELAY) == 1) { - apr_set_option(*new, APR_TCP_NODELAY, 1); + if (fspr_is_option_set(sock, APR_TCP_NODELAY) == 1) { + fspr_set_option(*new, APR_TCP_NODELAY, 1); } #endif /* TCP_NODELAY_INHERITED */ #if APR_O_NONBLOCK_INHERITED - if (apr_is_option_set(sock, APR_SO_NONBLOCK) == 1) { - apr_set_option(*new, APR_SO_NONBLOCK, 1); + if (fspr_is_option_set(sock, APR_SO_NONBLOCK) == 1) { + fspr_set_option(*new, APR_SO_NONBLOCK, 1); } #endif /* APR_O_NONBLOCK_INHERITED */ @@ -293,15 +293,15 @@ APR_DECLARE(apr_status_t) apr_socket_accept(apr_socket_t **new, (*new)->local_interface_unknown = 1; } - apr_pool_cleanup_register((*new)->pool, (void *)(*new), - socket_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*new)->pool, (void *)(*new), + socket_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, - apr_sockaddr_t *sa) +APR_DECLARE(fspr_status_t) fspr_socket_connect(fspr_socket_t *sock, + fspr_sockaddr_t *sa) { - apr_status_t rv; + fspr_status_t rv; if ((sock->socketdes == INVALID_SOCKET) || (!sock->local_addr)) { return APR_ENOTSOCK; @@ -313,7 +313,7 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, struct timeval tv, *tvptr; fd_set wfdset, efdset; - rv = apr_get_netos_error(); + rv = fspr_get_netos_error(); if (rv != APR_FROM_OS_ERROR(WSAEWOULDBLOCK)) { return rv; } @@ -338,13 +338,13 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, } else { /* casts for winsock/timeval definition */ - tv.tv_sec = (long)apr_time_sec(sock->timeout); - tv.tv_usec = (int)apr_time_usec(sock->timeout); + tv.tv_sec = (long)fspr_time_sec(sock->timeout); + tv.tv_usec = (int)fspr_time_usec(sock->timeout); tvptr = &tv; } rc = select(FD_SETSIZE+1, NULL, &wfdset, &efdset, tvptr); if (rc == SOCKET_ERROR) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } else if (!rc) { return APR_FROM_OS_ERROR(WSAETIMEDOUT); @@ -354,7 +354,7 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, /* The connect failed. */ int rclen = sizeof(rc); if (getsockopt(sock->socketdes, SOL_SOCKET, SO_ERROR, (char*) &rc, &rclen)) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } return APR_FROM_OS_ERROR(rc); } @@ -375,14 +375,14 @@ APR_DECLARE(apr_status_t) apr_socket_connect(apr_socket_t *sock, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_type_get(apr_socket_t *sock, int *type) +APR_DECLARE(fspr_status_t) fspr_socket_type_get(fspr_socket_t *sock, int *type) { *type = sock->type; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key, - apr_socket_t *sock) +APR_DECLARE(fspr_status_t) fspr_socket_data_get(void **data, const char *key, + fspr_socket_t *sock) { sock_userdata_t *cur = sock->userdata; @@ -399,77 +399,77 @@ APR_DECLARE(apr_status_t) apr_socket_data_get(void **data, const char *key, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_data_set(apr_socket_t *sock, void *data, +APR_DECLARE(fspr_status_t) fspr_socket_data_set(fspr_socket_t *sock, void *data, const char *key, - apr_status_t (*cleanup)(void *)) + fspr_status_t (*cleanup)(void *)) { - sock_userdata_t *new = apr_palloc(sock->pool, sizeof(sock_userdata_t)); + sock_userdata_t *new = fspr_palloc(sock->pool, sizeof(sock_userdata_t)); - new->key = apr_pstrdup(sock->pool, key); + new->key = fspr_pstrdup(sock->pool, key); new->data = data; new->next = sock->userdata; sock->userdata = new; if (cleanup) { - apr_pool_cleanup_register(sock->pool, data, cleanup, cleanup); + fspr_pool_cleanup_register(sock->pool, data, cleanup, cleanup); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_sock_get(apr_os_sock_t *thesock, - apr_socket_t *sock) +APR_DECLARE(fspr_status_t) fspr_os_sock_get(fspr_os_sock_t *thesock, + fspr_socket_t *sock) { *thesock = sock->socketdes; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_sock_make(apr_socket_t **apr_sock, - apr_os_sock_info_t *os_sock_info, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_os_sock_make(fspr_socket_t **fspr_sock, + fspr_os_sock_info_t *os_sock_info, + fspr_pool_t *cont) { - alloc_socket(apr_sock, cont); - set_socket_vars(*apr_sock, os_sock_info->family, os_sock_info->type, os_sock_info->protocol); - (*apr_sock)->timeout = -1; - (*apr_sock)->disconnected = 0; - (*apr_sock)->socketdes = *os_sock_info->os_sock; + alloc_socket(fspr_sock, cont); + set_socket_vars(*fspr_sock, os_sock_info->family, os_sock_info->type, os_sock_info->protocol); + (*fspr_sock)->timeout = -1; + (*fspr_sock)->disconnected = 0; + (*fspr_sock)->socketdes = *os_sock_info->os_sock; if (os_sock_info->local) { - memcpy(&(*apr_sock)->local_addr->sa.sin, + memcpy(&(*fspr_sock)->local_addr->sa.sin, os_sock_info->local, - (*apr_sock)->local_addr->salen); - (*apr_sock)->local_addr->pool = cont; + (*fspr_sock)->local_addr->salen); + (*fspr_sock)->local_addr->pool = cont; /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ - (*apr_sock)->local_addr->port = ntohs((*apr_sock)->local_addr->sa.sin.sin_port); + (*fspr_sock)->local_addr->port = ntohs((*fspr_sock)->local_addr->sa.sin.sin_port); } else { - (*apr_sock)->local_port_unknown = (*apr_sock)->local_interface_unknown = 1; + (*fspr_sock)->local_port_unknown = (*fspr_sock)->local_interface_unknown = 1; } if (os_sock_info->remote) { - memcpy(&(*apr_sock)->remote_addr->sa.sin, + memcpy(&(*fspr_sock)->remote_addr->sa.sin, os_sock_info->remote, - (*apr_sock)->remote_addr->salen); - (*apr_sock)->remote_addr->pool = cont; + (*fspr_sock)->remote_addr->salen); + (*fspr_sock)->remote_addr->pool = cont; /* XXX IPv6 - this assumes sin_port and sin6_port at same offset */ - (*apr_sock)->remote_addr->port = ntohs((*apr_sock)->remote_addr->sa.sin.sin_port); + (*fspr_sock)->remote_addr->port = ntohs((*fspr_sock)->remote_addr->sa.sin.sin_port); } else { - (*apr_sock)->remote_addr_unknown = 1; + (*fspr_sock)->remote_addr_unknown = 1; } - apr_pool_cleanup_register((*apr_sock)->pool, (void *)(*apr_sock), - socket_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*fspr_sock)->pool, (void *)(*fspr_sock), + socket_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, - apr_os_sock_t *thesock, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_os_sock_put(fspr_socket_t **sock, + fspr_os_sock_t *thesock, + fspr_pool_t *cont) { if ((*sock) == NULL) { alloc_socket(sock, cont); /* XXX figure out the actual socket type here */ - /* *or* just decide that apr_os_sock_put() has to be told the family and type */ + /* *or* just decide that fspr_os_sock_put() has to be told the family and type */ set_socket_vars(*sock, AF_INET, SOCK_STREAM, 0); (*sock)->timeout = -1; (*sock)->disconnected = 0; @@ -486,12 +486,12 @@ APR_DECLARE(apr_status_t) apr_os_sock_put(apr_socket_t **sock, * This is not trivial to implement. */ -APR_DECLARE(apr_status_t) apr_socket_inherit_set(apr_socket_t *socket) +APR_DECLARE(fspr_status_t) fspr_socket_inherit_set(fspr_socket_t *socket) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_socket_inherit_unset(apr_socket_t *socket) +APR_DECLARE(fspr_status_t) fspr_socket_inherit_unset(fspr_socket_t *socket) { return APR_ENOTIMPL; } diff --git a/libs/apr/network_io/win32/sockopt.c b/libs/apr/network_io/win32/sockopt.c index 05ba19c9b8..ee92233836 100644 --- a/libs/apr/network_io/win32/sockopt.c +++ b/libs/apr/network_io/win32/sockopt.c @@ -14,36 +14,36 @@ * limitations under the License. */ -#include "apr_arch_networkio.h" -#include "apr_network_io.h" -#include "apr_general.h" -#include "apr_strings.h" +#include "fspr_arch_networkio.h" +#include "fspr_network_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" #include -apr_status_t soblock(SOCKET sd) +fspr_status_t soblock(SOCKET sd) { u_long zero = 0; if (ioctlsocket(sd, FIONBIO, &zero) == SOCKET_ERROR) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } return APR_SUCCESS; } -apr_status_t sononblock(SOCKET sd) +fspr_status_t sononblock(SOCKET sd) { u_long one = 1; if (ioctlsocket(sd, FIONBIO, &one) == SOCKET_ERROR) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, apr_interval_time_t t) +APR_DECLARE(fspr_status_t) fspr_socket_timeout_set(fspr_socket_t *sock, fspr_interval_time_t t) { - apr_status_t stat; + fspr_status_t stat; if (t == 0) { /* Set the socket non-blocking if it was previously blocking */ @@ -62,7 +62,7 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, apr_interva if (sock->timeout != t) { /* Win32 timeouts are in msec, represented as int */ - sock->timeout_ms = (int)apr_time_as_msec(t); + sock->timeout_ms = (int)fspr_time_as_msec(t); setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVTIMEO, (char *) &sock->timeout_ms, sizeof(sock->timeout_ms)); @@ -86,56 +86,56 @@ APR_DECLARE(apr_status_t) apr_socket_timeout_set(apr_socket_t *sock, apr_interva } -APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, - apr_int32_t opt, apr_int32_t on) +APR_DECLARE(fspr_status_t) fspr_socket_opt_set(fspr_socket_t *sock, + fspr_int32_t opt, fspr_int32_t on) { int one; - apr_status_t stat; + fspr_status_t stat; one = on ? 1 : 0; switch (opt) { case APR_SO_KEEPALIVE: - if (on != apr_is_option_set(sock, APR_SO_KEEPALIVE)) { + if (on != fspr_is_option_set(sock, APR_SO_KEEPALIVE)) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_KEEPALIVE, (void *)&one, sizeof(int)) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } - apr_set_option(sock, APR_SO_KEEPALIVE, on); + fspr_set_option(sock, APR_SO_KEEPALIVE, on); } break; case APR_SO_DEBUG: - if (on != apr_is_option_set(sock, APR_SO_DEBUG)) { + if (on != fspr_is_option_set(sock, APR_SO_DEBUG)) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_DEBUG, (void *)&one, sizeof(int)) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } - apr_set_option(sock, APR_SO_DEBUG, on); + fspr_set_option(sock, APR_SO_DEBUG, on); } break; case APR_SO_SNDBUF: if (setsockopt(sock->socketdes, SOL_SOCKET, SO_SNDBUF, (void *)&on, sizeof(int)) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } break; case APR_SO_RCVBUF: if (setsockopt(sock->socketdes, SOL_SOCKET, SO_RCVBUF, (void *)&on, sizeof(int)) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } break; case APR_SO_REUSEADDR: - if (on != apr_is_option_set(sock, APR_SO_REUSEADDR)) { + if (on != fspr_is_option_set(sock, APR_SO_REUSEADDR)) { if (setsockopt(sock->socketdes, SOL_SOCKET, SO_REUSEADDR, (void *)&one, sizeof(int)) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } - apr_set_option(sock, APR_SO_REUSEADDR, on); + fspr_set_option(sock, APR_SO_REUSEADDR, on); } break; case APR_SO_NONBLOCK: - if (apr_is_option_set(sock, APR_SO_NONBLOCK) != on) { + if (fspr_is_option_set(sock, APR_SO_NONBLOCK) != on) { if (on) { if ((stat = sononblock(sock->socketdes)) != APR_SUCCESS) return stat; @@ -144,26 +144,26 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, if ((stat = soblock(sock->socketdes)) != APR_SUCCESS) return stat; } - apr_set_option(sock, APR_SO_NONBLOCK, on); + fspr_set_option(sock, APR_SO_NONBLOCK, on); } break; case APR_SO_LINGER: { - if (apr_is_option_set(sock, APR_SO_LINGER) != on) { + if (fspr_is_option_set(sock, APR_SO_LINGER) != on) { struct linger li; li.l_onoff = on; li.l_linger = APR_MAX_SECS_TO_LINGER; if (setsockopt(sock->socketdes, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(struct linger)) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } - apr_set_option(sock, APR_SO_LINGER, on); + fspr_set_option(sock, APR_SO_LINGER, on); } break; } case APR_TCP_DEFER_ACCEPT: #if defined(TCP_DEFER_ACCEPT) - if (apr_is_option_set(sock, APR_TCP_DEFER_ACCEPT) != on) { + if (fspr_is_option_set(sock, APR_TCP_DEFER_ACCEPT) != on) { int optlevel = IPPROTO_TCP; int optname = TCP_DEFER_ACCEPT; @@ -171,13 +171,13 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, (void *)&on, sizeof(int)) == -1) { return errno; } - apr_set_option(sock, APR_TCP_DEFER_ACCEPT, on); + fspr_set_option(sock, APR_TCP_DEFER_ACCEPT, on); } #else return APR_ENOTIMPL; #endif case APR_TCP_NODELAY: - if (apr_is_option_set(sock, APR_TCP_NODELAY) != on) { + if (fspr_is_option_set(sock, APR_TCP_NODELAY) != on) { int optlevel = IPPROTO_TCP; int optname = TCP_NODELAY; @@ -189,9 +189,9 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, #endif if (setsockopt(sock->socketdes, optlevel, optname, (void *)&on, sizeof(int)) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } - apr_set_option(sock, APR_TCP_NODELAY, on); + fspr_set_option(sock, APR_TCP_NODELAY, on); } break; case APR_IPV6_V6ONLY: @@ -202,9 +202,9 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, */ if (setsockopt(sock->socketdes, IPPROTO_IPV6, IPV6_V6ONLY, (void *)&on, sizeof(int)) == -1) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } - apr_set_option(sock, APR_IPV6_V6ONLY, on); + fspr_set_option(sock, APR_IPV6_V6ONLY, on); #else return APR_ENOTIMPL; #endif @@ -217,15 +217,15 @@ APR_DECLARE(apr_status_t) apr_socket_opt_set(apr_socket_t *sock, } -APR_DECLARE(apr_status_t) apr_socket_timeout_get(apr_socket_t *sock, apr_interval_time_t *t) +APR_DECLARE(fspr_status_t) fspr_socket_timeout_get(fspr_socket_t *sock, fspr_interval_time_t *t) { *t = sock->timeout; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, - apr_int32_t opt, apr_int32_t *on) +APR_DECLARE(fspr_status_t) fspr_socket_opt_get(fspr_socket_t *sock, + fspr_int32_t opt, fspr_int32_t *on) { switch (opt) { case APR_SO_DISCONNECTED: @@ -237,14 +237,14 @@ APR_DECLARE(apr_status_t) apr_socket_opt_get(apr_socket_t *sock, case APR_SO_NONBLOCK: case APR_SO_LINGER: default: - *on = apr_is_option_set(sock, opt); + *on = fspr_is_option_set(sock, opt); break; } return APR_SUCCESS; } -APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock) +APR_DECLARE(int) fspr_socket_fd_get(fspr_socket_t *sock) { if (sock) { return sock->socketdes; @@ -254,12 +254,12 @@ APR_DECLARE(int) apr_socket_fd_get(apr_socket_t *sock) } -APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark) +APR_DECLARE(fspr_status_t) fspr_socket_atmark(fspr_socket_t *sock, int *atmark) { u_long oobmark; if (ioctlsocket(sock->socketdes, SIOCATMARK, (void*) &oobmark) < 0) - return apr_get_netos_error(); + return fspr_get_netos_error(); *atmark = (oobmark != 0); @@ -267,12 +267,12 @@ APR_DECLARE(apr_status_t) apr_socket_atmark(apr_socket_t *sock, int *atmark) } -APR_DECLARE(apr_status_t) apr_gethostname(char *buf, int len, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_gethostname(char *buf, int len, + fspr_pool_t *cont) { if (gethostname(buf, len) == -1) { buf[0] = '\0'; - return apr_get_netos_error(); + return fspr_get_netos_error(); } else if (!memchr(buf, '\0', len)) { /* buffer too small */ buf[0] = '\0'; diff --git a/libs/apr/passwd/apr_getpass.c b/libs/apr/passwd/fspr_getpass.c similarity index 93% rename from libs/apr/passwd/apr_getpass.c rename to libs/apr/passwd/fspr_getpass.c index 7e89774948..c03087f027 100644 --- a/libs/apr/passwd/apr_getpass.c +++ b/libs/apr/passwd/fspr_getpass.c @@ -14,15 +14,15 @@ * limitations under the License. */ -/* apr_password_get.c: abstraction to provide for obtaining a password from the +/* fspr_password_get.c: abstraction to provide for obtaining a password from the * command line in whatever way the OS supports. In the best case, it's a * wrapper for the system library's getpass() routine; otherwise, we * use one we define ourselves. */ -#include "apr_private.h" -#include "apr_strings.h" -#include "apr_lib.h" -#include "apr_errno.h" +#include "fspr_private.h" +#include "fspr_strings.h" +#include "fspr_lib.h" +#include "fspr_errno.h" #if APR_HAVE_SYS_TYPES_H #include #endif @@ -179,7 +179,7 @@ static char *getpass(const char *prompt) fputs(prompt, stderr); n = 0; } - else if ((n < sizeof(password) - 1) && !apr_iscntrl(ch)) { + else if ((n < sizeof(password) - 1) && !fspr_iscntrl(ch)) { password[n++] = ch; fputc('*', stderr); } @@ -213,21 +213,21 @@ static char *getpass(const char *prompt) * smaller than our own. */ -APR_DECLARE(apr_status_t) apr_password_get(const char *prompt, char *pwbuf, apr_size_t *bufsiz) +APR_DECLARE(fspr_status_t) fspr_password_get(const char *prompt, char *pwbuf, fspr_size_t *bufsiz) { #ifdef HAVE_GETPASSPHRASE char *pw_got = getpassphrase(prompt); #else char *pw_got = getpass(prompt); #endif - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (!pw_got) return APR_EINVAL; if (strlen(pw_got) >= *bufsiz) { rv = APR_ENAMETOOLONG; } - apr_cpystrn(pwbuf, pw_got, *bufsiz); + fspr_cpystrn(pwbuf, pw_got, *bufsiz); memset(pw_got, 0, strlen(pw_got)); return rv; } diff --git a/libs/apr/poll/os2/poll.c b/libs/apr/poll/os2/poll.c index 3c36e5e688..f27b17e975 100644 --- a/libs/apr/poll/os2/poll.c +++ b/libs/apr/poll/os2/poll.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_poll.h" -#include "apr_arch_networkio.h" +#include "fspr.h" +#include "fspr_poll.h" +#include "fspr_arch_networkio.h" -APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num, - apr_int32_t *nsds, apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_poll(fspr_pollfd_t *aprset, fspr_int32_t num, + fspr_int32_t *nsds, fspr_interval_time_t timeout) { int *pollset; int i; diff --git a/libs/apr/poll/os2/pollset.c b/libs/apr/poll/os2/pollset.c index 0680c29c09..69f5f10cae 100644 --- a/libs/apr/poll/os2/pollset.c +++ b/libs/apr/poll/os2/pollset.c @@ -14,46 +14,46 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_poll.h" -#include "apr_arch_networkio.h" +#include "fspr.h" +#include "fspr_poll.h" +#include "fspr_arch_networkio.h" -struct apr_pollset_t { - apr_pool_t *pool; - apr_uint32_t nelts; - apr_uint32_t nalloc; +struct fspr_pollset_t { + fspr_pool_t *pool; + fspr_uint32_t nelts; + fspr_uint32_t nalloc; int *pollset; int num_read; int num_write; int num_except; int num_total; - apr_pollfd_t *query_set; - apr_pollfd_t *result_set; + fspr_pollfd_t *query_set; + fspr_pollfd_t *result_set; }; -APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, - apr_uint32_t size, - apr_pool_t *p, - apr_uint32_t flags) +APR_DECLARE(fspr_status_t) fspr_pollset_create(fspr_pollset_t **pollset, + fspr_uint32_t size, + fspr_pool_t *p, + fspr_uint32_t flags) { - *pollset = apr_palloc(p, sizeof(**pollset)); + *pollset = fspr_palloc(p, sizeof(**pollset)); (*pollset)->pool = p; (*pollset)->nelts = 0; (*pollset)->nalloc = size; - (*pollset)->pollset = apr_palloc(p, size * sizeof(int) * 3); - (*pollset)->query_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); - (*pollset)->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); + (*pollset)->pollset = fspr_palloc(p, size * sizeof(int) * 3); + (*pollset)->query_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); + (*pollset)->result_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); (*pollset)->num_read = -1; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset) +APR_DECLARE(fspr_status_t) fspr_pollset_destroy(fspr_pollset_t *pollset) { /* A no-op function for now. If we later implement /dev/poll * support, we'll need to close the /dev/poll fd here @@ -63,8 +63,8 @@ APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset) -APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_add(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { if (pollset->nelts == pollset->nalloc) { return APR_ENOMEM; @@ -83,16 +83,16 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, -APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_remove(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { - apr_uint32_t i; + fspr_uint32_t i; for (i = 0; i < pollset->nelts; i++) { if (descriptor->desc.s == pollset->query_set[i].desc.s) { /* Found an instance of the fd: remove this and any other copies */ - apr_uint32_t dst = i; - apr_uint32_t old_nelts = pollset->nelts; + fspr_uint32_t dst = i; + fspr_uint32_t old_nelts = pollset->nelts; pollset->nelts--; for (i++; i < old_nelts; i++) { @@ -116,7 +116,7 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, -static void make_pollset(apr_pollset_t *pollset) +static void make_pollset(fspr_pollset_t *pollset) { int i; int pos = 0; @@ -151,13 +151,13 @@ static void make_pollset(apr_pollset_t *pollset) -APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors) +APR_DECLARE(fspr_status_t) fspr_pollset_poll(fspr_pollset_t *pollset, + fspr_interval_time_t timeout, + fspr_int32_t *num, + const fspr_pollfd_t **descriptors) { int rv; - apr_uint32_t i; + fspr_uint32_t i; int *pollresult; int read_pos, write_pos, except_pos; diff --git a/libs/apr/poll/unix/epoll.c b/libs/apr/poll/unix/epoll.c index 388c67c041..cf9e47392b 100644 --- a/libs/apr/poll/unix/epoll.c +++ b/libs/apr/poll/unix/epoll.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_arch_poll_private.h" +#include "fspr_arch_poll_private.h" #ifdef POLLSET_USES_EPOLL -static apr_int16_t get_epoll_event(apr_int16_t event) +static fspr_int16_t get_epoll_event(fspr_int16_t event) { - apr_int16_t rv = 0; + fspr_int16_t rv = 0; if (event & APR_POLLIN) rv |= EPOLLIN; @@ -37,9 +37,9 @@ static apr_int16_t get_epoll_event(apr_int16_t event) return rv; } -static apr_int16_t get_epoll_revent(apr_int16_t event) +static fspr_int16_t get_epoll_revent(fspr_int16_t event) { - apr_int16_t rv = 0; + fspr_int16_t rv = 0; if (event & EPOLLIN) rv |= APR_POLLIN; @@ -56,18 +56,18 @@ static apr_int16_t get_epoll_revent(apr_int16_t event) return rv; } -struct apr_pollset_t +struct fspr_pollset_t { - apr_pool_t *pool; - apr_uint32_t nelts; - apr_uint32_t nalloc; + fspr_pool_t *pool; + fspr_uint32_t nelts; + fspr_uint32_t nalloc; int epoll_fd; struct epoll_event *pollset; - apr_pollfd_t *result_set; - apr_uint32_t flags; + fspr_pollfd_t *result_set; + fspr_uint32_t flags; #if APR_HAS_THREADS /* A thread mutex to protect operations on the rings */ - apr_thread_mutex_t *ring_lock; + fspr_thread_mutex_t *ring_lock; #endif /* A ring containing all of the pollfd_t that are active */ APR_RING_HEAD(pfd_query_ring_t, pfd_elem_t) query_ring; @@ -78,19 +78,19 @@ struct apr_pollset_t APR_RING_HEAD(pfd_dead_ring_t, pfd_elem_t) dead_ring; }; -static apr_status_t backend_cleanup(void *p_) +static fspr_status_t backend_cleanup(void *p_) { - apr_pollset_t *pollset = (apr_pollset_t *) p_; + fspr_pollset_t *pollset = (fspr_pollset_t *) p_; close(pollset->epoll_fd); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, - apr_uint32_t size, - apr_pool_t *p, - apr_uint32_t flags) +APR_DECLARE(fspr_status_t) fspr_pollset_create(fspr_pollset_t **pollset, + fspr_uint32_t size, + fspr_pool_t *p, + fspr_uint32_t flags) { - apr_status_t rv; + fspr_status_t rv; int fd; fd = epoll_create(size); @@ -99,10 +99,10 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, return errno; } - *pollset = apr_palloc(p, sizeof(**pollset)); + *pollset = fspr_palloc(p, sizeof(**pollset)); #if APR_HAS_THREADS if (flags & APR_POLLSET_THREADSAFE && - ((rv = apr_thread_mutex_create(&(*pollset)->ring_lock, + ((rv = fspr_thread_mutex_create(&(*pollset)->ring_lock, APR_THREAD_MUTEX_DEFAULT, p) != APR_SUCCESS))) { *pollset = NULL; @@ -119,9 +119,9 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, (*pollset)->flags = flags; (*pollset)->pool = p; (*pollset)->epoll_fd = fd; - (*pollset)->pollset = apr_palloc(p, size * sizeof(struct epoll_event)); - apr_pool_cleanup_register(p, *pollset, backend_cleanup, backend_cleanup); - (*pollset)->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); + (*pollset)->pollset = fspr_palloc(p, size * sizeof(struct epoll_event)); + fspr_pool_cleanup_register(p, *pollset, backend_cleanup, backend_cleanup); + (*pollset)->result_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); APR_RING_INIT(&(*pollset)->query_ring, pfd_elem_t, link); APR_RING_INIT(&(*pollset)->free_ring, pfd_elem_t, link); @@ -130,18 +130,18 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset) +APR_DECLARE(fspr_status_t) fspr_pollset_destroy(fspr_pollset_t *pollset) { - return apr_pool_cleanup_run(pollset->pool, pollset, backend_cleanup); + return fspr_pool_cleanup_run(pollset->pool, pollset, backend_cleanup); } -APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_add(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { struct epoll_event ev; int ret = -1; pfd_elem_t *elem; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; pollset_lock_rings(); @@ -150,7 +150,7 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, APR_RING_REMOVE(elem, link); } else { - elem = (pfd_elem_t *) apr_palloc(pollset->pool, sizeof(pfd_elem_t)); + elem = (pfd_elem_t *) fspr_palloc(pollset->pool, sizeof(pfd_elem_t)); APR_RING_ELEM_INIT(elem, link); } elem->pfd = *descriptor; @@ -180,11 +180,11 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, return rv; } -APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_remove(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { pfd_elem_t *ep; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; struct epoll_event ev; int ret = -1; @@ -224,13 +224,13 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, return rv; } -APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors) +APR_DECLARE(fspr_status_t) fspr_pollset_poll(fspr_pollset_t *pollset, + fspr_interval_time_t timeout, + fspr_int32_t *num, + const fspr_pollfd_t **descriptors) { int ret, i; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (timeout > 0) { timeout /= 1000; @@ -241,7 +241,7 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, (*num) = ret; if (ret < 0) { - rv = apr_get_netos_error(); + rv = fspr_get_netos_error(); } else if (ret == 0) { rv = APR_TIMEUP; diff --git a/libs/apr/poll/unix/kqueue.c b/libs/apr/poll/unix/kqueue.c index a8bea919c3..2938791007 100644 --- a/libs/apr/poll/unix/kqueue.c +++ b/libs/apr/poll/unix/kqueue.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_arch_poll_private.h" +#include "fspr_arch_poll_private.h" #ifdef POLLSET_USES_KQUEUE -static apr_int16_t get_kqueue_revent(apr_int16_t event, apr_int16_t flags) +static fspr_int16_t get_kqueue_revent(fspr_int16_t event, fspr_int16_t flags) { - apr_int16_t rv = 0; + fspr_int16_t rv = 0; if (event == EVFILT_READ) rv |= APR_POLLIN; @@ -34,19 +34,19 @@ static apr_int16_t get_kqueue_revent(apr_int16_t event, apr_int16_t flags) return rv; } -struct apr_pollset_t +struct fspr_pollset_t { - apr_pool_t *pool; - apr_uint32_t nelts; - apr_uint32_t nalloc; + fspr_pool_t *pool; + fspr_uint32_t nelts; + fspr_uint32_t nalloc; int kqueue_fd; struct kevent kevent; struct kevent *ke_set; - apr_pollfd_t *result_set; - apr_uint32_t flags; + fspr_pollfd_t *result_set; + fspr_uint32_t flags; #if APR_HAS_THREADS /* A thread mutex to protect operations on the rings */ - apr_thread_mutex_t *ring_lock; + fspr_thread_mutex_t *ring_lock; #endif /* A ring containing all of the pollfd_t that are active */ APR_RING_HEAD(pfd_query_ring_t, pfd_elem_t) query_ring; @@ -57,23 +57,23 @@ struct apr_pollset_t APR_RING_HEAD(pfd_dead_ring_t, pfd_elem_t) dead_ring; }; -static apr_status_t backend_cleanup(void *p_) +static fspr_status_t backend_cleanup(void *p_) { - apr_pollset_t *pollset = (apr_pollset_t *) p_; + fspr_pollset_t *pollset = (fspr_pollset_t *) p_; close(pollset->kqueue_fd); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, - apr_uint32_t size, - apr_pool_t *p, - apr_uint32_t flags) +APR_DECLARE(fspr_status_t) fspr_pollset_create(fspr_pollset_t **pollset, + fspr_uint32_t size, + fspr_pool_t *p, + fspr_uint32_t flags) { - apr_status_t rv = APR_SUCCESS; - *pollset = apr_palloc(p, sizeof(**pollset)); + fspr_status_t rv = APR_SUCCESS; + *pollset = fspr_palloc(p, sizeof(**pollset)); #if APR_HAS_THREADS if (flags & APR_POLLSET_THREADSAFE && - ((rv = apr_thread_mutex_create(&(*pollset)->ring_lock, + ((rv = fspr_thread_mutex_create(&(*pollset)->ring_lock, APR_THREAD_MUTEX_DEFAULT, p) != APR_SUCCESS))) { *pollset = NULL; @@ -91,7 +91,7 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, (*pollset)->pool = p; (*pollset)->ke_set = - (struct kevent *) apr_palloc(p, size * sizeof(struct kevent)); + (struct kevent *) fspr_palloc(p, size * sizeof(struct kevent)); memset((*pollset)->ke_set, 0, size * sizeof(struct kevent)); @@ -101,10 +101,10 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, return APR_ENOMEM; } - apr_pool_cleanup_register(p, (void *) (*pollset), backend_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(p, (void *) (*pollset), backend_cleanup, + fspr_pool_cleanup_null); - (*pollset)->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); + (*pollset)->result_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); APR_RING_INIT(&(*pollset)->query_ring, pfd_elem_t, link); APR_RING_INIT(&(*pollset)->free_ring, pfd_elem_t, link); @@ -113,17 +113,17 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, return rv; } -APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t * pollset) +APR_DECLARE(fspr_status_t) fspr_pollset_destroy(fspr_pollset_t * pollset) { - return apr_pool_cleanup_run(pollset->pool, pollset, backend_cleanup); + return fspr_pool_cleanup_run(pollset->pool, pollset, backend_cleanup); } -APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_add(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { - apr_os_sock_t fd; + fspr_os_sock_t fd; pfd_elem_t *elem; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; pollset_lock_rings(); @@ -132,7 +132,7 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, APR_RING_REMOVE(elem, link); } else { - elem = (pfd_elem_t *) apr_palloc(pollset->pool, sizeof(pfd_elem_t)); + elem = (pfd_elem_t *) fspr_palloc(pollset->pool, sizeof(pfd_elem_t)); APR_RING_ELEM_INIT(elem, link); } elem->pfd = *descriptor; @@ -175,12 +175,12 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, return rv; } -APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_remove(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { pfd_elem_t *ep; - apr_status_t rv = APR_SUCCESS; - apr_os_sock_t fd; + fspr_status_t rv = APR_SUCCESS; + fspr_os_sock_t fd; pollset_lock_rings(); @@ -229,21 +229,21 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, return rv; } -APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors) +APR_DECLARE(fspr_status_t) fspr_pollset_poll(fspr_pollset_t *pollset, + fspr_interval_time_t timeout, + fspr_int32_t *num, + const fspr_pollfd_t **descriptors) { int ret, i; struct timespec tv, *tvptr; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (timeout < 0) { tvptr = NULL; } else { - tv.tv_sec = (long) apr_time_sec(timeout); - tv.tv_nsec = (long) apr_time_msec(timeout); + tv.tv_sec = (long) fspr_time_sec(timeout); + tv.tv_nsec = (long) fspr_time_msec(timeout); tvptr = &tv; } @@ -251,7 +251,7 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, tvptr); (*num) = ret; if (ret < 0) { - rv = apr_get_netos_error(); + rv = fspr_get_netos_error(); } else if (ret == 0) { rv = APR_TIMEUP; diff --git a/libs/apr/poll/unix/poll.c b/libs/apr/poll/unix/poll.c index d27a9998d4..6b2a3c9fc0 100644 --- a/libs/apr/poll/unix/poll.c +++ b/libs/apr/poll/unix/poll.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_arch_poll_private.h" +#include "fspr_arch_poll_private.h" #if defined(POLL_USES_POLL) || defined(POLLSET_USES_POLL) -static apr_int16_t get_event(apr_int16_t event) +static fspr_int16_t get_event(fspr_int16_t event) { - apr_int16_t rv = 0; + fspr_int16_t rv = 0; if (event & APR_POLLIN) rv |= POLLIN; @@ -38,9 +38,9 @@ static apr_int16_t get_event(apr_int16_t event) return rv; } -static apr_int16_t get_revent(apr_int16_t event) +static fspr_int16_t get_revent(fspr_int16_t event) { - apr_int16_t rv = 0; + fspr_int16_t rv = 0; if (event & POLLIN) rv |= APR_POLLIN; @@ -65,9 +65,9 @@ static apr_int16_t get_revent(apr_int16_t event) #define SMALL_POLLSET_LIMIT 8 -APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num, - apr_int32_t *nsds, - apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_poll(fspr_pollfd_t *aprset, fspr_int32_t num, + fspr_int32_t *nsds, + fspr_interval_time_t timeout) { int i, num_to_poll; #ifdef HAVE_VLA @@ -89,7 +89,7 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num, * mapping. */ pollset = malloc(sizeof(struct pollfd) * num); - /* The other option is adding an apr_pool_abort() fn to invoke + /* The other option is adding an fspr_pool_abort() fn to invoke * the pool's out of memory handler */ if (!pollset) @@ -133,7 +133,7 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num, #endif if ((*nsds) < 0) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } if ((*nsds) == 0) { return APR_TIMEUP; @@ -147,43 +147,43 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, apr_int32_t num, #ifdef POLLSET_USES_POLL -struct apr_pollset_t +struct fspr_pollset_t { - apr_pool_t *pool; - apr_uint32_t nelts; - apr_uint32_t nalloc; + fspr_pool_t *pool; + fspr_uint32_t nelts; + fspr_uint32_t nalloc; struct pollfd *pollset; - apr_pollfd_t *query_set; - apr_pollfd_t *result_set; + fspr_pollfd_t *query_set; + fspr_pollfd_t *result_set; }; -APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, - apr_uint32_t size, - apr_pool_t *p, - apr_uint32_t flags) +APR_DECLARE(fspr_status_t) fspr_pollset_create(fspr_pollset_t **pollset, + fspr_uint32_t size, + fspr_pool_t *p, + fspr_uint32_t flags) { if (flags & APR_POLLSET_THREADSAFE) { *pollset = NULL; return APR_ENOTIMPL; } - *pollset = apr_palloc(p, sizeof(**pollset)); + *pollset = fspr_palloc(p, sizeof(**pollset)); (*pollset)->nelts = 0; (*pollset)->nalloc = size; (*pollset)->pool = p; - (*pollset)->pollset = apr_palloc(p, size * sizeof(struct pollfd)); - (*pollset)->query_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); - (*pollset)->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); + (*pollset)->pollset = fspr_palloc(p, size * sizeof(struct pollfd)); + (*pollset)->query_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); + (*pollset)->result_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset) +APR_DECLARE(fspr_status_t) fspr_pollset_destroy(fspr_pollset_t *pollset) { return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_add(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { if (pollset->nelts == pollset->nalloc) { return APR_ENOMEM; @@ -205,16 +205,16 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_remove(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { - apr_uint32_t i; + fspr_uint32_t i; for (i = 0; i < pollset->nelts; i++) { if (descriptor->desc.s == pollset->query_set[i].desc.s) { /* Found an instance of the fd: remove this and any other copies */ - apr_uint32_t dst = i; - apr_uint32_t old_nelts = pollset->nelts; + fspr_uint32_t dst = i; + fspr_uint32_t old_nelts = pollset->nelts; pollset->nelts--; for (i++; i < old_nelts; i++) { if (descriptor->desc.s == pollset->query_set[i].desc.s) { @@ -233,13 +233,13 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, return APR_NOTFOUND; } -APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors) +APR_DECLARE(fspr_status_t) fspr_pollset_poll(fspr_pollset_t *pollset, + fspr_interval_time_t timeout, + fspr_int32_t *num, + const fspr_pollfd_t **descriptors) { int rv; - apr_uint32_t i, j; + fspr_uint32_t i, j; if (timeout > 0) { timeout /= 1000; @@ -247,7 +247,7 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, rv = poll(pollset->pollset, pollset->nelts, timeout); (*num) = rv; if (rv < 0) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } if (rv == 0) { return APR_TIMEUP; diff --git a/libs/apr/poll/unix/port.c b/libs/apr/poll/unix/port.c index f668912b3f..626a690d40 100644 --- a/libs/apr/poll/unix/port.c +++ b/libs/apr/poll/unix/port.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_arch_poll_private.h" +#include "fspr_arch_poll_private.h" #ifdef POLLSET_USES_PORT -static apr_int16_t get_event(apr_int16_t event) +static fspr_int16_t get_event(fspr_int16_t event) { - apr_int16_t rv = 0; + fspr_int16_t rv = 0; if (event & APR_POLLIN) rv |= POLLIN; @@ -38,9 +38,9 @@ static apr_int16_t get_event(apr_int16_t event) return rv; } -static apr_int16_t get_revent(apr_int16_t event) +static fspr_int16_t get_revent(fspr_int16_t event) { - apr_int16_t rv = 0; + fspr_int16_t rv = 0; if (event & POLLIN) rv |= APR_POLLIN; @@ -59,18 +59,18 @@ static apr_int16_t get_revent(apr_int16_t event) } -struct apr_pollset_t +struct fspr_pollset_t { - apr_pool_t *pool; - apr_uint32_t nelts; - apr_uint32_t nalloc; + fspr_pool_t *pool; + fspr_uint32_t nelts; + fspr_uint32_t nalloc; int port_fd; port_event_t *port_set; - apr_pollfd_t *result_set; - apr_uint32_t flags; + fspr_pollfd_t *result_set; + fspr_uint32_t flags; #if APR_HAS_THREADS /* A thread mutex to protect operations on the rings */ - apr_thread_mutex_t *ring_lock; + fspr_thread_mutex_t *ring_lock; #endif /* A ring containing all of the pollfd_t that are active */ APR_RING_HEAD(pfd_query_ring_t, pfd_elem_t) query_ring; @@ -82,23 +82,23 @@ struct apr_pollset_t APR_RING_HEAD(pfd_dead_ring_t, pfd_elem_t) dead_ring; }; -static apr_status_t backend_cleanup(void *p_) +static fspr_status_t backend_cleanup(void *p_) { - apr_pollset_t *pollset = (apr_pollset_t *) p_; + fspr_pollset_t *pollset = (fspr_pollset_t *) p_; close(pollset->port_fd); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, - apr_uint32_t size, - apr_pool_t *p, - apr_uint32_t flags) +APR_DECLARE(fspr_status_t) fspr_pollset_create(fspr_pollset_t **pollset, + fspr_uint32_t size, + fspr_pool_t *p, + fspr_uint32_t flags) { - apr_status_t rv = APR_SUCCESS; - *pollset = apr_palloc(p, sizeof(**pollset)); + fspr_status_t rv = APR_SUCCESS; + *pollset = fspr_palloc(p, sizeof(**pollset)); #if APR_HAS_THREADS if (flags & APR_POLLSET_THREADSAFE && - ((rv = apr_thread_mutex_create(&(*pollset)->ring_lock, + ((rv = fspr_thread_mutex_create(&(*pollset)->ring_lock, APR_THREAD_MUTEX_DEFAULT, p) != APR_SUCCESS))) { *pollset = NULL; @@ -115,7 +115,7 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, (*pollset)->flags = flags; (*pollset)->pool = p; - (*pollset)->port_set = apr_palloc(p, size * sizeof(port_event_t)); + (*pollset)->port_set = fspr_palloc(p, size * sizeof(port_event_t)); (*pollset)->port_fd = port_create(); @@ -123,10 +123,10 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, return APR_ENOMEM; } - apr_pool_cleanup_register(p, (void *) (*pollset), backend_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(p, (void *) (*pollset), backend_cleanup, + fspr_pool_cleanup_null); - (*pollset)->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); + (*pollset)->result_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); APR_RING_INIT(&(*pollset)->query_ring, pfd_elem_t, link); APR_RING_INIT(&(*pollset)->add_ring, pfd_elem_t, link); @@ -136,18 +136,18 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, return rv; } -APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t *pollset) +APR_DECLARE(fspr_status_t) fspr_pollset_destroy(fspr_pollset_t *pollset) { - return apr_pool_cleanup_run(pollset->pool, pollset, backend_cleanup); + return fspr_pool_cleanup_run(pollset->pool, pollset, backend_cleanup); } -APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_add(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { - apr_os_sock_t fd; + fspr_os_sock_t fd; pfd_elem_t *elem; int res; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; pollset_lock_rings(); @@ -156,7 +156,7 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, APR_RING_REMOVE(elem, link); } else { - elem = (pfd_elem_t *) apr_palloc(pollset->pool, sizeof(pfd_elem_t)); + elem = (pfd_elem_t *) fspr_palloc(pollset->pool, sizeof(pfd_elem_t)); APR_RING_ELEM_INIT(elem, link); } elem->pfd = *descriptor; @@ -185,12 +185,12 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, return rv; } -APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_remove(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { - apr_os_sock_t fd; + fspr_os_sock_t fd; pfd_elem_t *ep; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; int res; pollset_lock_rings(); @@ -243,24 +243,24 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t *pollset, return rv; } -APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors) +APR_DECLARE(fspr_status_t) fspr_pollset_poll(fspr_pollset_t *pollset, + fspr_interval_time_t timeout, + fspr_int32_t *num, + const fspr_pollfd_t **descriptors) { - apr_os_sock_t fd; + fspr_os_sock_t fd; int ret, i; unsigned int nget; pfd_elem_t *ep; struct timespec tv, *tvptr; - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (timeout < 0) { tvptr = NULL; } else { - tv.tv_sec = (long) apr_time_sec(timeout); - tv.tv_nsec = (long) apr_time_msec(timeout); + tv.tv_sec = (long) fspr_time_sec(timeout); + tv.tv_nsec = (long) fspr_time_msec(timeout); tvptr = &tv; } diff --git a/libs/apr/poll/unix/select.c b/libs/apr/poll/unix/select.c index ca35b77db9..fecdaf845a 100644 --- a/libs/apr/poll/unix/select.c +++ b/libs/apr/poll/unix/select.c @@ -19,34 +19,34 @@ #define FD_SETSIZE 1024 #endif -#include "apr.h" -#include "apr_poll.h" -#include "apr_time.h" -#include "apr_portable.h" -#include "apr_arch_networkio.h" -#include "apr_arch_file_io.h" -#include "apr_arch_poll_private.h" +#include "fspr.h" +#include "fspr_poll.h" +#include "fspr_time.h" +#include "fspr_portable.h" +#include "fspr_arch_networkio.h" +#include "fspr_arch_file_io.h" +#include "fspr_arch_poll_private.h" #ifdef POLL_USES_SELECT -APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, int num, - apr_int32_t *nsds, - apr_interval_time_t timeout) +APR_DECLARE(fspr_status_t) fspr_poll(fspr_pollfd_t *aprset, int num, + fspr_int32_t *nsds, + fspr_interval_time_t timeout) { fd_set readset, writeset, exceptset; int rv, i; int maxfd = -1; struct timeval tv, *tvptr; #ifdef NETWARE - apr_datatype_e set_type = APR_NO_DESC; + fspr_datatype_e set_type = APR_NO_DESC; #endif if (timeout < 0) { tvptr = NULL; } else { - tv.tv_sec = (long) apr_time_sec(timeout); - tv.tv_usec = (long) apr_time_usec(timeout); + tv.tv_sec = (long) fspr_time_sec(timeout); + tv.tv_usec = (long) fspr_time_usec(timeout); tvptr = &tv; } @@ -55,7 +55,7 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, int num, FD_ZERO(&exceptset); for (i = 0; i < num; i++) { - apr_os_sock_t fd; + fspr_os_sock_t fd; aprset[i].rtnevents = 0; @@ -128,12 +128,12 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, int num, return APR_TIMEUP; } if ((*nsds) < 0) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } (*nsds) = 0; for (i = 0; i < num; i++) { - apr_os_sock_t fd; + fspr_os_sock_t fd; if (aprset[i].desc_type == APR_POLL_SOCKET) { fd = aprset[i].desc.s->socketdes; @@ -169,25 +169,25 @@ APR_DECLARE(apr_status_t) apr_poll(apr_pollfd_t *aprset, int num, #ifdef POLLSET_USES_SELECT -struct apr_pollset_t +struct fspr_pollset_t { - apr_pool_t *pool; + fspr_pool_t *pool; - apr_uint32_t nelts; - apr_uint32_t nalloc; + fspr_uint32_t nelts; + fspr_uint32_t nalloc; fd_set readset, writeset, exceptset; int maxfd; - apr_pollfd_t *query_set; - apr_pollfd_t *result_set; + fspr_pollfd_t *query_set; + fspr_pollfd_t *result_set; #ifdef NETWARE int set_type; #endif }; -APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, - apr_uint32_t size, - apr_pool_t *p, - apr_uint32_t flags) +APR_DECLARE(fspr_status_t) fspr_pollset_create(fspr_pollset_t **pollset, + fspr_uint32_t size, + fspr_pool_t *p, + fspr_uint32_t flags) { if (flags & APR_POLLSET_THREADSAFE) { *pollset = NULL; @@ -199,7 +199,7 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, return APR_EINVAL; } #endif - *pollset = apr_palloc(p, sizeof(**pollset)); + *pollset = fspr_palloc(p, sizeof(**pollset)); (*pollset)->nelts = 0; (*pollset)->nalloc = size; (*pollset)->pool = p; @@ -210,21 +210,21 @@ APR_DECLARE(apr_status_t) apr_pollset_create(apr_pollset_t **pollset, #ifdef NETWARE (*pollset)->set_type = APR_NO_DESC; #endif - (*pollset)->query_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); - (*pollset)->result_set = apr_palloc(p, size * sizeof(apr_pollfd_t)); + (*pollset)->query_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); + (*pollset)->result_set = fspr_palloc(p, size * sizeof(fspr_pollfd_t)); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_destroy(apr_pollset_t * pollset) +APR_DECLARE(fspr_status_t) fspr_pollset_destroy(fspr_pollset_t * pollset) { return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, - const apr_pollfd_t *descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_add(fspr_pollset_t *pollset, + const fspr_pollfd_t *descriptor) { - apr_os_sock_t fd; + fspr_os_sock_t fd; if (pollset->nelts == pollset->nalloc) { return APR_ENOMEM; @@ -285,11 +285,11 @@ APR_DECLARE(apr_status_t) apr_pollset_add(apr_pollset_t *pollset, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t * pollset, - const apr_pollfd_t * descriptor) +APR_DECLARE(fspr_status_t) fspr_pollset_remove(fspr_pollset_t * pollset, + const fspr_pollfd_t * descriptor) { - apr_uint32_t i; - apr_os_sock_t fd; + fspr_uint32_t i; + fspr_os_sock_t fd; if (descriptor->desc_type == APR_POLL_SOCKET) { fd = descriptor->desc.s->socketdes; @@ -305,8 +305,8 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t * pollset, for (i = 0; i < pollset->nelts; i++) { if (descriptor->desc.s == pollset->query_set[i].desc.s) { /* Found an instance of the fd: remove this and any other copies */ - apr_uint32_t dst = i; - apr_uint32_t old_nelts = pollset->nelts; + fspr_uint32_t dst = i; + fspr_uint32_t old_nelts = pollset->nelts; pollset->nelts--; for (i++; i < old_nelts; i++) { if (descriptor->desc.s == pollset->query_set[i].desc.s) { @@ -330,13 +330,13 @@ APR_DECLARE(apr_status_t) apr_pollset_remove(apr_pollset_t * pollset, return APR_NOTFOUND; } -APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, - apr_interval_time_t timeout, - apr_int32_t *num, - const apr_pollfd_t **descriptors) +APR_DECLARE(fspr_status_t) fspr_pollset_poll(fspr_pollset_t *pollset, + fspr_interval_time_t timeout, + fspr_int32_t *num, + const fspr_pollfd_t **descriptors) { int rv; - apr_uint32_t i, j; + fspr_uint32_t i, j; struct timeval tv, *tvptr; fd_set readset, writeset, exceptset; @@ -344,8 +344,8 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, tvptr = NULL; } else { - tv.tv_sec = (long) apr_time_sec(timeout); - tv.tv_usec = (long) apr_time_usec(timeout); + tv.tv_sec = (long) fspr_time_sec(timeout); + tv.tv_usec = (long) fspr_time_usec(timeout); tvptr = &tv; } @@ -365,14 +365,14 @@ APR_DECLARE(apr_status_t) apr_pollset_poll(apr_pollset_t *pollset, (*num) = rv; if (rv < 0) { - return apr_get_netos_error(); + return fspr_get_netos_error(); } if (rv == 0) { return APR_TIMEUP; } j = 0; for (i = 0; i < pollset->nelts; i++) { - apr_os_sock_t fd; + fspr_os_sock_t fd; if (pollset->query_set[i].desc_type == APR_POLL_SOCKET) { fd = pollset->query_set[i].desc.s->socketdes; } diff --git a/libs/apr/random/unix/apr_random.c b/libs/apr/random/unix/fspr_random.c similarity index 71% rename from libs/apr/random/unix/apr_random.c rename to libs/apr/random/unix/fspr_random.c index f574b590d4..5657624512 100644 --- a/libs/apr/random/unix/apr_random.c +++ b/libs/apr/random/unix/fspr_random.c @@ -17,10 +17,10 @@ * See the paper "???" by Ben Laurie for an explanation of this PRNG. */ -#include "apr.h" -#include "apr_pools.h" -#include "apr_random.h" -#include "apr_thread_proc.h" +#include "fspr.h" +#include "fspr_pools.h" +#include "fspr_random.h" +#include "fspr_thread_proc.h" #include #ifdef min @@ -35,11 +35,11 @@ #define APR_RANDOM_DEFAULT_G_FOR_INSECURE 32 #define APR_RANDOM_DEFAULT_G_FOR_SECURE 320 -typedef struct apr_random_pool_t { +typedef struct fspr_random_pool_t { unsigned char *pool; unsigned int bytes; unsigned int pool_size; -} apr_random_pool_t; +} fspr_random_pool_t; #define hash_init(h) (h)->init(h) #define hash_add(h,b,n) (h)->add(h,b,n) @@ -50,18 +50,18 @@ typedef struct apr_random_pool_t { #define crypt_setkey(c,k) (c)->set_key((c)->data,k) #define crypt_crypt(c,out,in) (c)->crypt((c)->date,out,in) -struct apr_random_t { - apr_pool_t *apr_pool; - apr_crypto_hash_t *pool_hash; +struct fspr_random_t { + fspr_pool_t *fspr_pool; + fspr_crypto_hash_t *pool_hash; unsigned int npools; - apr_random_pool_t *pools; + fspr_random_pool_t *pools; unsigned int next_pool; unsigned int generation; - apr_size_t rehash_size; - apr_size_t reseed_size; - apr_crypto_hash_t *key_hash; + fspr_size_t rehash_size; + fspr_size_t reseed_size; + fspr_crypto_hash_t *key_hash; #define K_size(g) ((g)->key_hash->size) - apr_crypto_hash_t *prng_hash; + fspr_crypto_hash_t *prng_hash; #define B_size(g) ((g)->prng_hash->size) unsigned char *H; @@ -71,33 +71,33 @@ struct apr_random_t { ? (g)->H_waiting : (g)->H) unsigned char *randomness; - apr_size_t random_bytes; + fspr_size_t random_bytes; unsigned int g_for_insecure; unsigned int g_for_secure; unsigned int secure_base; unsigned int insecure_started:1; unsigned int secure_started:1; - apr_random_t *next; + fspr_random_t *next; }; -static apr_random_t *all_random; +static fspr_random_t *all_random; -APR_DECLARE(void) apr_random_init(apr_random_t *g,apr_pool_t *p, - apr_crypto_hash_t *pool_hash, - apr_crypto_hash_t *key_hash, - apr_crypto_hash_t *prng_hash) +APR_DECLARE(void) fspr_random_init(fspr_random_t *g,fspr_pool_t *p, + fspr_crypto_hash_t *pool_hash, + fspr_crypto_hash_t *key_hash, + fspr_crypto_hash_t *prng_hash) { unsigned int n; - g->apr_pool = p; + g->fspr_pool = p; g->pool_hash = pool_hash; g->key_hash = key_hash; g->prng_hash = prng_hash; g->npools = APR_RANDOM_DEFAULT_POOLS; - g->pools = apr_palloc(p,g->npools*sizeof *g->pools); + g->pools = fspr_palloc(p,g->npools*sizeof *g->pools); for (n = 0; n < g->npools; ++n) { g->pools[n].bytes = g->pools[n].pool_size = 0; g->pools[n].pool = NULL; @@ -112,10 +112,10 @@ APR_DECLARE(void) apr_random_init(apr_random_t *g,apr_pool_t *p, /2)*g->pool_hash->size*2; g->reseed_size = APR_RANDOM_DEFAULT_RESEED_SIZE; - g->H = apr_pcalloc(p,H_size(g)); - g->H_waiting = apr_pcalloc(p,H_size(g)); + g->H = fspr_pcalloc(p,H_size(g)); + g->H_waiting = fspr_pcalloc(p,H_size(g)); - g->randomness = apr_palloc(p,B_size(g)); + g->randomness = fspr_palloc(p,B_size(g)); g->random_bytes = 0; g->g_for_insecure = APR_RANDOM_DEFAULT_G_FOR_INSECURE; @@ -127,7 +127,7 @@ APR_DECLARE(void) apr_random_init(apr_random_t *g,apr_pool_t *p, all_random = g; } -static void mix_pid(apr_random_t *g,unsigned char *H,pid_t pid) +static void mix_pid(fspr_random_t *g,unsigned char *H,pid_t pid) { hash_init(g->key_hash); hash_add(g->key_hash,H,H_size(g)); @@ -135,7 +135,7 @@ static void mix_pid(apr_random_t *g,unsigned char *H,pid_t pid) hash_finish(g->key_hash,H); } -static void mixer(apr_random_t *g,pid_t pid) +static void mixer(fspr_random_t *g,pid_t pid) { unsigned char *H = H_current(g); @@ -151,24 +151,24 @@ static void mixer(apr_random_t *g,pid_t pid) g->random_bytes = 0; } -APR_DECLARE(void) apr_random_after_fork(apr_proc_t *proc) +APR_DECLARE(void) fspr_random_after_fork(fspr_proc_t *proc) { - apr_random_t *r; + fspr_random_t *r; for (r = all_random; r; r = r->next) mixer(r,proc->pid); } -APR_DECLARE(apr_random_t *) apr_random_standard_new(apr_pool_t *p) +APR_DECLARE(fspr_random_t *) fspr_random_standard_new(fspr_pool_t *p) { - apr_random_t *r = apr_palloc(p,sizeof *r); + fspr_random_t *r = fspr_palloc(p,sizeof *r); - apr_random_init(r,p,apr_crypto_sha256_new(p),apr_crypto_sha256_new(p), - apr_crypto_sha256_new(p)); + fspr_random_init(r,p,fspr_crypto_sha256_new(p),fspr_crypto_sha256_new(p), + fspr_crypto_sha256_new(p)); return r; } -static void rekey(apr_random_t *g) +static void rekey(fspr_random_t *g) { unsigned int n; unsigned char *H = H_current(g); @@ -197,20 +197,20 @@ static void rekey(apr_random_t *g) } } -APR_DECLARE(void) apr_random_add_entropy(apr_random_t *g,const void *entropy_, - apr_size_t bytes) +APR_DECLARE(void) fspr_random_add_entropy(fspr_random_t *g,const void *entropy_, + fspr_size_t bytes) { unsigned int n; const unsigned char *entropy = entropy_; for (n = 0; n < bytes; ++n) { - apr_random_pool_t *p = &g->pools[g->next_pool]; + fspr_random_pool_t *p = &g->pools[g->next_pool]; if (++g->next_pool == g->npools) g->next_pool = 0; if (p->pool_size < p->bytes+1) { - unsigned char *np = apr_palloc(g->apr_pool,(p->bytes+1)*2); + unsigned char *np = fspr_palloc(g->fspr_pool,(p->bytes+1)*2); memcpy(np,p->pool,p->bytes); p->pool = np; @@ -233,23 +233,23 @@ APR_DECLARE(void) apr_random_add_entropy(apr_random_t *g,const void *entropy_, } /* This will give g->B_size bytes of randomness */ -static void apr_random_block(apr_random_t *g,unsigned char *random) +static void fspr_random_block(fspr_random_t *g,unsigned char *random) { /* FIXME: in principle, these are different hashes */ hash(g->prng_hash,g->H,g->H,H_size(g)); hash(g->prng_hash,random,g->H,B_size(g)); } -static void apr_random_bytes(apr_random_t *g,unsigned char *random, - apr_size_t bytes) +static void fspr_random_bytes(fspr_random_t *g,unsigned char *random, + fspr_size_t bytes) { - apr_size_t n; + fspr_size_t n; for (n = 0; n < bytes; ) { int l; if (g->random_bytes == 0) { - apr_random_block(g,g->randomness); + fspr_random_block(g,g->randomness); g->random_bytes = B_size(g); } l = min(bytes-n,g->random_bytes); @@ -259,40 +259,40 @@ static void apr_random_bytes(apr_random_t *g,unsigned char *random, } } -APR_DECLARE(apr_status_t) apr_random_secure_bytes(apr_random_t *g, +APR_DECLARE(fspr_status_t) fspr_random_secure_bytes(fspr_random_t *g, void *random, - apr_size_t bytes) + fspr_size_t bytes) { if (!g->secure_started) return APR_ENOTENOUGHENTROPY; - apr_random_bytes(g,random,bytes); + fspr_random_bytes(g,random,bytes); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_random_insecure_bytes(apr_random_t *g, +APR_DECLARE(fspr_status_t) fspr_random_insecure_bytes(fspr_random_t *g, void *random, - apr_size_t bytes) + fspr_size_t bytes) { if (!g->insecure_started) return APR_ENOTENOUGHENTROPY; - apr_random_bytes(g,random,bytes); + fspr_random_bytes(g,random,bytes); return APR_SUCCESS; } -APR_DECLARE(void) apr_random_barrier(apr_random_t *g) +APR_DECLARE(void) fspr_random_barrier(fspr_random_t *g) { g->secure_started = 0; g->secure_base = g->generation; } -APR_DECLARE(apr_status_t) apr_random_secure_ready(apr_random_t *r) +APR_DECLARE(fspr_status_t) fspr_random_secure_ready(fspr_random_t *r) { if (!r->secure_started) return APR_ENOTENOUGHENTROPY; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_random_insecure_ready(apr_random_t *r) +APR_DECLARE(fspr_status_t) fspr_random_insecure_ready(fspr_random_t *r) { if (!r->insecure_started) return APR_ENOTENOUGHENTROPY; diff --git a/libs/apr/random/unix/sha2.c b/libs/apr/random/unix/sha2.c index b8bd241d85..5a3f217822 100644 --- a/libs/apr/random/unix/sha2.c +++ b/libs/apr/random/unix/sha2.c @@ -45,9 +45,9 @@ */ /*** SHA-256/384/512 Machine Architecture Definitions *****************/ -typedef apr_byte_t sha2_byte; /* Exactly 1 byte */ -typedef apr_uint32_t sha2_word32; /* Exactly 4 bytes */ -typedef apr_uint64_t sha2_word64; /* Exactly 8 bytes */ +typedef fspr_byte_t sha2_byte; /* Exactly 1 byte */ +typedef fspr_uint32_t sha2_word32; /* Exactly 4 bytes */ +typedef fspr_uint64_t sha2_word64; /* Exactly 8 bytes */ /*** SHA-256/384/512 Various Length Definitions ***********************/ /* NOTE: Most of these are in sha2.h */ @@ -150,9 +150,9 @@ typedef apr_uint64_t sha2_word64; /* Exactly 8 bytes */ * library -- they are intended for private internal visibility/use * only. */ -void apr__SHA512_Last(SHA512_CTX*); -void apr__SHA256_Transform(SHA256_CTX*, const sha2_word32*); -void apr__SHA512_Transform(SHA512_CTX*, const sha2_word64*); +void fspr__SHA512_Last(SHA512_CTX*); +void fspr__SHA256_Transform(SHA256_CTX*, const sha2_word32*); +void fspr__SHA512_Transform(SHA512_CTX*, const sha2_word64*); /*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ @@ -264,7 +264,7 @@ static const char *sha2_hex_digits = "0123456789abcdef"; /*** SHA-256: *********************************************************/ -void apr__SHA256_Init(SHA256_CTX* context) { +void fspr__SHA256_Init(SHA256_CTX* context) { if (context == (SHA256_CTX*)0) { return; } @@ -310,7 +310,7 @@ void apr__SHA256_Init(SHA256_CTX* context) { (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ j++ -void apr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { +void fspr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { sha2_word32 a, b, c, d, e, f, g, h, s0, s1; sha2_word32 T1, *W256; int j; @@ -368,7 +368,7 @@ void apr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { #else /* SHA2_UNROLL_TRANSFORM */ -void apr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { +void fspr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { sha2_word32 a, b, c, d, e, f, g, h, s0, s1; sha2_word32 T1, T2, *W256; int j; @@ -458,7 +458,7 @@ void apr__SHA256_Transform(SHA256_CTX* context, const sha2_word32* data) { #endif /* SHA2_UNROLL_TRANSFORM */ -void apr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { +void fspr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -481,7 +481,7 @@ void apr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) context->bitcount += freespace << 3; len -= freespace; data += freespace; - apr__SHA256_Transform(context, (sha2_word32*)context->buffer); + fspr__SHA256_Transform(context, (sha2_word32*)context->buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->buffer[usedspace], data, len); @@ -495,7 +495,7 @@ void apr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) } while (len >= SHA256_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - apr__SHA256_Transform(context, (sha2_word32*)data); + fspr__SHA256_Transform(context, (sha2_word32*)data); context->bitcount += SHA256_BLOCK_LENGTH << 3; len -= SHA256_BLOCK_LENGTH; data += SHA256_BLOCK_LENGTH; @@ -511,7 +511,7 @@ void apr__SHA256_Update(SHA256_CTX* context, const sha2_byte *data, size_t len) assert(freespace==0); } -void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { +void fspr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { sha2_word32 *d = (sha2_word32*)digest; unsigned int usedspace; @@ -538,7 +538,7 @@ void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { MEMSET_BZERO(&context->buffer[usedspace], SHA256_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ - apr__SHA256_Transform(context, (sha2_word32*)context->buffer); + fspr__SHA256_Transform(context, (sha2_word32*)context->buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->buffer, SHA256_SHORT_BLOCK_LENGTH); @@ -554,7 +554,7 @@ void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { *(sha2_word64*)&context->buffer[SHA256_SHORT_BLOCK_LENGTH] = context->bitcount; /* Final transform: */ - apr__SHA256_Transform(context, (sha2_word32*)context->buffer); + fspr__SHA256_Transform(context, (sha2_word32*)context->buffer); #if !APR_IS_BIGENDIAN { @@ -576,7 +576,7 @@ void apr__SHA256_Final(sha2_byte digest[], SHA256_CTX* context) { assert(usedspace==0); } -char *apr__SHA256_End(SHA256_CTX* context, char buffer[]) { +char *fspr__SHA256_End(SHA256_CTX* context, char buffer[]) { sha2_byte digest[SHA256_DIGEST_LENGTH], *d = digest; int i; @@ -584,7 +584,7 @@ char *apr__SHA256_End(SHA256_CTX* context, char buffer[]) { assert(context != (SHA256_CTX*)0); if (buffer != (char*)0) { - apr__SHA256_Final(digest, context); + fspr__SHA256_Final(digest, context); for (i = 0; i < SHA256_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -599,17 +599,17 @@ char *apr__SHA256_End(SHA256_CTX* context, char buffer[]) { return buffer; } -char* apr__SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { +char* fspr__SHA256_Data(const sha2_byte* data, size_t len, char digest[SHA256_DIGEST_STRING_LENGTH]) { SHA256_CTX context; - apr__SHA256_Init(&context); - apr__SHA256_Update(&context, data, len); - return apr__SHA256_End(&context, digest); + fspr__SHA256_Init(&context); + fspr__SHA256_Update(&context, data, len); + return fspr__SHA256_End(&context, digest); } /*** SHA-512: *********************************************************/ -void apr__SHA512_Init(SHA512_CTX* context) { +void fspr__SHA512_Init(SHA512_CTX* context) { if (context == (SHA512_CTX*)0) { return; } @@ -654,7 +654,7 @@ void apr__SHA512_Init(SHA512_CTX* context) { (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ j++ -void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { +void fspr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { sha2_word64 a, b, c, d, e, f, g, h, s0, s1; sha2_word64 T1, *W512 = (sha2_word64*)context->buffer; int j; @@ -709,7 +709,7 @@ void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { #else /* SHA2_UNROLL_TRANSFORM */ -void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { +void fspr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { sha2_word64 a, b, c, d, e, f, g, h, s0, s1; sha2_word64 T1, T2, *W512 = (sha2_word64*)context->buffer; int j; @@ -797,7 +797,7 @@ void apr__SHA512_Transform(SHA512_CTX* context, const sha2_word64* data) { #endif /* SHA2_UNROLL_TRANSFORM */ -void apr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { +void fspr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) { unsigned int freespace, usedspace; if (len == 0) { @@ -820,7 +820,7 @@ void apr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) ADDINC128(context->bitcount, freespace << 3); len -= freespace; data += freespace; - apr__SHA512_Transform(context, (sha2_word64*)context->buffer); + fspr__SHA512_Transform(context, (sha2_word64*)context->buffer); } else { /* The buffer is not yet full */ MEMCPY_BCOPY(&context->buffer[usedspace], data, len); @@ -834,7 +834,7 @@ void apr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) } while (len >= SHA512_BLOCK_LENGTH) { /* Process as many complete blocks as we can */ - apr__SHA512_Transform(context, (sha2_word64*)data); + fspr__SHA512_Transform(context, (sha2_word64*)data); ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); len -= SHA512_BLOCK_LENGTH; data += SHA512_BLOCK_LENGTH; @@ -850,7 +850,7 @@ void apr__SHA512_Update(SHA512_CTX* context, const sha2_byte *data, size_t len) assert(freespace==0); } -void apr__SHA512_Last(SHA512_CTX* context) { +void fspr__SHA512_Last(SHA512_CTX* context) { unsigned int usedspace; usedspace = (unsigned int)((context->bitcount[0] >> 3) @@ -872,7 +872,7 @@ void apr__SHA512_Last(SHA512_CTX* context) { MEMSET_BZERO(&context->buffer[usedspace], SHA512_BLOCK_LENGTH - usedspace); } /* Do second-to-last transform: */ - apr__SHA512_Transform(context, (sha2_word64*)context->buffer); + fspr__SHA512_Transform(context, (sha2_word64*)context->buffer); /* And set-up for the last transform: */ MEMSET_BZERO(context->buffer, SHA512_BLOCK_LENGTH - 2); @@ -889,10 +889,10 @@ void apr__SHA512_Last(SHA512_CTX* context) { *(sha2_word64*)&context->buffer[SHA512_SHORT_BLOCK_LENGTH+8] = context->bitcount[0]; /* Final transform: */ - apr__SHA512_Transform(context, (sha2_word64*)context->buffer); + fspr__SHA512_Transform(context, (sha2_word64*)context->buffer); } -void apr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { +void fspr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ @@ -900,7 +900,7 @@ void apr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != (sha2_byte*)0) { - apr__SHA512_Last(context); + fspr__SHA512_Last(context); /* Save the hash data for output: */ #if !APR_IS_BIGENDIAN @@ -921,7 +921,7 @@ void apr__SHA512_Final(sha2_byte digest[], SHA512_CTX* context) { MEMSET_BZERO(context, sizeof(*context)); } -char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) { +char *fspr__SHA512_End(SHA512_CTX* context, char buffer[]) { sha2_byte digest[SHA512_DIGEST_LENGTH], *d = digest; int i; @@ -929,7 +929,7 @@ char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) { assert(context != (SHA512_CTX*)0); if (buffer != (char*)0) { - apr__SHA512_Final(digest, context); + fspr__SHA512_Final(digest, context); for (i = 0; i < SHA512_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -944,17 +944,17 @@ char *apr__SHA512_End(SHA512_CTX* context, char buffer[]) { return buffer; } -char* apr__SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { +char* fspr__SHA512_Data(const sha2_byte* data, size_t len, char digest[SHA512_DIGEST_STRING_LENGTH]) { SHA512_CTX context; - apr__SHA512_Init(&context); - apr__SHA512_Update(&context, data, len); - return apr__SHA512_End(&context, digest); + fspr__SHA512_Init(&context); + fspr__SHA512_Update(&context, data, len); + return fspr__SHA512_End(&context, digest); } /*** SHA-384: *********************************************************/ -void apr__SHA384_Init(SHA384_CTX* context) { +void fspr__SHA384_Init(SHA384_CTX* context) { if (context == (SHA384_CTX*)0) { return; } @@ -963,11 +963,11 @@ void apr__SHA384_Init(SHA384_CTX* context) { context->bitcount[0] = context->bitcount[1] = 0; } -void apr__SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { - apr__SHA512_Update((SHA512_CTX*)context, data, len); +void fspr__SHA384_Update(SHA384_CTX* context, const sha2_byte* data, size_t len) { + fspr__SHA512_Update((SHA512_CTX*)context, data, len); } -void apr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { +void fspr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { sha2_word64 *d = (sha2_word64*)digest; /* Sanity check: */ @@ -975,7 +975,7 @@ void apr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { /* If no digest buffer is passed, we don't bother doing this: */ if (digest != (sha2_byte*)0) { - apr__SHA512_Last((SHA512_CTX*)context); + fspr__SHA512_Last((SHA512_CTX*)context); /* Save the hash data for output: */ #if !APR_IS_BIGENDIAN @@ -996,7 +996,7 @@ void apr__SHA384_Final(sha2_byte digest[], SHA384_CTX* context) { MEMSET_BZERO(context, sizeof(*context)); } -char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) { +char *fspr__SHA384_End(SHA384_CTX* context, char buffer[]) { sha2_byte digest[SHA384_DIGEST_LENGTH], *d = digest; int i; @@ -1004,7 +1004,7 @@ char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) { assert(context != (SHA384_CTX*)0); if (buffer != (char*)0) { - apr__SHA384_Final(digest, context); + fspr__SHA384_Final(digest, context); for (i = 0; i < SHA384_DIGEST_LENGTH; i++) { *buffer++ = sha2_hex_digits[(*d & 0xf0) >> 4]; @@ -1019,11 +1019,11 @@ char *apr__SHA384_End(SHA384_CTX* context, char buffer[]) { return buffer; } -char* apr__SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { +char* fspr__SHA384_Data(const sha2_byte* data, size_t len, char digest[SHA384_DIGEST_STRING_LENGTH]) { SHA384_CTX context; - apr__SHA384_Init(&context); - apr__SHA384_Update(&context, data, len); - return apr__SHA384_End(&context, digest); + fspr__SHA384_Init(&context); + fspr__SHA384_Update(&context, data, len); + return fspr__SHA384_End(&context, digest); } diff --git a/libs/apr/random/unix/sha2.h b/libs/apr/random/unix/sha2.h index 9f0d93e1e0..0696d4e0b1 100644 --- a/libs/apr/random/unix/sha2.h +++ b/libs/apr/random/unix/sha2.h @@ -27,7 +27,7 @@ extern "C" { #endif -#include "apr.h" +#include "fspr.h" /*** SHA-256/384/512 Various Length Definitions ***********************/ #define SHA256_BLOCK_LENGTH 64 @@ -43,39 +43,39 @@ extern "C" { /*** SHA-256/384/512 Context Structures *******************************/ typedef struct _SHA256_CTX { - apr_uint32_t state[8]; - apr_uint64_t bitcount; - apr_byte_t buffer[SHA256_BLOCK_LENGTH]; + fspr_uint32_t state[8]; + fspr_uint64_t bitcount; + fspr_byte_t buffer[SHA256_BLOCK_LENGTH]; } SHA256_CTX; typedef struct _SHA512_CTX { - apr_uint64_t state[8]; - apr_uint64_t bitcount[2]; - apr_byte_t buffer[SHA512_BLOCK_LENGTH]; + fspr_uint64_t state[8]; + fspr_uint64_t bitcount[2]; + fspr_byte_t buffer[SHA512_BLOCK_LENGTH]; } SHA512_CTX; typedef SHA512_CTX SHA384_CTX; /*** SHA-256/384/512 Function Prototypes ******************************/ -void apr__SHA256_Init(SHA256_CTX *); -void apr__SHA256_Update(SHA256_CTX *, const apr_byte_t *, size_t); -void apr__SHA256_Final(apr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *); -char* apr__SHA256_End(SHA256_CTX *, char [SHA256_DIGEST_STRING_LENGTH]); -char* apr__SHA256_Data(const apr_byte_t *, size_t, +void fspr__SHA256_Init(SHA256_CTX *); +void fspr__SHA256_Update(SHA256_CTX *, const fspr_byte_t *, size_t); +void fspr__SHA256_Final(fspr_byte_t [SHA256_DIGEST_LENGTH], SHA256_CTX *); +char* fspr__SHA256_End(SHA256_CTX *, char [SHA256_DIGEST_STRING_LENGTH]); +char* fspr__SHA256_Data(const fspr_byte_t *, size_t, char [SHA256_DIGEST_STRING_LENGTH]); -void apr__SHA384_Init(SHA384_CTX *); -void apr__SHA384_Update(SHA384_CTX *, const apr_byte_t *, size_t); -void apr__SHA384_Final(apr_byte_t [SHA384_DIGEST_LENGTH], SHA384_CTX *); -char* apr__SHA384_End(SHA384_CTX *, char [SHA384_DIGEST_STRING_LENGTH]); -char* apr__SHA384_Data(const apr_byte_t *, size_t, +void fspr__SHA384_Init(SHA384_CTX *); +void fspr__SHA384_Update(SHA384_CTX *, const fspr_byte_t *, size_t); +void fspr__SHA384_Final(fspr_byte_t [SHA384_DIGEST_LENGTH], SHA384_CTX *); +char* fspr__SHA384_End(SHA384_CTX *, char [SHA384_DIGEST_STRING_LENGTH]); +char* fspr__SHA384_Data(const fspr_byte_t *, size_t, char [SHA384_DIGEST_STRING_LENGTH]); -void apr__SHA512_Init(SHA512_CTX *); -void apr__SHA512_Update(SHA512_CTX *, const apr_byte_t *, size_t); -void apr__SHA512_Final(apr_byte_t [SHA512_DIGEST_LENGTH], SHA512_CTX *); -char* apr__SHA512_End(SHA512_CTX *, char [SHA512_DIGEST_STRING_LENGTH]); -char* apr__SHA512_Data(const apr_byte_t *, size_t, +void fspr__SHA512_Init(SHA512_CTX *); +void fspr__SHA512_Update(SHA512_CTX *, const fspr_byte_t *, size_t); +void fspr__SHA512_Final(fspr_byte_t [SHA512_DIGEST_LENGTH], SHA512_CTX *); +char* fspr__SHA512_End(SHA512_CTX *, char [SHA512_DIGEST_STRING_LENGTH]); +char* fspr__SHA512_Data(const fspr_byte_t *, size_t, char [SHA512_DIGEST_STRING_LENGTH]); #ifdef __cplusplus diff --git a/libs/apr/random/unix/sha2_glue.c b/libs/apr/random/unix/sha2_glue.c index 4909a8fe1f..17bc4bd356 100644 --- a/libs/apr/random/unix/sha2_glue.c +++ b/libs/apr/random/unix/sha2_glue.c @@ -1,29 +1,29 @@ -#include -#include -#include +#include +#include +#include #include "sha2.h" -static void sha256_init(apr_crypto_hash_t *h) +static void sha256_init(fspr_crypto_hash_t *h) { - apr__SHA256_Init(h->data); + fspr__SHA256_Init(h->data); } -static void sha256_add(apr_crypto_hash_t *h,const void *data, - apr_size_t bytes) +static void sha256_add(fspr_crypto_hash_t *h,const void *data, + fspr_size_t bytes) { - apr__SHA256_Update(h->data,data,bytes); + fspr__SHA256_Update(h->data,data,bytes); } -static void sha256_finish(apr_crypto_hash_t *h,unsigned char *result) +static void sha256_finish(fspr_crypto_hash_t *h,unsigned char *result) { - apr__SHA256_Final(result,h->data); + fspr__SHA256_Final(result,h->data); } -APR_DECLARE(apr_crypto_hash_t *) apr_crypto_sha256_new(apr_pool_t *p) +APR_DECLARE(fspr_crypto_hash_t *) fspr_crypto_sha256_new(fspr_pool_t *p) { - apr_crypto_hash_t *h=apr_palloc(p,sizeof *h); + fspr_crypto_hash_t *h=fspr_palloc(p,sizeof *h); - h->data=apr_palloc(p,sizeof(SHA256_CTX)); + h->data=fspr_palloc(p,sizeof(SHA256_CTX)); h->init=sha256_init; h->add=sha256_add; h->finish=sha256_finish; diff --git a/libs/apr/renames_pending b/libs/apr/renames_pending index ca007a729c..58757f69b2 100644 --- a/libs/apr/renames_pending +++ b/libs/apr/renames_pending @@ -1,39 +1,39 @@ Pending symbol renames for APR [for some discussion yet] -apr_file_info_t from apr_finfo_t -apr_file_attrs_t from apr_fileattrs_t -apr_file_seek_where_t from apr_seek_where_t +fspr_file_info_t from fspr_finfo_t +fspr_file_attrs_t from fspr_fileattrs_t +fspr_file_seek_where_t from fspr_seek_where_t -#apr_filepath_name_get from apr_filename_of_pathname +#fspr_filepath_name_get from fspr_filename_of_pathname -apr_lock_mech_e from apr_lockmech_e +fspr_lock_mech_e from fspr_lockmech_e -#apr_gid_get from apr_get_groupid -#apr_gid_name_get from apr_get_groupname -#apr_gid_name_get from apr_group_name_get -#apr_gid_compare from apr_compare_groups +#fspr_gid_get from fspr_get_groupid +#fspr_gid_name_get from fspr_get_groupname +#fspr_gid_name_get from fspr_group_name_get +#fspr_gid_compare from fspr_compare_groups -#apr_socket_shutdown from apr_shutdown -#apr_socket_bind from apr_bind -#apr_socket_listen from apr_listen -#apr_socket_accept from apr_accept -#apr_socket_connect from apr_connect -#apr_socket_send from apr_send -#apr_socket_sendv from apr_sendv -#apr_socket_sendto from apr_sendto -#apr_socket_recvfrom from apr_recvfrom -#apr_socket_sendfile from apr_sendfile -#apr_socket_recv from apr_recv -#apr_socket_inherit_set from apr_socket_set_inherit -#apr_socket_inherit_unset from apr_socket_unset_inherit +#fspr_socket_shutdown from fspr_shutdown +#fspr_socket_bind from fspr_bind +#fspr_socket_listen from fspr_listen +#fspr_socket_accept from fspr_accept +#fspr_socket_connect from fspr_connect +#fspr_socket_send from fspr_send +#fspr_socket_sendv from fspr_sendv +#fspr_socket_sendto from fspr_sendto +#fspr_socket_recvfrom from fspr_recvfrom +#fspr_socket_sendfile from fspr_sendfile +#fspr_socket_recv from fspr_recv +#fspr_socket_inherit_set from fspr_socket_set_inherit +#fspr_socket_inherit_unset from fspr_socket_unset_inherit -#apr_time_exp_gmt_get from apr_implode_gmt -apr_time_interval_t from apr_interval_time_t -apr_time_interval_short_t from apr_short_interval_time_t +#fspr_time_exp_gmt_get from fspr_implode_gmt +fspr_time_interval_t from fspr_interval_time_t +fspr_time_interval_short_t from fspr_short_interval_time_t -#apr_uid_homepath_get from apr_get_home_directory -#apr_uid_get from apr_get_userid -#apr_uid_current from apr_current_userid -#apr_uid_compare from apr_compare_users -#apr_uid_name_get from apr_get_username +#fspr_uid_homepath_get from fspr_get_home_directory +#fspr_uid_get from fspr_get_userid +#fspr_uid_current from fspr_current_userid +#fspr_uid_compare from fspr_compare_users +#fspr_uid_name_get from fspr_get_username diff --git a/libs/apr/shmem/beos/shm.c b/libs/apr/shmem/beos/shm.c index 1f06f78acd..f8cb22db29 100644 --- a/libs/apr/shmem/beos/shm.c +++ b/libs/apr/shmem/beos/shm.c @@ -14,44 +14,44 @@ * limitations under the License. */ -#include "apr_general.h" -#include "apr_shm.h" -#include "apr_errno.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_general.h" +#include "fspr_shm.h" +#include "fspr_errno.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #include #include #include -#include "apr_portable.h" +#include "fspr_portable.h" -struct apr_shm_t { - apr_pool_t *pool; +struct fspr_shm_t { + fspr_pool_t *pool; void *memblock; void *ptr; - apr_size_t reqsize; - apr_size_t avail; + fspr_size_t reqsize; + fspr_size_t avail; area_id aid; }; -APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, - apr_size_t reqsize, +APR_DECLARE(fspr_status_t) fspr_shm_create(fspr_shm_t **m, + fspr_size_t reqsize, const char *filename, - apr_pool_t *p) + fspr_pool_t *p) { - apr_size_t pagesize; + fspr_size_t pagesize; area_id newid; char *addr; char shname[B_OS_NAME_LENGTH]; - (*m) = (apr_shm_t *)apr_pcalloc(p, sizeof(apr_shm_t)); + (*m) = (fspr_shm_t *)fspr_pcalloc(p, sizeof(fspr_shm_t)); /* we MUST allocate in pages, so calculate how big an area we need... */ pagesize = ((reqsize + B_PAGE_SIZE - 1) / B_PAGE_SIZE) * B_PAGE_SIZE; if (!filename) { int num = 0; - snprintf(shname, B_OS_NAME_LENGTH, "apr_shmem_%ld", find_thread(NULL)); + snprintf(shname, B_OS_NAME_LENGTH, "fspr_shmem_%ld", find_thread(NULL)); while (find_area(shname) >= 0) - snprintf(shname, B_OS_NAME_LENGTH, "apr_shmem_%ld_%d", + snprintf(shname, B_OS_NAME_LENGTH, "fspr_shmem_%ld_%d", find_thread(NULL), num++); } newid = create_area(filename ? filename : shname, @@ -71,7 +71,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m) +APR_DECLARE(fspr_status_t) fspr_shm_destroy(fspr_shm_t *m) { delete_area(m->aid); m->avail = 0; @@ -79,8 +79,8 @@ APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_shm_remove(const char *filename, + fspr_pool_t *pool) { area_id deleteme = find_area(filename); @@ -91,19 +91,19 @@ APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, +APR_DECLARE(fspr_status_t) fspr_shm_attach(fspr_shm_t **m, const char *filename, - apr_pool_t *pool) + fspr_pool_t *pool) { area_info ai; thread_info ti; - apr_shm_t *new_m; + fspr_shm_t *new_m; area_id deleteme = find_area(filename); if (deleteme == B_NAME_NOT_FOUND) return APR_EINVAL; - new_m = (apr_shm_t*)apr_palloc(pool, sizeof(apr_shm_t*)); + new_m = (fspr_shm_t*)fspr_palloc(pool, sizeof(fspr_shm_t*)); if (new_m == NULL) return APR_ENOMEM; new_m->pool = pool; @@ -133,33 +133,33 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m) +APR_DECLARE(fspr_status_t) fspr_shm_detach(fspr_shm_t *m) { delete_area(m->aid); return APR_SUCCESS; } -APR_DECLARE(void *) apr_shm_baseaddr_get(const apr_shm_t *m) +APR_DECLARE(void *) fspr_shm_baseaddr_get(const fspr_shm_t *m) { return m->memblock; } -APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m) +APR_DECLARE(fspr_size_t) fspr_shm_size_get(const fspr_shm_t *m) { return m->reqsize; } APR_POOL_IMPLEMENT_ACCESSOR(shm) -APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm, - apr_shm_t *shm) +APR_DECLARE(fspr_status_t) fspr_os_shm_get(fspr_os_shm_t *osshm, + fspr_shm_t *shm) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **m, - apr_os_shm_t *osshm, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_shm_put(fspr_shm_t **m, + fspr_os_shm_t *osshm, + fspr_pool_t *pool) { return APR_ENOTIMPL; } diff --git a/libs/apr/shmem/os2/shm.c b/libs/apr/shmem/os2/shm.c index 340cae4074..c08f517818 100644 --- a/libs/apr/shmem/os2/shm.c +++ b/libs/apr/shmem/os2/shm.c @@ -14,32 +14,32 @@ * limitations under the License. */ -#include "apr_general.h" -#include "apr_shm.h" -#include "apr_errno.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_general.h" +#include "fspr_shm.h" +#include "fspr_errno.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_portable.h" -struct apr_shm_t { - apr_pool_t *pool; +struct fspr_shm_t { + fspr_pool_t *pool; void *memblock; }; -APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, - apr_size_t reqsize, +APR_DECLARE(fspr_status_t) fspr_shm_create(fspr_shm_t **m, + fspr_size_t reqsize, const char *filename, - apr_pool_t *pool) + fspr_pool_t *pool) { int rc; - apr_shm_t *newm = (apr_shm_t *)apr_palloc(pool, sizeof(apr_shm_t)); + fspr_shm_t *newm = (fspr_shm_t *)fspr_palloc(pool, sizeof(fspr_shm_t)); char *name = NULL; ULONG flags = PAG_COMMIT|PAG_READ|PAG_WRITE; newm->pool = pool; if (filename) { - name = apr_pstrcat(pool, "\\SHAREMEM\\", filename, NULL); + name = fspr_pstrcat(pool, "\\SHAREMEM\\", filename, NULL); } if (name == NULL) { @@ -56,29 +56,29 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m) +APR_DECLARE(fspr_status_t) fspr_shm_destroy(fspr_shm_t *m) { DosFreeMem(m->memblock); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_shm_remove(const char *filename, + fspr_pool_t *pool) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, +APR_DECLARE(fspr_status_t) fspr_shm_attach(fspr_shm_t **m, const char *filename, - apr_pool_t *pool) + fspr_pool_t *pool) { int rc; - apr_shm_t *newm = (apr_shm_t *)apr_palloc(pool, sizeof(apr_shm_t)); + fspr_shm_t *newm = (fspr_shm_t *)fspr_palloc(pool, sizeof(fspr_shm_t)); char *name = NULL; ULONG flags = PAG_READ|PAG_WRITE; newm->pool = pool; - name = apr_pstrcat(pool, "\\SHAREMEM\\", filename, NULL); + name = fspr_pstrcat(pool, "\\SHAREMEM\\", filename, NULL); rc = DosGetNamedSharedMem(&(newm->memblock), name, flags); @@ -90,7 +90,7 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m) +APR_DECLARE(fspr_status_t) fspr_shm_detach(fspr_shm_t *m) { int rc = 0; @@ -101,12 +101,12 @@ APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m) return APR_FROM_OS_ERROR(rc); } -APR_DECLARE(void *) apr_shm_baseaddr_get(const apr_shm_t *m) +APR_DECLARE(void *) fspr_shm_baseaddr_get(const fspr_shm_t *m) { return m->memblock; } -APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m) +APR_DECLARE(fspr_size_t) fspr_shm_size_get(const fspr_shm_t *m) { ULONG flags, size = 0x1000000; DosQueryMem(m->memblock, &size, &flags); @@ -115,19 +115,19 @@ APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m) APR_POOL_IMPLEMENT_ACCESSOR(shm) -APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm, - apr_shm_t *shm) +APR_DECLARE(fspr_status_t) fspr_os_shm_get(fspr_os_shm_t *osshm, + fspr_shm_t *shm) { *osshm = shm->memblock; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **m, - apr_os_shm_t *osshm, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_shm_put(fspr_shm_t **m, + fspr_os_shm_t *osshm, + fspr_pool_t *pool) { int rc; - apr_shm_t *newm = (apr_shm_t *)apr_palloc(pool, sizeof(apr_shm_t)); + fspr_shm_t *newm = (fspr_shm_t *)fspr_palloc(pool, sizeof(fspr_shm_t)); ULONG flags = PAG_COMMIT|PAG_READ|PAG_WRITE; newm->pool = pool; diff --git a/libs/apr/shmem/unix/shm.c b/libs/apr/shmem/unix/shm.c index 95d1c053f0..36b16d91cc 100644 --- a/libs/apr/shmem/unix/shm.c +++ b/libs/apr/shmem/unix/shm.c @@ -14,16 +14,16 @@ * limitations under the License. */ -#include "apr_arch_shm.h" +#include "fspr_arch_shm.h" -#include "apr_general.h" -#include "apr_errno.h" -#include "apr_user.h" -#include "apr_strings.h" +#include "fspr_general.h" +#include "fspr_errno.h" +#include "fspr_user.h" +#include "fspr_strings.h" -static apr_status_t shm_cleanup_owner(void *m_) +static fspr_status_t shm_cleanup_owner(void *m_) { - apr_shm_t *m = (apr_shm_t *)m_; + fspr_shm_t *m = (fspr_shm_t *)m_; /* anonymous shared memory */ if (m->filename == NULL) { @@ -49,7 +49,7 @@ static apr_status_t shm_cleanup_owner(void *m_) if (munmap(m->base, m->realsize) == -1) { return errno; } - return apr_file_remove(m->filename, m->pool); + return fspr_file_remove(m->filename, m->pool); #endif #if APR_USE_SHMEM_MMAP_SHM if (munmap(m->base, m->realsize) == -1) { @@ -70,55 +70,55 @@ static apr_status_t shm_cleanup_owner(void *m_) if (shmdt(m->base) == -1) { return errno; } - return apr_file_remove(m->filename, m->pool); + return fspr_file_remove(m->filename, m->pool); #endif } return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, - apr_size_t reqsize, +APR_DECLARE(fspr_status_t) fspr_shm_create(fspr_shm_t **m, + fspr_size_t reqsize, const char *filename, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_shm_t *new_m; - apr_status_t status; + fspr_shm_t *new_m; + fspr_status_t status; #if APR_USE_SHMEM_SHMGET || APR_USE_SHMEM_SHMGET_ANON struct shmid_ds shmbuf; - apr_uid_t uid; - apr_gid_t gid; + fspr_uid_t uid; + fspr_gid_t gid; #endif #if APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM || \ APR_USE_SHMEM_MMAP_ZERO int tmpfd; #endif #if APR_USE_SHMEM_SHMGET - apr_size_t nbytes; + fspr_size_t nbytes; key_t shmkey; #endif #if APR_USE_SHMEM_MMAP_ZERO || APR_USE_SHMEM_SHMGET || \ APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM - apr_file_t *file; /* file where metadata is stored */ + fspr_file_t *file; /* file where metadata is stored */ #endif /* Check if they want anonymous or name-based shared memory */ if (filename == NULL) { #if APR_USE_SHMEM_MMAP_ZERO || APR_USE_SHMEM_MMAP_ANON - new_m = apr_palloc(pool, sizeof(apr_shm_t)); + new_m = fspr_palloc(pool, sizeof(fspr_shm_t)); new_m->pool = pool; new_m->reqsize = reqsize; new_m->realsize = reqsize + - APR_ALIGN_DEFAULT(sizeof(apr_size_t)); /* room for metadata */ + APR_ALIGN_DEFAULT(sizeof(fspr_size_t)); /* room for metadata */ new_m->filename = NULL; #if APR_USE_SHMEM_MMAP_ZERO - status = apr_file_open(&file, "/dev/zero", APR_READ | APR_WRITE, + status = fspr_file_open(&file, "/dev/zero", APR_READ | APR_WRITE, APR_OS_DEFAULT, pool); if (status != APR_SUCCESS) { return status; } - status = apr_os_file_get(&tmpfd, file); + status = fspr_os_file_get(&tmpfd, file); if (status != APR_SUCCESS) { return status; } @@ -129,18 +129,18 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, return errno; } - status = apr_file_close(file); + status = fspr_file_close(file); if (status != APR_SUCCESS) { return status; } /* store the real size in the metadata */ - *(apr_size_t*)(new_m->base) = new_m->realsize; + *(fspr_size_t*)(new_m->base) = new_m->realsize; /* metadata isn't usable */ - new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(apr_size_t)); + new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(fspr_size_t)); - apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, + fspr_pool_cleanup_null); *m = new_m; return APR_SUCCESS; @@ -152,12 +152,12 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, } /* store the real size in the metadata */ - *(apr_size_t*)(new_m->base) = new_m->realsize; + *(fspr_size_t*)(new_m->base) = new_m->realsize; /* metadata isn't usable */ - new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(apr_size_t)); + new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(fspr_size_t)); - apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, + fspr_pool_cleanup_null); *m = new_m; return APR_SUCCESS; @@ -165,7 +165,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, #endif /* APR_USE_SHMEM_MMAP_ZERO || APR_USE_SHMEM_MMAP_ANON */ #if APR_USE_SHMEM_SHMGET_ANON - new_m = apr_palloc(pool, sizeof(apr_shm_t)); + new_m = fspr_palloc(pool, sizeof(fspr_shm_t)); new_m->pool = pool; new_m->reqsize = reqsize; new_m->realsize = reqsize; @@ -184,7 +184,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, if (shmctl(new_m->shmid, IPC_STAT, &shmbuf) == -1) { return errno; } - apr_uid_current(&uid, &gid, pool); + fspr_uid_current(&uid, &gid, pool); shmbuf.shm_perm.uid = uid; shmbuf.shm_perm.gid = gid; if (shmctl(new_m->shmid, IPC_SET, &shmbuf) == -1) { @@ -199,8 +199,8 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, return errno; } - apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, + fspr_pool_cleanup_null); *m = new_m; return APR_SUCCESS; #endif /* APR_USE_SHMEM_SHMGET_ANON */ @@ -210,38 +210,38 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, /* Name-based shared memory */ else { - new_m = apr_palloc(pool, sizeof(apr_shm_t)); + new_m = fspr_palloc(pool, sizeof(fspr_shm_t)); new_m->pool = pool; new_m->reqsize = reqsize; - new_m->filename = apr_pstrdup(pool, filename); + new_m->filename = fspr_pstrdup(pool, filename); #if APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM new_m->realsize = reqsize + - APR_ALIGN_DEFAULT(sizeof(apr_size_t)); /* room for metadata */ + APR_ALIGN_DEFAULT(sizeof(fspr_size_t)); /* room for metadata */ /* FIXME: Ignore error for now. * - * status = apr_file_remove(file, pool);*/ + * status = fspr_file_remove(file, pool);*/ status = APR_SUCCESS; #if APR_USE_SHMEM_MMAP_TMP /* FIXME: Is APR_OS_DEFAULT sufficient? */ - status = apr_file_open(&file, filename, + status = fspr_file_open(&file, filename, APR_READ | APR_WRITE | APR_CREATE | APR_EXCL, APR_OS_DEFAULT, pool); if (status != APR_SUCCESS) { return status; } - status = apr_os_file_get(&tmpfd, file); + status = fspr_os_file_get(&tmpfd, file); if (status != APR_SUCCESS) { - apr_file_close(file); /* ignore errors, we're failing */ - apr_file_remove(new_m->filename, new_m->pool); + fspr_file_close(file); /* ignore errors, we're failing */ + fspr_file_remove(new_m->filename, new_m->pool); return status; } - status = apr_file_trunc(file, new_m->realsize); + status = fspr_file_trunc(file, new_m->realsize); if (status != APR_SUCCESS) { - apr_file_close(file); /* ignore errors, we're failing */ - apr_file_remove(new_m->filename, new_m->pool); + fspr_file_close(file); /* ignore errors, we're failing */ + fspr_file_remove(new_m->filename, new_m->pool); return status; } @@ -249,7 +249,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, MAP_SHARED, tmpfd, 0); /* FIXME: check for errors */ - status = apr_file_close(file); + status = fspr_file_close(file); if (status != APR_SUCCESS) { return status; } @@ -260,14 +260,14 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, return errno; } - status = apr_os_file_put(&file, &tmpfd, + status = fspr_os_file_put(&file, &tmpfd, APR_READ | APR_WRITE | APR_CREATE | APR_EXCL, pool); if (status != APR_SUCCESS) { return status; } - status = apr_file_trunc(file, new_m->realsize); + status = fspr_file_trunc(file, new_m->realsize); if (status != APR_SUCCESS) { shm_unlink(filename); /* we're failing, remove the object */ return status; @@ -277,19 +277,19 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, /* FIXME: check for errors */ - status = apr_file_close(file); + status = fspr_file_close(file); if (status != APR_SUCCESS) { return status; } #endif /* APR_USE_SHMEM_MMAP_SHM */ /* store the real size in the metadata */ - *(apr_size_t*)(new_m->base) = new_m->realsize; + *(fspr_size_t*)(new_m->base) = new_m->realsize; /* metadata isn't usable */ - new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(apr_size_t)); + new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(fspr_size_t)); - apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, + fspr_pool_cleanup_null); *m = new_m; return APR_SUCCESS; @@ -299,7 +299,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, new_m->realsize = reqsize; /* FIXME: APR_OS_DEFAULT is too permissive, switch to 600 I think. */ - status = apr_file_open(&file, filename, + status = fspr_file_open(&file, filename, APR_WRITE | APR_CREATE | APR_EXCL, APR_OS_DEFAULT, pool); if (status != APR_SUCCESS) { @@ -326,7 +326,7 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, if (shmctl(new_m->shmid, IPC_STAT, &shmbuf) == -1) { return errno; } - apr_uid_current(&uid, &gid, pool); + fspr_uid_current(&uid, &gid, pool); shmbuf.shm_perm.uid = uid; shmbuf.shm_perm.gid = gid; if (shmctl(new_m->shmid, IPC_SET, &shmbuf) == -1) { @@ -334,18 +334,18 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, } nbytes = sizeof(reqsize); - status = apr_file_write(file, (const void *)&reqsize, + status = fspr_file_write(file, (const void *)&reqsize, &nbytes); if (status != APR_SUCCESS) { return status; } - status = apr_file_close(file); + status = fspr_file_close(file); if (status != APR_SUCCESS) { return status; } - apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_owner, + fspr_pool_cleanup_null); *m = new_m; return APR_SUCCESS; @@ -355,18 +355,18 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_shm_remove(const char *filename, + fspr_pool_t *pool) { #if APR_USE_SHMEM_SHMGET - apr_status_t status; - apr_file_t *file; + fspr_status_t status; + fspr_file_t *file; key_t shmkey; int shmid; #endif #if APR_USE_SHMEM_MMAP_TMP - return apr_file_remove(filename, pool); + return fspr_file_remove(filename, pool); #endif #if APR_USE_SHMEM_MMAP_SHM if (shm_unlink(filename) == -1) { @@ -376,7 +376,7 @@ APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, #endif #if APR_USE_SHMEM_SHMGET /* Presume that the file already exists; just open for writing */ - status = apr_file_open(&file, filename, APR_WRITE, + status = fspr_file_open(&file, filename, APR_WRITE, APR_OS_DEFAULT, pool); if (status) { return status; @@ -389,7 +389,7 @@ APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, goto shm_remove_failed; } - apr_file_close(file); + fspr_file_close(file); if ((shmid = shmget(shmkey, 0, SHM_R | SHM_W)) < 0) { goto shm_remove_failed; @@ -401,12 +401,12 @@ APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, if (shmctl(shmid, IPC_RMID, NULL) == -1) { goto shm_remove_failed; } - return apr_file_remove(filename, pool); + return fspr_file_remove(filename, pool); shm_remove_failed: status = errno; /* ensure the file has been removed anyway. */ - apr_file_remove(filename, pool); + fspr_file_remove(filename, pool); return status; #endif @@ -414,14 +414,14 @@ shm_remove_failed: return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m) +APR_DECLARE(fspr_status_t) fspr_shm_destroy(fspr_shm_t *m) { - return apr_pool_cleanup_run(m->pool, m, shm_cleanup_owner); + return fspr_pool_cleanup_run(m->pool, m, shm_cleanup_owner); } -static apr_status_t shm_cleanup_attach(void *m_) +static fspr_status_t shm_cleanup_attach(void *m_) { - apr_shm_t *m = (apr_shm_t *)m_; + fspr_shm_t *m = (fspr_shm_t *)m_; if (m->filename == NULL) { /* It doesn't make sense to detach from an anonymous memory segment. */ @@ -445,9 +445,9 @@ static apr_status_t shm_cleanup_attach(void *m_) return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, +APR_DECLARE(fspr_status_t) fspr_shm_attach(fspr_shm_t **m, const char *filename, - apr_pool_t *pool) + fspr_pool_t *pool) { if (filename == NULL) { /* It doesn't make sense to attach to a segment if you don't know @@ -456,88 +456,88 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, } else { #if APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM - apr_shm_t *new_m; - apr_status_t status; + fspr_shm_t *new_m; + fspr_status_t status; int tmpfd; - apr_file_t *file; /* file where metadata is stored */ - apr_size_t nbytes; + fspr_file_t *file; /* file where metadata is stored */ + fspr_size_t nbytes; - new_m = apr_palloc(pool, sizeof(apr_shm_t)); + new_m = fspr_palloc(pool, sizeof(fspr_shm_t)); new_m->pool = pool; - new_m->filename = apr_pstrdup(pool, filename); + new_m->filename = fspr_pstrdup(pool, filename); - status = apr_file_open(&file, filename, + status = fspr_file_open(&file, filename, APR_READ | APR_WRITE, APR_OS_DEFAULT, pool); if (status != APR_SUCCESS) { return status; } - status = apr_os_file_get(&tmpfd, file); + status = fspr_os_file_get(&tmpfd, file); if (status != APR_SUCCESS) { return status; } nbytes = sizeof(new_m->realsize); - status = apr_file_read(file, (void *)&(new_m->realsize), + status = fspr_file_read(file, (void *)&(new_m->realsize), &nbytes); if (status != APR_SUCCESS) { return status; } - status = apr_os_file_get(&tmpfd, file); + status = fspr_os_file_get(&tmpfd, file); if (status != APR_SUCCESS) { - apr_file_close(file); /* ignore errors, we're failing */ - apr_file_remove(new_m->filename, new_m->pool); + fspr_file_close(file); /* ignore errors, we're failing */ + fspr_file_remove(new_m->filename, new_m->pool); return status; } - new_m->reqsize = new_m->realsize - sizeof(apr_size_t); + new_m->reqsize = new_m->realsize - sizeof(fspr_size_t); new_m->base = mmap(NULL, new_m->realsize, PROT_READ | PROT_WRITE, MAP_SHARED, tmpfd, 0); /* FIXME: check for errors */ - status = apr_file_close(file); + status = fspr_file_close(file); if (status != APR_SUCCESS) { return status; } /* metadata isn't part of the usable segment */ - new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(apr_size_t)); + new_m->usable = (char *)new_m->base + APR_ALIGN_DEFAULT(sizeof(fspr_size_t)); - apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_attach, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_attach, + fspr_pool_cleanup_null); *m = new_m; return APR_SUCCESS; #endif /* APR_USE_SHMEM_MMAP_TMP || APR_USE_SHMEM_MMAP_SHM */ #if APR_USE_SHMEM_SHMGET - apr_shm_t *new_m; - apr_status_t status; - apr_file_t *file; /* file where metadata is stored */ - apr_size_t nbytes; + fspr_shm_t *new_m; + fspr_status_t status; + fspr_file_t *file; /* file where metadata is stored */ + fspr_size_t nbytes; key_t shmkey; - new_m = apr_palloc(pool, sizeof(apr_shm_t)); + new_m = fspr_palloc(pool, sizeof(fspr_shm_t)); - status = apr_file_open(&file, filename, + status = fspr_file_open(&file, filename, APR_READ, APR_OS_DEFAULT, pool); if (status != APR_SUCCESS) { return status; } nbytes = sizeof(new_m->reqsize); - status = apr_file_read(file, (void *)&(new_m->reqsize), + status = fspr_file_read(file, (void *)&(new_m->reqsize), &nbytes); if (status != APR_SUCCESS) { return status; } - status = apr_file_close(file); + status = fspr_file_close(file); if (status != APR_SUCCESS) { return status; } - new_m->filename = apr_pstrdup(pool, filename); + new_m->filename = fspr_pstrdup(pool, filename); new_m->pool = pool; shmkey = ftok(filename, 1); if (shmkey == (key_t)-1) { @@ -552,8 +552,8 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, new_m->usable = new_m->base; new_m->realsize = new_m->reqsize; - apr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_attach, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(new_m->pool, new_m, shm_cleanup_attach, + fspr_pool_cleanup_null); *m = new_m; return APR_SUCCESS; @@ -563,34 +563,34 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m) +APR_DECLARE(fspr_status_t) fspr_shm_detach(fspr_shm_t *m) { - apr_status_t rv = shm_cleanup_attach(m); - apr_pool_cleanup_kill(m->pool, m, shm_cleanup_attach); + fspr_status_t rv = shm_cleanup_attach(m); + fspr_pool_cleanup_kill(m->pool, m, shm_cleanup_attach); return rv; } -APR_DECLARE(void *) apr_shm_baseaddr_get(const apr_shm_t *m) +APR_DECLARE(void *) fspr_shm_baseaddr_get(const fspr_shm_t *m) { return m->usable; } -APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m) +APR_DECLARE(fspr_size_t) fspr_shm_size_get(const fspr_shm_t *m) { return m->reqsize; } APR_POOL_IMPLEMENT_ACCESSOR(shm) -APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm, - apr_shm_t *shm) +APR_DECLARE(fspr_status_t) fspr_os_shm_get(fspr_os_shm_t *osshm, + fspr_shm_t *shm) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **m, - apr_os_shm_t *osshm, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_shm_put(fspr_shm_t **m, + fspr_os_shm_t *osshm, + fspr_pool_t *pool) { return APR_ENOTIMPL; } diff --git a/libs/apr/shmem/win32/shm.c b/libs/apr/shmem/win32/shm.c index 36af743964..15578f553e 100644 --- a/libs/apr/shmem/win32/shm.c +++ b/libs/apr/shmem/win32/shm.c @@ -14,54 +14,54 @@ * limitations under the License. */ -#include "apr_general.h" -#include "apr_errno.h" -#include "apr_file_io.h" -#include "apr_shm.h" -#include "apr_arch_file_io.h" +#include "fspr_general.h" +#include "fspr_errno.h" +#include "fspr_file_io.h" +#include "fspr_shm.h" +#include "fspr_arch_file_io.h" #include "limits.h" typedef struct memblock_t { - apr_size_t size; - apr_size_t length; + fspr_size_t size; + fspr_size_t length; } memblock_t; -struct apr_shm_t { - apr_pool_t *pool; +struct fspr_shm_t { + fspr_pool_t *pool; memblock_t *memblk; void *usrmem; - apr_size_t size; - apr_size_t length; + fspr_size_t size; + fspr_size_t length; HANDLE hMap; }; -static apr_status_t shm_cleanup(void* shm) +static fspr_status_t shm_cleanup(void* shm) { - apr_status_t rv = APR_SUCCESS; - apr_shm_t *m = shm; + fspr_status_t rv = APR_SUCCESS; + fspr_shm_t *m = shm; if (UnmapViewOfFile(m->memblk)) { - rv = apr_get_os_error(); + rv = fspr_get_os_error(); } if (CloseHandle(m->hMap)) { - return (rv != APR_SUCCESS) ? rv : apr_get_os_error(); + return (rv != APR_SUCCESS) ? rv : fspr_get_os_error(); } /* ### Do we want to make a point of unlinking m->file here? - * Need to add the fname to the apr_shm_t, in that case. + * Need to add the fname to the fspr_shm_t, in that case. */ return rv; } -APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, - apr_size_t reqsize, +APR_DECLARE(fspr_status_t) fspr_shm_create(fspr_shm_t **m, + fspr_size_t reqsize, const char *file, - apr_pool_t *pool) + fspr_pool_t *pool) { - static apr_size_t memblock = 0; + static fspr_size_t memblock = 0; HANDLE hMap, hFile; - apr_status_t rv; - apr_size_t size; - apr_file_t *f; + fspr_status_t rv; + fspr_size_t size; + fspr_file_t *f; void *base; void *mapkey; DWORD err, sizelo, sizehi; @@ -97,14 +97,14 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, * ever did. Ignore that error here, but fail later when * we discover we aren't the creator of the file map object. */ - rv = apr_file_open(&f, file, + rv = fspr_file_open(&f, file, APR_READ | APR_WRITE | APR_BINARY | APR_CREATE, APR_UREAD | APR_UWRITE, pool); if ((rv != APR_SUCCESS) - || ((rv = apr_os_file_get(&hFile, f)) != APR_SUCCESS)) { + || ((rv = fspr_os_file_get(&hFile, f)) != APR_SUCCESS)) { return rv; } - rv = apr_file_trunc(f, size); + rv = fspr_file_trunc(f, size); /* res_name_from_filename turns file into a pseudo-name * without slashes or backslashes, and prepends the \global @@ -127,10 +127,10 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, sizehi, sizelo, mapkey); } #endif - err = apr_get_os_error(); + err = fspr_get_os_error(); if (file) { - apr_file_close(f); + fspr_file_close(f); } if (hMap && err == ERROR_ALREADY_EXISTS) { @@ -145,10 +145,10 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, 0, 0, size); if (!base) { CloseHandle(hMap); - return apr_get_os_error(); + return fspr_get_os_error(); } - *m = (apr_shm_t *) apr_palloc(pool, sizeof(apr_shm_t)); + *m = (fspr_shm_t *) fspr_palloc(pool, sizeof(fspr_shm_t)); (*m)->pool = pool; (*m)->hMap = hMap; (*m)->memblk = base; @@ -160,27 +160,27 @@ APR_DECLARE(apr_status_t) apr_shm_create(apr_shm_t **m, (*m)->memblk->length = (*m)->length; (*m)->memblk->size = (*m)->size; - apr_pool_cleanup_register((*m)->pool, *m, - shm_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*m)->pool, *m, + shm_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_destroy(apr_shm_t *m) +APR_DECLARE(fspr_status_t) fspr_shm_destroy(fspr_shm_t *m) { - apr_status_t rv = shm_cleanup(m); - apr_pool_cleanup_kill(m->pool, m, shm_cleanup); + fspr_status_t rv = shm_cleanup(m); + fspr_pool_cleanup_kill(m->pool, m, shm_cleanup); return rv; } -APR_DECLARE(apr_status_t) apr_shm_remove(const char *filename, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_shm_remove(const char *filename, + fspr_pool_t *pool) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, +APR_DECLARE(fspr_status_t) fspr_shm_attach(fspr_shm_t **m, const char *file, - apr_pool_t *pool) + fspr_pool_t *pool) { HANDLE hMap; void *mapkey; @@ -207,7 +207,7 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, * opening the existing shmem and reading its size from the header */ hMap = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, - PAGE_READWRITE, 0, sizeof(apr_shm_t), mapkey); + PAGE_READWRITE, 0, sizeof(fspr_shm_t), mapkey); #endif } #endif @@ -219,16 +219,16 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, #endif if (!hMap) { - return apr_get_os_error(); + return fspr_get_os_error(); } base = MapViewOfFile(hMap, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0); if (!base) { CloseHandle(hMap); - return apr_get_os_error(); + return fspr_get_os_error(); } - *m = (apr_shm_t *) apr_palloc(pool, sizeof(apr_shm_t)); + *m = (fspr_shm_t *) fspr_palloc(pool, sizeof(fspr_shm_t)); (*m)->pool = pool; (*m)->memblk = base; /* Real (*m)->mem->size could be recovered with VirtualQuery */ @@ -241,59 +241,59 @@ APR_DECLARE(apr_status_t) apr_shm_attach(apr_shm_t **m, hMap = CreateFileMappingW(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, (*m)->size, mapkey); if (!hMap) { - return apr_get_os_error(); + return fspr_get_os_error(); } base = MapViewOfFile(hMap, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0); if (!base) { CloseHandle(hMap); - return apr_get_os_error(); + return fspr_get_os_error(); } #endif (*m)->hMap = hMap; (*m)->length = (*m)->memblk->length; (*m)->usrmem = (char*)base + sizeof(memblock_t); - apr_pool_cleanup_register((*m)->pool, *m, - shm_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*m)->pool, *m, + shm_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_shm_detach(apr_shm_t *m) +APR_DECLARE(fspr_status_t) fspr_shm_detach(fspr_shm_t *m) { - apr_status_t rv = shm_cleanup(m); - apr_pool_cleanup_kill(m->pool, m, shm_cleanup); + fspr_status_t rv = shm_cleanup(m); + fspr_pool_cleanup_kill(m->pool, m, shm_cleanup); return rv; } -APR_DECLARE(void *) apr_shm_baseaddr_get(const apr_shm_t *m) +APR_DECLARE(void *) fspr_shm_baseaddr_get(const fspr_shm_t *m) { return m->usrmem; } -APR_DECLARE(apr_size_t) apr_shm_size_get(const apr_shm_t *m) +APR_DECLARE(fspr_size_t) fspr_shm_size_get(const fspr_shm_t *m) { return m->length; } APR_POOL_IMPLEMENT_ACCESSOR(shm) -APR_DECLARE(apr_status_t) apr_os_shm_get(apr_os_shm_t *osshm, - apr_shm_t *shm) +APR_DECLARE(fspr_status_t) fspr_os_shm_get(fspr_os_shm_t *osshm, + fspr_shm_t *shm) { *osshm = shm->hMap; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **m, - apr_os_shm_t *osshm, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_shm_put(fspr_shm_t **m, + fspr_os_shm_t *osshm, + fspr_pool_t *pool) { void* base; base = MapViewOfFile(*osshm, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0); if (!base) { - return apr_get_os_error(); + return fspr_get_os_error(); } - *m = (apr_shm_t *) apr_palloc(pool, sizeof(apr_shm_t)); + *m = (fspr_shm_t *) fspr_palloc(pool, sizeof(fspr_shm_t)); (*m)->pool = pool; (*m)->hMap = *osshm; (*m)->memblk = base; @@ -302,8 +302,8 @@ APR_DECLARE(apr_status_t) apr_os_shm_put(apr_shm_t **m, (*m)->size = (*m)->memblk->size; (*m)->length = (*m)->memblk->length; - apr_pool_cleanup_register((*m)->pool, *m, - shm_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register((*m)->pool, *m, + shm_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } diff --git a/libs/apr/strings/apr_cpystrn.c b/libs/apr/strings/fspr_cpystrn.c similarity index 89% rename from libs/apr/strings/apr_cpystrn.c rename to libs/apr/strings/fspr_cpystrn.c index 888b2e5db6..704ebca623 100644 --- a/libs/apr/strings/apr_cpystrn.c +++ b/libs/apr/strings/fspr_cpystrn.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_strings.h" -#include "apr_private.h" -#include "apr_lib.h" +#include "fspr.h" +#include "fspr_strings.h" +#include "fspr_private.h" +#include "fspr_lib.h" #if APR_HAVE_SYS_TYPES_H #include @@ -39,10 +39,10 @@ * the destination string, we return a pointer to the * terminating '\0' to allow us to "check" for truncation * - * apr_cpystrn() follows the same call structure as strncpy(). + * fspr_cpystrn() follows the same call structure as strncpy(). */ -APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src, apr_size_t dst_size) +APR_DECLARE(char *) fspr_cpystrn(char *dst, const char *src, fspr_size_t dst_size) { char *d, *end; @@ -70,7 +70,7 @@ APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src, apr_size_t dst_size) * This function provides a way to parse a generic argument string * into a standard argv[] form of argument list. It respects the * usual "whitespace" and quoteing rules. In the future this could - * be expanded to include support for the apr_call_exec command line + * be expanded to include support for the fspr_call_exec command line * string processing (including converting '+' to ' ' and doing the * url processing. It does not currently support this function. * @@ -82,9 +82,9 @@ APR_DECLARE(char *) apr_cpystrn(char *dst, const char *src, apr_size_t dst_size) * pool and filled in with copies of the tokens * found during parsing of the arg_str. */ -APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, +APR_DECLARE(fspr_status_t) fspr_tokenize_to_argv(const char *arg_str, char ***argv_out, - apr_pool_t *token_context) + fspr_pool_t *token_context) { const char *cp; const char *ct; @@ -165,7 +165,7 @@ APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, numargs++; SKIP_WHITESPACE(ct); } - *argv_out = apr_palloc(token_context, numargs * sizeof(char*)); + *argv_out = fspr_palloc(token_context, numargs * sizeof(char*)); /* determine first argument */ for (argnum = 0; argnum < (numargs-1); argnum++) { @@ -174,8 +174,8 @@ APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, ct = cp; DETERMINE_NEXTSTRING(cp, isquoted); cp++; - (*argv_out)[argnum] = apr_palloc(token_context, cp - ct); - apr_cpystrn((*argv_out)[argnum], ct, cp - ct); + (*argv_out)[argnum] = fspr_palloc(token_context, cp - ct); + fspr_cpystrn((*argv_out)[argnum], ct, cp - ct); cleaned = dirty = (*argv_out)[argnum]; REMOVE_ESCAPE_CHARS(cleaned, dirty, escaped); } @@ -194,7 +194,7 @@ APR_DECLARE(apr_status_t) apr_tokenize_to_argv(const char *arg_str, * Corrected Win32 to accept "a/b\\stuff", "a:stuff" */ -APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname) +APR_DECLARE(const char *) fspr_filepath_name_get(const char *pathname) { const char path_separator = '/'; const char *s = strrchr(pathname, path_separator); @@ -216,10 +216,10 @@ APR_DECLARE(const char *) apr_filepath_name_get(const char *pathname) * collapse in place (src == dest) is legal. * returns terminating null ptr to dest string. */ -APR_DECLARE(char *) apr_collapse_spaces(char *dest, const char *src) +APR_DECLARE(char *) fspr_collapse_spaces(char *dest, const char *src) { while (*src) { - if (!apr_isspace(*src)) + if (!fspr_isspace(*src)) *dest++ = *src; ++src; } @@ -247,7 +247,7 @@ int strcasecmp(const char *a, const char *b) const char *p = a; const char *q = b; for (p = a, q = b; *p && *q; p++, q++) { - int diff = apr_tolower(*p) - apr_tolower(*q); + int diff = fspr_tolower(*p) - fspr_tolower(*q); if (diff) return diff; } @@ -272,7 +272,7 @@ int strncasecmp(const char *a, const char *b, size_t n) return 0; /* Match up to n characters */ if (!(*p && *q)) return *p - *q; - diff = apr_tolower(*p) - apr_tolower(*q); + diff = fspr_tolower(*p) - fspr_tolower(*q); if (diff) return diff; } diff --git a/libs/apr/strings/apr_fnmatch.c b/libs/apr/strings/fspr_fnmatch.c similarity index 84% rename from libs/apr/strings/apr_fnmatch.c rename to libs/apr/strings/fspr_fnmatch.c index 7c41ea6585..d65570cf67 100644 --- a/libs/apr/strings/apr_fnmatch.c +++ b/libs/apr/strings/fspr_fnmatch.c @@ -43,13 +43,13 @@ static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; * Compares a filename or pathname to a pattern. */ #ifndef WIN32 -#include "apr_private.h" +#include "fspr_private.h" #endif -#include "apr_file_info.h" -#include "apr_fnmatch.h" -#include "apr_tables.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_file_info.h" +#include "fspr_fnmatch.h" +#include "fspr_tables.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #include #if APR_HAVE_CTYPE_H # include @@ -59,7 +59,7 @@ static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94"; static const char *rangematch(const char *, int, int); -APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern, const char *string, int flags) +APR_DECLARE(fspr_status_t) fspr_fnmatch(const char *pattern, const char *string, int flags) { const char *stringstart; char c, test; @@ -113,7 +113,7 @@ APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern, const char *string, i /* General case, use recursion. */ while ((test = *string) != EOS) { - if (!apr_fnmatch(pattern, string, flags & ~APR_FNM_PERIOD)) { + if (!fspr_fnmatch(pattern, string, flags & ~APR_FNM_PERIOD)) { return (APR_SUCCESS); } if (test == '/' && flags & APR_FNM_PATHNAME) { @@ -149,7 +149,7 @@ APR_DECLARE(apr_status_t) apr_fnmatch(const char *pattern, const char *string, i /* FALLTHROUGH */ default: if (flags & APR_FNM_CASE_BLIND) { - if (apr_tolower(c) != apr_tolower(*string)) { + if (fspr_tolower(c) != fspr_tolower(*string)) { return (APR_FNM_NOMATCH); } } @@ -196,14 +196,14 @@ static const char *rangematch(const char *pattern, int test, int flags) } if ((c <= test && test <= c2) || ((flags & APR_FNM_CASE_BLIND) - && ((apr_tolower(c) <= apr_tolower(test)) - && (apr_tolower(test) <= apr_tolower(c2))))) { + && ((fspr_tolower(c) <= fspr_tolower(test)) + && (fspr_tolower(test) <= fspr_tolower(c2))))) { ok = 1; } } else if ((c == test) || ((flags & APR_FNM_CASE_BLIND) - && (apr_tolower(c) == apr_tolower(test)))) { + && (fspr_tolower(c) == fspr_tolower(test)))) { ok = 1; } } @@ -213,7 +213,7 @@ static const char *rangematch(const char *pattern, int test, int flags) /* This function is an Apache addition */ /* return non-zero if pattern has any glob chars in it */ -APR_DECLARE(int) apr_fnmatch_test(const char *pattern) +APR_DECLARE(int) fspr_fnmatch_test(const char *pattern) { int nesting; @@ -246,13 +246,13 @@ APR_DECLARE(int) apr_fnmatch_test(const char *pattern) } /* Find all files matching the specified pattern */ -APR_DECLARE(apr_status_t) apr_match_glob(const char *pattern, - apr_array_header_t **result, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_match_glob(const char *pattern, + fspr_array_header_t **result, + fspr_pool_t *p) { - apr_dir_t *dir; - apr_finfo_t finfo; - apr_status_t rv; + fspr_dir_t *dir; + fspr_finfo_t finfo; + fspr_status_t rv; char *path; /* XXX So, this is kind of bogus. Basically, I need to strip any leading @@ -261,7 +261,7 @@ APR_DECLARE(apr_status_t) apr_match_glob(const char *pattern, * return anything, then we look for '\'. This means that we could * screw up on unix if the pattern is something like "foo\.*" That '\' * isn't a directory delimiter, it is a part of the filename. To fix this, - * we really need apr_filepath_basename, which will be coming as soon as + * we really need fspr_filepath_basename, which will be coming as soon as * I get to it. rbb */ char *idx = strrchr(pattern, '/'); @@ -273,21 +273,21 @@ APR_DECLARE(apr_status_t) apr_match_glob(const char *pattern, path = "."; } else { - path = apr_pstrndup(p, pattern, idx - pattern); + path = fspr_pstrndup(p, pattern, idx - pattern); pattern = idx + 1; } - *result = apr_array_make(p, 0, sizeof(char *)); - rv = apr_dir_open(&dir, path, p); + *result = fspr_array_make(p, 0, sizeof(char *)); + rv = fspr_dir_open(&dir, path, p); if (rv != APR_SUCCESS) { return rv; } - while (apr_dir_read(&finfo, APR_FINFO_NAME, dir) == APR_SUCCESS) { - if (apr_fnmatch(pattern, finfo.name, 0) == APR_SUCCESS) { - *(const char **)apr_array_push(*result) = apr_pstrdup(p, finfo.name); + while (fspr_dir_read(&finfo, APR_FINFO_NAME, dir) == APR_SUCCESS) { + if (fspr_fnmatch(pattern, finfo.name, 0) == APR_SUCCESS) { + *(const char **)fspr_array_push(*result) = fspr_pstrdup(p, finfo.name); } } - apr_dir_close(dir); + fspr_dir_close(dir); return APR_SUCCESS; } diff --git a/libs/apr/strings/apr_snprintf.c b/libs/apr/strings/fspr_snprintf.c similarity index 90% rename from libs/apr/strings/apr_snprintf.c rename to libs/apr/strings/fspr_snprintf.c index 8c5030d725..cc7d2faf67 100644 --- a/libs/apr/strings/apr_snprintf.c +++ b/libs/apr/strings/fspr_snprintf.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_private.h" +#include "fspr.h" +#include "fspr_private.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_network_io.h" -#include "apr_portable.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_network_io.h" +#include "fspr_portable.h" #include #if APR_HAVE_CTYPE_H #include @@ -56,12 +56,12 @@ typedef enum { typedef WIDE_INT wide_int; typedef unsigned WIDE_INT u_wide_int; -typedef apr_int64_t widest_int; +typedef fspr_int64_t widest_int; #ifdef __TANDEM /* Although Tandem supports "long long" there is no unsigned variant. */ typedef unsigned long u_widest_int; #else -typedef apr_uint64_t u_widest_int; +typedef fspr_uint64_t u_widest_int; #endif typedef int bool_int; @@ -84,7 +84,7 @@ typedef int bool_int; */ /* - * apr_ecvt converts to decimal + * fspr_ecvt converts to decimal * the number of digits is specified by ndigit * decpt is set to the position of the decimal point * sign is set to 0 for positive, 1 for negative @@ -93,7 +93,7 @@ typedef int bool_int; #define NDIG 80 /* buf must have at least NDIG bytes */ -static char *apr_cvt(double arg, int ndigits, int *decpt, int *sign, +static char *fspr_cvt(double arg, int ndigits, int *decpt, int *sign, int eflag, char *buf) { register int r2; @@ -167,29 +167,29 @@ static char *apr_cvt(double arg, int ndigits, int *decpt, int *sign, return (buf); } -static char *apr_ecvt(double arg, int ndigits, int *decpt, int *sign, char *buf) +static char *fspr_ecvt(double arg, int ndigits, int *decpt, int *sign, char *buf) { - return (apr_cvt(arg, ndigits, decpt, sign, 1, buf)); + return (fspr_cvt(arg, ndigits, decpt, sign, 1, buf)); } -static char *apr_fcvt(double arg, int ndigits, int *decpt, int *sign, char *buf) +static char *fspr_fcvt(double arg, int ndigits, int *decpt, int *sign, char *buf) { - return (apr_cvt(arg, ndigits, decpt, sign, 0, buf)); + return (fspr_cvt(arg, ndigits, decpt, sign, 0, buf)); } /* - * apr_gcvt - Floating output conversion to + * fspr_gcvt - Floating output conversion to * minimal length string */ -static char *apr_gcvt(double number, int ndigit, char *buf, boolean_e altform) +static char *fspr_gcvt(double number, int ndigit, char *buf, boolean_e altform) { int sign, decpt; register char *p1, *p2; register int i; char buf1[NDIG]; - p1 = apr_ecvt(number, ndigit, &decpt, &sign, buf1); + p1 = fspr_ecvt(number, ndigit, &decpt, &sign, buf1); p2 = buf; if (sign) *p2++ = '-'; @@ -270,7 +270,7 @@ static char *apr_gcvt(double number, int ndigit, char *buf, boolean_e altform) #define STR_TO_DEC(str, num) \ num = NUM(*str++); \ - while (apr_isdigit(*str)) \ + while (fspr_isdigit(*str)) \ { \ num *= 10 ; \ num += NUM(*str++); \ @@ -288,7 +288,7 @@ static char *apr_gcvt(double number, int ndigit, char *buf, boolean_e altform) */ #define FIX_PRECISION(adjust, precision, s, s_len) \ if (adjust) { \ - apr_size_t p = (precision + 1 < NUM_BUF_SIZE) \ + fspr_size_t p = (precision + 1 < NUM_BUF_SIZE) \ ? precision : NUM_BUF_SIZE - 1; \ while (s_len < p) \ { \ @@ -338,7 +338,7 @@ while (width > len) */ static char *conv_10(register wide_int num, register bool_int is_unsigned, register bool_int *is_negative, char *buf_end, - register apr_size_t *len) + register fspr_size_t *len) { register char *p = buf_end; register u_wide_int magnitude; @@ -385,7 +385,7 @@ static char *conv_10(register wide_int num, register bool_int is_unsigned, static char *conv_10_quad(widest_int num, register bool_int is_unsigned, register bool_int *is_negative, char *buf_end, - register apr_size_t *len) + register fspr_size_t *len) { register char *p = buf_end; u_widest_int magnitude; @@ -442,12 +442,12 @@ static char *conv_10_quad(widest_int num, register bool_int is_unsigned, -static char *conv_in_addr(struct in_addr *ia, char *buf_end, apr_size_t *len) +static char *conv_in_addr(struct in_addr *ia, char *buf_end, fspr_size_t *len) { unsigned addr = ntohl(ia->s_addr); char *p = buf_end; bool_int is_negative; - apr_size_t sub_len; + fspr_size_t sub_len; p = conv_10((addr & 0x000000FF) , TRUE, &is_negative, p, &sub_len); *--p = '.'; @@ -463,16 +463,16 @@ static char *conv_in_addr(struct in_addr *ia, char *buf_end, apr_size_t *len) -static char *conv_apr_sockaddr(apr_sockaddr_t *sa, char *buf_end, apr_size_t *len) +static char *conv_fspr_sockaddr(fspr_sockaddr_t *sa, char *buf_end, fspr_size_t *len) { char *p = buf_end; bool_int is_negative; - apr_size_t sub_len; + fspr_size_t sub_len; char *ipaddr_str; p = conv_10(sa->port, TRUE, &is_negative, p, &sub_len); *--p = ':'; - apr_sockaddr_ip_get(&ipaddr_str, sa); + fspr_sockaddr_ip_get(&ipaddr_str, sa); sub_len = strlen(ipaddr_str); #if APR_HAVE_IPV6 if (sa->family == APR_INET6 && @@ -496,20 +496,20 @@ static char *conv_apr_sockaddr(apr_sockaddr_t *sa, char *buf_end, apr_size_t *le #if APR_HAS_THREADS -static char *conv_os_thread_t(apr_os_thread_t *tid, char *buf_end, apr_size_t *len) +static char *conv_os_thread_t(fspr_os_thread_t *tid, char *buf_end, fspr_size_t *len) { union { - apr_os_thread_t tid; - apr_uint64_t alignme; + fspr_os_thread_t tid; + fspr_uint64_t alignme; } u; int is_negative; u.tid = *tid; switch(sizeof(u.tid)) { - case sizeof(apr_int32_t): - return conv_10(*(apr_uint32_t *)&u.tid, TRUE, &is_negative, buf_end, len); - case sizeof(apr_int64_t): - return conv_10_quad(*(apr_uint64_t *)&u.tid, TRUE, &is_negative, buf_end, len); + case sizeof(fspr_int32_t): + return conv_10(*(fspr_uint32_t *)&u.tid, TRUE, &is_negative, buf_end, len); + case sizeof(fspr_int64_t): + return conv_10_quad(*(fspr_uint64_t *)&u.tid, TRUE, &is_negative, buf_end, len); default: /* not implemented; stick 0 in the buffer */ return conv_10(0, TRUE, &is_negative, buf_end, len); @@ -527,7 +527,7 @@ static char *conv_os_thread_t(apr_os_thread_t *tid, char *buf_end, apr_size_t *l */ static char *conv_fp(register char format, register double num, boolean_e add_dp, int precision, bool_int *is_negative, - char *buf, apr_size_t *len) + char *buf, fspr_size_t *len) { register char *s = buf; register char *p; @@ -535,14 +535,14 @@ static char *conv_fp(register char format, register double num, char buf1[NDIG]; if (format == 'f') - p = apr_fcvt(num, precision, &decimal_point, is_negative, buf1); + p = fspr_fcvt(num, precision, &decimal_point, is_negative, buf1); else /* either e or E format */ - p = apr_ecvt(num, precision + 1, &decimal_point, is_negative, buf1); + p = fspr_ecvt(num, precision + 1, &decimal_point, is_negative, buf1); /* * Check for Infinity and NaN */ - if (apr_isalpha(*p)) { + if (fspr_isalpha(*p)) { *len = strlen(p); memcpy(buf, p, *len + 1); *is_negative = FALSE; @@ -581,7 +581,7 @@ static char *conv_fp(register char format, register double num, if (format != 'f') { char temp[EXPONENT_LENGTH]; /* for exponent conversion */ - apr_size_t t_len; + fspr_size_t t_len; bool_int exponent_is_negative; *s++ = format; /* either e or E */ @@ -625,7 +625,7 @@ static char *conv_fp(register char format, register double num, * the number isn't quad size. */ static char *conv_p2(register u_wide_int num, register int nbits, - char format, char *buf_end, register apr_size_t *len) + char format, char *buf_end, register fspr_size_t *len) { register int mask = (1 << nbits) - 1; register char *p = buf_end; @@ -644,7 +644,7 @@ static char *conv_p2(register u_wide_int num, register int nbits, } static char *conv_p2_quad(u_widest_int num, register int nbits, - char format, char *buf_end, register apr_size_t *len) + char format, char *buf_end, register fspr_size_t *len) { register int mask = (1 << nbits) - 1; register char *p = buf_end; @@ -666,20 +666,20 @@ static char *conv_p2_quad(u_widest_int num, register int nbits, } #if APR_HAS_THREADS -static char *conv_os_thread_t_hex(apr_os_thread_t *tid, char *buf_end, apr_size_t *len) +static char *conv_os_thread_t_hex(fspr_os_thread_t *tid, char *buf_end, fspr_size_t *len) { union { - apr_os_thread_t tid; - apr_uint64_t alignme; + fspr_os_thread_t tid; + fspr_uint64_t alignme; } u; int is_negative; u.tid = *tid; switch(sizeof(u.tid)) { - case sizeof(apr_int32_t): - return conv_p2(*(apr_uint32_t *)&u.tid, 4, 'x', buf_end, len); - case sizeof(apr_int64_t): - return conv_p2_quad(*(apr_uint64_t *)&u.tid, 4, 'x', buf_end, len); + case sizeof(fspr_int32_t): + return conv_p2(*(fspr_uint32_t *)&u.tid, 4, 'x', buf_end, len); + case sizeof(fspr_int64_t): + return conv_p2_quad(*(fspr_uint64_t *)&u.tid, 4, 'x', buf_end, len); default: /* not implemented; stick 0 in the buffer */ return conv_10(0, TRUE, &is_negative, buf_end, len); @@ -690,20 +690,20 @@ static char *conv_os_thread_t_hex(apr_os_thread_t *tid, char *buf_end, apr_size_ /* * Do format conversion placing the output in buffer */ -APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), - apr_vformatter_buff_t *vbuff, const char *fmt, va_list ap) +APR_DECLARE(int) fspr_vformatter(int (*flush_func)(fspr_vformatter_buff_t *), + fspr_vformatter_buff_t *vbuff, const char *fmt, va_list ap) { register char *sp; register char *bep; register int cc = 0; - register apr_size_t i; + register fspr_size_t i; register char *s = NULL; char *q; - apr_size_t s_len; + fspr_size_t s_len; - register apr_size_t min_width = 0; - apr_size_t precision = 0; + register fspr_size_t min_width = 0; + fspr_size_t precision = 0; enum { LEFT, RIGHT } adjust; @@ -756,7 +756,7 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), /* * Try to avoid checking for flags, width or precision */ - if (!apr_islower(*fmt)) { + if (!fspr_islower(*fmt)) { /* * Recognize flags: -, #, BLANK, + */ @@ -778,7 +778,7 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), /* * Check if a width was specified */ - if (apr_isdigit(*fmt)) { + if (fspr_isdigit(*fmt)) { STR_TO_DEC(fmt, min_width); adjust_width = YES; } @@ -788,10 +788,10 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), adjust_width = YES; if (v < 0) { adjust = LEFT; - min_width = (apr_size_t)(-v); + min_width = (fspr_size_t)(-v); } else - min_width = (apr_size_t)v; + min_width = (fspr_size_t)v; } else adjust_width = NO; @@ -802,13 +802,13 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), if (*fmt == '.') { adjust_precision = YES; fmt++; - if (apr_isdigit(*fmt)) { + if (fspr_isdigit(*fmt)) { STR_TO_DEC(fmt, precision); } else if (*fmt == '*') { int v = va_arg(ap, int); fmt++; - precision = (v < 0) ? 0 : (apr_size_t)v; + precision = (v < 0) ? 0 : (fspr_size_t)v; } else precision = 0; @@ -1058,7 +1058,7 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), /* * * We use &num_buf[ 1 ], so that we have room for the sign */ - s = apr_gcvt(va_arg(ap, double), precision, &num_buf[1], + s = fspr_gcvt(va_arg(ap, double), precision, &num_buf[1], alternate_form); if (*s == '-') prefix_char = *s++; @@ -1140,14 +1140,14 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), pad_char = ' '; break; - /* print an apr_sockaddr_t as a.b.c.d:port */ + /* print an fspr_sockaddr_t as a.b.c.d:port */ case 'I': { - apr_sockaddr_t *sa; + fspr_sockaddr_t *sa; - sa = va_arg(ap, apr_sockaddr_t *); + sa = va_arg(ap, fspr_sockaddr_t *); if (sa != NULL) { - s = conv_apr_sockaddr(sa, &num_buf[NUM_BUF_SIZE], &s_len); + s = conv_fspr_sockaddr(sa, &num_buf[NUM_BUF_SIZE], &s_len); if (adjust_precision && precision < s_len) s_len = precision; } @@ -1181,9 +1181,9 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), case 'T': #if APR_HAS_THREADS { - apr_os_thread_t *tid; + fspr_os_thread_t *tid; - tid = va_arg(ap, apr_os_thread_t *); + tid = va_arg(ap, fspr_os_thread_t *); if (tid != NULL) { s = conv_os_thread_t(tid, &num_buf[NUM_BUF_SIZE], &s_len); if (adjust_precision && precision < s_len) @@ -1206,9 +1206,9 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), case 't': #if APR_HAS_THREADS { - apr_os_thread_t *tid; + fspr_os_thread_t *tid; - tid = va_arg(ap, apr_os_thread_t *); + tid = va_arg(ap, fspr_os_thread_t *); if (tid != NULL) { s = conv_os_thread_t_hex(tid, &num_buf[NUM_BUF_SIZE], &s_len); if (adjust_precision && precision < s_len) @@ -1304,21 +1304,21 @@ APR_DECLARE(int) apr_vformatter(int (*flush_func)(apr_vformatter_buff_t *), } -static int snprintf_flush(apr_vformatter_buff_t *vbuff) +static int snprintf_flush(fspr_vformatter_buff_t *vbuff) { /* if the buffer fills we have to abort immediately, there is no way - * to "flush" an apr_snprintf... there's nowhere to flush it to. + * to "flush" an fspr_snprintf... there's nowhere to flush it to. */ return -1; } -APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len, +APR_DECLARE_NONSTD(int) fspr_snprintf(char *buf, fspr_size_t len, const char *format, ...) { int cc; va_list ap; - apr_vformatter_buff_t vbuff; + fspr_vformatter_buff_t vbuff; if (len == 0) { /* NOTE: This is a special case; we just want to return the number @@ -1336,7 +1336,7 @@ APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len, vbuff.endpos = buf + len - 1; } va_start(ap, format); - cc = apr_vformatter(snprintf_flush, &vbuff, format, ap); + cc = fspr_vformatter(snprintf_flush, &vbuff, format, ap); va_end(ap); if (len != 0) { *vbuff.curpos = '\0'; @@ -1345,11 +1345,11 @@ APR_DECLARE_NONSTD(int) apr_snprintf(char *buf, apr_size_t len, } -APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format, +APR_DECLARE(int) fspr_vsnprintf(char *buf, fspr_size_t len, const char *format, va_list ap) { int cc; - apr_vformatter_buff_t vbuff; + fspr_vformatter_buff_t vbuff; if (len == 0) { /* See above note */ @@ -1360,7 +1360,7 @@ APR_DECLARE(int) apr_vsnprintf(char *buf, apr_size_t len, const char *format, vbuff.curpos = buf; vbuff.endpos = buf + len - 1; } - cc = apr_vformatter(snprintf_flush, &vbuff, format, ap); + cc = fspr_vformatter(snprintf_flush, &vbuff, format, ap); if (len != 0) { *vbuff.curpos = '\0'; } diff --git a/libs/apr/strings/apr_strings.c b/libs/apr/strings/fspr_strings.c similarity index 82% rename from libs/apr/strings/apr_strings.c rename to libs/apr/strings/fspr_strings.c index 771d351f19..48dd08b953 100644 --- a/libs/apr/strings/apr_strings.c +++ b/libs/apr/strings/fspr_strings.c @@ -46,14 +46,14 @@ * SUCH DAMAGE. */ -#include "apr.h" -#include "apr_strings.h" -#include "apr_general.h" -#include "apr_private.h" -#include "apr_lib.h" +#include "fspr.h" +#include "fspr_strings.h" +#include "fspr_general.h" +#include "fspr_private.h" +#include "fspr_lib.h" #define APR_WANT_STDIO #define APR_WANT_STRFUNC -#include "apr_want.h" +#include "fspr_want.h" #ifdef HAVE_STDDEF_H #include /* NULL */ @@ -63,24 +63,24 @@ #include /* strtol and strtoll */ #endif -/** this is used to cache lengths in apr_pstrcat */ +/** this is used to cache lengths in fspr_pstrcat */ #define MAX_SAVED_LENGTHS 6 -APR_DECLARE(char *) apr_pstrdup(apr_pool_t *a, const char *s) +APR_DECLARE(char *) fspr_pstrdup(fspr_pool_t *a, const char *s) { char *res; - apr_size_t len; + fspr_size_t len; if (s == NULL) { return NULL; } len = strlen(s) + 1; - res = apr_palloc(a, len); + res = fspr_palloc(a, len); memcpy(res, s, len); return res; } -APR_DECLARE(char *) apr_pstrndup(apr_pool_t *a, const char *s, apr_size_t n) +APR_DECLARE(char *) fspr_pstrndup(fspr_pool_t *a, const char *s, fspr_size_t n) { char *res; const char *end; @@ -91,51 +91,51 @@ APR_DECLARE(char *) apr_pstrndup(apr_pool_t *a, const char *s, apr_size_t n) end = memchr(s, '\0', n); if (end != NULL) n = end - s; - res = apr_palloc(a, n + 1); + res = fspr_palloc(a, n + 1); memcpy(res, s, n); res[n] = '\0'; return res; } -APR_DECLARE(char *) apr_pstrmemdup(apr_pool_t *a, const char *s, apr_size_t n) +APR_DECLARE(char *) fspr_pstrmemdup(fspr_pool_t *a, const char *s, fspr_size_t n) { char *res; if (s == NULL) { return NULL; } - res = apr_palloc(a, n + 1); + res = fspr_palloc(a, n + 1); memcpy(res, s, n); res[n] = '\0'; return res; } -APR_DECLARE(void *) apr_pmemdup(apr_pool_t *a, const void *m, apr_size_t n) +APR_DECLARE(void *) fspr_pmemdup(fspr_pool_t *a, const void *m, fspr_size_t n) { void *res; if (m == NULL) return NULL; - res = apr_palloc(a, n); + res = fspr_palloc(a, n); memcpy(res, m, n); return res; } -APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *a, ...) +APR_DECLARE_NONSTD(char *) fspr_pstrcat(fspr_pool_t *a, ...) { char *cp, *argp, *res; - apr_size_t saved_lengths[MAX_SAVED_LENGTHS] = { 0 }; + fspr_size_t saved_lengths[MAX_SAVED_LENGTHS] = { 0 }; int nargs = 0; /* Pass one --- find length of required string */ - apr_size_t len = 0; + fspr_size_t len = 0; va_list adummy; va_start(adummy, a); while ((cp = va_arg(adummy, char *)) != NULL) { - apr_size_t cplen = strlen(cp); + fspr_size_t cplen = strlen(cp); if (nargs < MAX_SAVED_LENGTHS) { saved_lengths[nargs++] = cplen; } @@ -146,7 +146,7 @@ APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *a, ...) /* Allocate the required string */ - res = (char *) apr_palloc(a, len + 1); + res = (char *) fspr_palloc(a, len + 1); cp = res; /* Pass two --- copy the argument strings into the result space */ @@ -175,11 +175,11 @@ APR_DECLARE_NONSTD(char *) apr_pstrcat(apr_pool_t *a, ...) return res; } -APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *a, const struct iovec *vec, - apr_size_t nvec, apr_size_t *nbytes) +APR_DECLARE(char *) fspr_pstrcatv(fspr_pool_t *a, const struct iovec *vec, + fspr_size_t nvec, fspr_size_t *nbytes) { - apr_size_t i; - apr_size_t len; + fspr_size_t i; + fspr_size_t len; const struct iovec *src; char *res; char *dst; @@ -196,7 +196,7 @@ APR_DECLARE(char *) apr_pstrcatv(apr_pool_t *a, const struct iovec *vec, } /* Allocate the required string */ - res = (char *) apr_palloc(a, len + 1); + res = (char *) fspr_palloc(a, len + 1); /* Pass two --- copy the argument strings into the result space */ src = vec; @@ -234,7 +234,7 @@ void *memchr(const void *s, int c, size_t n) #define INT64_MIN (-APR_INT64_C(0x7fffffffffffffff) - APR_INT64_C(1)) #endif -APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *nptr, +APR_DECLARE(fspr_status_t) fspr_strtoff(fspr_off_t *offset, const char *nptr, char **endptr, int base) { errno = 0; @@ -242,14 +242,14 @@ APR_DECLARE(apr_status_t) apr_strtoff(apr_off_t *offset, const char *nptr, return APR_FROM_OS_ERROR(errno); } -APR_DECLARE(apr_int64_t) apr_strtoi64(const char *nptr, char **endptr, int base) +APR_DECLARE(fspr_int64_t) fspr_strtoi64(const char *nptr, char **endptr, int base) { #ifdef APR_INT64_STRFN return APR_INT64_STRFN(nptr, endptr, base); #else const char *s; - apr_int64_t acc; - apr_int64_t val; + fspr_int64_t acc; + fspr_int64_t val; int neg, any; char c; @@ -261,7 +261,7 @@ APR_DECLARE(apr_int64_t) apr_strtoi64(const char *nptr, char **endptr, int base) s = nptr; do { c = *s++; - } while (apr_isspace(c)); + } while (fspr_isspace(c)); if (c == '-') { neg = 1; c = *s++; @@ -319,7 +319,7 @@ APR_DECLARE(apr_int64_t) apr_strtoi64(const char *nptr, char **endptr, int base) else if (c >= 's' && c <= 'z') c -= 'z' - 28; #else -#error "CANNOT COMPILE apr_strtoi64(), only ASCII and EBCDIC supported" +#error "CANNOT COMPILE fspr_strtoi64(), only ASCII and EBCDIC supported" #endif else break; @@ -351,15 +351,15 @@ APR_DECLARE(apr_int64_t) apr_strtoi64(const char *nptr, char **endptr, int base) #endif } -APR_DECLARE(apr_int64_t) apr_atoi64(const char *buf) +APR_DECLARE(fspr_int64_t) fspr_atoi64(const char *buf) { - return apr_strtoi64(buf, NULL, 10); + return fspr_strtoi64(buf, NULL, 10); } -APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n) +APR_DECLARE(char *) fspr_itoa(fspr_pool_t *p, int n) { const int BUFFER_SIZE = sizeof(int) * 3 + 2; - char *buf = apr_palloc(p, BUFFER_SIZE); + char *buf = fspr_palloc(p, BUFFER_SIZE); char *start = buf + BUFFER_SIZE - 1; int negative; if (n < 0) { @@ -380,10 +380,10 @@ APR_DECLARE(char *) apr_itoa(apr_pool_t *p, int n) return start; } -APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n) +APR_DECLARE(char *) fspr_ltoa(fspr_pool_t *p, long n) { const int BUFFER_SIZE = sizeof(long) * 3 + 2; - char *buf = apr_palloc(p, BUFFER_SIZE); + char *buf = fspr_palloc(p, BUFFER_SIZE); char *start = buf + BUFFER_SIZE - 1; int negative; if (n < 0) { @@ -404,10 +404,10 @@ APR_DECLARE(char *) apr_ltoa(apr_pool_t *p, long n) return start; } -APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n) +APR_DECLARE(char *) fspr_off_t_toa(fspr_pool_t *p, fspr_off_t n) { - const int BUFFER_SIZE = sizeof(apr_off_t) * 3 + 2; - char *buf = apr_palloc(p, BUFFER_SIZE); + const int BUFFER_SIZE = sizeof(fspr_off_t) * 3 + 2; + char *buf = fspr_palloc(p, BUFFER_SIZE); char *start = buf + BUFFER_SIZE - 1; int negative; if (n < 0) { @@ -428,7 +428,7 @@ APR_DECLARE(char *) apr_off_t_toa(apr_pool_t *p, apr_off_t n) return start; } -APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf) +APR_DECLARE(char *) fspr_strfsize(fspr_off_t size, char *buf) { const char ord[] = "KMGTPE"; const char *o = ord; @@ -438,7 +438,7 @@ APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf) return strcpy(buf, " - "); } if (size < 973) { - if (apr_snprintf(buf, 5, "%3d ", (int) size) < 0) + if (fspr_snprintf(buf, 5, "%3d ", (int) size) < 0) return strcpy(buf, "****"); return buf; } @@ -452,13 +452,13 @@ APR_DECLARE(char *) apr_strfsize(apr_off_t size, char *buf) if (size < 9 || (size == 9 && remain < 973)) { if ((remain = ((remain * 5) + 256) / 512) >= 10) ++size, remain = 0; - if (apr_snprintf(buf, 5, "%d.%d%c", (int) size, remain, *o) < 0) + if (fspr_snprintf(buf, 5, "%d.%d%c", (int) size, remain, *o) < 0) return strcpy(buf, "****"); return buf; } if (remain >= 512) ++size; - if (apr_snprintf(buf, 5, "%3d%c", (int) size, *o) < 0) + if (fspr_snprintf(buf, 5, "%3d%c", (int) size, *o) < 0) return strcpy(buf, "****"); return buf; } while (1); diff --git a/libs/apr/strings/apr_strnatcmp.c b/libs/apr/strings/fspr_strnatcmp.c similarity index 84% rename from libs/apr/strings/apr_strnatcmp.c rename to libs/apr/strings/fspr_strnatcmp.c index 0e960e8a90..f80b8e4aec 100644 --- a/libs/apr/strings/apr_strnatcmp.c +++ b/libs/apr/strings/fspr_strnatcmp.c @@ -22,8 +22,8 @@ #include #include -#include "apr_strings.h" -#include "apr_lib.h" /* for apr_is*() */ +#include "fspr_strings.h" +#include "fspr_lib.h" /* for fspr_is*() */ #if defined(__GNUC__) # define UNUSED __attribute__((__unused__)) @@ -43,11 +43,11 @@ compare_right(char const *a, char const *b) both numbers to know that they have the same magnitude, so we remember it in BIAS. */ for (;; a++, b++) { - if (!apr_isdigit(*a) && !apr_isdigit(*b)) + if (!fspr_isdigit(*a) && !fspr_isdigit(*b)) break; - else if (!apr_isdigit(*a)) + else if (!fspr_isdigit(*a)) return -1; - else if (!apr_isdigit(*b)) + else if (!fspr_isdigit(*b)) return +1; else if (*a < *b) { if (!bias) @@ -69,11 +69,11 @@ compare_left(char const *a, char const *b) /* Compare two left-aligned numbers: the first to have a different value wins. */ for (;; a++, b++) { - if (!apr_isdigit(*a) && !apr_isdigit(*b)) + if (!fspr_isdigit(*a) && !fspr_isdigit(*b)) break; - else if (!apr_isdigit(*a)) + else if (!fspr_isdigit(*a)) return -1; - else if (!apr_isdigit(*b)) + else if (!fspr_isdigit(*b)) return +1; else if (*a < *b) return -1; @@ -95,14 +95,14 @@ static int strnatcmp0(char const *a, char const *b, int fold_case) ca = a[ai]; cb = b[bi]; /* skip over leading spaces or zeros */ - while (apr_isspace(ca)) + while (fspr_isspace(ca)) ca = a[++ai]; - while (apr_isspace(cb)) + while (fspr_isspace(cb)) cb = b[++bi]; /* process run of digits */ - if (apr_isdigit(ca) && apr_isdigit(cb)) { + if (fspr_isdigit(ca) && fspr_isdigit(cb)) { fractional = (ca == '0' || cb == '0'); if (fractional) { @@ -121,8 +121,8 @@ static int strnatcmp0(char const *a, char const *b, int fold_case) } if (fold_case) { - ca = apr_toupper(ca); - cb = apr_toupper(cb); + ca = fspr_toupper(ca); + cb = fspr_toupper(cb); } if (ca < cb) @@ -136,14 +136,14 @@ static int strnatcmp0(char const *a, char const *b, int fold_case) -APR_DECLARE(int) apr_strnatcmp(char const *a, char const *b) +APR_DECLARE(int) fspr_strnatcmp(char const *a, char const *b) { return strnatcmp0(a, b, 0); } /* Compare, recognizing numeric string and ignoring case. */ -APR_DECLARE(int) apr_strnatcasecmp(char const *a, char const *b) +APR_DECLARE(int) fspr_strnatcasecmp(char const *a, char const *b) { return strnatcmp0(a, b, 1); } diff --git a/libs/apr/strings/apr_strtok.c b/libs/apr/strings/fspr_strtok.c similarity index 91% rename from libs/apr/strings/apr_strtok.c rename to libs/apr/strings/fspr_strtok.c index 517b319d47..eb7d5687bc 100644 --- a/libs/apr/strings/apr_strtok.c +++ b/libs/apr/strings/fspr_strtok.c @@ -18,13 +18,13 @@ #include /* for NULL */ #endif -#include "apr.h" -#include "apr_strings.h" +#include "fspr.h" +#include "fspr_strings.h" #define APR_WANT_STRFUNC /* for strchr() */ -#include "apr_want.h" +#include "fspr_want.h" -APR_DECLARE(char *) apr_strtok(char *str, const char *sep, char **last) +APR_DECLARE(char *) fspr_strtok(char *str, const char *sep, char **last) { char *token; diff --git a/libs/apr/support/unix/waitio.c b/libs/apr/support/unix/waitio.c index 7232cdd9ce..70594824aa 100644 --- a/libs/apr/support/unix/waitio.c +++ b/libs/apr/support/unix/waitio.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr_arch_file_io.h" -#include "apr_arch_networkio.h" -#include "apr_poll.h" -#include "apr_errno.h" -#include "apr_support.h" +#include "fspr_arch_file_io.h" +#include "fspr_arch_networkio.h" +#include "fspr_poll.h" +#include "fspr_errno.h" +#include "fspr_support.h" /* The only case where we don't use wait_for_io_or_timeout is on * pre-BONE BeOS, so this check should be sufficient and simpler */ @@ -37,7 +37,7 @@ #include #endif -apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s, +fspr_status_t fspr_wait_for_io_or_timeout(fspr_file_t *f, fspr_socket_t *s, int for_read) { struct pollfd pfd; @@ -63,14 +63,14 @@ apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s, #else /* !WAITIO_USES_POLL */ -apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s, +fspr_status_t fspr_wait_for_io_or_timeout(fspr_file_t *f, fspr_socket_t *s, int for_read) { - apr_interval_time_t timeout; - apr_pollfd_t pfd; + fspr_interval_time_t timeout; + fspr_pollfd_t pfd; int type = for_read ? APR_POLLIN : APR_POLLOUT; - apr_pollset_t *pollset; - apr_status_t status; + fspr_pollset_t *pollset; + fspr_status_t status; /* TODO - timeout should be less each time through this loop */ if (f) { @@ -79,7 +79,7 @@ apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s, pollset = f->pollset; if (pollset == NULL) { - status = apr_pollset_create(&(f->pollset), 1, f->pool, 0); + status = fspr_pollset_create(&(f->pollset), 1, f->pool, 0); if (status != APR_SUCCESS) { return status; } @@ -100,16 +100,16 @@ apr_status_t apr_wait_for_io_or_timeout(apr_file_t *f, apr_socket_t *s, * object with the correct reqevents value. Ignore the status result * on the remove, because it might not be in there (yet). */ - (void) apr_pollset_remove(pollset, &pfd); + (void) fspr_pollset_remove(pollset, &pfd); /* ### check status code */ - (void) apr_pollset_add(pollset, &pfd); + (void) fspr_pollset_add(pollset, &pfd); do { int numdesc; - const apr_pollfd_t *pdesc; + const fspr_pollfd_t *pdesc; - status = apr_pollset_poll(pollset, timeout, &numdesc, &pdesc); + status = fspr_pollset_poll(pollset, timeout, &numdesc, &pdesc); if (numdesc == 1 && (pdesc[0].rtnevents & type) != 0) { return APR_SUCCESS; diff --git a/libs/apr/tables/apr_hash.c b/libs/apr/tables/fspr_hash.c similarity index 72% rename from libs/apr/tables/apr_hash.c rename to libs/apr/tables/fspr_hash.c index 0e707601f5..259d66562b 100644 --- a/libs/apr/tables/apr_hash.c +++ b/libs/apr/tables/fspr_hash.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr_private.h" +#include "fspr_private.h" -#include "apr_general.h" -#include "apr_pools.h" +#include "fspr_general.h" +#include "fspr_pools.h" -#include "apr_hash.h" +#include "fspr_hash.h" #if APR_HAVE_STDLIB_H #include @@ -43,13 +43,13 @@ * isn't too bad given that pools have a low allocation overhead. */ -typedef struct apr_hash_entry_t apr_hash_entry_t; +typedef struct fspr_hash_entry_t fspr_hash_entry_t; -struct apr_hash_entry_t { - apr_hash_entry_t *next; +struct fspr_hash_entry_t { + fspr_hash_entry_t *next; unsigned int hash; const void *key; - apr_ssize_t klen; + fspr_ssize_t klen; const void *val; }; @@ -58,11 +58,11 @@ struct apr_hash_entry_t { * * We keep a pointer to the next hash entry here to allow the current * hash entry to be freed or otherwise mangled between calls to - * apr_hash_next(). + * fspr_hash_next(). */ -struct apr_hash_index_t { - apr_hash_t *ht; - apr_hash_entry_t *this, *next; +struct fspr_hash_index_t { + fspr_hash_t *ht; + fspr_hash_entry_t *this, *next; unsigned int index; }; @@ -73,13 +73,13 @@ struct apr_hash_index_t { * The count of hash entries may be greater depending on the chosen * collision rate. */ -struct apr_hash_t { - apr_pool_t *pool; - apr_hash_entry_t **array; - apr_hash_index_t iterator; /* For apr_hash_first(NULL, ...) */ +struct fspr_hash_t { + fspr_pool_t *pool; + fspr_hash_entry_t **array; + fspr_hash_index_t iterator; /* For fspr_hash_first(NULL, ...) */ unsigned int count, max; - apr_hashfunc_t hash_func; - apr_hash_entry_t *free; /* List of recycled entries */ + fspr_hashfunc_t hash_func; + fspr_hash_entry_t *free; /* List of recycled entries */ }; #define INITIAL_MAX 15 /* tunable == 2^n - 1 */ @@ -89,28 +89,28 @@ struct apr_hash_t { * Hash creation functions. */ -static apr_hash_entry_t **alloc_array(apr_hash_t *ht, unsigned int max) +static fspr_hash_entry_t **alloc_array(fspr_hash_t *ht, unsigned int max) { - return apr_pcalloc(ht->pool, sizeof(*ht->array) * (max + 1)); + return fspr_pcalloc(ht->pool, sizeof(*ht->array) * (max + 1)); } -APR_DECLARE(apr_hash_t *) apr_hash_make(apr_pool_t *pool) +APR_DECLARE(fspr_hash_t *) fspr_hash_make(fspr_pool_t *pool) { - apr_hash_t *ht; - ht = apr_palloc(pool, sizeof(apr_hash_t)); + fspr_hash_t *ht; + ht = fspr_palloc(pool, sizeof(fspr_hash_t)); ht->pool = pool; ht->free = NULL; ht->count = 0; ht->max = INITIAL_MAX; ht->array = alloc_array(ht, ht->max); - ht->hash_func = apr_hashfunc_default; + ht->hash_func = fspr_hashfunc_default; return ht; } -APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool, - apr_hashfunc_t hash_func) +APR_DECLARE(fspr_hash_t *) fspr_hash_make_custom(fspr_pool_t *pool, + fspr_hashfunc_t hash_func) { - apr_hash_t *ht = apr_hash_make(pool); + fspr_hash_t *ht = fspr_hash_make(pool); ht->hash_func = hash_func; return ht; } @@ -120,7 +120,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_make_custom(apr_pool_t *pool, * Hash iteration functions. */ -APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi) +APR_DECLARE(fspr_hash_index_t *) fspr_hash_next(fspr_hash_index_t *hi) { hi->this = hi->next; while (!hi->this) { @@ -133,11 +133,11 @@ APR_DECLARE(apr_hash_index_t *) apr_hash_next(apr_hash_index_t *hi) return hi; } -APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht) +APR_DECLARE(fspr_hash_index_t *) fspr_hash_first(fspr_pool_t *p, fspr_hash_t *ht) { - apr_hash_index_t *hi; + fspr_hash_index_t *hi; if (p) - hi = apr_palloc(p, sizeof(*hi)); + hi = fspr_palloc(p, sizeof(*hi)); else hi = &ht->iterator; @@ -145,12 +145,12 @@ APR_DECLARE(apr_hash_index_t *) apr_hash_first(apr_pool_t *p, apr_hash_t *ht) hi->index = 0; hi->this = NULL; hi->next = NULL; - return apr_hash_next(hi); + return fspr_hash_next(hi); } -APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, +APR_DECLARE(void) fspr_hash_this(fspr_hash_index_t *hi, const void **key, - apr_ssize_t *klen, + fspr_ssize_t *klen, void **val) { if (key) *key = hi->this->key; @@ -163,15 +163,15 @@ APR_DECLARE(void) apr_hash_this(apr_hash_index_t *hi, * Expanding a hash table */ -static void expand_array(apr_hash_t *ht) +static void expand_array(fspr_hash_t *ht) { - apr_hash_index_t *hi; - apr_hash_entry_t **new_array; + fspr_hash_index_t *hi; + fspr_hash_entry_t **new_array; unsigned int new_max; new_max = ht->max * 2 + 1; new_array = alloc_array(ht, new_max); - for (hi = apr_hash_first(NULL, ht); hi; hi = apr_hash_next(hi)) { + for (hi = fspr_hash_first(NULL, ht); hi; hi = fspr_hash_next(hi)) { unsigned int i = hi->this->hash & new_max; hi->this->next = new_array[i]; new_array[i] = hi->this; @@ -180,13 +180,13 @@ static void expand_array(apr_hash_t *ht) ht->max = new_max; } -APR_DECLARE_NONSTD(unsigned int) apr_hashfunc_default(const char *char_key, - apr_ssize_t *klen) +APR_DECLARE_NONSTD(unsigned int) fspr_hashfunc_default(const char *char_key, + fspr_ssize_t *klen) { unsigned int hash = 0; const unsigned char *key = (const unsigned char *)char_key; const unsigned char *p; - apr_ssize_t i; + fspr_ssize_t i; /* * This is the popular `times 33' hash algorithm which is used by @@ -251,12 +251,12 @@ APR_DECLARE_NONSTD(unsigned int) apr_hashfunc_default(const char *char_key, * that hash entries can be removed. */ -static apr_hash_entry_t **find_entry(apr_hash_t *ht, +static fspr_hash_entry_t **find_entry(fspr_hash_t *ht, const void *key, - apr_ssize_t klen, + fspr_ssize_t klen, const void *val) { - apr_hash_entry_t **hep, *he; + fspr_hash_entry_t **hep, *he; unsigned int hash; hash = ht->hash_func(key, &klen); @@ -276,7 +276,7 @@ static apr_hash_entry_t **find_entry(apr_hash_t *ht, if ((he = ht->free) != NULL) ht->free = he->next; else - he = apr_palloc(ht->pool, sizeof(*he)); + he = fspr_palloc(ht->pool, sizeof(*he)); he->next = NULL; he->hash = hash; he->key = key; @@ -287,29 +287,29 @@ static apr_hash_entry_t **find_entry(apr_hash_t *ht, return hep; } -APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool, - const apr_hash_t *orig) +APR_DECLARE(fspr_hash_t *) fspr_hash_copy(fspr_pool_t *pool, + const fspr_hash_t *orig) { - apr_hash_t *ht; - apr_hash_entry_t *new_vals; + fspr_hash_t *ht; + fspr_hash_entry_t *new_vals; unsigned int i, j; - ht = apr_palloc(pool, sizeof(apr_hash_t) + + ht = fspr_palloc(pool, sizeof(fspr_hash_t) + sizeof(*ht->array) * (orig->max + 1) + - sizeof(apr_hash_entry_t) * orig->count); + sizeof(fspr_hash_entry_t) * orig->count); ht->pool = pool; ht->free = NULL; ht->count = orig->count; ht->max = orig->max; ht->hash_func = orig->hash_func; - ht->array = (apr_hash_entry_t **)((char *)ht + sizeof(apr_hash_t)); + ht->array = (fspr_hash_entry_t **)((char *)ht + sizeof(fspr_hash_t)); - new_vals = (apr_hash_entry_t *)((char *)(ht) + sizeof(apr_hash_t) + + new_vals = (fspr_hash_entry_t *)((char *)(ht) + sizeof(fspr_hash_t) + sizeof(*ht->array) * (orig->max + 1)); j = 0; for (i = 0; i <= ht->max; i++) { - apr_hash_entry_t **new_entry = &(ht->array[i]); - apr_hash_entry_t *orig_entry = orig->array[i]; + fspr_hash_entry_t **new_entry = &(ht->array[i]); + fspr_hash_entry_t *orig_entry = orig->array[i]; while (orig_entry) { *new_entry = &new_vals[j++]; (*new_entry)->hash = orig_entry->hash; @@ -324,11 +324,11 @@ APR_DECLARE(apr_hash_t *) apr_hash_copy(apr_pool_t *pool, return ht; } -APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht, +APR_DECLARE(void *) fspr_hash_get(fspr_hash_t *ht, const void *key, - apr_ssize_t klen) + fspr_ssize_t klen) { - apr_hash_entry_t *he; + fspr_hash_entry_t *he; he = *find_entry(ht, key, klen, NULL); if (he) return (void *)he->val; @@ -336,17 +336,17 @@ APR_DECLARE(void *) apr_hash_get(apr_hash_t *ht, return NULL; } -APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, +APR_DECLARE(void) fspr_hash_set(fspr_hash_t *ht, const void *key, - apr_ssize_t klen, + fspr_ssize_t klen, const void *val) { - apr_hash_entry_t **hep; + fspr_hash_entry_t **hep; hep = find_entry(ht, key, klen, val); if (*hep) { if (!val) { /* delete entry */ - apr_hash_entry_t *old = *hep; + fspr_hash_entry_t *old = *hep; *hep = (*hep)->next; old->next = ht->free; ht->free = old; @@ -364,40 +364,40 @@ APR_DECLARE(void) apr_hash_set(apr_hash_t *ht, /* else key not present and val==NULL */ } -APR_DECLARE(unsigned int) apr_hash_count(apr_hash_t *ht) +APR_DECLARE(unsigned int) fspr_hash_count(fspr_hash_t *ht) { return ht->count; } -APR_DECLARE(void) apr_hash_clear(apr_hash_t *ht) +APR_DECLARE(void) fspr_hash_clear(fspr_hash_t *ht) { - apr_hash_index_t *hi; - for (hi = apr_hash_first(NULL, ht); hi; hi = apr_hash_next(hi)) - apr_hash_set(ht, hi->this->key, hi->this->klen, NULL); + fspr_hash_index_t *hi; + for (hi = fspr_hash_first(NULL, ht); hi; hi = fspr_hash_next(hi)) + fspr_hash_set(ht, hi->this->key, hi->this->klen, NULL); } -APR_DECLARE(apr_hash_t*) apr_hash_overlay(apr_pool_t *p, - const apr_hash_t *overlay, - const apr_hash_t *base) +APR_DECLARE(fspr_hash_t*) fspr_hash_overlay(fspr_pool_t *p, + const fspr_hash_t *overlay, + const fspr_hash_t *base) { - return apr_hash_merge(p, overlay, base, NULL, NULL); + return fspr_hash_merge(p, overlay, base, NULL, NULL); } -APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p, - const apr_hash_t *overlay, - const apr_hash_t *base, - void * (*merger)(apr_pool_t *p, +APR_DECLARE(fspr_hash_t *) fspr_hash_merge(fspr_pool_t *p, + const fspr_hash_t *overlay, + const fspr_hash_t *base, + void * (*merger)(fspr_pool_t *p, const void *key, - apr_ssize_t klen, + fspr_ssize_t klen, const void *h1_val, const void *h2_val, const void *data), const void *data) { - apr_hash_t *res; - apr_hash_entry_t *new_vals = NULL; - apr_hash_entry_t *iter; - apr_hash_entry_t *ent; + fspr_hash_t *res; + fspr_hash_entry_t *new_vals = NULL; + fspr_hash_entry_t *iter; + fspr_hash_entry_t *ent; unsigned int i,j,k; #if APR_POOL_DEBUG @@ -405,19 +405,19 @@ APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p, * overlay->a.pool and base->a.pool have a life span at least * as long as p */ - if (!apr_pool_is_ancestor(overlay->pool, p)) { + if (!fspr_pool_is_ancestor(overlay->pool, p)) { fprintf(stderr, - "apr_hash_merge: overlay's pool is not an ancestor of p\n"); + "fspr_hash_merge: overlay's pool is not an ancestor of p\n"); abort(); } - if (!apr_pool_is_ancestor(base->pool, p)) { + if (!fspr_pool_is_ancestor(base->pool, p)) { fprintf(stderr, - "apr_hash_merge: base's pool is not an ancestor of p\n"); + "fspr_hash_merge: base's pool is not an ancestor of p\n"); abort(); } #endif - res = apr_palloc(p, sizeof(apr_hash_t)); + res = fspr_palloc(p, sizeof(fspr_hash_t)); res->pool = p; res->free = NULL; res->hash_func = base->hash_func; @@ -428,7 +428,7 @@ APR_DECLARE(apr_hash_t *) apr_hash_merge(apr_pool_t *p, } res->array = alloc_array(res, res->max); if (base->count + overlay->count) { - new_vals = apr_palloc(p, sizeof(apr_hash_entry_t) * + new_vals = fspr_palloc(p, sizeof(fspr_hash_entry_t) * (base->count + overlay->count)); } j = 0; diff --git a/libs/apr/tables/apr_tables.c b/libs/apr/tables/fspr_tables.c similarity index 71% rename from libs/apr/tables/apr_tables.c rename to libs/apr/tables/fspr_tables.c index 5a1dfa2619..46153d8c38 100644 --- a/libs/apr/tables/apr_tables.c +++ b/libs/apr/tables/fspr_tables.c @@ -21,13 +21,13 @@ * rst --- 4/95 --- 6/95 */ -#include "apr_private.h" +#include "fspr_private.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_tables.h" -#include "apr_strings.h" -#include "apr_lib.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_tables.h" +#include "fspr_strings.h" +#include "fspr_lib.h" #if APR_HAVE_STDLIB_H #include #endif @@ -43,7 +43,7 @@ #endif /***************************************************************** - * This file contains array and apr_table_t functions only. + * This file contains array and fspr_table_t functions only. */ /***************************************************************** @@ -51,7 +51,7 @@ * The 'array' functions... */ -static void make_array_core(apr_array_header_t *res, apr_pool_t *p, +static void make_array_core(fspr_array_header_t *res, fspr_pool_t *p, int nelts, int elt_size, int clear) { /* @@ -63,10 +63,10 @@ static void make_array_core(apr_array_header_t *res, apr_pool_t *p, } if (clear) { - res->elts = apr_pcalloc(p, nelts * elt_size); + res->elts = fspr_pcalloc(p, nelts * elt_size); } else { - res->elts = apr_palloc(p, nelts * elt_size); + res->elts = fspr_palloc(p, nelts * elt_size); } res->pool = p; @@ -75,42 +75,42 @@ static void make_array_core(apr_array_header_t *res, apr_pool_t *p, res->nalloc = nelts; /* ...but this many allocated */ } -APR_DECLARE(int) apr_is_empty_array(const apr_array_header_t *a) +APR_DECLARE(int) fspr_is_empty_array(const fspr_array_header_t *a) { return ((a == NULL) || (a->nelts == 0)); } -APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p, +APR_DECLARE(fspr_array_header_t *) fspr_array_make(fspr_pool_t *p, int nelts, int elt_size) { - apr_array_header_t *res; + fspr_array_header_t *res; - res = (apr_array_header_t *) apr_palloc(p, sizeof(apr_array_header_t)); + res = (fspr_array_header_t *) fspr_palloc(p, sizeof(fspr_array_header_t)); make_array_core(res, p, nelts, elt_size, 1); return res; } -APR_DECLARE(void) apr_array_clear(apr_array_header_t *arr) +APR_DECLARE(void) fspr_array_clear(fspr_array_header_t *arr) { arr->nelts = 0; } -APR_DECLARE(void *) apr_array_pop(apr_array_header_t *arr) +APR_DECLARE(void *) fspr_array_pop(fspr_array_header_t *arr) { - if (apr_is_empty_array(arr)) { + if (fspr_is_empty_array(arr)) { return NULL; } return arr->elts + (arr->elt_size * (--arr->nelts)); } -APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr) +APR_DECLARE(void *) fspr_array_push(fspr_array_header_t *arr) { if (arr->nelts == arr->nalloc) { int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2; char *new_data; - new_data = apr_palloc(arr->pool, arr->elt_size * new_size); + new_data = fspr_palloc(arr->pool, arr->elt_size * new_size); memcpy(new_data, arr->elts, arr->nalloc * arr->elt_size); memset(new_data + arr->nalloc * arr->elt_size, 0, @@ -123,13 +123,13 @@ APR_DECLARE(void *) apr_array_push(apr_array_header_t *arr) return arr->elts + (arr->elt_size * (arr->nelts - 1)); } -static void *apr_array_push_noclear(apr_array_header_t *arr) +static void *fspr_array_push_noclear(fspr_array_header_t *arr) { if (arr->nelts == arr->nalloc) { int new_size = (arr->nalloc <= 0) ? 1 : arr->nalloc * 2; char *new_data; - new_data = apr_palloc(arr->pool, arr->elt_size * new_size); + new_data = fspr_palloc(arr->pool, arr->elt_size * new_size); memcpy(new_data, arr->elts, arr->nalloc * arr->elt_size); arr->elts = new_data; @@ -140,8 +140,8 @@ static void *apr_array_push_noclear(apr_array_header_t *arr) return arr->elts + (arr->elt_size * (arr->nelts - 1)); } -APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst, - const apr_array_header_t *src) +APR_DECLARE(void) fspr_array_cat(fspr_array_header_t *dst, + const fspr_array_header_t *src) { int elt_size = dst->elt_size; @@ -153,7 +153,7 @@ APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst, new_size *= 2; } - new_data = apr_pcalloc(dst->pool, elt_size * new_size); + new_data = fspr_pcalloc(dst->pool, elt_size * new_size); memcpy(new_data, dst->elts, dst->nalloc * elt_size); dst->elts = new_data; @@ -165,11 +165,11 @@ APR_DECLARE(void) apr_array_cat(apr_array_header_t *dst, dst->nelts += src->nelts; } -APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p, - const apr_array_header_t *arr) +APR_DECLARE(fspr_array_header_t *) fspr_array_copy(fspr_pool_t *p, + const fspr_array_header_t *arr) { - apr_array_header_t *res = - (apr_array_header_t *) apr_palloc(p, sizeof(apr_array_header_t)); + fspr_array_header_t *res = + (fspr_array_header_t *) fspr_palloc(p, sizeof(fspr_array_header_t)); make_array_core(res, p, arr->nalloc, arr->elt_size, 0); memcpy(res->elts, arr->elts, arr->elt_size * arr->nelts); @@ -186,8 +186,8 @@ APR_DECLARE(apr_array_header_t *) apr_array_copy(apr_pool_t *p, * overhead of the full copy only where it is really needed. */ -static APR_INLINE void copy_array_hdr_core(apr_array_header_t *res, - const apr_array_header_t *arr) +static APR_INLINE void copy_array_hdr_core(fspr_array_header_t *res, + const fspr_array_header_t *arr) { res->elts = arr->elts; res->elt_size = arr->elt_size; @@ -195,13 +195,13 @@ static APR_INLINE void copy_array_hdr_core(apr_array_header_t *res, res->nalloc = arr->nelts; /* Force overflow on push */ } -APR_DECLARE(apr_array_header_t *) - apr_array_copy_hdr(apr_pool_t *p, - const apr_array_header_t *arr) +APR_DECLARE(fspr_array_header_t *) + fspr_array_copy_hdr(fspr_pool_t *p, + const fspr_array_header_t *arr) { - apr_array_header_t *res; + fspr_array_header_t *res; - res = (apr_array_header_t *) apr_palloc(p, sizeof(apr_array_header_t)); + res = (fspr_array_header_t *) fspr_palloc(p, sizeof(fspr_array_header_t)); res->pool = p; copy_array_hdr_core(res, arr); return res; @@ -209,33 +209,33 @@ APR_DECLARE(apr_array_header_t *) /* The above is used here to avoid consing multiple new array bodies... */ -APR_DECLARE(apr_array_header_t *) - apr_array_append(apr_pool_t *p, - const apr_array_header_t *first, - const apr_array_header_t *second) +APR_DECLARE(fspr_array_header_t *) + fspr_array_append(fspr_pool_t *p, + const fspr_array_header_t *first, + const fspr_array_header_t *second) { - apr_array_header_t *res = apr_array_copy_hdr(p, first); + fspr_array_header_t *res = fspr_array_copy_hdr(p, first); - apr_array_cat(res, second); + fspr_array_cat(res, second); return res; } -/* apr_array_pstrcat generates a new string from the apr_pool_t containing +/* fspr_array_pstrcat generates a new string from the fspr_pool_t containing * the concatenated sequence of substrings referenced as elements within * the array. The string will be empty if all substrings are empty or null, * or if there are no elements in the array. * If sep is non-NUL, it will be inserted between elements as a separator. */ -APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p, - const apr_array_header_t *arr, +APR_DECLARE(char *) fspr_array_pstrcat(fspr_pool_t *p, + const fspr_array_header_t *arr, const char sep) { char *cp, *res, **strpp; - apr_size_t len; + fspr_size_t len; int i; if (arr->nelts <= 0 || arr->elts == NULL) { /* Empty table? */ - return (char *) apr_pcalloc(p, 1); + return (char *) fspr_pcalloc(p, 1); } /* Pass one --- find length of required string */ @@ -255,7 +255,7 @@ APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p, /* Allocate the required string */ - res = (char *) apr_palloc(p, len + 1); + res = (char *) fspr_palloc(p, len + 1); cp = res; /* Pass two --- copy the argument strings into the result space */ @@ -308,35 +308,35 @@ APR_DECLARE(char *) apr_array_pstrcat(apr_pool_t *p, #define COMPUTE_KEY_CHECKSUM(key, checksum) \ { \ const char *k = (key); \ - apr_uint32_t c = (apr_uint32_t)*k; \ + fspr_uint32_t c = (fspr_uint32_t)*k; \ (checksum) = c; \ (checksum) <<= 8; \ if (c) { \ - c = (apr_uint32_t)*++k; \ + c = (fspr_uint32_t)*++k; \ checksum |= c; \ } \ (checksum) <<= 8; \ if (c) { \ - c = (apr_uint32_t)*++k; \ + c = (fspr_uint32_t)*++k; \ checksum |= c; \ } \ (checksum) <<= 8; \ if (c) { \ - c = (apr_uint32_t)*++k; \ + c = (fspr_uint32_t)*++k; \ checksum |= c; \ } \ checksum &= CASE_MASK; \ } /** The opaque string-content table type */ -struct apr_table_t { +struct fspr_table_t { /* This has to be first to promote backwards compatibility with - * older modules which cast a apr_table_t * to an apr_array_header_t *... - * they should use the apr_table_elts() function for most of the + * older modules which cast a fspr_table_t * to an fspr_array_header_t *... + * they should use the fspr_table_elts() function for most of the * cases they do this for. */ /** The underlying array for the table */ - apr_array_header_t a; + fspr_array_header_t a; #ifdef MAKE_TABLE_PROFILE /** Who created the array. */ void *creator; @@ -352,7 +352,7 @@ struct apr_table_t { * of index_initialized will be zero. (Check this before * trying to use index_first[i] or index_last[i]!) */ - apr_uint32_t index_initialized; + fspr_uint32_t index_initialized; int index_first[TABLE_HASH_SIZE]; int index_last[TABLE_HASH_SIZE]; }; @@ -362,32 +362,32 @@ struct apr_table_t { * and table_elts() in alloc.h */ #ifdef MAKE_TABLE_PROFILE -static apr_table_entry_t *table_push(apr_table_t *t) +static fspr_table_entry_t *table_push(fspr_table_t *t) { if (t->a.nelts == t->a.nalloc) { return NULL; } - return (apr_table_entry_t *) apr_array_push_noclear(&t->a); + return (fspr_table_entry_t *) fspr_array_push_noclear(&t->a); } #else /* MAKE_TABLE_PROFILE */ -#define table_push(t) ((apr_table_entry_t *) apr_array_push_noclear(&(t)->a)) +#define table_push(t) ((fspr_table_entry_t *) fspr_array_push_noclear(&(t)->a)) #endif /* MAKE_TABLE_PROFILE */ -APR_DECLARE(const apr_array_header_t *) apr_table_elts(const apr_table_t *t) +APR_DECLARE(const fspr_array_header_t *) fspr_table_elts(const fspr_table_t *t) { - return (const apr_array_header_t *)t; + return (const fspr_array_header_t *)t; } -APR_DECLARE(int) apr_is_empty_table(const apr_table_t *t) +APR_DECLARE(int) fspr_is_empty_table(const fspr_table_t *t) { return ((t == NULL) || (t->a.nelts == 0)); } -APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts) +APR_DECLARE(fspr_table_t *) fspr_table_make(fspr_pool_t *p, int nelts) { - apr_table_t *t = apr_palloc(p, sizeof(apr_table_t)); + fspr_table_t *t = fspr_palloc(p, sizeof(fspr_table_t)); - make_array_core(&t->a, p, nelts, sizeof(apr_table_entry_t), 0); + make_array_core(&t->a, p, nelts, sizeof(fspr_table_entry_t), 0); #ifdef MAKE_TABLE_PROFILE t->creator = __builtin_return_address(0); #endif @@ -395,21 +395,21 @@ APR_DECLARE(apr_table_t *) apr_table_make(apr_pool_t *p, int nelts) return t; } -APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p, const apr_table_t *t) +APR_DECLARE(fspr_table_t *) fspr_table_copy(fspr_pool_t *p, const fspr_table_t *t) { - apr_table_t *new = apr_palloc(p, sizeof(apr_table_t)); + fspr_table_t *new = fspr_palloc(p, sizeof(fspr_table_t)); #if APR_POOL_DEBUG /* we don't copy keys and values, so it's necessary that t->a.pool * have a life span at least as long as p */ - if (!apr_pool_is_ancestor(t->a.pool, p)) { - fprintf(stderr, "apr_table_copy: t's pool is not an ancestor of p\n"); + if (!fspr_pool_is_ancestor(t->a.pool, p)) { + fprintf(stderr, "fspr_table_copy: t's pool is not an ancestor of p\n"); abort(); } #endif - make_array_core(&new->a, p, t->a.nalloc, sizeof(apr_table_entry_t), 0); - memcpy(new->a.elts, t->a.elts, t->a.nelts * sizeof(apr_table_entry_t)); + make_array_core(&new->a, p, t->a.nalloc, sizeof(fspr_table_entry_t), 0); + memcpy(new->a.elts, t->a.elts, t->a.nelts * sizeof(fspr_table_entry_t)); new->a.nelts = t->a.nelts; memcpy(new->index_first, t->index_first, sizeof(int) * TABLE_HASH_SIZE); memcpy(new->index_last, t->index_last, sizeof(int) * TABLE_HASH_SIZE); @@ -417,11 +417,11 @@ APR_DECLARE(apr_table_t *) apr_table_copy(apr_pool_t *p, const apr_table_t *t) return new; } -static void table_reindex(apr_table_t *t) +static void table_reindex(fspr_table_t *t) { int i; int hash; - apr_table_entry_t *next_elt = (apr_table_entry_t *) t->a.elts; + fspr_table_entry_t *next_elt = (fspr_table_entry_t *) t->a.elts; t->index_initialized = 0; for (i = 0; i < t->a.nelts; i++, next_elt++) { @@ -434,17 +434,17 @@ static void table_reindex(apr_table_t *t) } } -APR_DECLARE(void) apr_table_clear(apr_table_t *t) +APR_DECLARE(void) fspr_table_clear(fspr_table_t *t) { t->a.nelts = 0; t->index_initialized = 0; } -APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key) +APR_DECLARE(const char *) fspr_table_get(const fspr_table_t *t, const char *key) { - apr_table_entry_t *next_elt; - apr_table_entry_t *end_elt; - apr_uint32_t checksum; + fspr_table_entry_t *next_elt; + fspr_table_entry_t *end_elt; + fspr_uint32_t checksum; int hash; if (key == NULL) { @@ -456,8 +456,8 @@ APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key) return NULL; } COMPUTE_KEY_CHECKSUM(key, checksum); - next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash];; - end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash]; + next_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_first[hash];; + end_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_last[hash]; for (; next_elt <= end_elt; next_elt++) { if ((checksum == next_elt->key_checksum) && @@ -469,13 +469,13 @@ APR_DECLARE(const char *) apr_table_get(const apr_table_t *t, const char *key) return NULL; } -APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_set(fspr_table_t *t, const char *key, const char *val) { - apr_table_entry_t *next_elt; - apr_table_entry_t *end_elt; - apr_table_entry_t *table_end; - apr_uint32_t checksum; + fspr_table_entry_t *next_elt; + fspr_table_entry_t *end_elt; + fspr_table_entry_t *table_end; + fspr_uint32_t checksum; int hash; COMPUTE_KEY_CHECKSUM(key, checksum); @@ -485,9 +485,9 @@ APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, TABLE_SET_INDEX_INITIALIZED(t, hash); goto add_new_elt; } - next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash];; - end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash]; - table_end =((apr_table_entry_t *) t->a.elts) + t->a.nelts; + next_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_first[hash];; + end_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_last[hash]; + table_end =((fspr_table_entry_t *) t->a.elts) + t->a.nelts; for (; next_elt <= end_elt; next_elt++) { if ((checksum == next_elt->key_checksum) && @@ -496,9 +496,9 @@ APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, /* Found an existing entry with the same key, so overwrite it */ int must_reindex = 0; - apr_table_entry_t *dst_elt = NULL; + fspr_table_entry_t *dst_elt = NULL; - next_elt->val = apr_pstrdup(t->a.pool, val); + next_elt->val = fspr_pstrdup(t->a.pool, val); /* Remove any other instances of this key */ for (next_elt++; next_elt <= end_elt; next_elt++) { @@ -535,19 +535,19 @@ APR_DECLARE(void) apr_table_set(apr_table_t *t, const char *key, add_new_elt: t->index_last[hash] = t->a.nelts; - next_elt = (apr_table_entry_t *) table_push(t); - next_elt->key = apr_pstrdup(t->a.pool, key); - next_elt->val = apr_pstrdup(t->a.pool, val); + next_elt = (fspr_table_entry_t *) table_push(t); + next_elt->key = fspr_pstrdup(t->a.pool, key); + next_elt->val = fspr_pstrdup(t->a.pool, val); next_elt->key_checksum = checksum; } -APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_setn(fspr_table_t *t, const char *key, const char *val) { - apr_table_entry_t *next_elt; - apr_table_entry_t *end_elt; - apr_table_entry_t *table_end; - apr_uint32_t checksum; + fspr_table_entry_t *next_elt; + fspr_table_entry_t *end_elt; + fspr_table_entry_t *table_end; + fspr_uint32_t checksum; int hash; COMPUTE_KEY_CHECKSUM(key, checksum); @@ -557,9 +557,9 @@ APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, TABLE_SET_INDEX_INITIALIZED(t, hash); goto add_new_elt; } - next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash];; - end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash]; - table_end =((apr_table_entry_t *) t->a.elts) + t->a.nelts; + next_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_first[hash];; + end_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_last[hash]; + table_end =((fspr_table_entry_t *) t->a.elts) + t->a.nelts; for (; next_elt <= end_elt; next_elt++) { if ((checksum == next_elt->key_checksum) && @@ -568,7 +568,7 @@ APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, /* Found an existing entry with the same key, so overwrite it */ int must_reindex = 0; - apr_table_entry_t *dst_elt = NULL; + fspr_table_entry_t *dst_elt = NULL; next_elt->val = (char *)val; @@ -607,18 +607,18 @@ APR_DECLARE(void) apr_table_setn(apr_table_t *t, const char *key, add_new_elt: t->index_last[hash] = t->a.nelts; - next_elt = (apr_table_entry_t *) table_push(t); + next_elt = (fspr_table_entry_t *) table_push(t); next_elt->key = (char *)key; next_elt->val = (char *)val; next_elt->key_checksum = checksum; } -APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key) +APR_DECLARE(void) fspr_table_unset(fspr_table_t *t, const char *key) { - apr_table_entry_t *next_elt; - apr_table_entry_t *end_elt; - apr_table_entry_t *dst_elt; - apr_uint32_t checksum; + fspr_table_entry_t *next_elt; + fspr_table_entry_t *end_elt; + fspr_table_entry_t *dst_elt; + fspr_uint32_t checksum; int hash; int must_reindex; @@ -627,8 +627,8 @@ APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key) return; } COMPUTE_KEY_CHECKSUM(key, checksum); - next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash]; - end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash]; + next_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_first[hash]; + end_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_last[hash]; must_reindex = 0; for (; next_elt <= end_elt; next_elt++) { if ((checksum == next_elt->key_checksum) && @@ -637,7 +637,7 @@ APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key) /* Found a match: remove this entry, plus any additional * matches for the same key that might follow */ - apr_table_entry_t *table_end = ((apr_table_entry_t *) t->a.elts) + + fspr_table_entry_t *table_end = ((fspr_table_entry_t *) t->a.elts) + t->a.nelts; t->a.nelts--; dst_elt = next_elt; @@ -667,12 +667,12 @@ APR_DECLARE(void) apr_table_unset(apr_table_t *t, const char *key) } } -APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_merge(fspr_table_t *t, const char *key, const char *val) { - apr_table_entry_t *next_elt; - apr_table_entry_t *end_elt; - apr_uint32_t checksum; + fspr_table_entry_t *next_elt; + fspr_table_entry_t *end_elt; + fspr_uint32_t checksum; int hash; COMPUTE_KEY_CHECKSUM(key, checksum); @@ -682,15 +682,15 @@ APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key, TABLE_SET_INDEX_INITIALIZED(t, hash); goto add_new_elt; } - next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash]; - end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash]; + next_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_first[hash]; + end_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_last[hash]; for (; next_elt <= end_elt; next_elt++) { if ((checksum == next_elt->key_checksum) && !strcasecmp(next_elt->key, key)) { /* Found an existing entry with the same key, so merge with it */ - next_elt->val = apr_pstrcat(t->a.pool, next_elt->val, ", ", + next_elt->val = fspr_pstrcat(t->a.pool, next_elt->val, ", ", val, NULL); return; } @@ -698,28 +698,28 @@ APR_DECLARE(void) apr_table_merge(apr_table_t *t, const char *key, add_new_elt: t->index_last[hash] = t->a.nelts; - next_elt = (apr_table_entry_t *) table_push(t); - next_elt->key = apr_pstrdup(t->a.pool, key); - next_elt->val = apr_pstrdup(t->a.pool, val); + next_elt = (fspr_table_entry_t *) table_push(t); + next_elt->key = fspr_pstrdup(t->a.pool, key); + next_elt->val = fspr_pstrdup(t->a.pool, val); next_elt->key_checksum = checksum; } -APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_mergen(fspr_table_t *t, const char *key, const char *val) { - apr_table_entry_t *next_elt; - apr_table_entry_t *end_elt; - apr_uint32_t checksum; + fspr_table_entry_t *next_elt; + fspr_table_entry_t *end_elt; + fspr_uint32_t checksum; int hash; #if APR_POOL_DEBUG { - if (!apr_pool_is_ancestor(apr_pool_find(key), t->a.pool)) { - fprintf(stderr, "apr_table_mergen: key not in ancestor pool of t\n"); + if (!fspr_pool_is_ancestor(fspr_pool_find(key), t->a.pool)) { + fprintf(stderr, "fspr_table_mergen: key not in ancestor pool of t\n"); abort(); } - if (!apr_pool_is_ancestor(apr_pool_find(val), t->a.pool)) { - fprintf(stderr, "apr_table_mergen: key not in ancestor pool of t\n"); + if (!fspr_pool_is_ancestor(fspr_pool_find(val), t->a.pool)) { + fprintf(stderr, "fspr_table_mergen: key not in ancestor pool of t\n"); abort(); } } @@ -732,15 +732,15 @@ APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key, TABLE_SET_INDEX_INITIALIZED(t, hash); goto add_new_elt; } - next_elt = ((apr_table_entry_t *) t->a.elts) + t->index_first[hash];; - end_elt = ((apr_table_entry_t *) t->a.elts) + t->index_last[hash]; + next_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_first[hash];; + end_elt = ((fspr_table_entry_t *) t->a.elts) + t->index_last[hash]; for (; next_elt <= end_elt; next_elt++) { if ((checksum == next_elt->key_checksum) && !strcasecmp(next_elt->key, key)) { /* Found an existing entry with the same key, so merge with it */ - next_elt->val = apr_pstrcat(t->a.pool, next_elt->val, ", ", + next_elt->val = fspr_pstrcat(t->a.pool, next_elt->val, ", ", val, NULL); return; } @@ -748,17 +748,17 @@ APR_DECLARE(void) apr_table_mergen(apr_table_t *t, const char *key, add_new_elt: t->index_last[hash] = t->a.nelts; - next_elt = (apr_table_entry_t *) table_push(t); + next_elt = (fspr_table_entry_t *) table_push(t); next_elt->key = (char *)key; next_elt->val = (char *)val; next_elt->key_checksum = checksum; } -APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_add(fspr_table_t *t, const char *key, const char *val) { - apr_table_entry_t *elts; - apr_uint32_t checksum; + fspr_table_entry_t *elts; + fspr_uint32_t checksum; int hash; hash = TABLE_HASH(key); @@ -768,27 +768,27 @@ APR_DECLARE(void) apr_table_add(apr_table_t *t, const char *key, TABLE_SET_INDEX_INITIALIZED(t, hash); } COMPUTE_KEY_CHECKSUM(key, checksum); - elts = (apr_table_entry_t *) table_push(t); - elts->key = apr_pstrdup(t->a.pool, key); - elts->val = apr_pstrdup(t->a.pool, val); + elts = (fspr_table_entry_t *) table_push(t); + elts->key = fspr_pstrdup(t->a.pool, key); + elts->val = fspr_pstrdup(t->a.pool, val); elts->key_checksum = checksum; } -APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key, +APR_DECLARE(void) fspr_table_addn(fspr_table_t *t, const char *key, const char *val) { - apr_table_entry_t *elts; - apr_uint32_t checksum; + fspr_table_entry_t *elts; + fspr_uint32_t checksum; int hash; #if APR_POOL_DEBUG { - if (!apr_pool_is_ancestor(apr_pool_find(key), t->a.pool)) { - fprintf(stderr, "apr_table_addn: key not in ancestor pool of t\n"); + if (!fspr_pool_is_ancestor(fspr_pool_find(key), t->a.pool)) { + fprintf(stderr, "fspr_table_addn: key not in ancestor pool of t\n"); abort(); } - if (!apr_pool_is_ancestor(apr_pool_find(val), t->a.pool)) { - fprintf(stderr, "apr_table_addn: key not in ancestor pool of t\n"); + if (!fspr_pool_is_ancestor(fspr_pool_find(val), t->a.pool)) { + fprintf(stderr, "fspr_table_addn: key not in ancestor pool of t\n"); abort(); } } @@ -801,40 +801,40 @@ APR_DECLARE(void) apr_table_addn(apr_table_t *t, const char *key, TABLE_SET_INDEX_INITIALIZED(t, hash); } COMPUTE_KEY_CHECKSUM(key, checksum); - elts = (apr_table_entry_t *) table_push(t); + elts = (fspr_table_entry_t *) table_push(t); elts->key = (char *)key; elts->val = (char *)val; elts->key_checksum = checksum; } -APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p, - const apr_table_t *overlay, - const apr_table_t *base) +APR_DECLARE(fspr_table_t *) fspr_table_overlay(fspr_pool_t *p, + const fspr_table_t *overlay, + const fspr_table_t *base) { - apr_table_t *res; + fspr_table_t *res; #if APR_POOL_DEBUG /* we don't copy keys and values, so it's necessary that * overlay->a.pool and base->a.pool have a life span at least * as long as p */ - if (!apr_pool_is_ancestor(overlay->a.pool, p)) { + if (!fspr_pool_is_ancestor(overlay->a.pool, p)) { fprintf(stderr, - "apr_table_overlay: overlay's pool is not an ancestor of p\n"); + "fspr_table_overlay: overlay's pool is not an ancestor of p\n"); abort(); } - if (!apr_pool_is_ancestor(base->a.pool, p)) { + if (!fspr_pool_is_ancestor(base->a.pool, p)) { fprintf(stderr, - "apr_table_overlay: base's pool is not an ancestor of p\n"); + "fspr_table_overlay: base's pool is not an ancestor of p\n"); abort(); } #endif - res = apr_palloc(p, sizeof(apr_table_t)); + res = fspr_palloc(p, sizeof(fspr_table_t)); /* behave like append_arrays */ res->a.pool = p; copy_array_hdr_core(&res->a, &overlay->a); - apr_array_cat(&res->a, &base->a); + fspr_array_cat(&res->a, &base->a); table_reindex(res); return res; } @@ -844,7 +844,7 @@ APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p, * For each key value given as a vararg: * run the function pointed to as * int comp(void *r, char *key, char *value); - * on each valid key-value pair in the apr_table_t t that matches the vararg key, + * on each valid key-value pair in the fspr_table_t t that matches the vararg key, * or once for every valid key-value pair if the vararg list is empty, * until the function returns false (0) or we finish the table. * @@ -854,42 +854,42 @@ APR_DECLARE(apr_table_t *) apr_table_overlay(apr_pool_t *p, * only one traversal will be made and will cut short if comp returns 0. * * Note that the table_get and table_merge functions assume that each key in - * the apr_table_t is unique (i.e., no multiple entries with the same key). This + * the fspr_table_t is unique (i.e., no multiple entries with the same key). This * function does not make that assumption, since it (unfortunately) isn't * true for some of Apache's tables. * * Note that rec is simply passed-on to the comp function, so that the * caller can pass additional info for the task. * - * ADDENDUM for apr_table_vdo(): + * ADDENDUM for fspr_table_vdo(): * * The caching api will allow a user to walk the header values: * - * apr_status_t apr_cache_el_header_walk(apr_cache_el *el, + * fspr_status_t fspr_cache_el_header_walk(fspr_cache_el *el, * int (*comp)(void *, const char *, const char *), void *rec, ...); * * So it can be ..., however from there I use a callback that use a va_list: * - * apr_status_t (*cache_el_header_walk)(apr_cache_el *el, + * fspr_status_t (*cache_el_header_walk)(fspr_cache_el *el, * int (*comp)(void *, const char *, const char *), void *rec, va_list); * * To pass those ...'s on down to the actual module that will handle walking - * their headers, in the file case this is actually just an apr_table - and - * rather than reimplementing apr_table_do (which IMHO would be bad) I just + * their headers, in the file case this is actually just an fspr_table - and + * rather than reimplementing fspr_table_do (which IMHO would be bad) I just * called it with the va_list. For mod_shmem_cache I don't need it since I - * can't use apr_table's, but mod_file_cache should (though a good hash would + * can't use fspr_table's, but mod_file_cache should (though a good hash would * be better, but that's a different issue :). * * So to make mod_file_cache easier to maintain, it's a good thing */ -APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp, - void *rec, const apr_table_t *t, ...) +APR_DECLARE_NONSTD(int) fspr_table_do(fspr_table_do_callback_fn_t *comp, + void *rec, const fspr_table_t *t, ...) { int rv; va_list vp; va_start(vp, t); - rv = apr_table_vdo(comp, rec, t, vp); + rv = fspr_table_vdo(comp, rec, t, vp); va_end(vp); return rv; @@ -905,12 +905,12 @@ APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp, * * Note also that this behavior is at odds with the behavior seen if an * empty va_list is passed in -- in that case, a zero return value terminates - * the entire apr_table_vdo (which is what I think should happen in + * the entire fspr_table_vdo (which is what I think should happen in * both cases). * * If nobody objects soon, I'm going to change the order of the nested * loops in this function so that any zero return value from the (*comp) - * function will cause a full termination of apr_table_vdo. I'm hesitant + * function will cause a full termination of fspr_table_vdo. I'm hesitant * at the moment because these (funky) semantics have been around for a * very long time, and although Apache doesn't seem to use them at all, * some third-party vendor might. I can only think of one possible reason @@ -925,11 +925,11 @@ APR_DECLARE_NONSTD(int) apr_table_do(apr_table_do_callback_fn_t *comp, * * Sigh. --JCW, 06/28/02 */ -APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp, - void *rec, const apr_table_t *t, va_list vp) +APR_DECLARE(int) fspr_table_vdo(fspr_table_do_callback_fn_t *comp, + void *rec, const fspr_table_t *t, va_list vp) { char *argp; - apr_table_entry_t *elts = (apr_table_entry_t *) t->a.elts; + fspr_table_entry_t *elts = (fspr_table_entry_t *) t->a.elts; int vdorv = 1; argp = va_arg(vp, char *); @@ -939,7 +939,7 @@ APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp, /* Scan for entries that match the next key */ int hash = TABLE_HASH(argp); if (TABLE_INDEX_IS_INITIALIZED(t, hash)) { - apr_uint32_t checksum; + fspr_uint32_t checksum; COMPUTE_KEY_CHECKSUM(argp, checksum); for (i = t->index_first[hash]; rv && (i <= t->index_last[hash]); ++i) { @@ -966,22 +966,22 @@ APR_DECLARE(int) apr_table_vdo(apr_table_do_callback_fn_t *comp, return vdorv; } -static apr_table_entry_t **table_mergesort(apr_pool_t *pool, - apr_table_entry_t **values, - apr_size_t n) +static fspr_table_entry_t **table_mergesort(fspr_pool_t *pool, + fspr_table_entry_t **values, + fspr_size_t n) { /* Bottom-up mergesort, based on design in Sedgewick's "Algorithms * in C," chapter 8 */ - apr_table_entry_t **values_tmp = - (apr_table_entry_t **)apr_palloc(pool, n * sizeof(apr_table_entry_t*)); - apr_size_t i; - apr_size_t blocksize; + fspr_table_entry_t **values_tmp = + (fspr_table_entry_t **)fspr_palloc(pool, n * sizeof(fspr_table_entry_t*)); + fspr_size_t i; + fspr_size_t blocksize; /* First pass: sort pairs of elements (blocksize=1) */ for (i = 0; i + 1 < n; i += 2) { if (strcasecmp(values[i]->key, values[i + 1]->key) > 0) { - apr_table_entry_t *swap = values[i]; + fspr_table_entry_t *swap = values[i]; values[i] = values[i + 1]; values[i + 1] = swap; } @@ -990,9 +990,9 @@ static apr_table_entry_t **table_mergesort(apr_pool_t *pool, /* Merge successively larger blocks */ blocksize = 2; while (blocksize < n) { - apr_table_entry_t **dst = values_tmp; - apr_size_t next_start; - apr_table_entry_t **swap; + fspr_table_entry_t **dst = values_tmp; + fspr_size_t next_start; + fspr_table_entry_t **swap; /* Merge consecutive pairs blocks of the next blocksize. * Within a block, elements are in sorted order due to @@ -1001,10 +1001,10 @@ static apr_table_entry_t **table_mergesort(apr_pool_t *pool, for (next_start = 0; next_start + blocksize < n; next_start += (blocksize + blocksize)) { - apr_size_t block1_start = next_start; - apr_size_t block2_start = block1_start + blocksize; - apr_size_t block1_end = block2_start; - apr_size_t block2_end = block2_start + blocksize; + fspr_size_t block1_start = next_start; + fspr_size_t block2_start = block1_start + blocksize; + fspr_size_t block1_end = block2_start; + fspr_size_t block2_end = block2_start + blocksize; if (block2_end > n) { /* The last block may be smaller than blocksize */ block2_end = n; @@ -1060,13 +1060,13 @@ static apr_table_entry_t **table_mergesort(apr_pool_t *pool, return values; } -APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags) +APR_DECLARE(void) fspr_table_compress(fspr_table_t *t, unsigned flags) { - apr_table_entry_t **sort_array; - apr_table_entry_t **sort_next; - apr_table_entry_t **sort_end; - apr_table_entry_t *table_next; - apr_table_entry_t **last; + fspr_table_entry_t **sort_array; + fspr_table_entry_t **sort_next; + fspr_table_entry_t **sort_end; + fspr_table_entry_t *table_next; + fspr_table_entry_t **last; int i; int dups_found; @@ -1078,10 +1078,10 @@ APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags) * array and sort to allow for easy detection of * duplicate keys */ - sort_array = (apr_table_entry_t **) - apr_palloc(t->a.pool, t->a.nelts * sizeof(apr_table_entry_t*)); + sort_array = (fspr_table_entry_t **) + fspr_palloc(t->a.pool, t->a.nelts * sizeof(fspr_table_entry_t*)); sort_next = sort_array; - table_next = (apr_table_entry_t *)t->a.elts; + table_next = (fspr_table_entry_t *)t->a.elts; i = t->a.nelts; do { *sort_next++ = table_next++; @@ -1102,7 +1102,7 @@ APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags) while (sort_next < sort_end) { if (((*sort_next)->key_checksum == (*last)->key_checksum) && !strcasecmp((*sort_next)->key, (*last)->key)) { - apr_table_entry_t **dup_last = sort_next + 1; + fspr_table_entry_t **dup_last = sort_next + 1; dups_found = 1; while ((dup_last < sort_end) && ((*dup_last)->key_checksum == (*last)->key_checksum) && @@ -1113,15 +1113,15 @@ APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags) * all have the same key */ if (flags == APR_OVERLAP_TABLES_MERGE) { - apr_size_t len = 0; - apr_table_entry_t **next = last; + fspr_size_t len = 0; + fspr_table_entry_t **next = last; char *new_val; char *val_dst; do { len += strlen((*next)->val); len += 2; /* for ", " or trailing null */ } while (++next <= dup_last); - new_val = (char *)apr_palloc(t->a.pool, len); + new_val = (char *)fspr_palloc(t->a.pool, len); val_dst = new_val; next = last; for (;;) { @@ -1153,9 +1153,9 @@ APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags) /* Shift elements to the left to fill holes left by removing duplicates */ if (dups_found) { - apr_table_entry_t *src = (apr_table_entry_t *)t->a.elts; - apr_table_entry_t *dst = (apr_table_entry_t *)t->a.elts; - apr_table_entry_t *last_elt = src + t->a.nelts; + fspr_table_entry_t *src = (fspr_table_entry_t *)t->a.elts; + fspr_table_entry_t *dst = (fspr_table_entry_t *)t->a.elts; + fspr_table_entry_t *last_elt = src + t->a.nelts; do { if (src->key) { *dst++ = *src; @@ -1167,12 +1167,12 @@ APR_DECLARE(void) apr_table_compress(apr_table_t *t, unsigned flags) table_reindex(t); } -static void apr_table_cat(apr_table_t *t, const apr_table_t *s) +static void fspr_table_cat(fspr_table_t *t, const fspr_table_t *s) { const int n = t->a.nelts; register int idx; - apr_array_cat(&t->a,&s->a); + fspr_array_cat(&t->a,&s->a); if (n == 0) { memcpy(t->index_first,s->index_first,sizeof(int) * TABLE_HASH_SIZE); @@ -1193,7 +1193,7 @@ static void apr_table_cat(apr_table_t *t, const apr_table_t *s) t->index_initialized |= s->index_initialized; } -APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b, +APR_DECLARE(void) fspr_table_overlap(fspr_table_t *a, const fspr_table_t *b, unsigned flags) { if (a->a.nelts + b->a.nelts == 0) { @@ -1203,13 +1203,13 @@ APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b, #if APR_POOL_DEBUG /* Since the keys and values are not copied, it's required that * b->a.pool has a lifetime at least as long as a->a.pool. */ - if (!apr_pool_is_ancestor(b->a.pool, a->a.pool)) { - fprintf(stderr, "apr_table_overlap: b's pool is not an ancestor of a's\n"); + if (!fspr_pool_is_ancestor(b->a.pool, a->a.pool)) { + fprintf(stderr, "fspr_table_overlap: b's pool is not an ancestor of a's\n"); abort(); } #endif - apr_table_cat(a, b); + fspr_table_cat(a, b); - apr_table_compress(a, flags); + fspr_table_compress(a, flags); } diff --git a/libs/apr/test/globalmutexchild.c b/libs/apr/test/globalmutexchild.c index 4b8737b02b..194cfb54ad 100644 --- a/libs/apr/test/globalmutexchild.c +++ b/libs/apr/test/globalmutexchild.c @@ -15,12 +15,12 @@ */ #include "testglobalmutex.h" -#include "apr_pools.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_global_mutex.h" -#include "apr_strings.h" -#include "apr.h" +#include "fspr_pools.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_global_mutex.h" +#include "fspr_strings.h" +#include "fspr.h" #if APR_HAVE_STDLIB_H #include @@ -29,36 +29,36 @@ int main(int argc, const char * const argv[]) { - apr_pool_t *p; + fspr_pool_t *p; int i = 0; - apr_lockmech_e mech; - apr_global_mutex_t *global_lock; - apr_status_t rv; + fspr_lockmech_e mech; + fspr_global_mutex_t *global_lock; + fspr_status_t rv; - apr_initialize(); - atexit(apr_terminate); + fspr_initialize(); + atexit(fspr_terminate); - apr_pool_create(&p, NULL); + fspr_pool_create(&p, NULL); if (argc >= 2) { - mech = (apr_lockmech_e)apr_strtoi64(argv[1], NULL, 0); + mech = (fspr_lockmech_e)fspr_strtoi64(argv[1], NULL, 0); } else { mech = APR_LOCK_DEFAULT; } - rv = apr_global_mutex_create(&global_lock, LOCKNAME, mech, p); + rv = fspr_global_mutex_create(&global_lock, LOCKNAME, mech, p); if (rv != APR_SUCCESS) { exit(-rv); } - apr_global_mutex_child_init(&global_lock, LOCKNAME, p); + fspr_global_mutex_child_init(&global_lock, LOCKNAME, p); while (1) { - apr_global_mutex_lock(global_lock); + fspr_global_mutex_lock(global_lock); if (i == MAX_ITER) { - apr_global_mutex_unlock(global_lock); + fspr_global_mutex_unlock(global_lock); exit(i); } i++; - apr_global_mutex_unlock(global_lock); + fspr_global_mutex_unlock(global_lock); } exit(0); } diff --git a/libs/apr/test/internal/testregex.c b/libs/apr/test/internal/testregex.c index 20dcfdebe7..7a46b78364 100644 --- a/libs/apr/test/internal/testregex.c +++ b/libs/apr/test/internal/testregex.c @@ -15,25 +15,25 @@ */ -#include "apr_strings.h" -#include "apr_pools.h" -#include "apr_general.h" -#include "apr_hash.h" -#include "apr_lib.h" -#include "apr_time.h" +#include "fspr_strings.h" +#include "fspr_pools.h" +#include "fspr_general.h" +#include "fspr_hash.h" +#include "fspr_lib.h" +#include "fspr_time.h" #include #include #include int main( int argc, char** argv) { - apr_pool_t *context; + fspr_pool_t *context; regex_t regex; int rc; int i; int iters; - apr_time_t now; - apr_time_t end; - apr_hash_t *h; + fspr_time_t now; + fspr_time_t end; + fspr_hash_t *h; if (argc !=4 ) { @@ -42,9 +42,9 @@ int main( int argc, char** argv) { } iters = atoi( argv[3]); - apr_initialize() ; - atexit(apr_terminate); - if (apr_pool_create(&context, NULL) != APR_SUCCESS) { + fspr_initialize() ; + atexit(fspr_terminate); + if (fspr_pool_create(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Something went wrong\n"); exit(-1); } @@ -63,29 +63,29 @@ int main( int argc, char** argv) { else { fprintf(stderr,"No Match\n"); } - now = apr_time_now(); + now = fspr_time_now(); for (i=0;i #include @@ -54,15 +54,15 @@ void displaynw(struct testval *f, struct testval *l) void test_nrange(struct testval *p) { struct testval f, l, s; - apr_status_t rc; + fspr_status_t rc; int success = 0; memcpy (&s, p, sizeof(s)); ++s.nl; do { - apr_size_t nl = s.nl, wl = sizeof(s.w) / 2; - rc = apr_conv_utf8_to_ucs2(s.n, &nl, s.w, &wl); + fspr_size_t nl = s.nl, wl = sizeof(s.w) / 2; + rc = fspr_conv_utf8_to_ucs2(s.n, &nl, s.w, &wl); s.wl = (sizeof(s.w) / 2) - wl; if (!nl && rc == APR_SUCCESS) { if (!success) { @@ -106,15 +106,15 @@ void test_nrange(struct testval *p) void test_wrange(struct testval *p) { struct testval f, l, s; - apr_status_t rc; + fspr_status_t rc; int success = 0; memcpy (&s, p, sizeof(s)); ++s.wl; do { - apr_size_t nl = sizeof(s.n), wl = s.wl; - rc = apr_conv_ucs2_to_utf8(s.w, &wl, s.n, &nl); + fspr_size_t nl = sizeof(s.n), wl = s.wl; + rc = fspr_conv_ucs2_to_utf8(s.w, &wl, s.n, &nl); s.nl = sizeof(s.n) - nl; if (!wl && rc == APR_SUCCESS) { if (!success) { @@ -146,7 +146,7 @@ void test_wrange(struct testval *p) do { int wl = s.wl, nl = sizeof(s.n); - rc = apr_conv_ucs2_to_utf8(s.w, &wl, s.n, &nl); + rc = fspr_conv_ucs2_to_utf8(s.w, &wl, s.n, &nl); s.nl = sizeof(s.n) - s.nl; if (rc == APR_INCOMPLETE) { test_wrange(&s); @@ -164,11 +164,11 @@ int main(int argc, char **argv) struct testval s; memset (&s, 0, sizeof(s)); - if (argc < 2 || apr_tolower(*argv[1]) != 'w') { + if (argc < 2 || fspr_tolower(*argv[1]) != 'w') { printf ("\n\nTesting Narrow Char Ranges\n"); test_nrange(&s); } - if (argc < 2 || apr_tolower(*argv[1]) != 'n') { + if (argc < 2 || fspr_tolower(*argv[1]) != 'n') { printf ("\n\nTesting Wide Char Ranges\n"); test_wrange(&s); } diff --git a/libs/apr/test/mod_test.c b/libs/apr/test/mod_test.c index 2178e94059..ecae249f9f 100644 --- a/libs/apr/test/mod_test.c +++ b/libs/apr/test/mod_test.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_strings.h" +#include "fspr_strings.h" void print_hello(char str[256]); int count_reps(int reps); void print_hello(char str[256]) { - apr_cpystrn(str, "Hello - I'm a DSO!\n", strlen("Hello - I'm a DSO!\n") + 1); + fspr_cpystrn(str, "Hello - I'm a DSO!\n", strlen("Hello - I'm a DSO!\n") + 1); } int count_reps(int reps) diff --git a/libs/apr/test/occhild.c b/libs/apr/test/occhild.c index a96885d827..09954d1ac5 100644 --- a/libs/apr/test/occhild.c +++ b/libs/apr/test/occhild.c @@ -1,6 +1,6 @@ -#include "apr.h" -#include "apr_file_io.h" -#include "apr.h" +#include "fspr.h" +#include "fspr_file_io.h" +#include "fspr.h" #if APR_HAVE_STDLIB_H #include @@ -9,18 +9,18 @@ int main(void) { char buf[256]; - apr_file_t *err; - apr_pool_t *p; + fspr_file_t *err; + fspr_pool_t *p; - apr_initialize(); - atexit(apr_terminate); + fspr_initialize(); + atexit(fspr_terminate); - apr_pool_create(&p, NULL); - apr_file_open_stdin(&err, p); + fspr_pool_create(&p, NULL); + fspr_file_open_stdin(&err, p); while (1) { - apr_size_t length = 256; - apr_file_read(err, buf, &length); + fspr_size_t length = 256; + fspr_file_read(err, buf, &length); } exit(0); /* just to keep the compiler happy */ } diff --git a/libs/apr/test/proc_child.c b/libs/apr/test/proc_child.c index 405bb7f5b6..b712dddcee 100644 --- a/libs/apr/test/proc_child.c +++ b/libs/apr/test/proc_child.c @@ -1,4 +1,4 @@ -#include "apr.h" +#include "fspr.h" #include #if APR_HAVE_UNISTD_H #include @@ -11,7 +11,7 @@ int main(void) { char buf[256]; - apr_ssize_t bytes; + fspr_ssize_t bytes; bytes = read(STDIN_FILENO, buf, 256); if (bytes > 0) diff --git a/libs/apr/test/readchild.c b/libs/apr/test/readchild.c index f8443cceb8..92eb1af06c 100644 --- a/libs/apr/test/readchild.c +++ b/libs/apr/test/readchild.c @@ -16,31 +16,31 @@ #include -#include "apr_file_io.h" +#include "fspr_file_io.h" int main(int argc, char *argv[]) { - apr_file_t *in, *out; - apr_size_t nbytes, total_bytes; - apr_pool_t *p; + fspr_file_t *in, *out; + fspr_size_t nbytes, total_bytes; + fspr_pool_t *p; char buf[128]; - apr_status_t rv; + fspr_status_t rv; - apr_initialize(); - atexit(apr_terminate); - apr_pool_create(&p, NULL); + fspr_initialize(); + atexit(fspr_terminate); + fspr_pool_create(&p, NULL); - apr_file_open_stdin(&in, p); - apr_file_open_stdout(&out, p); + fspr_file_open_stdin(&in, p); + fspr_file_open_stdout(&out, p); total_bytes = 0; nbytes = sizeof(buf); - while ((rv = apr_file_read(in, buf, &nbytes)) == APR_SUCCESS) { + while ((rv = fspr_file_read(in, buf, &nbytes)) == APR_SUCCESS) { total_bytes += nbytes; nbytes = sizeof(buf); } - apr_file_printf(out, "%" APR_SIZE_T_FMT " bytes were read\n", + fspr_file_printf(out, "%" APR_SIZE_T_FMT " bytes were read\n", total_bytes); return 0; } diff --git a/libs/apr/test/sendfile.c b/libs/apr/test/sendfile.c index cfa1fb8a76..a788ba98b9 100644 --- a/libs/apr/test/sendfile.c +++ b/libs/apr/test/sendfile.c @@ -19,10 +19,10 @@ #include #include #include -#include "apr_network_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_poll.h" +#include "fspr_network_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_poll.h" #if !APR_HAS_SENDFILE int main(void) @@ -53,103 +53,103 @@ int main(void) typedef enum {BLK, NONBLK, TIMEOUT} client_socket_mode_t; -static void apr_setup(apr_pool_t **p, apr_socket_t **sock, int *family) +static void fspr_setup(fspr_pool_t **p, fspr_socket_t **sock, int *family) { char buf[120]; - apr_status_t rv; + fspr_status_t rv; - rv = apr_initialize(); + rv = fspr_initialize(); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_initialize()->%d/%s\n", + fprintf(stderr, "fspr_initialize()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } - atexit(apr_terminate); + atexit(fspr_terminate); - rv = apr_pool_create(p, NULL); + rv = fspr_pool_create(p, NULL); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_pool_create()->%d/%s\n", + fprintf(stderr, "fspr_pool_create()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } *sock = NULL; - rv = apr_socket_create(sock, *family, SOCK_STREAM, 0, *p); + rv = fspr_socket_create(sock, *family, SOCK_STREAM, 0, *p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_create()->%d/%s\n", + fprintf(stderr, "fspr_socket_create()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (*family == APR_UNSPEC) { - apr_sockaddr_t *localsa; + fspr_sockaddr_t *localsa; - rv = apr_socket_addr_get(&localsa, APR_LOCAL, *sock); + rv = fspr_socket_addr_get(&localsa, APR_LOCAL, *sock); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_addr_get()->%d/%s\n", + fprintf(stderr, "fspr_socket_addr_get()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } *family = localsa->family; } } -static void create_testfile(apr_pool_t *p, const char *fname) +static void create_testfile(fspr_pool_t *p, const char *fname) { - apr_file_t *f = NULL; - apr_status_t rv; + fspr_file_t *f = NULL; + fspr_status_t rv; char buf[120]; int i; - apr_finfo_t finfo; + fspr_finfo_t finfo; printf("Creating a test file...\n"); - rv = apr_file_open(&f, fname, + rv = fspr_file_open(&f, fname, APR_CREATE | APR_WRITE | APR_TRUNCATE | APR_BUFFERED, APR_UREAD | APR_UWRITE, p); if (rv) { - fprintf(stderr, "apr_file_open()->%d/%s\n", - rv, apr_strerror(rv, buf, sizeof buf)); + fprintf(stderr, "fspr_file_open()->%d/%s\n", + rv, fspr_strerror(rv, buf, sizeof buf)); exit(1); } buf[0] = FILE_DATA_CHAR; buf[1] = '\0'; for (i = 0; i < FILE_LENGTH; i++) { - /* exercise apr_file_putc() and apr_file_puts() on buffered files */ + /* exercise fspr_file_putc() and fspr_file_puts() on buffered files */ if ((i % 2) == 0) { - rv = apr_file_putc(buf[0], f); + rv = fspr_file_putc(buf[0], f); if (rv) { - fprintf(stderr, "apr_file_putc()->%d/%s\n", - rv, apr_strerror(rv, buf, sizeof buf)); + fprintf(stderr, "fspr_file_putc()->%d/%s\n", + rv, fspr_strerror(rv, buf, sizeof buf)); exit(1); } } else { - rv = apr_file_puts(buf, f); + rv = fspr_file_puts(buf, f); if (rv) { - fprintf(stderr, "apr_file_puts()->%d/%s\n", - rv, apr_strerror(rv, buf, sizeof buf)); + fprintf(stderr, "fspr_file_puts()->%d/%s\n", + rv, fspr_strerror(rv, buf, sizeof buf)); exit(1); } } } - rv = apr_file_close(f); + rv = fspr_file_close(f); if (rv) { - fprintf(stderr, "apr_file_close()->%d/%s\n", - rv, apr_strerror(rv, buf, sizeof buf)); + fprintf(stderr, "fspr_file_close()->%d/%s\n", + rv, fspr_strerror(rv, buf, sizeof buf)); exit(1); } - rv = apr_stat(&finfo, fname, APR_FINFO_NORM, p); + rv = fspr_stat(&finfo, fname, APR_FINFO_NORM, p); if (rv != APR_SUCCESS && rv != APR_INCOMPLETE) { - fprintf(stderr, "apr_stat()->%d/%s\n", - rv, apr_strerror(rv, buf, sizeof buf)); + fprintf(stderr, "fspr_stat()->%d/%s\n", + rv, fspr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -166,52 +166,52 @@ static void create_testfile(apr_pool_t *p, const char *fname) static int client(client_socket_mode_t socket_mode, char *host) { - apr_status_t rv, tmprv; - apr_socket_t *sock; - apr_pool_t *p; + fspr_status_t rv, tmprv; + fspr_socket_t *sock; + fspr_pool_t *p; char buf[120]; - apr_file_t *f = NULL; - apr_size_t len; - apr_size_t expected_len; - apr_off_t current_file_offset; - apr_hdtr_t hdtr; + fspr_file_t *f = NULL; + fspr_size_t len; + fspr_size_t expected_len; + fspr_off_t current_file_offset; + fspr_hdtr_t hdtr; struct iovec headers[3]; struct iovec trailers[3]; - apr_size_t bytes_read; - apr_pollset_t *pset; - apr_int32_t nsocks; + fspr_size_t bytes_read; + fspr_pollset_t *pset; + fspr_int32_t nsocks; int i; int family; - apr_sockaddr_t *destsa; + fspr_sockaddr_t *destsa; family = APR_INET; - apr_setup(&p, &sock, &family); + fspr_setup(&p, &sock, &family); create_testfile(p, TESTFILE); - rv = apr_file_open(&f, TESTFILE, APR_READ, 0, p); + rv = fspr_file_open(&f, TESTFILE, APR_READ, 0, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_file_open()->%d/%s\n", + fprintf(stderr, "fspr_file_open()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (!host) { host = "127.0.0.1"; } - rv = apr_sockaddr_info_get(&destsa, host, family, TESTSF_PORT, 0, p); + rv = fspr_sockaddr_info_get(&destsa, host, family, TESTSF_PORT, 0, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_sockaddr_info_get()->%d/%s\n", + fprintf(stderr, "fspr_sockaddr_info_get()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } - rv = apr_socket_connect(sock, destsa); + rv = fspr_socket_connect(sock, destsa); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_connect()->%d/%s\n", + fprintf(stderr, "fspr_socket_connect()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -221,21 +221,21 @@ static int client(client_socket_mode_t socket_mode, char *host) break; case NONBLK: /* set it non-blocking */ - rv = apr_socket_opt_set(sock, APR_SO_NONBLOCK, 1); + rv = fspr_socket_opt_set(sock, APR_SO_NONBLOCK, 1); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n", + fprintf(stderr, "fspr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } break; case TIMEOUT: /* set a timeout */ - rv = apr_socket_timeout_set(sock, 100 * APR_USEC_PER_SEC); + rv = fspr_socket_timeout_set(sock, 100 * APR_USEC_PER_SEC); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n", + fprintf(stderr, "fspr_socket_opt_set(APR_SO_NONBLOCK)->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } break; @@ -275,36 +275,36 @@ static int client(client_socket_mode_t socket_mode, char *host) if (socket_mode == BLK) { current_file_offset = 0; len = FILE_LENGTH; - rv = apr_socket_sendfile(sock, f, &hdtr, ¤t_file_offset, &len, 0); + rv = fspr_socket_sendfile(sock, f, &hdtr, ¤t_file_offset, &len, 0); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_sendfile()->%d/%s\n", + fprintf(stderr, "fspr_socket_sendfile()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } - printf("apr_socket_sendfile() updated offset with %ld\n", + printf("fspr_socket_sendfile() updated offset with %ld\n", (long int)current_file_offset); - printf("apr_socket_sendfile() updated len with %ld\n", + printf("fspr_socket_sendfile() updated len with %ld\n", (long int)len); printf("bytes really sent: %" APR_SIZE_T_FMT "\n", expected_len); if (len != expected_len) { - fprintf(stderr, "apr_socket_sendfile() didn't report the correct " + fprintf(stderr, "fspr_socket_sendfile() didn't report the correct " "number of bytes sent!\n"); exit(1); } } else { /* non-blocking... wooooooo */ - apr_size_t total_bytes_sent; - apr_pollfd_t pfd; + fspr_size_t total_bytes_sent; + fspr_pollfd_t pfd; pset = NULL; - rv = apr_pollset_create(&pset, 1, p, 0); + rv = fspr_pollset_create(&pset, 1, p, 0); assert(!rv); pfd.p = p; pfd.desc_type = APR_POLL_SOCKET; @@ -313,17 +313,17 @@ static int client(client_socket_mode_t socket_mode, char *host) pfd.desc.s = sock; pfd.client_data = NULL; - rv = apr_pollset_add(pset, &pfd); + rv = fspr_pollset_add(pset, &pfd); assert(!rv); total_bytes_sent = 0; current_file_offset = 0; len = FILE_LENGTH; do { - apr_size_t tmplen; + fspr_size_t tmplen; tmplen = len; /* bytes remaining to send from the file */ - printf("Calling apr_socket_sendfile()...\n"); + printf("Calling fspr_socket_sendfile()...\n"); printf("Headers (%d):\n", hdtr.numheaders); for (i = 0; i < hdtr.numheaders; i++) { printf("\t%ld bytes (%c)\n", @@ -338,13 +338,13 @@ static int client(client_socket_mode_t socket_mode, char *host) (long)hdtr.trailers[i].iov_len); } - rv = apr_socket_sendfile(sock, f, &hdtr, ¤t_file_offset, &tmplen, 0); - printf("apr_socket_sendfile()->%d, sent %ld bytes\n", rv, (long)tmplen); + rv = fspr_socket_sendfile(sock, f, &hdtr, ¤t_file_offset, &tmplen, 0); + printf("fspr_socket_sendfile()->%d, sent %ld bytes\n", rv, (long)tmplen); if (rv) { if (APR_STATUS_IS_EAGAIN(rv)) { assert(tmplen == 0); nsocks = 1; - tmprv = apr_pollset_poll(pset, -1, &nsocks, NULL); + tmprv = fspr_pollset_poll(pset, -1, &nsocks, NULL); assert(!tmprv); assert(nsocks == 1); /* continue; */ @@ -426,43 +426,43 @@ static int client(client_socket_mode_t socket_mode, char *host) } current_file_offset = 0; - rv = apr_file_seek(f, APR_CUR, ¤t_file_offset); + rv = fspr_file_seek(f, APR_CUR, ¤t_file_offset); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_file_seek()->%d/%s\n", + fprintf(stderr, "fspr_file_seek()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } - printf("After apr_socket_sendfile(), the kernel file pointer is " + printf("After fspr_socket_sendfile(), the kernel file pointer is " "at offset %ld.\n", (long int)current_file_offset); - rv = apr_socket_shutdown(sock, APR_SHUTDOWN_WRITE); + rv = fspr_socket_shutdown(sock, APR_SHUTDOWN_WRITE); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_shutdown()->%d/%s\n", + fprintf(stderr, "fspr_socket_shutdown()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } /* in case this is the non-blocking test, set socket timeout; * we're just waiting for EOF */ - rv = apr_socket_timeout_set(sock, apr_time_from_sec(3)); + rv = fspr_socket_timeout_set(sock, fspr_time_from_sec(3)); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_timeout_set()->%d/%s\n", + fprintf(stderr, "fspr_socket_timeout_set()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } bytes_read = 1; - rv = apr_socket_recv(sock, buf, &bytes_read); + rv = fspr_socket_recv(sock, buf, &bytes_read); if (rv != APR_EOF) { - fprintf(stderr, "apr_socket_recv()->%d/%s (expected APR_EOF)\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s (expected APR_EOF)\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 0) { @@ -472,13 +472,13 @@ static int client(client_socket_mode_t socket_mode, char *host) exit(1); } - printf("client: apr_socket_sendfile() worked as expected!\n"); + printf("client: fspr_socket_sendfile() worked as expected!\n"); - rv = apr_file_remove(TESTFILE, p); + rv = fspr_file_remove(TESTFILE, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_file_remove()->%d/%s\n", + fprintf(stderr, "fspr_file_remove()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -487,58 +487,58 @@ static int client(client_socket_mode_t socket_mode, char *host) static int server(void) { - apr_status_t rv; - apr_socket_t *sock; - apr_pool_t *p; + fspr_status_t rv; + fspr_socket_t *sock; + fspr_pool_t *p; char buf[120]; int i; - apr_socket_t *newsock = NULL; - apr_size_t bytes_read; - apr_sockaddr_t *localsa; + fspr_socket_t *newsock = NULL; + fspr_size_t bytes_read; + fspr_sockaddr_t *localsa; int family; family = APR_UNSPEC; - apr_setup(&p, &sock, &family); + fspr_setup(&p, &sock, &family); - rv = apr_socket_opt_set(sock, APR_SO_REUSEADDR, 1); + rv = fspr_socket_opt_set(sock, APR_SO_REUSEADDR, 1); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_opt_set()->%d/%s\n", + fprintf(stderr, "fspr_socket_opt_set()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } - rv = apr_sockaddr_info_get(&localsa, NULL, family, TESTSF_PORT, 0, p); + rv = fspr_sockaddr_info_get(&localsa, NULL, family, TESTSF_PORT, 0, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_sockaddr_info_get()->%d/%s\n", + fprintf(stderr, "fspr_sockaddr_info_get()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } - rv = apr_socket_bind(sock, localsa); + rv = fspr_socket_bind(sock, localsa); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_bind()->%d/%s\n", + fprintf(stderr, "fspr_socket_bind()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } - rv = apr_socket_listen(sock, 5); + rv = fspr_socket_listen(sock, 5); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_listen()->%d/%s\n", + fprintf(stderr, "fspr_socket_listen()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } printf("Waiting for a client to connect...\n"); - rv = apr_socket_accept(&newsock, sock, p); + rv = fspr_socket_accept(&newsock, sock, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_accept()->%d/%s\n", + fprintf(stderr, "fspr_socket_accept()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } @@ -546,11 +546,11 @@ static int server(void) assert(sizeof buf > strlen(HDR1)); bytes_read = strlen(HDR1); - rv = apr_socket_recv(newsock, buf, &bytes_read); + rv = fspr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_recv()->%d/%s\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != strlen(HDR1)) { @@ -566,11 +566,11 @@ static int server(void) assert(sizeof buf > strlen(HDR2)); bytes_read = strlen(HDR2); - rv = apr_socket_recv(newsock, buf, &bytes_read); + rv = fspr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_recv()->%d/%s\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != strlen(HDR2)) { @@ -586,15 +586,15 @@ static int server(void) for (i = 0; i < HDR3_LEN; i++) { bytes_read = 1; - rv = apr_socket_recv(newsock, buf, &bytes_read); + rv = fspr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_recv()->%d/%s\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 1) { - fprintf(stderr, "apr_socket_recv()->%ld bytes instead of 1\n", + fprintf(stderr, "fspr_socket_recv()->%ld bytes instead of 1\n", (long int)bytes_read); exit(1); } @@ -611,15 +611,15 @@ static int server(void) for (i = 0; i < FILE_LENGTH; i++) { bytes_read = 1; - rv = apr_socket_recv(newsock, buf, &bytes_read); + rv = fspr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_recv()->%d/%s\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 1) { - fprintf(stderr, "apr_socket_recv()->%ld bytes instead of 1\n", + fprintf(stderr, "fspr_socket_recv()->%ld bytes instead of 1\n", (long int)bytes_read); exit(1); } @@ -636,11 +636,11 @@ static int server(void) assert(sizeof buf > strlen(TRL1)); bytes_read = strlen(TRL1); - rv = apr_socket_recv(newsock, buf, &bytes_read); + rv = fspr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_recv()->%d/%s\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != strlen(TRL1)) { @@ -656,11 +656,11 @@ static int server(void) assert(sizeof buf > strlen(TRL2)); bytes_read = strlen(TRL2); - rv = apr_socket_recv(newsock, buf, &bytes_read); + rv = fspr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_recv()->%d/%s\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != strlen(TRL2)) { @@ -676,15 +676,15 @@ static int server(void) for (i = 0; i < TRL3_LEN; i++) { bytes_read = 1; - rv = apr_socket_recv(newsock, buf, &bytes_read); + rv = fspr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_socket_recv()->%d/%s\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 1) { - fprintf(stderr, "apr_socket_recv()->%ld bytes instead of 1\n", + fprintf(stderr, "fspr_socket_recv()->%ld bytes instead of 1\n", (long int)bytes_read); exit(1); } @@ -700,11 +700,11 @@ static int server(void) } bytes_read = 1; - rv = apr_socket_recv(newsock, buf, &bytes_read); + rv = fspr_socket_recv(newsock, buf, &bytes_read); if (rv != APR_EOF) { - fprintf(stderr, "apr_socket_recv()->%d/%s (expected APR_EOF)\n", + fprintf(stderr, "fspr_socket_recv()->%d/%s (expected APR_EOF)\n", rv, - apr_strerror(rv, buf, sizeof buf)); + fspr_strerror(rv, buf, sizeof buf)); exit(1); } if (bytes_read != 0) { @@ -714,7 +714,7 @@ static int server(void) exit(1); } - printf("server: apr_socket_sendfile() worked as expected!\n"); + printf("server: fspr_socket_sendfile() worked as expected!\n"); return 0; } diff --git a/libs/apr/test/sockchild.c b/libs/apr/test/sockchild.c index 5c15d113fb..d1d5e3a8b4 100644 --- a/libs/apr/test/sockchild.c +++ b/libs/apr/test/sockchild.c @@ -16,49 +16,49 @@ #include #include "testsock.h" -#include "apr_network_io.h" -#include "apr_pools.h" +#include "fspr_network_io.h" +#include "fspr_pools.h" int main(int argc, char *argv[]) { - apr_pool_t *p; - apr_socket_t *sock; - apr_status_t rv; - apr_sockaddr_t *remote_sa; + fspr_pool_t *p; + fspr_socket_t *sock; + fspr_status_t rv; + fspr_sockaddr_t *remote_sa; - apr_initialize(); - atexit(apr_terminate); - apr_pool_create(&p, NULL); + fspr_initialize(); + atexit(fspr_terminate); + fspr_pool_create(&p, NULL); if (argc < 2) { exit(-1); } - rv = apr_sockaddr_info_get(&remote_sa, "127.0.0.1", APR_UNSPEC, 8021, 0, p); + rv = fspr_sockaddr_info_get(&remote_sa, "127.0.0.1", APR_UNSPEC, 8021, 0, p); if (rv != APR_SUCCESS) { exit(-1); } - if (apr_socket_create(&sock, remote_sa->family, SOCK_STREAM, 0, + if (fspr_socket_create(&sock, remote_sa->family, SOCK_STREAM, 0, p) != APR_SUCCESS) { exit(-1); } - rv = apr_socket_timeout_set(sock, apr_time_from_sec(3)); + rv = fspr_socket_timeout_set(sock, fspr_time_from_sec(3)); if (rv) { exit(-1); } - apr_socket_connect(sock, remote_sa); + fspr_socket_connect(sock, remote_sa); if (!strcmp("read", argv[1])) { char datarecv[STRLEN]; - apr_size_t length = STRLEN; - apr_status_t rv; + fspr_size_t length = STRLEN; + fspr_status_t rv; memset(datarecv, 0, STRLEN); - rv = apr_socket_recv(sock, datarecv, &length); - apr_socket_close(sock); + rv = fspr_socket_recv(sock, datarecv, &length); + fspr_socket_close(sock); if (APR_STATUS_IS_TIMEUP(rv)) { exit(SOCKET_TIMEOUT); } @@ -70,10 +70,10 @@ int main(int argc, char *argv[]) exit(length); } else if (!strcmp("write", argv[1])) { - apr_size_t length = strlen(DATASTR); - apr_socket_send(sock, DATASTR, &length); + fspr_size_t length = strlen(DATASTR); + fspr_socket_send(sock, DATASTR, &length); - apr_socket_close(sock); + fspr_socket_close(sock); exit(length); } exit(-1); diff --git a/libs/apr/test/testapp.c b/libs/apr/test/testapp.c index 77607aa388..53b3dfedb3 100644 --- a/libs/apr/test/testapp.c +++ b/libs/apr/test/testapp.c @@ -1,10 +1,10 @@ -#include -#include +#include +#include int main(int argc, const char * const * argv, const char * const *env) { - apr_app_initialize(&argc, &argv, &env); + fspr_app_initialize(&argc, &argv, &env); - apr_terminate(); + fspr_terminate(); } diff --git a/libs/apr/test/testargs.c b/libs/apr/test/testargs.c index cb501924f1..9aab69e4f2 100644 --- a/libs/apr/test/testargs.c +++ b/libs/apr/test/testargs.c @@ -14,19 +14,19 @@ * limitations under the License. */ -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_getopt.h" -#include "apr_strings.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_getopt.h" +#include "fspr_strings.h" #include "testutil.h" static void format_arg(char *str, char option, const char *arg) { if (arg) { - apr_snprintf(str, 8196, "%soption: %c with %s\n", str, option, arg); + fspr_snprintf(str, 8196, "%soption: %c with %s\n", str, option, arg); } else { - apr_snprintf(str, 8196, "%soption: %c\n", str, option); + fspr_snprintf(str, 8196, "%soption: %c\n", str, option); } } @@ -35,7 +35,7 @@ static void unknown_arg(void *str, const char *err, ...) va_list va; va_start(va, err); - apr_vsnprintf(str, 8196, err, va); + fspr_vsnprintf(str, 8196, err, va); va_end(va); } @@ -43,17 +43,17 @@ static void no_options_found(abts_case *tc, void *data) { int largc = 5; const char * const largv[] = {"testprog", "-a", "-b", "-c", "-d"}; - apr_getopt_t *opt; - apr_status_t rv; + fspr_getopt_t *opt; + fspr_status_t rv; char ch; const char *optarg; char str[8196]; str[0] = '\0'; - rv = apr_getopt_init(&opt, p, largc, largv); + rv = fspr_getopt_init(&opt, p, largc, largv); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - while (apr_getopt(opt, "abcd", &ch, &optarg) == APR_SUCCESS) { + while (fspr_getopt(opt, "abcd", &ch, &optarg) == APR_SUCCESS) { switch (ch) { case 'a': case 'b': @@ -73,20 +73,20 @@ static void no_options(abts_case *tc, void *data) { int largc = 5; const char * const largv[] = {"testprog", "-a", "-b", "-c", "-d"}; - apr_getopt_t *opt; - apr_status_t rv; + fspr_getopt_t *opt; + fspr_status_t rv; char ch; const char *optarg; char str[8196]; str[0] = '\0'; - rv = apr_getopt_init(&opt, p, largc, largv); + rv = fspr_getopt_init(&opt, p, largc, largv); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); opt->errfn = unknown_arg; opt->errarg = str; - while (apr_getopt(opt, "efgh", &ch, &optarg) == APR_SUCCESS) { + while (fspr_getopt(opt, "efgh", &ch, &optarg) == APR_SUCCESS) { switch (ch) { case 'a': case 'b': @@ -105,20 +105,20 @@ static void required_option(abts_case *tc, void *data) { int largc = 3; const char * const largv[] = {"testprog", "-a", "foo"}; - apr_getopt_t *opt; - apr_status_t rv; + fspr_getopt_t *opt; + fspr_status_t rv; char ch; const char *optarg; char str[8196]; str[0] = '\0'; - rv = apr_getopt_init(&opt, p, largc, largv); + rv = fspr_getopt_init(&opt, p, largc, largv); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); opt->errfn = unknown_arg; opt->errarg = str; - while (apr_getopt(opt, "a:", &ch, &optarg) == APR_SUCCESS) { + while (fspr_getopt(opt, "a:", &ch, &optarg) == APR_SUCCESS) { switch (ch) { case 'a': format_arg(str, ch, optarg); @@ -134,20 +134,20 @@ static void required_option_notgiven(abts_case *tc, void *data) { int largc = 2; const char * const largv[] = {"testprog", "-a"}; - apr_getopt_t *opt; - apr_status_t rv; + fspr_getopt_t *opt; + fspr_status_t rv; char ch; const char *optarg; char str[8196]; str[0] = '\0'; - rv = apr_getopt_init(&opt, p, largc, largv); + rv = fspr_getopt_init(&opt, p, largc, largv); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); opt->errfn = unknown_arg; opt->errarg = str; - while (apr_getopt(opt, "a:", &ch, &optarg) == APR_SUCCESS) { + while (fspr_getopt(opt, "a:", &ch, &optarg) == APR_SUCCESS) { switch (ch) { case 'a': format_arg(str, ch, optarg); @@ -163,20 +163,20 @@ static void optional_option(abts_case *tc, void *data) { int largc = 3; const char * const largv[] = {"testprog", "-a", "foo"}; - apr_getopt_t *opt; - apr_status_t rv; + fspr_getopt_t *opt; + fspr_status_t rv; char ch; const char *optarg; char str[8196]; str[0] = '\0'; - rv = apr_getopt_init(&opt, p, largc, largv); + rv = fspr_getopt_init(&opt, p, largc, largv); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); opt->errfn = unknown_arg; opt->errarg = str; - while (apr_getopt(opt, "a::", &ch, &optarg) == APR_SUCCESS) { + while (fspr_getopt(opt, "a::", &ch, &optarg) == APR_SUCCESS) { switch (ch) { case 'a': format_arg(str, ch, optarg); @@ -192,20 +192,20 @@ static void optional_option_notgiven(abts_case *tc, void *data) { int largc = 2; const char * const largv[] = {"testprog", "-a"}; - apr_getopt_t *opt; - apr_status_t rv; + fspr_getopt_t *opt; + fspr_status_t rv; char ch; const char *optarg; char str[8196]; str[0] = '\0'; - rv = apr_getopt_init(&opt, p, largc, largv); + rv = fspr_getopt_init(&opt, p, largc, largv); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); opt->errfn = unknown_arg; opt->errarg = str; - while (apr_getopt(opt, "a::", &ch, &optarg) == APR_SUCCESS) { + while (fspr_getopt(opt, "a::", &ch, &optarg) == APR_SUCCESS) { switch (ch) { case 'a': format_arg(str, ch, optarg); diff --git a/libs/apr/test/testatomic.c b/libs/apr/test/testatomic.c index 7fae5c759f..c3ae095798 100644 --- a/libs/apr/test/testatomic.c +++ b/libs/apr/test/testatomic.c @@ -15,12 +15,12 @@ */ #include "testutil.h" -#include "apr_strings.h" -#include "apr_thread_proc.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_atomic.h" -#include "apr_time.h" +#include "fspr_strings.h" +#include "fspr_thread_proc.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_atomic.h" +#include "fspr_time.h" /* Use pthread_setconcurrency where it is available and not a nullop, * i.e. platforms using M:N or M:1 thread models: */ @@ -36,46 +36,46 @@ static void test_init(abts_case *tc, void *data) { - APR_ASSERT_SUCCESS(tc, "Could not initliaze atomics", apr_atomic_init(p)); + APR_ASSERT_SUCCESS(tc, "Could not initliaze atomics", fspr_atomic_init(p)); } static void test_set32(abts_case *tc, void *data) { - apr_uint32_t y32; - apr_atomic_set32(&y32, 2); + fspr_uint32_t y32; + fspr_atomic_set32(&y32, 2); ABTS_INT_EQUAL(tc, 2, y32); } static void test_read32(abts_case *tc, void *data) { - apr_uint32_t y32; - apr_atomic_set32(&y32, 2); - ABTS_INT_EQUAL(tc, 2, apr_atomic_read32(&y32)); + fspr_uint32_t y32; + fspr_atomic_set32(&y32, 2); + ABTS_INT_EQUAL(tc, 2, fspr_atomic_read32(&y32)); } static void test_dec32(abts_case *tc, void *data) { - apr_uint32_t y32; + fspr_uint32_t y32; int rv; - apr_atomic_set32(&y32, 2); + fspr_atomic_set32(&y32, 2); - rv = apr_atomic_dec32(&y32); + rv = fspr_atomic_dec32(&y32); ABTS_INT_EQUAL(tc, 1, y32); ABTS_ASSERT(tc, "atomic_dec returned zero when it shouldn't", rv != 0); - rv = apr_atomic_dec32(&y32); + rv = fspr_atomic_dec32(&y32); ABTS_INT_EQUAL(tc, 0, y32); ABTS_ASSERT(tc, "atomic_dec didn't returned zero when it should", rv == 0); } static void test_xchg32(abts_case *tc, void *data) { - apr_uint32_t oldval; - apr_uint32_t y32; + fspr_uint32_t oldval; + fspr_uint32_t y32; - apr_atomic_set32(&y32, 100); - oldval = apr_atomic_xchg32(&y32, 50); + fspr_atomic_set32(&y32, 100); + oldval = fspr_atomic_xchg32(&y32, 50); ABTS_INT_EQUAL(tc, 100, oldval); ABTS_INT_EQUAL(tc, 50, y32); @@ -83,182 +83,182 @@ static void test_xchg32(abts_case *tc, void *data) static void test_cas_equal(abts_case *tc, void *data) { - apr_uint32_t casval = 0; - apr_uint32_t oldval; + fspr_uint32_t casval = 0; + fspr_uint32_t oldval; - oldval = apr_atomic_cas32(&casval, 12, 0); + oldval = fspr_atomic_cas32(&casval, 12, 0); ABTS_INT_EQUAL(tc, 0, oldval); ABTS_INT_EQUAL(tc, 12, casval); } static void test_cas_equal_nonnull(abts_case *tc, void *data) { - apr_uint32_t casval = 12; - apr_uint32_t oldval; + fspr_uint32_t casval = 12; + fspr_uint32_t oldval; - oldval = apr_atomic_cas32(&casval, 23, 12); + oldval = fspr_atomic_cas32(&casval, 23, 12); ABTS_INT_EQUAL(tc, 12, oldval); ABTS_INT_EQUAL(tc, 23, casval); } static void test_cas_notequal(abts_case *tc, void *data) { - apr_uint32_t casval = 12; - apr_uint32_t oldval; + fspr_uint32_t casval = 12; + fspr_uint32_t oldval; - oldval = apr_atomic_cas32(&casval, 23, 2); + oldval = fspr_atomic_cas32(&casval, 23, 2); ABTS_INT_EQUAL(tc, 12, oldval); ABTS_INT_EQUAL(tc, 12, casval); } static void test_add32(abts_case *tc, void *data) { - apr_uint32_t oldval; - apr_uint32_t y32; + fspr_uint32_t oldval; + fspr_uint32_t y32; - apr_atomic_set32(&y32, 23); - oldval = apr_atomic_add32(&y32, 4); + fspr_atomic_set32(&y32, 23); + oldval = fspr_atomic_add32(&y32, 4); ABTS_INT_EQUAL(tc, 23, oldval); ABTS_INT_EQUAL(tc, 27, y32); } static void test_inc32(abts_case *tc, void *data) { - apr_uint32_t oldval; - apr_uint32_t y32; + fspr_uint32_t oldval; + fspr_uint32_t y32; - apr_atomic_set32(&y32, 23); - oldval = apr_atomic_inc32(&y32); + fspr_atomic_set32(&y32, 23); + oldval = fspr_atomic_inc32(&y32); ABTS_INT_EQUAL(tc, 23, oldval); ABTS_INT_EQUAL(tc, 24, y32); } static void test_set_add_inc_sub(abts_case *tc, void *data) { - apr_uint32_t y32; + fspr_uint32_t y32; - apr_atomic_set32(&y32, 0); - apr_atomic_add32(&y32, 20); - apr_atomic_inc32(&y32); - apr_atomic_sub32(&y32, 10); + fspr_atomic_set32(&y32, 0); + fspr_atomic_add32(&y32, 20); + fspr_atomic_inc32(&y32); + fspr_atomic_sub32(&y32, 10); ABTS_INT_EQUAL(tc, 11, y32); } static void test_wrap_zero(abts_case *tc, void *data) { - apr_uint32_t y32; - apr_uint32_t rv; - apr_uint32_t minus1 = -1; + fspr_uint32_t y32; + fspr_uint32_t rv; + fspr_uint32_t minus1 = -1; char *str; - apr_atomic_set32(&y32, 0); - rv = apr_atomic_dec32(&y32); + fspr_atomic_set32(&y32, 0); + rv = fspr_atomic_dec32(&y32); - ABTS_ASSERT(tc, "apr_atomic_dec32 on zero returned zero.", rv != 0); - str = apr_psprintf(p, "zero wrap failed: 0 - 1 = %d", y32); + ABTS_ASSERT(tc, "fspr_atomic_dec32 on zero returned zero.", rv != 0); + str = fspr_psprintf(p, "zero wrap failed: 0 - 1 = %d", y32); ABTS_ASSERT(tc, str, y32 == minus1); } static void test_inc_neg1(abts_case *tc, void *data) { - apr_uint32_t y32 = -1; - apr_uint32_t minus1 = -1; - apr_uint32_t rv; + fspr_uint32_t y32 = -1; + fspr_uint32_t minus1 = -1; + fspr_uint32_t rv; char *str; - rv = apr_atomic_inc32(&y32); + rv = fspr_atomic_inc32(&y32); - ABTS_ASSERT(tc, "apr_atomic_dec32 on zero returned zero.", rv == minus1); - str = apr_psprintf(p, "zero wrap failed: -1 + 1 = %d", y32); + ABTS_ASSERT(tc, "fspr_atomic_dec32 on zero returned zero.", rv == minus1); + str = fspr_psprintf(p, "zero wrap failed: -1 + 1 = %d", y32); ABTS_ASSERT(tc, str, y32 == 0); } #if APR_HAS_THREADS -void * APR_THREAD_FUNC thread_func_mutex(apr_thread_t *thd, void *data); -void * APR_THREAD_FUNC thread_func_atomic(apr_thread_t *thd, void *data); -void * APR_THREAD_FUNC thread_func_none(apr_thread_t *thd, void *data); +void * APR_THREAD_FUNC thread_func_mutex(fspr_thread_t *thd, void *data); +void * APR_THREAD_FUNC thread_func_atomic(fspr_thread_t *thd, void *data); +void * APR_THREAD_FUNC thread_func_none(fspr_thread_t *thd, void *data); -apr_thread_mutex_t *thread_lock; -volatile apr_uint32_t x = 0; /* mutex locks */ -volatile apr_uint32_t y = 0; /* atomic operations */ -volatile apr_uint32_t z = 0; /* no locks */ -apr_status_t exit_ret_val = 123; /* just some made up number to check on later */ +fspr_thread_mutex_t *thread_lock; +volatile fspr_uint32_t x = 0; /* mutex locks */ +volatile fspr_uint32_t y = 0; /* atomic operations */ +volatile fspr_uint32_t z = 0; /* no locks */ +fspr_status_t exit_ret_val = 123; /* just some made up number to check on later */ #define NUM_THREADS 40 #define NUM_ITERATIONS 20000 -void * APR_THREAD_FUNC thread_func_mutex(apr_thread_t *thd, void *data) +void * APR_THREAD_FUNC thread_func_mutex(fspr_thread_t *thd, void *data) { int i; for (i = 0; i < NUM_ITERATIONS; i++) { - apr_thread_mutex_lock(thread_lock); + fspr_thread_mutex_lock(thread_lock); x++; - apr_thread_mutex_unlock(thread_lock); + fspr_thread_mutex_unlock(thread_lock); } - apr_thread_exit(thd, exit_ret_val); + fspr_thread_exit(thd, exit_ret_val); return NULL; } -void * APR_THREAD_FUNC thread_func_atomic(apr_thread_t *thd, void *data) +void * APR_THREAD_FUNC thread_func_atomic(fspr_thread_t *thd, void *data) { int i; for (i = 0; i < NUM_ITERATIONS ; i++) { - apr_atomic_inc32(&y); - apr_atomic_add32(&y, 2); - apr_atomic_dec32(&y); - apr_atomic_dec32(&y); + fspr_atomic_inc32(&y); + fspr_atomic_add32(&y, 2); + fspr_atomic_dec32(&y); + fspr_atomic_dec32(&y); } - apr_thread_exit(thd, exit_ret_val); + fspr_thread_exit(thd, exit_ret_val); return NULL; } -void * APR_THREAD_FUNC thread_func_none(apr_thread_t *thd, void *data) +void * APR_THREAD_FUNC thread_func_none(fspr_thread_t *thd, void *data) { int i; for (i = 0; i < NUM_ITERATIONS ; i++) { z++; } - apr_thread_exit(thd, exit_ret_val); + fspr_thread_exit(thd, exit_ret_val); return NULL; } static void test_atomics_threaded(abts_case *tc, void *data) { - apr_thread_t *t1[NUM_THREADS]; - apr_thread_t *t2[NUM_THREADS]; - apr_thread_t *t3[NUM_THREADS]; - apr_status_t s1[NUM_THREADS]; - apr_status_t s2[NUM_THREADS]; - apr_status_t s3[NUM_THREADS]; - apr_status_t rv; + fspr_thread_t *t1[NUM_THREADS]; + fspr_thread_t *t2[NUM_THREADS]; + fspr_thread_t *t3[NUM_THREADS]; + fspr_status_t s1[NUM_THREADS]; + fspr_status_t s2[NUM_THREADS]; + fspr_status_t s3[NUM_THREADS]; + fspr_status_t rv; int i; #ifdef HAVE_PTHREAD_SETCONCURRENCY pthread_setconcurrency(8); #endif - rv = apr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_DEFAULT, p); + rv = fspr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "Could not create lock", rv); for (i = 0; i < NUM_THREADS; i++) { - apr_status_t r1, r2, r3; - r1 = apr_thread_create(&t1[i], NULL, thread_func_mutex, NULL, p); - r2 = apr_thread_create(&t2[i], NULL, thread_func_atomic, NULL, p); - r3 = apr_thread_create(&t3[i], NULL, thread_func_none, NULL, p); + fspr_status_t r1, r2, r3; + r1 = fspr_thread_create(&t1[i], NULL, thread_func_mutex, NULL, p); + r2 = fspr_thread_create(&t2[i], NULL, thread_func_atomic, NULL, p); + r3 = fspr_thread_create(&t3[i], NULL, thread_func_none, NULL, p); ABTS_ASSERT(tc, "Failed creating threads", r1 == APR_SUCCESS && r2 == APR_SUCCESS && r3 == APR_SUCCESS); } for (i = 0; i < NUM_THREADS; i++) { - apr_thread_join(&s1[i], t1[i]); - apr_thread_join(&s2[i], t2[i]); - apr_thread_join(&s3[i], t3[i]); + fspr_thread_join(&s1[i], t1[i]); + fspr_thread_join(&s2[i], t2[i]); + fspr_thread_join(&s3[i], t3[i]); ABTS_ASSERT(tc, "Invalid return value from thread_join", s1[i] == exit_ret_val && s2[i] == exit_ret_val && @@ -266,7 +266,7 @@ static void test_atomics_threaded(abts_case *tc, void *data) } ABTS_INT_EQUAL(tc, x, NUM_THREADS * NUM_ITERATIONS); - ABTS_INT_EQUAL(tc, apr_atomic_read32(&y), NUM_THREADS * NUM_ITERATIONS); + ABTS_INT_EQUAL(tc, fspr_atomic_read32(&y), NUM_THREADS * NUM_ITERATIONS); /* Comment out this test, because I have no clue what this test is * actually telling us. We are checking something that may or may not * be true, and it isn't really testing APR at all. diff --git a/libs/apr/test/testdir.c b/libs/apr/test/testdir.c index 82f145d6f1..97c21cc365 100644 --- a/libs/apr/test/testdir.c +++ b/libs/apr/test/testdir.c @@ -17,204 +17,204 @@ #include #include #include -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" #include "testutil.h" static void test_mkdir(abts_case *tc, void *data) { - apr_status_t rv; - apr_finfo_t finfo; + fspr_status_t rv; + fspr_finfo_t finfo; - rv = apr_dir_make("data/testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); + rv = fspr_dir_make("data/testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_stat(&finfo, "data/testdir", APR_FINFO_TYPE, p); + rv = fspr_stat(&finfo, "data/testdir", APR_FINFO_TYPE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, APR_DIR, finfo.filetype); } static void test_mkdir_recurs(abts_case *tc, void *data) { - apr_status_t rv; - apr_finfo_t finfo; + fspr_status_t rv; + fspr_finfo_t finfo; - rv = apr_dir_make_recursive("data/one/two/three", + rv = fspr_dir_make_recursive("data/one/two/three", APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_stat(&finfo, "data/one", APR_FINFO_TYPE, p); + rv = fspr_stat(&finfo, "data/one", APR_FINFO_TYPE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, APR_DIR, finfo.filetype); - rv = apr_stat(&finfo, "data/one/two", APR_FINFO_TYPE, p); + rv = fspr_stat(&finfo, "data/one/two", APR_FINFO_TYPE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, APR_DIR, finfo.filetype); - rv = apr_stat(&finfo, "data/one/two/three", APR_FINFO_TYPE, p); + rv = fspr_stat(&finfo, "data/one/two/three", APR_FINFO_TYPE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, APR_DIR, finfo.filetype); } static void test_remove(abts_case *tc, void *data) { - apr_status_t rv; - apr_finfo_t finfo; + fspr_status_t rv; + fspr_finfo_t finfo; - rv = apr_dir_remove("data/testdir", p); + rv = fspr_dir_remove("data/testdir", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_stat(&finfo, "data/testdir", APR_FINFO_TYPE, p); + rv = fspr_stat(&finfo, "data/testdir", APR_FINFO_TYPE, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); } static void test_removeall_fail(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_dir_remove("data/one", p); + rv = fspr_dir_remove("data/one", p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOTEMPTY(rv)); } static void test_removeall(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_dir_remove("data/one/two/three", p); + rv = fspr_dir_remove("data/one/two/three", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_remove("data/one/two", p); + rv = fspr_dir_remove("data/one/two", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_remove("data/one", p); + rv = fspr_dir_remove("data/one", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } static void test_remove_notthere(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_dir_remove("data/notthere", p); + rv = fspr_dir_remove("data/notthere", p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); } static void test_mkdir_twice(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_dir_make("data/testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); + rv = fspr_dir_make("data/testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_make("data/testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); + rv = fspr_dir_make("data/testdir", APR_UREAD | APR_UWRITE | APR_UEXECUTE, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EEXIST(rv)); - rv = apr_dir_remove("data/testdir", p); + rv = fspr_dir_remove("data/testdir", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } static void test_opendir(abts_case *tc, void *data) { - apr_status_t rv; - apr_dir_t *dir; + fspr_status_t rv; + fspr_dir_t *dir; - rv = apr_dir_open(&dir, "data", p); + rv = fspr_dir_open(&dir, "data", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_dir_close(dir); + fspr_dir_close(dir); } static void test_opendir_notthere(abts_case *tc, void *data) { - apr_status_t rv; - apr_dir_t *dir; + fspr_status_t rv; + fspr_dir_t *dir; - rv = apr_dir_open(&dir, "notthere", p); + rv = fspr_dir_open(&dir, "notthere", p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); } static void test_closedir(abts_case *tc, void *data) { - apr_status_t rv; - apr_dir_t *dir; + fspr_status_t rv; + fspr_dir_t *dir; - rv = apr_dir_open(&dir, "data", p); + rv = fspr_dir_open(&dir, "data", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_close(dir); + rv = fspr_dir_close(dir); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } static void test_rewind(abts_case *tc, void *data) { - apr_dir_t *dir; - apr_finfo_t first, second; + fspr_dir_t *dir; + fspr_finfo_t first, second; - APR_ASSERT_SUCCESS(tc, "apr_dir_open failed", apr_dir_open(&dir, "data", p)); + APR_ASSERT_SUCCESS(tc, "fspr_dir_open failed", fspr_dir_open(&dir, "data", p)); - APR_ASSERT_SUCCESS(tc, "apr_dir_read failed", - apr_dir_read(&first, APR_FINFO_DIRENT, dir)); + APR_ASSERT_SUCCESS(tc, "fspr_dir_read failed", + fspr_dir_read(&first, APR_FINFO_DIRENT, dir)); - APR_ASSERT_SUCCESS(tc, "apr_dir_rewind failed", apr_dir_rewind(dir)); + APR_ASSERT_SUCCESS(tc, "fspr_dir_rewind failed", fspr_dir_rewind(dir)); - APR_ASSERT_SUCCESS(tc, "second apr_dir_read failed", - apr_dir_read(&second, APR_FINFO_DIRENT, dir)); + APR_ASSERT_SUCCESS(tc, "second fspr_dir_read failed", + fspr_dir_read(&second, APR_FINFO_DIRENT, dir)); - APR_ASSERT_SUCCESS(tc, "apr_dir_close failed", apr_dir_close(dir)); + APR_ASSERT_SUCCESS(tc, "fspr_dir_close failed", fspr_dir_close(dir)); ABTS_STR_EQUAL(tc, first.name, second.name); } -/* Test for a (fixed) bug in apr_dir_read(). This bug only happened +/* Test for a (fixed) bug in fspr_dir_read(). This bug only happened in threadless cases. */ static void test_uncleared_errno(abts_case *tc, void *data) { - apr_file_t *thefile = NULL; - apr_finfo_t finfo; - apr_int32_t finfo_flags = APR_FINFO_TYPE | APR_FINFO_NAME; - apr_dir_t *this_dir; - apr_status_t rv; + fspr_file_t *thefile = NULL; + fspr_finfo_t finfo; + fspr_int32_t finfo_flags = APR_FINFO_TYPE | APR_FINFO_NAME; + fspr_dir_t *this_dir; + fspr_status_t rv; - rv = apr_dir_make("dir1", APR_OS_DEFAULT, p); + rv = fspr_dir_make("dir1", APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_make("dir2", APR_OS_DEFAULT, p); + rv = fspr_dir_make("dir2", APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_open(&thefile, "dir1/file1", + rv = fspr_file_open(&thefile, "dir1/file1", APR_READ | APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_close(thefile); + rv = fspr_file_close(thefile); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Try to remove dir1. This should fail because it's not empty. However, on a platform with threads disabled (such as FreeBSD), `errno' will be set as a result. */ - rv = apr_dir_remove("dir1", p); + rv = fspr_dir_remove("dir1", p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOTEMPTY(rv)); /* Read `.' and `..' out of dir2. */ - rv = apr_dir_open(&this_dir, "dir2", p); + rv = fspr_dir_open(&this_dir, "dir2", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_read(&finfo, finfo_flags, this_dir); + rv = fspr_dir_read(&finfo, finfo_flags, this_dir); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_read(&finfo, finfo_flags, this_dir); + rv = fspr_dir_read(&finfo, finfo_flags, this_dir); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Now, when we attempt to do a third read of empty dir2, and the underlying system readdir() returns NULL, the old value of errno shouldn't cause a false alarm. We should get an ENOENT - back from apr_dir_read, and *not* the old errno. */ - rv = apr_dir_read(&finfo, finfo_flags, this_dir); + back from fspr_dir_read, and *not* the old errno. */ + rv = fspr_dir_read(&finfo, finfo_flags, this_dir); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); - rv = apr_dir_close(this_dir); + rv = fspr_dir_close(this_dir); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Cleanup */ - rv = apr_file_remove("dir1/file1", p); + rv = fspr_file_remove("dir1/file1", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_remove("dir1", p); + rv = fspr_dir_remove("dir1", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_dir_remove("dir2", p); + rv = fspr_dir_remove("dir2", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } @@ -222,30 +222,30 @@ static void test_uncleared_errno(abts_case *tc, void *data) static void test_rmkdir_nocwd(abts_case *tc, void *data) { char *cwd, *path; - apr_status_t rv; + fspr_status_t rv; APR_ASSERT_SUCCESS(tc, "make temp dir", - apr_dir_make("dir3", APR_OS_DEFAULT, p)); + fspr_dir_make("dir3", APR_OS_DEFAULT, p)); - APR_ASSERT_SUCCESS(tc, "obtain cwd", apr_filepath_get(&cwd, 0, p)); + APR_ASSERT_SUCCESS(tc, "obtain cwd", fspr_filepath_get(&cwd, 0, p)); APR_ASSERT_SUCCESS(tc, "determine path to temp dir", - apr_filepath_merge(&path, cwd, "dir3", 0, p)); + fspr_filepath_merge(&path, cwd, "dir3", 0, p)); - APR_ASSERT_SUCCESS(tc, "change to temp dir", apr_filepath_set(path, p)); + APR_ASSERT_SUCCESS(tc, "change to temp dir", fspr_filepath_set(path, p)); - rv = apr_dir_remove(path, p); + rv = fspr_dir_remove(path, p); /* Some platforms cannot remove a directory which is in use. */ if (rv == APR_SUCCESS) { ABTS_ASSERT(tc, "fail to create dir", - apr_dir_make_recursive("foobar", APR_OS_DEFAULT, + fspr_dir_make_recursive("foobar", APR_OS_DEFAULT, p) != APR_SUCCESS); } - APR_ASSERT_SUCCESS(tc, "restore cwd", apr_filepath_set(cwd, p)); + APR_ASSERT_SUCCESS(tc, "restore cwd", fspr_filepath_set(cwd, p)); if (rv) { - apr_dir_remove(path, p); + fspr_dir_remove(path, p); ABTS_NOT_IMPL(tc, "cannot remove in-use directory"); } } diff --git a/libs/apr/test/testdso.c b/libs/apr/test/testdso.c index b87bdf70e1..aaeffcfee0 100644 --- a/libs/apr/test/testdso.c +++ b/libs/apr/test/testdso.c @@ -16,13 +16,13 @@ #include "testutil.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_dso.h" -#include "apr_strings.h" -#include "apr_file_info.h" -#include "apr.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_errno.h" +#include "fspr_dso.h" +#include "fspr_strings.h" +#include "fspr_file_info.h" +#include "fspr.h" #if APR_HAVE_UNISTD_H #include #endif @@ -53,32 +53,32 @@ static char *modname; static void test_load_module(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_status_t status; char errstr[256]; - status = apr_dso_load(&h, modname, p); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_load(&h, modname, p); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); - apr_dso_unload(h); + fspr_dso_unload(h); } static void test_dso_sym(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_dso_handle_sym_t func1 = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_dso_handle_sym_t func1 = NULL; + fspr_status_t status; void (*function)(char str[256]); char teststr[256]; char errstr[256]; - status = apr_dso_load(&h, modname, p); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_load(&h, modname, p); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); - status = apr_dso_sym(&func1, h, "print_hello"); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_sym(&func1, h, "print_hello"); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, func1); if (!tc->failed) { @@ -87,23 +87,23 @@ static void test_dso_sym(abts_case *tc, void *data) ABTS_STR_EQUAL(tc, "Hello - I'm a DSO!\n", teststr); } - apr_dso_unload(h); + fspr_dso_unload(h); } static void test_dso_sym_return_value(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_dso_handle_sym_t func1 = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_dso_handle_sym_t func1 = NULL; + fspr_status_t status; int (*function)(int); char errstr[256]; - status = apr_dso_load(&h, modname, p); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_load(&h, modname, p); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); - status = apr_dso_sym(&func1, h, "count_reps"); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_sym(&func1, h, "count_reps"); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, func1); if (!tc->failed) { @@ -112,24 +112,24 @@ static void test_dso_sym_return_value(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, 5, status); } - apr_dso_unload(h); + fspr_dso_unload(h); } static void test_unload_module(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_status_t status; char errstr[256]; - apr_dso_handle_sym_t func1 = NULL; + fspr_dso_handle_sym_t func1 = NULL; - status = apr_dso_load(&h, modname, p); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_load(&h, modname, p); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); - status = apr_dso_unload(h); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_unload(h); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); - status = apr_dso_sym(&func1, h, "print_hello"); + status = fspr_dso_sym(&func1, h, "print_hello"); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ESYMNOTFOUND(status)); } @@ -139,32 +139,32 @@ static char *libname; static void test_load_library(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_status_t status; char errstr[256]; - status = apr_dso_load(&h, libname, p); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_load(&h, libname, p); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); - apr_dso_unload(h); + fspr_dso_unload(h); } static void test_dso_sym_library(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_dso_handle_sym_t func1 = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_dso_handle_sym_t func1 = NULL; + fspr_status_t status; void (*function)(char str[256]); char teststr[256]; char errstr[256]; - status = apr_dso_load(&h, libname, p); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_load(&h, libname, p); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); - status = apr_dso_sym(&func1, h, "print_hello"); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_sym(&func1, h, "print_hello"); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, func1); if (!tc->failed) { @@ -173,23 +173,23 @@ static void test_dso_sym_library(abts_case *tc, void *data) ABTS_STR_EQUAL(tc, "Hello - I'm a DSO!\n", teststr); } - apr_dso_unload(h); + fspr_dso_unload(h); } static void test_dso_sym_return_value_library(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_dso_handle_sym_t func1 = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_dso_handle_sym_t func1 = NULL; + fspr_status_t status; int (*function)(int); char errstr[256]; - status = apr_dso_load(&h, libname, p); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_load(&h, libname, p); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); - status = apr_dso_sym(&func1, h, "count_reps"); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_sym(&func1, h, "count_reps"); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, func1); if (!tc->failed) { @@ -198,24 +198,24 @@ static void test_dso_sym_return_value_library(abts_case *tc, void *data) ABTS_INT_EQUAL(tc, 5, status); } - apr_dso_unload(h); + fspr_dso_unload(h); } static void test_unload_library(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_status_t status; char errstr[256]; - apr_dso_handle_sym_t func1 = NULL; + fspr_dso_handle_sym_t func1 = NULL; - status = apr_dso_load(&h, libname, p); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_load(&h, libname, p); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); ABTS_PTR_NOTNULL(tc, h); - status = apr_dso_unload(h); - ABTS_ASSERT(tc, apr_dso_error(h, errstr, 256), APR_SUCCESS == status); + status = fspr_dso_unload(h); + ABTS_ASSERT(tc, fspr_dso_error(h, errstr, 256), APR_SUCCESS == status); - status = apr_dso_sym(&func1, h, "print_hello"); + status = fspr_dso_sym(&func1, h, "print_hello"); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ESYMNOTFOUND(status)); } @@ -223,10 +223,10 @@ static void test_unload_library(abts_case *tc, void *data) static void test_load_notthere(abts_case *tc, void *data) { - apr_dso_handle_t *h = NULL; - apr_status_t status; + fspr_dso_handle_t *h = NULL; + fspr_status_t status; - status = apr_dso_load(&h, "No_File.so", p); + status = fspr_dso_load(&h, "No_File.so", p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EDSOOPEN(status)); ABTS_PTR_NOTNULL(tc, h); @@ -239,7 +239,7 @@ abts_suite *testdso(abts_suite *suite) suite = ADD_SUITE(suite) #if APR_HAS_DSO - apr_filepath_merge(&modname, NULL, MOD_NAME, 0, p); + fspr_filepath_merge(&modname, NULL, MOD_NAME, 0, p); abts_run_test(suite, test_load_module, NULL); abts_run_test(suite, test_dso_sym, NULL); @@ -247,7 +247,7 @@ abts_suite *testdso(abts_suite *suite) abts_run_test(suite, test_unload_module, NULL); #ifdef LIB_NAME - apr_filepath_merge(&libname, NULL, LIB_NAME, 0, p); + fspr_filepath_merge(&libname, NULL, LIB_NAME, 0, p); abts_run_test(suite, test_load_library, NULL); abts_run_test(suite, test_dso_sym_library, NULL); diff --git a/libs/apr/test/testdup.c b/libs/apr/test/testdup.c index 9d064ec0d8..a6fd1c8e83 100644 --- a/libs/apr/test/testdup.c +++ b/libs/apr/test/testdup.c @@ -15,10 +15,10 @@ */ -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_file_io.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_errno.h" +#include "fspr_file_io.h" #include "testutil.h" #define TEST "Testing\n" @@ -27,155 +27,155 @@ static void test_file_dup(abts_case *tc, void *data) { - apr_file_t *file1 = NULL; - apr_file_t *file3 = NULL; - apr_status_t rv; - apr_finfo_t finfo; + fspr_file_t *file1 = NULL; + fspr_file_t *file3 = NULL; + fspr_status_t rv; + fspr_finfo_t finfo; /* First, create a new file, empty... */ - rv = apr_file_open(&file1, FILEPATH "testdup.file", + rv = fspr_file_open(&file1, FILEPATH "testdup.file", APR_READ | APR_WRITE | APR_CREATE | APR_DELONCLOSE, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, file1); - rv = apr_file_dup(&file3, file1, p); + rv = fspr_file_dup(&file3, file1, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, file3); - rv = apr_file_close(file1); + rv = fspr_file_close(file1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* cleanup after ourselves */ - rv = apr_file_close(file3); + rv = fspr_file_close(file3); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_stat(&finfo, FILEPATH "testdup.file", APR_FINFO_NORM, p); + rv = fspr_stat(&finfo, FILEPATH "testdup.file", APR_FINFO_NORM, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); } static void test_file_readwrite(abts_case *tc, void *data) { - apr_file_t *file1 = NULL; - apr_file_t *file3 = NULL; - apr_status_t rv; - apr_finfo_t finfo; - apr_size_t txtlen = sizeof(TEST); + fspr_file_t *file1 = NULL; + fspr_file_t *file3 = NULL; + fspr_status_t rv; + fspr_finfo_t finfo; + fspr_size_t txtlen = sizeof(TEST); char buff[50]; - apr_off_t fpos; + fspr_off_t fpos; /* First, create a new file, empty... */ - rv = apr_file_open(&file1, FILEPATH "testdup.readwrite.file", + rv = fspr_file_open(&file1, FILEPATH "testdup.readwrite.file", APR_READ | APR_WRITE | APR_CREATE | APR_DELONCLOSE, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, file1); - rv = apr_file_dup(&file3, file1, p); + rv = fspr_file_dup(&file3, file1, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, file3); - rv = apr_file_write(file3, TEST, &txtlen); + rv = fspr_file_write(file3, TEST, &txtlen); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, sizeof(TEST), txtlen); fpos = 0; - rv = apr_file_seek(file1, APR_SET, &fpos); + rv = fspr_file_seek(file1, APR_SET, &fpos); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File position mismatch, expected 0", fpos == 0); txtlen = 50; - rv = apr_file_read(file1, buff, &txtlen); + rv = fspr_file_read(file1, buff, &txtlen); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, TEST, buff); /* cleanup after ourselves */ - rv = apr_file_close(file1); + rv = fspr_file_close(file1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_close(file3); + rv = fspr_file_close(file3); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_stat(&finfo, FILEPATH "testdup.readwrite.file", APR_FINFO_NORM, p); + rv = fspr_stat(&finfo, FILEPATH "testdup.readwrite.file", APR_FINFO_NORM, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); } static void test_dup2(abts_case *tc, void *data) { - apr_file_t *testfile = NULL; - apr_file_t *errfile = NULL; - apr_file_t *saveerr = NULL; - apr_status_t rv; + fspr_file_t *testfile = NULL; + fspr_file_t *errfile = NULL; + fspr_file_t *saveerr = NULL; + fspr_status_t rv; - rv = apr_file_open(&testfile, FILEPATH "testdup2.file", + rv = fspr_file_open(&testfile, FILEPATH "testdup2.file", APR_READ | APR_WRITE | APR_CREATE | APR_DELONCLOSE, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, testfile); - rv = apr_file_open_stderr(&errfile, p); + rv = fspr_file_open_stderr(&errfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Set aside the real errfile */ - rv = apr_file_dup(&saveerr, errfile, p); + rv = fspr_file_dup(&saveerr, errfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, saveerr); - rv = apr_file_dup2(errfile, testfile, p); + rv = fspr_file_dup2(errfile, testfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, errfile); - apr_file_close(testfile); + fspr_file_close(testfile); - rv = apr_file_dup2(errfile, saveerr, p); + rv = fspr_file_dup2(errfile, saveerr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, errfile); } static void test_dup2_readwrite(abts_case *tc, void *data) { - apr_file_t *errfile = NULL; - apr_file_t *testfile = NULL; - apr_file_t *saveerr = NULL; - apr_status_t rv; - apr_size_t txtlen = sizeof(TEST); + fspr_file_t *errfile = NULL; + fspr_file_t *testfile = NULL; + fspr_file_t *saveerr = NULL; + fspr_status_t rv; + fspr_size_t txtlen = sizeof(TEST); char buff[50]; - apr_off_t fpos; + fspr_off_t fpos; - rv = apr_file_open(&testfile, FILEPATH "testdup2.readwrite.file", + rv = fspr_file_open(&testfile, FILEPATH "testdup2.readwrite.file", APR_READ | APR_WRITE | APR_CREATE | APR_DELONCLOSE, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, testfile); - rv = apr_file_open_stderr(&errfile, p); + rv = fspr_file_open_stderr(&errfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* Set aside the real errfile */ - rv = apr_file_dup(&saveerr, errfile, p); + rv = fspr_file_dup(&saveerr, errfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, saveerr); - rv = apr_file_dup2(errfile, testfile, p); + rv = fspr_file_dup2(errfile, testfile, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, errfile); txtlen = sizeof(TEST2); - rv = apr_file_write(errfile, TEST2, &txtlen); + rv = fspr_file_write(errfile, TEST2, &txtlen); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, sizeof(TEST2), txtlen); fpos = 0; - rv = apr_file_seek(testfile, APR_SET, &fpos); + rv = fspr_file_seek(testfile, APR_SET, &fpos); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File position mismatch, expected 0", fpos == 0); txtlen = 50; - rv = apr_file_read(testfile, buff, &txtlen); + rv = fspr_file_read(testfile, buff, &txtlen); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, TEST2, buff); - apr_file_close(testfile); + fspr_file_close(testfile); - rv = apr_file_dup2(errfile, saveerr, p); + rv = fspr_file_dup2(errfile, saveerr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, errfile); } diff --git a/libs/apr/test/testenv.c b/libs/apr/test/testenv.c index d292c26e7d..91aa889e43 100644 --- a/libs/apr/test/testenv.c +++ b/libs/apr/test/testenv.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr_env.h" -#include "apr_errno.h" +#include "fspr_env.h" +#include "fspr_errno.h" #include "testutil.h" -#define TEST_ENVVAR_NAME "apr_test_envvar" -#define TEST_ENVVAR2_NAME "apr_test_envvar2" +#define TEST_ENVVAR_NAME "fspr_test_envvar" +#define TEST_ENVVAR2_NAME "fspr_test_envvar2" #define TEST_ENVVAR_VALUE "Just a value that we'll check" static int have_env_set; @@ -28,12 +28,12 @@ static int have_env_del; static void test_setenv(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_env_set(TEST_ENVVAR_NAME, TEST_ENVVAR_VALUE, p); + rv = fspr_env_set(TEST_ENVVAR_NAME, TEST_ENVVAR_VALUE, p); have_env_set = (rv != APR_ENOTIMPL); if (!have_env_set) { - ABTS_NOT_IMPL(tc, "apr_env_set"); + ABTS_NOT_IMPL(tc, "fspr_env_set"); } else { APR_ASSERT_SUCCESS(tc, "set environment variable", rv); } @@ -42,17 +42,17 @@ static void test_setenv(abts_case *tc, void *data) static void test_getenv(abts_case *tc, void *data) { char *value; - apr_status_t rv; + fspr_status_t rv; if (!have_env_set) { - ABTS_NOT_IMPL(tc, "apr_env_set (skip test for apr_env_get)"); + ABTS_NOT_IMPL(tc, "fspr_env_set (skip test for fspr_env_get)"); return; } - rv = apr_env_get(&value, TEST_ENVVAR_NAME, p); + rv = fspr_env_get(&value, TEST_ENVVAR_NAME, p); have_env_get = (rv != APR_ENOTIMPL); if (!have_env_get) { - ABTS_NOT_IMPL(tc, "apr_env_get"); + ABTS_NOT_IMPL(tc, "fspr_env_get"); return; } APR_ASSERT_SUCCESS(tc, "get environment variable", rv); @@ -62,26 +62,26 @@ static void test_getenv(abts_case *tc, void *data) static void test_delenv(abts_case *tc, void *data) { char *value; - apr_status_t rv; + fspr_status_t rv; if (!have_env_set) { - ABTS_NOT_IMPL(tc, "apr_env_set (skip test for apr_env_delete)"); + ABTS_NOT_IMPL(tc, "fspr_env_set (skip test for fspr_env_delete)"); return; } - rv = apr_env_delete(TEST_ENVVAR_NAME, p); + rv = fspr_env_delete(TEST_ENVVAR_NAME, p); have_env_del = (rv != APR_ENOTIMPL); if (!have_env_del) { - ABTS_NOT_IMPL(tc, "apr_env_delete"); + ABTS_NOT_IMPL(tc, "fspr_env_delete"); return; } APR_ASSERT_SUCCESS(tc, "delete environment variable", rv); if (!have_env_get) { - ABTS_NOT_IMPL(tc, "apr_env_get (skip sanity check for apr_env_delete)"); + ABTS_NOT_IMPL(tc, "fspr_env_get (skip sanity check for fspr_env_delete)"); return; } - rv = apr_env_get(&value, TEST_ENVVAR_NAME, p); + rv = fspr_env_get(&value, TEST_ENVVAR_NAME, p); ABTS_INT_EQUAL(tc, APR_ENOENT, rv); } @@ -89,45 +89,45 @@ static void test_delenv(abts_case *tc, void *data) static void test_emptyenv(abts_case *tc, void *data) { char *value; - apr_status_t rv; + fspr_status_t rv; if (!(have_env_set && have_env_get)) { - ABTS_NOT_IMPL(tc, "apr_env_set (skip test_emptyenv)"); + ABTS_NOT_IMPL(tc, "fspr_env_set (skip test_emptyenv)"); return; } /** Set empty string and test that rv != ENOENT) */ - rv = apr_env_set(TEST_ENVVAR_NAME, "", p); + rv = fspr_env_set(TEST_ENVVAR_NAME, "", p); APR_ASSERT_SUCCESS(tc, "set environment variable", rv); - rv = apr_env_get(&value, TEST_ENVVAR_NAME, p); + rv = fspr_env_get(&value, TEST_ENVVAR_NAME, p); APR_ASSERT_SUCCESS(tc, "get environment variable", rv); ABTS_STR_EQUAL(tc, "", value); if (!have_env_del) { - ABTS_NOT_IMPL(tc, "apr_env_del (skip recycle test_emptyenv)"); + ABTS_NOT_IMPL(tc, "fspr_env_del (skip recycle test_emptyenv)"); return; } /** Delete and retest */ - rv = apr_env_delete(TEST_ENVVAR_NAME, p); + rv = fspr_env_delete(TEST_ENVVAR_NAME, p); APR_ASSERT_SUCCESS(tc, "delete environment variable", rv); - rv = apr_env_get(&value, TEST_ENVVAR_NAME, p); + rv = fspr_env_get(&value, TEST_ENVVAR_NAME, p); ABTS_INT_EQUAL(tc, APR_ENOENT, rv); /** Set second variable + test*/ - rv = apr_env_set(TEST_ENVVAR2_NAME, TEST_ENVVAR_VALUE, p); + rv = fspr_env_set(TEST_ENVVAR2_NAME, TEST_ENVVAR_VALUE, p); APR_ASSERT_SUCCESS(tc, "set second environment variable", rv); - rv = apr_env_get(&value, TEST_ENVVAR2_NAME, p); + rv = fspr_env_get(&value, TEST_ENVVAR2_NAME, p); APR_ASSERT_SUCCESS(tc, "get second environment variable", rv); ABTS_STR_EQUAL(tc, TEST_ENVVAR_VALUE, value); /** Finally, test ENOENT (first variable) followed by second != ENOENT) */ - rv = apr_env_get(&value, TEST_ENVVAR_NAME, p); + rv = fspr_env_get(&value, TEST_ENVVAR_NAME, p); ABTS_INT_EQUAL(tc, APR_ENOENT, rv); - rv = apr_env_get(&value, TEST_ENVVAR2_NAME, p); + rv = fspr_env_get(&value, TEST_ENVVAR2_NAME, p); APR_ASSERT_SUCCESS(tc, "verify second environment variable", rv); ABTS_STR_EQUAL(tc, TEST_ENVVAR_VALUE, value); /** Cleanup */ - apr_env_delete(TEST_ENVVAR2_NAME, p); + fspr_env_delete(TEST_ENVVAR2_NAME, p); } abts_suite *testenv(abts_suite *suite) diff --git a/libs/apr/test/testfile.c b/libs/apr/test/testfile.c index 2ffc82643d..7e2be1204c 100644 --- a/libs/apr/test/testfile.c +++ b/libs/apr/test/testfile.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_network_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_poll.h" -#include "apr_lib.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_network_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_poll.h" +#include "fspr_lib.h" #include "testutil.h" #define DIRNAME "data" @@ -34,10 +34,10 @@ static void test_open_noreadwrite(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *thefile = NULL; + fspr_status_t rv; + fspr_file_t *thefile = NULL; - rv = apr_file_open(&thefile, FILENAME, + rv = fspr_file_open(&thefile, FILENAME, APR_CREATE | APR_EXCL, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_TRUE(tc, rv != APR_SUCCESS); @@ -47,10 +47,10 @@ static void test_open_noreadwrite(abts_case *tc, void *data) static void test_open_excl(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *thefile = NULL; + fspr_status_t rv; + fspr_file_t *thefile = NULL; - rv = apr_file_open(&thefile, FILENAME, + rv = fspr_file_open(&thefile, FILENAME, APR_CREATE | APR_EXCL | APR_WRITE, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_TRUE(tc, rv != APR_SUCCESS); @@ -60,111 +60,111 @@ static void test_open_excl(abts_case *tc, void *data) static void test_open_read(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, filetest); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_read(abts_case *tc, void *data) { - apr_status_t rv; - apr_size_t nbytes = 256; - char *str = apr_pcalloc(p, nbytes + 1); - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_size_t nbytes = 256; + char *str = fspr_pcalloc(p, nbytes + 1); + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, p); APR_ASSERT_SUCCESS(tc, "Opening test file " FILENAME, rv); - rv = apr_file_read(filetest, str, &nbytes); + rv = fspr_file_read(filetest, str, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(TESTSTR), nbytes); ABTS_STR_EQUAL(tc, TESTSTR, str); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_readzero(abts_case *tc, void *data) { - apr_status_t rv; - apr_size_t nbytes = 0; + fspr_status_t rv; + fspr_size_t nbytes = 0; char *str = NULL; - apr_file_t *filetest; + fspr_file_t *filetest; - rv = apr_file_open(&filetest, FILENAME, APR_READ, APR_OS_DEFAULT, p); + rv = fspr_file_open(&filetest, FILENAME, APR_READ, APR_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "Opening test file " FILENAME, rv); - rv = apr_file_read(filetest, str, &nbytes); + rv = fspr_file_read(filetest, str, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 0, nbytes); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_filename(abts_case *tc, void *data) { const char *str; - apr_status_t rv; - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, p); APR_ASSERT_SUCCESS(tc, "Opening test file " FILENAME, rv); - rv = apr_file_name_get(&str, filetest); + rv = fspr_file_name_get(&str, filetest); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, FILENAME, str); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_fileclose(abts_case *tc, void *data) { char str; - apr_status_t rv; - apr_size_t one = 1; - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_size_t one = 1; + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, p); APR_ASSERT_SUCCESS(tc, "Opening test file " FILENAME, rv); - rv = apr_file_close(filetest); + rv = fspr_file_close(filetest); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* We just closed the file, so this should fail */ - rv = apr_file_read(filetest, &str, &one); + rv = fspr_file_read(filetest, &str, &one); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EBADF(rv)); } static void test_file_remove(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_file_t *filetest = NULL; - rv = apr_file_remove(FILENAME, p); + rv = fspr_file_remove(FILENAME, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_open(&filetest, FILENAME, APR_READ, + rv = fspr_file_open(&filetest, FILENAME, APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); } static void test_open_write(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_file_t *filetest = NULL; filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_WRITE, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ENOENT(rv)); @@ -173,229 +173,229 @@ static void test_open_write(abts_case *tc, void *data) static void test_open_writecreate(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_file_t *filetest = NULL; filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_WRITE | APR_CREATE, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_write(abts_case *tc, void *data) { - apr_status_t rv; - apr_size_t bytes = strlen(TESTSTR); - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_size_t bytes = strlen(TESTSTR); + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_WRITE | APR_CREATE, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_write(filetest, TESTSTR, &bytes); + rv = fspr_file_write(filetest, TESTSTR, &bytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_open_readwrite(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_file_t *filetest = NULL; filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_READ | APR_WRITE, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, filetest); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_seek(abts_case *tc, void *data) { - apr_status_t rv; - apr_off_t offset = 5; - apr_size_t nbytes = 256; - char *str = apr_pcalloc(p, nbytes + 1); - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_off_t offset = 5; + fspr_size_t nbytes = 256; + char *str = fspr_pcalloc(p, nbytes + 1); + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_READ, APR_UREAD | APR_UWRITE | APR_GREAD, p); APR_ASSERT_SUCCESS(tc, "Open test file " FILENAME, rv); - rv = apr_file_read(filetest, str, &nbytes); + rv = fspr_file_read(filetest, str, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(TESTSTR), nbytes); ABTS_STR_EQUAL(tc, TESTSTR, str); memset(str, 0, nbytes + 1); - rv = apr_file_seek(filetest, SEEK_SET, &offset); + rv = fspr_file_seek(filetest, SEEK_SET, &offset); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_read(filetest, str, &nbytes); + rv = fspr_file_read(filetest, str, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(TESTSTR) - 5, nbytes); ABTS_STR_EQUAL(tc, TESTSTR + 5, str); - apr_file_close(filetest); + fspr_file_close(filetest); /* Test for regression of sign error bug with SEEK_END and buffered files. */ - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_READ | APR_BUFFERED, APR_UREAD | APR_UWRITE | APR_GREAD, p); APR_ASSERT_SUCCESS(tc, "Open test file " FILENAME, rv); offset = -5; - rv = apr_file_seek(filetest, SEEK_END, &offset); + rv = fspr_file_seek(filetest, SEEK_END, &offset); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(TESTSTR) - 5, nbytes); memset(str, 0, nbytes + 1); nbytes = 256; - rv = apr_file_read(filetest, str, &nbytes); + rv = fspr_file_read(filetest, str, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 5, nbytes); ABTS_STR_EQUAL(tc, TESTSTR + strlen(TESTSTR) - 5, str); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_userdata_set(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *filetest = NULL; + fspr_status_t rv; + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_WRITE, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_data_set(filetest, "This is a test", - "test", apr_pool_cleanup_null); + rv = fspr_file_data_set(filetest, "This is a test", + "test", fspr_pool_cleanup_null); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_userdata_get(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; void *udata; char *teststr; - apr_file_t *filetest = NULL; + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_WRITE, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_data_set(filetest, "This is a test", - "test", apr_pool_cleanup_null); + rv = fspr_file_data_set(filetest, "This is a test", + "test", fspr_pool_cleanup_null); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_data_get(&udata, "test", filetest); + rv = fspr_file_data_get(&udata, "test", filetest); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); teststr = udata; ABTS_STR_EQUAL(tc, "This is a test", teststr); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_userdata_getnokey(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; void *teststr; - apr_file_t *filetest = NULL; + fspr_file_t *filetest = NULL; - rv = apr_file_open(&filetest, FILENAME, + rv = fspr_file_open(&filetest, FILENAME, APR_WRITE, APR_UREAD | APR_UWRITE | APR_GREAD, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_data_get(&teststr, "nokey", filetest); + rv = fspr_file_data_get(&teststr, "nokey", filetest); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_EQUAL(tc, NULL, teststr); - apr_file_close(filetest); + fspr_file_close(filetest); } static void test_getc(abts_case *tc, void *data) { - apr_file_t *f = NULL; - apr_status_t rv; + fspr_file_t *f = NULL; + fspr_status_t rv; char ch; - rv = apr_file_open(&f, FILENAME, APR_READ, 0, p); + rv = fspr_file_open(&f, FILENAME, APR_READ, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_file_getc(&ch, f); + fspr_file_getc(&ch, f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, (int)TESTSTR[0], (int)ch); - apr_file_close(f); + fspr_file_close(f); } static void test_ungetc(abts_case *tc, void *data) { - apr_file_t *f = NULL; - apr_status_t rv; + fspr_file_t *f = NULL; + fspr_status_t rv; char ch; - rv = apr_file_open(&f, FILENAME, APR_READ, 0, p); + rv = fspr_file_open(&f, FILENAME, APR_READ, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_file_getc(&ch, f); + fspr_file_getc(&ch, f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, (int)TESTSTR[0], (int)ch); - apr_file_ungetc('X', f); + fspr_file_ungetc('X', f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_file_getc(&ch, f); + fspr_file_getc(&ch, f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 'X', (int)ch); - apr_file_close(f); + fspr_file_close(f); } static void test_gets(abts_case *tc, void *data) { - apr_file_t *f = NULL; - apr_status_t rv; - char *str = apr_palloc(p, 256); + fspr_file_t *f = NULL; + fspr_status_t rv; + char *str = fspr_palloc(p, 256); - rv = apr_file_open(&f, FILENAME, APR_READ, 0, p); + rv = fspr_file_open(&f, FILENAME, APR_READ, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_gets(str, 256, f); + rv = fspr_file_gets(str, 256, f); /* Only one line in the test file, so APR will encounter EOF on the first * call to gets, but we should get APR_SUCCESS on this call and * APR_EOF on the next. */ ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, TESTSTR, str); - rv = apr_file_gets(str, 256, f); + rv = fspr_file_gets(str, 256, f); ABTS_INT_EQUAL(tc, APR_EOF, rv); ABTS_STR_EQUAL(tc, "", str); - apr_file_close(f); + fspr_file_close(f); } static void test_bigread(abts_case *tc, void *data) { - apr_file_t *f = NULL; - apr_status_t rv; + fspr_file_t *f = NULL; + fspr_status_t rv; char buf[APR_BUFFERSIZE * 2]; - apr_size_t nbytes; + fspr_size_t nbytes; /* Create a test file with known content. */ - rv = apr_file_open(&f, "data/created_file", + rv = fspr_file_open(&f, "data/created_file", APR_CREATE | APR_WRITE | APR_TRUNCATE, APR_UREAD | APR_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -403,26 +403,26 @@ static void test_bigread(abts_case *tc, void *data) nbytes = APR_BUFFERSIZE; memset(buf, 0xFE, nbytes); - rv = apr_file_write(f, buf, &nbytes); + rv = fspr_file_write(f, buf, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, APR_BUFFERSIZE, nbytes); - rv = apr_file_close(f); + rv = fspr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); f = NULL; - rv = apr_file_open(&f, "data/created_file", APR_READ, 0, p); + rv = fspr_file_open(&f, "data/created_file", APR_READ, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); nbytes = sizeof buf; - rv = apr_file_read(f, buf, &nbytes); + rv = fspr_file_read(f, buf, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, APR_BUFFERSIZE, nbytes); - rv = apr_file_close(f); + rv = fspr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_remove("data/created_file", p); + rv = fspr_file_remove("data/created_file", p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } @@ -431,80 +431,80 @@ static void test_bigread(abts_case *tc, void *data) */ static void test_mod_neg(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *f; + fspr_status_t rv; + fspr_file_t *f; const char *s; int i; - apr_size_t nbytes; + fspr_size_t nbytes; char buf[8192]; - apr_off_t cur; + fspr_off_t cur; const char *fname = "data/modneg.dat"; - rv = apr_file_open(&f, fname, + rv = fspr_file_open(&f, fname, APR_CREATE | APR_WRITE, APR_UREAD | APR_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); s = "body56789\n"; nbytes = strlen(s); - rv = apr_file_write(f, s, &nbytes); + rv = fspr_file_write(f, s, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(s), nbytes); for (i = 0; i < 7980; i++) { s = "0"; nbytes = strlen(s); - rv = apr_file_write(f, s, &nbytes); + rv = fspr_file_write(f, s, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(s), nbytes); } s = "end456789\n"; nbytes = strlen(s); - rv = apr_file_write(f, s, &nbytes); + rv = fspr_file_write(f, s, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(s), nbytes); for (i = 0; i < 10000; i++) { s = "1"; nbytes = strlen(s); - rv = apr_file_write(f, s, &nbytes); + rv = fspr_file_write(f, s, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(s), nbytes); } - rv = apr_file_close(f); + rv = fspr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_open(&f, fname, APR_READ, 0, p); + rv = fspr_file_open(&f, fname, APR_READ, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_gets(buf, 11, f); + rv = fspr_file_gets(buf, 11, f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, "body56789\n", buf); cur = 0; - rv = apr_file_seek(f, APR_CUR, &cur); + rv = fspr_file_seek(f, APR_CUR, &cur); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File Pointer Mismatch, expected 10", cur == 10); nbytes = sizeof(buf); - rv = apr_file_read(f, buf, &nbytes); + rv = fspr_file_read(f, buf, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, nbytes, sizeof(buf)); - cur = -((apr_off_t)nbytes - 7980); - rv = apr_file_seek(f, APR_CUR, &cur); + cur = -((fspr_off_t)nbytes - 7980); + rv = fspr_file_seek(f, APR_CUR, &cur); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File Pointer Mismatch, expected 7990", cur == 7990); - rv = apr_file_gets(buf, 11, f); + rv = fspr_file_gets(buf, 11, f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, "end456789\n", buf); - rv = apr_file_close(f); + rv = fspr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_remove(fname, p); + rv = fspr_file_remove(fname, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } @@ -513,21 +513,21 @@ static void test_mod_neg(abts_case *tc, void *data) static void file_contents_equal(abts_case *tc, const char *fname, const void *expect, - apr_size_t expectlen) + fspr_size_t expectlen) { - void *actual = apr_palloc(p, expectlen); - apr_file_t *f; + void *actual = fspr_palloc(p, expectlen); + fspr_file_t *f; APR_ASSERT_SUCCESS(tc, "open file", - apr_file_open(&f, fname, APR_READ|APR_BUFFERED, + fspr_file_open(&f, fname, APR_READ|APR_BUFFERED, 0, p)); APR_ASSERT_SUCCESS(tc, "read from file", - apr_file_read_full(f, actual, expectlen, NULL)); + fspr_file_read_full(f, actual, expectlen, NULL)); ABTS_ASSERT(tc, "matched expected file contents", memcmp(expect, actual, expectlen) == 0); - APR_ASSERT_SUCCESS(tc, "close file", apr_file_close(f)); + APR_ASSERT_SUCCESS(tc, "close file", fspr_file_close(f)); } #define LINE1 "this is a line of text\n" @@ -535,34 +535,34 @@ static void file_contents_equal(abts_case *tc, static void test_puts(abts_case *tc, void *data) { - apr_file_t *f; + fspr_file_t *f; const char *fname = "data/testputs.txt"; APR_ASSERT_SUCCESS(tc, "open file for writing", - apr_file_open(&f, fname, + fspr_file_open(&f, fname, APR_WRITE|APR_CREATE|APR_TRUNCATE, APR_OS_DEFAULT, p)); APR_ASSERT_SUCCESS(tc, "write line to file", - apr_file_puts(LINE1, f)); + fspr_file_puts(LINE1, f)); APR_ASSERT_SUCCESS(tc, "write second line to file", - apr_file_puts(LINE2, f)); + fspr_file_puts(LINE2, f)); APR_ASSERT_SUCCESS(tc, "close for writing", - apr_file_close(f)); + fspr_file_close(f)); file_contents_equal(tc, fname, LINE1 LINE2, strlen(LINE1 LINE2)); } static void test_writev(abts_case *tc, void *data) { - apr_file_t *f; - apr_size_t nbytes; + fspr_file_t *f; + fspr_size_t nbytes; struct iovec vec[5]; const char *fname = "data/testwritev.txt"; APR_ASSERT_SUCCESS(tc, "open file for writing", - apr_file_open(&f, fname, + fspr_file_open(&f, fname, APR_WRITE|APR_CREATE|APR_TRUNCATE, APR_OS_DEFAULT, p)); @@ -570,7 +570,7 @@ static void test_writev(abts_case *tc, void *data) vec[0].iov_len = strlen(LINE1); APR_ASSERT_SUCCESS(tc, "writev of size 1 to file", - apr_file_writev(f, vec, 1, &nbytes)); + fspr_file_writev(f, vec, 1, &nbytes)); file_contents_equal(tc, fname, LINE1, strlen(LINE1)); @@ -586,10 +586,10 @@ static void test_writev(abts_case *tc, void *data) vec[4].iov_len = strlen(LINE2); APR_ASSERT_SUCCESS(tc, "writev of size 5 to file", - apr_file_writev(f, vec, 5, &nbytes)); + fspr_file_writev(f, vec, 5, &nbytes)); APR_ASSERT_SUCCESS(tc, "close for writing", - apr_file_close(f)); + fspr_file_close(f)); file_contents_equal(tc, fname, LINE1 LINE1 LINE2 LINE1 LINE1 LINE2, strlen(LINE1)*4 + strlen(LINE2)*2); @@ -598,13 +598,13 @@ static void test_writev(abts_case *tc, void *data) static void test_writev_full(abts_case *tc, void *data) { - apr_file_t *f; - apr_size_t nbytes; + fspr_file_t *f; + fspr_size_t nbytes; struct iovec vec[5]; const char *fname = "data/testwritev_full.txt"; APR_ASSERT_SUCCESS(tc, "open file for writing", - apr_file_open(&f, fname, + fspr_file_open(&f, fname, APR_WRITE|APR_CREATE|APR_TRUNCATE, APR_OS_DEFAULT, p)); @@ -620,12 +620,12 @@ static void test_writev_full(abts_case *tc, void *data) vec[4].iov_len = strlen(LINE2); APR_ASSERT_SUCCESS(tc, "writev_full of size 5 to file", - apr_file_writev_full(f, vec, 5, &nbytes)); + fspr_file_writev_full(f, vec, 5, &nbytes)); ABTS_INT_EQUAL(tc, strlen(LINE1)*3 + strlen(LINE2)*2, nbytes); APR_ASSERT_SUCCESS(tc, "close for writing", - apr_file_close(f)); + fspr_file_close(f)); file_contents_equal(tc, fname, LINE1 LINE2 LINE1 LINE1 LINE2, strlen(LINE1)*3 + strlen(LINE2)*2); @@ -634,54 +634,54 @@ static void test_writev_full(abts_case *tc, void *data) static void test_truncate(abts_case *tc, void *data) { - apr_status_t rv; - apr_file_t *f; + fspr_status_t rv; + fspr_file_t *f; const char *fname = "data/testtruncate.dat"; const char *s; - apr_size_t nbytes; - apr_finfo_t finfo; + fspr_size_t nbytes; + fspr_finfo_t finfo; - apr_file_remove(fname, p); + fspr_file_remove(fname, p); - rv = apr_file_open(&f, fname, + rv = fspr_file_open(&f, fname, APR_CREATE | APR_WRITE, APR_UREAD | APR_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); s = "some data"; nbytes = strlen(s); - rv = apr_file_write(f, s, &nbytes); + rv = fspr_file_write(f, s, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen(s), nbytes); - rv = apr_file_close(f); + rv = fspr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_open(&f, fname, + rv = fspr_file_open(&f, fname, APR_TRUNCATE | APR_WRITE, APR_UREAD | APR_UWRITE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_close(f); + rv = fspr_file_close(f); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_stat(&finfo, fname, APR_FINFO_SIZE, p); + rv = fspr_stat(&finfo, fname, APR_FINFO_SIZE, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "File size mismatch, expected 0 (empty)", finfo.size == 0); - rv = apr_file_remove(fname, p); + rv = fspr_file_remove(fname, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } static void test_bigfprintf(abts_case *tc, void *data) { - apr_file_t *f; + fspr_file_t *f; const char *fname = "data/testbigfprintf.dat"; char *to_write; int i; - apr_file_remove(fname, p); + fspr_file_remove(fname, p); APR_ASSERT_SUCCESS(tc, "open test file", - apr_file_open(&f, fname, + fspr_file_open(&f, fname, APR_CREATE|APR_WRITE, APR_UREAD|APR_UWRITE, p)); @@ -693,10 +693,10 @@ static void test_bigfprintf(abts_case *tc, void *data) strcpy(to_write + HUGE_STRING_LEN, "42"); - i = apr_file_printf(f, "%s", to_write); + i = fspr_file_printf(f, "%s", to_write); ABTS_INT_EQUAL(tc, HUGE_STRING_LEN + 2, i); - apr_file_close(f); + fspr_file_close(f); file_contents_equal(tc, fname, to_write, HUGE_STRING_LEN + 2); @@ -705,16 +705,16 @@ static void test_bigfprintf(abts_case *tc, void *data) static void test_fail_write_flush(abts_case *tc, void *data) { - apr_file_t *f; + fspr_file_t *f; const char *fname = "data/testflush.dat"; - apr_status_t rv; + fspr_status_t rv; char buf[APR_BUFFERSIZE]; int n; - apr_file_remove(fname, p); + fspr_file_remove(fname, p); APR_ASSERT_SUCCESS(tc, "open test file", - apr_file_open(&f, fname, + fspr_file_open(&f, fname, APR_CREATE|APR_READ|APR_BUFFERED, APR_UREAD|APR_UWRITE, p)); @@ -724,110 +724,110 @@ static void test_fail_write_flush(abts_case *tc, void *data) * internal buffer and actually tries to write to the file, which * was opened read-only and hence should be unwritable. */ for (n = 0, rv = APR_SUCCESS; n < 4 && rv == APR_SUCCESS; n++) { - apr_size_t bytes = sizeof buf; - rv = apr_file_write(f, buf, &bytes); + fspr_size_t bytes = sizeof buf; + rv = fspr_file_write(f, buf, &bytes); } ABTS_ASSERT(tc, "failed to write to read-only buffered fd", rv != APR_SUCCESS); - apr_file_close(f); + fspr_file_close(f); } static void test_fail_read_flush(abts_case *tc, void *data) { - apr_file_t *f; + fspr_file_t *f; const char *fname = "data/testflush.dat"; - apr_status_t rv; + fspr_status_t rv; char buf[2]; - apr_file_remove(fname, p); + fspr_file_remove(fname, p); APR_ASSERT_SUCCESS(tc, "open test file", - apr_file_open(&f, fname, + fspr_file_open(&f, fname, APR_CREATE|APR_READ|APR_BUFFERED, APR_UREAD|APR_UWRITE, p)); /* this write should be buffered. */ APR_ASSERT_SUCCESS(tc, "buffered write should succeed", - apr_file_puts("hello", f)); + fspr_file_puts("hello", f)); /* Now, trying a read should fail since the write must be flushed, * and should fail with something other than EOF since the file is * opened read-only. */ - rv = apr_file_read_full(f, buf, 2, NULL); + rv = fspr_file_read_full(f, buf, 2, NULL); ABTS_ASSERT(tc, "read should flush buffered write and fail", rv != APR_SUCCESS && rv != APR_EOF); /* Likewise for gets */ - rv = apr_file_gets(buf, 2, f); + rv = fspr_file_gets(buf, 2, f); ABTS_ASSERT(tc, "gets should flush buffered write and fail", rv != APR_SUCCESS && rv != APR_EOF); /* Likewise for seek. */ { - apr_off_t offset = 0; + fspr_off_t offset = 0; - rv = apr_file_seek(f, APR_SET, &offset); + rv = fspr_file_seek(f, APR_SET, &offset); } ABTS_ASSERT(tc, "seek should flush buffered write and fail", rv != APR_SUCCESS && rv != APR_EOF); - apr_file_close(f); + fspr_file_close(f); } static void test_xthread(abts_case *tc, void *data) { - apr_file_t *f; + fspr_file_t *f; const char *fname = "data/testxthread.dat"; - apr_status_t rv; - apr_int32_t flags = APR_CREATE|APR_READ|APR_WRITE|APR_APPEND|APR_XTHREAD; + fspr_status_t rv; + fspr_int32_t flags = APR_CREATE|APR_READ|APR_WRITE|APR_APPEND|APR_XTHREAD; char buf[128] = { 0 }; /* Test for bug 38438, opening file with append + xthread and seeking to the end of the file resulted in writes going to the beginning not the end. */ - apr_file_remove(fname, p); + fspr_file_remove(fname, p); APR_ASSERT_SUCCESS(tc, "open test file", - apr_file_open(&f, fname, flags, + fspr_file_open(&f, fname, flags, APR_UREAD|APR_UWRITE, p)); APR_ASSERT_SUCCESS(tc, "write should succeed", - apr_file_puts("hello", f)); + fspr_file_puts("hello", f)); - apr_file_close(f); + fspr_file_close(f); APR_ASSERT_SUCCESS(tc, "open test file", - apr_file_open(&f, fname, flags, + fspr_file_open(&f, fname, flags, APR_UREAD|APR_UWRITE, p)); /* Seek to the end. */ { - apr_off_t offset = 0; + fspr_off_t offset = 0; - rv = apr_file_seek(f, APR_END, &offset); + rv = fspr_file_seek(f, APR_END, &offset); } APR_ASSERT_SUCCESS(tc, "more writes should succeed", - apr_file_puts("world", f)); + fspr_file_puts("world", f)); /* Back to the beginning. */ { - apr_off_t offset = 0; + fspr_off_t offset = 0; - rv = apr_file_seek(f, APR_SET, &offset); + rv = fspr_file_seek(f, APR_SET, &offset); } - apr_file_read_full(f, buf, sizeof(buf), NULL); + fspr_file_read_full(f, buf, sizeof(buf), NULL); ABTS_STR_EQUAL(tc, "helloworld", buf); - apr_file_close(f); + fspr_file_close(f); } abts_suite *testfile(abts_suite *suite) diff --git a/libs/apr/test/testfilecopy.c b/libs/apr/test/testfilecopy.c index 730b1f0195..17d9fdda6b 100644 --- a/libs/apr/test/testfilecopy.c +++ b/libs/apr/test/testfilecopy.c @@ -15,34 +15,34 @@ */ #include "testutil.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_pools.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_pools.h" static void copy_helper(abts_case *tc, const char *from, const char * to, - apr_fileperms_t perms, int append, apr_pool_t *p) + fspr_fileperms_t perms, int append, fspr_pool_t *p) { - apr_status_t rv; - apr_status_t dest_rv; - apr_finfo_t copy; - apr_finfo_t orig; - apr_finfo_t dest; + fspr_status_t rv; + fspr_status_t dest_rv; + fspr_finfo_t copy; + fspr_finfo_t orig; + fspr_finfo_t dest; - dest_rv = apr_stat(&dest, to, APR_FINFO_SIZE, p); + dest_rv = fspr_stat(&dest, to, APR_FINFO_SIZE, p); if (!append) { - rv = apr_file_copy(from, to, perms, p); + rv = fspr_file_copy(from, to, perms, p); } else { - rv = apr_file_append(from, to, perms, p); + rv = fspr_file_append(from, to, perms, p); } APR_ASSERT_SUCCESS(tc, "Error copying file", rv); - rv = apr_stat(&orig, from, APR_FINFO_SIZE, p); + rv = fspr_stat(&orig, from, APR_FINFO_SIZE, p); APR_ASSERT_SUCCESS(tc, "Couldn't stat original file", rv); - rv = apr_stat(©, to, APR_FINFO_SIZE, p); + rv = fspr_stat(©, to, APR_FINFO_SIZE, p); APR_ASSERT_SUCCESS(tc, "Couldn't stat copy file", rv); if (!append) { @@ -57,23 +57,23 @@ static void copy_helper(abts_case *tc, const char *from, const char * to, static void copy_short_file(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; /* make absolutely sure that the dest file doesn't exist. */ - apr_file_remove("data/file_copy.txt", p); + fspr_file_remove("data/file_copy.txt", p); copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", APR_FILE_SOURCE_PERMS, 0, p); - rv = apr_file_remove("data/file_copy.txt", p); + rv = fspr_file_remove("data/file_copy.txt", p); APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv); } static void copy_over_existing(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; /* make absolutely sure that the dest file doesn't exist. */ - apr_file_remove("data/file_copy.txt", p); + fspr_file_remove("data/file_copy.txt", p); /* This is a cheat. I don't want to create a new file, so I just copy * one file, then I copy another. If the second copy succeeds, then @@ -85,29 +85,29 @@ static void copy_over_existing(abts_case *tc, void *data) copy_helper(tc, "data/mmap_datafile.txt", "data/file_copy.txt", APR_FILE_SOURCE_PERMS, 0, p); - rv = apr_file_remove("data/file_copy.txt", p); + rv = fspr_file_remove("data/file_copy.txt", p); APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv); } static void append_nonexist(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; /* make absolutely sure that the dest file doesn't exist. */ - apr_file_remove("data/file_copy.txt", p); + fspr_file_remove("data/file_copy.txt", p); copy_helper(tc, "data/file_datafile.txt", "data/file_copy.txt", APR_FILE_SOURCE_PERMS, 0, p); - rv = apr_file_remove("data/file_copy.txt", p); + rv = fspr_file_remove("data/file_copy.txt", p); APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv); } static void append_exist(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; /* make absolutely sure that the dest file doesn't exist. */ - apr_file_remove("data/file_copy.txt", p); + fspr_file_remove("data/file_copy.txt", p); /* This is a cheat. I don't want to create a new file, so I just copy * one file, then I copy another. If the second copy succeeds, then @@ -119,7 +119,7 @@ static void append_exist(abts_case *tc, void *data) copy_helper(tc, "data/mmap_datafile.txt", "data/file_copy.txt", APR_FILE_SOURCE_PERMS, 1, p); - rv = apr_file_remove("data/file_copy.txt", p); + rv = fspr_file_remove("data/file_copy.txt", p); APR_ASSERT_SUCCESS(tc, "Couldn't remove copy file", rv); } diff --git a/libs/apr/test/testfileinfo.c b/libs/apr/test/testfileinfo.c index f437d7dddc..0fb02b991d 100644 --- a/libs/apr/test/testfileinfo.c +++ b/libs/apr/test/testfileinfo.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_strings.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_poll.h" -#include "apr_lib.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_strings.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_poll.h" +#include "fspr_lib.h" #include "testutil.h" #define FILENAME "data/file_datafile.txt" @@ -29,7 +29,7 @@ static const struct view_fileinfo { - apr_int32_t bits; + fspr_int32_t bits; char *description; } vfi[] = { {APR_FINFO_MTIME, "MTIME"}, @@ -48,99 +48,99 @@ static const struct view_fileinfo {0, NULL} }; -static void finfo_equal(abts_case *tc, apr_finfo_t *f1, apr_finfo_t *f2) +static void finfo_equal(abts_case *tc, fspr_finfo_t *f1, fspr_finfo_t *f2) { /* Minimum supported flags across all platforms (APR_FINFO_MIN) */ - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo must return APR_FINFO_TYPE", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo must return APR_FINFO_TYPE", (f1->valid & f2->valid & APR_FINFO_TYPE)); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in filetype", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in filetype", f1->filetype == f2->filetype); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo must return APR_FINFO_SIZE", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo must return APR_FINFO_SIZE", (f1->valid & f2->valid & APR_FINFO_SIZE)); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in size", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in size", f1->size == f2->size); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo must return APR_FINFO_ATIME", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo must return APR_FINFO_ATIME", (f1->valid & f2->valid & APR_FINFO_ATIME)); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in atime", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in atime", f1->atime == f2->atime); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo must return APR_FINFO_MTIME", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo must return APR_FINFO_MTIME", (f1->valid & f2->valid & APR_FINFO_MTIME)); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in mtime", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in mtime", f1->mtime == f2->mtime); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo must return APR_FINFO_CTIME", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo must return APR_FINFO_CTIME", (f1->valid & f2->valid & APR_FINFO_CTIME)); - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in ctime", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in ctime", f1->ctime == f2->ctime); if (f1->valid & f2->valid & APR_FINFO_NAME) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in name", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in name", !strcmp(f1->name, f2->name)); if (f1->fname && f2->fname) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in fname", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in fname", !strcmp(f1->fname, f2->fname)); /* Additional supported flags not supported on all platforms */ if (f1->valid & f2->valid & APR_FINFO_USER) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in user", - !apr_uid_compare(f1->user, f2->user)); + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in user", + !fspr_uid_compare(f1->user, f2->user)); if (f1->valid & f2->valid & APR_FINFO_GROUP) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in group", - !apr_gid_compare(f1->group, f2->group)); + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in group", + !fspr_gid_compare(f1->group, f2->group)); if (f1->valid & f2->valid & APR_FINFO_INODE) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in inode", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in inode", f1->inode == f2->inode); if (f1->valid & f2->valid & APR_FINFO_DEV) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in device", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in device", f1->device == f2->device); if (f1->valid & f2->valid & APR_FINFO_NLINK) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in nlink", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in nlink", f1->nlink == f2->nlink); if (f1->valid & f2->valid & APR_FINFO_CSIZE) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in csize", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in csize", f1->csize == f2->csize); if (f1->valid & f2->valid & APR_FINFO_PROT) - ABTS_ASSERT(tc, "apr_stat and apr_getfileinfo differ in protection", + ABTS_ASSERT(tc, "fspr_stat and fspr_getfileinfo differ in protection", f1->protection == f2->protection); } static void test_info_get(abts_case *tc, void *data) { - apr_file_t *thefile; - apr_finfo_t finfo; - apr_status_t rv; + fspr_file_t *thefile; + fspr_finfo_t finfo; + fspr_status_t rv; - rv = apr_file_open(&thefile, FILENAME, APR_READ, APR_OS_DEFAULT, p); + rv = fspr_file_open(&thefile, FILENAME, APR_READ, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile); + rv = fspr_file_info_get(&finfo, APR_FINFO_NORM, thefile); if (rv == APR_INCOMPLETE) { char *str; int i; - str = apr_pstrdup(p, "APR_INCOMPLETE: Missing "); + str = fspr_pstrdup(p, "APR_INCOMPLETE: Missing "); for (i = 0; vfi[i].bits; ++i) { if (vfi[i].bits & ~finfo.valid) { - str = apr_pstrcat(p, str, vfi[i].description, " ", NULL); + str = fspr_pstrcat(p, str, vfi[i].description, " ", NULL); } } ABTS_FAIL(tc, str); } ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_file_close(thefile); + fspr_file_close(thefile); } static void test_stat(abts_case *tc, void *data) { - apr_finfo_t finfo; - apr_status_t rv; + fspr_finfo_t finfo; + fspr_status_t rv; - rv = apr_stat(&finfo, FILENAME, APR_FINFO_NORM, p); + rv = fspr_stat(&finfo, FILENAME, APR_FINFO_NORM, p); if (rv == APR_INCOMPLETE) { char *str; int i; - str = apr_pstrdup(p, "APR_INCOMPLETE: Missing "); + str = fspr_pstrdup(p, "APR_INCOMPLETE: Missing "); for (i = 0; vfi[i].bits; ++i) { if (vfi[i].bits & ~finfo.valid) { - str = apr_pstrcat(p, str, vfi[i].description, " ", NULL); + str = fspr_pstrcat(p, str, vfi[i].description, " ", NULL); } } ABTS_FAIL(tc, str); @@ -150,36 +150,36 @@ static void test_stat(abts_case *tc, void *data) static void test_stat_eq_finfo(abts_case *tc, void *data) { - apr_file_t *thefile; - apr_finfo_t finfo; - apr_finfo_t stat_finfo; - apr_status_t rv; + fspr_file_t *thefile; + fspr_finfo_t finfo; + fspr_finfo_t stat_finfo; + fspr_status_t rv; - rv = apr_file_open(&thefile, FILENAME, APR_READ, APR_OS_DEFAULT, p); + rv = fspr_file_open(&thefile, FILENAME, APR_READ, APR_OS_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile); + rv = fspr_file_info_get(&finfo, APR_FINFO_NORM, thefile); /* Opening the file may have toggled the atime member (time last - * accessed), so fetch our apr_stat() after getting the fileinfo + * accessed), so fetch our fspr_stat() after getting the fileinfo * of the open file... */ - rv = apr_stat(&stat_finfo, FILENAME, APR_FINFO_NORM, p); + rv = fspr_stat(&stat_finfo, FILENAME, APR_FINFO_NORM, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - apr_file_close(thefile); + fspr_file_close(thefile); finfo_equal(tc, &stat_finfo, &finfo); } static void test_buffered_write_size(abts_case *tc, void *data) { - const apr_size_t data_len = strlen(NEWFILEDATA); - apr_file_t *thefile; - apr_finfo_t finfo; - apr_status_t rv; - apr_size_t bytes; + const fspr_size_t data_len = strlen(NEWFILEDATA); + fspr_file_t *thefile; + fspr_finfo_t finfo; + fspr_status_t rv; + fspr_size_t bytes; - rv = apr_file_open(&thefile, NEWFILENAME, + rv = fspr_file_open(&thefile, NEWFILENAME, APR_READ | APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BUFFERED | APR_DELONCLOSE, APR_OS_DEFAULT, p); @@ -187,46 +187,46 @@ static void test_buffered_write_size(abts_case *tc, void *data) /* A funny thing happened to me the other day: I wrote something * into a buffered file, then asked for its size using - * apr_file_info_get; and guess what? The size was 0! That's not a + * fspr_file_info_get; and guess what? The size was 0! That's not a * nice way to behave. */ bytes = data_len; - rv = apr_file_write(thefile, NEWFILEDATA, &bytes); + rv = fspr_file_write(thefile, NEWFILEDATA, &bytes); APR_ASSERT_SUCCESS(tc, "write file contents", rv); ABTS_TRUE(tc, data_len == bytes); - rv = apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile); + rv = fspr_file_info_get(&finfo, APR_FINFO_SIZE, thefile); APR_ASSERT_SUCCESS(tc, "get file size", rv); - ABTS_TRUE(tc, bytes == (apr_size_t) finfo.size); - apr_file_close(thefile); + ABTS_TRUE(tc, bytes == (fspr_size_t) finfo.size); + fspr_file_close(thefile); } static void test_mtime_set(abts_case *tc, void *data) { - apr_file_t *thefile; - apr_finfo_t finfo; - apr_time_t epoch = 0; - apr_status_t rv; + fspr_file_t *thefile; + fspr_finfo_t finfo; + fspr_time_t epoch = 0; + fspr_status_t rv; /* This test sort of depends on the system clock being at least * marginally ccorrect; We'll be setting the modification time to * the epoch. */ - rv = apr_file_open(&thefile, NEWFILENAME, + rv = fspr_file_open(&thefile, NEWFILENAME, APR_READ | APR_WRITE | APR_CREATE | APR_TRUNCATE | APR_BUFFERED | APR_DELONCLOSE, APR_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "open file", rv); /* Check that the current mtime is not the epoch */ - rv = apr_stat(&finfo, NEWFILENAME, APR_FINFO_MTIME, p); + rv = fspr_stat(&finfo, NEWFILENAME, APR_FINFO_MTIME, p); if (rv == APR_INCOMPLETE) { char *str; int i; - str = apr_pstrdup(p, "APR_INCOMPLETE: Missing "); + str = fspr_pstrdup(p, "APR_INCOMPLETE: Missing "); for (i = 0; vfi[i].bits; ++i) { if (vfi[i].bits & ~finfo.valid) { - str = apr_pstrcat(p, str, vfi[i].description, " ", NULL); + str = fspr_pstrcat(p, str, vfi[i].description, " ", NULL); } } ABTS_FAIL(tc, str); @@ -235,17 +235,17 @@ static void test_mtime_set(abts_case *tc, void *data) ABTS_TRUE(tc, finfo.mtime != epoch); /* Reset the mtime to the epoch and verify the result. - * Note: we blindly assume that if the first apr_stat succeeded, + * Note: we blindly assume that if the first fspr_stat succeeded, * the second one will, too. */ - rv = apr_file_mtime_set(NEWFILENAME, epoch, p); + rv = fspr_file_mtime_set(NEWFILENAME, epoch, p); APR_ASSERT_SUCCESS(tc, "set mtime", rv); - rv = apr_stat(&finfo, NEWFILENAME, APR_FINFO_MTIME, p); + rv = fspr_stat(&finfo, NEWFILENAME, APR_FINFO_MTIME, p); APR_ASSERT_SUCCESS(tc, "get modified mtime", rv); ABTS_TRUE(tc, finfo.mtime == epoch); - apr_file_close(thefile); + fspr_file_close(thefile); } abts_suite *testfileinfo(abts_suite *suite) diff --git a/libs/apr/test/testflock.c b/libs/apr/test/testflock.c index 6eac94a7a0..545ba300ce 100644 --- a/libs/apr/test/testflock.c +++ b/libs/apr/test/testflock.c @@ -16,39 +16,39 @@ #include "testflock.h" #include "testutil.h" -#include "apr_pools.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_general.h" -#include "apr_strings.h" +#include "fspr_pools.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_general.h" +#include "fspr_strings.h" static int launch_reader(abts_case *tc) { - apr_proc_t proc = {0}; - apr_procattr_t *procattr; + fspr_proc_t proc = {0}; + fspr_procattr_t *procattr; const char *args[2]; - apr_status_t rv; - apr_exit_why_e why; + fspr_status_t rv; + fspr_exit_why_e why; int exitcode; - rv = apr_procattr_create(&procattr, p); + rv = fspr_procattr_create(&procattr, p); APR_ASSERT_SUCCESS(tc, "Couldn't create procattr", rv); - rv = apr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, + rv = fspr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, APR_NO_PIPE); APR_ASSERT_SUCCESS(tc, "Couldn't set io in procattr", rv); - rv = apr_procattr_error_check_set(procattr, 1); + rv = fspr_procattr_error_check_set(procattr, 1); APR_ASSERT_SUCCESS(tc, "Couldn't set error check in procattr", rv); args[0] = "tryread" EXTENSION; args[1] = NULL; - rv = apr_proc_create(&proc, "./tryread" EXTENSION, args, NULL, procattr, p); + rv = fspr_proc_create(&proc, "./tryread" EXTENSION, args, NULL, procattr, p); APR_ASSERT_SUCCESS(tc, "Couldn't launch program", rv); ABTS_ASSERT(tc, "wait for child process", - apr_proc_wait(&proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE); + fspr_proc_wait(&proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE); ABTS_ASSERT(tc, "child terminated normally", why == APR_PROC_EXIT); return exitcode; @@ -56,23 +56,23 @@ static int launch_reader(abts_case *tc) static void test_withlock(abts_case *tc, void *data) { - apr_file_t *file; - apr_status_t rv; + fspr_file_t *file; + fspr_status_t rv; int code; - rv = apr_file_open(&file, TESTFILE, APR_WRITE|APR_CREATE, + rv = fspr_file_open(&file, TESTFILE, APR_WRITE|APR_CREATE, APR_OS_DEFAULT, p); APR_ASSERT_SUCCESS(tc, "Could not create file.", rv); ABTS_PTR_NOTNULL(tc, file); - rv = apr_file_lock(file, APR_FLOCK_EXCLUSIVE); + rv = fspr_file_lock(file, APR_FLOCK_EXCLUSIVE); APR_ASSERT_SUCCESS(tc, "Could not lock the file.", rv); ABTS_PTR_NOTNULL(tc, file); code = launch_reader(tc); ABTS_INT_EQUAL(tc, FAILED_READ, code); - (void) apr_file_close(file); + (void) fspr_file_close(file); } static void test_withoutlock(abts_case *tc, void *data) @@ -86,7 +86,7 @@ static void test_withoutlock(abts_case *tc, void *data) static void remove_lockfile(abts_case *tc, void *data) { APR_ASSERT_SUCCESS(tc, "Couldn't remove lock file.", - apr_file_remove(TESTFILE, p)); + fspr_file_remove(TESTFILE, p)); } abts_suite *testflock(abts_suite *suite) diff --git a/libs/apr/test/testfmt.c b/libs/apr/test/testfmt.c index 9ddb639f0f..5e345c45e8 100644 --- a/libs/apr/test/testfmt.c +++ b/libs/apr/test/testfmt.c @@ -15,40 +15,40 @@ */ #include "testutil.h" -#include "apr.h" -#include "apr_portable.h" -#include "apr_strings.h" +#include "fspr.h" +#include "fspr_portable.h" +#include "fspr_strings.h" static void ssize_t_fmt(abts_case *tc, void *data) { char buf[100]; - apr_ssize_t var = 0; + fspr_ssize_t var = 0; sprintf(buf, "%" APR_SSIZE_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); - apr_snprintf(buf, sizeof(buf), "%" APR_SSIZE_T_FMT, var); + fspr_snprintf(buf, sizeof(buf), "%" APR_SSIZE_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); } static void size_t_fmt(abts_case *tc, void *data) { char buf[100]; - apr_size_t var = 0; + fspr_size_t var = 0; sprintf(buf, "%" APR_SIZE_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); - apr_snprintf(buf, sizeof(buf), "%" APR_SIZE_T_FMT, var); + fspr_snprintf(buf, sizeof(buf), "%" APR_SIZE_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); } static void off_t_fmt(abts_case *tc, void *data) { char buf[100]; - apr_off_t var = 0; + fspr_off_t var = 0; sprintf(buf, "%" APR_OFF_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); - apr_snprintf(buf, sizeof(buf), "%" APR_OFF_T_FMT, var); + fspr_snprintf(buf, sizeof(buf), "%" APR_OFF_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); } @@ -59,61 +59,61 @@ static void pid_t_fmt(abts_case *tc, void *data) sprintf(buf, "%" APR_PID_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); - apr_snprintf(buf, sizeof(buf), "%" APR_PID_T_FMT, var); + fspr_snprintf(buf, sizeof(buf), "%" APR_PID_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); } static void int64_t_fmt(abts_case *tc, void *data) { char buf[100]; - apr_int64_t var = 0; + fspr_int64_t var = 0; sprintf(buf, "%" APR_INT64_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); - apr_snprintf(buf, sizeof(buf), "%" APR_INT64_T_FMT, var); + fspr_snprintf(buf, sizeof(buf), "%" APR_INT64_T_FMT, var); ABTS_STR_EQUAL(tc, "0", buf); } static void uint64_t_fmt(abts_case *tc, void *data) { char buf[100]; - apr_uint64_t var = APR_UINT64_C(14000000); + fspr_uint64_t var = APR_UINT64_C(14000000); sprintf(buf, "%" APR_UINT64_T_FMT, var); ABTS_STR_EQUAL(tc, "14000000", buf); - apr_snprintf(buf, sizeof(buf), "%" APR_UINT64_T_FMT, var); + fspr_snprintf(buf, sizeof(buf), "%" APR_UINT64_T_FMT, var); ABTS_STR_EQUAL(tc, "14000000", buf); } static void uint64_t_hex_fmt(abts_case *tc, void *data) { char buf[100]; - apr_uint64_t var = APR_UINT64_C(14000000); + fspr_uint64_t var = APR_UINT64_C(14000000); sprintf(buf, "%" APR_UINT64_T_HEX_FMT, var); ABTS_STR_EQUAL(tc, "d59f80", buf); - apr_snprintf(buf, sizeof(buf), "%" APR_UINT64_T_HEX_FMT, var); + fspr_snprintf(buf, sizeof(buf), "%" APR_UINT64_T_HEX_FMT, var); ABTS_STR_EQUAL(tc, "d59f80", buf); } static void more_int64_fmts(abts_case *tc, void *data) { char buf[100]; - apr_int64_t i = APR_INT64_C(-42); - apr_int64_t ibig = APR_INT64_C(-314159265358979323); - apr_uint64_t ui = APR_UINT64_C(42); - apr_uint64_t big = APR_UINT64_C(3141592653589793238); + fspr_int64_t i = APR_INT64_C(-42); + fspr_int64_t ibig = APR_INT64_C(-314159265358979323); + fspr_uint64_t ui = APR_UINT64_C(42); + fspr_uint64_t big = APR_UINT64_C(3141592653589793238); - apr_snprintf(buf, sizeof buf, "%" APR_INT64_T_FMT, i); + fspr_snprintf(buf, sizeof buf, "%" APR_INT64_T_FMT, i); ABTS_STR_EQUAL(tc, buf, "-42"); - apr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, ui); + fspr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, ui); ABTS_STR_EQUAL(tc, buf, "42"); - apr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, big); + fspr_snprintf(buf, sizeof buf, "%" APR_UINT64_T_FMT, big); ABTS_STR_EQUAL(tc, buf, "3141592653589793238"); - apr_snprintf(buf, sizeof buf, "%" APR_INT64_T_FMT, ibig); + fspr_snprintf(buf, sizeof buf, "%" APR_INT64_T_FMT, ibig); ABTS_STR_EQUAL(tc, buf, "-314159265358979323"); } diff --git a/libs/apr/test/testfnmatch.c b/libs/apr/test/testfnmatch.c index b54502fd29..41f8bb34b2 100644 --- a/libs/apr/test/testfnmatch.c +++ b/libs/apr/test/testfnmatch.c @@ -15,9 +15,9 @@ */ #include "testutil.h" -#include "apr_file_info.h" -#include "apr_fnmatch.h" -#include "apr_tables.h" +#include "fspr_file_info.h" +#include "fspr_fnmatch.h" +#include "fspr_tables.h" /* XXX NUM_FILES must be equal to the nummber of expected files with a * .txt extension in the data directory at the time testfnmatch @@ -29,10 +29,10 @@ static void test_glob(abts_case *tc, void *data) { int i; char **list; - apr_array_header_t *result; + fspr_array_header_t *result; APR_ASSERT_SUCCESS(tc, "glob match against data/*.txt", - apr_match_glob("data\\*.txt", &result, p)); + fspr_match_glob("data\\*.txt", &result, p)); ABTS_INT_EQUAL(tc, NUM_FILES, result->nelts); @@ -47,11 +47,11 @@ static void test_glob_currdir(abts_case *tc, void *data) { int i; char **list; - apr_array_header_t *result; - apr_filepath_set("data", p); + fspr_array_header_t *result; + fspr_filepath_set("data", p); APR_ASSERT_SUCCESS(tc, "glob match against *.txt with data as current", - apr_match_glob("*.txt", &result, p)); + fspr_match_glob("*.txt", &result, p)); ABTS_INT_EQUAL(tc, NUM_FILES, result->nelts); @@ -61,7 +61,7 @@ static void test_glob_currdir(abts_case *tc, void *data) char *dot = strrchr(list[i], '.'); ABTS_STR_EQUAL(tc, dot, ".txt"); } - apr_filepath_set("..", p); + fspr_filepath_set("..", p); } abts_suite *testfnmatch(abts_suite *suite) diff --git a/libs/apr/test/testglobalmutex.c b/libs/apr/test/testglobalmutex.c index a10742d92f..b0d2f50976 100644 --- a/libs/apr/test/testglobalmutex.c +++ b/libs/apr/test/testglobalmutex.c @@ -15,51 +15,51 @@ */ #include "testglobalmutex.h" -#include "apr_thread_proc.h" -#include "apr_global_mutex.h" -#include "apr_strings.h" -#include "apr_errno.h" +#include "fspr_thread_proc.h" +#include "fspr_global_mutex.h" +#include "fspr_strings.h" +#include "fspr_errno.h" #include "testutil.h" -static void launch_child(abts_case *tc, apr_lockmech_e mech, - apr_proc_t *proc, apr_pool_t *p) +static void launch_child(abts_case *tc, fspr_lockmech_e mech, + fspr_proc_t *proc, fspr_pool_t *p) { - apr_procattr_t *procattr; + fspr_procattr_t *procattr; const char *args[3]; - apr_status_t rv; + fspr_status_t rv; - rv = apr_procattr_create(&procattr, p); + rv = fspr_procattr_create(&procattr, p); APR_ASSERT_SUCCESS(tc, "Couldn't create procattr", rv); - rv = apr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, + rv = fspr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, APR_NO_PIPE); APR_ASSERT_SUCCESS(tc, "Couldn't set io in procattr", rv); - rv = apr_procattr_error_check_set(procattr, 1); + rv = fspr_procattr_error_check_set(procattr, 1); APR_ASSERT_SUCCESS(tc, "Couldn't set error check in procattr", rv); args[0] = "globalmutexchild" EXTENSION; - args[1] = (const char*)apr_itoa(p, (int)mech); + args[1] = (const char*)fspr_itoa(p, (int)mech); args[2] = NULL; - rv = apr_proc_create(proc, "./globalmutexchild" EXTENSION, args, NULL, + rv = fspr_proc_create(proc, "./globalmutexchild" EXTENSION, args, NULL, procattr, p); APR_ASSERT_SUCCESS(tc, "Couldn't launch program", rv); } -static int wait_child(abts_case *tc, apr_proc_t *proc) +static int wait_child(abts_case *tc, fspr_proc_t *proc) { int exitcode; - apr_exit_why_e why; + fspr_exit_why_e why; ABTS_ASSERT(tc, "Error waiting for child process", - apr_proc_wait(proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE); + fspr_proc_wait(proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE); ABTS_ASSERT(tc, "child didn't terminate normally", why == APR_PROC_EXIT); return exitcode; } /* return symbolic name for a locking meechanism */ -static const char *mutexname(apr_lockmech_e mech) +static const char *mutexname(fspr_lockmech_e mech) { switch (mech) { case APR_LOCK_FCNTL: return "fcntl"; @@ -74,15 +74,15 @@ static const char *mutexname(apr_lockmech_e mech) static void test_exclusive(abts_case *tc, void *data) { - apr_lockmech_e mech = *(apr_lockmech_e *)data; - apr_proc_t p1, p2, p3, p4; - apr_status_t rv; - apr_global_mutex_t *global_lock; + fspr_lockmech_e mech = *(fspr_lockmech_e *)data; + fspr_proc_t p1, p2, p3, p4; + fspr_status_t rv; + fspr_global_mutex_t *global_lock; int x = 0; abts_log_message("lock mechanism is: "); abts_log_message(mutexname(mech)); - rv = apr_global_mutex_create(&global_lock, LOCKNAME, mech, p); + rv = fspr_global_mutex_create(&global_lock, LOCKNAME, mech, p); APR_ASSERT_SUCCESS(tc, "Error creating mutex", rv); launch_child(tc, mech, &p1, p); @@ -105,7 +105,7 @@ static void test_exclusive(abts_case *tc, void *data) abts_suite *testglobalmutex(abts_suite *suite) { - apr_lockmech_e mech = APR_LOCK_DEFAULT; + fspr_lockmech_e mech = APR_LOCK_DEFAULT; suite = ADD_SUITE(suite) abts_run_test(suite, test_exclusive, &mech); diff --git a/libs/apr/test/testglobalmutex.h b/libs/apr/test/testglobalmutex.h index 027062843d..a23df50fe4 100644 --- a/libs/apr/test/testglobalmutex.h +++ b/libs/apr/test/testglobalmutex.h @@ -21,7 +21,7 @@ #define MAX_ITER 255 #define MAX_COUNTER (MAX_ITER * 4) -#define LOCKNAME "data/apr_globalmutex.lock" +#define LOCKNAME "data/fspr_globalmutex.lock" #endif diff --git a/libs/apr/test/testhash.c b/libs/apr/test/testhash.c index c9b1cdb07c..924d722e6e 100644 --- a/libs/apr/test/testhash.c +++ b/libs/apr/test/testhash.c @@ -15,41 +15,41 @@ */ #include "testutil.h" -#include "apr.h" -#include "apr_strings.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_hash.h" +#include "fspr.h" +#include "fspr_strings.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_hash.h" -static void dump_hash(apr_pool_t *p, apr_hash_t *h, char *str) +static void dump_hash(fspr_pool_t *p, fspr_hash_t *h, char *str) { - apr_hash_index_t *hi; + fspr_hash_index_t *hi; char *val, *key; - apr_ssize_t len; + fspr_ssize_t len; int i = 0; str[0] = '\0'; - for (hi = apr_hash_first(p, h); hi; hi = apr_hash_next(hi)) { - apr_hash_this(hi,(void*) &key, &len, (void*) &val); - apr_snprintf(str, 8196, "%sKey %s (%" APR_SSIZE_T_FMT ") Value %s\n", + for (hi = fspr_hash_first(p, h); hi; hi = fspr_hash_next(hi)) { + fspr_hash_this(hi,(void*) &key, &len, (void*) &val); + fspr_snprintf(str, 8196, "%sKey %s (%" APR_SSIZE_T_FMT ") Value %s\n", str, key, len, val); i++; } - apr_snprintf(str, 8196, "%s#entries %d\n", str, i); + fspr_snprintf(str, 8196, "%s#entries %d\n", str, i); } -static void sum_hash(apr_pool_t *p, apr_hash_t *h, int *pcount, int *keySum, int *valSum) +static void sum_hash(fspr_pool_t *p, fspr_hash_t *h, int *pcount, int *keySum, int *valSum) { - apr_hash_index_t *hi; + fspr_hash_index_t *hi; void *val, *key; int count = 0; *keySum = 0; *valSum = 0; *pcount = 0; - for (hi = apr_hash_first(p, h); hi; hi = apr_hash_next(hi)) { - apr_hash_this(hi, (void*)&key, NULL, &val); + for (hi = fspr_hash_first(p, h); hi; hi = fspr_hash_next(hi)) { + fspr_hash_this(hi, (void*)&key, NULL, &val); *valSum += *(int *)val; *keySum += *(int *)key; count++; @@ -59,60 +59,60 @@ static void sum_hash(apr_pool_t *p, apr_hash_t *h, int *pcount, int *keySum, int static void hash_make(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); } static void hash_set(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; char *result = NULL; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value"); - result = apr_hash_get(h, "key", APR_HASH_KEY_STRING); + fspr_hash_set(h, "key", APR_HASH_KEY_STRING, "value"); + result = fspr_hash_get(h, "key", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "value", result); } static void hash_reset(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; char *result = NULL; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value"); - result = apr_hash_get(h, "key", APR_HASH_KEY_STRING); + fspr_hash_set(h, "key", APR_HASH_KEY_STRING, "value"); + result = fspr_hash_get(h, "key", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "value", result); - apr_hash_set(h, "key", APR_HASH_KEY_STRING, "new"); - result = apr_hash_get(h, "key", APR_HASH_KEY_STRING); + fspr_hash_set(h, "key", APR_HASH_KEY_STRING, "new"); + result = fspr_hash_get(h, "key", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "new", result); } static void same_value(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; char *result = NULL; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "same1", APR_HASH_KEY_STRING, "same"); - result = apr_hash_get(h, "same1", APR_HASH_KEY_STRING); + fspr_hash_set(h, "same1", APR_HASH_KEY_STRING, "same"); + result = fspr_hash_get(h, "same1", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "same", result); - apr_hash_set(h, "same2", APR_HASH_KEY_STRING, "same"); - result = apr_hash_get(h, "same2", APR_HASH_KEY_STRING); + fspr_hash_set(h, "same2", APR_HASH_KEY_STRING, "same"); + result = fspr_hash_get(h, "same2", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "same", result); } -static unsigned int hash_custom( const char *key, apr_ssize_t *klen) +static unsigned int hash_custom( const char *key, fspr_ssize_t *klen) { unsigned int hash = 0; while( *klen ) { @@ -124,55 +124,55 @@ static unsigned int hash_custom( const char *key, apr_ssize_t *klen) static void same_value_custom(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; char *result = NULL; - h = apr_hash_make_custom(p, hash_custom); + h = fspr_hash_make_custom(p, hash_custom); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "same1", 5, "same"); - result = apr_hash_get(h, "same1", 5); + fspr_hash_set(h, "same1", 5, "same"); + result = fspr_hash_get(h, "same1", 5); ABTS_STR_EQUAL(tc, "same", result); - apr_hash_set(h, "same2", 5, "same"); - result = apr_hash_get(h, "same2", 5); + fspr_hash_set(h, "same2", 5, "same"); + result = fspr_hash_get(h, "same2", 5); ABTS_STR_EQUAL(tc, "same", result); } static void key_space(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; char *result = NULL; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "key with space", APR_HASH_KEY_STRING, "value"); - result = apr_hash_get(h, "key with space", APR_HASH_KEY_STRING); + fspr_hash_set(h, "key with space", APR_HASH_KEY_STRING, "value"); + result = fspr_hash_get(h, "key with space", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "value", result); } /* This is kind of a hack, but I am just keeping an existing test. This is - * really testing apr_hash_first, apr_hash_next, and apr_hash_this which + * really testing fspr_hash_first, fspr_hash_next, and fspr_hash_this which * should be tested in three separate tests, but this will do for now. */ static void hash_traverse(abts_case *tc, void *data) { - apr_hash_t *h; + fspr_hash_t *h; char str[8196]; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "OVERWRITE", APR_HASH_KEY_STRING, "should not see this"); - apr_hash_set(h, "FOO3", APR_HASH_KEY_STRING, "bar3"); - apr_hash_set(h, "FOO3", APR_HASH_KEY_STRING, "bar3"); - apr_hash_set(h, "FOO1", APR_HASH_KEY_STRING, "bar1"); - apr_hash_set(h, "FOO2", APR_HASH_KEY_STRING, "bar2"); - apr_hash_set(h, "FOO4", APR_HASH_KEY_STRING, "bar4"); - apr_hash_set(h, "SAME1", APR_HASH_KEY_STRING, "same"); - apr_hash_set(h, "SAME2", APR_HASH_KEY_STRING, "same"); - apr_hash_set(h, "OVERWRITE", APR_HASH_KEY_STRING, "Overwrite key"); + fspr_hash_set(h, "OVERWRITE", APR_HASH_KEY_STRING, "should not see this"); + fspr_hash_set(h, "FOO3", APR_HASH_KEY_STRING, "bar3"); + fspr_hash_set(h, "FOO3", APR_HASH_KEY_STRING, "bar3"); + fspr_hash_set(h, "FOO1", APR_HASH_KEY_STRING, "bar1"); + fspr_hash_set(h, "FOO2", APR_HASH_KEY_STRING, "bar2"); + fspr_hash_set(h, "FOO4", APR_HASH_KEY_STRING, "bar4"); + fspr_hash_set(h, "SAME1", APR_HASH_KEY_STRING, "same"); + fspr_hash_set(h, "SAME2", APR_HASH_KEY_STRING, "same"); + fspr_hash_set(h, "OVERWRITE", APR_HASH_KEY_STRING, "Overwrite key"); dump_hash(p, h, str); ABTS_STR_EQUAL(tc, "Key FOO1 (4) Value bar1\n" @@ -186,16 +186,16 @@ static void hash_traverse(abts_case *tc, void *data) } /* This is kind of a hack, but I am just keeping an existing test. This is - * really testing apr_hash_first, apr_hash_next, and apr_hash_this which + * really testing fspr_hash_first, fspr_hash_next, and fspr_hash_this which * should be tested in three separate tests, but this will do for now. */ static void summation_test(abts_case *tc, void *data) { - apr_hash_t *h; + fspr_hash_t *h; int sumKeys, sumVal, trySumKey, trySumVal; int i, j, *val, *key; - h =apr_hash_make(p); + h =fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); sumKeys = 0; @@ -207,11 +207,11 @@ static void summation_test(abts_case *tc, void *data) j = i * 10 + 1; sumKeys += j; sumVal += i; - key = apr_palloc(p, sizeof(int)); + key = fspr_palloc(p, sizeof(int)); *key = j; - val = apr_palloc(p, sizeof(int)); + val = fspr_palloc(p, sizeof(int)); *val = i; - apr_hash_set(h, key, sizeof(int), val); + fspr_hash_set(h, key, sizeof(int), val); } sum_hash(p, h, &i, &trySumKey, &trySumVal); @@ -222,96 +222,96 @@ static void summation_test(abts_case *tc, void *data) static void delete_key(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; char *result = NULL; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value"); - apr_hash_set(h, "key2", APR_HASH_KEY_STRING, "value2"); + fspr_hash_set(h, "key", APR_HASH_KEY_STRING, "value"); + fspr_hash_set(h, "key2", APR_HASH_KEY_STRING, "value2"); - result = apr_hash_get(h, "key", APR_HASH_KEY_STRING); + result = fspr_hash_get(h, "key", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "value", result); - result = apr_hash_get(h, "key2", APR_HASH_KEY_STRING); + result = fspr_hash_get(h, "key2", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "value2", result); - apr_hash_set(h, "key", APR_HASH_KEY_STRING, NULL); + fspr_hash_set(h, "key", APR_HASH_KEY_STRING, NULL); - result = apr_hash_get(h, "key", APR_HASH_KEY_STRING); + result = fspr_hash_get(h, "key", APR_HASH_KEY_STRING); ABTS_PTR_EQUAL(tc, NULL, result); - result = apr_hash_get(h, "key2", APR_HASH_KEY_STRING); + result = fspr_hash_get(h, "key2", APR_HASH_KEY_STRING); ABTS_STR_EQUAL(tc, "value2", result); } static void hash_count_0(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; int count; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - count = apr_hash_count(h); + count = fspr_hash_count(h); ABTS_INT_EQUAL(tc, 0, count); } static void hash_count_1(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; int count; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "key", APR_HASH_KEY_STRING, "value"); + fspr_hash_set(h, "key", APR_HASH_KEY_STRING, "value"); - count = apr_hash_count(h); + count = fspr_hash_count(h); ABTS_INT_EQUAL(tc, 1, count); } static void hash_count_5(abts_case *tc, void *data) { - apr_hash_t *h = NULL; + fspr_hash_t *h = NULL; int count; - h = apr_hash_make(p); + h = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, h); - apr_hash_set(h, "key1", APR_HASH_KEY_STRING, "value1"); - apr_hash_set(h, "key2", APR_HASH_KEY_STRING, "value2"); - apr_hash_set(h, "key3", APR_HASH_KEY_STRING, "value3"); - apr_hash_set(h, "key4", APR_HASH_KEY_STRING, "value4"); - apr_hash_set(h, "key5", APR_HASH_KEY_STRING, "value5"); + fspr_hash_set(h, "key1", APR_HASH_KEY_STRING, "value1"); + fspr_hash_set(h, "key2", APR_HASH_KEY_STRING, "value2"); + fspr_hash_set(h, "key3", APR_HASH_KEY_STRING, "value3"); + fspr_hash_set(h, "key4", APR_HASH_KEY_STRING, "value4"); + fspr_hash_set(h, "key5", APR_HASH_KEY_STRING, "value5"); - count = apr_hash_count(h); + count = fspr_hash_count(h); ABTS_INT_EQUAL(tc, 5, count); } static void overlay_empty(abts_case *tc, void *data) { - apr_hash_t *base = NULL; - apr_hash_t *overlay = NULL; - apr_hash_t *result = NULL; + fspr_hash_t *base = NULL; + fspr_hash_t *overlay = NULL; + fspr_hash_t *result = NULL; int count; char str[8196]; - base = apr_hash_make(p); - overlay = apr_hash_make(p); + base = fspr_hash_make(p); + overlay = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, base); ABTS_PTR_NOTNULL(tc, overlay); - apr_hash_set(base, "key1", APR_HASH_KEY_STRING, "value1"); - apr_hash_set(base, "key2", APR_HASH_KEY_STRING, "value2"); - apr_hash_set(base, "key3", APR_HASH_KEY_STRING, "value3"); - apr_hash_set(base, "key4", APR_HASH_KEY_STRING, "value4"); - apr_hash_set(base, "key5", APR_HASH_KEY_STRING, "value5"); + fspr_hash_set(base, "key1", APR_HASH_KEY_STRING, "value1"); + fspr_hash_set(base, "key2", APR_HASH_KEY_STRING, "value2"); + fspr_hash_set(base, "key3", APR_HASH_KEY_STRING, "value3"); + fspr_hash_set(base, "key4", APR_HASH_KEY_STRING, "value4"); + fspr_hash_set(base, "key5", APR_HASH_KEY_STRING, "value5"); - result = apr_hash_overlay(p, overlay, base); + result = fspr_hash_overlay(p, overlay, base); - count = apr_hash_count(result); + count = fspr_hash_count(result); ABTS_INT_EQUAL(tc, 5, count); dump_hash(p, result, str); @@ -325,32 +325,32 @@ static void overlay_empty(abts_case *tc, void *data) static void overlay_2unique(abts_case *tc, void *data) { - apr_hash_t *base = NULL; - apr_hash_t *overlay = NULL; - apr_hash_t *result = NULL; + fspr_hash_t *base = NULL; + fspr_hash_t *overlay = NULL; + fspr_hash_t *result = NULL; int count; char str[8196]; - base = apr_hash_make(p); - overlay = apr_hash_make(p); + base = fspr_hash_make(p); + overlay = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, base); ABTS_PTR_NOTNULL(tc, overlay); - apr_hash_set(base, "base1", APR_HASH_KEY_STRING, "value1"); - apr_hash_set(base, "base2", APR_HASH_KEY_STRING, "value2"); - apr_hash_set(base, "base3", APR_HASH_KEY_STRING, "value3"); - apr_hash_set(base, "base4", APR_HASH_KEY_STRING, "value4"); - apr_hash_set(base, "base5", APR_HASH_KEY_STRING, "value5"); + fspr_hash_set(base, "base1", APR_HASH_KEY_STRING, "value1"); + fspr_hash_set(base, "base2", APR_HASH_KEY_STRING, "value2"); + fspr_hash_set(base, "base3", APR_HASH_KEY_STRING, "value3"); + fspr_hash_set(base, "base4", APR_HASH_KEY_STRING, "value4"); + fspr_hash_set(base, "base5", APR_HASH_KEY_STRING, "value5"); - apr_hash_set(overlay, "overlay1", APR_HASH_KEY_STRING, "value1"); - apr_hash_set(overlay, "overlay2", APR_HASH_KEY_STRING, "value2"); - apr_hash_set(overlay, "overlay3", APR_HASH_KEY_STRING, "value3"); - apr_hash_set(overlay, "overlay4", APR_HASH_KEY_STRING, "value4"); - apr_hash_set(overlay, "overlay5", APR_HASH_KEY_STRING, "value5"); + fspr_hash_set(overlay, "overlay1", APR_HASH_KEY_STRING, "value1"); + fspr_hash_set(overlay, "overlay2", APR_HASH_KEY_STRING, "value2"); + fspr_hash_set(overlay, "overlay3", APR_HASH_KEY_STRING, "value3"); + fspr_hash_set(overlay, "overlay4", APR_HASH_KEY_STRING, "value4"); + fspr_hash_set(overlay, "overlay5", APR_HASH_KEY_STRING, "value5"); - result = apr_hash_overlay(p, overlay, base); + result = fspr_hash_overlay(p, overlay, base); - count = apr_hash_count(result); + count = fspr_hash_count(result); ABTS_INT_EQUAL(tc, 10, count); dump_hash(p, result, str); @@ -372,23 +372,23 @@ static void overlay_2unique(abts_case *tc, void *data) static void overlay_same(abts_case *tc, void *data) { - apr_hash_t *base = NULL; - apr_hash_t *result = NULL; + fspr_hash_t *base = NULL; + fspr_hash_t *result = NULL; int count; char str[8196]; - base = apr_hash_make(p); + base = fspr_hash_make(p); ABTS_PTR_NOTNULL(tc, base); - apr_hash_set(base, "base1", APR_HASH_KEY_STRING, "value1"); - apr_hash_set(base, "base2", APR_HASH_KEY_STRING, "value2"); - apr_hash_set(base, "base3", APR_HASH_KEY_STRING, "value3"); - apr_hash_set(base, "base4", APR_HASH_KEY_STRING, "value4"); - apr_hash_set(base, "base5", APR_HASH_KEY_STRING, "value5"); + fspr_hash_set(base, "base1", APR_HASH_KEY_STRING, "value1"); + fspr_hash_set(base, "base2", APR_HASH_KEY_STRING, "value2"); + fspr_hash_set(base, "base3", APR_HASH_KEY_STRING, "value3"); + fspr_hash_set(base, "base4", APR_HASH_KEY_STRING, "value4"); + fspr_hash_set(base, "base5", APR_HASH_KEY_STRING, "value5"); - result = apr_hash_overlay(p, base, base); + result = fspr_hash_overlay(p, base, base); - count = apr_hash_count(result); + count = fspr_hash_count(result); ABTS_INT_EQUAL(tc, 5, count); dump_hash(p, result, str); diff --git a/libs/apr/test/testipsub.c b/libs/apr/test/testipsub.c index 1411cd05a7..bdf5b78a64 100644 --- a/libs/apr/test/testipsub.c +++ b/libs/apr/test/testipsub.c @@ -15,16 +15,16 @@ */ #include "testutil.h" -#include "apr_general.h" -#include "apr_network_io.h" -#include "apr_errno.h" +#include "fspr_general.h" +#include "fspr_network_io.h" +#include "fspr_errno.h" static void test_bad_input(abts_case *tc, void *data) { struct { const char *ipstr; const char *mask; - apr_status_t expected_rv; + fspr_status_t expected_rv; } testcases[] = { /* so we have a few good inputs in here; sue me */ @@ -63,11 +63,11 @@ static void test_bad_input(abts_case *tc, void *data) #endif }; int i; - apr_ipsubnet_t *ipsub; - apr_status_t rv; + fspr_ipsubnet_t *ipsub; + fspr_status_t rv; for (i = 0; i < (sizeof testcases / sizeof testcases[0]); i++) { - rv = apr_ipsubnet_create(&ipsub, testcases[i].ipstr, testcases[i].mask, p); + rv = fspr_ipsubnet_create(&ipsub, testcases[i].ipstr, testcases[i].mask, p); ABTS_INT_EQUAL(tc, rv, testcases[i].expected_rv); } } @@ -79,18 +79,18 @@ static void test_singleton_subnets(abts_case *tc, void *data) "198.144.203.195", "192.18.97.241", "198.137.240.91", "62.156.179.119", "204.177.92.181" }; - apr_ipsubnet_t *ipsub; - apr_sockaddr_t *sa; - apr_status_t rv; + fspr_ipsubnet_t *ipsub; + fspr_sockaddr_t *sa; + fspr_status_t rv; int i, j, rc; for (i = 0; i < sizeof v4addrs / sizeof v4addrs[0]; i++) { - rv = apr_ipsubnet_create(&ipsub, v4addrs[i], NULL, p); + rv = fspr_ipsubnet_create(&ipsub, v4addrs[i], NULL, p); ABTS_TRUE(tc, rv == APR_SUCCESS); for (j = 0; j < sizeof v4addrs / sizeof v4addrs[0]; j++) { - rv = apr_sockaddr_info_get(&sa, v4addrs[j], APR_INET, 0, 0, p); + rv = fspr_sockaddr_info_get(&sa, v4addrs[j], APR_INET, 0, 0, p); ABTS_TRUE(tc, rv == APR_SUCCESS); - rc = apr_ipsubnet_test(ipsub, sa); + rc = fspr_ipsubnet_test(ipsub, sa); if (!strcmp(v4addrs[i], v4addrs[j])) { ABTS_TRUE(tc, rc != 0); } @@ -124,21 +124,21 @@ static void test_interesting_subnets(abts_case *tc, void *data) ,{"127.0.0.1", "8", APR_INET6, "::ffff:127.0.0.1", "fe80::1"} #endif }; - apr_ipsubnet_t *ipsub; - apr_sockaddr_t *sa; - apr_status_t rv; + fspr_ipsubnet_t *ipsub; + fspr_sockaddr_t *sa; + fspr_status_t rv; int i, rc; for (i = 0; i < sizeof testcases / sizeof testcases[0]; i++) { - rv = apr_ipsubnet_create(&ipsub, testcases[i].ipstr, testcases[i].mask, p); + rv = fspr_ipsubnet_create(&ipsub, testcases[i].ipstr, testcases[i].mask, p); ABTS_TRUE(tc, rv == APR_SUCCESS); - rv = apr_sockaddr_info_get(&sa, testcases[i].in_subnet, testcases[i].family, 0, 0, p); + rv = fspr_sockaddr_info_get(&sa, testcases[i].in_subnet, testcases[i].family, 0, 0, p); ABTS_TRUE(tc, rv == APR_SUCCESS); - rc = apr_ipsubnet_test(ipsub, sa); + rc = fspr_ipsubnet_test(ipsub, sa); ABTS_TRUE(tc, rc != 0); - rv = apr_sockaddr_info_get(&sa, testcases[i].not_in_subnet, testcases[i].family, 0, 0, p); + rv = fspr_sockaddr_info_get(&sa, testcases[i].not_in_subnet, testcases[i].family, 0, 0, p); ABTS_TRUE(tc, rv == APR_SUCCESS); - rc = apr_ipsubnet_test(ipsub, sa); + rc = fspr_ipsubnet_test(ipsub, sa); ABTS_TRUE(tc, rc == 0); } } @@ -147,7 +147,7 @@ static void test_badmask_str(abts_case *tc, void *data) { char buf[128]; - ABTS_STR_EQUAL(tc, apr_strerror(APR_EBADMASK, buf, sizeof buf), + ABTS_STR_EQUAL(tc, fspr_strerror(APR_EBADMASK, buf, sizeof buf), "The specified network mask is invalid."); } @@ -155,7 +155,7 @@ static void test_badip_str(abts_case *tc, void *data) { char buf[128]; - ABTS_STR_EQUAL(tc, apr_strerror(APR_EBADIP, buf, sizeof buf), + ABTS_STR_EQUAL(tc, fspr_strerror(APR_EBADIP, buf, sizeof buf), "The specified IP address is invalid."); } diff --git a/libs/apr/test/testlfs.c b/libs/apr/test/testlfs.c index c502400eef..08b0521584 100644 --- a/libs/apr/test/testlfs.c +++ b/libs/apr/test/testlfs.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_poll.h" -#include "apr_strings.h" -#include "apr_lib.h" -#include "apr_mmap.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_poll.h" +#include "fspr_strings.h" +#include "fspr_lib.h" +#include "fspr_mmap.h" #include "testutil.h" /* Only enable these tests by default on platforms which support sparse @@ -37,7 +37,7 @@ static void test_nolfs(abts_case *tc, void *data) /* Tests which create an 8Gb sparse file and then check it can be used * as normal. */ -static apr_off_t eightGb = APR_INT64_C(2) << 32; +static fspr_off_t eightGb = APR_INT64_C(2) << 32; static int madefile = 0; @@ -49,22 +49,22 @@ static int madefile = 0; static void test_open(abts_case *tc, void *data) { - apr_file_t *f; - apr_status_t rv; + fspr_file_t *f; + fspr_status_t rv; - rv = apr_dir_make(TESTDIR, APR_OS_DEFAULT, p); + rv = fspr_dir_make(TESTDIR, APR_OS_DEFAULT, p); if (rv && !APR_STATUS_IS_EEXIST(rv)) { APR_ASSERT_SUCCESS(tc, "make test directory", rv); } APR_ASSERT_SUCCESS(tc, "open file", - apr_file_open(&f, TESTFN, + fspr_file_open(&f, TESTFN, APR_CREATE | APR_WRITE | APR_TRUNCATE, APR_OS_DEFAULT, p)); - rv = apr_file_trunc(f, eightGb); + rv = fspr_file_trunc(f, eightGb); - APR_ASSERT_SUCCESS(tc, "close large file", apr_file_close(f)); + APR_ASSERT_SUCCESS(tc, "close large file", fspr_file_close(f)); /* 8Gb may pass rlimits or filesystem limits */ @@ -84,178 +84,178 @@ static void test_open(abts_case *tc, void *data) static void test_reopen(abts_case *tc, void *data) { - apr_file_t *fh; - apr_finfo_t finfo; + fspr_file_t *fh; + fspr_finfo_t finfo; PRECOND; APR_ASSERT_SUCCESS(tc, "re-open 8Gb file", - apr_file_open(&fh, TESTFN, APR_READ, APR_OS_DEFAULT, p)); + fspr_file_open(&fh, TESTFN, APR_READ, APR_OS_DEFAULT, p)); APR_ASSERT_SUCCESS(tc, "file_info_get failed", - apr_file_info_get(&finfo, APR_FINFO_NORM, fh)); + fspr_file_info_get(&finfo, APR_FINFO_NORM, fh)); ABTS_ASSERT(tc, "file_info_get gave incorrect size", finfo.size == eightGb); - APR_ASSERT_SUCCESS(tc, "re-close large file", apr_file_close(fh)); + APR_ASSERT_SUCCESS(tc, "re-close large file", fspr_file_close(fh)); } static void test_stat(abts_case *tc, void *data) { - apr_finfo_t finfo; + fspr_finfo_t finfo; PRECOND; APR_ASSERT_SUCCESS(tc, "stat large file", - apr_stat(&finfo, TESTFN, APR_FINFO_NORM, p)); + fspr_stat(&finfo, TESTFN, APR_FINFO_NORM, p)); ABTS_ASSERT(tc, "stat gave incorrect size", finfo.size == eightGb); } static void test_readdir(abts_case *tc, void *data) { - apr_dir_t *dh; - apr_status_t rv; + fspr_dir_t *dh; + fspr_status_t rv; PRECOND; APR_ASSERT_SUCCESS(tc, "open test directory", - apr_dir_open(&dh, TESTDIR, p)); + fspr_dir_open(&dh, TESTDIR, p)); do { - apr_finfo_t finfo; + fspr_finfo_t finfo; - rv = apr_dir_read(&finfo, APR_FINFO_NORM, dh); + rv = fspr_dir_read(&finfo, APR_FINFO_NORM, dh); if (rv == APR_SUCCESS && strcmp(finfo.name, TESTFILE) == 0) { - ABTS_ASSERT(tc, "apr_dir_read gave incorrect size for large file", + ABTS_ASSERT(tc, "fspr_dir_read gave incorrect size for large file", finfo.size == eightGb); } } while (rv == APR_SUCCESS); if (!APR_STATUS_IS_ENOENT(rv)) { - APR_ASSERT_SUCCESS(tc, "apr_dir_read failed", rv); + APR_ASSERT_SUCCESS(tc, "fspr_dir_read failed", rv); } APR_ASSERT_SUCCESS(tc, "close test directory", - apr_dir_close(dh)); + fspr_dir_close(dh)); } #define TESTSTR "Hello, world." static void test_append(abts_case *tc, void *data) { - apr_file_t *fh; - apr_finfo_t finfo; + fspr_file_t *fh; + fspr_finfo_t finfo; PRECOND; APR_ASSERT_SUCCESS(tc, "open 8Gb file for append", - apr_file_open(&fh, TESTFN, APR_WRITE | APR_APPEND, + fspr_file_open(&fh, TESTFN, APR_WRITE | APR_APPEND, APR_OS_DEFAULT, p)); APR_ASSERT_SUCCESS(tc, "append to 8Gb file", - apr_file_write_full(fh, TESTSTR, strlen(TESTSTR), NULL)); + fspr_file_write_full(fh, TESTSTR, strlen(TESTSTR), NULL)); APR_ASSERT_SUCCESS(tc, "file_info_get failed", - apr_file_info_get(&finfo, APR_FINFO_NORM, fh)); + fspr_file_info_get(&finfo, APR_FINFO_NORM, fh)); ABTS_ASSERT(tc, "file_info_get gave incorrect size", finfo.size == eightGb + strlen(TESTSTR)); - APR_ASSERT_SUCCESS(tc, "close 8Gb file", apr_file_close(fh)); + APR_ASSERT_SUCCESS(tc, "close 8Gb file", fspr_file_close(fh)); } static void test_seek(abts_case *tc, void *data) { - apr_file_t *fh; - apr_off_t pos; + fspr_file_t *fh; + fspr_off_t pos; PRECOND; APR_ASSERT_SUCCESS(tc, "open 8Gb file for writing", - apr_file_open(&fh, TESTFN, APR_WRITE, + fspr_file_open(&fh, TESTFN, APR_WRITE, APR_OS_DEFAULT, p)); pos = 0; APR_ASSERT_SUCCESS(tc, "relative seek to end", - apr_file_seek(fh, APR_END, &pos)); + fspr_file_seek(fh, APR_END, &pos)); ABTS_ASSERT(tc, "seek to END gave 8Gb", pos == eightGb); pos = eightGb; - APR_ASSERT_SUCCESS(tc, "seek to 8Gb", apr_file_seek(fh, APR_SET, &pos)); + APR_ASSERT_SUCCESS(tc, "seek to 8Gb", fspr_file_seek(fh, APR_SET, &pos)); ABTS_ASSERT(tc, "seek gave 8Gb offset", pos == eightGb); pos = 0; - APR_ASSERT_SUCCESS(tc, "relative seek to 0", apr_file_seek(fh, APR_CUR, &pos)); + APR_ASSERT_SUCCESS(tc, "relative seek to 0", fspr_file_seek(fh, APR_CUR, &pos)); ABTS_ASSERT(tc, "relative seek gave 8Gb offset", pos == eightGb); - apr_file_close(fh); + fspr_file_close(fh); } static void test_write(abts_case *tc, void *data) { - apr_file_t *fh; - apr_off_t pos = eightGb - 4; + fspr_file_t *fh; + fspr_off_t pos = eightGb - 4; PRECOND; APR_ASSERT_SUCCESS(tc, "re-open 8Gb file", - apr_file_open(&fh, TESTFN, APR_WRITE, APR_OS_DEFAULT, p)); + fspr_file_open(&fh, TESTFN, APR_WRITE, APR_OS_DEFAULT, p)); APR_ASSERT_SUCCESS(tc, "seek to 8Gb - 4", - apr_file_seek(fh, APR_SET, &pos)); + fspr_file_seek(fh, APR_SET, &pos)); ABTS_ASSERT(tc, "seek gave 8Gb-4 offset", pos == eightGb - 4); APR_ASSERT_SUCCESS(tc, "write magic string to 8Gb-4", - apr_file_write_full(fh, "FISH", 4, NULL)); + fspr_file_write_full(fh, "FISH", 4, NULL)); - APR_ASSERT_SUCCESS(tc, "close 8Gb file", apr_file_close(fh)); + APR_ASSERT_SUCCESS(tc, "close 8Gb file", fspr_file_close(fh)); } #if APR_HAS_MMAP static void test_mmap(abts_case *tc, void *data) { - apr_mmap_t *map; - apr_file_t *fh; - apr_size_t len = 16384; /* hopefully a multiple of the page size */ - apr_off_t off = eightGb - len; + fspr_mmap_t *map; + fspr_file_t *fh; + fspr_size_t len = 16384; /* hopefully a multiple of the page size */ + fspr_off_t off = eightGb - len; void *ptr; PRECOND; APR_ASSERT_SUCCESS(tc, "open 8gb file for mmap", - apr_file_open(&fh, TESTFN, APR_READ, APR_OS_DEFAULT, p)); + fspr_file_open(&fh, TESTFN, APR_READ, APR_OS_DEFAULT, p)); APR_ASSERT_SUCCESS(tc, "mmap 8Gb file", - apr_mmap_create(&map, fh, off, len, APR_MMAP_READ, p)); + fspr_mmap_create(&map, fh, off, len, APR_MMAP_READ, p)); - APR_ASSERT_SUCCESS(tc, "close file", apr_file_close(fh)); + APR_ASSERT_SUCCESS(tc, "close file", fspr_file_close(fh)); ABTS_ASSERT(tc, "mapped a 16K block", map->size == len); APR_ASSERT_SUCCESS(tc, "get pointer into mmaped region", - apr_mmap_offset(&ptr, map, len - 4)); + fspr_mmap_offset(&ptr, map, len - 4)); ABTS_ASSERT(tc, "pointer was not NULL", ptr != NULL); ABTS_ASSERT(tc, "found the magic string", memcmp(ptr, "FISH", 4) == 0); - APR_ASSERT_SUCCESS(tc, "delete mmap handle", apr_mmap_delete(map)); + APR_ASSERT_SUCCESS(tc, "delete mmap handle", fspr_mmap_delete(map)); } #endif /* APR_HAS_MMAP */ static void test_format(abts_case *tc, void *data) { - apr_off_t off; + fspr_off_t off; PRECOND; - off = apr_atoi64(apr_off_t_toa(p, eightGb)); + off = fspr_atoi64(fspr_off_t_toa(p, eightGb)); - ABTS_ASSERT(tc, "apr_atoi64 parsed apr_off_t_toa result incorrectly", + ABTS_ASSERT(tc, "fspr_atoi64 parsed fspr_off_t_toa result incorrectly", off == eightGb); } diff --git a/libs/apr/test/testlock.c b/libs/apr/test/testlock.c index dddb52f76a..51dfc5602c 100644 --- a/libs/apr/test/testlock.c +++ b/libs/apr/test/testlock.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_thread_mutex.h" -#include "apr_thread_rwlock.h" -#include "apr_thread_cond.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_getopt.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_thread_mutex.h" +#include "fspr_thread_rwlock.h" +#include "fspr_thread_cond.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_getopt.h" #include "testutil.h" #if APR_HAS_THREADS @@ -30,67 +30,67 @@ #define MAX_COUNTER 100000 #define MAX_RETRY 5 -static void *APR_THREAD_FUNC thread_rwlock_func(apr_thread_t *thd, void *data); -static void *APR_THREAD_FUNC thread_mutex_function(apr_thread_t *thd, void *data); -static void *APR_THREAD_FUNC thread_cond_producer(apr_thread_t *thd, void *data); -static void *APR_THREAD_FUNC thread_cond_consumer(apr_thread_t *thd, void *data); +static void *APR_THREAD_FUNC thread_rwlock_func(fspr_thread_t *thd, void *data); +static void *APR_THREAD_FUNC thread_mutex_function(fspr_thread_t *thd, void *data); +static void *APR_THREAD_FUNC thread_cond_producer(fspr_thread_t *thd, void *data); +static void *APR_THREAD_FUNC thread_cond_consumer(fspr_thread_t *thd, void *data); -static apr_thread_mutex_t *thread_mutex; -static apr_thread_rwlock_t *rwlock; +static fspr_thread_mutex_t *thread_mutex; +static fspr_thread_rwlock_t *rwlock; static int i = 0, x = 0; static int buff[MAX_COUNTER]; struct { - apr_thread_mutex_t *mutex; + fspr_thread_mutex_t *mutex; int nput; int nval; } put; struct { - apr_thread_mutex_t *mutex; - apr_thread_cond_t *cond; + fspr_thread_mutex_t *mutex; + fspr_thread_cond_t *cond; int nready; } nready; -static apr_thread_mutex_t *timeout_mutex; -static apr_thread_cond_t *timeout_cond; +static fspr_thread_mutex_t *timeout_mutex; +static fspr_thread_cond_t *timeout_cond; -static void *APR_THREAD_FUNC thread_rwlock_func(apr_thread_t *thd, void *data) +static void *APR_THREAD_FUNC thread_rwlock_func(fspr_thread_t *thd, void *data) { int exitLoop = 1; while (1) { - apr_thread_rwlock_rdlock(rwlock); + fspr_thread_rwlock_rdlock(rwlock); if (i == MAX_ITER) exitLoop = 0; - apr_thread_rwlock_unlock(rwlock); + fspr_thread_rwlock_unlock(rwlock); if (!exitLoop) break; - apr_thread_rwlock_wrlock(rwlock); + fspr_thread_rwlock_wrlock(rwlock); if (i != MAX_ITER) { i++; x++; } - apr_thread_rwlock_unlock(rwlock); + fspr_thread_rwlock_unlock(rwlock); } return NULL; } -static void *APR_THREAD_FUNC thread_mutex_function(apr_thread_t *thd, void *data) +static void *APR_THREAD_FUNC thread_mutex_function(fspr_thread_t *thd, void *data) { int exitLoop = 1; /* slight delay to allow things to settle */ - apr_sleep (1); + fspr_sleep (1); while (1) { - apr_thread_mutex_lock(thread_mutex); + fspr_thread_mutex_lock(thread_mutex); if (i == MAX_ITER) exitLoop = 0; else @@ -98,7 +98,7 @@ static void *APR_THREAD_FUNC thread_mutex_function(apr_thread_t *thd, void *data i++; x++; } - apr_thread_mutex_unlock(thread_mutex); + fspr_thread_mutex_unlock(thread_mutex); if (!exitLoop) break; @@ -106,24 +106,24 @@ static void *APR_THREAD_FUNC thread_mutex_function(apr_thread_t *thd, void *data return NULL; } -static void *APR_THREAD_FUNC thread_cond_producer(apr_thread_t *thd, void *data) +static void *APR_THREAD_FUNC thread_cond_producer(fspr_thread_t *thd, void *data) { for (;;) { - apr_thread_mutex_lock(put.mutex); + fspr_thread_mutex_lock(put.mutex); if (put.nput >= MAX_COUNTER) { - apr_thread_mutex_unlock(put.mutex); + fspr_thread_mutex_unlock(put.mutex); return NULL; } buff[put.nput] = put.nval; put.nput++; put.nval++; - apr_thread_mutex_unlock(put.mutex); + fspr_thread_mutex_unlock(put.mutex); - apr_thread_mutex_lock(nready.mutex); + fspr_thread_mutex_lock(nready.mutex); if (nready.nready == 0) - apr_thread_cond_signal(nready.cond); + fspr_thread_cond_signal(nready.cond); nready.nready++; - apr_thread_mutex_unlock(nready.mutex); + fspr_thread_mutex_unlock(nready.mutex); *((int *) data) += 1; } @@ -131,16 +131,16 @@ static void *APR_THREAD_FUNC thread_cond_producer(apr_thread_t *thd, void *data) return NULL; } -static void *APR_THREAD_FUNC thread_cond_consumer(apr_thread_t *thd, void *data) +static void *APR_THREAD_FUNC thread_cond_consumer(fspr_thread_t *thd, void *data) { int i; for (i = 0; i < MAX_COUNTER; i++) { - apr_thread_mutex_lock(nready.mutex); + fspr_thread_mutex_lock(nready.mutex); while (nready.nready == 0) - apr_thread_cond_wait(nready.cond, nready.mutex); + fspr_thread_cond_wait(nready.cond, nready.mutex); nready.nready--; - apr_thread_mutex_unlock(nready.mutex); + fspr_thread_mutex_unlock(nready.mutex); if (buff[i] != i) printf("buff[%d] = %d\n", i, buff[i]); @@ -151,39 +151,39 @@ static void *APR_THREAD_FUNC thread_cond_consumer(apr_thread_t *thd, void *data) static void test_thread_mutex(abts_case *tc, void *data) { - apr_thread_t *t1, *t2, *t3, *t4; - apr_status_t s1, s2, s3, s4; + fspr_thread_t *t1, *t2, *t3, *t4; + fspr_status_t s1, s2, s3, s4; - s1 = apr_thread_mutex_create(&thread_mutex, APR_THREAD_MUTEX_DEFAULT, p); + s1 = fspr_thread_mutex_create(&thread_mutex, APR_THREAD_MUTEX_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s1); ABTS_PTR_NOTNULL(tc, thread_mutex); i = 0; x = 0; - s1 = apr_thread_create(&t1, NULL, thread_mutex_function, NULL, p); + s1 = fspr_thread_create(&t1, NULL, thread_mutex_function, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s1); - s2 = apr_thread_create(&t2, NULL, thread_mutex_function, NULL, p); + s2 = fspr_thread_create(&t2, NULL, thread_mutex_function, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s2); - s3 = apr_thread_create(&t3, NULL, thread_mutex_function, NULL, p); + s3 = fspr_thread_create(&t3, NULL, thread_mutex_function, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s3); - s4 = apr_thread_create(&t4, NULL, thread_mutex_function, NULL, p); + s4 = fspr_thread_create(&t4, NULL, thread_mutex_function, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s4); - apr_thread_join(&s1, t1); - apr_thread_join(&s2, t2); - apr_thread_join(&s3, t3); - apr_thread_join(&s4, t4); + fspr_thread_join(&s1, t1); + fspr_thread_join(&s2, t2); + fspr_thread_join(&s3, t3); + fspr_thread_join(&s4, t4); ABTS_INT_EQUAL(tc, MAX_ITER, x); } static void test_thread_rwlock(abts_case *tc, void *data) { - apr_thread_t *t1, *t2, *t3, *t4; - apr_status_t s1, s2, s3, s4; + fspr_thread_t *t1, *t2, *t3, *t4; + fspr_status_t s1, s2, s3, s4; - s1 = apr_thread_rwlock_create(&rwlock, p); + s1 = fspr_thread_rwlock_create(&rwlock, p); if (s1 == APR_ENOTIMPL) { ABTS_NOT_IMPL(tc, "rwlocks not implemented"); return; @@ -194,44 +194,44 @@ static void test_thread_rwlock(abts_case *tc, void *data) i = 0; x = 0; - s1 = apr_thread_create(&t1, NULL, thread_rwlock_func, NULL, p); + s1 = fspr_thread_create(&t1, NULL, thread_rwlock_func, NULL, p); APR_ASSERT_SUCCESS(tc, "create thread 1", s1); - s2 = apr_thread_create(&t2, NULL, thread_rwlock_func, NULL, p); + s2 = fspr_thread_create(&t2, NULL, thread_rwlock_func, NULL, p); APR_ASSERT_SUCCESS(tc, "create thread 2", s2); - s3 = apr_thread_create(&t3, NULL, thread_rwlock_func, NULL, p); + s3 = fspr_thread_create(&t3, NULL, thread_rwlock_func, NULL, p); APR_ASSERT_SUCCESS(tc, "create thread 3", s3); - s4 = apr_thread_create(&t4, NULL, thread_rwlock_func, NULL, p); + s4 = fspr_thread_create(&t4, NULL, thread_rwlock_func, NULL, p); APR_ASSERT_SUCCESS(tc, "create thread 4", s4); - apr_thread_join(&s1, t1); - apr_thread_join(&s2, t2); - apr_thread_join(&s3, t3); - apr_thread_join(&s4, t4); + fspr_thread_join(&s1, t1); + fspr_thread_join(&s2, t2); + fspr_thread_join(&s3, t3); + fspr_thread_join(&s4, t4); ABTS_INT_EQUAL(tc, MAX_ITER, x); - apr_thread_rwlock_destroy(rwlock); + fspr_thread_rwlock_destroy(rwlock); } static void test_cond(abts_case *tc, void *data) { - apr_thread_t *p1, *p2, *p3, *p4, *c1; - apr_status_t s0, s1, s2, s3, s4; + fspr_thread_t *p1, *p2, *p3, *p4, *c1; + fspr_status_t s0, s1, s2, s3, s4; int count1, count2, count3, count4; int sum; APR_ASSERT_SUCCESS(tc, "create put mutex", - apr_thread_mutex_create(&put.mutex, + fspr_thread_mutex_create(&put.mutex, APR_THREAD_MUTEX_DEFAULT, p)); ABTS_PTR_NOTNULL(tc, put.mutex); APR_ASSERT_SUCCESS(tc, "create nready mutex", - apr_thread_mutex_create(&nready.mutex, + fspr_thread_mutex_create(&nready.mutex, APR_THREAD_MUTEX_DEFAULT, p)); ABTS_PTR_NOTNULL(tc, nready.mutex); APR_ASSERT_SUCCESS(tc, "create condvar", - apr_thread_cond_create(&nready.cond, p)); + fspr_thread_cond_create(&nready.cond, p)); ABTS_PTR_NOTNULL(tc, nready.cond); count1 = count2 = count3 = count4 = 0; @@ -240,25 +240,25 @@ static void test_cond(abts_case *tc, void *data) i = 0; x = 0; - s0 = apr_thread_create(&p1, NULL, thread_cond_producer, &count1, p); + s0 = fspr_thread_create(&p1, NULL, thread_cond_producer, &count1, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s0); - s1 = apr_thread_create(&p2, NULL, thread_cond_producer, &count2, p); + s1 = fspr_thread_create(&p2, NULL, thread_cond_producer, &count2, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s1); - s2 = apr_thread_create(&p3, NULL, thread_cond_producer, &count3, p); + s2 = fspr_thread_create(&p3, NULL, thread_cond_producer, &count3, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s2); - s3 = apr_thread_create(&p4, NULL, thread_cond_producer, &count4, p); + s3 = fspr_thread_create(&p4, NULL, thread_cond_producer, &count4, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s3); - s4 = apr_thread_create(&c1, NULL, thread_cond_consumer, NULL, p); + s4 = fspr_thread_create(&c1, NULL, thread_cond_consumer, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s4); - apr_thread_join(&s0, p1); - apr_thread_join(&s1, p2); - apr_thread_join(&s2, p3); - apr_thread_join(&s3, p4); - apr_thread_join(&s4, c1); + fspr_thread_join(&s0, p1); + fspr_thread_join(&s1, p2); + fspr_thread_join(&s2, p3); + fspr_thread_join(&s3, p4); + fspr_thread_join(&s4, c1); APR_ASSERT_SUCCESS(tc, "destroy condvar", - apr_thread_cond_destroy(nready.cond)); + fspr_thread_cond_destroy(nready.cond)); sum = count1 + count2 + count3 + count4; /* @@ -270,28 +270,28 @@ static void test_cond(abts_case *tc, void *data) static void test_timeoutcond(abts_case *tc, void *data) { - apr_status_t s; - apr_interval_time_t timeout; - apr_time_t begin, end; + fspr_status_t s; + fspr_interval_time_t timeout; + fspr_time_t begin, end; int i; - s = apr_thread_mutex_create(&timeout_mutex, APR_THREAD_MUTEX_DEFAULT, p); + s = fspr_thread_mutex_create(&timeout_mutex, APR_THREAD_MUTEX_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s); ABTS_PTR_NOTNULL(tc, timeout_mutex); - s = apr_thread_cond_create(&timeout_cond, p); + s = fspr_thread_cond_create(&timeout_cond, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, s); ABTS_PTR_NOTNULL(tc, timeout_cond); - timeout = apr_time_from_sec(5); + timeout = fspr_time_from_sec(5); for (i = 0; i < MAX_RETRY; i++) { - apr_thread_mutex_lock(timeout_mutex); + fspr_thread_mutex_lock(timeout_mutex); - begin = apr_time_now(); - s = apr_thread_cond_timedwait(timeout_cond, timeout_mutex, timeout); - end = apr_time_now(); - apr_thread_mutex_unlock(timeout_mutex); + begin = fspr_time_now(); + s = fspr_thread_cond_timedwait(timeout_cond, timeout_mutex, timeout); + end = fspr_time_now(); + fspr_thread_mutex_unlock(timeout_mutex); if (s != APR_SUCCESS && !APR_STATUS_IS_TIMEUP(s)) { continue; @@ -302,7 +302,7 @@ static void test_timeoutcond(abts_case *tc, void *data) } ABTS_ASSERT(tc, "Too many retries", i < MAX_RETRY); APR_ASSERT_SUCCESS(tc, "Unable to destroy the conditional", - apr_thread_cond_destroy(timeout_cond)); + fspr_thread_cond_destroy(timeout_cond)); } #endif /* !APR_HAS_THREADS */ diff --git a/libs/apr/test/testlockperf.c b/libs/apr/test/testlockperf.c index e0bf75ae83..afee9c3db6 100644 --- a/libs/apr/test/testlockperf.c +++ b/libs/apr/test/testlockperf.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_thread_proc.h" -#include "apr_thread_mutex.h" -#include "apr_thread_rwlock.h" -#include "apr_file_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_getopt.h" +#include "fspr_thread_proc.h" +#include "fspr_thread_mutex.h" +#include "fspr_thread_rwlock.h" +#include "fspr_file_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_getopt.h" #include "errno.h" #include #include @@ -40,66 +40,66 @@ int main(void) static long mutex_counter; -static apr_thread_mutex_t *thread_lock; -void * APR_THREAD_FUNC thread_mutex_func(apr_thread_t *thd, void *data); -apr_status_t test_thread_mutex(int num_threads); /* apr_thread_mutex_t */ +static fspr_thread_mutex_t *thread_lock; +void * APR_THREAD_FUNC thread_mutex_func(fspr_thread_t *thd, void *data); +fspr_status_t test_thread_mutex(int num_threads); /* fspr_thread_mutex_t */ -static apr_thread_rwlock_t *thread_rwlock; -void * APR_THREAD_FUNC thread_rwlock_func(apr_thread_t *thd, void *data); -apr_status_t test_thread_rwlock(int num_threads); /* apr_thread_rwlock_t */ +static fspr_thread_rwlock_t *thread_rwlock; +void * APR_THREAD_FUNC thread_rwlock_func(fspr_thread_t *thd, void *data); +fspr_status_t test_thread_rwlock(int num_threads); /* fspr_thread_rwlock_t */ int test_thread_mutex_nested(int num_threads); -apr_pool_t *pool; +fspr_pool_t *pool; int i = 0, x = 0; -void * APR_THREAD_FUNC thread_mutex_func(apr_thread_t *thd, void *data) +void * APR_THREAD_FUNC thread_mutex_func(fspr_thread_t *thd, void *data) { int i; for (i = 0; i < MAX_COUNTER; i++) { - apr_thread_mutex_lock(thread_lock); + fspr_thread_mutex_lock(thread_lock); mutex_counter++; - apr_thread_mutex_unlock(thread_lock); + fspr_thread_mutex_unlock(thread_lock); } return NULL; } -void * APR_THREAD_FUNC thread_rwlock_func(apr_thread_t *thd, void *data) +void * APR_THREAD_FUNC thread_rwlock_func(fspr_thread_t *thd, void *data) { int i; for (i = 0; i < MAX_COUNTER; i++) { - apr_thread_rwlock_wrlock(thread_rwlock); + fspr_thread_rwlock_wrlock(thread_rwlock); mutex_counter++; - apr_thread_rwlock_unlock(thread_rwlock); + fspr_thread_rwlock_unlock(thread_rwlock); } return NULL; } int test_thread_mutex(int num_threads) { - apr_thread_t *t[MAX_THREADS]; - apr_status_t s[MAX_THREADS]; - apr_time_t time_start, time_stop; + fspr_thread_t *t[MAX_THREADS]; + fspr_status_t s[MAX_THREADS]; + fspr_time_t time_start, time_stop; int i; mutex_counter = 0; - printf("apr_thread_mutex_t Tests\n"); - printf("%-60s", " Initializing the apr_thread_mutex_t (UNNESTED)"); - s[0] = apr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_UNNESTED, pool); + printf("fspr_thread_mutex_t Tests\n"); + printf("%-60s", " Initializing the fspr_thread_mutex_t (UNNESTED)"); + s[0] = fspr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_UNNESTED, pool); if (s[0] != APR_SUCCESS) { printf("Failed!\n"); return s[0]; } printf("OK\n"); - apr_thread_mutex_lock(thread_lock); + fspr_thread_mutex_lock(thread_lock); /* set_concurrency(4)? -aaron */ printf(" Starting %d threads ", num_threads); for (i = 0; i < num_threads; ++i) { - s[i] = apr_thread_create(&t[i], NULL, thread_mutex_func, NULL, pool); + s[i] = fspr_thread_create(&t[i], NULL, thread_mutex_func, NULL, pool); if (s[i] != APR_SUCCESS) { printf("Failed!\n"); return s[i]; @@ -107,16 +107,16 @@ int test_thread_mutex(int num_threads) } printf("OK\n"); - time_start = apr_time_now(); - apr_thread_mutex_unlock(thread_lock); + time_start = fspr_time_now(); + fspr_thread_mutex_unlock(thread_lock); /* printf("%-60s", " Waiting for threads to exit"); */ for (i = 0; i < num_threads; ++i) { - apr_thread_join(&s[i], t[i]); + fspr_thread_join(&s[i], t[i]); } /* printf("OK\n"); */ - time_stop = apr_time_now(); + time_stop = fspr_time_now(); printf("microseconds: %" APR_INT64_T_FMT " usec\n", (time_stop - time_start)); if (mutex_counter != MAX_COUNTER * num_threads) @@ -127,27 +127,27 @@ int test_thread_mutex(int num_threads) int test_thread_mutex_nested(int num_threads) { - apr_thread_t *t[MAX_THREADS]; - apr_status_t s[MAX_THREADS]; - apr_time_t time_start, time_stop; + fspr_thread_t *t[MAX_THREADS]; + fspr_status_t s[MAX_THREADS]; + fspr_time_t time_start, time_stop; int i; mutex_counter = 0; - printf("apr_thread_mutex_t Tests\n"); - printf("%-60s", " Initializing the apr_thread_mutex_t (NESTED)"); - s[0] = apr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_NESTED, pool); + printf("fspr_thread_mutex_t Tests\n"); + printf("%-60s", " Initializing the fspr_thread_mutex_t (NESTED)"); + s[0] = fspr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_NESTED, pool); if (s[0] != APR_SUCCESS) { printf("Failed!\n"); return s[0]; } printf("OK\n"); - apr_thread_mutex_lock(thread_lock); + fspr_thread_mutex_lock(thread_lock); /* set_concurrency(4)? -aaron */ printf(" Starting %d threads ", num_threads); for (i = 0; i < num_threads; ++i) { - s[i] = apr_thread_create(&t[i], NULL, thread_mutex_func, NULL, pool); + s[i] = fspr_thread_create(&t[i], NULL, thread_mutex_func, NULL, pool); if (s[i] != APR_SUCCESS) { printf("Failed!\n"); return s[i]; @@ -155,16 +155,16 @@ int test_thread_mutex_nested(int num_threads) } printf("OK\n"); - time_start = apr_time_now(); - apr_thread_mutex_unlock(thread_lock); + time_start = fspr_time_now(); + fspr_thread_mutex_unlock(thread_lock); /* printf("%-60s", " Waiting for threads to exit"); */ for (i = 0; i < num_threads; ++i) { - apr_thread_join(&s[i], t[i]); + fspr_thread_join(&s[i], t[i]); } /* printf("OK\n"); */ - time_stop = apr_time_now(); + time_stop = fspr_time_now(); printf("microseconds: %" APR_INT64_T_FMT " usec\n", (time_stop - time_start)); if (mutex_counter != MAX_COUNTER * num_threads) @@ -175,27 +175,27 @@ int test_thread_mutex_nested(int num_threads) int test_thread_rwlock(int num_threads) { - apr_thread_t *t[MAX_THREADS]; - apr_status_t s[MAX_THREADS]; - apr_time_t time_start, time_stop; + fspr_thread_t *t[MAX_THREADS]; + fspr_status_t s[MAX_THREADS]; + fspr_time_t time_start, time_stop; int i; mutex_counter = 0; - printf("apr_thread_rwlock_t Tests\n"); - printf("%-60s", " Initializing the apr_thread_rwlock_t"); - s[0] = apr_thread_rwlock_create(&thread_rwlock, pool); + printf("fspr_thread_rwlock_t Tests\n"); + printf("%-60s", " Initializing the fspr_thread_rwlock_t"); + s[0] = fspr_thread_rwlock_create(&thread_rwlock, pool); if (s[0] != APR_SUCCESS) { printf("Failed!\n"); return s[0]; } printf("OK\n"); - apr_thread_rwlock_wrlock(thread_rwlock); + fspr_thread_rwlock_wrlock(thread_rwlock); /* set_concurrency(4)? -aaron */ printf(" Starting %d threads ", num_threads); for (i = 0; i < num_threads; ++i) { - s[i] = apr_thread_create(&t[i], NULL, thread_rwlock_func, NULL, pool); + s[i] = fspr_thread_create(&t[i], NULL, thread_rwlock_func, NULL, pool); if (s[i] != APR_SUCCESS) { printf("Failed!\n"); return s[i]; @@ -203,16 +203,16 @@ int test_thread_rwlock(int num_threads) } printf("OK\n"); - time_start = apr_time_now(); - apr_thread_rwlock_unlock(thread_rwlock); + time_start = fspr_time_now(); + fspr_thread_rwlock_unlock(thread_rwlock); /* printf("%-60s", " Waiting for threads to exit"); */ for (i = 0; i < num_threads; ++i) { - apr_thread_join(&s[i], t[i]); + fspr_thread_join(&s[i], t[i]); } /* printf("OK\n"); */ - time_stop = apr_time_now(); + time_stop = fspr_time_now(); printf("microseconds: %" APR_INT64_T_FMT " usec\n", (time_stop - time_start)); if (mutex_counter != MAX_COUNTER * num_threads) @@ -223,28 +223,28 @@ int test_thread_rwlock(int num_threads) int main(int argc, const char * const *argv) { - apr_status_t rv; + fspr_status_t rv; char errmsg[200]; const char *lockname = "multi.lock"; - apr_getopt_t *opt; + fspr_getopt_t *opt; char optchar; const char *optarg; printf("APR Lock Performance Test\n==============\n\n"); - apr_initialize(); - atexit(apr_terminate); + fspr_initialize(); + atexit(fspr_terminate); - if (apr_pool_create(&pool, NULL) != APR_SUCCESS) + if (fspr_pool_create(&pool, NULL) != APR_SUCCESS) exit(-1); - if ((rv = apr_getopt_init(&opt, pool, argc, argv)) != APR_SUCCESS) { + if ((rv = fspr_getopt_init(&opt, pool, argc, argv)) != APR_SUCCESS) { fprintf(stderr, "Could not set up to parse options: [%d] %s\n", - rv, apr_strerror(rv, errmsg, sizeof errmsg)); + rv, fspr_strerror(rv, errmsg, sizeof errmsg)); exit(-1); } - while ((rv = apr_getopt(opt, "f:", &optchar, &optarg)) == APR_SUCCESS) { + while ((rv = fspr_getopt(opt, "f:", &optchar, &optarg)) == APR_SUCCESS) { if (optchar == 'f') { lockname = optarg; } @@ -252,26 +252,26 @@ int main(int argc, const char * const *argv) if (rv != APR_SUCCESS && rv != APR_EOF) { fprintf(stderr, "Could not parse options: [%d] %s\n", - rv, apr_strerror(rv, errmsg, sizeof errmsg)); + rv, fspr_strerror(rv, errmsg, sizeof errmsg)); exit(-1); } for (i = 1; i <= MAX_THREADS; ++i) { if ((rv = test_thread_mutex(i)) != APR_SUCCESS) { fprintf(stderr,"thread_mutex test failed : [%d] %s\n", - rv, apr_strerror(rv, (char*)errmsg, 200)); + rv, fspr_strerror(rv, (char*)errmsg, 200)); exit(-3); } if ((rv = test_thread_mutex_nested(i)) != APR_SUCCESS) { fprintf(stderr,"thread_mutex (NESTED) test failed : [%d] %s\n", - rv, apr_strerror(rv, (char*)errmsg, 200)); + rv, fspr_strerror(rv, (char*)errmsg, 200)); exit(-4); } if ((rv = test_thread_rwlock(i)) != APR_SUCCESS) { fprintf(stderr,"thread_rwlock test failed : [%d] %s\n", - rv, apr_strerror(rv, (char*)errmsg, 200)); + rv, fspr_strerror(rv, (char*)errmsg, 200)); exit(-6); } } diff --git a/libs/apr/test/testmmap.c b/libs/apr/test/testmmap.c index 61b7481e5a..1e42d5e073 100644 --- a/libs/apr/test/testmmap.c +++ b/libs/apr/test/testmmap.c @@ -15,12 +15,12 @@ */ #include "testutil.h" -#include "apr_mmap.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_file_io.h" -#include "apr_strings.h" +#include "fspr_mmap.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_file_io.h" +#include "fspr_strings.h" /* hmmm, what is a truly portable define for the max path * length on a platform? @@ -36,17 +36,17 @@ static void not_implemented(abts_case *tc, void *data) #else -static apr_mmap_t *themmap = NULL; -static apr_file_t *thefile = NULL; +static fspr_mmap_t *themmap = NULL; +static fspr_file_t *thefile = NULL; static char *file1; -static apr_finfo_t finfo; +static fspr_finfo_t finfo; static int fsize; static void create_filename(abts_case *tc, void *data) { char *oldfileptr; - apr_filepath_get(&file1, 0, p); + fspr_filepath_get(&file1, 0, p); #ifndef NETWARE #ifdef WIN32 ABTS_TRUE(tc, file1[1] == ':'); @@ -57,41 +57,41 @@ static void create_filename(abts_case *tc, void *data) ABTS_TRUE(tc, file1[strlen(file1) - 1] != '/'); oldfileptr = file1; - file1 = apr_pstrcat(p, file1,"/data/mmap_datafile.txt" ,NULL); + file1 = fspr_pstrcat(p, file1,"/data/mmap_datafile.txt" ,NULL); ABTS_TRUE(tc, oldfileptr != file1); } static void test_file_close(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_file_close(thefile); + rv = fspr_file_close(thefile); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); } static void test_file_open(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_file_open(&thefile, file1, APR_READ, APR_UREAD | APR_GREAD, p); + rv = fspr_file_open(&thefile, file1, APR_READ, APR_UREAD | APR_GREAD, p); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); ABTS_PTR_NOTNULL(tc, thefile); } static void test_get_filesize(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_file_info_get(&finfo, APR_FINFO_NORM, thefile); + rv = fspr_file_info_get(&finfo, APR_FINFO_NORM, thefile); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); ABTS_ASSERT(tc, "File size mismatch", fsize == finfo.size); } static void test_mmap_create(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_mmap_create(&themmap, thefile, 0, (apr_size_t) finfo.size, + rv = fspr_mmap_create(&themmap, thefile, 0, (fspr_size_t) finfo.size, APR_MMAP_READ, p); ABTS_PTR_NOTNULL(tc, themmap); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); @@ -110,20 +110,20 @@ static void test_mmap_contents(abts_case *tc, void *data) static void test_mmap_delete(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; ABTS_PTR_NOTNULL(tc, themmap); - rv = apr_mmap_delete(themmap); + rv = fspr_mmap_delete(themmap); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); } static void test_mmap_offset(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; void *addr; ABTS_PTR_NOTNULL(tc, themmap); - rv = apr_mmap_offset(&addr, themmap, 5); + rv = fspr_mmap_offset(&addr, themmap, 5); /* Must use nEquals since the string is not guaranteed to be NULL terminated */ ABTS_STR_NEQUAL(tc, addr, TEST_STRING + 5, fsize-5); diff --git a/libs/apr/test/testmutexscope.c b/libs/apr/test/testmutexscope.c index 0ea08cc634..0d8cb30d6c 100644 --- a/libs/apr/test/testmutexscope.c +++ b/libs/apr/test/testmutexscope.c @@ -19,11 +19,11 @@ #include #include -#include "apr.h" -#include "apr_general.h" -#include "apr_proc_mutex.h" -#include "apr_global_mutex.h" -#include "apr_thread_proc.h" +#include "fspr.h" +#include "fspr_general.h" +#include "fspr_proc_mutex.h" +#include "fspr_global_mutex.h" +#include "fspr_thread_proc.h" #if !APR_HAS_THREADS int main(void) @@ -34,23 +34,23 @@ int main(void) #else /* APR_HAS_THREADS */ -static apr_thread_mutex_t *thread_mutex; -static apr_proc_mutex_t *proc_mutex; -static apr_global_mutex_t *global_mutex; -static apr_pool_t *p; +static fspr_thread_mutex_t *thread_mutex; +static fspr_proc_mutex_t *proc_mutex; +static fspr_global_mutex_t *global_mutex; +static fspr_pool_t *p; static volatile int counter; typedef enum {TEST_GLOBAL, TEST_PROC} test_mode_e; -static void lock_init(apr_lockmech_e mech, test_mode_e test_mode) +static void lock_init(fspr_lockmech_e mech, test_mode_e test_mode) { if (test_mode == TEST_PROC) { - assert(apr_proc_mutex_create(&proc_mutex, + assert(fspr_proc_mutex_create(&proc_mutex, NULL, mech, p) == APR_SUCCESS); } else { - assert(apr_global_mutex_create(&global_mutex, + assert(fspr_global_mutex_create(&global_mutex, NULL, mech, p) == APR_SUCCESS); @@ -60,62 +60,62 @@ static void lock_init(apr_lockmech_e mech, test_mode_e test_mode) static void lock_destroy(test_mode_e test_mode) { if (test_mode == TEST_PROC) { - assert(apr_proc_mutex_destroy(proc_mutex) == APR_SUCCESS); + assert(fspr_proc_mutex_destroy(proc_mutex) == APR_SUCCESS); } else { - assert(apr_global_mutex_destroy(global_mutex) == APR_SUCCESS); + assert(fspr_global_mutex_destroy(global_mutex) == APR_SUCCESS); } } static void lock_grab(test_mode_e test_mode) { if (test_mode == TEST_PROC) { - assert(apr_proc_mutex_lock(proc_mutex) == APR_SUCCESS); + assert(fspr_proc_mutex_lock(proc_mutex) == APR_SUCCESS); } else { - assert(apr_global_mutex_lock(global_mutex) == APR_SUCCESS); + assert(fspr_global_mutex_lock(global_mutex) == APR_SUCCESS); } } static void lock_release(test_mode_e test_mode) { if (test_mode == TEST_PROC) { - assert(apr_proc_mutex_unlock(proc_mutex) == APR_SUCCESS); + assert(fspr_proc_mutex_unlock(proc_mutex) == APR_SUCCESS); } else { - assert(apr_global_mutex_unlock(global_mutex) == APR_SUCCESS); + assert(fspr_global_mutex_unlock(global_mutex) == APR_SUCCESS); } } -static void * APR_THREAD_FUNC eachThread(apr_thread_t *id, void *p) +static void * APR_THREAD_FUNC eachThread(fspr_thread_t *id, void *p) { test_mode_e test_mode = (test_mode_e)p; lock_grab(test_mode); ++counter; - assert(apr_thread_mutex_lock(thread_mutex) == APR_SUCCESS); - assert(apr_thread_mutex_unlock(thread_mutex) == APR_SUCCESS); + assert(fspr_thread_mutex_lock(thread_mutex) == APR_SUCCESS); + assert(fspr_thread_mutex_unlock(thread_mutex) == APR_SUCCESS); lock_release(test_mode); return NULL; } -static void test_mech_mode(apr_lockmech_e mech, const char *mech_name, +static void test_mech_mode(fspr_lockmech_e mech, const char *mech_name, test_mode_e test_mode) { - apr_thread_t *threads[20]; + fspr_thread_t *threads[20]; int numThreads = 5; int i; - apr_status_t rv; + fspr_status_t rv; printf("Trying %s mutexes with mechanism `%s'...\n", test_mode == TEST_GLOBAL ? "global" : "proc", mech_name); assert(numThreads <= sizeof(threads) / sizeof(threads[0])); - assert(apr_pool_create(&p, NULL) == APR_SUCCESS); + assert(fspr_pool_create(&p, NULL) == APR_SUCCESS); - assert(apr_thread_mutex_create(&thread_mutex, 0, p) == APR_SUCCESS); - assert(apr_thread_mutex_lock(thread_mutex) == APR_SUCCESS); + assert(fspr_thread_mutex_create(&thread_mutex, 0, p) == APR_SUCCESS); + assert(fspr_thread_mutex_lock(thread_mutex) == APR_SUCCESS); lock_init(mech, test_mode); @@ -124,19 +124,19 @@ static void test_mech_mode(apr_lockmech_e mech, const char *mech_name, i = 0; while (i < numThreads) { - rv = apr_thread_create(&threads[i], + rv = fspr_thread_create(&threads[i], NULL, eachThread, (void *)test_mode, p); if (rv != APR_SUCCESS) { - fprintf(stderr, "apr_thread_create->%d\n", rv); + fprintf(stderr, "fspr_thread_create->%d\n", rv); exit(1); } ++i; } - apr_sleep(apr_time_from_sec(5)); + fspr_sleep(fspr_time_from_sec(5)); if (test_mode == TEST_PROC) { printf(" Mutex mechanism `%s' is %sglobal in scope on this platform.\n", @@ -144,7 +144,7 @@ static void test_mech_mode(apr_lockmech_e mech, const char *mech_name, } else { if (counter != 1) { - fprintf(stderr, "\n!!!apr_global_mutex operations are broken on this " + fprintf(stderr, "\n!!!fspr_global_mutex operations are broken on this " "platform for mutex mechanism `%s'!\n" "They don't block out threads within the same process.\n", mech_name); @@ -156,25 +156,25 @@ static void test_mech_mode(apr_lockmech_e mech, const char *mech_name, } } - assert(apr_thread_mutex_unlock(thread_mutex) == APR_SUCCESS); + assert(fspr_thread_mutex_unlock(thread_mutex) == APR_SUCCESS); i = 0; while (i < numThreads) { - apr_status_t ignored; + fspr_status_t ignored; - rv = apr_thread_join(&ignored, + rv = fspr_thread_join(&ignored, threads[i]); assert(rv == APR_SUCCESS); ++i; } lock_destroy(test_mode); - apr_thread_mutex_destroy(thread_mutex); - apr_pool_destroy(p); + fspr_thread_mutex_destroy(thread_mutex); + fspr_pool_destroy(p); } -static void test_mech(apr_lockmech_e mech, const char *mech_name) +static void test_mech(fspr_lockmech_e mech, const char *mech_name) { test_mech_mode(mech, mech_name, TEST_PROC); test_mech_mode(mech, mech_name, TEST_GLOBAL); @@ -183,7 +183,7 @@ static void test_mech(apr_lockmech_e mech, const char *mech_name) int main(void) { struct { - apr_lockmech_e mech; + fspr_lockmech_e mech; const char *mech_name; } lockmechs[] = { {APR_LOCK_DEFAULT, "default"} @@ -205,13 +205,13 @@ int main(void) }; int i; - assert(apr_initialize() == APR_SUCCESS); + assert(fspr_initialize() == APR_SUCCESS); for (i = 0; i < sizeof(lockmechs) / sizeof(lockmechs[0]); i++) { test_mech(lockmechs[i].mech, lockmechs[i].mech_name); } - apr_terminate(); + fspr_terminate(); return 0; } diff --git a/libs/apr/test/testnames.c b/libs/apr/test/testnames.c index fca79f3ee8..e35e4d7bf4 100644 --- a/libs/apr/test/testnames.c +++ b/libs/apr/test/testnames.c @@ -15,12 +15,12 @@ */ #include "testutil.h" -#include "apr_file_io.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_lib.h" +#include "fspr_file_io.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_lib.h" #if WIN32 #define ABS_ROOT "C:/" @@ -32,13 +32,13 @@ static void merge_aboveroot(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; char errmsg[256]; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo", ABS_ROOT"bar", APR_FILEPATH_NOTABOVEROOT, + rv = fspr_filepath_merge(&dstpath, ABS_ROOT"foo", ABS_ROOT"bar", APR_FILEPATH_NOTABOVEROOT, p); - apr_strerror(rv, errmsg, sizeof(errmsg)); + fspr_strerror(rv, errmsg, sizeof(errmsg)); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EABOVEROOT(rv)); ABTS_PTR_EQUAL(tc, NULL, dstpath); ABTS_STR_EQUAL(tc, "The given path was above the root path", errmsg); @@ -46,10 +46,10 @@ static void merge_aboveroot(abts_case *tc, void *data) static void merge_belowroot(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo", ABS_ROOT"foo/bar", + rv = fspr_filepath_merge(&dstpath, ABS_ROOT"foo", ABS_ROOT"foo/bar", APR_FILEPATH_NOTABOVEROOT, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -58,10 +58,10 @@ static void merge_belowroot(abts_case *tc, void *data) static void merge_noflag(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo", ABS_ROOT"foo/bar", 0, p); + rv = fspr_filepath_merge(&dstpath, ABS_ROOT"foo", ABS_ROOT"foo/bar", 0, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, ABS_ROOT"foo/bar", dstpath); @@ -69,15 +69,15 @@ static void merge_noflag(abts_case *tc, void *data) static void merge_dotdot(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", 0, p); + rv = fspr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", 0, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, ABS_ROOT"foo/baz", dstpath); - rv = apr_filepath_merge(&dstpath, "", "../test", 0, p); + rv = fspr_filepath_merge(&dstpath, "", "../test", 0, p); ABTS_INT_EQUAL(tc, 0, APR_SUCCESS); ABTS_STR_EQUAL(tc, "../test", dstpath); @@ -86,23 +86,23 @@ static void merge_dotdot(abts_case *tc, void *data) * return ../test unless a previously fixed bug remains or the developer changes * the case of the test directory: */ - rv = apr_filepath_merge(&dstpath, "", "../test", APR_FILEPATH_TRUENAME, p); + rv = fspr_filepath_merge(&dstpath, "", "../test", APR_FILEPATH_TRUENAME, p); ABTS_INT_EQUAL(tc, 0, APR_SUCCESS); ABTS_STR_EQUAL(tc, "../test", dstpath); } static void merge_dotdot_dotdot_dotdot(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, "", + rv = fspr_filepath_merge(&dstpath, "", "../../..", APR_FILEPATH_TRUENAME, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, "../../..", dstpath); - rv = apr_filepath_merge(&dstpath, "", + rv = fspr_filepath_merge(&dstpath, "", "../../../", APR_FILEPATH_TRUENAME, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -111,10 +111,10 @@ static void merge_dotdot_dotdot_dotdot(abts_case *tc, void *data) static void merge_secure(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../bar/baz", 0, p); + rv = fspr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../bar/baz", 0, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, ABS_ROOT"foo/bar/baz", dstpath); @@ -122,10 +122,10 @@ static void merge_secure(abts_case *tc, void *data) static void merge_notrel(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", + rv = fspr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", APR_FILEPATH_NOTRELATIVE, p); ABTS_PTR_NOTNULL(tc, dstpath); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -134,13 +134,13 @@ static void merge_notrel(abts_case *tc, void *data) static void merge_notrelfail(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; char errmsg[256]; - rv = apr_filepath_merge(&dstpath, "foo/bar", "../baz", + rv = fspr_filepath_merge(&dstpath, "foo/bar", "../baz", APR_FILEPATH_NOTRELATIVE, p); - apr_strerror(rv, errmsg, sizeof(errmsg)); + fspr_strerror(rv, errmsg, sizeof(errmsg)); ABTS_PTR_EQUAL(tc, NULL, dstpath); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ERELATIVE(rv)); @@ -149,13 +149,13 @@ static void merge_notrelfail(abts_case *tc, void *data) static void merge_notabsfail(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; char errmsg[256]; - rv = apr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", + rv = fspr_filepath_merge(&dstpath, ABS_ROOT"foo/bar", "../baz", APR_FILEPATH_NOTABSOLUTE, p); - apr_strerror(rv, errmsg, sizeof(errmsg)); + fspr_strerror(rv, errmsg, sizeof(errmsg)); ABTS_PTR_EQUAL(tc, NULL, dstpath); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EABSOLUTE(rv)); @@ -164,10 +164,10 @@ static void merge_notabsfail(abts_case *tc, void *data) static void merge_notabs(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *dstpath = NULL; - rv = apr_filepath_merge(&dstpath, "foo/bar", "../baz", + rv = fspr_filepath_merge(&dstpath, "foo/bar", "../baz", APR_FILEPATH_NOTABSOLUTE, p); ABTS_PTR_NOTNULL(tc, dstpath); @@ -177,11 +177,11 @@ static void merge_notabs(abts_case *tc, void *data) static void root_absolute(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; const char *root = NULL; const char *path = ABS_ROOT"foo/bar"; - rv = apr_filepath_root(&root, &path, 0, p); + rv = fspr_filepath_root(&root, &path, 0, p); ABTS_PTR_NOTNULL(tc, root); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -190,13 +190,13 @@ static void root_absolute(abts_case *tc, void *data) static void root_relative(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; const char *root = NULL; const char *path = "foo/bar"; char errmsg[256]; - rv = apr_filepath_root(&root, &path, 0, p); - apr_strerror(rv, errmsg, sizeof(errmsg)); + rv = fspr_filepath_root(&root, &path, 0, p); + fspr_strerror(rv, errmsg, sizeof(errmsg)); ABTS_PTR_EQUAL(tc, NULL, root); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_ERELATIVE(rv)); @@ -205,11 +205,11 @@ static void root_relative(abts_case *tc, void *data) static void root_from_slash(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; const char *root = NULL; const char *path = "//"; - rv = apr_filepath_root(&root, &path, APR_FILEPATH_TRUENAME, p); + rv = fspr_filepath_root(&root, &path, APR_FILEPATH_TRUENAME, p); #if defined(WIN32) || defined(OS2) ABTS_INT_EQUAL(tc, APR_EINCOMPLETE, rv); @@ -223,15 +223,15 @@ static void root_from_slash(abts_case *tc, void *data) static void root_from_cwd_and_back(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; const char *root = NULL; const char *path = "//"; char *origpath; char *testpath; - ABTS_INT_EQUAL(tc, APR_SUCCESS, apr_filepath_get(&origpath, 0, p)); + ABTS_INT_EQUAL(tc, APR_SUCCESS, fspr_filepath_get(&origpath, 0, p)); path = origpath; - rv = apr_filepath_root(&root, &path, APR_FILEPATH_TRUENAME, p); + rv = fspr_filepath_root(&root, &path, APR_FILEPATH_TRUENAME, p); #if defined(WIN32) || defined(OS2) ABTS_INT_EQUAL(tc, origpath[0], root[0]); @@ -257,7 +257,7 @@ static void root_from_cwd_and_back(abts_case *tc, void *data) ABTS_STR_EQUAL(tc, origpath + 1, path); #endif - rv = apr_filepath_merge(&testpath, root, path, + rv = fspr_filepath_merge(&testpath, root, path, APR_FILEPATH_TRUENAME | APR_FILEPATH_NOTABOVEROOT | APR_FILEPATH_NOTRELATIVE, p); diff --git a/libs/apr/test/testoc.c b/libs/apr/test/testoc.c index 9dbaff8c37..c067f78f83 100644 --- a/libs/apr/test/testoc.c +++ b/libs/apr/test/testoc.c @@ -15,11 +15,11 @@ */ #include "testutil.h" -#include "apr_thread_proc.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_thread_proc.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #if APR_HAS_OTHER_CHILD @@ -29,19 +29,19 @@ static void ocmaint(int reason, void *data, int status) { switch (reason) { case APR_OC_REASON_DEATH: - apr_cpystrn(reasonstr, "APR_OC_REASON_DEATH", + fspr_cpystrn(reasonstr, "APR_OC_REASON_DEATH", strlen("APR_OC_REASON_DEATH") + 1); break; case APR_OC_REASON_LOST: - apr_cpystrn(reasonstr, "APR_OC_REASON_LOST", + fspr_cpystrn(reasonstr, "APR_OC_REASON_LOST", strlen("APR_OC_REASON_LOST") + 1); break; case APR_OC_REASON_UNWRITABLE: - apr_cpystrn(reasonstr, "APR_OC_REASON_UNWRITEABLE", + fspr_cpystrn(reasonstr, "APR_OC_REASON_UNWRITEABLE", strlen("APR_OC_REASON_UNWRITEABLE") + 1); break; case APR_OC_REASON_RESTART: - apr_cpystrn(reasonstr, "APR_OC_REASON_RESTART", + fspr_cpystrn(reasonstr, "APR_OC_REASON_RESTART", strlen("APR_OC_REASON_RESTART") + 1); break; } @@ -56,24 +56,24 @@ static void ocmaint(int reason, void *data, int status) */ static void test_child_kill(abts_case *tc, void *data) { - apr_file_t *std = NULL; - apr_proc_t newproc; - apr_procattr_t *procattr = NULL; + fspr_file_t *std = NULL; + fspr_proc_t newproc; + fspr_procattr_t *procattr = NULL; const char *args[3]; - apr_status_t rv; + fspr_status_t rv; - args[0] = apr_pstrdup(p, "occhild" EXTENSION); - args[1] = apr_pstrdup(p, "-X"); + args[0] = fspr_pstrdup(p, "occhild" EXTENSION); + args[1] = fspr_pstrdup(p, "-X"); args[2] = NULL; - rv = apr_procattr_create(&procattr, p); + rv = fspr_procattr_create(&procattr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_NO_PIPE, + rv = fspr_procattr_io_set(procattr, APR_FULL_BLOCK, APR_NO_PIPE, APR_NO_PIPE); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_proc_create(&newproc, "./occhild" EXTENSION, args, NULL, procattr, p); + rv = fspr_proc_create(&newproc, "./occhild" EXTENSION, args, NULL, procattr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, newproc.in); ABTS_PTR_EQUAL(tc, NULL, newproc.out); @@ -81,16 +81,16 @@ static void test_child_kill(abts_case *tc, void *data) std = newproc.in; - apr_proc_other_child_register(&newproc, ocmaint, NULL, std, p); + fspr_proc_other_child_register(&newproc, ocmaint, NULL, std, p); - apr_sleep(apr_time_from_sec(1)); - rv = apr_proc_kill(&newproc, SIGKILL); + fspr_sleep(fspr_time_from_sec(1)); + rv = fspr_proc_kill(&newproc, SIGKILL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* allow time for things to settle... */ - apr_sleep(apr_time_from_sec(3)); + fspr_sleep(fspr_time_from_sec(3)); - apr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); + fspr_proc_other_child_refresh_all(APR_OC_REASON_RUNNING); ABTS_STR_EQUAL(tc, "APR_OC_REASON_DEATH", reasonstr); } #else diff --git a/libs/apr/test/testpath.c b/libs/apr/test/testpath.c index b05ae9917e..6de85b8400 100644 --- a/libs/apr/test/testpath.c +++ b/libs/apr/test/testpath.c @@ -15,10 +15,10 @@ */ #include "testutil.h" -#include "apr_file_info.h" -#include "apr_errno.h" -#include "apr_pools.h" -#include "apr_tables.h" +#include "fspr_file_info.h" +#include "fspr_errno.h" +#include "fspr_pools.h" +#include "fspr_tables.h" #if defined(WIN32) || defined(NETWARE) || defined(OS2) #define PSEP ";" @@ -46,11 +46,11 @@ static const int parts_out_count = sizeof(parts_out)/sizeof(*parts_out); static void list_split_multi(abts_case *tc, void *data) { int i; - apr_status_t rv; - apr_array_header_t *pathelts; + fspr_status_t rv; + fspr_array_header_t *pathelts; pathelts = NULL; - rv = apr_filepath_list_split(&pathelts, path_in, p); + rv = fspr_filepath_list_split(&pathelts, path_in, p); ABTS_PTR_NOTNULL(tc, pathelts); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, parts_out_count, pathelts->nelts); @@ -61,13 +61,13 @@ static void list_split_multi(abts_case *tc, void *data) static void list_split_single(abts_case *tc, void *data) { int i; - apr_status_t rv; - apr_array_header_t *pathelts; + fspr_status_t rv; + fspr_array_header_t *pathelts; for (i = 0; i < parts_in_count; ++i) { pathelts = NULL; - rv = apr_filepath_list_split(&pathelts, parts_in[i], p); + rv = fspr_filepath_list_split(&pathelts, parts_in[i], p); ABTS_PTR_NOTNULL(tc, pathelts); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); if (parts_in[i][0] == '\0') @@ -84,15 +84,15 @@ static void list_merge_multi(abts_case *tc, void *data) { int i; char *liststr; - apr_status_t rv; - apr_array_header_t *pathelts; + fspr_status_t rv; + fspr_array_header_t *pathelts; - pathelts = apr_array_make(p, parts_in_count, sizeof(const char*)); + pathelts = fspr_array_make(p, parts_in_count, sizeof(const char*)); for (i = 0; i < parts_in_count; ++i) - *(const char**)apr_array_push(pathelts) = parts_in[i]; + *(const char**)fspr_array_push(pathelts) = parts_in[i]; liststr = NULL; - rv = apr_filepath_list_merge(&liststr, pathelts, p); + rv = fspr_filepath_list_merge(&liststr, pathelts, p); ABTS_PTR_NOTNULL(tc, liststr); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, liststr, path_out); @@ -102,16 +102,16 @@ static void list_merge_single(abts_case *tc, void *data) { int i; char *liststr; - apr_status_t rv; - apr_array_header_t *pathelts; + fspr_status_t rv; + fspr_array_header_t *pathelts; - pathelts = apr_array_make(p, 1, sizeof(const char*)); - apr_array_push(pathelts); + pathelts = fspr_array_make(p, 1, sizeof(const char*)); + fspr_array_push(pathelts); for (i = 0; i < parts_in_count; ++i) { *(const char**)pathelts->elts = parts_in[i]; liststr = NULL; - rv = apr_filepath_list_merge(&liststr, pathelts, p); + rv = fspr_filepath_list_merge(&liststr, pathelts, p); if (parts_in[i][0] == '\0') ABTS_PTR_EQUAL(tc, NULL, liststr); else diff --git a/libs/apr/test/testpipe.c b/libs/apr/test/testpipe.c index db3c77ffc3..add6c384a7 100644 --- a/libs/apr/test/testpipe.c +++ b/libs/apr/test/testpipe.c @@ -17,21 +17,21 @@ #include #include "testutil.h" -#include "apr_file_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_thread_proc.h" -#include "apr_strings.h" +#include "fspr_file_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_thread_proc.h" +#include "fspr_strings.h" -static apr_file_t *readp = NULL; -static apr_file_t *writep = NULL; +static fspr_file_t *readp = NULL; +static fspr_file_t *writep = NULL; static void create_pipe(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_file_pipe_create(&readp, &writep, p); + rv = fspr_file_pipe_create(&readp, &writep, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, readp); ABTS_PTR_NOTNULL(tc, writep); @@ -39,60 +39,60 @@ static void create_pipe(abts_case *tc, void *data) static void close_pipe(abts_case *tc, void *data) { - apr_status_t rv; - apr_size_t nbytes = 256; + fspr_status_t rv; + fspr_size_t nbytes = 256; char buf[256]; - rv = apr_file_close(readp); - rv = apr_file_close(writep); + rv = fspr_file_close(readp); + rv = fspr_file_close(writep); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_read(readp, buf, &nbytes); + rv = fspr_file_read(readp, buf, &nbytes); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_EBADF(rv)); } static void set_timeout(abts_case *tc, void *data) { - apr_status_t rv; - apr_interval_time_t timeout; + fspr_status_t rv; + fspr_interval_time_t timeout; - rv = apr_file_pipe_create(&readp, &writep, p); + rv = fspr_file_pipe_create(&readp, &writep, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, readp); ABTS_PTR_NOTNULL(tc, writep); - rv = apr_file_pipe_timeout_get(readp, &timeout); + rv = fspr_file_pipe_timeout_get(readp, &timeout); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "Timeout mismatch, expected -1", timeout == -1); - rv = apr_file_pipe_timeout_set(readp, apr_time_from_sec(1)); + rv = fspr_file_pipe_timeout_set(readp, fspr_time_from_sec(1)); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_pipe_timeout_get(readp, &timeout); + rv = fspr_file_pipe_timeout_get(readp, &timeout); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_ASSERT(tc, "Timeout mismatch, expected 1 second", - timeout == apr_time_from_sec(1)); + timeout == fspr_time_from_sec(1)); } static void read_write(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *buf; - apr_size_t nbytes; + fspr_size_t nbytes; nbytes = strlen("this is a test"); - buf = (char *)apr_palloc(p, nbytes + 1); + buf = (char *)fspr_palloc(p, nbytes + 1); - rv = apr_file_pipe_create(&readp, &writep, p); + rv = fspr_file_pipe_create(&readp, &writep, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, readp); ABTS_PTR_NOTNULL(tc, writep); - rv = apr_file_pipe_timeout_set(readp, apr_time_from_sec(1)); + rv = fspr_file_pipe_timeout_set(readp, fspr_time_from_sec(1)); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); if (!rv) { - rv = apr_file_read(readp, buf, &nbytes); + rv = fspr_file_read(readp, buf, &nbytes); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 0, nbytes); } @@ -100,25 +100,25 @@ static void read_write(abts_case *tc, void *data) static void read_write_notimeout(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char *buf = "this is a test"; char *input; - apr_size_t nbytes; + fspr_size_t nbytes; nbytes = strlen("this is a test"); - rv = apr_file_pipe_create(&readp, &writep, p); + rv = fspr_file_pipe_create(&readp, &writep, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, readp); ABTS_PTR_NOTNULL(tc, writep); - rv = apr_file_write(writep, buf, &nbytes); + rv = fspr_file_write(writep, buf, &nbytes); ABTS_INT_EQUAL(tc, strlen("this is a test"), nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); nbytes = 256; - input = apr_pcalloc(p, nbytes + 1); - rv = apr_file_read(readp, input, &nbytes); + input = fspr_pcalloc(p, nbytes + 1); + rv = fspr_file_read(readp, input, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen("this is a test"), nbytes); ABTS_STR_EQUAL(tc, "this is a test", input); @@ -131,54 +131,54 @@ static void test_pipe_writefull(abts_case *tc, void *data) int bytes_per_iteration = 8000; char *buf = (char *)malloc(bytes_per_iteration); char responsebuf[128]; - apr_size_t nbytes; + fspr_size_t nbytes; int bytes_processed; - apr_proc_t proc = {0}; - apr_procattr_t *procattr; + fspr_proc_t proc = {0}; + fspr_procattr_t *procattr; const char *args[2]; - apr_status_t rv; - apr_exit_why_e why; + fspr_status_t rv; + fspr_exit_why_e why; - rv = apr_procattr_create(&procattr, p); + rv = fspr_procattr_create(&procattr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_io_set(procattr, APR_CHILD_BLOCK, APR_CHILD_BLOCK, + rv = fspr_procattr_io_set(procattr, APR_CHILD_BLOCK, APR_CHILD_BLOCK, APR_CHILD_BLOCK); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_procattr_error_check_set(procattr, 1); + rv = fspr_procattr_error_check_set(procattr, 1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); args[0] = "readchild" EXTENSION; args[1] = NULL; - rv = apr_proc_create(&proc, "./readchild" EXTENSION, args, NULL, procattr, p); + rv = fspr_proc_create(&proc, "./readchild" EXTENSION, args, NULL, procattr, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_pipe_timeout_set(proc.in, apr_time_from_sec(10)); + rv = fspr_file_pipe_timeout_set(proc.in, fspr_time_from_sec(10)); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_file_pipe_timeout_set(proc.out, apr_time_from_sec(10)); + rv = fspr_file_pipe_timeout_set(proc.out, fspr_time_from_sec(10)); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); i = iterations; do { - rv = apr_file_write_full(proc.in, buf, bytes_per_iteration, NULL); + rv = fspr_file_write_full(proc.in, buf, bytes_per_iteration, NULL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } while (--i); free(buf); - rv = apr_file_close(proc.in); + rv = fspr_file_close(proc.in); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); nbytes = sizeof(responsebuf); - rv = apr_file_read(proc.out, responsebuf, &nbytes); + rv = fspr_file_read(proc.out, responsebuf, &nbytes); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - bytes_processed = (int)apr_strtoi64(responsebuf, NULL, 10); + bytes_processed = (int)fspr_strtoi64(responsebuf, NULL, 10); ABTS_INT_EQUAL(tc, iterations * bytes_per_iteration, bytes_processed); ABTS_ASSERT(tc, "wait for child process", - apr_proc_wait(&proc, NULL, &why, APR_WAIT) == APR_CHILD_DONE); + fspr_proc_wait(&proc, NULL, &why, APR_WAIT) == APR_CHILD_DONE); ABTS_ASSERT(tc, "child terminated normally", why == APR_PROC_EXIT); } diff --git a/libs/apr/test/testpoll.c b/libs/apr/test/testpoll.c index 36dd8a06bf..1b1424614a 100644 --- a/libs/apr/test/testpoll.c +++ b/libs/apr/test/testpoll.c @@ -15,12 +15,12 @@ */ #include "testutil.h" -#include "apr_strings.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_network_io.h" -#include "apr_poll.h" +#include "fspr_strings.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_network_io.h" +#include "fspr_poll.h" #define SMALL_NUM_SOCKETS 3 /* We can't use 64 here, because some platforms *ahem* Solaris *ahem* have @@ -29,83 +29,83 @@ */ #define LARGE_NUM_SOCKETS 50 -static apr_socket_t *s[LARGE_NUM_SOCKETS]; -static apr_sockaddr_t *sa[LARGE_NUM_SOCKETS]; -static apr_pollset_t *pollset; +static fspr_socket_t *s[LARGE_NUM_SOCKETS]; +static fspr_sockaddr_t *sa[LARGE_NUM_SOCKETS]; +static fspr_pollset_t *pollset; /* ###: tests surrounded by ifdef OLD_POLL_INTERFACE either need to be * converted to use the pollset interface or removed. */ #ifdef OLD_POLL_INTERFACE -static apr_pollfd_t *pollarray; -static apr_pollfd_t *pollarray_large; +static fspr_pollfd_t *pollarray; +static fspr_pollfd_t *pollarray_large; #endif -static void make_socket(apr_socket_t **sock, apr_sockaddr_t **sa, - apr_port_t port, apr_pool_t *p, abts_case *tc) +static void make_socket(fspr_socket_t **sock, fspr_sockaddr_t **sa, + fspr_port_t port, fspr_pool_t *p, abts_case *tc) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_sockaddr_info_get(sa, "127.0.0.1", APR_UNSPEC, port, 0, p); + rv = fspr_sockaddr_info_get(sa, "127.0.0.1", APR_UNSPEC, port, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_create(sock, (*sa)->family, SOCK_DGRAM, 0, p); + rv = fspr_socket_create(sock, (*sa)->family, SOCK_DGRAM, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv =apr_socket_bind((*sock), (*sa)); + rv =fspr_socket_bind((*sock), (*sa)); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } #ifdef OLD_POLL_INTERFACE -static void check_sockets(const apr_pollfd_t *pollarray, - apr_socket_t **sockarray, int which, int pollin, +static void check_sockets(const fspr_pollfd_t *pollarray, + fspr_socket_t **sockarray, int which, int pollin, abts_case *tc) { - apr_status_t rv; - apr_int16_t event; + fspr_status_t rv; + fspr_int16_t event; char *str; - rv = apr_poll_revents_get(&event, sockarray[which], - (apr_pollfd_t *)pollarray); + rv = fspr_poll_revents_get(&event, sockarray[which], + (fspr_pollfd_t *)pollarray); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); if (pollin) { - str = apr_psprintf(p, "Socket %d not signalled when it should be", + str = fspr_psprintf(p, "Socket %d not signalled when it should be", which); ABTS_ASSERT(tc, str, event & APR_POLLIN); } else { - str = apr_psprintf(p, "Socket %d signalled when it should not be", + str = fspr_psprintf(p, "Socket %d signalled when it should not be", which); ABTS_ASSERT(tc, str, !(event & APR_POLLIN)); } } #endif -static void send_msg(apr_socket_t **sockarray, apr_sockaddr_t **sas, int which, +static void send_msg(fspr_socket_t **sockarray, fspr_sockaddr_t **sas, int which, abts_case *tc) { - apr_size_t len = 5; - apr_status_t rv; + fspr_size_t len = 5; + fspr_status_t rv; ABTS_PTR_NOTNULL(tc, sockarray[which]); - rv = apr_socket_sendto(sockarray[which], sas[which], 0, "hello", &len); + rv = fspr_socket_sendto(sockarray[which], sas[which], 0, "hello", &len); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen("hello"), len); } -static void recv_msg(apr_socket_t **sockarray, int which, apr_pool_t *p, +static void recv_msg(fspr_socket_t **sockarray, int which, fspr_pool_t *p, abts_case *tc) { - apr_size_t buflen = 5; - char *buffer = apr_pcalloc(p, sizeof(char) * (buflen + 1)); - apr_sockaddr_t *recsa; - apr_status_t rv; + fspr_size_t buflen = 5; + char *buffer = fspr_pcalloc(p, sizeof(char) * (buflen + 1)); + fspr_sockaddr_t *recsa; + fspr_status_t rv; ABTS_PTR_NOTNULL(tc, sockarray[which]); - apr_sockaddr_info_get(&recsa, "127.0.0.1", APR_UNSPEC, 7770, 0, p); + fspr_sockaddr_info_get(&recsa, "127.0.0.1", APR_UNSPEC, 7770, 0, p); - rv = apr_socket_recvfrom(recsa, sockarray[which], 0, buffer, &buflen); + rv = fspr_socket_recvfrom(recsa, sockarray[which], 0, buffer, &buflen); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, strlen("hello"), buflen); ABTS_STR_EQUAL(tc, "hello", buffer); @@ -124,17 +124,17 @@ static void create_all_sockets(abts_case *tc, void *data) #ifdef OLD_POLL_INTERFACE static void setup_small_poll(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int i; - rv = apr_poll_setup(&pollarray, SMALL_NUM_SOCKETS, p); + rv = fspr_poll_setup(&pollarray, SMALL_NUM_SOCKETS, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); for (i = 0; i < SMALL_NUM_SOCKETS;i++){ ABTS_INT_EQUAL(tc, 0, pollarray[i].reqevents); ABTS_INT_EQUAL(tc, 0, pollarray[i].rtnevents); - rv = apr_poll_socket_add(pollarray, s[i], APR_POLLIN); + rv = fspr_poll_socket_add(pollarray, s[i], APR_POLLIN); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_EQUAL(tc, s[i], pollarray[i].desc.s); } @@ -142,17 +142,17 @@ static void setup_small_poll(abts_case *tc, void *data) static void setup_large_poll(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int i; - rv = apr_poll_setup(&pollarray_large, LARGE_NUM_SOCKETS, p); + rv = fspr_poll_setup(&pollarray_large, LARGE_NUM_SOCKETS, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); for (i = 0; i < LARGE_NUM_SOCKETS;i++){ ABTS_INT_EQUAL(tc, 0, pollarray_large[i].reqevents); ABTS_INT_EQUAL(tc, 0, pollarray_large[i].rtnevents); - rv = apr_poll_socket_add(pollarray_large, s[i], APR_POLLIN); + rv = fspr_poll_socket_add(pollarray_large, s[i], APR_POLLIN); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_EQUAL(tc, s[i], pollarray_large[i].desc.s); } @@ -160,10 +160,10 @@ static void setup_large_poll(abts_case *tc, void *data) static void nomessage(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int srv = SMALL_NUM_SOCKETS; - rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); + rv = fspr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); check_sockets(pollarray, s, 0, 0, tc); check_sockets(pollarray, s, 1, 0, tc); @@ -172,12 +172,12 @@ static void nomessage(abts_case *tc, void *data) static void send_2(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int srv = SMALL_NUM_SOCKETS; send_msg(s, sa, 2, tc); - rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); + rv = fspr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); check_sockets(pollarray, s, 0, 0, tc); check_sockets(pollarray, s, 1, 0, tc); @@ -186,13 +186,13 @@ static void send_2(abts_case *tc, void *data) static void recv_2_send_1(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int srv = SMALL_NUM_SOCKETS; recv_msg(s, 2, p, tc); send_msg(s, sa, 1, tc); - rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); + rv = fspr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); check_sockets(pollarray, s, 0, 0, tc); check_sockets(pollarray, s, 1, 1, tc); @@ -201,12 +201,12 @@ static void recv_2_send_1(abts_case *tc, void *data) static void send_2_signaled_1(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int srv = SMALL_NUM_SOCKETS; send_msg(s, sa, 2, tc); - rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); + rv = fspr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); check_sockets(pollarray, s, 0, 0, tc); check_sockets(pollarray, s, 1, 1, tc); @@ -215,13 +215,13 @@ static void send_2_signaled_1(abts_case *tc, void *data) static void recv_1_send_0(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int srv = SMALL_NUM_SOCKETS; recv_msg(s, 1, p, tc); send_msg(s, sa, 0, tc); - rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); + rv = fspr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); check_sockets(pollarray, s, 0, 1, tc); check_sockets(pollarray, s, 1, 0, tc); @@ -230,13 +230,13 @@ static void recv_1_send_0(abts_case *tc, void *data) static void clear_all_signalled(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int srv = SMALL_NUM_SOCKETS; recv_msg(s, 0, p, tc); recv_msg(s, 2, p, tc); - rv = apr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); + rv = fspr_poll(pollarray, SMALL_NUM_SOCKETS, &srv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); check_sockets(pollarray, s, 0, 0, tc); check_sockets(pollarray, s, 1, 0, tc); @@ -245,13 +245,13 @@ static void clear_all_signalled(abts_case *tc, void *data) static void send_large_pollarray(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int lrv = LARGE_NUM_SOCKETS; int i; send_msg(s, sa, LARGE_NUM_SOCKETS - 1, tc); - rv = apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv, + rv = fspr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); @@ -267,13 +267,13 @@ static void send_large_pollarray(abts_case *tc, void *data) static void recv_large_pollarray(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int lrv = LARGE_NUM_SOCKETS; int i; recv_msg(s, LARGE_NUM_SOCKETS - 1, p, tc); - rv = apr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv, + rv = fspr_poll(pollarray_large, LARGE_NUM_SOCKETS, &lrv, 2 * APR_USEC_PER_SEC); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); @@ -285,29 +285,29 @@ static void recv_large_pollarray(abts_case *tc, void *data) static void setup_pollset(abts_case *tc, void *data) { - apr_status_t rv; - rv = apr_pollset_create(&pollset, LARGE_NUM_SOCKETS, p, 0); + fspr_status_t rv; + rv = fspr_pollset_create(&pollset, LARGE_NUM_SOCKETS, p, 0); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } static void multi_event_pollset(abts_case *tc, void *data) { - apr_status_t rv; - apr_pollfd_t socket_pollfd; + fspr_status_t rv; + fspr_pollfd_t socket_pollfd; int lrv; - const apr_pollfd_t *descs = NULL; + const fspr_pollfd_t *descs = NULL; ABTS_PTR_NOTNULL(tc, s[0]); socket_pollfd.desc_type = APR_POLL_SOCKET; socket_pollfd.reqevents = APR_POLLIN | APR_POLLOUT; socket_pollfd.desc.s = s[0]; socket_pollfd.client_data = s[0]; - rv = apr_pollset_add(pollset, &socket_pollfd); + rv = fspr_pollset_add(pollset, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); send_msg(s, sa, 0, tc); - rv = apr_pollset_poll(pollset, 0, &lrv, &descs); + rv = fspr_pollset_poll(pollset, 0, &lrv, &descs); ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv)); if (lrv == 1) { ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s); @@ -331,24 +331,24 @@ static void multi_event_pollset(abts_case *tc, void *data) recv_msg(s, 0, p, tc); - rv = apr_pollset_poll(pollset, 0, &lrv, &descs); + rv = fspr_pollset_poll(pollset, 0, &lrv, &descs); ABTS_INT_EQUAL(tc, 0, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 1, lrv); ABTS_PTR_EQUAL(tc, s[0], descs[0].desc.s); ABTS_INT_EQUAL(tc, APR_POLLOUT, descs[0].rtnevents); ABTS_PTR_EQUAL(tc, s[0], descs[0].client_data); - rv = apr_pollset_remove(pollset, &socket_pollfd); + rv = fspr_pollset_remove(pollset, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } static void add_sockets_pollset(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int i; for (i = 0; i < LARGE_NUM_SOCKETS;i++){ - apr_pollfd_t socket_pollfd; + fspr_pollfd_t socket_pollfd; ABTS_PTR_NOTNULL(tc, s[i]); @@ -356,18 +356,18 @@ static void add_sockets_pollset(abts_case *tc, void *data) socket_pollfd.reqevents = APR_POLLIN; socket_pollfd.desc.s = s[i]; socket_pollfd.client_data = s[i]; - rv = apr_pollset_add(pollset, &socket_pollfd); + rv = fspr_pollset_add(pollset, &socket_pollfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } } static void nomessage_pollset(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int lrv; - const apr_pollfd_t *descs = NULL; + const fspr_pollfd_t *descs = NULL; - rv = apr_pollset_poll(pollset, 0, &lrv, &descs); + rv = fspr_pollset_poll(pollset, 0, &lrv, &descs); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 0, lrv); ABTS_PTR_EQUAL(tc, NULL, descs); @@ -375,12 +375,12 @@ static void nomessage_pollset(abts_case *tc, void *data) static void send0_pollset(abts_case *tc, void *data) { - apr_status_t rv; - const apr_pollfd_t *descs = NULL; + fspr_status_t rv; + const fspr_pollfd_t *descs = NULL; int num; send_msg(s, sa, 0, tc); - rv = apr_pollset_poll(pollset, 0, &num, &descs); + rv = fspr_pollset_poll(pollset, 0, &num, &descs); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, num); ABTS_PTR_NOTNULL(tc, descs); @@ -391,12 +391,12 @@ static void send0_pollset(abts_case *tc, void *data) static void recv0_pollset(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int lrv; - const apr_pollfd_t *descs = NULL; + const fspr_pollfd_t *descs = NULL; recv_msg(s, 0, p, tc); - rv = apr_pollset_poll(pollset, 0, &lrv, &descs); + rv = fspr_pollset_poll(pollset, 0, &lrv, &descs); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 0, lrv); ABTS_PTR_EQUAL(tc, NULL, descs); @@ -404,13 +404,13 @@ static void recv0_pollset(abts_case *tc, void *data) static void send_middle_pollset(abts_case *tc, void *data) { - apr_status_t rv; - const apr_pollfd_t *descs = NULL; + fspr_status_t rv; + const fspr_pollfd_t *descs = NULL; int num; send_msg(s, sa, 2, tc); send_msg(s, sa, 5, tc); - rv = apr_pollset_poll(pollset, 0, &num, &descs); + rv = fspr_pollset_poll(pollset, 0, &num, &descs); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 2, num); ABTS_PTR_NOTNULL(tc, descs); @@ -422,14 +422,14 @@ static void send_middle_pollset(abts_case *tc, void *data) static void clear_middle_pollset(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int lrv; - const apr_pollfd_t *descs = NULL; + const fspr_pollfd_t *descs = NULL; recv_msg(s, 2, p, tc); recv_msg(s, 5, p, tc); - rv = apr_pollset_poll(pollset, 0, &lrv, &descs); + rv = fspr_pollset_poll(pollset, 0, &lrv, &descs); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 0, lrv); ABTS_PTR_EQUAL(tc, NULL, descs); @@ -437,12 +437,12 @@ static void clear_middle_pollset(abts_case *tc, void *data) static void send_last_pollset(abts_case *tc, void *data) { - apr_status_t rv; - const apr_pollfd_t *descs = NULL; + fspr_status_t rv; + const fspr_pollfd_t *descs = NULL; int num; send_msg(s, sa, LARGE_NUM_SOCKETS - 1, tc); - rv = apr_pollset_poll(pollset, 0, &num, &descs); + rv = fspr_pollset_poll(pollset, 0, &num, &descs); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, num); ABTS_PTR_NOTNULL(tc, descs); @@ -453,13 +453,13 @@ static void send_last_pollset(abts_case *tc, void *data) static void clear_last_pollset(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int lrv; - const apr_pollfd_t *descs = NULL; + const fspr_pollfd_t *descs = NULL; recv_msg(s, LARGE_NUM_SOCKETS - 1, p, tc); - rv = apr_pollset_poll(pollset, 0, &lrv, &descs); + rv = fspr_pollset_poll(pollset, 0, &lrv, &descs); ABTS_INT_EQUAL(tc, 1, APR_STATUS_IS_TIMEUP(rv)); ABTS_INT_EQUAL(tc, 0, lrv); ABTS_PTR_EQUAL(tc, NULL, descs); @@ -467,24 +467,24 @@ static void clear_last_pollset(abts_case *tc, void *data) static void close_all_sockets(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; int i; for (i = 0; i < LARGE_NUM_SOCKETS; i++){ - rv = apr_socket_close(s[i]); + rv = fspr_socket_close(s[i]); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } } static void pollset_remove(abts_case *tc, void *data) { - apr_status_t rv; - apr_pollset_t *pollset; - const apr_pollfd_t *hot_files; - apr_pollfd_t pfd; - apr_int32_t num; + fspr_status_t rv; + fspr_pollset_t *pollset; + const fspr_pollfd_t *hot_files; + fspr_pollfd_t pfd; + fspr_int32_t num; - rv = apr_pollset_create(&pollset, 5, p, 0); + rv = fspr_pollset_create(&pollset, 5, p, 0); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); pfd.p = p; @@ -493,36 +493,36 @@ static void pollset_remove(abts_case *tc, void *data) pfd.desc.s = s[0]; pfd.client_data = (void *)1; - rv = apr_pollset_add(pollset, &pfd); + rv = fspr_pollset_add(pollset, &pfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); pfd.desc.s = s[1]; pfd.client_data = (void *)2; - rv = apr_pollset_add(pollset, &pfd); + rv = fspr_pollset_add(pollset, &pfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); pfd.desc.s = s[2]; pfd.client_data = (void *)3; - rv = apr_pollset_add(pollset, &pfd); + rv = fspr_pollset_add(pollset, &pfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); pfd.desc.s = s[3]; pfd.client_data = (void *)4; - rv = apr_pollset_add(pollset, &pfd); + rv = fspr_pollset_add(pollset, &pfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_pollset_poll(pollset, 1000, &num, &hot_files); + rv = fspr_pollset_poll(pollset, 1000, &num, &hot_files); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 4, num); /* now remove the pollset element referring to desc s[1] */ pfd.desc.s = s[1]; pfd.client_data = (void *)999; /* not used on this call */ - rv = apr_pollset_remove(pollset, &pfd); + rv = fspr_pollset_remove(pollset, &pfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* this time only three should match */ - rv = apr_pollset_poll(pollset, 1000, &num, &hot_files); + rv = fspr_pollset_poll(pollset, 1000, &num, &hot_files); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 3, num); ABTS_PTR_EQUAL(tc, (void *)1, hot_files[0].client_data); @@ -535,11 +535,11 @@ static void pollset_remove(abts_case *tc, void *data) /* now remove the pollset elements referring to desc s[2] */ pfd.desc.s = s[2]; pfd.client_data = (void *)999; /* not used on this call */ - rv = apr_pollset_remove(pollset, &pfd); + rv = fspr_pollset_remove(pollset, &pfd); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* this time only two should match */ - rv = apr_pollset_poll(pollset, 1000, &num, &hot_files); + rv = fspr_pollset_poll(pollset, 1000, &num, &hot_files); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 2, num); ABTS_ASSERT(tc, "Incorrect socket in result set", diff --git a/libs/apr/test/testpools.c b/libs/apr/test/testpools.c index cb45552e77..9354dd44f8 100644 --- a/libs/apr/test/testpools.c +++ b/libs/apr/test/testpools.c @@ -15,10 +15,10 @@ */ -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_errno.h" -#include "apr_file_io.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_errno.h" +#include "fspr_file_io.h" #include #include #include @@ -29,15 +29,15 @@ #define ALLOC_BYTES 1024 -static apr_pool_t *pmain = NULL; -static apr_pool_t *pchild = NULL; +static fspr_pool_t *pmain = NULL; +static fspr_pool_t *pchild = NULL; static void alloc_bytes(abts_case *tc, void *data) { int i; char *alloc; - alloc = apr_palloc(pmain, ALLOC_BYTES); + alloc = fspr_palloc(pmain, ALLOC_BYTES); ABTS_PTR_NOTNULL(tc, alloc); for (i=0;i #include @@ -32,47 +32,47 @@ #define CHILDREN 6 #define MAX_COUNTER (MAX_ITER * CHILDREN) -static apr_proc_mutex_t *proc_lock; +static fspr_proc_mutex_t *proc_lock; static volatile int *x; /* a slower more racy way to implement (*x)++ */ static int increment(int n) { - apr_sleep(1); + fspr_sleep(1); return n+1; } -static void make_child(abts_case *tc, apr_proc_t **proc, apr_pool_t *p) +static void make_child(abts_case *tc, fspr_proc_t **proc, fspr_pool_t *p) { - apr_status_t rv; + fspr_status_t rv; - *proc = apr_pcalloc(p, sizeof(**proc)); + *proc = fspr_pcalloc(p, sizeof(**proc)); /* slight delay to allow things to settle */ - apr_sleep (1); + fspr_sleep (1); - rv = apr_proc_fork(*proc, p); + rv = fspr_proc_fork(*proc, p); if (rv == APR_INCHILD) { int i = 0; - /* The parent process has setup all processes to call apr_terminate + /* The parent process has setup all processes to call fspr_terminate * at exit. But, that means that all processes must also call - * apr_initialize at startup. You cannot have an unequal number - * of apr_terminate and apr_initialize calls. If you do, bad things + * fspr_initialize at startup. You cannot have an unequal number + * of fspr_terminate and fspr_initialize calls. If you do, bad things * will happen. In this case, the bad thing is that if the mutex * is a semaphore, it will be destroyed before all of the processes * die. That means that the test will most likely fail. */ - apr_initialize(); + fspr_initialize(); - if (apr_proc_mutex_child_init(&proc_lock, NULL, p)) + if (fspr_proc_mutex_child_init(&proc_lock, NULL, p)) exit(1); do { - if (apr_proc_mutex_lock(proc_lock)) + if (fspr_proc_mutex_lock(proc_lock)) exit(1); i++; *x = increment(*x); - if (apr_proc_mutex_unlock(proc_lock)) + if (fspr_proc_mutex_unlock(proc_lock)) exit(1); } while (i < MAX_ITER); exit(0); @@ -82,25 +82,25 @@ static void make_child(abts_case *tc, apr_proc_t **proc, apr_pool_t *p) } /* Wait for a child process and check it terminated with success. */ -static void await_child(abts_case *tc, apr_proc_t *proc) +static void await_child(abts_case *tc, fspr_proc_t *proc) { int code; - apr_exit_why_e why; - apr_status_t rv; + fspr_exit_why_e why; + fspr_status_t rv; - rv = apr_proc_wait(proc, &code, &why, APR_WAIT); + rv = fspr_proc_wait(proc, &code, &why, APR_WAIT); ABTS_ASSERT(tc, "child did not terminate with success", rv == APR_CHILD_DONE && why == APR_PROC_EXIT && code == 0); } static void test_exclusive(abts_case *tc, const char *lockname, - apr_lockmech_e mech) + fspr_lockmech_e mech) { - apr_proc_t *child[CHILDREN]; - apr_status_t rv; + fspr_proc_t *child[CHILDREN]; + fspr_status_t rv; int n; - rv = apr_proc_mutex_create(&proc_lock, lockname, mech, p); + rv = fspr_proc_mutex_create(&proc_lock, lockname, mech, p); APR_ASSERT_SUCCESS(tc, "create the mutex", rv); if (rv != APR_SUCCESS) return; @@ -118,25 +118,25 @@ static void test_exclusive(abts_case *tc, const char *lockname, static void proc_mutex(abts_case *tc, void *data) { #if APR_HAS_FORK - apr_status_t rv; + fspr_status_t rv; const char *shmname = "tpm.shm"; - apr_shm_t *shm; - apr_lockmech_e *mech = data; + fspr_shm_t *shm; + fspr_lockmech_e *mech = data; /* Use anonymous shm if available. */ - rv = apr_shm_create(&shm, sizeof(int), NULL, p); + rv = fspr_shm_create(&shm, sizeof(int), NULL, p); if (rv == APR_ENOTIMPL) { - apr_file_remove(shmname, p); - rv = apr_shm_create(&shm, sizeof(int), shmname, p); + fspr_file_remove(shmname, p); + rv = fspr_shm_create(&shm, sizeof(int), shmname, p); } APR_ASSERT_SUCCESS(tc, "create shm segment", rv); if (rv != APR_SUCCESS) return; - x = apr_shm_baseaddr_get(shm); + x = fspr_shm_baseaddr_get(shm); test_exclusive(tc, NULL, *mech); - rv = apr_shm_destroy(shm); + rv = fspr_shm_destroy(shm); APR_ASSERT_SUCCESS(tc, "Error destroying shared memory block", rv); #else ABTS_NOT_IMPL(tc, "APR lacks fork() support"); @@ -146,7 +146,7 @@ static void proc_mutex(abts_case *tc, void *data) abts_suite *testprocmutex(abts_suite *suite) { - apr_lockmech_e mech = APR_LOCK_DEFAULT; + fspr_lockmech_e mech = APR_LOCK_DEFAULT; suite = ADD_SUITE(suite) abts_run_test(suite, proc_mutex, &mech); diff --git a/libs/apr/test/testrand.c b/libs/apr/test/testrand.c index befed08745..346d8fb3a9 100644 --- a/libs/apr/test/testrand.c +++ b/libs/apr/test/testrand.c @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "apr_general.h" +#include "fspr_general.h" #include #include #include @@ -23,15 +23,15 @@ static void rand_exists(abts_case *tc, void *data) { #if !APR_HAS_RANDOM - ABTS_NOT_IMPL(tc, "apr_generate_random_bytes"); + ABTS_NOT_IMPL(tc, "fspr_generate_random_bytes"); #else unsigned char c[42]; /* There must be a better way to test random-ness, but I don't know * what it is right now. */ - APR_ASSERT_SUCCESS(tc, "apr_generate_random_bytes failed", - apr_generate_random_bytes(c, sizeof c)); + APR_ASSERT_SUCCESS(tc, "fspr_generate_random_bytes failed", + fspr_generate_random_bytes(c, sizeof c)); #endif } diff --git a/libs/apr/test/testrand2.c b/libs/apr/test/testrand2.c index f9f8286400..e233d18b6b 100644 --- a/libs/apr/test/testrand2.c +++ b/libs/apr/test/testrand2.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr_general.h" -#include "apr_random.h" -#include "apr_thread_proc.h" +#include "fspr_general.h" +#include "fspr_random.h" +#include "fspr_thread_proc.h" #include #include #include @@ -43,15 +43,15 @@ static void hexdump(const unsigned char *b,int n) printf("\n"); } -static apr_random_t *r; +static fspr_random_t *r; -typedef apr_status_t APR_THREAD_FUNC rnd_fn(apr_random_t *r,void *b,apr_size_t n); +typedef fspr_status_t APR_THREAD_FUNC rnd_fn(fspr_random_t *r,void *b,fspr_size_t n); -static void rand_run_kat(abts_case *tc,rnd_fn *f,apr_random_t *r, +static void rand_run_kat(abts_case *tc,rnd_fn *f,fspr_random_t *r, const unsigned char expected[128]) { unsigned char c[128]; - apr_status_t rv; + fspr_status_t rv; rv=f(r,c,128); ABTS_INT_EQUAL(tc,0,rv); @@ -65,11 +65,11 @@ static void rand_run_kat(abts_case *tc,rnd_fn *f,apr_random_t *r, } } -static int rand_check_kat(rnd_fn *f,apr_random_t *r, +static int rand_check_kat(rnd_fn *f,fspr_random_t *r, const unsigned char expected[128]) { unsigned char c[128]; - apr_status_t rv; + fspr_status_t rv; rv=f(r,c,128); if(rv) @@ -79,18 +79,18 @@ static int rand_check_kat(rnd_fn *f,apr_random_t *r, return 0; } -static void rand_add_zeroes(apr_random_t *r) +static void rand_add_zeroes(fspr_random_t *r) { static unsigned char c[2048]; - apr_random_add_entropy(r,c,sizeof c); + fspr_random_add_entropy(r,c,sizeof c); } -static void rand_run_seed_short(abts_case *tc,rnd_fn *f,apr_random_t *r, +static void rand_run_seed_short(abts_case *tc,rnd_fn *f,fspr_random_t *r, int count) { int i; - apr_status_t rv; + fspr_status_t rv; char c[1]; for(i=0 ; i < count ; ++i) @@ -101,8 +101,8 @@ static void rand_run_seed_short(abts_case *tc,rnd_fn *f,apr_random_t *r, static void rand_seed_short(abts_case *tc, void *data) { - r=apr_random_standard_new(p); - rand_run_seed_short(tc,apr_random_insecure_bytes,r,32); + r=fspr_random_standard_new(p); + rand_run_seed_short(tc,fspr_random_insecure_bytes,r,32); } static void rand_kat(abts_case *tc, void *data) @@ -126,12 +126,12 @@ static void rand_kat(abts_case *tc, void *data) 0x87,0xec,0x2e,0xb1,0x2d,0x6a,0xbd,0x46 }; rand_add_zeroes(r); - rand_run_kat(tc,apr_random_insecure_bytes,r,expected); + rand_run_kat(tc,fspr_random_insecure_bytes,r,expected); } static void rand_seed_short2(abts_case *tc, void *data) { - rand_run_seed_short(tc,apr_random_secure_bytes,r,320); + rand_run_seed_short(tc,fspr_random_secure_bytes,r,320); } static void rand_kat2(abts_case *tc, void *data) @@ -155,13 +155,13 @@ static void rand_kat2(abts_case *tc, void *data) 0xed,0xd2,0xde,0xce,0x18,0x70,0x57,0x12 }; rand_add_zeroes(r); - rand_run_kat(tc,apr_random_secure_bytes,r,expected); + rand_run_kat(tc,fspr_random_secure_bytes,r,expected); } static void rand_barrier(abts_case *tc, void *data) { - apr_random_barrier(r); - rand_run_seed_short(tc,apr_random_secure_bytes,r,320); + fspr_random_barrier(r); + rand_run_seed_short(tc,fspr_random_secure_bytes,r,320); } static void rand_kat3(abts_case *tc, void *data) @@ -184,7 +184,7 @@ static void rand_kat3(abts_case *tc, void *data) 0x04,0xbf,0x32,0xd6,0xdc,0xb7,0x31,0x01, 0x29,0x51,0x51,0xb3,0x19,0x6e,0xe4,0xf8 }; - rand_run_kat(tc,apr_random_insecure_bytes,r,expected); + rand_run_kat(tc,fspr_random_insecure_bytes,r,expected); } static void rand_kat4(abts_case *tc, void *data) @@ -208,14 +208,14 @@ static void rand_kat4(abts_case *tc, void *data) 0x17,0x35,0x5f,0x35,0x8d,0x55,0x0c,0x07 }; rand_add_zeroes(r); - rand_run_kat(tc,apr_random_secure_bytes,r,expected); + rand_run_kat(tc,fspr_random_secure_bytes,r,expected); } #if APR_HAS_FORK static void rand_fork(abts_case *tc, void *data) { - apr_proc_t proc; - apr_status_t rv; + fspr_proc_t proc; + fspr_status_t rv; unsigned char expected[128]= { 0xac,0x93,0xd2,0x5c,0xc7,0xf5,0x8d,0xc2, 0xd8,0x8d,0xb6,0x7a,0x94,0xe1,0x83,0x4c, @@ -234,22 +234,22 @@ static void rand_fork(abts_case *tc, void *data) 0x32,0x8a,0x54,0x01,0xd0,0xaf,0x3f,0x13, 0xc1,0x7f,0x10,0x2e,0x08,0x1c,0x28,0x4b, }; - rv=apr_proc_fork(&proc,p); + rv=fspr_proc_fork(&proc,p); if(rv == APR_INCHILD) { int n; - n=rand_check_kat(apr_random_secure_bytes,r,expected); + n=rand_check_kat(fspr_random_secure_bytes,r,expected); exit(n); } else if(rv == APR_INPARENT) { int exitcode; - apr_exit_why_e why; + fspr_exit_why_e why; - rand_run_kat(tc,apr_random_secure_bytes,r,expected); - apr_proc_wait(&proc,&exitcode,&why,APR_WAIT); + rand_run_kat(tc,fspr_random_secure_bytes,r,expected); + fspr_proc_wait(&proc,&exitcode,&why,APR_WAIT); if(why != APR_PROC_EXIT) { ABTS_FAIL(tc,"Child terminated abnormally"); diff --git a/libs/apr/test/testshm.c b/libs/apr/test/testshm.c index 3691dd52ce..7839156583 100644 --- a/libs/apr/test/testshm.c +++ b/libs/apr/test/testshm.c @@ -15,15 +15,15 @@ */ #include "testutil.h" -#include "apr_shm.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_thread_proc.h" -#include "apr_time.h" +#include "fspr_shm.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_thread_proc.h" +#include "fspr_time.h" #include "testshm.h" -#include "apr.h" +#include "fspr.h" #if APR_HAVE_STDLIB_H #include @@ -35,9 +35,9 @@ static int msgwait(int sleep_sec, int first_box, int last_box) { int i; int recvd = 0; - apr_time_t start = apr_time_now(); - apr_interval_time_t sleep_duration = apr_time_from_sec(sleep_sec); - while (apr_time_now() - start < sleep_duration) { + fspr_time_t start = fspr_time_now(); + fspr_interval_time_t sleep_duration = fspr_time_from_sec(sleep_sec); + while (fspr_time_now() - start < sleep_duration) { for (i = first_box; i < last_box; i++) { if (boxes[i].msgavail && !strcmp(boxes[i].msg, MSG)) { recvd++; @@ -48,84 +48,84 @@ static int msgwait(int sleep_sec, int first_box, int last_box) memset(boxes[i].msg, 0, 1024); } } - apr_sleep(apr_time_make(0, 10000)); /* 10ms */ + fspr_sleep(fspr_time_make(0, 10000)); /* 10ms */ } return recvd; } static void msgput(int boxnum, char *msg) { - apr_cpystrn(boxes[boxnum].msg, msg, strlen(msg) + 1); + fspr_cpystrn(boxes[boxnum].msg, msg, strlen(msg) + 1); boxes[boxnum].msgavail = 1; } static void test_anon_create(abts_case *tc, void *data) { - apr_status_t rv; - apr_shm_t *shm = NULL; + fspr_status_t rv; + fspr_shm_t *shm = NULL; - rv = apr_shm_create(&shm, SHARED_SIZE, NULL, p); + rv = fspr_shm_create(&shm, SHARED_SIZE, NULL, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); ABTS_PTR_NOTNULL(tc, shm); - rv = apr_shm_destroy(shm); + rv = fspr_shm_destroy(shm); APR_ASSERT_SUCCESS(tc, "Error destroying shared memory block", rv); } static void test_check_size(abts_case *tc, void *data) { - apr_status_t rv; - apr_shm_t *shm = NULL; - apr_size_t retsize; + fspr_status_t rv; + fspr_shm_t *shm = NULL; + fspr_size_t retsize; - rv = apr_shm_create(&shm, SHARED_SIZE, NULL, p); + rv = fspr_shm_create(&shm, SHARED_SIZE, NULL, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); ABTS_PTR_NOTNULL(tc, shm); - retsize = apr_shm_size_get(shm); + retsize = fspr_shm_size_get(shm); ABTS_INT_EQUAL(tc, SHARED_SIZE, retsize); - rv = apr_shm_destroy(shm); + rv = fspr_shm_destroy(shm); APR_ASSERT_SUCCESS(tc, "Error destroying shared memory block", rv); } static void test_shm_allocate(abts_case *tc, void *data) { - apr_status_t rv; - apr_shm_t *shm = NULL; + fspr_status_t rv; + fspr_shm_t *shm = NULL; - rv = apr_shm_create(&shm, SHARED_SIZE, NULL, p); + rv = fspr_shm_create(&shm, SHARED_SIZE, NULL, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); ABTS_PTR_NOTNULL(tc, shm); - boxes = apr_shm_baseaddr_get(shm); + boxes = fspr_shm_baseaddr_get(shm); ABTS_PTR_NOTNULL(tc, boxes); - rv = apr_shm_destroy(shm); + rv = fspr_shm_destroy(shm); APR_ASSERT_SUCCESS(tc, "Error destroying shared memory block", rv); } #if APR_HAS_FORK static void test_anon(abts_case *tc, void *data) { - apr_proc_t proc; - apr_status_t rv; - apr_shm_t *shm; - apr_size_t retsize; + fspr_proc_t proc; + fspr_status_t rv; + fspr_shm_t *shm; + fspr_size_t retsize; int cnt, i; int recvd; - rv = apr_shm_create(&shm, SHARED_SIZE, NULL, p); + rv = fspr_shm_create(&shm, SHARED_SIZE, NULL, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); ABTS_PTR_NOTNULL(tc, shm); - retsize = apr_shm_size_get(shm); + retsize = fspr_shm_size_get(shm); ABTS_INT_EQUAL(tc, SHARED_SIZE, retsize); - boxes = apr_shm_baseaddr_get(shm); + boxes = fspr_shm_baseaddr_get(shm); ABTS_PTR_NOTNULL(tc, boxes); - rv = apr_proc_fork(&proc, p); + rv = fspr_proc_fork(&proc, p); if (rv == APR_INCHILD) { /* child */ int num = msgwait(5, 0, N_BOXES); /* exit with the number of messages received so that the parent @@ -141,69 +141,69 @@ static void test_anon(abts_case *tc, void *data) i += N_BOXES; /* start over at the top */ } msgput(i, MSG); - apr_sleep(apr_time_make(0, 10000)); + fspr_sleep(fspr_time_make(0, 10000)); } } else { - ABTS_FAIL(tc, "apr_proc_fork failed"); + ABTS_FAIL(tc, "fspr_proc_fork failed"); } /* wait for the child */ - rv = apr_proc_wait(&proc, &recvd, NULL, APR_WAIT); + rv = fspr_proc_wait(&proc, &recvd, NULL, APR_WAIT); ABTS_INT_EQUAL(tc, N_MESSAGES, recvd); - rv = apr_shm_destroy(shm); + rv = fspr_shm_destroy(shm); APR_ASSERT_SUCCESS(tc, "Error destroying shared memory block", rv); } #endif static void test_named(abts_case *tc, void *data) { - apr_status_t rv; - apr_shm_t *shm = NULL; - apr_size_t retsize; - apr_proc_t pidproducer, pidconsumer; - apr_procattr_t *attr1 = NULL, *attr2 = NULL; + fspr_status_t rv; + fspr_shm_t *shm = NULL; + fspr_size_t retsize; + fspr_proc_t pidproducer, pidconsumer; + fspr_procattr_t *attr1 = NULL, *attr2 = NULL; int sent, received; - apr_exit_why_e why; + fspr_exit_why_e why; const char *args[4]; - apr_shm_remove(SHARED_FILENAME, p); + fspr_shm_remove(SHARED_FILENAME, p); - rv = apr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, p); + rv = fspr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); if (rv != APR_SUCCESS) { return; } ABTS_PTR_NOTNULL(tc, shm); - retsize = apr_shm_size_get(shm); + retsize = fspr_shm_size_get(shm); ABTS_INT_EQUAL(tc, SHARED_SIZE, retsize); - boxes = apr_shm_baseaddr_get(shm); + boxes = fspr_shm_baseaddr_get(shm); ABTS_PTR_NOTNULL(tc, boxes); - rv = apr_procattr_create(&attr1, p); + rv = fspr_procattr_create(&attr1, p); ABTS_PTR_NOTNULL(tc, attr1); APR_ASSERT_SUCCESS(tc, "Couldn't create attr1", rv); - args[0] = apr_pstrdup(p, "testshmproducer" EXTENSION); + args[0] = fspr_pstrdup(p, "testshmproducer" EXTENSION); args[1] = NULL; - rv = apr_proc_create(&pidproducer, "./testshmproducer" EXTENSION, args, + rv = fspr_proc_create(&pidproducer, "./testshmproducer" EXTENSION, args, NULL, attr1, p); APR_ASSERT_SUCCESS(tc, "Couldn't launch producer", rv); - rv = apr_procattr_create(&attr2, p); + rv = fspr_procattr_create(&attr2, p); ABTS_PTR_NOTNULL(tc, attr2); APR_ASSERT_SUCCESS(tc, "Couldn't create attr2", rv); - args[0] = apr_pstrdup(p, "testshmconsumer" EXTENSION); - rv = apr_proc_create(&pidconsumer, "./testshmconsumer" EXTENSION, args, + args[0] = fspr_pstrdup(p, "testshmconsumer" EXTENSION); + rv = fspr_proc_create(&pidconsumer, "./testshmconsumer" EXTENSION, args, NULL, attr2, p); APR_ASSERT_SUCCESS(tc, "Couldn't launch consumer", rv); - rv = apr_proc_wait(&pidconsumer, &received, &why, APR_WAIT); + rv = fspr_proc_wait(&pidconsumer, &received, &why, APR_WAIT); ABTS_INT_EQUAL(tc, APR_CHILD_DONE, rv); ABTS_INT_EQUAL(tc, APR_PROC_EXIT, why); - rv = apr_proc_wait(&pidproducer, &sent, &why, APR_WAIT); + rv = fspr_proc_wait(&pidproducer, &sent, &why, APR_WAIT); ABTS_INT_EQUAL(tc, APR_CHILD_DONE, rv); ABTS_INT_EQUAL(tc, APR_PROC_EXIT, why); @@ -212,7 +212,7 @@ static void test_named(abts_case *tc, void *data) * without having to cleanup manually. */ APR_ASSERT_SUCCESS(tc, "Error destroying shared memory", - apr_shm_destroy(shm)); + fspr_shm_destroy(shm)); ABTS_INT_EQUAL(tc, sent, received); @@ -220,32 +220,32 @@ static void test_named(abts_case *tc, void *data) static void test_named_remove(abts_case *tc, void *data) { - apr_status_t rv; - apr_shm_t *shm; + fspr_status_t rv; + fspr_shm_t *shm; - apr_shm_remove(SHARED_FILENAME, p); + fspr_shm_remove(SHARED_FILENAME, p); - rv = apr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, p); + rv = fspr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); if (rv != APR_SUCCESS) { return; } ABTS_PTR_NOTNULL(tc, shm); - rv = apr_shm_remove(SHARED_FILENAME, p); + rv = fspr_shm_remove(SHARED_FILENAME, p); APR_ASSERT_SUCCESS(tc, "Error removing shared memory block", rv); if (rv != APR_SUCCESS) { return ; } - rv = apr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, p); + rv = fspr_shm_create(&shm, SHARED_SIZE, SHARED_FILENAME, p); APR_ASSERT_SUCCESS(tc, "Error allocating shared memory block", rv); if (rv != APR_SUCCESS) { return; } ABTS_PTR_NOTNULL(tc, shm); - rv = apr_shm_destroy(shm); + rv = fspr_shm_destroy(shm); APR_ASSERT_SUCCESS(tc, "Error destroying shared memory block", rv); } diff --git a/libs/apr/test/testshm.h b/libs/apr/test/testshm.h index 5b24a9d427..efcfc062de 100644 --- a/libs/apr/test/testshm.h +++ b/libs/apr/test/testshm.h @@ -24,7 +24,7 @@ typedef struct mbox { mbox *boxes; #define N_BOXES 10 -#define SHARED_SIZE (apr_size_t)(N_BOXES * sizeof(mbox)) +#define SHARED_SIZE (fspr_size_t)(N_BOXES * sizeof(mbox)) #define SHARED_FILENAME "data/apr.testshm.shm" #define N_MESSAGES 100 #define MSG "Sending a message" diff --git a/libs/apr/test/testshmconsumer.c b/libs/apr/test/testshmconsumer.c index 6a2a3c30d3..5e67e837b9 100644 --- a/libs/apr/test/testshmconsumer.c +++ b/libs/apr/test/testshmconsumer.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_shm.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_time.h" +#include "fspr_shm.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_time.h" #include "testshm.h" -#include "apr.h" +#include "fspr.h" #if APR_HAVE_STDLIB_H #include @@ -34,9 +34,9 @@ static int msgwait(int sleep_sec, int first_box, int last_box) { int i; int recvd = 0; - apr_time_t start = apr_time_now(); - apr_interval_time_t sleep_duration = apr_time_from_sec(sleep_sec); - while (apr_time_now() - start < sleep_duration) { + fspr_time_t start = fspr_time_now(); + fspr_interval_time_t sleep_duration = fspr_time_from_sec(sleep_sec); + while (fspr_time_now() - start < sleep_duration) { for (i = first_box; i < last_box; i++) { if (boxes[i].msgavail && !strcmp(boxes[i].msg, MSG)) { recvd++; @@ -44,35 +44,35 @@ static int msgwait(int sleep_sec, int first_box, int last_box) memset(boxes[i].msg, 0, 1024); } } - apr_sleep(apr_time_from_sec(1)); + fspr_sleep(fspr_time_from_sec(1)); } return recvd; } int main(void) { - apr_status_t rv; - apr_pool_t *pool; - apr_shm_t *shm; + fspr_status_t rv; + fspr_pool_t *pool; + fspr_shm_t *shm; int recvd; - apr_initialize(); + fspr_initialize(); - if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { + if (fspr_pool_create(&pool, NULL) != APR_SUCCESS) { exit(-1); } - rv = apr_shm_attach(&shm, SHARED_FILENAME, pool); + rv = fspr_shm_attach(&shm, SHARED_FILENAME, pool); if (rv != APR_SUCCESS) { exit(-2); } - boxes = apr_shm_baseaddr_get(shm); + boxes = fspr_shm_baseaddr_get(shm); /* consume messages on all of the boxes */ recvd = msgwait(30, 0, N_BOXES); /* wait for 30 seconds for messages */ - rv = apr_shm_detach(shm); + rv = fspr_shm_detach(shm); if (rv != APR_SUCCESS) { exit(-3); } diff --git a/libs/apr/test/testshmproducer.c b/libs/apr/test/testshmproducer.c index 58eb94fcd3..70073db7bd 100644 --- a/libs/apr/test/testshmproducer.c +++ b/libs/apr/test/testshmproducer.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_shm.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_time.h" +#include "fspr_shm.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_time.h" #include "testshm.h" -#include "apr.h" +#include "fspr.h" #if APR_HAVE_STDLIB_H #include @@ -31,30 +31,30 @@ #if APR_HAS_SHARED_MEMORY static void msgput(int boxnum, char *msg) { - apr_cpystrn(boxes[boxnum].msg, msg, strlen(msg) + 1); + fspr_cpystrn(boxes[boxnum].msg, msg, strlen(msg) + 1); boxes[boxnum].msgavail = 1; } int main(void) { - apr_status_t rv; - apr_pool_t *pool; - apr_shm_t *shm; + fspr_status_t rv; + fspr_pool_t *pool; + fspr_shm_t *shm; int i; int sent = 0; - apr_initialize(); + fspr_initialize(); - if (apr_pool_create(&pool, NULL) != APR_SUCCESS) { + if (fspr_pool_create(&pool, NULL) != APR_SUCCESS) { exit(-1); } - rv = apr_shm_attach(&shm, SHARED_FILENAME, pool); + rv = fspr_shm_attach(&shm, SHARED_FILENAME, pool); if (rv != APR_SUCCESS) { exit(-2); } - boxes = apr_shm_baseaddr_get(shm); + boxes = fspr_shm_baseaddr_get(shm); /* produce messages on all of the boxes, in descending order, * Yes, we could just return N_BOXES, but I want to have a double-check @@ -64,10 +64,10 @@ int main(void) */ for (i = N_BOXES - 1, sent = 0; i >= 0; i--, sent++) { msgput(i, MSG); - apr_sleep(apr_time_from_sec(1)); + fspr_sleep(fspr_time_from_sec(1)); } - rv = apr_shm_detach(shm); + rv = fspr_shm_detach(shm); if (rv != APR_SUCCESS) { exit(-3); } diff --git a/libs/apr/test/testsleep.c b/libs/apr/test/testsleep.c index d50cc1b49d..6112a85907 100644 --- a/libs/apr/test/testsleep.c +++ b/libs/apr/test/testsleep.c @@ -15,10 +15,10 @@ */ #include "time.h" -#include "apr_thread_proc.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" +#include "fspr_thread_proc.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" #include #include #include @@ -32,7 +32,7 @@ static void sleep_one(abts_case *tc, void *data) time_t posttime; time_t timediff; - apr_sleep(apr_time_from_sec(SLEEP_INTERVAL)); + fspr_sleep(fspr_time_from_sec(SLEEP_INTERVAL)); posttime = time(NULL); /* normalize the timediff. We should have slept for SLEEP_INTERVAL, so diff --git a/libs/apr/test/testsock.c b/libs/apr/test/testsock.c index 7c1759e924..f731630dc3 100644 --- a/libs/apr/test/testsock.c +++ b/libs/apr/test/testsock.c @@ -16,45 +16,45 @@ #include "testutil.h" #include "testsock.h" -#include "apr_thread_proc.h" -#include "apr_network_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" -#include "apr_poll.h" +#include "fspr_thread_proc.h" +#include "fspr_network_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" +#include "fspr_poll.h" -static void launch_child(abts_case *tc, apr_proc_t *proc, const char *arg1, apr_pool_t *p) +static void launch_child(abts_case *tc, fspr_proc_t *proc, const char *arg1, fspr_pool_t *p) { - apr_procattr_t *procattr; + fspr_procattr_t *procattr; const char *args[3]; - apr_status_t rv; + fspr_status_t rv; - rv = apr_procattr_create(&procattr, p); + rv = fspr_procattr_create(&procattr, p); APR_ASSERT_SUCCESS(tc, "Couldn't create procattr", rv); - rv = apr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, + rv = fspr_procattr_io_set(procattr, APR_NO_PIPE, APR_NO_PIPE, APR_NO_PIPE); APR_ASSERT_SUCCESS(tc, "Couldn't set io in procattr", rv); - rv = apr_procattr_error_check_set(procattr, 1); + rv = fspr_procattr_error_check_set(procattr, 1); APR_ASSERT_SUCCESS(tc, "Couldn't set error check in procattr", rv); args[0] = "sockchild" EXTENSION; args[1] = arg1; args[2] = NULL; - rv = apr_proc_create(proc, "./sockchild" EXTENSION, args, NULL, + rv = fspr_proc_create(proc, "./sockchild" EXTENSION, args, NULL, procattr, p); APR_ASSERT_SUCCESS(tc, "Couldn't launch program", rv); } -static int wait_child(abts_case *tc, apr_proc_t *proc) +static int wait_child(abts_case *tc, fspr_proc_t *proc) { int exitcode; - apr_exit_why_e why; + fspr_exit_why_e why; ABTS_ASSERT(tc, "Error waiting for child process", - apr_proc_wait(proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE); + fspr_proc_wait(proc, &exitcode, &why, APR_WAIT) == APR_CHILD_DONE); ABTS_ASSERT(tc, "child terminated normally", why == APR_PROC_EXIT); return exitcode; @@ -62,37 +62,37 @@ static int wait_child(abts_case *tc, apr_proc_t *proc) static void test_addr_info(abts_case *tc, void *data) { - apr_status_t rv; - apr_sockaddr_t *sa; + fspr_status_t rv; + fspr_sockaddr_t *sa; - rv = apr_sockaddr_info_get(&sa, NULL, APR_UNSPEC, 80, 0, p); + rv = fspr_sockaddr_info_get(&sa, NULL, APR_UNSPEC, 80, 0, p); APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv); - rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_UNSPEC, 80, 0, p); + rv = fspr_sockaddr_info_get(&sa, "127.0.0.1", APR_UNSPEC, 80, 0, p); APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv); ABTS_STR_EQUAL(tc, "127.0.0.1", sa->hostname); } -static apr_socket_t *setup_socket(abts_case *tc) +static fspr_socket_t *setup_socket(abts_case *tc) { - apr_status_t rv; - apr_sockaddr_t *sa; - apr_socket_t *sock; + fspr_status_t rv; + fspr_sockaddr_t *sa; + fspr_socket_t *sock; - rv = apr_sockaddr_info_get(&sa, "127.0.0.1", APR_INET, 8021, 0, p); + rv = fspr_sockaddr_info_get(&sa, "127.0.0.1", APR_INET, 8021, 0, p); APR_ASSERT_SUCCESS(tc, "Problem generating sockaddr", rv); - rv = apr_socket_create(&sock, sa->family, SOCK_STREAM, APR_PROTO_TCP, p); + rv = fspr_socket_create(&sock, sa->family, SOCK_STREAM, APR_PROTO_TCP, p); APR_ASSERT_SUCCESS(tc, "Problem creating socket", rv); - rv = apr_socket_opt_set(sock, APR_SO_REUSEADDR, 1); + rv = fspr_socket_opt_set(sock, APR_SO_REUSEADDR, 1); APR_ASSERT_SUCCESS(tc, "Could not set REUSEADDR on socket", rv); - rv = apr_socket_bind(sock, sa); + rv = fspr_socket_bind(sock, sa); APR_ASSERT_SUCCESS(tc, "Problem binding to port", rv); if (rv) return NULL; - rv = apr_socket_listen(sock, 5); + rv = fspr_socket_listen(sock, 5); APR_ASSERT_SUCCESS(tc, "Problem listening on socket", rv); return sock; @@ -100,55 +100,55 @@ static apr_socket_t *setup_socket(abts_case *tc) static void test_create_bind_listen(abts_case *tc, void *data) { - apr_status_t rv; - apr_socket_t *sock = setup_socket(tc); + fspr_status_t rv; + fspr_socket_t *sock = setup_socket(tc); if (!sock) return; - rv = apr_socket_close(sock); + rv = fspr_socket_close(sock); APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv); } static void test_send(abts_case *tc, void *data) { - apr_status_t rv; - apr_socket_t *sock; - apr_socket_t *sock2; - apr_proc_t proc; + fspr_status_t rv; + fspr_socket_t *sock; + fspr_socket_t *sock2; + fspr_proc_t proc; int protocol; - apr_size_t length; + fspr_size_t length; sock = setup_socket(tc); if (!sock) return; launch_child(tc, &proc, "read", p); - rv = apr_socket_accept(&sock2, sock, p); + rv = fspr_socket_accept(&sock2, sock, p); APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv); - apr_socket_protocol_get(sock2, &protocol); + fspr_socket_protocol_get(sock2, &protocol); ABTS_INT_EQUAL(tc, APR_PROTO_TCP, protocol); length = strlen(DATASTR); - apr_socket_send(sock2, DATASTR, &length); + fspr_socket_send(sock2, DATASTR, &length); /* Make sure that the client received the data we sent */ ABTS_INT_EQUAL(tc, strlen(DATASTR), wait_child(tc, &proc)); - rv = apr_socket_close(sock2); + rv = fspr_socket_close(sock2); APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv); - rv = apr_socket_close(sock); + rv = fspr_socket_close(sock); APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv); } static void test_recv(abts_case *tc, void *data) { - apr_status_t rv; - apr_socket_t *sock; - apr_socket_t *sock2; - apr_proc_t proc; + fspr_status_t rv; + fspr_socket_t *sock; + fspr_socket_t *sock2; + fspr_proc_t proc; int protocol; - apr_size_t length = STRLEN; + fspr_size_t length = STRLEN; char datastr[STRLEN]; sock = setup_socket(tc); @@ -156,31 +156,31 @@ static void test_recv(abts_case *tc, void *data) launch_child(tc, &proc, "write", p); - rv = apr_socket_accept(&sock2, sock, p); + rv = fspr_socket_accept(&sock2, sock, p); APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv); - apr_socket_protocol_get(sock2, &protocol); + fspr_socket_protocol_get(sock2, &protocol); ABTS_INT_EQUAL(tc, APR_PROTO_TCP, protocol); memset(datastr, 0, STRLEN); - apr_socket_recv(sock2, datastr, &length); + fspr_socket_recv(sock2, datastr, &length); /* Make sure that the server received the data we sent */ ABTS_STR_EQUAL(tc, DATASTR, datastr); ABTS_INT_EQUAL(tc, strlen(datastr), wait_child(tc, &proc)); - rv = apr_socket_close(sock2); + rv = fspr_socket_close(sock2); APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv); - rv = apr_socket_close(sock); + rv = fspr_socket_close(sock); APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv); } static void test_timeout(abts_case *tc, void *data) { - apr_status_t rv; - apr_socket_t *sock; - apr_socket_t *sock2; - apr_proc_t proc; + fspr_status_t rv; + fspr_socket_t *sock; + fspr_socket_t *sock2; + fspr_proc_t proc; int protocol; int exit; @@ -189,10 +189,10 @@ static void test_timeout(abts_case *tc, void *data) launch_child(tc, &proc, "read", p); - rv = apr_socket_accept(&sock2, sock, p); + rv = fspr_socket_accept(&sock2, sock, p); APR_ASSERT_SUCCESS(tc, "Problem with receiving connection", rv); - apr_socket_protocol_get(sock2, &protocol); + fspr_socket_protocol_get(sock2, &protocol); ABTS_INT_EQUAL(tc, APR_PROTO_TCP, protocol); exit = wait_child(tc, &proc); @@ -201,57 +201,57 @@ static void test_timeout(abts_case *tc, void *data) /* We didn't write any data, so make sure the child program returns * an error. */ - rv = apr_socket_close(sock2); + rv = fspr_socket_close(sock2); APR_ASSERT_SUCCESS(tc, "Problem closing connected socket", rv); - rv = apr_socket_close(sock); + rv = fspr_socket_close(sock); APR_ASSERT_SUCCESS(tc, "Problem closing socket", rv); } static void test_get_addr(abts_case *tc, void *data) { - apr_status_t rv; - apr_socket_t *ld, *sd, *cd; - apr_sockaddr_t *sa, *ca; + fspr_status_t rv; + fspr_socket_t *ld, *sd, *cd; + fspr_sockaddr_t *sa, *ca; char a[128], b[128]; ld = setup_socket(tc); APR_ASSERT_SUCCESS(tc, "get local address of bound socket", - apr_socket_addr_get(&sa, APR_LOCAL, ld)); + fspr_socket_addr_get(&sa, APR_LOCAL, ld)); - rv = apr_socket_create(&cd, sa->family, SOCK_STREAM, + rv = fspr_socket_create(&cd, sa->family, SOCK_STREAM, APR_PROTO_TCP, p); APR_ASSERT_SUCCESS(tc, "create client socket", rv); APR_ASSERT_SUCCESS(tc, "enable non-block mode", - apr_socket_opt_set(cd, APR_SO_NONBLOCK, 1)); + fspr_socket_opt_set(cd, APR_SO_NONBLOCK, 1)); /* It is valid for a connect() on a socket with NONBLOCK set to * succeed (if the connection can be established synchronously), * but if it does, this test cannot proceed. */ - rv = apr_socket_connect(cd, sa); + rv = fspr_socket_connect(cd, sa); if (rv == APR_SUCCESS) { - apr_socket_close(ld); - apr_socket_close(cd); + fspr_socket_close(ld); + fspr_socket_close(cd); ABTS_NOT_IMPL(tc, "Cannot test if connect completes " "synchronously"); return; } if (!APR_STATUS_IS_EINPROGRESS(rv)) { - apr_socket_close(ld); - apr_socket_close(cd); + fspr_socket_close(ld); + fspr_socket_close(cd); APR_ASSERT_SUCCESS(tc, "connect to listener", rv); return; } APR_ASSERT_SUCCESS(tc, "accept connection", - apr_socket_accept(&sd, ld, p)); + fspr_socket_accept(&sd, ld, p)); { /* wait for writability */ - apr_pollfd_t pfd; + fspr_pollfd_t pfd; int n; pfd.p = p; @@ -261,24 +261,24 @@ static void test_get_addr(abts_case *tc, void *data) pfd.client_data = NULL; APR_ASSERT_SUCCESS(tc, "poll for connect completion", - apr_poll(&pfd, 1, &n, 5 * APR_USEC_PER_SEC)); + fspr_poll(&pfd, 1, &n, 5 * APR_USEC_PER_SEC)); } APR_ASSERT_SUCCESS(tc, "get local address of server socket", - apr_socket_addr_get(&sa, APR_LOCAL, sd)); + fspr_socket_addr_get(&sa, APR_LOCAL, sd)); APR_ASSERT_SUCCESS(tc, "get remote address of client socket", - apr_socket_addr_get(&ca, APR_REMOTE, cd)); + fspr_socket_addr_get(&ca, APR_REMOTE, cd)); - apr_snprintf(a, sizeof(a), "%pI", sa); - apr_snprintf(b, sizeof(b), "%pI", ca); + fspr_snprintf(a, sizeof(a), "%pI", sa); + fspr_snprintf(b, sizeof(b), "%pI", ca); ABTS_STR_EQUAL(tc, a, b); - apr_socket_close(cd); - apr_socket_close(sd); - apr_socket_close(ld); + fspr_socket_close(cd); + fspr_socket_close(sd); + fspr_socket_close(ld); } abts_suite *testsock(abts_suite *suite) diff --git a/libs/apr/test/testsockets.c b/libs/apr/test/testsockets.c index 6328af8d9b..9337886ab7 100644 --- a/libs/apr/test/testsockets.c +++ b/libs/apr/test/testsockets.c @@ -14,46 +14,46 @@ * limitations under the License. */ -#include "apr_network_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" +#include "fspr_network_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" #include "testutil.h" #define STRLEN 21 static void tcp_socket(abts_case *tc, void *data) { - apr_status_t rv; - apr_socket_t *sock = NULL; + fspr_status_t rv; + fspr_socket_t *sock = NULL; int type; - rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, 0, p); + rv = fspr_socket_create(&sock, APR_INET, SOCK_STREAM, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, sock); - rv = apr_socket_type_get(sock, &type); + rv = fspr_socket_type_get(sock, &type); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, SOCK_STREAM, type); - apr_socket_close(sock); + fspr_socket_close(sock); } static void udp_socket(abts_case *tc, void *data) { - apr_status_t rv; - apr_socket_t *sock = NULL; + fspr_status_t rv; + fspr_socket_t *sock = NULL; int type; - rv = apr_socket_create(&sock, APR_INET, SOCK_DGRAM, 0, p); + rv = fspr_socket_create(&sock, APR_INET, SOCK_DGRAM, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, sock); - rv = apr_socket_type_get(sock, &type); + rv = fspr_socket_type_get(sock, &type); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, SOCK_DGRAM, type); - apr_socket_close(sock); + fspr_socket_close(sock); } /* On recent Linux systems, whilst IPv6 is always supported by glibc, @@ -68,17 +68,17 @@ static void udp_socket(abts_case *tc, void *data) static void tcp6_socket(abts_case *tc, void *data) { #if APR_HAVE_IPV6 - apr_status_t rv; - apr_socket_t *sock = NULL; + fspr_status_t rv; + fspr_socket_t *sock = NULL; - rv = apr_socket_create(&sock, APR_INET6, SOCK_STREAM, 0, p); + rv = fspr_socket_create(&sock, APR_INET6, SOCK_STREAM, 0, p); if (V6_NOT_ENABLED(rv)) { ABTS_NOT_IMPL(tc, "IPv6 not enabled"); return; } ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, sock); - apr_socket_close(sock); + fspr_socket_close(sock); #else ABTS_NOT_IMPL(tc, "IPv6"); #endif @@ -87,17 +87,17 @@ static void tcp6_socket(abts_case *tc, void *data) static void udp6_socket(abts_case *tc, void *data) { #if APR_HAVE_IPV6 - apr_status_t rv; - apr_socket_t *sock = NULL; + fspr_status_t rv; + fspr_socket_t *sock = NULL; - rv = apr_socket_create(&sock, APR_INET6, SOCK_DGRAM, 0, p); + rv = fspr_socket_create(&sock, APR_INET6, SOCK_DGRAM, 0, p); if (V6_NOT_ENABLED(rv)) { ABTS_NOT_IMPL(tc, "IPv6 not enabled"); return; } ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, sock); - apr_socket_close(sock); + fspr_socket_close(sock); #else ABTS_NOT_IMPL(tc, "IPv6"); #endif @@ -105,91 +105,91 @@ static void udp6_socket(abts_case *tc, void *data) static void sendto_receivefrom(abts_case *tc, void *data) { - apr_status_t rv; - apr_socket_t *sock = NULL; - apr_socket_t *sock2 = NULL; + fspr_status_t rv; + fspr_socket_t *sock = NULL; + fspr_socket_t *sock2 = NULL; char sendbuf[STRLEN] = "APR_INET, SOCK_DGRAM"; char recvbuf[80]; char *ip_addr; - apr_port_t fromport; - apr_sockaddr_t *from; - apr_sockaddr_t *to; - apr_size_t len = 30; + fspr_port_t fromport; + fspr_sockaddr_t *from; + fspr_sockaddr_t *to; + fspr_size_t len = 30; int family; const char *addr; #if APR_HAVE_IPV6 family = APR_INET6; addr = "::1"; - rv = apr_socket_create(&sock, family, SOCK_DGRAM, 0, p); + rv = fspr_socket_create(&sock, family, SOCK_DGRAM, 0, p); if (V6_NOT_ENABLED(rv)) { #endif family = APR_INET; addr = "127.0.0.1"; - rv = apr_socket_create(&sock, family, SOCK_DGRAM, 0, p); + rv = fspr_socket_create(&sock, family, SOCK_DGRAM, 0, p); #if APR_HAVE_IPV6 } #endif ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_create(&sock2, family, SOCK_DGRAM, 0, p); + rv = fspr_socket_create(&sock2, family, SOCK_DGRAM, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_sockaddr_info_get(&to, addr, APR_UNSPEC, 7772, 0, p); + rv = fspr_sockaddr_info_get(&to, addr, APR_UNSPEC, 7772, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_sockaddr_info_get(&from, addr, APR_UNSPEC, 7771, 0, p); + rv = fspr_sockaddr_info_get(&from, addr, APR_UNSPEC, 7771, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_opt_set(sock, APR_SO_REUSEADDR, 1); + rv = fspr_socket_opt_set(sock, APR_SO_REUSEADDR, 1); APR_ASSERT_SUCCESS(tc, "Could not set REUSEADDR on socket", rv); - rv = apr_socket_opt_set(sock2, APR_SO_REUSEADDR, 1); + rv = fspr_socket_opt_set(sock2, APR_SO_REUSEADDR, 1); APR_ASSERT_SUCCESS(tc, "Could not set REUSEADDR on socket2", rv); - rv = apr_socket_bind(sock, to); + rv = fspr_socket_bind(sock, to); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_bind(sock2, from); + rv = fspr_socket_bind(sock2, from); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); len = STRLEN; - rv = apr_socket_sendto(sock2, to, 0, sendbuf, &len); + rv = fspr_socket_sendto(sock2, to, 0, sendbuf, &len); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, STRLEN, len); len = 80; - rv = apr_socket_recvfrom(from, sock, 0, recvbuf, &len); + rv = fspr_socket_recvfrom(from, sock, 0, recvbuf, &len); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, STRLEN, len); ABTS_STR_EQUAL(tc, "APR_INET, SOCK_DGRAM", recvbuf); - apr_sockaddr_ip_get(&ip_addr, from); + fspr_sockaddr_ip_get(&ip_addr, from); fromport = from->port; ABTS_STR_EQUAL(tc, addr, ip_addr); ABTS_INT_EQUAL(tc, 7771, fromport); - apr_socket_close(sock); - apr_socket_close(sock2); + fspr_socket_close(sock); + fspr_socket_close(sock2); } static void socket_userdata(abts_case *tc, void *data) { - apr_socket_t *sock1, *sock2; - apr_status_t rv; + fspr_socket_t *sock1, *sock2; + fspr_status_t rv; void *user; const char *key = "GENERICKEY"; - rv = apr_socket_create(&sock1, AF_INET, SOCK_STREAM, 0, p); + rv = fspr_socket_create(&sock1, AF_INET, SOCK_STREAM, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_create(&sock2, AF_INET, SOCK_STREAM, 0, p); + rv = fspr_socket_create(&sock2, AF_INET, SOCK_STREAM, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_data_set(sock1, "SOCK1", key, NULL); + rv = fspr_socket_data_set(sock1, "SOCK1", key, NULL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_data_set(sock2, "SOCK2", key, NULL); + rv = fspr_socket_data_set(sock2, "SOCK2", key, NULL); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_data_get(&user, key, sock1); + rv = fspr_socket_data_get(&user, key, sock1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, "SOCK1", user); - rv = apr_socket_data_get(&user, key, sock2); + rv = fspr_socket_data_get(&user, key, sock2); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_STR_EQUAL(tc, "SOCK2", user); } diff --git a/libs/apr/test/testsockopt.c b/libs/apr/test/testsockopt.c index 203e2c39ff..9328bfd340 100644 --- a/libs/apr/test/testsockopt.c +++ b/libs/apr/test/testsockopt.c @@ -14,45 +14,45 @@ * limitations under the License. */ -#include "apr_network_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" +#include "fspr_network_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" #include "testutil.h" -static apr_socket_t *sock = NULL; +static fspr_socket_t *sock = NULL; static void create_socket(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_socket_create(&sock, APR_INET, SOCK_STREAM, 0, p); + rv = fspr_socket_create(&sock, APR_INET, SOCK_STREAM, 0, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_PTR_NOTNULL(tc, sock); } static void set_keepalive(abts_case *tc, void *data) { - apr_status_t rv; - apr_int32_t ck; + fspr_status_t rv; + fspr_int32_t ck; - rv = apr_socket_opt_set(sock, APR_SO_KEEPALIVE, 1); + rv = fspr_socket_opt_set(sock, APR_SO_KEEPALIVE, 1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck); + rv = fspr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, ck); } static void set_debug(abts_case *tc, void *data) { - apr_status_t rv1, rv2; - apr_int32_t ck; + fspr_status_t rv1, rv2; + fspr_int32_t ck; /* On some platforms APR_SO_DEBUG can only be set as root; just test * for get/set consistency of this option. */ - rv1 = apr_socket_opt_set(sock, APR_SO_DEBUG, 1); - rv2 = apr_socket_opt_get(sock, APR_SO_DEBUG, &ck); + rv1 = fspr_socket_opt_set(sock, APR_SO_DEBUG, 1); + rv2 = fspr_socket_opt_get(sock, APR_SO_DEBUG, &ck); APR_ASSERT_SUCCESS(tc, "get SO_DEBUG option", rv2); if (rv1 == APR_SUCCESS) { ABTS_INT_EQUAL(tc, 1, ck); @@ -63,17 +63,17 @@ static void set_debug(abts_case *tc, void *data) static void remove_keepalive(abts_case *tc, void *data) { - apr_status_t rv; - apr_int32_t ck; + fspr_status_t rv; + fspr_int32_t ck; - rv = apr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck); + rv = fspr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, ck); - rv = apr_socket_opt_set(sock, APR_SO_KEEPALIVE, 0); + rv = fspr_socket_opt_set(sock, APR_SO_KEEPALIVE, 0); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck); + rv = fspr_socket_opt_get(sock, APR_SO_KEEPALIVE, &ck); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 0, ck); } @@ -83,33 +83,33 @@ static void corkable(abts_case *tc, void *data) #if !APR_HAVE_CORKABLE_TCP ABTS_NOT_IMPL(tc, "TCP isn't corkable"); #else - apr_status_t rv; - apr_int32_t ck; + fspr_status_t rv; + fspr_int32_t ck; - rv = apr_socket_opt_set(sock, APR_TCP_NODELAY, 1); + rv = fspr_socket_opt_set(sock, APR_TCP_NODELAY, 1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_opt_get(sock, APR_TCP_NODELAY, &ck); + rv = fspr_socket_opt_get(sock, APR_TCP_NODELAY, &ck); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, ck); - rv = apr_socket_opt_set(sock, APR_TCP_NOPUSH, 1); + rv = fspr_socket_opt_set(sock, APR_TCP_NOPUSH, 1); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_opt_get(sock, APR_TCP_NOPUSH, &ck); + rv = fspr_socket_opt_get(sock, APR_TCP_NOPUSH, &ck); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, ck); - rv = apr_socket_opt_get(sock, APR_TCP_NODELAY, &ck); + rv = fspr_socket_opt_get(sock, APR_TCP_NODELAY, &ck); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); /* TCP_NODELAY is now in an unknown state; it may be zero if * TCP_NOPUSH and TCP_NODELAY are mutually exclusive on this * platform, e.g. Linux < 2.6. */ - rv = apr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); + rv = fspr_socket_opt_set(sock, APR_TCP_NOPUSH, 0); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_socket_opt_get(sock, APR_TCP_NODELAY, &ck); + rv = fspr_socket_opt_get(sock, APR_TCP_NODELAY, &ck); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); ABTS_INT_EQUAL(tc, 1, ck); #endif @@ -117,9 +117,9 @@ static void corkable(abts_case *tc, void *data) static void close_socket(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_socket_close(sock); + rv = fspr_socket_close(sock); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } diff --git a/libs/apr/test/teststr.c b/libs/apr/test/teststr.c index ec382c343a..4ed57dec4f 100644 --- a/libs/apr/test/teststr.c +++ b/libs/apr/test/teststr.c @@ -25,9 +25,9 @@ #include #endif -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_errno.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_errno.h" /* I haven't bothered to check for APR_ENOTIMPL here, AFAIK, all string * functions exist on all platforms. @@ -49,7 +49,7 @@ static void test_strtok(abts_case *tc, void *data) " \r\n\3\2\1" }, { - NULL, /* but who cares if apr_strtok() segfaults? */ + NULL, /* but who cares if fspr_strtok() segfaults? */ " \t" }, #if 0 /* don't do this... you deserve to segfault */ @@ -74,11 +74,11 @@ static void test_strtok(abts_case *tc, void *data) char *str1, *str2; char *state; - str1 = apr_pstrdup(p, cases[curtc].input); - str2 = apr_pstrdup(p, cases[curtc].input); + str1 = fspr_pstrdup(p, cases[curtc].input); + str2 = fspr_pstrdup(p, cases[curtc].input); do { - retval1 = apr_strtok(str1, cases[curtc].sep, &state); + retval1 = fspr_strtok(str1, cases[curtc].sep, &state); retval2 = strtok(str2, cases[curtc].sep); if (!retval1) { @@ -97,7 +97,7 @@ static void test_strtok(abts_case *tc, void *data) static void snprintf_noNULL(abts_case *tc, void *data) { char buff[100]; - char *testing = apr_palloc(p, 10); + char *testing = fspr_palloc(p, 10); testing[0] = 't'; testing[1] = 'e'; @@ -108,7 +108,7 @@ static void snprintf_noNULL(abts_case *tc, void *data) testing[6] = 'g'; /* If this test fails, we are going to seg fault. */ - apr_snprintf(buff, sizeof(buff), "%.*s", 7, testing); + fspr_snprintf(buff, sizeof(buff), "%.*s", 7, testing); ABTS_STR_NEQUAL(tc, buff, testing, 7); } @@ -116,7 +116,7 @@ static void snprintf_0NULL(abts_case *tc, void *data) { int rv; - rv = apr_snprintf(NULL, 0, "%sBAR", "FOO"); + rv = fspr_snprintf(NULL, 0, "%sBAR", "FOO"); ABTS_INT_EQUAL(tc, 6, rv); } @@ -125,7 +125,7 @@ static void snprintf_0nonNULL(abts_case *tc, void *data) int rv; char *buff = "testing"; - rv = apr_snprintf(buff, 0, "%sBAR", "FOO"); + rv = fspr_snprintf(buff, 0, "%sBAR", "FOO"); ABTS_INT_EQUAL(tc, 6, rv); ABTS_ASSERT(tc, "buff unmangled", strcmp(buff, "FOOBAR") != 0); } @@ -135,15 +135,15 @@ static void snprintf_underflow(abts_case *tc, void *data) char buf[20]; int rv; - rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.0001); + rv = fspr_snprintf(buf, sizeof buf, "%.2f", (double)0.0001); ABTS_INT_EQUAL(tc, 4, rv); ABTS_STR_EQUAL(tc, "0.00", buf); - rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.001); + rv = fspr_snprintf(buf, sizeof buf, "%.2f", (double)0.001); ABTS_INT_EQUAL(tc, 4, rv); ABTS_STR_EQUAL(tc, "0.00", buf); - rv = apr_snprintf(buf, sizeof buf, "%.2f", (double)0.01); + rv = fspr_snprintf(buf, sizeof buf, "%.2f", (double)0.01); ABTS_INT_EQUAL(tc, 4, rv); ABTS_STR_EQUAL(tc, "0.01", buf); } @@ -151,20 +151,20 @@ static void snprintf_underflow(abts_case *tc, void *data) static void string_error(abts_case *tc, void *data) { char buf[128], *rv; - apr_status_t n; + fspr_status_t n; buf[0] = '\0'; - rv = apr_strerror(APR_ENOENT, buf, sizeof buf); + rv = fspr_strerror(APR_ENOENT, buf, sizeof buf); ABTS_PTR_EQUAL(tc, buf, rv); ABTS_TRUE(tc, strlen(buf) > 0); - rv = apr_strerror(APR_TIMEUP, buf, sizeof buf); + rv = fspr_strerror(APR_TIMEUP, buf, sizeof buf); ABTS_PTR_EQUAL(tc, buf, rv); ABTS_STR_EQUAL(tc, "The timeout specified has expired", buf); /* throw some randomish numbers at it to check for robustness */ for (n = 1; n < 1000000; n *= 2) { - apr_strerror(n, buf, sizeof buf); + fspr_strerror(n, buf, sizeof buf); } } @@ -176,10 +176,10 @@ static void string_long(abts_case *tc, void *data) memset(s, 'A', SIZE); s[SIZE] = '\0'; - apr_psprintf(p, "%s", s); + fspr_psprintf(p, "%s", s); } -/* ### FIXME: apr.h/apr_strings.h should provide these! */ +/* ### FIXME: apr.h/fspr_strings.h should provide these! */ #define MY_LLONG_MAX (APR_INT64_C(9223372036854775807)) #define MY_LLONG_MIN (-MY_LLONG_MAX - APR_INT64_C(1)) @@ -188,7 +188,7 @@ static void string_strtoi64(abts_case *tc, void *data) static const struct { int errnum, base; const char *in, *end; - apr_int64_t result; + fspr_int64_t result; } ts[] = { /* base 10 tests */ @@ -243,22 +243,22 @@ static void string_strtoi64(abts_case *tc, void *data) for (n = 0; n < sizeof(ts)/sizeof(ts[0]); n++) { char *end = "end ptr not changed"; - apr_int64_t result; + fspr_int64_t result; int errnum; errno = 0; - result = apr_strtoi64(ts[n].in, &end, ts[n].base); + result = fspr_strtoi64(ts[n].in, &end, ts[n].base); errnum = errno; ABTS_ASSERT(tc, - apr_psprintf(p, "for '%s': result was %" APR_INT64_T_FMT + fspr_psprintf(p, "for '%s': result was %" APR_INT64_T_FMT " not %" APR_INT64_T_FMT, ts[n].in, result, ts[n].result), result == ts[n].result); if (ts[n].errnum != -1) { ABTS_ASSERT(tc, - apr_psprintf(p, "for '%s': errno was %d not %d", ts[n].in, + fspr_psprintf(p, "for '%s': errno was %d not %d", ts[n].in, errnum, ts[n].errnum), ts[n].errnum == errnum); } @@ -268,7 +268,7 @@ static void string_strtoi64(abts_case *tc, void *data) ABTS_PTR_EQUAL(tc, ts[n].in + strlen(ts[n].in), end); } else if (ts[n].end != (void *)-1) { ABTS_ASSERT(tc, - apr_psprintf(p, "for '%s', end was '%s' not '%s'", + fspr_psprintf(p, "for '%s', end was '%s' not '%s'", ts[n].in, end, ts[n].end), strcmp(ts[n].end, end) == 0); } @@ -277,14 +277,14 @@ static void string_strtoi64(abts_case *tc, void *data) static void string_strtoff(abts_case *tc, void *data) { - apr_off_t off; + fspr_off_t off; ABTS_ASSERT(tc, "strtoff fails on out-of-range integer", - apr_strtoff(&off, "999999999999999999999999999999", + fspr_strtoff(&off, "999999999999999999999999999999", NULL, 10) != APR_SUCCESS); ABTS_ASSERT(tc, "strtoff failed for 1234", - apr_strtoff(&off, "1234", NULL, 10) == APR_SUCCESS); + fspr_strtoff(&off, "1234", NULL, 10) == APR_SUCCESS); ABTS_ASSERT(tc, "strtoff failed to parse 1234", off == 1234); } @@ -292,25 +292,25 @@ static void string_strtoff(abts_case *tc, void *data) /* random-ish checks for strfsize buffer overflows */ static void overflow_strfsize(abts_case *tc, void *data) { - apr_off_t off; + fspr_off_t off; char buf[7]; buf[5] = '$'; buf[6] = '@'; for (off = -9999; off < 20000; off++) { - apr_strfsize(off, buf); + fspr_strfsize(off, buf); } for (; off < 9999999; off += 9) { - apr_strfsize(off, buf); + fspr_strfsize(off, buf); } for (; off < 999999999; off += 999) { - apr_strfsize(off, buf); + fspr_strfsize(off, buf); } for (off = 1; off < LONG_MAX && off > 0; off *= 2) { - apr_strfsize(off, buf); - apr_strfsize(off + 1, buf); - apr_strfsize(off - 1, buf); + fspr_strfsize(off, buf); + fspr_strfsize(off + 1, buf); + fspr_strfsize(off - 1, buf); } ABTS_ASSERT(tc, "strfsize overflowed", buf[5] == '$'); @@ -320,7 +320,7 @@ static void overflow_strfsize(abts_case *tc, void *data) static void string_strfsize(abts_case *tc, void *data) { static const struct { - apr_off_t size; + fspr_off_t size; const char *buf; } ts[] = { { -1, " - " }, @@ -334,14 +334,14 @@ static void string_strfsize(abts_case *tc, void *data) { 103809024, " 99M" }, { 1047527424, "1.0G" } /* "999M" would be more correct */ }; - apr_size_t n; + fspr_size_t n; for (n = 0; n < sizeof(ts)/sizeof(ts[0]); n++) { char buf[6], *ret; buf[5] = '%'; - ret = apr_strfsize(ts[n].size, buf); + ret = fspr_strfsize(ts[n].size, buf); ABTS_ASSERT(tc, "strfsize returned wrong buffer", ret == buf); ABTS_ASSERT(tc, "strfsize overflowed", buf[5] == '%'); @@ -357,10 +357,10 @@ static void snprintf_overflow(abts_case *tc, void *data) buf[2] = '4'; buf[3] = '2'; - rv = apr_snprintf(buf, 2, "%s", "a"); + rv = fspr_snprintf(buf, 2, "%s", "a"); ABTS_INT_EQUAL(tc, 1, rv); - rv = apr_snprintf(buf, 2, "%s", "abcd"); + rv = fspr_snprintf(buf, 2, "%s", "abcd"); ABTS_INT_EQUAL(tc, 1, rv); ABTS_STR_EQUAL(tc, buf, "a"); diff --git a/libs/apr/test/teststrnatcmp.c b/libs/apr/test/teststrnatcmp.c index 3a5e4c67ba..7e62742a0c 100644 --- a/libs/apr/test/teststrnatcmp.c +++ b/libs/apr/test/teststrnatcmp.c @@ -14,50 +14,50 @@ * limitations under the License. */ -#include "apr_file_io.h" -#include "apr_errno.h" -#include "apr_strings.h" +#include "fspr_file_io.h" +#include "fspr_errno.h" +#include "fspr_strings.h" #include "testutil.h" static void less0(abts_case *tc, void *data) { - int rv = apr_strnatcmp("a", "b"); + int rv = fspr_strnatcmp("a", "b"); ABTS_ASSERT(tc, "didn't compare simple strings properly", rv < 0); } static void str_equal(abts_case *tc, void *data) { - int rv = apr_strnatcmp("a", "a"); + int rv = fspr_strnatcmp("a", "a"); ABTS_ASSERT(tc, "didn't compare simple strings properly", rv == 0); } static void more0(abts_case *tc, void *data) { - int rv = apr_strnatcmp("b", "a"); + int rv = fspr_strnatcmp("b", "a"); ABTS_ASSERT(tc, "didn't compare simple strings properly", rv > 0); } static void less_ignore_case(abts_case *tc, void *data) { - int rv = apr_strnatcasecmp("a", "B"); + int rv = fspr_strnatcasecmp("a", "B"); ABTS_ASSERT(tc, "didn't compare simple strings properly", rv < 0); } static void str_equal_ignore_case(abts_case *tc, void *data) { - int rv = apr_strnatcasecmp("a", "A"); + int rv = fspr_strnatcasecmp("a", "A"); ABTS_ASSERT(tc, "didn't compare simple strings properly", rv == 0); } static void more_ignore_case(abts_case *tc, void *data) { - int rv = apr_strnatcasecmp("b", "A"); + int rv = fspr_strnatcasecmp("b", "A"); ABTS_ASSERT(tc, "didn't compare simple strings properly", rv > 0); } static void natcmp(abts_case *tc, void *data) { - int rv = apr_strnatcasecmp("a2", "a10"); + int rv = fspr_strnatcasecmp("a2", "a10"); ABTS_ASSERT(tc, "didn't compare simple strings properly", rv < 0); } diff --git a/libs/apr/test/testtable.c b/libs/apr/test/testtable.c index d377eaf5a1..e9696d768d 100644 --- a/libs/apr/test/testtable.c +++ b/libs/apr/test/testtable.c @@ -15,11 +15,11 @@ */ #include "testutil.h" -#include "apr.h" -#include "apr_strings.h" -#include "apr_general.h" -#include "apr_pools.h" -#include "apr_tables.h" +#include "fspr.h" +#include "fspr_strings.h" +#include "fspr_general.h" +#include "fspr_pools.h" +#include "fspr_tables.h" #if APR_HAVE_STDIO_H #include #endif @@ -30,11 +30,11 @@ #include #endif -static apr_table_t *t1 = NULL; +static fspr_table_t *t1 = NULL; static void table_make(abts_case *tc, void *data) { - t1 = apr_table_make(p, 5); + t1 = fspr_table_make(p, 5); ABTS_PTR_NOTNULL(tc, t1); } @@ -42,8 +42,8 @@ static void table_get(abts_case *tc, void *data) { const char *val; - apr_table_set(t1, "foo", "bar"); - val = apr_table_get(t1, "foo"); + fspr_table_set(t1, "foo", "bar"); + val = fspr_table_get(t1, "foo"); ABTS_STR_EQUAL(tc, val, "bar"); } @@ -51,9 +51,9 @@ static void table_set(abts_case *tc, void *data) { const char *val; - apr_table_set(t1, "setkey", "bar"); - apr_table_set(t1, "setkey", "2ndtry"); - val = apr_table_get(t1, "setkey"); + fspr_table_set(t1, "setkey", "bar"); + fspr_table_set(t1, "setkey", "2ndtry"); + val = fspr_table_get(t1, "setkey"); ABTS_STR_EQUAL(tc, val, "2ndtry"); } @@ -61,7 +61,7 @@ static void table_getnotthere(abts_case *tc, void *data) { const char *val; - val = apr_table_get(t1, "keynotthere"); + val = fspr_table_get(t1, "keynotthere"); ABTS_PTR_EQUAL(tc, NULL, (void *)val); } @@ -69,9 +69,9 @@ static void table_add(abts_case *tc, void *data) { const char *val; - apr_table_add(t1, "addkey", "bar"); - apr_table_add(t1, "addkey", "foo"); - val = apr_table_get(t1, "addkey"); + fspr_table_add(t1, "addkey", "bar"); + fspr_table_add(t1, "addkey", "foo"); + val = fspr_table_get(t1, "addkey"); ABTS_STR_EQUAL(tc, val, "bar"); } @@ -79,94 +79,94 @@ static void table_add(abts_case *tc, void *data) static void table_nelts(abts_case *tc, void *data) { const char *val; - apr_table_t *t = apr_table_make(p, 1); + fspr_table_t *t = fspr_table_make(p, 1); - apr_table_set(t, "abc", "def"); - apr_table_set(t, "def", "abc"); - apr_table_set(t, "foo", "zzz"); - val = apr_table_get(t, "foo"); + fspr_table_set(t, "abc", "def"); + fspr_table_set(t, "def", "abc"); + fspr_table_set(t, "foo", "zzz"); + val = fspr_table_get(t, "foo"); ABTS_STR_EQUAL(tc, val, "zzz"); - val = apr_table_get(t, "abc"); + val = fspr_table_get(t, "abc"); ABTS_STR_EQUAL(tc, val, "def"); - val = apr_table_get(t, "def"); + val = fspr_table_get(t, "def"); ABTS_STR_EQUAL(tc, val, "abc"); - ABTS_INT_EQUAL(tc, 3, apr_table_elts(t)->nelts); + ABTS_INT_EQUAL(tc, 3, fspr_table_elts(t)->nelts); } static void table_clear(abts_case *tc, void *data) { - apr_table_clear(t1); - ABTS_INT_EQUAL(tc, 0, apr_table_elts(t1)->nelts); + fspr_table_clear(t1); + ABTS_INT_EQUAL(tc, 0, fspr_table_elts(t1)->nelts); } static void table_unset(abts_case *tc, void *data) { const char *val; - apr_table_t *t = apr_table_make(p, 1); + fspr_table_t *t = fspr_table_make(p, 1); - apr_table_set(t, "a", "1"); - apr_table_set(t, "b", "2"); - apr_table_unset(t, "b"); - ABTS_INT_EQUAL(tc, 1, apr_table_elts(t)->nelts); - val = apr_table_get(t, "a"); + fspr_table_set(t, "a", "1"); + fspr_table_set(t, "b", "2"); + fspr_table_unset(t, "b"); + ABTS_INT_EQUAL(tc, 1, fspr_table_elts(t)->nelts); + val = fspr_table_get(t, "a"); ABTS_STR_EQUAL(tc, val, "1"); - val = apr_table_get(t, "b"); + val = fspr_table_get(t, "b"); ABTS_PTR_EQUAL(tc, (void *)val, (void *)NULL); } static void table_overlap(abts_case *tc, void *data) { const char *val; - apr_table_t *t1 = apr_table_make(p, 1); - apr_table_t *t2 = apr_table_make(p, 1); + fspr_table_t *t1 = fspr_table_make(p, 1); + fspr_table_t *t2 = fspr_table_make(p, 1); - apr_table_addn(t1, "a", "0"); - apr_table_addn(t1, "g", "7"); - apr_table_addn(t2, "a", "1"); - apr_table_addn(t2, "b", "2"); - apr_table_addn(t2, "c", "3"); - apr_table_addn(t2, "b", "2.0"); - apr_table_addn(t2, "d", "4"); - apr_table_addn(t2, "e", "5"); - apr_table_addn(t2, "b", "2."); - apr_table_addn(t2, "f", "6"); - apr_table_overlap(t1, t2, APR_OVERLAP_TABLES_SET); + fspr_table_addn(t1, "a", "0"); + fspr_table_addn(t1, "g", "7"); + fspr_table_addn(t2, "a", "1"); + fspr_table_addn(t2, "b", "2"); + fspr_table_addn(t2, "c", "3"); + fspr_table_addn(t2, "b", "2.0"); + fspr_table_addn(t2, "d", "4"); + fspr_table_addn(t2, "e", "5"); + fspr_table_addn(t2, "b", "2."); + fspr_table_addn(t2, "f", "6"); + fspr_table_overlap(t1, t2, APR_OVERLAP_TABLES_SET); - ABTS_INT_EQUAL(tc, apr_table_elts(t1)->nelts, 7); - val = apr_table_get(t1, "a"); + ABTS_INT_EQUAL(tc, fspr_table_elts(t1)->nelts, 7); + val = fspr_table_get(t1, "a"); ABTS_STR_EQUAL(tc, val, "1"); - val = apr_table_get(t1, "b"); + val = fspr_table_get(t1, "b"); ABTS_STR_EQUAL(tc, val, "2."); - val = apr_table_get(t1, "c"); + val = fspr_table_get(t1, "c"); ABTS_STR_EQUAL(tc, val, "3"); - val = apr_table_get(t1, "d"); + val = fspr_table_get(t1, "d"); ABTS_STR_EQUAL(tc, val, "4"); - val = apr_table_get(t1, "e"); + val = fspr_table_get(t1, "e"); ABTS_STR_EQUAL(tc, val, "5"); - val = apr_table_get(t1, "f"); + val = fspr_table_get(t1, "f"); ABTS_STR_EQUAL(tc, val, "6"); - val = apr_table_get(t1, "g"); + val = fspr_table_get(t1, "g"); ABTS_STR_EQUAL(tc, val, "7"); } static void table_overlap2(abts_case *tc, void *data) { - apr_pool_t *subp; - apr_table_t *t1, *t2; + fspr_pool_t *subp; + fspr_table_t *t1, *t2; - apr_pool_create(&subp, p); + fspr_pool_create(&subp, p); - t1 = apr_table_make(subp, 1); - t2 = apr_table_make(p, 1); - apr_table_addn(t1, "t1", "one"); - apr_table_addn(t2, "t2", "two"); + t1 = fspr_table_make(subp, 1); + t2 = fspr_table_make(p, 1); + fspr_table_addn(t1, "t1", "one"); + fspr_table_addn(t2, "t2", "two"); - apr_table_overlap(t1, t2, APR_OVERLAP_TABLES_SET); + fspr_table_overlap(t1, t2, APR_OVERLAP_TABLES_SET); - ABTS_INT_EQUAL(tc, 2, apr_table_elts(t1)->nelts); + ABTS_INT_EQUAL(tc, 2, fspr_table_elts(t1)->nelts); - ABTS_STR_EQUAL(tc, apr_table_get(t1, "t1"), "one"); - ABTS_STR_EQUAL(tc, apr_table_get(t1, "t2"), "two"); + ABTS_STR_EQUAL(tc, fspr_table_get(t1, "t1"), "one"); + ABTS_STR_EQUAL(tc, fspr_table_get(t1, "t2"), "two"); } diff --git a/libs/apr/test/testtemp.c b/libs/apr/test/testtemp.c index 1f1143ee35..6d94c193e9 100644 --- a/libs/apr/test/testtemp.c +++ b/libs/apr/test/testtemp.c @@ -15,31 +15,31 @@ */ #include "testutil.h" -#include "apr_file_io.h" -#include "apr_strings.h" +#include "fspr_file_io.h" +#include "fspr_strings.h" static void test_temp_dir(abts_case *tc, void *data) { const char *tempdir = NULL; - apr_status_t rv; + fspr_status_t rv; - rv = apr_temp_dir_get(&tempdir, p); + rv = fspr_temp_dir_get(&tempdir, p); APR_ASSERT_SUCCESS(tc, "Error finding Temporary Directory", rv); ABTS_PTR_NOTNULL(tc, tempdir); } static void test_mktemp(abts_case *tc, void *data) { - apr_file_t *f = NULL; + fspr_file_t *f = NULL; const char *tempdir = NULL; char *filetemplate; - apr_status_t rv; + fspr_status_t rv; - rv = apr_temp_dir_get(&tempdir, p); + rv = fspr_temp_dir_get(&tempdir, p); APR_ASSERT_SUCCESS(tc, "Error finding Temporary Directory", rv); - filetemplate = apr_pstrcat(p, tempdir, "/tempfileXXXXXX", NULL); - rv = apr_file_mktemp(&f, filetemplate, 0, p); + filetemplate = fspr_pstrcat(p, tempdir, "/tempfileXXXXXX", NULL); + rv = fspr_file_mktemp(&f, filetemplate, 0, p); APR_ASSERT_SUCCESS(tc, "Error opening Temporary file", rv); } diff --git a/libs/apr/test/testthread.c b/libs/apr/test/testthread.c index 35ef293bec..a5709aac74 100644 --- a/libs/apr/test/testthread.c +++ b/libs/apr/test/testthread.c @@ -14,84 +14,84 @@ * limitations under the License. */ -#include "apr_thread_proc.h" -#include "apr_errno.h" -#include "apr_general.h" +#include "fspr_thread_proc.h" +#include "fspr_errno.h" +#include "fspr_general.h" #include "errno.h" -#include "apr_time.h" +#include "fspr_time.h" #include "testutil.h" #if APR_HAS_THREADS -static apr_thread_mutex_t *thread_lock; -static apr_thread_once_t *control = NULL; +static fspr_thread_mutex_t *thread_lock; +static fspr_thread_once_t *control = NULL; static int x = 0; static int value = 0; -static apr_thread_t *t1; -static apr_thread_t *t2; -static apr_thread_t *t3; -static apr_thread_t *t4; +static fspr_thread_t *t1; +static fspr_thread_t *t2; +static fspr_thread_t *t3; +static fspr_thread_t *t4; /* just some made up number to check on later */ -static apr_status_t exit_ret_val = 123; +static fspr_status_t exit_ret_val = 123; static void init_func(void) { value++; } -static void * APR_THREAD_FUNC thread_func1(apr_thread_t *thd, void *data) +static void * APR_THREAD_FUNC thread_func1(fspr_thread_t *thd, void *data) { int i; - apr_thread_once(control, init_func); + fspr_thread_once(control, init_func); for (i = 0; i < 10000; i++) { - apr_thread_mutex_lock(thread_lock); + fspr_thread_mutex_lock(thread_lock); x++; - apr_thread_mutex_unlock(thread_lock); + fspr_thread_mutex_unlock(thread_lock); } - apr_thread_exit(thd, exit_ret_val); + fspr_thread_exit(thd, exit_ret_val); return NULL; } static void thread_init(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_thread_once_init(&control, p); + rv = fspr_thread_once_init(&control, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_DEFAULT, p); + rv = fspr_thread_mutex_create(&thread_lock, APR_THREAD_MUTEX_DEFAULT, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } static void create_threads(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_thread_create(&t1, NULL, thread_func1, NULL, p); + rv = fspr_thread_create(&t1, NULL, thread_func1, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_thread_create(&t2, NULL, thread_func1, NULL, p); + rv = fspr_thread_create(&t2, NULL, thread_func1, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_thread_create(&t3, NULL, thread_func1, NULL, p); + rv = fspr_thread_create(&t3, NULL, thread_func1, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); - rv = apr_thread_create(&t4, NULL, thread_func1, NULL, p); + rv = fspr_thread_create(&t4, NULL, thread_func1, NULL, p); ABTS_INT_EQUAL(tc, APR_SUCCESS, rv); } static void join_threads(abts_case *tc, void *data) { - apr_status_t s; + fspr_status_t s; - apr_thread_join(&s, t1); + fspr_thread_join(&s, t1); ABTS_INT_EQUAL(tc, exit_ret_val, s); - apr_thread_join(&s, t2); + fspr_thread_join(&s, t2); ABTS_INT_EQUAL(tc, exit_ret_val, s); - apr_thread_join(&s, t3); + fspr_thread_join(&s, t3); ABTS_INT_EQUAL(tc, exit_ret_val, s); - apr_thread_join(&s, t4); + fspr_thread_join(&s, t4); ABTS_INT_EQUAL(tc, exit_ret_val, s); } diff --git a/libs/apr/test/testtime.c b/libs/apr/test/testtime.c index 84b4772695..2922d095d6 100644 --- a/libs/apr/test/testtime.c +++ b/libs/apr/test/testtime.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "apr_time.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" +#include "fspr_time.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" #include "testutil.h" -#include "apr_strings.h" +#include "fspr_strings.h" #include #define STR_SIZE 45 @@ -30,11 +30,11 @@ * 2002-08-14 12:05:36.186711 -25200 [257 Sat]. * Which happens to be when I wrote the new tests. */ -static apr_time_t now = APR_INT64_C(1032030336186711); +static fspr_time_t now = APR_INT64_C(1032030336186711); -static char* print_time (apr_pool_t *pool, const apr_time_exp_t *xt) +static char* print_time (fspr_pool_t *pool, const fspr_time_exp_t *xt) { - return apr_psprintf (pool, + return fspr_psprintf (pool, "%04d-%02d-%02d %02d:%02d:%02d.%06d %+05d [%d %s]%s", xt->tm_year + 1900, xt->tm_mon, @@ -45,18 +45,18 @@ static char* print_time (apr_pool_t *pool, const apr_time_exp_t *xt) xt->tm_usec, xt->tm_gmtoff, xt->tm_yday + 1, - apr_day_snames[xt->tm_wday], + fspr_day_snames[xt->tm_wday], (xt->tm_isdst ? " DST" : "")); } static void test_now(abts_case *tc, void *data) { - apr_time_t timediff; - apr_time_t current; + fspr_time_t timediff; + fspr_time_t current; time_t os_now; - current = apr_time_now(); + current = fspr_time_now(); time(&os_now); timediff = os_now - (current / APR_USEC_PER_SEC); @@ -64,18 +64,18 @@ static void test_now(abts_case *tc, void *data) * that the time will be slightly off, so accept anything between -1 and * 1 second. */ - ABTS_ASSERT(tc, "apr_time and OS time do not agree", + ABTS_ASSERT(tc, "fspr_time and OS time do not agree", (timediff > -2) && (timediff < 2)); } static void test_gmtstr(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; + fspr_status_t rv; + fspr_time_exp_t xt; - rv = apr_time_exp_gmt(&xt, now); + rv = fspr_time_exp_gmt(&xt, now); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_time_exp_gmt"); + ABTS_NOT_IMPL(tc, "fspr_time_exp_gmt"); } ABTS_TRUE(tc, rv == APR_SUCCESS); ABTS_STR_EQUAL(tc, "2002-08-14 19:05:36.186711 +0000 [257 Sat]", @@ -84,14 +84,14 @@ static void test_gmtstr(abts_case *tc, void *data) static void test_exp_lt(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; - time_t posix_secs = (time_t)apr_time_sec(now); + fspr_status_t rv; + fspr_time_exp_t xt; + time_t posix_secs = (time_t)fspr_time_sec(now); struct tm *posix_exp = localtime(&posix_secs); - rv = apr_time_exp_lt(&xt, now); + rv = fspr_time_exp_lt(&xt, now); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_time_exp_lt"); + ABTS_NOT_IMPL(tc, "fspr_time_exp_lt"); } ABTS_TRUE(tc, rv == APR_SUCCESS); @@ -112,51 +112,51 @@ static void test_exp_lt(abts_case *tc, void *data) static void test_exp_get_gmt(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; - apr_time_t imp; - apr_int64_t hr_off_64; + fspr_status_t rv; + fspr_time_exp_t xt; + fspr_time_t imp; + fspr_int64_t hr_off_64; - rv = apr_time_exp_gmt(&xt, now); + rv = fspr_time_exp_gmt(&xt, now); ABTS_TRUE(tc, rv == APR_SUCCESS); - rv = apr_time_exp_get(&imp, &xt); + rv = fspr_time_exp_get(&imp, &xt); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_time_exp_get"); + ABTS_NOT_IMPL(tc, "fspr_time_exp_get"); } ABTS_TRUE(tc, rv == APR_SUCCESS); - hr_off_64 = (apr_int64_t) xt.tm_gmtoff * APR_USEC_PER_SEC; + hr_off_64 = (fspr_int64_t) xt.tm_gmtoff * APR_USEC_PER_SEC; ABTS_TRUE(tc, now + hr_off_64 == imp); } static void test_exp_get_lt(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; - apr_time_t imp; - apr_int64_t hr_off_64; + fspr_status_t rv; + fspr_time_exp_t xt; + fspr_time_t imp; + fspr_int64_t hr_off_64; - rv = apr_time_exp_lt(&xt, now); + rv = fspr_time_exp_lt(&xt, now); ABTS_TRUE(tc, rv == APR_SUCCESS); - rv = apr_time_exp_get(&imp, &xt); + rv = fspr_time_exp_get(&imp, &xt); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_time_exp_get"); + ABTS_NOT_IMPL(tc, "fspr_time_exp_get"); } ABTS_TRUE(tc, rv == APR_SUCCESS); - hr_off_64 = (apr_int64_t) xt.tm_gmtoff * APR_USEC_PER_SEC; + hr_off_64 = (fspr_int64_t) xt.tm_gmtoff * APR_USEC_PER_SEC; ABTS_TRUE(tc, now + hr_off_64 == imp); } static void test_imp_gmt(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; - apr_time_t imp; + fspr_status_t rv; + fspr_time_exp_t xt; + fspr_time_t imp; - rv = apr_time_exp_gmt(&xt, now); + rv = fspr_time_exp_gmt(&xt, now); ABTS_TRUE(tc, rv == APR_SUCCESS); - rv = apr_time_exp_gmt_get(&imp, &xt); + rv = fspr_time_exp_gmt_get(&imp, &xt); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_time_exp_gmt_get"); + ABTS_NOT_IMPL(tc, "fspr_time_exp_gmt_get"); } ABTS_TRUE(tc, rv == APR_SUCCESS); ABTS_TRUE(tc, now == imp); @@ -164,12 +164,12 @@ static void test_imp_gmt(abts_case *tc, void *data) static void test_rfcstr(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; char str[STR_SIZE]; - rv = apr_rfc822_date(str, now); + rv = fspr_rfc822_date(str, now); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_rfc822_date"); + ABTS_NOT_IMPL(tc, "fspr_rfc822_date"); } ABTS_TRUE(tc, rv == APR_SUCCESS); ABTS_STR_EQUAL(tc, "Sat, 14 Sep 2002 19:05:36 GMT", str); @@ -177,35 +177,35 @@ static void test_rfcstr(abts_case *tc, void *data) static void test_ctime(abts_case *tc, void *data) { - apr_status_t rv; - char apr_str[STR_SIZE]; + fspr_status_t rv; + char fspr_str[STR_SIZE]; char libc_str[STR_SIZE]; - apr_time_t now_sec = apr_time_sec(now); + fspr_time_t now_sec = fspr_time_sec(now); time_t posix_sec = (time_t) now_sec; - rv = apr_ctime(apr_str, now); + rv = fspr_ctime(fspr_str, now); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_ctime"); + ABTS_NOT_IMPL(tc, "fspr_ctime"); } ABTS_TRUE(tc, rv == APR_SUCCESS); strcpy(libc_str, ctime(&posix_sec)); *strchr(libc_str, '\n') = '\0'; - ABTS_STR_EQUAL(tc, libc_str, apr_str); + ABTS_STR_EQUAL(tc, libc_str, fspr_str); } static void test_strftime(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; + fspr_status_t rv; + fspr_time_exp_t xt; char *str = NULL; - apr_size_t sz; + fspr_size_t sz; - rv = apr_time_exp_gmt(&xt, now); - str = apr_palloc(p, STR_SIZE + 1); - rv = apr_strftime(str, &sz, STR_SIZE, "%R %A %d %B %Y", &xt); + rv = fspr_time_exp_gmt(&xt, now); + str = fspr_palloc(p, STR_SIZE + 1); + rv = fspr_strftime(str, &sz, STR_SIZE, "%R %A %d %B %Y", &xt); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_strftime"); + ABTS_NOT_IMPL(tc, "fspr_strftime"); } ABTS_TRUE(tc, rv == APR_SUCCESS); ABTS_STR_EQUAL(tc, "19:05 Saturday 14 September 2002", str); @@ -213,15 +213,15 @@ static void test_strftime(abts_case *tc, void *data) static void test_strftimesmall(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; + fspr_status_t rv; + fspr_time_exp_t xt; char str[STR_SIZE]; - apr_size_t sz; + fspr_size_t sz; - rv = apr_time_exp_gmt(&xt, now); - rv = apr_strftime(str, &sz, STR_SIZE, "%T", &xt); + rv = fspr_time_exp_gmt(&xt, now); + rv = fspr_strftime(str, &sz, STR_SIZE, "%T", &xt); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_strftime"); + ABTS_NOT_IMPL(tc, "fspr_strftime"); } ABTS_TRUE(tc, rv == APR_SUCCESS); ABTS_STR_EQUAL(tc, "19:05:36", str); @@ -229,13 +229,13 @@ static void test_strftimesmall(abts_case *tc, void *data) static void test_exp_tz(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; - apr_int32_t hr_off = -5 * 3600; /* 5 hours in seconds */ + fspr_status_t rv; + fspr_time_exp_t xt; + fspr_int32_t hr_off = -5 * 3600; /* 5 hours in seconds */ - rv = apr_time_exp_tz(&xt, now, hr_off); + rv = fspr_time_exp_tz(&xt, now, hr_off); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_time_exp_tz"); + ABTS_NOT_IMPL(tc, "fspr_time_exp_tz"); } ABTS_TRUE(tc, rv == APR_SUCCESS); ABTS_TRUE(tc, (xt.tm_usec == 186711) && @@ -251,16 +251,16 @@ static void test_exp_tz(abts_case *tc, void *data) static void test_strftimeoffset(abts_case *tc, void *data) { - apr_status_t rv; - apr_time_exp_t xt; + fspr_status_t rv; + fspr_time_exp_t xt; char str[STR_SIZE]; - apr_size_t sz; - apr_int32_t hr_off = -5 * 3600; /* 5 hours in seconds */ + fspr_size_t sz; + fspr_int32_t hr_off = -5 * 3600; /* 5 hours in seconds */ - apr_time_exp_tz(&xt, now, hr_off); - rv = apr_strftime(str, &sz, STR_SIZE, "%T", &xt); + fspr_time_exp_tz(&xt, now, hr_off); + rv = fspr_strftime(str, &sz, STR_SIZE, "%T", &xt); if (rv == APR_ENOTIMPL) { - ABTS_NOT_IMPL(tc, "apr_strftime"); + ABTS_NOT_IMPL(tc, "fspr_strftime"); } ABTS_TRUE(tc, rv == APR_SUCCESS); } @@ -268,8 +268,8 @@ static void test_strftimeoffset(abts_case *tc, void *data) /* 0.9.4 and earlier rejected valid dates in 2038 */ static void test_2038(abts_case *tc, void *data) { - apr_time_exp_t xt; - apr_time_t t; + fspr_time_exp_t xt; + fspr_time_t t; /* 2038-01-19T03:14:07.000000Z */ xt.tm_year = 138; @@ -280,7 +280,7 @@ static void test_2038(abts_case *tc, void *data) xt.tm_sec = 7; APR_ASSERT_SUCCESS(tc, "explode January 19th, 2038", - apr_time_exp_get(&t, &xt)); + fspr_time_exp_get(&t, &xt)); } abts_suite *testtime(abts_suite *suite) diff --git a/libs/apr/test/testud.c b/libs/apr/test/testud.c index 77cd28faa9..22f30787cf 100644 --- a/libs/apr/test/testud.c +++ b/libs/apr/test/testud.c @@ -16,18 +16,18 @@ #include #include -#include "apr_file_io.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_strings.h" +#include "fspr_file_io.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_strings.h" #include "testutil.h" -static apr_pool_t *pool; +static fspr_pool_t *pool; static char *testdata; static int cleanup_called = 0; -static apr_status_t string_cleanup(void *data) +static fspr_status_t string_cleanup(void *data) { cleanup_called = 1; return APR_SUCCESS; @@ -35,38 +35,38 @@ static apr_status_t string_cleanup(void *data) static void set_userdata(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; - rv = apr_pool_userdata_set(testdata, "TEST", string_cleanup, pool); + rv = fspr_pool_userdata_set(testdata, "TEST", string_cleanup, pool); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); } static void get_userdata(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; void *retdata; - rv = apr_pool_userdata_get(&retdata, "TEST", pool); + rv = fspr_pool_userdata_get(&retdata, "TEST", pool); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); ABTS_STR_EQUAL(tc, retdata, testdata); } static void get_nonexistkey(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; void *retdata; - rv = apr_pool_userdata_get(&retdata, "DOESNTEXIST", pool); + rv = fspr_pool_userdata_get(&retdata, "DOESNTEXIST", pool); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); ABTS_PTR_EQUAL(tc, retdata, NULL); } static void post_pool_clear(abts_case *tc, void *data) { - apr_status_t rv; + fspr_status_t rv; void *retdata; - rv = apr_pool_userdata_get(&retdata, "DOESNTEXIST", pool); + rv = fspr_pool_userdata_get(&retdata, "DOESNTEXIST", pool); ABTS_INT_EQUAL(tc, rv, APR_SUCCESS); ABTS_PTR_EQUAL(tc, retdata, NULL); } @@ -75,14 +75,14 @@ abts_suite *testud(abts_suite *suite) { suite = ADD_SUITE(suite) - apr_pool_create(&pool, p); - testdata = apr_pstrdup(pool, "This is a test\n"); + fspr_pool_create(&pool, p); + testdata = fspr_pstrdup(pool, "This is a test\n"); abts_run_test(suite, set_userdata, NULL); abts_run_test(suite, get_userdata, NULL); abts_run_test(suite, get_nonexistkey, NULL); - apr_pool_clear(pool); + fspr_pool_clear(pool); abts_run_test(suite, post_pool_clear, NULL); diff --git a/libs/apr/test/testuser.c b/libs/apr/test/testuser.c index 834abaf3a7..49f285b839 100644 --- a/libs/apr/test/testuser.c +++ b/libs/apr/test/testuser.c @@ -15,59 +15,59 @@ */ #include "testutil.h" -#include "apr_errno.h" -#include "apr_general.h" -#include "apr_user.h" +#include "fspr_errno.h" +#include "fspr_general.h" +#include "fspr_user.h" #if APR_HAS_USER static void uid_current(abts_case *tc, void *data) { - apr_uid_t uid; - apr_gid_t gid; + fspr_uid_t uid; + fspr_gid_t gid; - APR_ASSERT_SUCCESS(tc, "apr_uid_current failed", - apr_uid_current(&uid, &gid, p)); + APR_ASSERT_SUCCESS(tc, "fspr_uid_current failed", + fspr_uid_current(&uid, &gid, p)); } static void username(abts_case *tc, void *data) { - apr_uid_t uid; - apr_gid_t gid; - apr_uid_t retreived_uid; - apr_gid_t retreived_gid; + fspr_uid_t uid; + fspr_gid_t gid; + fspr_uid_t retreived_uid; + fspr_gid_t retreived_gid; char *uname = NULL; - APR_ASSERT_SUCCESS(tc, "apr_uid_current failed", - apr_uid_current(&uid, &gid, p)); + APR_ASSERT_SUCCESS(tc, "fspr_uid_current failed", + fspr_uid_current(&uid, &gid, p)); - APR_ASSERT_SUCCESS(tc, "apr_uid_name_get failed", - apr_uid_name_get(&uname, uid, p)); + APR_ASSERT_SUCCESS(tc, "fspr_uid_name_get failed", + fspr_uid_name_get(&uname, uid, p)); ABTS_PTR_NOTNULL(tc, uname); - APR_ASSERT_SUCCESS(tc, "apr_uid_get failed", - apr_uid_get(&retreived_uid, &retreived_gid, uname, p)); + APR_ASSERT_SUCCESS(tc, "fspr_uid_get failed", + fspr_uid_get(&retreived_uid, &retreived_gid, uname, p)); - APR_ASSERT_SUCCESS(tc, "apr_uid_compare failed", - apr_uid_compare(uid, retreived_uid)); + APR_ASSERT_SUCCESS(tc, "fspr_uid_compare failed", + fspr_uid_compare(uid, retreived_uid)); #ifdef WIN32 /* ### this fudge was added for Win32 but makes the test return NotImpl * on Unix if run as root, when !gid is also true. */ if (!gid || !retreived_gid) { /* The function had no way to recover the gid (this would have been - * an ENOTIMPL if apr_uid_ functions didn't try to double-up and - * also return apr_gid_t values, which was bogus. + * an ENOTIMPL if fspr_uid_ functions didn't try to double-up and + * also return fspr_gid_t values, which was bogus. */ if (!gid) { - ABTS_NOT_IMPL(tc, "Groups from apr_uid_current"); + ABTS_NOT_IMPL(tc, "Groups from fspr_uid_current"); } else { - ABTS_NOT_IMPL(tc, "Groups from apr_uid_get"); + ABTS_NOT_IMPL(tc, "Groups from fspr_uid_get"); } } else { #endif - APR_ASSERT_SUCCESS(tc, "apr_gid_compare failed", - apr_gid_compare(gid, retreived_gid)); + APR_ASSERT_SUCCESS(tc, "fspr_gid_compare failed", + fspr_gid_compare(gid, retreived_gid)); #ifdef WIN32 } #endif @@ -75,67 +75,67 @@ static void username(abts_case *tc, void *data) static void groupname(abts_case *tc, void *data) { - apr_uid_t uid; - apr_gid_t gid; - apr_gid_t retreived_gid; + fspr_uid_t uid; + fspr_gid_t gid; + fspr_gid_t retreived_gid; char *gname = NULL; - APR_ASSERT_SUCCESS(tc, "apr_uid_current failed", - apr_uid_current(&uid, &gid, p)); + APR_ASSERT_SUCCESS(tc, "fspr_uid_current failed", + fspr_uid_current(&uid, &gid, p)); - APR_ASSERT_SUCCESS(tc, "apr_gid_name_get failed", - apr_gid_name_get(&gname, gid, p)); + APR_ASSERT_SUCCESS(tc, "fspr_gid_name_get failed", + fspr_gid_name_get(&gname, gid, p)); ABTS_PTR_NOTNULL(tc, gname); - APR_ASSERT_SUCCESS(tc, "apr_gid_get failed", - apr_gid_get(&retreived_gid, gname, p)); + APR_ASSERT_SUCCESS(tc, "fspr_gid_get failed", + fspr_gid_get(&retreived_gid, gname, p)); - APR_ASSERT_SUCCESS(tc, "apr_gid_compare failed", - apr_gid_compare(gid, retreived_gid)); + APR_ASSERT_SUCCESS(tc, "fspr_gid_compare failed", + fspr_gid_compare(gid, retreived_gid)); } #ifndef WIN32 static void fail_userinfo(abts_case *tc, void *data) { - apr_uid_t uid; - apr_gid_t gid; - apr_status_t rv; + fspr_uid_t uid; + fspr_gid_t gid; + fspr_status_t rv; char *tmp; errno = 0; gid = uid = 9999999; tmp = NULL; - rv = apr_uid_name_get(&tmp, uid, p); - ABTS_ASSERT(tc, "apr_uid_name_get should fail or " + rv = fspr_uid_name_get(&tmp, uid, p); + ABTS_ASSERT(tc, "fspr_uid_name_get should fail or " "return a user name", rv != APR_SUCCESS || tmp != NULL); errno = 0; tmp = NULL; - rv = apr_gid_name_get(&tmp, gid, p); - ABTS_ASSERT(tc, "apr_gid_name_get should fail or " + rv = fspr_gid_name_get(&tmp, gid, p); + ABTS_ASSERT(tc, "fspr_gid_name_get should fail or " "return a group name", rv != APR_SUCCESS || tmp != NULL); gid = 424242; errno = 0; - rv = apr_gid_get(&gid, "I_AM_NOT_A_GROUP", p); - ABTS_ASSERT(tc, "apr_gid_get should fail or " + rv = fspr_gid_get(&gid, "I_AM_NOT_A_GROUP", p); + ABTS_ASSERT(tc, "fspr_gid_get should fail or " "set a group number", rv != APR_SUCCESS || gid == 424242); gid = uid = 424242; errno = 0; - rv = apr_uid_get(&uid, &gid, "I_AM_NOT_A_USER", p); - ABTS_ASSERT(tc, "apr_gid_get should fail or " + rv = fspr_uid_get(&uid, &gid, "I_AM_NOT_A_USER", p); + ABTS_ASSERT(tc, "fspr_gid_get should fail or " "set a user and group number", rv != APR_SUCCESS || uid == 424242 || gid == 4242442); errno = 0; tmp = NULL; - rv = apr_uid_homepath_get(&tmp, "I_AM_NOT_A_USER", p); - ABTS_ASSERT(tc, "apr_uid_homepath_get should fail or " + rv = fspr_uid_homepath_get(&tmp, "I_AM_NOT_A_USER", p); + ABTS_ASSERT(tc, "fspr_uid_homepath_get should fail or " "set a path name", rv != APR_SUCCESS || tmp != NULL); } diff --git a/libs/apr/test/testutil.c b/libs/apr/test/testutil.c index c433e92c39..2b094cc8ec 100644 --- a/libs/apr/test/testutil.c +++ b/libs/apr/test/testutil.c @@ -19,11 +19,11 @@ #include "abts.h" #include "testutil.h" -#include "apr_pools.h" +#include "fspr_pools.h" -apr_pool_t *p; +fspr_pool_t *p; -void apr_assert_success(abts_case* tc, const char* context, apr_status_t rv, +void fspr_assert_success(abts_case* tc, const char* context, fspr_status_t rv, int lineno) { if (rv == APR_ENOTIMPL) { @@ -31,14 +31,14 @@ void apr_assert_success(abts_case* tc, const char* context, apr_status_t rv, } else if (rv != APR_SUCCESS) { char buf[STRING_MAX], ebuf[128]; sprintf(buf, "%s (%d): %s\n", context, rv, - apr_strerror(rv, ebuf, sizeof ebuf)); + fspr_strerror(rv, ebuf, sizeof ebuf)); abts_fail(tc, buf, lineno); } } void initialize(void) { - apr_initialize(); - atexit(apr_terminate); + fspr_initialize(); + atexit(fspr_terminate); - apr_pool_create(&p, NULL); + fspr_pool_create(&p, NULL); } diff --git a/libs/apr/test/testutil.h b/libs/apr/test/testutil.h index 96394c5eb0..9ad9182445 100644 --- a/libs/apr/test/testutil.h +++ b/libs/apr/test/testutil.h @@ -14,7 +14,7 @@ * limitations under the License. */ -#include "apr_pools.h" +#include "fspr_pools.h" #include "abts.h" #ifndef APR_TEST_UTIL @@ -35,14 +35,14 @@ * a bit more consistent... */ -extern apr_pool_t *p; +extern fspr_pool_t *p; /* Assert that RV is an APR_SUCCESS value; else fail giving strerror * for RV and CONTEXT message. */ -void apr_assert_success(abts_case* tc, const char *context, - apr_status_t rv, int lineno); +void fspr_assert_success(abts_case* tc, const char *context, + fspr_status_t rv, int lineno); #define APR_ASSERT_SUCCESS(tc, ctxt, rv) \ - apr_assert_success(tc, ctxt, rv, __LINE__) + fspr_assert_success(tc, ctxt, rv, __LINE__) void initialize(void); diff --git a/libs/apr/test/testvsn.c b/libs/apr/test/testvsn.c index dbc218a13f..32ffafc95e 100644 --- a/libs/apr/test/testvsn.c +++ b/libs/apr/test/testvsn.c @@ -17,13 +17,13 @@ #include #include "testutil.h" -#include "apr_version.h" -#include "apr_general.h" +#include "fspr_version.h" +#include "fspr_general.h" static void test_strings(abts_case *tc, void *data) { - ABTS_STR_EQUAL(tc, APR_VERSION_STRING, apr_version_string()); + ABTS_STR_EQUAL(tc, APR_VERSION_STRING, fspr_version_string()); } #ifdef APR_IS_DEV_VERSION @@ -34,9 +34,9 @@ static void test_strings(abts_case *tc, void *data) static void test_ints(abts_case *tc, void *data) { - apr_version_t vsn; + fspr_version_t vsn; - apr_version(&vsn); + fspr_version(&vsn); ABTS_INT_EQUAL(tc, APR_MAJOR_VERSION, vsn.major); ABTS_INT_EQUAL(tc, APR_MINOR_VERSION, vsn.minor); diff --git a/libs/apr/test/tryread.c b/libs/apr/test/tryread.c index 729f8e699b..6ff6ce0399 100644 --- a/libs/apr/test/tryread.c +++ b/libs/apr/test/tryread.c @@ -15,10 +15,10 @@ */ #include "testflock.h" -#include "apr_pools.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr.h" +#include "fspr_pools.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr.h" #if APR_HAVE_STDLIB_H #include @@ -26,19 +26,19 @@ int main(int argc, const char * const *argv) { - apr_file_t *file; - apr_status_t status; - apr_pool_t *p; + fspr_file_t *file; + fspr_status_t status; + fspr_pool_t *p; - apr_initialize(); - apr_pool_create(&p, NULL); + fspr_initialize(); + fspr_pool_create(&p, NULL); - if (apr_file_open(&file, TESTFILE, APR_WRITE, APR_OS_DEFAULT, p) + if (fspr_file_open(&file, TESTFILE, APR_WRITE, APR_OS_DEFAULT, p) != APR_SUCCESS) { exit(UNEXPECTED_ERROR); } - status = apr_file_lock(file, APR_FLOCK_EXCLUSIVE | APR_FLOCK_NONBLOCK); + status = fspr_file_lock(file, APR_FLOCK_EXCLUSIVE | APR_FLOCK_NONBLOCK); if (status == APR_SUCCESS) { exit(SUCCESSFUL_READ); } diff --git a/libs/apr/threadproc/beos/apr_proc_stub.c b/libs/apr/threadproc/beos/fspr_proc_stub.c similarity index 100% rename from libs/apr/threadproc/beos/apr_proc_stub.c rename to libs/apr/threadproc/beos/fspr_proc_stub.c diff --git a/libs/apr/threadproc/beos/proc.c b/libs/apr/threadproc/beos/proc.c index 7af73036f5..fb2012e065 100644 --- a/libs/apr/threadproc/beos/proc.c +++ b/libs/apr/threadproc/beos/proc.c @@ -14,8 +14,8 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" -#include "apr_strings.h" +#include "fspr_arch_threadproc.h" +#include "fspr_strings.h" struct send_pipe { int in; @@ -23,10 +23,10 @@ struct send_pipe { int err; }; -APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new, fspr_pool_t *pool) { - (*new) = (apr_procattr_t *)apr_palloc(pool, - sizeof(apr_procattr_t)); + (*new) = (fspr_procattr_t *)fspr_palloc(pool, + sizeof(fspr_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -44,65 +44,65 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t * return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t in, - apr_int32_t out, apr_int32_t err) +APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, fspr_int32_t in, + fspr_int32_t out, fspr_int32_t err) { - apr_status_t status; + fspr_status_t status; if (in != 0) { - if ((status = apr_file_pipe_create(&attr->child_in, &attr->parent_in, + if ((status = fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool)) != APR_SUCCESS) { return status; } switch (in) { case APR_FULL_BLOCK: - apr_file_pipe_timeout_set(attr->child_in, -1); - apr_file_pipe_timeout_set(attr->parent_in, -1); + fspr_file_pipe_timeout_set(attr->child_in, -1); + fspr_file_pipe_timeout_set(attr->parent_in, -1); break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_in, -1); + fspr_file_pipe_timeout_set(attr->child_in, -1); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_in, -1); + fspr_file_pipe_timeout_set(attr->parent_in, -1); break; default: break; } } if (out) { - if ((status = apr_file_pipe_create(&attr->parent_out, &attr->child_out, + if ((status = fspr_file_pipe_create(&attr->parent_out, &attr->child_out, attr->pool)) != APR_SUCCESS) { return status; } switch (out) { case APR_FULL_BLOCK: - apr_file_pipe_timeout_set(attr->child_out, -1); - apr_file_pipe_timeout_set(attr->parent_out, -1); + fspr_file_pipe_timeout_set(attr->child_out, -1); + fspr_file_pipe_timeout_set(attr->parent_out, -1); break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_out, -1); + fspr_file_pipe_timeout_set(attr->child_out, -1); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_out, -1); + fspr_file_pipe_timeout_set(attr->parent_out, -1); break; default: break; } } if (err) { - if ((status = apr_file_pipe_create(&attr->parent_err, &attr->child_err, + if ((status = fspr_file_pipe_create(&attr->parent_err, &attr->child_err, attr->pool)) != APR_SUCCESS) { return status; } switch (err) { case APR_FULL_BLOCK: - apr_file_pipe_timeout_set(attr->child_err, -1); - apr_file_pipe_timeout_set(attr->parent_err, -1); + fspr_file_pipe_timeout_set(attr->child_err, -1); + fspr_file_pipe_timeout_set(attr->parent_err, -1); break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_err, -1); + fspr_file_pipe_timeout_set(attr->child_err, -1); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_err, -1); + fspr_file_pipe_timeout_set(attr->parent_err, -1); break; default: break; @@ -111,17 +111,17 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr, const char *dir) { char * cwd; if (dir[0] != '/') { cwd = (char*)malloc(sizeof(char) * PATH_MAX); getcwd(cwd, PATH_MAX); - attr->currdir = (char *)apr_pstrcat(attr->pool, cwd, "/", dir, NULL); + attr->currdir = (char *)fspr_pstrcat(attr->pool, cwd, "/", dir, NULL); free(cwd); } else { - attr->currdir = (char *)apr_pstrdup(attr->pool, dir); + attr->currdir = (char *)fspr_pstrdup(attr->pool, dir); } if (attr->currdir) { return APR_SUCCESS; @@ -129,20 +129,20 @@ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, return APR_ENOMEM; } -APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) +APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr, + fspr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) +APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, fspr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *pool) { int pid; @@ -195,32 +195,32 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) return APR_INPARENT; } -APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, - apr_child_errfn_t *errfn) +APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr, + fspr_child_errfn_t *errfn) { /* won't ever be called on this platform, so don't save the function pointer */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, - apr_int32_t chk) +APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr, + fspr_int32_t chk) { /* won't ever be used on this platform, so don't save the flag */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, - apr_int32_t addrspace) +APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr, + fspr_int32_t addrspace) { /* won't ever be used on this platform, so don't save the flag */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, +APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *new, const char *progname, const char * const *args, const char * const *env, - apr_procattr_t *attr, - apr_pool_t *pool) + fspr_procattr_t *attr, + fspr_pool_t *pool) { int i=0,nargs=0; char **newargs = NULL; @@ -228,7 +228,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, struct send_pipe *sp; char * dir = NULL; - sp = (struct send_pipe *)apr_palloc(pool, sizeof(struct send_pipe)); + sp = (struct send_pipe *)fspr_palloc(pool, sizeof(struct send_pipe)); new->in = attr->parent_in; new->err = attr->parent_err; @@ -243,7 +243,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, } newargs = (char**)malloc(sizeof(char *) * (i + 4)); - newargs[0] = strdup("/boot/home/config/bin/apr_proc_stub"); + newargs[0] = strdup("/boot/home/config/bin/fspr_proc_stub"); if (attr->currdir == NULL) { /* we require the directory , so use a temp. variable */ dir = malloc(sizeof(char) * PATH_MAX); @@ -278,13 +278,13 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, resume_thread(newproc); if (attr->child_in) { - apr_file_close(attr->child_in); + fspr_file_close(attr->child_in); } if (attr->child_out) { - apr_file_close(attr->child_out); + fspr_file_close(attr->child_out); } if (attr->child_err) { - apr_file_close(attr->child_err); + fspr_file_close(attr->child_err); } send_data(newproc, 0, (void*)sp, sizeof(struct send_pipe)); @@ -298,26 +298,26 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc, int *exitcode, - apr_exit_why_e *exitwhy, - apr_wait_how_e waithow, - apr_pool_t *p) + fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow, + fspr_pool_t *p) { proc->pid = -1; - return apr_proc_wait(proc, exitcode, exitwhy, waithow); + return fspr_proc_wait(proc, exitcode, exitwhy, waithow); } -APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc, int *exitcode, - apr_exit_why_e *exitwhy, - apr_wait_how_e waithow) + fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow) { pid_t pstatus; int waitpid_options = WUNTRACED; int exit_int; int ignore; - apr_exit_why_e ignorewhy; + fspr_exit_why_e ignorewhy; if (exitcode == NULL) { exitcode = &ignore; @@ -354,65 +354,65 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, return errno; } -APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, apr_file_t *child_in, - apr_file_t *parent_in) +APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr, fspr_file_t *child_in, + fspr_file_t *parent_in) { if (attr->child_in == NULL && attr->parent_in == NULL) - apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool); + fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool); if (child_in != NULL) - apr_file_dup(&attr->child_in, child_in, attr->pool); + fspr_file_dup(&attr->child_in, child_in, attr->pool); if (parent_in != NULL) - apr_file_dup(&attr->parent_in, parent_in, attr->pool); + fspr_file_dup(&attr->parent_in, parent_in, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_file_t *child_out, - apr_file_t *parent_out) +APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr, fspr_file_t *child_out, + fspr_file_t *parent_out) { if (attr->child_out == NULL && attr->parent_out == NULL) - apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool); + fspr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool); if (child_out != NULL) - apr_file_dup(&attr->child_out, child_out, attr->pool); + fspr_file_dup(&attr->child_out, child_out, attr->pool); if (parent_out != NULL) - apr_file_dup(&attr->parent_out, parent_out, attr->pool); + fspr_file_dup(&attr->parent_out, parent_out, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_file_t *child_err, - apr_file_t *parent_err) +APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr, fspr_file_t *child_err, + fspr_file_t *parent_err) { if (attr->child_err == NULL && attr->parent_err == NULL) - apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool); + fspr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool); if (child_err != NULL) - apr_file_dup(&attr->child_err, child_err, attr->pool); + fspr_file_dup(&attr->child_err, child_err, attr->pool); if (parent_err != NULL) - apr_file_dup(&attr->parent_err, parent_err, attr->pool); + fspr_file_dup(&attr->parent_err, parent_err, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what, +APR_DECLARE(fspr_status_t) fspr_procattr_limit_set(fspr_procattr_t *attr, fspr_int32_t what, void *limit) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr, const char *username, const char *password) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr, const char *groupname) { return APR_ENOTIMPL; diff --git a/libs/apr/threadproc/beos/thread.c b/libs/apr/threadproc/beos/thread.c index 629c86def7..79248cc0c5 100644 --- a/libs/apr/threadproc/beos/thread.c +++ b/libs/apr/threadproc/beos/thread.c @@ -14,13 +14,13 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" -#include "apr_portable.h" +#include "fspr_arch_threadproc.h" +#include "fspr_portable.h" -APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new, fspr_pool_t *pool) { - (*new) = (apr_threadattr_t *)apr_palloc(pool, - sizeof(apr_threadattr_t)); + (*new) = (fspr_threadattr_t *)fspr_palloc(pool, + sizeof(fspr_threadattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -32,7 +32,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_int32_t on) +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr, fspr_int32_t on) { if (on == 1){ attr->detached = 1; @@ -42,7 +42,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr) +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr) { if (attr->detached == 1){ return APR_DETACH; @@ -50,32 +50,32 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr) return APR_NOTDETACH; } -APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, - apr_size_t stacksize) +APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr, + fspr_size_t stacksize) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, - apr_size_t size) +APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr, + fspr_size_t size) { return APR_ENOTIMPL; } static void *dummy_worker(void *opaque) { - apr_thread_t *thd = (apr_thread_t*)opaque; + fspr_thread_t *thd = (fspr_thread_t*)opaque; return thd->func(thd, thd->data); } -APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr, - apr_thread_start_t func, void *data, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new, fspr_threadattr_t *attr, + fspr_thread_start_t func, void *data, + fspr_pool_t *pool) { int32 temp; - apr_status_t stat; + fspr_status_t stat; - (*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t)); + (*new) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t)); if ((*new) == NULL) { return APR_ENOMEM; } @@ -91,7 +91,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t else temp = B_NORMAL_PRIORITY; - stat = apr_pool_create(&(*new)->pool, pool); + stat = fspr_pool_create(&(*new)->pool, pool); if (stat != APR_SUCCESS) { return stat; } @@ -110,26 +110,26 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t } } -APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void) +APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current(void) { return find_thread(NULL); } -int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2) +int fspr_os_thread_equal(fspr_os_thread_t tid1, fspr_os_thread_t tid2) { return tid1 == tid2; } -APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval) +APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd, fspr_status_t retval) { - apr_pool_destroy(thd->pool); + fspr_pool_destroy(thd->pool); thd->exitval = retval; exit_thread ((status_t)(retval)); /* This will never be reached... */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval, fspr_thread_t *thd) { status_t rv = 0, ret; ret = wait_for_thread(thd->td, &rv); @@ -149,7 +149,7 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *th } } -APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd) { if (suspend_thread(thd->td) == B_NO_ERROR){ return APR_SUCCESS; @@ -159,45 +159,45 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) } } -void apr_thread_yield() +void fspr_thread_yield() { } -APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, apr_thread_t *thread) +APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key, fspr_thread_t *thread) { - return apr_pool_userdata_get(data, key, thread->pool); + return fspr_pool_userdata_get(data, key, thread->pool); } -APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_thread_t *thread) +APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_thread_t *thread) { - return apr_pool_userdata_set(data, key, cleanup, thread->pool); + return fspr_pool_userdata_set(data, key, cleanup, thread->pool); } -APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd, fspr_thread_t *thd) { *thethd = &thd->td; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd, fspr_os_thread_t *thethd, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*thd) == NULL) { - (*thd) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t)); + (*thd) = (fspr_thread_t *)fspr_pcalloc(pool, sizeof(fspr_thread_t)); (*thd)->pool = pool; } (*thd)->td = *thethd; return APR_SUCCESS; } -static apr_status_t thread_once_cleanup(void *vcontrol) +static fspr_status_t thread_once_cleanup(void *vcontrol) { - apr_thread_once_t *control = (apr_thread_once_t *)vcontrol; + fspr_thread_once_t *control = (fspr_thread_once_t *)vcontrol; if (control->sem) { release_sem(control->sem); @@ -207,23 +207,23 @@ static apr_status_t thread_once_cleanup(void *vcontrol) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control, + fspr_pool_t *p) { int rc; - *control = (apr_thread_once_t *)apr_pcalloc(p, sizeof(apr_thread_once_t)); + *control = (fspr_thread_once_t *)fspr_pcalloc(p, sizeof(fspr_thread_once_t)); (*control)->hit = 0; /* we haven't done it yet... */ rc = ((*control)->sem = create_sem(1, "thread_once")); if (rc < 0) return rc; - apr_pool_cleanup_register(p, control, thread_once_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(p, control, thread_once_cleanup, fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, +APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control, void (*func)(void)) { if (!control->hit) { diff --git a/libs/apr/threadproc/beos/threadpriv.c b/libs/apr/threadproc/beos/threadpriv.c index 442235f7dd..a50d62caa6 100644 --- a/libs/apr/threadproc/beos/threadpriv.c +++ b/libs/apr/threadproc/beos/threadpriv.c @@ -14,16 +14,16 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" +#include "fspr_arch_threadproc.h" static struct beos_key key_table[BEOS_MAX_DATAKEYS]; static struct beos_private_data *beos_data[BEOS_MAX_DATAKEYS]; static sem_id lock; -APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, - void (*dest)(void *), apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key, + void (*dest)(void *), fspr_pool_t *pool) { - (*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; } @@ -44,7 +44,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, return APR_ENOMEM; } -APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new, fspr_threadkey_t *key) { thread_id tid; int i, index=0; @@ -76,7 +76,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, apr_threadkey_t return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv, fspr_threadkey_t *key) { thread_id tid; int i,index = 0, ret = 0; @@ -131,7 +131,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, apr_threadkey_t return APR_ENOMEM; } -APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key) { if (key->key < BEOS_MAX_DATAKEYS){ acquire_sem(key_table[key->key].lock); @@ -146,33 +146,33 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key, - apr_threadkey_t *threadkey) +APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key, + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_get(data, key, threadkey->pool); + return fspr_pool_userdata_get(data, key, threadkey->pool); } -APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_threadkey_t *threadkey) +APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_set(data, key, cleanup, threadkey->pool); + return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool); } -APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey, fspr_threadkey_t *key) { *thekey = key->key; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, - apr_os_threadkey_t *thekey, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key, + fspr_os_threadkey_t *thekey, fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*key) == NULL) { - (*key) = (apr_threadkey_t *)apr_pcalloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_pcalloc(pool, sizeof(fspr_threadkey_t)); (*key)->pool = pool; } (*key)->key = *thekey; diff --git a/libs/apr/threadproc/netware/proc.c b/libs/apr/threadproc/netware/proc.c index 0f70776999..58fb147453 100644 --- a/libs/apr/threadproc/netware/proc.c +++ b/libs/apr/threadproc/netware/proc.c @@ -14,16 +14,16 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" -#include "apr_arch_file_io.h" -#include "apr_strings.h" -#include "apr_portable.h" +#include "fspr_arch_threadproc.h" +#include "fspr_arch_file_io.h" +#include "fspr_strings.h" +#include "fspr_portable.h" #include -apr_status_t apr_netware_proc_cleanup(void *theproc) +fspr_status_t fspr_netware_proc_cleanup(void *theproc) { - apr_proc_t *proc = theproc; + fspr_proc_t *proc = theproc; int exit_int; int waitpid_options = WUNTRACED | WNOHANG; @@ -35,9 +35,9 @@ apr_status_t apr_netware_proc_cleanup(void *theproc) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new,apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new,fspr_pool_t *pool) { - (*new) = (apr_procattr_t *)apr_pcalloc(pool, sizeof(apr_procattr_t)); + (*new) = (fspr_procattr_t *)fspr_pcalloc(pool, sizeof(fspr_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -45,18 +45,18 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new,apr_pool_t *p (*new)->pool = pool; (*new)->cmdtype = APR_PROGRAM; /* Default to a current path since NetWare doesn't handle it very well */ - apr_filepath_get(&((*new)->currdir), APR_FILEPATH_NATIVE, pool); + fspr_filepath_get(&((*new)->currdir), APR_FILEPATH_NATIVE, pool); (*new)->detached = 1; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t in, - apr_int32_t out, apr_int32_t err) +APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, fspr_int32_t in, + fspr_int32_t out, fspr_int32_t err) { - apr_status_t status; + fspr_status_t status; if (in != 0) { - if ((status = apr_file_pipe_create(&attr->child_in, &attr->parent_in, + if ((status = fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool)) != APR_SUCCESS) { return status; } @@ -64,18 +64,18 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_in, 0); + fspr_file_pipe_timeout_set(attr->child_in, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_in, 0); + fspr_file_pipe_timeout_set(attr->parent_in, 0); break; default: - apr_file_pipe_timeout_set(attr->child_in, 0); - apr_file_pipe_timeout_set(attr->parent_in, 0); + fspr_file_pipe_timeout_set(attr->child_in, 0); + fspr_file_pipe_timeout_set(attr->parent_in, 0); } } if (out) { - if ((status = apr_file_pipe_create(&attr->parent_out, &attr->child_out, + if ((status = fspr_file_pipe_create(&attr->parent_out, &attr->child_out, attr->pool)) != APR_SUCCESS) { return status; } @@ -83,18 +83,18 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_out, 0); + fspr_file_pipe_timeout_set(attr->child_out, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_out, 0); + fspr_file_pipe_timeout_set(attr->parent_out, 0); break; default: - apr_file_pipe_timeout_set(attr->child_out, 0); - apr_file_pipe_timeout_set(attr->parent_out, 0); + fspr_file_pipe_timeout_set(attr->child_out, 0); + fspr_file_pipe_timeout_set(attr->parent_out, 0); } } if (err) { - if ((status = apr_file_pipe_create(&attr->parent_err, &attr->child_err, + if ((status = fspr_file_pipe_create(&attr->parent_err, &attr->child_err, attr->pool)) != APR_SUCCESS) { return status; } @@ -102,90 +102,90 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_err, 0); + fspr_file_pipe_timeout_set(attr->child_err, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_err, 0); + fspr_file_pipe_timeout_set(attr->parent_err, 0); break; default: - apr_file_pipe_timeout_set(attr->child_err, 0); - apr_file_pipe_timeout_set(attr->parent_err, 0); + fspr_file_pipe_timeout_set(attr->child_err, 0); + fspr_file_pipe_timeout_set(attr->parent_err, 0); } } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, apr_file_t *child_in, - apr_file_t *parent_in) +APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr, fspr_file_t *child_in, + fspr_file_t *parent_in) { if (attr->child_in == NULL && attr->parent_in == NULL) - apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool); + fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool); if (child_in != NULL) - apr_file_dup2(attr->child_in, child_in, attr->pool); + fspr_file_dup2(attr->child_in, child_in, attr->pool); if (parent_in != NULL) - apr_file_dup2(attr->parent_in, parent_in, attr->pool); + fspr_file_dup2(attr->parent_in, parent_in, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_file_t *child_out, - apr_file_t *parent_out) +APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr, fspr_file_t *child_out, + fspr_file_t *parent_out) { if (attr->child_out == NULL && attr->parent_out == NULL) - apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool); + fspr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool); if (child_out != NULL) - apr_file_dup2(attr->child_out, child_out, attr->pool); + fspr_file_dup2(attr->child_out, child_out, attr->pool); if (parent_out != NULL) - apr_file_dup2(attr->parent_out, parent_out, attr->pool); + fspr_file_dup2(attr->parent_out, parent_out, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_file_t *child_err, - apr_file_t *parent_err) +APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr, fspr_file_t *child_err, + fspr_file_t *parent_err) { if (attr->child_err == NULL && attr->parent_err == NULL) - apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool); + fspr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool); if (child_err != NULL) - apr_file_dup2(attr->child_err, child_err, attr->pool); + fspr_file_dup2(attr->child_err, child_err, attr->pool); if (parent_err != NULL) - apr_file_dup2(attr->parent_err, parent_err, attr->pool); + fspr_file_dup2(attr->parent_err, parent_err, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr, const char *dir) { - return apr_filepath_merge(&attr->currdir, NULL, dir, + return fspr_filepath_merge(&attr->currdir, NULL, dir, APR_FILEPATH_NATIVE, attr->pool); } -APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) +APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr, + fspr_cmdtype_e cmd) { /* won't ever be called on this platform, so don't save the function pointer */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) +APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, fspr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; } #if APR_HAS_FORK -APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *pool) { int pid; @@ -207,7 +207,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) } #endif -static apr_status_t limit_proc(apr_procattr_t *attr) +static fspr_status_t limit_proc(fspr_procattr_t *attr) { #if APR_HAVE_STRUCT_RLIMIT && APR_HAVE_SETRLIMIT #ifdef RLIMIT_CPU @@ -252,33 +252,33 @@ static apr_status_t limit_proc(apr_procattr_t *attr) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, - apr_child_errfn_t *errfn) +APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr, + fspr_child_errfn_t *errfn) { /* won't ever be called on this platform, so don't save the function pointer */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, - apr_int32_t chk) +APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr, + fspr_int32_t chk) { /* won't ever be used on this platform, so don't save the flag */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, - apr_int32_t addrspace) +APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr, + fspr_int32_t addrspace) { attr->addrspace = addrspace; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc, +APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *newproc, const char *progname, const char * const *args, const char * const *env, - apr_procattr_t *attr, - apr_pool_t *pool) + fspr_procattr_t *attr, + fspr_pool_t *pool) { wiring_t wire; int addr_space; @@ -299,9 +299,9 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc, if (attr->currdir) { char *fullpath = NULL; - apr_status_t rv; + fspr_status_t rv; - if ((rv = apr_filepath_merge(&fullpath, attr->currdir, progname, + if ((rv = fspr_filepath_merge(&fullpath, attr->currdir, progname, APR_FILEPATH_NATIVE, pool)) != APR_SUCCESS) { return rv; } @@ -314,47 +314,47 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc, } if (attr->child_in) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_in), - attr->child_in, apr_unix_file_cleanup); - apr_file_close(attr->child_in); + fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_in), + attr->child_in, fspr_unix_file_cleanup); + fspr_file_close(attr->child_in); } if (attr->child_out) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_out), - attr->child_out, apr_unix_file_cleanup); - apr_file_close(attr->child_out); + fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_out), + attr->child_out, fspr_unix_file_cleanup); + fspr_file_close(attr->child_out); } if (attr->child_err) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_err), - attr->child_err, apr_unix_file_cleanup); - apr_file_close(attr->child_err); + fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_err), + attr->child_err, fspr_unix_file_cleanup); + fspr_file_close(attr->child_err); } - apr_pool_cleanup_register(pool, (void *)newproc, apr_netware_proc_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, (void *)newproc, fspr_netware_proc_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc, int *exitcode, - apr_exit_why_e *exitwhy, - apr_wait_how_e waithow, - apr_pool_t *p) + fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow, + fspr_pool_t *p) { proc->pid = -1; - return apr_proc_wait(proc, exitcode, exitwhy, waithow); + return fspr_proc_wait(proc, exitcode, exitwhy, waithow); } -APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, - int *exitcode, apr_exit_why_e *exitwhy, - apr_wait_how_e waithow) +APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc, + int *exitcode, fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow) { pid_t pstatus; int waitpid_options = WUNTRACED; int exit_int; int ignore; - apr_exit_why_e ignorewhy; + fspr_exit_why_e ignorewhy; if (exitcode == NULL) { exitcode = &ignore; @@ -407,7 +407,7 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, return errno; } -APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what, +APR_DECLARE(fspr_status_t) fspr_procattr_limit_set(fspr_procattr_t *attr, fspr_int32_t what, struct rlimit *limit) { switch(what) { @@ -436,7 +436,7 @@ APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32 return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr, const char *username, const char *password) { @@ -444,7 +444,7 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr, const char *groupname) { /* Always return SUCCESS because NetWare threads don't run within a group */ diff --git a/libs/apr/threadproc/netware/procsup.c b/libs/apr/threadproc/netware/procsup.c index 72fa1d9764..07b67f65c8 100644 --- a/libs/apr/threadproc/netware/procsup.c +++ b/libs/apr/threadproc/netware/procsup.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" +#include "fspr_arch_threadproc.h" -apr_status_t apr_proc_detach(int daemonize) +fspr_status_t fspr_proc_detach(int daemonize) { #if 0 int x; diff --git a/libs/apr/threadproc/netware/signals.c b/libs/apr/threadproc/netware/signals.c index bc660af7dc..a50519a0e6 100644 --- a/libs/apr/threadproc/netware/signals.c +++ b/libs/apr/threadproc/netware/signals.c @@ -14,29 +14,29 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" +#include "fspr_arch_threadproc.h" #include -#include "apr_private.h" -#include "apr_pools.h" -#include "apr_signal.h" -#include "apr_strings.h" +#include "fspr_private.h" +#include "fspr_pools.h" +#include "fspr_signal.h" +#include "fspr_strings.h" #include #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H #include #endif -APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signum) +APR_DECLARE(fspr_status_t) fspr_proc_kill(fspr_proc_t *proc, int signum) { return APR_ENOTIMPL; } -void apr_signal_init(apr_pool_t *pglobal) +void fspr_signal_init(fspr_pool_t *pglobal) { } -const char *apr_signal_description_get(int signum) +const char *fspr_signal_description_get(int signum) { switch (signum) { @@ -64,19 +64,19 @@ static void *signal_thread_func(void *signal_handler) return NULL; } -APR_DECLARE(apr_status_t) apr_setup_signal_thread(void) +APR_DECLARE(fspr_status_t) fspr_setup_signal_thread(void) { int rv = 0; return rv; } -APR_DECLARE(apr_status_t) apr_signal_block(int signum) +APR_DECLARE(fspr_status_t) fspr_signal_block(int signum) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_signal_unblock(int signum) +APR_DECLARE(fspr_status_t) fspr_signal_unblock(int signum) { return APR_ENOTIMPL; } diff --git a/libs/apr/threadproc/netware/thread.c b/libs/apr/threadproc/netware/thread.c index dcf4993db9..6bcddac2c2 100644 --- a/libs/apr/threadproc/netware/thread.c +++ b/libs/apr/threadproc/netware/thread.c @@ -14,18 +14,18 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_portable.h" -#include "apr_strings.h" -#include "apr_arch_threadproc.h" +#include "fspr.h" +#include "fspr_portable.h" +#include "fspr_strings.h" +#include "fspr_arch_threadproc.h" static int thread_count = 0; -apr_status_t apr_threadattr_create(apr_threadattr_t **new, - apr_pool_t *pool) +fspr_status_t fspr_threadattr_create(fspr_threadattr_t **new, + fspr_pool_t *pool) { - (*new) = (apr_threadattr_t *)apr_palloc(pool, - sizeof(apr_threadattr_t)); + (*new) = (fspr_threadattr_t *)fspr_palloc(pool, + sizeof(fspr_threadattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -38,45 +38,45 @@ apr_status_t apr_threadattr_create(apr_threadattr_t **new, return APR_SUCCESS; } -apr_status_t apr_threadattr_detach_set(apr_threadattr_t *attr,apr_int32_t on) +fspr_status_t fspr_threadattr_detach_set(fspr_threadattr_t *attr,fspr_int32_t on) { attr->detach = on; return APR_SUCCESS; } -apr_status_t apr_threadattr_detach_get(apr_threadattr_t *attr) +fspr_status_t fspr_threadattr_detach_get(fspr_threadattr_t *attr) { if (attr->detach == 1) return APR_DETACH; return APR_NOTDETACH; } -APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, - apr_size_t stacksize) +APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr, + fspr_size_t stacksize) { attr->stack_size = stacksize; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, - apr_size_t size) +APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr, + fspr_size_t size) { return APR_ENOTIMPL; } static void *dummy_worker(void *opaque) { - apr_thread_t *thd = (apr_thread_t *)opaque; + fspr_thread_t *thd = (fspr_thread_t *)opaque; return thd->func(thd, thd->data); } -apr_status_t apr_thread_create(apr_thread_t **new, - apr_threadattr_t *attr, - apr_thread_start_t func, +fspr_status_t fspr_thread_create(fspr_thread_t **new, + fspr_threadattr_t *attr, + fspr_thread_start_t func, void *data, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_status_t stat; + fspr_status_t stat; long flags = NX_THR_BIND_CONTEXT; char threadName[NX_MAX_OBJECT_NAME_LEN+1]; size_t stack_size = APR_DEFAULT_STACK_SIZE; @@ -97,7 +97,7 @@ apr_status_t apr_thread_create(apr_thread_t **new, stack_size = attr->stack_size; } - (*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t)); + (*new) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -106,9 +106,9 @@ apr_status_t apr_thread_create(apr_thread_t **new, (*new)->pool = pool; (*new)->data = data; (*new)->func = func; - (*new)->thread_name = (char*)apr_pstrdup(pool, threadName); + (*new)->thread_name = (char*)fspr_pstrdup(pool, threadName); - stat = apr_pool_create(&(*new)->pool, pool); + stat = fspr_pool_create(&(*new)->pool, pool); if (stat != APR_SUCCESS) { return stat; } @@ -141,34 +141,34 @@ apr_status_t apr_thread_create(apr_thread_t **new, return(stat);// if error } -apr_os_thread_t apr_os_thread_current() +fspr_os_thread_t fspr_os_thread_current() { return NXThreadGetId(); } -int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2) +int fspr_os_thread_equal(fspr_os_thread_t tid1, fspr_os_thread_t tid2) { return (tid1 == tid2); } -void apr_thread_yield() +void fspr_thread_yield() { NXThreadYield(); } -apr_status_t apr_thread_exit(apr_thread_t *thd, - apr_status_t retval) +fspr_status_t fspr_thread_exit(fspr_thread_t *thd, + fspr_status_t retval) { thd->exitval = retval; - apr_pool_destroy(thd->pool); + fspr_pool_destroy(thd->pool); NXThreadExit(NULL); return APR_SUCCESS; } -apr_status_t apr_thread_join(apr_status_t *retval, - apr_thread_t *thd) +fspr_status_t fspr_thread_join(fspr_status_t *retval, + fspr_thread_t *thd) { - apr_status_t stat; + fspr_status_t stat; NXThreadId_t dthr; if ((stat = NXThreadJoin(thd->td, &dthr, NULL)) == 0) { @@ -180,16 +180,16 @@ apr_status_t apr_thread_join(apr_status_t *retval, } } -apr_status_t apr_thread_detach(apr_thread_t *thd) +fspr_status_t fspr_thread_detach(fspr_thread_t *thd) { return APR_SUCCESS; } -apr_status_t apr_thread_data_get(void **data, const char *key, - apr_thread_t *thread) +fspr_status_t fspr_thread_data_get(void **data, const char *key, + fspr_thread_t *thread) { if (thread != NULL) { - return apr_pool_userdata_get(data, key, thread->pool); + return fspr_pool_userdata_get(data, key, thread->pool); } else { data = NULL; @@ -197,12 +197,12 @@ apr_status_t apr_thread_data_get(void **data, const char *key, } } -apr_status_t apr_thread_data_set(void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_thread_t *thread) +fspr_status_t fspr_thread_data_set(void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_thread_t *thread) { if (thread != NULL) { - return apr_pool_userdata_set(data, key, cleanup, thread->pool); + return fspr_pool_userdata_set(data, key, cleanup, thread->pool); } else { data = NULL; @@ -210,8 +210,8 @@ apr_status_t apr_thread_data_set(void *data, const char *key, } } -APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, - apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd, + fspr_thread_t *thd) { if (thd == NULL) { return APR_ENOTHREAD; @@ -220,29 +220,29 @@ APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, - apr_os_thread_t *thethd, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd, + fspr_os_thread_t *thethd, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*thd) == NULL) { - (*thd) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t)); + (*thd) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t)); (*thd)->pool = pool; } (*thd)->td = *thethd; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control, + fspr_pool_t *p) { - (*control) = apr_pcalloc(p, sizeof(**control)); + (*control) = fspr_pcalloc(p, sizeof(**control)); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, +APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control, void (*func)(void)) { if (!atomic_xchg(&control->value, 1)) { diff --git a/libs/apr/threadproc/netware/threadpriv.c b/libs/apr/threadproc/netware/threadpriv.c index 54680a5634..3813fdfc38 100644 --- a/libs/apr/threadproc/netware/threadpriv.c +++ b/libs/apr/threadproc/netware/threadpriv.c @@ -14,15 +14,15 @@ * limitations under the License. */ -#include "apr_portable.h" -#include "apr_arch_threadproc.h" +#include "fspr_portable.h" +#include "fspr_arch_threadproc.h" -apr_status_t apr_threadkey_private_create(apr_threadkey_t **key, - void (*dest)(void *), apr_pool_t *pool) +fspr_status_t fspr_threadkey_private_create(fspr_threadkey_t **key, + void (*dest)(void *), fspr_pool_t *pool) { - apr_status_t stat; + fspr_status_t stat; - (*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; } @@ -35,9 +35,9 @@ apr_status_t apr_threadkey_private_create(apr_threadkey_t **key, return stat; } -apr_status_t apr_threadkey_private_get(void **new, apr_threadkey_t *key) +fspr_status_t fspr_threadkey_private_get(void **new, fspr_threadkey_t *key) { - apr_status_t stat; + fspr_status_t stat; if ((stat = NXKeyGetValue(key->key, new)) == 0) { return APR_SUCCESS; @@ -47,9 +47,9 @@ apr_status_t apr_threadkey_private_get(void **new, apr_threadkey_t *key) } } -apr_status_t apr_threadkey_private_set(void *priv, apr_threadkey_t *key) +fspr_status_t fspr_threadkey_private_set(void *priv, fspr_threadkey_t *key) { - apr_status_t stat; + fspr_status_t stat; if ((stat = NXKeySetValue(key->key, priv)) == 0) { return APR_SUCCESS; } @@ -58,42 +58,42 @@ apr_status_t apr_threadkey_private_set(void *priv, apr_threadkey_t *key) } } -apr_status_t apr_threadkey_private_delete(apr_threadkey_t *key) +fspr_status_t fspr_threadkey_private_delete(fspr_threadkey_t *key) { - apr_status_t stat; + fspr_status_t stat; if ((stat = NXKeyDelete(key->key)) == 0) { return APR_SUCCESS; } return stat; } -apr_status_t apr_threadkey_data_get(void **data, const char *key, apr_threadkey_t *threadkey) +fspr_status_t fspr_threadkey_data_get(void **data, const char *key, fspr_threadkey_t *threadkey) { - return apr_pool_userdata_get(data, key, threadkey->pool); + return fspr_pool_userdata_get(data, key, threadkey->pool); } -apr_status_t apr_threadkey_data_set(void *data, - const char *key, apr_status_t (*cleanup) (void *), - apr_threadkey_t *threadkey) +fspr_status_t fspr_threadkey_data_set(void *data, + const char *key, fspr_status_t (*cleanup) (void *), + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_set(data, key, cleanup, threadkey->pool); + return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool); } -apr_status_t apr_os_threadkey_get(apr_os_threadkey_t *thekey, - apr_threadkey_t *key) +fspr_status_t fspr_os_threadkey_get(fspr_os_threadkey_t *thekey, + fspr_threadkey_t *key) { thekey = &(key->key); return APR_SUCCESS; } -apr_status_t apr_os_threadkey_put(apr_threadkey_t **key, - apr_os_threadkey_t *thekey, apr_pool_t *pool) +fspr_status_t fspr_os_threadkey_put(fspr_threadkey_t **key, + fspr_os_threadkey_t *thekey, fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*key) == NULL) { - (*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t)); (*key)->pool = pool; } (*key)->key = *thekey; diff --git a/libs/apr/threadproc/os2/proc.c b/libs/apr/threadproc/os2/proc.c index 20dfffb8b8..8448a33bc5 100644 --- a/libs/apr/threadproc/os2/proc.c +++ b/libs/apr/threadproc/os2/proc.c @@ -17,16 +17,16 @@ #define INCL_DOS #define INCL_DOSERRORS -#include "apr_arch_threadproc.h" -#include "apr_arch_file_io.h" -#include "apr_private.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include "apr_strings.h" -#include "apr_signal.h" +#include "fspr_arch_threadproc.h" +#include "fspr_arch_file_io.h" +#include "fspr_private.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" +#include "fspr_strings.h" +#include "fspr_signal.h" #include #include #include @@ -34,10 +34,10 @@ #include #include -APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new, fspr_pool_t *pool) { - (*new) = (apr_procattr_t *)apr_palloc(pool, - sizeof(apr_procattr_t)); + (*new) = (fspr_procattr_t *)fspr_palloc(pool, + sizeof(fspr_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -55,12 +55,12 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t * return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t in, - apr_int32_t out, apr_int32_t err) +APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, fspr_int32_t in, + fspr_int32_t out, fspr_int32_t err) { - apr_status_t stat; + fspr_status_t stat; if (in) { - if ((stat = apr_file_pipe_create(&attr->child_in, &attr->parent_in, + if ((stat = fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool)) != APR_SUCCESS) { return stat; } @@ -68,18 +68,18 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_in, 0); + fspr_file_pipe_timeout_set(attr->child_in, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_in, 0); + fspr_file_pipe_timeout_set(attr->parent_in, 0); break; default: - apr_file_pipe_timeout_set(attr->child_in, 0); - apr_file_pipe_timeout_set(attr->parent_in, 0); + fspr_file_pipe_timeout_set(attr->child_in, 0); + fspr_file_pipe_timeout_set(attr->parent_in, 0); } } if (out) { - if ((stat = apr_file_pipe_create(&attr->parent_out, &attr->child_out, + if ((stat = fspr_file_pipe_create(&attr->parent_out, &attr->child_out, attr->pool)) != APR_SUCCESS) { return stat; } @@ -87,18 +87,18 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_out, 0); + fspr_file_pipe_timeout_set(attr->child_out, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_out, 0); + fspr_file_pipe_timeout_set(attr->parent_out, 0); break; default: - apr_file_pipe_timeout_set(attr->child_out, 0); - apr_file_pipe_timeout_set(attr->parent_out, 0); + fspr_file_pipe_timeout_set(attr->child_out, 0); + fspr_file_pipe_timeout_set(attr->parent_out, 0); } } if (err) { - if ((stat = apr_file_pipe_create(&attr->parent_err, &attr->child_err, + if ((stat = fspr_file_pipe_create(&attr->parent_err, &attr->child_err, attr->pool)) != APR_SUCCESS) { return stat; } @@ -106,90 +106,90 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_err, 0); + fspr_file_pipe_timeout_set(attr->child_err, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_err, 0); + fspr_file_pipe_timeout_set(attr->parent_err, 0); break; default: - apr_file_pipe_timeout_set(attr->child_err, 0); - apr_file_pipe_timeout_set(attr->parent_err, 0); + fspr_file_pipe_timeout_set(attr->child_err, 0); + fspr_file_pipe_timeout_set(attr->parent_err, 0); } } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, apr_file_t *child_in, - apr_file_t *parent_in) +APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr, fspr_file_t *child_in, + fspr_file_t *parent_in) { if (attr->child_in == NULL && attr->parent_in == NULL) - apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool); + fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool); if (child_in != NULL) - apr_file_dup(&attr->child_in, child_in, attr->pool); + fspr_file_dup(&attr->child_in, child_in, attr->pool); if (parent_in != NULL) - apr_file_dup(&attr->parent_in, parent_in, attr->pool); + fspr_file_dup(&attr->parent_in, parent_in, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_file_t *child_out, - apr_file_t *parent_out) +APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr, fspr_file_t *child_out, + fspr_file_t *parent_out) { if (attr->child_out == NULL && attr->parent_out == NULL) - apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool); + fspr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool); if (child_out != NULL) - apr_file_dup(&attr->child_out, child_out, attr->pool); + fspr_file_dup(&attr->child_out, child_out, attr->pool); if (parent_out != NULL) - apr_file_dup(&attr->parent_out, parent_out, attr->pool); + fspr_file_dup(&attr->parent_out, parent_out, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_file_t *child_err, - apr_file_t *parent_err) +APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr, fspr_file_t *child_err, + fspr_file_t *parent_err) { if (attr->child_err == NULL && attr->parent_err == NULL) - apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool); + fspr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool); if (child_err != NULL) - apr_file_dup(&attr->child_err, child_err, attr->pool); + fspr_file_dup(&attr->child_err, child_err, attr->pool); if (parent_err != NULL) - apr_file_dup(&attr->parent_err, parent_err, attr->pool); + fspr_file_dup(&attr->parent_err, parent_err, attr->pool); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, const char *dir) +APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr, const char *dir) { - attr->currdir = apr_pstrdup(attr->pool, dir); + attr->currdir = fspr_pstrdup(attr->pool, dir); if (attr->currdir) { return APR_SUCCESS; } return APR_ENOMEM; } -APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) +APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr, + fspr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach) +APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, fspr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *pool) { int pid; @@ -215,7 +215,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) /* quotes in the string are doubled up. * Used to escape quotes in args passed to OS/2's cmd.exe */ -static char *double_quotes(apr_pool_t *pool, const char *str) +static char *double_quotes(fspr_pool_t *pool, const char *str) { int num_quotes = 0; int len = 0; @@ -225,7 +225,7 @@ static char *double_quotes(apr_pool_t *pool, const char *str) num_quotes += str[len++] == '\"'; } - quote_doubled_str = apr_palloc(pool, len + num_quotes + 1); + quote_doubled_str = fspr_palloc(pool, len + num_quotes + 1); dest = quote_doubled_str; while (*str) { @@ -240,8 +240,8 @@ static char *double_quotes(apr_pool_t *pool, const char *str) -APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, - apr_child_errfn_t *errfn) +APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr, + fspr_child_errfn_t *errfn) { /* won't ever be called on this platform, so don't save the function pointer */ return APR_SUCCESS; @@ -249,15 +249,15 @@ APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, -APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, - apr_int32_t chk) +APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr, + fspr_int32_t chk) { /* won't ever be used on this platform, so don't save the flag */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, - apr_int32_t addrspace) +APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr, + fspr_int32_t addrspace) { /* won't ever be used on this platform, so don't save the flag */ return APR_SUCCESS; @@ -265,13 +265,13 @@ APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, -APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname, +APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *proc, const char *progname, const char * const *args, const char * const *env, - apr_procattr_t *attr, apr_pool_t *pool) + fspr_procattr_t *attr, fspr_pool_t *pool) { int i, arg, numargs, cmdlen; - apr_status_t status; + fspr_status_t status; const char **newargs; char savedir[300]; HFILE save_in, save_out, save_err, dup; @@ -279,7 +279,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname char *extension, *newprogname, *extra_arg = NULL, *cmdline, *cmdline_pos; char interpreter[1024]; char error_object[260]; - apr_file_t *progfile; + fspr_file_t *progfile; int env_len, e; char *env_block, *env_block_pos; RESULTCODES rescodes; @@ -314,7 +314,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname DosSetFHState(attr->parent_err->filedes, OPEN_FLAGS_NOINHERIT); } - apr_signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */ + fspr_signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */ if (attr->currdir != NULL) { _getcwd2(savedir, sizeof(savedir)); @@ -340,21 +340,21 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname strcpy(interpreter, "#!" SHELL_PATH); extra_arg = "/C"; } else if (stricmp(extension, ".exe") != 0) { - status = apr_file_open(&progfile, progname, APR_READ|APR_BUFFERED, 0, pool); + status = fspr_file_open(&progfile, progname, APR_READ|APR_BUFFERED, 0, pool); if (status != APR_SUCCESS && APR_STATUS_IS_ENOENT(status)) { - progname = apr_pstrcat(pool, progname, ".exe", NULL); + progname = fspr_pstrcat(pool, progname, ".exe", NULL); } if (status == APR_SUCCESS) { - status = apr_file_gets(interpreter, sizeof(interpreter), progfile); + status = fspr_file_gets(interpreter, sizeof(interpreter), progfile); if (status == APR_SUCCESS) { if (interpreter[0] == '#' && interpreter[1] == '!') { /* delete CR/LF & any other whitespace off the end */ int end = strlen(interpreter) - 1; - while (end >= 0 && apr_isspace(interpreter[end])) { + while (end >= 0 && fspr_isspace(interpreter[end])) { interpreter[end] = '\0'; end--; } @@ -376,7 +376,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname } } - apr_file_close(progfile); + fspr_file_close(progfile); } } @@ -386,7 +386,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname i++; } - newargs = (const char **)apr_palloc(pool, sizeof (char *) * (i + 4)); + newargs = (const char **)fspr_palloc(pool, sizeof (char *) * (i + 4)); numargs = 0; if (interpreter[0]) @@ -394,7 +394,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname if (extra_arg) newargs[numargs++] = "/c"; - newargs[numargs++] = newprogname = apr_pstrdup(pool, progname); + newargs[numargs++] = newprogname = fspr_pstrdup(pool, progname); arg = 1; while (args && args[arg]) { @@ -412,14 +412,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname for (i=0; i\" ")) - a = apr_pstrcat(pool, "\"", double_quotes(pool, a), "\"", NULL); + a = fspr_pstrcat(pool, "\"", double_quotes(pool, a), "\"", NULL); if (i) *(cmdline_pos++) = ' '; @@ -441,7 +441,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname for (env_len=1, e=0; env[e]; e++) env_len += strlen(env[e]) + 1; - env_block = apr_palloc(pool, env_len); + env_block = fspr_palloc(pool, env_len); env_block_pos = env_block; for (e=0; env[e]; e++) { @@ -464,21 +464,21 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname } if (attr->child_in) { - apr_file_close(attr->child_in); + fspr_file_close(attr->child_in); dup = STDIN_FILENO; DosDupHandle(save_in, &dup); DosClose(save_in); } if (attr->child_out) { - apr_file_close(attr->child_out); + fspr_file_close(attr->child_out); dup = STDOUT_FILENO; DosDupHandle(save_out, &dup); DosClose(save_out); } if (attr->child_err) { - apr_file_close(attr->child_err); + fspr_file_close(attr->child_err); dup = STDERR_FILENO; DosDupHandle(save_err, &dup); DosClose(save_err); @@ -497,10 +497,10 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname static void proces_result_codes(RESULTCODES codes, int *exitcode, - apr_exit_why_e *exitwhy) + fspr_exit_why_e *exitwhy) { int result = 0; - apr_exit_why_e why = APR_PROC_EXIT; + fspr_exit_why_e why = APR_PROC_EXIT; switch (codes.codeTerminate) { case TC_EXIT: /* Normal exit */ @@ -553,11 +553,11 @@ static void proces_result_codes(RESULTCODES codes, -APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc, int *exitcode, - apr_exit_why_e *exitwhy, - apr_wait_how_e waithow, - apr_pool_t *p) + fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow, + fspr_pool_t *p) { RESULTCODES codes; ULONG rc; @@ -578,9 +578,9 @@ APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, -APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, - int *exitcode, apr_exit_why_e *exitwhy, - apr_wait_how_e waithow) +APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc, + int *exitcode, fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow) { RESULTCODES codes; ULONG rc; @@ -599,19 +599,19 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, -APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize) +APR_DECLARE(fspr_status_t) fspr_proc_detach(int daemonize) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr, const char *username, const char *password) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr, const char *groupname) { return APR_ENOTIMPL; diff --git a/libs/apr/threadproc/os2/thread.c b/libs/apr/threadproc/os2/thread.c index c1c35219d0..bed45d3ffd 100644 --- a/libs/apr/threadproc/os2/thread.c +++ b/libs/apr/threadproc/os2/thread.c @@ -16,17 +16,17 @@ #define INCL_DOSERRORS #define INCL_DOS -#include "apr_arch_threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" -#include "apr_arch_file_io.h" +#include "fspr_arch_threadproc.h" +#include "fspr_thread_proc.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" +#include "fspr_arch_file_io.h" #include -APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new, fspr_pool_t *pool) { - (*new) = (apr_threadattr_t *)apr_palloc(pool, sizeof(apr_threadattr_t)); + (*new) = (fspr_threadattr_t *)fspr_palloc(pool, sizeof(fspr_threadattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -40,7 +40,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool -APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_int32_t on) +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr, fspr_int32_t on) { attr->attr |= APR_THREADATTR_DETACHED; return APR_SUCCESS; @@ -48,40 +48,40 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_ -APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr) +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr) { return (attr->attr & APR_THREADATTR_DETACHED) ? APR_DETACH : APR_NOTDETACH; } -APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, - apr_size_t stacksize) +APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr, + fspr_size_t stacksize) { attr->stacksize = stacksize; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, - apr_size_t size) +APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr, + fspr_size_t size) { return APR_ENOTIMPL; } -static void apr_thread_begin(void *arg) +static void fspr_thread_begin(void *arg) { - apr_thread_t *thread = (apr_thread_t *)arg; + fspr_thread_t *thread = (fspr_thread_t *)arg; thread->exitval = thread->func(thread, thread->data); } -APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr, - apr_thread_start_t func, void *data, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new, fspr_threadattr_t *attr, + fspr_thread_start_t func, void *data, + fspr_pool_t *pool) { - apr_status_t stat; - apr_thread_t *thread; + fspr_status_t stat; + fspr_thread_t *thread; - thread = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t)); + thread = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t)); *new = thread; if (thread == NULL) { @@ -92,21 +92,21 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t thread->attr = attr; thread->func = func; thread->data = data; - stat = apr_pool_create(&thread->pool, pool); + stat = fspr_pool_create(&thread->pool, pool); if (stat != APR_SUCCESS) { return stat; } if (attr == NULL) { - stat = apr_threadattr_create(&thread->attr, thread->pool); + stat = fspr_threadattr_create(&thread->attr, thread->pool); if (stat != APR_SUCCESS) { return stat; } } - thread->tid = _beginthread(apr_thread_begin, NULL, + thread->tid = _beginthread(fspr_thread_begin, NULL, thread->attr->stacksize > 0 ? thread->attr->stacksize : APR_THREAD_STACKSIZE, thread); @@ -120,7 +120,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t -APR_DECLARE(apr_os_thread_t) apr_os_thread_current() +APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current() { PIB *ppib; TIB *ptib; @@ -130,7 +130,7 @@ APR_DECLARE(apr_os_thread_t) apr_os_thread_current() -APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval) +APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd, fspr_status_t retval) { thd->exitval = retval; _endthread(); @@ -139,7 +139,7 @@ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval -APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval, fspr_thread_t *thd) { ULONG rc; TID waittid = thd->tid; @@ -158,7 +158,7 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *th -APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd) { thd->attr->attr |= APR_THREADATTR_DETACHED; return APR_SUCCESS; @@ -166,14 +166,14 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) -void apr_thread_yield() +void fspr_thread_yield() { DosSleep(0); } -APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd, fspr_thread_t *thd) { *thethd = &thd->tid; return APR_SUCCESS; @@ -181,11 +181,11 @@ APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, apr_thread -APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd, fspr_os_thread_t *thethd, + fspr_pool_t *pool) { if ((*thd) == NULL) { - (*thd) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t)); + (*thd) = (fspr_thread_t *)fspr_pcalloc(pool, sizeof(fspr_thread_t)); (*thd)->pool = pool; } (*thd)->tid = *thethd; @@ -194,34 +194,34 @@ APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t -int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2) +int fspr_os_thread_equal(fspr_os_thread_t tid1, fspr_os_thread_t tid2) { return tid1 == tid2; } -APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, apr_thread_t *thread) +APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key, fspr_thread_t *thread) { - return apr_pool_userdata_get(data, key, thread->pool); + return fspr_pool_userdata_get(data, key, thread->pool); } -APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_thread_t *thread) +APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_thread_t *thread) { - return apr_pool_userdata_set(data, key, cleanup, thread->pool); + return fspr_pool_userdata_set(data, key, cleanup, thread->pool); } APR_POOL_IMPLEMENT_ACCESSOR(thread) -static apr_status_t thread_once_cleanup(void *vcontrol) +static fspr_status_t thread_once_cleanup(void *vcontrol) { - apr_thread_once_t *control = (apr_thread_once_t *)vcontrol; + fspr_thread_once_t *control = (fspr_thread_once_t *)vcontrol; if (control->sem) { DosCloseEventSem(control->sem); @@ -232,19 +232,19 @@ static apr_status_t thread_once_cleanup(void *vcontrol) -APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control, + fspr_pool_t *p) { ULONG rc; - *control = (apr_thread_once_t *)apr_pcalloc(p, sizeof(apr_thread_once_t)); + *control = (fspr_thread_once_t *)fspr_pcalloc(p, sizeof(fspr_thread_once_t)); rc = DosCreateEventSem(NULL, &(*control)->sem, 0, TRUE); - apr_pool_cleanup_register(p, control, thread_once_cleanup, apr_pool_cleanup_null); + fspr_pool_cleanup_register(p, control, thread_once_cleanup, fspr_pool_cleanup_null); return APR_FROM_OS_ERROR(rc); } -APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, +APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control, void (*func)(void)) { if (!control->hit) { diff --git a/libs/apr/threadproc/os2/threadpriv.c b/libs/apr/threadproc/os2/threadpriv.c index 107ec10d71..2e315abedd 100644 --- a/libs/apr/threadproc/os2/threadpriv.c +++ b/libs/apr/threadproc/os2/threadpriv.c @@ -14,19 +14,19 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" -#include "apr_thread_proc.h" -#include "apr_portable.h" -#include "apr_general.h" -#include "apr_errno.h" -#include "apr_lib.h" -#include "apr_arch_file_io.h" +#include "fspr_arch_threadproc.h" +#include "fspr_thread_proc.h" +#include "fspr_portable.h" +#include "fspr_general.h" +#include "fspr_errno.h" +#include "fspr_lib.h" +#include "fspr_arch_file_io.h" -APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, +APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key, void (*dest)(void *), - apr_pool_t *pool) + fspr_pool_t *pool) { - (*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; @@ -36,51 +36,51 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, return APR_OS2_STATUS(DosAllocThreadLocalMemory(1, &((*key)->key))); } -APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new, fspr_threadkey_t *key) { (*new) = (void *)*(key->key); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv, fspr_threadkey_t *key) { *(key->key) = (ULONG)priv; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key) { return APR_OS2_STATUS(DosFreeThreadLocalMemory(key->key)); } -APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key, - apr_threadkey_t *threadkey) +APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key, + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_get(data, key, threadkey->pool); + return fspr_pool_userdata_get(data, key, threadkey->pool); } -APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_threadkey_t *threadkey) +APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_set(data, key, cleanup, threadkey->pool); + return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool); } -APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey, fspr_threadkey_t *key) { *thekey = key->key; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, - apr_os_threadkey_t *thekey, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key, + fspr_os_threadkey_t *thekey, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*key) == NULL) { - (*key) = (apr_threadkey_t *)apr_pcalloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_pcalloc(pool, sizeof(fspr_threadkey_t)); (*key)->pool = pool; } (*key)->key = *thekey; diff --git a/libs/apr/threadproc/unix/proc.c b/libs/apr/threadproc/unix/proc.c index fc7f925eb4..3781876edb 100644 --- a/libs/apr/threadproc/unix/proc.c +++ b/libs/apr/threadproc/unix/proc.c @@ -14,16 +14,16 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_signal.h" -#include "apr_random.h" +#include "fspr_arch_threadproc.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_signal.h" +#include "fspr_random.h" -APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new, + fspr_pool_t *pool) { - (*new) = (apr_procattr_t *)apr_pcalloc(pool, sizeof(apr_procattr_t)); + (*new) = (fspr_procattr_t *)fspr_pcalloc(pool, sizeof(fspr_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -34,14 +34,14 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, - apr_int32_t in, - apr_int32_t out, - apr_int32_t err) +APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, + fspr_int32_t in, + fspr_int32_t out, + fspr_int32_t err) { - apr_status_t status; + fspr_status_t status; if (in != 0) { - if ((status = apr_file_pipe_create(&attr->child_in, &attr->parent_in, + if ((status = fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool)) != APR_SUCCESS) { return status; } @@ -50,19 +50,19 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_in, 0); + fspr_file_pipe_timeout_set(attr->child_in, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_in, 0); + fspr_file_pipe_timeout_set(attr->parent_in, 0); break; default: - apr_file_pipe_timeout_set(attr->child_in, 0); - apr_file_pipe_timeout_set(attr->parent_in, 0); + fspr_file_pipe_timeout_set(attr->child_in, 0); + fspr_file_pipe_timeout_set(attr->parent_in, 0); } } if (out) { - if ((status = apr_file_pipe_create(&attr->parent_out, &attr->child_out, + if ((status = fspr_file_pipe_create(&attr->parent_out, &attr->child_out, attr->pool)) != APR_SUCCESS) { return status; } @@ -71,19 +71,19 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_out, 0); + fspr_file_pipe_timeout_set(attr->child_out, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_out, 0); + fspr_file_pipe_timeout_set(attr->parent_out, 0); break; default: - apr_file_pipe_timeout_set(attr->child_out, 0); - apr_file_pipe_timeout_set(attr->parent_out, 0); + fspr_file_pipe_timeout_set(attr->child_out, 0); + fspr_file_pipe_timeout_set(attr->parent_out, 0); } } if (err) { - if ((status = apr_file_pipe_create(&attr->parent_err, &attr->child_err, + if ((status = fspr_file_pipe_create(&attr->parent_err, &attr->child_err, attr->pool)) != APR_SUCCESS) { return status; } @@ -92,14 +92,14 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - apr_file_pipe_timeout_set(attr->child_err, 0); + fspr_file_pipe_timeout_set(attr->child_err, 0); break; case APR_CHILD_BLOCK: - apr_file_pipe_timeout_set(attr->parent_err, 0); + fspr_file_pipe_timeout_set(attr->parent_err, 0); break; default: - apr_file_pipe_timeout_set(attr->child_err, 0); - apr_file_pipe_timeout_set(attr->parent_err, 0); + fspr_file_pipe_timeout_set(attr->child_err, 0); + fspr_file_pipe_timeout_set(attr->parent_err, 0); } } @@ -107,67 +107,67 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, } -APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, - apr_file_t *child_in, - apr_file_t *parent_in) +APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr, + fspr_file_t *child_in, + fspr_file_t *parent_in) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (attr->child_in == NULL && attr->parent_in == NULL) - rv = apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool); + rv = fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool); if (child_in != NULL && rv == APR_SUCCESS) - rv = apr_file_dup2(attr->child_in, child_in, attr->pool); + rv = fspr_file_dup2(attr->child_in, child_in, attr->pool); if (parent_in != NULL && rv == APR_SUCCESS) - rv = apr_file_dup2(attr->parent_in, parent_in, attr->pool); + rv = fspr_file_dup2(attr->parent_in, parent_in, attr->pool); return rv; } -APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, - apr_file_t *child_out, - apr_file_t *parent_out) +APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr, + fspr_file_t *child_out, + fspr_file_t *parent_out) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (attr->child_out == NULL && attr->parent_out == NULL) - rv = apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool); + rv = fspr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool); if (child_out != NULL && rv == APR_SUCCESS) - rv = apr_file_dup2(attr->child_out, child_out, attr->pool); + rv = fspr_file_dup2(attr->child_out, child_out, attr->pool); if (parent_out != NULL && rv == APR_SUCCESS) - rv = apr_file_dup2(attr->parent_out, parent_out, attr->pool); + rv = fspr_file_dup2(attr->parent_out, parent_out, attr->pool); return rv; } -APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, - apr_file_t *child_err, - apr_file_t *parent_err) +APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr, + fspr_file_t *child_err, + fspr_file_t *parent_err) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (attr->child_err == NULL && attr->parent_err == NULL) - rv = apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool); + rv = fspr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool); if (child_err != NULL && rv == APR_SUCCESS) - rv = apr_file_dup2(attr->child_err, child_err, attr->pool); + rv = fspr_file_dup2(attr->child_err, child_err, attr->pool); if (parent_err != NULL && rv == APR_SUCCESS) - rv = apr_file_dup2(attr->parent_err, parent_err, attr->pool); + rv = fspr_file_dup2(attr->parent_err, parent_err, attr->pool); return rv; } -APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr, const char *dir) { - attr->currdir = apr_pstrdup(attr->pool, dir); + attr->currdir = fspr_pstrdup(attr->pool, dir); if (attr->currdir) { return APR_SUCCESS; } @@ -175,21 +175,21 @@ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, return APR_ENOMEM; } -APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) +APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr, + fspr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, - apr_int32_t detach) +APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, + fspr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *pool) { int pid; @@ -202,7 +202,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) proc->out = NULL; proc->err = NULL; - apr_random_after_fork(proc); + fspr_random_after_fork(proc); return APR_INCHILD; } @@ -215,7 +215,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool) return APR_INPARENT; } -static apr_status_t limit_proc(apr_procattr_t *attr) +static fspr_status_t limit_proc(fspr_procattr_t *attr) { #if APR_HAVE_STRUCT_RLIMIT && APR_HAVE_SETRLIMIT #ifdef RLIMIT_CPU @@ -267,35 +267,35 @@ static apr_status_t limit_proc(apr_procattr_t *attr) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, - apr_child_errfn_t *errfn) +APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr, + fspr_child_errfn_t *errfn) { attr->errfn = errfn; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, - apr_int32_t chk) +APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr, + fspr_int32_t chk) { attr->errchk = chk; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, - apr_int32_t addrspace) +APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr, + fspr_int32_t addrspace) { /* won't ever be used on this platform, so don't save the flag */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr, const char *username, const char *password) { - apr_status_t rv; - apr_gid_t gid; + fspr_status_t rv; + fspr_gid_t gid; - if ((rv = apr_uid_get(&attr->uid, &gid, username, + if ((rv = fspr_uid_get(&attr->uid, &gid, username, attr->pool)) != APR_SUCCESS) { attr->uid = -1; return rv; @@ -308,22 +308,22 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr, const char *groupname) { - apr_status_t rv; + fspr_status_t rv; - if ((rv = apr_gid_get(&attr->gid, groupname, attr->pool)) != APR_SUCCESS) + if ((rv = fspr_gid_get(&attr->gid, groupname, attr->pool)) != APR_SUCCESS) attr->gid = -1; return rv; } -APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, +APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *new, const char *progname, const char * const *args, const char * const *env, - apr_procattr_t *attr, - apr_pool_t *pool) + fspr_procattr_t *attr, + fspr_pool_t *pool) { int i; const char * const empty_envp[] = {NULL}; @@ -385,41 +385,41 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, */ if (attr->child_in) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_in), - attr->child_in, apr_unix_file_cleanup); + fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_in), + attr->child_in, fspr_unix_file_cleanup); } if (attr->child_out) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_out), - attr->child_out, apr_unix_file_cleanup); + fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_out), + attr->child_out, fspr_unix_file_cleanup); } if (attr->child_err) { - apr_pool_cleanup_kill(apr_file_pool_get(attr->child_err), - attr->child_err, apr_unix_file_cleanup); + fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_err), + attr->child_err, fspr_unix_file_cleanup); } - apr_pool_cleanup_for_exec(); + fspr_pool_cleanup_for_exec(); if (attr->child_in) { - apr_file_close(attr->parent_in); + fspr_file_close(attr->parent_in); dup2(attr->child_in->filedes, STDIN_FILENO); - apr_file_close(attr->child_in); + fspr_file_close(attr->child_in); } if (attr->child_out) { - apr_file_close(attr->parent_out); + fspr_file_close(attr->parent_out); dup2(attr->child_out->filedes, STDOUT_FILENO); - apr_file_close(attr->child_out); + fspr_file_close(attr->child_out); } if (attr->child_err) { - apr_file_close(attr->parent_err); + fspr_file_close(attr->parent_err); dup2(attr->child_err->filedes, STDERR_FILENO); - apr_file_close(attr->child_err); + fspr_file_close(attr->child_err); } - apr_signal(SIGCHLD, SIG_DFL); /* not sure if this is needed or not */ + fspr_signal(SIGCHLD, SIG_DFL); /* not sure if this is needed or not */ if (attr->currdir != NULL) { if (chdir(attr->currdir) == -1) { @@ -485,7 +485,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, { char *ch, *onearg; - ch = onearg = apr_palloc(pool, onearg_len); + ch = onearg = fspr_palloc(pool, onearg_len); i = 0; while (args[i]) { size_t len = strlen(args[i]); @@ -505,7 +505,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, newargs[3] = NULL; if (attr->detached) { - apr_proc_detach(APR_PROC_DETACH_DAEMONIZE); + fspr_proc_detach(APR_PROC_DETACH_DAEMONIZE); } if (attr->cmdtype == APR_SHELLCMD) { @@ -517,14 +517,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } else if (attr->cmdtype == APR_PROGRAM) { if (attr->detached) { - apr_proc_detach(APR_PROC_DETACH_DAEMONIZE); + fspr_proc_detach(APR_PROC_DETACH_DAEMONIZE); } execve(progname, (char * const *)args, (char * const *)env); } else if (attr->cmdtype == APR_PROGRAM_ENV) { if (attr->detached) { - apr_proc_detach(APR_PROC_DETACH_DAEMONIZE); + fspr_proc_detach(APR_PROC_DETACH_DAEMONIZE); } execv(progname, (char * const *)args); @@ -532,7 +532,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, else { /* APR_PROGRAM_PATH */ if (attr->detached) { - apr_proc_detach(APR_PROC_DETACH_DAEMONIZE); + fspr_proc_detach(APR_PROC_DETACH_DAEMONIZE); } execvp(progname, (char * const *)args); @@ -540,7 +540,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if (attr->errfn) { char *desc; - desc = apr_psprintf(pool, "exec of '%s' failed", + desc = fspr_psprintf(pool, "exec of '%s' failed", progname); attr->errfn(pool, errno, desc); } @@ -551,39 +551,39 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, /* Parent process */ if (attr->child_in) { - apr_file_close(attr->child_in); + fspr_file_close(attr->child_in); } if (attr->child_out) { - apr_file_close(attr->child_out); + fspr_file_close(attr->child_out); } if (attr->child_err) { - apr_file_close(attr->child_err); + fspr_file_close(attr->child_err); } return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc, int *exitcode, - apr_exit_why_e *exitwhy, - apr_wait_how_e waithow, - apr_pool_t *p) + fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow, + fspr_pool_t *p) { proc->pid = -1; - return apr_proc_wait(proc, exitcode, exitwhy, waithow); + return fspr_proc_wait(proc, exitcode, exitwhy, waithow); } -APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, - int *exitcode, apr_exit_why_e *exitwhy, - apr_wait_how_e waithow) +APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc, + int *exitcode, fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow) { pid_t pstatus; int waitpid_options = WUNTRACED; int exit_int; int ignore; - apr_exit_why_e ignorewhy; + fspr_exit_why_e ignorewhy; if (exitcode == NULL) { exitcode = &ignore; @@ -633,8 +633,8 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, return errno; } -APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, - apr_int32_t what, +APR_DECLARE(fspr_status_t) fspr_procattr_limit_set(fspr_procattr_t *attr, + fspr_int32_t what, struct rlimit *limit) { switch(what) { diff --git a/libs/apr/threadproc/unix/procsup.c b/libs/apr/threadproc/unix/procsup.c index caf13bfa73..d37828c515 100644 --- a/libs/apr/threadproc/unix/procsup.c +++ b/libs/apr/threadproc/unix/procsup.c @@ -14,9 +14,9 @@ * limitations under the License. */ -#include "apr_arch_threadproc.h" +#include "fspr_arch_threadproc.h" -APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize) +APR_DECLARE(fspr_status_t) fspr_proc_detach(int daemonize) { int x; diff --git a/libs/apr/threadproc/unix/signals.c b/libs/apr/threadproc/unix/signals.c index f44c3d7859..44da95a335 100644 --- a/libs/apr/threadproc/unix/signals.c +++ b/libs/apr/threadproc/unix/signals.c @@ -15,11 +15,11 @@ */ #define INCL_DOSEXCEPTIONS /* for OS2 */ -#include "apr_arch_threadproc.h" -#include "apr_private.h" -#include "apr_pools.h" -#include "apr_signal.h" -#include "apr_strings.h" +#include "fspr_arch_threadproc.h" +#include "fspr_private.h" +#include "fspr_pools.h" +#include "fspr_signal.h" +#include "fspr_strings.h" #include #if APR_HAS_THREADS && APR_HAVE_PTHREAD_H @@ -27,12 +27,12 @@ #endif #ifdef SIGWAIT_TAKES_ONE_ARG -#define apr_sigwait(a,b) ((*(b)=sigwait((a)))<0?-1:0) +#define fspr_sigwait(a,b) ((*(b)=sigwait((a)))<0?-1:0) #else -#define apr_sigwait(a,b) sigwait((a),(b)) +#define fspr_sigwait(a,b) sigwait((a),(b)) #endif -APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signum) +APR_DECLARE(fspr_status_t) fspr_proc_kill(fspr_proc_t *proc, int signum) { #ifdef OS2 /* SIGTERM's don't work too well in OS/2 (only affects other EMX @@ -71,7 +71,7 @@ static void avoid_zombies(int signo) * from W. Richard Stevens' "Advanced Programming in the UNIX Environment" * (the version that does not automatically restart system calls). */ -APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func) +APR_DECLARE(fspr_sigfunc_t *) fspr_signal(int signo, fspr_sigfunc_t * func) { struct sigaction act, oact; @@ -111,10 +111,10 @@ APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func) * on the version of autoconf used. */ #if defined(SYS_SIGLIST_DECLARED) || HAVE_DECL_SYS_SIGLIST -void apr_signal_init(apr_pool_t *pglobal) +void fspr_signal_init(fspr_pool_t *pglobal) { } -const char *apr_signal_description_get(int signum) +const char *fspr_signal_description_get(int signum) { return sys_siglist[signum]; } @@ -145,7 +145,7 @@ static const char *signal_description[APR_NUMSIG]; } \ } while (0) -void apr_signal_init(apr_pool_t *pglobal) +void fspr_signal_init(fspr_pool_t *pglobal) { int sig; @@ -256,10 +256,10 @@ void apr_signal_init(apr_pool_t *pglobal) for (sig = 0; sig < APR_NUMSIG; ++sig) if (signal_description[sig] == NULL) - signal_description[sig] = apr_psprintf(pglobal, "signal #%d", sig); + signal_description[sig] = fspr_psprintf(pglobal, "signal #%d", sig); } -const char *apr_signal_description_get(int signum) +const char *fspr_signal_description_get(int signum) { return signum < APR_NUMSIG @@ -316,7 +316,7 @@ static void remove_sync_sigs(sigset_t *sig_mask) #endif } -APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum)) +APR_DECLARE(fspr_status_t) fspr_signal_thread(int(*signal_handler)(int signum)) { sigset_t sig_mask; #if APR_HAVE_SIGWAIT @@ -380,7 +380,7 @@ APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum)) #if APR_HAVE_SIGWAIT int signal_received; - if (apr_sigwait(&sig_mask, &signal_received) != 0) + if (fspr_sigwait(&sig_mask, &signal_received) != 0) { /* handle sigwait() error here */ } @@ -391,12 +391,12 @@ APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum)) #elif HAVE_SIGSUSPEND sigsuspend(&sig_mask); #else -#error No apr_sigwait() and no sigsuspend() +#error No fspr_sigwait() and no sigsuspend() #endif } } -APR_DECLARE(apr_status_t) apr_setup_signal_thread(void) +APR_DECLARE(fspr_status_t) fspr_setup_signal_thread(void) { sigset_t sig_mask; int rv; @@ -432,7 +432,7 @@ APR_DECLARE(apr_status_t) apr_setup_signal_thread(void) #endif /* APR_HAS_THREADS && ... */ -APR_DECLARE(apr_status_t) apr_signal_block(int signum) +APR_DECLARE(fspr_status_t) fspr_signal_block(int signum) { #if APR_HAVE_SIGACTION sigset_t sig_mask; @@ -459,7 +459,7 @@ APR_DECLARE(apr_status_t) apr_signal_block(int signum) #endif } -APR_DECLARE(apr_status_t) apr_signal_unblock(int signum) +APR_DECLARE(fspr_status_t) fspr_signal_unblock(int signum) { #if APR_HAVE_SIGACTION sigset_t sig_mask; diff --git a/libs/apr/threadproc/unix/thread.c b/libs/apr/threadproc/unix/thread.c index 165dddc238..0deaefa1a8 100644 --- a/libs/apr/threadproc/unix/thread.c +++ b/libs/apr/threadproc/unix/thread.c @@ -14,19 +14,19 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_portable.h" -#include "apr_arch_threadproc.h" +#include "fspr.h" +#include "fspr_portable.h" +#include "fspr_arch_threadproc.h" #if APR_HAS_THREADS #if APR_HAVE_PTHREAD_H /* Destroy the threadattr object */ -static apr_status_t threadattr_cleanup(void *data) +static fspr_status_t threadattr_cleanup(void *data) { - apr_threadattr_t *attr = data; - apr_status_t rv; + fspr_threadattr_t *attr = data; + fspr_status_t rv; rv = pthread_attr_destroy(&attr->attr); #ifdef PTHREAD_SETS_ERRNO @@ -37,18 +37,18 @@ static apr_status_t threadattr_cleanup(void *data) return rv; } -APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new, + fspr_pool_t *pool) { - apr_status_t stat; + fspr_status_t stat; - (*new) = apr_palloc(pool, sizeof(apr_threadattr_t)); + (*new) = fspr_palloc(pool, sizeof(fspr_threadattr_t)); (*new)->pool = pool; stat = pthread_attr_init(&(*new)->attr); if (stat == 0) { - apr_pool_cleanup_register(pool, *new, threadattr_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(pool, *new, threadattr_cleanup, + fspr_pool_cleanup_null); return APR_SUCCESS; } #ifdef PTHREAD_SETS_ERRNO @@ -60,10 +60,10 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, #define DETACH_ARG(v) ((v) ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE) -APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, - apr_int32_t on) +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr, + fspr_int32_t on) { - apr_status_t stat; + fspr_status_t stat; #ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR int arg = DETACH_ARG(v); @@ -83,7 +83,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, } } -APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr) +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr) { int state; @@ -97,8 +97,8 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr) return APR_NOTDETACH; } -APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, - apr_size_t stacksize) +APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr, + fspr_size_t stacksize) { int stat; @@ -113,11 +113,11 @@ APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, return stat; } -APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, - apr_size_t size) +APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr, + fspr_size_t size) { #ifdef HAVE_PTHREAD_ATTR_SETGUARDSIZE - apr_status_t rv; + fspr_status_t rv; rv = pthread_attr_setguardsize(&attr->attr, size); if (rv == 0) { @@ -134,7 +134,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, static void *dummy_worker(void *opaque) { - apr_thread_t *thread = (apr_thread_t*)opaque; + fspr_thread_t *thread = (fspr_thread_t*)opaque; #ifdef HAVE_PTHREAD_SETSCHEDPARAM if (thread->priority) { @@ -151,23 +151,23 @@ static void *dummy_worker(void *opaque) return thread->func(thread, thread->data); } -APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, - apr_threadattr_t *attr, - apr_thread_start_t func, +APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new, + fspr_threadattr_t *attr, + fspr_thread_start_t func, void *data, - apr_pool_t *pool) + fspr_pool_t *pool) { - apr_status_t stat; + fspr_status_t stat; pthread_attr_t *temp; pthread_t tt; - (*new) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t)); + (*new) = (fspr_thread_t *)fspr_pcalloc(pool, sizeof(fspr_thread_t)); if ((*new) == NULL) { return APR_ENOMEM; } - (*new)->td = (pthread_t *)apr_pcalloc(pool, sizeof(pthread_t)); + (*new)->td = (pthread_t *)fspr_pcalloc(pool, sizeof(pthread_t)); if ((*new)->td == NULL) { return APR_ENOMEM; @@ -182,7 +182,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, else temp = NULL; - stat = apr_pool_create(&(*new)->pool, pool); + stat = fspr_pool_create(&(*new)->pool, pool); if (stat != APR_SUCCESS) { return stat; } @@ -205,31 +205,31 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, } } -APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void) +APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current(void) { return pthread_self(); } -APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1, - apr_os_thread_t tid2) +APR_DECLARE(int) fspr_os_thread_equal(fspr_os_thread_t tid1, + fspr_os_thread_t tid2) { return pthread_equal(tid1, tid2); } -APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, - apr_status_t retval) +APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd, + fspr_status_t retval) { thd->exitval = retval; - apr_pool_destroy(thd->pool); + fspr_pool_destroy(thd->pool); pthread_exit(NULL); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, - apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval, + fspr_thread_t *thd) { - apr_status_t stat; - apr_status_t *thread_stat; + fspr_status_t stat; + fspr_status_t *thread_stat; if ((stat = pthread_join(*thd->td,(void *)&thread_stat)) == 0) { *retval = thd->exitval; @@ -244,9 +244,9 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, } } -APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd) { - apr_status_t stat; + fspr_status_t stat; #ifdef PTHREAD_DETACH_ARG1_ADDR if ((stat = pthread_detach(thd->td)) == 0) { @@ -265,40 +265,40 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) } } -void apr_thread_yield() +void fspr_thread_yield() { } -APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, - apr_thread_t *thread) +APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key, + fspr_thread_t *thread) { - return apr_pool_userdata_get(data, key, thread->pool); + return fspr_pool_userdata_get(data, key, thread->pool); } -APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key, - apr_status_t (*cleanup)(void *), - apr_thread_t *thread) +APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key, + fspr_status_t (*cleanup)(void *), + fspr_thread_t *thread) { - return apr_pool_userdata_set(data, key, cleanup, thread->pool); + return fspr_pool_userdata_set(data, key, cleanup, thread->pool); } -APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, - apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd, + fspr_thread_t *thd) { *thethd = thd->td; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, - apr_os_thread_t *thethd, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd, + fspr_os_thread_t *thethd, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*thd) == NULL) { - (*thd) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t)); + (*thd) = (fspr_thread_t *)fspr_pcalloc(pool, sizeof(fspr_thread_t)); (*thd)->pool = pool; } @@ -306,17 +306,17 @@ APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control, + fspr_pool_t *p) { static const pthread_once_t once_init = PTHREAD_ONCE_INIT; - *control = apr_palloc(p, sizeof(**control)); + *control = fspr_palloc(p, sizeof(**control)); (*control)->once = once_init; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, +APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control, void (*func)(void)) { return pthread_once(&control->once, func); @@ -330,9 +330,9 @@ APR_POOL_IMPLEMENT_ACCESSOR(thread) #if !APR_HAS_THREADS /* avoid warning for no prototype */ -APR_DECLARE(apr_status_t) apr_os_thread_get(void); +APR_DECLARE(fspr_status_t) fspr_os_thread_get(void); -APR_DECLARE(apr_status_t) apr_os_thread_get(void) +APR_DECLARE(fspr_status_t) fspr_os_thread_get(void) { return APR_ENOTIMPL; } diff --git a/libs/apr/threadproc/unix/threadpriv.c b/libs/apr/threadproc/unix/threadpriv.c index c278520380..fcc0e4d753 100644 --- a/libs/apr/threadproc/unix/threadpriv.c +++ b/libs/apr/threadproc/unix/threadpriv.c @@ -14,18 +14,18 @@ * limitations under the License. */ -#include "apr.h" -#include "apr_portable.h" -#include "apr_arch_threadproc.h" +#include "fspr.h" +#include "fspr_portable.h" +#include "fspr_arch_threadproc.h" #if APR_HAS_THREADS #if APR_HAVE_PTHREAD_H -APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, +APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key, void (*dest)(void *), - apr_pool_t *pool) + fspr_pool_t *pool) { - (*key) = (apr_threadkey_t *)apr_pcalloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_pcalloc(pool, sizeof(fspr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; @@ -37,8 +37,8 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, } -APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, - apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new, + fspr_threadkey_t *key) { #ifdef PTHREAD_GETSPECIFIC_TAKES_TWO_ARGS if (pthread_getspecific(key->key,new)) @@ -49,10 +49,10 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, - apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv, + fspr_threadkey_t *key) { - apr_status_t stat; + fspr_status_t stat; if ((stat = pthread_setspecific(key->key, priv)) == 0) { return APR_SUCCESS; @@ -62,10 +62,10 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, } } -APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key) { #ifdef HAVE_PTHREAD_KEY_DELETE - apr_status_t stat; + fspr_status_t stat; if ((stat = pthread_key_delete(key->key)) == 0) { return APR_SUCCESS; @@ -77,36 +77,36 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key) #endif } -APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key, - apr_threadkey_t *threadkey) +APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key, + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_get(data, key, threadkey->pool); + return fspr_pool_userdata_get(data, key, threadkey->pool); } -APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key, - apr_status_t (*cleanup)(void *), - apr_threadkey_t *threadkey) +APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key, + fspr_status_t (*cleanup)(void *), + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_set(data, key, cleanup, threadkey->pool); + return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool); } -APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, - apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey, + fspr_threadkey_t *key) { *thekey = key->key; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, - apr_os_threadkey_t *thekey, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key, + fspr_os_threadkey_t *thekey, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*key) == NULL) { - (*key) = (apr_threadkey_t *)apr_pcalloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_pcalloc(pool, sizeof(fspr_threadkey_t)); (*key)->pool = pool; } @@ -119,9 +119,9 @@ APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, #if !APR_HAS_THREADS /* avoid warning for no prototype */ -APR_DECLARE(apr_status_t) apr_os_threadkey_get(void); +APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(void); -APR_DECLARE(apr_status_t) apr_os_threadkey_get(void) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(void) { return APR_ENOTIMPL; } diff --git a/libs/apr/threadproc/win32/proc.c b/libs/apr/threadproc/win32/proc.c index 014dfc8428..24f725d3dd 100644 --- a/libs/apr/threadproc/win32/proc.c +++ b/libs/apr/threadproc/win32/proc.c @@ -14,15 +14,15 @@ * limitations under the License. */ -#include "win32/apr_arch_threadproc.h" -#include "win32/apr_arch_file_io.h" +#include "win32/fspr_arch_threadproc.h" +#include "win32/fspr_arch_file_io.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_general.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_lib.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_general.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_lib.h" #include #if APR_HAVE_SIGNAL_H #include @@ -52,21 +52,21 @@ * */ -APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new, + fspr_pool_t *pool) { - (*new) = (apr_procattr_t *)apr_pcalloc(pool, sizeof(apr_procattr_t)); + (*new) = (fspr_procattr_t *)fspr_pcalloc(pool, sizeof(fspr_procattr_t)); (*new)->pool = pool; (*new)->cmdtype = APR_PROGRAM; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, - apr_int32_t in, - apr_int32_t out, - apr_int32_t err) +APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, + fspr_int32_t in, + fspr_int32_t out, + fspr_int32_t err) { - apr_status_t stat = APR_SUCCESS; + fspr_status_t stat = APR_SUCCESS; if (in) { /* APR_CHILD_BLOCK maps to APR_WRITE_BLOCK, while @@ -79,138 +79,138 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, in = APR_READ_BLOCK; else if (in == APR_PARENT_BLOCK) in = APR_WRITE_BLOCK; - stat = apr_create_nt_pipe(&attr->child_in, &attr->parent_in, in, + stat = fspr_create_nt_pipe(&attr->child_in, &attr->parent_in, in, attr->pool); if (stat == APR_SUCCESS) - stat = apr_file_inherit_unset(attr->parent_in); + stat = fspr_file_inherit_unset(attr->parent_in); } if (out && stat == APR_SUCCESS) { - stat = apr_create_nt_pipe(&attr->parent_out, &attr->child_out, out, + stat = fspr_create_nt_pipe(&attr->parent_out, &attr->child_out, out, attr->pool); if (stat == APR_SUCCESS) - stat = apr_file_inherit_unset(attr->parent_out); + stat = fspr_file_inherit_unset(attr->parent_out); } if (err && stat == APR_SUCCESS) { - stat = apr_create_nt_pipe(&attr->parent_err, &attr->child_err, err, + stat = fspr_create_nt_pipe(&attr->parent_err, &attr->child_err, err, attr->pool); if (stat == APR_SUCCESS) - stat = apr_file_inherit_unset(attr->parent_err); + stat = fspr_file_inherit_unset(attr->parent_err); } return stat; } -APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, - apr_file_t *child_in, - apr_file_t *parent_in) +APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr, + fspr_file_t *child_in, + fspr_file_t *parent_in) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (child_in) { if (attr->child_in == NULL) - rv = apr_file_dup(&attr->child_in, child_in, attr->pool); + rv = fspr_file_dup(&attr->child_in, child_in, attr->pool); else - rv = apr_file_dup2(attr->child_in, child_in, attr->pool); + rv = fspr_file_dup2(attr->child_in, child_in, attr->pool); if (rv == APR_SUCCESS) - rv = apr_file_inherit_set(attr->child_in); + rv = fspr_file_inherit_set(attr->child_in); } if (parent_in && rv == APR_SUCCESS) { if (attr->parent_in == NULL) - rv = apr_file_dup(&attr->parent_in, parent_in, attr->pool); + rv = fspr_file_dup(&attr->parent_in, parent_in, attr->pool); else - rv = apr_file_dup2(attr->parent_in, parent_in, attr->pool); + rv = fspr_file_dup2(attr->parent_in, parent_in, attr->pool); } return rv; } -APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, - apr_file_t *child_out, - apr_file_t *parent_out) +APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr, + fspr_file_t *child_out, + fspr_file_t *parent_out) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (child_out) { if (attr->child_out == NULL) - rv = apr_file_dup(&attr->child_out, child_out, attr->pool); + rv = fspr_file_dup(&attr->child_out, child_out, attr->pool); else - rv = apr_file_dup2(attr->child_out, child_out, attr->pool); + rv = fspr_file_dup2(attr->child_out, child_out, attr->pool); if (rv == APR_SUCCESS) - rv = apr_file_inherit_set(attr->child_out); + rv = fspr_file_inherit_set(attr->child_out); } if (parent_out && rv == APR_SUCCESS) { if (attr->parent_out == NULL) - rv = apr_file_dup(&attr->parent_out, parent_out, attr->pool); + rv = fspr_file_dup(&attr->parent_out, parent_out, attr->pool); else - rv = apr_file_dup2(attr->parent_out, parent_out, attr->pool); + rv = fspr_file_dup2(attr->parent_out, parent_out, attr->pool); } return rv; } -APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, - apr_file_t *child_err, - apr_file_t *parent_err) +APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr, + fspr_file_t *child_err, + fspr_file_t *parent_err) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (child_err) { if (attr->child_err == NULL) - rv = apr_file_dup(&attr->child_err, child_err, attr->pool); + rv = fspr_file_dup(&attr->child_err, child_err, attr->pool); else - rv = apr_file_dup2(attr->child_err, child_err, attr->pool); + rv = fspr_file_dup2(attr->child_err, child_err, attr->pool); if (rv == APR_SUCCESS) - rv = apr_file_inherit_set(attr->child_err); + rv = fspr_file_inherit_set(attr->child_err); } if (parent_err && rv == APR_SUCCESS) { if (attr->parent_err == NULL) - rv = apr_file_dup(&attr->parent_err, parent_err, attr->pool); + rv = fspr_file_dup(&attr->parent_err, parent_err, attr->pool); else - rv = apr_file_dup2(attr->parent_err, parent_err, attr->pool); + rv = fspr_file_dup2(attr->parent_err, parent_err, attr->pool); } return rv; } -APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr, const char *dir) { /* curr dir must be in native format, there are all sorts of bugs in * the NT library loading code that flunk the '/' parsing test. */ - return apr_filepath_merge(&attr->currdir, NULL, dir, + return fspr_filepath_merge(&attr->currdir, NULL, dir, APR_FILEPATH_NATIVE, attr->pool); } -APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr, - apr_cmdtype_e cmd) +APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr, + fspr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, - apr_int32_t det) +APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, + fspr_int32_t det) { attr->detached = det; return APR_SUCCESS; } -static apr_status_t attr_cleanup(void *theattr) +static fspr_status_t attr_cleanup(void *theattr) { - apr_procattr_t *attr = (apr_procattr_t *)theattr; + fspr_procattr_t *attr = (fspr_procattr_t *)theattr; if (attr->user_token) CloseHandle(attr->user_token); attr->user_token = NULL; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr, const char *username, const char *password) { @@ -218,18 +218,18 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, return APR_ENOTIMPL; #else HANDLE user; - apr_wchar_t *wusername = NULL; - apr_wchar_t *wpassword = NULL; - apr_status_t rv; - apr_size_t len, wlen; + fspr_wchar_t *wusername = NULL; + fspr_wchar_t *wpassword = NULL; + fspr_status_t rv; + fspr_size_t len, wlen; - if (apr_os_level >= APR_WIN_NT_4) + if (fspr_os_level >= APR_WIN_NT_4) { if (attr->user_token) { /* Cannot set that twice */ if (attr->errfn) { attr->errfn(attr->pool, 0, - apr_pstrcat(attr->pool, + fspr_pstrcat(attr->pool, "function called twice" " on username: ", username, NULL)); } @@ -237,12 +237,12 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, } len = strlen(username) + 1; wlen = len; - wusername = apr_palloc(attr->pool, wlen * sizeof(apr_wchar_t)); - if ((rv = apr_conv_utf8_to_ucs2(username, &len, wusername, &wlen)) + wusername = fspr_palloc(attr->pool, wlen * sizeof(fspr_wchar_t)); + if ((rv = fspr_conv_utf8_to_ucs2(username, &len, wusername, &wlen)) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(attr->pool, rv, - apr_pstrcat(attr->pool, + fspr_pstrcat(attr->pool, "utf8 to ucs2 conversion failed" " on username: ", username, NULL)); } @@ -251,12 +251,12 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, if (password) { len = strlen(password) + 1; wlen = len; - wpassword = apr_palloc(attr->pool, wlen * sizeof(apr_wchar_t)); - if ((rv = apr_conv_utf8_to_ucs2(password, &len, wpassword, &wlen)) + wpassword = fspr_palloc(attr->pool, wlen * sizeof(fspr_wchar_t)); + if ((rv = fspr_conv_utf8_to_ucs2(password, &len, wpassword, &wlen)) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(attr->pool, rv, - apr_pstrcat(attr->pool, + fspr_pstrcat(attr->pool, "utf8 to ucs2 conversion failed" " on password: ", password, NULL)); } @@ -270,10 +270,10 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, LOGON32_PROVIDER_DEFAULT, &user)) { /* Logon Failed */ - return apr_get_os_error(); + return fspr_get_os_error(); } if (wpassword) - memset(wpassword, 0, wlen * sizeof(apr_wchar_t)); + memset(wpassword, 0, wlen * sizeof(fspr_wchar_t)); /* Get the primary token for user */ if (!DuplicateTokenEx(user, TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY, @@ -282,24 +282,24 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, TokenPrimary, &(attr->user_token))) { /* Failed to duplicate the user token */ - rv = apr_get_os_error(); + rv = fspr_get_os_error(); CloseHandle(user); return rv; } CloseHandle(user); - attr->sd = apr_pcalloc(attr->pool, SECURITY_DESCRIPTOR_MIN_LENGTH); + attr->sd = fspr_pcalloc(attr->pool, SECURITY_DESCRIPTOR_MIN_LENGTH); InitializeSecurityDescriptor(attr->sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(attr->sd, -1, 0, 0); - attr->sa = apr_palloc(attr->pool, sizeof(SECURITY_ATTRIBUTES)); + attr->sa = fspr_palloc(attr->pool, sizeof(SECURITY_ATTRIBUTES)); attr->sa->nLength = sizeof (SECURITY_ATTRIBUTES); attr->sa->lpSecurityDescriptor = attr->sd; attr->sa->bInheritHandle = TRUE; /* register the cleanup */ - apr_pool_cleanup_register(attr->pool, (void *)attr, + fspr_pool_cleanup_register(attr->pool, (void *)attr, attr_cleanup, - apr_pool_cleanup_null); + fspr_pool_cleanup_null); return APR_SUCCESS; } else @@ -307,7 +307,7 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr, #endif } -APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr, +APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr, const char *groupname) { /* Always return SUCCESS cause groups are irrelevant */ @@ -318,20 +318,20 @@ static const char* has_space(const char *str) { const char *ch; for (ch = str; *ch; ++ch) { - if (apr_isspace(*ch)) { + if (fspr_isspace(*ch)) { return ch; } } return NULL; } -static char *apr_caret_escape_args(apr_pool_t *p, const char *str) +static char *fspr_caret_escape_args(fspr_pool_t *p, const char *str) { char *cmd; unsigned char *d; const unsigned char *s; - cmd = apr_palloc(p, 2 * strlen(str) + 1); /* Be safe */ + cmd = fspr_palloc(p, 2 * strlen(str) + 1); /* Be safe */ d = (unsigned char *)cmd; s = (const unsigned char *)str; for (; *s; ++s) { @@ -356,36 +356,36 @@ static char *apr_caret_escape_args(apr_pool_t *p, const char *str) return cmd; } -APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr, - apr_child_errfn_t *errfn) +APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr, + fspr_child_errfn_t *errfn) { attr->errfn = errfn; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr, - apr_int32_t chk) +APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr, + fspr_int32_t chk) { attr->errchk = chk; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr, - apr_int32_t addrspace) +APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr, + fspr_int32_t addrspace) { /* won't ever be used on this platform, so don't save the flag */ return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, +APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *new, const char *progname, const char * const *args, const char * const *env, - apr_procattr_t *attr, - apr_pool_t *pool) + fspr_procattr_t *attr, + fspr_pool_t *pool) { - apr_status_t rv; - apr_size_t i; + fspr_status_t rv; + fspr_size_t i; const char *argv0; char *cmdline; char *pEnvBlock; @@ -404,7 +404,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * not manage the stdio handles properly when running old 16 * bit executables if the detached attribute is set. */ - if (apr_os_level >= APR_WIN_NT) { + if (fspr_os_level >= APR_WIN_NT) { /* * XXX DETACHED_PROCESS won't on Win9x at all; on NT/W2K * 16 bit executables fail (MS KB: Q150956) @@ -418,16 +418,16 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * XXX progname must be NULL if this is a 16 bit app running in WOW */ if (progname[0] == '\"') { - progname = apr_pstrndup(pool, progname + 1, strlen(progname) - 2); + progname = fspr_pstrndup(pool, progname + 1, strlen(progname) - 2); } if (attr->cmdtype == APR_PROGRAM || attr->cmdtype == APR_PROGRAM_ENV) { char *fullpath = NULL; - if ((rv = apr_filepath_merge(&fullpath, attr->currdir, progname, + if ((rv = fspr_filepath_merge(&fullpath, attr->currdir, progname, APR_FILEPATH_NATIVE, pool)) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(pool, rv, - apr_pstrcat(pool, "filepath_merge failed.", + fspr_pstrcat(pool, "filepath_merge failed.", " currdir: ", attr->currdir, " progname: ", progname, NULL)); } @@ -437,21 +437,21 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } else { /* Do not fail if the path isn't parseable for APR_PROGRAM_PATH - * or APR_SHELLCMD. We only invoke apr_filepath_merge (with no + * or APR_SHELLCMD. We only invoke fspr_filepath_merge (with no * left hand side expression) in order to correct the path slash * delimiters. But the filename doesn't need to be in the CWD, * nor does it need to be a filename at all (it could be a * built-in shell command.) */ char *fullpath = NULL; - if ((rv = apr_filepath_merge(&fullpath, "", progname, + if ((rv = fspr_filepath_merge(&fullpath, "", progname, APR_FILEPATH_NATIVE, pool)) == APR_SUCCESS) { progname = fullpath; } } if (has_space(progname)) { - argv0 = apr_pstrcat(pool, "\"", progname, "\"", NULL); + argv0 = fspr_pstrcat(pool, "\"", progname, "\"", NULL); } else { argv0 = progname; @@ -461,10 +461,10 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, cmdline = ""; for (i = 1; args && args[i]; ++i) { if (has_space(args[i]) || !args[i][0]) { - cmdline = apr_pstrcat(pool, cmdline, " \"", args[i], "\"", NULL); + cmdline = fspr_pstrcat(pool, cmdline, " \"", args[i], "\"", NULL); } else { - cmdline = apr_pstrcat(pool, cmdline, " ", args[i], NULL); + cmdline = fspr_pstrcat(pool, cmdline, " ", args[i], NULL); } } @@ -478,22 +478,22 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, return APR_EINVAL; } if (shellcmd[0] == '"') { - progname = apr_pstrndup(pool, shellcmd + 1, strlen(shellcmd) - 2); + progname = fspr_pstrndup(pool, shellcmd + 1, strlen(shellcmd) - 2); } else { progname = shellcmd; if (has_space(shellcmd)) { - shellcmd = apr_pstrcat(pool, "\"", shellcmd, "\"", NULL); + shellcmd = fspr_pstrcat(pool, "\"", shellcmd, "\"", NULL); } } /* Command.com does not support a quoted command, while cmd.exe demands one. */ i = strlen(progname); if (i >= 11 && strcasecmp(progname + i - 11, "command.com") == 0) { - cmdline = apr_pstrcat(pool, shellcmd, " /C ", argv0, cmdline, NULL); + cmdline = fspr_pstrcat(pool, shellcmd, " /C ", argv0, cmdline, NULL); } else { - cmdline = apr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL); + cmdline = fspr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL); } } else @@ -517,12 +517,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, return APR_EINVAL; } if (shellcmd[0] == '"') { - progname = apr_pstrndup(pool, shellcmd + 1, strlen(shellcmd) - 2); + progname = fspr_pstrndup(pool, shellcmd + 1, strlen(shellcmd) - 2); } else { progname = shellcmd; if (has_space(shellcmd)) { - shellcmd = apr_pstrcat(pool, "\"", shellcmd, "\"", NULL); + shellcmd = fspr_pstrcat(pool, "\"", shellcmd, "\"", NULL); } } i = strlen(progname); @@ -532,7 +532,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * until this moment in all four code paths, with some flags * to toggle 'which flavor' is needed. */ - cmdline = apr_pstrcat(pool, shellcmd, " /C ", argv0, cmdline, NULL); + cmdline = fspr_pstrcat(pool, shellcmd, " /C ", argv0, cmdline, NULL); } else { /* We must protect the cmdline args from any interpolation - this @@ -542,16 +542,16 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * the shift-state to be toggled, and the application will * not see the caret escapes. */ - cmdline = apr_caret_escape_args(pool, cmdline); + cmdline = fspr_caret_escape_args(pool, cmdline); /* * Our app name must always be quoted so the quotes surrounding * the entire /c "command args" are unambigious. */ if (*argv0 != '"') { - cmdline = apr_pstrcat(pool, shellcmd, " /C \"\"", argv0, "\"", cmdline, "\"", NULL); + cmdline = fspr_pstrcat(pool, shellcmd, " /C \"\"", argv0, "\"", cmdline, "\"", NULL); } else { - cmdline = apr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL); + cmdline = fspr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL); } } } @@ -563,7 +563,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, * would succeed, but "c:\bin\aprtest" or "aprtest.exe" * can fail. */ - cmdline = apr_pstrcat(pool, argv0, cmdline, NULL); + cmdline = fspr_pstrcat(pool, argv0, cmdline, NULL); if (attr->cmdtype == APR_PROGRAM_PATH) { progname = NULL; @@ -576,7 +576,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, pEnvBlock = NULL; } else { - apr_size_t iEnvBlockLen; + fspr_size_t iEnvBlockLen; /* * Win32's CreateProcess call requires that the environment * be passed in an environment block, a null terminated block of @@ -594,20 +594,20 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, #if APR_HAS_UNICODE_FS IF_WIN_OS_IS_UNICODE { - apr_wchar_t *pNext; - pEnvBlock = (char *)apr_palloc(pool, iEnvBlockLen * 2); + fspr_wchar_t *pNext; + pEnvBlock = (char *)fspr_palloc(pool, iEnvBlockLen * 2); dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT; i = 0; - pNext = (apr_wchar_t*)pEnvBlock; + pNext = (fspr_wchar_t*)pEnvBlock; while (env[i]) { - apr_size_t in = strlen(env[i]) + 1; - if ((rv = apr_conv_utf8_to_ucs2(env[i], &in, + fspr_size_t in = strlen(env[i]) + 1; + if ((rv = fspr_conv_utf8_to_ucs2(env[i], &in, pNext, &iEnvBlockLen)) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(pool, rv, - apr_pstrcat(pool, + fspr_pstrcat(pool, "utf8 to ucs2 conversion failed" " on this string: ", env[i], NULL)); } @@ -625,7 +625,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, ELSE_WIN_OS_IS_ANSI { char *pNext; - pEnvBlock = (char *)apr_palloc(pool, iEnvBlockLen); + pEnvBlock = (char *)fspr_palloc(pool, iEnvBlockLen); i = 0; pNext = pEnvBlock; @@ -647,19 +647,19 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, IF_WIN_OS_IS_UNICODE { STARTUPINFOW si; - apr_wchar_t *wprg = NULL; - apr_wchar_t *wcmd = NULL; - apr_wchar_t *wcwd = NULL; + fspr_wchar_t *wprg = NULL; + fspr_wchar_t *wcmd = NULL; + fspr_wchar_t *wcwd = NULL; if (progname) { - apr_size_t nprg = strlen(progname) + 1; - apr_size_t nwprg = nprg + 6; - wprg = apr_palloc(pool, nwprg * sizeof(wprg[0])); - if ((rv = apr_conv_utf8_to_ucs2(progname, &nprg, wprg, &nwprg)) + fspr_size_t nprg = strlen(progname) + 1; + fspr_size_t nwprg = nprg + 6; + wprg = fspr_palloc(pool, nwprg * sizeof(wprg[0])); + if ((rv = fspr_conv_utf8_to_ucs2(progname, &nprg, wprg, &nwprg)) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(pool, rv, - apr_pstrcat(pool, + fspr_pstrcat(pool, "utf8 to ucs2 conversion failed" " on progname: ", progname, NULL)); } @@ -668,14 +668,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, } if (cmdline) { - apr_size_t ncmd = strlen(cmdline) + 1; - apr_size_t nwcmd = ncmd; - wcmd = apr_palloc(pool, nwcmd * sizeof(wcmd[0])); - if ((rv = apr_conv_utf8_to_ucs2(cmdline, &ncmd, wcmd, &nwcmd)) + fspr_size_t ncmd = strlen(cmdline) + 1; + fspr_size_t nwcmd = ncmd; + wcmd = fspr_palloc(pool, nwcmd * sizeof(wcmd[0])); + if ((rv = fspr_conv_utf8_to_ucs2(cmdline, &ncmd, wcmd, &nwcmd)) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(pool, rv, - apr_pstrcat(pool, + fspr_pstrcat(pool, "utf8 to ucs2 conversion failed" " on cmdline: ", cmdline, NULL)); } @@ -685,15 +685,15 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, if (attr->currdir) { - apr_size_t ncwd = strlen(attr->currdir) + 1; - apr_size_t nwcwd = ncwd; - wcwd = apr_palloc(pool, ncwd * sizeof(wcwd[0])); - if ((rv = apr_conv_utf8_to_ucs2(attr->currdir, &ncwd, + fspr_size_t ncwd = strlen(attr->currdir) + 1; + fspr_size_t nwcwd = ncwd; + wcwd = fspr_palloc(pool, ncwd * sizeof(wcwd[0])); + if ((rv = fspr_conv_utf8_to_ucs2(attr->currdir, &ncwd, wcwd, &nwcwd)) != APR_SUCCESS) { if (attr->errfn) { attr->errfn(pool, rv, - apr_pstrcat(pool, + fspr_pstrcat(pool, "utf8 to ucs2 conversion failed" " on currdir: ", attr->currdir, NULL)); } @@ -732,7 +732,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, si.lpDesktop = L"Winsta0\\Default"; if (!ImpersonateLoggedOnUser(attr->user_token)) { /* failed to impersonate the logged user */ - rv = apr_get_os_error(); + rv = fspr_get_os_error(); CloseHandle(attr->user_token); attr->user_token = NULL; return rv; @@ -814,43 +814,43 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, /* Check CreateProcess result */ if (!rv) - return apr_get_os_error(); + return fspr_get_os_error(); - /* XXX Orphaned handle warning - no fix due to broken apr_proc_t api. + /* XXX Orphaned handle warning - no fix due to broken fspr_proc_t api. */ new->hproc = pi.hProcess; new->pid = pi.dwProcessId; if (attr->child_in) { - apr_file_close(attr->child_in); + fspr_file_close(attr->child_in); } if (attr->child_out) { - apr_file_close(attr->child_out); + fspr_file_close(attr->child_out); } if (attr->child_err) { - apr_file_close(attr->child_err); + fspr_file_close(attr->child_err); } CloseHandle(pi.hThread); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc, +APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc, int *exitcode, - apr_exit_why_e *exitwhy, - apr_wait_how_e waithow, - apr_pool_t *p) + fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow, + fspr_pool_t *p) { - /* Unix does apr_proc_wait(proc(-1), exitcode, exitwhy, waithow) - * but Win32's apr_proc_wait won't work that way. We can either + /* Unix does fspr_proc_wait(proc(-1), exitcode, exitwhy, waithow) + * but Win32's fspr_proc_wait won't work that way. We can either * register all APR created processes in some sort of AsyncWait * thread, or simply walk from the global process pool for all - * apr_pool_note_subprocess()es registered with APR. + * fspr_pool_note_subprocess()es registered with APR. */ return APR_ENOTIMPL; } -static apr_exit_why_e why_from_exit_code(DWORD exit) { +static fspr_exit_why_e why_from_exit_code(DWORD exit) { /* See WinNT.h STATUS_ACCESS_VIOLATION and family for how * this class of failures was determined */ @@ -863,9 +863,9 @@ static apr_exit_why_e why_from_exit_code(DWORD exit) { /* ### No way to tell if Dr Watson grabbed a core, AFAICT. */ } -APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, - int *exitcode, apr_exit_why_e *exitwhy, - apr_wait_how_e waithow) +APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc, + int *exitcode, fspr_exit_why_e *exitwhy, + fspr_wait_how_e waithow) { DWORD stat; DWORD time; @@ -889,10 +889,10 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc, else if (stat == WAIT_TIMEOUT) { return APR_CHILD_NOTDONE; } - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize) +APR_DECLARE(fspr_status_t) fspr_proc_detach(int daemonize) { return APR_ENOTIMPL; } diff --git a/libs/apr/threadproc/win32/signals.c b/libs/apr/threadproc/win32/signals.c index 5e714931dc..c733c4dbd8 100644 --- a/libs/apr/threadproc/win32/signals.c +++ b/libs/apr/threadproc/win32/signals.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "win32/apr_arch_threadproc.h" -#include "win32/apr_arch_file_io.h" -#include "apr_thread_proc.h" -#include "apr_file_io.h" -#include "apr_general.h" +#include "win32/fspr_arch_threadproc.h" +#include "win32/fspr_arch_file_io.h" +#include "fspr_thread_proc.h" +#include "fspr_file_io.h" +#include "fspr_general.h" #if APR_HAVE_SIGNAL_H #include #endif @@ -32,35 +32,35 @@ * ### Actually, closing the input handle to the proc should also do fine * for most console apps. This definately needs improvement... */ -APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signal) +APR_DECLARE(fspr_status_t) fspr_proc_kill(fspr_proc_t *proc, int signal) { if (proc->hproc != NULL) { if (TerminateProcess(proc->hproc, signal) == 0) { - return apr_get_os_error(); + return fspr_get_os_error(); } - /* On unix, SIGKILL leaves a apr_proc_wait()able pid lying around, - * so we will leave hproc alone until the app calls apr_proc_wait(). + /* On unix, SIGKILL leaves a fspr_proc_wait()able pid lying around, + * so we will leave hproc alone until the app calls fspr_proc_wait(). */ return APR_SUCCESS; } return APR_EPROC_UNKNOWN; } -void apr_signal_init(apr_pool_t *pglobal) +void fspr_signal_init(fspr_pool_t *pglobal) { } -const char *apr_signal_description_get(int signum) +const char *fspr_signal_description_get(int signum) { return "unknown signal (not supported)"; } -APR_DECLARE(apr_status_t) apr_signal_block(int signum) +APR_DECLARE(fspr_status_t) fspr_signal_block(int signum) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_signal_unblock(int signum) +APR_DECLARE(fspr_status_t) fspr_signal_unblock(int signum) { return APR_ENOTIMPL; } diff --git a/libs/apr/threadproc/win32/thread.c b/libs/apr/threadproc/win32/thread.c index 280213f2a1..e049c272db 100644 --- a/libs/apr/threadproc/win32/thread.c +++ b/libs/apr/threadproc/win32/thread.c @@ -14,25 +14,25 @@ * limitations under the License. */ -#include "apr_private.h" -#include "win32/apr_arch_threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" +#include "fspr_private.h" +#include "win32/fspr_arch_threadproc.h" +#include "fspr_thread_proc.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" #if APR_HAVE_PROCESS_H #include #endif -#include "apr_arch_misc.h" +#include "fspr_arch_misc.h" -/* Chosen for us by apr_initialize */ -DWORD tls_apr_thread = 0; +/* Chosen for us by fspr_initialize */ +DWORD tls_fspr_thread = 0; -APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new, + fspr_pool_t *pool) { - (*new) = (apr_threadattr_t *)apr_palloc(pool, - sizeof(apr_threadattr_t)); + (*new) = (fspr_threadattr_t *)fspr_palloc(pool, + sizeof(fspr_threadattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -45,51 +45,51 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, - apr_int32_t on) +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr, + fspr_int32_t on) { attr->detach = on; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr) +APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr) { if (attr->detach == 1) return APR_DETACH; return APR_NOTDETACH; } -APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, - apr_size_t stacksize) +APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr, + fspr_size_t stacksize) { attr->stacksize = stacksize; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr, - apr_size_t size) +APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr, + fspr_size_t size) { return APR_ENOTIMPL; } static void *dummy_worker(void *opaque) { - apr_thread_t *thd = (apr_thread_t *)opaque; - TlsSetValue(tls_apr_thread, thd->td); + fspr_thread_t *thd = (fspr_thread_t *)opaque; + TlsSetValue(tls_fspr_thread, thd->td); return thd->func(thd, thd->data); } -APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, - apr_threadattr_t *attr, - apr_thread_start_t func, - void *data, apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new, + fspr_threadattr_t *attr, + fspr_thread_start_t func, + void *data, fspr_pool_t *pool) { - apr_status_t stat; + fspr_status_t stat; unsigned temp; HANDLE handle; int priority = THREAD_PRIORITY_NORMAL; - (*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t)); + (*new) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -99,7 +99,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, (*new)->data = data; (*new)->func = func; (*new)->td = NULL; - stat = apr_pool_create(&(*new)->pool, pool); + stat = fspr_pool_create(&(*new)->pool, pool); if (stat != APR_SUCCESS) { return stat; } @@ -131,7 +131,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, attr && attr->stacksize > 0 ? attr->stacksize : 0, (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker, (*new), 0, &temp)) == 0) { - return apr_get_os_error(); + return fspr_get_os_error(); } #endif @@ -148,11 +148,11 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, - apr_status_t retval) +APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd, + fspr_status_t retval) { thd->exitval = retval; - apr_pool_destroy(thd->pool); + fspr_pool_destroy(thd->pool); thd->pool = NULL; #ifndef _WIN32_WCE _endthreadex(0); @@ -162,10 +162,10 @@ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, - apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval, + fspr_thread_t *thd) { - apr_status_t rv = APR_SUCCESS; + fspr_status_t rv = APR_SUCCESS; if (!thd->td) { /* Can not join on detached threads */ @@ -180,25 +180,25 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, rv = APR_INCOMPLETE; } else - rv = apr_get_os_error(); + rv = fspr_get_os_error(); CloseHandle(thd->td); thd->td = NULL; return rv; } -APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd) { if (thd->td && CloseHandle(thd->td)) { thd->td = NULL; return APR_SUCCESS; } else { - return apr_get_os_error(); + return fspr_get_os_error(); } } -APR_DECLARE(void) apr_thread_yield() +APR_DECLARE(void) fspr_thread_yield() { /* SwitchToThread is not supported on Win9x, but since it's * primarily a noop (entering time consuming code, therefore @@ -206,29 +206,29 @@ APR_DECLARE(void) apr_thread_yield() * we won't worry too much if it's not available. */ #ifndef _WIN32_WCE - if (apr_os_level >= APR_WIN_NT) { + if (fspr_os_level >= APR_WIN_NT) { SwitchToThread(); } #endif } -APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, - apr_thread_t *thread) +APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key, + fspr_thread_t *thread) { - return apr_pool_userdata_get(data, key, thread->pool); + return fspr_pool_userdata_get(data, key, thread->pool); } -APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key, - apr_status_t (*cleanup) (void *), - apr_thread_t *thread) +APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key, + fspr_status_t (*cleanup) (void *), + fspr_thread_t *thread) { - return apr_pool_userdata_set(data, key, cleanup, thread->pool); + return fspr_pool_userdata_set(data, key, cleanup, thread->pool); } -APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void) +APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current(void) { - HANDLE hthread = (HANDLE)TlsGetValue(tls_apr_thread); + HANDLE hthread = (HANDLE)TlsGetValue(tls_fspr_thread); HANDLE hproc; if (hthread) { @@ -242,12 +242,12 @@ APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void) DUPLICATE_SAME_ACCESS)) { return NULL; } - TlsSetValue(tls_apr_thread, hthread); + TlsSetValue(tls_fspr_thread, hthread); return hthread; } -APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, - apr_thread_t *thd) +APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd, + fspr_thread_t *thd) { if (thd == NULL) { return APR_ENOTHREAD; @@ -256,29 +256,29 @@ APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, - apr_os_thread_t *thethd, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd, + fspr_os_thread_t *thethd, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*thd) == NULL) { - (*thd) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t)); + (*thd) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t)); (*thd)->pool = pool; } (*thd)->td = thethd; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control, + fspr_pool_t *p) { - (*control) = apr_pcalloc(p, sizeof(**control)); + (*control) = fspr_pcalloc(p, sizeof(**control)); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, +APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control, void (*func)(void)) { if (!InterlockedExchange(&control->value, 1)) { @@ -287,11 +287,11 @@ APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control, return APR_SUCCESS; } -APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1, - apr_os_thread_t tid2) +APR_DECLARE(int) fspr_os_thread_equal(fspr_os_thread_t tid1, + fspr_os_thread_t tid2) { /* Since the only tid's we support our are own, and - * apr_os_thread_current returns the identical handle + * fspr_os_thread_current returns the identical handle * to the one we created initially, the test is simple. */ return (tid1 == tid2); diff --git a/libs/apr/threadproc/win32/threadpriv.c b/libs/apr/threadproc/win32/threadpriv.c index 9ddc24fbd1..3f9530ab6e 100644 --- a/libs/apr/threadproc/win32/threadpriv.c +++ b/libs/apr/threadproc/win32/threadpriv.c @@ -14,18 +14,18 @@ * limitations under the License. */ -#include "win32/apr_arch_threadproc.h" -#include "apr_thread_proc.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_errno.h" -#include "apr_portable.h" +#include "win32/fspr_arch_threadproc.h" +#include "fspr_thread_proc.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_errno.h" +#include "fspr_portable.h" -APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, +APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key, void (*dest)(void *), - apr_pool_t *pool) + fspr_pool_t *pool) { - (*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; } @@ -35,64 +35,64 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key, if (((*key)->key = TlsAlloc()) != 0xFFFFFFFF) { return APR_SUCCESS; } - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, - apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new, + fspr_threadkey_t *key) { if ((*new) = TlsGetValue(key->key)) { return APR_SUCCESS; } - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, - apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv, + fspr_threadkey_t *key) { if (TlsSetValue(key->key, priv)) { return APR_SUCCESS; } - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key) { if (TlsFree(key->key)) { return APR_SUCCESS; } - return apr_get_os_error(); + return fspr_get_os_error(); } -APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key, - apr_threadkey_t *threadkey) +APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key, + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_get(data, key, threadkey->pool); + return fspr_pool_userdata_get(data, key, threadkey->pool); } -APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key, - apr_status_t (*cleanup)(void *), - apr_threadkey_t *threadkey) +APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key, + fspr_status_t (*cleanup)(void *), + fspr_threadkey_t *threadkey) { - return apr_pool_userdata_set(data, key, cleanup, threadkey->pool); + return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool); } -APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, - apr_threadkey_t *key) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey, + fspr_threadkey_t *key) { *thekey = key->key; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key, - apr_os_threadkey_t *thekey, - apr_pool_t *pool) +APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key, + fspr_os_threadkey_t *thekey, + fspr_pool_t *pool) { if (pool == NULL) { return APR_ENOPOOL; } if ((*key) == NULL) { - (*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t)); + (*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t)); (*key)->pool = pool; } (*key)->key = *thekey; diff --git a/libs/apr/time/unix/time.c b/libs/apr/time/unix/time.c index dfa45e690c..8e77d740d3 100644 --- a/libs/apr/time/unix/time.c +++ b/libs/apr/time/unix/time.c @@ -14,14 +14,14 @@ * limitations under the License. */ -#include "apr_portable.h" -#include "apr_time.h" -#include "apr_lib.h" -#include "apr_private.h" -#include "apr_strings.h" +#include "fspr_portable.h" +#include "fspr_time.h" +#include "fspr_lib.h" +#include "fspr_private.h" +#include "fspr_strings.h" /* private APR headers */ -#include "apr_arch_internal_time.h" +#include "fspr_arch_internal_time.h" /* System Headers required for time library */ #if APR_HAVE_SYS_TIME_H @@ -36,11 +36,11 @@ /* End System Headers */ #if !defined(HAVE_STRUCT_TM_TM_GMTOFF) && !defined(HAVE_STRUCT_TM___TM_GMTOFF) -static apr_int32_t server_gmt_offset; +static fspr_int32_t server_gmt_offset; #define NO_GMTOFF_IN_STRUCT_TM #endif -static apr_int32_t get_offset(struct tm *tm) +static fspr_int32_t get_offset(struct tm *tm) { #if defined(HAVE_STRUCT_TM_TM_GMTOFF) return tm->tm_gmtoff; @@ -63,23 +63,23 @@ static apr_int32_t get_offset(struct tm *tm) #endif } -APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result, +APR_DECLARE(fspr_status_t) fspr_time_ansi_put(fspr_time_t *result, time_t input) { - *result = (apr_time_t)input * APR_USEC_PER_SEC; + *result = (fspr_time_t)input * APR_USEC_PER_SEC; return APR_SUCCESS; } /* NB NB NB NB This returns GMT!!!!!!!!!! */ -APR_DECLARE(apr_time_t) apr_time_now(void) +APR_DECLARE(fspr_time_t) fspr_time_now(void) { struct timeval tv; gettimeofday(&tv, NULL); return tv.tv_sec * APR_USEC_PER_SEC + tv.tv_usec; } -static void explode_time(apr_time_exp_t *xt, apr_time_t t, - apr_int32_t offset, int use_localtime) +static void explode_time(fspr_time_exp_t *xt, fspr_time_t t, + fspr_int32_t offset, int use_localtime) { struct tm tm; time_t tt = (t / APR_USEC_PER_SEC) + offset; @@ -109,36 +109,36 @@ static void explode_time(apr_time_exp_t *xt, apr_time_t t, xt->tm_gmtoff = get_offset(&tm); } -APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result, - apr_time_t input, apr_int32_t offs) +APR_DECLARE(fspr_status_t) fspr_time_exp_tz(fspr_time_exp_t *result, + fspr_time_t input, fspr_int32_t offs) { explode_time(result, input, offs, 0); result->tm_gmtoff = offs; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result, - apr_time_t input) +APR_DECLARE(fspr_status_t) fspr_time_exp_gmt(fspr_time_exp_t *result, + fspr_time_t input) { - return apr_time_exp_tz(result, input, 0); + return fspr_time_exp_tz(result, input, 0); } -APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, - apr_time_t input) +APR_DECLARE(fspr_status_t) fspr_time_exp_lt(fspr_time_exp_t *result, + fspr_time_t input) { #if defined(__EMX__) /* EMX gcc (OS/2) has a timezone global we can use */ - return apr_time_exp_tz(result, input, -timezone); + return fspr_time_exp_tz(result, input, -timezone); #else explode_time(result, input, 0, 1); return APR_SUCCESS; #endif /* __EMX__ */ } -APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, apr_time_exp_t *xt) +APR_DECLARE(fspr_status_t) fspr_time_exp_get(fspr_time_t *t, fspr_time_exp_t *xt) { - apr_time_t year = xt->tm_year; - apr_time_t days; + fspr_time_t year = xt->tm_year; + fspr_time_t days; static const int dayoffset[12] = {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; @@ -161,25 +161,25 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, apr_time_exp_t *xt) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *t, - apr_time_exp_t *xt) +APR_DECLARE(fspr_status_t) fspr_time_exp_gmt_get(fspr_time_t *t, + fspr_time_exp_t *xt) { - apr_status_t status = apr_time_exp_get(t, xt); + fspr_status_t status = fspr_time_exp_get(t, xt); if (status == APR_SUCCESS) - *t -= (apr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC; + *t -= (fspr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC; return status; } -APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime, - apr_time_t *aprtime) +APR_DECLARE(fspr_status_t) fspr_os_imp_time_get(fspr_os_imp_time_t **ostime, + fspr_time_t *aprtime) { (*ostime)->tv_usec = *aprtime % APR_USEC_PER_SEC; (*ostime)->tv_sec = *aprtime / APR_USEC_PER_SEC; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime, - apr_time_exp_t *aprtime) +APR_DECLARE(fspr_status_t) fspr_os_exp_time_get(fspr_os_exp_time_t **ostime, + fspr_time_exp_t *aprtime) { (*ostime)->tm_sec = aprtime->tm_sec; (*ostime)->tm_min = aprtime->tm_min; @@ -200,17 +200,17 @@ APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime, - apr_os_imp_time_t **ostime, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_os_imp_time_put(fspr_time_t *aprtime, + fspr_os_imp_time_t **ostime, + fspr_pool_t *cont) { *aprtime = (*ostime)->tv_sec * APR_USEC_PER_SEC + (*ostime)->tv_usec; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime, - apr_os_exp_time_t **ostime, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_os_exp_time_put(fspr_time_exp_t *aprtime, + fspr_os_exp_time_t **ostime, + fspr_pool_t *cont) { aprtime->tm_sec = (*ostime)->tm_sec; aprtime->tm_min = (*ostime)->tm_min; @@ -231,7 +231,7 @@ APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime, return APR_SUCCESS; } -APR_DECLARE(void) apr_sleep(apr_interval_time_t t) +APR_DECLARE(void) fspr_sleep(fspr_interval_time_t t) { #ifdef OS2 DosSleep(t/1000); @@ -248,7 +248,7 @@ APR_DECLARE(void) apr_sleep(apr_interval_time_t t) } #ifdef OS2 -APR_DECLARE(apr_status_t) apr_os2_time_to_apr_time(apr_time_t *result, +APR_DECLARE(fspr_status_t) fspr_os2_time_to_fspr_time(fspr_time_t *result, FDATE os2date, FTIME os2time) { @@ -268,9 +268,9 @@ APR_DECLARE(apr_status_t) apr_os2_time_to_apr_time(apr_time_t *result, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_apr_time_to_os2_time(FDATE *os2date, +APR_DECLARE(fspr_status_t) fspr_fspr_time_to_os2_time(FDATE *os2date, FTIME *os2time, - apr_time_t aprtime) + fspr_time_t aprtime) { time_t ansitime = aprtime / APR_USEC_PER_SEC; struct tm *lt; @@ -287,13 +287,13 @@ APR_DECLARE(apr_status_t) apr_apr_time_to_os2_time(FDATE *os2date, #endif #ifdef NETWARE -APR_DECLARE(void) apr_netware_setup_time(void) +APR_DECLARE(void) fspr_netware_setup_time(void) { tzset(); server_gmt_offset = -TZONE; } #else -APR_DECLARE(void) apr_unix_setup_time(void) +APR_DECLARE(void) fspr_unix_setup_time(void) { #ifdef NO_GMTOFF_IN_STRUCT_TM /* Precompute the offset from GMT on systems where it's not @@ -334,14 +334,14 @@ APR_DECLARE(void) apr_unix_setup_time(void) #endif t.tm_isdst = 0; /* we know this GMT time isn't daylight-savings */ t2 = mktime(&t); - server_gmt_offset = (apr_int32_t) difftime(t1, t2); + server_gmt_offset = (fspr_int32_t) difftime(t1, t2); #endif /* NO_GMTOFF_IN_STRUCT_TM */ } #endif /* A noop on all known Unix implementations */ -APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p) +APR_DECLARE(void) fspr_time_clock_hires(fspr_pool_t *p) { return; } diff --git a/libs/apr/time/unix/timestr.c b/libs/apr/time/unix/timestr.c index f74febac19..3519f26d23 100644 --- a/libs/apr/time/unix/timestr.c +++ b/libs/apr/time/unix/timestr.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_portable.h" -#include "apr_time.h" -#include "apr_lib.h" -#include "apr_private.h" +#include "fspr_portable.h" +#include "fspr_time.h" +#include "fspr_lib.h" +#include "fspr_private.h" /* System Headers required for time library */ #if APR_HAVE_SYS_TIME_H #include @@ -30,27 +30,27 @@ #endif /* End System Headers */ -APR_DECLARE_DATA const char apr_month_snames[12][4] = +APR_DECLARE_DATA const char fspr_month_snames[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -APR_DECLARE_DATA const char apr_day_snames[7][4] = +APR_DECLARE_DATA const char fspr_day_snames[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) +fspr_status_t fspr_rfc822_date(char *date_str, fspr_time_t t) { - apr_time_exp_t xt; + fspr_time_exp_t xt; const char *s; int real_year; - apr_time_exp_gmt(&xt, t); + fspr_time_exp_gmt(&xt, t); /* example: "Sat, 08 Jan 2000 18:31:41 GMT" */ /* 12345678901234567890123456789 */ - s = &apr_day_snames[xt.tm_wday][0]; + s = &fspr_day_snames[xt.tm_wday][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -59,7 +59,7 @@ apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) *date_str++ = xt.tm_mday / 10 + '0'; *date_str++ = xt.tm_mday % 10 + '0'; *date_str++ = ' '; - s = &apr_month_snames[xt.tm_mon][0]; + s = &fspr_month_snames[xt.tm_mon][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -87,22 +87,22 @@ apr_status_t apr_rfc822_date(char *date_str, apr_time_t t) return APR_SUCCESS; } -apr_status_t apr_ctime(char *date_str, apr_time_t t) +fspr_status_t fspr_ctime(char *date_str, fspr_time_t t) { - apr_time_exp_t xt; + fspr_time_exp_t xt; const char *s; int real_year; /* example: "Wed Jun 30 21:49:08 1993" */ /* 123456789012345678901234 */ - apr_time_exp_lt(&xt, t); - s = &apr_day_snames[xt.tm_wday][0]; + fspr_time_exp_lt(&xt, t); + s = &fspr_day_snames[xt.tm_wday][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = ' '; - s = &apr_month_snames[xt.tm_mon][0]; + s = &fspr_month_snames[xt.tm_mon][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -129,8 +129,8 @@ apr_status_t apr_ctime(char *date_str, apr_time_t t) return APR_SUCCESS; } -apr_status_t apr_strftime(char *s, apr_size_t *retsize, apr_size_t max, - const char *format, apr_time_exp_t *xt) +fspr_status_t fspr_strftime(char *s, fspr_size_t *retsize, fspr_size_t max, + const char *format, fspr_time_exp_t *xt) { struct tm tm; memset(&tm, 0, sizeof tm); diff --git a/libs/apr/time/win32/access.c b/libs/apr/time/win32/access.c index cd25e2f0bf..189e06d19c 100644 --- a/libs/apr/time/win32/access.c +++ b/libs/apr/time/win32/access.c @@ -14,12 +14,12 @@ * limitations under the License. */ -#include "win32/apr_arch_atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" +#include "win32/fspr_arch_atime.h" +#include "fspr_time.h" +#include "fspr_general.h" +#include "fspr_lib.h" -apr_status_t apr_get_curtime(struct atime_t *time, apr_time_t *rv) +fspr_status_t fspr_get_curtime(struct atime_t *time, fspr_time_t *rv) { if (time) { (*rv) = time->currtime; @@ -28,7 +28,7 @@ apr_status_t apr_get_curtime(struct atime_t *time, apr_time_t *rv) return APR_ENOTIME; } -apr_status_t apr_get_sec(struct atime_t *time, apr_int32_t *rv) +fspr_status_t fspr_get_sec(struct atime_t *time, fspr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wSecond; @@ -37,7 +37,7 @@ apr_status_t apr_get_sec(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t apr_get_min(struct atime_t *time, apr_int32_t *rv) +fspr_status_t fspr_get_min(struct atime_t *time, fspr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wMinute; @@ -46,7 +46,7 @@ apr_status_t apr_get_min(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t apr_get_hour(struct atime_t *time, apr_int32_t *rv) +fspr_status_t fspr_get_hour(struct atime_t *time, fspr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wHour; @@ -55,7 +55,7 @@ apr_status_t apr_get_hour(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t apr_get_mday(struct atime_t *time, apr_int32_t *rv) +fspr_status_t fspr_get_mday(struct atime_t *time, fspr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wDay; @@ -64,7 +64,7 @@ apr_status_t apr_get_mday(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t apr_get_mon(struct atime_t *time, apr_int32_t *rv) +fspr_status_t fspr_get_mon(struct atime_t *time, fspr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wMonth; @@ -73,7 +73,7 @@ apr_status_t apr_get_mon(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t apr_get_year(struct atime_t *time, apr_int32_t *rv) +fspr_status_t fspr_get_year(struct atime_t *time, fspr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wYear; @@ -82,7 +82,7 @@ apr_status_t apr_get_year(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t apr_get_wday(struct atime_t *time, apr_int32_t *rv) +fspr_status_t fspr_get_wday(struct atime_t *time, fspr_int32_t *rv) { if (time) { (*rv) = time->explodedtime->wDayOfWeek; @@ -91,13 +91,13 @@ apr_status_t apr_get_wday(struct atime_t *time, apr_int32_t *rv) return APR_ENOTIME; } -apr_status_t apr_set_sec(struct atime_t *time, apr_int32_t value) +fspr_status_t fspr_set_sec(struct atime_t *time, fspr_int32_t value) { if (!time) { return APR_ENOTIME; } if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, + time->explodedtime = (SYSTEMTIME *)fspr_pcalloc(time->cntxt, sizeof(SYSTEMTIME)); } if (time->explodedtime == NULL) { @@ -107,13 +107,13 @@ apr_status_t apr_set_sec(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t apr_set_min(struct atime_t *time, apr_int32_t value) +fspr_status_t fspr_set_min(struct atime_t *time, fspr_int32_t value) { if (!time) { return APR_ENOTIME; } if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, + time->explodedtime = (SYSTEMTIME *)fspr_pcalloc(time->cntxt, sizeof(SYSTEMTIME)); } if (time->explodedtime == NULL) { @@ -123,13 +123,13 @@ apr_status_t apr_set_min(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t apr_set_hour(struct atime_t *time, apr_int32_t value) +fspr_status_t fspr_set_hour(struct atime_t *time, fspr_int32_t value) { if (!time) { return APR_ENOTIME; } if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, + time->explodedtime = (SYSTEMTIME *)fspr_pcalloc(time->cntxt, sizeof(SYSTEMTIME)); } if (time->explodedtime == NULL) { @@ -139,13 +139,13 @@ apr_status_t apr_set_hour(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t apr_set_mday(struct atime_t *time, apr_int32_t value) +fspr_status_t fspr_set_mday(struct atime_t *time, fspr_int32_t value) { if (!time) { return APR_ENOTIME; } if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, + time->explodedtime = (SYSTEMTIME *)fspr_pcalloc(time->cntxt, sizeof(SYSTEMTIME)); } if (time->explodedtime == NULL) { @@ -155,13 +155,13 @@ apr_status_t apr_set_mday(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t apr_set_mon(struct atime_t *time, apr_int32_t value) +fspr_status_t fspr_set_mon(struct atime_t *time, fspr_int32_t value) { if (!time) { return APR_ENOTIME; } if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, + time->explodedtime = (SYSTEMTIME *)fspr_pcalloc(time->cntxt, sizeof(SYSTEMTIME)); } if (time->explodedtime == NULL) { @@ -171,13 +171,13 @@ apr_status_t apr_set_mon(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t apr_set_year(struct atime_t *time, apr_int32_t value) +fspr_status_t fspr_set_year(struct atime_t *time, fspr_int32_t value) { if (!time) { return APR_ENOTIME; } if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, + time->explodedtime = (SYSTEMTIME *)fspr_pcalloc(time->cntxt, sizeof(SYSTEMTIME)); } if (time->explodedtime == NULL) { @@ -187,13 +187,13 @@ apr_status_t apr_set_year(struct atime_t *time, apr_int32_t value) return APR_SUCCESS; } -apr_status_t apr_set_wday(struct atime_t *time, apr_int32_t value) +fspr_status_t fspr_set_wday(struct atime_t *time, fspr_int32_t value) { if (!time) { return APR_ENOTIME; } if (time->explodedtime == NULL) { - time->explodedtime = (SYSTEMTIME *)apr_pcalloc(time->cntxt, + time->explodedtime = (SYSTEMTIME *)fspr_pcalloc(time->cntxt, sizeof(SYSTEMTIME)); } if (time->explodedtime == NULL) { diff --git a/libs/apr/time/win32/time.c b/libs/apr/time/win32/time.c index 6a2b2737de..3dd473a8b4 100644 --- a/libs/apr/time/win32/time.c +++ b/libs/apr/time/win32/time.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "win32/apr_arch_atime.h" -#include "apr_time.h" -#include "apr_general.h" -#include "apr_lib.h" -#include "apr_portable.h" +#include "win32/fspr_arch_atime.h" +#include "fspr_time.h" +#include "fspr_general.h" +#include "fspr_lib.h" +#include "fspr_portable.h" #if APR_HAVE_TIME_H #include #endif @@ -27,7 +27,7 @@ #endif #include #include -#include "apr_arch_misc.h" +#include "fspr_arch_misc.h" /* Leap year is any year divisible by four, but not by 100 unless also * divisible by 400 @@ -49,7 +49,7 @@ static DWORD get_local_timezone(TIME_ZONE_INFORMATION **tzresult) return result; } -static void SystemTimeToAprExpTime(apr_time_exp_t *xt, SYSTEMTIME *tm) +static void SystemTimeToAprExpTime(fspr_time_exp_t *xt, SYSTEMTIME *tm) { static const int dayoffset[12] = {0, 31, 59, 90, 120, 151, 182, 212, 243, 273, 304, 334}; @@ -76,15 +76,15 @@ static void SystemTimeToAprExpTime(apr_time_exp_t *xt, SYSTEMTIME *tm) xt->tm_yday++; } -APR_DECLARE(apr_status_t) apr_time_ansi_put(apr_time_t *result, +APR_DECLARE(fspr_status_t) fspr_time_ansi_put(fspr_time_t *result, time_t input) { - *result = (apr_time_t) input * APR_USEC_PER_SEC; + *result = (fspr_time_t) input * APR_USEC_PER_SEC; return APR_SUCCESS; } /* Return micro-seconds since the Unix epoch (jan. 1, 1970) UTC */ -APR_DECLARE(apr_time_t) apr_time_now(void) +APR_DECLARE(fspr_time_t) fspr_time_now(void) { LONGLONG aprtime = 0; FILETIME time; @@ -99,8 +99,8 @@ APR_DECLARE(apr_time_t) apr_time_now(void) return aprtime; } -APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result, - apr_time_t input) +APR_DECLARE(fspr_status_t) fspr_time_exp_gmt(fspr_time_exp_t *result, + fspr_time_t input) { FILETIME ft; SYSTEMTIME st; @@ -110,13 +110,13 @@ APR_DECLARE(apr_status_t) apr_time_exp_gmt(apr_time_exp_t *result, * generally UTC, so no timezone info needed */ SystemTimeToAprExpTime(result, &st); - result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC); + result->tm_usec = (fspr_int32_t) (input % APR_USEC_PER_SEC); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result, - apr_time_t input, - apr_int32_t offs) +APR_DECLARE(fspr_status_t) fspr_time_exp_tz(fspr_time_exp_t *result, + fspr_time_t input, + fspr_int32_t offs) { FILETIME ft; SYSTEMTIME st; @@ -126,13 +126,13 @@ APR_DECLARE(apr_status_t) apr_time_exp_tz(apr_time_exp_t *result, * generally UTC, so we will simply note the offs used. */ SystemTimeToAprExpTime(result, &st); - result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC); + result->tm_usec = (fspr_int32_t) (input % APR_USEC_PER_SEC); result->tm_gmtoff = offs; return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, - apr_time_t input) +APR_DECLARE(fspr_status_t) fspr_time_exp_lt(fspr_time_exp_t *result, + fspr_time_t input) { SYSTEMTIME st; FILETIME ft, localft; @@ -144,7 +144,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, { TIME_ZONE_INFORMATION *tz; SYSTEMTIME localst; - apr_time_t localtime; + fspr_time_t localtime; get_local_timezone(&tz); @@ -158,7 +158,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, */ SystemTimeToTzSpecificLocalTime(tz, &st, &localst); SystemTimeToAprExpTime(result, &localst); - result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC); + result->tm_usec = (fspr_int32_t) (input % APR_USEC_PER_SEC); /* Recover the resulting time as an apr time and use the @@ -166,8 +166,8 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, */ SystemTimeToFileTime(&localst, &localft); FileTimeToAprTime(&localtime, &localft); - result->tm_gmtoff = (int)apr_time_sec(localtime) - - (int)apr_time_sec(input); + result->tm_gmtoff = (int)fspr_time_sec(localtime) + - (int)fspr_time_sec(input); /* To compute the dst flag, we compare the expected * local (standard) timezone bias to the delta. @@ -189,7 +189,7 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, FileTimeToLocalFileTime(&ft, &localft); FileTimeToSystemTime(&localft, &st); SystemTimeToAprExpTime(result, &st); - result->tm_usec = (apr_int32_t) (input % APR_USEC_PER_SEC); + result->tm_usec = (fspr_int32_t) (input % APR_USEC_PER_SEC); switch (GetTimeZoneInformation(&tz)) { case TIME_ZONE_ID_UNKNOWN: @@ -216,11 +216,11 @@ APR_DECLARE(apr_status_t) apr_time_exp_lt(apr_time_exp_t *result, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, - apr_time_exp_t *xt) +APR_DECLARE(fspr_status_t) fspr_time_exp_get(fspr_time_t *t, + fspr_time_exp_t *xt) { - apr_time_t year = xt->tm_year; - apr_time_t days; + fspr_time_t year = xt->tm_year; + fspr_time_t days; static const int dayoffset[12] = {306, 337, 0, 31, 61, 92, 122, 153, 184, 214, 245, 275}; @@ -244,25 +244,25 @@ APR_DECLARE(apr_status_t) apr_time_exp_get(apr_time_t *t, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_time_exp_gmt_get(apr_time_t *t, - apr_time_exp_t *xt) +APR_DECLARE(fspr_status_t) fspr_time_exp_gmt_get(fspr_time_t *t, + fspr_time_exp_t *xt) { - apr_status_t status = apr_time_exp_get(t, xt); + fspr_status_t status = fspr_time_exp_get(t, xt); if (status == APR_SUCCESS) - *t -= (apr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC; + *t -= (fspr_time_t) xt->tm_gmtoff * APR_USEC_PER_SEC; return status; } -APR_DECLARE(apr_status_t) apr_os_imp_time_get(apr_os_imp_time_t **ostime, - apr_time_t *aprtime) +APR_DECLARE(fspr_status_t) fspr_os_imp_time_get(fspr_os_imp_time_t **ostime, + fspr_time_t *aprtime) { - /* TODO: Consider not passing in pointer to apr_time_t (e.g., call by value) */ + /* TODO: Consider not passing in pointer to fspr_time_t (e.g., call by value) */ AprTimeToFileTime(*ostime, *aprtime); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime, - apr_time_exp_t *aprexptime) +APR_DECLARE(fspr_status_t) fspr_os_exp_time_get(fspr_os_exp_time_t **ostime, + fspr_time_exp_t *aprexptime) { (*ostime)->wYear = aprexptime->tm_year + 1900; (*ostime)->wMonth = aprexptime->tm_mon + 1; @@ -275,9 +275,9 @@ APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime, - apr_os_imp_time_t **ostime, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_os_imp_time_put(fspr_time_t *aprtime, + fspr_os_imp_time_t **ostime, + fspr_pool_t *cont) { /* XXX: sanity failure, what is file time, gmt or local ? */ @@ -285,9 +285,9 @@ APR_DECLARE(apr_status_t) apr_os_imp_time_put(apr_time_t *aprtime, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime, - apr_os_exp_time_t **ostime, - apr_pool_t *cont) +APR_DECLARE(fspr_status_t) fspr_os_exp_time_put(fspr_time_exp_t *aprtime, + fspr_os_exp_time_t **ostime, + fspr_pool_t *cont) { /* The Platform SDK documents that SYSTEMTIME/FILETIME are * generally UTC, so no timezone info needed @@ -296,7 +296,7 @@ APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime, return APR_SUCCESS; } -APR_DECLARE(void) apr_sleep(apr_interval_time_t t) +APR_DECLARE(void) fspr_sleep(fspr_interval_time_t t) { /* One of the few sane situations for a cast, Sleep * is in ms, not us, and passed as a DWORD value @@ -305,14 +305,14 @@ APR_DECLARE(void) apr_sleep(apr_interval_time_t t) } -static apr_status_t clock_restore(void *unsetres) +static fspr_status_t clock_restore(void *unsetres) { ULONG newRes; SetTimerResolution((ULONG)unsetres, FALSE, &newRes); return APR_SUCCESS; } -APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p) +APR_DECLARE(void) fspr_time_clock_hires(fspr_pool_t *p) { ULONG newRes; /* Timer resolution is stated in 100ns units. Note that TRUE requests the @@ -320,7 +320,7 @@ APR_DECLARE(void) apr_time_clock_hires(apr_pool_t *p) */ if (SetTimerResolution(10000, TRUE, &newRes) == 0 /* STATUS_SUCCESS */) { /* register the cleanup... */ - apr_pool_cleanup_register(p, (void*)10000, clock_restore, - apr_pool_cleanup_null); + fspr_pool_cleanup_register(p, (void*)10000, clock_restore, + fspr_pool_cleanup_null); } } diff --git a/libs/apr/time/win32/timestr.c b/libs/apr/time/win32/timestr.c index af1526497b..606291e0be 100644 --- a/libs/apr/time/win32/timestr.c +++ b/libs/apr/time/win32/timestr.c @@ -14,31 +14,31 @@ * limitations under the License. */ -#include "win32/apr_arch_atime.h" -#include "apr_portable.h" -#include "apr_strings.h" +#include "win32/fspr_arch_atime.h" +#include "fspr_portable.h" +#include "fspr_strings.h" -APR_DECLARE_DATA const char apr_month_snames[12][4] = +APR_DECLARE_DATA const char fspr_month_snames[12][4] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -APR_DECLARE_DATA const char apr_day_snames[7][4] = +APR_DECLARE_DATA const char fspr_day_snames[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t) +APR_DECLARE(fspr_status_t) fspr_rfc822_date(char *date_str, fspr_time_t t) { - apr_time_exp_t xt; + fspr_time_exp_t xt; const char *s; int real_year; - apr_time_exp_gmt(&xt, t); + fspr_time_exp_gmt(&xt, t); /* example: "Sat, 08 Jan 2000 18:31:41 GMT" */ /* 12345678901234567890123456789 */ - s = &apr_day_snames[xt.tm_wday][0]; + s = &fspr_day_snames[xt.tm_wday][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -47,7 +47,7 @@ APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t) *date_str++ = xt.tm_mday / 10 + '0'; *date_str++ = xt.tm_mday % 10 + '0'; *date_str++ = ' '; - s = &apr_month_snames[xt.tm_mon][0]; + s = &fspr_month_snames[xt.tm_mon][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -75,22 +75,22 @@ APR_DECLARE(apr_status_t) apr_rfc822_date(char *date_str, apr_time_t t) return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t) +APR_DECLARE(fspr_status_t) fspr_ctime(char *date_str, fspr_time_t t) { - apr_time_exp_t xt; + fspr_time_exp_t xt; const char *s; int real_year; /* example: "Wed Jun 30 21:49:08 1993" */ /* 123456789012345678901234 */ - apr_time_exp_lt(&xt, t); - s = &apr_day_snames[xt.tm_wday][0]; + fspr_time_exp_lt(&xt, t); + s = &fspr_day_snames[xt.tm_wday][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = ' '; - s = &apr_month_snames[xt.tm_mon][0]; + s = &fspr_month_snames[xt.tm_mon][0]; *date_str++ = *s++; *date_str++ = *s++; *date_str++ = *s++; @@ -120,7 +120,7 @@ APR_DECLARE(apr_status_t) apr_ctime(char *date_str, apr_time_t t) #ifndef _WIN32_WCE -apr_size_t win32_strftime_extra(char *s, size_t max, const char *format, +fspr_size_t win32_strftime_extra(char *s, size_t max, const char *format, const struct tm *tm) { /* If the new format string is bigger than max, the result string won't fit @@ -128,7 +128,7 @@ apr_size_t win32_strftime_extra(char *s, size_t max, const char *format, * enough */ char *new_format = (char *) malloc(max + 11); size_t i, j, format_length = strlen(format); - apr_size_t return_value; + fspr_size_t return_value; int length_written; for (i = 0, j = 0; (i < format_length && j < max);) { @@ -138,7 +138,7 @@ apr_size_t win32_strftime_extra(char *s, size_t max, const char *format, } switch (format[i+1]) { case 'C': - length_written = apr_snprintf(new_format + j, max - j, "%2d", + length_written = fspr_snprintf(new_format + j, max - j, "%2d", (tm->tm_year + 1970)/100); j = (length_written == -1) ? max : (j + length_written); i += 2; @@ -166,7 +166,7 @@ apr_size_t win32_strftime_extra(char *s, size_t max, const char *format, j += 8; break; case 'e': - length_written = apr_snprintf(new_format + j, max - j, "%2d", + length_written = fspr_snprintf(new_format + j, max - j, "%2d", tm->tm_mday); j = (length_written == -1) ? max : (j + length_written); i += 2; @@ -192,9 +192,9 @@ apr_size_t win32_strftime_extra(char *s, size_t max, const char *format, #endif -APR_DECLARE(apr_status_t) apr_strftime(char *s, apr_size_t *retsize, - apr_size_t max, const char *format, - apr_time_exp_t *xt) +APR_DECLARE(fspr_status_t) fspr_strftime(char *s, fspr_size_t *retsize, + fspr_size_t max, const char *format, + fspr_time_exp_t *xt) { #ifdef _WIN32_WCE return APR_ENOTIMPL; diff --git a/libs/apr/user/netware/groupinfo.c b/libs/apr/user/netware/groupinfo.c index e7cfd9b267..86a22df502 100644 --- a/libs/apr/user/netware/groupinfo.c +++ b/libs/apr/user/netware/groupinfo.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_user.h" -#include "apr_private.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_user.h" +#include "fspr_private.h" #ifdef HAVE_GRP_H #include #endif @@ -28,14 +28,14 @@ #include /* for _POSIX_THREAD_SAFE_FUNCTIONS */ #endif -APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_gid_name_get(char **groupname, fspr_gid_t groupid, + fspr_pool_t *p) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid, - const char *groupname, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_gid_get(fspr_gid_t *groupid, + const char *groupname, fspr_pool_t *p) { return APR_ENOTIMPL; } diff --git a/libs/apr/user/netware/userinfo.c b/libs/apr/user/netware/userinfo.c index b58991b8ea..c5677dab7e 100644 --- a/libs/apr/user/netware/userinfo.c +++ b/libs/apr/user/netware/userinfo.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_user.h" -#include "apr_private.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_user.h" +#include "fspr_private.h" #ifdef HAVE_PWD_H #include #endif @@ -30,25 +30,25 @@ #define PWBUF_SIZE 512 -static apr_status_t getpwnam_safe(const char *username, +static fspr_status_t getpwnam_safe(const char *username, struct passwd *pw, char pwbuf[PWBUF_SIZE]) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, +APR_DECLARE(fspr_status_t) fspr_uid_homepath_get(char **dirname, const char *username, - apr_pool_t *p) + fspr_pool_t *p) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, - apr_gid_t *gid, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_current(fspr_uid_t *uid, + fspr_gid_t *gid, + fspr_pool_t *p) { return APR_ENOTIMPL; } @@ -56,14 +56,14 @@ APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, -APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, - const char *username, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_get(fspr_uid_t *uid, fspr_gid_t *gid, + const char *username, fspr_pool_t *p) { return APR_ENOTIMPL; } -APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_name_get(char **username, fspr_uid_t userid, + fspr_pool_t *p) { return APR_ENOTIMPL; } diff --git a/libs/apr/user/unix/groupinfo.c b/libs/apr/user/unix/groupinfo.c index 89ae966b67..994eda17a3 100644 --- a/libs/apr/user/unix/groupinfo.c +++ b/libs/apr/user/unix/groupinfo.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_user.h" -#include "apr_private.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_user.h" +#include "fspr_private.h" #ifdef HAVE_GRP_H #include #endif @@ -28,15 +28,15 @@ #include /* for _POSIX_THREAD_SAFE_FUNCTIONS */ #endif -APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_gid_name_get(char **groupname, fspr_gid_t groupid, + fspr_pool_t *p) { struct group *gr; #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRGID_R) struct group grp; char grbuf[512]; - apr_status_t rv; + fspr_status_t rv; /* See comment in getpwnam_safe on error handling. */ rv = getgrgid_r(groupid, &grp, grbuf, sizeof(grbuf), &gr); @@ -52,19 +52,19 @@ APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, return errno ? errno : APR_ENOENT; } #endif - *groupname = apr_pstrdup(p, gr->gr_name); + *groupname = fspr_pstrdup(p, gr->gr_name); return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *groupid, - const char *groupname, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_gid_get(fspr_gid_t *groupid, + const char *groupname, fspr_pool_t *p) { struct group *gr; #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETGRNAM_R) struct group grp; char grbuf[512]; - apr_status_t rv; + fspr_status_t rv; /* See comment in getpwnam_safe on error handling. */ rv = getgrnam_r(groupname, &grp, grbuf, sizeof(grbuf), &gr); diff --git a/libs/apr/user/unix/userinfo.c b/libs/apr/user/unix/userinfo.c index 8b1d6db808..3cb6c5abb7 100644 --- a/libs/apr/user/unix/userinfo.c +++ b/libs/apr/user/unix/userinfo.c @@ -14,10 +14,10 @@ * limitations under the License. */ -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_user.h" -#include "apr_private.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_user.h" +#include "fspr_private.h" #ifdef HAVE_PWD_H #include #endif @@ -28,17 +28,17 @@ #include /* for _POSIX_THREAD_SAFE_FUNCTIONS */ #endif #define APR_WANT_MEMFUNC -#include "apr_want.h" +#include "fspr_want.h" #define PWBUF_SIZE 512 -static apr_status_t getpwnam_safe(const char *username, +static fspr_status_t getpwnam_safe(const char *username, struct passwd *pw, char pwbuf[PWBUF_SIZE]) { struct passwd *pwptr; #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWNAM_R) - apr_status_t rv; + fspr_status_t rv; /* POSIX defines getpwnam_r() et al to return the error number * rather than set errno, and requires pwptr to be set to NULL if @@ -66,31 +66,31 @@ static apr_status_t getpwnam_safe(const char *username, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, +APR_DECLARE(fspr_status_t) fspr_uid_homepath_get(char **dirname, const char *username, - apr_pool_t *p) + fspr_pool_t *p) { struct passwd pw; char pwbuf[PWBUF_SIZE]; - apr_status_t rv; + fspr_status_t rv; if ((rv = getpwnam_safe(username, &pw, pwbuf)) != APR_SUCCESS) return rv; #ifdef OS2 /* Need to manually add user name for OS/2 */ - *dirname = apr_pstrcat(p, pw.pw_dir, pw.pw_name, NULL); + *dirname = fspr_pstrcat(p, pw.pw_dir, pw.pw_name, NULL); #else - *dirname = apr_pstrdup(p, pw.pw_dir); + *dirname = fspr_pstrdup(p, pw.pw_dir); #endif return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, - apr_gid_t *gid, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_current(fspr_uid_t *uid, + fspr_gid_t *gid, + fspr_pool_t *p) { *uid = getuid(); *gid = getgid(); @@ -101,12 +101,12 @@ APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, -APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, - const char *username, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_get(fspr_uid_t *uid, fspr_gid_t *gid, + const char *username, fspr_pool_t *p) { struct passwd pw; char pwbuf[PWBUF_SIZE]; - apr_status_t rv; + fspr_status_t rv; if ((rv = getpwnam_safe(username, &pw, pwbuf)) != APR_SUCCESS) return rv; @@ -117,14 +117,14 @@ APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_name_get(char **username, fspr_uid_t userid, + fspr_pool_t *p) { struct passwd *pw; #if APR_HAS_THREADS && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && defined(HAVE_GETPWUID_R) struct passwd pwd; char pwbuf[PWBUF_SIZE]; - apr_status_t rv; + fspr_status_t rv; rv = getpwuid_r(userid, &pwd, pwbuf, sizeof(pwbuf), &pw); if (rv) { @@ -141,6 +141,6 @@ APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, return errno ? errno : APR_ENOENT; } #endif - *username = apr_pstrdup(p, pw->pw_name); + *username = fspr_pstrdup(p, pw->pw_name); return APR_SUCCESS; } diff --git a/libs/apr/user/win32/groupinfo.c b/libs/apr/user/win32/groupinfo.c index 7739a5428d..5ed18ee323 100644 --- a/libs/apr/user/win32/groupinfo.c +++ b/libs/apr/user/win32/groupinfo.c @@ -14,16 +14,16 @@ * limitations under the License. */ -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_user.h" -#include "apr_private.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_user.h" +#include "fspr_private.h" #if APR_HAVE_SYS_TYPES_H #include #endif -APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *gid, - const char *groupname, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_gid_get(fspr_gid_t *gid, + const char *groupname, fspr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -37,11 +37,11 @@ APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *gid, char *pos; if (pos = strchr(groupname, '/')) { - domain = apr_pstrndup(p, groupname, pos - groupname); + domain = fspr_pstrndup(p, groupname, pos - groupname); groupname = pos + 1; } else if (pos = strchr(groupname, '\\')) { - domain = apr_pstrndup(p, groupname, pos - groupname); + domain = fspr_pstrndup(p, groupname, pos - groupname); groupname = pos + 1; } else { @@ -54,22 +54,22 @@ APR_DECLARE(apr_status_t) apr_gid_get(apr_gid_t *gid, if (sidlen) { /* Give it back on the second pass */ - *gid = apr_palloc(p, sidlen); + *gid = fspr_palloc(p, sidlen); domlen = sizeof(anydomain); rv = LookupAccountName(domain, groupname, *gid, &sidlen, anydomain, &domlen, &sidtype); } if (!sidlen || !rv) { - return apr_get_os_error(); + return fspr_get_os_error(); } return APR_SUCCESS; #endif } -APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_gid_name_get(char **groupname, fspr_gid_t groupid, fspr_pool_t *p) { #ifdef _WIN32_WCE - *groupname = apr_pstrdup(p, "Administrators"); + *groupname = fspr_pstrdup(p, "Administrators"); #else SID_NAME_USE type; char name[MAX_PATH], domain[MAX_PATH]; @@ -77,16 +77,16 @@ APR_DECLARE(apr_status_t) apr_gid_name_get(char **groupname, apr_gid_t groupid, if (!groupid) return APR_EINVAL; if (!LookupAccountSid(NULL, groupid, name, &cbname, domain, &cbdomain, &type)) - return apr_get_os_error(); + return fspr_get_os_error(); if (type != SidTypeGroup && type != SidTypeWellKnownGroup && type != SidTypeAlias) return APR_EINVAL; - *groupname = apr_pstrdup(p, name); + *groupname = fspr_pstrdup(p, name); #endif return APR_SUCCESS; } -APR_DECLARE(apr_status_t) apr_gid_compare(apr_gid_t left, apr_gid_t right) +APR_DECLARE(fspr_status_t) fspr_gid_compare(fspr_gid_t left, fspr_gid_t right) { if (!left || !right) return APR_EINVAL; diff --git a/libs/apr/user/win32/userinfo.c b/libs/apr/user/win32/userinfo.c index aae3f9bec0..28b243d828 100644 --- a/libs/apr/user/win32/userinfo.c +++ b/libs/apr/user/win32/userinfo.c @@ -14,11 +14,11 @@ * limitations under the License. */ -#include "apr_private.h" -#include "apr_strings.h" -#include "apr_portable.h" -#include "apr_user.h" -#include "apr_arch_file_io.h" +#include "fspr_private.h" +#include "fspr_strings.h" +#include "fspr_portable.h" +#include "fspr_user.h" +#include "fspr_arch_file_io.h" #if APR_HAVE_SYS_TYPES_H #include #endif @@ -30,7 +30,7 @@ * depends on IsValidSid(), which internally we better test long * before we get here! */ -void get_sid_string(char *buf, apr_size_t blen, apr_uid_t id) +void get_sid_string(char *buf, fspr_size_t blen, fspr_uid_t id) { PSID_IDENTIFIER_AUTHORITY psia; DWORD nsa; @@ -45,10 +45,10 @@ void get_sid_string(char *buf, apr_size_t blen, apr_uid_t id) + ((DWORD)(psia->Value[3]) << 16) + ((DWORD)(psia->Value[2]) << 24); sa = (DWORD)(psia->Value[1]) + ((DWORD)(psia->Value[0]) << 8); if (sa) { - slen = apr_snprintf(buf, blen, "S-%lu-0x%04x%08x", + slen = fspr_snprintf(buf, blen, "S-%lu-0x%04x%08x", SID_REVISION, sa, nsa); } else { - slen = apr_snprintf(buf, blen, "S-%lu-%lu", + slen = fspr_snprintf(buf, blen, "S-%lu-%lu", SID_REVISION, nsa); } @@ -56,7 +56,7 @@ void get_sid_string(char *buf, apr_size_t blen, apr_uid_t id) */ nsa = *GetSidSubAuthorityCount(id); for (sa = 0; sa < nsa; ++sa) { - slen += apr_snprintf(buf + slen, blen - slen, "-%lu", + slen += fspr_snprintf(buf + slen, blen - slen, "-%lu", *GetSidSubAuthority(id, sa)); } } @@ -64,26 +64,26 @@ void get_sid_string(char *buf, apr_size_t blen, apr_uid_t id) /* Query the ProfileImagePath from the version-specific branch, where the * regkey uses the user's name on 9x, and user's sid string on NT. */ -APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, +APR_DECLARE(fspr_status_t) fspr_uid_homepath_get(char **dirname, const char *username, - apr_pool_t *p) + fspr_pool_t *p) { #ifdef _WIN32_WCE - *dirname = apr_pstrdup(p, "/My Documents"); + *dirname = fspr_pstrdup(p, "/My Documents"); return APR_SUCCESS; #else - apr_status_t rv; + fspr_status_t rv; char regkey[MAX_PATH * 2]; char *fixch; DWORD keylen; DWORD type; HKEY key; - if (apr_os_level >= APR_WIN_NT) { - apr_uid_t uid; - apr_gid_t gid; + if (fspr_os_level >= APR_WIN_NT) { + fspr_uid_t uid; + fspr_gid_t gid; - if ((rv = apr_uid_get(&uid, &gid, username, p)) != APR_SUCCESS) + if ((rv = fspr_uid_get(&uid, &gid, username, p)) != APR_SUCCESS) return rv; strcpy(regkey, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\" @@ -95,7 +95,7 @@ APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, strcpy(regkey, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\" "ProfileList\\"); keylen = (DWORD)strlen(regkey); - apr_cpystrn(regkey + keylen, username, sizeof(regkey) - keylen); + fspr_cpystrn(regkey + keylen, username, sizeof(regkey) - keylen); } if ((rv = RegOpenKeyEx(HKEY_LOCAL_MACHINE, regkey, 0, @@ -114,18 +114,18 @@ APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, if (type == REG_SZ) { char retdir[MAX_PATH]; if ((rv = unicode_to_utf8_path(retdir, sizeof(retdir), - (apr_wchar_t*)regkey)) != APR_SUCCESS) + (fspr_wchar_t*)regkey)) != APR_SUCCESS) return rv; - *dirname = apr_pstrdup(p, retdir); + *dirname = fspr_pstrdup(p, retdir); } else if (type == REG_EXPAND_SZ) { - apr_wchar_t path[MAX_PATH]; + fspr_wchar_t path[MAX_PATH]; char retdir[MAX_PATH]; - ExpandEnvironmentStringsW((apr_wchar_t*)regkey, path, sizeof(path)); + ExpandEnvironmentStringsW((fspr_wchar_t*)regkey, path, sizeof(path)); if ((rv = unicode_to_utf8_path(retdir, sizeof(retdir), path)) != APR_SUCCESS) return rv; - *dirname = apr_pstrdup(p, retdir); + *dirname = fspr_pstrdup(p, retdir); } else return APR_ENOENT; @@ -141,12 +141,12 @@ APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, if (rv != ERROR_SUCCESS) return APR_FROM_OS_ERROR(rv); if (type == REG_SZ) { - *dirname = apr_pstrdup(p, regkey); + *dirname = fspr_pstrdup(p, regkey); } else if (type == REG_EXPAND_SZ) { char path[MAX_PATH]; ExpandEnvironmentStrings(regkey, path, sizeof(path)); - *dirname = apr_pstrdup(p, path); + *dirname = fspr_pstrdup(p, path); } else return APR_ENOENT; @@ -159,9 +159,9 @@ APR_DECLARE(apr_status_t) apr_uid_homepath_get(char **dirname, #endif /* _WIN32_WCE */ } -APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, - apr_gid_t *gid, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_current(fspr_uid_t *uid, + fspr_gid_t *gid, + fspr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -172,32 +172,32 @@ APR_DECLARE(apr_status_t) apr_uid_current(apr_uid_t *uid, TOKEN_PRIMARY_GROUP *grp; if(!OpenProcessToken(GetCurrentProcess(), STANDARD_RIGHTS_READ | READ_CONTROL | TOKEN_QUERY, &threadtok)) { - return apr_get_os_error(); + return fspr_get_os_error(); } *uid = NULL; if (!GetTokenInformation(threadtok, TokenUser, NULL, 0, &needed) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) - && (usr = apr_palloc(p, needed)) + && (usr = fspr_palloc(p, needed)) && GetTokenInformation(threadtok, TokenUser, usr, needed, &needed)) *uid = usr->User.Sid; else - return apr_get_os_error(); + return fspr_get_os_error(); if (!GetTokenInformation(threadtok, TokenPrimaryGroup, NULL, 0, &needed) && (GetLastError() == ERROR_INSUFFICIENT_BUFFER) - && (grp = apr_palloc(p, needed)) + && (grp = fspr_palloc(p, needed)) && GetTokenInformation(threadtok, TokenPrimaryGroup, grp, needed, &needed)) *gid = grp->PrimaryGroup; else - return apr_get_os_error(); + return fspr_get_os_error(); return APR_SUCCESS; #endif } -APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, - const char *username, apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_get(fspr_uid_t *uid, fspr_gid_t *gid, + const char *username, fspr_pool_t *p) { #ifdef _WIN32_WCE return APR_ENOTIMPL; @@ -211,11 +211,11 @@ APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, char *pos; if (pos = strchr(username, '/')) { - domain = apr_pstrndup(p, username, pos - username); + domain = fspr_pstrndup(p, username, pos - username); username = pos + 1; } else if (pos = strchr(username, '\\')) { - domain = apr_pstrndup(p, username, pos - username); + domain = fspr_pstrndup(p, username, pos - username); username = pos + 1; } else { @@ -228,13 +228,13 @@ APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, if (sidlen) { /* Give it back on the second pass */ - *uid = apr_palloc(p, sidlen); + *uid = fspr_palloc(p, sidlen); domlen = sizeof(anydomain); rv = LookupAccountName(domain, username, *uid, &sidlen, anydomain, &domlen, &sidtype); } if (!sidlen || !rv) { - return apr_get_os_error(); + return fspr_get_os_error(); } /* There doesn't seem to be a simple way to retrieve the primary group sid */ @@ -243,11 +243,11 @@ APR_DECLARE(apr_status_t) apr_uid_get(apr_uid_t *uid, apr_gid_t *gid, #endif } -APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, - apr_pool_t *p) +APR_DECLARE(fspr_status_t) fspr_uid_name_get(char **username, fspr_uid_t userid, + fspr_pool_t *p) { #ifdef _WIN32_WCE - *username = apr_pstrdup(p, "Administrator"); + *username = fspr_pstrdup(p, "Administrator"); return APR_SUCCESS; #else SID_NAME_USE type; @@ -256,15 +256,15 @@ APR_DECLARE(apr_status_t) apr_uid_name_get(char **username, apr_uid_t userid, if (!userid) return APR_EINVAL; if (!LookupAccountSid(NULL, userid, name, &cbname, domain, &cbdomain, &type)) - return apr_get_os_error(); + return fspr_get_os_error(); if (type != SidTypeUser && type != SidTypeAlias && type != SidTypeWellKnownGroup) return APR_EINVAL; - *username = apr_pstrdup(p, name); + *username = fspr_pstrdup(p, name); return APR_SUCCESS; #endif } -APR_DECLARE(apr_status_t) apr_uid_compare(apr_uid_t left, apr_uid_t right) +APR_DECLARE(fspr_status_t) fspr_uid_compare(fspr_uid_t left, fspr_uid_t right) { if (!left || !right) return APR_EINVAL; From 85d25e269b71158c312b76f15b910a7e3fcef863 Mon Sep 17 00:00:00 2001 From: Chris Rienzo Date: Thu, 18 Aug 2022 14:39:44 -0400 Subject: [PATCH 052/155] [core] use fspr prefixed symbols instead of apr --- libs/.gitignore | 6 +- src/include/private/switch_apr_pvt.h | 34 +-- src/include/switch_apr.h | 90 ++++---- src/include/switch_types.h | 2 +- src/switch.c | 8 +- src/switch_apr.c | 328 +++++++++++++-------------- src/switch_apr_queue.c | 139 ++++++------ src/switch_core.c | 8 +- src/switch_core_memory.c | 136 +++++------ src/switch_loadable_module.c | 38 ++-- src/switch_rtp.c | 2 +- src/switch_time.c | 2 +- 12 files changed, 396 insertions(+), 397 deletions(-) diff --git a/libs/.gitignore b/libs/.gitignore index f1d983b2da..7ed9df2c58 100644 --- a/libs/.gitignore +++ b/libs/.gitignore @@ -34,9 +34,9 @@ opal /apr/build/pkg/pkginfo /apr/exports.c /apr/export_vars.c -/apr/include/apr.h -/apr/include/arch/unix/apr_private.h -/apr/include/arch/unix/apr_private.h.in +/apr/include/fspr.h +/apr/include/arch/unix/fspr_private.h +/apr/include/arch/unix/fspr_private.h.in /apr/.make.dirs /apr/Makefile /apr/test/internal/Makefile diff --git a/src/include/private/switch_apr_pvt.h b/src/include/private/switch_apr_pvt.h index f908f0df84..849662ee28 100644 --- a/src/include/private/switch_apr_pvt.h +++ b/src/include/private/switch_apr_pvt.h @@ -34,34 +34,34 @@ #ifndef __SWITCH_APR_PVT_H__ #define __SWITCH_APR_PVT_H__ -/* for apr_pool_create and apr_pool_destroy */ +/* for fspr_pool_create and fspr_pool_destroy */ /* functions only used in this file so not exposed */ -#include +#include -/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */ +/* for fspr_hash_make, fspr_hash_pool_get, fspr_hash_set */ /* functions only used in this file so not exposed */ -#include +#include -/* for apr_pvsprintf */ +/* for fspr_pvsprintf */ /* function only used in this file so not exposed */ -#include +#include -/* for apr_initialize and apr_terminate */ +/* for fspr_initialize and fspr_terminate */ /* function only used in this file so not exposed */ -#include +#include -#include +#include typedef struct switch_apr_queue_t switch_apr_queue_t; -apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, apr_pool_t *a); -apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data); -apr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data); +fspr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, fspr_pool_t *a); +fspr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data); +fspr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data); unsigned int switch_apr_queue_size(switch_apr_queue_t *queue); -apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data); -apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, apr_interval_time_t timeout); -apr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data); -apr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue); -apr_status_t switch_apr_queue_term(switch_apr_queue_t *queue); +fspr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data); +fspr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, fspr_interval_time_t timeout); +fspr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data); +fspr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue); +fspr_status_t switch_apr_queue_term(switch_apr_queue_t *queue); #endif // __SWITCH_APR_PVT_H__ diff --git a/src/include/switch_apr.h b/src/include/switch_apr.h index 57d7e994e7..36f1531bef 100644 --- a/src/include/switch_apr.h +++ b/src/include/switch_apr.h @@ -75,14 +75,14 @@ SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_i * @{ */ /** The fundamental pool type */ -/* see switch types.h typedef struct apr_pool_t switch_memory_pool_t;*/ +/* see switch types.h typedef struct fspr_pool_t switch_memory_pool_t;*/ /** * Clear all memory in the pool and run all the cleanups. This also destroys all * subpools. * @param pool The pool to clear * @remark This does not actually free the memory, it just allows the pool * to re-use this memory for the next allocation. - * @see apr_pool_destroy() + * @see fspr_pool_destroy() */ SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *pool); @@ -108,16 +108,16 @@ SWITCH_DECLARE(char *) switch_copy_string(_Out_z_cap_(dst_size) #if 0 /** - * @defgroup apr_hash Hash Tables + * @defgroup fspr_hash Hash Tables * @ingroup switch_apr * @{ */ /** Abstract type for hash tables. */ - typedef struct apr_hash_t switch_hash_t; + typedef struct fspr_hash_t switch_hash_t; /** Abstract type for scanning hash tables. */ - typedef struct apr_hash_index_t switch_hash_index_t; + typedef struct fspr_hash_index_t switch_hash_index_t; /** * When passing a key to switch_hashfunc_default, this value can be @@ -228,7 +228,7 @@ SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec); SWITCH_DECLARE(switch_time_t) switch_time_now(void); /** - * Convert time value from human readable format to a numeric apr_time_t that + * Convert time value from human readable format to a numeric fspr_time_t that * always represents GMT * @param result the resulting imploded time * @param input the input exploded time @@ -273,7 +273,7 @@ SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input); /** - * Convert time value from human readable format to a numeric apr_time_t + * Convert time value from human readable format to a numeric fspr_time_t * e.g. elapsed usec since epoch * @param result the resulting imploded time * @param input the input exploded time @@ -311,7 +311,7 @@ SWITCH_DECLARE(void) switch_micro_sleep(switch_interval_time_t t); */ /** Opaque thread-local mutex structure */ - typedef struct apr_thread_mutex_t switch_mutex_t; + typedef struct fspr_thread_mutex_t switch_mutex_t; /** Lock Flags */ #define SWITCH_MUTEX_DEFAULT 0x0 /**< platform-optimal lock behavior */ @@ -374,8 +374,8 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock); */ /** Opaque type used for the atomic operations */ -#ifdef apr_atomic_t - typedef apr_atomic_t switch_atomic_t; +#ifdef fspr_atomic_t + typedef fspr_atomic_t switch_atomic_t; #else typedef uint32_t switch_atomic_t; #endif @@ -433,7 +433,7 @@ SWITCH_DECLARE(int) switch_atomic_dec(volatile switch_atomic_t *mem); */ /** Opaque structure used for the rwlock */ - typedef struct apr_thread_rwlock_t switch_thread_rwlock_t; + typedef struct fspr_thread_rwlock_t switch_thread_rwlock_t; SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool); SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock); @@ -460,7 +460,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock */ /** Opaque structure for thread condition variables */ - typedef struct apr_thread_cond_t switch_thread_cond_t; + typedef struct fspr_thread_cond_t switch_thread_cond_t; /** * Create and initialize a condition variable that can be used to signal @@ -682,17 +682,17 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void */ /** Structure for referencing files. */ - typedef struct apr_file_t switch_file_t; + typedef struct fspr_file_t switch_file_t; typedef int32_t switch_fileperms_t; typedef int switch_seek_where_t; /** - * @defgroup apr_file_seek_flags File Seek Flags + * @defgroup fspr_file_seek_flags File Seek Flags * @{ */ -/* flags for apr_file_seek */ +/* flags for fspr_file_seek */ /** Set the file position */ #define SWITCH_SEEK_SET SEEK_SET /** Current */ @@ -725,7 +725,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void #define SWITCH_FPROT_OS_DEFAULT 0x0FFF /**< use OS's default permissions */ -/* additional permission flags for apr_file_copy and apr_file_append */ +/* additional permission flags for fspr_file_copy and fspr_file_append */ #define SWITCH_FPROT_FILE_SOURCE_PERMS 0x1000 /**< Copy source file's permissions */ /** @} */ @@ -769,7 +769,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void #define SWITCH_FOPEN_XTHREAD 0x00200 /**< Platform dependent tag to open the file for use across multiple threads */ #define SWITCH_FOPEN_SHARELOCK 0x00400 /**< Platform dependent support for higher level locked read/write access to support writes across process/machines */ #define SWITCH_FOPEN_NOCLEANUP 0x00800 /**< Do not register a cleanup when the file is opened */ -#define SWITCH_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this file should support apr_socket_sendfile operation */ +#define SWITCH_FOPEN_SENDFILE_ENABLED 0x01000 /**< Advisory flag that this file should support fspr_socket_sendfile operation */ #define SWITCH_FOPEN_LARGEFILE 0x04000 /**< Platform dependent flag to enable large file support */ /** @} */ @@ -796,11 +796,11 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void * writes across process/machines * SWITCH_FOPEN_NOCLEANUP Do not register a cleanup with the pool * passed in on the pool argument (see below). - * The apr_os_file_t handle in apr_file_t will not + * The fspr_os_file_t handle in fspr_file_t will not * be closed when the pool is destroyed. * SWITCH_FOPEN_SENDFILE_ENABLED Open with appropriate platform semantics * for sendfile operations. Advisory only, - * apr_socket_sendfile does not check this flag. + * fspr_socket_sendfile does not check this flag. * * @param perm Access permissions for file. * @param pool The pool to use. @@ -844,7 +844,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_rename(const char *from_path, const * @param nbytes On entry, the number of bytes to read; on exit, the number * of bytes read. * - * @remark apr_file_read will read up to the specified number of + * @remark fspr_file_read will read up to the specified number of * bytes, but never more. If there isn't enough data to fill that * number of bytes, all of the available data is read. The third * argument is modified to reflect the number of bytes read. If a @@ -863,7 +863,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *b * @param nbytes On entry, the number of bytes to write; on exit, the number * of bytes written. * - * @remark apr_file_write will write up to the specified number of + * @remark fspr_file_write will write up to the specified number of * bytes, but never more. If the OS cannot write that many bytes, it * will write as many as it can. The third argument is modified to * reflect the * number of bytes written. @@ -929,10 +929,10 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir); */ /** Opaque Thread structure. */ - typedef struct apr_thread_t switch_thread_t; + typedef struct fspr_thread_t switch_thread_t; /** Opaque Thread attributes structure. */ - typedef struct apr_threadattr_t switch_threadattr_t; + typedef struct fspr_threadattr_t switch_threadattr_t; /** * The prototype for any APR thread worker functions. @@ -940,7 +940,7 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir); */ typedef void *(SWITCH_THREAD_FUNC * switch_thread_start_t) (switch_thread_t *, void *); -//APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr, switch_size_t stacksize) +//APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr, switch_size_t stacksize) SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize); SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority); @@ -1014,10 +1014,10 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre #endif /** A structure to represent sockets */ - typedef struct apr_socket_t switch_socket_t; + typedef struct fspr_socket_t switch_socket_t; /** Freeswitch's socket address type, used to ensure protocol independence */ - typedef struct apr_sockaddr_t switch_sockaddr_t; + typedef struct fspr_sockaddr_t switch_sockaddr_t; typedef enum { SWITCH_SHUTDOWN_READ, /**< no longer allow read request */ @@ -1118,8 +1118,8 @@ SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const sw /** - * Create apr_sockaddr_t from hostname, address family, and port. - * @param sa The new apr_sockaddr_t. + * Create fspr_sockaddr_t from hostname, address family, and port. + * @param sa The new fspr_sockaddr_t. * @param hostname The hostname or numeric address string to resolve/parse, or * NULL to build an address that corresponds to 0.0.0.0 or :: * @param family The address family to use, or SWITCH_UNSPEC if the system should @@ -1138,7 +1138,7 @@ SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const sw * isn't NULL and APR_HAVE_IPV6; mutually exclusive * with APR_IPV4_ADDR_OK * - * @param pool The pool for the apr_sockaddr_t and associated storage. + * @param pool The pool for the fspr_sockaddr_t and associated storage. */ SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, int32_t family, switch_port_t port, int32_t flags, switch_memory_pool_t *pool); @@ -1156,7 +1156,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, con * @remark *
      * This functions acts like a blocking write by default.  To change
    - * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
    + * this behavior, use fspr_socket_timeout_set() or the APR_SO_NONBLOCK
      * socket option.
      *
      * It is possible for both bytes to be sent and an error to be returned.
    @@ -1168,7 +1168,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const
     
     /**
      * @param sock The socket to send from
    - * @param where The apr_sockaddr_t describing where to send the data
    + * @param where The fspr_sockaddr_t describing where to send the data
      * @param flags The flags to use
      * @param buf  The data to send
      * @param len  The length of the data to send
    @@ -1179,7 +1179,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, swit
     SWITCH_DECLARE(switch_status_t) switch_socket_send_nonblock(switch_socket_t *sock, const char *buf, switch_size_t *len);
     
     /**
    - * @param from The apr_sockaddr_t to fill in the recipient info
    + * @param from The fspr_sockaddr_t to fill in the recipient info
      * @param sock The socket to use
      * @param flags The flags to use
      * @param buf  The buffer to use
    @@ -1199,7 +1199,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int
      * @remark
      * 
      * This functions acts like a blocking read by default.  To change
    - * this behavior, use apr_socket_timeout_set() or the APR_SO_NONBLOCK
    + * this behavior, use fspr_socket_timeout_set() or the APR_SO_NONBLOCK
      * socket option.
      * The number of bytes actually received is stored in argument 3.
      *
    @@ -1304,14 +1304,14 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
     									   /**< descriptor type */
     		 int16_t reqevents;	/**< requested events */
     		 int16_t rtnevents;	/**< returned events */
    -		 switch_descriptor_t desc;	 /**< @see apr_descriptor */
    +		 switch_descriptor_t desc;	 /**< @see fspr_descriptor */
     		 void *client_data;		/**< allows app to associate context */
     	 };
     
     
     
     /**
    - * @defgroup apr_poll Poll Routines
    + * @defgroup fspr_poll Poll Routines
      * @ingroup switch_apr
      * @{
      */
    @@ -1319,7 +1319,7 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
     	 typedef struct switch_pollfd switch_pollfd_t;
     
     /** Opaque structure used for pollset API */
    -	 typedef struct apr_pollset_t switch_pollset_t;
    +	 typedef struct fspr_pollset_t switch_pollset_t;
     
     /**
      * Poll options
    @@ -1340,9 +1340,9 @@ SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, sw
      *
      * @remark If flags equals APR_POLLSET_THREADSAFE, then a pollset is
      * created on which it is safe to make concurrent calls to
    - * apr_pollset_add(), apr_pollset_remove() and apr_pollset_poll() from
    + * fspr_pollset_add(), fspr_pollset_remove() and fspr_pollset_poll() from
      * separate threads.  This feature is only supported on some
    - * platforms; the apr_pollset_create() call will fail with
    + * platforms; the fspr_pollset_create() call will fail with
      * APR_ENOTIMPL on platforms where it is not supported.
      */
     SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *pool, uint32_t flags);
    @@ -1353,11 +1353,11 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollse
      * @param descriptor The descriptor to add
      * @remark If you set client_data in the descriptor, that value
      *         will be returned in the client_data field whenever this
    - *         descriptor is signalled in apr_pollset_poll().
    + *         descriptor is signalled in fspr_pollset_poll().
      * @remark If the pollset has been created with APR_POLLSET_THREADSAFE
    - *         and thread T1 is blocked in a call to apr_pollset_poll() for
    - *         this same pollset that is being modified via apr_pollset_add()
    - *         in thread T2, the currently executing apr_pollset_poll() call in
    + *         and thread T1 is blocked in a call to fspr_pollset_poll() for
    + *         this same pollset that is being modified via fspr_pollset_add()
    + *         in thread T2, the currently executing fspr_pollset_poll() call in
      *         T1 will either: (1) automatically include the newly added descriptor
      *         in the set of descriptors it is watching or (2) return immediately
      *         with APR_EINTR.  Option (1) is recommended, but option (2) is
    @@ -1371,9 +1371,9 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, co
      * @param pollset The pollset from which to remove the descriptor
      * @param descriptor The descriptor to remove
      * @remark If the pollset has been created with APR_POLLSET_THREADSAFE
    - *         and thread T1 is blocked in a call to apr_pollset_poll() for
    - *         this same pollset that is being modified via apr_pollset_remove()
    - *         in thread T2, the currently executing apr_pollset_poll() call in
    + *         and thread T1 is blocked in a call to fspr_pollset_poll() for
    + *         this same pollset that is being modified via fspr_pollset_remove()
    + *         in thread T2, the currently executing fspr_pollset_poll() call in
      *         T1 will either: (1) automatically exclude the newly added descriptor
      *         in the set of descriptors it is watching or (2) return immediately
      *         with APR_EINTR.  Option (1) is recommended, but option (2) is
    diff --git a/src/include/switch_types.h b/src/include/switch_types.h
    index f6a62a4632..f6bb87d391 100644
    --- a/src/include/switch_types.h
    +++ b/src/include/switch_types.h
    @@ -2323,7 +2323,7 @@ typedef int switch_os_socket_t;
     #define SWITCH_SOCK_INVALID -1
     #endif
     
    -typedef struct apr_pool_t switch_memory_pool_t;
    +typedef struct fspr_pool_t switch_memory_pool_t;
     typedef void* switch_plc_state_t;
     typedef uint16_t switch_port_t;
     typedef uint8_t switch_payload_t;
    diff --git a/src/switch.c b/src/switch.c
    index 3ace9fb7cf..19a3d93fad 100644
    --- a/src/switch.c
    +++ b/src/switch.c
    @@ -1040,7 +1040,7 @@ int main(int argc, char *argv[])
     		return freeswitch_kill_background();
     	}
     
    -	if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
    +	if (fspr_initialize() != SWITCH_STATUS_SUCCESS) {
     		fprintf(stderr, "FATAL ERROR! Could not initialize APR\n");
     		return 255;
     	}
    @@ -1067,7 +1067,7 @@ int main(int argc, char *argv[])
     			rlp.rlim_max = SWITCH_SYSTEM_THREAD_STACKSIZE;
     			setrlimit(RLIMIT_STACK, &rlp);
     
    -			apr_terminate();
    +			fspr_terminate();
     			if (argv) ret = (int) execv(argv[0], argv);
     
     			for (i = 0; i < argc; i++) {
    @@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
     	switch_snprintf(pid_buffer, sizeof(pid_buffer), "%d", pid);
     	pid_len = strlen(pid_buffer);
     
    -	apr_pool_create(&pool, NULL);
    +	fspr_pool_create(&pool, NULL);
     
     	switch_dir_make_recursive(SWITCH_GLOBAL_dirs.run_dir, SWITCH_DEFAULT_DIR_PERMS, pool);
     
    @@ -1230,7 +1230,7 @@ int main(int argc, char *argv[])
     	destroy_status = switch_core_destroy();
     
     	switch_file_close(fd);
    -	apr_pool_destroy(pool);
    +	fspr_pool_destroy(pool);
     
     	if (unlink(pid_path) != 0) {
     		fprintf(stderr, "Failed to delete pid file [%s]\n", pid_path);
    diff --git a/src/switch_apr.c b/src/switch_apr.c
    index 0f07276b86..6cf1c86277 100644
    --- a/src/switch_apr.c
    +++ b/src/switch_apr.c
    @@ -39,37 +39,37 @@
     #include "private/switch_apr_pvt.h"
     
     /* apr headers*/
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
    +#include 
     #define APR_WANT_STDIO
     #define APR_WANT_STRFUNC
    -#include 
    -#include 
    -#include 
    -#include 
    +#include 
    +#include 
    +#include 
    +#include 
     
     #ifdef WIN32
    -#include "apr_arch_networkio.h"
    +#include "fspr_arch_networkio.h"
     /* Missing socket symbols */
     #ifndef SOL_TCP
     #define SOL_TCP IPPROTO_TCP
     #endif
     #endif
     
    -/* apr_vformatter_buff_t definition*/
    -#include 
    +/* fspr_vformatter_buff_t definition*/
    +#include 
     
     #if (defined(HAVE_LIBMD5) || defined(HAVE_LIBMD) || defined(HAVE_MD5INIT))
     #include 
    @@ -91,7 +91,7 @@ SWITCH_DECLARE(int) switch_status_is_timeup(int status)
     SWITCH_DECLARE(switch_thread_id_t) switch_thread_self(void)
     {
     #ifndef WIN32
    -	return apr_os_thread_current();
    +	return fspr_os_thread_current();
     #else
     	return (switch_thread_id_t) (GetCurrentThreadId());
     #endif
    @@ -102,7 +102,7 @@ SWITCH_DECLARE(int) switch_thread_equal(switch_thread_id_t tid1, switch_thread_i
     #ifdef WIN32
     	return (tid1 == tid2);
     #else
    -	return apr_os_thread_equal(tid1, tid2);
    +	return fspr_os_thread_equal(tid1, tid2);
     #endif
     
     }
    @@ -112,7 +112,7 @@ SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, sw
     	unsigned int hash = 0;
     	const unsigned char *key = (const unsigned char *) char_key;
     	const unsigned char *p;
    -	apr_ssize_t i;
    +	fspr_ssize_t i;
     
     	if (*klen == APR_HASH_KEY_STRING) {
     		for (p = key; *p; p++) {
    @@ -131,7 +131,7 @@ SWITCH_DECLARE(unsigned int) switch_ci_hashfunc_default(const char *char_key, sw
     
     SWITCH_DECLARE(unsigned int) switch_hashfunc_default(const char *key, switch_ssize_t *klen)
     {
    -	return apr_hashfunc_default(key, klen);
    +	return fspr_hashfunc_default(key, klen);
     }
     
     /* string functions */
    @@ -185,12 +185,12 @@ SWITCH_DECLARE(switch_status_t) switch_strftime(char *s, switch_size_t *retsize,
     		p++;
     	}
     
    -	return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
    +	return fspr_strftime(s, retsize, max, format, (fspr_time_exp_t *) tm);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_strftime_nocheck(char *s, switch_size_t *retsize, switch_size_t max, const char *format, switch_time_exp_t *tm)
     {
    -	return apr_strftime(s, retsize, max, format, (apr_time_exp_t *) tm);
    +	return fspr_strftime(s, retsize, max, format, (fspr_time_exp_t *) tm);
     }
     
     SWITCH_DECLARE(int) switch_snprintf(char *buf, switch_size_t len, const char *format, ...)
    @@ -198,14 +198,14 @@ SWITCH_DECLARE(int) switch_snprintf(char *buf, switch_size_t len, const char *fo
     	va_list ap;
     	int ret;
     	va_start(ap, format);
    -	ret = apr_vsnprintf(buf, len, format, ap);
    +	ret = fspr_vsnprintf(buf, len, format, ap);
     	va_end(ap);
     	return ret;
     }
     
     SWITCH_DECLARE(int) switch_vsnprintf(char *buf, switch_size_t len, const char *format, va_list ap)
     {
    -	return apr_vsnprintf(buf, len, format, ap);
    +	return fspr_vsnprintf(buf, len, format, ap);
     }
     
     SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_size_t dst_size)
    @@ -216,44 +216,44 @@ SWITCH_DECLARE(char *) switch_copy_string(char *dst, const char *src, switch_siz
     		*dst = '\0';
     		return dst;
     	}
    -	return apr_cpystrn(dst, src, dst_size);
    +	return fspr_cpystrn(dst, src, dst_size);
     }
     
     /* thread read write lock functions */
     
     SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_create(switch_thread_rwlock_t ** rwlock, switch_memory_pool_t *pool)
     {
    -	return apr_thread_rwlock_create(rwlock, pool);
    +	return fspr_thread_rwlock_create(rwlock, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_destroy(switch_thread_rwlock_t *rwlock)
     {
    -	return apr_thread_rwlock_destroy(rwlock);
    +	return fspr_thread_rwlock_destroy(rwlock);
     }
     
     SWITCH_DECLARE(switch_memory_pool_t *) switch_thread_rwlock_pool_get(switch_thread_rwlock_t *rwlock)
     {
    -	return apr_thread_rwlock_pool_get(rwlock);
    +	return fspr_thread_rwlock_pool_get(rwlock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_rdlock(switch_thread_rwlock_t *rwlock)
     {
    -	return apr_thread_rwlock_rdlock(rwlock);
    +	return fspr_thread_rwlock_rdlock(rwlock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_tryrdlock(switch_thread_rwlock_t *rwlock)
     {
    -	return apr_thread_rwlock_tryrdlock(rwlock);
    +	return fspr_thread_rwlock_tryrdlock(rwlock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_wrlock(switch_thread_rwlock_t *rwlock)
     {
    -	return apr_thread_rwlock_wrlock(rwlock);
    +	return fspr_thread_rwlock_wrlock(rwlock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock(switch_thread_rwlock_t *rwlock)
     {
    -	return apr_thread_rwlock_trywrlock(rwlock);
    +	return fspr_thread_rwlock_trywrlock(rwlock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock_timeout(switch_thread_rwlock_t *rwlock, int timeout)
    @@ -274,7 +274,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_trywrlock_timeout(switch_th
     
     SWITCH_DECLARE(switch_status_t) switch_thread_rwlock_unlock(switch_thread_rwlock_t *rwlock)
     {
    -	return apr_thread_rwlock_unlock(rwlock);
    +	return fspr_thread_rwlock_unlock(rwlock);
     }
     
     /* thread mutex functions */
    @@ -286,27 +286,27 @@ SWITCH_DECLARE(switch_status_t) switch_mutex_init(switch_mutex_t ** lock, unsign
     	   APR has no reason to not use critical sections instead of mutexes. */
     	if (flags == SWITCH_MUTEX_NESTED) flags = SWITCH_MUTEX_DEFAULT;
     #endif
    -	return apr_thread_mutex_create(lock, flags, pool);
    +	return fspr_thread_mutex_create(lock, flags, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_mutex_destroy(switch_mutex_t *lock)
     {
    -	return apr_thread_mutex_destroy(lock);
    +	return fspr_thread_mutex_destroy(lock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_mutex_lock(switch_mutex_t *lock)
     {
    -	return apr_thread_mutex_lock(lock);
    +	return fspr_thread_mutex_lock(lock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_mutex_unlock(switch_mutex_t *lock)
     {
    -	return apr_thread_mutex_unlock(lock);
    +	return fspr_thread_mutex_unlock(lock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_mutex_trylock(switch_mutex_t *lock)
     {
    -	return apr_thread_mutex_trylock(lock);
    +	return fspr_thread_mutex_trylock(lock);
     }
     
     /* time function stubs */
    @@ -318,38 +318,38 @@ SWITCH_DECLARE(switch_time_t) switch_time_now(void)
     	clock_gettime(CLOCK_REALTIME, &ts);
     	return ts.tv_sec * APR_USEC_PER_SEC + (ts.tv_nsec / 1000);
     #else
    -	return (switch_time_t) apr_time_now();
    +	return (switch_time_t) fspr_time_now();
     #endif
     }
     
     SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt_get(switch_time_t *result, switch_time_exp_t *input)
     {
    -	return apr_time_exp_gmt_get((apr_time_t *) result, (apr_time_exp_t *) input);
    +	return fspr_time_exp_gmt_get((fspr_time_t *) result, (fspr_time_exp_t *) input);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_time_exp_get(switch_time_t *result, switch_time_exp_t *input)
     {
    -	return apr_time_exp_get((apr_time_t *) result, (apr_time_exp_t *) input);
    +	return fspr_time_exp_get((fspr_time_t *) result, (fspr_time_exp_t *) input);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_time_exp_lt(switch_time_exp_t *result, switch_time_t input)
     {
    -	return apr_time_exp_lt((apr_time_exp_t *) result, input);
    +	return fspr_time_exp_lt((fspr_time_exp_t *) result, input);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_time_exp_tz(switch_time_exp_t *result, switch_time_t input, switch_int32_t offs)
     {
    -	return apr_time_exp_tz((apr_time_exp_t *) result, input, (apr_int32_t) offs);
    +	return fspr_time_exp_tz((fspr_time_exp_t *) result, input, (fspr_int32_t) offs);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_time_exp_gmt(switch_time_exp_t *result, switch_time_t input)
     {
    -	return apr_time_exp_gmt((apr_time_exp_t *) result, input);
    +	return fspr_time_exp_gmt((fspr_time_exp_t *) result, input);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_rfc822_date(char *date_str, switch_time_t t)
     {
    -	return apr_rfc822_date(date_str, t);
    +	return fspr_rfc822_date(date_str, t);
     }
     
     SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec)
    @@ -361,17 +361,17 @@ SWITCH_DECLARE(switch_time_t) switch_time_make(switch_time_t sec, int32_t usec)
     
     SWITCH_DECLARE(switch_status_t) switch_thread_cond_create(switch_thread_cond_t ** cond, switch_memory_pool_t *pool)
     {
    -	return apr_thread_cond_create(cond, pool);
    +	return fspr_thread_cond_create(cond, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_cond_wait(switch_thread_cond_t *cond, switch_mutex_t *mutex)
     {
    -	return apr_thread_cond_wait(cond, mutex);
    +	return fspr_thread_cond_wait(cond, mutex);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_t *cond, switch_mutex_t *mutex, switch_interval_time_t timeout)
     {
    -	apr_status_t st = apr_thread_cond_timedwait(cond, mutex, timeout);
    +	fspr_status_t st = fspr_thread_cond_timedwait(cond, mutex, timeout);
     
     	if (st == APR_TIMEUP) {
     		st = SWITCH_STATUS_TIMEOUT;
    @@ -382,17 +382,17 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_timedwait(switch_thread_cond_
     
     SWITCH_DECLARE(switch_status_t) switch_thread_cond_signal(switch_thread_cond_t *cond)
     {
    -	return apr_thread_cond_signal(cond);
    +	return fspr_thread_cond_signal(cond);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_cond_broadcast(switch_thread_cond_t *cond)
     {
    -	return apr_thread_cond_broadcast(cond);
    +	return fspr_thread_cond_broadcast(cond);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t *cond)
     {
    -	return apr_thread_cond_destroy(cond);
    +	return fspr_thread_cond_destroy(cond);
     }
     
     /* file i/o stubs */
    @@ -400,57 +400,57 @@ SWITCH_DECLARE(switch_status_t) switch_thread_cond_destroy(switch_thread_cond_t
     SWITCH_DECLARE(switch_status_t) switch_file_open(switch_file_t ** newf, const char *fname, int32_t flag, switch_fileperms_t perm,
     												 switch_memory_pool_t *pool)
     {
    -	return apr_file_open(newf, fname, flag, perm, pool);
    +	return fspr_file_open(newf, fname, flag, perm, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_seek_where_t where, int64_t *offset)
     {
    -	apr_status_t rv;
    -	apr_off_t off = (apr_off_t) (*offset);
    -	rv = apr_file_seek(thefile, where, &off);
    +	fspr_status_t rv;
    +	fspr_off_t off = (fspr_off_t) (*offset);
    +	rv = fspr_file_seek(thefile, where, &off);
     	*offset = (int64_t) off;
     	return rv;
     }
     
     SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, const char *to_path, switch_fileperms_t perms, switch_memory_pool_t *pool)
     {
    -	return apr_file_copy(from_path, to_path, perms, pool);
    +	return fspr_file_copy(from_path, to_path, perms, pool);
     }
     
     
     SWITCH_DECLARE(switch_status_t) switch_file_close(switch_file_t *thefile)
     {
    -	return apr_file_close(thefile);
    +	return fspr_file_close(thefile);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_file_trunc(switch_file_t *thefile, int64_t offset)
     {
    -	return apr_file_trunc(thefile, offset);
    +	return fspr_file_trunc(thefile, offset);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_file_lock(switch_file_t *thefile, int type)
     {
    -	return apr_file_lock(thefile, type);
    +	return fspr_file_lock(thefile, type);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_file_rename(const char *from_path, const char *to_path, switch_memory_pool_t *pool)
     {
    -	return apr_file_rename(from_path, to_path, pool);
    +	return fspr_file_rename(from_path, to_path, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_file_remove(const char *path, switch_memory_pool_t *pool)
     {
    -	return apr_file_remove(path, pool);
    +	return fspr_file_remove(path, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_file_read(switch_file_t *thefile, void *buf, switch_size_t *nbytes)
     {
    -	return apr_file_read(thefile, buf, nbytes);
    +	return fspr_file_read(thefile, buf, nbytes);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_file_write(switch_file_t *thefile, const void *buf, switch_size_t *nbytes)
     {
    -	return apr_file_write(thefile, buf, nbytes);
    +	return fspr_file_write(thefile, buf, nbytes);
     }
     
     SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *format, ...)
    @@ -474,18 +474,18 @@ SWITCH_DECLARE(int) switch_file_printf(switch_file_t *thefile, const char *forma
     
     SWITCH_DECLARE(switch_status_t) switch_file_mktemp(switch_file_t ** thefile, char *templ, int32_t flags, switch_memory_pool_t *pool)
     {
    -	return apr_file_mktemp(thefile, templ, flags, pool);
    +	return fspr_file_mktemp(thefile, templ, flags, pool);
     }
     
     SWITCH_DECLARE(switch_size_t) switch_file_get_size(switch_file_t *thefile)
     {
    -	struct apr_finfo_t finfo;
    -	return apr_file_info_get(&finfo, APR_FINFO_SIZE, thefile) == SWITCH_STATUS_SUCCESS ? (switch_size_t) finfo.size : 0;
    +	struct fspr_finfo_t finfo;
    +	return fspr_file_info_get(&finfo, APR_FINFO_SIZE, thefile) == SWITCH_STATUS_SUCCESS ? (switch_size_t) finfo.size : 0;
     }
     
     SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, switch_memory_pool_t *pool)
     {
    -	apr_dir_t *dir_handle;
    +	fspr_dir_t *dir_handle;
     	switch_memory_pool_t *our_pool = NULL;
     	switch_status_t status;
     
    @@ -494,8 +494,8 @@ SWITCH_DECLARE(switch_status_t) switch_directory_exists(const char *dirname, swi
     		pool = our_pool;
     	}
     
    -	if ((status = apr_dir_open(&dir_handle, dirname, pool)) == APR_SUCCESS) {
    -		apr_dir_close(dir_handle);
    +	if ((status = fspr_dir_open(&dir_handle, dirname, pool)) == APR_SUCCESS) {
    +		fspr_dir_close(dir_handle);
     	}
     
     	if (our_pool) {
    @@ -510,7 +510,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_
     	int32_t wanted = APR_FINFO_TYPE;
     	switch_memory_pool_t *our_pool = NULL;
     	switch_status_t status = SWITCH_STATUS_FALSE;
    -	apr_finfo_t info = { 0 };
    +	fspr_finfo_t info = { 0 };
     
     	if (zstr(filename)) {
     		return status;
    @@ -520,7 +520,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_
     		switch_core_new_memory_pool(&our_pool);
     	}
     
    -	apr_stat(&info, filename, wanted, pool ? pool : our_pool);
    +	fspr_stat(&info, filename, wanted, pool ? pool : our_pool);
     	if (info.filetype != APR_NOFILE) {
     		status = SWITCH_STATUS_SUCCESS;
     	}
    @@ -534,17 +534,17 @@ SWITCH_DECLARE(switch_status_t) switch_file_exists(const char *filename, switch_
     
     SWITCH_DECLARE(switch_status_t) switch_dir_make(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
     {
    -	return apr_dir_make(path, perm, pool);
    +	return fspr_dir_make(path, perm, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_dir_make_recursive(const char *path, switch_fileperms_t perm, switch_memory_pool_t *pool)
     {
    -	return apr_dir_make_recursive(path, perm, pool);
    +	return fspr_dir_make_recursive(path, perm, pool);
     }
     
     struct switch_dir {
    -	apr_dir_t *dir_handle;
    -	apr_finfo_t finfo;
    +	fspr_dir_t *dir_handle;
    +	fspr_finfo_t finfo;
     };
     
     SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const char *dirname, switch_memory_pool_t *pool)
    @@ -558,7 +558,7 @@ SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const c
     	}
     
     	memset(dir, 0, sizeof(*dir));
    -	if ((status = apr_dir_open(&(dir->dir_handle), dirname, pool)) == APR_SUCCESS) {
    +	if ((status = fspr_dir_open(&(dir->dir_handle), dirname, pool)) == APR_SUCCESS) {
     		*new_dir = dir;
     	} else {
     		free(dir);
    @@ -570,7 +570,7 @@ SWITCH_DECLARE(switch_status_t) switch_dir_open(switch_dir_t ** new_dir, const c
     
     SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir)
     {
    -	switch_status_t status = apr_dir_close(thedir->dir_handle);
    +	switch_status_t status = fspr_dir_close(thedir->dir_handle);
     
     	free(thedir);
     	return status;
    @@ -579,12 +579,12 @@ SWITCH_DECLARE(switch_status_t) switch_dir_close(switch_dir_t *thedir)
     SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir)
     {
     	const char *name;
    -	apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
    +	fspr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
     	uint32_t count = 0;
     
    -	apr_dir_rewind(thedir->dir_handle);
    +	fspr_dir_rewind(thedir->dir_handle);
     
    -	while (apr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
    +	while (fspr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
     
     		if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) {
     			continue;
    @@ -599,7 +599,7 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir)
     		}
     	}
     
    -	apr_dir_rewind(thedir->dir_handle);
    +	fspr_dir_rewind(thedir->dir_handle);
     
     	return count;
     }
    @@ -607,10 +607,10 @@ SWITCH_DECLARE(uint32_t) switch_dir_count(switch_dir_t *thedir)
     SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *buf, switch_size_t len)
     {
     	const char *fname = NULL;
    -	apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
    +	fspr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
     	const char *name;
     
    -	while (apr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
    +	while (fspr_dir_read(&(thedir->finfo), finfo_flags, thedir->dir_handle) == SWITCH_STATUS_SUCCESS) {
     
     		if (thedir->finfo.filetype != APR_REG && thedir->finfo.filetype != APR_LNK) {
     			continue;
    @@ -634,18 +634,18 @@ SWITCH_DECLARE(const char *) switch_dir_next_file(switch_dir_t *thedir, char *bu
     /* thread stubs */
     
     #ifndef WIN32
    -struct apr_threadattr_t {
    -	apr_pool_t *pool;
    +struct fspr_threadattr_t {
    +	fspr_pool_t *pool;
     	pthread_attr_t attr;
     	int priority;
     };
     #else
     /* this needs to be revisited when apr for windows supports thread priority settings */
     /* search for WIN32 in this file */
    -struct apr_threadattr_t {
    -	apr_pool_t *pool;
    -	apr_int32_t detach;
    -	apr_size_t stacksize;
    +struct fspr_threadattr_t {
    +	fspr_pool_t *pool;
    +	fspr_int32_t detach;
    +	fspr_size_t stacksize;
     	int priority;
     };
     #endif
    @@ -655,7 +655,7 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **
     {
     	switch_status_t status;
     
    -	if ((status = apr_threadattr_create(new_attr, pool)) == SWITCH_STATUS_SUCCESS) {
    +	if ((status = fspr_threadattr_create(new_attr, pool)) == SWITCH_STATUS_SUCCESS) {
     
     		(*new_attr)->priority = SWITCH_PRI_LOW;
     
    @@ -666,12 +666,12 @@ SWITCH_DECLARE(switch_status_t) switch_threadattr_create(switch_threadattr_t **
     
     SWITCH_DECLARE(switch_status_t) switch_threadattr_detach_set(switch_threadattr_t *attr, int32_t on)
     {
    -	return apr_threadattr_detach_set(attr, on);
    +	return fspr_threadattr_detach_set(attr, on);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_threadattr_stacksize_set(switch_threadattr_t *attr, switch_size_t stacksize)
     {
    -	return apr_threadattr_stacksize_set(attr, stacksize);
    +	return fspr_threadattr_stacksize_set(attr, stacksize);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_threadattr_priority_set(switch_threadattr_t *attr, switch_thread_priority_t priority)
    @@ -688,7 +688,7 @@ SWITCH_DECLARE(switch_status_t) switch_thread_create(switch_thread_t ** new_thre
     													 switch_thread_start_t func, void *data, switch_memory_pool_t *cont)
     {
     	switch_core_memory_pool_set_data(cont, "_in_thread", TT_KEY);
    -	return apr_thread_create(new_thread, attr, func, data, cont);
    +	return fspr_thread_create(new_thread, attr, func, data, cont);
     }
     
     SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct timeval *tvp)
    @@ -700,52 +700,52 @@ SWITCH_DECLARE(switch_interval_time_t) switch_interval_time_from_timeval(struct
     
     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);
    +	return fspr_os_sock_get(thesock, sock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_os_sock_put(switch_socket_t **sock, switch_os_socket_t *thesock, switch_memory_pool_t *pool)
     {
    -	return apr_os_sock_put(sock, thesock, pool);
    +	return fspr_os_sock_put(sock, thesock, pool);
     }
     
     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);
    +	return fspr_socket_addr_get(sa, (fspr_interface_e) remote, sock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_create(switch_socket_t ** new_sock, int family, int type, int protocol, switch_memory_pool_t *pool)
     {
    -	return apr_socket_create(new_sock, family, type, protocol, pool);
    +	return fspr_socket_create(new_sock, family, type, protocol, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_shutdown(switch_socket_t *sock, switch_shutdown_how_e how)
     {
    -	return apr_socket_shutdown(sock, (apr_shutdown_how_e) how);
    +	return fspr_socket_shutdown(sock, (fspr_shutdown_how_e) how);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_close(switch_socket_t *sock)
     {
    -	return apr_socket_close(sock);
    +	return fspr_socket_close(sock);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_bind(switch_socket_t *sock, switch_sockaddr_t *sa)
     {
    -	return apr_socket_bind(sock, sa);
    +	return fspr_socket_bind(sock, sa);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_listen(switch_socket_t *sock, int32_t backlog)
     {
    -	return apr_socket_listen(sock, backlog);
    +	return fspr_socket_listen(sock, backlog);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_accept(switch_socket_t ** new_sock, switch_socket_t *sock, switch_memory_pool_t *pool)
     {
    -	return apr_socket_accept(new_sock, sock, pool);
    +	return fspr_socket_accept(new_sock, sock, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_connect(switch_socket_t *sock, switch_sockaddr_t *sa)
     {
    -	return apr_socket_connect(sock, sa);
    +	return fspr_socket_connect(sock, sa);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const char *buf, switch_size_t *len)
    @@ -756,7 +756,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send(switch_socket_t *sock, const
     
     	while ((wrote < req && status == SWITCH_STATUS_SUCCESS) || (need == 0 && status == SWITCH_STATUS_BREAK) || status == 730035 || status == 35) {
     		need = req - wrote;
    -		status = apr_socket_send(sock, buf + wrote, &need);
    +		status = fspr_socket_send(sock, buf + wrote, &need);
     		if (status == SWITCH_STATUS_BREAK || status == 730035 || status == 35) {
     			if (++to_count > 60000) {
     				status = SWITCH_STATUS_FALSE;
    @@ -779,7 +779,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_send_nonblock(switch_socket_t *soc
     		return SWITCH_STATUS_GENERR;
     	}
     
    -	return apr_socket_send(sock, buf, len);
    +	return fspr_socket_send(sock, buf, len);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, switch_sockaddr_t *where, int32_t flags, const char *buf,
    @@ -788,14 +788,14 @@ SWITCH_DECLARE(switch_status_t) switch_socket_sendto(switch_socket_t *sock, swit
     	if (!where || !buf || !len || !*len) {
     		return SWITCH_STATUS_GENERR;
     	}
    -	return apr_socket_sendto(sock, where, flags, buf, len);
    +	return fspr_socket_sendto(sock, where, flags, buf, len);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_recv(switch_socket_t *sock, char *buf, switch_size_t *len)
     {
     	int r;
     
    -	r = apr_socket_recv(sock, buf, len);
    +	r = fspr_socket_recv(sock, buf, len);
     
     	if (r == 35 || r == 730035) {
     		r = SWITCH_STATUS_BREAK;
    @@ -809,7 +809,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, s
     	switch_sockaddr_t *new_sa;
     	unsigned short family = APR_INET;
     
    -	new_sa = apr_pcalloc(pool, sizeof(apr_sockaddr_t));
    +	new_sa = fspr_pcalloc(pool, sizeof(fspr_sockaddr_t));
     	switch_assert(new_sa);
     	new_sa->pool = pool;
     
    @@ -828,20 +828,20 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, s
     SWITCH_DECLARE(switch_status_t) switch_sockaddr_info_get(switch_sockaddr_t ** sa, const char *hostname, int32_t family,
     														 switch_port_t port, int32_t flags, switch_memory_pool_t *pool)
     {
    -	return apr_sockaddr_info_get(sa, hostname, family, port, flags, pool);
    +	return fspr_sockaddr_info_get(sa, hostname, family, port, flags, pool);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, const char *ip, switch_port_t port, switch_memory_pool_t *pool)
     {
     	switch_status_t status = SWITCH_STATUS_SUCCESS;
    -	apr_sockaddr_t *new_sa;
    +	fspr_sockaddr_t *new_sa;
     	int family;
     
     	if (!sa || !pool || !ip) {
     		switch_goto_status(SWITCH_STATUS_GENERR, end);
     	}
     
    -	new_sa = apr_pcalloc(pool, sizeof(apr_sockaddr_t));
    +	new_sa = fspr_pcalloc(pool, sizeof(fspr_sockaddr_t));
     	switch_assert(new_sa);
     
     	new_sa->pool = pool;
    @@ -863,7 +863,7 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, con
     		memcpy(&new_sa->sa, &sa4, sizeof(struct sockaddr_in));
     	}
     
    -	new_sa->hostname = apr_pstrdup(pool, ip);
    +	new_sa->hostname = fspr_pstrdup(pool, ip);
     	new_sa->family = family;
     	new_sa->sa.sin.sin_family = family;
     	if (port) {
    @@ -915,13 +915,13 @@ SWITCH_DECLARE(switch_status_t) switch_socket_opt_set(switch_socket_t *sock, int
     #endif
     	}
     
    -	return apr_socket_opt_set(sock, opt, on);
    +	return fspr_socket_opt_set(sock, opt, on);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_timeout_get(switch_socket_t *sock, switch_interval_time_t *t)
     {
    -	apr_interval_time_t at = 0;
    -	switch_status_t status = apr_socket_timeout_get(sock, &at);
    +	fspr_interval_time_t at = 0;
    +	switch_status_t status = fspr_socket_timeout_get(sock, &at);
     	*t = at;
     
     	return status;
    @@ -929,37 +929,37 @@ SWITCH_DECLARE(switch_status_t) switch_socket_timeout_get(switch_socket_t *sock,
     
     SWITCH_DECLARE(switch_status_t) switch_socket_timeout_set(switch_socket_t *sock, switch_interval_time_t t)
     {
    -	return apr_socket_timeout_set(sock, t);
    +	return fspr_socket_timeout_set(sock, t);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_sockaddr_ip_get(char **addr, switch_sockaddr_t *sa)
     {
    -	return apr_sockaddr_ip_get(addr, sa);
    +	return fspr_sockaddr_ip_get(addr, sa);
     }
     
     SWITCH_DECLARE(int) switch_sockaddr_equal(const switch_sockaddr_t *sa1, const switch_sockaddr_t *sa2)
     {
    -	return apr_sockaddr_equal(sa1, sa2);
    +	return fspr_sockaddr_equal(sa1, sa2);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_mcast_join(switch_socket_t *sock, switch_sockaddr_t *join, switch_sockaddr_t *iface, switch_sockaddr_t *source)
     {
    -	return apr_mcast_join(sock, join, iface, source);
    +	return fspr_mcast_join(sock, join, iface, source);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_mcast_hops(switch_socket_t *sock, uint8_t ttl)
     {
    -	return apr_mcast_hops(sock, ttl);
    +	return fspr_mcast_hops(sock, ttl);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_mcast_loopback(switch_socket_t *sock, uint8_t opt)
     {
    -	return apr_mcast_loopback(sock, opt);
    +	return fspr_mcast_loopback(sock, opt);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_mcast_interface(switch_socket_t *sock, switch_sockaddr_t *iface)
     {
    -	return apr_mcast_interface(sock, iface);
    +	return fspr_mcast_interface(sock, iface);
     }
     
     
    @@ -984,7 +984,7 @@ SWITCH_DECLARE(const char *) switch_get_addr(char *buf, switch_size_t len, switc
     
     SWITCH_DECLARE(int) switch_socket_fd_get(switch_socket_t *sock)
     {
    -	return apr_socket_fd_get(sock);
    +	return fspr_socket_fd_get(sock);
     }
     
     SWITCH_DECLARE(uint16_t) switch_sockaddr_get_port(switch_sockaddr_t *sa)
    @@ -999,19 +999,19 @@ SWITCH_DECLARE(int32_t) switch_sockaddr_get_family(switch_sockaddr_t *sa)
     
     SWITCH_DECLARE(switch_status_t) switch_getnameinfo(char **hostname, switch_sockaddr_t *sa, int32_t flags)
     {
    -	return apr_getnameinfo(hostname, sa, flags);
    +	return fspr_getnameinfo(hostname, sa, flags);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_atmark(switch_socket_t *sock, int *atmark)
     {
    -	return apr_socket_atmark(sock, atmark);
    +	return fspr_socket_atmark(sock, atmark);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from, switch_socket_t *sock, int32_t flags, char *buf, size_t *len)
     {
     	int r = SWITCH_STATUS_GENERR;
     
    -	if (from && sock && (r = apr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
    +	if (from && sock && (r = fspr_socket_recvfrom(from, sock, flags, buf, len)) == APR_SUCCESS) {
     		from->port = ntohs(from->sa.sin.sin_port);
     		/* from->ipaddr_ptr = &(from->sa.sin.sin_addr);
     		 * from->ipaddr_ptr = inet_ntoa(from->sa.sin.sin_addr);
    @@ -1029,7 +1029,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_recvfrom(switch_sockaddr_t *from,
     
     SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t ** pollset, uint32_t size, switch_memory_pool_t *pool, uint32_t flags)
     {
    -	return apr_pollset_create(pollset, size, pool, flags);
    +	return fspr_pollset_create(pollset, size, pool, flags);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
    @@ -1038,7 +1038,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, co
     		return SWITCH_STATUS_FALSE;
     	}
     
    -	return apr_pollset_add((apr_pollset_t *) pollset, (const apr_pollfd_t *) descriptor);
    +	return fspr_pollset_add((fspr_pollset_t *) pollset, (const fspr_pollfd_t *) descriptor);
     }
     
     SWITCH_DECLARE(switch_status_t) switch_pollset_remove(switch_pollset_t *pollset, const switch_pollfd_t *descriptor)
    @@ -1047,7 +1047,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_remove(switch_pollset_t *pollset,
     		return SWITCH_STATUS_FALSE;
     	}
     
    -	return apr_pollset_remove((apr_pollset_t *) pollset, (const apr_pollfd_t *) descriptor);
    +	return fspr_pollset_remove((fspr_pollset_t *) pollset, (const fspr_pollfd_t *) descriptor);
     }
     
     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)
    @@ -1056,7 +1056,7 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **po
     		return SWITCH_STATUS_FALSE;
     	}
     
    -	if ((*pollfd = (switch_pollfd_t*)apr_palloc(pool, sizeof(switch_pollfd_t))) == 0) {
    +	if ((*pollfd = (switch_pollfd_t*)fspr_palloc(pool, sizeof(switch_pollfd_t))) == 0) {
     		return SWITCH_STATUS_MEMERR;
     	}
     
    @@ -1073,10 +1073,10 @@ SWITCH_DECLARE(switch_status_t) switch_socket_create_pollfd(switch_pollfd_t **po
     
     SWITCH_DECLARE(switch_status_t) switch_pollset_poll(switch_pollset_t *pollset, switch_interval_time_t timeout, int32_t *num, const switch_pollfd_t **descriptors)
     {
    -	apr_status_t st = SWITCH_STATUS_FALSE;
    +	fspr_status_t st = SWITCH_STATUS_FALSE;
     
     	if (pollset) {
    -		st = apr_pollset_poll((apr_pollset_t *) pollset, timeout, num, (const apr_pollfd_t **) descriptors);
    +		st = fspr_pollset_poll((fspr_pollset_t *) pollset, timeout, num, (const fspr_pollfd_t **) descriptors);
     
     		if (st == APR_TIMEUP) {
     			st = SWITCH_STATUS_TIMEOUT;
    @@ -1088,10 +1088,10 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_poll(switch_pollset_t *pollset, s
     
     SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout)
     {
    -	apr_status_t st = SWITCH_STATUS_FALSE;
    +	fspr_status_t st = SWITCH_STATUS_FALSE;
     
     	if (aprset) {
    -		st = apr_poll((apr_pollfd_t *) aprset, numsock, nsds, timeout);
    +		st = fspr_poll((fspr_pollfd_t *) aprset, numsock, nsds, timeout);
     
     		if (numsock == 1 && ((aprset[0].rtnevents & APR_POLLERR) || (aprset[0].rtnevents & APR_POLLHUP) || (aprset[0].rtnevents & APR_POLLNVAL))) {
     			st = SWITCH_STATUS_GENERR;
    @@ -1228,7 +1228,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_pop_timeout(switch_queue_t *queue,
     
     SWITCH_DECLARE(switch_status_t) switch_queue_push(switch_queue_t *queue, void *data)
     {
    -	apr_status_t s;
    +	fspr_status_t s;
     
     	do {
     		s = switch_apr_queue_push(queue, data);
    @@ -1254,7 +1254,7 @@ SWITCH_DECLARE(switch_status_t) switch_queue_term(switch_queue_t *queue)
     
     SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void *data)
     {
    -	apr_status_t s;
    +	fspr_status_t s;
     
     	do {
     		s = switch_apr_queue_trypush(queue, data);
    @@ -1301,7 +1301,7 @@ SWITCH_DECLARE(int) switch_vasprintf(char **ret, const char *fmt, va_list ap)
     
     SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_array_header_t ** result, switch_memory_pool_t *pool)
     {
    -	return apr_match_glob(pattern, (apr_array_header_t **) result, pool);
    +	return fspr_match_glob(pattern, (fspr_array_header_t **) result, pool);
     }
     
     /**
    @@ -1312,7 +1312,7 @@ SWITCH_DECLARE(switch_status_t) switch_match_glob(const char *pattern, switch_ar
      */
     SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, switch_file_t ** out, switch_memory_pool_t *pool)
     {
    -	return apr_file_pipe_create((apr_file_t **) in, (apr_file_t **) out, pool);
    +	return fspr_file_pipe_create((fspr_file_t **) in, (fspr_file_t **) out, pool);
     }
     
     /**
    @@ -1322,7 +1322,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_create(switch_file_t ** in, swi
      */
     SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thepipe, switch_interval_time_t *timeout)
     {
    -	return apr_file_pipe_timeout_get((apr_file_t *) thepipe, (apr_interval_time_t *) timeout);
    +	return fspr_file_pipe_timeout_get((fspr_file_t *) thepipe, (fspr_interval_time_t *) timeout);
     }
     
     /**
    @@ -1333,7 +1333,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_get(switch_file_t *thep
      */
     SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thepipe, switch_interval_time_t timeout)
     {
    -	return apr_file_pipe_timeout_set((apr_file_t *) thepipe, (apr_interval_time_t) timeout);
    +	return fspr_file_pipe_timeout_set((fspr_file_t *) thepipe, (fspr_interval_time_t) timeout);
     }
     
     
    @@ -1344,7 +1344,7 @@ SWITCH_DECLARE(switch_status_t) switch_file_pipe_timeout_set(switch_file_t *thep
      */
     SWITCH_DECLARE(switch_status_t) switch_thread_exit(switch_thread_t *thd, switch_status_t retval)
     {
    -	return apr_thread_exit((apr_thread_t *) thd, retval);
    +	return fspr_thread_exit((fspr_thread_t *) thd, retval);
     }
     
     /**
    @@ -1359,63 +1359,63 @@ SWITCH_DECLARE(switch_status_t) switch_thread_join(switch_status_t *retval, swit
     		return SWITCH_STATUS_FALSE;
     	}
     
    -	return apr_thread_join((apr_status_t *) retval, (apr_thread_t *) thd);
    +	return fspr_thread_join((fspr_status_t *) retval, (fspr_thread_t *) thd);
     }
     
     
     SWITCH_DECLARE(switch_status_t) switch_atomic_init(switch_memory_pool_t *pool)
     {
    -	return apr_atomic_init((apr_pool_t *) pool);
    +	return fspr_atomic_init((fspr_pool_t *) pool);
     }
     
     SWITCH_DECLARE(uint32_t) switch_atomic_read(volatile switch_atomic_t *mem)
     {
    -#ifdef apr_atomic_t
    -	return apr_atomic_read((apr_atomic_t *)mem);
    +#ifdef fspr_atomic_t
    +	return fspr_atomic_read((fspr_atomic_t *)mem);
     #else
    -	return apr_atomic_read32((apr_uint32_t *)mem);
    +	return fspr_atomic_read32((fspr_uint32_t *)mem);
     #endif
     }
     
     SWITCH_DECLARE(void) switch_atomic_set(volatile switch_atomic_t *mem, uint32_t val)
     {
    -#ifdef apr_atomic_t
    -	apr_atomic_set((apr_atomic_t *)mem, val);
    +#ifdef fspr_atomic_t
    +	fspr_atomic_set((fspr_atomic_t *)mem, val);
     #else
    -	apr_atomic_set32((apr_uint32_t *)mem, val);
    +	fspr_atomic_set32((fspr_uint32_t *)mem, val);
     #endif
     }
     
     SWITCH_DECLARE(void) switch_atomic_add(volatile switch_atomic_t *mem, uint32_t val)
     {
    -#ifdef apr_atomic_t
    -	apr_atomic_add((apr_atomic_t *)mem, val);
    +#ifdef fspr_atomic_t
    +	fspr_atomic_add((fspr_atomic_t *)mem, val);
     #else
    -	apr_atomic_add32((apr_uint32_t *)mem, val);
    +	fspr_atomic_add32((fspr_uint32_t *)mem, val);
     #endif
     }
     
     SWITCH_DECLARE(void) switch_atomic_inc(volatile switch_atomic_t *mem)
     {
    -#ifdef apr_atomic_t
    -	apr_atomic_inc((apr_atomic_t *)mem);
    +#ifdef fspr_atomic_t
    +	fspr_atomic_inc((fspr_atomic_t *)mem);
     #else
    -	apr_atomic_inc32((apr_uint32_t *)mem);
    +	fspr_atomic_inc32((fspr_uint32_t *)mem);
     #endif
     }
     
     SWITCH_DECLARE(int) switch_atomic_dec(volatile switch_atomic_t *mem)
     {
    -#ifdef apr_atomic_t
    -	return apr_atomic_dec((apr_atomic_t *)mem);
    +#ifdef fspr_atomic_t
    +	return fspr_atomic_dec((fspr_atomic_t *)mem);
     #else
    -	return apr_atomic_dec32((apr_uint32_t *)mem);
    +	return fspr_atomic_dec32((fspr_uint32_t *)mem);
     #endif
     }
     
     SWITCH_DECLARE(char *) switch_strerror(switch_status_t statcode, char *buf, switch_size_t bufsize)
     {
    -	return apr_strerror(statcode, buf, bufsize);
    +	return fspr_strerror(statcode, buf, bufsize);
     }
     
     /* For Emacs:
    diff --git a/src/switch_apr_queue.c b/src/switch_apr_queue.c
    index 289bbdf0cc..7d3e91b440 100644
    --- a/src/switch_apr_queue.c
    +++ b/src/switch_apr_queue.c
    @@ -14,10 +14,9 @@
      * limitations under the License.
      */
     
    -#include 
    -#include 
    -#include 
    -#include 
    +#include 
    +#include 
    +#include 
     
     /* 
      * define this to get debug messages
    @@ -33,9 +32,9 @@ struct switch_apr_queue_t {
         unsigned int        bounds;/**< max size of queue */
         unsigned int        full_waiters;
         unsigned int        empty_waiters;
    -    apr_thread_mutex_t *one_big_mutex;
    -    apr_thread_cond_t  *not_empty;
    -    apr_thread_cond_t  *not_full;
    +    fspr_thread_mutex_t *one_big_mutex;
    +    fspr_thread_cond_t  *not_empty;
    +    fspr_thread_cond_t  *not_full;
         int                 terminated;
     };
     
    @@ -69,15 +68,15 @@ static void Q_DBG(char*msg, switch_apr_queue_t *q) {
      * Callback routine that is called to destroy this
      * switch_apr_queue_t when its pool is destroyed.
      */
    -static apr_status_t queue_destroy(void *data) 
    +static fspr_status_t queue_destroy(void *data) 
     {
         switch_apr_queue_t *queue = data;
     
         /* Ignore errors here, we can't do anything about them anyway. */
     
    -    apr_thread_cond_destroy(queue->not_empty);
    -    apr_thread_cond_destroy(queue->not_full);
    -    apr_thread_mutex_destroy(queue->one_big_mutex);
    +    fspr_thread_cond_destroy(queue->not_empty);
    +    fspr_thread_cond_destroy(queue->not_full);
    +    fspr_thread_mutex_destroy(queue->one_big_mutex);
     
         return APR_SUCCESS;
     }
    @@ -85,33 +84,33 @@ static apr_status_t queue_destroy(void *data)
     /**
      * Initialize the switch_apr_queue_t.
      */
    -apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, apr_pool_t *a)
    +fspr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_capacity, fspr_pool_t *a)
     {
    -    apr_status_t rv;
    +    fspr_status_t rv;
         switch_apr_queue_t *queue;
    -    queue = apr_palloc(a, sizeof(switch_apr_queue_t));
    +    queue = fspr_palloc(a, sizeof(switch_apr_queue_t));
         *q = queue;
     
         /* nested doesn't work ;( */
    -    rv = apr_thread_mutex_create(&queue->one_big_mutex,
    +    rv = fspr_thread_mutex_create(&queue->one_big_mutex,
                                      APR_THREAD_MUTEX_UNNESTED,
                                      a);
         if (rv != APR_SUCCESS) {
             return rv;
         }
     
    -    rv = apr_thread_cond_create(&queue->not_empty, a);
    +    rv = fspr_thread_cond_create(&queue->not_empty, a);
         if (rv != APR_SUCCESS) {
             return rv;
         }
     
    -    rv = apr_thread_cond_create(&queue->not_full, a);
    +    rv = fspr_thread_cond_create(&queue->not_full, a);
         if (rv != APR_SUCCESS) {
             return rv;
         }
     
         /* Set all the data in the queue to NULL */
    -    queue->data = apr_palloc(a, queue_capacity * sizeof(void*));
    +    queue->data = fspr_palloc(a, queue_capacity * sizeof(void*));
     	if (!queue->data) return APR_ENOMEM;
     	memset(queue->data, 0, queue_capacity * sizeof(void*));
         queue->bounds = queue_capacity;
    @@ -122,7 +121,7 @@ apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_
         queue->full_waiters = 0;
         queue->empty_waiters = 0;
     
    -    apr_pool_cleanup_register(a, queue, queue_destroy, apr_pool_cleanup_null);
    +    fspr_pool_cleanup_register(a, queue, queue_destroy, fspr_pool_cleanup_null);
     
         return APR_SUCCESS;
     }
    @@ -132,15 +131,15 @@ apr_status_t switch_apr_queue_create(switch_apr_queue_t **q, unsigned int queue_
      * the push operation has completed, it signals other threads waiting
      * in apr_queue_pop() that they may continue consuming sockets.
      */
    -apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
    +fspr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
     {
    -    apr_status_t rv;
    +    fspr_status_t rv;
     
         if (queue->terminated) {
             return APR_EOF; /* no more elements ever again */
         }
     
    -    rv = apr_thread_mutex_lock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_lock(queue->one_big_mutex);
         if (rv != APR_SUCCESS) {
             return rv;
         }
    @@ -148,17 +147,17 @@ apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
         if (apr_queue_full(queue)) {
             if (!queue->terminated) {
                 queue->full_waiters++;
    -            rv = apr_thread_cond_wait(queue->not_full, queue->one_big_mutex);
    +            rv = fspr_thread_cond_wait(queue->not_full, queue->one_big_mutex);
                 queue->full_waiters--;
                 if (rv != APR_SUCCESS) {
    -                apr_thread_mutex_unlock(queue->one_big_mutex);
    +                fspr_thread_mutex_unlock(queue->one_big_mutex);
                     return rv;
                 }
             }
             /* If we wake up and it's still empty, then we were interrupted */
             if (apr_queue_full(queue)) {
                 Q_DBG("queue full (intr)", queue);
    -            rv = apr_thread_mutex_unlock(queue->one_big_mutex);
    +            rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
                 if (rv != APR_SUCCESS) {
                     return rv;
                 }
    @@ -177,14 +176,14 @@ apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
     
         if (queue->empty_waiters) {
             Q_DBG("sig !empty", queue);
    -        rv = apr_thread_cond_signal(queue->not_empty);
    +        rv = fspr_thread_cond_signal(queue->not_empty);
             if (rv != APR_SUCCESS) {
    -            apr_thread_mutex_unlock(queue->one_big_mutex);
    +            fspr_thread_mutex_unlock(queue->one_big_mutex);
                 return rv;
             }
         }
     
    -    rv = apr_thread_mutex_unlock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
         return rv;
     }
     
    @@ -193,21 +192,21 @@ apr_status_t switch_apr_queue_push(switch_apr_queue_t *queue, void *data)
      * the push operation has completed, it signals other threads waiting
      * in apr_queue_pop() that they may continue consuming sockets.
      */
    -apr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data)
    +fspr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data)
     {
    -    apr_status_t rv;
    +    fspr_status_t rv;
     
         if (queue->terminated) {
             return APR_EOF; /* no more elements ever again */
         }
     
    -    rv = apr_thread_mutex_lock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_lock(queue->one_big_mutex);
         if (rv != APR_SUCCESS) {
             return rv;
         }
     
         if (apr_queue_full(queue)) {
    -        apr_thread_mutex_unlock(queue->one_big_mutex);
    +        fspr_thread_mutex_unlock(queue->one_big_mutex);
             return APR_EAGAIN;
         }
         
    @@ -217,14 +216,14 @@ apr_status_t switch_apr_queue_trypush(switch_apr_queue_t *queue, void *data)
     
         if (queue->empty_waiters) {
             Q_DBG("sig !empty", queue);
    -        rv  = apr_thread_cond_signal(queue->not_empty);
    +        rv  = fspr_thread_cond_signal(queue->not_empty);
             if (rv != APR_SUCCESS) {
    -            apr_thread_mutex_unlock(queue->one_big_mutex);
    +            fspr_thread_mutex_unlock(queue->one_big_mutex);
                 return rv;
             }
         }
     
    -    rv = apr_thread_mutex_unlock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
         return rv;
     }
     
    @@ -241,15 +240,15 @@ unsigned int switch_apr_queue_size(switch_apr_queue_t *queue) {
      * Once retrieved, the item is placed into the address specified by
      * 'data'.
      */
    -apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
    +fspr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
     {
    -    apr_status_t rv;
    +    fspr_status_t rv;
     
         if (queue->terminated) {
             return APR_EOF; /* no more elements ever again */
         }
     
    -    rv = apr_thread_mutex_lock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_lock(queue->one_big_mutex);
         if (rv != APR_SUCCESS) {
             return rv;
         }
    @@ -258,17 +257,17 @@ apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
         if (apr_queue_empty(queue)) {
             if (!queue->terminated) {
                 queue->empty_waiters++;
    -            rv = apr_thread_cond_wait(queue->not_empty, queue->one_big_mutex);
    +            rv = fspr_thread_cond_wait(queue->not_empty, queue->one_big_mutex);
                 queue->empty_waiters--;
                 if (rv != APR_SUCCESS) {
    -                apr_thread_mutex_unlock(queue->one_big_mutex);
    +                fspr_thread_mutex_unlock(queue->one_big_mutex);
                     return rv;
                 }
             }
             /* If we wake up and it's still empty, then we were interrupted */
             if (apr_queue_empty(queue)) {
                 Q_DBG("queue empty (intr)", queue);
    -            rv = apr_thread_mutex_unlock(queue->one_big_mutex);
    +            rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
                 if (rv != APR_SUCCESS) {
                     return rv;
                 }
    @@ -287,14 +286,14 @@ apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
         queue->out = (queue->out + 1) % queue->bounds;
         if (queue->full_waiters) {
             Q_DBG("signal !full", queue);
    -        rv = apr_thread_cond_signal(queue->not_full);
    +        rv = fspr_thread_cond_signal(queue->not_full);
             if (rv != APR_SUCCESS) {
    -            apr_thread_mutex_unlock(queue->one_big_mutex);
    +            fspr_thread_mutex_unlock(queue->one_big_mutex);
                 return rv;
             }
         }
     
    -    rv = apr_thread_mutex_unlock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
         return rv;
     }
     
    @@ -304,15 +303,15 @@ apr_status_t switch_apr_queue_pop(switch_apr_queue_t *queue, void **data)
      * until timeout is elapsed. Once retrieved, the item is placed into
      * the address specified by'data'.
      */
    -apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, apr_interval_time_t timeout)
    +fspr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data, fspr_interval_time_t timeout)
     {
    -    apr_status_t rv;
    +    fspr_status_t rv;
     
         if (queue->terminated) {
             return APR_EOF; /* no more elements ever again */
         }
     
    -    rv = apr_thread_mutex_lock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_lock(queue->one_big_mutex);
         if (rv != APR_SUCCESS) {
             return rv;
         }
    @@ -321,18 +320,18 @@ apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data
         if (apr_queue_empty(queue)) {
             if (!queue->terminated) {
                 queue->empty_waiters++;
    -            rv = apr_thread_cond_timedwait(queue->not_empty, queue->one_big_mutex, timeout);
    +            rv = fspr_thread_cond_timedwait(queue->not_empty, queue->one_big_mutex, timeout);
                 queue->empty_waiters--;
     			/* In the event of a timemout, APR_TIMEUP will be returned */
                 if (rv != APR_SUCCESS) {
    -                apr_thread_mutex_unlock(queue->one_big_mutex);
    +                fspr_thread_mutex_unlock(queue->one_big_mutex);
                     return rv;
                 }
             }
             /* If we wake up and it's still empty, then we were interrupted */
             if (apr_queue_empty(queue)) {
                 Q_DBG("queue empty (intr)", queue);
    -            rv = apr_thread_mutex_unlock(queue->one_big_mutex);
    +            rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
                 if (rv != APR_SUCCESS) {
                     return rv;
                 }
    @@ -351,14 +350,14 @@ apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data
         queue->out = (queue->out + 1) % queue->bounds;
         if (queue->full_waiters) {
             Q_DBG("signal !full", queue);
    -        rv = apr_thread_cond_signal(queue->not_full);
    +        rv = fspr_thread_cond_signal(queue->not_full);
             if (rv != APR_SUCCESS) {
    -            apr_thread_mutex_unlock(queue->one_big_mutex);
    +            fspr_thread_mutex_unlock(queue->one_big_mutex);
                 return rv;
             }
         }
     
    -    rv = apr_thread_mutex_unlock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
         return rv;
     }
     
    @@ -368,21 +367,21 @@ apr_status_t switch_apr_queue_pop_timeout(switch_apr_queue_t *queue, void **data
      * items available, return APR_EAGAIN.  Once retrieved,
      * the item is placed into the address specified by 'data'.
      */
    -apr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data)
    +fspr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data)
     {
    -    apr_status_t rv;
    +    fspr_status_t rv;
     
         if (queue->terminated) {
             return APR_EOF; /* no more elements ever again */
         }
     
    -    rv = apr_thread_mutex_lock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_lock(queue->one_big_mutex);
         if (rv != APR_SUCCESS) {
             return rv;
         }
     
         if (apr_queue_empty(queue)) {
    -        apr_thread_mutex_unlock(queue->one_big_mutex);
    +        fspr_thread_mutex_unlock(queue->one_big_mutex);
             return APR_EAGAIN;
         } 
     
    @@ -392,39 +391,39 @@ apr_status_t switch_apr_queue_trypop(switch_apr_queue_t *queue, void **data)
         queue->out = (queue->out + 1) % queue->bounds;
         if (queue->full_waiters) {
             Q_DBG("signal !full", queue);
    -        rv = apr_thread_cond_signal(queue->not_full);
    +        rv = fspr_thread_cond_signal(queue->not_full);
             if (rv != APR_SUCCESS) {
    -            apr_thread_mutex_unlock(queue->one_big_mutex);
    +            fspr_thread_mutex_unlock(queue->one_big_mutex);
                 return rv;
             }
         }
     
    -    rv = apr_thread_mutex_unlock(queue->one_big_mutex);
    +    rv = fspr_thread_mutex_unlock(queue->one_big_mutex);
         return rv;
     }
     
    -apr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue)
    +fspr_status_t switch_apr_queue_interrupt_all(switch_apr_queue_t *queue)
     {
    -    apr_status_t rv;
    +    fspr_status_t rv;
         Q_DBG("intr all", queue);    
    -    if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
    +    if ((rv = fspr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
             return rv;
         }
    -    apr_thread_cond_broadcast(queue->not_empty);
    -    apr_thread_cond_broadcast(queue->not_full);
    +    fspr_thread_cond_broadcast(queue->not_empty);
    +    fspr_thread_cond_broadcast(queue->not_full);
     
    -    if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
    +    if ((rv = fspr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
             return rv;
         }
     
         return APR_SUCCESS;
     }
     
    -apr_status_t switch_apr_queue_term(switch_apr_queue_t *queue)
    +fspr_status_t switch_apr_queue_term(switch_apr_queue_t *queue)
     {
    -    apr_status_t rv;
    +    fspr_status_t rv;
     
    -    if ((rv = apr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
    +    if ((rv = fspr_thread_mutex_lock(queue->one_big_mutex)) != APR_SUCCESS) {
             return rv;
         }
     
    @@ -433,7 +432,7 @@ apr_status_t switch_apr_queue_term(switch_apr_queue_t *queue)
          * would-be popper checks it but right before they block
          */
         queue->terminated = 1;
    -    if ((rv = apr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
    +    if ((rv = fspr_thread_mutex_unlock(queue->one_big_mutex)) != APR_SUCCESS) {
             return rv;
         }
         return switch_apr_queue_interrupt_all(queue);
    diff --git a/src/switch_core.c b/src/switch_core.c
    index b1be132018..0fafbfe522 100644
    --- a/src/switch_core.c
    +++ b/src/switch_core.c
    @@ -1908,7 +1908,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
     	}
     
     	/* INIT APR and Create the pool context */
    -	if (apr_initialize() != SWITCH_STATUS_SUCCESS) {
    +	if (fspr_initialize() != SWITCH_STATUS_SUCCESS) {
     		*err = "FATAL ERROR! Could not initialize APR\n";
     		return SWITCH_STATUS_MEMERR;
     	}
    @@ -2003,7 +2003,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_init(switch_core_flag_t flags, switc
     	if (switch_xml_init(runtime.memory_pool, err) != SWITCH_STATUS_SUCCESS) {
     		/* allow missing configuration if MINIMAL */
     		if (!(flags & SCF_MINIMAL)) {
    -			apr_terminate();
    +			fspr_terminate();
     			return SWITCH_STATUS_MEMERR;
     		}
     	}
    @@ -3160,8 +3160,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_destroy(void)
     	switch_core_media_deinit();
     
     	if (runtime.memory_pool) {
    -		apr_pool_destroy(runtime.memory_pool);
    -		apr_terminate();
    +		fspr_pool_destroy(runtime.memory_pool);
    +		fspr_terminate();
     	}
     
     	sqlite3_shutdown();
    diff --git a/src/switch_core_memory.c b/src/switch_core_memory.c
    index f005a9245e..7d3f4adbd7 100644
    --- a/src/switch_core_memory.c
    +++ b/src/switch_core_memory.c
    @@ -86,13 +86,13 @@ SWITCH_DECLARE(void *) switch_core_perform_session_alloc(switch_core_session_t *
     #ifdef DEBUG_ALLOC
     	if (memory > DEBUG_ALLOC_CUTOFF)
     		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Session Allocate %s %d\n",
    -						  (void *) session->pool, (void *) session, apr_pool_tag(session->pool, NULL), (int) memory);
    +						  (void *) session->pool, (void *) session, fspr_pool_tag(session->pool, NULL), (int) memory);
     #endif
     
     #if APR_POOL_DEBUG
    -	ptr = apr_palloc_debug(session->pool, memory, func);
    +	ptr = fspr_palloc_debug(session->pool, memory, func);
     #else
    -	ptr = apr_palloc(session->pool, memory);
    +	ptr = fspr_palloc(session->pool, memory);
     #endif
     	switch_assert(ptr != NULL);
     
    @@ -123,10 +123,10 @@ SWITCH_DECLARE(void *) switch_core_perform_permanent_alloc(switch_size_t memory,
     
     #ifdef DEBUG_ALLOC
     	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n",
    -					  (void *)memory_manager.memory_pool, apr_pool_tag(memory_manager.memory_pool, NULL), (int) memory);
    +					  (void *)memory_manager.memory_pool, fspr_pool_tag(memory_manager.memory_pool, NULL), (int) memory);
     #endif
     
    -	ptr = apr_palloc(memory_manager.memory_pool, memory);
    +	ptr = fspr_palloc(memory_manager.memory_pool, memory);
     
     	switch_assert(ptr != NULL);
     	memset(ptr, 0, memory);
    @@ -160,12 +160,12 @@ SWITCH_DECLARE(char *) switch_core_perform_permanent_strdup(const char *todup, c
     #endif
     
     	len = strlen(todup) + 1;
    -	duped = apr_pstrmemdup(memory_manager.memory_pool, todup, len);
    +	duped = fspr_pstrmemdup(memory_manager.memory_pool, todup, len);
     	switch_assert(duped != NULL);
     
     #ifdef DEBUG_ALLOC
     	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Perm Allocate %s %d\n",
    -					  (void *) memory_manager.memory_pool, apr_pool_tag(memory_manager.memory_pool, NULL), (int) len);
    +					  (void *) memory_manager.memory_pool, fspr_pool_tag(memory_manager.memory_pool, NULL), (int) len);
     #endif
     
     #ifdef LOCK_MORE
    @@ -206,7 +206,7 @@ SWITCH_DECLARE(char *) switch_core_vsprintf(switch_memory_pool_t *pool, const ch
     #endif
     #endif
     
    -	result = apr_pvsprintf(pool, fmt, ap);
    +	result = fspr_pvsprintf(pool, fmt, ap);
     	switch_assert(result != NULL);
     
     #ifdef LOCK_MORE
    @@ -258,10 +258,10 @@ SWITCH_DECLARE(char *) switch_core_perform_session_strdup(switch_core_session_t
     	len = strlen(todup);
     	if (len > DEBUG_ALLOC_CUTOFF)
     		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p %p Sess Strdup Allocate %s %ld\n",
    -						  (void *) session->pool, (void *)session, apr_pool_tag(session->pool, NULL), strlen(todup));
    +						  (void *) session->pool, (void *)session, fspr_pool_tag(session->pool, NULL), strlen(todup));
     #endif
     
    -	duped = apr_pstrdup(session->pool, todup);
    +	duped = fspr_pstrdup(session->pool, todup);
     	switch_assert(duped != NULL);
     
     #ifdef LOCK_MORE
    @@ -299,10 +299,10 @@ SWITCH_DECLARE(char *) switch_core_perform_strndup(switch_memory_pool_t *pool, c
     #ifdef DEBUG_ALLOC
     	if (len > DEBUG_ALLOC_CUTOFF)
     		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Strdup Allocate %s %d\n",
    -						  (void *) pool, apr_pool_tag(pool, NULL), (int)len);
    +						  (void *) pool, fspr_pool_tag(pool, NULL), (int)len);
     #endif
     
    -	duped = apr_pstrmemdup(pool, todup, len);
    +	duped = fspr_pstrmemdup(pool, todup, len);
     	switch_assert(duped != NULL);
     
     #ifdef LOCK_MORE
    @@ -316,58 +316,58 @@ SWITCH_DECLARE(char *) switch_core_perform_strndup(switch_memory_pool_t *pool, c
     
     SWITCH_DECLARE(void) switch_core_memory_pool_set_data(switch_memory_pool_t *pool, const char *key, void *data)
     {
    -	apr_pool_userdata_set(data, key, NULL, pool);
    +	fspr_pool_userdata_set(data, key, NULL, pool);
     }
     
     SWITCH_DECLARE(void *) switch_core_memory_pool_get_data(switch_memory_pool_t *pool, const char *key)
     {
     	void *data = NULL;
     
    -	apr_pool_userdata_get(&data, key, pool);
    +	fspr_pool_userdata_get(&data, key, pool);
     
     	return data;
     }
     
     SWITCH_DECLARE(void) switch_core_memory_pool_tag(switch_memory_pool_t *pool, const char *tag)
     {
    -	apr_pool_tag(pool, tag);
    +	fspr_pool_tag(pool, tag);
     }
     
     SWITCH_DECLARE(void) switch_pool_clear(switch_memory_pool_t *p)
     {
     #ifdef PER_POOL_LOCK
    -	apr_thread_mutex_t *my_mutex;
    -	apr_pool_mutex_set(p, NULL);
    +	fspr_thread_mutex_t *my_mutex;
    +	fspr_pool_mutex_set(p, NULL);
     #endif
     
    -	apr_pool_clear(p);
    +	fspr_pool_clear(p);
     
     #ifdef PER_POOL_LOCK
     
    -	if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, p)) != APR_SUCCESS) {
    +	if ((fspr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, p)) != APR_SUCCESS) {
     		abort();
     	}
     
    -	apr_pool_mutex_set(p, my_mutex);
    +	fspr_pool_mutex_set(p, my_mutex);
     
     #endif
     
     }
     
     #if APR_POOL_DEBUG
    -static int switch_core_pool_stats_callback(apr_pool_t *pool, void *data) {
    +static int switch_core_pool_stats_callback(fspr_pool_t *pool, void *data) {
     	switch_stream_handle_t *stream = (switch_stream_handle_t *)data;
    -	size_t size = (size_t)apr_pool_num_bytes(pool, 1);
    +	size_t size = (size_t)fspr_pool_num_bytes(pool, 1);
     	unsigned int alloc = 0, total_alloc = 0, clear = 0;
     	char *line = NULL;
     
    -	apr_pool_userdata_get((void**)&line, "line", pool);
    -	apr_pool_get_stats(pool, &alloc, &total_alloc, &clear);
    +	fspr_pool_userdata_get((void**)&line, "line", pool);
    +	fspr_pool_get_stats(pool, &alloc, &total_alloc, &clear);
     
     	if (stream) {
    -		stream->write_function(stream, "Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear);
    +		stream->write_function(stream, "Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : fspr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear);
     	} else {
    -		printf("Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : apr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear);
    +		printf("Pool '%s' size: %" SWITCH_SIZE_T_FMT ", alloc:%d, total_alloc:%d, clear:%d\n", (line ? line : fspr_pool_tag(pool, NULL)), size, alloc, total_alloc, clear);
     	}
     	return 0;
     }
    @@ -377,7 +377,7 @@ SWITCH_DECLARE(void) switch_core_pool_stats(switch_stream_handle_t *stream)
     {
     #if APR_POOL_DEBUG
     	if (runtime.memory_pool) {
    -		apr_pool_walk_tree_debug(runtime.memory_pool, switch_core_pool_stats_callback, (void *)stream);
    +		fspr_pool_walk_tree_debug(runtime.memory_pool, switch_core_pool_stats_callback, (void *)stream);
     	}
     #else
     	if (stream) {
    @@ -392,13 +392,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
     {
     	char *tmp;
     #ifdef INSTANTLY_DESTROY_POOLS
    -	apr_pool_create(pool, NULL);
    +	fspr_pool_create(pool, NULL);
     	switch_assert(*pool != NULL);
     #else
     
     #ifdef PER_POOL_LOCK
    -	apr_allocator_t *my_allocator = NULL;
    -	apr_thread_mutex_t *my_mutex;
    +	fspr_allocator_t *my_allocator = NULL;
    +	fspr_thread_mutex_t *my_mutex;
     #else
     	void *pop = NULL;
     #endif
    @@ -415,43 +415,43 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_new_memory_pool(switch_memor
     #endif
     
     #ifdef PER_POOL_LOCK
    -		if ((apr_allocator_create(&my_allocator)) != APR_SUCCESS) {
    +		if ((fspr_allocator_create(&my_allocator)) != APR_SUCCESS) {
     			abort();
     		}
     
     #if APR_POOL_DEBUG
    -		if ((apr_pool_create_ex_debug(pool, memory_manager.memory_pool, NULL, my_allocator, func)) != APR_SUCCESS) {
    +		if ((fspr_pool_create_ex_debug(pool, memory_manager.memory_pool, NULL, my_allocator, func)) != APR_SUCCESS) {
     #else
    -		if ((apr_pool_create_ex(pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
    +		if ((fspr_pool_create_ex(pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
     #endif
     			abort();
     		}
     
    -		if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, *pool)) != APR_SUCCESS) {
    +		if ((fspr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, *pool)) != APR_SUCCESS) {
     			abort();
     		}
     
    -		apr_allocator_mutex_set(my_allocator, my_mutex);
    -		apr_allocator_owner_set(my_allocator, *pool);
    +		fspr_allocator_mutex_set(my_allocator, my_mutex);
    +		fspr_allocator_owner_set(my_allocator, *pool);
     
    -		apr_pool_mutex_set(*pool, my_mutex);
    +		fspr_pool_mutex_set(*pool, my_mutex);
     
     #else
    -		apr_pool_create(pool, NULL);
    +		fspr_pool_create(pool, NULL);
     		switch_assert(*pool != NULL);
     	}
     #endif
     #endif
     
     	tmp = switch_core_sprintf(*pool, "%s:%d", file, line);
    -	apr_pool_tag(*pool, tmp);
    +	fspr_pool_tag(*pool, tmp);
     
     #if APR_POOL_DEBUG
    -	apr_pool_userdata_set(tmp, "line", NULL, *pool);
    +	fspr_pool_userdata_set(tmp, "line", NULL, *pool);
     #endif
     
     #ifdef DEBUG_ALLOC2
    -	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p New Pool %s\n", (void *) *pool, apr_pool_tag(*pool, NULL));
    +	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p New Pool %s\n", (void *) *pool, fspr_pool_tag(*pool, NULL));
     #endif
     
     
    @@ -476,20 +476,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m
     		tmp_pool = *pool;
     		*pool = NULL;
     
    -		tag = apr_pool_tag(tmp_pool, NULL);
    +		tag = fspr_pool_tag(tmp_pool, NULL);
     		tmp = switch_core_sprintf(tmp_pool, "%s,%s:%d", (tag ? tag : ""), file, line);
    -		apr_pool_tag(tmp_pool, tmp);
    +		fspr_pool_tag(tmp_pool, tmp);
     	}
     
     #ifdef DEBUG_ALLOC2
    -	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Free Pool %s\n", (void *) tmp_pool, apr_pool_tag(tmp_pool, NULL));
    +	switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Free Pool %s\n", (void *) tmp_pool, fspr_pool_tag(tmp_pool, NULL));
     #endif
     
     #ifdef INSTANTLY_DESTROY_POOLS
     #ifdef USE_MEM_LOCK
     	switch_mutex_lock(memory_manager.mem_lock);
     #endif
    -	apr_pool_destroy(tmp_pool);
    +	fspr_pool_destroy(tmp_pool);
     #ifdef USE_MEM_LOCK
     	switch_mutex_unlock(memory_manager.mem_lock);
     #endif
    @@ -499,9 +499,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_destroy_memory_pool(switch_m
     		switch_mutex_lock(memory_manager.mem_lock);
     #endif
     #if APR_POOL_DEBUG
    -		apr_pool_destroy_debug(tmp_pool, func);
    +		fspr_pool_destroy_debug(tmp_pool, func);
     #else
    -		apr_pool_destroy(tmp_pool);
    +		fspr_pool_destroy(tmp_pool);
     #endif
     #ifdef USE_MEM_LOCK
     		switch_mutex_unlock(memory_manager.mem_lock);
    @@ -527,14 +527,14 @@ SWITCH_DECLARE(void *) switch_core_perform_alloc(switch_memory_pool_t *pool, swi
     #ifdef DEBUG_ALLOC
     	if (memory > DEBUG_ALLOC_CUTOFF)
     		switch_log_printf(SWITCH_CHANNEL_ID_LOG, file, func, line, NULL, SWITCH_LOG_CONSOLE, "%p Core Allocate %s %d\n",
    -						  (void *) pool, apr_pool_tag(pool, NULL), (int) memory);
    +						  (void *) pool, fspr_pool_tag(pool, NULL), (int) memory);
     	/*switch_assert(memory < 20000); */
     #endif
     
     #if APR_POOL_DEBUG
    -	ptr = apr_palloc_debug(pool, memory, func);
    +	ptr = fspr_palloc_debug(pool, memory, func);
     #else
    -	ptr = apr_palloc(pool, memory);
    +	ptr = fspr_palloc(pool, memory);
     #endif
     	switch_assert(ptr != NULL);
     	memset(ptr, 0, memory);
    @@ -564,7 +564,7 @@ SWITCH_DECLARE(void) switch_core_memory_reclaim(void)
     #ifdef USE_MEM_LOCK
     		switch_mutex_lock(memory_manager.mem_lock);
     #endif
    -		apr_pool_destroy(pool);
    +		fspr_pool_destroy(pool);
     #ifdef USE_MEM_LOCK
     		switch_mutex_unlock(memory_manager.mem_lock);
     #endif
    @@ -601,16 +601,16 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
     #ifdef DEBUG_ALLOC
     				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
     #endif
    -				apr_pool_destroy(pop);
    +				fspr_pool_destroy(pop);
     #ifdef USE_MEM_LOCK
     				switch_mutex_unlock(memory_manager.mem_lock);
     #endif
     #else
    -				apr_pool_mutex_set(pop, NULL);
    +				fspr_pool_mutex_set(pop, NULL);
     #ifdef DEBUG_ALLOC
     				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
     #endif
    -				apr_pool_clear(pop);
    +				fspr_pool_clear(pop);
     				if (switch_queue_trypush(memory_manager.pool_recycle_queue, pop) != SWITCH_STATUS_SUCCESS) {
     #ifdef USE_MEM_LOCK
     					switch_mutex_lock(memory_manager.mem_lock);
    @@ -618,7 +618,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
     #ifdef DEBUG_ALLOC
     				switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%p DESTROY POOL\n", (void *) pop);
     #endif
    -					apr_pool_destroy(pop);
    +					fspr_pool_destroy(pop);
     #ifdef USE_MEM_LOCK
     					switch_mutex_unlock(memory_manager.mem_lock);
     #endif
    @@ -647,7 +647,7 @@ static void *SWITCH_THREAD_FUNC pool_thread(switch_thread_t *thread, void *obj)
     #ifdef USE_MEM_LOCK
     			switch_mutex_lock(memory_manager.mem_lock);
     #endif
    -			apr_pool_destroy(pop);
    +			fspr_pool_destroy(pop);
     			pop = NULL;
     #ifdef USE_MEM_LOCK
     			switch_mutex_unlock(memory_manager.mem_lock);
    @@ -678,7 +678,7 @@ void switch_core_memory_stop(void)
     
     
     	while (switch_queue_trypop(memory_manager.pool_queue, &pop) == SWITCH_STATUS_SUCCESS && pop) {
    -		apr_pool_destroy(pop);
    +		fspr_pool_destroy(pop);
     	}
     #endif
     }
    @@ -689,33 +689,33 @@ switch_memory_pool_t *switch_core_memory_init(void)
     	switch_threadattr_t *thd_attr;
     #endif
     #ifdef PER_POOL_LOCK
    -	apr_allocator_t *my_allocator = NULL;
    -	apr_thread_mutex_t *my_mutex;
    +	fspr_allocator_t *my_allocator = NULL;
    +	fspr_thread_mutex_t *my_mutex;
     #endif
     
     	memset(&memory_manager, 0, sizeof(memory_manager));
     
     #ifdef PER_POOL_LOCK
    -	if ((apr_allocator_create(&my_allocator)) != APR_SUCCESS) {
    +	if ((fspr_allocator_create(&my_allocator)) != APR_SUCCESS) {
     		abort();
     	}
     
    -	if ((apr_pool_create_ex(&memory_manager.memory_pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
    -		apr_allocator_destroy(my_allocator);
    +	if ((fspr_pool_create_ex(&memory_manager.memory_pool, NULL, NULL, my_allocator)) != APR_SUCCESS) {
    +		fspr_allocator_destroy(my_allocator);
     		my_allocator = NULL;
     		abort();
     	}
     
    -	if ((apr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, memory_manager.memory_pool)) != APR_SUCCESS) {
    +	if ((fspr_thread_mutex_create(&my_mutex, APR_THREAD_MUTEX_NESTED, memory_manager.memory_pool)) != APR_SUCCESS) {
     		abort();
     	}
     
    -	apr_allocator_mutex_set(my_allocator, my_mutex);
    -	apr_pool_mutex_set(memory_manager.memory_pool, my_mutex);
    -	apr_allocator_owner_set(my_allocator, memory_manager.memory_pool);
    -	apr_pool_tag(memory_manager.memory_pool, "core_pool");
    +	fspr_allocator_mutex_set(my_allocator, my_mutex);
    +	fspr_pool_mutex_set(memory_manager.memory_pool, my_mutex);
    +	fspr_allocator_owner_set(my_allocator, memory_manager.memory_pool);
    +	fspr_pool_tag(memory_manager.memory_pool, "core_pool");
     #else
    -	apr_pool_create(&memory_manager.memory_pool, NULL);
    +	fspr_pool_create(&memory_manager.memory_pool, NULL);
     	switch_assert(memory_manager.memory_pool != NULL);
     #endif
     
    diff --git a/src/switch_loadable_module.c b/src/switch_loadable_module.c
    index 439b8d0c19..cf9c8f368e 100644
    --- a/src/switch_loadable_module.c
    +++ b/src/switch_loadable_module.c
    @@ -34,14 +34,14 @@
     #include 
     #include "private/switch_core_pvt.h"
     
    -/* for apr_pstrcat */
    -#include 
    +/* for fspr_pstrcat */
    +#include 
     
    -/* for apr_env_get and apr_env_set */
    -#include 
    +/* for fspr_env_get and fspr_env_set */
    +#include 
     
    -/* for apr file and directory handling */
    -#include 
    +/* for fspr file and directory handling */
    +#include 
     
     typedef struct switch_file_node_s {
     	const switch_file_interface_t *ptr;
    @@ -1633,7 +1633,7 @@ static switch_status_t switch_loadable_module_load_file(char *path, char *filena
     {
     	switch_loadable_module_t *module = NULL;
     	switch_dso_lib_t dso = NULL;
    -	apr_status_t status = SWITCH_STATUS_SUCCESS;
    +	fspr_status_t status = SWITCH_STATUS_SUCCESS;
     	switch_loadable_module_function_table_t *interface_struct_handle = NULL;
     	switch_loadable_module_function_table_t *mod_interface_functions = NULL;
     	char *struct_name = NULL;
    @@ -2061,14 +2061,14 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_build_dynamic(char *filen
     static void switch_loadable_module_path_init()
     {
     	char *path = NULL, *working = NULL;
    -	apr_dir_t *perl_dir_handle = NULL;
    +	fspr_dir_t *perl_dir_handle = NULL;
     
    -	apr_env_get(&path, "path", loadable_modules.pool);
    -	apr_filepath_get(&working, APR_FILEPATH_NATIVE, loadable_modules.pool);
    +	fspr_env_get(&path, "path", loadable_modules.pool);
    +	fspr_filepath_get(&working, APR_FILEPATH_NATIVE, loadable_modules.pool);
     
    -	if (apr_dir_open(&perl_dir_handle, ".\\perl", loadable_modules.pool) == APR_SUCCESS) {
    -		apr_dir_close(perl_dir_handle);
    -		apr_env_set("path", apr_pstrcat(loadable_modules.pool, path, ";", working, "\\perl", NULL), loadable_modules.pool);
    +	if (fspr_dir_open(&perl_dir_handle, ".\\perl", loadable_modules.pool) == APR_SUCCESS) {
    +		fspr_dir_close(perl_dir_handle);
    +		fspr_env_set("path", fspr_pstrcat(loadable_modules.pool, path, ";", working, "\\perl", NULL), loadable_modules.pool);
     	}
     }
     #endif
    @@ -2076,9 +2076,9 @@ static void switch_loadable_module_path_init()
     SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autoload)
     {
     
    -	apr_finfo_t finfo = { 0 };
    -	apr_dir_t *module_dir_handle = NULL;
    -	apr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
    +	fspr_finfo_t finfo = { 0 };
    +	fspr_dir_t *module_dir_handle = NULL;
    +	fspr_int32_t finfo_flags = APR_FINFO_DIRENT | APR_FINFO_TYPE | APR_FINFO_NAME;
     	char *precf = "pre_load_modules.conf";
     	char *cf = "modules.conf";
     	char *pcf = "post_load_modules.conf";
    @@ -2286,12 +2286,12 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo
     	}
     
     	if (all) {
    -		if (apr_dir_open(&module_dir_handle, SWITCH_GLOBAL_dirs.mod_dir, loadable_modules.pool) != APR_SUCCESS) {
    +		if (fspr_dir_open(&module_dir_handle, SWITCH_GLOBAL_dirs.mod_dir, loadable_modules.pool) != APR_SUCCESS) {
     			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't open directory: %s\n", SWITCH_GLOBAL_dirs.mod_dir);
     			return SWITCH_STATUS_GENERR;
     		}
     
    -		while (apr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) {
    +		while (fspr_dir_read(&finfo, finfo_flags, module_dir_handle) == APR_SUCCESS) {
     			const char *fname = finfo.fname;
     
     			if (finfo.filetype != APR_REG) {
    @@ -2312,7 +2312,7 @@ SWITCH_DECLARE(switch_status_t) switch_loadable_module_init(switch_bool_t autolo
     
     			switch_loadable_module_load_module(SWITCH_GLOBAL_dirs.mod_dir, fname, SWITCH_FALSE, &err);
     		}
    -		apr_dir_close(module_dir_handle);
    +		fspr_dir_close(module_dir_handle);
     	}
     
     	switch_loadable_module_runtime();
    diff --git a/src/switch_rtp.c b/src/switch_rtp.c
    index f0be8db97b..e9f2c53c81 100644
    --- a/src/switch_rtp.c
    +++ b/src/switch_rtp.c
    @@ -36,7 +36,7 @@
     #include 
     #endif
     #include 
    -#include 
    +#include 
     #undef PACKAGE_NAME
     #undef PACKAGE_STRING
     #undef PACKAGE_TARNAME
    diff --git a/src/switch_time.c b/src/switch_time.c
    index 39ad4bb597..60bf28866e 100644
    --- a/src/switch_time.c
    +++ b/src/switch_time.c
    @@ -162,7 +162,7 @@ static void do_sleep(switch_interval_time_t t)
     
     #if !defined(DARWIN)
     	if (t > 100000 || !NANO) {
    -		apr_sleep(t);
    +		fspr_sleep(t);
     		return;
     	}
     #endif
    
    From dd3075a20303e1990bc596a1846ae110d63cea2f Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Fri, 19 Aug 2022 02:51:59 +0300
    Subject: [PATCH 053/155] [Core] Fix Windows build after apr-util removal
    
    ---
     Freeswitch.2017.sln                           | 188 ----
     libs/apr/libapr.rc                            |   2 +-
     libs/win32/apr-util/cleancount                |   1 -
     libs/win32/apr-util/libaprutil.2017.vcxproj   | 960 ------------------
     libs/win32/apr-util/xml.2017.vcxproj          | 289 ------
     libs/win32/apr/libapr.2017.vcxproj            | 124 +--
     .../mod_managed/mod_managed.2017.vcxproj      |  16 +-
     src/switch_apr.c                              |   2 +
     src/switch_apr_queue.c                        |   1 +
     src/switch_time.c                             |   2 +-
     src/switch_xml.c                              |  20 +-
     w32/Library/FreeSwitchCore.2017.vcxproj       |   5 +-
     12 files changed, 86 insertions(+), 1524 deletions(-)
     delete mode 100644 libs/win32/apr-util/cleancount
     delete mode 100644 libs/win32/apr-util/libaprutil.2017.vcxproj
     delete mode 100644 libs/win32/apr-util/xml.2017.vcxproj
    
    diff --git a/Freeswitch.2017.sln b/Freeswitch.2017.sln
    index b708f4e9ca..46fc1a7e88 100644
    --- a/Freeswitch.2017.sln
    +++ b/Freeswitch.2017.sln
    @@ -166,8 +166,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "vm", "vm", "{3DAF028C-AB5B-
     EndProject
     Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Sound Files", "Sound Files", "{4F227C26-768F-46A3-8684-1D08A46FB374}"
     EndProject
    -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "unimrcp", "unimrcp", "{62F27B1A-C919-4A70-8478-51F178F3B18F}"
    -EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchConsole", "w32\Console\FreeSwitchConsole.2017.vcxproj", "{1AF3A893-F7BE-43DD-B697-8AB2397C0D67}"
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FreeSwitchCoreLib", "w32\Library\FreeSwitchCore.2017.vcxproj", "{202D7A4E-760D-4D0E-AFA1-D7459CED30FF}"
    @@ -198,8 +196,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_cepstral", "src\mod\asr
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_ilbc", "src\mod\codecs\mod_ilbc\mod_ilbc.2017.vcxproj", "{D3EC0AFF-76FC-4210-A825-9A17410660A3}"
     EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dingaling", "src\mod\endpoints\mod_dingaling\mod_dingaling.2017.vcxproj", "{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}"
    -EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_commands", "src\mod\applications\mod_commands\mod_commands.2017.vcxproj", "{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}"
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_console", "src\mod\loggers\mod_console\mod_console.2017.vcxproj", "{1C453396-D912-4213-89FD-9B489162B7B5}"
    @@ -217,20 +213,14 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_dptools", "src\mod\appl
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_event_socket", "src\mod\event_handlers\mod_event_socket\mod_event_socket.2017.vcxproj", "{05515420-16DE-4E63-BE73-85BE85BA5142}"
     EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libdingaling", "libs\libdingaling\libdingaling.2017.vcxproj", "{1906D736-08BD-4EE1-924F-B536249B9A54}"
    -EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsrtp", "libs\srtp\libsrtp.2017.vcxproj", "{EEF031CB-FED8-451E-A471-91EC8D4F6750}"
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libsqlite", "libs\win32\sqlite\sqlite.2017.vcxproj", "{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3}"
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libapr", "libs\win32\apr\libapr.2017.vcxproj", "{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}"
     EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libaprutil", "libs\win32\apr-util\libaprutil.2017.vcxproj", "{F057DA7F-79E5-4B00-845C-EF446EF055E3}"
    -EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iksemel", "libs\win32\iksemel\iksemel.2017.vcxproj", "{E727E8F6-935D-46FE-8B0E-37834748A0E3}"
     EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "xml", "libs\win32\apr-util\xml.2017.vcxproj", "{155844C3-EC5F-407F-97A4-A2DDADED9B2F}"
    -EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_sofia", "src\mod\endpoints\mod_sofia\mod_sofia.2017.vcxproj", "{0DF3ABD0-DDC0-4265-B778-07C66780979B}"
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pthread", "libs\win32\pthread\pthread.2017.vcxproj", "{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4}"
    @@ -380,27 +370,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbroadvoice", "libs\win32
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_bv", "src\mod\codecs\mod_bv\mod_bv.2017.vcxproj", "{D5C87B19-150D-4EF3-A671-96589BD2D14A}"
     EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "aprtoolkit", "libs\unimrcp\libs\apr-toolkit\aprtoolkit.2017.vcxproj", "{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}"
    -	ProjectSection(ProjectDependencies) = postProject
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {155844C3-EC5F-407F-97A4-A2DDADED9B2F}
    -	EndProjectSection
    -EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mpf", "libs\unimrcp\libs\mpf\mpf.2017.vcxproj", "{B5A00BFA-6083-4FAE-A097-71642D6473B5}"
    -EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcp", "libs\unimrcp\libs\mrcp\mrcp.2017.vcxproj", "{1C320193-46A6-4B34-9C56-8AB584FC1B56}"
    -EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpclient", "libs\unimrcp\libs\mrcp-client\mrcpclient.2017.vcxproj", "{72782932-37CC-46AE-8C7F-9A7B1A6EE108}"
    -EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsignaling", "libs\unimrcp\libs\mrcp-signaling\mrcpsignaling.2017.vcxproj", "{12A49562-BAB9-43A3-A21D-15B60BBB4C31}"
    -EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpv2transport", "libs\unimrcp\libs\mrcpv2-transport\mrcpv2transport.2017.vcxproj", "{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}"
    -EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "unirtsp", "libs\unimrcp\libs\uni-rtsp\unirtsp.2017.vcxproj", "{504B3154-7A4F-459D-9877-B951021C3F1F}"
    -EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpsofiasip", "libs\unimrcp\modules\mrcp-sofiasip\mrcpsofiasip.2017.vcxproj", "{746F3632-5BB2-4570-9453-31D6D58A7D8E}"
    -EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mrcpunirtsp", "libs\unimrcp\modules\mrcp-unirtsp\mrcpunirtsp.2017.vcxproj", "{DEB01ACB-D65F-4A62-AED9-58C1054499E9}"
    -EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_unimrcp", "src\mod\asr_tts\mod_unimrcp\mod_unimrcp.2017.vcxproj", "{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}"
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcelt", "libs\win32\celt\libcelt.2017.vcxproj", "{ABB71A76-42B0-47A4-973A-42E3D920C6FD}"
    @@ -752,17 +721,6 @@ Global
     		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|Win32.Build.0 = Release|Win32
     		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.ActiveCfg = Release|x64
     		{D3EC0AFF-76FC-4210-A825-9A17410660A3}.Release|x64.Build.0 = Release|x64
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|Win32.ActiveCfg = Release|x64
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.ActiveCfg = Release|x64
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.All|x64.Build.0 = Release|x64
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|Win32.Build.0 = Debug|Win32
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.ActiveCfg = Debug|x64
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Debug|x64.Build.0 = Debug|x64
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.ActiveCfg = Release|Win32
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|Win32.Build.0 = Release|Win32
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.ActiveCfg = Release|x64
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3}.Release|x64.Build.0 = Release|x64
     		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|Win32.ActiveCfg = Release|x64
     		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.ActiveCfg = Release|x64
     		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB}.All|x64.Build.0 = Release|x64
    @@ -840,17 +798,6 @@ Global
     		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|Win32.Build.0 = Release|Win32
     		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.ActiveCfg = Release|x64
     		{05515420-16DE-4E63-BE73-85BE85BA5142}.Release|x64.Build.0 = Release|x64
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|Win32.ActiveCfg = Release DLL|x64
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.ActiveCfg = Release DLL|x64
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.All|x64.Build.0 = Release DLL|x64
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|Win32.Build.0 = Debug|Win32
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.ActiveCfg = Debug|x64
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.Debug|x64.Build.0 = Debug|x64
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.ActiveCfg = Release|Win32
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|Win32.Build.0 = Release|Win32
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.ActiveCfg = Release|x64
    -		{1906D736-08BD-4EE1-924F-B536249B9A54}.Release|x64.Build.0 = Release|x64
     		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|Win32.ActiveCfg = Release Dll|x64
     		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.ActiveCfg = Release Dll|x64
     		{EEF031CB-FED8-451E-A471-91EC8D4F6750}.All|x64.Build.0 = Release Dll|x64
    @@ -884,17 +831,6 @@ Global
     		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|Win32.Build.0 = Release|Win32
     		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.ActiveCfg = Release|x64
     		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF}.Release|x64.Build.0 = Release|x64
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|Win32.ActiveCfg = Release|x64
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.ActiveCfg = Release|x64
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.All|x64.Build.0 = Release|x64
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|Win32.Build.0 = Debug|Win32
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.ActiveCfg = Debug|x64
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Debug|x64.Build.0 = Debug|x64
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.ActiveCfg = Release|Win32
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|Win32.Build.0 = Release|Win32
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.ActiveCfg = Release|x64
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3}.Release|x64.Build.0 = Release|x64
     		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|Win32.ActiveCfg = Release|x64
     		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.ActiveCfg = Release|x64
     		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.All|x64.Build.0 = Release|x64
    @@ -906,17 +842,6 @@ Global
     		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|Win32.Build.0 = Release|Win32
     		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.ActiveCfg = Release|x64
     		{E727E8F6-935D-46FE-8B0E-37834748A0E3}.Release|x64.Build.0 = Release|x64
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|Win32.ActiveCfg = Debug|x64
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.ActiveCfg = Debug|x64
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.All|x64.Build.0 = Debug|x64
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|Win32.Build.0 = Debug|Win32
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.ActiveCfg = Debug|x64
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Debug|x64.Build.0 = Debug|x64
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.ActiveCfg = Release|Win32
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|Win32.Build.0 = Release|Win32
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.ActiveCfg = Release|x64
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F}.Release|x64.Build.0 = Release|x64
     		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|Win32.ActiveCfg = Release|x64
     		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.ActiveCfg = Release|x64
     		{0DF3ABD0-DDC0-4265-B778-07C66780979B}.All|x64.Build.0 = Release|x64
    @@ -1697,105 +1622,6 @@ Global
     		{D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|Win32.Build.0 = Release|Win32
     		{D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64.ActiveCfg = Release|x64
     		{D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64.Build.0 = Release|x64
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|Win32.ActiveCfg = Release|Win32
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|Win32.Build.0 = Release|Win32
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.All|x64.ActiveCfg = Release|Win32
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|Win32.Build.0 = Debug|Win32
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.ActiveCfg = Debug|x64
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Debug|x64.Build.0 = Debug|x64
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.ActiveCfg = Release|Win32
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|Win32.Build.0 = Release|Win32
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.ActiveCfg = Release|x64
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2}.Release|x64.Build.0 = Release|x64
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|Win32.ActiveCfg = Release|Win32
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|Win32.Build.0 = Release|Win32
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.All|x64.ActiveCfg = Release|Win32
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|Win32.Build.0 = Debug|Win32
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.ActiveCfg = Debug|x64
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Debug|x64.Build.0 = Debug|x64
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.ActiveCfg = Release|Win32
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|Win32.Build.0 = Release|Win32
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.ActiveCfg = Release|x64
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5}.Release|x64.Build.0 = Release|x64
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|Win32.ActiveCfg = Release|Win32
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|Win32.Build.0 = Release|Win32
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.All|x64.ActiveCfg = Release|Win32
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|Win32.Build.0 = Debug|Win32
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.ActiveCfg = Debug|x64
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Debug|x64.Build.0 = Debug|x64
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.ActiveCfg = Release|Win32
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|Win32.Build.0 = Release|Win32
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.ActiveCfg = Release|x64
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56}.Release|x64.Build.0 = Release|x64
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|Win32.ActiveCfg = Release|Win32
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|Win32.Build.0 = Release|Win32
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.All|x64.ActiveCfg = Release|Win32
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|Win32.Build.0 = Debug|Win32
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.ActiveCfg = Debug|x64
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Debug|x64.Build.0 = Debug|x64
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.ActiveCfg = Release|Win32
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|Win32.Build.0 = Release|Win32
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.ActiveCfg = Release|x64
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108}.Release|x64.Build.0 = Release|x64
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|Win32.ActiveCfg = Release|Win32
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|Win32.Build.0 = Release|Win32
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.All|x64.ActiveCfg = Release|Win32
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|Win32.Build.0 = Debug|Win32
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.ActiveCfg = Debug|x64
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Debug|x64.Build.0 = Debug|x64
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.ActiveCfg = Release|Win32
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|Win32.Build.0 = Release|Win32
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.ActiveCfg = Release|x64
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31}.Release|x64.Build.0 = Release|x64
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|Win32.ActiveCfg = Release|Win32
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|Win32.Build.0 = Release|Win32
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.All|x64.ActiveCfg = Release|Win32
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|Win32.Build.0 = Debug|Win32
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.ActiveCfg = Debug|x64
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Debug|x64.Build.0 = Debug|x64
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.ActiveCfg = Release|Win32
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|Win32.Build.0 = Release|Win32
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.ActiveCfg = Release|x64
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA}.Release|x64.Build.0 = Release|x64
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.All|Win32.ActiveCfg = Release|Win32
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.All|Win32.Build.0 = Release|Win32
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.All|x64.ActiveCfg = Release|Win32
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|Win32.Build.0 = Debug|Win32
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.ActiveCfg = Debug|x64
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.Debug|x64.Build.0 = Debug|x64
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.ActiveCfg = Release|Win32
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.Release|Win32.Build.0 = Release|Win32
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.ActiveCfg = Release|x64
    -		{504B3154-7A4F-459D-9877-B951021C3F1F}.Release|x64.Build.0 = Release|x64
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|Win32.ActiveCfg = Release|Win32
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|Win32.Build.0 = Release|Win32
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.All|x64.ActiveCfg = Release|Win32
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|Win32.Build.0 = Debug|Win32
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.ActiveCfg = Debug|x64
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Debug|x64.Build.0 = Debug|x64
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.ActiveCfg = Release|Win32
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|Win32.Build.0 = Release|Win32
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.ActiveCfg = Release|x64
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E}.Release|x64.Build.0 = Release|x64
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|Win32.ActiveCfg = Release|Win32
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|Win32.Build.0 = Release|Win32
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.All|x64.ActiveCfg = Release|Win32
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|Win32.Build.0 = Debug|Win32
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.ActiveCfg = Debug|x64
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Debug|x64.Build.0 = Debug|x64
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.ActiveCfg = Release|Win32
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|Win32.Build.0 = Release|Win32
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.ActiveCfg = Release|x64
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9}.Release|x64.Build.0 = Release|x64
     		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|Win32.ActiveCfg = Release|x64
     		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64.ActiveCfg = Release|x64
     		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64.Build.0 = Release|x64
    @@ -2739,7 +2565,6 @@ Global
     		{713E4747-1126-40B1-BD84-58F9A7745423} = {57199684-EC63-4A60-9DC6-11815AF6B413}
     		{F1B71990-EB04-4EB5-B28A-BC3EB6F7E843} = {D4A12E4C-DBDA-4614-BA26-3425AE9F60F5}
     		{3DAF028C-AB5B-4183-A01B-DCC43F5A87F0} = {D4A12E4C-DBDA-4614-BA26-3425AE9F60F5}
    -		{62F27B1A-C919-4A70-8478-51F178F3B18F} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{1D95CD95-0DE2-48C3-AC23-D5C7D1C9C0F0} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
     		{AFAC0568-7548-42D5-9F6A-8D3400A1E4F6} = {A5A27244-AD24-46E5-B01B-840CD296C91D}
     		{5FD31A25-5D83-4794-8BEE-904DAD84CE71} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
    @@ -2753,7 +2578,6 @@ Global
     		{8B754330-A434-4791-97E5-1EE67060BAC0} = {0C808854-54D1-4230-BFF5-77B5FD905000}
     		{692F6330-4D87-4C82-81DF-40DB5892636E} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
     		{D3EC0AFF-76FC-4210-A825-9A17410660A3} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
    -		{FFAA4C52-3A53-4F99-90C1-D59D1F0427F3} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
     		{30A5B29C-983E-4580-9FD0-D647CCDCC7EB} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
     		{1C453396-D912-4213-89FD-9B489162B7B5} = {A7AB4405-FDB7-4853-9FBB-1516B1C3D80A}
     		{CBEC7225-0C21-4DA8-978E-1F158F8AD950} = {F69A4A6B-9360-4EBB-A280-22AA3C455AC5}
    @@ -2761,13 +2585,10 @@ Global
     		{C24FB505-05D7-4319-8485-7540B44C8603} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
     		{B5881A85-FE70-4F64-8607-2CAAE52669C6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
     		{05515420-16DE-4E63-BE73-85BE85BA5142} = {9ADF1E48-2F5C-4ED7-A893-596259FABFE0}
    -		{1906D736-08BD-4EE1-924F-B536249B9A54} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{EEF031CB-FED8-451E-A471-91EC8D4F6750} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{6EDFEFD5-3596-4FA9-8EBA-B331547B35A3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{F6C55D93-B927-4483-BB69-15AEF3DD2DFF} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
    -		{F057DA7F-79E5-4B00-845C-EF446EF055E3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{E727E8F6-935D-46FE-8B0E-37834748A0E3} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
    -		{155844C3-EC5F-407F-97A4-A2DDADED9B2F} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{0DF3ABD0-DDC0-4265-B778-07C66780979B} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
     		{DF018947-0FFF-4EB3-BDEE-441DC81DA7A4} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{FEA1EEF7-876F-48DE-88BF-C0E3E606D758} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
    @@ -2840,15 +2661,6 @@ Global
     		{432DB165-1EB2-4781-A9C0-71E62610B20A} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
     		{CF70F278-3364-4395-A2E1-23501C9B8AD2} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{D5C87B19-150D-4EF3-A671-96589BD2D14A} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
    -		{13DEECA0-BDD4-4744-A1A2-8EB0A44DF3D2} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
    -		{B5A00BFA-6083-4FAE-A097-71642D6473B5} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
    -		{1C320193-46A6-4B34-9C56-8AB584FC1B56} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
    -		{72782932-37CC-46AE-8C7F-9A7B1A6EE108} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
    -		{12A49562-BAB9-43A3-A21D-15B60BBB4C31} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
    -		{A9EDAC04-6A5F-4BA7-BC0D-CCE7B255B6EA} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
    -		{504B3154-7A4F-459D-9877-B951021C3F1F} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
    -		{746F3632-5BB2-4570-9453-31D6D58A7D8E} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
    -		{DEB01ACB-D65F-4A62-AED9-58C1054499E9} = {62F27B1A-C919-4A70-8478-51F178F3B18F}
     		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
     		{ABB71A76-42B0-47A4-973A-42E3D920C6FD} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{EF300386-A8DF-4372-B6D8-FB9BFFCA9AED} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
    diff --git a/libs/apr/libapr.rc b/libs/apr/libapr.rc
    index 925868d1e5..b06b68a105 100644
    --- a/libs/apr/libapr.rc
    +++ b/libs/apr/libapr.rc
    @@ -1,4 +1,4 @@
    -#include "apr_version.h"
    +#include "fspr_version.h"
     
     #define APR_COPYRIGHT "Copyright 2000-2005 The Apache Software " \
                           "Foundation or its licensors, as applicable."
    diff --git a/libs/win32/apr-util/cleancount b/libs/win32/apr-util/cleancount
    deleted file mode 100644
    index 56a6051ca2..0000000000
    --- a/libs/win32/apr-util/cleancount
    +++ /dev/null
    @@ -1 +0,0 @@
    -1
    \ No newline at end of file
    diff --git a/libs/win32/apr-util/libaprutil.2017.vcxproj b/libs/win32/apr-util/libaprutil.2017.vcxproj
    deleted file mode 100644
    index a31b09e69d..0000000000
    --- a/libs/win32/apr-util/libaprutil.2017.vcxproj
    +++ /dev/null
    @@ -1,960 +0,0 @@
    -
    -
    -  
    -    
    -      Debug
    -      Win32
    -    
    -    
    -      Debug
    -      x64
    -    
    -    
    -      Release
    -      Win32
    -    
    -    
    -      Release
    -      x64
    -    
    -  
    -  
    -    libaprutil
    -    {F057DA7F-79E5-4B00-845C-EF446EF055E3}
    -    libaprutil
    -  
    -  
    -  
    -    DynamicLibrary
    -    false
    -    $(DefaultPlatformToolset)
    -  
    -  
    -    DynamicLibrary
    -    false
    -    $(DefaultPlatformToolset)
    -  
    -  
    -    DynamicLibrary
    -    false
    -    $(DefaultPlatformToolset)
    -  
    -  
    -    DynamicLibrary
    -    false
    -    $(DefaultPlatformToolset)
    -  
    -  
    -  
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -  
    -    <_ProjectFileVersion>10.0.30319.1
    -    false
    -    false
    -    false
    -    false
    -  
    -  
    -    
    -      if not exist "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" type "$(ProjectDir)..\..\apr-util\include\apr_ldap.hw" > "$(ProjectDir)..\..\apr-util\include\apr_ldap.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu.h" type "$(ProjectDir)..\..\apr-util\include\apu.hw" > "$(ProjectDir)..\..\apr-util\include\apu.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_config.h" type "$(ProjectDir)..\..\apr-util\include\apu_config.hw" > "$(ProjectDir)..\..\apr-util\include\apu_config.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h" type "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.hw" > "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_want.h" type "$(ProjectDir)..\..\apr-util\include\apu_want.hw" > "$(ProjectDir)..\..\apr-util\include\apu_want.h"
    -xcopy "$(ProjectDir)..\..\apr-util\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y
    -
    -    
    -    
    -      /EHsc  %(AdditionalOptions)
    -      Disabled
    -      ..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr\include;..\..\apr-util\xml\expat\lib;%(AdditionalIncludeDirectories)
    -      _DEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS;%(PreprocessorDefinitions)
    -      MultiThreadedDebugDLL
    -      Level3
    -      true
    -      4244;4018;4267;%(DisableSpecificWarnings)
    -    
    -    
    -      _DEBUG;APU_VERSION_ONLY;%(PreprocessorDefinitions)
    -      0x0409
    -      ..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr-1.2.7\include;%(AdditionalIncludeDirectories)
    -    
    -    
    -      ws2_32.lib;mswsock.lib;wldap32.lib;%(AdditionalDependencies)
    -      true
    -      %(AdditionalLibraryDirectories)
    -      true
    -      Windows
    -      0x6EE60000
    -      false
    -      MachineX86
    -    
    -    
    -      true
    -    
    -  
    -  
    -    
    -      if not exist "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" type "$(ProjectDir)..\..\apr-util\include\apr_ldap.hw" > "$(ProjectDir)..\..\apr-util\include\apr_ldap.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu.h" type "$(ProjectDir)..\..\apr-util\include\apu.hw" > "$(ProjectDir)..\..\apr-util\include\apu.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_config.h" type "$(ProjectDir)..\..\apr-util\include\apu_config.hw" > "$(ProjectDir)..\..\apr-util\include\apu_config.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h" type "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.hw" > "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_want.h" type "$(ProjectDir)..\..\apr-util\include\apu_want.hw" > "$(ProjectDir)..\..\apr-util\include\apu_want.h"
    -xcopy "$(ProjectDir)..\..\apr-util\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y
    -
    -    
    -    
    -      /EHsc  %(AdditionalOptions)
    -      Disabled
    -      ..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr\include;..\..\apr-util\xml\expat\lib;%(AdditionalIncludeDirectories)
    -      _DEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS;%(PreprocessorDefinitions)
    -      MultiThreadedDebugDLL
    -      Level3
    -      true
    -      4244;4018;4267;%(DisableSpecificWarnings)
    -    
    -    
    -      _DEBUG;APU_VERSION_ONLY;%(PreprocessorDefinitions)
    -      0x0409
    -      ..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr-1.2.7\include;%(AdditionalIncludeDirectories)
    -    
    -    
    -      ws2_32.lib;mswsock.lib;wldap32.lib;%(AdditionalDependencies)
    -      true
    -      %(AdditionalLibraryDirectories)
    -      true
    -      Windows
    -      0x6EE60000
    -      false
    -      MachineX64
    -    
    -    
    -      true
    -    
    -  
    -  
    -    
    -      if not exist "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" type "$(ProjectDir)..\..\apr-util\include\apr_ldap.hw" > "$(ProjectDir)..\..\apr-util\include\apr_ldap.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu.h" type "$(ProjectDir)..\..\apr-util\include\apu.hw" > "$(ProjectDir)..\..\apr-util\include\apu.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_config.h" type "$(ProjectDir)..\..\apr-util\include\apu_config.hw" > "$(ProjectDir)..\..\apr-util\include\apu_config.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h" type "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.hw" > "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_want.h" type "$(ProjectDir)..\..\apr-util\include\apu_want.hw" > "$(ProjectDir)..\..\apr-util\include\apu_want.h"
    -xcopy "$(ProjectDir)..\..\apr-util\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y
    -
    -    
    -    
    -      MaxSpeed
    -      OnlyExplicitInline
    -      ..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr\include;..\..\apr-util\xml\expat\lib;%(AdditionalIncludeDirectories)
    -      NDEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS;%(PreprocessorDefinitions)
    -      true
    -      MultiThreadedDLL
    -      true
    -      Level3
    -      true
    -      4244;4018;4267;%(DisableSpecificWarnings)
    -    
    -    
    -      NDEBUG;APU_VERSION_ONLY;%(PreprocessorDefinitions)
    -      0x0409
    -      ..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr-1.2.7\include;%(AdditionalIncludeDirectories)
    -    
    -    
    -      ws2_32.lib;mswsock.lib;wldap32.lib;%(AdditionalDependencies)
    -      true
    -      %(AdditionalLibraryDirectories)
    -      true
    -      Windows
    -      true
    -      0x6EE60000
    -      false
    -      MachineX86
    -    
    -    
    -      true
    -    
    -  
    -  
    -    
    -      if not exist "$(ProjectDir)..\..\apr-util\include\apr_ldap.h" type "$(ProjectDir)..\..\apr-util\include\apr_ldap.hw" > "$(ProjectDir)..\..\apr-util\include\apr_ldap.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu.h" type "$(ProjectDir)..\..\apr-util\include\apu.hw" > "$(ProjectDir)..\..\apr-util\include\apu.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_config.h" type "$(ProjectDir)..\..\apr-util\include\apu_config.hw" > "$(ProjectDir)..\..\apr-util\include\apu_config.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h" type "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.hw" > "$(ProjectDir)..\..\apr-util\include\apu_select_dbm.h"
    -if not exist "$(ProjectDir)..\..\apr-util\include\apu_want.h" type "$(ProjectDir)..\..\apr-util\include\apu_want.hw" > "$(ProjectDir)..\..\apr-util\include\apu_want.h"
    -xcopy "$(ProjectDir)..\..\apr-util\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y
    -
    -    
    -    
    -      MaxSpeed
    -      OnlyExplicitInline
    -      ..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr\include;..\..\apr-util\xml\expat\lib;%(AdditionalIncludeDirectories)
    -      NDEBUG;APU_DECLARE_EXPORT;APU_USE_SDBM;WIN32;_WINDOWS;%(PreprocessorDefinitions)
    -      true
    -      MultiThreadedDLL
    -      true
    -      Level3
    -      true
    -      4244;4018;4267;%(DisableSpecificWarnings)
    -    
    -    
    -      NDEBUG;APU_VERSION_ONLY;%(PreprocessorDefinitions)
    -      0x0409
    -      ..\..\apr-util\include;..\..\apr-util\include/private;..\..\apr-util\dbm/sdbm;..\..\apr-iconv-1.1.1\include;..\..\apr-1.2.7\include;%(AdditionalIncludeDirectories)
    -    
    -    
    -      ws2_32.lib;mswsock.lib;wldap32.lib;%(AdditionalDependencies)
    -      true
    -      %(AdditionalLibraryDirectories)
    -      true
    -      Windows
    -      true
    -      0x6EE60000
    -      false
    -      MachineX64
    -    
    -    
    -      true
    -    
    -  
    -  
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -  
    -  
    -    
    -      true
    -      true
    -      true
    -      true
    -    
    -    
    -      true
    -      true
    -      true
    -      true
    -    
    -    
    -      true
    -      true
    -      true
    -      true
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -  
    -  
    -    
    -    
    -    
    -      Creating apr_ldap.h from apr_ldap.hw
    -      if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw > ..\..\apr-util\include\apr_ldap.h
    -
    -      ..\..\apr-util\include\apr_ldap.h;%(Outputs)
    -      Creating apr_ldap.h from apr_ldap.hw
    -      if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw > ..\..\apr-util\include\apr_ldap.h
    -
    -      ..\..\apr-util\include\apr_ldap.h;%(Outputs)
    -      Creating apr_ldap.h from apr_ldap.hw
    -      if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw > ..\..\apr-util\include\apr_ldap.h
    -
    -      ..\..\apr-util\include\apr_ldap.h;%(Outputs)
    -      Creating apr_ldap.h from apr_ldap.hw
    -      if not exist ..\..\apr-util\include\apr_ldap.h type ..\..\apr-util\include\apr_ldap.hw > ..\..\apr-util\include\apr_ldap.h
    -
    -      ..\..\apr-util\include\apr_ldap.h;%(Outputs)
    -    
    -    
    -    
    -    
    -      Creating apu.h from apu.hw
    -      if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw > ..\..\apr-util\include\apu.h
    -
    -      ..\..\apr-util\include\apu.h;%(Outputs)
    -      Creating apu.h from apu.hw
    -      if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw > ..\..\apr-util\include\apu.h
    -
    -      ..\..\apr-util\include\apu.h;%(Outputs)
    -      Creating apu.h from apu.hw
    -      if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw > ..\..\apr-util\include\apu.h
    -
    -      ..\..\apr-util\include\apu.h;%(Outputs)
    -      Creating apu.h from apu.hw
    -      if not exist ..\..\apr-util\include\apu.h type ..\..\apr-util\include\apu.hw > ..\..\apr-util\include\apu.h
    -
    -      ..\..\apr-util\include\apu.h;%(Outputs)
    -    
    -    
    -    
    -      Creating apu_config.h from apu_config.hw
    -      if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw > ..\..\apr-util\include\private\apu_config.h
    -
    -      ..\..\apr-util\include\private\apu_config.h;%(Outputs)
    -      Creating apu_config.h from apu_config.hw
    -      if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw > ..\..\apr-util\include\private\apu_config.h
    -
    -      ..\..\apr-util\include\private\apu_config.h;%(Outputs)
    -      Creating apu_config.h from apu_config.hw
    -      if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw > ..\..\apr-util\include\private\apu_config.h
    -
    -      ..\..\apr-util\include\private\apu_config.h;%(Outputs)
    -      Creating apu_config.h from apu_config.hw
    -      if not exist ..\..\apr-util\include\private\apu_config.h type ..\..\apr-util\include\private\apu_config.hw > ..\..\apr-util\include\private\apu_config.h
    -
    -      ..\..\apr-util\include\private\apu_config.h;%(Outputs)
    -    
    -    
    -    
    -      Creating apu_select_dbm.h from apu_select_dbm.hw
    -      if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw > ..\..\apr-util\include\private\apu_select_dbm.h
    -
    -      ..\..\apr-util\include\private\apu_select_dbm.h;%(Outputs)
    -      Creating apu_select_dbm.h from apu_select_dbm.hw
    -      if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw > ..\..\apr-util\include\private\apu_select_dbm.h
    -
    -      ..\..\apr-util\include\private\apu_select_dbm.h;%(Outputs)
    -      Creating apu_select_dbm.h from apu_select_dbm.hw
    -      if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw > ..\..\apr-util\include\private\apu_select_dbm.h
    -
    -      ..\..\apr-util\include\private\apu_select_dbm.h;%(Outputs)
    -      Creating apu_select_dbm.h from apu_select_dbm.hw
    -      if not exist ..\..\apr-util\include\private\apu_select_dbm.h type ..\..\apr-util\include\private\apu_select_dbm.hw > ..\..\apr-util\include\private\apu_select_dbm.h
    -
    -      ..\..\apr-util\include\private\apu_select_dbm.h;%(Outputs)
    -    
    -    
    -    
    -    
    -      Creating apu_want.h from apu_want.hw
    -      if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw > ..\..\apr-util\include\apu_want.h
    -
    -      ..\..\apr-util\include\apu_want.h;%(Outputs)
    -      Creating apu_want.h from apu_want.hw
    -      if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw > ..\..\apr-util\include\apu_want.h
    -
    -      ..\..\apr-util\include\apu_want.h;%(Outputs)
    -      Creating apu_want.h from apu_want.hw
    -      if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw > ..\..\apr-util\include\apu_want.h
    -
    -      ..\..\apr-util\include\apu_want.h;%(Outputs)
    -      Creating apu_want.h from apu_want.hw
    -      if not exist ..\..\apr-util\include\apu_want.h type ..\..\apr-util\include\apu_want.hw > ..\..\apr-util\include\apu_want.h
    -
    -      ..\..\apr-util\include\apu_want.h;%(Outputs)
    -    
    -  
    -  
    -    
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -    
    -  
    -  
    -    
    -      {f6c55d93-b927-4483-bb69-15aef3dd2dff}
    -    
    -    
    -      {155844c3-ec5f-407f-97a4-a2ddaded9b2f}
    -    
    -  
    -  
    -  
    -  
    -
    \ No newline at end of file
    diff --git a/libs/win32/apr-util/xml.2017.vcxproj b/libs/win32/apr-util/xml.2017.vcxproj
    deleted file mode 100644
    index d6e38880e3..0000000000
    --- a/libs/win32/apr-util/xml.2017.vcxproj
    +++ /dev/null
    @@ -1,289 +0,0 @@
    -
    -
    -  
    -    
    -      Debug
    -      Win32
    -    
    -    
    -      Debug
    -      x64
    -    
    -    
    -      Release
    -      Win32
    -    
    -    
    -      Release
    -      x64
    -    
    -  
    -  
    -    xml
    -    {155844C3-EC5F-407F-97A4-A2DDADED9B2F}
    -    xml
    -  
    -  
    -  
    -    StaticLibrary
    -    false
    -    MultiByte
    -    $(DefaultPlatformToolset)
    -  
    -  
    -    StaticLibrary
    -    false
    -    MultiByte
    -    true
    -    $(DefaultPlatformToolset)
    -  
    -  
    -    StaticLibrary
    -    false
    -    MultiByte
    -    $(DefaultPlatformToolset)
    -  
    -  
    -    StaticLibrary
    -    false
    -    MultiByte
    -    true
    -    $(DefaultPlatformToolset)
    -  
    -  
    -  
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -    
    -    
    -  
    -  
    -  
    -    <_ProjectFileVersion>10.0.30319.1
    -    $(PlatformName)\xml\$(Configuration)\
    -    $(PlatformName)\xml\$(Configuration)\
    -    $(PlatformName)\xml\$(Configuration)\
    -    $(PlatformName)\xml\$(Configuration)\
    -  
    -  
    -    
    -      MaxSpeed
    -      OnlyExplicitInline
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\;%(AdditionalIncludeDirectories)
    -      WIN32;NDEBUG;_WINDOWS;VERSION="expat_1.95.2";%(PreprocessorDefinitions)
    -      true
    -      MultiThreadedDLL
    -      true
    -      Level3
    -      true
    -      4244;%(DisableSpecificWarnings)
    -    
    -    
    -      0x0409
    -    
    -    
    -      true
    -    
    -    
    -      true
    -    
    -  
    -  
    -    
    -      X64
    -    
    -    
    -      MaxSpeed
    -      OnlyExplicitInline
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\;%(AdditionalIncludeDirectories)
    -      WIN32;NDEBUG;_WINDOWS;VERSION="expat_1.95.2";%(PreprocessorDefinitions)
    -      true
    -      MultiThreadedDLL
    -      true
    -      Level3
    -      true
    -      4244;%(DisableSpecificWarnings)
    -    
    -    
    -      0x0409
    -    
    -    
    -      true
    -    
    -    
    -      true
    -    
    -  
    -  
    -    
    -      /EHsc  %(AdditionalOptions)
    -      Disabled
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\;%(AdditionalIncludeDirectories)
    -      WIN32;_DEBUG;_WINDOWS;VERSION="expat_1.95.2";%(PreprocessorDefinitions)
    -      MultiThreadedDebugDLL
    -      Level3
    -      true
    -      4244;%(DisableSpecificWarnings)
    -    
    -    
    -      0x0409
    -    
    -    
    -      true
    -    
    -    
    -      true
    -    
    -  
    -  
    -    
    -      X64
    -    
    -    
    -      /EHsc  %(AdditionalOptions)
    -      Disabled
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\;%(AdditionalIncludeDirectories)
    -      WIN32;_DEBUG;_WINDOWS;VERSION="expat_1.95.2";%(PreprocessorDefinitions)
    -      MultiThreadedDebugDLL
    -      Level3
    -      true
    -      4244;%(DisableSpecificWarnings)
    -    
    -    
    -      0x0409
    -    
    -    
    -      true
    -    
    -    
    -      true
    -    
    -  
    -  
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -    
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -      true
    -      %(AdditionalIncludeDirectories)
    -      %(PreprocessorDefinitions)
    -    
    -  
    -  
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -      Creating config.h from winconfig.h
    -      if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h" > "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h"
    -
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\config.h;%(Outputs)
    -      Creating config.h from winconfig.h
    -      if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h" > "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h"
    -
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\config.h;%(Outputs)
    -      Creating config.h from winconfig.h
    -      if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h" > "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h"
    -
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\config.h;%(Outputs)
    -      Creating config.h from winconfig.h
    -      if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\winconfig.h" > "$(ProjectDir)..\..\apr-util\xml\expat\lib\config.h"
    -
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\config.h;%(Outputs)
    -    
    -  
    -  
    -    
    -      Creating expat.h from expat.h.in
    -      if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in" > "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h"
    -
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h;%(Outputs)
    -      Creating expat.h from expat.h.in
    -      if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in" > "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h"
    -
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h;%(Outputs)
    -      Creating expat.h from expat.h.in
    -      if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in" > "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h"
    -
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h;%(Outputs)
    -      Creating expat.h from expat.h.in
    -      if not exist "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h" type "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h.in" > "$(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h"
    -
    -      $(ProjectDir)..\..\apr-util\xml\expat\lib\expat.h;%(Outputs)
    -    
    -    
    -  
    -  
    -  
    -  
    -
    \ No newline at end of file
    diff --git a/libs/win32/apr/libapr.2017.vcxproj b/libs/win32/apr/libapr.2017.vcxproj
    index 6171b2afa7..c616dc9267 100644
    --- a/libs/win32/apr/libapr.2017.vcxproj
    +++ b/libs/win32/apr/libapr.2017.vcxproj
    @@ -73,7 +73,7 @@
       
       
         
    -      if not exist "$(ProjectDir)..\..\apr\include\apr.h" type "$(ProjectDir)apr.hw" > "$(ProjectDir)..\..\apr\include\apr.h"
    +      if not exist "$(ProjectDir)..\..\apr\include\fspr.h" type "$(ProjectDir)fspr.hw" > "$(ProjectDir)..\..\apr\include\fspr.h"
     xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y
     
         
    @@ -109,7 +109,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /
       
       
         
    -      if not exist "$(ProjectDir)..\..\apr\include\apr.h" type "$(ProjectDir)apr.hw" > "$(ProjectDir)..\..\apr\include\apr.h"
    +      if not exist "$(ProjectDir)..\..\apr\include\fspr.h" type "$(ProjectDir)fspr.hw" > "$(ProjectDir)..\..\apr\include\fspr.h"
     xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y
     
         
    @@ -143,7 +143,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /
       
       
         
    -      if not exist "$(ProjectDir)..\..\apr\include\apr.h" type "$(ProjectDir)apr.hw" > "$(ProjectDir)..\..\apr\include\apr.h"
    +      if not exist "$(ProjectDir)..\..\apr\include\fspr.h" type "$(ProjectDir)fspr.hw" > "$(ProjectDir)..\..\apr\include\fspr.h"
     xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y
     
         
    @@ -180,7 +180,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /
       
       
         
    -      if not exist "$(ProjectDir)..\..\apr\include\apr.h" type "$(ProjectDir)apr.hw" > "$(ProjectDir)..\..\apr\include\apr.h"
    +      if not exist "$(ProjectDir)..\..\apr\include\fspr.h" type "$(ProjectDir)fspr.hw" > "$(ProjectDir)..\..\apr\include\fspr.h"
     xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /Y
     
         
    @@ -216,7 +216,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /
         
       
       
    -    
    +    
         
         
         
    @@ -238,7 +238,7 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /
         
         
         
    -    
    +    
         
         
         
    @@ -260,19 +260,19 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /
         
         
         
    -    
    -    
    +    
    +    
         
         
         
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
         
         
         
    @@ -284,52 +284,52 @@ xcopy "$(ProjectDir)..\..\apr\include\*.h" "$(ProjectDir)..\..\include\" /C /D /
         
       
       
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
       
       
         
    diff --git a/src/mod/languages/mod_managed/mod_managed.2017.vcxproj b/src/mod/languages/mod_managed/mod_managed.2017.vcxproj
    index 7722567b1c..97aff02a01 100644
    --- a/src/mod/languages/mod_managed/mod_managed.2017.vcxproj
    +++ b/src/mod/languages/mod_managed/mod_managed.2017.vcxproj
    @@ -155,7 +155,7 @@
           MultiThreadedDebugDLL
           
           
    -      4505;%(DisableSpecificWarnings)
    +      4505;6553;%(DisableSpecificWarnings)
           true
         
         
    @@ -178,7 +178,7 @@
           
           
           true
    -      4505;%(DisableSpecificWarnings)
    +      4505;6553;%(DisableSpecificWarnings)
         
         
           shlwapi.lib;mscoree.lib;%(AdditionalDependencies)
    @@ -196,7 +196,7 @@
           true
           
           
    -      4505;%(DisableSpecificWarnings)
    +      4505;6553;%(DisableSpecificWarnings)
           true
         
         
    @@ -217,7 +217,7 @@
           true
           
           
    -      4505;%(DisableSpecificWarnings)
    +      4505;6553;%(DisableSpecificWarnings)
         
         
           
    @@ -237,7 +237,7 @@
           
           
           true
    -      4505;%(DisableSpecificWarnings)
    +      4505;6553;%(DisableSpecificWarnings)
         
         
           shlwapi.lib;mono.lib;C:\program Files\Mono\lib\glib-2.0.lib;%(AdditionalDependencies)
    @@ -261,7 +261,7 @@
           
           
           true
    -      4505;%(DisableSpecificWarnings)
    +      4505;6553;%(DisableSpecificWarnings)
         
         
           shlwapi.lib;mono.lib;C:\program Files\Mono\lib\glib-2.0.lib;%(AdditionalDependencies)
    @@ -283,7 +283,7 @@
           
           
           Level3
    -      4505;%(DisableSpecificWarnings)
    +      4505;6553;%(DisableSpecificWarnings)
         
         
           
    @@ -305,7 +305,7 @@
           
           
           Level3
    -      4505;%(DisableSpecificWarnings)
    +      4505;6553;%(DisableSpecificWarnings)
         
         
           
    diff --git a/src/switch_apr.c b/src/switch_apr.c
    index 6cf1c86277..9bc5d8a759 100644
    --- a/src/switch_apr.c
    +++ b/src/switch_apr.c
    @@ -77,7 +77,9 @@
     #include 
     #endif
     
    +#ifndef WIN32
     #include 
    +#endif
     
     /* apr stubs */
     
    diff --git a/src/switch_apr_queue.c b/src/switch_apr_queue.c
    index 7d3e91b440..3fddf007d6 100644
    --- a/src/switch_apr_queue.c
    +++ b/src/switch_apr_queue.c
    @@ -14,6 +14,7 @@
      * limitations under the License.
      */
     
    +#include 
     #include 
     #include 
     #include 
    diff --git a/src/switch_time.c b/src/switch_time.c
    index 60bf28866e..44c1edbcce 100644
    --- a/src/switch_time.c
    +++ b/src/switch_time.c
    @@ -179,7 +179,7 @@ static void do_sleep(switch_interval_time_t t)
     	ts.tv_nsec = (t % APR_USEC_PER_SEC) * 850;
     	nanosleep(&ts, NULL);
     #else
    -	apr_sleep(t);
    +	fspr_sleep(t);
     #endif
     
     #if defined(DARWIN)
    diff --git a/src/switch_xml.c b/src/switch_xml.c
    index 108473918f..c43a530252 100644
    --- a/src/switch_xml.c
    +++ b/src/switch_xml.c
    @@ -63,7 +63,7 @@
     #include 
     #else /* we're on windoze :( */
     /* glob functions at end of this file */
    -#include 
    +#include 
     
     typedef struct {
     	size_t gl_pathc;			/* Count of total paths so far. */
    @@ -3626,19 +3626,19 @@ static int glob2(char *pathbuf, char *pathend, char *pathend_last, char *pattern
     static int glob3(char *pathbuf, char *pathend, char *pathend_last, char *pattern, char *restpattern, glob_t *pglob, size_t *limit)
     {
     	int err;
    -	apr_dir_t *dirp;
    -	apr_pool_t *pool;
    +	fspr_dir_t *dirp;
    +	fspr_pool_t *pool;
     
    -	apr_pool_create(&pool, NULL);
    +	fspr_pool_create(&pool, NULL);
     
     	if (pathend > pathend_last)
     		return (GLOB_ABORTED);
     	*pathend = EOS;
     	errno = 0;
     
    -	if (apr_dir_open(&dirp, pathbuf, pool) != APR_SUCCESS) {
    +	if (fspr_dir_open(&dirp, pathbuf, pool) != APR_SUCCESS) {
     		/* TODO: don't call for ENOENT or ENOTDIR? */
    -		apr_pool_destroy(pool);
    +		fspr_pool_destroy(pool);
     		if (pglob->gl_errfunc) {
     			if (pglob->gl_errfunc(pathbuf, errno) || pglob->gl_flags & GLOB_ERR)
     				return (GLOB_ABORTED);
    @@ -3650,11 +3650,11 @@ static int glob3(char *pathbuf, char *pathend, char *pathend_last, char *pattern
     
     	/* Search directory for matching names. */
     	while (dirp) {
    -		apr_finfo_t dp;
    +		fspr_finfo_t dp;
     		unsigned char *sc;
     		char *dc;
     
    -		if (apr_dir_read(&dp, APR_FINFO_NAME, dirp) != APR_SUCCESS)
    +		if (fspr_dir_read(&dp, APR_FINFO_NAME, dirp) != APR_SUCCESS)
     			break;
     		if (!(dp.valid & APR_FINFO_NAME) || !(dp.name) || !strlen(dp.name))
     			break;
    @@ -3677,8 +3677,8 @@ static int glob3(char *pathbuf, char *pathend, char *pathend_last, char *pattern
     	}
     
     	if (dirp)
    -		apr_dir_close(dirp);
    -	apr_pool_destroy(pool);
    +		fspr_dir_close(dirp);
    +	fspr_pool_destroy(pool);
     	return (err);
     }
     
    diff --git a/w32/Library/FreeSwitchCore.2017.vcxproj b/w32/Library/FreeSwitchCore.2017.vcxproj
    index 68450d79dd..642a01a259 100644
    --- a/w32/Library/FreeSwitchCore.2017.vcxproj
    +++ b/w32/Library/FreeSwitchCore.2017.vcxproj
    @@ -311,6 +311,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\"
         
         
         
    +    
         
           Create
           Create
    @@ -799,10 +800,6 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\"
           {eef031cb-fed8-451e-a471-91ec8d4f6750}
           false
         
    -    
    -      {f057da7f-79e5-4b00-845c-ef446ef055e3}
    -      false
    -    
         
           {f6c55d93-b927-4483-bb69-15aef3dd2dff}
           false
    
    From 193316b244a22df1a8a2c7986e2924f1937c345c Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Mon, 29 Aug 2022 17:50:06 +0300
    Subject: [PATCH 054/155] [Build-System] Remove mod_unimrcp from the Windows
     build.
    
    ---
     Freeswitch.2017.sln                | 14 ---------
     libs/win32/apr/{apr.hw => fspr.hw} | 50 +++++++++++++++---------------
     w32/Setup/Setup.2017.wixproj       | 16 ----------
     3 files changed, 25 insertions(+), 55 deletions(-)
     rename libs/win32/apr/{apr.hw => fspr.hw} (92%)
    
    diff --git a/Freeswitch.2017.sln b/Freeswitch.2017.sln
    index 46fc1a7e88..e99c333c3d 100644
    --- a/Freeswitch.2017.sln
    +++ b/Freeswitch.2017.sln
    @@ -370,8 +370,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libbroadvoice", "libs\win32
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_bv", "src\mod\codecs\mod_bv\mod_bv.2017.vcxproj", "{D5C87B19-150D-4EF3-A671-96589BD2D14A}"
     EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_unimrcp", "src\mod\asr_tts\mod_unimrcp\mod_unimrcp.2017.vcxproj", "{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}"
    -EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcelt", "libs\win32\celt\libcelt.2017.vcxproj", "{ABB71A76-42B0-47A4-973A-42E3D920C6FD}"
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FSComm", "fscomm\FSComm.2017.vcxproj", "{7D3122C7-C9D0-3748-81F8-F0DDCB40BF5E}"
    @@ -1622,17 +1620,6 @@ Global
     		{D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|Win32.Build.0 = Release|Win32
     		{D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64.ActiveCfg = Release|x64
     		{D5C87B19-150D-4EF3-A671-96589BD2D14A}.Release|x64.Build.0 = Release|x64
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|Win32.ActiveCfg = Release|x64
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64.ActiveCfg = Release|x64
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.All|x64.Build.0 = Release|x64
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|Win32.ActiveCfg = Debug|Win32
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|Win32.Build.0 = Debug|Win32
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x64.ActiveCfg = Debug|x64
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Debug|x64.Build.0 = Debug|x64
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|Win32.ActiveCfg = Release|Win32
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|Win32.Build.0 = Release|Win32
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64.ActiveCfg = Release|x64
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD}.Release|x64.Build.0 = Release|x64
     		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|Win32.ActiveCfg = Release|x64
     		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64.ActiveCfg = Release|x64
     		{ABB71A76-42B0-47A4-973A-42E3D920C6FD}.All|x64.Build.0 = Release|x64
    @@ -2661,7 +2648,6 @@ Global
     		{432DB165-1EB2-4781-A9C0-71E62610B20A} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
     		{CF70F278-3364-4395-A2E1-23501C9B8AD2} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{D5C87B19-150D-4EF3-A671-96589BD2D14A} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
    -		{D07C378A-F5F7-438F-ADF3-4AC4FB1883CD} = {4CF6A6AC-07DE-4B9E-ABE1-7F98B64E0BB0}
     		{ABB71A76-42B0-47A4-973A-42E3D920C6FD} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{EF300386-A8DF-4372-B6D8-FB9BFFCA9AED} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
     		{AFA983D6-4569-4F88-BA94-555ED00FD9A8} = {F881ADA2-2F1A-4046-9FEB-191D9422D781}
    diff --git a/libs/win32/apr/apr.hw b/libs/win32/apr/fspr.hw
    similarity index 92%
    rename from libs/win32/apr/apr.hw
    rename to libs/win32/apr/fspr.hw
    index 27be40106e..a9c7eab316 100644
    --- a/libs/win32/apr/apr.hw
    +++ b/libs/win32/apr/fspr.hw
    @@ -106,7 +106,7 @@
     #endif /* !_WINDOWS_ */
     
     /**
    - * @defgroup apr_platform Platform Definitions
    + * @defgroup fspr_platform Platform Definitions
      * @ingroup APR 
      * @{
      */
    @@ -275,7 +275,7 @@ extern "C" {
     #endif
     
     /**
    - * @addtogroup apr_platform
    + * @addtogroup fspr_platform
      * @ingroup APR 
      * @{
      */
    @@ -322,29 +322,29 @@ extern "C" {
     
     /* Typedefs that APR needs. */
     
    -typedef  unsigned char     apr_byte_t;
    +typedef  unsigned char     fspr_byte_t;
     
    -typedef  short             apr_int16_t;
    -typedef  unsigned short    apr_uint16_t;
    +typedef  short             fspr_int16_t;
    +typedef  unsigned short    fspr_uint16_t;
                                                    
    -typedef  int               apr_int32_t;
    -typedef  unsigned int      apr_uint32_t;
    +typedef  int               fspr_int32_t;
    +typedef  unsigned int      fspr_uint32_t;
                                                    
    -typedef  __int64           apr_int64_t;
    -typedef  unsigned __int64  apr_uint64_t;
    +typedef  __int64           fspr_int64_t;
    +typedef  unsigned __int64  fspr_uint64_t;
     
    -typedef  size_t      apr_size_t;
    +typedef  size_t      fspr_size_t;
     #if APR_HAVE_STDDEF_H
    -typedef  ptrdiff_t   apr_ssize_t;
    +typedef  ptrdiff_t   fspr_ssize_t;
     #else
    -typedef  int         apr_ssize_t;
    +typedef  int         fspr_ssize_t;
     #endif
     #if APR_HAS_LARGE_FILES
    -typedef  __int64     apr_off_t;
    +typedef  __int64     fspr_off_t;
     #else
    -typedef  int         apr_off_t;
    +typedef  int         fspr_off_t;
     #endif
    -typedef  int         apr_socklen_t;
    +typedef  int         fspr_socklen_t;
     
     /* Are we big endian? */
     /* XXX: Fatal assumption on Alpha platforms */
    @@ -356,7 +356,7 @@ typedef  int         apr_socklen_t;
     #define APR_SIZEOF_VOIDP   4
     #endif
     
    -/* XXX These simply don't belong here, perhaps in apr_portable.h
    +/* XXX These simply don't belong here, perhaps in fspr_portable.h
      * based on some APR_HAVE_PID/GID/UID?
      */
     typedef  int         pid_t;
    @@ -378,8 +378,8 @@ typedef  int         gid_t;
     
     #ifndef WS2TCPIP_INLINE
     #define IN6_IS_ADDR_V4MAPPED(a) \
    -    (   (*(const apr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \
    -     && (*(const apr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
    +    (   (*(const fspr_uint64_t *)(const void *)(&(a)->s6_addr[0]) == 0) \
    +     && (*(const fspr_uint32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
     #endif
     
     #endif /* APR_HAS_IPV6 */
    @@ -391,7 +391,7 @@ typedef  int         gid_t;
      * so that they follow the platform's calling convention.
      * @example
      */
    -/** void* APR_THREAD_FUNC my_thread_entry_fn(apr_thread_t *thd, void *data);
    +/** void* APR_THREAD_FUNC my_thread_entry_fn(fspr_thread_t *thd, void *data);
      */
     #define APR_THREAD_FUNC  __stdcall
     
    @@ -406,7 +406,7 @@ typedef  int         gid_t;
      * @remark Both the declaration and implementations must use the same macro.
      * @example
      */
    -/** APR_DECLARE(rettype) apr_func(args)
    +/** APR_DECLARE(rettype) fspr_func(args)
      * @see APR_DECLARE_NONSTD @see APR_DECLARE_DATA
      * @remark Note that when APR compiles the library itself, it passes the 
      * symbol -DAPR_DECLARE_EXPORT to the compiler on some platforms (e.g. Win32) 
    @@ -427,7 +427,7 @@ typedef  int         gid_t;
      * @remark Both the declaration and implementations must use the same macro.
      * @example
      */
    -/** APR_DECLARE_NONSTD(rettype) apr_func(args, ...);
    +/** APR_DECLARE_NONSTD(rettype) fspr_func(args, ...);
      */
     #define APR_DECLARE_NONSTD(type)     type
     
    @@ -439,8 +439,8 @@ typedef  int         gid_t;
      * but both must include the macro.
      * @example
      */
    -/** extern APR_DECLARE_DATA type apr_variable;\n
    - * APR_DECLARE_DATA type apr_variable = value;
    +/** extern APR_DECLARE_DATA type fspr_variable;\n
    + * APR_DECLARE_DATA type fspr_variable = value;
      */
     #define APR_DECLARE_DATA
     
    @@ -484,12 +484,12 @@ typedef  int         gid_t;
     /* No difference between PROC and GLOBAL mutex */
     #define APR_PROC_MUTEX_IS_GLOBAL      1
     
    -typedef int apr_wait_t;
    +typedef int fspr_wait_t;
     
     /* struct iovec is needed to emulate Unix writev */
     struct iovec {
         char*      iov_base;
    -    apr_size_t iov_len;
    +    fspr_size_t iov_len;
     };
     
     /* Nasty Win32 .h ommissions we really need */
    diff --git a/w32/Setup/Setup.2017.wixproj b/w32/Setup/Setup.2017.wixproj
    index 8b6b616b2d..dd745e8438 100644
    --- a/w32/Setup/Setup.2017.wixproj
    +++ b/w32/Setup/Setup.2017.wixproj
    @@ -385,14 +385,6 @@
           Binaries;Content;Satellites
           INSTALLFOLDER
         
    -    
    -      mod_unimrcp
    -      {d07c378a-f5f7-438f-adf3-4ac4fb1883cd}
    -      True
    -      True
    -      Binaries;Content;Satellites
    -      INSTALLFOLDER
    -    
         
           mod_amr
           {8deb383c-4091-4f42-a56f-c9e46d552d79}
    @@ -529,14 +521,6 @@
           Binaries;Content;Satellites
           INSTALLFOLDER
         
    -    
    -      mod_dingaling
    -      {ffaa4c52-3a53-4f99-90c1-d59d1f0427f3}
    -      True
    -      True
    -      Binaries;Content;Satellites
    -      INSTALLFOLDER
    -    
         
           mod_gsmopen
           {74b120ff-6935-4dfe-a142-cdb6bea99c90}
    
    From 9311ee7dc2ec6ca6292c7bf3f44c3ab970e71608 Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Mon, 29 Aug 2022 18:23:14 +0300
    Subject: [PATCH 055/155] [Build-System] Remove dingaling.conf.xml
    
    ---
     Freeswitch.2017.sln                              | 1 -
     conf/vanilla/autoload_configs/dingaling.conf.xml | 9 ---------
     2 files changed, 10 deletions(-)
     delete mode 100644 conf/vanilla/autoload_configs/dingaling.conf.xml
    
    diff --git a/Freeswitch.2017.sln b/Freeswitch.2017.sln
    index e99c333c3d..6b6f24055e 100644
    --- a/Freeswitch.2017.sln
    +++ b/Freeswitch.2017.sln
    @@ -69,7 +69,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "autoload_configs", "autoloa
     		conf\vanilla\autoload_configs\conference.conf.xml = conf\vanilla\autoload_configs\conference.conf.xml
     		conf\vanilla\autoload_configs\console.conf.xml = conf\vanilla\autoload_configs\console.conf.xml
     		conf\vanilla\autoload_configs\dialplan_directory.conf.xml = conf\vanilla\autoload_configs\dialplan_directory.conf.xml
    -		conf\vanilla\autoload_configs\dingaling.conf.xml = conf\vanilla\autoload_configs\dingaling.conf.xml
     		conf\vanilla\autoload_configs\enum.conf.xml = conf\vanilla\autoload_configs\enum.conf.xml
     		conf\vanilla\autoload_configs\event_multicast.conf.xml = conf\vanilla\autoload_configs\event_multicast.conf.xml
     		conf\vanilla\autoload_configs\event_socket.conf.xml = conf\vanilla\autoload_configs\event_socket.conf.xml
    diff --git a/conf/vanilla/autoload_configs/dingaling.conf.xml b/conf/vanilla/autoload_configs/dingaling.conf.xml
    deleted file mode 100644
    index dd6c9a5da1..0000000000
    --- a/conf/vanilla/autoload_configs/dingaling.conf.xml
    +++ /dev/null
    @@ -1,9 +0,0 @@
    -
    -  
    -    
    -    
    -  
    -
    -  
    -
    -
    
    From 91799e0fc78aa68f41c7dd78e9892761ac51e871 Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Tue, 30 Aug 2022 00:17:52 +0300
    Subject: [PATCH 056/155] [mod_ssml] Add deps rule to the Makefile.am
    
    ---
     src/mod/formats/mod_ssml/Makefile.am | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
    diff --git a/src/mod/formats/mod_ssml/Makefile.am b/src/mod/formats/mod_ssml/Makefile.am
    index 9a54b5e710..c3a6d83710 100644
    --- a/src/mod/formats/mod_ssml/Makefile.am
    +++ b/src/mod/formats/mod_ssml/Makefile.am
    @@ -26,6 +26,8 @@ TESTS = $(noinst_PROGRAMS)
     
     BUILT_SOURCES=$(IKS_LA)
     
    -$(IKS_LA): $(IKS_DIR) $(IKS_DIR)/.update
    +$(IKS_LA): $(IKS_BUILDDIR) $(IKS_DIR) $(IKS_DIR)/.update
     	@cd $(IKS_DIR) && $(MAKE)
     	@$(TOUCH_TARGET)
    +
    +deps: $(IKS_LA)
    
    From 6d73982cf4a77f8798fa91d501922edceefa75fd Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Tue, 30 Aug 2022 01:08:39 +0300
    Subject: [PATCH 057/155] [Build-System] mrcp: cleanup freeswitch.spec
    
    ---
     freeswitch.spec | 6 +-----
     1 file changed, 1 insertion(+), 5 deletions(-)
    
    diff --git a/freeswitch.spec b/freeswitch.spec
    index 8672b4fc59..7dfb92962a 100644
    --- a/freeswitch.spec
    +++ b/freeswitch.spec
    @@ -1792,9 +1792,7 @@ fi
     %dir %attr(0750, freeswitch, daemon) %{sysconfdir}/dialplan/skinny-patterns
     %dir %attr(0750, freeswitch, daemon) %{sysconfdir}/directory
     %dir %attr(0750, freeswitch, daemon) %{sysconfdir}/directory/default
    -%dir %attr(0750, freeswitch, daemon) %{sysconfdir}/jingle_profiles
     %dir %attr(0750, freeswitch, daemon) %{sysconfdir}/lang
    -%dir %attr(0750, freeswitch, daemon) %{sysconfdir}/mrcp_profiles
     %dir %attr(0750, freeswitch, daemon) %{sysconfdir}/sip_profiles
     %dir %attr(0750, freeswitch, daemon) %{sysconfdir}/sip_profiles/external
     %dir %attr(0750, freeswitch, daemon) %{sysconfdir}/sip_profiles/external-ipv6
    @@ -1995,11 +1993,9 @@ fi
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/sip_profiles/external/*.xml
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/sip_profiles/external-ipv6/*.xml
     ######################################################################################################################
    -#				Other Protocol Profiles (skinny, jingle, mrcp)
    +#				Other Protocol Profiles (skinny)
     ######################################################################################################################
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/skinny_profiles/*.xml
    -%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/jingle_profiles/*.xml
    -%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/mrcp_profiles/*.xml
     ######################################################################################################################
     #						Grammar Files
     ######################################################################################################################
    
    From 6d208d311501cd9a47d6e14d99546c04cc719a6b Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Tue, 30 Aug 2022 01:41:22 +0300
    Subject: [PATCH 058/155] [Configuration] Remove jingle_profiles
    
    ---
     conf/vanilla/jingle_profiles/client.xml | 36 -------------------------
     conf/vanilla/jingle_profiles/server.xml | 21 ---------------
     2 files changed, 57 deletions(-)
     delete mode 100644 conf/vanilla/jingle_profiles/client.xml
     delete mode 100644 conf/vanilla/jingle_profiles/server.xml
    
    diff --git a/conf/vanilla/jingle_profiles/client.xml b/conf/vanilla/jingle_profiles/client.xml
    deleted file mode 100644
    index 20a8dd809d..0000000000
    --- a/conf/vanilla/jingle_profiles/client.xml
    +++ /dev/null
    @@ -1,36 +0,0 @@
    -
    -  
    -  
    -  
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -
    -    
    -    
    -
    -  
    -
    diff --git a/conf/vanilla/jingle_profiles/server.xml b/conf/vanilla/jingle_profiles/server.xml
    deleted file mode 100644
    index b60dc27ea6..0000000000
    --- a/conf/vanilla/jingle_profiles/server.xml
    +++ /dev/null
    @@ -1,21 +0,0 @@
    -
    -  
    -  
    -  
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -    
    -  
    -
    
    From 741d1632844eec670d1ab31cc074e7011a2431d3 Mon Sep 17 00:00:00 2001
    From: Len 
    Date: Tue, 6 Sep 2022 11:16:20 -0400
    Subject: [PATCH 059/155] [Configuration] Add vanilla autoload_configs
     signalwire.conf.xml
    
    ---
     conf/vanilla/autoload_configs/signalwire.conf.xml | 14 ++++++++++++++
     1 file changed, 14 insertions(+)
     create mode 100644 conf/vanilla/autoload_configs/signalwire.conf.xml
    
    diff --git a/conf/vanilla/autoload_configs/signalwire.conf.xml b/conf/vanilla/autoload_configs/signalwire.conf.xml
    new file mode 100644
    index 0000000000..86e7056c7b
    --- /dev/null
    +++ b/conf/vanilla/autoload_configs/signalwire.conf.xml
    @@ -0,0 +1,14 @@
    +
    +  
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +    
    +  
    +
    
    From 82cec3104ea63bd91182454aee84ab61e5fce7cb Mon Sep 17 00:00:00 2001
    From: Len 
    Date: Tue, 6 Sep 2022 15:30:35 -0400
    Subject: [PATCH 060/155] [Build-System] Add signalwire.conf.xml to the
     freeswitch.spec
    
    ---
     freeswitch.spec | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/freeswitch.spec b/freeswitch.spec
    index 7dfb92962a..769859ea16 100644
    --- a/freeswitch.spec
    +++ b/freeswitch.spec
    @@ -1939,6 +1939,7 @@ fi
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/rtmp.conf.xml
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/sangoma_codec.conf.xml
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/shout.conf.xml
    +%config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/signalwire.conf.xml
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/skinny.conf.xml
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/smpp.conf.xml
     %config(noreplace) %attr(0640, freeswitch, daemon) %{sysconfdir}/autoload_configs/sms_flowroute.conf.xml
    
    From 71aa3cb03ca4ddc004c36419362b64fc385bdb17 Mon Sep 17 00:00:00 2001
    From: Jakub Karolczyk 
    Date: Fri, 9 Sep 2022 11:07:19 +0100
    Subject: [PATCH 061/155] [mod_sofia] Fix handling of late offer
    
    ---
     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 82f990d906..9022039eb3 100644
    --- a/src/mod/endpoints/mod_sofia/sofia.c
    +++ b/src/mod/endpoints/mod_sofia/sofia.c
    @@ -8576,7 +8576,11 @@ static void sofia_handle_sip_i_state(switch_core_session_t *session, int status,
     				if (!tech_pvt) goto done;
     
     				if (tech_pvt->mparams.num_codecs) {
    -					match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE);
    +					if (sofia_test_flag(tech_pvt, TFLAG_GOT_ACK)) {
    +						match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_REQUEST);
    +					} else {
    +						match = sofia_media_negotiate_sdp(session, r_sdp, SDP_TYPE_RESPONSE);
    +					}
     				}
     
     				if (match) {
    
    From c71ed98addfe7ab5445d0abe49f8fb8f91e1d8b1 Mon Sep 17 00:00:00 2001
    From: Clock 
    Date: Wed, 5 Oct 2022 01:19:10 +0800
    Subject: [PATCH 062/155] [mod_shout] Replace space with tab in Makefile.am
    
    ---
     src/mod/formats/mod_shout/Makefile.am | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/mod/formats/mod_shout/Makefile.am b/src/mod/formats/mod_shout/Makefile.am
    index 7fd8e01ab3..ace4ce4af4 100644
    --- a/src/mod/formats/mod_shout/Makefile.am
    +++ b/src/mod/formats/mod_shout/Makefile.am
    @@ -16,7 +16,7 @@ else
     install: error
     all: error
     error:
    -       $(error You must install libmp3lame-dev to build mod_shout)
    +	$(error You must install libmp3lame-dev to build mod_shout)
     endif
     
     else
    
    From 9c7c77e259a70817aacbbe1711f1bfbd01c33694 Mon Sep 17 00:00:00 2001
    From: "Konstantin S. Vishnivetsky" 
    Date: Thu, 6 Oct 2022 13:12:05 +0400
    Subject: [PATCH 063/155] [fs_cli] Add: -s key adding log events filter UUID on
     fs_cli startup
    
    * Add: -s key adding log events filter UUID on fs_cli startup
    * Add: long option --set-log-uuid
    ---
     libs/esl/fs_cli.c | 12 ++++++++++--
     1 file changed, 10 insertions(+), 2 deletions(-)
    
    diff --git a/libs/esl/fs_cli.c b/libs/esl/fs_cli.c
    index 76e85b450d..973df741e0 100644
    --- a/libs/esl/fs_cli.c
    +++ b/libs/esl/fs_cli.c
    @@ -632,7 +632,8 @@ static const char *usage_str =
     	"  -b, --batchmode                 Batch mode\n"
     	"  -t, --timeout                   Timeout for API commands (in milliseconds)\n"
     	"  -T, --connect-timeout           Timeout for socket connection (in milliseconds)\n"
    -	"  -n, --no-color                  Disable color\n\n";
    +	"  -n, --no-color                  Disable color\n"
    +	"  -s, --set-log-uuid              Set UUID to filter log events\n\n";
     
     static int usage(char *name){
     	printf(usage_str, name);
    @@ -1468,6 +1469,7 @@ int main(int argc, char *argv[])
     		{"reconnect", 0, 0, 'R'},
     		{"timeout", 1, 0, 't'},
     		{"connect-timeout", 1, 0, 'T'},
    +		{"set-log-uuid", 1, 0, 's'},
     		{0, 0, 0, 0}
     	};
     	char temp_host[128];
    @@ -1483,6 +1485,7 @@ int main(int argc, char *argv[])
     	int argv_exec = 0;
     	char argv_command[1024] = "";
     	char argv_loglevel[127] = "";
    +	char argv_filter_uuid[64] = {0};
     	int argv_log_uuid = 0;
     	int argv_log_uuid_short = 0;
     	int argv_quiet = 0;
    @@ -1539,7 +1542,7 @@ int main(int argc, char *argv[])
     	esl_global_set_default_logger(6); /* default debug level to 6 (info) */
     	for(;;) {
     		int option_index = 0;
    -		opt = getopt_long(argc, argv, "H:P:u:p:d:x:l:USt:T:qQrRhib?n", options, &option_index);
    +		opt = getopt_long(argc, argv, "H:P:u:p:d:x:l:USt:T:qQrRhib?ns:", options, &option_index);
     		if (opt == -1) break;
     		switch (opt) {
     			case 'H':
    @@ -1614,6 +1617,11 @@ int main(int argc, char *argv[])
     			case 'T':
     				connect_timeout = atoi(optarg);
     				break;
    +			case 's':
    +				esl_set_string(argv_filter_uuid, optarg);
    +				filter_uuid = strdup(argv_filter_uuid);
    +				break;
    +
     			case 'h':
     			case '?':
     				print_banner(stdout, is_color);
    
    From c6452cc8daf43619362a3fb3e230bcc2c71b68b6 Mon Sep 17 00:00:00 2001
    From: Dmitry Ukolov 
    Date: Thu, 6 Oct 2022 13:15:41 +0400
    Subject: [PATCH 064/155] [mod_sofia] Add db-spin-up-wait-ms profile parameter.
    
    ---
     conf/vanilla/sip_profiles/internal.xml  | 3 +++
     src/mod/endpoints/mod_sofia/mod_sofia.h | 1 +
     src/mod/endpoints/mod_sofia/sofia.c     | 5 ++++-
     3 files changed, 8 insertions(+), 1 deletion(-)
    
    diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml
    index 749e4b0687..5e38cfac1f 100644
    --- a/conf/vanilla/sip_profiles/internal.xml
    +++ b/conf/vanilla/sip_profiles/internal.xml
    @@ -239,6 +239,9 @@
         
         
     
    +    
    +    
    +
         
         
     
    diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h
    index 9c4da13a67..34ca3d66e4 100644
    --- a/src/mod/endpoints/mod_sofia/mod_sofia.h
    +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h
    @@ -727,6 +727,7 @@ struct sofia_profile {
     	uint32_t max_recv_requests_per_second;
     	uint32_t rtp_timeout_sec;
     	uint32_t rtp_hold_timeout_sec;
    +	uint32_t db_spin_up_wait_ms;
     	char *odbc_dsn;
     	char *pre_trans_execute;
     	char *post_trans_execute;
    diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c
    index 9022039eb3..dc52535e06 100644
    --- a/src/mod/endpoints/mod_sofia/sofia.c
    +++ b/src/mod/endpoints/mod_sofia/sofia.c
    @@ -4650,6 +4650,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
     					profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_2;
     					profile->tls_version |= SOFIA_TLS_VERSION_TLSv1_3;
     					profile->tls_timeout = 300;
    +					profile->db_spin_up_wait_ms = 1000;
     					profile->mflags = MFLAG_REFER | MFLAG_REGISTER;
     					profile->server_rport_level = 1;
     					profile->client_rport_level = 1;
    @@ -4788,6 +4789,8 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
     						}
     					} else if (!strcasecmp(var, "odbc-dsn") && !zstr(val)) {
     						profile->odbc_dsn = switch_core_strdup(profile->pool, val);
    +					} else if (!strcasecmp(var, "db-spin-up-wait-ms") && !zstr(val)) {
    +						profile->db_spin_up_wait_ms = atoi(val);
     					} else if (!strcasecmp(var, "db-pre-trans-execute") && !zstr(val)) {
     						profile->pre_trans_execute = switch_core_strdup(profile->pool, val);
     					} else if (!strcasecmp(var, "db-post-trans-execute") && !zstr(val)) {
    @@ -6351,7 +6354,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
     						launch_sofia_profile_thread(profile);
     						if (profile->odbc_dsn) {
     							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Connecting ODBC Profile %s [%s]\n", profile->name, url);
    -							switch_yield(1000000);
    +							switch_yield(profile->db_spin_up_wait_ms * 1000);
     						} else {
     							switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Started Profile %s [%s]\n", profile->name, url);
     						}
    
    From 5a399a50da301b539ad2f471f68fad3911ead797 Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Fri, 14 Oct 2022 18:11:17 +0000
    Subject: [PATCH 065/155] swigall
    
    ---
     src/mod/languages/mod_managed/managed/swig.cs | 426 +++++++++---------
     1 file changed, 213 insertions(+), 213 deletions(-)
    
    diff --git a/src/mod/languages/mod_managed/managed/swig.cs b/src/mod/languages/mod_managed/managed/swig.cs
    index 5586d3f981..06858aa6b9 100644
    --- a/src/mod/languages/mod_managed/managed/swig.cs
    +++ b/src/mod/languages/mod_managed/managed/swig.cs
    @@ -1001,35 +1001,6 @@ public class SWIGTYPE_p_a_2__icand_s {
     
     namespace FreeSWITCH.Native {
     
    -public class SWIGTYPE_p_apr_pool_t {
    -  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
    -
    -  internal SWIGTYPE_p_apr_pool_t(global::System.IntPtr cPtr, bool futureUse) {
    -    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
    -  }
    -
    -  protected SWIGTYPE_p_apr_pool_t() {
    -    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
    -  }
    -
    -  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_apr_pool_t obj) {
    -    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
    -  }
    -}
    -
    -}
    -//------------------------------------------------------------------------------
    -// 
    -//
    -// This file was automatically generated by SWIG (http://www.swig.org).
    -// Version 3.0.12
    -//
    -// Do not make changes to this file unless you know what you are doing--modify
    -// the SWIG interface file instead.
    -//------------------------------------------------------------------------------
    -
    -namespace FreeSWITCH.Native {
    -
     public class SWIGTYPE_p_cJSON {
       private global::System.Runtime.InteropServices.HandleRef swigCPtr;
     
    @@ -1117,18 +1088,18 @@ public class SWIGTYPE_p_f_p_p_switch_database_interface_handle__switch_status_t
     
     namespace FreeSWITCH.Native {
     
    -public class SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t {
    +public class SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t {
       private global::System.Runtime.InteropServices.HandleRef swigCPtr;
     
    -  internal SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) {
    +  internal SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t(global::System.IntPtr cPtr, bool futureUse) {
         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
       }
     
    -  protected SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t() {
    +  protected SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t() {
         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
       }
     
    -  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t obj) {
    +  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t obj) {
         return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
       }
     }
    @@ -2451,18 +2422,18 @@ public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event__switch_status_t
     
     namespace FreeSWITCH.Native {
     
    -public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t {
    +public class SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_fspr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t {
       private global::System.Runtime.InteropServices.HandleRef swigCPtr;
     
    -  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t(global::System.IntPtr cPtr, bool futureUse) {
    +  internal SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_fspr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t(global::System.IntPtr cPtr, bool futureUse) {
         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
       }
     
    -  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t() {
    +  protected SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_fspr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t() {
         swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
       }
     
    -  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t obj) {
    +  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_fspr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t obj) {
         return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
       }
     }
    @@ -4162,6 +4133,35 @@ public class SWIGTYPE_p_float {
     
     namespace FreeSWITCH.Native {
     
    +public class SWIGTYPE_p_fspr_pool_t {
    +  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
    +
    +  internal SWIGTYPE_p_fspr_pool_t(global::System.IntPtr cPtr, bool futureUse) {
    +    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
    +  }
    +
    +  protected SWIGTYPE_p_fspr_pool_t() {
    +    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
    +  }
    +
    +  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_fspr_pool_t obj) {
    +    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
    +  }
    +}
    +
    +}
    +//------------------------------------------------------------------------------
    +// 
    +//
    +// This file was automatically generated by SWIG (http://www.swig.org).
    +// Version 3.0.12
    +//
    +// Do not make changes to this file unless you know what you are doing--modify
    +// the SWIG interface file instead.
    +//------------------------------------------------------------------------------
    +
    +namespace FreeSWITCH.Native {
    +
     public class SWIGTYPE_p_in6_addr {
       private global::System.Runtime.InteropServices.HandleRef swigCPtr;
     
    @@ -4220,35 +4220,6 @@ public class SWIGTYPE_p_int {
     
     namespace FreeSWITCH.Native {
     
    -public class SWIGTYPE_p_p_apr_pool_t {
    -  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
    -
    -  internal SWIGTYPE_p_p_apr_pool_t(global::System.IntPtr cPtr, bool futureUse) {
    -    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
    -  }
    -
    -  protected SWIGTYPE_p_p_apr_pool_t() {
    -    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
    -  }
    -
    -  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_apr_pool_t obj) {
    -    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
    -  }
    -}
    -
    -}
    -//------------------------------------------------------------------------------
    -// 
    -//
    -// This file was automatically generated by SWIG (http://www.swig.org).
    -// Version 3.0.12
    -//
    -// Do not make changes to this file unless you know what you are doing--modify
    -// the SWIG interface file instead.
    -//------------------------------------------------------------------------------
    -
    -namespace FreeSWITCH.Native {
    -
     public class SWIGTYPE_p_p_cJSON {
       private global::System.Runtime.InteropServices.HandleRef swigCPtr;
     
    @@ -4307,6 +4278,35 @@ public class SWIGTYPE_p_p_char {
     
     namespace FreeSWITCH.Native {
     
    +public class SWIGTYPE_p_p_fspr_pool_t {
    +  private global::System.Runtime.InteropServices.HandleRef swigCPtr;
    +
    +  internal SWIGTYPE_p_p_fspr_pool_t(global::System.IntPtr cPtr, bool futureUse) {
    +    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(this, cPtr);
    +  }
    +
    +  protected SWIGTYPE_p_p_fspr_pool_t() {
    +    swigCPtr = new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero);
    +  }
    +
    +  internal static global::System.Runtime.InteropServices.HandleRef getCPtr(SWIGTYPE_p_p_fspr_pool_t obj) {
    +    return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
    +  }
    +}
    +
    +}
    +//------------------------------------------------------------------------------
    +// 
    +//
    +// This file was automatically generated by SWIG (http://www.swig.org).
    +// Version 3.0.12
    +//
    +// Do not make changes to this file unless you know what you are doing--modify
    +// the SWIG interface file instead.
    +//------------------------------------------------------------------------------
    +
    +namespace FreeSWITCH.Native {
    +
     public class SWIGTYPE_p_p_p_char {
       private global::System.Runtime.InteropServices.HandleRef swigCPtr;
     
    @@ -8374,16 +8374,16 @@ else
         return ret;
       }
     
    -  public static void switch_core_memory_pool_tag(SWIGTYPE_p_apr_pool_t pool, string tag) {
    -    freeswitchPINVOKE.switch_core_memory_pool_tag(SWIGTYPE_p_apr_pool_t.getCPtr(pool), tag);
    +  public static void switch_core_memory_pool_tag(SWIGTYPE_p_fspr_pool_t pool, string tag) {
    +    freeswitchPINVOKE.switch_core_memory_pool_tag(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), tag);
       }
     
       public static void switch_core_pool_stats(switch_stream_handle stream) {
         freeswitchPINVOKE.switch_core_pool_stats(switch_stream_handle.getCPtr(stream));
       }
     
    -  public static switch_status_t switch_core_perform_new_memory_pool(SWIGTYPE_p_p_apr_pool_t pool, string file, string func, int line) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_new_memory_pool(SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), file, func, line);
    +  public static switch_status_t switch_core_perform_new_memory_pool(SWIGTYPE_p_p_fspr_pool_t pool, string file, string func, int line) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_new_memory_pool(SWIGTYPE_p_p_fspr_pool_t.getCPtr(pool), file, func, line);
         return ret;
       }
     
    @@ -8392,17 +8392,17 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_core_perform_destroy_memory_pool(SWIGTYPE_p_p_apr_pool_t pool, string file, string func, int line) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_destroy_memory_pool(SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), file, func, line);
    +  public static switch_status_t switch_core_perform_destroy_memory_pool(SWIGTYPE_p_p_fspr_pool_t pool, string file, string func, int line) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_destroy_memory_pool(SWIGTYPE_p_p_fspr_pool_t.getCPtr(pool), file, func, line);
         return ret;
       }
     
    -  public static void switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t pool, string key, SWIGTYPE_p_void data) {
    -    freeswitchPINVOKE.switch_core_memory_pool_set_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key, SWIGTYPE_p_void.getCPtr(data));
    +  public static void switch_core_memory_pool_set_data(SWIGTYPE_p_fspr_pool_t pool, string key, SWIGTYPE_p_void data) {
    +    freeswitchPINVOKE.switch_core_memory_pool_set_data(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), key, SWIGTYPE_p_void.getCPtr(data));
       }
     
    -  public static SWIGTYPE_p_void switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t pool, string key) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_memory_pool_get_data(SWIGTYPE_p_apr_pool_t.getCPtr(pool), key);
    +  public static SWIGTYPE_p_void switch_core_memory_pool_get_data(SWIGTYPE_p_fspr_pool_t pool, string key) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_memory_pool_get_data(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), key);
         SWIGTYPE_p_void ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
         return ret;
       }
    @@ -8428,8 +8428,8 @@ else
         return ret;
       }
     
    -  public static SWIGTYPE_p_void switch_core_perform_alloc(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_switch_size_t memory, string file, string func, int line) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_perform_alloc(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_switch_size_t.getCPtr(memory), file, func, line);
    +  public static SWIGTYPE_p_void switch_core_perform_alloc(SWIGTYPE_p_fspr_pool_t pool, SWIGTYPE_p_switch_size_t memory, string file, string func, int line) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_perform_alloc(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), SWIGTYPE_p_switch_size_t.getCPtr(memory), file, func, line);
         SWIGTYPE_p_void ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_void(cPtr, false);
         if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
         return ret;
    @@ -8452,13 +8452,13 @@ else
         return ret;
       }
     
    -  public static string switch_core_perform_strdup(SWIGTYPE_p_apr_pool_t pool, string todup, string file, string func, int line) {
    -    string ret = freeswitchPINVOKE.switch_core_perform_strdup(SWIGTYPE_p_apr_pool_t.getCPtr(pool), todup, file, func, line);
    +  public static string switch_core_perform_strdup(SWIGTYPE_p_fspr_pool_t pool, string todup, string file, string func, int line) {
    +    string ret = freeswitchPINVOKE.switch_core_perform_strdup(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), todup, file, func, line);
         return ret;
       }
     
    -  public static string switch_core_perform_strndup(SWIGTYPE_p_apr_pool_t pool, string todup, uint len, string file, string func, int line) {
    -    string ret = freeswitchPINVOKE.switch_core_perform_strndup(SWIGTYPE_p_apr_pool_t.getCPtr(pool), todup, len, file, func, line);
    +  public static string switch_core_perform_strndup(SWIGTYPE_p_fspr_pool_t pool, string todup, uint len, string file, string func, int line) {
    +    string ret = freeswitchPINVOKE.switch_core_perform_strndup(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), todup, len, file, func, line);
         return ret;
       }
     
    @@ -8467,25 +8467,25 @@ else
         return ret;
       }
     
    -  public static string switch_core_sprintf(SWIGTYPE_p_apr_pool_t pool, string fmt) {
    -    string ret = freeswitchPINVOKE.switch_core_sprintf(SWIGTYPE_p_apr_pool_t.getCPtr(pool), fmt);
    +  public static string switch_core_sprintf(SWIGTYPE_p_fspr_pool_t pool, string fmt) {
    +    string ret = freeswitchPINVOKE.switch_core_sprintf(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), fmt);
         return ret;
       }
     
    -  public static SWIGTYPE_p_apr_pool_t switch_core_session_get_pool(SWIGTYPE_p_switch_core_session session) {
    +  public static SWIGTYPE_p_fspr_pool_t switch_core_session_get_pool(SWIGTYPE_p_switch_core_session session) {
         global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_get_pool(SWIGTYPE_p_switch_core_session.getCPtr(session));
    -    SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +    SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
         return ret;
       }
     
    -  public static SWIGTYPE_p_switch_core_session switch_core_session_request_xml(switch_endpoint_interface endpoint_interface, SWIGTYPE_p_p_apr_pool_t pool, switch_xml xml) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_xml(switch_endpoint_interface.getCPtr(endpoint_interface), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), switch_xml.getCPtr(xml));
    +  public static SWIGTYPE_p_switch_core_session switch_core_session_request_xml(switch_endpoint_interface endpoint_interface, SWIGTYPE_p_p_fspr_pool_t pool, switch_xml xml) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_xml(switch_endpoint_interface.getCPtr(endpoint_interface), SWIGTYPE_p_p_fspr_pool_t.getCPtr(pool), switch_xml.getCPtr(xml));
         SWIGTYPE_p_switch_core_session ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
         return ret;
       }
     
    -  public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, uint originate_flags, SWIGTYPE_p_p_apr_pool_t pool, string use_uuid) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, originate_flags, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), use_uuid);
    +  public static SWIGTYPE_p_switch_core_session switch_core_session_request_uuid(switch_endpoint_interface endpoint_interface, switch_call_direction_t direction, uint originate_flags, SWIGTYPE_p_p_fspr_pool_t pool, string use_uuid) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_uuid(switch_endpoint_interface.getCPtr(endpoint_interface), (int)direction, originate_flags, SWIGTYPE_p_p_fspr_pool_t.getCPtr(pool), use_uuid);
         SWIGTYPE_p_switch_core_session ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
         return ret;
       }
    @@ -8536,8 +8536,8 @@ else
         return ret;
       }
     
    -  public static SWIGTYPE_p_switch_core_session switch_core_session_request_by_name(string endpoint_name, switch_call_direction_t direction, SWIGTYPE_p_p_apr_pool_t pool) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_by_name(endpoint_name, (int)direction, SWIGTYPE_p_p_apr_pool_t.getCPtr(pool));
    +  public static SWIGTYPE_p_switch_core_session switch_core_session_request_by_name(string endpoint_name, switch_call_direction_t direction, SWIGTYPE_p_p_fspr_pool_t pool) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_session_request_by_name(endpoint_name, (int)direction, SWIGTYPE_p_p_fspr_pool_t.getCPtr(pool));
         SWIGTYPE_p_switch_core_session ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_switch_core_session(cPtr, false);
         return ret;
       }
    @@ -8677,8 +8677,8 @@ else
         return ret;
       }
     
    -  public static string switch_core_get_variable_pdup(string varname, SWIGTYPE_p_apr_pool_t pool) {
    -    string ret = freeswitchPINVOKE.switch_core_get_variable_pdup(varname, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static string switch_core_get_variable_pdup(string varname, SWIGTYPE_p_fspr_pool_t pool) {
    +    string ret = freeswitchPINVOKE.switch_core_get_variable_pdup(varname, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -8888,8 +8888,8 @@ else
         freeswitchPINVOKE.switch_core_service_session_av(SWIGTYPE_p_switch_core_session.getCPtr(session), (int)audio, (int)video);
       }
     
    -  public static switch_call_cause_t switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session session, switch_event var_event, string endpoint_name, switch_caller_profile caller_profile, SWIGTYPE_p_p_switch_core_session new_session, SWIGTYPE_p_p_apr_pool_t pool, uint flags, SWIGTYPE_p_switch_call_cause_t cancel_cause) {
    -    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_event.getCPtr(var_event), endpoint_name, switch_caller_profile.getCPtr(caller_profile), SWIGTYPE_p_p_switch_core_session.getCPtr(new_session), SWIGTYPE_p_p_apr_pool_t.getCPtr(pool), flags, SWIGTYPE_p_switch_call_cause_t.getCPtr(cancel_cause));
    +  public static switch_call_cause_t switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session session, switch_event var_event, string endpoint_name, switch_caller_profile caller_profile, SWIGTYPE_p_p_switch_core_session new_session, SWIGTYPE_p_p_fspr_pool_t pool, uint flags, SWIGTYPE_p_switch_call_cause_t cancel_cause) {
    +    switch_call_cause_t ret = (switch_call_cause_t)freeswitchPINVOKE.switch_core_session_outgoing_channel(SWIGTYPE_p_switch_core_session.getCPtr(session), switch_event.getCPtr(var_event), endpoint_name, switch_caller_profile.getCPtr(caller_profile), SWIGTYPE_p_p_switch_core_session.getCPtr(new_session), SWIGTYPE_p_p_fspr_pool_t.getCPtr(pool), flags, SWIGTYPE_p_switch_call_cause_t.getCPtr(cancel_cause));
         return ret;
       }
     
    @@ -9165,8 +9165,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_core_timer_init(switch_timer timer, string timer_name, int interval, int samples, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_init(switch_timer.getCPtr(timer), timer_name, interval, samples, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_core_timer_init(switch_timer timer, string timer_name, int interval, int samples, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_timer_init(switch_timer.getCPtr(timer), timer_name, interval, samples, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -9199,13 +9199,13 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_core_codec_init_with_bitrate(switch_codec codec, string codec_name, string fmtp, string modname, uint rate, int ms, int channels, uint bitrate, uint flags, switch_codec_settings codec_settings, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_init_with_bitrate(switch_codec.getCPtr(codec), codec_name, fmtp, modname, rate, ms, channels, bitrate, flags, switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_core_codec_init_with_bitrate(switch_codec codec, string codec_name, string fmtp, string modname, uint rate, int ms, int channels, uint bitrate, uint flags, switch_codec_settings codec_settings, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_init_with_bitrate(switch_codec.getCPtr(codec), codec_name, fmtp, modname, rate, ms, channels, bitrate, flags, switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    -  public static switch_status_t switch_core_codec_copy(switch_codec codec, switch_codec new_codec, switch_codec_settings codec_settings, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_copy(switch_codec.getCPtr(codec), switch_codec.getCPtr(new_codec), switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_core_codec_copy(switch_codec codec, switch_codec new_codec, switch_codec_settings codec_settings, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_codec_copy(switch_codec.getCPtr(codec), switch_codec.getCPtr(new_codec), switch_codec_settings.getCPtr(codec_settings), SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -9385,8 +9385,8 @@ else
         freeswitchPINVOKE.switch_core_db_test_reactive(SWIGTYPE_p_sqlite3.getCPtr(db), test_sql, drop_sql, reactive_sql);
       }
     
    -  public static switch_status_t switch_core_perform_file_open(string file, string func, int line, switch_file_handle fh, string file_path, uint channels, uint rate, uint flags, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_file_open(file, func, line, switch_file_handle.getCPtr(fh), file_path, channels, rate, flags, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_core_perform_file_open(string file, string func, int line, switch_file_handle fh, string file_path, uint channels, uint rate, uint flags, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_perform_file_open(file, func, line, switch_file_handle.getCPtr(fh), file_path, channels, rate, flags, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -9438,8 +9438,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_core_file_handle_dup(switch_file_handle oldfh, SWIGTYPE_p_p_switch_file_handle newfh, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_handle_dup(switch_file_handle.getCPtr(oldfh), SWIGTYPE_p_p_switch_file_handle.getCPtr(newfh), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_core_file_handle_dup(switch_file_handle oldfh, SWIGTYPE_p_p_switch_file_handle newfh, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_file_handle_dup(switch_file_handle.getCPtr(oldfh), SWIGTYPE_p_p_switch_file_handle.getCPtr(newfh), SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -9463,8 +9463,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_core_speech_open(switch_speech_handle sh, string module_name, string voice_name, uint rate, uint interval, uint channels, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_open(switch_speech_handle.getCPtr(sh), module_name, voice_name, rate, interval, channels, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_core_speech_open(switch_speech_handle sh, string module_name, string voice_name, uint rate, uint interval, uint channels, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_speech_open(switch_speech_handle.getCPtr(sh), module_name, voice_name, rate, interval, channels, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -9499,8 +9499,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_core_asr_open(switch_asr_handle ah, string module_name, string codec, int rate, string dest, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_open(switch_asr_handle.getCPtr(ah), module_name, codec, rate, dest, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_core_asr_open(switch_asr_handle ah, string module_name, string codec, int rate, string dest, SWIGTYPE_p_unsigned_long flags, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_asr_open(switch_asr_handle.getCPtr(ah), module_name, codec, rate, dest, SWIGTYPE_p_unsigned_long.getCPtr(flags), SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -9586,8 +9586,8 @@ else
         freeswitchPINVOKE.switch_core_asr_float_param(switch_asr_handle.getCPtr(ah), param, val);
       }
     
    -  public static switch_status_t switch_core_directory_open(switch_directory_handle dh, string module_name, string source, string dsn, string passwd, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_open(switch_directory_handle.getCPtr(dh), module_name, source, dsn, passwd, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_core_directory_open(switch_directory_handle dh, string module_name, string source, string dsn, string passwd, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_core_directory_open(switch_directory_handle.getCPtr(dh), module_name, source, dsn, passwd, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -9753,8 +9753,8 @@ else
         return ret;
       }
     
    -  public static switch_loadable_module_interface switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t pool, string name) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_module_interface(SWIGTYPE_p_apr_pool_t.getCPtr(pool), name);
    +  public static switch_loadable_module_interface switch_loadable_module_create_module_interface(SWIGTYPE_p_fspr_pool_t pool, string name) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_create_module_interface(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), name);
         switch_loadable_module_interface ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_loadable_module_interface(cPtr, false);
         return ret;
       }
    @@ -10467,8 +10467,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_loadable_module_build_dynamic(string filename, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t switch_module_load, SWIGTYPE_p_f_void__switch_status_t switch_module_runtime, SWIGTYPE_p_f_void__switch_status_t switch_module_shutdown, switch_bool_t runtime) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_build_dynamic(filename, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t.getCPtr(switch_module_load), SWIGTYPE_p_f_void__switch_status_t.getCPtr(switch_module_runtime), SWIGTYPE_p_f_void__switch_status_t.getCPtr(switch_module_shutdown), (int)runtime);
    +  public static switch_status_t switch_loadable_module_build_dynamic(string filename, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t switch_module_load, SWIGTYPE_p_f_void__switch_status_t switch_module_runtime, SWIGTYPE_p_f_void__switch_status_t switch_module_shutdown, switch_bool_t runtime) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_loadable_module_build_dynamic(filename, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t.getCPtr(switch_module_load), SWIGTYPE_p_f_void__switch_status_t.getCPtr(switch_module_runtime), SWIGTYPE_p_f_void__switch_status_t.getCPtr(switch_module_shutdown), (int)runtime);
         return ret;
       }
     
    @@ -10627,12 +10627,12 @@ else
         return ret;
       }
     
    -  public static void switch_core_codec_add_implementation(SWIGTYPE_p_apr_pool_t pool, switch_codec_interface codec_interface, switch_codec_type_t codec_type, byte ianacode, string iananame, string fmtp, uint samples_per_second, uint actual_samples_per_second, int bits_per_second, int microseconds_per_packet, uint samples_per_packet, uint decoded_bytes_per_packet, uint encoded_bytes_per_packet, byte number_of_channels, int codec_frames_per_packet, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t encode, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t decode, SWIGTYPE_p_f_p_switch_codec__switch_status_t destroy) {
    -    freeswitchPINVOKE.switch_core_codec_add_implementation(SWIGTYPE_p_apr_pool_t.getCPtr(pool), switch_codec_interface.getCPtr(codec_interface), (int)codec_type, ianacode, iananame, fmtp, samples_per_second, actual_samples_per_second, bits_per_second, microseconds_per_packet, samples_per_packet, decoded_bytes_per_packet, encoded_bytes_per_packet, number_of_channels, codec_frames_per_packet, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(init), SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(encode), SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(decode), SWIGTYPE_p_f_p_switch_codec__switch_status_t.getCPtr(destroy));
    +  public static void switch_core_codec_add_implementation(SWIGTYPE_p_fspr_pool_t pool, switch_codec_interface codec_interface, switch_codec_type_t codec_type, byte ianacode, string iananame, string fmtp, uint samples_per_second, uint actual_samples_per_second, int bits_per_second, int microseconds_per_packet, uint samples_per_packet, uint decoded_bytes_per_packet, uint encoded_bytes_per_packet, byte number_of_channels, int codec_frames_per_packet, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t encode, SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t decode, SWIGTYPE_p_f_p_switch_codec__switch_status_t destroy) {
    +    freeswitchPINVOKE.switch_core_codec_add_implementation(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), switch_codec_interface.getCPtr(codec_interface), (int)codec_type, ianacode, iananame, fmtp, samples_per_second, actual_samples_per_second, bits_per_second, microseconds_per_packet, samples_per_packet, decoded_bytes_per_packet, encoded_bytes_per_packet, number_of_channels, codec_frames_per_packet, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(init), SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(encode), SWIGTYPE_p_f_p_switch_codec_p_switch_codec_p_void_unsigned_long_unsigned_long_p_void_p_unsigned_long_p_unsigned_long_p_unsigned_int__switch_status_t.getCPtr(decode), SWIGTYPE_p_f_p_switch_codec__switch_status_t.getCPtr(destroy));
       }
     
    -  public static void switch_core_codec_add_video_implementation(SWIGTYPE_p_apr_pool_t pool, switch_codec_interface codec_interface, byte ianacode, string iananame, string fmtp, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init, SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t encode, SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t decode, SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_control_command_t_enum_switch_codec_control_type_t_p_void_enum_switch_codec_control_type_t_p_void_p_enum_switch_codec_control_type_t_p_p_void__switch_status_t control, SWIGTYPE_p_f_p_switch_codec__switch_status_t destroy) {
    -    freeswitchPINVOKE.switch_core_codec_add_video_implementation(SWIGTYPE_p_apr_pool_t.getCPtr(pool), switch_codec_interface.getCPtr(codec_interface), ianacode, iananame, fmtp, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(init), SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t.getCPtr(encode), SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t.getCPtr(decode), SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_control_command_t_enum_switch_codec_control_type_t_p_void_enum_switch_codec_control_type_t_p_void_p_enum_switch_codec_control_type_t_p_p_void__switch_status_t.getCPtr(control), SWIGTYPE_p_f_p_switch_codec__switch_status_t.getCPtr(destroy));
    +  public static void switch_core_codec_add_video_implementation(SWIGTYPE_p_fspr_pool_t pool, switch_codec_interface codec_interface, byte ianacode, string iananame, string fmtp, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t init, SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t encode, SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t decode, SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_control_command_t_enum_switch_codec_control_type_t_p_void_enum_switch_codec_control_type_t_p_void_p_enum_switch_codec_control_type_t_p_p_void__switch_status_t control, SWIGTYPE_p_f_p_switch_codec__switch_status_t destroy) {
    +    freeswitchPINVOKE.switch_core_codec_add_video_implementation(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), switch_codec_interface.getCPtr(codec_interface), ianacode, iananame, fmtp, SWIGTYPE_p_f_p_switch_codec_unsigned_long_p_q_const__switch_codec_settings__switch_status_t.getCPtr(init), SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t.getCPtr(encode), SWIGTYPE_p_f_p_switch_codec_p_switch_frame__switch_status_t.getCPtr(decode), SWIGTYPE_p_f_p_switch_codec_enum_switch_codec_control_command_t_enum_switch_codec_control_type_t_p_void_enum_switch_codec_control_type_t_p_void_p_enum_switch_codec_control_type_t_p_p_void__switch_status_t.getCPtr(control), SWIGTYPE_p_f_p_switch_codec__switch_status_t.getCPtr(destroy));
       }
     
       public static switch_bool_t switch_core_codec_ready(switch_codec codec) {
    @@ -10670,8 +10670,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_console_init(SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_console_init(SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_console_init(SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -10942,8 +10942,8 @@ else
         return ret;
       }
     
    -  public static string switch_find_parameter(string str, string param, SWIGTYPE_p_apr_pool_t pool) {
    -    string ret = freeswitchPINVOKE.switch_find_parameter(str, param, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static string switch_find_parameter(string str, string param, SWIGTYPE_p_fspr_pool_t pool) {
    +    string ret = freeswitchPINVOKE.switch_find_parameter(str, param, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -11162,13 +11162,13 @@ else
         return ret;
       }
     
    -  public static string switch_pool_strip_whitespace(SWIGTYPE_p_apr_pool_t pool, string str) {
    -    string ret = freeswitchPINVOKE.switch_pool_strip_whitespace(SWIGTYPE_p_apr_pool_t.getCPtr(pool), str);
    +  public static string switch_pool_strip_whitespace(SWIGTYPE_p_fspr_pool_t pool, string str) {
    +    string ret = freeswitchPINVOKE.switch_pool_strip_whitespace(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), str);
         return ret;
       }
     
    -  public static string switch_escape_char(SWIGTYPE_p_apr_pool_t pool, string arg1, string delim, char esc) {
    -    string ret = freeswitchPINVOKE.switch_escape_char(SWIGTYPE_p_apr_pool_t.getCPtr(pool), arg1, delim, esc);
    +  public static string switch_escape_char(SWIGTYPE_p_fspr_pool_t pool, string arg1, string delim, char esc) {
    +    string ret = freeswitchPINVOKE.switch_escape_char(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), arg1, delim, esc);
         return ret;
       }
     
    @@ -11178,8 +11178,8 @@ else
         return ret;
       }
     
    -  public static string switch_escape_string_pool(string arg0, SWIGTYPE_p_apr_pool_t pool) {
    -    string ret = freeswitchPINVOKE.switch_escape_string_pool(arg0, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static string switch_escape_string_pool(string arg0, SWIGTYPE_p_fspr_pool_t pool) {
    +    string ret = freeswitchPINVOKE.switch_escape_string_pool(arg0, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -11213,8 +11213,8 @@ else
         return ret;
       }
     
    -  public static string switch_util_quote_shell_arg_pool(string arg0, SWIGTYPE_p_apr_pool_t pool) {
    -    string ret = freeswitchPINVOKE.switch_util_quote_shell_arg_pool(arg0, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static string switch_util_quote_shell_arg_pool(string arg0, SWIGTYPE_p_fspr_pool_t pool) {
    +    string ret = freeswitchPINVOKE.switch_util_quote_shell_arg_pool(arg0, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -11257,13 +11257,13 @@ else
         return ret;
       }
     
    -  public static string switch_core_url_encode_opt(SWIGTYPE_p_apr_pool_t pool, string url, switch_bool_t double_encode) {
    -    string ret = freeswitchPINVOKE.switch_core_url_encode_opt(SWIGTYPE_p_apr_pool_t.getCPtr(pool), url, (int)double_encode);
    +  public static string switch_core_url_encode_opt(SWIGTYPE_p_fspr_pool_t pool, string url, switch_bool_t double_encode) {
    +    string ret = freeswitchPINVOKE.switch_core_url_encode_opt(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), url, (int)double_encode);
         return ret;
       }
     
    -  public static string switch_core_url_encode(SWIGTYPE_p_apr_pool_t pool, string url) {
    -    string ret = freeswitchPINVOKE.switch_core_url_encode(SWIGTYPE_p_apr_pool_t.getCPtr(pool), url);
    +  public static string switch_core_url_encode(SWIGTYPE_p_fspr_pool_t pool, string url) {
    +    string ret = freeswitchPINVOKE.switch_core_url_encode(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), url);
         return ret;
       }
     
    @@ -11311,8 +11311,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_network_list_create(SWIGTYPE_p_p_switch_network_list list, string name, switch_bool_t default_type, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_create(SWIGTYPE_p_p_switch_network_list.getCPtr(list), name, (int)default_type, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_network_list_create(SWIGTYPE_p_p_switch_network_list list, string name, switch_bool_t default_type, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_network_list_create(SWIGTYPE_p_p_switch_network_list.getCPtr(list), name, (int)default_type, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -11586,8 +11586,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_caller_extension_clone(SWIGTYPE_p_p_switch_caller_extension new_ext, switch_caller_extension orig, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_caller_extension_clone(SWIGTYPE_p_p_switch_caller_extension.getCPtr(new_ext), switch_caller_extension.getCPtr(orig), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_caller_extension_clone(SWIGTYPE_p_p_switch_caller_extension new_ext, switch_caller_extension orig, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_caller_extension_clone(SWIGTYPE_p_p_switch_caller_extension.getCPtr(new_ext), switch_caller_extension.getCPtr(orig), SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -11604,8 +11604,8 @@ else
         return ret;
       }
     
    -  public static switch_caller_profile switch_caller_profile_new(SWIGTYPE_p_apr_pool_t pool, string username, string dialplan, string caller_id_name, string caller_id_number, string network_addr, string ani, string aniii, string rdnis, string source, string context, string destination_number) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_new(SWIGTYPE_p_apr_pool_t.getCPtr(pool), username, dialplan, caller_id_name, caller_id_number, network_addr, ani, aniii, rdnis, source, context, destination_number);
    +  public static switch_caller_profile switch_caller_profile_new(SWIGTYPE_p_fspr_pool_t pool, string username, string dialplan, string caller_id_name, string caller_id_number, string network_addr, string ani, string aniii, string rdnis, string source, string context, string destination_number) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_new(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), username, dialplan, caller_id_name, caller_id_number, network_addr, ani, aniii, rdnis, source, context, destination_number);
         switch_caller_profile ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
         return ret;
       }
    @@ -11616,8 +11616,8 @@ else
         return ret;
       }
     
    -  public static switch_caller_profile switch_caller_profile_dup(SWIGTYPE_p_apr_pool_t pool, switch_caller_profile tocopy) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_dup(SWIGTYPE_p_apr_pool_t.getCPtr(pool), switch_caller_profile.getCPtr(tocopy));
    +  public static switch_caller_profile switch_caller_profile_dup(SWIGTYPE_p_fspr_pool_t pool, switch_caller_profile tocopy) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_dup(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), switch_caller_profile.getCPtr(tocopy));
         switch_caller_profile ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_caller_profile(cPtr, false);
         return ret;
       }
    @@ -11711,8 +11711,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_channel_alloc(SWIGTYPE_p_p_switch_channel channel, switch_call_direction_t direction, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_alloc(SWIGTYPE_p_p_switch_channel.getCPtr(channel), (int)direction, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_channel_alloc(SWIGTYPE_p_p_switch_channel channel, switch_call_direction_t direction, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_channel_alloc(SWIGTYPE_p_p_switch_channel.getCPtr(channel), (int)direction, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -12343,8 +12343,8 @@ else
         freeswitchPINVOKE.switch_channel_handle_cause(SWIGTYPE_p_switch_channel.getCPtr(channel), (int)cause);
       }
     
    -  public static void switch_channel_global_init(SWIGTYPE_p_apr_pool_t pool) {
    -    freeswitchPINVOKE.switch_channel_global_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static void switch_channel_global_init(SWIGTYPE_p_fspr_pool_t pool) {
    +    freeswitchPINVOKE.switch_channel_global_init(SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
       }
     
       public static void switch_channel_global_uninit() {
    @@ -12390,8 +12390,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_buffer_create_partition(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create_partition(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen));
    +  public static switch_status_t switch_buffer_create_partition(SWIGTYPE_p_fspr_pool_t pool, SWIGTYPE_p_p_switch_buffer buffer, SWIGTYPE_p_void data, SWIGTYPE_p_switch_size_t datalen) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_buffer_create_partition(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_buffer.getCPtr(buffer), SWIGTYPE_p_void.getCPtr(data), SWIGTYPE_p_switch_size_t.getCPtr(datalen));
         if (freeswitchPINVOKE.SWIGPendingException.Pending) throw freeswitchPINVOKE.SWIGPendingException.Retrieve();
         return ret;
       }
    @@ -12407,8 +12407,8 @@ else
         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));
    +  public static switch_status_t switch_buffer_create(SWIGTYPE_p_fspr_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_fspr_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();
         return ret;
       }
    @@ -12516,8 +12516,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_event_init(SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_event_init(SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_event_init(SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -13382,8 +13382,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_ivr_digit_stream_parser_new(SWIGTYPE_p_apr_pool_t pool, SWIGTYPE_p_p_switch_ivr_digit_stream_parser parser) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_new(SWIGTYPE_p_apr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_ivr_digit_stream_parser.getCPtr(parser));
    +  public static switch_status_t switch_ivr_digit_stream_parser_new(SWIGTYPE_p_fspr_pool_t pool, SWIGTYPE_p_p_switch_ivr_digit_stream_parser parser) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_digit_stream_parser_new(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), SWIGTYPE_p_p_switch_ivr_digit_stream_parser.getCPtr(parser));
         return ret;
       }
     
    @@ -13428,8 +13428,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string transfer_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu new_menu, SWIGTYPE_p_switch_ivr_menu main, string name, string greeting_sound, string short_greeting_sound, string invalid_sound, string exit_sound, string transfer_sound, string confirm_macro, string confirm_key, string tts_engine, string tts_voice, int confirm_attempts, int inter_timeout, int digit_len, int timeout, int max_failures, int max_timeouts, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_init(SWIGTYPE_p_p_switch_ivr_menu.getCPtr(new_menu), SWIGTYPE_p_switch_ivr_menu.getCPtr(main), name, greeting_sound, short_greeting_sound, invalid_sound, exit_sound, transfer_sound, confirm_macro, confirm_key, tts_engine, tts_voice, confirm_attempts, inter_timeout, digit_len, timeout, max_failures, max_timeouts, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -13468,8 +13468,8 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_ivr_menu_stack_xml_init(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx xml_menu_ctx, SWIGTYPE_p_apr_pool_t pool) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_xml_init(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx.getCPtr(xml_menu_ctx), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_status_t switch_ivr_menu_stack_xml_init(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx xml_menu_ctx, SWIGTYPE_p_fspr_pool_t pool) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_menu_stack_xml_init(SWIGTYPE_p_p_switch_ivr_menu_xml_ctx.getCPtr(xml_menu_ctx), SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         return ret;
       }
     
    @@ -13625,8 +13625,8 @@ else
         freeswitchPINVOKE.switch_ivr_dmachine_set_nonmatch_callback(SWIGTYPE_p_switch_ivr_dmachine.getCPtr(dmachine), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback));
       }
     
    -  public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, string name, SWIGTYPE_p_apr_pool_t pool, uint digit_timeout, uint input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback, SWIGTYPE_p_void user_data) {
    -    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), name, SWIGTYPE_p_apr_pool_t.getCPtr(pool), digit_timeout, input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback), SWIGTYPE_p_void.getCPtr(user_data));
    +  public static switch_status_t switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine dmachine_p, string name, SWIGTYPE_p_fspr_pool_t pool, uint digit_timeout, uint input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t match_callback, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t nonmatch_callback, SWIGTYPE_p_void user_data) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_ivr_dmachine_create(SWIGTYPE_p_p_switch_ivr_dmachine.getCPtr(dmachine_p), name, SWIGTYPE_p_fspr_pool_t.getCPtr(pool), digit_timeout, input_timeout, SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(match_callback), SWIGTYPE_p_f_p_switch_ivr_dmachine_match__switch_status_t.getCPtr(nonmatch_callback), SWIGTYPE_p_void.getCPtr(user_data));
         return ret;
       }
     
    @@ -13912,8 +13912,8 @@ else
         freeswitchPINVOKE.switch_rtp_get_random(SWIGTYPE_p_void.getCPtr(buf), len);
       }
     
    -  public static void switch_rtp_init(SWIGTYPE_p_apr_pool_t pool) {
    -    freeswitchPINVOKE.switch_rtp_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static void switch_rtp_init(SWIGTYPE_p_fspr_pool_t pool) {
    +    freeswitchPINVOKE.switch_rtp_init(SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
       }
     
       public static void switch_rtp_shutdown() {
    @@ -13959,10 +13959,10 @@ else
         return ret;
       }
     
    -  public static switch_status_t switch_rtp_create(SWIGTYPE_p_p_switch_rtp new_rtp_session, byte payload, uint samples_per_interval, uint ms_per_packet, SWIGTYPE_p_switch_rtp_flag_t flags, string timer_name, out string err, SWIGTYPE_p_apr_pool_t pool) {
    +  public static switch_status_t switch_rtp_create(SWIGTYPE_p_p_switch_rtp new_rtp_session, byte payload, uint samples_per_interval, uint ms_per_packet, SWIGTYPE_p_switch_rtp_flag_t flags, string timer_name, out string err, SWIGTYPE_p_fspr_pool_t pool) {
     var err_ptr = global::System.IntPtr.Zero;
         try {
    -      switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_create(SWIGTYPE_p_p_switch_rtp.getCPtr(new_rtp_session), payload, samples_per_interval, ms_per_packet, SWIGTYPE_p_switch_rtp_flag_t.getCPtr(flags), timer_name, ref err_ptr, SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +      switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_rtp_create(SWIGTYPE_p_p_switch_rtp.getCPtr(new_rtp_session), payload, samples_per_interval, ms_per_packet, SWIGTYPE_p_switch_rtp_flag_t.getCPtr(flags), timer_name, ref err_ptr, SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
           return ret;
         } finally {
     if(err_ptr != global::System.IntPtr.Zero)
    @@ -13972,10 +13972,10 @@ else
         }
       }
     
    -  public static SWIGTYPE_p_switch_rtp switch_rtp_new(string rx_host, ushort rx_port, string tx_host, ushort tx_port, byte payload, uint samples_per_interval, uint ms_per_packet, SWIGTYPE_p_switch_rtp_flag_t flags, string timer_name, out string err, SWIGTYPE_p_apr_pool_t pool, ushort bundle_internal_ports, ushort bundle_external_port) {
    +  public static SWIGTYPE_p_switch_rtp switch_rtp_new(string rx_host, ushort rx_port, string tx_host, ushort tx_port, byte payload, uint samples_per_interval, uint ms_per_packet, SWIGTYPE_p_switch_rtp_flag_t flags, string timer_name, out string err, SWIGTYPE_p_fspr_pool_t pool, ushort bundle_internal_ports, ushort bundle_external_port) {
     var err_ptr = global::System.IntPtr.Zero;
         try {
    -      global::System.IntPtr cPtr = freeswitchPINVOKE.switch_rtp_new(rx_host, rx_port, tx_host, tx_port, payload, samples_per_interval, ms_per_packet, SWIGTYPE_p_switch_rtp_flag_t.getCPtr(flags), timer_name, ref err_ptr, SWIGTYPE_p_apr_pool_t.getCPtr(pool), bundle_internal_ports, bundle_external_port);
    +      global::System.IntPtr cPtr = freeswitchPINVOKE.switch_rtp_new(rx_host, rx_port, tx_host, tx_port, payload, samples_per_interval, ms_per_packet, SWIGTYPE_p_switch_rtp_flag_t.getCPtr(flags), timer_name, ref err_ptr, SWIGTYPE_p_fspr_pool_t.getCPtr(pool), bundle_internal_ports, bundle_external_port);
           SWIGTYPE_p_switch_rtp ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_switch_rtp(cPtr, false);
           return ret;
         } finally {
    @@ -14279,8 +14279,8 @@ else
         freeswitchPINVOKE.switch_rtp_intentional_bugs(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), (int)bugs);
       }
     
    -  public static switch_rtp_stats_t switch_rtp_get_stats(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_apr_pool_t pool) {
    -    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_stats(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_apr_pool_t.getCPtr(pool));
    +  public static switch_rtp_stats_t switch_rtp_get_stats(SWIGTYPE_p_switch_rtp rtp_session, SWIGTYPE_p_fspr_pool_t pool) {
    +    global::System.IntPtr cPtr = freeswitchPINVOKE.switch_rtp_get_stats(SWIGTYPE_p_switch_rtp.getCPtr(rtp_session), SWIGTYPE_p_fspr_pool_t.getCPtr(pool));
         switch_rtp_stats_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new switch_rtp_stats_t(cPtr, false);
         return ret;
       }
    @@ -14344,8 +14344,8 @@ else
         return ret;
       }
     
    -  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);
    +  public static switch_status_t switch_log_init(SWIGTYPE_p_fspr_pool_t pool, switch_bool_t colorize) {
    +    switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_log_init(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), (int)colorize);
         return ret;
       }
     
    @@ -14587,10 +14587,10 @@ else
         }
       }
     
    -  public static switch_status_t switch_xml_init(SWIGTYPE_p_apr_pool_t pool, out string err) {
    +  public static switch_status_t switch_xml_init(SWIGTYPE_p_fspr_pool_t pool, out string err) {
     var err_ptr = global::System.IntPtr.Zero;
         try {
    -      switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_init(SWIGTYPE_p_apr_pool_t.getCPtr(pool), ref err_ptr);
    +      switch_status_t ret = (switch_status_t)freeswitchPINVOKE.switch_xml_init(SWIGTYPE_p_fspr_pool_t.getCPtr(pool), ref err_ptr);
           return ret;
         } finally {
     if(err_ptr != global::System.IntPtr.Zero)
    @@ -29680,13 +29680,13 @@ public class switch_asr_handle : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t memory_pool {
    +  public SWIGTYPE_p_fspr_pool_t memory_pool {
         set {
    -      freeswitchPINVOKE.switch_asr_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_asr_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_asr_handle_memory_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -31693,13 +31693,13 @@ public class switch_caller_profile : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t pool {
    +  public SWIGTYPE_p_fspr_pool_t pool {
         set {
    -      freeswitchPINVOKE.switch_caller_profile_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_caller_profile_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_caller_profile_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -32687,13 +32687,13 @@ public class switch_codec : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t memory_pool {
    +  public SWIGTYPE_p_fspr_pool_t memory_pool {
         set {
    -      freeswitchPINVOKE.switch_codec_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_codec_memory_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_codec_memory_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -34268,13 +34268,13 @@ public class switch_core_thread_session : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t pool {
    +  public SWIGTYPE_p_fspr_pool_t pool {
         set {
    -      freeswitchPINVOKE.switch_core_thread_session_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_core_thread_session_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_core_thread_session_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -35375,13 +35375,13 @@ public class switch_device_record_t : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t pool {
    +  public SWIGTYPE_p_fspr_pool_t pool {
         set {
    -      freeswitchPINVOKE.switch_device_record_t_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_device_record_t_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_device_record_t_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -36194,13 +36194,13 @@ public class switch_directory_handle : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t memory_pool {
    +  public SWIGTYPE_p_fspr_pool_t memory_pool {
         set {
    -      freeswitchPINVOKE.switch_directory_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_directory_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_directory_handle_memory_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -37440,13 +37440,13 @@ public class switch_file_handle : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t memory_pool {
    +  public SWIGTYPE_p_fspr_pool_t memory_pool {
         set {
    -      freeswitchPINVOKE.switch_file_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_file_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_file_handle_memory_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -40455,13 +40455,13 @@ public class switch_io_routines : global::System.IDisposable {
         }
       }
     
    -  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t outgoing_channel {
    +  public SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_fspr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t outgoing_channel {
         set {
    -      freeswitchPINVOKE.switch_io_routines_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_io_routines_outgoing_channel_set(swigCPtr, SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_fspr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_io_routines_outgoing_channel_get(swigCPtr);
    -      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_apr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t(cPtr, false);
    +      SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_fspr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_switch_core_session_p_switch_event_p_switch_caller_profile_p_p_switch_core_session_p_p_fspr_pool_t_unsigned_long_p_enum_switch_call_cause_t__switch_call_cause_t(cPtr, false);
           return ret;
         } 
       }
    @@ -41178,13 +41178,13 @@ public class switch_loadable_module_function_table_t : global::System.IDisposabl
         } 
       }
     
    -  public SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t load {
    +  public SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t load {
         set {
    -      freeswitchPINVOKE.switch_loadable_module_function_table_t_load_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_loadable_module_function_table_t_load_set(swigCPtr, SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_function_table_t_load_get(swigCPtr);
    -      SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_apr_pool_t__switch_status_t(cPtr, false);
    +      SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_f_p_p_switch_loadable_module_interface_p_fspr_pool_t__switch_status_t(cPtr, false);
           return ret;
         } 
       }
    @@ -41487,13 +41487,13 @@ public class switch_loadable_module_interface : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t pool {
    +  public SWIGTYPE_p_fspr_pool_t pool {
         set {
    -      freeswitchPINVOKE.switch_loadable_module_interface_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_loadable_module_interface_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_loadable_module_interface_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -45637,13 +45637,13 @@ public class switch_speech_handle : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t memory_pool {
    +  public SWIGTYPE_p_fspr_pool_t memory_pool {
         set {
    -      freeswitchPINVOKE.switch_speech_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_speech_handle_memory_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_speech_handle_memory_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -46803,13 +46803,13 @@ public class switch_thread_data_t : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t pool {
    +  public SWIGTYPE_p_fspr_pool_t pool {
         set {
    -      freeswitchPINVOKE.switch_thread_data_t_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_thread_data_t_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_thread_data_t_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    @@ -46943,13 +46943,13 @@ public class switch_timer : global::System.IDisposable {
         } 
       }
     
    -  public SWIGTYPE_p_apr_pool_t memory_pool {
    +  public SWIGTYPE_p_fspr_pool_t memory_pool {
         set {
    -      freeswitchPINVOKE.switch_timer_memory_pool_set(swigCPtr, SWIGTYPE_p_apr_pool_t.getCPtr(value));
    +      freeswitchPINVOKE.switch_timer_memory_pool_set(swigCPtr, SWIGTYPE_p_fspr_pool_t.getCPtr(value));
         } 
         get {
           global::System.IntPtr cPtr = freeswitchPINVOKE.switch_timer_memory_pool_get(swigCPtr);
    -      SWIGTYPE_p_apr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_apr_pool_t(cPtr, false);
    +      SWIGTYPE_p_fspr_pool_t ret = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_fspr_pool_t(cPtr, false);
           return ret;
         } 
       }
    
    From 347b7f530de7f2db7cdf66ffeab80c3f75c24460 Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Sat, 15 Oct 2022 01:16:48 +0300
    Subject: [PATCH 066/155] version bump
    
    ---
     build/next-release.txt | 2 +-
     configure.ac           | 4 ++--
     2 files changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/build/next-release.txt b/build/next-release.txt
    index 924b6af807..e7cd7fead7 100644
    --- a/build/next-release.txt
    +++ b/build/next-release.txt
    @@ -1 +1 @@
    -1.10.8-dev
    +1.10.9-dev
    diff --git a/configure.ac b/configure.ac
    index 52b0a3cd98..f8b9cadaf6 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -3,10 +3,10 @@
     
     # Must change all of the below together
     # For a release, set revision for that tagged release as well and uncomment
    -AC_INIT([freeswitch], [1.10.8-dev], bugs@freeswitch.org)
    +AC_INIT([freeswitch], [1.10.9-dev], bugs@freeswitch.org)
     AC_SUBST(SWITCH_VERSION_MAJOR, [1])
     AC_SUBST(SWITCH_VERSION_MINOR, [10])
    -AC_SUBST(SWITCH_VERSION_MICRO, [8-dev])
    +AC_SUBST(SWITCH_VERSION_MICRO, [9-dev])
     AC_SUBST(SWITCH_VERSION_REVISION, [])
     AC_SUBST(SWITCH_VERSION_REVISION_HUMAN, [])
     
    
    From 5bfb9a935fe3077bb4fb002ddfd7ae1fd6ef7e68 Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Thu, 20 Oct 2022 18:54:05 +0300
    Subject: [PATCH 067/155] [Build-System] Disable static build by default on
     Linux.
    
    ---
     configure.ac | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/configure.ac b/configure.ac
    index f8b9cadaf6..9b87103dae 100644
    --- a/configure.ac
    +++ b/configure.ac
    @@ -248,7 +248,7 @@ m4_defun([_LT_AC_LANG_F77_CONFIG], [:])
     m4_defun([_LT_AC_LANG_GCJ_CONFIG], [:])
     m4_defun([_LT_AC_LANG_RC_CONFIG], [:])
     AM_PROG_CC_C_O
    -AC_PROG_LIBTOOL
    +LT_INIT([disable-static])
     
     #Check for compiler vendor
     AX_COMPILER_VENDOR
    
    From d07b8af19905819e7f30d98397cf857bdef32ba1 Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Tue, 25 Oct 2022 12:19:58 +0300
    Subject: [PATCH 068/155] [Packaging] Shared libraries instead of static in
     freeswitch devel CentOS package.
    
    ---
     freeswitch.spec | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/freeswitch.spec b/freeswitch.spec
    index 769859ea16..3af95eabce 100644
    --- a/freeswitch.spec
    +++ b/freeswitch.spec
    @@ -1709,6 +1709,8 @@ cd ../..
     %{__rm} -f %{buildroot}/%{MODINSTDIR}/ftmod_sangoma_isdn*
     %endif
     
    +%{__rm} -f %{buildroot}/%{LIBDIR}/*.la
    +%{__rm} -f %{buildroot}/%{MODINSTDIR}/*.la
     
     
     ######################################################################################################################
    @@ -1861,10 +1863,8 @@ fi
     #
     ######################################################################################################################
     %files devel
    -%{LIBDIR}/*.a
    -%{LIBDIR}/*.la
    +%{LIBDIR}/*.so*
     %{PKGCONFIGDIR}/*
    -%{MODINSTDIR}/*.*a
     %{INCLUDEDIR}/*.h
     %{INCLUDEDIR}/test/*.h
     
    
    From 92caab3647f7006f67af8bf835e84dbb94e735b9 Mon Sep 17 00:00:00 2001
    From: =?UTF-8?q?Zvonimir=20Bu=C5=BEani=C4=87?= 
    Date: Wed, 26 Oct 2022 19:53:01 +0200
    Subject: [PATCH 069/155] [core] Fix wrong reason code for group call
    
    ---
     src/switch_ivr_originate.c | 9 ++++++++-
     1 file changed, 8 insertions(+), 1 deletion(-)
    
    diff --git a/src/switch_ivr_originate.c b/src/switch_ivr_originate.c
    index c4f4bfa2b2..63a0911929 100644
    --- a/src/switch_ivr_originate.c
    +++ b/src/switch_ivr_originate.c
    @@ -1795,7 +1795,14 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_enterprise_originate(switch_core_sess
     		if (cancel_cause && *cancel_cause > 0) {
     			handles[i].cancel_cause = *cancel_cause;
     		} else {
    -			handles[i].cancel_cause = SWITCH_CAUSE_LOSE_RACE;
    +			/* Was this call taken by another destination? */
    +			if (hp != NULL && hp->cause == SWITCH_CAUSE_SUCCESS) {
    +				/* Yes, the race was lost */
    +				handles[i].cancel_cause = SWITCH_CAUSE_LOSE_RACE;
    +			} else {
    +				/* No, something else happened, probably Originator Cancel */
    +				handles[i].cancel_cause = SWITCH_CAUSE_ORIGINATOR_CANCEL;
    +			}
     		}
     	}
     
    
    From 2ab600c71a659a5a8771c74ed7d777cfe09bc163 Mon Sep 17 00:00:00 2001
    From: Andrey Volk 
    Date: Fri, 28 Oct 2022 00:27:55 +0300
    Subject: [PATCH 070/155] [mod_http_cache] Fix leaking curl handle in
     http_get()
    
    ---
     src/mod/applications/mod_http_cache/mod_http_cache.c | 1 +
     1 file changed, 1 insertion(+)
    
    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 d6f4fb6ed8..9d19099e56 100644
    --- a/src/mod/applications/mod_http_cache/mod_http_cache.c
    +++ b/src/mod/applications/mod_http_cache/mod_http_cache.c
    @@ -1167,6 +1167,7 @@ static switch_status_t http_get(url_cache_t *cache, http_profile_t *profile, cac
     		switch_curl_easy_cleanup(curl_handle);
     		close(get_data.fd);
     	} else {
    +		switch_curl_easy_cleanup(curl_handle);
     		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "open() error: %s\n", strerror(errno));
     		status = SWITCH_STATUS_GENERR;
     		goto done;
    
    From 8e59603d98ba699c42c6947a9adf24cbf573c335 Mon Sep 17 00:00:00 2001
    From: Dragos Oancea 
    Date: Fri, 28 Oct 2022 18:34:18 +0300
    Subject: [PATCH 071/155] [core][mod_sofia] remove ZRTP (deemed obsolete).
     [unit-tests][build-system][docs] remove references to ZRTP.
    
    ---
     Freeswitch.2017.sln                           |   14 -
     LICENSE                                       |   21 -
     Makefile.am                                   |   16 -
     bootstrap.sh                                  |    8 +-
     build/buildzrtp.sh                            |    8 -
     conf/insideout/sip_profiles/external.xml      |    1 -
     conf/insideout/sip_profiles/internal-ipv6.xml |    3 -
     conf/insideout/sip_profiles/internal.xml      |    3 -
     conf/rayo/autoload_configs/switch.conf.xml    |    2 -
     conf/rayo/sip_profiles/external.xml           |    1 -
     conf/rayo/vars.xml                            |    7 -
     conf/sbc/sbc_profiles/external.xml            |    1 -
     conf/sbc/sbc_profiles/internal-ipv6.xml       |    3 -
     conf/sbc/sbc_profiles/internal.xml            |    3 -
     conf/testing/autoload_configs/switch.conf.xml |    2 -
     conf/testing/sip_profiles/external-ipv6.xml   |    1 -
     conf/testing/sip_profiles/external.xml        |    1 -
     conf/testing/sip_profiles/internal-ipv6.xml   |    3 -
     conf/testing/sip_profiles/internal.xml        |    3 -
     conf/testing/vars.xml                         |    1 -
     conf/vanilla/autoload_configs/switch.conf.xml |    2 -
     conf/vanilla/dialplan/default.xml             |   13 -
     conf/vanilla/dialplan/features.xml            |   10 +-
     conf/vanilla/sip_profiles/external-ipv6.xml   |    1 -
     conf/vanilla/sip_profiles/external.xml        |    1 -
     conf/vanilla/sip_profiles/internal-ipv6.xml   |    3 -
     conf/vanilla/sip_profiles/internal.xml        |    3 -
     conf/vanilla/vars.xml                         |    7 -
     configure.ac                                  |   12 -
     debian/copyright                              |   21 -
     debian/license-reconcile.yml                  |   27 -
     debian/rules                                  |    2 +-
     docs/phrase/phrase_de.xml                     |   18 -
     docs/phrase/phrase_en.xml                     |   18 -
     docs/phrase/phrase_es_ES.xml                  |   18 -
     docs/phrase/phrase_es_MX.xml                  |   18 -
     docs/phrase/phrase_pt_BR.xml                  |   18 -
     docs/phrase/phrase_pt_PT.xml                  |   18 -
     docs/phrase/phrase_ru.xml                     |   33 -
     freeswitch.spec                               |    1 -
     libs/libzrtp/.gitignore                       |   22 -
     libs/libzrtp/AUTHORS                          |   30 -
     libs/libzrtp/COPYING                          |    7 -
     libs/libzrtp/ChangeLog                        |  556 ---
     libs/libzrtp/INSTALL                          |  255 --
     libs/libzrtp/Makefile.am                      |  115 -
     libs/libzrtp/NEWS                             |    0
     libs/libzrtp/README                           |   10 -
     libs/libzrtp/acinclude.m4                     |   94 -
     libs/libzrtp/bootstrap.sh                     |   14 -
     libs/libzrtp/configure.ac                     |   97 -
     libs/libzrtp/create_docs.sh                   |    9 -
     libs/libzrtp/create_pack.pl                   |  421 --
     libs/libzrtp/doc/Doxyfile.in                  | 1813 --------
     libs/libzrtp/doc/manuals/changelog.dox        |  223 -
     libs/libzrtp/doc/manuals/howto.dox            |  489 --
     libs/libzrtp/doc/manuals/main.dox             |   38 -
     libs/libzrtp/doc/manuals/rng.dox              |   74 -
     libs/libzrtp/include/zrtp.h                   |  968 ----
     libs/libzrtp/include/zrtp_base.h              |  208 -
     libs/libzrtp/include/zrtp_config.h            |  271 --
     libs/libzrtp/include/zrtp_config_android.h    |   99 -
     libs/libzrtp/include/zrtp_config_symbian.h    |   69 -
     libs/libzrtp/include/zrtp_config_user.h       |  187 -
     libs/libzrtp/include/zrtp_config_win.h        |   74 -
     libs/libzrtp/include/zrtp_crypto.h            |  656 ---
     libs/libzrtp/include/zrtp_ec.h                |   81 -
     libs/libzrtp/include/zrtp_engine.h            |  387 --
     libs/libzrtp/include/zrtp_error.h             |  136 -
     libs/libzrtp/include/zrtp_iface.h             |  692 ---
     libs/libzrtp/include/zrtp_iface_cache.h       |  169 -
     libs/libzrtp/include/zrtp_iface_scheduler.h   |   89 -
     libs/libzrtp/include/zrtp_iface_system.h      |  183 -
     libs/libzrtp/include/zrtp_legal.h             |   25 -
     libs/libzrtp/include/zrtp_list.h              |   66 -
     libs/libzrtp/include/zrtp_log.h               |  169 -
     libs/libzrtp/include/zrtp_pbx.h               |  152 -
     libs/libzrtp/include/zrtp_protocol.h          |  495 --
     libs/libzrtp/include/zrtp_srtp.h              |  252 -
     libs/libzrtp/include/zrtp_srtp_builtin.h      |  149 -
     libs/libzrtp/include/zrtp_string.h            |  283 --
     libs/libzrtp/include/zrtp_types.h             |  987 ----
     libs/libzrtp/include/zrtp_version.h           |   19 -
     libs/libzrtp/projects/android/jni/Android.mk  |   72 -
     libs/libzrtp/projects/symbian/DelayRuner.cpp  |   79 -
     libs/libzrtp/projects/symbian/DelayRuner.h    |   72 -
     libs/libzrtp/projects/symbian/bld.bat         |    1 -
     libs/libzrtp/projects/symbian/bld.inf         |   13 -
     libs/libzrtp/projects/symbian/bldgcce.bat     |    2 -
     libs/libzrtp/projects/symbian/libzrtp.mmp     |   74 -
     .../projects/symbian/zrtp_iface_symb.cpp      |  336 --
     .../projects/win/libzrtp.2010.vcxproj.filters |  262 --
     .../libzrtp/projects/win/libzrtp.2017.vcxproj |  258 --
     libs/libzrtp/projects/win/libzrtp.sln         |   28 -
     libs/libzrtp/projects/win/libzrtp.vcproj      |  499 --
     libs/libzrtp/projects/win/libzrtp.x32.vcxproj |  180 -
     .../projects/win/libzrtp.x32.vcxproj.filters  |  262 --
     libs/libzrtp/projects/win/libzrtp.x64.vcxproj |  179 -
     .../projects/win/libzrtp.x64.vcxproj.filters  |  262 --
     .../projects/win/libzrtp_not_ec.vcproj        |  483 --
     libs/libzrtp/projects/win/libzrtp_test.vcproj |  211 -
     .../projects/win_ce/libzrtp_test_wince.vcproj |  500 --
     .../libzrtp/projects/win_ce/libzrtp_wince.sln |   40 -
     .../projects/win_ce/libzrtp_wince.vcproj      |  761 ---
     .../win_ce/libzrtp_wince_not_ec.vcproj        |  741 ---
     .../projects/win_kernel/MAKEFILE.WIN32        |  132 -
     .../projects/win_kernel/MAKEFILE.WIN64        |  134 -
     .../projects/win_kernel/MAKEFILE_NOT_EC.WIN32 |  129 -
     .../projects/win_kernel/MAKEFILE_NOT_EC.WIN64 |  131 -
     .../xcode/libzrtp.xcodeproj/project.pbxproj   |  626 ---
     .../contents.xcworkspacedata                  |    7 -
     .../libzrtp_test.xcodeproj/project.pbxproj    |  295 --
     .../contents.xcworkspacedata                  |    7 -
     libs/libzrtp/src/zrtp.c                       | 1208 -----
     libs/libzrtp/src/zrtp_crc.c                   |  146 -
     libs/libzrtp/src/zrtp_crypto_aes.c            |  833 ----
     libs/libzrtp/src/zrtp_crypto_atl.c            |   44 -
     libs/libzrtp/src/zrtp_crypto_ec.c             |  461 --
     libs/libzrtp/src/zrtp_crypto_ecdh.c           |  559 ---
     libs/libzrtp/src/zrtp_crypto_ecdsa.c          |  642 ---
     libs/libzrtp/src/zrtp_crypto_hash.c           | 1638 -------
     libs/libzrtp/src/zrtp_crypto_pk.c             |  351 --
     libs/libzrtp/src/zrtp_crypto_sas.c            |  745 ---
     libs/libzrtp/src/zrtp_datatypes.c             |  124 -
     libs/libzrtp/src/zrtp_engine.c                | 1480 ------
     libs/libzrtp/src/zrtp_engine_driven.c         |  152 -
     libs/libzrtp/src/zrtp_iface_cache.c           |  963 ----
     libs/libzrtp/src/zrtp_iface_scheduler.c       |  375 --
     libs/libzrtp/src/zrtp_iface_sys.c             |  489 --
     libs/libzrtp/src/zrtp_initiator.c             |  557 ---
     libs/libzrtp/src/zrtp_legal.c                 |  742 ---
     libs/libzrtp/src/zrtp_list.c                  |   66 -
     libs/libzrtp/src/zrtp_log.c                   |  496 --
     libs/libzrtp/src/zrtp_pbx.c                   |  691 ---
     libs/libzrtp/src/zrtp_protocol.c              | 1456 ------
     libs/libzrtp/src/zrtp_responder.c             |  612 ---
     libs/libzrtp/src/zrtp_rng.c                   |  351 --
     libs/libzrtp/src/zrtp_srtp_builtin.c          | 1469 ------
     libs/libzrtp/src/zrtp_srtp_dm.c               |  232 -
     libs/libzrtp/src/zrtp_string.c                |  174 -
     libs/libzrtp/src/zrtp_utils.c                 |  630 ---
     libs/libzrtp/src/zrtp_utils_proto.c           |  633 ---
     libs/libzrtp/test/cache_test.c                |  498 --
     libs/libzrtp/test/cipher_test.c               |   65 -
     libs/libzrtp/test/cmockery/cmockery.c         | 1803 --------
     libs/libzrtp/test/cmockery/cmockery.h         |  565 ---
     libs/libzrtp/test/dh_test.c                   |   52 -
     libs/libzrtp/test/dk_test.c                   |  140 -
     libs/libzrtp/test/ecdh_test.c                 |   60 -
     libs/libzrtp/test/engine_helpers.c            |   69 -
     libs/libzrtp/test/enroll_test_helpers.c       |   81 -
     libs/libzrtp/test/enrollment_test.c           |  101 -
     libs/libzrtp/test/go_secure_test.c            |   99 -
     libs/libzrtp/test/hash_test.c                 |   80 -
     libs/libzrtp/test/minor_bugs_test.c           |   92 -
     libs/libzrtp/test/queue.c                     |  111 -
     libs/libzrtp/test/queue.h                     |   29 -
     libs/libzrtp/test/sasrelay_test.c             |  123 -
     libs/libzrtp/test/srtp_replay_test.c          |  240 -
     libs/libzrtp/test/test_engine.c               |  854 ----
     libs/libzrtp/test/test_engine.h               |  130 -
     libs/libzrtp/test/zrtphash_test.c             |  113 -
     libs/libzrtp/third_party/bgaes/aes.h          |  232 -
     libs/libzrtp/third_party/bgaes/aes_modes.c    |  914 ----
     libs/libzrtp/third_party/bgaes/aescrypt.c     |  316 --
     libs/libzrtp/third_party/bgaes/aeskey.c       |  578 ---
     libs/libzrtp/third_party/bgaes/aesopt.h       |  728 ---
     libs/libzrtp/third_party/bgaes/aestab.c       |  400 --
     libs/libzrtp/third_party/bgaes/aestab.h       |  186 -
     libs/libzrtp/third_party/bgaes/bg2zrtp.h      |   44 -
     libs/libzrtp/third_party/bgaes/brg_types.h    |  186 -
     libs/libzrtp/third_party/bgaes/sha1.c         |  260 --
     libs/libzrtp/third_party/bgaes/sha1.h         |   73 -
     libs/libzrtp/third_party/bgaes/sha2.c         |  774 ----
     libs/libzrtp/third_party/bgaes/sha2.h         |  151 -
     libs/libzrtp/third_party/bnlib/.gitignore     |    8 -
     libs/libzrtp/third_party/bnlib/CHANGES        |   59 -
     libs/libzrtp/third_party/bnlib/Makefile.in    |  182 -
     libs/libzrtp/third_party/bnlib/README.bn      |  225 -
     libs/libzrtp/third_party/bnlib/README.bntest  |   28 -
     .../bnlib/bignum-ARM/README-small-memory      |    6 -
     .../third_party/bnlib/bignum-ARM/bntest16.c   |  797 ----
     .../third_party/bnlib/bignum-ARM/config.h     |   59 -
     .../third_party/bnlib/bignum-ARM/cputime.h    |  250 -
     .../third_party/bnlib/bignum-ARM/kludge.h     |   70 -
     .../third_party/bnlib/bignum-ARM/lbn.h        |  151 -
     .../third_party/bnlib/bignum-ARM/lbn16.c      | 4070 -----------------
     .../third_party/bnlib/bignum-ARM/lbn16.h      |  156 -
     .../third_party/bnlib/bignum-ARM/lbnarm.h     |   79 -
     .../third_party/bnlib/bignum-ARM/lbnarm.s     |  173 -
     .../third_party/bnlib/bignum-ARM/lbnmem.c     |  148 -
     .../third_party/bnlib/bignum-ARM/lbnmem.h     |   63 -
     .../third_party/bnlib/bignum-ARM/sha256_arm.c |  241 -
     .../bnlib/bignum-ARM/sha256_core.s            |  157 -
     libs/libzrtp/third_party/bnlib/bn.c           |  104 -
     libs/libzrtp/third_party/bnlib/bn.doc         |  541 ---
     libs/libzrtp/third_party/bnlib/bn.h           |  228 -
     libs/libzrtp/third_party/bnlib/bn00.c         |   30 -
     libs/libzrtp/third_party/bnlib/bn16.c         | 1182 -----
     libs/libzrtp/third_party/bnlib/bn16.h         |   66 -
     libs/libzrtp/third_party/bnlib/bn32.c         | 1182 -----
     libs/libzrtp/third_party/bnlib/bn32.h         |   66 -
     libs/libzrtp/third_party/bnlib/bn64.c         | 1182 -----
     libs/libzrtp/third_party/bnlib/bn64.h         |   66 -
     libs/libzrtp/third_party/bnlib/bn68000.c      |   25 -
     libs/libzrtp/third_party/bnlib/bn8086.c       |   25 -
     libs/libzrtp/third_party/bnlib/bnconfig.hin   |   61 -
     libs/libzrtp/third_party/bnlib/bnconfig.win   |   61 -
     libs/libzrtp/third_party/bnlib/bninit16.c     |   19 -
     libs/libzrtp/third_party/bnlib/bninit32.c     |   19 -
     libs/libzrtp/third_party/bnlib/bninit64.c     |   19 -
     libs/libzrtp/third_party/bnlib/bnintern.doc   |  304 --
     libs/libzrtp/third_party/bnlib/bnprint.c      |   76 -
     libs/libzrtp/third_party/bnlib/bnprint.h      |   14 -
     libs/libzrtp/third_party/bnlib/bnsize00.h     |   35 -
     libs/libzrtp/third_party/bnlib/bntest00.c     |   24 -
     libs/libzrtp/third_party/bnlib/bntest16.c     |  798 ----
     libs/libzrtp/third_party/bnlib/bntest32.c     |  798 ----
     libs/libzrtp/third_party/bnlib/bntest64.c     |  798 ----
     libs/libzrtp/third_party/bnlib/bootstrap.sh   |    5 -
     libs/libzrtp/third_party/bnlib/cfg            |    4 -
     libs/libzrtp/third_party/bnlib/cfg.debug      |    4 -
     libs/libzrtp/third_party/bnlib/configure.ac   |  271 --
     libs/libzrtp/third_party/bnlib/cputime.h      |  260 --
     libs/libzrtp/third_party/bnlib/germain.c      |  608 ---
     libs/libzrtp/third_party/bnlib/germain.h      |   12 -
     libs/libzrtp/third_party/bnlib/germtest.c     |  336 --
     libs/libzrtp/third_party/bnlib/jacobi.c       |   67 -
     libs/libzrtp/third_party/bnlib/jacobi.h       |   10 -
     libs/libzrtp/third_party/bnlib/kludge.h       |   74 -
     libs/libzrtp/third_party/bnlib/lbn.h          |  156 -
     libs/libzrtp/third_party/bnlib/lbn00.c        |   27 -
     libs/libzrtp/third_party/bnlib/lbn16.c        | 4067 ----------------
     libs/libzrtp/third_party/bnlib/lbn16.h        |  156 -
     libs/libzrtp/third_party/bnlib/lbn32.c        | 4067 ----------------
     libs/libzrtp/third_party/bnlib/lbn32.h        |  156 -
     libs/libzrtp/third_party/bnlib/lbn64.c        | 4067 ----------------
     libs/libzrtp/third_party/bnlib/lbn64.h        |  156 -
     libs/libzrtp/third_party/bnlib/lbn68000.c     |  460 --
     libs/libzrtp/third_party/bnlib/lbn68000.h     |   37 -
     libs/libzrtp/third_party/bnlib/lbn68020.c     |  309 --
     libs/libzrtp/third_party/bnlib/lbn68020.h     |   32 -
     libs/libzrtp/third_party/bnlib/lbn68360.s     |  280 --
     libs/libzrtp/third_party/bnlib/lbn80386.asm   |  414 --
     libs/libzrtp/third_party/bnlib/lbn80386.h     |  145 -
     libs/libzrtp/third_party/bnlib/lbn80386.s     |  394 --
     libs/libzrtp/third_party/bnlib/lbn8086.asm    | 1038 -----
     libs/libzrtp/third_party/bnlib/lbn8086.h      |   76 -
     libs/libzrtp/third_party/bnlib/lbn960jx.h     |   38 -
     libs/libzrtp/third_party/bnlib/lbn960jx.s     |  253 -
     libs/libzrtp/third_party/bnlib/lbnalpha.h     |   33 -
     libs/libzrtp/third_party/bnlib/lbnalpha.s     |  194 -
     libs/libzrtp/third_party/bnlib/lbnmem.c       |  148 -
     libs/libzrtp/third_party/bnlib/lbnmem.h       |   66 -
     libs/libzrtp/third_party/bnlib/lbnppc.c       |  322 --
     libs/libzrtp/third_party/bnlib/lbnppc.h       |   62 -
     libs/libzrtp/third_party/bnlib/legal.c        | 1100 -----
     libs/libzrtp/third_party/bnlib/legal.h        |   14 -
     libs/libzrtp/third_party/bnlib/ppcasm.h       |  539 ---
     libs/libzrtp/third_party/bnlib/prime.c        |  679 ---
     libs/libzrtp/third_party/bnlib/prime.h        |   16 -
     libs/libzrtp/third_party/bnlib/sieve.c        |  679 ---
     libs/libzrtp/third_party/bnlib/sieve.h        |   26 -
     libs/libzrtp/third_party/bnlib/sizetest.c     |   15 -
     .../third_party/bnlib/test/README.dhtest      |   21 -
     .../third_party/bnlib/test/README.dsatest     |   18 -
     .../third_party/bnlib/test/README.rsatest     |   12 -
     libs/libzrtp/third_party/bnlib/test/dhtest.c  |  375 --
     libs/libzrtp/third_party/bnlib/test/dsatest.c |  672 ---
     libs/libzrtp/third_party/bnlib/test/first.h   |    4 -
     libs/libzrtp/third_party/bnlib/test/kb.h      |   12 -
     libs/libzrtp/third_party/bnlib/test/kbmsdos.c |   75 -
     libs/libzrtp/third_party/bnlib/test/kbunix.c  |  260 --
     libs/libzrtp/third_party/bnlib/test/keygen.c  |  380 --
     libs/libzrtp/third_party/bnlib/test/keygen.h  |   11 -
     libs/libzrtp/third_party/bnlib/test/keys.c    |   55 -
     libs/libzrtp/third_party/bnlib/test/keys.h    |   34 -
     libs/libzrtp/third_party/bnlib/test/kludge.h  |   63 -
     libs/libzrtp/third_party/bnlib/test/md5.c     |  238 -
     libs/libzrtp/third_party/bnlib/test/md5.h     |   24 -
     libs/libzrtp/third_party/bnlib/test/noise.c   |  437 --
     libs/libzrtp/third_party/bnlib/test/noise.h   |   14 -
     libs/libzrtp/third_party/bnlib/test/posix.h   |   53 -
     .../libzrtp/third_party/bnlib/test/primes.doc |  215 -
     .../third_party/bnlib/test/primetest.c        |  196 -
     libs/libzrtp/third_party/bnlib/test/pt.c      |  188 -
     libs/libzrtp/third_party/bnlib/test/random.c  |  301 --
     libs/libzrtp/third_party/bnlib/test/random.h  |   15 -
     .../libzrtp/third_party/bnlib/test/randpool.c |  158 -
     .../libzrtp/third_party/bnlib/test/randpool.h |   13 -
     .../libzrtp/third_party/bnlib/test/randtest.c |  299 --
     libs/libzrtp/third_party/bnlib/test/rsaglue.c |  471 --
     libs/libzrtp/third_party/bnlib/test/rsaglue.h |   37 -
     libs/libzrtp/third_party/bnlib/test/rsatest.c |  265 --
     libs/libzrtp/third_party/bnlib/test/sha.c     |  511 ---
     libs/libzrtp/third_party/bnlib/test/sha.h     |   58 -
     libs/libzrtp/third_party/bnlib/test/types.h   |   45 -
     libs/libzrtp/third_party/bnlib/test/userio.h  |   10 -
     libs/libzrtp/third_party/bnlib/test/usuals.h  |   46 -
     scripts/debian_min_build.sh                   |    4 +-
     scripts/lua/sound_test.lua                    |    3 +-
     scripts/lua/zrtp_agent.lua                    |   38 -
     scripts/lua/zrtp_proxy_media.lua              |   87 -
     scripts/lua/zrtp_sas_proxy.lua                |  103 -
     scripts/mk_fs_fhs.sh                          |    4 +-
     src/include/switch_channel.h                  |    1 -
     src/include/switch_core_media.h               |    3 -
     src/include/switch_types.h                    |   35 +-
     .../endpoints/mod_sofia/conf/sofia.conf.xml   |    3 -
     src/mod/endpoints/mod_sofia/mod_sofia.c       |   15 -
     src/mod/endpoints/mod_sofia/mod_sofia.h       |    1 -
     src/mod/endpoints/mod_sofia/sofia.c           |   20 -
     .../test/conf-nuafail/freeswitch.xml          |    1 -
     .../mod_sofia/test/conf-sipp/freeswitch.xml   |    3 -
     .../mod_sofia/test/conf/freeswitch.xml        |    1 -
     .../event_handlers/mod_kazoo/kazoo_ei_utils.c |    8 -
     src/switch_channel.c                          |   57 -
     src/switch_core.c                             |   55 -
     src/switch_core_media.c                       |  190 -
     src/switch_core_session.c                     |    4 -
     src/switch_ivr_originate.c                    |   11 +-
     src/switch_rtp.c                              |  564 +--
     tests/unit/conf/freeswitch.xml                |    1 -
     tests/unit/conf_eavesdrop/freeswitch.xml      |    2 -
     tests/unit/conf_rtp/freeswitch.xml            |    1 -
     tests/unit/conf_sip/freeswitch.xml            |    2 -
     tests/unit/conf_sofia/freeswitch.xml          |    2 -
     tests/unit/conf_test/freeswitch.xml           |    2 -
     w32/Library/FreeSwitchCore.2017.vcxproj       |   21 +-
     329 files changed, 35 insertions(+), 90031 deletions(-)
     delete mode 100755 build/buildzrtp.sh
     delete mode 100644 libs/libzrtp/.gitignore
     delete mode 100644 libs/libzrtp/AUTHORS
     delete mode 100644 libs/libzrtp/COPYING
     delete mode 100644 libs/libzrtp/ChangeLog
     delete mode 100644 libs/libzrtp/INSTALL
     delete mode 100644 libs/libzrtp/Makefile.am
     delete mode 100644 libs/libzrtp/NEWS
     delete mode 100644 libs/libzrtp/README
     delete mode 100644 libs/libzrtp/acinclude.m4
     delete mode 100755 libs/libzrtp/bootstrap.sh
     delete mode 100644 libs/libzrtp/configure.ac
     delete mode 100755 libs/libzrtp/create_docs.sh
     delete mode 100755 libs/libzrtp/create_pack.pl
     delete mode 100644 libs/libzrtp/doc/Doxyfile.in
     delete mode 100644 libs/libzrtp/doc/manuals/changelog.dox
     delete mode 100644 libs/libzrtp/doc/manuals/howto.dox
     delete mode 100644 libs/libzrtp/doc/manuals/main.dox
     delete mode 100644 libs/libzrtp/doc/manuals/rng.dox
     delete mode 100644 libs/libzrtp/include/zrtp.h
     delete mode 100644 libs/libzrtp/include/zrtp_base.h
     delete mode 100644 libs/libzrtp/include/zrtp_config.h
     delete mode 100644 libs/libzrtp/include/zrtp_config_android.h
     delete mode 100644 libs/libzrtp/include/zrtp_config_symbian.h
     delete mode 100644 libs/libzrtp/include/zrtp_config_user.h
     delete mode 100644 libs/libzrtp/include/zrtp_config_win.h
     delete mode 100644 libs/libzrtp/include/zrtp_crypto.h
     delete mode 100644 libs/libzrtp/include/zrtp_ec.h
     delete mode 100644 libs/libzrtp/include/zrtp_engine.h
     delete mode 100644 libs/libzrtp/include/zrtp_error.h
     delete mode 100644 libs/libzrtp/include/zrtp_iface.h
     delete mode 100644 libs/libzrtp/include/zrtp_iface_cache.h
     delete mode 100644 libs/libzrtp/include/zrtp_iface_scheduler.h
     delete mode 100644 libs/libzrtp/include/zrtp_iface_system.h
     delete mode 100644 libs/libzrtp/include/zrtp_legal.h
     delete mode 100644 libs/libzrtp/include/zrtp_list.h
     delete mode 100644 libs/libzrtp/include/zrtp_log.h
     delete mode 100644 libs/libzrtp/include/zrtp_pbx.h
     delete mode 100644 libs/libzrtp/include/zrtp_protocol.h
     delete mode 100644 libs/libzrtp/include/zrtp_srtp.h
     delete mode 100644 libs/libzrtp/include/zrtp_srtp_builtin.h
     delete mode 100644 libs/libzrtp/include/zrtp_string.h
     delete mode 100644 libs/libzrtp/include/zrtp_types.h
     delete mode 100644 libs/libzrtp/include/zrtp_version.h
     delete mode 100644 libs/libzrtp/projects/android/jni/Android.mk
     delete mode 100644 libs/libzrtp/projects/symbian/DelayRuner.cpp
     delete mode 100644 libs/libzrtp/projects/symbian/DelayRuner.h
     delete mode 100755 libs/libzrtp/projects/symbian/bld.bat
     delete mode 100644 libs/libzrtp/projects/symbian/bld.inf
     delete mode 100755 libs/libzrtp/projects/symbian/bldgcce.bat
     delete mode 100644 libs/libzrtp/projects/symbian/libzrtp.mmp
     delete mode 100644 libs/libzrtp/projects/symbian/zrtp_iface_symb.cpp
     delete mode 100644 libs/libzrtp/projects/win/libzrtp.2010.vcxproj.filters
     delete mode 100644 libs/libzrtp/projects/win/libzrtp.2017.vcxproj
     delete mode 100644 libs/libzrtp/projects/win/libzrtp.sln
     delete mode 100644 libs/libzrtp/projects/win/libzrtp.vcproj
     delete mode 100644 libs/libzrtp/projects/win/libzrtp.x32.vcxproj
     delete mode 100644 libs/libzrtp/projects/win/libzrtp.x32.vcxproj.filters
     delete mode 100644 libs/libzrtp/projects/win/libzrtp.x64.vcxproj
     delete mode 100644 libs/libzrtp/projects/win/libzrtp.x64.vcxproj.filters
     delete mode 100644 libs/libzrtp/projects/win/libzrtp_not_ec.vcproj
     delete mode 100644 libs/libzrtp/projects/win/libzrtp_test.vcproj
     delete mode 100644 libs/libzrtp/projects/win_ce/libzrtp_test_wince.vcproj
     delete mode 100644 libs/libzrtp/projects/win_ce/libzrtp_wince.sln
     delete mode 100644 libs/libzrtp/projects/win_ce/libzrtp_wince.vcproj
     delete mode 100644 libs/libzrtp/projects/win_ce/libzrtp_wince_not_ec.vcproj
     delete mode 100644 libs/libzrtp/projects/win_kernel/MAKEFILE.WIN32
     delete mode 100644 libs/libzrtp/projects/win_kernel/MAKEFILE.WIN64
     delete mode 100644 libs/libzrtp/projects/win_kernel/MAKEFILE_NOT_EC.WIN32
     delete mode 100644 libs/libzrtp/projects/win_kernel/MAKEFILE_NOT_EC.WIN64
     delete mode 100644 libs/libzrtp/projects/xcode/libzrtp.xcodeproj/project.pbxproj
     delete mode 100644 libs/libzrtp/projects/xcode/libzrtp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
     delete mode 100644 libs/libzrtp/projects/xcode/libzrtp_test.xcodeproj/project.pbxproj
     delete mode 100644 libs/libzrtp/projects/xcode/libzrtp_test.xcodeproj/project.xcworkspace/contents.xcworkspacedata
     delete mode 100644 libs/libzrtp/src/zrtp.c
     delete mode 100644 libs/libzrtp/src/zrtp_crc.c
     delete mode 100644 libs/libzrtp/src/zrtp_crypto_aes.c
     delete mode 100644 libs/libzrtp/src/zrtp_crypto_atl.c
     delete mode 100644 libs/libzrtp/src/zrtp_crypto_ec.c
     delete mode 100644 libs/libzrtp/src/zrtp_crypto_ecdh.c
     delete mode 100644 libs/libzrtp/src/zrtp_crypto_ecdsa.c
     delete mode 100644 libs/libzrtp/src/zrtp_crypto_hash.c
     delete mode 100644 libs/libzrtp/src/zrtp_crypto_pk.c
     delete mode 100644 libs/libzrtp/src/zrtp_crypto_sas.c
     delete mode 100644 libs/libzrtp/src/zrtp_datatypes.c
     delete mode 100644 libs/libzrtp/src/zrtp_engine.c
     delete mode 100644 libs/libzrtp/src/zrtp_engine_driven.c
     delete mode 100644 libs/libzrtp/src/zrtp_iface_cache.c
     delete mode 100644 libs/libzrtp/src/zrtp_iface_scheduler.c
     delete mode 100644 libs/libzrtp/src/zrtp_iface_sys.c
     delete mode 100644 libs/libzrtp/src/zrtp_initiator.c
     delete mode 100644 libs/libzrtp/src/zrtp_legal.c
     delete mode 100644 libs/libzrtp/src/zrtp_list.c
     delete mode 100644 libs/libzrtp/src/zrtp_log.c
     delete mode 100644 libs/libzrtp/src/zrtp_pbx.c
     delete mode 100644 libs/libzrtp/src/zrtp_protocol.c
     delete mode 100644 libs/libzrtp/src/zrtp_responder.c
     delete mode 100644 libs/libzrtp/src/zrtp_rng.c
     delete mode 100644 libs/libzrtp/src/zrtp_srtp_builtin.c
     delete mode 100644 libs/libzrtp/src/zrtp_srtp_dm.c
     delete mode 100644 libs/libzrtp/src/zrtp_string.c
     delete mode 100644 libs/libzrtp/src/zrtp_utils.c
     delete mode 100644 libs/libzrtp/src/zrtp_utils_proto.c
     delete mode 100644 libs/libzrtp/test/cache_test.c
     delete mode 100644 libs/libzrtp/test/cipher_test.c
     delete mode 100644 libs/libzrtp/test/cmockery/cmockery.c
     delete mode 100644 libs/libzrtp/test/cmockery/cmockery.h
     delete mode 100644 libs/libzrtp/test/dh_test.c
     delete mode 100644 libs/libzrtp/test/dk_test.c
     delete mode 100644 libs/libzrtp/test/ecdh_test.c
     delete mode 100644 libs/libzrtp/test/engine_helpers.c
     delete mode 100644 libs/libzrtp/test/enroll_test_helpers.c
     delete mode 100644 libs/libzrtp/test/enrollment_test.c
     delete mode 100644 libs/libzrtp/test/go_secure_test.c
     delete mode 100644 libs/libzrtp/test/hash_test.c
     delete mode 100644 libs/libzrtp/test/minor_bugs_test.c
     delete mode 100644 libs/libzrtp/test/queue.c
     delete mode 100644 libs/libzrtp/test/queue.h
     delete mode 100644 libs/libzrtp/test/sasrelay_test.c
     delete mode 100644 libs/libzrtp/test/srtp_replay_test.c
     delete mode 100644 libs/libzrtp/test/test_engine.c
     delete mode 100644 libs/libzrtp/test/test_engine.h
     delete mode 100644 libs/libzrtp/test/zrtphash_test.c
     delete mode 100644 libs/libzrtp/third_party/bgaes/aes.h
     delete mode 100644 libs/libzrtp/third_party/bgaes/aes_modes.c
     delete mode 100644 libs/libzrtp/third_party/bgaes/aescrypt.c
     delete mode 100644 libs/libzrtp/third_party/bgaes/aeskey.c
     delete mode 100644 libs/libzrtp/third_party/bgaes/aesopt.h
     delete mode 100644 libs/libzrtp/third_party/bgaes/aestab.c
     delete mode 100644 libs/libzrtp/third_party/bgaes/aestab.h
     delete mode 100644 libs/libzrtp/third_party/bgaes/bg2zrtp.h
     delete mode 100644 libs/libzrtp/third_party/bgaes/brg_types.h
     delete mode 100644 libs/libzrtp/third_party/bgaes/sha1.c
     delete mode 100644 libs/libzrtp/third_party/bgaes/sha1.h
     delete mode 100644 libs/libzrtp/third_party/bgaes/sha2.c
     delete mode 100644 libs/libzrtp/third_party/bgaes/sha2.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/.gitignore
     delete mode 100644 libs/libzrtp/third_party/bnlib/CHANGES
     delete mode 100644 libs/libzrtp/third_party/bnlib/Makefile.in
     delete mode 100644 libs/libzrtp/third_party/bnlib/README.bn
     delete mode 100644 libs/libzrtp/third_party/bnlib/README.bntest
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/README-small-memory
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/bntest16.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/config.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/cputime.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/kludge.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/lbn.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/lbn16.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/lbnarm.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/lbnarm.s
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/lbnmem.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/sha256_arm.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bignum-ARM/sha256_core.s
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn.doc
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn00.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn16.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn16.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn32.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn32.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn64.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn64.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn68000.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bn8086.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bnconfig.hin
     delete mode 100644 libs/libzrtp/third_party/bnlib/bnconfig.win
     delete mode 100644 libs/libzrtp/third_party/bnlib/bninit16.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bninit32.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bninit64.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bnintern.doc
     delete mode 100644 libs/libzrtp/third_party/bnlib/bnprint.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bnprint.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bnsize00.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/bntest00.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bntest16.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bntest32.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/bntest64.c
     delete mode 100755 libs/libzrtp/third_party/bnlib/bootstrap.sh
     delete mode 100755 libs/libzrtp/third_party/bnlib/cfg
     delete mode 100755 libs/libzrtp/third_party/bnlib/cfg.debug
     delete mode 100644 libs/libzrtp/third_party/bnlib/configure.ac
     delete mode 100644 libs/libzrtp/third_party/bnlib/cputime.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/germain.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/germain.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/germtest.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/jacobi.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/jacobi.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/kludge.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn00.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn16.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn16.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn32.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn32.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn64.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn64.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn68000.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn68000.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn68020.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn68020.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn68360.s
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn80386.asm
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn80386.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn80386.s
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn8086.asm
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn8086.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn960jx.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbn960jx.s
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbnalpha.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbnalpha.s
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbnmem.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbnmem.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbnppc.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/lbnppc.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/legal.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/legal.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/ppcasm.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/prime.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/prime.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/sieve.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/sieve.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/sizetest.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/README.dhtest
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/README.dsatest
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/README.rsatest
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/dhtest.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/dsatest.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/first.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/kb.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/kbmsdos.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/kbunix.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/keygen.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/keygen.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/keys.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/keys.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/kludge.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/md5.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/md5.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/noise.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/noise.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/posix.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/primes.doc
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/primetest.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/pt.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/random.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/random.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/randpool.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/randpool.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/randtest.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/rsaglue.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/rsaglue.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/rsatest.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/sha.c
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/sha.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/types.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/userio.h
     delete mode 100644 libs/libzrtp/third_party/bnlib/test/usuals.h
     delete mode 100644 scripts/lua/zrtp_agent.lua
     delete mode 100644 scripts/lua/zrtp_proxy_media.lua
     delete mode 100644 scripts/lua/zrtp_sas_proxy.lua
    
    diff --git a/Freeswitch.2017.sln b/Freeswitch.2017.sln
    index 6b6f24055e..5f3259a6e0 100644
    --- a/Freeswitch.2017.sln
    +++ b/Freeswitch.2017.sln
    @@ -417,8 +417,6 @@ 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.2017.vcxproj", "{74B120FF-6935-4DFE-A142-CDB6BEA99C90}"
     EndProject
    -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp", "libs\libzrtp\projects\win\libzrtp.2017.vcxproj", "{C13CC324-0032-4492-9A30-310A6BD64FF5}"
    -EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mod_redis", "src\mod\applications\mod_redis\mod_redis.2017.vcxproj", "{886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}"
     EndProject
     Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjpeg", "libs\win32\libjpeg\libjpeg.2017.vcxproj", "{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1}"
    @@ -1865,17 +1863,6 @@ Global
     		{74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|Win32.Build.0 = Release|Win32
     		{74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x64.ActiveCfg = Release|x64
     		{74B120FF-6935-4DFE-A142-CDB6BEA99C90}.Release|x64.Build.0 = 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}.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
     		{886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.All|Win32.ActiveCfg = Release|x64
     		{886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.All|x64.ActiveCfg = Release|x64
     		{886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6}.All|x64.Build.0 = Release|x64
    @@ -2670,7 +2657,6 @@ Global
     		{9DE35039-A8F6-4FBF-B1B6-EB527F802411} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{26C82FCE-E0CF-4D10-A00C-D8E582FFEB53} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{74B120FF-6935-4DFE-A142-CDB6BEA99C90} = {9460B5F1-0A95-41C4-BEB7-9C2C96459A7C}
    -		{C13CC324-0032-4492-9A30-310A6BD64FF5} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{886B5E9D-F2C2-4AF2-98C8-EF98C4C770E6} = {E72B5BCB-6462-4D23-B419-3AF1A4AC3D78}
     		{019DBD2A-273D-4BA4-BF86-B5EFE2ED76B1} = {EB910B0D-F27D-4B62-B67B-DE834C99AC5B}
     		{D2396DD7-7D38-473A-ABB7-6F96D65AE1B9} = {9DE35039-A8F6-4FBF-B1B6-EB527F802411}
    diff --git a/LICENSE b/LICENSE
    index 2002b83219..e36ad2a73c 100644
    --- a/LICENSE
    +++ b/LICENSE
    @@ -1709,27 +1709,6 @@ License: LGPL-2.1
     Files: libs/broadvoice/autogen.sh
     License: GPL-2
     
    -Files: libs/libzrtp/*
    -Copyright: 2006-2012 Philip R. Zimmermann.
    - 1993-2005 Colin Plumb
    - 1998-2006, Dr Brian Gladman, Worcester, UK.
    - 2002, Bryce "Zooko" Wilcox-O'Hearn
    - 2010 Soft Industry
    -License: AGPL-3 or MPL-1.1
    -
    -Files: libs/libzrtp/test/cmockery/cmockery.c
    -Copyright: 2008 Google Inc
    -License: Apache-2.0
    -
    -Files: libs/libzrtp/third_party/bnlib/legal.c
    - libs/libzrtp/third_party/bnlib/*
    -Copyright: 1993-2005 Colin Plumb
    -License: GPL-2 or GPL-3 or MPL-1.1
    -
    -Files: libs/libzrtp/third_party/bnlib/test/md5.c
    -Copyright: 1995 Abandoned Colin Plumb
    -License: public-domain
    -
     Files: libs/win32/sqlite/sqlite3.[ch]
      libs/win32/sqlite/parse.c
     Copyright: 2006 Abandoned D. Richard Hipp 
    diff --git a/Makefile.am b/Makefile.am
    index f869072ff7..fdd339a68b 100644
    --- a/Makefile.am
    +++ b/Makefile.am
    @@ -244,19 +244,6 @@ if HAVE_ODBC
     libfreeswitch_la_LDFLAGS += $(ODBC_LIB_FLAGS)
     endif
     
    -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 = -L$(switch_srcdir)/libs/libzrtp/third_party/bnlib
    -ZRTP_LDFLAGS += -L$(switch_srcdir)/libs/libzrtp
    -ZRTP_LIBS = -lbn -lzrtp
    -libfreeswitch_la_LDFLAGS += $(ZRTP_LDFLAGS)
    -libfreeswitch_la_LIBADD += $(ZRTP_LIBS)
    -CORE_LIBS += libs/libzrtp/libzrtp.a
    -LIBS += libs/libzrtp/third_party/bnlib/libbn.a
    -endif
    -
     library_includetestdir = $(includedir)/test
     library_includetest_HEADERS = \
     	src/include/test/switch_fct.h \
    @@ -570,9 +557,6 @@ src/include/switch_version.h: src/include/switch_version.h.in Makefile $(switch_
     libs/libedit/src/.libs/libedit.a:
     	cd libs/libedit && $(MAKE)
     
    -libs/libzrtp/libzrtp.a:
    -	cd libs/libzrtp && $(MAKE)
    -
     libs/libvpx/Makefile: libs/libvpx/.update
     	cd libs/libvpx && CC="$(CC)" CXX="$(CXX)" CFLAGS="$(CFLAGS) $(VISIBILITY_FLAG)" CXXFLAGS="$(CXXFLAGS)" LDFLAGS="$(LDFLAGS)" ./configure --enable-pic --disable-docs --disable-examples --disable-install-bins --disable-install-srcs --disable-unit-tests --size-limit=16384x16384
     
    diff --git a/bootstrap.sh b/bootstrap.sh
    index 802c6098f7..afa73687f5 100755
    --- a/bootstrap.sh
    +++ b/bootstrap.sh
    @@ -10,7 +10,7 @@ BGJOB=false
     VERBOSE=false
     BASEDIR=`pwd`;
     LIBDIR=${BASEDIR}/libs;
    -SUBDIRS="apr libzrtp iksemel srtp fs";
    +SUBDIRS="apr iksemel srtp fs";
     
     while getopts 'jhd:v' o; do 
       case "$o" in
    @@ -172,10 +172,6 @@ bootstrap_apr() {
     
     }
     
    -bootstrap_libzrtp() {
    -  (cd ${LIBDIR}/libzrtp && ./bootstrap.sh)
    -}
    -
     # Libs automake automation function
     libbootstrap() {
       i=$1
    @@ -260,7 +256,7 @@ bootstrap_libs_post() {
     bootstrap_libs() {
       for i in ${SUBDIRS}; do
         case "$i" in
    -      apr|fs|libzrtp)
    +      apr|fs)
             ${BGJOB} && wait
             bootstrap_$i
             continue
    diff --git a/build/buildzrtp.sh b/build/buildzrtp.sh
    deleted file mode 100755
    index 9df8fff6f6..0000000000
    --- a/build/buildzrtp.sh
    +++ /dev/null
    @@ -1,8 +0,0 @@
    -#!/bin/sh
    -tar zxf libzrtp-0.81.514.tar.gz
    -cd libzrtp-0.81.514
    -patch -p1 < ../patches/zrtp_bnlib_pic.diff
    -cd projects/gnu/
    -./configure CFLAGS="-fPIC"
    -make
    -make install
    diff --git a/conf/insideout/sip_profiles/external.xml b/conf/insideout/sip_profiles/external.xml
    index 22fd155434..be38318432 100644
    --- a/conf/insideout/sip_profiles/external.xml
    +++ b/conf/insideout/sip_profiles/external.xml
    @@ -48,7 +48,6 @@
         
         
         
    -     
         
    diff --git a/conf/insideout/sip_profiles/internal-ipv6.xml b/conf/insideout/sip_profiles/internal-ipv6.xml
    index 0ae93cfc82..64dac272c3 100644
    --- a/conf/insideout/sip_profiles/internal-ipv6.xml
    +++ b/conf/insideout/sip_profiles/internal-ipv6.xml
    @@ -70,9 +70,6 @@
         
         
     
    -    
    -    
    -
         
         
         
    diff --git a/conf/insideout/sip_profiles/internal.xml b/conf/insideout/sip_profiles/internal.xml
    index b64b5cea86..63ea350449 100644
    --- a/conf/insideout/sip_profiles/internal.xml
    +++ b/conf/insideout/sip_profiles/internal.xml
    @@ -106,9 +106,6 @@
         
         
     
    -    
    -    
    -
         
         
         
    diff --git a/conf/rayo/autoload_configs/switch.conf.xml b/conf/rayo/autoload_configs/switch.conf.xml
    index d23d832224..02aa434f9b 100644
    --- a/conf/rayo/autoload_configs/switch.conf.xml
    +++ b/conf/rayo/autoload_configs/switch.conf.xml
    @@ -145,8 +145,6 @@
         
         
     
    -    
    -
         
         
    diff --git a/conf/rayo/vars.xml b/conf/rayo/vars.xml
    index a91c963465..af602cad34 100644
    --- a/conf/rayo/vars.xml
    +++ b/conf/rayo/vars.xml
    @@ -14,13 +14,6 @@
       
       
     
    -  
    -  
    -
       
       
     
    diff --git a/conf/sbc/sbc_profiles/external.xml b/conf/sbc/sbc_profiles/external.xml
    index 7bf024658b..1cb91e8dab 100644
    --- a/conf/sbc/sbc_profiles/external.xml
    +++ b/conf/sbc/sbc_profiles/external.xml
    @@ -49,7 +49,6 @@
         
         
         
    -     
         
    diff --git a/conf/sbc/sbc_profiles/internal-ipv6.xml b/conf/sbc/sbc_profiles/internal-ipv6.xml
    index 525554f4b8..e433da1425 100644
    --- a/conf/sbc/sbc_profiles/internal-ipv6.xml
    +++ b/conf/sbc/sbc_profiles/internal-ipv6.xml
    @@ -69,9 +69,6 @@
         
         
     
    -    
    -    
    -
         
         
         
    diff --git a/conf/sbc/sbc_profiles/internal.xml b/conf/sbc/sbc_profiles/internal.xml
    index d4b2efd37b..8263a82668 100644
    --- a/conf/sbc/sbc_profiles/internal.xml
    +++ b/conf/sbc/sbc_profiles/internal.xml
    @@ -110,9 +110,6 @@
         
         
     
    -    
    -    
    -
         
         
         
    diff --git a/conf/testing/autoload_configs/switch.conf.xml b/conf/testing/autoload_configs/switch.conf.xml
    index d07c1b2d6e..2633165f68 100644
    --- a/conf/testing/autoload_configs/switch.conf.xml
    +++ b/conf/testing/autoload_configs/switch.conf.xml
    @@ -150,8 +150,6 @@
         
         
     
    -    
    -
         
         
    diff --git a/conf/testing/sip_profiles/external.xml b/conf/testing/sip_profiles/external.xml
    index 6edc878c06..4d12b0f5b3 100644
    --- a/conf/testing/sip_profiles/external.xml
    +++ b/conf/testing/sip_profiles/external.xml
    @@ -57,7 +57,6 @@
         
         
         
    -     
         
    diff --git a/conf/testing/sip_profiles/internal-ipv6.xml b/conf/testing/sip_profiles/internal-ipv6.xml
    index 98efa2ffbb..46e60d4ad9 100644
    --- a/conf/testing/sip_profiles/internal-ipv6.xml
    +++ b/conf/testing/sip_profiles/internal-ipv6.xml
    @@ -71,9 +71,6 @@
         
         
     
    -    
    -    
    -
         
         
         
    diff --git a/conf/testing/sip_profiles/internal.xml b/conf/testing/sip_profiles/internal.xml
    index d7b2ef893d..62f52af63f 100644
    --- a/conf/testing/sip_profiles/internal.xml
    +++ b/conf/testing/sip_profiles/internal.xml
    @@ -246,9 +246,6 @@
         
         
     
    -    
    -    
    -
         
         
         
    diff --git a/conf/testing/vars.xml b/conf/testing/vars.xml
    index 814f709be3..68d5e1083e 100644
    --- a/conf/testing/vars.xml
    +++ b/conf/testing/vars.xml
    @@ -7,7 +7,6 @@
       
       
       
    -  
       
       
       
    diff --git a/conf/vanilla/autoload_configs/switch.conf.xml b/conf/vanilla/autoload_configs/switch.conf.xml
    index ba54eb7fce..8117d8ed9c 100644
    --- a/conf/vanilla/autoload_configs/switch.conf.xml
    +++ b/conf/vanilla/autoload_configs/switch.conf.xml
    @@ -153,8 +153,6 @@
         
         
     
    -    
    -
         
    -	
     	
           
         
    @@ -768,13 +764,6 @@
           
         
     
    -    
    -    
    -      
    -	
    -      
    -    
    -
          
           
    diff --git a/conf/vanilla/sip_profiles/external-ipv6.xml b/conf/vanilla/sip_profiles/external-ipv6.xml
    index 99e8feb246..1b9d0c857d 100644
    --- a/conf/vanilla/sip_profiles/external-ipv6.xml
    +++ b/conf/vanilla/sip_profiles/external-ipv6.xml
    @@ -57,7 +57,6 @@
         
         
         
    -     
         
    diff --git a/conf/vanilla/sip_profiles/external.xml b/conf/vanilla/sip_profiles/external.xml
    index d9e312d78f..57ec4a6e74 100644
    --- a/conf/vanilla/sip_profiles/external.xml
    +++ b/conf/vanilla/sip_profiles/external.xml
    @@ -57,7 +57,6 @@
         
         
         
    -     
         
    diff --git a/conf/vanilla/sip_profiles/internal-ipv6.xml b/conf/vanilla/sip_profiles/internal-ipv6.xml
    index f067ae7482..26c891ba98 100644
    --- a/conf/vanilla/sip_profiles/internal-ipv6.xml
    +++ b/conf/vanilla/sip_profiles/internal-ipv6.xml
    @@ -73,9 +73,6 @@
         
         
     
    -    
    -    
    -
         
         
         
    diff --git a/conf/vanilla/sip_profiles/internal.xml b/conf/vanilla/sip_profiles/internal.xml
    index 5e38cfac1f..eb07779f43 100644
    --- a/conf/vanilla/sip_profiles/internal.xml
    +++ b/conf/vanilla/sip_profiles/internal.xml
    @@ -251,9 +251,6 @@
         
         
     
    -    
    -    
    -
         
         
         
    diff --git a/conf/vanilla/vars.xml b/conf/vanilla/vars.xml
    index 387592c978..e612694c83 100644
    --- a/conf/vanilla/vars.xml
    +++ b/conf/vanilla/vars.xml
    @@ -41,7 +41,6 @@
           storage_dir
           cache_dir
           core_uuid
    -      zrtp_enabled
           nat_public_addr
           nat_private_addr
           nat_type
    @@ -64,12 +63,6 @@
       
       
       
    -  
    -  
       
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -    
       
     
     
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -    
       
     
     
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -    
       
     
    diff --git a/docs/phrase/phrase_es_MX.xml b/docs/phrase/phrase_es_MX.xml
    index 7860d01e81..c7882ff7e0 100644
    --- a/docs/phrase/phrase_es_MX.xml
    +++ b/docs/phrase/phrase_es_MX.xml
    @@ -991,23 +991,5 @@
           
           
         
    -    
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -    
       
     
    diff --git a/docs/phrase/phrase_pt_BR.xml b/docs/phrase/phrase_pt_BR.xml
    index af58683a09..d618767b8f 100644
    --- a/docs/phrase/phrase_pt_BR.xml
    +++ b/docs/phrase/phrase_pt_BR.xml
    @@ -985,23 +985,5 @@
            
            
         
    -    
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -       
    -    
       
     
    diff --git a/docs/phrase/phrase_pt_PT.xml b/docs/phrase/phrase_pt_PT.xml
    index 66775ef839..4a04b5751d 100644
    --- a/docs/phrase/phrase_pt_PT.xml
    +++ b/docs/phrase/phrase_pt_PT.xml
    @@ -984,23 +984,5 @@
           
           
         
    -    
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -      
    -       
    -      
    -      
    -    
       
     
    diff --git a/docs/phrase/phrase_ru.xml b/docs/phrase/phrase_ru.xml
    index fb873dd9da..714afa440f 100644
    --- a/docs/phrase/phrase_ru.xml
    +++ b/docs/phrase/phrase_ru.xml
    @@ -1157,39 +1157,6 @@
           		
           		
         	
    -    	
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -      		
    -    	
         	
         		
         		
    diff --git a/freeswitch.spec b/freeswitch.spec
    index 3af95eabce..709f3ef38d 100644
    --- a/freeswitch.spec
    +++ b/freeswitch.spec
    @@ -1616,7 +1616,6 @@ autoreconf --force --install
     --with-odbc \
     --with-erlang \
     --with-openssl \
    ---enable-zrtp \
     %{?configure_options}
     
     unset MODULES
    diff --git a/libs/libzrtp/.gitignore b/libs/libzrtp/.gitignore
    deleted file mode 100644
    index 9f4002095f..0000000000
    --- a/libs/libzrtp/.gitignore
    +++ /dev/null
    @@ -1,22 +0,0 @@
    -# -*- mode:conf -*-
    -/*.a
    -/*.dat
    -/*.o
    -/.cproject
    -/.deps
    -/.project
    -/.stamp-doc
    -/Makefile
    -/Makefile.in
    -/_configs.sed
    -/aclocal.m4
    -/autom4te.cache/*
    -/cache_test
    -/config.*
    -/config/*
    -/configure
    -/doc/Doxyfile
    -/doc/out
    -/include/zrtp_config_unix.h
    -!/build/Makefile.am
    -!/build/test/Makefile.am
    diff --git a/libs/libzrtp/AUTHORS b/libs/libzrtp/AUTHORS
    deleted file mode 100644
    index f948f2f08e..0000000000
    --- a/libs/libzrtp/AUTHORS
    +++ /dev/null
    @@ -1,30 +0,0 @@
    -# 
    -# Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved.
    -# Contact: http://philzimmermann.com
    -# For licensing and other legal details, see the file zrtp_legal.c.
    -# 
    -# Viktor Krikun  
    -
    -Created by Phil Zimmermann.
    -
    -Developers:
    -	Viktor Krikun
    -	Nikolay Popok
    -	Vitaly Rozhkov
    -	Andrey Rozinko
    -	Bryce Wilcox-O'Hearn
    -	
    -Thanks to:
    -	Alan Johnston
    -	Jon Callas
    -	Hal Finney
    -	Colin Plumb
    -	Sagar Pai
    -	Werner Dittmann
    -	Travis Cross
    -	L. Amber Wilcox-O'Hearn
    -	Ariel Boston
    -	Donovan Preston
    -
    -Portions of this software are available under open source licenses from other authors.
    -Notably, Brian Gladman's AES implementation, and David McGrew's libSRTP package.
    diff --git a/libs/libzrtp/COPYING b/libs/libzrtp/COPYING
    deleted file mode 100644
    index ac0efbec90..0000000000
    --- a/libs/libzrtp/COPYING
    +++ /dev/null
    @@ -1,7 +0,0 @@
    -/*
    - * libZRTP SDK library, implements the ZRTP secure VoIP protocol.
    - * Copyright (c) 2006-2009 Philip R. Zimmermann.  All rights reserved.
    - * Contact: http://philzimmermann.com
    - * For licensing and other legal details, see the file zrtp_legal.c.
    - */
    - 
    \ No newline at end of file
    diff --git a/libs/libzrtp/ChangeLog b/libs/libzrtp/ChangeLog
    deleted file mode 100644
    index 6fdf46638c..0000000000
    --- a/libs/libzrtp/ChangeLog
    +++ /dev/null
    @@ -1,556 +0,0 @@
    - * libZRTP SDK library, implements the ZRTP secure VoIP protocol.
    - * Copyright (c) 2006-2009 Philip R. Zimmermann.  All rights reserved.
    - * Contact: http://philzimmermann.com
    - * For licensing and other legal details, see the file zrtp_legal.c.
    -
    -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    -SINCE LIBZRTP v0.80 CHANGELOG IS A PART OF HTML DOCUMENTATION. 
    -Check generated html or doc/manuals/changelog.dox doxygen sources
    -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    -
    -
    -libzrtp 0.7.1											18.11.2008
    ---------------------------------------------------------------------------------
    -1.	Fixed bug with hardcoded AES128 cipher for generating SRTP keys. In this 
    -	version is selected according to ZRTP discovery.
    -	
    -2.	Added initialization/deinitalization functions to zrtp helper functions.
    -
    -libzrtp 0.7.0											04.11.2008
    ---------------------------------------------------------------------------------
    -1.	Changes in libzrtp sources tree.
    -
    -2.	Improvements in libzrtp initialization routine:
    -	- all global zrtp options were combined in zrtp_config_t structure;
    -	- zrtp_init() allocates memory for zrtp global context;
    -	- zrtp_config_defaults() 
    -
    -3.	Improvements for Passive/Active mode support.
    -	a) A passive endpoint never sends a commit message, period. Also, it 
    -	declares itself as a passive endpoint by setting the P flag it its own
    -	Hello message;
    -	b) A active endpoint does not send a commit to a passive endpoint, which it 
    -	recognizes by detecting the P flag;
    -	c) A passive phone, if acting as a SIP initiator (meaning it initiated the 
    -	call), rejects all commit packets from everyone;
    -	d) A passive phone rejects all commit messages from a PBX, which is easily 
    -	recognized by the M flag.
    -	Passive mode support is built into the library logic and will be used
    -	automatically if the developer specifies signaling role by setting 
    -	is_initiator flag in zrtp_init_session_ctx().
    -
    -4.	Improvements in ZRTP feedback interface and system-dependent functions.
    -    There are two types of interface functions in libzrtp: system dependent API
    -	and realization of helper functions and events. System dependent API in
    -	defined in zrtp_iface_system.h as set of extern functions. System
    -	functions are already implemented for several basic platforms in
    -	zrtp_iface.sys.c libzrtp feedback and helper functions were re-factored
    -	and implemented as set of callbacks. If the developer doesn't want to
    -	handle one or another event it may just leave necessary pointer empty.
    -	See zrtp_init() and zrtp_callback_t, zrtp_iface.h for more details.
    -
    -5. 	ZRTP configuration approach was improved: zrtp_config_xxx.h contains
    -	adjustments for necessary target platform. libzrtp contains default
    -	configs for Linux, OS X, Windows, Window CE and Symbian platforms.
    -	All ZRTP protocol and behavior related adjustments are collected in
    -	zrtp_config_user.h. Edit this file to configure libzrtp for your
    -	needs.
    -	
    -6.	Implemented new functions in protocol according to the Internet Draft v 10.
    -
    -7.	Improved realization of built-in libzrtp scheduler. Fixed bug with crashing
    -	on performing delay call when zrtp session have been already deleted.
    -	
    -8. 	Logging function was improved. Use ZRTP_LOG macro to print log messages. See
    -	zrtp_log.h for more information.
    -
    -
    -libzrtp 0.6.8											03.09.2008
    ---------------------------------------------------------------------------------
    -ZRTP
    -1.	Fixed bug with incorrect maximum value for T1 retry interval timer which 
    -    increased delay between LOOKING_FOR_ZRTP and NO_ZRTP_SUPPORT states. 
    -    Internal fix, no API changes required;
    -2.	Implemented version negotiation according to the latest specification.
    -	libzrtp v 0.6.8 supports ZRTP v0.90 only. No changes required in 
    -	applications that use the SDK.
    -3. 	Compilation flag WITH_ZFONE was removed. The developer, who wants to use
    -	built-in ZRTP cache, has to set name of the ZRTP cache explicitly,
    -	implementing  zrtp_get_cache_path() function.
    -4. 	New libzrtp licensing scheme was implemented. It allows the licensing policy 
    -    to be changed at run time.  See zrtp_license_mode_t doc. for more details. 
    -    Affected API - zrtp_init().
    -5. 	ZRTP Protocol version was changed to 0.90 according to ZRTP Internet Draft.
    -6. 	Some changes in Linux config files: surplus configuration flags were removed
    -	from ./cfg.XXX templates. 
    -7.	Added experimental ZRTP messages retries scheduler for slow channels. As 
    -	ex ample for GSM CSD channel with average bandwidth 6Kb/s. To use this
    -	option build library with BUILD_FOR_CSD flag.
    -
    -
    -libzrtp 0.6.6											27.06.2008
    ---------------------------------------------------------------------------------
    -ZRTP
    -1. Small bug was fixed in S0 calculation: when RS1 is corrupted the library uses
    -   RS2 instead;
    -2. Some changes in Makefile and building process: unused header were eliminated 	
    -   from the installation process.
    -3. -DBUILD_WITH_ZRTP_MUTEXES was replaced with --enable_mutexes option passed to 
    -   ./configure script. This change allows not to specify any libzrtp compilation 
    -   flags during user application compilation. --enable-mutexes adds    
    -   BUILD_ZRTP_MUTEXES definition to the ./config/zrtp_unix_config.h so if you 
    -   build libzrtp on other platforms - define this flag manually (windows 
    -   configuration file already includes this option).
    -4. Clean-up in .h and .c comments was made.
    -
    -
    -libzrtp 0.6.5											04.06.2008
    ---------------------------------------------------------------------------------
    -ZRTP
    -1. New names for: other_secret - pbxs; srtps - auxs. In bits and secrets storages;
    -2. RS2 secret was eliminated form DH s0 calculation;
    -3. Protocol version number was increased to 0.85
    -
    -
    -libzrtp 0.6.4											19.05.2008
    ---------------------------------------------------------------------------------
    -ZRTP
    -1. According to the new version of the Internet Draft Signaling shared secret was
    -   removed from the protocol and from the sources. It was not used by interface
    -   functions and developers may change nothing in libzrtp based applications.
    -   
    -2. DH4K Key echange was eleminated from the specification and from the sources.
    -   Now ECDH is used for all larger AES key sizes.
    -
    -
    -libzrtp 0.6.2											04.02.2008
    ---------------------------------------------------------------------------------
    -ZRTP
    -1. New behaviour for Secure --> Clear --> Secure scenario was implemnted. According
    -   to ZRTP ID 06 section 5.7.2.1 new value of ZRTPSess computed as hash(ZRTPSess).
    -
    -DOC:
    -   Libzrtp documentation was updated up to version 0.6.2.
    -
    -
    -libzrtp 0.6.1											03.14.2008
    ---------------------------------------------------------------------------------
    -ZRTP
    -1. Multistream mode was implemented according to ZRTP Internet Draft 05.n:
    -    - new stream mode zrtp_stream_mode_t:: ZRTP_STREAM_MODE_MULT;
    -	- Multistream key exchange component was added with ID zrtp_pktype_id_t::
    -	  ZRTP_PKTYPE_MULT and symbolic name ZRTP_MULT. To allow libzrtp use Multistream
    -	  mode - ZRTP_PKTYPE_MULT have to be added to the stream profile in the first
    -	  position;
    -	- According to the new draft SAS and ZRTPSess key are Session option and
    -	  were moved to the zrtp_conn_ctx_t structure. New specification defines
    -	  single SAS values for all streams within the session;
    -	- ZRTP state-machine was changed to handle Multistream mode. In .Fast. mode
    -	  DH exchange is omitted and stream skips ZRTP_STATE_WAIT_CONFIRM1 and
    -	  ZRTP_STATE_PENDINGSECURE for the Initiator and Responder state-machines,
    -	  respectively;
    -
    -2. Hash preimages were added to prevent DOS attacks. See ZRTP ID sec 9.0 for detail
    -   information. This option is available using  zrtp_set_signaling_hash() and
    -   zrtp_get_signaling_hash() functions. 
    -
    -3. Hmac values were added to every packet to allow eliminate SAS validation
    -   if SIP is protected;
    -
    -4. Autosave. of the default realization of the ZRTP cache to the hard drive was
    -   implemented;
    -
    -5. Lot of other internal changes and improvements according to the latest ZRTP
    -   specification v06.
    -								 
    -
    -libzrtp 0.4.5-6										
    ---------------------------------------------------------------------------------
    -	1. Full PBX support. Tested on GS-Labs Asterisk
    -	API:
    -	DOC:
    -	
    -	2. Resolved problem with BG ciphers compilation: initialization of AES hash tables.
    -	
    -	3. Fixed bug in SRTP replay protection. (Undeleted nodes for mulsy-stream encryption)
    -	   (May resulted in a error zrtp_protocol_error_t::zrtp_status_rp_fail)
    -	
    -	4. Vrification is a session option. Input parameter of zrtp_set_verified() was
    -	   changed from stream to ZRTP session structure.
    -
    -	5. Fixed bug with malformed ZRTP Hello packet.
    -
    -	5. fast video
    -	
    -libzrtp 0.4.4											31.07.2007
    ---------------------------------------------------------------------------------
    -    1. New extra error code for replay protection was added.
    -	   See zrtp_status_t::zrtp_status_rp_fail.
    -    
    -    2. Fixed bug which may resulted in a dammage with decrypt failed 7 error. It
    -       was happen when libzrtp passed RTP alerts packet to the replay protection
    -       engine and ROC was broken.
    -       
    -    3. Fixed RTCP encryption/decryption.
    -    
    -    4. Fixed bug with RS1 and RS2 swapping when one of the sides lost RS1.
    -       (May resulted in a error zrtp_protocol_error_t::zrtp_error_auth_decrypt )
    -
    -
    -libzrtp 0.4.3											06.07.2007
    --------------------------------------------------------------------------------- 
    -	1. Beta version of API for PBX support according to the latest ZRTP draft.
    -	   Not tested. For internal development only. Follow // PBX comments;
    -	   - secret's cache format was changed.
    -	   
    -	2. S0 calculation according to NIST recommendations; Internal change
    -		- ZRTP protocol version was increased to 0.07.
    -	
    -	3. All libzrtp sources was audited with coverity code analyzer. http://coverity.com/
    -	
    -libzrtp (0.3.9 - 0.4.2)										27.06.2008
    --------------------------------------------------------------------------------- 
    -	1. Changes according to new draft 04a. All changes are internal.
    -	   a) new DH packets: pvi/pvr, nonce field is at the end of the DH packet.
    -	      In "Preshared" mode both DH packets contain nonce value instead of pvi/r;
    -	   b) new hvi value the same for all modes (DH and Preshared)
    -	      hvi = hash(initiator's DHPart2 message | responder's Hello message);
    -	   c) new algorithm of SAS computing: sasvalue = HMAC(hmackeyi,"SAS");
    -
    -	2. New GUI based test-unite forSymbian platform
    -	
    -	3. Default implementation of the packet retries unite for Symbian was added
    -	   to the libzrtp package. Except besides scheduler, libzrtp includes
    -	   realization of some synchronization and threading routines. These 
    -	   components written in C++ and can't be linked with the library. One should
    -	   add them to own Symbian project project.
    -	   
    -	4. Compilation of default realization of ZRTP mutexes was separated from
    -	   the other system interfaces. To build library with default mutexes
    -	   BUILD_ZRTP_MUTEXES flag should be used;
    -	   
    -	5. New clearing logic. Goals:
    -	   API:
    -	      - state-machine states were changed
    -	      - goclear reason was eliminated. Now we can switch to CLEAR just on
    -	        user action.
    -	      - ZRTP_EVENT_IS_INITIATINGCLEAR was removed as a uperfluous event. As a
    -	        result all event codes were changed.
    -	      - new clear_hmac = HMAC(hmakkeyi/r, "Clear Hmac")
    -	6. New Errors handling logic. See updated state-macine diagram and "developers
    -	   guide".
    -	   API:
    -		  - ZRTP_STATE_ERROR was added to handle error requests. Libzrtp switches
    -		    to this state after the Error exchange. From  ZRTP_STATE_ERROR stream
    -		    cxan be started again or destroyed, depending on application strategy.		    
    -	      - ZRTP_ERRORACK and ZRTP_ERROR packets were added
    -	      - new event ZRTP_ENEVT_NO_ZRTP inform's user that other side doesn't
    -	        support ZRTP encryption.
    -	      	      
    -	7. -D WITH_STACK_MINIM compilation flag allows to minimize coasts for the
    -	   system stack. In the most critical places dynamic allocation will be used
    -	   instead of static variables. This option can be useful on mobile platforms
    -	   in kernel mode, etc.
    -	   
    -	8. Several bug fixes in scheduler. Improved built-in realization of Symbian
    -	   platform. If you use our default realization on Symbian - please update.
    -	     
    -	9. David A. McGrew's srtp was replaced with our own. We did it to get control
    -	   over all crypto functions, generalize interface of crypto component. It
    -	   allows us to port libsrtp to any platforms more smoothly. We have one 
    -	   configuration file, all platform-dependent function and definitions are
    -	   concentrated at one place. We eliminated superfluous functionality from 
    -	   libsrtp, made it crossplatform and thread-safe. In SRTP engine we use our
    -	   own crypto-components based on by Dr. Brian Gladman's sources. Each component
    -	   has strong self-test function allows it to be tested on any platform and
    -	   in any environment.
    -	  - project structure was changed;
    -	  - bgaes folder includes AES and SHA routines by Dr. Brian Gladman. For details
    -	    see dgaes/howto and bg2zrtp.h files;
    -	  - libzrtp supports external realizations of SRTP (Use zrtp_srtp.h API and flag
    -	    -D WITHOUT_BUILTIN_SRTP );
    -	
    -	10. Header files were refactored: one can add just single zrtp.h include to use
    -	   any libzrtp function or data type;
    -	
    -	11. Solved problem with deadlock during Video conferences. (One side starts
    -	    negotioation with Video and another one with Audio stream)
    -		
    -	12. Some changes in test-unite:
    -		- test vectores and test-cases for all cryptio components are available;
    -		- zrtp_system_test.h checks environment and compilation flags
    -		- use ZRTP_ENABLE_TEST flag to build library with all tests
    -	13. Full documentation review and updating.
    -	
    -	14. Sources clean up and some refactoring;
    -	
    -	15. Fixing in "break the tie" logic. See diagrams and zrtp_preparse_commit(),
    -	    zrtp_preparse_init_commit();
    -	
    -	16. Some changes according to the lates ZRTP specification:
    -		- sasvalue was trancated to 32 bits and used mostleft parts of the hashvalue.
    -	
    -	17. Small bug fixes (zrtp_can_start_dh and zrtp_can_start_preshared() mixed into
    -	    zrtp_can_start_stream);
    -	
    -	18. New key derivation mechanism according to NIST standarts. See ZRTP Draft
    -		5.4.4 and 5.5.4.
    -		
    -libzrtp (0.3.7)
    --------------------------------------------------------------------------------- 
    -	1. New, more clear and useful test-unite
    -	2. Eliminated zrtp_stop_protocol(). Now zrtp_done_session_ctx() includes 
    -	   protocol stopping.
    -	3. Some simplifications in project structure: removed zrtp_inet.h and bnase32.h,
    -	   zrtp_iface.c was removed to src\iface folder;
    -	4. ZSTR_GET_VALUE should be used to convert zrtp_stringxx_t to zrtp_stringn_t;
    -	5. Some changes for windows CE;
    -	6. Changed default options: SAS base256 enabled by defauld and "staysecure" is on.
    -
    -libzrtp (0.3.6)							
    ---------------------------------------------------------------------------------
    -	FIXES:
    -	   a) CRC now covers the whole ZRTP packet, not just a body
    -	   b) improved names of some crypto-components in HELLO/COMMIT packets
    -	   c) improved messages hash: hash function covers all ZRTP message with
    -	      magic number and length fields;
    -	   d) fixed DHPart1 and DHPart2 packets format according to last version
    -	      of ZRTP Internet draft.
    -	   e) fixed retain secrets sorting algorithm according to the last version
    -	      of the internet draft.
    -	      
    -	1. Windows CE support. Now library is fully compatible with Windows CE.	   
    -		- .\libzrtp\projects\libzrtp_wince_vc8.sln project file for MS VS 2005
    -		- .\libzrtp\test\WinCE contains sources of simple test-unite ( We have
    -		  just started working in this direction and more intelligent test unite
    -		  will be available soon. Tested on HTC S620 with Windows CE 2005 )
    -	   
    -	2. Added previous state field to ZRTP stream structure. It can be used to
    -	   analyze conditions of switching from one state to another. (For libzrtp
    -	   developers only)
    -	   API:
    -		- zrtp_stream_ctx_t#_prev_state was added
    -		- _zrtp_change_state() MUST be used to switch from one state to another
    -			
    -	3. Some changes in PENDING_CLEAR state handler. In case of error during
    -	   transition from CLEAR to SECURE state-machine will switch back to CLEAR
    -	   without the confirmation by user.
    -	   
    -	   
    -libzrtp (0.3.5)
    ---------------------------------------------------------------------------------
    -    Full description is in progress
    -	
    -	1. Support of all crypto futures according to the new ZRTP draft v 0.3. Lots
    -	   of internal changes were provided in ZRTP kernel.
    -
    -	2. Symbian support. Now you can build libzrtp and test unites on Symbian
    -	   platforms. There are .inf and .mmp files in corresponded directories.
    -	   (Symbian project files are a little bit row and we will appreciate any
    -	   suggestions and advices.)
    -
    -	3. ZRTP stream became more independent. You can use different configurations
    -	   for different streams. So
    -	   ZRTP profile:	profile;
    -	   "staysecure" 	flag: 	staysecure;
    -	   SAS values:		sas_values;
    -	   cache TTL:		cache_ttl;
    -	   and all used crypto components were removed from session context
    -	   (zrtp_conn_ctx_t) to stream context (zrtp_stream_ctx_t).
    -	   API:
    -	    - you should configure every stream in the same way as the whole session in
    -	      previous version has been done. See zrtp_init_session_ctx()
    -	      and zrtp_attach_stream()
    -
    -	4. "Multistream" mode was replaced by "Preshared" (based on retain secrets
    -	   from previous call. See  http://zfoneproject.com/docs/ietf/draft-zimmermann-avt-zrtp-03.html#anchor19 .
    -	   Preshared mode is available as a normal ZRTP crypto component e.g."DH3K"
    -	   or "DH4K". If you enable Preshared mode in profile and libzrtp finds
    -	   secrets in your cache - "Preshared" mode will be used for all next calls
    -	   API:
    -	    - the choice of stream mode was removed from zrtp_start_stream() and
    -	      from zrtp_secure_stream(). 
    -
    -	5. Integer enumerations for all crypto components e.g. Hash type, cipher type
    -	   etc. You should use these values instead of character values for optional
    -       	   profile configuration. (as an example for enabling "preshared" mode)
    -	   API:
    -	    - enumerations types zrtp_hash_id, zrtp_cipher_idzrtp_atl_id,
    -		  zrtp_pktype_id, zrtp_sas_id in zrtp_crypto.h
    -		- all crypto components structures now have id field and libzrtp
    -		  operates with this field to find, register or delete crypto
    -		  components.
    -		- ZRTP profile: zrtp_profile_t uses this integer values too. (list of
    -		  crypto-components is a zero terminated array of values of necessary
    -		  type)
    -		- zrtp_find_in_profile() and zrtp_find_comp() operate with component
    -		  integer identifiers
    -		- there are two special functions to convert component ID to ZRTP
    -		  character name: zrtp_comp_id2type(), zrtp_comp_type2id.
    -
    -	6. Integer error codes were provided instead of 4-character values. One should
    -	   use them to analyze zrtp_stream_ctx_t#last_error value in your ZRTP
    -	   errors handlers.
    -	   API:
    -		- zrtp_protocol_error_t was added to zrtp_error.h.
    -		- zrtp_stream_ctx_t#last_error now is an integer value from
    -		  zrtp_protocol_error_t space.
    -
    -	7. Special function for verification of SAS value was added. One should use
    -	   this function to set/unset SAS verification flag from his own
    -	   application.
    -	   API:
    -		- zrtp_set_verified() was added to zrtp.h
    -
    -	8. Some optimization of types was provided. Here are some possible changes which you 
    -	   need to make in your product:
    -		- libzrtp uses it own strings (zrtp_stringXX_t group) to operate with
    -		  binary and character strings. In this version we made attempt to
    -		  minimize memory coasts and replaced zrtp_string_t with zrtp_stringXX_t
    -		  group, where XX - maximum length in bytes. zrtp_stringxx_t contains
    -		  its length and as a result all functions for work with strings are
    -		  type independent. So one should use one of these types to store binary
    -		  strings and zrtp_stringn_t as a type of operand in all global functions.
    -		- all retain secrets holders and flags were removed to zrtp_secrets
    -		  structure in zrtp_conn_ctx_t#secrets.
    -		- zrtp_packet_string4_t was replaced by zrtp_ucharXX_t group  where XX -
    -		  type length in bytes. These types are used in library for packets
    -		  construction instead of char arrays.
    -
    -	9. Packets retries synchronization was added. zrtp_retry_task_t structure
    -	   from zrtp_types_t is used for all operations with scheduler. One should
    -	   use #callback and #timeout fields from this structure.
    -	   API:
    -		- zrtp_send_packet_later(), zrtp_cancel_send_packet_later()
    -		
    -libzrtp (0.3.4)
    ---------------------------------------------------------------------------------
    -    1. ZRTP state-macine was fully refactored. All transitions between states
    -       are absolutely identical to diagram attached to documentation.
    -       DOC:
    -	- See doc/img/png/state_mach_ext.png
    -	
    -	2. ZRTP uses new packets format according to draft-zimmermann-avt-zrtp-03i
    -	
    -	3. Improved some mistakes in libbn make-files for windows. Unused
    -	   functions were omitted.
    -	   
    -	4. Provided types optimization to decrease RAM memory costs.
    -		
    -	5. Packets retries were synchronized.
    -	   
    -	6. zrtp_voip_proto_t was removed from the library
    -	   API:
    -	    - if you need this enumeration see zfone_types.h in zfone project
    -	
    -	7. "GoClear reasons" support
    -	
    -	8. Some internal changes according to draft-zimmermann-avt-zrtp-03i		
    -		a) Commit hash covers the whole Hello body 
    -		b) GoClear hmac includes "Reason string"
    -		c) Confirm body encrypted by AES CDB cipher
    -		d) Confirm hmac covers whole encrypted part of the packet
    -	
    -	9. Use BUILD_ZRTP_DEBUG_LOG flag instead of BUILD_DEBUG_LOG to build the
    -	   library with debug logs.
    -
    -libzrtp (0.3.3)											21.02.2007
    ---------------------------------------------------------------------------------
    -    1. libzrtp test application refactored for better performance and usability.
    -       For addition information see test application README file and
    -       "libzrtp test suite" chapter in main documentation page.    
    -	
    -    2. Some changes in documentation for better English
    -
    -    3. Use microseconds in zrtp_time_t instead of milliseconds.
    -       API changes:
    -        - change zrtp_get_time() function realization if needed
    -
    -    4. Fixed several small mistakes
    -	
    -
    -libzrtp (0.3.2)											09.02.2007
    ---------------------------------------------------------------------------------
    -    1. Global context allocation removed to user space. 
    -       This was made to able RNG using before library initialization.
    -       API changes:
    -	- zrtp_init(), zrtp_down()
    -	- zrtp_randstr(), zrtp_add_system_state()
    -	
    -    2. Fixed bug in srtp SHA1 calculation for Windows.
    -	
    -    3. Confirm and GoClear HMAC was truncated to 64 bits.
    -	
    -    4. Calls stack minimized for library using in kernel mode
    -	
    -    5. Default realization of secrets' cache is available. Cache was implemented
    -       as a simple binary file and can be built using  -DBUILD_DEFAULT_CACHE file.
    -       API:
    -	- realization at src\iface\zrtp_cache.c
    -       DOC:
    -	- 1.4 libZRTP setup and building
    -	- 2.2 System-dependent functions
    -
    -    6. Default cross-platform realization of time-out sending unite is available.
    -       This unite is available for Linux, MacOS and Windows. It can be built using
    -       -DBUILD_DEFAULT_TIMER flag.
    -       API:
    -	- realization at src\iface\zrtp_scheduler.c
    -       DOC:
    -	- 1.4 libZRTP setup and building
    -	- 2.2 System-dependent functions
    -	   
    -    7. "HOWTO libzrtp" was added to the library documentation
    -
    -libzrtp (0.3.1)											06.12.2006
    ---------------------------------------------------------------------------------
    -    1. Global variables were removed from c-files. Added global context
    -       zrtp_global_ctx_t for necessary data storing. This was made to allow
    -       to build library in some special environment as Symbian OS ed2.
    -       DOC changes:
    -	    - 2.1.2 data structure
    -       API changes:
    -	    - zrtp_global_ctx_t added
    -    	- zrtp_init(), zrtp_down(), zrtp_init_session(), zrtp_down_session()
    -    
    -    2. Added multithreading support. Now libzrtp is thread-safe. About all
    -       conditions of usage in multithreading application and synchronization
    -       schemes see section "2.3.3 Multithreading and concurrent streams" in 
    -       developers guide.
    -       DOC changes:
    -	    - 2.2.3 Multithreading and concurrent streams
    -       API changes:
    -	    - mutex were added to main data structures
    -	    - mutex interface section at zrtp_iface.c, default realization at
    -	      zrtp_iface.c
    -    
    -    3. Session configuration routine was simplified. ZRTP profile is applied on
    -       session initialization. Some configuration functions were removed and
    -       changed.
    -	DOC changes:
    -    	- 2.3.1 Setup, initialization and deinitialization
    -	API:
    -	    - zrtp_profile_autoload() removed
    -	    - zrtp_init_session(), zrtp_check_profile()
    -
    -    4. Default realizations of system interfaces was added (for Windows, Linux
    -       and MacOS).
    -       API:
    -	    - zrtp_iface.c added
    -    
    -    5. Test suit developed.
    -       Simple test-unite created. It runs several ZRTP sessions, enters SECURE
    -       mode, shows statistics and is closed. To build test-suite on Unix - use C
    -       flags -DBUILD_DEBUG_LOG -DBUILD_WITH_CFUNC -DBUILD_EMPTY_CACHE
    -       -DBUILD_EMPTY_TIMER and configure param.  --enable-test. To run tests:
    -       make check. To build test-suite on Windows use necessary project files.
    -       DOC changes:
    -	    - 1.4 libZRTP setup and building
    -	API:
    -	    - Sources can be found at /test directory
    -    
    -    6. Some changes in project structure, configuration and make files according
    -       to new functionality.
    -       DOC changes:
    -    	- 1.4 libZRTP setup and building
    -	
    \ No newline at end of file
    diff --git a/libs/libzrtp/INSTALL b/libs/libzrtp/INSTALL
    deleted file mode 100644
    index 16a3c821ff..0000000000
    --- a/libs/libzrtp/INSTALL
    +++ /dev/null
    @@ -1,255 +0,0 @@
    -/*
    - * libZRTP SDK library, implements the ZRTP secure VoIP protocol.
    - * Copyright (c) 2006-2009 Philip R. Zimmermann.  All rights reserved.
    - * Contact: http://philzimmermann.com
    - * For licensing and other legal details, see the file zrtp_legal.c.
    - * 
    - * Viktor Krykun  
    - */
    -
    -Basic Installation
    -================================================================================
    -
    -    To start playing with Zfone and libzrtp you should install few developers
    -packages on your machine: gcc and g++ compilers, automake and autoconf tools.
    -
    -	To install library as a Zfone component for Linux the following flags
    -should be used: BUILD_DEBUG_LOG,  BUILD_WITH_CFUNC,  BUILD_DEFAULT_CACHE,
    -BUILD_DEFAULT_TIMER and WITH_ZFONE.
    -	The following instructions are for experienced users and developers only.
    -If you just want to install Zfone use the command as follows:
    -./configure CFLAGS="-O0 -g3 -W -Wall -DBUILD_DEBUG_LOG -DBUILD_WITH_CFUNC 
    --DBUILD_DEFAULT_CACHE -DBUILD_DEFAULT_TIMER -DWITH_ZFONE"
    -
    -Library distribution contains installation and configuration files, project files
    -for several Operation Systems. To install Library on Unix-like systems the
    -autotools tool set is used. To install on Windows - Microsoft Visual Studio.
    -Except standard for your system compile flags the following are available for
    -your system:
    --# -DBUILD_DEBUG_LOG - enables debug and logging information  
    -    This flag is recommended to be used at design stages for testing. Logs make
    -    debug process much easier and are to be included into bugreport.
    --# -DBUILD_WITH_CFUNC - assign to the library to gather standard for this
    -    platform system interface functions realizations. This option simplifies the
    -    library use and make code more compact. You can have a look at realizations
    -    in src/zrtp-iface.c. file. And if they suit you use this flag.
    --# -DBUILD_EMPTY_CACHE this flag assigns to the library to use empty stubs
    -    instead of operations with cache. This checkbox may be used in  test
    -    applications or in systems where cache secrets storing is impossible. Be
    -    careful with this flag! Use it if it is really necessary.
    --# -DBUILD_EMPTY_TIMER this flag assigns to the library to use empty stubs
    -    instead of delayed tasks processing. This checkbox may be used in test
    -    applications or in systems with the reliable communication channel (the
    -    package loss is impossible). Be careful with this flag! Use it if it is
    -    really necessary.
    -
    -Except library itself, the set of utilities for the all components workability
    -check on the basis of a certain platform is provided. libzrtp test creates
    -several parallel ZRTP sessions, initiates transfer to the protected mode,
    -displays statistics, after which the application is stopped. If application test
    -was completed successfully the library is configured correctly, all components
    -work correctly. Note! Installation of test application is carried out with
    --DBUILD_EMPTY_CACHE  -DBUILD_EMPTY_TIMER flags. After fulfilling tests reinstall
    -library without use of these flags. 
    -
    -Further instructions must be followed in order to build and set up the library in
    -any Unix-like operation system (Linux, FreeBSD, MacOS):
    -    -# Download source codes from zfoneproject.com
    -    -# Decompress the archive libzrtp-0.3.X.tzr.gz : tar -zxf ./libzrtp-0.3.X.tzr.gz
    -       and open cd libzrtp-0.3.X directory
    -    -# Configure the library: ./configure  (use necessary compollation flags)
    -    -# Build the library: make
    -    -# If you get the errors during, please send a full log of configuration
    -       and building process to  zfone-bugs@philzimmermann.com. Please specify
    -       the operation system, hardware platform, compiler version and other
    -       environmental parameters. Any proposals will be taken into account when
    -       developing new versions.
    -    -# After te library successful building, run setup (installation): ./make install
    -    -# to build test unites run ./configure  with CFLAGS="-DBUILD_DEBUG_LOG
    -       -DBUILD_WITH_CFUNC -DBUILD_EMPTY_CACHE -DBUILD_EMPTY_TIMER and parameter
    -       --enable-test. After successful configuration start test: "make check".
    -       This command will build and run all test (bnlib test, srtp tests and
    -       libzrtp tests) Don't forget to rebuild library without -DBUILD_EMPTY_CACHE
    -       -DBUILD_EMPTY_TIMER. 
    -              
    -For library configuration and installation on Windows platform the followinf
    -files should be used:
    -    -# For installation with the Microsoft Visual Studio v6 use:
    -	- libzrtp.dsw
    -	- libzrtp.dsp
    -        - test\libzrtp_test.dsp
    -    -# For installation with the Microsoft Visual Studio v7 use:
    -	- libzrtp.sln
    -        - libzrtp.vcproj
    -        - test\libzrtp_test.vcproj
    -    -# If you want to build libzrtp in Windows kernel mode you mast use MAKEFILE.WIN32
    -
    -For 32-bit machines bnlib contains assemble file lbn80386.asm. The assembler is
    -needed to install it. The compiler ml is in the stracture of VS7, if you use VS6
    -you can use Microsoft Macro Assembler (http://www.masm32.com/masmdl.htm). To
    -compile this file you have define in properties: Commands: \ml /c /Cx
    -/coff /Fo $(TargetDir)\$(InputName).obj $(InputPath) Outputs: $(TargetDir)\$(InputName).obj
    - where  is a complete path to the compiler. 
    -
    -Possible problems and methods of the solution:
    -    -# Some environment problems with automatic definition of architecture
    -     and byte-order are possible at library building. We recommend before  building
    -     of libZRTP on a new program or hardware platform uncomment the test-unite at
    -     the end of the file \c zrtp_syste.h.  If there is a mistakes in definition of
    -     architecture or byte-order use zrtp_system.h manual configuration following
    -     the comments.
    -
    -Please take into account the fact that libzrtp developers are not responsible for
    -external modules of the library. In other words, the functionality of the library
    -was tested under majority of widespread Linux and Windows systems, but warnings
    -can still occur during these modules compilation.
    -
    -If you have faced with some problems during configuration or installing of the
    -library - send a report to the Support Service. If you installed library on the
    -platform not described here, please contact the Support Service. We are
    -interested very much to get know the results of testing on new platforms. We
    -will carefully examine all proposals and will do our best to realize them in new
    -library versions.
    -
    -
    -Compilers and Options
    -=================
    -
    -   Some systems require unusual options for compilation or linking that
    -the `configure' script does not know about.  You can give `configure'
    -initial values for variables by setting them in the environment.  Using
    -a Bourne-compatible shell, you can do that on the command line like
    -this:
    -     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
    -
    -Or on systems that have the `env' program, you can do it like this:
    -     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
    -
    -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 must use a version of `make' that
    -supports the `VPATH' variable, such as 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 `..'.
    -
    -   If you have to use a `make' that does not supports the `VPATH'
    -variable, you have 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.
    -
    -Installation Names
    -==================
    -
    -   By default, `make install' will install the package's files in
    -`/usr/local/include', `/usr/local/lib', etc.  You can specify an
    -installation prefix other than `/usr/local' by giving `configure' the
    -option `--prefix=PATH'.
    -
    -   You can specify separate installation prefixes for
    -architecture-specific files and architecture-independent files.  If you
    -give `configure' the option `--exec-prefix=PATH', the package will use
    -PATH as the prefix for installing programs and libraries.
    -Documentation and other data files will still use the regular prefix.
    -
    -   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'.
    -
    -Optional Features
    -=================
    -
    -   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.
    -
    -Specifying the System Type
    -==========================
    -
    -   There may be some features `configure' can not figure out
    -automatically, but needs to determine by the type of host the package
    -will run on.  Usually `configure' can figure that out, but if it prints
    -a message saying it can not guess the host type, give it the
    -`--host=TYPE' option.  TYPE can either be a short name for the system
    -type, such as `sun4', or a canonical name with three fields:
    -     CPU-COMPANY-SYSTEM
    -
    -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 host type.
    -
    -   If you are building compiler tools for cross-compiling, you can also
    -use the `--target=TYPE' option to select the type of system they will
    -produce code for and the `--build=TYPE' option to select the type of
    -system on which you are compiling the package.
    -
    -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
    -
    -will cause the specified gcc to be used as the C compiler (unless it is
    -overridden in the site shell script).
    -
    -Operation Controls
    -==================
    -
    -   `configure' recognizes the following options to control how it
    -operates.
    -
    -`--version'
    -`-V'
    -     Print the version of Autoconf used to generate the `configure'
    -     script, and exit.
    -
    -`--cache-file=FILE'
    -     Use and save the results of the tests in FILE instead of
    -     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
    -     debugging `configure'.
    -
    -`--help'
    -     Print a summary of the options to `configure', and exit.
    -
    -`--quiet'
    -`--silent'
    -`-q'
    -     Do not print messages saying which checks are being made.
    -
    -`--srcdir=DIR'
    -     Look for the package's source code in directory DIR.  Usually
    -     `configure' can determine that directory automatically.
    -
    -`--version'
    -     Print the version of Autoconf used to generate the `configure'
    -     script, and exit.
    -
    -`configure' also accepts some other, not widely useful, options.
    diff --git a/libs/libzrtp/Makefile.am b/libs/libzrtp/Makefile.am
    deleted file mode 100644
    index 2d3b82421d..0000000000
    --- a/libs/libzrtp/Makefile.am
    +++ /dev/null
    @@ -1,115 +0,0 @@
    -#
    -# Copyright (c) 2006-2007 Philip R. Zimmermann. All rights reserved.
    -# Contact: http://philzimmermann.com
    -# 
    -# Viktor Krikun  
    -#
    -
    -libzrtp_includedir=$(includedir)/libzrtp
    -libzrtp_include_HEADERS = \
    -					$(top_srcdir)/include/zrtp.h \
    -					$(top_srcdir)/include/zrtp_base.h \
    -					$(top_srcdir)/include/zrtp_config.h \
    -					$(top_srcdir)/include/zrtp_config_user.h \
    -					$(top_srcdir)/include/zrtp_config_unix.h \
    -					$(top_srcdir)/include/zrtp_crypto.h \
    -					$(top_srcdir)/include/zrtp_ec.h \
    -					$(top_srcdir)/include/zrtp_engine.h \
    -					$(top_srcdir)/include/zrtp_error.h \
    -					$(top_srcdir)/include/zrtp_iface.h \
    -					$(top_srcdir)/include/zrtp_iface_scheduler.h \
    -					$(top_srcdir)/include/zrtp_iface_cache.h \
    -					$(top_srcdir)/include/zrtp_iface_system.h \
    -					$(top_srcdir)/include/zrtp_legal.h \
    -					$(top_srcdir)/include/zrtp_list.h \
    -					$(top_srcdir)/include/zrtp_log.h \
    -					$(top_srcdir)/include/zrtp_pbx.h \
    -					$(top_srcdir)/include/zrtp_protocol.h \
    -					$(top_srcdir)/include/zrtp_srtp.h \
    -					$(top_srcdir)/include/zrtp_srtp_builtin.h \
    -					$(top_srcdir)/include/zrtp_string.h \
    -					$(top_srcdir)/include/zrtp_types.h \
    -					$(top_srcdir)/include/zrtp_version.h \
    -					\
    -					$(top_srcdir)/third_party/bnlib/bn.h \
    -					\
    -					$(top_srcdir)/third_party/bgaes/aes.h \
    -					$(top_srcdir)/third_party/bgaes/aesopt.h \
    -					$(top_srcdir)/third_party/bgaes/aestab.h \
    -					$(top_srcdir)/third_party/bgaes/bg2zrtp.h \
    -					$(top_srcdir)/third_party/bgaes/brg_types.h \
    -					$(top_srcdir)/third_party/bgaes/sha1.h \
    -					$(top_srcdir)/third_party/bgaes/sha2.h
    -
    -lib_LIBRARIES = libzrtp.a
    -
    -libzrtp_a_CPPFLAGS = \
    -			-I$(top_srcdir)/include \
    -			-I$(top_srcdir)/. \
    -			-I$(top_srcdir)/third_party/bgaes \
    -			-I$(top_srcdir)/third_party/bnlib
    -
    -libzrtp_a_LIBADD = $(top_srcdir)/third_party/bnlib/libbn.a
    -
    -libzrtp_a_SOURCES = $(top_srcdir)/src/zrtp.c \
    -					$(top_srcdir)/src/zrtp_crc.c \
    -					$(top_srcdir)/src/zrtp_crypto_aes.c \
    -					$(top_srcdir)/src/zrtp_crypto_atl.c \
    -					$(top_srcdir)/src/zrtp_crypto_ec.c \
    -					$(top_srcdir)/src/zrtp_crypto_ecdh.c \
    -					$(top_srcdir)/src/zrtp_crypto_hash.c \
    -					$(top_srcdir)/src/zrtp_crypto_pk.c \
    -					$(top_srcdir)/src/zrtp_crypto_sas.c \
    -					$(top_srcdir)/src/zrtp_datatypes.c \
    -					$(top_srcdir)/src/zrtp_engine.c \
    -					$(top_srcdir)/src/zrtp_iface_scheduler.c \
    -					$(top_srcdir)/src/zrtp_iface_sys.c \
    -					$(top_srcdir)/src/zrtp_initiator.c \
    -					$(top_srcdir)/src/zrtp_legal.c \
    -					$(top_srcdir)/src/zrtp_list.c \
    -					$(top_srcdir)/src/zrtp_log.c \
    -					$(top_srcdir)/src/zrtp_pbx.c \
    -					$(top_srcdir)/src/zrtp_protocol.c \
    -					$(top_srcdir)/src/zrtp_responder.c \
    -					$(top_srcdir)/src/zrtp_rng.c \
    -					$(top_srcdir)/src/zrtp_srtp_builtin.c \
    -					$(top_srcdir)/src/zrtp_string.c \
    -					$(top_srcdir)/src/zrtp_utils.c \
    -					$(top_srcdir)/src/zrtp_utils_proto.c \
    -					\
    -					$(top_srcdir)/third_party/bgaes/aes_modes.c \
    -					$(top_srcdir)/third_party/bgaes/aescrypt.c \
    -					$(top_srcdir)/third_party/bgaes/aeskey.c \
    -					$(top_srcdir)/third_party/bgaes/aestab.c \
    -					$(top_srcdir)/third_party/bgaes/sha1.c \
    -					$(top_srcdir)/third_party/bgaes/sha2.c\
    -					\
    -					$(top_srcdir)/src/zrtp_iface_cache.c
    -					$(top_srcdir)/src/zrtp_engine_driven.c
    -
    -check_PROGRAMS = cache_test
    -
    -cache_test_CPPFLAGS = 	-I$(top_srcdir)/include \
    -			-I$(top_srcdir)/. \
    -			-I$(top_srcdir)/test \
    -			-I$(top_srcdir)/test/cmockery \
    -			-I$(top_srcdir)/third_party/bgaes \
    -			-I$(top_srcdir)/third_party/bnlib
    -
    -cache_test_SOURCES = $(top_srcdir)/test/cmockery/cmockery.c \
    -					 $(top_srcdir)/test/cache_test.c
    -cache_test_LDADD   = libzrtp.a  $(top_srcdir)/third_party/bnlib/libbn.a -lpthread
    -
    -SUBDIRS =  third_party/bnlib
    -
    -if HAVE_DOXYGEN
    -doc: .stamp-doc
    -.stamp-doc:
    -	(cd doc && $(DOXYGEN) Doxyfile)
    -	touch $@
    -endif
    -
    -uninstall:
    -	rm -rf $(prefix)/include/libzrtp
    -	rm -f $(prefix)/lib/libzrtp.a
    -
    diff --git a/libs/libzrtp/NEWS b/libs/libzrtp/NEWS
    deleted file mode 100644
    index e69de29bb2..0000000000
    diff --git a/libs/libzrtp/README b/libs/libzrtp/README
    deleted file mode 100644
    index c6d90aae2e..0000000000
    --- a/libs/libzrtp/README
    +++ /dev/null
    @@ -1,10 +0,0 @@
    -# 
    -# libZRTP SDK library, implements the ZRTP secure VoIP protocol.
    -# Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved.
    -# Contact: http://philzimmermann.com
    -# For licensing and other legal details, see the file zrtp_legal.c.
    -# 
    -
    -- Check HTML Documentation ./doc
    -- Visit the Zfone Project Home Page http://zfoneproject.com/
    -- Report bugs via the Zfone Bugs Page http://zfoneproject.com/bugs.html
    diff --git a/libs/libzrtp/acinclude.m4 b/libs/libzrtp/acinclude.m4
    deleted file mode 100644
    index f5879955c2..0000000000
    --- a/libs/libzrtp/acinclude.m4
    +++ /dev/null
    @@ -1,94 +0,0 @@
    -AC_DEFUN([AX_PREFIX_CONFIG_H],[dnl
    -AC_BEFORE([AC_CONFIG_HEADERS],[$0])dnl
    -AC_CONFIG_COMMANDS([ifelse($1,,$PACKAGE-config.h,$1)],[dnl
    -AS_VAR_PUSHDEF([_OUT],[ac_prefix_conf_OUT])dnl
    -AS_VAR_PUSHDEF([_DEF],[ac_prefix_conf_DEF])dnl
    -AS_VAR_PUSHDEF([_PKG],[ac_prefix_conf_PKG])dnl
    -AS_VAR_PUSHDEF([_LOW],[ac_prefix_conf_LOW])dnl
    -AS_VAR_PUSHDEF([_UPP],[ac_prefix_conf_UPP])dnl
    -AS_VAR_PUSHDEF([_INP],[ac_prefix_conf_INP])dnl
    -m4_pushdef([_script],[conftest.prefix])dnl
    -m4_pushdef([_symbol],[m4_cr_Letters[]m4_cr_digits[]_])dnl
    -_OUT=`echo ifelse($1, , $PACKAGE-config.h, $1)`
    -_DEF=`echo _$_OUT | sed -e "y:m4_cr_letters:m4_cr_LETTERS[]:" -e "s/@<:@^m4_cr_Letters@:>@/_/g"`
    -_PKG=`echo ifelse($2, , $PACKAGE, $2)`
    -_LOW=`echo _$_PKG | sed -e "y:m4_cr_LETTERS-:m4_cr_letters[]_:"`
    -_UPP=`echo $_PKG | sed -e "y:m4_cr_letters-:m4_cr_LETTERS[]_:"  -e "/^@<:@m4_cr_digits@:>@/s/^/_/"`
    -_INP=`echo "ifelse($3,,,$3)" | sed -e 's/ *//'`
    -if test ".$_INP" = "."; then
    -   for ac_file in : $CONFIG_HEADERS; do test "_$ac_file" = _: && continue
    -     case "$ac_file" in
    -        *.h) _INP=$ac_file ;;
    -        *)
    -     esac
    -     test ".$_INP" != "." && break
    -   done
    -fi
    -if test ".$_INP" = "."; then
    -   case "$_OUT" in
    -      */*) _INP=`basename "$_OUT"`
    -      ;;
    -      *-*) _INP=`echo "$_OUT" | sed -e "s/@<:@_symbol@:>@*-//"`
    -      ;;
    -      *) _INP=config.h
    -      ;;
    -   esac
    -fi
    -if test -z "$_PKG" ; then
    -   AC_MSG_ERROR([no prefix for _PREFIX_PKG_CONFIG_H])
    -else
    -  if test ! -f "$_INP" ; then if test -f "$srcdir/$_INP" ; then
    -     _INP="$srcdir/$_INP"
    -  fi fi
    -  AC_MSG_NOTICE(creating $_OUT - prefix $_UPP for $_INP defines)
    -  if test -f $_INP ; then
    -    echo "s/^@%:@undef  *\\(@<:@m4_cr_LETTERS[]_@:>@\\)/@%:@undef $_UPP""_\\1/" > _script
    -    echo "s/^@%:@undef  *\\(@<:@m4_cr_letters@:>@\\)/@%:@undef $_LOW""_\\1/" >> _script
    -    echo "s/^@%:@def[]ine  *\\(@<:@m4_cr_LETTERS[]_@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_UPP""_\\1 \\" >> _script
    -    echo "@%:@def[]ine $_UPP""_\\1 \\2 \\" >> _script
    -    echo "@%:@endif/" >>_script
    -    echo "s/^@%:@def[]ine  *\\(@<:@m4_cr_letters@:>@@<:@_symbol@:>@*\\)\\(.*\\)/@%:@ifndef $_LOW""_\\1 \\" >> _script
    -    echo "@%:@define $_LOW""_\\1 \\2 \\" >> _script
    -    echo "@%:@endif/" >> _script
    -    # now executing _script on _DEF input to create _OUT output file
    -    echo "@%:@ifndef $_DEF"      >$tmp/pconfig.h
    -    echo "@%:@def[]ine $_DEF 1" >>$tmp/pconfig.h
    -    echo ' ' >>$tmp/pconfig.h
    -    echo /'*' $_OUT. Generated automatically at end of configure. '*'/ >>$tmp/pconfig.h
    -
    -    sed -f _script $_INP >>$tmp/pconfig.h
    -    echo ' ' >>$tmp/pconfig.h
    -    echo '/* once:' $_DEF '*/' >>$tmp/pconfig.h
    -    echo "@%:@endif" >>$tmp/pconfig.h
    -    if cmp -s $_OUT $tmp/pconfig.h 2>/dev/null; then
    -      AC_MSG_NOTICE([$_OUT is unchanged])
    -    else
    -      ac_dir=`AS_DIRNAME(["$_OUT"])`
    -      AS_MKDIR_P(["$ac_dir"])
    -      rm -f "$_OUT"
    -      mv $tmp/pconfig.h "$_OUT"
    -    fi
    -    cp _script _configs.sed
    -  else
    -    AC_MSG_ERROR([input file $_INP does not exist - skip generating $_OUT])
    -  fi
    -  rm -f conftest.*
    -fi
    -m4_popdef([_symbol])dnl
    -m4_popdef([_script])dnl
    -AS_VAR_POPDEF([_INP])dnl
    -AS_VAR_POPDEF([_UPP])dnl
    -AS_VAR_POPDEF([_LOW])dnl
    -AS_VAR_POPDEF([_PKG])dnl
    -AS_VAR_POPDEF([_DEF])dnl
    -AS_VAR_POPDEF([_OUT])dnl
    -],[PACKAGE="$PACKAGE"])])
    -
    -dnl implementation note: a bug report (31.5.2005) from Marten Svantesson points
    -dnl out a problem where `echo "\1"` results in a Control-A. The unix standard
    -dnl    http://www.opengroup.org/onlinepubs/000095399/utilities/echo.html
    -dnl defines all backslash-sequences to be inherently non-portable asking
    -dnl for replacement mit printf. Some old systems had problems with that
    -dnl one either. However, the latest libtool (!) release does export an $ECHO
    -dnl (and $echo) that does the right thing - just one question is left: what
    -dnl was the first version to have it? Is it greater 2.58 ?
    diff --git a/libs/libzrtp/bootstrap.sh b/libs/libzrtp/bootstrap.sh
    deleted file mode 100755
    index dfa3cc3652..0000000000
    --- a/libs/libzrtp/bootstrap.sh
    +++ /dev/null
    @@ -1,14 +0,0 @@
    -#!/bin/sh
    -
    -reconf () {
    -  aclocal
    -  mkdir -p config
    -  libtoolize --copy --automake
    -  autoconf
    -  autoheader
    -  automake --no-force --add-missing --copy
    -}
    -
    -(cd third_party/bnlib && ./bootstrap.sh)
    -reconf
    -
    diff --git a/libs/libzrtp/configure.ac b/libs/libzrtp/configure.ac
    deleted file mode 100644
    index 5ac158109c..0000000000
    --- a/libs/libzrtp/configure.ac
    +++ /dev/null
    @@ -1,97 +0,0 @@
    -# 
    -# Copyright (c) 2006-2011 Philip R. Zimmermann. All rights reserved.
    -# Contact: http://philzimmermann.com
    -# For licensing and other legal details, see the file zrtp_legal.c.
    -# 
    -# Viktor Krikun  
    -#
    -
    -AC_INIT([libzrtp], [1.2.0])
    -
    -AC_CONFIG_AUX_DIR(config)
    -AC_CONFIG_HEADER(config/config.h)
    -
    -# Checks for target OS
    -AC_CANONICAL_TARGET
    -
    -case $target_os in
    -  aix*)       ;;
    -  *mingw* | *cygw* | *win32* | *w32* )
    -  echo "------- START libzrtp configuration for Windows platform ------------"
    -  ;;
    -  *darwin*) 
    -  echo "------- START libzrtp configuration for Darwin platform ------------"
    -  ;;
    -  *freebsd2* | *freebsd* | *netbsd* | *openbsd* | *osf[12]*)
    -  echo "------- START libzrtp configuration for BSD platform ------------"
    -  ;;
    -  hpux* | irix* | linuxaout* | linux* | osf* | solaris2* | sunos4*)
    -  echo "------- START libzrtp configuration for Linux platform ------------"
    -  ;;
    -esac
    -
    -
    -AM_INIT_AUTOMAKE
    -AX_PREFIX_CONFIG_H(include/zrtp_config_unix.h,ZRTP,config/config.h)
    -
    -CFLAGS="$CFLAGS -std=c99 -O2 -g3 -Wall -Wextra -Wno-unused-parameter -fno-strict-aliasing -fPIC -DZRTP_AUTOMAKE=1"
    -
    -# Configuring external libraries
    -echo "========================= configuring bnlib =============================="
    -cd third_party/bnlib
    -./configure CFLAGS="$CFLAGS"
    -cd ../..
    -echo "================================ done  ==================================="
    -
    -# Checks for programs.
    -AC_PROG_CC
    -AC_PROG_CXX
    -AC_PROG_RANLIB
    -AM_PROG_CC_C_O
    -
    -# Checks for header files.
    -AC_HEADER_STDC
    -AC_CHECK_HEADERS([linux/version.h endian.h])
    -AC_CHECK_HEADERS([errno.h])
    -AC_CHECK_HEADERS([asm/types.h])
    -AC_CHECK_HEADERS([stdlib.h stdint.h stdarg.h])
    -AC_CHECK_HEADERS([string.h strings.h])
    -AC_CHECK_HEADERS([stdio.h unistd.h])
    -AC_CHECK_HEADERS([inttypes.h sys/inttypes.h sys/types.h machine/types.h])
    -AC_CHECK_HEADERS([pthread.h semaphore.h sys/time.h fcntl.h])
    -
    -AC_CHECK_TYPES([int8_t,uint8_t,int16_t,uint16_t,int32_t,uint32_t,uint64_t,int64_t])
    -
    -# Checks for typedefs, structures, and compiler characteristics.
    -AC_C_CONST
    -
    -# Checks for library functions.
    -AC_CHECK_FUNCS([memset memcpy malloc free]) 
    -AC_CHECK_FUNCS([usleep nanosleep])
    -AC_CHECK_FUNCS([fopen fread])
    -AC_CHECK_FUNCS([pthread_mutex_lock pthread_mutex_unlock pthread_mutex_init pthread_mutex_destroy])
    -AC_CHECK_FUNCS([pthread_attr_init pthread_attr_setdetachstate pthread_create])
    -AC_CHECK_FUNCS([sem_wait sem_trywait sem_post sem_unlink sem_destroy sem_open sem_init])
    -
    -AC_CHECK_LIB([pthread], [main], [LIBS="-lpthread $LIBS"], [echo "  Couldn't find library pthread";])
    -
    -# Other
    -AC_DEFINE(PRAGMA_PACK_PUSH,[#pragma pack(push, 1)],[Define pragma pack(push) for your platform])
    -AC_DEFINE(PRAGMA_PACK_POP,[#pragma pack(pop)],[Define pragma pack(pop) for your platform])
    -AC_DEFINE(INLINE,[static inline],[Define inline construction for your platform])
    -
    -#
    -# Documentation
    -#
    -AM_CONDITIONAL([HAVE_DOXYGEN], [false])
    -AC_CHECK_PROGS([DOXYGEN], [doxygen])
    -if test -z "$DOXYGEN"; then
    -  AC_MSG_WARN([Doxygen not found - continuing without Doxygen support])
    -else
    -  AM_CONDITIONAL([HAVE_DOXYGEN], [true])
    -  AC_CONFIG_FILES([doc/Doxyfile])
    -fi
    -
    -#
    -# Generate Makefiles
    -AC_OUTPUT([Makefile])
    diff --git a/libs/libzrtp/create_docs.sh b/libs/libzrtp/create_docs.sh
    deleted file mode 100755
    index a30c7c256b..0000000000
    --- a/libs/libzrtp/create_docs.sh
    +++ /dev/null
    @@ -1,9 +0,0 @@
    -cd ../../doc
    -rm -f docs.tar.gz
    -rm -rf libzrtp-doc
    -echo "=================> start doxygen."
    -doxygen > /dev/null 2>&1
    -mkdir libzrtp-doc
    -cp -Rf ./out/html/* ./libzrtp-doc
    -tar -zcvf ./libzrtp-doc.tar.gz ./libzrtp-doc >> /dev/null
    -rm -rf libzrtp-doc
    diff --git a/libs/libzrtp/create_pack.pl b/libs/libzrtp/create_pack.pl
    deleted file mode 100755
    index e43b63ece3..0000000000
    --- a/libs/libzrtp/create_pack.pl
    +++ /dev/null
    @@ -1,421 +0,0 @@
    -#!/usr/bin/perl
    -
    -use Getopt::Std;
    -
    -getopts("l:ehs", \%args);
    -
    -if ($args{h})
    -{
    -	print "Usage: create_pack.pl [OPTION]...\n\n";
    -	print "  -l file      write down list of files\n";
    -	print "  -e           enterprise version\n";
    -	print "  -s           dont add version suffix to package name\n";
    -	print "  -h           this help\n\n";
    -	exit 1;
    -}
    -
    -#to create list of files:
    -if ($args{l})
    -{
    -	create_files_list($args{l});
    -	exit 1;
    -}
    -
    -$enterprise = 0;
    -if ($args{e}) 
    -{
    -	$enterprise = 1;
    -}
    -
    -if ($args{s})
    -{
    -	$packdir="libzrtp";
    -}
    -else
    -{
    -	$LIBZRTP_VERSION=`cat ../../include/zrtp_version.h | grep 'LIBZRTP_VERSION_STR' | awk '{print \$3, \$4}' | sed 's/"v\\(.*\\) \\(.*\\)"/\\1.\\2/'`;
    -	chomp($LIBZRTP_VERSION);
    -	$packdir="libzrtp-$LIBZRTP_VERSION";
    -}
    -
    -if (-d $packdir) 
    -{
    -	`rm -rf $packdir`
    -}
    -
    -mkdir $packdir;
    -create_array();
    -
    -foreach $file(@array) 
    -{
    -	if (!$enterprise && 
    -			(($file =~ m/\/enterprise/i) ||
    -	  		 ($file =~ m/_ec.*(proj|sln)/i) ||
    -	  		 ($file =~ m/_EC.*(WIN)/i) ||
    -	  		 ($file =~ m/\/xcode/i)))
    -	{
    -		print "$file skipped\n";
    -		next;
    -	}
    -	
    -	$path = "../../" . $file;
    -	if (!-e $path)
    -	{
    -		print "[ERROR]: file $file doesn't exist!\n";
    -		`rm -rf $packdir`;
    -		exit -1;
    -	}
    -	if (-d $path)
    -	{
    -		mkdir "$packdir/$file";
    -	}
    -	else 
    -	{
    -#		print "copying $path file\n";
    -		`cp $path $packdir/$file`
    -	}
    -}
    -
    -if (!$enterprise)
    -{
    -	`cp -f ../../projects/win/libzrtp_not_ec.vcproj $packdir/projects/win/libzrtp.vcproj`;
    -	`cp -f ../../projects/win_ce/libzrtp_wince_not_ec.vcproj $packdir/projects/win_ce/libzrtp_wince.vcproj`;
    -	`cp -f ../../projects/win_kernel/MAKEFILE_NOT_EC.WIN64 $packdir/projects/win_kernel/MAKEFILE.WIN64`;
    -	`cp -f ../../projects/win_kernel/MAKEFILE_NOT_EC.WIN32 $packdir/projects/win_kernel/MAKEFILE.WIN32`;
    -	
    -	`rm $packdir/include/zrtp_ec.h`;
    -#	`rm $packdir/include/zrtp_iface_cache.h`;
    -	`rm $packdir/src/zrtp_crypto_ecdsa.c`;
    -	`rm $packdir/src/zrtp_crypto_ec.c`;
    -#	`rm $packdir/src/zrtp_engine_driven.c`;
    -	`rm $packdir/src/zrtp_crypto_ecdh.c`;
    -#	`rm $packdir/src/zrtp_iface_cache.c`;
    -}
    -
    -	  
    -`find $packdir -name "._*" -delete`;
    -
    -$pack_name = $packdir;
    -if ($enterprise)
    -{
    -    $pack_name = $pack_name . "-ec";
    -}
    -
    -$system = `uname -a`;
    -if ($system =~ m/darwin/i)
    -{
    -    `rm -rf $pack_name.zip`;
    -    `zip -r $pack_name.zip $packdir`;
    -}
    -else
    -{
    -    `rm -rf $pack_name.tar.gz`;
    -    `tar -zcvf $pack_name.tar.gz $packdir`;
    -}
    -`rm -rf $packdir`;
    -print "package was created\n";
    -
    -#for item in $array; do
    -#  echo "item:"$'\t'"$item"
    -
    -sub create_files_list()
    -{
    -  	$path = `pwd`;
    -	chop($path);
    -	`cd ../..;find . -not -path *svn* -print | awk '{printf \"\\t\\t\\"%s\\",\\n\", \$1} ' > $path/$_[0];cd $path`;
    -}
    -  
    -
    -sub create_array() 
    -{
    -	@array =
    -	(
    -		"./ChangeLog",
    -		"./README",
    -		"./AUTHORS",
    -		"./projects",
    -		"./projects/gnu",
    -		"./projects/gnu/Makefile.am",
    -		"./projects/gnu/Makefile.in",
    -		"./projects/gnu/COPYING",
    -		"./projects/gnu/aclocal.m4",
    -		"./projects/gnu/configure",
    -		"./projects/gnu/README",
    -		"./projects/gnu/AUTHORS",
    -		"./projects/gnu/configure.in",
    -		"./projects/gnu/INSTALL",
    -		"./projects/gnu/autoreconf.sh",
    -		"./projects/gnu/config",
    -		"./projects/gnu/config/config.guess",
    -		"./projects/gnu/config/config.sub",
    -		"./projects/gnu/config/config.h.in",
    -		"./projects/gnu/config/install-sh",
    -		"./projects/gnu/config/missing",
    -		"./projects/gnu/config/prefix_config.m4",
    -		"./projects/gnu/config/depcomp",
    -		"./projects/gnu/NEWS",
    -		"./projects/gnu/Makefile.in",
    -		"./projects/gnu/build",
    -		"./projects/gnu/build/Makefile.am",
    -		"./projects/gnu/build/Makefile.in",
    -		"./projects/gnu/build/test",
    -		"./projects/gnu/build/test/Makefile.am",
    -		"./projects/gnu/build/test/Makefile.in",
    -		"./projects/gnu/ChangeLog",
    -		"./projects/xcode",
    -		"./projects/xcode/libzrtp.xcodeproj",
    -		"./projects/xcode/libzrtp.xcodeproj/project.pbxproj",
    -		"./projects/xcode/libzrtp_test.xcodeproj",
    -		"./projects/xcode/libzrtp_test.xcodeproj/project.pbxproj",
    -		"./projects/win_kernel",
    -		"./projects/win_kernel/MAKEFILE.WIN64",
    -		"./projects/win_kernel/MAKEFILE.WIN32",
    -		"./projects/win",
    -		"./projects/win/libzrtp.vcproj",
    -		"./projects/win/libzrtp.sln",
    -		"./projects/win/libzrtp_test.vcproj",
    -		"./projects/win_ce",
    -		"./projects/win_ce/libzrtp_test_wince.vcproj",
    -		"./projects/win_ce/libzrtp_wince.sln",
    -		"./projects/win_ce/libzrtp_wince.vcproj",
    -		"./projects/symbian",
    -		"./projects/symbian/bld.bat",
    -		"./projects/symbian/bld.inf",
    -		"./projects/symbian/bldgcce.bat",
    -		"./projects/symbian/libzrtp.mmp",
    -		"./projects/symbian/zrtp_iface_symb.cpp",
    -		"./src",
    -		"./src/zrtp.c",
    -		"./src/zrtp_crc.c",
    -		"./src/zrtp_crypto_aes.c",
    -		"./src/zrtp_crypto_atl.c",
    -		"./src/zrtp_crypto_hash.c",
    -		"./src/zrtp_crypto_pk.c",
    -		"./src/zrtp_crypto_sas.c",
    -		"./src/zrtp_datatypes.c",
    -		"./src/zrtp_engine.c",
    -		"./src/zrtp_iface_scheduler.c",
    -		"./src/zrtp_iface_sys.c",
    -		"./src/zrtp_initiator.c",
    -		"./src/zrtp_legal.c",
    -		"./src/zrtp_list.c",
    -		"./src/zrtp_log.c",
    -		"./src/zrtp_pbx.c",
    -		"./src/zrtp_protocol.c",
    -		"./src/zrtp_responder.c",
    -		"./src/zrtp_rng.c",
    -		"./src/zrtp_srtp_builtin.c",
    -		"./src/zrtp_srtp_dm.c",
    -		"./src/zrtp_string.c",
    -		"./src/zrtp_utils.c",
    -		"./src/zrtp_utils_proto.c",
    -		"./src/zrtp_crypto_ecdsa.c",
    -		"./src/zrtp_crypto_ec.c",
    -		"./src/zrtp_engine_driven.c",
    -		"./src/zrtp_crypto_ecdh.c",
    -		"./src/zrtp_iface_cache.c",
    -		"./doc",
    -		"./include",
    -		"./include/zrtp.h",
    -		"./include/zrtp_base.h",
    -		"./include/zrtp_config.h",
    -		"./include/zrtp_config_user.h",
    -		"./include/zrtp_config_win.h",
    -		"./include/zrtp_config_symbian.h",
    -		"./include/zrtp_crypto.h",
    -		"./include/zrtp_engine.h",
    -		"./include/zrtp_error.h",
    -		"./include/zrtp_ec.h",
    -		"./include/zrtp_iface.h",
    -		"./include/zrtp_iface_cache.h",
    -		"./include/zrtp_iface_system.h",
    -		"./include/zrtp_iface_scheduler.h",
    -		"./include/zrtp_legal.h",
    -		"./include/zrtp_list.h",
    -		"./include/zrtp_log.h",
    -		"./include/zrtp_pbx.h",
    -		"./include/zrtp_protocol.h",
    -		"./include/zrtp_srtp.h",
    -		"./include/zrtp_srtp_builtin.h",
    -		"./include/zrtp_string.h",
    -		"./include/zrtp_types.h",
    -		"./include/zrtp_version.h",
    -		"./third_party",
    -		"./third_party/bnlib",
    -		"./third_party/bnlib/lbnmem.c",
    -		"./third_party/bnlib/lbn00.c",
    -		"./third_party/bnlib/bn16.c",
    -		"./third_party/bnlib/bn32.c",
    -		"./third_party/bnlib/bn.c",
    -		"./third_party/bnlib/lbnppc.h",
    -		"./third_party/bnlib/bnsize00.h",
    -		"./third_party/bnlib/lbn32.h",
    -		"./third_party/bnlib/lbn80386.h",
    -		"./third_party/bnlib/lbn68020.h",
    -		"./third_party/bnlib/germtest",
    -		"./third_party/bnlib/jacobi.h",
    -		"./third_party/bnlib/bn00.c",
    -		"./third_party/bnlib/bnconfig.h",
    -		"./third_party/bnlib/lbn8086.h",
    -		"./third_party/bnlib/bntest00.c",
    -		"./third_party/bnlib/germain.c",
    -		"./third_party/bnlib/lbn960jx.h",
    -		"./third_party/bnlib/sizetest.c",
    -		"./third_party/bnlib/config.cache",
    -		"./third_party/bnlib/bn68000.c",
    -		"./third_party/bnlib/lbnalpha.h",
    -		"./third_party/bnlib/cputime.h",
    -		"./third_party/bnlib/legal.c",
    -		"./third_party/bnlib/configure.lineno",
    -		"./third_party/bnlib/configure",
    -		"./third_party/bnlib/bnprint.c",
    -		"./third_party/bnlib/bn8086.c",
    -		"./third_party/bnlib/lbn68020.c",
    -		"./third_party/bnlib/README.bntest",
    -		"./third_party/bnlib/lbn8086.asm",
    -		"./third_party/bnlib/lbn16.c",
    -		"./third_party/bnlib/lbn32.c",
    -		"./third_party/bnlib/legal.h",
    -		"./third_party/bnlib/configure.in",
    -		"./third_party/bnlib/lbn960jx.s",
    -		"./third_party/bnlib/prime.h",
    -		"./third_party/bnlib/bninit16.c",
    -		"./third_party/bnlib/bninit32.c",
    -		"./third_party/bnlib/files",
    -		"./third_party/bnlib/ppcasm.h",
    -		"./third_party/bnlib/lbn.h",
    -		"./third_party/bnlib/README.bn",
    -		"./third_party/bnlib/bnintern.doc",
    -		"./third_party/bnlib/sieve.c",
    -		"./third_party/bnlib/bn16.h",
    -		"./third_party/bnlib/bn32.h",
    -		"./third_party/bnlib/bnprint.h",
    -		"./third_party/bnlib/sieve.h",
    -		"./third_party/bnlib/cfg",
    -		"./third_party/bnlib/lbn68000.h",
    -		"./third_party/bnlib/lbnalpha.s",
    -		"./third_party/bnlib/bntest16.c",
    -		"./third_party/bnlib/bntest32.c",
    -		"./third_party/bnlib/cfg.debug",
    -		"./third_party/bnlib/lbnmem.h",
    -		"./third_party/bnlib/germtest.c",
    -		"./third_party/bnlib/prime.c",
    -		"./third_party/bnlib/lbn68000.c",
    -		"./third_party/bnlib/config.log",
    -		"./third_party/bnlib/germain.h",
    -		"./third_party/bnlib/kludge.h",
    -		"./third_party/bnlib/Makefile.in",
    -		"./third_party/bnlib/test",
    -		"./third_party/bnlib/test/primetest.c",
    -		"./third_party/bnlib/test/rsaglue.h",
    -		"./third_party/bnlib/test/randpool.c",
    -		"./third_party/bnlib/test/keys.c",
    -		"./third_party/bnlib/test/primes.doc",
    -		"./third_party/bnlib/test/rsatest.c",
    -		"./third_party/bnlib/test/posix.h",
    -		"./third_party/bnlib/test/legal.c",
    -		"./third_party/bnlib/test/README.rsatest",
    -		"./third_party/bnlib/test/rsaglue.c",
    -		"./third_party/bnlib/test/kbmsdos.c",
    -		"./third_party/bnlib/test/keygen.c",
    -		"./third_party/bnlib/test/README.dsatest",
    -		"./third_party/bnlib/test/types.h",
    -		"./third_party/bnlib/test/random.c",
    -		"./third_party/bnlib/test/md5.c",
    -		"./third_party/bnlib/test/userio.h",
    -		"./third_party/bnlib/test/md5.h",
    -		"./third_party/bnlib/test/dsatest.c",
    -		"./third_party/bnlib/test/pt.c",
    -		"./third_party/bnlib/test/dhtest.c",
    -		"./third_party/bnlib/test/sha.h",
    -		"./third_party/bnlib/test/keygen.h",
    -		"./third_party/bnlib/test/noise.h",
    -		"./third_party/bnlib/test/first.h",
    -		"./third_party/bnlib/test/README.dhtest",
    -		"./third_party/bnlib/test/randtest.c",
    -		"./third_party/bnlib/test/randpool.h",
    -		"./third_party/bnlib/test/random.h",
    -		"./third_party/bnlib/test/sha.c",
    -		"./third_party/bnlib/test/noise.c",
    -		"./third_party/bnlib/test/kbunix.c",
    -		"./third_party/bnlib/test/kludge.h",
    -		"./third_party/bnlib/test/keys.h",
    -		"./third_party/bnlib/test/usuals.h",
    -		"./third_party/bnlib/test/kb.h",
    -		"./third_party/bnlib/CHANGES",
    -		"./third_party/bnlib/bnconfig.hin",
    -		"./third_party/bnlib/lbn80386.asm",
    -		"./third_party/bnlib/jacobi.c",
    -		"./third_party/bnlib/config.status",
    -		"./third_party/bnlib/lbn16.h",
    -		"./third_party/bnlib/lbn80386.s",
    -		"./third_party/bnlib/lbn68360.s",
    -		"./third_party/bnlib/bignum-ARM",
    -		"./third_party/bnlib/bignum-ARM/lbnmem.c",
    -		"./third_party/bnlib/bignum-ARM/sha256_core.s",
    -		"./third_party/bnlib/bignum-ARM/lbnarm.h",
    -		"./third_party/bnlib/bignum-ARM/config.h",
    -		"./third_party/bnlib/bignum-ARM/cputime.h",
    -		"./third_party/bnlib/bignum-ARM/lbn16.c",
    -		"./third_party/bnlib/bignum-ARM/lbnarm.s",
    -		"./third_party/bnlib/bignum-ARM/README-small-memory",
    -		"./third_party/bnlib/bignum-ARM/sha256_arm.c",
    -		"./third_party/bnlib/bignum-ARM/lbn.h",
    -		"./third_party/bnlib/bignum-ARM/bntest16.c",
    -		"./third_party/bnlib/bignum-ARM/lbnmem.h",
    -		"./third_party/bnlib/bignum-ARM/kludge.h",
    -		"./third_party/bnlib/bignum-ARM/lbn16.h",
    -		"./third_party/bnlib/bn.doc",
    -		"./third_party/bnlib/lbnppc.c",
    -		"./third_party/bnlib/bn.h",
    -		"./third_party/bgaes",
    -		"./third_party/bgaes/sha1.h",
    -		"./third_party/bgaes/sha1.c",
    -		"./third_party/bgaes/brg_types.h",
    -		"./third_party/bgaes/aestab.c",
    -		"./third_party/bgaes/aestab.h",
    -		"./third_party/bgaes/sha2.h",
    -		"./third_party/bgaes/aes_modes.c",
    -		"./third_party/bgaes/aescrypt.c",
    -		"./third_party/bgaes/bg2zrtp.h",
    -		"./third_party/bgaes/aeskey.c",
    -		"./third_party/bgaes/sha2.c",
    -		"./third_party/bgaes/aes.h",
    -		"./third_party/bgaes/aesopt.h",
    -		"./test",
    -		"./test/README",
    -		"./test/pc",
    -		"./test/pc/zrtp_test_core.c",
    -		"./test/pc/zrtp_test_core.h",
    -		"./test/pc/zrtp_test_crypto.c",
    -		"./test/pc/zrtp_test_queue.c",
    -		"./test/pc/zrtp_test_queue.h",
    -		"./test/pc/zrtp_test_ui.c",
    -		"./test/win_ce",
    -		"./test/win_ce/libzrtp_test_GUI.cpp",
    -		"./test/win_ce/libzrtp_test_GUI.h",
    -		"./test/win_ce/libzrtp_test_GUI.ico",
    -		"./test/win_ce/libzrtp_test_GUIppc.rc",
    -		"./test/win_ce/libzrtp_test_GUIppc.rc2",
    -		"./test/win_ce/libzrtp_test_GUIsp.rc",
    -		"./test/win_ce/libzrtp_test_GUIsp.rc2",
    -		"./test/win_ce/ReadMe.txt",
    -		"./test/win_ce/resourceppc.h",
    -		"./test/win_ce/resourcesp.h",
    -		"./test/win_ce/stdafx.cpp",
    -		"./test/win_ce/stdafx.h",
    -		"./doc",
    -		"./doc/img",
    -		"./doc/manuals",
    -		"./doc/manuals/howto.dox",
    -		"./doc/manuals/main.dox",
    -		"./doc/manuals/rng.dox",
    -		"./doc/out",
    -		"./doc/out/html",
    -		"./doc/out/html/zfone.jpg",
    -		"./doc/Doxyfile",
    -		"./doc/doxygen.css",
    -		"./doc/footer.html",
    -		"./doc/header.html"
    -	)
    -}
    diff --git a/libs/libzrtp/doc/Doxyfile.in b/libs/libzrtp/doc/Doxyfile.in
    deleted file mode 100644
    index ae1f390756..0000000000
    --- a/libs/libzrtp/doc/Doxyfile.in
    +++ /dev/null
    @@ -1,1813 +0,0 @@
    -# Doxyfile 1.8.0
    -
    -# This file describes the settings to be used by the documentation system
    -# doxygen (www.doxygen.org) for a project.
    -#
    -# All text after a hash (#) is considered a comment and will be ignored.
    -# The format is:
    -#       TAG = value [value, ...]
    -# For lists items can also be appended using:
    -#       TAG += value [value, ...]
    -# Values that contain spaces should be placed between quotes (" ").
    -
    -#---------------------------------------------------------------------------
    -# Project related configuration options
    -#---------------------------------------------------------------------------
    -
    -# This tag specifies the encoding used for all characters in the config file
    -# that follow. The default is UTF-8 which is also the encoding used for all
    -# text before the first occurrence of this tag. Doxygen uses libiconv (or the
    -# iconv built into libc) for the transcoding. See
    -# http://www.gnu.org/software/libiconv for the list of possible encodings.
    -
    -DOXYFILE_ENCODING      = UTF-8
    -
    -# The PROJECT_NAME tag is a single word (or sequence of words) that should
    -# identify the project. Note that if you do not use Doxywizard you need
    -# to put quotes around the project name if it contains spaces.
    -
    -PROJECT_NAME           = @PACKAGE_NAME@
    -
    -# The PROJECT_NUMBER tag can be used to enter a project or revision number.
    -# This could be handy for archiving the generated documentation or
    -# if some version control system is used.
    -
    -PROJECT_NUMBER         = @PACKAGE_VERSION@
    -
    -# Using the PROJECT_BRIEF tag one can provide an optional one line description
    -# for a project that appears at the top of each page and should give viewer
    -# a quick idea about the purpose of the project. Keep the description short.
    -
    -PROJECT_BRIEF          = "ZRTP VoIP security"
    -
    -# With the PROJECT_LOGO tag one can specify an logo or icon that is
    -# included in the documentation. The maximum height of the logo should not
    -# exceed 55 pixels and the maximum width should not exceed 200 pixels.
    -# Doxygen will copy the logo to the output directory.
    -
    -PROJECT_LOGO           =
    -
    -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
    -# base path where the generated documentation will be put.
    -# If a relative path is entered, it will be relative to the location
    -# where doxygen was started. If left blank the current directory will be used.
    -
    -OUTPUT_DIRECTORY       = @top_srcdir@/doc/out
    -
    -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
    -# 4096 sub-directories (in 2 levels) under the output directory of each output
    -# format and will distribute the generated files over these directories.
    -# Enabling this option can be useful when feeding doxygen a huge amount of
    -# source files, where putting all generated files in the same directory would
    -# otherwise cause performance problems for the file system.
    -
    -CREATE_SUBDIRS         = NO
    -
    -# The OUTPUT_LANGUAGE tag is used to specify the language in which all
    -# documentation generated by doxygen is written. Doxygen will use this
    -# information to generate all constant output in the proper language.
    -# The default language is English, other supported languages are:
    -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional,
    -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German,
    -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English
    -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian,
    -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak,
    -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese.
    -
    -OUTPUT_LANGUAGE        = English
    -
    -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
    -# include brief member descriptions after the members that are listed in
    -# the file and class documentation (similar to JavaDoc).
    -# Set to NO to disable this.
    -
    -BRIEF_MEMBER_DESC      = YES
    -
    -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
    -# the brief description of a member or function before the detailed description.
    -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
    -# brief descriptions will be completely suppressed.
    -
    -REPEAT_BRIEF           = YES
    -
    -# This tag implements a quasi-intelligent brief description abbreviator
    -# that is used to form the text in various listings. Each string
    -# in this list, if found as the leading text of the brief description, will be
    -# stripped from the text and the result after processing the whole list, is
    -# used as the annotated text. Otherwise, the brief description is used as-is.
    -# If left blank, the following values are used ("$name" is automatically
    -# replaced with the name of the entity): "The $name class" "The $name widget"
    -# "The $name file" "is" "provides" "specifies" "contains"
    -# "represents" "a" "an" "the"
    -
    -ABBREVIATE_BRIEF       =
    -
    -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
    -# Doxygen will generate a detailed section even if there is only a brief
    -# description.
    -
    -ALWAYS_DETAILED_SEC    = NO
    -
    -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
    -# inherited members of a class in the documentation of that class as if those
    -# members were ordinary class members. Constructors, destructors and assignment
    -# operators of the base classes will not be shown.
    -
    -INLINE_INHERITED_MEMB  = NO
    -
    -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
    -# path before files name in the file list and in the header files. If set
    -# to NO the shortest path that makes the file name unique will be used.
    -
    -FULL_PATH_NAMES        = YES
    -
    -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
    -# can be used to strip a user-defined part of the path. Stripping is
    -# only done if one of the specified strings matches the left-hand part of
    -# the path. The tag can be used to show relative paths in the file list.
    -# If left blank the directory from which doxygen is run is used as the
    -# path to strip.
    -
    -STRIP_FROM_PATH        =
    -
    -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
    -# the path mentioned in the documentation of a class, which tells
    -# the reader which header file to include in order to use a class.
    -# If left blank only the name of the header file containing the class
    -# definition is used. Otherwise one should specify the include paths that
    -# are normally passed to the compiler using the -I flag.
    -
    -STRIP_FROM_INC_PATH    =
    -
    -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
    -# (but less readable) file names. This can be useful if your file system
    -# doesn't support long names like on DOS, Mac, or CD-ROM.
    -
    -SHORT_NAMES            = NO
    -
    -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
    -# will interpret the first line (until the first dot) of a JavaDoc-style
    -# comment as the brief description. If set to NO, the JavaDoc
    -# comments will behave just like regular Qt-style comments
    -# (thus requiring an explicit @brief command for a brief description.)
    -
    -JAVADOC_AUTOBRIEF      = NO
    -
    -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will
    -# interpret the first line (until the first dot) of a Qt-style
    -# comment as the brief description. If set to NO, the comments
    -# will behave just like regular Qt-style comments (thus requiring
    -# an explicit \brief command for a brief description.)
    -
    -QT_AUTOBRIEF           = NO
    -
    -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
    -# treat a multi-line C++ special comment block (i.e. a block of //! or ///
    -# comments) as a brief description. This used to be the default behaviour.
    -# The new default is to treat a multi-line C++ comment block as a detailed
    -# description. Set this tag to YES if you prefer the old behaviour instead.
    -
    -MULTILINE_CPP_IS_BRIEF = NO
    -
    -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
    -# member inherits the documentation from any documented member that it
    -# re-implements.
    -
    -INHERIT_DOCS           = YES
    -
    -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
    -# a new page for each member. If set to NO, the documentation of a member will
    -# be part of the file/class/namespace that contains it.
    -
    -SEPARATE_MEMBER_PAGES  = NO
    -
    -# The TAB_SIZE tag can be used to set the number of spaces in a tab.
    -# Doxygen uses this value to replace tabs by spaces in code fragments.
    -
    -TAB_SIZE               = 4
    -
    -# This tag can be used to specify a number of aliases that acts
    -# as commands in the documentation. An alias has the form "name=value".
    -# For example adding "sideeffect=\par Side Effects:\n" will allow you to
    -# put the command \sideeffect (or @sideeffect) in the documentation, which
    -# will result in a user-defined paragraph with heading "Side Effects:".
    -# You can put \n's in the value part of an alias to insert newlines.
    -
    -ALIASES                =
    -
    -# This tag can be used to specify a number of word-keyword mappings (TCL only).
    -# A mapping has the form "name=value". For example adding
    -# "class=itcl::class" will allow you to use the command class in the
    -# itcl::class meaning.
    -
    -TCL_SUBST              =
    -
    -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
    -# sources only. Doxygen will then generate output that is more tailored for C.
    -# For instance, some of the names that are used will be different. The list
    -# of all members will be omitted, etc.
    -
    -OPTIMIZE_OUTPUT_FOR_C  = YES
    -
    -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
    -# sources only. Doxygen will then generate output that is more tailored for
    -# Java. For instance, namespaces will be presented as packages, qualified
    -# scopes will look different, etc.
    -
    -OPTIMIZE_OUTPUT_JAVA   = NO
    -
    -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
    -# sources only. Doxygen will then generate output that is more tailored for
    -# Fortran.
    -
    -OPTIMIZE_FOR_FORTRAN   = NO
    -
    -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
    -# sources. Doxygen will then generate output that is tailored for
    -# VHDL.
    -
    -OPTIMIZE_OUTPUT_VHDL   = NO
    -
    -# Doxygen selects the parser to use depending on the extension of the files it
    -# parses. With this tag you can assign which parser to use for a given extension.
    -# Doxygen has a built-in mapping, but you can override or extend it using this
    -# tag. The format is ext=language, where ext is a file extension, and language
    -# is one of the parsers supported by doxygen: IDL, Java, Javascript, CSharp, C,
    -# C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, C++. For instance to make
    -# doxygen treat .inc files as Fortran files (default is PHP), and .f files as C
    -# (default is Fortran), use: inc=Fortran f=C. Note that for custom extensions
    -# you also need to set FILE_PATTERNS otherwise the files are not read by doxygen.
    -
    -EXTENSION_MAPPING      =
    -
    -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all
    -# comments according to the Markdown format, which allows for more readable
    -# documentation. See http://daringfireball.net/projects/markdown/ for details.
    -# The output of markdown processing is further processed by doxygen, so you
    -# can mix doxygen, HTML, and XML commands with Markdown formatting.
    -# Disable only in case of backward compatibilities issues.
    -
    -MARKDOWN_SUPPORT       = YES
    -
    -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
    -# to include (a tag file for) the STL sources as input, then you should
    -# set this tag to YES in order to let doxygen match functions declarations and
    -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
    -# func(std::string) {}). This also makes the inheritance and collaboration
    -# diagrams that involve STL classes more complete and accurate.
    -
    -BUILTIN_STL_SUPPORT    = NO
    -
    -# If you use Microsoft's C++/CLI language, you should set this option to YES to
    -# enable parsing support.
    -
    -CPP_CLI_SUPPORT        = NO
    -
    -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only.
    -# Doxygen will parse them like normal C++ but will assume all classes use public
    -# instead of private inheritance when no explicit protection keyword is present.
    -
    -SIP_SUPPORT            = NO
    -
    -# For Microsoft's IDL there are propget and propput attributes to indicate getter
    -# and setter methods for a property. Setting this option to YES (the default)
    -# will make doxygen replace the get and set methods by a property in the
    -# documentation. This will only work if the methods are indeed getting or
    -# setting a simple type. If this is not the case, or you want to show the
    -# methods anyway, you should set this option to NO.
    -
    -IDL_PROPERTY_SUPPORT   = YES
    -
    -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
    -# tag is set to YES, then doxygen will reuse the documentation of the first
    -# member in the group (if any) for the other members of the group. By default
    -# all members of a group must be documented explicitly.
    -
    -DISTRIBUTE_GROUP_DOC   = NO
    -
    -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
    -# the same type (for instance a group of public functions) to be put as a
    -# subgroup of that type (e.g. under the Public Functions section). Set it to
    -# NO to prevent subgrouping. Alternatively, this can be done per class using
    -# the \nosubgrouping command.
    -
    -SUBGROUPING            = YES
    -
    -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and
    -# unions are shown inside the group in which they are included (e.g. using
    -# @ingroup) instead of on a separate page (for HTML and Man pages) or
    -# section (for LaTeX and RTF).
    -
    -INLINE_GROUPED_CLASSES = NO
    -
    -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and
    -# unions with only public data fields will be shown inline in the documentation
    -# of the scope in which they are defined (i.e. file, namespace, or group
    -# documentation), provided this scope is documented. If set to NO (the default),
    -# structs, classes, and unions are shown on a separate page (for HTML and Man
    -# pages) or section (for LaTeX and RTF).
    -
    -INLINE_SIMPLE_STRUCTS  = NO
    -
    -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum
    -# is documented as struct, union, or enum with the name of the typedef. So
    -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
    -# with name TypeT. When disabled the typedef will appear as a member of a file,
    -# namespace, or class. And the struct will be named TypeS. This can typically
    -# be useful for C code in case the coding convention dictates that all compound
    -# types are typedef'ed and only the typedef is referenced, never the tag name.
    -
    -TYPEDEF_HIDES_STRUCT   = NO
    -
    -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to
    -# determine which symbols to keep in memory and which to flush to disk.
    -# When the cache is full, less often used symbols will be written to disk.
    -# For small to medium size projects (<1000 input files) the default value is
    -# probably good enough. For larger projects a too small cache size can cause
    -# doxygen to be busy swapping symbols to and from disk most of the time
    -# causing a significant performance penalty.
    -# If the system has enough physical memory increasing the cache will improve the
    -# performance by keeping more symbols in memory. Note that the value works on
    -# a logarithmic scale so increasing the size by one will roughly double the
    -# memory usage. The cache size is given by this formula:
    -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0,
    -# corresponding to a cache size of 2^16 = 65536 symbols.
    -
    -SYMBOL_CACHE_SIZE      = 0
    -
    -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be
    -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given
    -# their name and scope. Since this can be an expensive process and often the
    -# same symbol appear multiple times in the code, doxygen keeps a cache of
    -# pre-resolved symbols. If the cache is too small doxygen will become slower.
    -# If the cache is too large, memory is wasted. The cache size is given by this
    -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0,
    -# corresponding to a cache size of 2^16 = 65536 symbols.
    -
    -LOOKUP_CACHE_SIZE      = 0
    -
    -#---------------------------------------------------------------------------
    -# Build related configuration options
    -#---------------------------------------------------------------------------
    -
    -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
    -# documentation are documented, even if no documentation was available.
    -# Private class members and static file members will be hidden unless
    -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
    -
    -EXTRACT_ALL            = NO
    -
    -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
    -# will be included in the documentation.
    -
    -EXTRACT_PRIVATE        = NO
    -
    -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal scope will be included in the documentation.
    -
    -EXTRACT_PACKAGE        = NO
    -
    -# If the EXTRACT_STATIC tag is set to YES all static members of a file
    -# will be included in the documentation.
    -
    -EXTRACT_STATIC         = NO
    -
    -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
    -# defined locally in source files will be included in the documentation.
    -# If set to NO only classes defined in header files are included.
    -
    -EXTRACT_LOCAL_CLASSES  = YES
    -
    -# This flag is only useful for Objective-C code. When set to YES local
    -# methods, which are defined in the implementation section but not in
    -# the interface are included in the documentation.
    -# If set to NO (the default) only methods in the interface are included.
    -
    -EXTRACT_LOCAL_METHODS  = NO
    -
    -# If this flag is set to YES, the members of anonymous namespaces will be
    -# extracted and appear in the documentation as a namespace called
    -# 'anonymous_namespace{file}', where file will be replaced with the base
    -# name of the file that contains the anonymous namespace. By default
    -# anonymous namespaces are hidden.
    -
    -EXTRACT_ANON_NSPACES   = NO
    -
    -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
    -# undocumented members of documented classes, files or namespaces.
    -# If set to NO (the default) these members will be included in the
    -# various overviews, but no documentation section is generated.
    -# This option has no effect if EXTRACT_ALL is enabled.
    -
    -HIDE_UNDOC_MEMBERS     = NO
    -
    -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
    -# undocumented classes that are normally visible in the class hierarchy.
    -# If set to NO (the default) these classes will be included in the various
    -# overviews. This option has no effect if EXTRACT_ALL is enabled.
    -
    -HIDE_UNDOC_CLASSES     = NO
    -
    -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
    -# friend (class|struct|union) declarations.
    -# If set to NO (the default) these declarations will be included in the
    -# documentation.
    -
    -HIDE_FRIEND_COMPOUNDS  = NO
    -
    -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
    -# documentation blocks found inside the body of a function.
    -# If set to NO (the default) these blocks will be appended to the
    -# function's detailed documentation block.
    -
    -HIDE_IN_BODY_DOCS      = NO
    -
    -# The INTERNAL_DOCS tag determines if documentation
    -# that is typed after a \internal command is included. If the tag is set
    -# to NO (the default) then the documentation will be excluded.
    -# Set it to YES to include the internal documentation.
    -
    -INTERNAL_DOCS          = NO
    -
    -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
    -# file names in lower-case letters. If set to YES upper-case letters are also
    -# allowed. This is useful if you have classes or files whose names only differ
    -# in case and if your file system supports case sensitive file names. Windows
    -# and Mac users are advised to set this option to NO.
    -
    -CASE_SENSE_NAMES       = NO
    -
    -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
    -# will show members with their full class and namespace scopes in the
    -# documentation. If set to YES the scope will be hidden.
    -
    -HIDE_SCOPE_NAMES       = NO
    -
    -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
    -# will put a list of the files that are included by a file in the documentation
    -# of that file.
    -
    -SHOW_INCLUDE_FILES     = YES
    -
    -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen
    -# will list include files with double quotes in the documentation
    -# rather than with sharp brackets.
    -
    -FORCE_LOCAL_INCLUDES   = NO
    -
    -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
    -# is inserted in the documentation for inline members.
    -
    -INLINE_INFO            = YES
    -
    -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
    -# will sort the (detailed) documentation of file and class members
    -# alphabetically by member name. If set to NO the members will appear in
    -# declaration order.
    -
    -SORT_MEMBER_DOCS       = YES
    -
    -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
    -# brief documentation of file, namespace and class members alphabetically
    -# by member name. If set to NO (the default) the members will appear in
    -# declaration order.
    -
    -SORT_BRIEF_DOCS        = NO
    -
    -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen
    -# will sort the (brief and detailed) documentation of class members so that
    -# constructors and destructors are listed first. If set to NO (the default)
    -# the constructors will appear in the respective orders defined by
    -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS.
    -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO
    -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO.
    -
    -SORT_MEMBERS_CTORS_1ST = NO
    -
    -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the
    -# hierarchy of group names into alphabetical order. If set to NO (the default)
    -# the group names will appear in their defined order.
    -
    -SORT_GROUP_NAMES       = NO
    -
    -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
    -# sorted by fully-qualified names, including namespaces. If set to
    -# NO (the default), the class list will be sorted only by class name,
    -# not including the namespace part.
    -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
    -# Note: This option applies only to the class list, not to the
    -# alphabetical list.
    -
    -SORT_BY_SCOPE_NAME     = NO
    -
    -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to
    -# do proper type resolution of all parameters of a function it will reject a
    -# match between the prototype and the implementation of a member function even
    -# if there is only one candidate or it is obvious which candidate to choose
    -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen
    -# will still accept a match between prototype and implementation in such cases.
    -
    -STRICT_PROTO_MATCHING  = NO
    -
    -# The GENERATE_TODOLIST tag can be used to enable (YES) or
    -# disable (NO) the todo list. This list is created by putting \todo
    -# commands in the documentation.
    -
    -GENERATE_TODOLIST      = YES
    -
    -# The GENERATE_TESTLIST tag can be used to enable (YES) or
    -# disable (NO) the test list. This list is created by putting \test
    -# commands in the documentation.
    -
    -GENERATE_TESTLIST      = YES
    -
    -# The GENERATE_BUGLIST tag can be used to enable (YES) or
    -# disable (NO) the bug list. This list is created by putting \bug
    -# commands in the documentation.
    -
    -GENERATE_BUGLIST       = YES
    -
    -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
    -# disable (NO) the deprecated list. This list is created by putting
    -# \deprecated commands in the documentation.
    -
    -GENERATE_DEPRECATEDLIST= YES
    -
    -# The ENABLED_SECTIONS tag can be used to enable conditional
    -# documentation sections, marked by \if sectionname ... \endif.
    -
    -ENABLED_SECTIONS       =
    -
    -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
    -# the initial value of a variable or macro consists of for it to appear in
    -# the documentation. If the initializer consists of more lines than specified
    -# here it will be hidden. Use a value of 0 to hide initializers completely.
    -# The appearance of the initializer of individual variables and macros in the
    -# documentation can be controlled using \showinitializer or \hideinitializer
    -# command in the documentation regardless of this setting.
    -
    -MAX_INITIALIZER_LINES  = 30
    -
    -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
    -# at the bottom of the documentation of classes and structs. If set to YES the
    -# list will mention the files that were used to generate the documentation.
    -
    -SHOW_USED_FILES        = 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 NO.
    -
    -SHOW_DIRECTORIES       = NO
    -
    -# Set the SHOW_FILES tag to NO to disable the generation of the Files page.
    -# This will remove the Files entry from the Quick Index and from the
    -# Folder Tree View (if specified). The default is YES.
    -
    -SHOW_FILES             = YES
    -
    -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the
    -# Namespaces page.
    -# This will remove the Namespaces entry from the Quick Index
    -# and from the Folder Tree View (if specified). The default is YES.
    -
    -SHOW_NAMESPACES        = 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
    -# popen()) the command  , where  is the value of
    -# the FILE_VERSION_FILTER tag, and  is the name of an input file
    -# provided by doxygen. Whatever the program writes to standard output
    -# is used as the file version. See the manual for examples.
    -
    -FILE_VERSION_FILTER    =
    -
    -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
    -# by doxygen. The layout file controls the global structure of the generated
    -# output files in an output format independent way. The create the layout file
    -# that represents doxygen's defaults, run doxygen with the -l option.
    -# You can optionally specify a file name after the option, if omitted
    -# DoxygenLayout.xml will be used as the name of the layout file.
    -
    -LAYOUT_FILE            =
    -
    -# The CITE_BIB_FILES tag can be used to specify one or more bib files
    -# containing the references data. This must be a list of .bib files. The
    -# .bib extension is automatically appended if omitted. Using this command
    -# requires the bibtex tool to be installed. See also
    -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style
    -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this
    -# feature you need bibtex and perl available in the search path.
    -
    -CITE_BIB_FILES         =
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to warning and progress messages
    -#---------------------------------------------------------------------------
    -
    -# The QUIET tag can be used to turn on/off the messages that are generated
    -# by doxygen. Possible values are YES and NO. If left blank NO is used.
    -
    -QUIET                  = NO
    -
    -# The WARNINGS tag can be used to turn on/off the warning messages that are
    -# generated by doxygen. Possible values are YES and NO. If left blank
    -# NO is used.
    -
    -WARNINGS               = YES
    -
    -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
    -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
    -# automatically be disabled.
    -
    -WARN_IF_UNDOCUMENTED   = YES
    -
    -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
    -# potential errors in the documentation, such as not documenting some
    -# parameters in a documented function, or documenting parameters that
    -# don't exist or using markup commands wrongly.
    -
    -WARN_IF_DOC_ERROR      = YES
    -
    -# The WARN_NO_PARAMDOC option can be enabled to get warnings for
    -# functions that are documented, but have no documentation for their parameters
    -# or return value. If set to NO (the default) doxygen will only warn about
    -# wrong or incomplete parameter documentation, but not about the absence of
    -# documentation.
    -
    -WARN_NO_PARAMDOC       = NO
    -
    -# The WARN_FORMAT tag determines the format of the warning messages that
    -# doxygen can produce. The string should contain the $file, $line, and $text
    -# tags, which will be replaced by the file and line number from which the
    -# warning originated and the warning text. Optionally the format may contain
    -# $version, which will be replaced by the version of the file (if it could
    -# be obtained via FILE_VERSION_FILTER)
    -
    -WARN_FORMAT            = "$file:$line: $text"
    -
    -# The WARN_LOGFILE tag can be used to specify a file to which warning
    -# and error messages should be written. If left blank the output is written
    -# to stderr.
    -
    -WARN_LOGFILE           =
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to the input files
    -#---------------------------------------------------------------------------
    -
    -# The INPUT tag can be used to specify the files and/or directories that contain
    -# documented source files. You may enter file names like "myfile.cpp" or
    -# directories like "/usr/src/myproject". Separate the files or directories
    -# with spaces.
    -
    -INPUT                  = @top_srcdir@
    -INPUT                  = @top_srcdir@/doc/manuals/main.dox \
    -                         @top_srcdir@/doc/manuals/howto.dox \
    -                         @top_srcdir@/doc/manuals/changelog.dox \
    -                         @top_srcdir@/doc/manuals/rng.dox \
    -                         @top_srcdir@/include/zrtp_config_user.h \
    -                         @top_srcdir@/include/zrtp.h \
    -                         @top_srcdir@/include/zrtp_iface_system.h \
    -                         @top_srcdir@/include/zrtp_iface.h \
    -                         @top_srcdir@/include/zrtp_error.h \
    -                         @top_srcdir@/include/zrtp_types.h \
    -                         @top_srcdir@/include/zrtp_string.h \
    -                         @top_srcdir@/include/zrtp_pbx.h
    -
    -
    -# This tag can be used to specify the character encoding of the source files
    -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
    -# also the default input encoding. Doxygen uses libiconv (or the iconv built
    -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for
    -# the list of possible encodings.
    -
    -INPUT_ENCODING         = UTF-8
    -
    -# If the value of the INPUT tag contains directories, you can use the
    -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
    -# and *.h) to filter out the source-files in the directories. If left
    -# blank the following patterns are tested:
    -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh
    -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py
    -# *.f90 *.f *.for *.vhd *.vhdl
    -
    -FILE_PATTERNS          =
    -
    -# The RECURSIVE tag can be used to turn specify whether or not subdirectories
    -# should be searched for input files as well. Possible values are YES and NO.
    -# If left blank NO is used.
    -
    -RECURSIVE              = NO
    -
    -# The EXCLUDE tag can be used to specify files and/or directories that should be
    -# excluded from the INPUT source files. This way you can easily exclude a
    -# subdirectory from a directory tree whose root is specified with the INPUT tag.
    -# Note that relative paths are relative to the directory from which doxygen is
    -# run.
    -
    -EXCLUDE                =
    -
    -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
    -# directories that are symbolic links (a Unix file system feature) are excluded
    -# from the input.
    -
    -EXCLUDE_SYMLINKS       = NO
    -
    -# If the value of the INPUT tag contains directories, you can use the
    -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
    -# certain files from those directories. Note that the wildcards are matched
    -# against the file with absolute path, so to exclude all test directories
    -# for example use the pattern */test/*
    -
    -EXCLUDE_PATTERNS       =
    -
    -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
    -# (namespaces, classes, functions, etc.) that should be excluded from the
    -# output. The symbol name can be a fully qualified name, a word, or if the
    -# wildcard * is used, a substring. Examples: ANamespace, AClass,
    -# AClass::ANamespace, ANamespace::*Test
    -
    -EXCLUDE_SYMBOLS        =
    -
    -# The EXAMPLE_PATH tag can be used to specify one or more files or
    -# directories that contain example code fragments that are included (see
    -# the \include command).
    -
    -EXAMPLE_PATH           =
    -
    -# If the value of the EXAMPLE_PATH tag contains directories, you can use the
    -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
    -# and *.h) to filter out the source-files in the directories. If left
    -# blank all files are included.
    -
    -EXAMPLE_PATTERNS       =
    -
    -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
    -# searched for input files to be used with the \include or \dontinclude
    -# commands irrespective of the value of the RECURSIVE tag.
    -# Possible values are YES and NO. If left blank NO is used.
    -
    -EXAMPLE_RECURSIVE      = NO
    -
    -# The IMAGE_PATH tag can be used to specify one or more files or
    -# directories that contain image that are included in the documentation (see
    -# the \image command).
    -
    -IMAGE_PATH             =
    -
    -# The INPUT_FILTER tag can be used to specify a program that doxygen should
    -# invoke to filter for each input file. Doxygen will invoke the filter program
    -# by executing (via popen()) the command  , where 
    -# is the value of the INPUT_FILTER tag, and  is the name of an
    -# input file. Doxygen will then use the output that the filter program writes
    -# to standard output.
    -# If FILTER_PATTERNS is specified, this tag will be
    -# ignored.
    -
    -INPUT_FILTER           =
    -
    -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
    -# basis.
    -# Doxygen will compare the file name with each pattern and apply the
    -# filter if there is a match.
    -# The filters are a list of the form:
    -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
    -# info on how filters are used. If FILTER_PATTERNS is empty or if
    -# non of the patterns match the file name, INPUT_FILTER is applied.
    -
    -FILTER_PATTERNS        =
    -
    -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
    -# INPUT_FILTER) will be used to filter the input files when producing source
    -# files to browse (i.e. when SOURCE_BROWSER is set to YES).
    -
    -FILTER_SOURCE_FILES    = NO
    -
    -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
    -# pattern. A pattern will override the setting for FILTER_PATTERN (if any)
    -# and it is also possible to disable source filtering for a specific pattern
    -# using *.ext= (so without naming a filter). This option only has effect when
    -# FILTER_SOURCE_FILES is enabled.
    -
    -FILTER_SOURCE_PATTERNS =
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to source browsing
    -#---------------------------------------------------------------------------
    -
    -# If the SOURCE_BROWSER tag is set to YES then a list of source files will
    -# be generated. Documented entities will be cross-referenced with these sources.
    -# Note: To get rid of all source code in the generated output, make sure also
    -# VERBATIM_HEADERS is set to NO.
    -
    -SOURCE_BROWSER         = NO
    -
    -# Setting the INLINE_SOURCES tag to YES will include the body
    -# of functions and classes directly in the documentation.
    -
    -INLINE_SOURCES         = NO
    -
    -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
    -# doxygen to hide any special comment blocks from generated source code
    -# fragments. Normal C and C++ comments will always remain visible.
    -
    -STRIP_CODE_COMMENTS    = YES
    -
    -# If the REFERENCED_BY_RELATION tag is set to YES
    -# then for each documented function all documented
    -# functions referencing it will be listed.
    -
    -REFERENCED_BY_RELATION = NO
    -
    -# If the REFERENCES_RELATION tag is set to YES
    -# then for each documented function all documented entities
    -# called/used by that function will be listed.
    -
    -REFERENCES_RELATION    = NO
    -
    -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
    -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
    -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
    -# link to the source code.
    -# Otherwise they will link to the documentation.
    -
    -REFERENCES_LINK_SOURCE = YES
    -
    -# If the USE_HTAGS tag is set to YES then the references to source code
    -# will point to the HTML generated by the htags(1) tool instead of doxygen
    -# built-in source browser. The htags tool is part of GNU's global source
    -# tagging system (see http://www.gnu.org/software/global/global.html). You
    -# will need version 4.8.6 or higher.
    -
    -USE_HTAGS              = NO
    -
    -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
    -# will generate a verbatim copy of the header file for each class for
    -# which an include is specified. Set to NO to disable this.
    -
    -VERBATIM_HEADERS       = YES
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to the alphabetical class index
    -#---------------------------------------------------------------------------
    -
    -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
    -# of all compounds will be generated. Enable this if the project
    -# contains a lot of classes, structs, unions or interfaces.
    -
    -ALPHABETICAL_INDEX     = YES
    -
    -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
    -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
    -# in which this list will be split (can be a number in the range [1..20])
    -
    -COLS_IN_ALPHA_INDEX    = 5
    -
    -# In case all classes in a project start with a common prefix, all
    -# classes will be put under the same header in the alphabetical index.
    -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
    -# should be ignored while generating the index headers.
    -
    -IGNORE_PREFIX          =
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to the HTML output
    -#---------------------------------------------------------------------------
    -
    -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
    -# generate HTML output.
    -
    -GENERATE_HTML          = YES
    -
    -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
    -# If a relative path is entered the value of OUTPUT_DIRECTORY will be
    -# put in front of it. If left blank `html' will be used as the default path.
    -
    -HTML_OUTPUT            = html
    -
    -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
    -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
    -# doxygen will generate files with .html extension.
    -
    -HTML_FILE_EXTENSION    = .html
    -
    -# The HTML_HEADER tag can be used to specify a personal HTML header for
    -# each generated HTML page. If it is left blank doxygen will generate a
    -# standard header. Note that when using a custom header you are responsible
    -#  for the proper inclusion of any scripts and style sheets that doxygen
    -# needs, which is dependent on the configuration options used.
    -# It is advised to generate a default header using "doxygen -w html
    -# header.html footer.html stylesheet.css YourConfigFile" and then modify
    -# that header. Note that the header is subject to change so you typically
    -# have to redo this when upgrading to a newer version of doxygen or when
    -# changing the value of configuration settings such as GENERATE_TREEVIEW!
    -
    -HTML_HEADER            =
    -
    -# The HTML_FOOTER tag can be used to specify a personal HTML footer for
    -# each generated HTML page. If it is left blank doxygen will generate a
    -# standard footer.
    -
    -HTML_FOOTER            =
    -
    -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
    -# style sheet that is used by each HTML page. It can be used to
    -# fine-tune the look of the HTML output. If the tag is left blank doxygen
    -# will generate a default style sheet. Note that doxygen will try to copy
    -# the style sheet file to the HTML output directory, so don't put your own
    -# style sheet in the HTML output directory as well, or it will be erased!
    -
    -HTML_STYLESHEET        =
    -
    -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
    -# other source files which should be copied to the HTML output directory. Note
    -# that these files will be copied to the base HTML output directory. Use the
    -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
    -# files. In the HTML_STYLESHEET file, use the file name only. Also note that
    -# the files will be copied as-is; there are no commands or markers available.
    -
    -HTML_EXTRA_FILES       =
    -
    -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output.
    -# Doxygen will adjust the colors in the style sheet and background images
    -# according to this color. Hue is specified as an angle on a colorwheel,
    -# see http://en.wikipedia.org/wiki/Hue for more information.
    -# For instance the value 0 represents red, 60 is yellow, 120 is green,
    -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again.
    -# The allowed range is 0 to 359.
    -
    -HTML_COLORSTYLE_HUE    = 220
    -
    -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of
    -# the colors in the HTML output. For a value of 0 the output will use
    -# grayscales only. A value of 255 will produce the most vivid colors.
    -
    -HTML_COLORSTYLE_SAT    = 100
    -
    -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to
    -# the luminance component of the colors in the HTML output. Values below
    -# 100 gradually make the output lighter, whereas values above 100 make
    -# the output darker. The value divided by 100 is the actual gamma applied,
    -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2,
    -# and 100 does not change the gamma.
    -
    -HTML_COLORSTYLE_GAMMA  = 80
    -
    -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
    -# page will contain the date and time when the page was generated. Setting
    -# this to NO can help when comparing the output of multiple runs.
    -
    -HTML_TIMESTAMP         = YES
    -
    -# 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 HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
    -# documentation will contain sections that can be hidden and shown after the
    -# page has loaded. For this to work a browser that supports
    -# JavaScript and DHTML is required (for instance Mozilla 1.0+, Firefox
    -# Netscape 6.0+, Internet explorer 5.0+, Konqueror, or Safari).
    -
    -HTML_DYNAMIC_SECTIONS  = NO
    -
    -# If the GENERATE_DOCSET tag is set to YES, additional index files
    -# will be generated that can be used as input for Apple's Xcode 3
    -# integrated development environment, introduced with OSX 10.5 (Leopard).
    -# To create a documentation set, doxygen will generate a Makefile in the
    -# HTML output directory. Running make will produce the docset in that
    -# directory and running "make install" will install the docset in
    -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find
    -# it at startup.
    -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
    -# for more information.
    -
    -GENERATE_DOCSET        = NO
    -
    -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the
    -# feed. A documentation feed provides an umbrella under which multiple
    -# documentation sets from a single provider (such as a company or product suite)
    -# can be grouped.
    -
    -DOCSET_FEEDNAME        = "Doxygen generated docs"
    -
    -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that
    -# should uniquely identify the documentation set bundle. This should be a
    -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen
    -# will append .docset to the name.
    -
    -DOCSET_BUNDLE_ID       = org.doxygen.Project
    -
    -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely identify
    -# the documentation publisher. This should be a reverse domain-name style
    -# string, e.g. com.mycompany.MyDocSet.documentation.
    -
    -DOCSET_PUBLISHER_ID    = org.doxygen.Publisher
    -
    -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher.
    -
    -DOCSET_PUBLISHER_NAME  = Publisher
    -
    -# 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 compiled HTML help file (.chm)
    -# of the generated HTML documentation.
    -
    -GENERATE_HTMLHELP      = NO
    -
    -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
    -# be used to specify the file name of the resulting .chm file. You
    -# can add a path in front of the file if the result should not be
    -# written to the html output directory.
    -
    -CHM_FILE               =
    -
    -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
    -# be used to specify the location (absolute path including file name) of
    -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
    -# the HTML help compiler on the generated index.hhp.
    -
    -HHC_LOCATION           =
    -
    -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
    -# controls if a separate .chi index file is generated (YES) or that
    -# it should be included in the master .chm file (NO).
    -
    -GENERATE_CHI           = NO
    -
    -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING
    -# is used to encode HtmlHelp index (hhk), content (hhc) and project file
    -# content.
    -
    -CHM_INDEX_ENCODING     =
    -
    -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
    -# controls whether a binary table of contents is generated (YES) or a
    -# normal table of contents (NO) in the .chm file.
    -
    -BINARY_TOC             = NO
    -
    -# The TOC_EXPAND flag can be set to YES to add extra items for group members
    -# to the contents of the HTML help documentation and to the tree view.
    -
    -TOC_EXPAND             = NO
    -
    -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
    -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated
    -# that can be used as input for Qt's qhelpgenerator to generate a
    -# Qt Compressed Help (.qch) of the generated HTML documentation.
    -
    -GENERATE_QHP           = NO
    -
    -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can
    -# be used to specify the file name of the resulting .qch file.
    -# The path specified is relative to the HTML output folder.
    -
    -QCH_FILE               =
    -
    -# The QHP_NAMESPACE tag specifies the namespace to use when generating
    -# Qt Help Project output. For more information please see
    -# http://doc.trolltech.com/qthelpproject.html#namespace
    -
    -QHP_NAMESPACE          = org.doxygen.Project
    -
    -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating
    -# Qt Help Project output. For more information please see
    -# http://doc.trolltech.com/qthelpproject.html#virtual-folders
    -
    -QHP_VIRTUAL_FOLDER     = doc
    -
    -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to
    -# add. For more information please see
    -# http://doc.trolltech.com/qthelpproject.html#custom-filters
    -
    -QHP_CUST_FILTER_NAME   =
    -
    -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the
    -# custom filter to add. For more information please see
    -# 
    -# Qt Help Project / Custom Filters.
    -
    -QHP_CUST_FILTER_ATTRS  =
    -
    -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
    -# project's
    -# filter section matches.
    -# 
    -# Qt Help Project / Filter Attributes.
    -
    -QHP_SECT_FILTER_ATTRS  =
    -
    -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can
    -# be used to specify the location of Qt's qhelpgenerator.
    -# If non-empty doxygen will try to run qhelpgenerator on the generated
    -# .qhp file.
    -
    -QHG_LOCATION           =
    -
    -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files
    -#  will be generated, which together with the HTML files, form an Eclipse help
    -# plugin. To install this plugin and make it available under the help contents
    -# menu in Eclipse, the contents of the directory containing the HTML and XML
    -# files needs to be copied into the plugins directory of eclipse. The name of
    -# the directory within the plugins directory should be the same as
    -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before
    -# the help appears.
    -
    -GENERATE_ECLIPSEHELP   = NO
    -
    -# A unique identifier for the eclipse help plugin. When installing the plugin
    -# the directory name containing the HTML and XML files should also have
    -# this name.
    -
    -ECLIPSE_DOC_ID         = org.doxygen.Project
    -
    -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs)
    -# at top of each HTML page. The value NO (the default) enables the index and
    -# the value YES disables it. Since the tabs have the same information as the
    -# navigation tree you can set this option to NO if you already set
    -# GENERATE_TREEVIEW to YES.
    -
    -DISABLE_INDEX          = NO
    -
    -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
    -# structure should be generated to display hierarchical information.
    -# If the tag value is set to YES, a side panel will be generated
    -# containing a tree-like index structure (just like the one that
    -# is generated for HTML Help). For this to work a browser that supports
    -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser).
    -# Windows users are probably better off using the HTML help feature.
    -# Since the tree basically has the same information as the tab index you
    -# could consider to set DISABLE_INDEX to NO when enabling this option.
    -
    -GENERATE_TREEVIEW      = NO
    -
    -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values
    -# (range [0,1..20]) that doxygen will group on one line in the generated HTML
    -# documentation. Note that a value of 0 will completely suppress the enum
    -# values from appearing in the overview section.
    -
    -ENUM_VALUES_PER_LINE   = 4
    -
    -# By enabling USE_INLINE_TREES, doxygen will generate the Groups, Directories,
    -# and Class Hierarchy pages using a tree view instead of an ordered list.
    -
    -USE_INLINE_TREES       = NO
    -
    -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
    -# used to set the initial width (in pixels) of the frame in which the tree
    -# is shown.
    -
    -TREEVIEW_WIDTH         = 250
    -
    -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open
    -# links to external symbols imported via tag files in a separate window.
    -
    -EXT_LINKS_IN_WINDOW    = NO
    -
    -# Use this tag to change the font size of Latex formulas included
    -# as images in the HTML documentation. The default is 10. Note that
    -# when you change the font size after a successful doxygen run you need
    -# to manually remove any form_*.png images from the HTML output directory
    -# to force them to be regenerated.
    -
    -FORMULA_FONTSIZE       = 10
    -
    -# Use the FORMULA_TRANPARENT tag to determine whether or not the images
    -# generated for formulas are transparent PNGs. Transparent PNGs are
    -# not supported properly for IE 6.0, but are supported on all modern browsers.
    -# Note that when changing this option you need to delete any form_*.png files
    -# in the HTML output before the changes have effect.
    -
    -FORMULA_TRANSPARENT    = YES
    -
    -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax
    -# (see http://www.mathjax.org) which uses client side Javascript for the
    -# rendering instead of using prerendered bitmaps. Use this if you do not
    -# have LaTeX installed or if you want to formulas look prettier in the HTML
    -# output. When enabled you may also need to install MathJax separately and
    -# configure the path to it using the MATHJAX_RELPATH option.
    -
    -USE_MATHJAX            = NO
    -
    -# When MathJax is enabled you need to specify the location relative to the
    -# HTML output directory using the MATHJAX_RELPATH option. The destination
    -# directory should contain the MathJax.js script. For instance, if the mathjax
    -# directory is located at the same level as the HTML output directory, then
    -# MATHJAX_RELPATH should be ../mathjax. The default value points to
    -# the MathJax Content Delivery Network so you can quickly see the result without
    -# installing MathJax.
    -# However, it is strongly recommended to install a local
    -# copy of MathJax from http://www.mathjax.org before deployment.
    -
    -MATHJAX_RELPATH        = http://cdn.mathjax.org/mathjax/latest
    -
    -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension
    -# names that should be enabled during MathJax rendering.
    -
    -MATHJAX_EXTENSIONS     =
    -
    -# When the SEARCHENGINE tag is enabled doxygen will generate a search box
    -# for the HTML output. The underlying search engine uses javascript
    -# and DHTML and should work on any modern browser. Note that when using
    -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets
    -# (GENERATE_DOCSET) there is already a search function so this one should
    -# typically be disabled. For large projects the javascript based search engine
    -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution.
    -
    -SEARCHENGINE           = YES
    -
    -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
    -# implemented using a PHP enabled web server instead of at the web client
    -# using Javascript. Doxygen will generate the search PHP script and index
    -# file to put on the web server. The advantage of the server
    -# based approach is that it scales better to large projects and allows
    -# full text search. The disadvantages are that it is more difficult to setup
    -# and does not have live searching capabilities.
    -
    -SERVER_BASED_SEARCH    = NO
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to the LaTeX output
    -#---------------------------------------------------------------------------
    -
    -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
    -# generate Latex output.
    -
    -GENERATE_LATEX         = NO
    -
    -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
    -# If a relative path is entered the value of OUTPUT_DIRECTORY will be
    -# put in front of it. If left blank `latex' will be used as the default path.
    -
    -LATEX_OUTPUT           = latex
    -
    -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
    -# invoked. If left blank `latex' will be used as the default command name.
    -# Note that when enabling USE_PDFLATEX this option is only used for
    -# generating bitmaps for formulas in the HTML output, but not in the
    -# Makefile that is written to the output directory.
    -
    -LATEX_CMD_NAME         = latex
    -
    -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
    -# generate index for LaTeX. If left blank `makeindex' will be used as the
    -# default command name.
    -
    -MAKEINDEX_CMD_NAME     = makeindex
    -
    -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
    -# LaTeX documents. This may be useful for small projects and may help to
    -# save some trees in general.
    -
    -COMPACT_LATEX          = NO
    -
    -# The PAPER_TYPE tag can be used to set the paper type that is used
    -# by the printer. Possible values are: a4, letter, legal and
    -# executive. If left blank a4wide will be used.
    -
    -PAPER_TYPE             = a4
    -
    -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
    -# packages that should be included in the LaTeX output.
    -
    -EXTRA_PACKAGES         =
    -
    -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
    -# the generated latex document. The header should contain everything until
    -# the first chapter. If it is left blank doxygen will generate a
    -# standard header. Notice: only use this tag if you know what you are doing!
    -
    -LATEX_HEADER           =
    -
    -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for
    -# the generated latex document. The footer should contain everything after
    -# the last chapter. If it is left blank doxygen will generate a
    -# standard footer. Notice: only use this tag if you know what you are doing!
    -
    -LATEX_FOOTER           =
    -
    -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
    -# is prepared for conversion to pdf (using ps2pdf). The pdf file will
    -# contain links (just like the HTML output) instead of page references
    -# This makes the output suitable for online browsing using a pdf viewer.
    -
    -PDF_HYPERLINKS         = YES
    -
    -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
    -# plain latex in the generated Makefile. Set this option to YES to get a
    -# higher quality PDF documentation.
    -
    -USE_PDFLATEX           = YES
    -
    -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
    -# command to the generated LaTeX files. This will instruct LaTeX to keep
    -# running if errors occur, instead of asking the user for help.
    -# This option is also used when generating formulas in HTML.
    -
    -LATEX_BATCHMODE        = NO
    -
    -# If LATEX_HIDE_INDICES is set to YES then doxygen will not
    -# include the index chapters (such as File Index, Compound Index, etc.)
    -# in the output.
    -
    -LATEX_HIDE_INDICES     = NO
    -
    -# If LATEX_SOURCE_CODE is set to YES then doxygen will include
    -# source code with syntax highlighting in the LaTeX output.
    -# Note that which sources are shown also depends on other settings
    -# such as SOURCE_BROWSER.
    -
    -LATEX_SOURCE_CODE      = NO
    -
    -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
    -# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See
    -# http://en.wikipedia.org/wiki/BibTeX for more info.
    -
    -LATEX_BIB_STYLE        = plain
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to the RTF output
    -#---------------------------------------------------------------------------
    -
    -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
    -# The RTF output is optimized for Word 97 and may not look very pretty with
    -# other RTF readers or editors.
    -
    -GENERATE_RTF           = NO
    -
    -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
    -# If a relative path is entered the value of OUTPUT_DIRECTORY will be
    -# put in front of it. If left blank `rtf' will be used as the default path.
    -
    -RTF_OUTPUT             = rtf
    -
    -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
    -# RTF documents. This may be useful for small projects and may help to
    -# save some trees in general.
    -
    -COMPACT_RTF            = NO
    -
    -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
    -# will contain hyperlink fields. The RTF file will
    -# contain links (just like the HTML output) instead of page references.
    -# This makes the output suitable for online browsing using WORD or other
    -# programs which support those fields.
    -# Note: wordpad (write) and others do not support links.
    -
    -RTF_HYPERLINKS         = NO
    -
    -# Load style sheet definitions from file. Syntax is similar to doxygen's
    -# config file, i.e. a series of assignments. You only have to provide
    -# replacements, missing definitions are set to their default value.
    -
    -RTF_STYLESHEET_FILE    =
    -
    -# Set optional variables used in the generation of an rtf document.
    -# Syntax is similar to doxygen's config file.
    -
    -RTF_EXTENSIONS_FILE    =
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to the man page output
    -#---------------------------------------------------------------------------
    -
    -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
    -# generate man pages
    -
    -GENERATE_MAN           = YES
    -
    -# The MAN_OUTPUT tag is used to specify where the man pages will be put.
    -# If a relative path is entered the value of OUTPUT_DIRECTORY will be
    -# put in front of it. If left blank `man' will be used as the default path.
    -
    -MAN_OUTPUT             = man
    -
    -# The MAN_EXTENSION tag determines the extension that is added to
    -# the generated man pages (default is the subroutine's section .3)
    -
    -MAN_EXTENSION          = .3
    -
    -# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
    -# then it will generate one additional man file for each entity
    -# documented in the real man page(s). These additional files
    -# only source the real man page, but without them the man command
    -# would be unable to find the correct page. The default is NO.
    -
    -MAN_LINKS              = NO
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to the XML output
    -#---------------------------------------------------------------------------
    -
    -# If the GENERATE_XML tag is set to YES Doxygen will
    -# generate an XML file that captures the structure of
    -# the code including all documentation.
    -
    -GENERATE_XML           = NO
    -
    -# The XML_OUTPUT tag is used to specify where the XML pages will be put.
    -# If a relative path is entered the value of OUTPUT_DIRECTORY will be
    -# put in front of it. If left blank `xml' will be used as the default path.
    -
    -XML_OUTPUT             = xml
    -
    -# The XML_SCHEMA tag can be used to specify an XML schema,
    -# which can be used by a validating XML parser to check the
    -# syntax of the XML files.
    -
    -XML_SCHEMA             =
    -
    -# The XML_DTD tag can be used to specify an XML DTD,
    -# which can be used by a validating XML parser to check the
    -# syntax of the XML files.
    -
    -XML_DTD                =
    -
    -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
    -# dump the program listings (including syntax highlighting
    -# and cross-referencing information) to the XML output. Note that
    -# enabling this will significantly increase the size of the XML output.
    -
    -XML_PROGRAMLISTING     = YES
    -
    -#---------------------------------------------------------------------------
    -# configuration options for the AutoGen Definitions output
    -#---------------------------------------------------------------------------
    -
    -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
    -# generate an AutoGen Definitions (see autogen.sf.net) file
    -# that captures the structure of the code including all
    -# documentation. Note that this feature is still experimental
    -# and incomplete at the moment.
    -
    -GENERATE_AUTOGEN_DEF   = NO
    -
    -#---------------------------------------------------------------------------
    -# configuration options related to the Perl module output
    -#---------------------------------------------------------------------------
    -
    -# If the GENERATE_PERLMOD tag is set to YES Doxygen will
    -# generate a Perl module file that captures the structure of
    -# the code including all documentation. Note that this
    -# feature is still experimental and incomplete at the
    -# moment.
    -
    -GENERATE_PERLMOD       = NO
    -
    -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
    -# the necessary Makefile rules, Perl scripts and LaTeX code to be able
    -# to generate PDF and DVI output from the Perl module output.
    -
    -PERLMOD_LATEX          = NO
    -
    -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
    -# nicely formatted so it can be parsed by a human reader.
    -# This is useful
    -# if you want to understand what is going on.
    -# On the other hand, if this
    -# tag is set to NO the size of the Perl module output will be much smaller
    -# and Perl will parse it just the same.
    -
    -PERLMOD_PRETTY         = YES
    -
    -# The names of the make variables in the generated doxyrules.make file
    -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
    -# This is useful so different doxyrules.make files included by the same
    -# Makefile don't overwrite each other's variables.
    -
    -PERLMOD_MAKEVAR_PREFIX =
    -
    -#---------------------------------------------------------------------------
    -# Configuration options related to the preprocessor
    -#---------------------------------------------------------------------------
    -
    -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
    -# evaluate all C-preprocessor directives found in the sources and include
    -# files.
    -
    -ENABLE_PREPROCESSING   = YES
    -
    -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
    -# names in the source code. If set to NO (the default) only conditional
    -# compilation will be performed. Macro expansion can be done in a controlled
    -# way by setting EXPAND_ONLY_PREDEF to YES.
    -
    -MACRO_EXPANSION        = NO
    -
    -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
    -# then the macro expansion is limited to the macros specified with the
    -# PREDEFINED and EXPAND_AS_DEFINED tags.
    -
    -EXPAND_ONLY_PREDEF     = NO
    -
    -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
    -# pointed to by INCLUDE_PATH will be searched when a #include is found.
    -
    -SEARCH_INCLUDES        = YES
    -
    -# The INCLUDE_PATH tag can be used to specify one or more directories that
    -# contain include files that are not input files but should be processed by
    -# the preprocessor.
    -
    -INCLUDE_PATH           =
    -
    -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
    -# patterns (like *.h and *.hpp) to filter out the header-files in the
    -# directories. If left blank, the patterns specified with FILE_PATTERNS will
    -# be used.
    -
    -INCLUDE_FILE_PATTERNS  =
    -
    -# The PREDEFINED tag can be used to specify one or more macro names that
    -# are defined before the preprocessor is started (similar to the -D option of
    -# gcc). The argument of the tag is a list of macros of the form: name
    -# or name=definition (no spaces). If the definition and the = are
    -# omitted =1 is assumed. To prevent a macro definition from being
    -# undefined via #undef or recursively expanded use the := operator
    -# instead of the = operator.
    -
    -PREDEFINED             =
    -
    -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
    -# this tag can be used to specify a list of macro names that should be expanded.
    -# The macro definition that is found in the sources will be used.
    -# Use the PREDEFINED tag if you want to use a different macro definition that
    -# overrules the definition found in the source code.
    -
    -EXPAND_AS_DEFINED      =
    -
    -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
    -# doxygen's preprocessor will remove all references to function-like macros
    -# that are alone on a line, have an all uppercase name, and do not end with a
    -# semicolon, because these will confuse the parser if not removed.
    -
    -SKIP_FUNCTION_MACROS   = YES
    -
    -#---------------------------------------------------------------------------
    -# Configuration::additions related to external references
    -#---------------------------------------------------------------------------
    -
    -# The TAGFILES option can be used to specify one or more tagfiles. For each
    -# tag file the location of the external documentation should be added. The
    -# format of a tag file without this location is as follows:
    -#
    -# TAGFILES = file1 file2 ...
    -# Adding location for the tag files is done as follows:
    -#
    -# TAGFILES = file1=loc1 "file2 = loc2" ...
    -# where "loc1" and "loc2" can be relative or absolute paths
    -# or URLs. Note that each tag file must have a unique name (where the name does
    -# NOT include the path). If a tag file is not located in the directory in which
    -# doxygen is run, you must also specify the path to the tagfile here.
    -
    -TAGFILES               =
    -
    -# When a file name is specified after GENERATE_TAGFILE, doxygen will create
    -# a tag file that is based on the input files it reads.
    -
    -GENERATE_TAGFILE       =
    -
    -# If the ALLEXTERNALS tag is set to YES all external classes will be listed
    -# in the class index. If set to NO only the inherited external classes
    -# will be listed.
    -
    -ALLEXTERNALS           = NO
    -
    -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
    -# in the modules index. If set to NO, only the current project's groups will
    -# be listed.
    -
    -EXTERNAL_GROUPS        = YES
    -
    -# The PERL_PATH should be the absolute path and name of the perl script
    -# interpreter (i.e. the result of `which perl').
    -
    -PERL_PATH              = /usr/bin/perl
    -
    -#---------------------------------------------------------------------------
    -# Configuration options related to the dot tool
    -#---------------------------------------------------------------------------
    -
    -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
    -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
    -# or super classes. Setting the tag to NO turns the diagrams off. Note that
    -# this option also works with HAVE_DOT disabled, but it is recommended to
    -# install and use dot, since it yields more powerful graphs.
    -
    -CLASS_DIAGRAMS         = YES
    -
    -# You can define message sequence charts within doxygen comments using the \msc
    -# command. Doxygen will then run the mscgen tool (see
    -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the
    -# documentation. The MSCGEN_PATH tag allows you to specify the directory where
    -# the mscgen tool resides. If left empty the tool is assumed to be found in the
    -# default search path.
    -
    -MSCGEN_PATH            =
    -
    -# If set to YES, the inheritance and collaboration graphs will hide
    -# inheritance and usage relations if the target is undocumented
    -# or is not a class.
    -
    -HIDE_UNDOC_RELATIONS   = YES
    -
    -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
    -# available from the path. This tool is part of Graphviz, a graph visualization
    -# toolkit from AT&T and Lucent Bell Labs. The other options in this section
    -# have no effect if this option is set to NO (the default)
    -
    -HAVE_DOT               = NO
    -
    -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is
    -# allowed to run in parallel. When set to 0 (the default) doxygen will
    -# base this on the number of processors available in the system. You can set it
    -# explicitly to a value larger than 0 to get control over the balance
    -# between CPU load and processing speed.
    -
    -DOT_NUM_THREADS        = 0
    -
    -# By default doxygen will use the Helvetica font for all dot files that
    -# doxygen generates. When you want a differently looking font you can specify
    -# the font name using DOT_FONTNAME. You need to make sure dot is able to find
    -# the font, which can be done by putting it in a standard location or by setting
    -# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the
    -# directory containing the font.
    -
    -DOT_FONTNAME           = Helvetica
    -
    -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs.
    -# The default size is 10pt.
    -
    -DOT_FONTSIZE           = 10
    -
    -# By default doxygen will tell dot to use the Helvetica font.
    -# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to
    -# set the path where dot can find it.
    -
    -DOT_FONTPATH           =
    -
    -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
    -# will generate a graph for each documented class showing the direct and
    -# indirect inheritance relations. Setting this tag to YES will force the
    -# CLASS_DIAGRAMS tag to NO.
    -
    -CLASS_GRAPH            = YES
    -
    -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
    -# will generate a graph for each documented class showing the direct and
    -# indirect implementation dependencies (inheritance, containment, and
    -# class references variables) of the class with other documented classes.
    -
    -COLLABORATION_GRAPH    = YES
    -
    -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
    -# will generate a graph for groups, showing the direct groups dependencies
    -
    -GROUP_GRAPHS           = YES
    -
    -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
    -# collaboration diagrams in a style similar to the OMG's Unified Modeling
    -# Language.
    -
    -UML_LOOK               = NO
    -
    -# If the UML_LOOK tag is enabled, the fields and methods are shown inside
    -# the class node. If there are many fields or methods and many nodes the
    -# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS
    -# threshold limits the number of items for each type to make the size more
    -# managable. Set this to 0 for no limit. Note that the threshold may be
    -# exceeded by 50% before the limit is enforced.
    -
    -UML_LIMIT_NUM_FIELDS   = 10
    -
    -# If set to YES, the inheritance and collaboration graphs will show the
    -# relations between templates and their instances.
    -
    -TEMPLATE_RELATIONS     = NO
    -
    -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
    -# tags are set to YES then doxygen will generate a graph for each documented
    -# file showing the direct and indirect include dependencies of the file with
    -# other documented files.
    -
    -INCLUDE_GRAPH          = YES
    -
    -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
    -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
    -# documented header file showing the documented files that directly or
    -# indirectly include this file.
    -
    -INCLUDED_BY_GRAPH      = YES
    -
    -# If the CALL_GRAPH and HAVE_DOT options are set to YES then
    -# doxygen will generate a call dependency graph for every global function
    -# or class method. Note that enabling this option will significantly increase
    -# the time of a run. So in most cases it will be better to enable call graphs
    -# for selected functions only using the \callgraph command.
    -
    -CALL_GRAPH             = NO
    -
    -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then
    -# doxygen will generate a caller dependency graph for every global function
    -# or class method. Note that enabling this option will significantly increase
    -# the time of a run. So in most cases it will be better to enable caller
    -# graphs for selected functions only using the \callergraph command.
    -
    -CALLER_GRAPH           = NO
    -
    -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
    -# will generate a graphical hierarchy of all classes instead of a textual one.
    -
    -GRAPHICAL_HIERARCHY    = YES
    -
    -# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES 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.
    -
    -DIRECTORY_GRAPH        = YES
    -
    -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
    -# generated by dot. Possible values are svg, png, jpg, or gif.
    -# If left blank png will be used. If you choose svg you need to set
    -# HTML_FILE_EXTENSION to xhtml in order to make the SVG files
    -# visible in IE 9+ (other browsers do not have this requirement).
    -
    -DOT_IMAGE_FORMAT       = png
    -
    -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
    -# enable generation of interactive SVG images that allow zooming and panning.
    -# Note that this requires a modern browser other than Internet Explorer.
    -# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you
    -# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files
    -# visible. Older versions of IE do not have SVG support.
    -
    -INTERACTIVE_SVG        = NO
    -
    -# The tag DOT_PATH can be used to specify the path where the dot tool can be
    -# found. If left blank, it is assumed the dot tool can be found in the path.
    -
    -DOT_PATH               =
    -
    -# The DOTFILE_DIRS tag can be used to specify one or more directories that
    -# contain dot files that are included in the documentation (see the
    -# \dotfile command).
    -
    -DOTFILE_DIRS           =
    -
    -# The MSCFILE_DIRS tag can be used to specify one or more directories that
    -# contain msc files that are included in the documentation (see the
    -# \mscfile command).
    -
    -MSCFILE_DIRS           =
    -
    -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of
    -# nodes that will be shown in the graph. If the number of nodes in a graph
    -# becomes larger than this value, doxygen will truncate the graph, which is
    -# visualized by representing a node as a red box. Note that doxygen if the
    -# number of direct children of the root node in a graph is already larger than
    -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note
    -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
    -
    -DOT_GRAPH_MAX_NODES    = 50
    -
    -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
    -# graphs generated by dot. A depth value of 3 means that only nodes reachable
    -# from the root by following a path via at most 3 edges will be shown. Nodes
    -# that lay further from the root node will be omitted. Note that setting this
    -# option to 1 or 2 may greatly reduce the computation time needed for large
    -# code bases. Also note that the size of a graph can be further restricted by
    -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
    -
    -MAX_DOT_GRAPH_DEPTH    = 0
    -
    -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
    -# background. This is disabled by default, because dot on Windows does not
    -# seem to support this out of the box. Warning: Depending on the platform used,
    -# enabling this option may lead to badly anti-aliased labels on the edges of
    -# a graph (i.e. they become hard to read).
    -
    -DOT_TRANSPARENT        = NO
    -
    -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
    -# files in one run (i.e. multiple -o and -T options on the command line). This
    -# makes dot run faster, but since only newer versions of dot (>1.8.10)
    -# support this, this feature is disabled by default.
    -
    -DOT_MULTI_TARGETS      = NO
    -
    -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
    -# generate a legend page explaining the meaning of the various boxes and
    -# arrows in the dot generated graphs.
    -
    -GENERATE_LEGEND        = YES
    -
    -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
    -# remove the intermediate dot files that are used to generate
    -# the various graphs.
    -
    -DOT_CLEANUP            = YES
    diff --git a/libs/libzrtp/doc/manuals/changelog.dox b/libs/libzrtp/doc/manuals/changelog.dox
    deleted file mode 100644
    index 42fdae34d0..0000000000
    --- a/libs/libzrtp/doc/manuals/changelog.dox
    +++ /dev/null
    @@ -1,223 +0,0 @@
    -# 
    -# Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved.
    -# Contact: http://philzimmermann.com
    -# For licensing and other legal details, see the file zrtp_legal.c.
    -# 
    -# Viktor Krykun  
    -
    -/**
    - * \file  changelog.dox
    - * \brief libzrtp ChangeLog
    - */
    -
    -/*!
    -\page changelog ChangeLog
    -
    -****************************************************************************************************
    -\section v120 libzrtp v1.20 build XXX (ZRTP RFC 6189, protocol 1.1)
    -****************************************************************************************************
    -
    -This release is focused on better ZRTP cache management. 
    -
    -***\subsection v120_changes API changes and Upgrade Instructions:
    -  *- Starting from v120 libzrtp uses global ZID for all outgoing connections. Local ZID should be
    -    specified in zrtp_global_t#zid and provided to zrtp_init(). App doesn't need to pass local ZID 
    -    each time it creates new session via zrtp_session_init().    
    -  *- Added zrtp_randstr2() which allow to generate random string before libzrtp being initialized.
    -    Can be handy to generate initial ZID. In normal circumstances, use zrtp_randstr() whenever possible.
    -  *- ZRTP cache API was completely redesigned. Look at zrtp_cache.h for more details.
    -  
    -
    -***\subsection v120_feature New features and improvements.
    -  *- new better cache management API.
    -
    -***\subsection v120_bugs Bug fixes
    -  *- fixed bug when ZRTP forces enrolled endpoints to re-render SAS when sashash is empty.
    -  *- other minor bug fixes and improvements
    -  *- fixed bug when zrtp_signaling_hash_set() silently not accepted imported zrtp-hash-value with 
    -     "buffer too small" debug output.
    -
    -
    -****************************************************************************************************
    -\section v091 DEVELOPERS BUILD Release Notes - libzrtp - Version 0.91 build XXX (ZRTP ID v16x, protocol 1.X)
    -****************************************************************************************************
    -\note To build Libzrtp Enterprise with Elliptic Cure Diffie-Hellman support on Unix platform, use
    -      "./configure --enable-enterprise". By default libzrtp will be build with no ECDH support.
    -
    -
    -***\subsection v091_feature New features and improvements. - -***\subsection v091_bugs Bug fixes - *- [LZRTP-179] Fixed bug in build scripts when commercial version of libzrtp v0.90 was built - with ZRTP_ENABLE_EC set to 1 by default. - *- [LZRTP-181] Fixed zrtp_init() crash on Mac OSX 10.6 - *- [LZRTP-182] Fixed libzrtp build issue on Free-BSD - - -**************************************************************************************************** -\section v090 Release Notes - libzrtp - Version 0.90 build 577 (ZRTP ID v15x, protocol 1.1) -**************************************************************************************************** -
    -***\subsection v090_feature New features and improvements. - *- [LZRTP-178] After the cache mismatch don't update the cache automatically, wait for the SAS verification. More details at this feature could be found in ZRTP ID section 4.6.1.1 - *- [LZRTP-151] Add secrets flags to \ref zrtp_info_t to allow user monitor secrets state - *- [LZRTP-169] Check and optimize build process on Windows mingw and msys. - -***\subsection v090_bugs Bug fixes - *- [LZRTP-176] Added -fPIC flag to Linux and Mac builds to be able to link the library into 64bit applications. - *- [LZRTP-175] Change SHA1 definition name to SRTP_SHA1 and move to private part of the API to eliminate ambiguity. - *- [LZRTP-155] Session info should display current, updated value of the TTL, not the old one from previous negotiation. - *- [LZRTP-177] Diffie-Hellman secret exponent for DH2K should be 256bits instead of 128. - - -**************************************************************************************************** -\section v082 Release Notes - libzrtp - Version 0.82 build 540 (ZRTP ID v15, protocol 1.1) -**************************************************************************************************** -
    -Minor improvements. Zfone and libZRTP projects moved to public bug-tracking and wiki system. - -***\subsection v082_feature New features and improvements. - *- Improved libzrtp resistance to long delays during DH calculations on slow hardware. - *- Structures Members alignment in Microsoft Visual Studio projects was changed from 1 byte to "Default". - *- Implemented entropy collection from dropped RTP messages. Don't forget to store RNG seed when you done with libzrtp and upload it agan on next session. - *- Implement default entropy collector for Win32 platform. RtlGenRandom() system call is used. Together with the entropy collection from dropped RTP message, it should guaranty good enough entropy. - *- zrtp_def_cache_reset_since() was implemented as call-back, similar to the rest of ZRTP cache interfaces. - *- Eliminated secure logs from the public build. - *- Public bug-tracker and wiki launched (in addition to our internal tools) - *- libzrtp API documentation is available at developers.zfoneproject.com - - -**************************************************************************************************** -\section v081 Release Notes - libzrtp - Version 0.81 build 514 (ZRTP ID v15, protocol 1.1) -**************************************************************************************************** -
    -***\subsection v081_bugs Bug - *- [LZRTP-161] Improvement in ZRTP state-machine\n - libzrtp state-machine didn't process incoming Hello message in StartInitiatingSecure state. - In some situations this issue could cause libzrtp not responding on incoming HELLO messages and freeze the protocol. - - *- [LZRTP-166] Fixed "Secure Since" logic.\n - Previous version of libzrtp computed secure since in a wrong way. libzrtp 0.81 remembers secure since date when new RS1 secret is generated and keep it unchanged while RS secrets are matched for all next calls. - \n - Use zrtp_def_cache_get_since() to get secure since for the particular pair of ZIDs. - \warning Secure since function is available for the build-in implementation of ZRTP cache. - -***\subsection v081_feature New Feature - *- [LZRTP-157] Implement algorithms negotiation according to ZRTP ID v15 section 4.1.2\n - This method is provided to allow the two parties to mutually and deterministically choose the same DH key size and algorithm before a Commit message is sent. No API changes required. - - *- [LZRTP-158] Zfone Ping response implemented.\n - New Zfone3 software uses specific VoIp calls detection algorithms and uses ZRTP Ping to discover the call topology. Each ZRTP endpoint may response with PingAck to be compatible with Zfone3. libzrtp based products don't need to do anything more to support Zfone3. The library handles this automatically. Ping-Response doesn't affect res of ZRTP logic. - \n - \sa Check ZRTP RFC sec 5.16 for more information. - -***\subsection v081_improv Improvement - *- [LZRTP-164] New ZRTP security event was added.\n - Libzrtp rises special event when after switching to secure state, the secrets are not expired, cached, but don't match. In other words: it is typical condition for the MitM attacks. Developer should use this event to notify user about the situation. Check zrtp_security_event_t#ZRTP_EVENT_MITM_WARNING for more detail information. - - *- [LZRTP-153] New Project files to build libzrtp on Windows CE.\n - Check ./projects/win_ce directory to find appropriate Microsoft Visual Studio projects. - - - -**************************************************************************************************** -\section v080 Release Notes - libzrtp - Version 0.80 -**************************************************************************************************** -
    -***\subsection v080_bugs Bug - - [LZRTP-97] zrtp_hex2str and zrtp_st2hex don't work correct.\n - Fixed bug in str2hex() providing wrong converting. Previous versions of libzrtp were affect, - but str2hex wasn't used in crypto logic and there was no security weakness. - - [LZRTP-154] zrtp_register_with_trusted_mitm() on storing MiTM secret didn't set the "matches" flag for ZRTP_BIT_PBX. In result, zrtp_is_user_enrolled() returned false right after ZRTP_STATE_SECURE event. This issue affected ZRTP MitM endpoints only and for the very first enrollment stream with the endpoint. In all next calls with the endpoint zrtp_is_user_enrolled() worked correct. - -***\subsection v080_improv Improvement - *- [LZRTP-26] Refactoring in the test-unite\n - Test-unite was redesigned: platform independent test-core and UI parts, specific for every - target platform. test-core has cleaner API and internal structure. UI part allow to simplify - application and separate business logic from UI routine. - - *- [LZRTP-46] Change zrtp_time_t to literal integer type.\n - zrtp_tim_now() just returns current time in milliseconds instead of zrtp_time_t structure. - - *- [LZRTP-83] Refactoring in libzrtp debug logging.\n - Made logs easy to read and analyze. Used indention. - - *- [LZRTP-84] Refactoring in libzrtp terms.\n - Following changes in functions names and data structures were made: - zrtp_stream_ctx_t - zrtp_stream_t\n - zrtp_conn_ctx_t - zrtp_session_t\n - zrtp_global_ctx_t - zrtp_global_t\n - (in zrtp.h more explicitly reflect meaning of data types)\n - \n - ZSTR_GET_VALUE/P - ZRTP_GV/P\n - SET_EMPTY_ZRTP_STRING - ZSTR_SET_EMPTY\n - (in zrtp_string.h just cleaner and shorter names)\n - \n - zrtp_init() (Allocates memory)\n - zrtp_init_session_ctx() - zrtp_session_init(). (Allocates memory)\n - zrtp_add_entropy() - zrtp_entropy_add() \n - zrtp_secure_stream() - zrtp_stream_secure()\n - zrtp_clear_stream() - zrtp_stream_clear()\n - zrtp_done_session_ctx - zrtp_session_down()\n - zrtp_attach_stream - zrtp_stream_attach()\n - zrtp_start_stream() - zrtp_stream_start()\n - zrtp_stop_stream() - zrtp_stream_stop()\n - zrtp_set_verified - zrtp_verified_set()\n - zrtp_check_profile - zrtp_profile_check()\n - (in zrtp.h used following approach: zrtp prefix; module name; action name) - - *- [LZRTP-85] Hide private fields in zrtp_session_ctx and zrtp_stream_ctx.\n - zrtp_stream_t and zrtp_session_t structures were hidden inside libzrtp internal data-types. General libzrtp-based application shouldn't use these structures directly. zrtp_stream_info_t and zrtp_session_info_t structures should be used instead. To implement data encapsulation, libzrtp provides following functions: - zrtp_stream_get(), zrtp_session_get()\n - zrtp_stream_set_userdata(), zrtp_stream_get_userdata()\n - zrtp_session_set_userdata(), zrtp_session_get_userdata()\n - \n - Advanced zrtp products may access zrtp_stream_t and zrtp_session_t directly but implementer can avoid this in most of the cases. - - *- [LZRTP-88] Create a macro for UNALIGNED constructions on mobile platforms.\n - - *- [LZRTP-89] Code style for crypto components sources.\n - Public API not affected. Internal changes: - - more compact code because fo using more general crypto functions - - code stayle and comments - - test-vectors were moved inside c-files fof appropriate crypto components. - - *- [LZRTP-99] zrtp_session_init should allocate memory for zrtp_session_t.\n - - *- [LZRTP-112] Modify zrtp logger to be able write \\n and NON \\n logs.\n - ZRTP_LOG by default doesn't add \\n at the end of the log string. ZRTP_LOGC print plain log message without header and any formatting. - - *- [LZRTP-116] Review synchronization objects in libzrtp.\n - - zrtp_global_t#comp_protector was removed. This mutex protected crypto components list. Since v0.80 libzrtp doesn't allow users to manage list of crypto components. libzrtp loads all available components at zrtp_init() and destroys them on zrtp_down(). Any modification with the list performed between these two call - don't need mutex. - - zrtp_secrets_t#protector was removed, just unused in the code - - zrtp_global_t#cache_protector was removed. Third-party ZRTP cache implementation should be thread-safe. It was made because it is simpler and more flexible solution. - - *- [LZRTP-120] Add file with version number to identify builds.\n - zrtp_version.h have been added to the project. - - *- [LZRTP-128] Eliminate Sound event from libzrtp.\n - zrtp_callback_misc_t::on_sound_event() was eliminated. This message was originally deigned for early versions of ZFone project. Event is supernumerary and duplicated other protocol and security events. Users, who need such event may perform the same actions using zrtp_callback_event_t events. - - *- [LZRTP-133] Move ssrc parameter from stream_create() to stream_start()\n - SSRC parameter was moved from zrtp_stream_attach() to zrtp_stream_start(). Such improvement should allow users to create zrtp streams before media starts and ssrc is unknown. It may be useful for proxy products: ZFone, UM-Lab software and other. - - *- [LZRTP-143] Speedup DH key exchange procedure.\n - DH crypto context data was moved directly to zrtp_stream_t and statically allocated. On creating protocol routine, libzrtp checks is DH context have been already initialized with the same type of key exchange scheme. If so - new DH value will not be recalculated. - -***\subsection v080_feature New Feature - - [LZRTP-14] Add DH2K public key exchange scheme\n - DH2K public key exchange scheme was implemented and available for developers the same way as rest of crypto components. - -***\subsection v080_tasks Task - *- [LZRTP-24] Implement Self-tests for DH and ECDH components.\n - Test cases for DH components were implemented and added to the libzrtp test-unite routine. DH checks algorithm correctness and performance as well. Besides test-vectors, it emulates DH exchange computing public and secret values for both endpoints. - - *- [LZRTP-122] Print out all zrtp configuration settings and adjustments on initialization. - - *- [LZRTP-123] Create standard error codes and error text descriptions.\n - New functions zrtp_log_error2str() and zrtp_log_status2str() were added to convert status codes to text description. Some clean-up in zrtp_status_t was made, removed unused or ambiguous status codes. - - *- [LZRTP-132] Replace HMAC with KDF function call.\n - Since ZRTP draft 12b defines ZRTP KDF to be in compliance with the recommendations in NIST SP 800-108. KDF function implemented as _zrtp_kdf() in zrtp_utils_proto.c. All KDF operations were replaced with from hmac to kdf function. - -*/ diff --git a/libs/libzrtp/doc/manuals/howto.dox b/libs/libzrtp/doc/manuals/howto.dox deleted file mode 100644 index 8792b6bed7..0000000000 --- a/libs/libzrtp/doc/manuals/howto.dox +++ /dev/null @@ -1,489 +0,0 @@ -# -# Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. -# Contact: http://philzimmermann.com -# For licensing and other legal details, see the file zrtp_legal.c. -# -# Viktor Krykun - - -/** - * \file howto.dox - * \brief How to Get Up and Running Quickly with libZRTP - */ - -/** -\page howto How to Get Up and Running Quickly with libZRTP - -**************************************************************************************************** -\section howto_about 1. About -**************************************************************************************************** -
    -The libzrtp library is a cross-platform implementation of ZRTP, a VoIP encryption protocol developed by Phil Zimmermann. libzrtp is suitable for inclusion in software VoIP clients, firmware for hardware VoIP phones, VoIP PBX servers, mobile VoIP clients, and SIP border control servers, enabling a VoIP application to interoperate and make secure calls with the rest of the ZRTP -community. - -The libzrtp library consists of three main components: the protocol module responsible for the safe connection of a call, the encryption module, and a set of interfaces. ZRTP works by assuming control of the VoIP traffic and initiating an encrypted connection between two ZRTP endpoints after a safe mode is achieved. To integrate the library, please review our documentation on the -ZRTP interfaces, connections management, and integration plan. - - -**************************************************************************************************** -\section howto_quick 2. Quick Info -**************************************************************************************************** -
    - ***

    Building with GNU tools (Linux, *BSD, MacOS X, mingw, etc.)

    - - Generally these should be all that are needed to build the libraries, applications, and samples: - -# go to ./projects/gnu and run -\code -$ ./configure -$ make clean && make -\endcode - - **

    Building Win32 Target with Microsoft Visual Studio

    - Generally we can just do these steps: - -# Visual Studio 8: open projects/win/libzrtp_vc8.sln solution, - -# build the libzrtp_test application. - - **

    Building for Windows Mobile

    - Generally these are all that are needed: - -# Visual Studio 8: open projects/win/libzrtp_wince_vc8.sln solution, - -# build the libzrtp_test application. - - **

    Locating Output Binaries/Libraries

    - For GNU targets, library files will be placed to ./projects/gnu/build and ./third_party/bnlib. - - **

    Running the Applications

    - After successful build, you can try running libzrtp_test application on projects/gnu/build/test directory. - -**************************************************************************************************** -\section howto_getting_source 3. Getting the Source Distribution -**************************************************************************************************** -
    -***\subsection howto_getting_source_tar 3.1 Getting the Release tarball - - Getting the released tarball is the best way to obtain stable version of libzrtp. The tarball may not contain the latest features or bug-fixes, but normally it is considered more stable, tested and well documented. - - The latest released tarball can be downloaded from the http://zfoneproject.com/prod_sdk.html - -***\subsection howto_getting_source_svn 3.2 Getting from Subversion trunk - At the moment, SVN repository is available for libzrtp developers only. It will be opened for public soon. - -***\subsection howto_getting_source_layout 3.3 Source Directories Layout - - The top-level directories (denoted as $TOP here) in the source distribution contains the following sub-directories: - - \c $TOP/doc - documentation folder; - - \c $TOP/include - header files: - - \c zrtp_config_user.h - user defined ZRTP configuration options; - - \c zrtp_config_win.h - Windows related configuration options; - - \c zrtp_config.h - libzrtp automatic configuration routine. - - \c zrtp_crypto.h - contains definitions of the data types and functions necessary to - strengthen the crypto-segment of the library. These functions are used only by libzrtp - developers only. Typical projects based on libzrtp do not use these functions; - - \c zrtp_engine.h - contains types and functions needed by the ZRTP state-machine For - internal use only; - - \c zrtp_error.h - contains error codes returned by the libzrtp functions; - - \c zrtp_iface_system.h - contains a set of OS-related interface functions which must be - implemented in order to use the library; - - \c zrtp_iface.h - contains a set of ZRTP utility interface functions which must be - implemented in order to use the library; - - \c zrtp_legal.h - libzrtp license agreement; - - \c zrtp_list.h - contains functions and macros for safe operations with linked lists. All - lists in libzrtp are based on these functions. They can be used to avoid mistakes in list operations; - - \c zrtp_log.h - contains functions to track bugs and store the error log.; - - \c zrtp_pbx.h - conatins declarations of the main PBX related functions. Use this header if you are the implementor of some VoIP-server solutions; - - \c zrtp_srtp.h - SRTP crypto types and interfaces. Used to integrate libzrtp with third - party SRTP implementations; - - \c zrtp_srtp_builtin.h - data structures for built-in realization of SRTP. - - \c zrtp_string.h - contains functions for the use of the special, safe strings, - zrtp_stringn_t, used by libzrtp. - - \c zrtp_types.h - contains the definitions of the internal data types which are used by - libzrtp developers and experienced users. - - \c zrtp.h - conatins declarations of the main dataypes and function - functions necessary to operate libzrtp. This file header is only must to - be included in each module using the libzrt functions; - - \c $TOP/projects - - \c gnu - make files for Unix-like systems using autotools; - - \c symbian - configuration and make files for Symbian platform; - - \c win - Set of Microsoft Visual Studio project files for Windows and Windows CE. - - \c win_kernel - makefiles for Windows Kernel mode. - - \c xcode - project files for Apple Xcode. - - \c $TOP/src - libzrtp source files;\n - - \c $TOP/test - test suite for libZRTP kernel logic. Includes versions for Unix, Windows, - Windows CE and Symbian. - - \c $TOP/third_party - - \c bnlib - libbn files which are not intended for external use; - - \c bgaes - AES encryption library and hash functions by Brian Gladman; - - -**************************************************************************************************** -\section howto_praparations 4. Build Preparation -**************************************************************************************************** -
    -***\subsection howto_praparations_config 4.1 zrtp_cinfig_user.h - - Before building libzrtp, some adjustments may be performed according to developers needs. In order to do this, \c include/zrtp_cinfig_user.h should be used. Most of configuration parameters are optional and libzrtp can be build without any modifications. - - Check \ref zrtp_config for more information. - -***\subsection howto_praparations_iface 4.2 libzrtp platform-dependent interfaces - - The library requires external implementation of some system-dependent functions to enable cross-platform operation. The libzrtp distribution contains almost all interface implementations for the following platforms: Windows, Linux, Mac OSX, Symbian, Windows CE. The Quick Start allows a fast integration of the library. Built-in implementations are used by default and developer don't need to anything more. - - In order to start using libzrtp, developer should implement just few feedback interfaces. Libzrtp uses callbacks to notify application about some events in ZRTP protocol, such as: - - zrtp_callback_event_t#on_zrtp_secure - notify user about switching to secure; - - zrtp_callback_event_t#on_zrtp_not_secure - notify about ZRTP security issues. - - Another callback which must be implemented - transport routine: - - zrtp_callback_misc_t#on_send_packet - libzrtp uses this function to deliver ZRTP protocol message to the remote party. - - These only two callbacks which must be implemented to start using libzrtp. Example can be found at the end of this article. - - For more detail information about libzrtp platform-dependent interfaces check \ref XXX. - -**************************************************************************************************** -\section howto_unix 5. Building Linux, *nix, *BSD, and MacOS X Targets with GNU Build Systems -**************************************************************************************************** -
    -***\subsection howto_unix_targets Supported Targets - - The new, autoconf based GNU build system can be used to build the libraries/applications for the following targets: - - Linux (i386, Opteron, Itanium, MIPS, PowerPC, etc.), - - MacOS X (Intel, PowerPC), - - mingw (i386), - - FreeBSD (i386, Opteron, etc.), - - etc. - -***\subsection howto_unix_requir 5.1 Requirements - - In order to use libzrtp's GNU build system, these typical GNU tools are needed: - - GNU make, - - GNU binutils for the target, and - - GNU gcc for the target. - - In addition, the appropriate libraries must be installed for platform-dependent interfaces implementation. This could just be a libc and the appropriate system abstraction library such as Posix. - - The build system is known to work on the following hosts: - - Linux, many types of distributions. - - MacOS X 10.4 and higher - -***\subsection howto_unix_build 5.2 Running configure and make - - Run "./configure" without any options to let the script detect the appropriate settings for the host: -\code - $ cd libzrtp - $ ./configure - ... -\endcode - - Once the configure script completes successfully, libzrtp is ready to be built. Use following commands: -\code - $ cd libzrtp - $ make clean - $ make -\endcode - - Description of all make targets supported by the Makefile's: - - \c all. The default (or first) target to build the library binary; - - \c clean. Clean the object files and libzrtp binary; - - \c check. Build test cases and start libzrtp_test application; - - \c distclean. Remove all generated files (object, libraries, binaries, and - dependency files). - - \c install. Make install of libzrtp headers and binaries; - - \c uninstall. Remove installed headers and binaries. - -**************************************************************************************************** -\section howto_osx 6. Building MacOS X Targets with Xcode -**************************************************************************************************** -
    -***\subsection howto_osx_requir 6.1 Requirements - - To build libzrtp on OS X using Xcode you need following: - - Mac OSX 10.4 or later. - - Apple developers Tools installed. - - Xcode 3.1 or higher. - -***\subsection howto_osx_build 6.2 Building the Projects - - Follow the steps below to build libzrtp using Apple Xcode: - -# For Apple Xcode: open \c projects/xcode/libzrtp.xcodeproj project file. - -# Set "libzrtp" or "libzrtp_ec" as Active Target. - -# Select Debug or Release build as appropriate. - -# Build "configure" target. - -# Build the project. This will build libzrtp with all dependencies. - -# After successful build, libzrtp will be placed in \c projects/xcode/build/Debug or Release. - - Use \c projects/xcode/libzrtp_test.xcodeproj by analogy to build the test application. - -**************************************************************************************************** -\section howto_win 7. Building for Windows Targets with Microsoft Visual Studio -**************************************************************************************************** -
    -***\subsection howto_win_requir 7.1 Requirements - - The Microsoft Visual Studio based project files can be used with one of the following: - - Microsoft Visual C++ 2005 (including Express edition), - - For the host platform, the following are required: - - Windows NT, 2000, XP, 2003, or later , - - Sufficient amount of RAM for the build process (at least 256MB). - -***\subsection howto_win_build 7.2 Building the Projects - - Follow the steps below to build libzrtp using Visual Studio: - -# For Visual Studio 8 (VS 2005): open libzrtp_vs8.sln solution file. - -# Set "libzrtp" or "libzrtp_ec" as StartUp Project. - -# Select Debug or Release build as appropriate. - -# Build the project. This will build libzrtp and all dependencies. - -# After successful build, libzrtp will be placed in \c projects/win/Debug or Release. - - To build libzrtp test-cases use "libzrtp_test" as StartUp Project and perform steps listed above. - -**************************************************************************************************** -\section howto_wince 8. Building for Windows Mobile Targets (Windows CE/WinCE/PDA/SmartPhone) -**************************************************************************************************** -
    -***\subsection howto_wince_requir 8.1 Requirements - - The Microsoft Visual Studio based project files can be used with one of the following: - - Microsoft Visual C++ 2005 - - For the host platform, the following are required: - - Windows NT, 2000, XP, 2003, or later , - - Sufficient amount of RAM for the build process (at least 256MB). - -***\subsection howto_wince_build 8.2 Building the Projects - - Follow the steps below to build libzrtp using Visual Studio: - -# For Visual Studio 8 (VS 2005): open libzrtp_wince_vs8.sln solution file. - -# Set "libzrtp" or "libzrtp_ec" as StartUp Project. - -# Select Debug or Release build as appropriate. - -# Build the project. This will build libzrtp and all dependencies. - -# After successful build, libzrtp will be placed in \c projects/win/Debug or Release. - -\note - The Test Application is not available for Windows Mobile platform at the moment. We will fix this in next version of libzrtp. - -**************************************************************************************************** -\section howto_symbian 9. Building for Symbian -**************************************************************************************************** -
    - -**************************************************************************************************** -\section howto_using 10. Using libzrtp with Applications -**************************************************************************************************** -
    - Regardless of the build system being used, the following tasks are normally needed to be done in order to build application to use libzrtp: - -# Add following include directories in the include search path: - - \c libzrtp/include - - \c libzrtp/include/enterprise (if you are using Enterprise version of libzrtp) - - \c libzrtp/third_party/bgaes - - \c libzrtp/third_party/bnlib - - \c libzrtp/projects/gnu/config (for GNU Autoconf targets) - -# Put these library directories in the library search path: - - \c libzrtp/third_party/bnlib - - \c libzrtp/projects/gnu/build (for GNU Autoconf targets) - - \c libzrtp/projects/xcode/build/Release (when building with Xcode) - - \c libzrtp/projects/win/Release (when building with Visual Studio) - -# Include \c libzrtp.h header file to the application. - -# Link with \c libzrtp and \c bnlib. - -# Link with system spesific libraries: - - Windows: Add (among other things): ws2_32.lib. - - Linux, *nix, *BSD: Add (among other things): '-lpthread'. - - MacOS X: Add (among other things): '-lpthread'. - -**************************************************************************************************** -\section howto_example 11. Quick Start Example -**************************************************************************************************** -
    - -An overview for creating an encrypted channel using libzrtp: - -*** \subsection howto_example_init 11.1 Initialization - - The library supports profiling and dictating different channel parameters, though the initialization can be performed by one function call with default parameters. - -\code -typedef struct testcon_t -{ - zrtp_session_t *zrtp_session; // ZRTP Session structure - zrtp_stream_t *zrtp_audio; // ZRTP stream for voice encryption - zrtp_stream__t *zrtp_video; // ZRTP stream for video encryption -} testcon_t; - -testcon_t safe_connection; // Secure channel instance -zrtp_global_t zrtp_global; // Persistent storage for libzrtp data -\endcode - -\code -zrtp_status_t s = zrtp_status_ok; -zrtp_config_t zrtp_config; - -// Initialize zrtp config with default values -zrtp_config_defaults(&zrtp_config); - -// Make some adjustments: -// - Set Client ID to identify ourself -// - Set appropriate license mode -// - We going to use default zrtp cache implementation, so let's specify cache file path -strcpy(zrtp_config.client_id, TEST_CLIENT_ID); -zrtp_config.lic_mode = ZRTP_LICENSE_MODE_ACTIVE; -zrtp_zstrcpyc( ZSTR_GV(zrtp_config.def_cache_path), TEST_CACHE_PATH); - -// Define interface callback functions -zrtp_config.cb.misc_cb.on_send_packet = on_send_packet; -zrtp_config.cb.event_cb.on_zrtp_secure = on_zrtp_secure; -zrtp_config.cb.event_cb.on_zrtp_security_event = on_zrtp_event; - -// Everything is ready - initialize libzrtp. -s = zrtp_init(&zrtp_config, &zrtp_global); -if (zrtp_status_ok != s) { - // Check error code and debug logs -} - -// The library has been initialized and is ready to use -. . . -\endcode - -*** \subsection howto_example_sessions 11.2 Sessions/Streams - - The library operates with the ZRTP streams concept, where each packet is encrypted within this stream. The streams are created before the start of the encryption process. - -\code -// -// Allocate zrtp session with default parameters -// -z = zrtp_session_init( zrtp_global, - NULL, - zid, - is_initator, - &safe_connection->zrtp_session); -if (zrtp_status_ok != s) { - // Check error code and debug logs -} - -// Set call-back pointer to our parent structure -zrtp_session_set_userdata(safe_connection->zrtp_session, &safe_connection); - -// -// Attach Audio and Video Streams -// -s = zrtp_stream_attach(safe_connection->zrtp_session, &safe_connection->zrtp_audio); -if (zrtp_status_ok != s) { - // Check error code and debug logs -} -zrtp_stream_set_userdata(safe_connection->zrtp_audio, &safe_connection); - -s = zrtp_stream_attach(safe_connection->zrtp_session, &safe_connection->zrtp_video); -if (zrtp_status_ok != s) { - // Check error code and debug logs -} -zrtp_stream_set_userdata(safe_connection->zrtp_video, &safe_connection); -\endcode - - -*** \subsection howto_example_protocol 11.3 Protocol Handling - - To create an encrypted channel, run the ZRTP engine for each stream added to the session. In our case we have two streams. The library will notify when achieving safe mode through the feedback path interface. - -\code -// -// Streams are ready - initiate ZRTP protocol -// -zrtp_stream_start(safe_connection->zrtp_audio, assrc); -zrtp_stream_start(safe_connection->zrtp_video, vssrc); -\endcode - -The three steps above create the encrypted channel. After entering the "Secure" state, you provide a plain packet to the library and receive an encrypted packet ready to be sent. Decryption works in the analogous way. - -\code -zrtp_status_t s = zrtp_status_fail; -char packet[MAX_RTP_SIZE]; -int size = 0; - -// Some abstract function for packets receiving -size = get_packet(packet); - - // - // Processing incoming packets. - // You must determine media type and choose corresponding ZRTP stream - // -s = zrtp_process_srtp(safe_connection->zrtp_audio, packet, &size); -switch (s) { - case zrtp_status_ok: - // - // Packet was successfully decrypted. Dont forget that packet - // size was changed during decryption. New size now in size - // - - case zrtp_status_drop: - // - // This is a protocol ZRTP packet or masked RTP media. - // In either case the packet must be dropped to protect your - // private data and media codec - - case zrtp_status_fail: - // - // This is some kind of error - see logs for more information. - // Don't put such packet to the network. It is not secure. - // -} -\endcode - -*** \subsection howto_example_callbacks 11.4 Callbacks - - libzrtp informs the user application about all changes in protocol state through a system of callback functions. The developer's guide considers this question in detail in \ref XXX. In most cases we need to display the SAS string and some other stream options after switching to the Secure state. An example of doing this is follow: - -\code -static void on_zrtp_secure(zrtp_stream_t *stream, unsigned event) -{ - test_options_t* info; // some user-defined stream options - - switch (event) { - case ZRTP_EVENT_IS_SECURE: - { - safe_connection_t* safe_connection = zrtp_stream_get_userdata(stream); - zrtp_session_info_t zrtp_session_info; - - zrtp_session_get(safe_connection->zrtp_session, &zrtp_session_info); - // - // Print out SAS there. - // - } break; - - // ... - // handle other events there - - default: - break; - } -} -\endcode - -An overview for closing an secure channel using libzrtp: - -*** \subsection howto_example_utilization 11.5 Utilization - - The uninstall session permits libzrtp to dispose of all engaged resources and release memory for session context storage. ZRTP streams will be also released, so you don't need to call separate functions. - -\code -zrtp_session_down(safe_connection->zrtp_session); -\endcode - - When you no longer need the library, dispose of all resources allocated before the beginning of the operation. - -\code -zrtp_down(&zrtp_global); -\endcode - -**************************************************************************************************** -\section howto_summary 12. Summary -**************************************************************************************************** -
    -Integration of libzrtp requires familiarity with the protocol and the library operation features. While the encryption of VoIP is not a trivial task, we have attempted to simplify as much as possible the work required to integrate libzrtp. - -*/ diff --git a/libs/libzrtp/doc/manuals/main.dox b/libs/libzrtp/doc/manuals/main.dox deleted file mode 100644 index e36cffd489..0000000000 --- a/libs/libzrtp/doc/manuals/main.dox +++ /dev/null @@ -1,38 +0,0 @@ -# -# Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. -# Contact: http://philzimmermann.com -# For licensing and other legal details, see the file zrtp_legal.c. -# -# Viktor Krykun - -/** -\mainpage ZRTP VoIP security - -**************************************************************************************************** -\section intro Intro -**************************************************************************************************** - - ZRTP Protocol finally goes RFC and we going to stabilize SDK as well. Libzrtp series 0.9X builds - will contain bug-fixes, performance and stability improvements only. - - So, please, be a patient with new API changes. We hope you will find them useful. - -**************************************************************************************************** -\section aboutdoc About this Documentation -**************************************************************************************************** - - Libzrtp, since v0.80 includes new, documentation. We have updated "How to Get Up and Running Quickly with libZRTP" and Public API documentation. - - We working on new "Libzrtp Developers Guide" which will give more detail information about ZRTP protocol and libzrtp architecture. This document will be available in next versions of libzrtp. But even now, libzrtp contains enough documentation to start using it comfortable. - - \note - libzrtp private API may have outdated information from previous version (links like this: \ref XXX). We working hard on that part of the documentation and it will be published in next versions of libzrtp. - -**************************************************************************************************** -\section zrtp Libzrtp Documents -**************************************************************************************************** --# \ref changelog --# \ref howto --# \ref rng - -*/ diff --git a/libs/libzrtp/doc/manuals/rng.dox b/libs/libzrtp/doc/manuals/rng.dox deleted file mode 100644 index 60d10646cc..0000000000 --- a/libs/libzrtp/doc/manuals/rng.dox +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. -# Contact: http://philzimmermann.com -# For licensing and other legal details, see the file zrtp_legal.c. -# -# Viktor Krykun - - -/** - * \file rng.dox - * \brief Random Number Generation in libzrtp - */ - -/** -\page rng Random Number Generation in libzrtp - -\section rng Random number generation - - The generation of cryptographic key material is a highly sensitive process. To do this, you need high entropy random numbers that an attacker cannot predict. This section discusses the random number generator used by libzrtp, and how suitable entropy can be collected on different hardware platforms. - - Failure to use true entropy from the physical environment as a basis for generating random cryptographic key material would lead to a disastrous loss of security. - -**************************************************************************************************** -\subsection rng_algorithm Deterministic Random Bit Generator -**************************************************************************************************** -
    - Libzrtp uses a cryptographically strong Deterministic Random Bit Generator (DRBG), based on running the AES-256 block cipher in counter mode. The output of this DRBG is used for key material by libzrtp for the Diffie-Hellman private keys, and other random protocol components such as nonces. The 256-bit AES key and 128-bit initialization vector for the DRBG are drawn from an entropy pool - created by a SHA-512 hash of raw entropy sources. These raw entropy sources are highly platform dependent and thus are not included in libzrtp. The library provides only a set of interfaces for adding the entropy to the entropy pool. We will discuss the entropy collection in the next section. - - When a random number is required by the ZRTP protocol, the library kernel calls the Deterministic Random Bit Generator interface function zrtp_randstr(). That function requires the existance of an entropy pool that has already been seeded with sufficient entropy. This entropy pool must be seeded by calling zrtp_entropy_add(). - - The zrtp_entropy_add() function takes a buffer of raw unprocessed entropy provided by the caller and adds it to the entropy pool via the SHA-512 hash function. - -**************************************************************************************************** -\subsection rng_accumulation Entropy accumulation -**************************************************************************************************** -
    - Random numbers for cryptographic key material must be derived from a physical entropy source, such as RF noise, acoustic noise, thermal noise, high resolution timings of environmental events, or other unpredictable physical sources of entropy. For a detailed explanation of cryptographic grade random numbers and guidance for collecting suitable entropy, see RFC 4086 and Chapter 10 of "Practical Cryptography" by Ferguson and Schneier. The raw entropy must be distilled and processed through a Deterministic Random Bit Generator (DRBG). We supply a suitable DRBG in libzrtp, which is accessed through the zrtp_randstr() function. - - To add entropy to the entropy pool maintained by the libzrtp random number generator, the application calls the zrtp_entropy_add() function. This entropy accumulation function may be called whenever new entropy becomes available. - - \warning - The entropy pool builds up more precious entropy each time you call zrtp_entropy_add(). Once in a while, it is a good idea to save the entropy in nonvolatile storage, by calling zrtp_randstr() and writing the output to a file, or to flash memory, or to some nonvolatile system storage area. This can be done whenever the VoIP application shuts down, or perhaps at the end of each secure VoIP call. A minimum of 512 bits (64 bytes) of output from zrtp_randstr() should be stored this way, but there is no need to store more than 256 bytes. When the VoIP application starts back up again, the contents of this nonvolatile entropy file should be added back into the active entropy pool by passing it to the zrtp_entropy_add() function. - -**************************************************************************************************** -\subsection rng_default Libzrtp built-in entropy sources -**************************************************************************************************** -
    - The SDK library provides a default implementation of entropy accumulation for Windows Kernel and Unix based platforms. - - For the Windows kernel mode it gathers current system state information as an entropy source. Among them are the performance counter, the current value of the system interrupt-time count, the count of the interval timer interrupts, and the values of some CPU registers. - - For Unix platforms, libzrtp calls \c /dev/urandom. - - If you are running libzrtp on a Windows Kernel or a full-blown desktop *nix-like system - you need not do anything more to implement the RNG. If you are using some other platform - carefully read the next section. - -**************************************************************************************************** -\subsection rng_guidelines Entropy sources for your platform. -**************************************************************************************************** -
    - On a desktop or laptop PC running Linux, FreeBSD, NetBSD, or OpenBSD, a good source of entropy may be found by reading from \c /dev/random or \c /dev/urandom. This is because \c /dev/random is seeded by entropy from keyboard timings, mouse movements, disk latency measurements, or other physical noise sources, some of them involving unpredictable human interaction. - - However, some low cost embedded Linux systems have no keyboard, no mouse or trackpad, no disk drive, and are starving for high quality entropy. There are some low cost Asterisk PBX boxes that are built this way. Or hardware Analog Telephone Adapters. Or low cost consumer routers. Many of them have no \c /dev/random implemented, or worse, have only a stub for /dev/random that does not actually collect any environmental entropy. This creates a dangerous illusion that entropy is available, because \c /dev/urandom appears to work, but is not backed by true entropy. This is bad, and not only for ZRTP. Platforms like these might not be able to generate strong cryptographic key material for SSH or SSL. - - If you are an OEM that builds hardware like this, and you wish to implement the ZRTP protocol with our libzrtp SDK, you really should provide a properly implemented \c /dev/random and \c /dev/urandom, properly supplied with true environmental entropy. If you are building a telephone, you can easily collect entropy from raw audio samples from the microphone. If the phone includes a video camera, you can collect entropy by sampling a few raw uncompressed video frames. If it's a mobile phone or a cordless phone, you can collect entropy from the RF noise in your wireless circuitry. If it's an embedded box like a router or low cost PBX, you can do high resolution timings of packet arrivals and use the timer readings as entropy sources. A PBX might include an analog interface to PSTN phone lines, and those interfaces usually include registers that measure analog voltage levels, which can serve as a source of entropy. The entropy sources do not need to produce much entropy, just a few bits at a time, but it can build up slowly until you have accumulated a few hundred bits of entropy. That's enough to generate cryptographically useful keys. Even if it takes some seconds or even minutes to accumulate this much entropy the first time your product is activated, it can be stored in nonvolatile storage so that it will be ready to reseed the entropy pool instantly the next time your product is powered up. - - In the ideal case, if you are designing the embedded hardware yourself, you could provide a good source of entropy by including a simple ring oscillator in the hardware. A ring oscillator is a circular chain (a ring) of NOT gates, and has nothing whatsoever to do with a telephone ring generator. The oscillation frequency drifts from thermal noise, and sampling the output at some low sampling rate is a good way to get some entropy. However, most designers have to work with existing hardware designs, and don't have the luxury of adding special hardware to generate entropy, which means you have to improvise with whatever you can collect from the environment, using any of the methods described above. - - If the library is used on another platform, the potential entropy sources should be thoroughly analyzed and a custom implementation must be developed for that platform. You can get your entropy collection ideas by looking at the default implementation of \c zrtp_add_system_state() provided in \c zrtp_rng.c. Again, microphone noise can be a good entropy source for VoIP clients. Raw, uncompressed, unfiltered audio samples should be used. - - If you have entropy gathering schemes for platforms not already supported in libzrtp, or if you doubt the correctness of your entropy collection approach, contact us to discuss how it may be done. We will do our best to provide you with technical assistance. - -*/ diff --git a/libs/libzrtp/include/zrtp.h b/libs/libzrtp/include/zrtp.h deleted file mode 100644 index c2ff1c2c78..0000000000 --- a/libs/libzrtp/include/zrtp.h +++ /dev/null @@ -1,968 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -/** - * \file zrtp.h - * \brief Defines basic libzrtp functions and data types - */ - -#ifndef __ZRTP_H__ -#define __ZRTP_H__ - -#include "zrtp_config.h" -#include "zrtp_base.h" -#include "zrtp_error.h" -#include "zrtp_types.h" -#include "zrtp_protocol.h" -#include "zrtp_engine.h" -#include "zrtp_crypto.h" -#include "zrtp_iface.h" -#include "zrtp_iface_system.h" -#include "zrtp_iface_scheduler.h" -#include "zrtp_list.h" -#include "zrtp_legal.h" -#include "zrtp_log.h" -#include "zrtp_srtp.h" -#include "zrtp_srtp_builtin.h" -#include "zrtp_string.h" -#include "zrtp_pbx.h" -#include "zrtp_legal.h" -#include "zrtp_version.h" -#include "zrtp_iface_cache.h" -#include "zrtp_ec.h" - - - -/** - * \defgroup zrtp_api API - * - * In this section the basic functions for using the library are defined. They include - * initialization and deinitialization functions, functions for session and stream management and - * functions for RTP traffic management. - * - * In most cases this section is all you need to start working with libzrtp. The typical simplified - * order of operations in using libzrtp is the following: - * -# library configuration - * -# library initialization; - * -# ZRTP session creation and configuration; - * -# ZRTP stream attaching and Protocol initiation; - * -# RTP stream processing; - * -# ZRTP protocol stopping and releasing resources. - * For each of these actions there is a set of corresponding functions. - * \sa - * - \ref howto - * - \ref XXX_GUIDE - */ - - - -/*======================================================================*/ -/* Public ZRTP libzrtp datatypes */ -/*======================================================================*/ - - -/** - * \defgroup zrtp_types Types and Definitions - * \ingroup zrtp_api - * The data types used in libzrtp are defined in this section - * \{ - * - */ -/** - * \typedef typedef uint32_t zrtp_id_t; - * \brief libzrtp general identifier used to debug connections management. - * \ingroup zrtp_main_init - */ - -/** Length of "zrtp-hash-value", RFC 6189 sec 8. @sa zrtp_signaling_hash_get(); */ -#define ZRTP_SIGN_ZRTP_HASH_LENGTH (ZRTP_MESSAGE_HASH_SIZE*2) - -/** - * \brief Enumeration for ZRTP Licensing modes - * \ingroup zrtp_main_init - * - * A ZRTP endpoint that is Passive will never send a Commit message, which means that it cannot be - * the initiator in the ZRTP exchange. Since at least one of the two parties must be the initiator, - * two Passive endpoints cannot make a secure connection. However, a non-Passive ZRTP endpoint can - * send a Commit message, enabling it to act as the initiator in a ZRTP exchange. This allows it to - * make a secure connection to a Passive endpoint, or to another non-Passive endpoint. - * - * In addition, a Passive ZRTP endpoint declares that it is Passive by setting the passive flag in - * the Hello message, which means the other party will recognize it as Passive. This allows for a - * Passive mode and two forms of Active mode-- Active, or Unlimited. These three possible behaviors - * for a ZRTP endpoint are defined as: - * - \b Passive: Never send a Commit message, and thus can never be the initiator. - * - \b Active: Will send a Commit message, but only to non-Passive ZRTP partners. - * - \b Unlimited: Will send a Commit message to any ZRTP partner, Passive or non-Passive. - * - * This can be used to provide three classes of service, which can be licensed t different price - * points. Passive can be used in freeware for widest possible deployment, Active can be used in - * discount products that can only talk to non-freeware, and Unlimited can be used in full-price - * products that will benefit from the network effect of widely deployed Passive freeware. - */ -typedef enum zrtp_license_mode_t -{ - /** @brief Never send a Commit message, and thus can never be the initiator. */ - ZRTP_LICENSE_MODE_PASSIVE = 0, - /** @brief Will initiate ZRTP exchange, but only to non-Passive ZRTP partners. */ - ZRTP_LICENSE_MODE_ACTIVE, - /** @brief Will send a Commit message to any ZRTP partner, Passive or non-Passive. */ - ZRTP_LICENSE_MODE_UNLIMITED -} zrtp_license_mode_t; - -/** - * @brief Enumeration to define Signaling initiator/responder roles. - * - * Used by libzrtp to optimize some internal processes and protocol handshake. - * - * @sas zrtp_stream_start(). - */ -typedef enum zrtp_signaling_role_t -{ - /** @brief Unknown Signaling role, should be used when the app can't determine the role. */ - ZRTP_SIGNALING_ROLE_UNKNOWN = 0, - /** @brief Signaling Initiator. */ - ZRTP_SIGNALING_ROLE_INITIATOR, - /** @brief Signaling Responder. */ - ZRTP_SIGNALING_ROLE_RESPONDER, - ZRTP_SIGNALING_ROLE_COUNT -} zrtp_signaling_role_t; - - -/** @brief 12-byte ZID for unique ZRTP endpoint identification. */ -typedef unsigned char zrtp_zid_t[12]; - -/** \brief 16-byte ID for ZRTP endpoint's software identification. */ -typedef char zrtp_client_id_t[16]; - -/** - * @brief ZRTP global configuration options - * @ingroup zrtp_main_init - * @warning Use \ref zrtp_config_defaults() before start configuring this structure. - */ -typedef struct zrtp_config_t -{ - /** @brief Symbolic client identifier */ - zrtp_client_id_t client_id; - - /** @brief libzrtp license mode defined protocol behavior */ - zrtp_license_mode_t lic_mode; - - /** @brief Set this flag to 1 if you product is MiTM box */ - uint8_t is_mitm; - - /** @brief Set of interfaces required to operate with libzrtp */ - zrtp_callback_t cb; - - /** @brief Path to zrtp cache file (set if you use built-in realization) */ - zrtp_string256_t def_cache_path; - - /** - * @brief Flush the cache automatically - * Set to 1 if you want libzrtp to flush the cache to the persistent storage - * right after it is modified. If cache_auto_store is 0, libzrtp will flush - * the cache on going down only and the app is responsible for storing the - * cache in unexpected situations. Enabled by default. - * - * @sa zrtp_def_cache_store() - */ - unsigned cache_auto_store; -} zrtp_config_t; - -/** - * \brief zrtp stream information structure - * \ingroup zrtp_main_management - * - * libzrtp, since v0.80 takes data encapsulating approach and hides all private data inside - * zrtp_stream_t structure. Developers shouldn't access them directly. \ref zrtp_stream_get() should - * be used instead to fill zrtp_stream_info_t structure. zrtp_stream_info_t contains all needed - * information in safe and easy to use form. - */ -struct zrtp_stream_info_t -{ - /** \brief Stream unique identifier for debug purposes */ - zrtp_id_t id; - - /** \brief Pointer to the parent zrtp session */ - zrtp_session_t* session; - - /** \brief Stream mode. Defines libzrtp behavior related to specified contexts. */ - zrtp_stream_mode_t mode; - - /** \brief Defines ZRTP Trusted mitm mode for the current session. */ - zrtp_mitm_mode_t mitm_mode; - - /** \brief Reflects current state of ZRTP protocol */ - zrtp_state_t state; - - /** - * \brief Last protocol error code - * - * Available for reading in ERROR state on zrtp_security_event_t#ZRTP_EVENT_PROTOCOL_ERROR. - */ - zrtp_protocol_error_t last_error; - - /** - * \brief Remote passive flag - * - * This flag shows when remote side is "passive" (has license mode PASSIVE) available in CLEAR - * state and later. - */ - uint8_t peer_passive; - - /** - * \brief Allowclear flag. - * - * Current value of "allowclear" option exchanged during ZRTP negotiation. Available in SECURE - * state. - */ - uint8_t res_allowclear; - - /** - * \brief Peer disclose bit flag - * - * Indicates the ability of the remote side to disclose its session key. Specifies that the - * remote side allows call monitoring. If this flag is set, the end user must be informed. It - * can be read in the SECURE state. - */ - uint8_t peer_disclose; - - /** - * \brief Defines that remote party is ZRTP MiTM endpoint - * - * Enabled by (Asterisk PBX, UMLab SIP Firewall or etc.) Available for reading in CLEAR state - * ande later. - */ - uint8_t peer_mitm; -}; - -/** - * \brief zrtp session information structure - * \ingroup zrtp_main_management - * libzrtp, since v0.80 takes data incapsulating approach and hides all private date inside - * zrtp_session_t structure. Developers shouldn't access them directly. \ref zrtp_session_get() - * should be used instead to fill zrtp_session_info_t structure. zrtp_session_info_t contains all - * needed information in safe and easy to use form. - */ -struct zrtp_session_info_t -{ - /** \brief Session unique identifier for debug purposes */ - zrtp_id_t id; - - /** - * \brief Local ZID - * - The unique 12-characters string that identifies the local ZRTP endpoint.This ID allows remote - * peers to recognize this ZRTP endpoint. - */ - zrtp_string16_t zid; - - /** - * \brief Remote ZID - * - * Extracted from the Hello packet of the very first ZRTP stream. Uniquely identifies the remote - * ZRTP peer. - */ - zrtp_string16_t peer_zid; - - /** \brief Character name identified remote ZRTP endpoint.*/ - zrtp_string16_t peer_clientid; - - /** \brief ZRTP Protocol version supported by the remote endpoint. */ - zrtp_string16_t peer_version; - - /** - * \brief Indicates that SAS related data is available for reading. - * \note - * As SAS is computed in SECURE state only, it may contain unknown values in other states. Check - * sas_is_ready before displaying SAS to the user. - */ - uint8_t sas_is_ready; - - /** \brief First Short Authentication String */ - zrtp_string16_t sas1; - - /** - * \brief Second Short Authentication string. - * \note - * Second SAS is available for \c base256 authentication only (\c sas_is_base256 is set). In - * other case, \c sas1 contains \c base32 value and \c sas2 is empty. - */ - zrtp_string16_t sas2; - - /** \brief Binary SAS digest (ZRTP_SAS_DIGEST_LENGTH bytes) */ - zrtp_string32_t sasbin; - - /** - * \brief Bit-map to summarize shared secrets "Cached" flags. - * - * 1 at appropriate bit means that the secrets was found in the cache and restored successfully. - * Value equal to 0 indicates that secret for the remote endpoint was not found in the cache - * and was generated randomly. - * Use ZRTP_BIT_RS1, ZRTP_BIT_RS2, ZRTP_BIT_AUX and ZRTP_BIT_PBX bit-masks to get "cached" value - * for the appropriate secret. - */ - uint32_t cached_flags; - - /** - * \brief Bit-map to summarize shared secrets "Matched" flags. - * - * 1 at appropriate bit means that the secret, locally computed by your ZRTP endpoint is equal - * to the secret, received from the remote endpoint. Secrets may not match if one of the - * endpoints doesn't use cache of the shared secrets, if the cache was deleted or in case of - * an attack. - * Use ZRTP_BIT_RS1, ZRTP_BIT_RS2, ZRTP_BIT_AUX and ZRTP_BIT_PBX bit-masks to get "cached" value - * for the appropriate secret. - */ - uint32_t matches_flags; - - /** - * \brief Bit-map to summarize shared secrets "Wrong" flags. - * - * 1 at appropriate bit means that the secret was restored from the cache, but doesn't match - * to the remote endpoint's secret. Such situation may happen if the remote endpoint lost cache - * or in case of attach. - * Use ZRTP_BIT_RS1, ZRTP_BIT_RS2, ZRTP_BIT_AUX and ZRTP_BIT_PBX bit-masks to get "cached" value - * for the appropriate secret. - */ - uint32_t wrongs_flags; - - /** - * \brief SAS Verification flag. - * - * The SAS Verified flag (V) is set based on the user indicating that SAS comparison has been - * successfully performed. Each party sends the SAS Verified flag from the previous session in - * the Confirm message of the current session. - * \sa - * - ZRTP RFC section. "7.1. SAS Verified Flag" for more information about Verification Flag. - * - zrtp_verified_set() - */ - uint32_t sas_is_verified; - - /** \brief Indicates base256 SAS encoding */ - uint8_t sas_is_base256; - - /** - * \brief actual lifetime of the secrets - * - * This variable contains the interval for retaining secrets within an established session. In - * accordance with ZRTP RFC this value is calculated as the minimal of local and remote TTLs - * after confirmation. Value is given in seconds and can be read in the SECURE state. - */ - uint32_t secrets_ttl; - - /** \brief Hash crypto component name used in ZRTP calculations. */ - zrtp_string32_t hash_name; - - /** \brief Cipher crypto component name used in ZRTP encryption. */ - zrtp_string32_t cipher_name; - - /** \brief SRTP Authentication crypto component name used in ZRTP exchange. */ - zrtp_string32_t auth_name; - - /** \brief SAS scheme crypto component name used in ZRTP exchange. */ - zrtp_string32_t sas_name; - - /** \brief Publik Key Exchange name used in ZRTP exchange. */ - zrtp_string32_t pk_name; -}; - -/* \} */ - - -/*======================================================================*/ -/* libzrtp Public API: Streams management */ -/*======================================================================*/ - - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/** - * \defgroup zrtp_main_init Initalization and Configuration - * \ingroup zrtp_api - * \{ - */ - -/** - * \brief Initializes libzrtp global config - * - * zrtp_config_defaults() prepares all fields of zrtp_config_t for further usage in zrtp_init(). - * This function allocates all necessary resources and initialize zrtp_config_t#cb with default - * implementations. - * - * \param config - libzrtp config for initialization. - * \warning this function must be used before start operating with the config. - */ -void zrtp_config_defaults(zrtp_config_t* config); - -/** - * \brief Initializing libzrtp - * - * This function initializes the library and all its components. zrtp_init() initialize global data - * for all sessions and streams. Fields of the global zrtp context are initialized automatically and - * shouldn't be modified. For correct memory management, global context should be released by - * calling zrtp_down(). - * - * \param config - libzrtp inital parameters - * \param zrtp - out parameter, pointer to allocated zrtp global context structure; - * \warning this function \b must be called before any operation with libzrtp. - * \return - * - zrtp_status_ok in successfully initialized or one of zrtp status errors in other case. - * \sa zrtp_down() -*/ -zrtp_status_t zrtp_init(zrtp_config_t* config, zrtp_global_t** zrtp); - -/*! - * \brief Shutting down the library - * - * Frees all allocated structures and resources. This function \b must be called at the end of use - * to stop libzrtp correctly. zrtp_down() doesn't stop in-progress ZRTP streams. To avoid mistakes, - * close all sessions before library deinitialization. - * - * \param zrtp - global ZRTP context previously allocated by zrtp_init(); - * \return - * - zrtp_status_ok if successfully shut down; - * - zrtp_status_fail if an error occurred. - * \sa zrtp_init() - */ -zrtp_status_t zrtp_down(zrtp_global_t* zrtp); - -/* \} */ - -/** - * \defgroup zrtp_main_management ZRTP Connections - * \ingroup zrtp_api - * \{ - */ - -/** - * \brief ZRTP Session Initialization. - * - * This function allocates and initializes the internal session context data. The given context is - * associated with the specified ZRTP identifier. Only after initialization does the session contain - * ZRTP_MAX_STREAMS_PER_SESSION streams ready to be used. - * - * After successfully initialization, configuration will be done according to the relevant profile - * \c profile. Profile will be applyed to every stream allocated within this session. Before using - * the profile, call zrtp_profile_check() function to make sure that the profile you are applying - * is correct. - * - * \warning Don't call zrtp_session_init() in parallel with other operations on this session. - * \param zrtp - global libzrtp context; - * \param profile - the session configuration profile. If value of this parameter is NULL, default - * profile will be used. NULL profile usage is equivalent to calling zrtp_profile_defaults(). - * \param zid - ZRTP peer identificator. - * \param role - identifies if the endpoint was the signaling initiator of the call. Used to - * provide Passive Mode options to the developer. If your application doesn't control signaling - * or you don't want to support Passive Mode features - set it to ZRTP_SIGNALING_ROLE_UNKNOWN. - * \param session - allocated session structure. - * \return - * - zrtp_status_ok if initialization is successful; - * - zrtp_status_fail if an error occurs. - * \sa zrtp_session_down() - */ -zrtp_status_t zrtp_session_init( zrtp_global_t* zrtp, - zrtp_profile_t* profile, - zrtp_zid_t zid, - zrtp_signaling_role_t role, - zrtp_session_t **session); -/** - * \brief ZRTP Session context deinitialization - * - * This function releases all resources allocated for internal context operations by zrtp_init(). - * - * \warning Don't call zrtp_session_init() in parallel with other operations on this session. - * \param session - session for deinitialization. - * \sa zrtp_session_init() - */ -void zrtp_session_down(zrtp_session_t *session); - - -/** - * \brief Obtain information about ZRTP session - * - * Function initialize and fills all fields of zrtp_session_info_t structure according to - * the current state of ZRTP session. - * - * \param session - zrtp session which parameters should be extracted; - * \param info - out structure to be initialized. - * \return - * - zrtp_status_ok in case of success. - * - zrtp_status_fail if an error occurs. - */ -zrtp_status_t zrtp_session_get(zrtp_session_t *session, zrtp_session_info_t *info); - -/** - * \brief Allow user to associate some data with current zrtp session. - * \param session - zrtp session to attach data to. - * \param udata - pointer to the user-data context. - * \sa zrtp_session_get_userdata() - */ -void zrtp_session_set_userdata(zrtp_session_t *session, void* udata); - -/** - * \brief Return user data associated with the zrtp session - * \param session - zrtp session to extract user data. - * \return - * - pointer to the user-data context previously set by zrtp_session_set_userdata(). - * - NULL if the user data unavailable. - * \sa zrtp_session_set_userdata() - */ -void* zrtp_session_get_userdata(zrtp_session_t *session); - -/** - * \brief Attaching a new stream to the session - * - * This function call initializes a ZRTP stream and prepares it for use within the specified - * session. The maximum number of streams for one session is defined by the - * ZRTP_MAX_STREAMS_PER_SESSION variable. All newly created streams are equivalent and have - * ZRTP_STREAM_MODE_CLEAR mode and ZRTP_ACTIVE state. Only after attaching a stream, ZRTP protocol - * can be initiated. - * - * \param session - the ZRTP session within which a new stream is to be - * \param stream - out parameter, attached stream will be stored there - * \return - * - zrtp_status_ok if stream was attached successfully - * - one of zrtp_status_t errors in case of failure - * \sa zrtp_stream_start() zrtp_stream_stop() - */ -zrtp_status_t zrtp_stream_attach(zrtp_session_t *session, zrtp_stream_t** stream); - -/** - * \brief Starting a ZRTP stream - * - * ZRTP stream setup is initiated by calling this function. Exchange of command packets begins - * immediately according to protocol. If the option "autosecure" is on, calling this function is the - * only requirement for setting up the ZRTP connection within a stream. If "autosecure" mode is not - * available, calling this function activates only connection within a ZRTP stream. A connection can - * be established manually later by calling zrtp_stream_secure(). - * - * Setup of the stream/connection takes a certain interval of time. This function just initiates - * this process. The system of callbacks informs the user about the progress of libzrtp protocol. - * - * \param stream - ZRTP stream to be started. - * \param ssrc - ssrc which will be used in ZRTP protocol messages. It should match with ssrc of - * appropriate RTP stream which will be encrypted by this ZRTP stream. - * \return - * - zrtp_status_ok in case of success; - * - one of zrtp_status_t errors in case of failure - * \sa - * - \ref XXX_GUIDE_CB \ref XXX_GUIDE_MANAGEMENT - * - zrtp_stream_stop() zrtp_stream_secure() zrtp_stream_clear() - */ -zrtp_status_t zrtp_stream_start(zrtp_stream_t* stream, - uint32_t ssrc); - -/** - * \brief ZRTP protocol stopping - * - * This function stops all protocol operations for the specified stream, releases resources - * allocated on the zrtp_stream_start() and prepares the stream structure for the next use. - * - * This function will stop the protocol at any stage: all delayed tasks are canceled, and the - * protocol packet exchange and encryption is stopped. After this function call it is necessary to - * stop processing traffic using the zrtp_process_xxx() function. - * - * \param stream - the stream being shutdown. - * \return - * - zrtp_status_ok in case of success; - * - one of zrtp_status_t errors in case of failure - * \sa - * - \ref XXX_GUIDE_CB \ref XXX_GUIDE_MANAGEMENT - * - zrtp_stream_start() zrtp_stream_secure() zrtp_stream_clear() - */ -zrtp_status_t zrtp_stream_stop(zrtp_stream_t* stream); - -/*! - * \brief Initiating an interruption of the secure connection - * - * This function initiates the shutting down of the ZRTP connection within a stream. In other words, - * after successfully switching to secure mode (\ref XXX SECURE state, fig. 1.5), calling this - * function begins the exchange of packets switching back to insecure (CLEAR) mode. - * - * This function can only be implemented from the SECURE state. Attempt to call this function from - * any other state will end in failure. The client application is informed about protocol - * progress through a system of callbacks. - * - * \param stream - ZRTP stream . - * \return - * - zrtp_status_ok - if shutting down the connection is started successfully. - * - zrtp_status_fail - if shutting down the connection is initiated from an incorrect state. - * \sa - * - \ref XXX_GUIDE_CB \ref XXX_GUIDE_MANAGEMENT - * - zrtp_stream_start() zrtp_stream_secure() zrtp_stream_clear() - */ -zrtp_status_t zrtp_stream_clear(zrtp_stream_t *stream); - -/** - * \brief Initiating a secure connection setup - * - * The function initiates a ZRTP connection setup within a stream. In other words, after the - * protocol has started and Discovery phase have been successfully accomplished, calling this - * function will begin the exchange of packets for switching to SECURE mode. - * - * This function can be successfully performed only from the CLEAR state (\ref XXX Figure 1.6). - * Attempting to call this function from any other state will result in failure. The client - * application is informed about protocol progress through a system of callbacks. - * - * \param stream - ZRTP stream to be secured. - * \return - * - zrtp_status_ok - if switching to secure mode started successfully. - * - zrtp_status_fail - if switching to secure mode is initiated from a state other than CLEAR. - * \sa - * - \ref XXX_GUIDE_CB \ref XXX_GUIDE_MANAGEMENT. - * - zrtp_stream_start() zrtp_stream_clear(). - */ -zrtp_status_t zrtp_stream_secure(zrtp_stream_t *stream); - -/** - * \brief Obtain information about zrtp stream - * - * Function initialize and fills all fields of zrtp_stream_info_t structure accordint to - * current state of zrtp stream. - * - * \param stream - zrtp stream which parameters should be extracted - * \param info - out structure to be initialized - * \return - * - zrtp_status_ok in case of success. - * - zrtp_status_fail if an error occurs. - */ -zrtp_status_t zrtp_stream_get(zrtp_stream_t *stream, zrtp_stream_info_t *info); - -/** - * @brief Allow user to associate some data with zrtp stream. - * @param stream - zrtp stream to attach data to. - * @param udata - pointer to the user-data context. - * @sa zrtp_stream_get_userdata() - */ -void zrtp_stream_set_userdata(zrtp_stream_t *stream, void* udata); - -/** - * \brief Return user data associated with the zrtp stream - * \return - * - pointer to the user-data context previously set by zrtp_stream_set_userdata() - * - NULL if user data unavailable; - * \sa zrtp_stream_set_userdata() - */ -void* zrtp_stream_get_userdata(const zrtp_stream_t *stream); - -/* \} */ - -/*======================================================================*/ -/* libzrtp Public API: Encryption */ -/*======================================================================*/ - -/** - * \defgroup zrtp_main_proto Traffic Processing - * \ingroup zrtp_api - * \{ - */ - -/** - * \brief Processing outgoing RTP packets - * - * This is the main function for processing outgoing RTP packets. As soon as the protocol is - * started, each outgoing RTP packet (not encrypted) has to go through this function. - * - * It performs different actions depending on the connection state and packet type: - * - In setup ZRTP connection mode, it encrypts outgoing RTP packets. The packet is encrypted right - * in the transferred buffer; - * - Protects codec and data privacy by deleting certain packets from the stream. In this case the - * body and the length of the packet remain unchanged. - * - * \param stream - ZRTP stream to process RTP packet; - * \param packet - buffer storing the RTP packet for encryption. After processing, the encrypted - * packet is stored in the same buffer. - * \param length - the length of the buffered packet. After processing, the length of encrypted - * packet is stored here. - * \warning During encryption, the data length increases in comparison to the source data. Because - * the function uses the same buffer both for incoming and resulting values, the length of the - * buffer must be larger than size of source packet. - * \return - * - zrtp_status_ok if encryption is successful. The packet should be sent to the recipient. - * - zrtp_status_fail if there was an error during encryption. The packet should be rejected. - * - zrtp_status_drop if there was interference in the VoIP client codec protection mechanism. The - * packet should be rejected. - * \sa zrtp_process_srtp() zrtp_process_rtcp() zrtp_process_srtcp() - */ -zrtp_status_t zrtp_process_rtp( zrtp_stream_t *stream, - char* packet, - unsigned int* length); - -/** - * \brief Processing incoming RTP packets - * - * This is the main function for incoming RTP packets processing. It is an analogue of - * zrtp_process_rtp() but for an incoming stream. After the protocol is started, each (encrypted) - * incoming RTP packet has to go through this function. - * - * It performs different actions depending on the connection state and packet type: - * - during setup/interruption of ZRTP connection, processes incoming protocol packets. The body - * and length of the packet remain unchanged; - * - in setup ZRTP connection mode, decrypts incoming RTP packet. The packet is decrypted right in - * the transferred buffer; - * - protects codec and data privacy by deleting certain packets from the stream. In this case the - * body and the length of the packet remain unchanged. - * - * \param stream - ZRTP stream for processing - * \param packet - buffer storing the packet for decrypting. After processing, the decrypted packet - * is stored in the same buffer; - * \param length - the length of the buffered packet. After processing, the length of decrypted - * packet is stored here; - * \return - * - zrtp_status_ok if decrypting is successful. Such a packet should be sent to the recipient; - * - zrtp_status_fail if an error occurred during decrypting or command packet processing. The - * packet should be rejected; - * - zrtp_status_drop if the command packet processing is successful or if there was interference - * in the VoIP client codec protection mechanism. The packet should be rejected in either case; - * \sa zrtp_process_rtp() zrtp_process_rtcp() zrtp_process_srtcp() - */ -zrtp_status_t zrtp_process_srtp( zrtp_stream_t *stream, - char* packet, - unsigned int* length); - -/*! - * \brief Processing outgoing RTCP packets - * - * This is the main function for processing outgoing RTCP packets. The function behavior is similar - * to that of zrtp_process_rtp(): - * - In SECURE mode, encrypts outgoing RTCP packets. The packet is encrypted right in the - * transferred buffer. The length of encrypted packet is returned in the \c length variable; - * - protects codec and data privacy by deleting certain packets from the stream. In this case the - * body and the length of the packet remain unchanged. - * - * \param stream - ZRTP session for processing; - * \param packet - buffer storing RTCP packet; - * \param length - length of the buffered packet. - * \return - * - zrtp_status_ok if encryption is successful. The packet should be sent to the recipient. - * - zrtp_status_fail if there was an error during encryption. The packet should be rejected. - * - zrtp_status_drop if there was interference in the VoIP client codec protection mechanism. The - * packet should be rejected. - * \sa zrtp_process_srtp() zrtp_process_rtp() zrtp_process_srtcp() - */ -zrtp_status_t zrtp_process_rtcp( zrtp_stream_t *stream, - char* packet, - unsigned int* length); - -/** - * \brief Processing incoming RTCP packets - * - * This is the main function for processing incoming RTCP packets. The function behavior is similar - * to that of zrtp_process_srtp(): - * - In SECURE mode, decrypts incoming RTCP packets. The packet is decrypted right in the - * transferred buffer. The length of the encrypted packet is returned in the \c length variable; - * - In transition states, drops all incoming RTCP traffic. In this case the body and the length of - * the packet remain unchanged. - * - * \param stream - ZRTP stream for processing; - * \param packet - buffer storing the RTCP packet; - * \param length - length of the buffered packet. - * \return - * - zrtp_status_ok if decrypting is successful. Such a packet should be sent to the recipient; - * - zrtp_status_drop if the command packet processing is successful or if there was interference - * in the VoIP client codec protection mechanism. The packet should be rejected in either case; - * - zrtp_status_fail if there was an error during encryption. The packet should be rejected. - * \sa zrtp_process_srtp() zrtp_process_rtp() zrtp_process_rtcp() - */ -zrtp_status_t zrtp_process_srtcp( zrtp_stream_t *stream, - char* packet, - unsigned int* length); - -/* \} */ - -/** - * \defgroup zrtp_main_utils Utilities - * \ingroup zrtp_api - * \{ - */ - -/** - * \brief Specifies the hash of the peer Hello message for verification. - * - * In accordance with the ZRTP RFC sec. 9, this protocol can prevent DOS attacks by verification of - * the Hello message hash sent through the signaling protocol. - * - * This function allows the user to specify the Hello hash for verification. If after the - * discovering phase the Hello hashes don't match, libzrtp raises the - * zrtp_event_t#ZRTP_EVENT_WRONG_SIGNALING_HASH event. This function should only be called before - * starting the protocol from the ZRTP_STATE_ACTIVE state. - * - * \param stream - stream for operating with; - * \param hash_buff - signaling hash buffer. Function accepts string, not a binary value!; - * \param hash_buff_length - signaling hash length in bytes, must be ZRTP_SIGN_ZRTP_HASH_LENGTH bytes; - * \return: - * - zrtp_status_ok if the operation finished successfully - * - one of the errors otherwise - * \sa - * - ZRTP RFC. sec 8; - * - zrtp_signaling_hash_get() - */ -zrtp_status_t zrtp_signaling_hash_set( zrtp_stream_t* stream, - const char *hash_buff, - uint32_t hash_buff_length); - -/** - * \brief Returns the hash of the Hello message to be transferred in signaling. - * - * To prevent DOS attacks, the hash of the Hello message may be sent through signaling. - * zrtp_signaling_hash_get() may be called after attaching the stream to receive the value of this - * hash. - * - * \param stream - stream for operating with - * \param hash_buff - buffer for storing signaling hash. Function returns already parsed hex string. - * String is null-terminated. Buffer must be at least ZRTP_SIGN_ZRTP_HASH_LENGTH bytes length. - * \param hash_buff_length - buffer length in bytes, non less than ZRTP_SIGN_ZRTP_HASH_LENGTH bytes. - * \return: - * - zrtp_status_ok if the operation finished successfully - * - one of the errors otherwise - * \sa - * - ZRTP RFC. sec 8; - * - zrtp_signaling_hash_set() - */ -zrtp_status_t zrtp_signaling_hash_get(zrtp_stream_t* stream, - char* hash_buff, - uint32_t hash_buff_length); - -/** - * \brief Changing the value of the secret's verification flag - * - * This function is used to change (set, unset) the secret's verification flag. zrtp_verified_set() - * changes the relevant internal data and stores a flag in the cache. - * \note - * Special synchronization mechanisms are provided to protect the cache from race conditions. Don't - * change the verified flag directly in the cache - use this function. - * - * \param zrtp - zrtp global data; - * \param zid1 - ZID of the first party; - * \param zid2 - ZID of the second party; - * \param verified - Boolean value of the verified flag. - * \return - * - zrtp_status_ok - if successful; - * - one of zrtp_status_t errors if fails. - */ -zrtp_status_t zrtp_verified_set( zrtp_global_t *zrtp, - zrtp_string16_t *zid1, - zrtp_string16_t *zid2, - uint8_t verified); - -/** - * \brief Verifying the ZRTP profile - * - * zrtp_profile_check() checks the correctness of the values in the profile. The following checks - * are performed: - * - the number of components in each group does not exceed ZRTP_MAX_COMP_COUNT; - * - the components declared are supported by the library kernel. - * - presence of the set of obligatory components defined by ZRTP RFC. - * - * \param profile - ZRTP profile for validation; - * \param zrtp - global ZRTP context. - * \return - * - zrtp_status_ok - if profile passed all available tests; - * - one of ZRTP errors - if there are mistakes in the profile. See debug logging for additional - * information. - */ -zrtp_status_t zrtp_profile_check(const zrtp_profile_t* profile, zrtp_global_t* zrtp); - -/** - * \brief Configure the default ZRTP profile - * - * These options are used: - * \code - * "active" is enabled; - * "allowclear" is disabled by default and enabled for Zfone only; - * "autosecure" is enabled; - * "disclose_bit" is disabled; - * cache_ttl = ZRTP_CACHE_DEFAULT_TTL defined by ZRTP RFC; - * - * [sas_schemes] = ZRTP_SAS_BASE256, ZRTP_SAS_BASE32; - * [cipher_types] = ZRTP_CIPHER_AES128; - * [pk_schemes] = ZRTP_PKTYPE_DH3072; - * [auth_tag_lens] = ZRTP_ATL_HS32; - * [hash_schemes] = ZRTP_HASH_SHA256; - * \endcode - * - * \param profile - ZRTP stream profile for filling; - * \param zrtp - libzrtp global context. - */ -void zrtp_profile_defaults(zrtp_profile_t* profile, zrtp_global_t* zrtp); - -/** - * \brief Search for a component in the profile by ID - * - * The utility function returning the position of an element of the specified type in the profile. - * Used by libZRTP kernel and for external use. - * - * \param profile - ZRTP profile; - * \param type - sought component type; - * \param id - sought component ID. - * \return - * - component position - if component was found; - * -1 - if the component with the specified ID can't be found in profile. - */ -int zrtp_profile_find(const zrtp_profile_t* profile, zrtp_crypto_comp_t type, uint8_t id); - -/* \} */ - -/** - * \defgroup zrtp_main_rng Random Number Generation - * \ingroup zrtp_api - * \{ - * The generation of cryptographic key material is a highly sensitive process. To do this, you need - * high entropy random numbers that an attacker cannot predict. This section \ref rng gives basic - * knowliges andbot the RNG and it's implementation in libzrtp. - * \warning - * \ref rng \c MUST be read by every developer using libzrtp. - */ - -/** - * \brief Entropy accumulation routine - * - * The random number generation scheme is described in detail in chapter \ref XXX. This function - * gets \c length bytes of entropy from \c buffer and hashes it into the special storage. This - * function should be called periodically from the user's space to increase entropy quality. - * \warning - * RNG is a very important and sensitive component of the crypto-system. Please, pay attention to - * \ref rng. - * \param zrtp - libzrtp global context; - * \param buffer - pointer to the buffer with entropy for accumulating; - * \param length - entropy size in bytes. - * \return: number of hashed bytes. - */ -int zrtp_entropy_add(zrtp_global_t* zrtp, const unsigned char *buffer, uint32_t length); - -/** - * \brief Random string generation - * - * zrtp_randstr() generates \c length bytes of "random" data. We say "random" because the - * "randomness" of the generated sequence depends on the quality of the entropy passed to - * zrtp_entropy_add(). If the user provides "good" entropy, zrtp_randstr() generates sufficiently - * "random" data. - * - * \param zrtp - libzrtp global context; - * \param buffer - buffer into which random data will be generated; - * \param length - length of required sequence in bytes. - * \return - * - length of generated sequence in bytes or -1 in case of error - * \sa \ref rng - */ -int zrtp_randstr(zrtp_global_t* zrtp, unsigned char *buffer, uint32_t length); - -int zrtp_randstr2(unsigned char *buffer, uint32_t length); - -/* \} */ - -#if defined(__cplusplus) -} -#endif - -#endif /* __ZRTP_H__ */ diff --git a/libs/libzrtp/include/zrtp_base.h b/libs/libzrtp/include/zrtp_base.h deleted file mode 100644 index 2b03352d5b..0000000000 --- a/libs/libzrtp/include/zrtp_base.h +++ /dev/null @@ -1,208 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_BASE_H__ -#define __ZRTP_BASE_H__ - -#include "zrtp_config.h" - -typedef double uint64_t_; - -typedef uint8_t zrtp_uchar4_t[4]; -typedef uint8_t zrtp_uchar8_t[8]; -typedef uint8_t zrtp_uchar12_t[12]; -typedef uint8_t zrtp_uchar16_t[16]; -typedef uint8_t zrtp_uchar32_t[32]; -typedef uint8_t zrtp_uchar64_t[64]; -typedef uint8_t zrtp_uchar128_t[128]; -typedef uint8_t zrtp_uchar256_t[256]; -typedef uint8_t zrtp_uchar1024_t[1024]; - -typedef uint32_t zrtp_id_t; - -typedef struct zrtp_profile_t zrtp_profile_t; -typedef struct zrtp_stream_t zrtp_stream_t; -typedef struct zrtp_session_t zrtp_session_t; -typedef struct zrtp_global_t zrtp_global_t; - -typedef struct zrtp_protocol_t zrtp_protocol_t; -typedef struct zrtp_srtp_ctx_t zrtp_srtp_ctx_t; -typedef struct zrtp_shared_secret_t zrtp_shared_secret_t; -typedef struct zrtp_retry_task_t zrtp_retry_task_t; - -typedef struct zrtp_hash_t zrtp_hash_t; -typedef struct zrtp_cipher_t zrtp_cipher_t; -typedef struct zrtp_auth_tag_length_t zrtp_auth_tag_length_t; -typedef struct zrtp_pk_scheme_t zrtp_pk_scheme_t; -typedef struct zrtp_sas_scheme_t zrtp_sas_scheme_t; -typedef struct zrtp_sig_scheme_t zrtp_sig_scheme_t; - -typedef struct zrtp_mutex_t zrtp_mutex_t; -typedef struct zrtp_sem_t zrtp_sem_t; - -typedef struct zrtp_stream_info_t zrtp_stream_info_t; -typedef struct zrtp_session_info_t zrtp_session_info_t; - -#include "sha2.h" -#define MD_CTX sha512_ctx -#define MD_Update(a,b,c) sha512_hash((const unsigned char *)(b),c,a) - - -/** - * \brief Function computing minimum value - * - * This macro returns the lesser of two values. If the numbers are equal, either of them is returned. - * - * \param left - first value for comparison; - * \param right - second value for comparison. - * \return - * - lesser of compared numbers. - */ -#define ZRTP_MIN(left, right) ((left < right) ? left : right) - - -/*! - * \brief zrtp_htonXX, zrtp_ntohXX - convert values between host and network - * byte order - * - * To avoid ambiguities and difficulties with compilation on various platforms, - * we designed our own swap functions. Byte order detection is based on zrtp_system.h. - * - * On the i80x86 the host byte order is little-endian (least significant byte - * first), whereas the network byte order, as used on the Internet, is - * big-endian (most significant byte first). - */ - -uint16_t zrtp_swap16(uint16_t x); -uint32_t zrtp_swap32(uint32_t x); -uint64_t zrtp_swap64(uint64_t x); - -#if ZRTP_BYTE_ORDER == ZBO_BIG_ENDIAN -/*! Converts 16 bit unsigned integer to network byte order */ -#define zrtp_hton16(x) (x) -/*! Converts 32 bit unsigned integer to network byte order */ -#define zrtp_hton32(x) (x) -/*! Converts 64 bit unsigned integer to network byte order */ -#define zrtp_hton64(x) (x) - -/*! Converts 16 bit unsigned integer to host byte order */ -#define zrtp_ntoh16(x) (x) -/*! Converts 32 bit unsigned integer to host byte order */ -#define zrtp_ntoh32(x) (x) -/*! Converts 64 bit unsigned integer to host byte order */ -#define zrtp_ntoh64(x) (x) -#else /* ZBO_BIG_ENDIAN */ -/*! Converts 16 bit unsigned integer to network byte order */ -#define zrtp_hton16(x) (zrtp_swap16(x)) -/*! Converts 32 bit unsigned integer to network byte order */ -#define zrtp_hton32(x) (zrtp_swap32(x)) -/*! Converts 64 bit unsigned integer to network byte order */ -#define zrtp_hton64(x) (zrtp_swap64(x)) - -/*! Converts 16 bit unsigned integer to host byte order */ -#define zrtp_ntoh16(x) (zrtp_swap16(x)) -/*! Converts 32 bit unsigned integer to host byte order */ -#define zrtp_ntoh32(x) (zrtp_swap32(x)) -/*! Converts 64 bit unsigned integer to host byte order */ -#define zrtp_ntoh64(x) (zrtp_swap64(x)) -#endif - - -/* - * 128 and 256-bit structures used in Ciphers and SRTP module - */ -typedef union - { - uint8_t v8[16]; - uint16_t v16[8]; - uint32_t v32[4]; - uint64_t v64[2]; - } zrtp_v128_t; - -typedef union - { - uint8_t v8[32]; - uint16_t v16[16]; - uint32_t v32[8]; - uint64_t v64[4]; - } zrtp_v256_t; - -/* - * The following macros define the data manipulation functions. - * - * If DATATYPES_USE_MACROS is defined, then these macros are used directly (and - * function-call overhead is avoided). Otherwise, the macros are used through - * the functions defined in datatypes.c (and the compiler provides better - * warnings). - */ - -#define _zrtp_v128_xor(z, x, y) \ -( \ -(z)->v32[0] = (x)->v32[0] ^ (y)->v32[0], \ -(z)->v32[1] = (x)->v32[1] ^ (y)->v32[1], \ -(z)->v32[2] = (x)->v32[2] ^ (y)->v32[2], \ -(z)->v32[3] = (x)->v32[3] ^ (y)->v32[3] \ -) - -#define _zrtp_v128_get_bit(x, bit) \ -( \ -( (((x)->v32[(bit) >> 5]) >> ((bit) & 31)) & 1) \ -) - -#define zrtp_bitmap_get_bit(x, bit) \ -( \ -( (((x)[(bit) >> 3]) >> ((bit) & 7) ) & 1) \ -) - -#define zrtp_bitmap_set_bit(x, bit) \ -( \ -( (((x)[(bit) >> 3])) |= ((uint8_t)1 << ((bit) & 7)) ) \ -) - -#define zrtp_bitmap_clear_bit(x, bit) \ -( \ -( (((x)[(bit) >> 3])) &= ~((uint8_t)1 << ((bit) & 7)) ) \ -) - -void zrtp_bitmap_left_shift(uint8_t *x, int width_bytes, int index); - -void zrtp_v128_xor(zrtp_v128_t *z, zrtp_v128_t *x, zrtp_v128_t *y); - - - -//WIN64 { -#if (ZRTP_PLATFORM == ZP_WIN32_KERNEL) - -#ifdef WIN64 // For 64-bit apps - -unsigned __int64 __rdtsc(void); -#pragma intrinsic(__rdtsc) -#define _RDTSC __rdtsc - -#else // For 32-bit apps - -#define _RDTSC_STACK(ts) \ -__asm rdtsc \ -__asm mov DWORD PTR [ts], eax \ -__asm mov DWORD PTR [ts+4], edx - -__inline unsigned __int64 _inl_rdtsc32() { - unsigned __int64 t; - _RDTSC_STACK(t); - return t; -} -#define _RDTSC _inl_rdtsc32 - -#endif - -#endif -//WIN64 } - - -#endif /*__ZRTP_BASE_H__*/ diff --git a/libs/libzrtp/include/zrtp_config.h b/libs/libzrtp/include/zrtp_config.h deleted file mode 100644 index dbfad31f7d..0000000000 --- a/libs/libzrtp/include/zrtp_config.h +++ /dev/null @@ -1,271 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_CONFIG_H__ -#define __ZRTP_CONFIG_H__ - -#include "zrtp_config_user.h" - -/* - * ZRTP PLATFORM DETECTION - * If platworm is not specified manually in zrtp_config_user.h - try to detect it aytomatically - */ -#if !defined(ZRTP_PLATFORM) -# if defined(ANDROID_NDK) -# define ZRTP_PLATFORM ZP_ANDROID -# elif defined(__FreeBSD__) -# define ZRTP_PLATFORM ZP_BSD -# elif defined(linux) || defined(__linux__) || defined(__linux) -# include -# define ZRTP_PLATFORM ZP_LINUX -# elif defined(__MACOSX__) || defined (__APPLE__) || defined (__MACH__) -# define ZRTP_PLATFORM ZP_DARWIN -# elif defined(_WIN32_WCE) || defined(UNDER_CE) -# include -# define ZRTP_PLATFORM ZP_WINCE -# elif defined(__SYMBIAN32__) -# define ZRTP_PLATFORM ZP_SYMBIAN -# elif defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WIN32) || defined(__TOS_WIN__) -# if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) -# define ZRTP_PLATFORM ZP_WIN32_KERNEL -# elif defined(_WIN64) -# define ZRTP_PLATFORM ZP_WIN32 -# else -# define ZRTP_PLATFORM ZP_WIN32 -# endif -# endif -#endif - -#if ZRTP_PLATFORM == ZP_ANDROID -# include "zrtp_config_android.h" -#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || defined(ZRTP_AUTOMAKE) -# include "zrtp_config_unix.h" -#elif (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN32_KERNEL) || (ZRTP_PLATFORM == ZP_WINCE) -# include "zrtp_config_win.h" -#elif (ZRTP_PLATFORM == ZP_SYMBIAN) -# include "zrtp_config_symbian.h" -#endif - -#if !defined(ZRTP_PLATFORM) -# error "Libzrtp can't detect software platform: use manual setup in zrtp_config_user.h" -#endif - -#if ZRTP_HAVE_LINUX_VERSION_H == 1 -#include -#endif -#if ZRTP_HAVE_ASM_TYPES_H == 1 -#include -#endif - -/* - * ZRTP BYTEORDER DETECTION - * If the byte order is not specified manually in zrtp_config_user.h - try to detect it automatically - */ -#if !defined(ZRTP_BYTE_ORDER) - -#if defined(_i386_) || defined(i_386_) || defined(_X86_) || defined(x86) || defined(__i386__) || \ - defined(__i386) || defined(_M_IX86) || defined(__I86__) -/* - * Generic i386 processor family, little-endian - */ -#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN - -#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_AMD64_) -/* - * AMD 64bit processor, little endian - */ -#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN - -#elif defined( __sparc__) || defined(__sparc) -/* - * Sun Sparc, big endian - */ -#define ZRTP_BYTE_ORDER ZBO_BIG_ENDIAN - -#elif defined(__AARCH64EB__) -/* - * aarch64, big endian - */ -#define ZRTP_BYTE_ORDER ZBO_BIG_ENDIAN - -#elif defined(ARM) || defined(_ARM_) || defined(ARMV4) || defined(__arm__) || defined(__AARCH64EL__) -/* - * ARM, default to little endian - */ -#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN - -#elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) || defined(__ppc__) || \ - defined(_M_PPC) || defined(_ARCH_PPC) -/* - * PowerPC, big endian - */ -#define ZRTP_BYTE_ORDER ZBO_BIG_ENDIAN - -#elif defined(__MIPSEB__) -/* - * mips, big endian - */ -#define ZRTP_BYTE_ORDER ZBO_BIG_ENDIAN - -#elif defined(__MIPSEL__) -/* - * mips, little endian - */ -#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN - -#elif defined(__e2k__) -/* - * Elbrus, little endian - */ -#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN - -#endif /* Automatic byte order detection */ - -#endif - -#if !defined(ZRTP_BYTE_ORDER) -# error "Libzrtp can't detect byte order: use manual setup in zrtp_config_user.h" -#endif - - -/* - * Define Unaligned structure for target platform - */ -#if (ZRTP_PLATFORM == ZP_WINCE) -# define ZRTP_UNALIGNED(type) UNALIGNED type -#else -# define ZRTP_UNALIGNED(type) type -#endif - - -/* - * Define basic literal types for libzrtp - * We use this definitions in SRTP, AES and Hash implementation - */ -#if (ZRTP_PLATFORM != ZP_WIN32_KERNEL) -# if ZRTP_HAVE_STDLIB_H == 1 -# include -# endif -# if ZRTP_HAVE_STDINT_H == 1 -# include -# endif -# if ZRTP_HAVE_INTTYPES_H == 1 -# include -# endif -# if ZRTP_HAVE_SYS_TYPES_H == 1 -# include -# endif -# if ZRTP_HAVE_SYS_INT_TYPES_H == 1 -# include -# endif -# if ZRTP_HAVE_MACHINE_TYPES_H == 1 -# include -# endif -#endif - -#if (ZRTP_PLATFORM == ZP_WINCE) || (ZRTP_PLATFORM == ZP_SYMBIAN) || (ZRTP_PLATFORM == ZP_ANDROID) -# define ALIGNMENT_32BIT_REQUIRED -#endif - -#ifdef ZRTP_HAVE_UINT64_T -# if ZRTP_HAVE_UINT64_T == 0 -# if defined(WIN32) || defined(WIN64) -# if defined(_MSC_VER) && (_MSC_VER < 1310) - typedef __int64 uint64_t; -# else - typedef unsigned long long uint64_t; -# endif -# else -# if SIZEOF_UNSIGNED_LONG == 8 - typedef unsigned long uint64_t; -# elif SIZEOF_UNSIGNED_LONG_LONG == 8 - typedef unsigned long long uint64_t; -# else -# define ZRTP_NO_64BIT_MATH 1 -# endif -# endif /* WIN32 */ -# endif -#endif - -#ifdef ZRTP_HAVE_INT64_T -# if ZRTP_HAVE_INT64_T == 0 -# if defined(WIN32) || defined(WIN64) -# if defined(_MSC_VER) && (_MSC_VER < 1310) - typedef __int64 int64_t; -# else - typedef long long int64_t; -# endif -# else -# if SIZEOF_UNSIGNED_LONG == 8 - typedef long int64_t; -# elif SIZEOF_UNSIGNED_LONG_LONG == 8 - typedef long long int64_t; -# else -# define ZRTP_NO_64BIT_MATH 1 -# endif -# endif /* WIN32 */ -# endif -#endif - -#define SIZEOF_UNSIGNED_LONG_LONG 8 - -#if defined(WIN32) || defined(WIN64) -# if defined(_MSC_VER) && (_MSC_VER < 1310) -# define li_64(h) 0x##h##ui64 -# else -# define li_64(h) 0x##h##ull -# endif -#else -# if SIZEOF_UNSIGNED_LONG == 8 -# define li_64(h) 0x##h##ul -# elif SIZEOF_UNSIGNED_LONG_LONG == 8 -# define li_64(h) 0x##h##ull -# else -# define ZRTP_NO_64BIT_MATH 1 -# endif -#endif /* WIN32 */ - - -#ifdef ZRTP_HAVE_UINT8_T -# if ZRTP_HAVE_UINT8_T == 0 - typedef unsigned char uint8_t; -# endif -#endif - -#ifdef ZRTP_HAVE_UINT16_T -# if ZRTP_HAVE_UINT16_T == 0 - typedef unsigned short int uint16_t; -# endif -#endif - -#ifdef ZRTP_HAVE_UINT32_T -# if ZRTP_HAVE_UINT32_T == 0 - typedef unsigned int uint32_t; -# endif -#endif - -#ifdef ZRTP_HAVE_INT8_T -# if ZRTP_HAVE_INT8_T == 0 - typedef char int8_t; -# endif -#endif - -#ifdef ZRTP_HAVE_INT16_T -# if ZRTP_HAVE_INT16_T == 0 - typedef short int int16_t; -# endif -#endif - -#ifdef ZRTP_HAVE_INT32_T -# if ZRTP_HAVE_INT32_T == 0 - typedef int int32_t; -# endif -#endif - -#endif /*__ZRTP_CONFIG_H__ */ diff --git a/libs/libzrtp/include/zrtp_config_android.h b/libs/libzrtp/include/zrtp_config_android.h deleted file mode 100644 index 06d379939e..0000000000 --- a/libs/libzrtp/include/zrtp_config_android.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef ZRTP_SYMB_CONFIG_H__ -#define ZRTP_SYMB_CONFIG_H__ - -#ifndef ZRTP_HAVE_STDIO_H -# define ZRTP_HAVE_STDIO_H 1 -#endif - -#ifndef ZRTP_HAVE_STDARG_H -# define ZRTP_HAVE_STDARG_H 1 -#endif - - -#ifndef NO_ASSERT_H -# define NO_ASSERT_H 1 -#endif - -#ifndef NO_STDLIB_H -# define NO_STDLIB_H 0 -#endif -//#define ZRTP_HAVE_INTTYPES_H 1 -#ifndef ZRTP_HAVE_UNISTD_H -# define ZRTP_HAVE_UNISTD_H 1 -#endif - -#ifndef ZRTP_HAVE_PTHREAD_H -# define ZRTP_HAVE_PTHREAD_H 1 -#endif - -#ifndef ZRTP_HAVE_SEMAPHORE_H -#define ZRTP_HAVE_SEMAPHORE_H 1 -#endif - -#ifndef ZRTP_HAVE_ERRNO_H -#define ZRTP_HAVE_ERRNO_H 1 -#endif - -#ifndef ZRTP_HAVE_FCNTL_H -#define ZRTP_HAVE_FCNTL_H 1 -#endif - -#ifndef ZRTP_HAVE_SYS_TIME_H -# define ZRTP_HAVE_SYS_TIME_H 1 -#endif - - -#ifndef ZRTP_HAVE_SYS_TYPES_H -# define ZRTP_HAVE_SYS_TYPES_H 1 -#endif - - -#ifndef ZRTP_HAVE_INTTYPES_H -# define ZRTP_HAVE_INTTYPES_H 1 -#endif - -#ifndef ZRTP_HAVE_STDINT_H -# define ZRTP_HAVE_STDINT_H 1 -#endif - -#ifndef ZRTP_HAVE_LINUX_VERSION_H -# define ZRTP_HAVE_LINUX_VERSION_H 0 -#endif - - -// (ZRTP_PLATFORM == ZP_ANDROID) - - -#define ZRTP_HAVE_INT64_T 1 -#define ZRTP_HAVE_INT32_T 1 -#define ZRTP_HAVE_INT16_T 1 -#define ZRTP_HAVE_INT8_T 1 - -#define ZRTP_HAVE_UINT64_T 1 -#define ZRTP_HAVE_UINT32_T 1 -#define ZRTP_HAVE_UINT16_T 1 -#define ZRTP_HAVE_UINT8_T 1 - -#define ZRTP_BYTE_ORDER ZBO_LITTLE_ENDIAN - -#define SIZEOF_UNSIGNED_LONG 4 -#define SIZEOF_UNSIGNED_LONG_LONG 8 - -#define ZRTP_INLINE inline - -#define ZRTP_USE_BUILTIN_CACHE 1 -#define ZRTP_USE_BUILTIN_SCEHDULER 1 -#undef ZRTP_USE_STACK_MINIM -#define ZRTP_USE_STACK_MINIM 1 -#define ALIGNMENT_32BIT_REQUIRED - -#endif /* ZRTP_WIN_CONFIG_H__ */ diff --git a/libs/libzrtp/include/zrtp_config_symbian.h b/libs/libzrtp/include/zrtp_config_symbian.h deleted file mode 100644 index 1cda65dbb2..0000000000 --- a/libs/libzrtp/include/zrtp_config_symbian.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef ZRTP_SYMB_CONFIG_H__ -#define ZRTP_SYMB_CONFIG_H__ - - -/* - * Used to map system integer types to zrtp integer definitions. - * Define to 1 if you have the header file. - */ -#undef ZRTP_HAVE_INTTYPES_H - -/* - * This header is needed for operations with binary file in deefault realization - * of the secrets' cache. Can be eliminated if default cache isn't used. - * Define to 1 if you have the header file. - */ -#ifndef ZRTP_HAVE_STDIO_H -# define ZRTP_HAVE_STDIO_H 1 -#endif - -#ifndef ZRTP_HAVE_STDARG_H -# define ZRTP_HAVE_STDARG_H 1 -#endif - -/* - * Used by bnlib, but we don't need this on Symbian platform. - */ -#ifndef NO_ASSERT_H -# define NO_ASSERT_H 1 -#endif - -/* - * Used by bnlib. We have stdlib in Symbian platform - set it to 1. - */ -#ifndef NO_STDLIB_H -# define NO_STDLIB_H 0 -#endif - -#ifndef ZRTP_HAVE_SYS_TIME_H -# define ZRTP_HAVE_SYS_TIME_H 1 -#endif - - -#define ZRTP_HAVE_INT64_T 0 -#define ZRTP_HAVE_INT32_T 0 -#define ZRTP_HAVE_INT16_T 0 -#define ZRTP_HAVE_INT8_T 0 - -#define ZRTP_HAVE_UINT64_T 0 -#define ZRTP_HAVE_UINT32_T 0 -#define ZRTP_HAVE_UINT16_T 0 -#define ZRTP_HAVE_UINT8_T 0 - -#define ZRTP_BYTE_ORDER ZBO_BIG_ENDIAN - -#define SIZEOF_UNSIGNED_LONG 4 -#define SIZEOF_UNSIGNED_LONG_LONG 8 - -#define ZRTP_INLINE static __inline - -#endif /* ZRTP_WIN_CONFIG_H__ */ diff --git a/libs/libzrtp/include/zrtp_config_user.h b/libs/libzrtp/include/zrtp_config_user.h deleted file mode 100644 index 2989878d08..0000000000 --- a/libs/libzrtp/include/zrtp_config_user.h +++ /dev/null @@ -1,187 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -/** - * @file zrtp_config_user.h - * @brief libzrtp user configuration routine - */ - -#ifndef __ZRTP_CONFIG_USER_H__ -#define __ZRTP_CONFIG_USER_H__ - -/** - * \defgroup zrtp_config Build Configuration - * \{ - * - * As libzrtp based on few OS dependent components, target platform and byte-order must be defined - * on compilation level. libzrtp provides automatic platform and byte-order detection. Developer - * needs to define these parameters manually in very specific cases only. - * - * libzrtp originaly supports folowwing platforms: - * - 32/64-bit Windows platform; - * - Windows kernel mode; - * - Apple Mac OS X and iPhone; - * - Linux and *nix platforms; - * - Symbian OS. - * - * In order to specify platform manually, developer should define ZRTP_PLATFORM value. If - * ZRTP_PLATFORM is not defined - libzrtp will try to detect it automatically (see zrtp_config.h). - * - * In order to specify platform byte-order manually, developer should define ZRTP_BYTE_ORDER value. - * If ZRTP_BYTE_ORDER is not defined - libzrtp will try to detect it automatically. - */ - -/** \brief Constant to define ZRTP Windows 32-bit platform */ -#define ZP_WIN32 100 -/** \brief Constant to define ZRTP Windows 64-bit platform */ -#define ZP_WIN64 106 -/** \brief Constant to define ZRTP Windows Kernel mode */ -#define ZP_WIN32_KERNEL 101 -/** \brief Constant to define ZRTP Windows CE platform */ -#define ZP_WINCE 102 -/** \brief Constant to define Linux and *nux platforms */ -#define ZP_LINUX 103 -/** \brief Constant to define Mac OS X Platform */ -#define ZP_DARWIN 104 -/** \brief Constant to define Symbian OS */ -#define ZP_SYMBIAN 105 -/** \brief Constant to define ZRTP BSD platform */ -#define ZP_BSD 107 -/** \brief Constant to define ZRTP Android platform */ -#define ZP_ANDROID 108 - -/** \brief Define Platform manually there */ -//#undefine ZRTP_PLATFORM - - -/** \brief Constant to define Big Endian Platform */ -#define ZBO_BIG_ENDIAN 0x4321 -/** \brief Constant to define Little Endian Platform */ -#define ZBO_LITTLE_ENDIAN 0x1234 - -/** \brief Define Platform Byte Order manually there */ -//#define ZRTP_BYTE_ORDER - -/** \brief Defines the max length in bytes of a binary SAS digest */ -#ifndef ZRTP_SAS_DIGEST_LENGTH -#define ZRTP_SAS_DIGEST_LENGTH 32 -#endif - -/** \brief Defines maximum number of ZRTP streams within one session */ -#ifndef ZRTP_MAX_STREAMS_PER_SESSION -#define ZRTP_MAX_STREAMS_PER_SESSION 2 -#endif - -/** - * \brief Allows to build libzrtp against external srtp encryption library - * - * The latest version of libzrtp, starting with 0.3.9, supplies a built-in mechanism for SRTP - * encryption. However, if for some reason during development it is neccesary to use an external - * library, this flag must be set. - */ -#ifndef ZRTP_USE_EXTERN_SRTP -#define ZRTP_USE_EXTERN_SRTP 0 -#endif - -/** - * \brief Build libzrtp with minimum stack usage - * - * Set to 1 you build libzrtp in environment with strong limitation of stack size (Mobile platforms - * or in kernel mode). When this flag is set, some static data allocation will be changed to - * dynamic. The size of these data doesn't matter in "regular" PC applications, but on mobile - * platforms and in kernel mode, where the stack size is critical, libzrtp must work with optimized - * data. - */ -#ifndef ZRTP_USE_STACK_MINIM -#define ZRTP_USE_STACK_MINIM 0 -#endif - -#ifndef ZRTP_USE_BUILTIN -#define ZRTP_USE_BUILTIN 1 -#endif - -#ifndef ZRTP_USE_BUILTIN_SCEHDULER -#define ZRTP_USE_BUILTIN_SCEHDULER 1 -#endif - -#ifndef ZRTP_USE_BUILTIN_CACHE -# if defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WIN32) || defined(__TOS_WIN__) -# if defined(__BUILDMACHINE__) && (__BUILDMACHINE__ == WinDDK) -# define ZRTP_USE_BUILTIN_CACHE 1 -# else -# define ZRTP_USE_BUILTIN_CACHE 0 -# endif -# else -# define ZRTP_USE_BUILTIN_CACHE 1 -# endif -#endif - -#ifndef ZRTP_DEBUG_WITH_PJSIP -#define ZRTP_DEBUG_WITH_PJSIP 0 -#endif - -/** - * \brief Set to 1 if you build libzrtp against libzrtp-s. - * - * CSD-mode was implemented to support new ZRTP/S protocol designed by KHAMSA SA, Via Giacometti 1, - * CH-6900, Lugano - info@khamsa.ch. and Phil Zimmermann. ZRTP/S allows to make secure ZRTP calls - * over CSD channels. This option affect enterprise version of the library only. - */ -#ifndef ZRTP_BUILD_FOR_CSD -#define ZRTP_BUILD_FOR_CSD 0 -#endif - -/** - * \brief Maximum number of Preshared exchanges allowed since last retain secret update - * - * Preshared key exchange mode has lot of weaknesses comparing to DH. And one of them - lack of key - * continuity. Preshared mode is not recommended unless there is a strong necessity in using it - * (slow CPU device, low-latency channel). - * - * To minimize risk of using Preshared exchanges, libzrtp automatically limits number for preshared - * connection available for the same instance of RS value. In other words, libzrtp forces DH exchange - * every \c ZRTP_PRESHARED_MAX_ALLOWED calls. - */ -#define ZRTP_PRESHARED_MAX_ALLOWED 20 - -/** - * \brief Defines libzrtp log-level - * - * Defines maximum log level for libzrtp: log-level 3 contains debug messages, 2 - warnings and - * software errors, 1 - security issues. If you set this option to 0 - libzrtp will not debug - * output and will not even make a log function calls. - */ -#ifndef ZRTP_LOG_MAX_LEVEL -#define ZRTP_LOG_MAX_LEVEL 3 -#endif - -/** - * \brief Enables SRTP debug output - * - * \warning! ZRTP crypto debug logs may include security sensitive information and cause security - * weakness in the system. Enable SRTP debug logging only when it necessary. - */ -#ifndef ZRTP_DEBUG_SRTP_KEYS -#define ZRTP_DEBUG_SRTP_KEYS 0 -#endif - -/** - * \brief Enables ZRTP Crypto debug logging. - * - * \warning! ZRTP crypto debug logs may include security sensitive information and cause security - * weakness in the system. Enable ZRTP Protocol debug logging only when it necessary. - */ -#ifndef ZRTP_DEBUG_ZRTP_KEYS -#define ZRTP_DEBUG_ZRTP_KEYS 0 -#endif - - -/* \} */ - -#endif /*__ZRTP_CONFIG_USER_H__*/ diff --git a/libs/libzrtp/include/zrtp_config_win.h b/libs/libzrtp/include/zrtp_config_win.h deleted file mode 100644 index 15135a50bd..0000000000 --- a/libs/libzrtp/include/zrtp_config_win.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef ZRTP_WIN_CONFIG_H__ -#define ZRTP_WIN_CONFIG_H__ - -#define _CRT_SECURE_NO_WARNINGS 1 -#pragma warning(disable: 4068) - -#if !(defined(__BUILDMACHINE__) && __BUILDMACHINE__ == WinDDK) -#include -#endif - -/* - * Used to map system integer types to zrtp integer definitions. - * Define to 1 if you have the header file. - */ -#undef ZRTP_HAVE_INTTYPES_H - -#define ZRTP_HAVE_STRING_H 1 - -/* - * This header is needed for operations with binary file in deefault realization - * of the secrets' cache. Can be eliminated if default cache isn't used. - * Define to 1 if you have the header file. - */ -#ifndef ZRTP_HAVE_STDIO_H -# define ZRTP_HAVE_STDIO_H 1 -#endif - -#ifndef ZRTP_HAVE_STDARG_H -# define ZRTP_HAVE_STDARG_H 1 -#endif - -/* - * Used by bnlib, but we don't need this on Windows platform. - */ -#ifndef NO_ASSERT_H - #define NO_ASSERT_H 1 -#endif - -/* - * Used by bnlib. We have stdlib in any Windows platform - set it to 1. - */ -#ifndef NO_STDLIB_H - #define NO_STDLIB_H 0 -#endif - - -#define ZRTP_HAVE_INT64_T 0 -#define ZRTP_HAVE_INT32_T 0 -#define ZRTP_HAVE_INT16_T 0 -#define ZRTP_HAVE_INT8_T 0 - -#define ZRTP_HAVE_UINT64_T 0 -#define ZRTP_HAVE_UINT32_T 0 -#define ZRTP_HAVE_UINT16_T 0 -#define ZRTP_HAVE_UINT8_T 0 - -#define SIZEOF_UNSIGNED_LONG 4 -#define SIZEOF_UNSIGNED_LONG_LONG 8 - -#define ZRTP_INLINE static __inline - -#define ZRTP_VERSION "0.90" - - -#endif /* ZRTP_WIN_CONFIG_H__ */ diff --git a/libs/libzrtp/include/zrtp_crypto.h b/libs/libzrtp/include/zrtp_crypto.h deleted file mode 100644 index bb191bdedd..0000000000 --- a/libs/libzrtp/include/zrtp_crypto.h +++ /dev/null @@ -1,656 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_CRYPTO_H__ -#define __ZRTP_CRYPTO_H__ - -#include "bn.h" -#include "zrtp_types.h" -#include "zrtp_error.h" -#include "zrtp_engine.h" -#include "zrtp_config_user.h" -#include "zrtp_ec.h" - - - -/*! - * \defgroup crypto Library crypto-components - * \ingroup zrtp_dev - * - * This section describes functions and data types for managing crypto-components. - * All these functions and structures are used by the libZRTP kernel for the - * built-in crypt-components management. The developer has the option of - * implementing and integrating her own components into the library. This is not - * a full manual on creating crypto-components. Its purpose is only to elucidate - * the library functionality. - * - * The concept behind crypto components is similar to that of classes in object - * oriented programming. The components are defined as structures and - * manipulated by functions. Component attributes are stored in 'contexts', and - * are defined during initialization. Resources allocated at initialization are - * freed with the 'free' function. - * - * Components are divided into 5 functional groups (component types): - * - ciphers; - * - hash/hmac components; - * - public key exchange schemes; - * - components defined SRTP authentication scheme; - * - SAS calculation schemes. - * Within a group, components are distinguished by integer identifiers and by - * their defined functionality. So to fully identify a component, you need to - * know its type and its identifier. (For example an AES cipher with a 128 bit - * key is defined as: ZRTP_CC_CIPHER, zrtp_cipher_id_t::ZRTP_CIPHER_AES128). - * The high number of components means that every component must have a minimal - * set of attributes and functions: type identifier, and function initialization - * and deinitialization. The base type of all components is zrtp_comp_t. Every - * new component MUST start with definitions of this structure strictly in the - * given order. - * \warning - * Every crypto-component included in libZRTP was developed and tested by - * professionals. Its presence is functionally based. Using only the built-in - * components gives you 100% crypto-strength and the guarantee of the fully - * tested code. Never use your own components without strong reasons. If you - * have noticed the absence of any important component in the library, contact - * the developers. Reasonable offers will be considered for implementation in - * the following versions. - * \{ - */ - - -/*============================================================================*/ -/* Types of libZRTP crypto-components definitions */ -/*============================================================================*/ - -/*! - * \brief Enumeration for crypto-components types definition - */ -typedef enum zrtp_crypto_comp_t -{ - ZRTP_CC_HASH = 1, /*!< hash calculation schemes */ - ZRTP_CC_SAS = 2, /*!< short autentification scheme components */ - ZRTP_CC_CIPHER = 3, /*!< ciphers */ - ZRTP_CC_PKT = 4, /*!< public key exchange scheme */ - ZRTP_CC_ATL = 5, -}zrtp_crypto_comp_t; - - -/*! - * This ID with code 0 is used as an error signal by all crypto-components - * groups to indicate a wrongly defined component identifier. - */ -#define ZRTP_COMP_UNKN 0 - -/*! Defines types of hash functions */ -typedef enum zrtp_hash_id_t -{ - ZRTP_HASH_SHA256 = 1, - ZRTP_HASH_SHA384 = 2 -} zrtp_hash_id_t; - -/*! Defines types of ciphers */ -typedef enum zrtp_cipher_id_t -{ - ZRTP_CIPHER_AES128 = 1, - ZRTP_CIPHER_AES256 = 2 -} zrtp_cipher_id_t; - -/*! Defines SRTP authentication schemes */ -typedef enum zrtp_atl_id_t -{ - ZRTP_ATL_HS32 = 1, - ZRTP_ATL_HS80 = 2 -} zrtp_atl_id_t; - -/*! Defines public key exchange schemes */ -/* WARNING! don't change order of the PK components definitions! */ -typedef enum zrtp_pktype_id_t -{ - ZRTP_PKTYPE_PRESH = 1, - ZRTP_PKTYPE_MULT = 2, - ZRTP_PKTYPE_DH2048 = 3, - ZRTP_PKTYPE_EC256P = 4, - ZRTP_PKTYPE_DH3072 = 5, - ZRTP_PKTYPE_EC384P = 6, - ZRTP_PKTYPE_EC521P = 7, - ZRTP_PKTYPE_DH4096 = 8 -} zrtp_pktype_id_t; - -/*! Defines modes of short authentication scheme calculation */ -typedef enum zrtp_sas_id -{ - ZRTP_SAS_BASE32 = 1, - ZRTP_SAS_BASE256 = 2 -} zrtp_sas_id_t; - - -/*! - * \brief Global structure for all crypto-component types. - * \warning All developed components must have these 4 fields at the beginning. - */ -typedef struct zrtp_comp_t -{ - zrtp_uchar4_t type; /*!< 4-character symbolic name defined by ZRTP Draft */ - uint8_t id; /*!< Integer component identifier */ - zrtp_global_t* zrtp;/*!< ZRTP global context */ - - /*! - * \brief Component initiation function. - * This function body is for holding component initialization code. libzrtp - * calls the function before using a component, at its registration. If the - * component does not require additional actions for initialization, the - * value of this field can be NULL. - * \param self - self-pointer for fast access to structure data. - * \return - * - zrtp_status_ok - if initialized successfully; - * - one of \ref zrtp_status_t errors - if initialization failed. - */ - zrtp_status_t (*init)(void* self); - - /*! - * \brief Component deinitializtion function. - * This function body is for holding component deinitialization code and - * all code for releasing allocated resources. libzrtp calls the function - * at the end of component use, at context deinitialization. If the component - * does not require additional actions for deinitialization, the value of - * this field can be NULL. - * \param self - pointer to component structure for deinitialization. - * \return - * - zrtp_status_ok - if deinitialized successfully; - * - one of \ref zrtp_status_t errors - if deinitialization failed. - */ - zrtp_status_t (*free)(void* self); -} zrtp_comp_t; - - -/*! - * \brief Structure for defining the hash-value computing scheme - * The ZRTP context field zrtp_stream#_hash is initialized by the given type - * value and used for all hash calculations within the ZRTP sessions. Having - * implemented a structure of this type, it is possible to integrate new hash - * calculation schemes into libzrtp. - */ -struct zrtp_hash_t -{ - zrtp_comp_t base; - - /*! - * \brief Begin hash computation with update support. - * The following set of functions ( zrtp_hash#hash_begin, zrtp_hash#hash_update, - * zrtp_hash#hash_end) implements a standard hash calculation scheme with - * accumulation. The functions perform the required actions to start - * calculations and to allocate hash-contexts for preserving intermediate - * results and other required information. The allocated context will be - * passed-to by the subsequent calls zrtp_hash#hash_update and zrtp_hash#hash_end. - * \param self - self-pointer for fast access to structure data - * \return - * - pointer to allocated hash-context if successful; - * - NULL if error. - */ - void* (*hash_begin)(zrtp_hash_t *self); - - /*! - * \brief Process more input data for hash calculation - * This function is called in the hash-building chain to obtain additional - * data that it then processes and recalculates intermediate values. - * \param self - self-pointer for fast access to structure data; - * \param ctx - hash-context for current hash-value calculation; - * \param msg - additional source data for processing; - * \param length - length of additional data in bytes. - * \return - * - zrtp_status_ok - if successfully processed; - * - one of \ref zrtp_status_t errors - if error. - */ - zrtp_status_t (*hash_update)( zrtp_hash_t *self, - void *ctx, - const int8_t*msg, - uint32_t length ); - - /*! - * \brief Completes the computation of the current hash-value - * This function completes the computation of the hash-value with accumul. - * After completion, the hash-context previously allocated by the call to - * zrtp_hash#hash_begin, must be destroyed. The size of the calculated - * value must be kept in the parameter digest field zrtp_string#length. - * \param self - self-pointer for fast access to structure data; - * \param ctx - hash-context for current hash-value calculation; - * \param digest - buffer for storing result. - * \return - * - zrtp_status_ok - if computing finished successfully; - * - one of \ref zrtp_status_t errors - if error. - */ - zrtp_status_t (*hash_end)( zrtp_hash_t *self, - void *ctx, - zrtp_stringn_t *digest ); - - /*! - * \brief Calculate hash-value for current message - * This function implicitly calls the previous 3 functions. The only - * difference is that initial data for hash value construction is gathered - * in a single buffer and is passed to the function in the \c msg argument. - * The calculated value size must be stored in the digest zrtp_string#length - * parameter - * \param self - self-pointer for fast access to structure data; - * \param msg - source data buffer for hash computing; - * \param digest - buffer for storing result. - * \return - * - zrtp_status_ok - if computing finished successfully; - * - one of \ref zrtp_status_t errors - if error. - */ - zrtp_status_t (*hash)( zrtp_hash_t *self, - const zrtp_stringn_t *msg, - zrtp_stringn_t *digest ); - - /*! \brief Analogue of zrtp_hash::hash for C-string */ - zrtp_status_t (*hash_c)( zrtp_hash_t *self, - const char* msg, - uint32_t msg_len, - zrtp_stringn_t *digest ); - - /*! - * \brief HASH self-test. - * This function implements hmac self-tests using pre-defined test vectors. - * \param self - self-pointer for fast access to structure data; - * \return - * - zrtp_status_ok - if tests have been passed successfully; - * - one of \ref zrtp_status_t errors - if one or more tests have - * failed. - */ - zrtp_status_t (*hash_self_test)(zrtp_hash_t *self); - - - /*! - * \brief Begin HMAC computation with update support. - * The zrtp_hash#hmac_begin, zrtp_hash#hmac_update and zrtp_hash#hmac_end - * functions implement the HMAC calculation scheme with accumulation. The - * function performs all actions required before beginning the calculation - * and allocates a hash-context to store intermediate values. The allocated - * hash-context will be passed to successive hash_update and hash_end calls - * \param self - self-pointer for fast access to structure data; - * \param key - secret key for hmac-value protection. - * \return - * - pointer to allocated hmac-context if successful; - * - NULL - if error. - */ - void* (*hmac_begin)(zrtp_hash_t *self, const zrtp_stringn_t *key); - - /*! \brief Analogue of zrtp_hash::hmac_begin for C-string */ - void* (*hmac_begin_c)(zrtp_hash_t *self, const char *key, uint32_t length); - - /*! - * \brief Process more input data for HMAC calculation - * This function is called to transfer additional data to the HMAC hash- - * calculation. Processes new data and recalculates intermediate values. - * \param self - self-pointer for fast access to structure data; - * \param ctx - hmac-context for current hmac-value calculation; - * \param msg - additional source data for processing; - * \param length - additional data length in bytes. - * \return - * - zrtp_status_ok - if successfully processed; - * - one of \ref zrtp_status_t errors - if error. - */ - zrtp_status_t (*hmac_update)( zrtp_hash_t *self, - void *ctx, - const char *msg, - uint32_t length ); - - /*! - * \brief Complete current HMAC-value computation - * This function completes the hmac calculation. After the final iteration - * \a the hash_context allocated by zrtp_hash#hmac_begin is destroyed. The - * argument \c len holds the HMAC size. If the buffer contains more than \c - * length characters then only the first \c length are copied to \c digest. - * The calculated value size is stored in the digest parameter length. - * \param self - self-pointer for fast access to structure data; - * \param ctx - hmac-context for current hmac-value calculation; - * \param digest - buffer for storing result; - * \param len - required hmac-value size. - * \return - * - zrtp_status_ok - if computing finished successfully; - * - one of \ref zrtp_status_t errors - if error. - */ - zrtp_status_t (*hmac_end)( zrtp_hash_t *self, - void *ctx, - zrtp_stringn_t *digest, - uint32_t len); - - /*! - * \brief Calculate hmac-value for current message - * The function implicitly calls the previous 3 functions - * (zrtp_hash#hmac_begin, zrtp_hash#hmac_update and zrtp_hash#hmac_end). The - * difference is that the initial data for hash value construction is - * gathered in a single buffer and is passed to the function in the \a msg - * argument. The calculated value size must be stored in the \a digest - * zrtp_string#length parameter - * \param self - self-pointer for fast access to structure data; - * \param key - key for protecting hmac; - * \param msg - source data buffer for hash computing; - * \param digest - buffer for storing result. - * \return - * - zrtp_status_ok - if computing finished successfully; - * - one of \ref zrtp_status_t errors - if error. - */ - zrtp_status_t (*hmac)( zrtp_hash_t *self, - const zrtp_stringn_t *key, - const zrtp_stringn_t *msg, - zrtp_stringn_t *digest ); - - /*! \brief Analogue of zrtp_hash::hmac for C-string */ - zrtp_status_t (*hmac_c)( zrtp_hash_t *self, - const char *key, - const uint32_t key_len, - const char *msg, - const uint32_t msg_len, - zrtp_stringn_t *digest ); - - /*! - * \brief Truncated Hmac-calculation version - * This function acts just like the previous \a hmac except it returns the - * first \a length bytes of the calculated value in the digest. - * \param self - self-pointer for fast access to structure data; - * \param key - key for hmac protection; - * \param msg - source data buffer for hash computing; - * \param digest - buffer for storing result; - * \param len - required hmac-value size. - * \return - * - zrtp_status_ok - if computed successfully; - * - one of \ref zrtp_status_t errors - if error. - */ - zrtp_status_t (*hmac_truncated)( zrtp_hash_t *self, - const zrtp_stringn_t *key, - const zrtp_stringn_t *msg, - uint32_t len, - zrtp_stringn_t *digest ); - - /*! \brief Analogue of zrtp_hash::hmac_truncated for C-string */ - zrtp_status_t (*hmac_truncated_c)( zrtp_hash_t *self, - const char *key, - const uint32_t key_len, - const char *msg, - const uint32_t msg_len, - uint32_t necessary_len, - zrtp_stringn_t *digest ); - - /*! - * \brief HMAC self-test. - * This function implements the hmac self-tests using pre-defined test vectors. - * \param self - self-pointer for fast access to structure data; . - * \return - * - zrtp_status_ok - if tests have passed successfully; - * - one of \ref zrtp_status_t errors - if one or more tests have failed. - */ - zrtp_status_t (*hmac_self_test)( zrtp_hash_t *self); - - uint32_t digest_length; - uint32_t block_length; - mlist_t mlist; -}; - - -/*! - * \brief Structure for defining the SRTP authentication scheme - * The ZRTP context field zrtp_stream#_authtaglength is initialized by the - * given type value and used for SRTP encryption configuration. - */ -struct zrtp_auth_tag_length_t -{ - zrtp_comp_t base; - uint32_t tag_length; - mlist_t mlist; -}; - - -/** - * @brief Structure for describing the public key scheme - * The ZRTP context field zrtp_stream#_pubkeyscheme is initialized by the given - * type value and used by libzrtp in public key exchange. - */ -struct zrtp_pk_scheme_t -{ - zrtp_comp_t base; - - /** Generate Diffie-Hellman secret value and Calculate public value */ - zrtp_status_t (*initialize)( zrtp_pk_scheme_t *self, - zrtp_dh_crypto_context_t *dh_cc ); - - /** Calculate Diffie-Hellman result (ZRTP Internet Draft) */ - zrtp_status_t (*compute)( zrtp_pk_scheme_t *self, - zrtp_dh_crypto_context_t *dh_cc, - struct BigNum *dhresult, - struct BigNum *pv); - - /** Validate Diffie-Hellman public value */ - zrtp_status_t (*validate)(zrtp_pk_scheme_t *self, struct BigNum *pv); - - /** Diffie-Hellman self-test routine. */ - zrtp_status_t (*self_test)(zrtp_pk_scheme_t *self); - - /** Diffie-Hellman secret value size in bytes */ - uint32_t sv_length; - - /** Diffie-Hellman public value size in bytes */ - uint32_t pv_length; - - mlist_t mlist; -}; - - -/*! - * \brief Structure for defining SAS generation scheme - * The type of the ZRTP context's field zrtp_stream#_sasscheme. It is used - * to generate short authentication strings. LibZRTP functionality can be augmented - * with a new SAS scheme by supplying your own instance of zrtp_sas_scheme. - */ -struct zrtp_sas_scheme_t -{ - zrtp_comp_t base; - - /*! - * \brief Generate short authentication strings - * This function computes SAS values according to the specified scheme. It - * can use base32 or base256 algorithms. It stores the generated SAS values - * as a zrtp_sas_values_t structure (string and binary representation). - * \param self - self-pointer for fast access to structure data; - * \param session - ZRTP session context for additional data; - * \param hash - hmac component to be used for SAS calculation; - * \param is_transferred - if this flag is equal to 1 new SAS value should - * not be computed. It is already in sas->bin buffer and rendering only - * is required. - * \return - * - zrtp_status_ok - if generation successful; - * - one of zrtp_status_t errors - if generation failed. - */ - zrtp_status_t (*compute)( zrtp_sas_scheme_t *self, - zrtp_stream_t *stream, - zrtp_hash_t *hash, - uint8_t is_transferred ); - - mlist_t mlist; -}; - - -#include "aes.h" - -/*! Defines block cipher modes. */ -typedef enum zrtp_cipher_mode_values_t -{ - ZRTP_CIPHER_MODE_CTR = 1, - ZRTP_CIPHER_MODE_CFB = 2 -} zrtp_cipher_mode_values_t; - -typedef struct zrtp_cipher_mode_t -{ - uint8_t mode; -} zrtp_cipher_mode_t; - - -/* \brief Structure for cipher definition */ -struct zrtp_cipher_t -{ - zrtp_comp_t base; - - /*! - * \brief Start cipher. - * This function performs all actions necessary to allocate the cipher context - * for holding intermediate results and other required information. The allocated - * context should be related to the given key. It will be passed to the - * zrtp_cipher#set_iv, zrtp_cipher#encrypt and zrtp_cipher#decrypt functions. - * \param self - self-pointer for fast access to structure data; - * \param key - cipher key; - * \param extra_data - additional data necessary for cipher initialization; - * \param mode - cipher mode (one of \ref zrtp_cipher_mode_values_t values). - * \return - * - pointer to allocated cipher context; - * - NULL if error. - */ - void* (*start)( zrtp_cipher_t *self, - void *key, - void *extra_data, uint8_t mode ); - - /*! - * \brief Set Initialization Vector. - * Function resets the previous state of the cipher context and sets the new IV. - * \param self - self-pointer for fast access to structure data; - * \param cipher_ctx - cipher context for current key value; - * \param iv - new initialization vector value. - * \return - * - zrtp_status_ok - if vector has been set successfully; - * - one of \ref zrtp_status_t errors - if operation failed. - */ - zrtp_status_t (*set_iv)( zrtp_cipher_t *self, - void *cipher_ctx, - zrtp_v128_t *iv ); - - /*! - * \brief Encrypt data. - * Implements the encryption engine. - * \param self - self-pointer for fast access to structure data; - * \param cipher_ctx - cipher context for current key value; - * \param buf - buffer with data for encryption. If successful this - * buffer contains the resulting encrypted text; - * \param len - length of plain/encrypted data. - * \return - * - zrtp_status_ok - if data has been encrypted successfully; - * - one of \ref zrtp_status_t errors - if encryption failed. - */ - zrtp_status_t (*encrypt)( zrtp_cipher_t *self, - void *cipher_ctx, - unsigned char *buf, - int len ); - - /*! - * \brief Decrypt data. - * Implements the decryption engine. - * \param self - self-pointer for fast access to structure data; - * \param cipher_ctx - cipher context for current key value; - * \param buf - buffer with data for decryption. If successful this buffer - * contains the resulting plain text; - * \param len - length of encrypted/plain data. - * \return - * - zrtp_status_ok - if data has been decrypted successfully; - * - one of \ref zrtp_status_t errors - if decryption failed. - */ - zrtp_status_t (*decrypt)( zrtp_cipher_t *self, - void *cipher_ctx, - unsigned char *buf, - int len ); - - /*! - * \brief Cipher self-test. - * Implements cipher self-tests using pre-defined test vectors. - * \param self - self-pointer for fast access to structure data; - * \param mode - cipher mode (one of \ref zrtp_cipher_mode_values_t values). - * \return - * - zrtp_status_ok - if tests have passed successfully; - * - one of \ref zrtp_status_t errors - if one or more tests have failed. - */ - zrtp_status_t (*self_test)(zrtp_cipher_t *self, uint8_t mode); - - /*! - * \brief Destroy cipher context. - * Deallocs the cipher context previously allocated by a call to zrtp_cipher#start. - * \param self - self-pointer for fast access to structure data; - * \param cipher_ctx - cipher context for current key value. - * \return - * - zrtp_status_ok - if the context has been deallocated - * successfully; - * - one of \ref zrtp_status_t errors - if deallocation failed. - */ - zrtp_status_t (*stop)(zrtp_cipher_t *self, void* cipher_ctx); - - mlist_t mlist; -}; - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -/*============================================================================*/ -/* Crypto-components management Private part */ -/*============================================================================*/ - - -/*! - * \brief Destroy components buffer - * This function clears the list of components of the specified type, destroys - * all components and releases all allocated resources. It is used on libzrtp - * down. zrtp_comp_done calls zrtp_comp_t#free() if it isn't NULL. - * \param zrtp - the ZRTP global context where components are stored; - * \param type - specifies the component pool type for destroying. - * \return - * - zrtp_status_ok - if clearing successful; - * - zrtp_status_fail - if error. - */ -zrtp_status_t zrtp_comp_done(zrtp_crypto_comp_t type, zrtp_global_t* zrtp); - -/*! - * \brief Registering a new crypto-component - * Correctness of values in the necessary structure is the developer's - * responsibility. zrtp_comp_register calls zrtp_comp_t#init() if it isn't NULL. - * \param type - type of registred component; - * \param comp - registered crypto-component; - * \param zrtp - the ZRTP global context where components are stored. - * \return - * - zrtp_status_ok if registration successful; - * - zrtp_status_fail if error (conflicts with other components). - */ -zrtp_status_t zrtp_comp_register( zrtp_crypto_comp_t type, - void *comp, - zrtp_global_t* zrtp); - -/*! - * \brief Search component by ID - * \param type - type of sought component; - * \param zrtp - the ZRTP global context where components are stored; - * \param id - integer identifier of the necessary element. - * \return - * - the found structure if successful; - * - NULL if the element with the specified ID can't be found or - * other error. - */ -void* zrtp_comp_find( zrtp_crypto_comp_t type, - uint8_t id, - zrtp_global_t* zrtp); - - -/*! Converts a component's integer ID to a symbolic ZRTP name */ -char* zrtp_comp_id2type(zrtp_crypto_comp_t type, uint8_t id); - -/*! Converts a component's ZRTP symbolic name to an integer ID */ -uint8_t zrtp_comp_type2id(zrtp_crypto_comp_t type, char* name); - - -/*! \} */ - -#if defined(__cplusplus) -} -#endif - -#endif /*__ZRTP_CRYPTO_H__ */ diff --git a/libs/libzrtp/include/zrtp_ec.h b/libs/libzrtp/include/zrtp_ec.h deleted file mode 100644 index 75497979a5..0000000000 --- a/libs/libzrtp/include/zrtp_ec.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - */ - -#ifndef __ZRTP_CRYPTO_EC_H__ -#define __ZRTP_CRYPTO_EC_H__ - -#include "bn.h" - -#include "zrtp_config.h" -#include "zrtp_types.h" -#include "zrtp_error.h" - -#define ZRTP_MAXECBITS 521 -#define ZRTP_MAXECWORDS ((ZRTP_MAXECBITS+7)/8) - -typedef struct zrtp_ec_params -{ - unsigned ec_bits; /* # EC bits: 256, 384, 521 */ - uint8_t P_data[ZRTP_MAXECWORDS]; /* curve field prime */ - uint8_t n_data[ZRTP_MAXECWORDS]; /* curve order (# points) */ - uint8_t b_data[ZRTP_MAXECWORDS]; /* curve param, y^3 = x^2 -3x + b */ - uint8_t Gx_data[ZRTP_MAXECWORDS]; /* curve point, x coordinate */ - uint8_t Gy_data[ZRTP_MAXECWORDS]; /* curve point, y coordinate */ -} zrtp_ec_params_t; - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/*============================================================================*/ -/* Elliptic Curve library */ -/*============================================================================*/ - -int zrtp_ecAdd ( struct BigNum *rsltx, - struct BigNum *rslty, - struct BigNum *p1x, - struct BigNum *p1y, - struct BigNum *p2x, - struct BigNum *p2y, - struct BigNum *mod); - -int zrtp_ecMul ( struct BigNum *rsltx, - struct BigNum *rslty, - struct BigNum *mult, - struct BigNum *basex, - struct BigNum *basey, - struct BigNum *mod); - -zrtp_status_t zrtp_ec_random_point( zrtp_global_t *zrtp, - struct BigNum *P, - struct BigNum *n, - struct BigNum *Gx, - struct BigNum *Gy, - struct BigNum *pkx, - struct BigNum *pky, - struct BigNum *sv, - uint8_t *test_sv_data, - size_t test_sv_data_len); - -extern zrtp_status_t zrtp_ec_init_params(struct zrtp_ec_params *params, uint32_t bits ); - - -/* Useful bignum utility functions not defined in bignum library */ -int bnAddMod_ (struct BigNum *rslt, struct BigNum *n1, struct BigNum *mod); -int bnAddQMod_ (struct BigNum *rslt, unsigned n1, struct BigNum *mod); -int bnSubMod_ (struct BigNum *rslt, struct BigNum *n1, struct BigNum *mod); -int bnSubQMod_ (struct BigNum *rslt, unsigned n1, struct BigNum *mod); -int bnMulMod_ (struct BigNum *rslt, struct BigNum *n1, struct BigNum *n2, struct BigNum *mod); -int bnMulQMod_ (struct BigNum *rslt, struct BigNum *n1, unsigned n2, struct BigNum *mod); -int bnSquareMod_ (struct BigNum *rslt, struct BigNum *n1, struct BigNum *mod); - -#if defined(__cplusplus) -} -#endif - -#endif /* __ZRTP_CRYPTO_EC_H__ */ diff --git a/libs/libzrtp/include/zrtp_engine.h b/libs/libzrtp/include/zrtp_engine.h deleted file mode 100644 index a2c7e05de5..0000000000 --- a/libs/libzrtp/include/zrtp_engine.h +++ /dev/null @@ -1,387 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - - -#ifndef __ZRTP_ENGINE_H__ -#define __ZRTP_ENGINE_H__ - -#include "zrtp_config.h" -#include "zrtp_types.h" -#include "zrtp_crypto.h" - - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/** - * @defgroup engine_dev ZRTP Engine related types and functions - * @ingroup zrtp_dev - * \{ - */ - -#define ZRTP_IS_STREAM_DH(stream) \ -(stream->mode == ZRTP_STREAM_MODE_DH) - -#define ZRTP_IS_STREAM_FAST(stream) \ -(stream->mode != ZRTP_STREAM_MODE_DH) - -#define ZRTP_IS_STREAM_MULT(stream) \ -(stream->mode == ZRTP_STREAM_MODE_MULT) - -#define ZRTP_IS_STREAM_PRESH(stream) \ -(stream->mode == ZRTP_STREAM_MODE_PRESHARED) - - -/** - * @brief Test Passive Rule N1 - * A passive endpoint never sends a Commit message. Semi-active endpoint does - * not send a commit to a passive endpoint. - * Return 1 if the tast have been passed successfully and 0 in other case. - */ -#define ZRTP_PASSIVE1_TEST(stream) \ -( (ZRTP_LICENSE_MODE_UNLIMITED == stream->zrtp->lic_mode) || \ - ((ZRTP_LICENSE_MODE_ACTIVE == stream->zrtp->lic_mode) && (!stream->messages.peer_hello.pasive)) ) - -/** - * @brief Test Passive Rule N2 - * A passive phone, if acting as a SIP initiator (meaning it initiated the call), - * rejects all commit packets from everyone. - * Return 1 if the tast have been passed successfully and 0 in other case - */ -#define ZRTP_PASSIVE2_TEST(stream) \ -( !((ZRTP_LICENSE_MODE_PASSIVE == stream->zrtp->lic_mode) && \ - (stream->session->signaling_role == ZRTP_SIGNALING_ROLE_INITIATOR)) ) - -/** - * @brief Test Passive Rule N3 - * A passive phone rejects all commit messages from a PBX. - * Return 1 if the tast have been passed successfully and 0 in other case - */ -#define ZRTP_PASSIVE3_TEST(stream) \ -( !(!stream->zrtp->is_mitm && stream->peer_mitm_flag && \ - (ZRTP_LICENSE_MODE_PASSIVE == stream->zrtp->lic_mode)) ) - - -/*===========================================================================*/ -/* PROTOCOL Logic */ -/*===========================================================================*/ - -/** - * @brief Allocate ZRTP protocol structure - * Allocates and initializes all necessary data according to the protocol mode. - * Initializes required DH crypto context info and generates secret IDs. - * @param stream - stream context in which protocol should be allocated; - * @param is_initiator - defines protocol type (1 - initiator, 0 - responder). - * @exception SOFTWARE exceptions. - */ -zrtp_status_t _zrtp_protocol_init( zrtp_stream_t *stream, - uint8_t is_initiator, - zrtp_protocol_t **proto); - -/** - * @brief Release protocol structure - * Stops all replay tasks, clears all crypto sources and SRTP engine, and - * releases memory. The protocol should be destroyed on: stream closing, or - * switching to CLEAR or ERROR states. - */ -void _zrtp_protocol_destroy(zrtp_protocol_t *proto); - -/** - * @brief Encrypts RTP/RTCP media - * After switching to Secure, the protocol structure is able to encrypt - * media using the SRTP crypto-engine. - * @param self - self-pointer to protocol instance; - * @param packet - media packet for encryption; - * @param is_rtp - defines type of media for encryption; value equal to 1 - * means RTP packet, 0 - RTCP. - * @return - * - zrtp_status_ok - if successfully encrypted; - * - one of zrtp_status_t errors otherwise. - */ -zrtp_status_t _zrtp_protocol_encrypt( zrtp_protocol_t *proto, - zrtp_rtp_info_t *packet, - uint8_t is_rtp); - -/** - * @brief Decrypts RTP/RTCP media - * After switching to Secure, the protocol structure is able to decrypt - * media using the SRTP crypto-engine. - * @param self - self-pointer to protocol instance; - * @param packet - media packet for decryption; - * @param is_rtp - defines type of media for decryption; value equal to 1 - * means RTP packet, 0 - RTCP. - * @return - * - zrtp_status_ok - if successfully decrypted; - * - one of zrtp_status_t errors otherwise. - */ -zrtp_status_t _zrtp_protocol_decrypt( zrtp_protocol_t *self, - zrtp_rtp_info_t *packet, - uint8_t is_rtp); - - -/*===========================================================================*/ -/* CRTPTO Utilities */ -/*===========================================================================*/ - -/** - * ZRTP KDF function. - * KDF(KI, Label, Context, L) = HMAC(KI, i | Label | 0x00 | Context | L). See - * Section "4.5.1. The ZRTP Key Derivation Function" in ZRTP RFC for more info. - * @param stream - used to obtain negotiated HMAC function and other parameters; - * @param ki- secret key derivation key that is unknown to the wiretapper - * (for example, s0); - * @param label - string of nonzero octets that identifies the purpose for the - * derived keying material; - * @param context - includes ZIDi, ZIDr, and some optional nonce material; - * @param length - needed digest length. (The output of the KDF is truncated to - * the leftmost length bits); - * @param digest - destination buffer. - */ -zrtp_status_t _zrtp_kdf( zrtp_stream_t* stream, - zrtp_stringn_t* ki, - zrtp_stringn_t* label, - zrtp_stringn_t* context, - uint32_t length, - zrtp_stringn_t* digest); - -/*! - * \brief Allocate shared secret structure - * This function allocates memory for a zrtp_shared_secret_t and initializes - * the secret value using a zrtp_fill_shared_secret() function call. Used in - * protocol allocating. - * \param session - ZRTP session for access to global data. - * \return - * - allocated secrets - on success; - * - NULL - if allocation fails. - */ -zrtp_shared_secret_t *_zrtp_alloc_shared_secret(zrtp_session_t* session); - -/*! - * \brief Restores secrets from the cache - * Uploads retained secrets from the cache and initializes secret flags. If - * the secret has expired (is_expired flag is set), its value will be randomly - * regenerated. _zrtp_prepare_secrets() is called after the discovery phase on - * the setting up the very first stream. After secrets are uploaded the - * zrtp_secrets_t#_is_ready flag is enabled to prevent secrets from reinitialization - * on setting up the next stream. - * \param session - ZRTP session in which secrets should be restored. - * - zrtp_status_ok - if secrets were restored successfully; - * - one of zrtp_status_t errors in case of failure. - */ -zrtp_status_t _zrtp_prepare_secrets(zrtp_session_t* session); - -/** - * @brief Validate confirm chmac message. - * In case of chmac failure it switches to Initiating Error state and generate - * ZRTP_EVENT_WRONG_MESSAGE_HMAC security event. - * @return - * -1 - in case of error and 0 - on success. - */ -int _zrtp_validate_message_hmac(zrtp_stream_t *stream, zrtp_msg_hdr_t* msg2check, char* hmackey); - -/** - * @brief Computes preshared key using available secrets. - * hash(len(rs1) | rs1 | len(auxsecret) | auxsecret | len(pbxsecret) | pbxsecret) - * Result key stored in key variable, if key_id not NULL - hmac - * of the preshared_key will be stored. - * return - * - zrtp_status_ok on success and one of libzrtp errors in case of failure - */ -zrtp_status_t _zrtp_compute_preshared_key( zrtp_session_t *session, - zrtp_stringn_t* rs1, - zrtp_stringn_t* auxs, - zrtp_stringn_t* pbxs, - zrtp_stringn_t* key, - zrtp_stringn_t* key_id); - -/** @brief Perform Key generation according to ZRTp RFC sec. 5.6 */ -zrtp_status_t _zrtp_set_public_value(zrtp_stream_t *stream, int is_initiator); - - -/*===========================================================================*/ -/* PROTOCOL Utilites */ -/*===========================================================================*/ - -/*! - * \brief Check availability to start stream (DH or Preshared) - * The ZRTP specification says that only one DH stream can be run at a time between - * two ZRTP endpoints. So _zrtp_can_start_stream(DH) looks over all sessions - * between two ZIDs and if any other stream is running it denies the start of - * another DH stream in parallel. Although the ZRTP standard says that Preshared - * or Multistream stream can't be run in parallel with DH streams between two - * ZRTP endpoints. So _zrtp_can_start_stream(PRESH) looks over all sessions between - * two ZIDs and if any other DH stream is running it denies the start of - * Preshared/Multistream stream in parallel. All operations with sessions and - * streams are protected by mutexes. Call this function every time before starting - * "initiating secure" process. For internal use only. - * \sa "break the tie schemes" internal document. - * \param stream - ZRTP stream which going to be started; - * \param conc - in this variable _zrtp_can_start_stream() returns pointer to the - * concurrent DH stream if it's in progress. It's used in "breaking the tie" - * scheme. - * \param mode - stream mode. - * \return - * - 1 if stream can be started; - * - 0 - if stream can't be started and should wait for concurrent stream - * establishment. - */ -int _zrtp_can_start_stream( zrtp_stream_t* stream, - zrtp_stream_t** conc, - zrtp_stream_mode_t mode); - -/** Return ZRTP Stream mode which should be used for current stream. */ -zrtp_stream_mode_t _zrtp_define_stream_mode(zrtp_stream_t* stream); - -/*! - * \brief Chooses the best crypto component of the given type - * Selects the crypto component according to the local initiator's profile and - * the remote responder's Hello. - * \param profile - local profile; - * \param peer_hello - Hello packet, received from the remote peer; - * \param type - type of the crypto component to be chosen. - * \return: - * - identifier of the chosen component (according to type); - * - ZRTP_COMP_UNKN in case of error. - */ -uint8_t _zrtp_choose_best_comp( zrtp_profile_t* profile, - zrtp_packet_Hello_t* peer_hello, - zrtp_crypto_comp_t type); - -/*! - * \brief Computes replay timeouts - * This function computes messages replays schedule. There are some recommended - * values by ZRTP specification, but in some network environments values may be - * sligh different - */ -uint32_t _zrtp_get_timeout(uint32_t curr_timeout, zrtp_msg_type_t msg); - - -/*! - * \brief Terminates retransmission task - * This function is a wrapper around zrtp_cancele_send_packet_later() which - * unsets the zrtp_retry_task_t#_is_enabled flag to prevent the scheduler from - * re-adding tasks after their termination. - */ -void _zrtp_cancel_send_packet_later( zrtp_stream_t* stream, - zrtp_msg_type_t type); - -/*! - * \brief state switcher - * This function changes stream state to \c state, makes a backup of the previous - * state at zrtp_stream_t#_prev_state and prints debug information. - * \warning Don't change the stream state directly. Use this function. - * \param stream - ZRTP stream to be changed; - * \param state - new state. - */ -void _zrtp_change_state( zrtp_stream_t* stream, zrtp_state_t state); - - -/*===========================================================================*/ -/* Shared STATE-MACHINE Routine */ -/*===========================================================================*/ - -// TODO: clean this up -zrtp_status_t _zrtp_machine_enter_pendingsecure(zrtp_stream_t* stream, zrtp_rtp_info_t* commit); -zrtp_status_t _zrtp_machine_enter_initiatingsecure(zrtp_stream_t* stream); -zrtp_status_t _zrtp_machine_enter_secure(zrtp_stream_t* stream); -zrtp_status_t _zrtp_machine_enter_pendingclear(zrtp_stream_t* stream); -zrtp_status_t _zrtp_machine_enter_initiatingerror( zrtp_stream_t *stream, - zrtp_protocol_error_t code, - uint8_t notif); - -zrtp_status_t _zrtp_machine_create_confirm(zrtp_stream_t *stream, zrtp_packet_Confirm_t* confirm); -zrtp_status_t _zrtp_machine_process_confirm(zrtp_stream_t *stream, zrtp_packet_Confirm_t *confirm); -zrtp_status_t _zrtp_machine_process_goclear(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); - -zrtp_status_t _zrtp_machine_start_initiating_secure(zrtp_stream_t *stream); -zrtp_statemachine_type_t _zrtp_machine_preparse_commit(zrtp_stream_t *stream, zrtp_rtp_info_t* packet); - - -/*===========================================================================*/ -/* PARSERS */ -/*===========================================================================*/ - -/*! - * \brief Prepare RTP/ZRTP media packet for the further processing. - * This function defines the packet type, parses SSRC and makes the sequence - * number implicit. If it is a ZRTP message, packet length correctness and CRC - * are checked as well. - * \param stream - ZRTP stream associated with this packet; - * \param packet - packet for preparing; - * \param length - packet length; - * \param info - resulting packet structure; - * \param is_input - 1 - assumes incoming and 0 - outgoing packet direction. - */ -zrtp_status_t _zrtp_packet_preparse( zrtp_stream_t* stream, - char* packet, - uint32_t *length, - zrtp_rtp_info_t* info, - uint8_t is_input); - -/*! - * \brief Fills ZRTP message header and computes messages HMAC - * _zrtp_packet_fill_msg_hdr() prepares a ZRTP message header for sending. It calculates - * the total message length in 4-byte words and fills the message type block. - * \param stream - stream within in the operation will be performed - * \param type - ZRTP message type; - * \param body_length - message body length (without header); - * \param hdr - message ZRTP header - * \return - * - zrtp_status_ok - if success; - * - zrtp_status_bad_param - if message \c type is unknown. - */ -zrtp_status_t _zrtp_packet_fill_msg_hdr( zrtp_stream_t *stream, - zrtp_msg_type_t type, - uint16_t body_length, - zrtp_msg_hdr_t *hdr); - -/** - * @brief Sends ZRTP message onto the network - * _zrtp_packet_send_message constructs a ZRTP header and prepares packet for sending, - * computes CRC and injects the packet into the network using the interface - * function zrtp_send_rtp(). - * @param ctx - ZRTP stream context; - * @param type - packet type to construct primitive ZRTP messages; - * @param message - ZRTP message for sending. - * @return - * - 0 - if sent successfully; - * - -1 - if error. - */ -int _zrtp_packet_send_message( zrtp_stream_t *stream, - zrtp_msg_type_t type, - const void *message); - -/** @brief Returns ZRTP message type by symbolic name in header. */ -zrtp_msg_type_t _zrtp_packet_get_type(ZRTP_UNALIGNED(zrtp_rtp_hdr_t)*hdr, uint32_t length); - -/** - * @brief Insert CRC32 to ZRTP packets - * This function computes the 32 bit ZRTP packet checksum according to RFC 3309. - * As specified at ZRTP RFC, CRC32 is appended to the end of the extension for every ZRTP packet. - * @param packet - zrtp packet wrapper structure. - */ -void _zrtp_packet_insert_crc(char* packet, uint32_t length); - -/** - * @brief Validate ZRTP packet CRC - * @return - * - 0 if correct CRC; - * - -1 if CRC validation failed. - */ -int8_t _zrtp_packet_validate_crc(const char* packet, uint32_t length); - -/* \} */ - -#if defined(__cplusplus) -} -#endif - -#endif /* __ZRTP_ENGINE_H__ */ diff --git a/libs/libzrtp/include/zrtp_error.h b/libs/libzrtp/include/zrtp_error.h deleted file mode 100644 index a50b68ba9f..0000000000 --- a/libs/libzrtp/include/zrtp_error.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - - -/** - * \file zrtp_error.h - * \brief libzrtp errors definitions - */ - -#ifndef __ZRTP_ERROR_H__ -#define __ZRTP_ERROR_H__ - -#include "zrtp_config.h" - -/** - * \defgroup zrtp_errors Libzrtp Error Definitions - * - * In this section the ZRTP protocol error codes and the library internal errors are defined. - * - * When ZRTP Protocl error detected, zrtp_callback_event_t#on_zrtp_security_event is called and - * zrtp_session_info_t#last_error contains error code. - * \{ - */ - -/** - * \brief Define protocol error codes according to ZRTP RFC sec. 5.9 - */ -typedef enum zrtp_protocol_error_t -{ - zrtp_error_unknown = 0, - zrtp_error_timeout = 1, - - zrtp_error_invalid_packet = 0x10, /** Malformed packet (CRC OK, but wrong structure) */ - zrtp_error_software = 0x20, /** Critical software error */ - zrtp_error_version = 0x30, /** Unsupported ZRTP version */ - zrtp_error_hello_mistmatch = 0x40, /** Hello components mismatch */ - - zrtp_error_hash_unsp = 0x51, /** Hash type not supported */ - zrtp_error_cipher_unsp = 0x52, /** Cipher type not supported */ - zrtp_error_pktype_unsp = 0x53, /** Public key exchange not supported */ - zrtp_error_auth_unsp = 0x54, /** SRTP auth. tag not supported */ - zrtp_error_sas_unsp = 0x55, /** SAS scheme not supported */ - zrtp_error_no_secret = 0x56, /** No shared secret available, Preshared mode required */ - - zrtp_error_possible_mitm1 = 0x61, /** DH Error: bad pvi or pvr ( == 1, 0, or p-1) */ - zrtp_error_possible_mitm2 = 0x62, /** DH Error: hvi != hashed data */ - zrtp_error_possible_mitm3 = 0x63, /** Received relayed SAS from untrusted MiTM */ - - zrtp_error_auth_decrypt = 0x70, /** Auth. Error: Bad Confirm pkt HMAC */ - zrtp_error_nonse_reuse = 0x80, /** Nonce reuse */ - zrtp_error_equal_zid = 0x90, /** Equal ZIDs in Hello */ - zrtp_error_service_unavail = 0xA0, /** Service unavailable */ - zrtp_error_goclear_unsp = 0x100,/** GoClear packet received, but not allowed */ - - zrtp_error_wrong_zid = 0x202, /** ZID received in new Hello doesn't equal to ZID from the previous stream */ - zrtp_error_wrong_meshmac = 0x203, /** Message HMAC doesn't match with pre-received one */ - zrtp_error_count -} zrtp_protocol_error_t; - -/** - * \brief libzrtp functions statuses. - * - * Note that the value of zrtp_status_ok is equal to zero. This can simplify error checking - * somewhat. - */ -typedef enum zrtp_status_t -{ - zrtp_status_ok = 0, /** OK status */ - zrtp_status_fail = 1, /** General, unspecified failure */ - zrtp_status_bad_param = 2, /** Wrong, unsupported parameter */ - zrtp_status_alloc_fail = 3, /** Fail allocate memory */ - zrtp_status_auth_fail = 4, /** SRTP authentication failure */ - zrtp_status_cipher_fail = 5, /** Cipher failure on RTP encrypt/decrypt */ - zrtp_status_algo_fail = 6, /** General Crypto Algorithm failure */ - zrtp_status_key_expired = 7, /** SRTP can't use key any longer */ - zrtp_status_buffer_size = 8, /** Input buffer too small */ - zrtp_status_drop = 9, /** Packet process DROP status */ - zrtp_status_open_fail = 10, /** Failed to open file/device */ - zrtp_status_read_fail = 11, /** Unable to read data from the file/stream */ - zrtp_status_write_fail = 12, /** Unable to write to the file/stream */ - zrtp_status_old_pkt = 13, /** SRTP packet is out of sliding window */ - zrtp_status_rp_fail = 14, /** RTP replay protection failed */ - zrtp_status_zrp_fail = 15, /** ZRTP replay protection failed */ - zrtp_status_crc_fail = 16, /** ZRTP packet CRC is wrong */ - zrtp_status_rng_fail = 17, /** Can't generate random value */ - zrtp_status_wrong_state = 18, /** Illegal operation in current state */ - zrtp_status_attack = 19, /** Attack detected */ - zrtp_status_notavailable = 20, /** Function is not available in current configuration */ - zrtp_status_count = 21 -} zrtp_status_t; - -/** \} */ - -/** \manonly */ - -#define ZRTP_MIM2_WARNING_STR \ - "Possible Man-In-The-Middle-Attack! Switching to state Error\n"\ - "because a packet arrived that was ZRTP_DHPART2, but contained\n"\ - "a g^y that didn't match the previous ZRTP_COMMIT.\n" - -#define ZRTP_MITM1_WARNING_STR "DH validating failed. (pvi is 1 or p-1), aborted\n" - -#define ZRTP_VERIFIED_INIT_WARNING_STR \ - "Falling back to cleartext because a packet arrived that was\n"\ - "ZRTP_CONFIRM1, but which couldn't be verified - the sender must have a different\n"\ - "shared secret than we have.\n" - -#define ZRTP_VERIFIED_RESP_WARNING_STR \ - "Falling back to cleartext because a packet arrived that was ZRTP_CONFIRM2,\n"\ - " but which couldn't be verified - the sender must have a different shared secret than we have.\n" - -#define ZRTP_EQUAL_ZID_WARNING_STR \ - "Received a ZRTP_HELLO packet with the same ZRTP ID that we have.\n"\ - " This is likely due to a bug in the software. Ignoring the ZRTP_HELLO\n"\ - " packet, therefore this call cannot be encrypted.\n" - -#define ZRTP_UNSUPPORTED_COMP_WARNING_STR \ - " Received ZRTP_HELLO packet with an algorithms field which had a\n"\ - " list of hashes that didn't include any of our supported hashes. Ignoring\n"\ - " the ZRTP_HELLO packet, therefore this call cannot be encrypted.\n" - -#define ZRTP_NOT_UNIQUE_NONCE_WARNING_STR \ - " Received COMMIT with hash value already used in another stream within this ZRTP session\n" - -#define ZRTP_RELAYED_SAS_FROM_NONMITM_STR \ -" Received SAS Relaying message from endpoint which haven't introduced as MiTM.\n" - -/** \endmanonly */ - -#endif /* __ZRTP_ERROR_H__ */ diff --git a/libs/libzrtp/include/zrtp_iface.h b/libs/libzrtp/include/zrtp_iface.h deleted file mode 100644 index e8de27fb3b..0000000000 --- a/libs/libzrtp/include/zrtp_iface.h +++ /dev/null @@ -1,692 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - - - -/** - * \file zrtp_iface.h - * \brief libzrtp product-dependent functions - */ - -#ifndef __ZRTP_IFACE_H__ -#define __ZRTP_IFACE_H__ - -#include "zrtp_config.h" -#include "zrtp_base.h" -#include "zrtp_string.h" -#include "zrtp_error.h" -#include "zrtp_iface_system.h" - - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/*======================================================================*/ -/* libzrtp interface: Cache */ -/*======================================================================*/ - -/*! - * \defgroup zrtp_iface_cache ZRTP Cache - * \ingroup zrtp_iface - * - * The secret cache implementation should have a two-layer structure: each pair of ZIDs should have - * a relevant pair of secrets (current and previous). In addition to the value of the secret, the - * cache should contain: verification flag, last usage time-stamp and cache TTL value. - * - * The simplest secret cache scheme implementation is: - * \code - * [local_ZID][remote_ZID][curr_cache][prev_cache][verified][used at][cache ttl] - * \endcode - * \warning - * Libzrtp doen't provide synchronization for cache read/write operation. Cache is not thread safe - * by default. Implementor must take care of synchronization inside his implementation. - * - * For more information see corresponding section \ref XXX. Samples can be found at \ref XXX - * (\c zrtp_iface_builtin.h, \c zrtp_iface_cache.c) - * \{ - */ - -/** - * @brief Data types and functions related to shared secrets. - */ -typedef struct zrtp_callback_cache_t -{ - /** - * \brief Cache initialization. - * - * libzrtp calls this function before start using cache routine at zrtp_init(). - * - * \param zrtp - libzrtp global context; - * \sa zrtp_callback_cache_t#on_down() - */ - zrtp_status_t (*on_init)(zrtp_global_t* zrtp); - - /** - * \brief Cache deinitialization. - * - * libzrtp calls this function when zrtp cache is no longer needed at zrtp_down(). - * \sa zrtp_callback_cache_t#on_init() - */ - void (*on_down)(); - - /** - * \brief Add/Update cache value - * - * Interface function for entering the retained secret to the cache. This function should - * guarantee permanent storage in the cache. The implementation algorithm is the following: - * - if the entry associated with a given pair of ZIDs does not exist, the value should be - * stored in cache. - * - if the entry already exists, the current secret value becomes stored as the previous one. - * The new value becomes stored as the current one. Besides rss->value a timestamp - * (rss->lastused_at) and cache TTL(rss->ttl) should be updated. - * - * \param one_zid - ZID of one side; - * \param another_zid - ZID of the other side; - * \param rss - a structure storing the value of the secret that needs to be saved. - * \return - * - zrtp_status_ok if operation is successful; - * - some error code from \ref zrtp_status_t in case of error. - * \sa zrtp_callback_cache_t#on_get - */ - zrtp_status_t (*on_put)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_shared_secret_t *rss); - - /** - * \brief Return secret cache associated with specified pair of ZIDs. - * - * This function should return the secret associated with the specified pair of ZIDs. In - * addition to the secret value, TTL (rss->ttl) and cache timestamp (rss->lastused_at) value - * should be also returned. - * - * \param one_zid - one side's ZID; - * \param another_zid - the other side's ZID; - * \param prev_requested - if this parameter value is 1, the function should return the previous - * secret's value. If this parameter value is 0, the function should return the current - * secret's value; - * \param rss - structure that needs to be filled in. - * \return - * - zrtp_status_ok - if operation is successful; - * - zrtp_status_fail - if the secret cannot be found; - * - some error code from zrtp_status_t if an error occurred. - * \sa zrtp_callback_cache_t#on_put - */ - zrtp_status_t (*on_get)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_shared_secret_t *rss, - int prev_requested); - - /** - * \brief Set/clear cache verification flag - * - * This function should set the secret verification flag associated with a pair of ZIDs. - * \warning - * For internal use only. To change the verification flag from the user space use the - * zrtp_verified_set() function. - * - * \param one_zid - first ZID for cache identification; - * \param another_zid - second ZID for cache identification; - * \param verified - verification flag (value can be 0 or 1). - * \return - * - zrtp_status_ok if flag is successfully modified; - * - zrtp_status_fail if the secret cannot be found; - * - some other error code from \ref zrtp_status_t if another error occurred. - */ - zrtp_status_t (*on_set_verified)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t verified); - - /** - * \brief Return cache verification flag - * - * This function return the secret verification flag associated with a pair of ZIDs. - * - * \param one_zid - first ZID for cache identification; - * \param another_zid - second ZID for cache identification; - * \param verified - verification flag to be filled in - * \return - * - zrtp_status_ok if flag is successfully returned; - * - zrtp_status_fail if the secret cannot be found; - * - some other error code from \ref zrtp_status_t if another error occurred. - */ - zrtp_status_t (*on_get_verified)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t* verified); - - /** - * \brief Should set Secure Since cache aparemeter to current date and time - * - * This function is optional and may be ommited. - * - * \param one_zid - first ZID for cache identification; - * \param another_zid - second ZID for cache identification; - * \return - * - zrtp_status_ok if the oprtation finished sucessfully. - * - some other error code from \ref zrtp_status_t if another error occurred. - */ - zrtp_status_t (*on_reset_since)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid); - - /** - * \brief Add/Update cache value for MiTM endpoint - * - * This function is analogy to zrtp_callback_cache_t#on_put but for MiTM endpoint. - * \todo Add more detail description - * \sa zrtp_callback_cache_t#on_put zrtp_callback_cache_t#on_get_mitm - */ - zrtp_status_t (*on_put_mitm)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_shared_secret_t *rss); - - /** - * \brief Return secret cache for MiTM endpoint - * - * This function is analogy to zrtp_callback_cache_t#on_get but for MiTM endpoint. - * \todo Add more detail description - * \sa zrtp_callback_cache_t#on_get zrtp_callback_cache_t#on_put_mitm - */ - zrtp_status_t (*on_get_mitm)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_shared_secret_t *rss); - - /** - * \brief Return Preshared calls counter - * - * This function should return the preshared calls counter associated with a pair of ZIDs. - * - * \param one_zid - first ZID for cache identification; - * \param another_zid - second ZID for cache identification; - * \param counter - preshared calls counter to be filled in - * \return - * - zrtp_status_ok if counter is successfully returned; - * - zrtp_status_fail if the secret cannot be found; - * - some other error code from \ref zrtp_status_t if another error occurred. - */ - zrtp_status_t (*on_presh_counter_get)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t* counter); - - /** - * \brief Increase/reset Preshared streams counter made between two endpoints (ZIDs) - * - * This function should set the preshared calls counter associated with a pair of ZIDs. - * Function is optional and should be implemented if your prodict uses Preshared keys exchange. - * - * \param one_zid - first ZID for; - * \param another_zid - second ZID; - * \param counter - Preshared calls counter. - * \return - * - zrtp_status_ok if the counter is successfully modified; - * - zrtp_status_fail if the secret cannot be found; - * - some other error code from \ref zrtp_status_t if another error occurred. - */ - zrtp_status_t (*on_presh_counter_set)( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t counter); -} zrtp_callback_cache_t; - - -/** \} */ - -/*======================================================================*/ -/* libzrtp interface: Scheduler */ -/*======================================================================*/ - -/** - * \defgroup zrtp_iface_scheduler ZRTP Delay Calls - * \ingroup zrtp_iface - * - * Algorithm used in the scheduled call module is described in detail in section \ref XXX of the - * developer's guide documentation. Technical details of this function's implementation follows. - * - * For more information see corresponding section \ref XXX. Samples can be found at \ref XXX - * (\c zrtp_iface_builtin.h, \c zrtp_iface_scheduler.c) - * \{ - */ - -/** \brief ZRTP Delays Calls signature. */ -typedef void (*zrtp_call_callback_t)(zrtp_stream_t*, zrtp_retry_task_t*); - -/** - * @brief Delay Call wrapper - */ -struct zrtp_retry_task_t -{ - /** \brief Task action callback */ - zrtp_call_callback_t callback; - - /** \brief Timeout before call in milliseconds */ - zrtp_time_t timeout; - - /** - * \brief User data pointer. - * - * Pointer to the user data. This pointer can be used for fast access to some additional data - * attached to this task by the user application. - */ - void* usr_data; - - - // TODO: hide these elements - /** - * \brief Task activity flag. - * - * Libzrtp unsets this flag on task canceling. It prevents the scheduler engine from re-adding - * an already canceled task. Callback handlers skip passive tasks. - * \note - * For internal use only. Don't' modify this field in implementation. - */ - uint8_t _is_enabled; - - /** - * \brief Number of task retries. - * - * Every handler that attempts the task increases it by one. When the limit is reached the - * scheduler should stop retries and performs a specified action - generally raises an error. - * \note - * For internal use only. Don't' modify this field in implementation. - */ - uint32_t _retrys; - - /** - * \brief Task Busy flag. - * - * Built-in cache implementation uses this flag to protect task from being removed during the - * callback. - * - * Default cache implementation "locks" this flag before call zrtp_retry_task#callback - * and "unlocks" when the call is performed. zrtp_callback_scheduler_t#on_wait_call_later exits - * when there are no callbacks in progress - no tasks with \c _is_busy enabled. - */ - uint8_t _is_busy; -}; - -/** - * @brief Delay Calls callbacks - */ -typedef struct zrtp_callback_scheduler_t -{ - /** - * \brief Delay Calls initialization. - * - * libzrtp calls this function before start using scheduler routine at zrtp_init(). - * - * \param zrtp - libzrtp global context; - * \sa zrtp_callback_scheduler_t#on_down() - */ - zrtp_status_t (*on_init)(zrtp_global_t* zrtp); - - /** - * \brief Delay Calls deinitialization. - * - * libzrtp calls this function when zrtp scheduler is no longer needed at zrtp_down(). - * \sa zrtp_callback_scheduler_t#on_init() - */ - void (*on_down)(); - - /** - * \brief Interface for performing delay call - * - * This function should add delay call request (\c task) to the processing queue. When the - * zrtp_retry_task_t#timeout is expired, scheduler should call zrtp_retry_task_t#callback and - * remove tasks from the processing queue. - * - * \param stream - stream context for processing the callback function; - * \param task - task structure that should be processed. - * \sa zrtp_callback_scheduler_t#on_cancel_call_later - */ - void (*on_call_later)(zrtp_stream_t *stream, zrtp_retry_task_t* task); - - /** - * \brief Interface for canceling a delay calls - * - * This function cancels delay call if it still in the processing queue. The algorithm is the - * following: - * - If there is a specified task for a specified stream, this task should be deleted. - * - If the \c task parameter is equal to NULL - ALL tasks for the specified stream must be - * terminated and removed from the queue. - * - * \param ctx - stream context for the operation; - * \param task - delayed call wrapper structure. - * \sa zrtp_callback_scheduler_t#on_call_later - */ - void (*on_cancel_call_later)(zrtp_stream_t* ctx, zrtp_retry_task_t* task); - - /** - * \brief Interface for waiting for scheduling tasks is finished - * - * This function is called by libzrtp when the state-mamchine is in a position to destroy ZRTP - * session and all incapsulated streams. Allocated for the stream memory may be cleared and - * released. If after this operation, scheduler perform time-out call it will bring system to - * crash. - * - * The scheduler implementation must guarantee that any delay call for the \c stream will not be - * performed after on_wait_call_later(). - * - * \param stream - stream context for the operation; - * \sa zrtp_callback_scheduler_t#on_call_later. - */ - void (*on_wait_call_later)(zrtp_stream_t* stream); -} zrtp_callback_scheduler_t; - -/** \} */ - -/*======================================================================*/ -/* libzrtp interface: Protocol */ -/*======================================================================*/ - -/** - * \defgroup zrtp_iface_proto ZRTP Protocol Feedback - * \ingroup zrtp_iface - * - * This section defines ZRTP protcol events. Detail description of ZRTP state-machine is defined in - * \ref XXX. - * \{ - */ - -/** - * \brief ZRTP Protocol events - * - * For additional information see \ref XXX - */ -typedef enum zrtp_protocol_event_t -{ - /** \brief Just a stub for error detection. */ - ZRTP_EVENT_UNSUPPORTED = 0, - - /** \brief Switching to CLEAR state */ - ZRTP_EVENT_IS_CLEAR, - - /** \brief Switching to INITIATING_SECURE state */ - ZRTP_EVENT_IS_INITIATINGSECURE, - - /** \brief Switching to PENDING_SECURE state */ - ZRTP_EVENT_IS_PENDINGSECURE, - - /** \brief Switching to PENDING_CLEAR state */ - ZRTP_EVENT_IS_PENDINGCLEAR, - - /** - * \brief Switching to NO_ZRTP state. - * - * Hello packet undelivered - no ZRTP endpoint and other end - */ - ZRTP_EVENT_NO_ZRTP, - - /** - * \brief First N Hello packet undelivered - probably, no ZRTP endpoint and other end - * - * Libzrtp raises this event after few Hello have been send without receiving response from the - * remote endpoint. User application may use this event to stop Securing ritual if connection - * lag is important. - * - * Developer should take into account that delays in Hello receiving may be conditioned by - * interruptions in media channel - * - * \warning Don't handle this event unless necessary - */ - ZRTP_EVENT_NO_ZRTP_QUICK, - - /** - * \brief MiTM Enrollment with MiTM endpoint - * - * Informs the Client-side endpoint of receiving a registration invitation from the MiTM. - * Libzrtp raises this event after switching to the Secure state (ZRTP_EVENT_IS_SECURE). The - * user may accept the invitation using a zrtp_register_with_trusted_mitm() call. - */ - ZRTP_EVENT_IS_CLIENT_ENROLLMENT, - - /** - * \brief New user has registered to the MitM - * - * Informs MitM of the registration of a new user. Libzrtp raises this event when a user calls - * the special registration number and has switched to the secure state. - */ - ZRTP_EVENT_NEW_USER_ENROLLED, - - /** - * \brief New user has already registered with the MiTM - * - * Notifies the MiTM of an attempt to register from a user that is already registered. In this - * case a new MiTM secret will not be generated and the user may be informed by voice prompt. - * Libzrtp raises this event from the SECURE state. - */ - ZRTP_EVENT_USER_ALREADY_ENROLLED, - - /** - * \brief User has cancelled registration - * - * Libzrtp may raise this event during regular calls when it discovers that the user has removed - * its MiTM secret. This event informs the MiTM that the SAS can no longer be transferred to - * this user. - */ - ZRTP_EVENT_USER_UNENROLLED, - - /** - * \brief SAS value and/or rendering scheme was updated - * - * LibZRTP raises this event when the SAS value is transferred from the trusted MiTM. The value - * is rendered automatically according to the rendering scheme specified by the trusted MiTM. - * (it may be different than that of the previous one). - * - * On receiving this event, the Client application should replace the old SAS with the new one - * and ask the user to verify it. This event is called from the Secure state only. - */ - ZRTP_EVENT_LOCAL_SAS_UPDATED, - - /** - * \brief SAS transfer was accepted by the remote side - * - * Libzrtp raises this event to inform the Server-side about accepting the change of SAS value - * and/or rendering scheme by the remote client. This event is called from the Secure state - * only. - */ - ZRTP_EVENT_REMOTE_SAS_UPDATED, - - /** - * \brief Swishing to SECURE state - * - * Duplicates zrtp_callback_event_t#on_zrtp_secure for more thin adjustments. - */ - ZRTP_EVENT_IS_SECURE, - - /** - * \brief Swishing to SECURE state is finished. - * - * Equal to ZRTP_EVENT_IS_SECURE but called when the Securing process is completely finished: - * new RS secret is generate, cache flags updated and etc. Can be used in extended application - * for more thin adjustments. - */ - ZRTP_EVENT_IS_SECURE_DONE, - - /** - * \brief Indicates DRM restriction. Stream can't go Secure. - * - * Libzrtp generate this event if DRM rules don't allow to switch to Secure mode: - * - A passive endpoint never sends a Commit message. Semi-active endpoint does not send a - * Commit to a passive endpoint - * - A passive phone, if acting as a SIP initiator r ejects all commit packets from everyone. - * - A passive phone rejects all commit messages from a PBX. - */ - ZRTP_EVENT_IS_PASSIVE_RESTRICTION, - - ZRTP_EVENT_COUNT - -} zrtp_protocol_event_t; - -/** - * \brief ZRTP Protocol Errors and Warnings - * - * For additional information see \ref XXX - */ -typedef enum zrtp_security_event_t -{ - /** - * \brief Switching to ERROR state - * - * The exact error code can be found at zrtp_stream_info_t#last_error. Use zrtp_log_error2str() - * to get error description in text mode. - */ - ZRTP_EVENT_PROTOCOL_ERROR = ZRTP_EVENT_COUNT, - - /** - * \brief Hello Hash is different from that received in signaling. - * - * In accordance with sec. 8.1 of the ZRTP RFC, libzrtp provides the ability to prevent DOS - * attacks. libzrtp can detect an attack in which the hash of the remote Hello was received - * through signaling and added to the ZRTP context (zrtp_signaling_hash_set()). - * - * When the hash of the incoming Hello doesn't match the hash from signaling, the - * ZRTP_EVENT_WRONG_SIGNALING_HASH event is raised and the connection MAY be terminated - * manually. - */ - ZRTP_EVENT_WRONG_SIGNALING_HASH, - - /** - * \brief Hmac of the received packet is different from the hmac value earlier received. - * - * If the Hello hash is sent through protected signaling, libzrtp provides the ability to - * prevent protocol packets from modification and even eliminates comparing the SAS. To do this, - * libzrtp compares the message Hmac with the Hmac received in the previous message. - * - * If the Hmacs don't match, the ZRTP_EVENT_WRONG_MESSAGE_HMAC event is raised and the - * connection MAY be terminated manually. - */ - ZRTP_EVENT_WRONG_MESSAGE_HMAC, - - /** - * \brief Retain secret was found in the cache but it doesn't match with the remote one - * - * The library rises this event when non-expired secret have been found in the cache but - * value of the secret doesn't match with the remote side secret. Such situation may happen - * in case of MiTM attack or when remote side lost it's cache. - * - * Recommended behavior: the application should notify user about the situation and ask him to - * verify the SAS. If SAS is different - it indicates the attack. - */ - ZRTP_EVENT_MITM_WARNING -} zrtp_security_event_t; - -/** - * \brief Callbacks definitions - * - * This section lists callback functions informing the user about the protocol status. These - * callbacks must be defined in the user application. - */ -typedef struct zrtp_callback_event_t -{ - /** - * \brief ZRTP Protocol events notification. - * - * Informs about switching between the protocol states and other events. Provides more flexible - * control over the protocol then on_zrtp_secure and on_zrtp_not_secure. - * - * \param event - type of event; - * \param stream - ZRTP stream context. - */ - void (*on_zrtp_protocol_event)(zrtp_stream_t *stream, zrtp_protocol_event_t event); - - /** - * \brief ZRTP Security events notification - * - * Informs about ZRTP security events: MiTM attacks, cache desynchronization and - * others. - * \warning MUST be handled in the target application to provide high security level. - * - * \param event - type of event; - * \param stream - ZRTP stream context. - */ - void (*on_zrtp_security_event)(zrtp_stream_t *stream, zrtp_security_event_t event); - - /** - * \brief Indicates switching to SECURE state. - * - * Pair of events: \c on_zrtp_secure and \c on_zrtp_not_secure represent simplified event - * handling mechanism comparing to \c on_zrtp_protocol_event. libzrtp calls this event when the - * call is SECURE and media is encrypted. - * - * SAS Verification is required on this event. - * - * \param stream - ZRTP stream context. - */ - void (*on_zrtp_secure)(zrtp_stream_t *stream); - - /** - * \brief Indicates switching to NOT SECURE state. - * - * This event duplicates some protocol and security events to simplify libzrtp usage. It may be - * used in applications which don't require detail information about ZRTP protocol. - * - * If Error appeared - the exact error code can be found at zrtp_stream_info_t#last_error. Use - * zrtp_log_error2str() to get error description in text mode. - * - * \param stream - ZRTP stream context. - */ - void (*on_zrtp_not_secure)(zrtp_stream_t *stream); -} zrtp_callback_event_t; - -/** \} */ - -/*======================================================================*/ -/* libzrtp interface: Misc */ -/*======================================================================*/ - -/** - * \defgroup zrtp_iface_misc Miscellaneous functions - * \ingroup zrtp_iface - * \{ - */ - -/** - * \brief Miscellaneous Functions - */ -typedef struct zrtp_callback_misc_t -{ - /** - * \brief RTP packet sending function - * - * This function pushes an outgoing ZRTP packet to the network. Correct building of IP and UPD - * headers is the developer's responsibility. - * - * \param stream - ZRTP stream context; - * \param packet - buffer storing the ZRTP packet to send; - * \param length - size of the ZRTP packet. - * \return - * - number of bytes sent if successful; - * - -1 if error occurred. - */ - int (*on_send_packet)(const zrtp_stream_t* stream, char* packet, unsigned int length); -} zrtp_callback_misc_t; - -/** \} */ - -/** - * \brief ZRTP feedback interface and application dependent routine - * \ingroup zrtp_iface - */ -typedef struct zrtp_callback_t -{ - /** \brief ZRTP Protocol Feedback */ - zrtp_callback_event_t event_cb; - /** \brief ZRTP Delay Calls routine */ - zrtp_callback_scheduler_t sched_cb; - /** \brief ZRTP Cache */ - zrtp_callback_cache_t cache_cb; - /** \brief Miscellaneous functions */ - zrtp_callback_misc_t misc_cb; -} zrtp_callback_t; - - -#if defined(__cplusplus) -} -#endif - -#endif /*__ZRTP_IFACE_H__*/ diff --git a/libs/libzrtp/include/zrtp_iface_cache.h b/libs/libzrtp/include/zrtp_iface_cache.h deleted file mode 100644 index 0bdde3cf92..0000000000 --- a/libs/libzrtp/include/zrtp_iface_cache.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_IFACE_CACHE_H__ -#define __ZRTP_IFACE_CACHE_H__ - -#include "zrtp_config.h" -#include "zrtp_base.h" -#include "zrtp_string.h" -#include "zrtp_error.h" -#include "zrtp_iface.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if defined(ZRTP_USE_BUILTIN_CACHE) && (ZRTP_USE_BUILTIN_CACHE == 1) - -#define ZRTP_DEF_CACHE_VERSION_STR "libZRTP cache version=" -#define ZRTP_DEF_CACHE_VERSION_VAL "1.0" - -/** - * @brief Cache element identifier type - * Elements of this type link cache data with a pair of ZIDs. - * (constructed as: [ZID1][ZID2], where ZID1 - ZID with greater binary value) - * This type is used to identify cache elements in the built-in implementation. - */ -typedef uint8_t zrtp_cache_id_t[24]; - -#define ZRTP_MITMCACHE_ELEM_LENGTH ( sizeof(zrtp_cache_id_t) + sizeof(zrtp_string64_t) ) -#define ZRTP_CACHE_ELEM_LENGTH ( sizeof(zrtp_cache_elem_t) - sizeof(mlist_t) - (sizeof(uint32_t)*2) ) -#define ZFONE_CACHE_NAME_LENGTH 256 - -/** - * @brief Secret cache element structure - * This structure is used to store cache data in the built-in implementation - * of the caching system. - */ -typedef struct zrtp_cache_elem -{ - zrtp_cache_id_t id; /** Cache element identifier */ - zrtp_string64_t curr_cache; /** Current cache value */ - zrtp_string64_t prev_cache; /** Prev cache value */ - uint32_t verified; /** Verified flag for the cache value */ - uint32_t lastused_at; /** Last usage time-stamp in seconds */ - uint32_t ttl; /** Cache TTL since lastused_at in seconds */ - uint32_t secure_since; /** Secure since date in seconds. Utility field. Don't required by libzrtp. */ - char name[ZFONE_CACHE_NAME_LENGTH]; /** name of the user associated with this cache entry */ - uint32_t name_length; /** cache name lengths */ - uint32_t presh_counter; /** number of Preshared streams made since last DH exchange */ - uint32_t _index; /** cache element index in the cache file */ - uint32_t _is_dirty; /** dirty flag means the entry has unsaved changes */ - mlist_t _mlist; -} zrtp_cache_elem_t; - -#endif /* ZRTP_USE_BUILTIN_CACHE */ - -zrtp_status_t zrtp_def_cache_init(zrtp_global_t* zrtp); - -void zrtp_def_cache_down(); - -zrtp_status_t zrtp_def_cache_set_verified( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t verified); - -zrtp_status_t zrtp_def_cache_get_verified( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t* verified); - - -zrtp_status_t zrtp_def_cache_put( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_shared_secret_t *rss); - -zrtp_status_t zrtp_def_cache_put_mitm( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_shared_secret_t *rss); - -zrtp_status_t zrtp_def_cache_get( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_shared_secret_t *rss, - int prev_requested); - -zrtp_status_t zrtp_def_cache_get_mitm( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_shared_secret_t *rss); - -zrtp_status_t zrtp_def_cache_set_presh_counter( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t counter); - -zrtp_status_t zrtp_def_cache_get_presh_counter( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t* counter); - -#if defined(ZRTP_USE_BUILTIN_CACHE) && (ZRTP_USE_BUILTIN_CACHE == 1) -/** - * @brief Cache iterator - * zrtp_def_cache_foreach() calls this function for every cache entry. - * @param elem - cache element; - * @param is_mitm - is 1 when callback was called for MiTM for each. - * @param del - callback may return 1 to this to remove cache entry from the list. - * @param data - pointer to some user data from zrtp_def_cache_foreach(); - * @return - * - 0 - if element was requested for reading only and wasn't changed; - * - 1 - if element was modified and cache should be updated. - */ -typedef int (*zrtp_cache_callback_t)(zrtp_cache_elem_t* elem, int is_mitm, void* data, int* del); - -/** - * @brief Iterate over all cache entries. - * Can be used for searching and modifying cache entries. Protected by mutex. - * Can be called in parallel with other cache operations when protocol is - * running. - * @param global - libzrtp global context; - * @param is_mitm - if value of this flag is 1 - fore_each will be applied for MiTM secrets; - * @param callback - function to be called for every cache entry; - * @param data - this pointer will be passed to every \c callback call. - */ -void zrtp_def_cache_foreach( zrtp_global_t *global, - int is_mitm, - zrtp_cache_callback_t callback, - void *data); - -#endif /* ZRTP_USE_BUILTIN_CACHE */ - -/** - * @brief Store shared secrets cache to the persistent storage - * May be used in server solutions for periodically flushing the cache to prevent data loss. - * - * @return - * - zrtp_status_ok - if operation completed successfully; - * - zrtp_status_wrong_state - if a call is performed from a routine which - * doesn't use the default cache. - */ -zrtp_status_t zrtp_def_cache_store(zrtp_global_t *global); - -zrtp_status_t zrtp_def_cache_reset_since( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid); - -zrtp_status_t zrtp_def_cache_get_since( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t* since); - -zrtp_status_t zrtp_def_cache_get_name( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_stringn_t* name); - -zrtp_status_t zrtp_def_cache_put_name( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - const zrtp_stringn_t* name); - -#if defined(ZRTP_USE_BUILTIN_CACHE) && (ZRTP_USE_BUILTIN_CACHE == 1) -zrtp_cache_elem_t* zrtp_def_cache_get2(const zrtp_cache_id_t id, int is_mitm); -#endif /* ZRTP_USE_BUILTIN_CACHE */ - -#if defined(__cplusplus) -} -#endif - -#endif /*__ZRTP_IFACE_CACHE_H__*/ - diff --git a/libs/libzrtp/include/zrtp_iface_scheduler.h b/libs/libzrtp/include/zrtp_iface_scheduler.h deleted file mode 100644 index 2fe27c447a..0000000000 --- a/libs/libzrtp/include/zrtp_iface_scheduler.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - - -#ifndef __ZRTP_IFACE_SCHEDULER_H__ -#define __ZRTP_IFACE_SCHEDULER_H__ - -#include "zrtp_config.h" -#include "zrtp_base.h" -#include "zrtp_string.h" -#include "zrtp_error.h" -#include "zrtp_iface.h" - -#if defined(ZRTP_USE_BUILTIN_SCEHDULER) && (ZRTP_USE_BUILTIN_SCEHDULER == 1) - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -/** - * In order to use default secheduler libzrtp one should define tow extra interfaces: - * sleep and threads riutine. - */ - -/** - * \brief Suspend thread execution for an interval measured in miliseconds - * \param msec - number of miliseconds - * \return: 0 if successful and -1 in case of errors. - */ - -#if ZRTP_PLATFORM != ZP_WIN32_KERNEL - -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WINCE) -#include - typedef LPTHREAD_START_ROUTINE zrtp_thread_routine_t; -#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || (ZRTP_PLATFORM == ZP_ANDROID) - typedef void *(*zrtp_thread_routine_t)(void*); -#elif (ZRTP_PLATFORM == ZP_SYMBIAN) - typedef int(*zrtp_thread_routine_t)(void*); -#endif - -/** - * \brief Function is used to create a new thread, within a process. - * - * Thread should be created with default attributes. Upon its creation, the thread executes - * \c start_routine, with \c arg as its sole argument. - * \param start_routine - thread start routine. - * \param arg - start routine arguments. - * \return 0 if successful and -1 in case of errors. - */ - - -extern int zrtp_thread_create(zrtp_thread_routine_t start_routine, void *arg); -extern int zrtp_sleep(unsigned int msec); - -#endif - -void zrtp_def_scheduler_down(); - -zrtp_status_t zrtp_def_scheduler_init(zrtp_global_t* zrtp); - -void zrtp_def_scheduler_call_later(zrtp_stream_t *ctx, zrtp_retry_task_t* ztask); - -void zrtp_def_scheduler_cancel_call_later(zrtp_stream_t* ctx, zrtp_retry_task_t* ztask); - -void zrtp_def_scheduler_wait_call_later(zrtp_stream_t* ctx); - - -zrtp_status_t zrtp_sem_init(zrtp_sem_t** sem, uint32_t value, uint32_t limit); -zrtp_status_t zrtp_sem_destroy(zrtp_sem_t* sem); -zrtp_status_t zrtp_sem_wait(zrtp_sem_t* sem); -zrtp_status_t zrtp_sem_trtwait(zrtp_sem_t* sem); -zrtp_status_t zrtp_sem_post(zrtp_sem_t* sem); - -#if defined(__cplusplus) -} -#endif - -#endif /* ZRTP_USE_BUILTIN_SCEHDULER */ - -#endif /*__ZRTP_IFACE_SCHEDULER_H__*/ diff --git a/libs/libzrtp/include/zrtp_iface_system.h b/libs/libzrtp/include/zrtp_iface_system.h deleted file mode 100644 index 6a69bd5b8b..0000000000 --- a/libs/libzrtp/include/zrtp_iface_system.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - - -/** - * \file zrtp_iface_system.h - * \brief libzrtp platform-dependent routine - */ - -#ifndef __ZRTP_IFACE_SYSTEM_H__ -#define __ZRTP_IFACE_SYSTEM_H__ - -#include "zrtp_config.h" -#include "zrtp_types.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - - -/*============================================================================*/ -/* System wide functions */ -/*============================================================================*/ - -/** - * \defgroup zrtp_iface Library Interfaces Overview - * - * This section describes the requirements for the implementation of each interface function. - * Descriptions are divided into groups by function - */ - -/** - * \defgroup zrtp_iface_base Basic platform-dependent routine - * \ingroup zrtp_iface - * \{ - */ - -/** - * \brief Time in miliseconds - * - * libzrtp uses a unix-like time calculation scheme: time since 1/1/1970. - */ -typedef uint64_t zrtp_time_t; - - -/** - * \brief Allocates memory of a defined size - * - * Allocates \c size bytes and returns a pointer to the allocated memory Allocated memory is not - * cleared. - * - * \param size - number of bytes for allocation - * \return - * - pointer to the allocated memory if successful. - * - NULL if the memory allocation failed. - */ -extern void* zrtp_sys_alloc(unsigned int size); - -/** - * \brief release memory - * - * Release the memory space pointed to by \c obj, which was returned by a previous zrtp_sys_alloc() - * call. If \c obj is NULL, no operation is performed. - * - * \param obj - pointer to the released memory - */ -extern void zrtp_sys_free(void* obj); - -/** - * \brief Memory copying function. - * - * This function copies \c length bytes from memory area \c src to memory area \c dest. The memory - * areas should not overlap. - * - * \param dest - pointer to the destination buffer - * \param src - pointer to the source buffer; - * \param length - number of bytes to be copied. - * \return - * - pointer to the destination buffer (dest) - */ -extern void* zrtp_memcpy(void* dest, const void* src, unsigned int length); - -/** - * \brief Write a byte to a byte string - * - * The zrtp_memset() function writes \c n bytes of value \c c (converted to an unsigned char) to the - * string \c s. - * \return - * - first argument - */ -extern void *zrtp_memset(void *s, int c, unsigned int n); - -/** - * \brief Returns current date and time - * - * This function should return current unix-like date and time: number of microseconds since - * 1.1.1970. - */ -extern zrtp_time_t zrtp_time_now(); - -/** \} */ - -/*============================================================================*/ -/* Mutex related interfaces */ -/*============================================================================*/ - -/** - * \defgroup zrtp_iface_mutex Synchronization related functions - * \ingroup zrtp_iface - * \{ - */ - -/** - * \brief Initializing the mutex structure - * - * This function allocates and initializes the mutex referenced by \c mutex with default attributes. - * Upon successful initialization, the state of the mutex becomes initialized and unlocked. This - * function should create a NON RECURSIVE mutex. (Attempting to relock the mutex causes deadlock) - * - * \param mutex - out parameter, mutex structure for allocation and initialization - * \return: - * - zrtp_status_ok if initialization successful; - * - zrtp_status_fail if an error occurred. - * \sa zrtp_mutex_destroy() - */ -extern zrtp_status_t zrtp_mutex_init(zrtp_mutex_t** mutex); - -/** - * \brief Deinitializing the mutex structure - * - * This function destroys the mutex object previously allocated by zrtp_mutex_init(). - * - * \param mutex - mutex structure for deinitialization. - * \return: - * - zrtp_status_ok if deinitialization successful; - * - zrtp_status_fail if an error occurred. - * \sa zrtp_mutex_init() - */ - extern zrtp_status_t zrtp_mutex_destroy(zrtp_mutex_t* mutex); - -/** - * \brief Mutex locking - * - * This function locks the mutex object referenced by \c mutex. If the mutex is already locked, the - * thread that called it is blocked until the mutex becomes available. This operation returns the - * mutex object referenced by the mutex in the locked state with the calling thread as its owner. - * - * \param mutex - mutex for locking; - * \return: - * - zrtp_status_ok if successful; - * - zrtp_status_fail if an error occurred. - */ -extern zrtp_status_t zrtp_mutex_lock(zrtp_mutex_t* mutex); - -/** - * \brief Mutex releasing - * - * This function releases the mutex object referenced by mutex. The way a mutex is released depends - * on the mutex's type attribute. If there are threads blocked on the mutex object referenced by - * mutex when zrtp_mutex_unlock() is called and the mutex becomes available, the scheduling policy - * determines which thread acquires the mutex. - * - * \param mutex - mutex to release - * \return: - * - zrtp_status_ok if successful; - * - zrtp_status_fail if an error occurred. - */ -extern zrtp_status_t zrtp_mutex_unlock(zrtp_mutex_t* mutex); - -/*! \} */ - -#if defined(__cplusplus) -} -#endif - -#endif /* __ZRTP_IFACE_SYSTEM_H__ */ diff --git a/libs/libzrtp/include/zrtp_legal.h b/libs/libzrtp/include/zrtp_legal.h deleted file mode 100644 index 03c94729fd..0000000000 --- a/libs/libzrtp/include/zrtp_legal.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_LEGAL_H__ -#define __ZRTP_LEGAL_H__ - - -/* - * We want the copyright string accessable to the unix strings command in - * the linked binary, and don't want the linker to remove it if it's not - * referenced, thus the volatile qualifier. - * - * ANSI C standard, section 3.5.3: "An object that has volatile-qualified - * type may be modified in ways unknown to the implementation or have - * other unknown side effects." - */ -extern volatile const char zrtpCopyright[]; - -#endif /*__ZRTP_LEGAL_H__ */ diff --git a/libs/libzrtp/include/zrtp_list.h b/libs/libzrtp/include/zrtp_list.h deleted file mode 100644 index e6ee0988c8..0000000000 --- a/libs/libzrtp/include/zrtp_list.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - - -#ifndef __ZRTP_LIST_H__ -#define __ZRTP_LIST_H__ - -#include "zrtp_config.h" - -typedef struct mlist mlist_t; -struct mlist -{ - mlist_t *next; - mlist_t *prev; -}; - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* - * \warning - * We cast pointer to integer. There is bad thing for 64 bit platforms but - * calculated offset couldn't be bigger then 2x32 and it will be casted - * to integer correctly. - */ -#define mlist_list_offset(type, list_name) ((size_t)&(((type*)0)->list_name)) - -#define mlist_get_struct(type, list_name, list_ptr) \ - ((type*)(((char*)(list_ptr)) - mlist_list_offset(type,list_name))) - -#define mlist_for_each(pos, head) \ - for (pos = (head)->next; pos != (head); pos = pos->next) - -#define mlist_for_each_safe(pos, n, head) \ - for (pos = (head)->next, n = pos->next; pos != (head); \ - pos = n, n = pos->next) - -void init_mlist(mlist_t* head); - -void mlist_add(mlist_t* head, mlist_t* node); -void mlist_add_tail(mlist_t *head, mlist_t *node); - -void mlist_insert(mlist_t *prev, mlist_t *node); - -void mlist_del(mlist_t *node); -void mlist_del_tail(mlist_t *node); - -mlist_t* mlist_get(mlist_t *head); -mlist_t* mlist_get_tail(mlist_t *head); - -int mlist_isempty(mlist_t *head); - -#if defined(__cplusplus) -} -#endif - - -#endif /*__ZRTP_LIST_H__ */ diff --git a/libs/libzrtp/include/zrtp_log.h b/libs/libzrtp/include/zrtp_log.h deleted file mode 100644 index ca2213eca4..0000000000 --- a/libs/libzrtp/include/zrtp_log.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_LOG_H__ -#define __ZRTP_LOG_H__ - -#include "zrtp_config.h" -#include "zrtp_types.h" -#include "zrtp_base.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define ZRTP_LOG_SENDER_MAX_LEN 12 -#define ZRTP_LOG_BUFFER_SIZE 512 - - -/*! - * \defgroup iface_log Functions for debug and information logging - * \ingroup interfaces - * \{ - */ - -/** - * @brief Write log message. - * This is the main macro used to write text to the logging backend. - * @param level The logging verbosity level. Lower number indicates higher - * importance, with level zero indicates fatal error. Only - * numeral argument is permitted (e.g. not variable). - * @param arg Enclosed 'printf' like arguments, with the first - * argument is the sender, the second argument is format - * string and the following arguments are variable number of - * arguments suitable for the format string. - * - * Sample: - * @code - * ZRTP_LOG(2, (__UNITE__, "Some log message with id %d", id)); - * @endcode - */ - -#define ZRTP_LOG(level,arg) do { \ -zrtp_log_wrapper_##level(arg); \ -} while (0) - -#define ZRTP_LOGC(level,arg) do { \ -zrtp_log_wrapperc_##level(arg); \ -} while (0) - - -/** - * @brief Signature for function to be registered to the logging subsystem to - * write the actual log message to some output device. - * - * @param level Log level. - * @param data Log message, which will be NULL terminated. - * @param len Message length. (prefix + text) - * @param offset Log message prefix length - */ -typedef void zrtp_log_engine(int level, char *data, int len, int offset); - - -#if ZRTP_LOG_MAX_LEVEL >= 1 - -/** - * @brief Changes default log writer function. - * This function may be used to implement log writer in a way native for target - * OS or product. By default libzrtp uses console output. - * @param engine - log writer. - */ -void zrtp_log_set_log_engine(zrtp_log_engine *engine); - -/** - * @brief Changes Log-Level in run-time mode - * Libzrtp uses 3 log levels: - * - 1 - system related errors; - * - 2 - security, ZRTP protocol related errors and warnings; - * - 3 - debug logging. - * By default, libzrtp uses debug logging - level 3. - * @param level - log level. - */ -void zrtp_log_set_level(uint32_t level); - -/* \} */ - -#else /* If logger is enabled */ - -# define zrtp_log_set_log_engine(engine) -# define zrtp_log_set_level(level) - -#endif /* If logger is enabled */ - - -#if ZRTP_LOG_MAX_LEVEL >= 1 -# define zrtp_log_wrapper_1(arg) zrtp_log_1 arg - void zrtp_log_1(const char *src, const char *format, ...); -# define zrtp_log_wrapperc_1(arg) zrtp_logc_1 arg - void zrtp_logc_1(const char *format, ...); -#else -# define zrtp_log_wrapper_1(arg) -# define zrtp_log_wrapperc_1(arg) -#endif - -#if ZRTP_LOG_MAX_LEVEL >= 2 -# define zrtp_log_wrapper_2(arg) zrtp_log_2 arg - void zrtp_log_2(const char *src, const char *format, ...); -# define zrtp_log_wrapperc_2(arg) zrtp_logc_2 arg - void zrtp_logc_2(const char *format, ...); -#else -#define zrtp_log_wrapper_2(arg) -#define zrtp_log_wrapperc_2(arg) -#endif - -#if ZRTP_LOG_MAX_LEVEL >= 3 -# define zrtp_log_wrapper_3(arg) zrtp_log_3 arg - void zrtp_log_3(const char *src, const char *format, ...); -# define zrtp_log_wrapperc_3(arg) zrtp_logc_3 arg - void zrtp_logc_3(const char *format, ...); - -#else -# define zrtp_log_wrapper_3(arg) -# define zrtp_log_wrapperc_3(arg) -#endif - -const char* zrtp_log_error2str(zrtp_protocol_error_t error); -const char* zrtp_log_status2str(zrtp_status_t error); - -/** Returns symbolical name of ZRTP protocol state for the current stream. */ -const char* zrtp_log_state2str(zrtp_state_t state); - -/** Returns symbolical name of ZXRTP protocol packet by it's code. */ -const char* zrtp_log_pkt2str(zrtp_msg_type_t type); - -/** Returns symbolical name of the PK Exchange mode for the current stream. */ -const char* zrtp_log_mode2str(zrtp_stream_mode_t mode); - -/** Returns symbolical name of the protocol and security events. */ -const char* zrtp_log_event2str(uint8_t event); - -/** - * Returns character name of the Signaling role. - * - * @param role One of zrtp_signaling_role_t values. - * @return character name of the \c role. - */ -const char* zrtp_log_sign_role2str(unsigned role); - - -/** Print out ZRTP environment configuration setting to log level 3. */ -void zrtp_print_env_settings(); - -/** Print out ZRTP stream info strxucture. (use ZRTP log-level 3). */ -void zrtp_log_print_streaminfo(zrtp_stream_info_t* info); - -/** Print out ZRTP session info structure. (use ZRTP log-level 3). */ -void zrtp_log_print_sessioninfo(zrtp_session_info_t* info); - -#ifdef __cplusplus -} -#endif - - -#endif /* __ZRTP_LOG_H__ */ diff --git a/libs/libzrtp/include/zrtp_pbx.h b/libs/libzrtp/include/zrtp_pbx.h deleted file mode 100644 index 485ec74670..0000000000 --- a/libs/libzrtp/include/zrtp_pbx.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - - -/** - * \file zrtp_pbx.h - * \brief Defines basic Functions to work with MiTM endpoints - */ - -#ifndef __ZRTP_PBX_H__ -#define __ZRTP_PBX_H__ - -#include "zrtp_config.h" -#include "zrtp_types.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/** - * \defgroup zrtp_api_mitm PBX related functions and data types - * \ingroup zrtp_api - * - * In this section the basic functions for using the library in MiTM mode - * environment. Asterisk PBX, for example. - * \{ - */ - -/** - * \brief Start ZRTP enrollment ritual on Server side - * - * This is the equivalent of zrtp_stream_start() but for MiTM endpoints. By calling - * zrtp_stream_registration_start() libzrtp prepares to engage in the enrollment ritual: send - * special flag in Confirm packet and prepare for generating the MiTM secret. - * \return - * - zrtp_status_ok - if operation started successfully; - * - one of zrtp_status_t errorrs in other case. - * \sa zrtp_callback_event_t#on_zrtp_protocol_event - * \sa zrtp_event_t (PBX related definitions) - */ -zrtp_status_t zrtp_stream_registration_start(zrtp_stream_t* stream, uint32_t ssrc); - -/** - * \brief Continue ZRTP enrollment ritual (from CLEAR state) on Server side. - * - * This is equivalent to zrtp_stream_secure() but with enrollment ritual. Use this function instead - * of zrtp_stream_registration_start() in case when "autosecure" option is disabled for some reason. - * \return - * - zrtp_status_ok - if operation started successfully; - * - one of zrtp_status_t errorrs in other case. - */ -zrtp_status_t zrtp_stream_registration_secure(zrtp_stream_t* stream); - -/** - * \brief Confirms enrollment ritual on Client side - * - * Invocation of this function by event zrtp_protocol_event_t#ZRTP_EVENT_IS_CLIENT_ENROLLMENT - * confirms enrollment process; libzrtp generates special secret which will be used to "Sign" all - * further calls with the trusted MiTM. - * \return - * - zrtp_status_ok - in case when enrollment was completed successfully; - * - zrtp_status_fail - in case of error: wrong protocol state or system error. - */ -zrtp_status_t zrtp_register_with_trusted_mitm(zrtp_stream_t* stream); - -/** - * \brief Automatically handle ZRTP call in PBX environment - * - * This function may be called to handle ZRTP call between two ZRTP endpoints through PBX. As - * described in ID sec 8.3., there are several problems with ZRTP in PBX environment. - * zrtp_resolve_mitm_call() implements several steps to resolve such problems: - * - detect enrolled and non enrolled endpoint. If both sides are enrolled - one side for the SAS - * transfer will be chousen automatically; - * - start SAS transfer with the enrolled endpoint; - * - update flags and SAS rendering scheme if necessary. - * In other words: After switching to SECURE state, this is the one function which ZRTP MiTM - * endpoint should call to handle ZRTP call correctly. If you want to have more flexability in MiTM - * mode - resolve ambiguity manually using functions listed below. - * \param stream1 - one party of ZRTP call (must be in secure state already); - * \param stream2 - other party of ZRTP call (must be in secure state already). - * \return - * - zrtp_status_ok - if operation started successfully; - * - one of zrtp_status_t errors in other case. - * \ref XXX_DRAFT, XXX_GUIDE - */ -zrtp_status_t zrtp_resolve_mitm_call(zrtp_stream_t* stream1, zrtp_stream_t* stream2); - -/** - * @brief Links two lags of Trusted ZRTP MiTM call together. - * - * This function allows libzrtp2 to optimize protocol behavior of one leg depending on the state and - * parameters of the other lag. MitM boxes should use this API whenever possible. - * - * @param stream1 - one leg of the trusted MiTM call; - * @param stream2 - another leg of the trusted MiTM call. - * - * @return zrtp_status_ok in case of success. - */ -zrtp_status_t zrtp_link_mitm_calls(zrtp_stream_t* stream1, zrtp_stream_t* stream2); - -/** - * \brief Updates remote-side SAS value and rendering scheme - * - * zrtp_update_remote_sas() initiates process of "SAS transferring" between trusted MiTM and user. - * It allows to change as SAS rendering scheme as a SAS value and related flags as well. It the MiTM - * needs to update just one of the parameters - the other one should be set to NULL. libzrtp informs - * about status of the SAS updating through zrtp_protocol_event_t::ZRTP_EVENT_REMOTE_SAS_UPDATED. - * Call this function in SECURE state only. - * \param stream - zrtp endpoint stream to update; - * \param transf_sas_scheme - chosen SAS rendering scheme; - * \param transf_sas_value - relaying SAS value (full sas hash); - * \param transf_ac_flag - relaying "allowclear" flag; - * \param transf_d_flag - relaying "disclose" flag. - * \return - * - zrtp_status_ok - if operation started successfully; - * - one of zrtp_status_t errors in other case. - */ -zrtp_status_t zrtp_update_remote_options( zrtp_stream_t* stream, - zrtp_sas_id_t transf_sas_scheme, - zrtp_string32_t* transf_sas_value, - uint8_t transf_ac_flag, - uint8_t transf_d_flag ); - -/** - * \brief Check if user at the end of the stream \c stream is enrolled - * \param stream - stream for examining. - * \return: 1 if user is enrolled and 0 in other case - */ -uint8_t zrtp_is_user_enrolled(zrtp_stream_t* stream); - -/** - * \brief Choose single enrolled stream from two enrolled - * - * This function may be used to resolve ambiguity with call transferring between two enrolled users. - * \return stream which shuld be used for SAS transferring - */ -zrtp_stream_t* zrtp_choose_one_enrolled(zrtp_stream_t* stream1, zrtp_stream_t* stream2); - -/* \} */ - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/libs/libzrtp/include/zrtp_protocol.h b/libs/libzrtp/include/zrtp_protocol.h deleted file mode 100644 index 104d6d9be0..0000000000 --- a/libs/libzrtp/include/zrtp_protocol.h +++ /dev/null @@ -1,495 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_PROTOCOL_H__ -#define __ZRTP_PROTOCOL_H__ - -#include "zrtp_config.h" -#include "zrtp_types.h" -#include "zrtp_error.h" - -#if defined(_MSC_VER) -#pragma warning(disable:4214) -#endif - -/*! - * \defgroup dev_protocol Protocol related data types and definitions - * \ingroup zrtp_dev - * \{ - */ - -/*! ZRTP Protocol version, retransmitted in HELLO packets */ -#define ZRTP_PROTOCOL_VERSION "1.10" -#define ZRTP_PROTOCOL_VERSION_VALUE 110 - -#define ZRTP_ZFONE_PROTOCOL_VERSION "0.10" -#define ZRTP_ZFONE_PROTOCOL_VERSION_VALUE 10 - -/* - * Protocol constants and definitions. All these values are defined by the ZRTP - * specification "ZRTP Internet Draft". - * Don't change them! - */ -#define ZRTP_S384 "S384" -#define ZRTP_S256 "S256" -#define ZRTP_S160 "S160" -#define ZRTP_AES1 "AES1" -#define ZRTP_AES3 "AES3" -#define ZRTP_HS32 "HS32" -#define ZRTP_HS80 "HS80" -#define ZRTP_DH2K "DH2k" -#define ZRTP_DH3K "DH3k" -#define ZRTP_EC256P "EC25" -#define ZRTP_EC384P "EC38" -#define ZRTP_EC521P "EC52" -#define ZRTP_MULT "Mult" -#define ZRTP_PRESHARED "Prsh" -#define ZRTP_B32 "B32 " -#define ZRTP_B256 "B256" - -#define ZRTP_ROLE_INITIATOR "Initiator" -#define ZRTP_ROLE_RESPONDER "Responder" -#define ZRTP_INITIATOR_HMAKKEY_STR "Initiator HMAC key" -#define ZRTP_RESPONDER_HMAKKEY_STR "Responder HMAC key" -#define ZRTP_GOCLEAR_STR "GoClear" -#define ZRTP_INITIATOR_KEY_STR "Initiator SRTP master key" -#define ZRTP_INITIATOR_SALT_STR "Initiator SRTP master salt" -#define ZRTP_RESPONDER_KEY_STR "Responder SRTP master key" -#define ZRTP_RESPONDER_SALT_STR "Responder SRTP master salt" -#define ZRTP_SKEY_STR "ZRTP Session Key" -#define ZRTP_SAS_STR "SAS" -#define ZRTP_RS_STR "retained secret" -#define ZRTP_INITIATOR_ZRTPKEY_STR "Initiator ZRTP key" -#define ZRTP_RESPONDER_ZRTPKEY_STR "Responder ZRTP key" -#define ZRTP_CLEAR_HMAC_STR "GoClear" -#define ZRTP_KDF_STR "ZRTP-HMAC-KDF" -#define ZRTP_SESS_STR "ZRTP Session Key" -#define ZRTP_MULTI_STR "ZRTP MSK" -#define ZRTP_PRESH_STR "ZRTP PSK" -#define ZRTP_TRUSTMITMKEY_STR "Trusted MiTM key" -#define ZRTP_COMMIT_HV_KEY_STR "Prsh" - -#define ZRTP_CACHE_DEFAULT_TTL (30*24*60*60) - -/** ZRTP Message magic Cookie */ -#define ZRTP_PACKETS_MAGIC 0x5a525450L -/** Defines ZRTP extension type for RTP protocol */ -#define ZRTP_MESSAGE_MAGIC 0x505a - - -/** - * @brief Retransmission timer T1 in milliseconds - * T1 is used for the retransmission of Hello messages. The HELLO timeout is - * doubled each time a resend occurs. The gain (max timeout value) is limited - * by @ref ZRTP_T1_CAPPING. After reaching \c ZRTP_T1_CAPPING, the state machine - * keeps resending HELLO packets until the resend count is less than \ref - * ZRTP_T1_MAX_COUNT - * @sa ZRTP_T1_MAX_COUNT ZRTP_T1_CAPPING - */ - -#define ZRTP_T1 50 - -/*! - * \brief Max resends count value for T1 timer - * This is the threshold value for HELLO replays. See \ref ZRTP_T1 ZRTP_T1 for - * details. If the resend count exceeds the value of ZRTP_T1_MAX_COUNT then - * the state machine calls _zrtp_machine_enter_initiatingerror() with error code \ref - * zrtp_protocol_error_t#zrtp_error_timeout and ZRTP session establishment is - * failed. - */ -#define ZRTP_T1_MAX_COUNT 20 - -/*! - * \brief Max resends count value for T1 timer for cases when local side have - * received remote Hello. Libzrtp uses this extended number of retries when there - * is an evidence, that remote side supports ZRTP protocol (remote Hello received). - * This approach allows to eliminate problem when ZRTP state-machine switches to - * NO_ZRTP state while remote side is computing his initial DH value. (especially - * important for slow devices) - */ -#define ZRTP_T1_MAX_COUNT_EXT 60 - -/*! Hello retries counter for ZRTP_EVENT_NO_ZRTP_QUICK event */ -#define ZRTP_NO_ZRTP_FAST_COUNT 5 - -/*! - * \brief Max T1 timeout - * ZRTP_T1_MAX_COUNT is the threshold for the growth of the timeout value of - * HELLO resends. See \ref ZRTP_T1 for details. - */ -#define ZRTP_T1_CAPPING 200 - -/*! - * \brief ZRTP stream initiation period in milliseconds - * If for some reason the initiation of a secure ZRTP stream can't be performed - * at a given time (there are no retained secrets for the session, or the - * concurrent stream is being processed in "DH" mode) the next attempt will be - * done in ZRTP_PROCESS_T1 milliseconds. If at the end of ZRTP_PROCESS_T1_MAX_COUNT - * attempts the necessary conditions haven't been reached, the task is canceled. - * The mechanism of delayed execution is the same as the mechanism of delayed - * packet sending. \sa ZRTP_PROCESS_T1_MAX_COUNT - */ -#define ZRTP_PROCESS_T1 50 - -/*! - * \brief Max recall count value - * This is the threshold value for ZRTP stream initiation tries. See \ref - * ZRTP_PROCESS_T1 for details. -*/ -#define ZRTP_PROCESS_T1_MAX_COUNT 20000 - -/*! - * \brief Retransmission timer T2 in milliseconds - * T2 is used for the retransmission of all ZRTP messages except HELLO. The - * timeout value is doubled after every retransmission. The gain (max timeout's - * value) is limited by \ref ZRTP_T2_CAPPING. \ref ZRTP_T2_MAX_COUNT is the limit - * for packets resent as for \ref ZRTP_T1. - */ -#define ZRTP_T2 150 - -/*! - * \brief Max retransmissions for non-HELLO packets - * ZRTP_T2_MAX_COUNT limits number of resends for the non-HELLO/GOCLEAR packets. - * When exceeded, call_is_on_error() is called and the error code is set to - * \ref zrtp_protocol_error_t#zrtp_error_timeout - */ -#define ZRTP_T2_MAX_COUNT 10 - - -/*! - * \brief Max timeout value for protocol packets (except HELLO and GOCLEAR) - * The resend timeout value grows until it reaches ZRTP_T2_CAPPING. After that - * the state machine keeps resending until the resend count hits the limit of - * \ref ZRTP_T2_MAX_COUNT - */ -#define ZRTP_T2_CAPPING 1200 - -/*! - * \brief Retransmission timer for GoClear resending in milliseconds. - * To prevent pinholes from closing or NAT bindings from expiring, the GoClear - * message should be resent every N seconds while waiting for confirmation from - * the user. GoClear replays are endless. - */ -#define ZRTP_T3 300 - -/*! - * \brief Set of timeouts for Error packet replays. - * The meaning of these fields are the same as in the T1 group but for - * Error/ErrorAck packets. The values of these options are not strongly - * defined by the draft. We use empirical values. - */ -#define ZRTP_ET 150 -#define ZRTP_ETI_MAX_COUNT 10 -#define ZRTP_ETR_MAX_COUNT 3 - -/* ZRTP Retries schedule for slow CSD channel */ -#define ZRTP_CSD_T4PROC 2000 - -#define ZRTP_CSD_T1 400 + ZRTP_CSD_T4PROC -#define ZRTP_CSD_T2 900 + ZRTP_CSD_T4PROC -#define ZRTP_CSD_T3 900 + ZRTP_CSD_T4PROC -#define ZRTP_CSD_T4 200 + ZRTP_CSD_T4PROC -#define ZRTP_CSD_ET 200 + ZRTP_CSD_T4PROC - - -/*! Defines the max component number which can be used in a HELLO agreement */ -#define ZRTP_MAX_COMP_COUNT 7 - - -/* - * Some definitions of protocol structure sizes. To simplify sizeof() constructions - */ -#define ZRTP_VERSION_SIZE 4 -#define ZRTP_ZID_SIZE 12 -#define ZRTP_CLIENTID_SIZE 16 -#define ZRTP_COMP_TYPE_SIZE 4 -#define ZRTP_RS_SIZE 32 -#define ZRTP_RSID_SIZE 8 -#define ZRTP_PACKET_TYPE_SIZE 8 -#define RTP_V2_HDR_SIZE 12 -#define RTP_HDR_SIZE RTP_V2_HDR_SIZE -#define RTCP_HDR_SIZE 8 -#define ZRTP_HV_SIZE 32 -#define ZRTP_HV_NONCE_SIZE 16 -#define ZRTP_HV_KEY_SIZE 8 -#define ZRTP_HMAC_SIZE 8 -#define ZRTP_CFBIV_SIZE 16 -#define ZRTP_MITM_SAS_SIZE 4 -#define ZRTP_MESSAGE_HASH_SIZE 32 -#define ZRTP_HASH_SIZE 32 - -/* Without header and HMAC: + + + + */ -#define ZRTP_HELLO_STATIC_SIZE (ZRTP_VERSION_SIZE + ZRTP_CLIENTID_SIZE + 32 + ZRTP_ZID_SIZE + 4) - -/* Without header and HMAC: + */ -#define ZRTP_DH_STATIC_SIZE (32 + 4*8) - -/* Without header and HMAC: + + */ -#define ZRTP_COMMIT_STATIC_SIZE (32 + ZRTP_ZID_SIZE + 4*5) - -/* + + + CRC32 */ -#define ZRTP_MIN_PACKET_LENGTH (RTP_HDR_SIZE + 4 + 8 + 4) - - -#if ( ZRTP_PLATFORM != ZP_SYMBIAN ) - #pragma pack(push,1) -#endif - - - -/** Base ZRTP messages header */ -typedef struct zrtp_msg_hdr -{ - /** ZRTP magic cookie */ - uint16_t magic; - - /** ZRTP message length in 4-byte words */ - uint16_t length; - - /** ZRTP message type */ - zrtp_uchar8_t type; -} zrtp_msg_hdr_t; - -/*! - * \brief ZRTP HELLO packet data - * Contains fields needed to construct/store a ZRTP HELLO packet - */ -typedef struct zrtp_packet_Hello -{ - zrtp_msg_hdr_t hdr; - /** ZRTP protocol version */ - zrtp_uchar4_t version; - - /** ZRTP client ID */ - zrtp_uchar16_t cliend_id; - - /*!< Hash to prevent DOS attacks */ - zrtp_uchar32_t hash; - - /** Endpoint unique ID */ - zrtp_uchar12_t zid; -#if ZRTP_BYTE_ORDER == ZBO_LITTLE_ENDIAN - uint8_t padding2:4; - - /** Passive flag */ - uint8_t pasive:1; - - /** M flag */ - uint8_t mitmflag:1; - - /** Signature support flag */ - uint8_t sigflag:1; - - uint8_t uflag:1; - - /** Hash scheme count */ - uint8_t hc:4; - uint8_t padding3:4; - - /** Cipher count */ - uint8_t ac:4; - - /** Hash scheme count */ - uint8_t cc:4; - - /** SAS scheme count */ - uint8_t sc:4; - - /** PK Type count */ - uint8_t kc:4; -#elif ZRTP_BYTE_ORDER == ZBO_BIG_ENDIAN - uint8_t uflag:1; - uint8_t sigflag:1; - uint8_t mitmflag:1; - uint8_t pasive:1; - uint8_t padding2:4; - uint8_t padding3:4; - uint8_t hc:4; - uint8_t cc:4; - uint8_t ac:4; - uint8_t kc:4; - uint8_t sc:4; -#endif - - zrtp_uchar4_t comp[ZRTP_MAX_COMP_COUNT*5]; - zrtp_uchar8_t hmac; -} zrtp_packet_Hello_t; - - -/** - * @brief ZRTP COMMIT packet data - * Contains information to build/store a ZRTP commit packet. - */ -typedef struct zrtp_packet_Commit -{ - zrtp_msg_hdr_t hdr; - - /** Hash to prevent DOS attacks */ - zrtp_uchar32_t hash; - - /** ZRTP endpoint unique ID */ - zrtp_uchar12_t zid; - - /** hash calculations schemes selected by ZRTP endpoint */ - zrtp_uchar4_t hash_type; - - /** cipher types selected by ZRTP endpoint */ - zrtp_uchar4_t cipher_type; - - /** SRTP auth tag lengths selected by ZRTP endpoint */ - zrtp_uchar4_t auth_tag_length; - - /** session key exchange schemes selected by endpoints */ - zrtp_uchar4_t public_key_type; - - /** SAS calculation schemes selected by endpoint*/ - zrtp_uchar4_t sas_type; - /** hvi. See "ZRTP Internet Draft" */ - zrtp_uchar32_t hv; - zrtp_uchar8_t hmac; -} zrtp_packet_Commit_t; - - -/** - * @brief ZRTP DH1/2 packets data - * Contains fields needed to constructing/storing ZRTP DH1/2 packet. - */ -typedef struct zrtp_packet_DHPart -{ - zrtp_msg_hdr_t hdr; - - /** Hash to prevent DOS attacks */ - zrtp_uchar32_t hash; - - /** hash of retained shared secret 1 */ - zrtp_uchar8_t rs1ID; - - /** hash of retained shared secret 2 */ - zrtp_uchar8_t rs2ID; - - /** hash of user-defined secret */ - zrtp_uchar8_t auxsID; - - /** hash of PBX secret */ - zrtp_uchar8_t pbxsID; - - /** pvi/pvr or nonce field depends on stream mode */ - zrtp_uchar1024_t pv; - zrtp_uchar8_t hmac; -} zrtp_packet_DHPart_t; - - -/** - * @brief ZRTP Confirm1/Confirm2 packets data - */ -typedef struct zrtp_packet_Confirm -{ - zrtp_msg_hdr_t hdr; - - /** HMAC of preceding parameters */ - zrtp_uchar8_t hmac; - - /** The CFB Initialization Vector is a 128 bit random nonce */ - zrtp_uchar16_t iv; - - /** Hash to prevent DOS attacks */ - zrtp_uchar32_t hash; - - /** Unused (Set to zero and ignored) */ - uint8_t pad[2]; - - /** Length of optional signature field */ - uint8_t sig_length; - - /** boolean flags for allowclear, SAS verified and disclose */ - uint8_t flags; - - /** how long (seconds) to cache shared secret */ - uint32_t expired_interval; -} zrtp_packet_Confirm_t; - - -/** - * @brief ZRTP Confirm1/Confirm2 packets data - */ -typedef struct zrtp_packet_SASRelay -{ - zrtp_msg_hdr_t hdr; - - /** HMAC of preceding parameters */ - zrtp_uchar8_t hmac; - - /** The CFB Initialization Vector is a 128 bit random nonce */ - zrtp_uchar16_t iv; - - /** Unused (Set to zero and ignored) */ - uint8_t pad[2]; - - /** Length of optionas signature field */ - uint8_t sig_length; - - /** boolean flags for allowclear, SAS verified and disclose */ - uint8_t flags; - - /** Rendering scheme of relayed sasvalue (for trusted MitMs) */ - zrtp_uchar4_t sas_scheme; - - /** Trusted MITM relayed sashash */ - uint8_t sashash[32]; -} zrtp_packet_SASRelay_t; - - -/** - * @brief GoClear packet structure according to ZRTP specification - */ -typedef struct zrtp_packet_GoClear -{ - zrtp_msg_hdr_t hdr; - - /** Clear HMAC to protect SRTP session from accidental termination */ - zrtp_uchar8_t clear_hmac; -} zrtp_packet_GoClear_t; - - -/** - * @brief Error packet structure in accordance with ZRTP specification - */ -typedef struct zrtp_packet_Error -{ - zrtp_msg_hdr_t hdr; - - /** ZRTP error code defined by draft and \ref zrtp_protocol_error_t */ - uint32_t code; -} zrtp_packet_Error_t; - -/** ZFone Ping Message. Similar to ZRTP protocol packet format */ -typedef struct -{ - zrtp_msg_hdr_t hdr; - zrtp_uchar4_t version; /** Zfone discovery protocol version */ - zrtp_uchar8_t endpointhash; /** Zfone endpoint unique identifier */ -} zrtp_packet_zfoneping_t; - -/** ZFone Ping MessageAck. Similar to ZRTP protocol packet format */ -typedef struct -{ - zrtp_msg_hdr_t hdr; - zrtp_uchar4_t version; /** Zfone discovery protocol version */ - zrtp_uchar8_t endpointhash; /** Zfone endpoint unique identifier */ - zrtp_uchar8_t peerendpointhash; /** EndpointHash copied from Ping message */ - uint32_t peerssrc; -} zrtp_packet_zfonepingack_t; - -/*! \} */ - -#if ( ZRTP_PLATFORM != ZP_SYMBIAN ) - #pragma pack(pop) -#endif - -#endif /*__ZRTP_PROTOCOL_H__*/ diff --git a/libs/libzrtp/include/zrtp_srtp.h b/libs/libzrtp/include/zrtp_srtp.h deleted file mode 100644 index 8a5489364a..0000000000 --- a/libs/libzrtp/include/zrtp_srtp.h +++ /dev/null @@ -1,252 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Vitaly Rozhkov - */ - -#ifndef __ZRTP_SRTP_H__ -#define __ZRTP_SRTP_H__ - -#include "zrtp_config.h" -#include "zrtp_error.h" -#include "zrtp_types.h" -#include "zrtp_crypto.h" - - -/* in host order, so outside the #if */ -#define ZRTP_RTCP_E_BIT 0x80000000 -/* for byte-access */ -#define ZRTP_RTCP_E_BYTE_BIT 0x80 -#define ZRTP_RTCP_INDEX_MASK 0x7fffffff - - -/*! - * \defgroup srtp SRTP encryption interface - * \ingroup zrtp_dev - * \{ - */ - -/* Special types and definitions for the embedded implementation */ -#if (!defined(ZRTP_USE_EXTERN_SRTP) || (ZRTP_USE_EXTERN_SRTP == 0)) -#include "zrtp_srtp_builtin.h" - -/*! - * \brief Structure describing an SRTP session. - * An instance of this structure is created by calling zrtp_srtp_create() - * and destroyed by calling zrtp_srtp_destroy(). It is used for - * protecting and unprotecting included streams. - */ -struct zrtp_srtp_ctx_t -{ - zrtp_srtp_stream_ctx_t *outgoing_srtp; /*!< pointer to outgoing SRTP stream context */ - zrtp_srtp_stream_ctx_t *incoming_srtp; /*!< pointer to incoming SRTP stream context */ -}; - -/*! - * \brief Global context of an internal SRTP implementation. - * It is created by calling zrtp_srtp_init() and destroyed by calling zrtp_srtp_down(). - * This context is used for holding replay protection mechanism data. - */ -typedef struct -{ - zrtp_rp_ctx_t *rp_ctx; /*!< pointer to replay protection context. */ -} zrtp_srtp_global_t; - -#else -typedef void zrtp_srtp_global_t; -#endif /* BUILDIN SRTP */ - -/*! Defines types of SRTP hmac functions */ -typedef enum zrtp_srtp_hash_id_t -{ - /*! - * @warning SHA1 hash algorithm is for internal use only! It used for srtp authentication and does - * not used in ZRTP protocol itself. Don't use it in \ref zrtp_profile_t#hash_schemes configuration. - */ - ZRTP_SRTP_HASH_HMAC_SHA1 = 10 -} zrtp_srtp_hash_id_t; - - -/*! - * \brief Structure describing SRTP/SRTCP stream parameters. - */ -typedef struct -{ - /*!< Cipher used to encrypt packets */ - zrtp_cipher_t *cipher; - /*! - * \brief Cipher key length in bytes (not including salt length). - * Used for cipher key derivation on stream initialization - * by calling \ref zrtp_srtp_create(). - */ - uint32_t cipher_key_len; - - /*!< Hash used for packets authentication */ - zrtp_hash_t *hash; - - /*! - * \brief Key length in bytes for HMAC generation. - * Used for auth key derivation on stream initialization by calling \ref - * zrtp_srtp_create() and for filling the key buffer with zeros on - * stream deinitialization by calling \ref zrtp_srtp_destroy(). - */ - uint32_t auth_key_len; - - /*!< Structure describing SRTP authentication scheme */ - zrtp_auth_tag_length_t *auth_tag_len; -} zrtp_srtp_policy_t; - - -/*! - * \brief Structure describing SRTP stream parameters. - * Variables of this type should be mapped into the SRTP stream context when - * a new stream is created. - */ -typedef struct -{ - zrtp_srtp_policy_t rtp_policy; /*!< crypto policy for RTP stream */ - zrtp_srtp_policy_t rtcp_policy; /*!< crypto policy for RTCP stream */ - - zrtp_cipher_t *dk_cipher; /*!< cipher for the key derivation mechanism */ - - /*!< Master key for key derivation. (holds the key value only, without the salt) */ - zrtp_string64_t key; - /*!< Master salt for key derivation. (salt should be 14 bytes length) */ - zrtp_string64_t salt; - - uint16_t ssrc; -} zrtp_srtp_profile_t; - - -/*! - * \brief Initialize SRTP engine and allocate global SRTP context. - * Contains global data for all sessions and streams. For correct memory - * management, the global SRTP context should be released by calling \ref - * zrtp_srtp_destroy(). A pointer to the allocated SRTP global should be saved - * at zrtp->srtp_global. - * \warning this function \b must be called before any operation with the SRTP - * engine. - * \param zrtp - pointer to libzrtp global context - * \return - * - zrtp_status_ok if success - * - zrtp_status_fail if error. - */ -zrtp_status_t zrtp_srtp_init(zrtp_global_t *zrtp); - -/*! - * \brief Free all allocated resources that were allocated by initialization - * This function \b must be called at the end of SRTP engine use. - * A pointer to deallocated SRTP global context (zrtp->srtp_global) - * should be cleared ( set to NULL). - * \param zrtp - pointer to libzrtp global context; - * \return - * - zrtp_status_ok - if SRTP engine has been deinitialized successfully; - * - one of \ref zrtp_status_t errors - if deinitialization failed. - */ -zrtp_status_t zrtp_srtp_down( zrtp_global_t *zrtp); - -/*! - * \brief Creates SRTP context based on given incoming and outgoing profiles. - * \param srtp_global - pointer to SRTP engine global context; - * \param inc_profile - profile for incoming stream configuration; - * \param out_profile - profile for outgoing stream configuration. - * \return - * - pointer to allocated and initialized SRTP session; - * - NULL if error. - */ -zrtp_srtp_ctx_t * zrtp_srtp_create( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_profile_t *inc_profile, - zrtp_srtp_profile_t *out_profile ); - -/*! - * \brief Destroys SRTP context that was allocated by \ref zrtp_srtp_create() - * \param srtp_global - pointer to SRTP engine global context; - * \param srtp_ctx - pointer to SRTP context. - * \return - * - zrtp_status_ok - if SRTP context has been destroyed successfully; - * - one of \ref zrtp_status_t errors if error. - */ -zrtp_status_t zrtp_srtp_destroy( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t * srtp_ctx ); - - -/*! - * \brief Function applies SRTP protection to the RTP packet. - * If zrtp_status_ok is returned, then packet points to the resulting SRTP - * packet; otherwise, no assumptions should be made about the value of either - * data elements. - * \note This function assumes that it can write the authentication tag - * directly into the packet buffer, right after the the RTP payload. 32-bit - * boundary alignment of the packet is assumed as well. - * \param srtp_global - global SRTP context; - * \param srtp_ctx - SRTP context to use in processing the packet; - * \param packet - pointer to the packet to be protected. - * \return - * - zrtp_status_ok - if packet has been protected successfully; - * - one of \ref zrtp_status_t errors - if protection failed. - */ -zrtp_status_t zrtp_srtp_protect( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet ); - -/*! - * \brief Decrypts SRTP packet. - * If zrtp_status_ok is returned, then packet points to the resulting plain RTP - * packet; otherwise, no assumptions should be made about the value of either - * data elements. - * \warning This function assumes that the SRTP packet is aligned on - * a 32-bit boundary. - * \param srtp_global - global SRTP context; - * \param srtp_ctx - SRTP context to use in processing the packet; - * \param packet - pointer to the packet to be unprotected. - * \return - * - zrtp_status_ok - if packet has been unprotected successfully - * - one of \ref zrtp_status_t errors - if decryption failed - */ -zrtp_status_t zrtp_srtp_unprotect( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet ); - -/*! - * \brief Function applies SRTCP protection to the RTCP packet. - * If zrtp_status_ok is returned, then packet points to the result in SRTCP - * packet; otherwise, no assumptions should be made about the value of either - * data elements. - * \note This function assumes that it can write the authentication tag - * directly into the packet buffer, right after the the RTP payload. 32-bit - * boundary alignment of the packet is also assumed. - * \param srtp_global - global SRTP context; - * \param srtp_ctx - SRTP context to use in processing the packet; - * \param packet - pointer to the packet to be protected. - * \return - * - zrtp_status_ok - if packet has been protected successfully; - * - one of \ref zrtp_status_t errors - if protection failed. - */ -zrtp_status_t zrtp_srtp_protect_rtcp( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet ); - -/*! - * \brief Decrypts SRTCP packet. - * If zrtp_status_ok is returned, then packet points to the resulting RTCP - * packet; otherwise, no assumptions should be made about the value of either - * data elements. - * \warning This function assumes that the SRTP packet is aligned on - * a 32-bit boundary. - * \param srtp_global - global SRTP context; - * \param srtp_ctx - SRTP context to use in processing the packet; - * \param packet - pointer to the packet to be unprotected. - * \return - * - zrtp_status_ok - if packet has been unprotected successfully; - * - one of \ref zrtp_status_t errors - if decryption failed. -*/ -zrtp_status_t zrtp_srtp_unprotect_rtcp( zrtp_srtp_global_t *srtp_global, - zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rtp_info_t *packet ); - -/* \} */ - -#endif /*__ZRTP_SRTP_H__ */ diff --git a/libs/libzrtp/include/zrtp_srtp_builtin.h b/libs/libzrtp/include/zrtp_srtp_builtin.h deleted file mode 100644 index 0e92d4af88..0000000000 --- a/libs/libzrtp/include/zrtp_srtp_builtin.h +++ /dev/null @@ -1,149 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - * Vitaly Rozhkov - */ - -#ifndef __ZRTP_SRTP_BUILTIN_H__ -#define __ZRTP_SRTP_BUILTIN_H__ - -#include "zrtp_config.h" -#include "zrtp_error.h" -#include "zrtp_types.h" -#include "zrtp_crypto.h" - -/*! - * \defgroup dev_srtp Built in SRTP realization - * \ingroup zrtp_dev - * \{ - */ - -/*! - * \brief Sliding window width in bits. - * This window is used by the replay protection mechanism. As stated in the - * RFC3711, '3.3.2., the replay protection sliding window width MUST be at least - * 64, but MAY be set to a higher value. - */ -#if (ZRTP_PLATFORM == ZP_SYMBIAN) -# define ZRTP_SRTP_WINDOW_WIDTH 16 -#else -# define ZRTP_SRTP_WINDOW_WIDTH 128 -#endif - -#if ZRTP_SRTP_WINDOW_WIDTH % 8 -/*! - * \brief Sliding window width in bytes if padding is needed. - * This is used for allocating a window as a uint8_t array. - */ -#define ZRTP_SRTP_WINDOW_WIDTH_BYTES ZRTP_SRTP_WINDOW_WIDTH/8+1 -#else -/*! - * \brief Sliding window width in bytes if padding isn't needed. - * This is used for allocating a window as a uint8_t array. - */ -#define ZRTP_SRTP_WINDOW_WIDTH_BYTES ZRTP_SRTP_WINDOW_WIDTH/8 -#endif - -#define RP_INCOMING_DIRECTION 1 -#define RP_OUTGOING_DIRECTION 2 - - -/*! \brief Structure describing replay protection engine data */ -typedef struct -{ - uint32_t seq; /*!< sequence number of packet on the top of sliding window */ - uint8_t window[ZRTP_SRTP_WINDOW_WIDTH_BYTES]; /*!< sliding window buffer */ -} zrtp_srtp_rp_t; - - -/*! \brief Structure describing cipher wrapper */ -typedef struct -{ - /*!< cipher that will be used for packet encryption */ - zrtp_cipher_t *cipher; - - /*!< pointer to cipher's context */ - void *ctx; -} zrtp_srtp_cipher_t; - - -/*! \brief Structure describing authentication wrapper */ -typedef struct -{ - zrtp_hash_t *hash; /*!< hash component for authentication tag generation */ - uint8_t *key; /*!< key buffer for HMAC generation */ - uint32_t key_len; /*!< key length in bytes. Used for zeroes filling of buffer with key */ - zrtp_auth_tag_length_t *tag_len; /*!< SRTP authentication scheme component */ -} zrtp_srtp_auth_t; - - -/*! \brief Structure for SRTP stream context description. */ -typedef struct -{ - /*!< wrapper for cipher component and holding its auxiliary data. Used for RTP encryption */ - zrtp_srtp_cipher_t rtp_cipher; - /*!< wrapper for hash component and holding its auxiliary data. Used for RTP authentication */ - zrtp_srtp_auth_t rtp_auth; - - /*!< wrapper for cipher component and holding its auxiliary data. Used for RTCP encryption */ - zrtp_srtp_cipher_t rtcp_cipher; - /*!< wrapper for hash component and holding its auxiliary data. Used for RTCP authentication */ - zrtp_srtp_auth_t rtcp_auth; -} zrtp_srtp_stream_ctx_t; - - -/*! - * \brief Enumeration of labels used in key derivation for various purposes. - * See RFC3711, "4.3. Key Derivation" for more details - */ -typedef enum -{ - label_rtp_encryption = 0x00, /*!< for RTP cipher's key derivation */ - label_rtp_msg_auth = 0x01, /*!< for RTP packets authentication mechanism's key derivation */ - label_rtp_salt = 0x02, /*!< for RTP cipher's salt derivation */ - - label_rtcp_encryption = 0x03, /*!< used for RTCP cipher's key derivation */ - label_rtcp_msg_auth = 0x04, /*!< for RTCP packets authentication mechanism key derivation */ - label_rtcp_salt = 0x05 /*!< for RTCP cipher's salt derivation */ -} zrtp_srtp_prf_label; - -typedef zrtp_srtp_cipher_t zrtp_dk_ctx; - - -/*! - * \brief Structure describing a protection node. - * Each node keeps data for protecting RTP and RTCP packets against replays - * within streams with a given SSRC. There are two replay protection nodes for - * each SSRC value in the two lists. One is used for incoming packets and - * the other for outgoing packets. -*/ -typedef struct -{ - zrtp_srtp_rp_t rtp_rp; /*!< RTP replay protection data */ - zrtp_srtp_rp_t rtcp_rp; /*!< RTCP replay protection data */ - uint32_t ssrc; /*!< RTP media SSRC for nodes searching in the linked list */ - zrtp_srtp_ctx_t *srtp_ctx; /*!< SRTP context related with current node*/ - mlist_t mlist; -} zrtp_rp_node_t; - - -/*! -* \brief Structure describing replay protection context. -* This structure holds two linked list's heads and two mutexes for -* synchronization access to appropriate lists. -*/ -typedef struct -{ - zrtp_rp_node_t inc_head; /*!< head of replay protection nodes list for incoming packets */ - zrtp_mutex_t* inc_sync; /*!< mutex for incoming list access synchronization */ - zrtp_rp_node_t out_head; /*!< head of replay protection nodes list for outgoing packets */ - zrtp_mutex_t* out_sync; /*!< mutex for outgoing list access synchronization */ -} zrtp_rp_ctx_t; - -/* \} */ - -#endif /* __ZRTP_SRTP_BUILTIN_H__ */ diff --git a/libs/libzrtp/include/zrtp_string.h b/libs/libzrtp/include/zrtp_string.h deleted file mode 100644 index a132130cfe..0000000000 --- a/libs/libzrtp/include/zrtp_string.h +++ /dev/null @@ -1,283 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_STRING_H__ -#define __ZRTP_STRING_H__ - -#include "zrtp_config.h" - -/** - * \file zrtp_strings.h - * \brief libzrtp safe strings - */ - -/*============================================================================*/ -/* Libzrtp Strings */ -/*============================================================================*/ - -#define ZRTP_STRING8 12 -#define ZRTP_STRING16 20 -#define ZRTP_STRING32 36 -#define ZRTP_STRING64 68 -#define ZRTP_STRING128 132 -#define ZRTP_STRING256 260 -#define ZRTP_STRING1024 1028 - - -#if ( ZRTP_PLATFORM != ZP_SYMBIAN ) -#pragma pack(push, 1) -#endif - -typedef struct zrtp_stringn -{ - uint16_t length; - uint16_t max_length; - char buffer[0]; -} zrtp_stringn_t; - -typedef struct zrtp_string8 -{ - uint16_t length; - uint16_t max_length; - char buffer[ZRTP_STRING8]; -} zrtp_string8_t; - - -typedef struct zrtp_string16 -{ - uint16_t length; - uint16_t max_length; - char buffer[ZRTP_STRING16]; -} zrtp_string16_t; - -typedef struct zrtp_string32 -{ - uint16_t length; - uint16_t max_length; - char buffer[ZRTP_STRING32]; -} zrtp_string32_t; - -typedef struct zrtp_string64 -{ - uint16_t length; - uint16_t max_length; - char buffer[ZRTP_STRING64]; -} zrtp_string64_t; - -typedef struct zrtp_string128 -{ - uint16_t length; - uint16_t max_length; - char buffer[ZRTP_STRING128]; -} zrtp_string128_t; - -typedef struct zrtp_string256 -{ - uint16_t length; - uint16_t max_length; - char buffer[ZRTP_STRING256]; -} zrtp_string256_t; - -typedef struct zrtp_string1024 -{ - uint16_t length; - uint16_t max_length; - char buffer[ZRTP_STRING1024]; -} zrtp_string1024_t; - -#if ( ZRTP_PLATFORM != ZP_SYMBIAN ) -#pragma pack(pop) -#endif - - -/** - * \defgroup zrtp_strings Libzrtp Safe Strings - * - * Using standard C-like strings is potentially dangerous in any program. All standard functions for - * working with c-strings rely on zero-termination, since c-strings don't contain a representation - * of their length. This can cause many mistakes. Moreover, it is impossible to use these strings - * for storing binary data. - * - * To solve these problems libzrtp uses zstrings instead of normal c-strings. A zstring is just a - * wrapped c-string that stores its own length. Use the following data types, macros and utility - * functions for working with zstrings in your applications. - * - * zstrings are easy to use, and at the same time light-weight and flexible. - * We use two groups of zstring types: - * \li zrtp_stringn_t - base type for all operations with zstrings; - * \li zrtp_stringXX_t group - storage types. - * - * One can use any zrtp_stringXX_t type (big enough to store necessary data) esired and operate with - * it using global zstring functions. To cast zrtp_stringXX_t to zrtp_stringn_t, the \ref ZSTR_GV - * and \ref ZSTR_GVP macros can be used. - * - * The main principle of running zstrings is storing its current data size. So to avoid mistakes and - * mess it is advised to use preestablished initialization macros. The description of each follows. - * \{ - */ - - -/** - * \brief Casts zrtp_stringXX_t to a pointer to zrtp_stringn_t. - * - * This macro prevents static casts caused by using zstring functions. Prevents mistakes and makes - * zstrings safer to use. - * \sa ZSTR_GVP - */ -#define ZSTR_GV(pstr) \ -(zrtp_stringn_t*)((char*)pstr.buffer - sizeof(pstr.max_length) - sizeof(pstr.length)) - -/** - * \brief Casts zrtp_stringXX_t* to a pointer to zrtp_stringn_t. - * - * This macro prevents static casts from using zstring functions. - * \sa ZSTR_GV - */ -#define ZSTR_GVP(pstr) \ -(zrtp_stringn_t*)((char*)pstr->buffer - sizeof(pstr->max_length) - sizeof(pstr->length)) - -/** - * \brief Macro for empty zstring initialization - * \warning Use this macro on every zrtp_string structure allocation. - * usage: \code zrtp_string_t zstr = ZSTR_INIT_EMPTY(zstr); \endcode - */ -#define ZSTR_INIT_EMPTY(a) { 0, sizeof(a.buffer) - 1, { 0 }} - -/** - * \brief Macro for zstring initialization from a constant C-string - * usage: \code zrtp_string_t zstr = ZSTR_INIT_WITH_CONST_CSTRING("zstring use example"); \endcode - */ -#define ZSTR_INIT_WITH_CONST_CSTRING(s) {sizeof(s) - 1, 0, s} - -/** - * \brief Macro for zstring clearing - * - * Use this macro for initializing already created zstrings - * usage: \code ZSTR_SET_EMPTY(zstr); \endcode - */ -#define ZSTR_SET_EMPTY(a)\ -{ a.length = 0; a.max_length = sizeof(a.buffer) - 1; a.buffer[0] = 0; } - - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/** - * \brief compare two zstrings - * - * Function compares the two strings left and right. - * \param left - one string for comparing; - * \param right - the other string for comparing. - * \return - * - -1 if left string less than right; - * - 0 if left string is equal to right; - * - 1 if left string greater than right. - */ -int zrtp_zstrcmp(const zrtp_stringn_t *left, const zrtp_stringn_t *right); - -/** - * \brief Copy a zstring - * - * The zrtp_zstrcpy function copies the string pointed by src to the structure pointed to by dst. - * \param src source string; - * \param dst destination string. - */ -void zrtp_zstrcpy(zrtp_stringn_t *dst, const zrtp_stringn_t *src); - -/** - * \brief Copy first N bytes of zstring - * - * The zrtp_zstrncpy function copies the first N bytes from the string pointed to by src to the - * structure pointed by dst. - * \param src - source string; - * \param dst - destination string; - * \param size - nuber of bytes to copy. - */ -void zrtp_zstrncpy(zrtp_stringn_t *dst, const zrtp_stringn_t *src, uint16_t size); - -/** - * @brief Copy a c-string into a z-string - * \param dst - destination zsyring - * \param src - source c-string to be copied. - */ -void zrtp_zstrcpyc(zrtp_stringn_t *dst, const char *src); - - -/** - * \brief Copy first N bytes of a c-string into a z-string - * \param dst - destination zsyring - * \param src - source c-string to be copied. - * \param size - number of bytes to be copied from \c src to \c dst - */ -void zrtp_zstrncpyc(zrtp_stringn_t *dst, const char *src, uint16_t size); - -/** - * \brief Concatenate two strings - * - * The zrtp_zstrcat function appends the src string to the dst string. If dst string doesn't have - * enough space it will be truncated. - * \param src source string; - * \param dst destination string. - */ -void zrtp_zstrcat(zrtp_stringn_t *dst, const zrtp_stringn_t *src); - -/** - * \brief Clear a zstring - * \param zstr - string for clearing; - */ -void zrtp_wipe_zstring(zrtp_stringn_t *zstr); - -/** - * \brief Compare two binary strings - * - * This function is used to prevent errors caused by other, non byte-to-byte comparison - * implementations. The secret sorting function is sensitive to such things. - * - * \param s1 - first string for comparison - * \param s2 - second string for comparison - * \param n - number of bytes to be compared - * \return - an integer less than, equal to, or greater than zero, if the first n bytes of s1 - * is found, respectively, to be less than, to match, or to be greater than the first n bytes of s2. - */ -int zrtp_memcmp(const void* s1, const void* s2, uint32_t n); - -/** - * \brief Converts binary data to the hex string representation - * - * \param bin - pointer to the binary buffer for converting; - * \param bin_size - binary data size; - * \param buff - destination buffer; - * \param buff_size - destination buffer size. - * \return - * - pointer to the buff with converted data; - * - "Buffer too small" in case of error. - */ -const char* hex2str(const char* bin, int bin_size, char* buff, int buff_size); - -/** - * \brief Converts hex string to the binary representation - * - * \param buff - source buffer for converting; - * \param buff_size - source buffer size; - * \param bin - pointer to the destination binary buffer; - * \param bin_size - binary data size; - * \return - * - pointer to the buff with converted data, or NULL in case of error. - */ -char *str2hex(const char* buff, int buff_size, char* bin, int bin_size); - -#if defined(__cplusplus) -} -#endif - -/** \} */ - -#endif /* __ZRTP_STRING_H__ */ diff --git a/libs/libzrtp/include/zrtp_types.h b/libs/libzrtp/include/zrtp_types.h deleted file mode 100644 index b1282cc3e6..0000000000 --- a/libs/libzrtp/include/zrtp_types.h +++ /dev/null @@ -1,987 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - - -#ifndef __ZRTP_TYPES_H__ -#define __ZRTP_TYPES_H__ - -#include "zrtp_config.h" -#include "bn.h" -#include "zrtp_base.h" -#include "zrtp_iface.h" -#include "zrtp_list.h" -#include "zrtp_legal.h" -#include "zrtp_string.h" -#include "zrtp_protocol.h" - - -/** - * \brief Defines ZRTP state-machine states - * \ingroup zrtp_types - * - * The conditions for switching from one state to another, and libzrtp behavior in every state is - * described in detail in \ref XXX and depicted in diagram XXX and XXX. - * - * The current stream state is stored in the zrtp_stream_info_t#state variable and available for - * reading at any time. - */ -typedef enum zrtp_state_t -{ - ZRTP_STATE_NONE = 0, - ZRTP_STATE_ACTIVE, /** Just right stream attaching, before protocol start */ - ZRTP_STATE_START, /** Protocol initiated, Discovery haven't started yet */ - ZRTP_STATE_WAIT_HELLOACK, /** Hello sending, waiting for HelloAck */ - ZRTP_STATE_WAIT_HELLO, /** HelloAck received, Waiting for peer Hello */ - ZRTP_STATE_CLEAR, /** CLEAR state */ - ZRTP_STATE_START_INITIATINGSECURE, /** Starting Initiator state-machine */ - ZRTP_STATE_INITIATINGSECURE, /** Commit retries, waiting for DH1 */ - ZRTP_STATE_WAIT_CONFIRM1, /** DH2 retries, waiting for Confirm1 */ - ZRTP_STATE_WAIT_CONFIRMACK, /** Confirm2 retries, waiting for ConfirmAck */ - ZRTP_STATE_PENDINGSECURE, /** Responder state-machine, waiting for DH2 */ - ZRTP_STATE_WAIT_CONFIRM2, /** Waiting for Confirm2 to finalize ZRTP exchange */ - ZRTP_STATE_SECURE, /** SECURE state, call is encrypted */ - ZRTP_STATE_SASRELAYING, /** SAS transferring to the remote peer (for MiTM only) */ - ZRTP_STATE_INITIATINGCLEAR, /** Switching to CLEAR initated by the local endpoint */ - ZRTP_STATE_PENDINGCLEAR, /** CLEAR request have been received */ - ZRTP_STATE_INITIATINGERROR, /** Protocol ERROR detected on local side */ - ZRTP_STATE_PENDINGERROR, /** Protocol ERROR received from the remote peer */ - ZRTP_STATE_ERROR, /** Protocol ERROR state. Check zrtp_stream_info#last_error*/ -#if (defined(ZRTP_BUILD_FOR_CSD) && (ZRTP_BUILD_FOR_CSD == 1)) - ZRTP_STATE_DRIVEN_INITIATOR, - ZRTP_STATE_DRIVEN_RESPONDER, - ZRTP_STATE_DRIVEN_PENDING, -#endif - ZRTP_STATE_NO_ZRTP, /** Discovery phase failed. Remote peer doesn't support ZRTP */ - ZRTP_STATE_COUNT -} zrtp_state_t; - -/** - * \brief Enumeration for ZRTP stream mode definition - * \ingroup zrtp_types - */ -typedef enum zrtp_stream_mode_t -{ - ZRTP_STREAM_MODE_UNKN = 0, /** Unused stream - unknown mode */ - ZRTP_STREAM_MODE_CLEAR = 1, /** Just after stream attaching - mode is undefined */ - ZRTP_STREAM_MODE_DH = 2, /** FULL DH ZRTP stream mode */ - ZRTP_STREAM_MODE_PRESHARED = 3, /** Preshared ZRTP stream mode */ - ZRTP_STREAM_MODE_MULT = 4, /** Multistream ZRTP stream mode */ - ZRTP_STREAM_MODE_COUNT = 5 -} zrtp_stream_mode_t; - -/** - * \brief ZRTP session profile - * \ingroup zrtp_types - * \ingroup zrtp_main_init - * - * ZRTP Sessions are configured with a profile scheme. Each profile is defined by a structure of the - * given type. zrtp_profile_t contains a set of preferences for crypto components and other - * protocol parameters. - * - * The Crypto component choosing mechanism is as follows: both sides communicated their supported - * components during the "discovery phase". After that the initiator chooses the optimal - * intersection of components. - * - * For components identification the numerical values of the following types are used: - * zrtp_hash_id_t, zrtp_cipher_id_t, zrtp_atl_id_t, and zrtp_sas_id_t. The profile field responsible - * for components of a particular type setting is an integer-valued array where component - * identifiers should be placed in order of priority. 0-element is of the first priority. The list - * should end with ZRTP_COMP_UNKN=0. - * - * The values in the profile may be filled either by libzrtp zrtp_profile_defaults() or by the user - * manually. - * - * The profile is applied to the stream context on allocation by zrtp_session_init(). - * - * \sa XXX - */ -struct zrtp_profile_t -{ - /** - * \brief Allowclear mode flag - * - * This option means that the ZRTP peer allows SRTP termination. If allowclear is disabled, the - * ZRTP peer must stay in protected mode until the moment the ZRTP stream is shut down. When not - * in "allowclear" mode, libzrtp will reject all incoming GoClear packages and will not generate - * its own. - * - * Setting the value equal to 1 turns "allowclear" on, and 0 turns "allowclear" off. If - * "allowclear" is disabled zrtp_stream_clear() returns zrtp_status_fail. - */ - uint8_t allowclear; - - /** - * \brief ZRTP "autosecure" mode flag - * - * In "autosecure" mode, a protected connection will be initiated automatically just after - * stream start-up. If the option "autosecure" is switched off, then a secure connection can be - *initialized only by calling zrtp_stream_secure(). - */ - uint8_t autosecure; - - /** - * \brief Disclose bit. - * - * This field MUST be set by user application if it's going to disclose stream keys. - */ - uint8_t disclose_bit; - - /** - * \brief Enabled Discovery Optimization - * - * ZRTP protocol specification allows to speed-up the discovery process by sending Commit - * instead of HelloAck. This is the default behavior for most of ZRTP endpoints. It allows to - * eliminate one unnecessary exchange. - * - * At other hand, this optimization may cose some problems on slow devices: using this option, - * the endpoint starts to compute DH value right after receiving remote Hello. It may take - * seginificent amount of time on slow device (of is the device is busy on other calculations). - * As all libzrtp messages are processed in single thread, while local endpoint computing DH - * it be unable to response on remote Hello-s and remote side may switch to NO_ZRTP state. - * - * Not use this option is you running libzrtp on slow device or your software supports HQ video - * conferences. Enabled by default. - */ - uint8_t discovery_optimization; - - /** - * \brief Cache time-to-live - * - * The time interval libzrtp should retain secrets. This parameter sets the secret's time to - * live in seconds. This option is global for all connections processed by the library. It is - * used together with zrtp_session_info_t#cache_ttl. - * - * ZRTP_CACHE_DEFAULT_TTL value is used by default. - */ - uint32_t cache_ttl; - - /** \brief SAS calculation scheme preferences */ - uint8_t sas_schemes[ZRTP_MAX_COMP_COUNT+1]; - - /** \brief Cipher type preferences */ - uint8_t cipher_types[ZRTP_MAX_COMP_COUNT+1]; - - /** \brief Public key exchange scheme preferences */ - uint8_t pk_schemes[ZRTP_MAX_COMP_COUNT+1]; - - /** \brief Auth tag length preferences */ - uint8_t auth_tag_lens[ZRTP_MAX_COMP_COUNT+1]; - - /** - * \brief Hash calculation scheme preferences - * \note ZRTP_HASH_SHA256 is only one hash algorithm supported by current version of libzrtp. - */ - uint8_t hash_schemes[ZRTP_MAX_COMP_COUNT+1]; -}; - -/** - * \brief Shared secret structure - * \ingroup zrtp_iface_cache - * - * This structure stores ZRTP shared secret values used in the protocol. - */ -struct zrtp_shared_secret_t -{ - /** \brief ZRTP secret value */ - zrtp_string64_t value; - - /** - * \brief last usage time-stamp in seconds. - * - * Library updates this value on generation of the new value based on previous one. - */ - uint32_t lastused_at; - - /** - * \brief TTL value in seconds. - * - * Available for reading after the Hello exchange. Updated on switching to Secure state. - */ - uint32_t ttl; - - /** - * \brief Loaded secret flag. - * - * When the flag is set (= 1), the secret has been loaded from the cache. Otherwise the secret - * has been generated. - * \warning For internal use only. Don't modify this flag in the application. - */ - uint8_t _cachedflag; -}; - -/** - * \brief Lists MitM roles on PBX call transferring - * - * Enumeration type for the ZRTP modes based on the role of the MitM. - */ -typedef enum zrtp_mitm_mode_t -{ - /** MitM is not supported or not activated. */ - ZRTP_MITM_MODE_UNKN = 0, - - /** - * \brief Client-side mode called to the PBX in ZRTP trusted MiTM mode. - * - * Libzrtp activates this state on receiving an Hello, indicating that remote side is trusted - * MiTM. - */ - ZRTP_MITM_MODE_CLIENT, - - /** - * \brief Server-side mode to transfer SAS to the registrant. - * - * Libzrtp switches to this state on starting zrtp_update_remote_options(). - */ - ZRTP_MITM_MODE_RECONFIRM_SERVER, - /** - * \brief Client-side mode accepted SAS transfer from the trusted MiTM. - * - * Libzrtp activates this state on receiving an SASRELAY from a trusted MiTM endpoint. - */ - ZRTP_MITM_MODE_RECONFIRM_CLIENT, - /** - * \brief Server-side mode to accept the user's registration requests. - * - * Libzrtp switches to this state on starting a registration stream by - * zrtp_stream_registration_start() or zrtp_stream_registration_secure(). - */ - ZRTP_MITM_MODE_REG_SERVER, - /** - * \brief User-side mode to confirm the registration ritual. - * - * The library enables this state when a remote party invites it to the registration ritual - * by a special flag in the Confirm packet. - */ - ZRTP_MITM_MODE_REG_CLIENT -} zrtp_mitm_mode_t; - - -/** \manonly */ - - -/*======================================================================*/ -/* Internal ZRTP libzrtp datatypes */ -/*======================================================================*/ - -/** - * @defgroup types_dev libzrtp types for developers - * The data types used in inside libzrte. This section is for libzrtp developers - * @ingroup zrtp_dev - * \{ - */ - - -/** - * @brief Enumeration for ZRTP protocol packets type definition - * @warning! Don't change order of these definition without synchronizing with - * print* functions (see zrtp_log.h) - */ -typedef enum -{ - ZRTP_UNPARSED = -1, /** Unparsed packet */ - ZRTP_NONE = 0, /** Not ZRTP packet */ - ZRTP_HELLO = 1, /** ZRTP protocol HELLO packet */ - ZRTP_HELLOACK = 2, /** ZRTP protocol HELLOACK packet */ - ZRTP_COMMIT = 3, /** ZRTP protocol COMMIT packet */ - ZRTP_DHPART1 = 4, /** ZRTP protocol DHPART1 packet */ - ZRTP_DHPART2 = 5, /** ZRTP protocol DHPART2 packet */ - ZRTP_CONFIRM1 = 6, /** ZRTP protocol CONFIRM1 packet */ - ZRTP_CONFIRM2 = 7, /** ZRTP protocol CONFIRM2 packet */ - ZRTP_CONFIRM2ACK = 8, /** ZRTP protocol CONFIRM2ACK packet */ - ZRTP_GOCLEAR = 9, /** ZRTP protocol GOCLEAR packet */ - ZRTP_GOCLEARACK = 10, /** ZRTP protocol GOCLEARACK packet */ - ZRTP_ERROR = 11, /** ZRTP protocol ERROR packet */ - ZRTP_ERRORACK = 12, /** ZRTP protocol ERRORACK packet */ - ZRTP_PROCESS = 13, /** This is not a packet type but type of task for scheduler */ - ZRTP_SASRELAY = 14, /** ZRTP protocol SASRELAY packet */ - ZRTP_RELAYACK = 15, /** ZRTP protocol RELAYACK packet */ - ZRTP_ZFONEPING = 16, /** Zfone3 Ping packet */ - ZRTP_ZFONEPINGACK = 17, /** Zfone3 PingAck packet */ - ZRTP_MSG_TYPE_COUNT = 18 -} zrtp_msg_type_t; - - -/** - * @brief enumeration for protocol state-machine roles - * Protocol role fully defines it's behavior. ZRTP peer chooses a role according - * to specification. For details see internal developers documentation - */ -typedef enum zrtp_statemachine_type_t -{ - ZRTP_STATEMACHINE_NONE = 0, /** Unknown type. Used as error value */ - ZRTP_STATEMACHINE_INITIATOR = 1, /** Defines initiator's protocol logic */ - ZRTP_STATEMACHINE_RESPONDER = 2 /** Defines responder's protocol logic */ -} zrtp_statemachine_type_t; - -#define ZRTP_BIT_RS1 0x02 -#define ZRTP_BIT_RS2 0x04 -#define ZRTP_BIT_AUX 0x10 -#define ZRTP_BIT_PBX 0x20 - -/** - * @brief Library global context - * Compilers and linkers on some operating systems don't support the declaration - * of global variables in c files. Storing a context allows us to solve this - * problem in a way that unifies component use. The context is created by calling - * zrtp_init(), and is destroyed with zrtp_down(). It contains data necessary - * for crypto-component algorithms, including hash schemes, cipher types, SAS - * schemes etc. Context data can be divided into three groups: - * - ID of client ZRTP peer; - * - RNG related fields (hash context for entropy computing); - * - DH scheme related fields(internal data used for DH exchange); - * - headers of the lists of every crypto-component type used for component - * management. - * All of this data, except for "RNG related fields", is for internal use only - * and set automatically. All that is needed is to link every created session - * to global context. - * @sa zrtp_init() zrtp_down() zrtp_session_init() - */ -struct zrtp_global_t -{ - uint32_t lic_mode; /** ZRTP license mode. */ - zrtp_string16_t client_id; /** Local ZRTP client ID. */ - uint8_t is_mitm; /** Flags defines that the local endpoint acts as ZRTP MiTM. */ - MD_CTX rand_ctx; /** Hash context for entropy accumulation for the RNG unit. */ - uint8_t rand_initialized; /** RNG unit initialization flag. */ - zrtp_string256_t def_cache_path; /** Full path to ZRTP cache file. */ - unsigned cache_auto_store; /** Set when user wants libzrtp to flush the cache once it changed */ - zrtp_mutex_t* rng_protector; /** This object is used to protect the shared RNG hash zrtp#rand_ctx */ - struct BigNum one; /** This section provides static data for DH3K and DH4K components */ - struct BigNum G; - struct BigNum P_2048; - struct BigNum P_2048_1; - struct BigNum P_3072; - struct BigNum P_3072_1; - uint8_t P_2048_data[256]; - uint8_t P_3072_data[384]; - mlist_t hash_head; /** Head of hash components list */ - mlist_t cipher_head; /** Head of ciphers list */ - mlist_t atl_head; /** Head of ATL components list */ - mlist_t pktype_head; /** Head of public key exchange schemes list */ - mlist_t sas_head; /** SAS schemes list */ - void* srtp_global; /** Storage for some SRTP global data */ - mlist_t sessions_head; /** Head of ZRTP sessions list */ - uint32_t sessions_count; /** Global sessions count used to create ZRTP session IDs. For debug purposes mostly. */ - uint32_t streams_count; /** Global streams count used to create ZRTP session IDs. For debug purposes mostly. */ - zrtp_mutex_t* sessions_protector; /** This object is used to synchronize sessions list operations */ - zrtp_callback_t cb; /** Set of feedback callbacks used by libzrtp to interact with the user-space.*/ -}; - - -/** - * @brief RTP packet structure used in libzrtp - * Used for conveniently working with RTP/ZRTP packets. A binary RTP/ZRTP - * packet is converted into a zrtp_rtp_info_t structure before processing by - * _zrtp_packet_preparse() - */ -typedef struct zrtp_rtp_info_t -{ - /** Packet length in bytes */ - uint32_t *length; - - /** Pointer to the RTP/ZRTP packet body */ - char *packet; - - /** Pointer to ZRTP Message part (skip ZRTP transport header part) */ - void *message; - - /** ZRTP packet type (ZRTP_NONE in case of non command packet) */ - zrtp_msg_type_t type; - - /** Straightened RTP/ZRTP sequence number in host mode */ - uint32_t seq; - - /** RTP SSRC/ZRTP in network mode */ - uint32_t ssrc; -} zrtp_rtp_info_t; - - -/** - * @brief Retained secrets container - * Contains the session's shared secret values and related flags restored from - * the cache. Every subsequent stream within a session uses these values - * through @ref zrtp_proto_secret_t pointers. By definition, different ZRTP - * streams can't change secret values. Secret flags are protected against race - * conditions by the mutex \c _protector. For internal use only. - */ -typedef struct zrtp_secrets_t -{ - /** First retained secret RS1. */ - zrtp_shared_secret_t *rs1; - - /** Second retained secret RS1. */ - zrtp_shared_secret_t *rs2; - - /** User-defined secret. */ - zrtp_shared_secret_t *auxs; - - /** PBX Secret for trusted MiTMs. */ - zrtp_shared_secret_t *pbxs; - - /** Bit-map to summarize shared secrets "Cached" flags. */ - uint32_t cached; - uint32_t cached_curr; - - /** Bit-map to summarize shared secrets "Matches" flags. */ - uint32_t matches; - uint32_t matches_curr; - - /** Bit-map to summarize shared secrets "Wrongs" flags. */ - uint32_t wrongs; - uint32_t wrongs_curr; - - /** This flag equals one if the secrets have been uploaded from the cache. */ - uint8_t is_ready; -} zrtp_secrets_t; - - -/** - * @brief Protocol shared secret - * Wrapper around the session shared secrets \ref zrtp_shared_secret. Used - * for ID storing and secret sorting according to ZRTP ID sec. 5.4.4. - */ -typedef struct zrtp_proto_secret_t -{ - /** Local-side secret ID */ - zrtp_string8_t id; - - /** Remote-side secret ID */ - zrtp_string8_t peer_id; - - /** Pointer to the binary value and set of related flags */ - zrtp_shared_secret_t *secret; -} zrtp_proto_secret_t; - - -/** - * @brief ZRTP messages cache - * This structure contains ZRTP messages prepared for sending or received from - * the other side. This scheme allows speed-ups the resending of packets and - * computing message hashes, and makes resending thread-safe. Besides packets, - * tasks retries are stored as well. - */ -typedef struct zrtp_stream_mescache_t -{ - zrtp_packet_Hello_t peer_hello; - zrtp_packet_Hello_t hello; - zrtp_packet_GoClear_t goclear; - zrtp_packet_Commit_t peer_commit; - zrtp_packet_Commit_t commit; - zrtp_packet_DHPart_t peer_dhpart; - zrtp_packet_DHPart_t dhpart; - zrtp_packet_Confirm_t confirm; - zrtp_string32_t h0; - zrtp_packet_Confirm_t peer_confirm; - zrtp_packet_Error_t error; - zrtp_packet_SASRelay_t sasrelay; - - zrtp_retry_task_t hello_task; - zrtp_retry_task_t goclear_task; - zrtp_retry_task_t dh_task; - zrtp_retry_task_t commit_task; - zrtp_retry_task_t dhpart_task; - zrtp_retry_task_t confirm_task; - zrtp_retry_task_t error_task; - zrtp_retry_task_t errorack_task; - zrtp_retry_task_t sasrelay_task; - - /*! - * 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; - - -/** - * @brief Crypto context for Diffie-Hellman calculations - * Used only by DH streams to store Diffie-Hellman calculations. Allocated on - * protocol initialization and released on switching to SECURE mode. - */ -typedef struct zrtp_dh_crypto_context_t -{ - /** DH secret value */ - struct BigNum sv; - - /** DH public value */ - struct BigNum pv; - - /** DH public value recalculated for remote side */ - struct BigNum peer_pv; - - /** DH shared secret. DHSS = hash(DHResult) */ - zrtp_string64_t dhss; - - unsigned int initialized_with; -} zrtp_dh_crypto_context_t; - - -/*! - * \brief Crypto context for ECDSA calculations - * Used to store ECDSA keys and calculations. Allocated on - * protocol initialization and released on switching to SECURE mode. - */ -typedef struct zrtp_dsa_crypto_context_t -{ - struct BigNum sv; /*!< DSA secret value */ - struct BigNum pv; /*!< DSA public value */ - struct BigNum peer_pv;/*!< DSA public value for some remote side */ -} zrtp_dsa_crypto_context_t; - - -/** - * @brief Protocol crypto context - * Used as temporary storage for ZRTP crypto data during protocol running. - * Unlike \ref zrtp_stream_crypto_t this context is needed only during key - * negotiation and destroyed on switching to SECURE state. - */ -typedef struct zrtp_proto_crypto_t -{ - /** ZRTP */ - zrtp_string128_t kdf_context; - - /** ZRTP stream key */ - zrtp_string64_t s0; - - /** Local hvi value for the hash commitment: hvi or nonce for Multistream. */ - zrtp_string64_t hv; - - /** Remove hvi value for the hash commitment: hvi or nonce for Multistream. */ - zrtp_string64_t peer_hv; - - /** Total messages hash. See ZRTP ID 5.4.4/5.5.4 */ - zrtp_string64_t mes_hash; - - /** RS1 */ - zrtp_proto_secret_t rs1; - - /** RS2 */ - zrtp_proto_secret_t rs2; - - /** User-Defined secret */ - zrtp_proto_secret_t auxs; - - /** PBX secret */ - zrtp_proto_secret_t pbxs; -} zrtp_proto_crypto_t; - -/*! - * \brief ZRTP protocol structure - * Protocol structure is responsible for ZRTP protocol logic (CLEAR-SECURE - * switching) and RTP media encrypting/decrypting. The protocol is created - * right after the discovery phase and destroyed on stream closing. - */ -struct zrtp_protocol_t -{ - /** Protocol mode: responder or initiator. */ - zrtp_statemachine_type_t type; - - /** Context for storing protocol crypto data. */ - zrtp_proto_crypto_t* cc; - - /** SRTP crypto engine */ - zrtp_srtp_ctx_t* _srtp; - - /** Back-pointer to ZRTP stream context. */ - zrtp_stream_t *context; -}; - -/** - * @brief Stream-persistent crypto options. - * Unlike \ref zrtp_proto_crypto_t these data are kept after switching to Secure - * state or stopping the protocol; used to sign/verify Confirm and GoClear packets. - */ -typedef struct zrtp_stream_crypto_t -{ - /** Local side hmackey value. */ - zrtp_string64_t hmackey; - - /** Remote side hmackey value. */ - zrtp_string64_t peer_hmackey; - - /** Local side ZRTP key for Confirms protection. */ - zrtp_string64_t zrtp_key; - - /** Remote side ZRTP key for Confirms verification. */ - zrtp_string64_t peer_zrtp_key; -} zrtp_stream_crypto_t; - - -/** - * @brief stream media context. Contains all RTP media-related information. - */ -typedef struct zrtp_media_context_t -{ - /** The highest ZRTP message sequence number received. */ - uint32_t high_in_zrtp_seq; - - /** The last ZRTP message sequence number sent. */ - uint32_t high_out_zrtp_seq; - - /** The highest RTP media sequence number received; used by SRTP. */ - uint32_t high_in_media_seq; - - /** The highest RTP media sequence number sent; used by SRTP. */ - uint32_t high_out_media_seq; - - /** SSRC of the RTP media stream associated with the current ZRTP stream. */ - uint32_t ssrc; -} zrtp_media_context_t; - -/*! - * \brief ZRTP stream context - * \warning Fields with prefix "_" are for internal use only. - */ -struct zrtp_stream_t -{ - /*! Stream unique identifier for debug purposes */ - zrtp_id_t id; - - /*! - * \brief Stream mode - * This field defines libzrtp behavior related to specified contexts. See - * "ZRTP Internet Draft" - * and \ref usage for additional information about stream types and their - * processing logic. - */ - zrtp_stream_mode_t mode; - - /*! - * \brief Defines ZRTP role in trusted MitM scheme. - * The value of this mode determines the behavior of the ZRTP machine - * according to it's role in the MitM scheme. Initially the mode is - * ZRTP_MITM_MODE_UNKN and then changes on protocol running. - */ - zrtp_mitm_mode_t mitm_mode; - - /*! - * \brief Previous ZRTP protocol states - * Used in analysis to determine the reason for a switch from one state to - * another. Enabled by _zrtp_change_state(. - */ - zrtp_state_t prev_state; - - /** 1 means that peer Hello have been raceived within current ZRTP session */ - uint8_t is_hello_received; - - /*!< Reflects current state of ZRTP protocol */ - zrtp_state_t state; - - /** - * @brief Persistent stream crypto options. - * Stores persistent crypto data needed after Confirmation. This data can be - * cleared only when the stream is destroyed. - */ - zrtp_stream_crypto_t cc; - - /** DH crypto context used in PK calculations */ - zrtp_dh_crypto_context_t dh_cc; - - /*! - * \brief Pointer to the ZRTP protocol implementation - * The protocol structure stores all crypto data during the securing - * procedure. After switching to SECURE state the protocol clears all - * crypto sources and performs traffic encryption/decryption. - */ - zrtp_protocol_t *protocol; - - /*!< Holder for RTP/ZRTP media stream options. */ - zrtp_media_context_t media_ctx; - - /*!< ZRTP messages and task retries cache */ - zrtp_stream_mescache_t messages; - - /*! - * Current value of "allowclear" option exchanged during ZRTP negotiation. - * Available for reading in SECURE state. - */ - uint8_t allowclear; - - /*! - * This flag shows when remote side is "passive" (has license mode PASSIVE) - * Available for reading in CLEAR state. - */ - uint8_t peer_passive; - - /*! - * \brief actual lifetime of stream secrets - * This variable contains the interval for retaining secrets within an - * established stream. In accordance with "ZRTP Internet Draft" - * this value is calculated as the minimal of local and remote TTLs after - * confirmation. Value is given in seconds and can be read in the SECURE - * state. It may be used in displaying session parameters. - */ - uint32_t cache_ttl; - - /*! - * \brief Peer disclose bit Indicates the ability of the remote side to - * disclose its session key. Specifies that the remote side allows call - * monitoring. If this flag is set, the end user must be informed. It can - * be read in the SECURE state. - */ - uint8_t peer_disclose_bit; - - /*! - * \brief Last protocol error code - * If there is a mistake in running the protocol, zrtp_event_callback() - * will be called and the required error code will be set to this field. - * An error code is the numeric representation of ZRTP errors defined in - * the draft. All error codes are defined by \ref zrtp_protocol_error_t. - */ - zrtp_protocol_error_t last_error; - - /** - * Duplicates MiTM flag from peer Hello message - */ - uint8_t peer_mitm_flag; - - /** - * Duplicates U flag from peer Hello message - */ - uint8_t peer_super_flag; - - /*! - * \brief Pointer to the concurrent DH stream - * If Commit messages are sent by both ZRTP endpoints at the same time, but - * are received in different media streams, "tie-breaking" rules apply - the - * Commit message with the lowest hvi value is discarded and the other side - * becomes the initiator. The media stream in which the Commit was sent will - * proceed through the ZRTP exchange while the media stream with the discarded - * Commit must wait for the completion of the other ZRTP exchange. A pointer - * to that "waiting" stream is stored in \c _concurrent. When the running - * stream is switched to "Initiating Secure" the concurrent stream is resumed. - */ - zrtp_stream_t *concurrent; - - /** Back-pointer to the ZRTP global data */ - zrtp_global_t *zrtp; - - /** Pointer to parent session context. Used for back capability */ - zrtp_session_t *session; - - /*!< Public key exchange component used within current stream */ - zrtp_pk_scheme_t *pubkeyscheme; - - /*! - * Pointer to the user data. This pointer can be used for fast access to - * some additional data attached to this ZRTP stream by the user application - */ - void *usr_data; - - /*! - * Pointer to the peer stream during a trusted MiTM call. - * @sa zrtp_link_mitm_calls() - */ - zrtp_stream_t *linked_mitm; - - /*! - * \brief Stream data protector - * A mutex is used to avoid race conditions during asynchronous calls - * (zrtp_stream_secure(), zrtp_stream_clear() etc.) in parallel to the main - * processing loop zrtp_process_rtp/srtp(). - */ - zrtp_mutex_t* stream_protector; -}; - - -/*! - * \brief ZRTP session context - * Describes the state of the ZRTP session. Stores data necessary and sufficient - * for processing ZRTP sessions. Encapsulates ZRTP streams and all crypto-data. - */ -struct zrtp_session_t -{ - /*! Session unique identifier for debug purposes */ - zrtp_id_t id; - - /*! - * \brief Local-side ZID - * The unique 12-characters string that identifies the local ZRTP endpoint. - * It must be generated by the user application on installation and used - * permanently for every ZRTP session. This ID allows remote peers to - * recognize this ZRTP endpoint. - */ - zrtp_string16_t zid; - - /*! - * \brief Remote-side ZID - * Extracted from the Hello packet of the very first ZRTP stream. Uniquely - * identifies the remote ZRTP peer. Used in combination with the local zid - * to restore secrets and other data from the previous call. Available for - * reading after the discovering phase. - */ - zrtp_string16_t peer_zid; - - /*!< ZRTP profile, defined crypto options and behavior for every stream within current session */ - zrtp_profile_t profile; - - /* - * Signaling Role which protocol was started with, one of zrtp_signaling_role_t values. - */ - unsigned signaling_role; - - /*! - * \brief Set of retained secrets and flags for the current ZRTP session. - * libzrtp uploads secrets and flags from the cache on the very first - * stream within every ZRTP session. - */ - zrtp_secrets_t secrets; - - /*!< ZRTP session key used to extend ZRTP session without additional DH exchange */ - zrtp_string64_t zrtpsess; - - /** First SAS base32/256 string */ - zrtp_string16_t sas1; - - /** Second SAS 256 string */ - zrtp_string16_t sas2; - - /** Binary SAS digest (ZRTP_SAS_DIGEST_LENGTH bytes) */ - zrtp_string32_t sasbin; - - /*!< Back-pointer to the ZRTP global data */ - zrtp_global_t *zrtp; - - /*!< Back-pointer to user data associated with this session context. */ - void *usr_data; - - /** Hash component used within current session */ - zrtp_hash_t *hash; - - /** Cipher component used within current session */ - zrtp_cipher_t *blockcipher; - - /** SRTP authentication component used within current session */ - zrtp_auth_tag_length_t *authtaglength; - - /** SAS scheme component used within current session */ - zrtp_sas_scheme_t *sasscheme; - - /** List of ZRTP streams attached to the session. */ - zrtp_stream_t streams[ZRTP_MAX_STREAMS_PER_SESSION]; - - /** This object is used to synchronize all stream list operations */ - zrtp_mutex_t* streams_protector; - - /** Prevents race conditions if streams start simultaneously. */ - zrtp_mutex_t* init_protector; - - /** - * This flag indicates that possible MiTM attach was detected during the protocol exchange. - */ - uint8_t mitm_alert_detected; - - mlist_t _mlist; -}; - -/*! \} */ - - -/*===========================================================================*/ -/* Data types and definitions for SRTP */ -/*===========================================================================*/ - -#if ZRTP_BYTE_ORDER == ZBO_LITTLE_ENDIAN - -/** - * RTP header structure - * @ingroup dev_srtp - */ -typedef struct -{ - uint16_t cc:4; /** CSRC count */ - uint16_t x:1; /** header extension flag */ - uint16_t p:1; /** padding flag */ - uint16_t version:2; /** protocol version */ - uint16_t pt:7; /** payload type */ - uint16_t m:1; /** marker bit */ - uint16_t seq; /** sequence number */ - uint32_t ts; /** timestamp */ - uint32_t ssrc; /** synchronization source */ -} zrtp_rtp_hdr_t; - -/** - * RTCP header structure - * @ingroup dev_srtp - */ -typedef struct -{ - unsigned char rc:5; /** reception report count */ - unsigned char p:1; /** padding flag */ - unsigned char version:2; /** protocol version */ - unsigned char pt:8; /** payload type */ - uint16_t len; /** length */ - uint32_t ssrc; /** synchronization source */ -} zrtp_rtcp_hdr_t; - -typedef struct -{ - unsigned int index:31; /** srtcp packet index in network order! */ - unsigned int e:1; /** encrypted? 1=yes */ - /** optional mikey/etc go here */ - /** and then the variable-length auth tag */ -} zrtp_rtcp_trailer_t; - -#else - -/** - * RTP header structure - * @ingroup dev_srtp - */ -typedef struct -{ - uint16_t version:2; /** protocol version */ - uint16_t p:1; /** padding flag */ - uint16_t x:1; /** header extension flag */ - uint16_t cc:4; /** CSRC count */ - uint16_t m:1; /** marker bit */ - uint16_t pt:7; /** payload type */ - uint16_t seq; /** sequence number */ - uint32_t ts; /** timestamp */ - uint32_t ssrc; /** synchronization source */ -} zrtp_rtp_hdr_t; - -/** - * RTCP header structure - * @ingroup dev_srtp - */ -typedef struct -{ - unsigned char version:2; /** protocol version */ - unsigned char p:1; /** padding flag */ - unsigned char rc:5; /** reception report count */ - unsigned char pt:8; /** payload type */ - uint16_t len; /** length */ - uint32_t ssrc; /** synchronization source */ -} zrtp_rtcp_hdr_t; - -typedef struct -{ - unsigned int e:1; /** encrypted? 1=yes */ - unsigned int index:31; /** srtcp packet index */ -} zrtp_rtcp_trailer_t; - -#endif - -/** - * RTP header extension structure - * @ingroup dev_srtp - */ -typedef struct -{ - uint16_t profile_specific; /** profile-specific info */ - uint16_t length; /** number of 32-bit words in extension */ -} zrtp_rtp_hdr_xtnd_t; - - -/** \endmanonly */ - -#endif /* __ZRTP_TYPES_H__ */ diff --git a/libs/libzrtp/include/zrtp_version.h b/libs/libzrtp/include/zrtp_version.h deleted file mode 100644 index fc0a349442..0000000000 --- a/libs/libzrtp/include/zrtp_version.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#ifndef __ZRTP_VERSION_H__ -#define __ZRTP_VERSION_H__ - -#define LIBZRTP_VERSION_MAJOR 1 - -#define LIBZRTP_VERSION_MINOR 20 -#define LIBZRTP_VERSION_BUILD 616 -#define LIBZRTP_VERSION_STR "v1.20 616" - -#endif /*__ZRTP_VERSION_H__*/ diff --git a/libs/libzrtp/projects/android/jni/Android.mk b/libs/libzrtp/projects/android/jni/Android.mk deleted file mode 100644 index cb3837b6bf..0000000000 --- a/libs/libzrtp/projects/android/jni/Android.mk +++ /dev/null @@ -1,72 +0,0 @@ -LOCAL_PATH := $(call my-dir)/../../.. - -include $(CLEAR_VARS) - -LOCAL_MODULE := libzrtp -MY_SRC_PATH := src - -MY_SRC_FILES := $(MY_SRC_PATH)/zrtp.c \ - $(MY_SRC_PATH)/zrtp_crc.c \ - $(MY_SRC_PATH)/zrtp_crypto_aes.c \ - $(MY_SRC_PATH)/zrtp_crypto_atl.c \ - $(MY_SRC_PATH)/zrtp_crypto_hash.c \ - $(MY_SRC_PATH)/zrtp_crypto_pk.c \ - $(MY_SRC_PATH)/zrtp_crypto_sas.c \ - $(MY_SRC_PATH)/zrtp_datatypes.c \ - $(MY_SRC_PATH)/zrtp_engine.c \ - $(MY_SRC_PATH)/zrtp_engine_driven.c \ - $(MY_SRC_PATH)/zrtp_iface_cache.c \ - $(MY_SRC_PATH)/zrtp_iface_scheduler.c \ - $(MY_SRC_PATH)/zrtp_iface_sys.c \ - $(MY_SRC_PATH)/zrtp_initiator.c \ - $(MY_SRC_PATH)/zrtp_legal.c \ - $(MY_SRC_PATH)/zrtp_list.c \ - $(MY_SRC_PATH)/zrtp_log.c \ - $(MY_SRC_PATH)/zrtp_pbx.c \ - $(MY_SRC_PATH)/zrtp_protocol.c \ - $(MY_SRC_PATH)/zrtp_responder.c \ - $(MY_SRC_PATH)/zrtp_rng.c \ - $(MY_SRC_PATH)/zrtp_srtp_builtin.c \ - $(MY_SRC_PATH)/zrtp_srtp_dm.c \ - $(MY_SRC_PATH)/zrtp_string.c \ - $(MY_SRC_PATH)/zrtp_utils.c \ - $(MY_SRC_PATH)/zrtp_utils_proto.c - -MY_SRC_FILES += third_party/bgaes/aes_modes.c \ - third_party/bgaes/sha2.c \ - third_party/bgaes/sha1.c \ - third_party/bgaes/aestab.c \ - third_party/bgaes/aeskey.c \ - third_party/bgaes/aescrypt.c - -MY_SRC_FILES += third_party/bnlib/bn.c \ - third_party/bnlib/bn32.c \ - third_party/bnlib/bninit32.c \ - third_party/bnlib/lbn32.c \ - third_party/bnlib/lbnmem.c \ - third_party/bnlib/legal.c - -LOCAL_SRC_FILES := $(MY_SRC_FILES) - -LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include - -LOCAL_C_INCLUDES := $(LOCAL_PATH)/include -LOCAL_C_INCLUDES += $(LOCAL_PATH)/third_party/bnlib -LOCAL_C_INCLUDES += $(LOCAL_PATH)/third_party/bgaes - -LOCAL_ARM_MODE := arm -LOCAL_CFLAGS := -DANDROID_NDK=5 - -#include $(BUILD_STATIC_LIBRARY) -include $(BUILD_SHARED_LIBRARY) - -# -# Dummy shared library to build libzrtp.a -# - -# include $(CLEAR_VARS) -# -# LOCAL_MODULE := libzrtp-dummy -# LOCAL_STATIC_LIBRARIES := libzrtp -# -# include $(BUILD_SHARED_LIBRARY) diff --git a/libs/libzrtp/projects/symbian/DelayRuner.cpp b/libs/libzrtp/projects/symbian/DelayRuner.cpp deleted file mode 100644 index e0297d63ff..0000000000 --- a/libs/libzrtp/projects/symbian/DelayRuner.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/* - ============================================================================ - Name : CDelayRuner.cpp - Author : R. Drutsky - Version : 1.0 - Copyright : Copyright (c) 2010 Soft Industry - Description : CCDelayRuner implementation - ============================================================================ - */ - -#include "DelayRuner.h" -#include "zrtp_iface_system.h" - -void zrtp_internal_delete_task_from_list(zrtp_stream_t* ctx, zrtp_retry_task_t* ztask); - -CDelayRuner::CDelayRuner() : - CActive(EPriorityLow) // Standard priority - { - } - -CDelayRuner* CDelayRuner::NewLC() - { - CDelayRuner* self = new (ELeave) CDelayRuner(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -CDelayRuner* CDelayRuner::NewL() - { - CDelayRuner* self = CDelayRuner::NewLC(); - CleanupStack::Pop(); // self; - return self; - } - -void CDelayRuner::ConstructL() - { - User::LeaveIfError(iTimer.CreateLocal()); // Initialize timer - CActiveScheduler::Add(this); // Add to scheduler - } - -CDelayRuner::~CDelayRuner() - { - Cancel(); // Cancel any request, if outstanding - iTimer.Close(); // Destroy the RTimer object - // Delete instance variables if any - } - -void CDelayRuner::DoCancel() - { - iTimer.Cancel(); - } - -void CDelayRuner::StartL(zrtp_stream_t *ctx, zrtp_retry_task_t* ztask) - { - Cancel(); // Cancel any request, just to be sure - //iState = EUninitialized; - iCtx = ctx; - iZTask = ztask; - iTimer.After(iStatus, ztask->timeout * 1000); // Set for later - SetActive(); // Tell scheduler a request is active - } - -void CDelayRuner::RunL() - { - if (iStatus == KErrNone) - { - // Do something useful - iZTask->_is_busy = 1 ; // may be we don't need this - (iZTask->callback)(iCtx,iZTask); - iZTask->_is_busy = 0 ; // may be we don't need this - } - zrtp_internal_delete_task_from_list(iCtx,iZTask); - } - -TInt CDelayRuner::RunError(TInt aError) - { - return aError; - } diff --git a/libs/libzrtp/projects/symbian/DelayRuner.h b/libs/libzrtp/projects/symbian/DelayRuner.h deleted file mode 100644 index ae19f3a4e6..0000000000 --- a/libs/libzrtp/projects/symbian/DelayRuner.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - ============================================================================ - Name : CDelayRuner.h - Author : R. Drutsky - Version : 1.0 - Copyright : Copyright (c) 2010 Soft Industry - Description : CDelayRuner declaration - ============================================================================ - */ - -#ifndef DELAYRUNER_H -#define DELAYRUNER_H - -#include // For CActive, link against: euser.lib -#include // For RTimer, link against: euser.lib - -#include -class CDelayRuner : public CActive - { -public: - // Cancel and destroy - ~CDelayRuner(); - - // Two-phased constructor. - static CDelayRuner* NewL(); - - // Two-phased constructor. - static CDelayRuner* NewLC(); - -public: - // New functions - // Function for making the initial request - void StartL(zrtp_stream_t *ctx, zrtp_retry_task_t* ztask); - -private: - // C++ constructor - CDelayRuner(); - - // Second-phase constructor - void ConstructL(); - -private: - // From CActive - // Handle completion - void RunL(); - - // How to cancel me - void DoCancel(); - - // Override to handle leaves from RunL(). Default implementation causes - // the active scheduler to panic. - TInt RunError(TInt aError); - -private: - enum TCDelayRunerState - { - EUninitialized, // Uninitialized - EInitialized, // Initalized - EError - // Error condition - }; - -private: - TInt iState; // State of the active object - RTimer iTimer; // Provides async timing service - - zrtp_stream_t *iCtx; - zrtp_retry_task_t * iZTask; - - }; - -#endif // CDELAYRUNER_H diff --git a/libs/libzrtp/projects/symbian/bld.bat b/libs/libzrtp/projects/symbian/bld.bat deleted file mode 100755 index 0bbff637c6..0000000000 --- a/libs/libzrtp/projects/symbian/bld.bat +++ /dev/null @@ -1 +0,0 @@ -bldmake bldfiles \ No newline at end of file diff --git a/libs/libzrtp/projects/symbian/bld.inf b/libs/libzrtp/projects/symbian/bld.inf deleted file mode 100644 index f477ab57f7..0000000000 --- a/libs/libzrtp/projects/symbian/bld.inf +++ /dev/null @@ -1,13 +0,0 @@ -/* - * Copyright (c) 2006-2007 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * - * Nikolay Popok mailto: - * - */ - -PRJ_MMPFILES -libzrtp.mmp - -PRJ_PLATFORMS -WINSCW GCCE WINC diff --git a/libs/libzrtp/projects/symbian/bldgcce.bat b/libs/libzrtp/projects/symbian/bldgcce.bat deleted file mode 100755 index cf1e17b541..0000000000 --- a/libs/libzrtp/projects/symbian/bldgcce.bat +++ /dev/null @@ -1,2 +0,0 @@ -abld build gcce urel -pause \ No newline at end of file diff --git a/libs/libzrtp/projects/symbian/libzrtp.mmp b/libs/libzrtp/projects/symbian/libzrtp.mmp deleted file mode 100644 index ba6a7a1001..0000000000 --- a/libs/libzrtp/projects/symbian/libzrtp.mmp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - */ - -TARGET libzrtp.lib -TARGETTYPE lib -UID 0x0FFFFFF0 - -VENDORID 0 - -//OPTION GCC +Wno-ctor-dtor-privacy -MACRO ZRTP_USE_STACK_MINIM - -USERINCLUDE . - -SOURCEPATH . -SOURCE DelayRuner.cpp -SOURCE zrtp_iface_symb.cpp - -SOURCEPATH ..\..\third_party\bnlib -SOURCE bn.c -SOURCE bn32.c -SOURCE bninit32.c -SOURCE lbn32.c -SOURCE lbnmem.c -SOURCE legal.c - -SOURCEPATH ..\..\src -SOURCE zrtp_crc.c -SOURCE zrtp_crypto_aes.c -SOURCE zrtp_crypto_atl.c -SOURCE zrtp_crypto_hash.c -SOURCE zrtp_crypto_pk.c -SOURCE zrtp_crypto_sas.c -SOURCE zrtp_datatypes.c -SOURCE zrtp_engine.c -SOURCE zrtp_iface_cache.c -SOURCE zrtp_iface_scheduler.c -SOURCE zrtp_iface_sys.c -SOURCE zrtp_initiator.c -SOURCE zrtp_list.c -SOURCE zrtp_log.c -SOURCE zrtp_pbx.c -SOURCE zrtp_protocol.c -SOURCE zrtp_responder.c -SOURCE zrtp_rng.c -SOURCE zrtp_srtp_builtin.c -SOURCE zrtp_string.c -SOURCE zrtp_utils.c -SOURCE zrtp_utils_proto.c -SOURCE zrtp.c - -SOURCEPATH ..\..\third_party\bgaes -SOURCE aes_modes.c -SOURCE aescrypt.c -SOURCE aeskey.c -SOURCE aestab.c -SOURCE sha1.c -SOURCE sha2.c - -SYSTEMINCLUDE ..\..\. -SYSTEMINCLUDE ..\..\include -SYSTEMINCLUDE ..\..\third_party\bnlib -SYSTEMINCLUDE ..\..\third_party\bgaes - -SYSTEMINCLUDE \epoc32\include -SYSTEMINCLUDE \epoc32\include\libc - -LIBRARY euser.lib - -SOURCEPATH ..\..\src -SOURCE zrtp_crypto_ec.c zrtp_crypto_ecdh.c zrtp_crypto_ecdsa.c zrtp_engine_driven.c zrtp_legal.c zrtp_srtp_dm.c diff --git a/libs/libzrtp/projects/symbian/zrtp_iface_symb.cpp b/libs/libzrtp/projects/symbian/zrtp_iface_symb.cpp deleted file mode 100644 index bfbe93770b..0000000000 --- a/libs/libzrtp/projects/symbian/zrtp_iface_symb.cpp +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - */ - -#include -#include -#include - -#include - -#include -#include -#include - -#include - -extern "C" -{ -/** - * @brief Get kernel-generated random number - * @bug seems not work - * @return 32 random bits - */ -uint32_t zrtp_symbian_kernel_random(); - -/** - * @brief Pseudo random number: sum of pid's shifted and xored by number of precceses - * @return - */ -uint32_t zrtp_sum_of_pid_and_number_of_poccesses(); - -/** - * @brief Number of milisecond past from particular date and time - * @return - */ -uint64_t zrtp_get_system_time_crazy(); - -/** - * @brief Current procces PID - * @return PID - */ -unsigned int zrtp_get_pid(); - -/** - * @brief Availible memory - * @return memory availible on heap - */ -uint32_t zrtp_get_availible_heap(); - -} - - - -//----------------------------------------------------------------------------- -zrtp_status_t zrtp_mutex_init(zrtp_mutex_t **mutex) { - RMutex *rmutex = new RMutex(); - //rmutex->CreateLocal(); was before - rmutex->CreateGlobal(KNullDesC); - *mutex = (zrtp_mutex_t*) rmutex; - return zrtp_status_ok; -} - -zrtp_status_t zrtp_mutex_lock(zrtp_mutex_t* mutex) { - RMutex *rmutex = (RMutex *) mutex; - rmutex->Wait(); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_mutex_unlock(zrtp_mutex_t* mutex) { - RMutex *rmutex = (RMutex *) mutex; - rmutex->Signal(); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_mutex_destroy(zrtp_mutex_t* mutex) { - RMutex *rmutex = (RMutex *) mutex; - if (rmutex) { - rmutex->Close(); - delete rmutex; - } - return zrtp_status_ok; -} - -//----------------------------------------------------------------------------- -zrtp_status_t zrtp_sem_init(zrtp_sem_t** sem, uint32_t value, uint32_t limit) { - RSemaphore *rsem = new RSemaphore(); - //rsem->CreateLocal(value); - rsem->CreateGlobal(KNullDesC,value); - *sem = (zrtp_sem_t*) rsem; - return zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_destroy(zrtp_sem_t* sem) { - RSemaphore *rsem = (RSemaphore *) sem; - if (rsem) { - rsem->Close(); - delete rsem; - } - return zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_wait(zrtp_sem_t* sem) { - RSemaphore *rsem = (RSemaphore *) sem; - rsem->Wait(); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_trtwait(zrtp_sem_t* sem) { - RSemaphore *rsem = (RSemaphore *) sem; - rsem->Wait(1000); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_post(zrtp_sem_t* sem) { - RSemaphore *rsem = (RSemaphore *) sem; - rsem->Signal(); - return zrtp_status_ok; -} - -//----------------------------------------------------------------------------- -int zrtp_sleep(unsigned int msec) { - TTimeIntervalMicroSeconds32 i(msec *1000); - User::After(i); - return 0; -} - -int zrtp_thread_create(zrtp_thread_routine_t start_routine, void *arg) { - RThread h; - TBuf<64> thName=_L("zrtp_thread"); - - h.Create(thName, start_routine, KDefaultStackSize*2, NULL, arg) ; - h.Resume(); - h.Close(); - - return NULL; -} -//----------------------------------------------------------------------------- -// For Scheduler -#if (defined(ZRTP_USE_BUILTIN_SCEHDULER) && (ZRTP_USE_BUILTIN_SCEHDULER ==1)) - -#include "DelayRuner.h" -#include "zrtp_error.h" -mlist_t tasks_head_s; -static uint8_t inited = 0 ; -static uint8_t is_running = 0; - -typedef struct { - zrtp_stream_t *ctx; /** ZRTP stream context associated with the task */ - zrtp_retry_task_t *ztask; /** ZRTP stream associated with the task */ - mlist_t _mlist; - CDelayRuner* ao; // Active object -} zrtp_sched_task_s_t; - -zrtp_status_t zrtp_def_scheduler_init(zrtp_global_t* zrtp) -{ - zrtp_status_t status = zrtp_status_ok; - ZRTP_LOG(3,("symbian","Init start")); - if (inited) { - return zrtp_status_ok; - } - - do { - init_mlist(&tasks_head_s); - is_running = 1; - inited = 1; - } while (0); - - ZRTP_LOG(3,("symbian","Init end")); - return status; -} - -void zrtp_def_scheduler_down() -{ - ZRTP_LOG(3,("symbian","Down start")); - mlist_t *node = 0, *tmp = 0; - - if (!inited) { - return; - } - - /* Stop main thread */ - is_running = 0; -// zrtp_sem_post(count); - - /* Then destroy tasks queue and realease all other resources */ - //zrtp_mutex_lock(protector); - - mlist_for_each_safe(node, tmp, &tasks_head_s) { - zrtp_sched_task_s_t* task = mlist_get_struct(zrtp_sched_task_s_t, _mlist, node); - if (task->ao!=NULL) - { - delete task->ao; - } - zrtp_sys_free(task); - } - init_mlist(&tasks_head_s); - -// zrtp_mutex_unlock(protector); - -// zrtp_mutex_destroy(protector); -// zrtp_sem_destroy(count); - - ZRTP_LOG(3,("symbian","Down end")); - inited = 0; -} - - -void zrtp_def_scheduler_call_later(zrtp_stream_t *ctx, zrtp_retry_task_t* ztask) -{ -// ZRTP_LOG(3,("symbian","CallLater start")); - //mlist_t *node=0, *tmp=0; - mlist_t* last = &tasks_head_s; - - //zrtp_mutex_lock(protector); - - if (!ztask->_is_enabled) { - //zrtp_mutex_unlock(protector); - return; - } - - do { - zrtp_sched_task_s_t* new_task = (zrtp_sched_task_s_t*)zrtp_sys_alloc(sizeof(zrtp_sched_task_s_t)); - if (!new_task) { - break; - } - - new_task->ctx = ctx; - new_task->ztask = ztask; - new_task->ao = CDelayRuner::NewL(); - - mlist_insert(last, &new_task->_mlist); - - new_task->ao->StartL(ctx,ztask); - //zrtp_sem_post(count); - } while (0); - - //ZRTP_LOG(3,("symbian","CallLater end")); - //zrtp_mutex_unlock(protector); -} - -void zrtp_def_scheduler_cancel_call_later(zrtp_stream_t* ctx, zrtp_retry_task_t* ztask) -{ - mlist_t *node=0, *tmp=0; - ZRTP_LOG(3,("symbian","CancelcallLater start")); -// zrtp_mutex_lock(protector); - - mlist_for_each_safe(node, tmp, &tasks_head_s) { - zrtp_sched_task_s_t* task = mlist_get_struct(zrtp_sched_task_s_t, _mlist, node); - if ((task->ctx == ctx) && ((task->ztask == ztask) || !ztask)) { - task->ao->Cancel(); - delete task->ao; // Cancel and delete task - mlist_del(&task->_mlist); - zrtp_sys_free(task); - //zrtp_sem_trtwait(count); - if (ztask) { - break; - } - } - } - ZRTP_LOG(3,("symbian","CancelCallLater done")); -// zrtp_mutex_unlock(protector); -} - -void zrtp_internal_delete_task_from_list(zrtp_stream_t* ctx, zrtp_retry_task_t* ztask) - { - mlist_t *node=0, *tmp=0; - ZRTP_LOG(3,("symbian","DelTask begin")); - mlist_for_each_safe(node, tmp, &tasks_head_s) - { - zrtp_sched_task_s_t* task = mlist_get_struct(zrtp_sched_task_s_t, _mlist, node); - if ((task->ctx == ctx) && ((task->ztask == ztask) || !ztask)) - { - delete task->ao; // Cancel and delete task - mlist_del(&task->_mlist); - zrtp_sys_free(task); - ZRTP_LOG(3,("symbian","DelTask Del")); - //zrtp_sem_trtwait(count); - if (ztask) - { - break; - } - } - } - ZRTP_LOG(3,("symbian","DelTask end")); - } - -void zrtp_def_scheduler_wait_call_later(zrtp_stream_t* ctx) -{ -} -#endif // ZRTP_USE_BUILTIN_SCEHDULER -//----------------------------------------------------------------------------- - -unsigned int zrtp_get_pid() - { - return getpid(); - } - -uint64_t zrtp_get_system_time_crazy() - { - TTime time; - - return time.MicroSecondsFrom(TTime(TDateTime (491,EAugust,7,3,37,17,347))).Int64(); - } - -uint32_t zrtp_sum_of_pid_and_number_of_poccesses() - { - TFindProcess fp; - RProcess procces; - TFullName proccesName; - uint_32t idsum=1; - uint_32t proccesCount=0; - fp.Find(KNullDesC); - while (fp.Next(proccesName)==KErrNone) - { - if (procces.Open(proccesName,EOwnerProcess)==KErrNone) - { - idsum+=procces.Id(); - proccesCount++; - procces.Close(); - } - } - idsum = (idsum << 3) xor proccesCount; - return idsum; - } - -uint32_t zrtp_get_availible_heap() - { - return User::Heap().MaxLength(); - } - -uint32_t zrtp_symbian_kernel_random() - { - return Math::Random(); - } diff --git a/libs/libzrtp/projects/win/libzrtp.2010.vcxproj.filters b/libs/libzrtp/projects/win/libzrtp.2010.vcxproj.filters deleted file mode 100644 index 7e1165d4b3..0000000000 --- a/libs/libzrtp/projects/win/libzrtp.2010.vcxproj.filters +++ /dev/null @@ -1,262 +0,0 @@ - - - - - {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 - - - src - - - src - - - - - - - \ No newline at end of file diff --git a/libs/libzrtp/projects/win/libzrtp.2017.vcxproj b/libs/libzrtp/projects/win/libzrtp.2017.vcxproj deleted file mode 100644 index 3e5362e219..0000000000 --- a/libs/libzrtp/projects/win/libzrtp.2017.vcxproj +++ /dev/null @@ -1,258 +0,0 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {C13CC324-0032-4492-9A30-310A6BD64FF5} - libzrtp.x32 - Win32Proj - libzrtp - - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - StaticLibrary - Unicode - $(DefaultPlatformToolset) - - - - - - - - - - - - - - - - - - - - - - - - - - - <_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 - 4267;%(DisableSpecificWarnings) - - - - 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 - 4267;%(DisableSpecificWarnings) - - - - 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 - 4267;%(DisableSpecificWarnings) - - - - 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 - 4267;%(DisableSpecificWarnings) - - - - 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.sln b/libs/libzrtp/projects/win/libzrtp.sln deleted file mode 100644 index b94a523c24..0000000000 --- a/libs/libzrtp/projects/win/libzrtp.sln +++ /dev/null @@ -1,28 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp_test", "libzrtp_test.vcproj", "{BA35741B-8C8E-4A39-9CA1-0CE032D6E4ED}" - ProjectSection(ProjectDependencies) = postProject - {C13CC324-E0CA-4492-9A30-310A6BD64FF5} = {C13CC324-E0CA-4492-9A30-310A6BD64FF5} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp", "libzrtp.vcproj", "{C13CC324-E0CA-4492-9A30-310A6BD64FF5}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {BA35741B-8C8E-4A39-9CA1-0CE032D6E4ED}.Debug|Win32.ActiveCfg = Debug|Win32 - {BA35741B-8C8E-4A39-9CA1-0CE032D6E4ED}.Debug|Win32.Build.0 = Debug|Win32 - {BA35741B-8C8E-4A39-9CA1-0CE032D6E4ED}.Release|Win32.ActiveCfg = Release|Win32 - {BA35741B-8C8E-4A39-9CA1-0CE032D6E4ED}.Release|Win32.Build.0 = Release|Win32 - {C13CC324-E0CA-4492-9A30-310A6BD64FF5}.Debug|Win32.ActiveCfg = Debug|Win32 - {C13CC324-E0CA-4492-9A30-310A6BD64FF5}.Debug|Win32.Build.0 = Debug|Win32 - {C13CC324-E0CA-4492-9A30-310A6BD64FF5}.Release|Win32.ActiveCfg = Release|Win32 - {C13CC324-E0CA-4492-9A30-310A6BD64FF5}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libs/libzrtp/projects/win/libzrtp.vcproj b/libs/libzrtp/projects/win/libzrtp.vcproj deleted file mode 100644 index 485bd2f02d..0000000000 --- a/libs/libzrtp/projects/win/libzrtp.vcproj +++ /dev/null @@ -1,499 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libzrtp/projects/win/libzrtp.x32.vcxproj b/libs/libzrtp/projects/win/libzrtp.x32.vcxproj deleted file mode 100644 index d67c404c97..0000000000 --- a/libs/libzrtp/projects/win/libzrtp.x32.vcxproj +++ /dev/null @@ -1,180 +0,0 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - {C13CC324-0032-4492-9A30-310A6BD64FF5} - libzrtp.x32 - Win32Proj - - - - StaticLibrary - MultiByte - - - StaticLibrary - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Configuration).x32\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Configuration).x32\ - 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=1;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebug - Default - - - Level3 - ProgramDatabase - CompileAsC - - - $(OutDir)libzrtp.x32.lib - - - - - ../../include;../../third_party/bnlib;../../third_party/bgaes;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1;%(PreprocessorDefinitions) - - - MultiThreaded - Default - false - - - Level3 - ProgramDatabase - CompileAsC - - - $(OutDir)libzrtp.x32.lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/libzrtp/projects/win/libzrtp.x32.vcxproj.filters b/libs/libzrtp/projects/win/libzrtp.x32.vcxproj.filters deleted file mode 100644 index 451b5531f3..0000000000 --- a/libs/libzrtp/projects/win/libzrtp.x32.vcxproj.filters +++ /dev/null @@ -1,262 +0,0 @@ - - - - - {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 - - - 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/projects/win/libzrtp.x64.vcxproj b/libs/libzrtp/projects/win/libzrtp.x64.vcxproj deleted file mode 100644 index 056158ec4f..0000000000 --- a/libs/libzrtp/projects/win/libzrtp.x64.vcxproj +++ /dev/null @@ -1,179 +0,0 @@ - - - - - Debug - x64 - - - Release - x64 - - - - {C13CC324-0064-4492-9A30-310A6BD64FF5} - libzrtp.x64 - Win32Proj - - - - StaticLibrary - MultiByte - - - StaticLibrary - MultiByte - - - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Configuration).x64\ - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Configuration).x64\ - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - ../../include;../../third_party/bnlib;../../third_party/bgaes;../../test/include;%(AdditionalIncludeDirectories) - _WIN64;_DEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1;%(PreprocessorDefinitions) - EnableFastChecks - MultiThreadedDebug - Default - - - Level3 - ProgramDatabase - CompileAsC - - - $(OutDir)libzrtp.x64.lib - - - - - ../../include;../../third_party/bnlib;../../third_party/bgaes;%(AdditionalIncludeDirectories) - _WIN64;NDEBUG;_LIB;HAVE_CONFIG_H=1;ZRTP_ENABLE_EC=1;%(PreprocessorDefinitions) - - - MultiThreaded - Default - false - - - Level3 - ProgramDatabase - CompileAsC - - - $(OutDir)libzrtp.x64.lib - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/libs/libzrtp/projects/win/libzrtp.x64.vcxproj.filters b/libs/libzrtp/projects/win/libzrtp.x64.vcxproj.filters deleted file mode 100644 index 533b86f682..0000000000 --- a/libs/libzrtp/projects/win/libzrtp.x64.vcxproj.filters +++ /dev/null @@ -1,262 +0,0 @@ - - - - - {c0e76076-0064-445d-8c07-32b6c762622b} - - - {a03c0d83-0064-4848-9704-22cdce5ab144} - - - {dbe8a34e-0064-495e-8df7-e82218921e60} - - - {96d1a5c9-0064-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 - - - 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/projects/win/libzrtp_not_ec.vcproj b/libs/libzrtp/projects/win/libzrtp_not_ec.vcproj deleted file mode 100644 index 63f6c1ca56..0000000000 --- a/libs/libzrtp/projects/win/libzrtp_not_ec.vcproj +++ /dev/null @@ -1,483 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libzrtp/projects/win/libzrtp_test.vcproj b/libs/libzrtp/projects/win/libzrtp_test.vcproj deleted file mode 100644 index 99ce3f1675..0000000000 --- a/libs/libzrtp/projects/win/libzrtp_test.vcproj +++ /dev/null @@ -1,211 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libzrtp/projects/win_ce/libzrtp_test_wince.vcproj b/libs/libzrtp/projects/win_ce/libzrtp_test_wince.vcproj deleted file mode 100644 index 4dfc6574c0..0000000000 --- a/libs/libzrtp/projects/win_ce/libzrtp_test_wince.vcproj +++ /dev/null @@ -1,500 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libzrtp/projects/win_ce/libzrtp_wince.sln b/libs/libzrtp/projects/win_ce/libzrtp_wince.sln deleted file mode 100644 index a732637635..0000000000 --- a/libs/libzrtp/projects/win_ce/libzrtp_wince.sln +++ /dev/null @@ -1,40 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 10.00 -# Visual Studio 2008 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp", "libzrtp_wince.vcproj", "{53F84E3B-9903-4046-897B-33FEFFED527A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libzrtp_test", "libzrtp_test_wince.vcproj", "{5C082222-FD44-4295-8055-915936F086BE}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4) - Debug|Smartphone 2003 (ARMV4) = Debug|Smartphone 2003 (ARMV4) - Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4) - Release|Smartphone 2003 (ARMV4) = Release|Smartphone 2003 (ARMV4) - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {53F84E3B-9903-4046-897B-33FEFFED527A}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4) - {53F84E3B-9903-4046-897B-33FEFFED527A}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4) - {53F84E3B-9903-4046-897B-33FEFFED527A}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4) - {53F84E3B-9903-4046-897B-33FEFFED527A}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4) - {53F84E3B-9903-4046-897B-33FEFFED527A}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4) - {53F84E3B-9903-4046-897B-33FEFFED527A}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4) - {53F84E3B-9903-4046-897B-33FEFFED527A}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4) - {53F84E3B-9903-4046-897B-33FEFFED527A}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4) - {5C082222-FD44-4295-8055-915936F086BE}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4) - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/libs/libzrtp/projects/win_ce/libzrtp_wince.vcproj b/libs/libzrtp/projects/win_ce/libzrtp_wince.vcproj deleted file mode 100644 index cbe4fb4389..0000000000 --- a/libs/libzrtp/projects/win_ce/libzrtp_wince.vcproj +++ /dev/null @@ -1,761 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libzrtp/projects/win_ce/libzrtp_wince_not_ec.vcproj b/libs/libzrtp/projects/win_ce/libzrtp_wince_not_ec.vcproj deleted file mode 100644 index d16b5559d6..0000000000 --- a/libs/libzrtp/projects/win_ce/libzrtp_wince_not_ec.vcproj +++ /dev/null @@ -1,741 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/libs/libzrtp/projects/win_kernel/MAKEFILE.WIN32 b/libs/libzrtp/projects/win_kernel/MAKEFILE.WIN32 deleted file mode 100644 index 2b15ded64a..0000000000 --- a/libs/libzrtp/projects/win_kernel/MAKEFILE.WIN32 +++ /dev/null @@ -1,132 +0,0 @@ -# -# Copyright (c) 2006 Philip R. Zimmermann. All rights reserved. -# Contact: http://philzimmermann.com -# For licensing and other legal details, see the file zrtp_legal.c. -# -# Andrew Rozinko - -# -# THIS MAKEFILE WORKS WITH MICROSOFT NMAKE ONLY -# - -# change this to point to your DDK - -DDK = ..\..\..\..\winddk\3790 -OS = wxp -BASENAME = libzrtp - -#RELEASE = 1 - -CC = cl -ASM = ml -LIB = lib - -all: $(BASENAME).lib - -# bnlib (the BigNumber engine) - -bnlib = \ - ../../third_party/bnlib/bn.obj \ - ../../third_party/bnlib/bn32.obj \ - ../../third_party/bnlib/bninit32.obj \ - ../../third_party/bnlib/lbn32.obj \ - ../../third_party/bnlib/lbnmem.obj \ - ../../third_party/bnlib/legal.obj - -protocol = \ - ../../src/zrtp.obj \ - ../../src/zrtp_crc.obj \ - ../../src/zrtp_crypto_aes.obj \ - ../../src/zrtp_crypto_atl.obj \ - ../../src/zrtp_crypto_hash.obj \ - ../../src/zrtp_crypto_pk.obj \ - ../../src/zrtp_crypto_sas.obj \ - ../../src/zrtp_datatypes.obj \ - ../../src/zrtp_engine.obj \ - ../../src/enterprise/zrtp_engine_driven.obj \ - ../../src/enterprise/zrtp_crypto_ec.obj \ - ../../src/enterprise/zrtp_crypto_ecdh.obj \ - ../../src/zrtp_iface_sys.obj \ - ../../src/zrtp_initiator.obj \ - ../../src/zrtp_legal.obj \ - ../../src/zrtp_list.obj \ - ../../src/zrtp_log.obj \ - ../../src/zrtp_pbx.obj \ - ../../src/zrtp_protocol.obj \ - ../../src/zrtp_responder.obj \ - ../../src/zrtp_rng.obj \ - ../../src/zrtp_srtp_builtin.obj \ - ../../src/zrtp_string.obj \ - ../../src/zrtp_utils.obj \ - ../../src/zrtp_utils_proto.obj - -bgaes = \ - ../../third_party/bgaes/aes_modes.obj \ - ../../third_party/bgaes/aescrypt.obj \ - ../../third_party/bgaes/aeskey.obj \ - ../../third_party/bgaes/aestab.obj \ - ../../third_party/bgaes/sha1.obj \ - ../../third_party/bgaes/sha2.obj - -OBJECTS = $(bnlib) $(protocol) $(bgaes) - -!IFNDEF RELEASE - -# Debug - -OUT_DIR = debug_ec.km - -DEFINES_D = -D_X86_=1 -Di386=1 -DSTD_CALL -DCONDITION_HANDLING=1 \ --DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 \ --DWINNT=1 -D_WIN32_WINNT=0x0500 -DWIN32_LEAN_AND_MEAN=1 -DDBG=1 -D_DEBUG -DDEBUG -DDEVL=1 \ --DFPO=0 -D_DLL=1 -D_IDWBUILD -DRDRDBG -DSRVDBG -DDBG_MESSAGES=1 \ --D_UNICODE -DLITTLE_ENDIAN -DZRTP_USE_ENTERPRISE=1 - -CFLAGS_D = $(DEFINES_D) -Zel -Zp8 -Gy -cbstring -Gz -QIfdiv- -QIf -Gi- -Gm- -GX- \ --GR- -GF -FI$(DDK)\inc\$(OS)\warning.h -Z7 -Od -Oi -Oy- -W3 - -!ELSE - -# Release - -OUT_DIR = release_ec.km - -DEFINES_D = -D_X86_=1 -Di386=1 -DSTD_CALL -DCONDITION_HANDLING=1 \ --DNT_UP=1 -DNO_DISK_ACCESS -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 \ --DWINNT=1 -D_WIN32_WINNT=0x0500 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 \ --DFPO=1 -DNDEBUG -D_DLL=1 -D_IDWBUILD -D_UNICODE \ --DLITTLE_ENDIAN -DZRTP_USE_ENTERPRISE=1 - -CFLAGS_D = $(DEFINES_D) -Zel -Zp8 -Gy -cbstring -Gz -QIfdiv- -QIf -Gi- -Gm- -GX- \ --GR- -GF -Oxs -Oy -FI$(DDK)\inc\$(OS)\warning.h -W3 -FAcs -Z7 - -!ENDIF - -ASM = ml -AFLAGS = /c /Cx /coff /Zi -AINCLUDE = -I. -I$(DDK)\inc - -CFLAGS = $(CFLAGS_D) -nologo -DHAVE_CONFIG_H=1 -DNT_DRIVER -D__BUILDMACHINE__=WinDDK \ - -I$(DDK)\inc\$(OS) -I$(DDK)\inc\ddk\$(OS) -I$(DDK)\inc\ddk\wdm\$(OS) \ - -I. -Ibnlib -Iinclude \ - -I$(DDK)\inc\crt -I..\..\third_party\bnlib\config -I..\..\third_party\bnlib \ - -I..\..\third_party\bgaes -I..\..\test\include -I..\..\include -I..\..\include\enterprise - -.c.obj : - @$(CC) -c $(CFLAGS) $< /Fo$(OUT_DIR)/$( - -# -# THIS MAKEFILE WORKS WITH MICROSOFT NMAKE ONLY -# - -# change this to point to your DDK - -DDK = ..\..\..\..\winddk2003 -OS = wnet -BASENAME = libzrtp -BINPATH = $(DDK)\bin\win64\x86\amd64 - -#RELEASE = 1 - -CC = $(BINPATH)\cl -ASM = $(BINPATH)\ml -LIB = $(BINPATH)\lib - -all: $(BASENAME).lib - -# bnlib (the BigNumber engine) - -bnlib = \ - ../../third_party/bnlib/bn.obj \ - ../../third_party/bnlib/bn32.obj \ - ../../third_party/bnlib/bninit32.obj \ - ../../third_party/bnlib/lbn32.obj \ - ../../third_party/bnlib/lbnmem.obj \ - ../../third_party/bnlib/legal.obj - -protocol = \ - ../../src/zrtp.obj \ - ../../src/zrtp_crc.obj \ - ../../src/zrtp_crypto_aes.obj \ - ../../src/zrtp_crypto_atl.obj \ - ../../src/zrtp_crypto_hash.obj \ - ../../src/zrtp_crypto_pk.obj \ - ../../src/zrtp_crypto_sas.obj \ - ../../src/zrtp_datatypes.obj \ - ../../src/zrtp_engine.obj \ - ../../src/enterprise/zrtp_engine_driven.obj \ - ../../src/enterprise/zrtp_crypto_ec.obj \ - ../../src/enterprise/zrtp_crypto_ecdh.obj \ - ../../src/zrtp_iface_sys.obj \ - ../../src/zrtp_initiator.obj \ - ../../src/zrtp_legal.obj \ - ../../src/zrtp_list.obj \ - ../../src/zrtp_log.obj \ - ../../src/zrtp_pbx.obj \ - ../../src/zrtp_protocol.obj \ - ../../src/zrtp_responder.obj \ - ../../src/zrtp_rng.obj \ - ../../src/zrtp_srtp_builtin.obj \ - ../../src/zrtp_string.obj \ - ../../src/zrtp_utils.obj \ - ../../src/zrtp_utils_proto.obj - -bgaes = \ - ../../third_party/bgaes/aes_modes.obj \ - ../../third_party/bgaes/aescrypt.obj \ - ../../third_party/bgaes/aeskey.obj \ - ../../third_party/bgaes/aestab.obj \ - ../../third_party/bgaes/sha1.obj \ - ../../third_party/bgaes/sha2.obj - -OBJECTS = $(bnlib) $(protocol) $(bgaes) - -!IFNDEF RELEASE - -# Debug - -OUT_DIR = debug64_ec.km - -DEFINES_D = -DWIN64=1 -D_WIN64=1 -D_AMD64_=1 -D_M_AMD64 -D_WINDOWS \ --DSTD_CALL -DCONDITION_HANDLING=1 \ --DNT_UP=1 -DNT_INST=0 -D_NT1X_=100 \ --DWINNT=1 -D_WIN32_WINNT=0x0500 -DWIN32_LEAN_AND_MEAN=1 -DDBG=1 -D_DEBUG -DDEBUG -DDEVL=1 \ --DFPO=0 -D_DLL=1 -D_IDWBUILD -DRDRDBG -DSRVDBG -DDBG_MESSAGES=1 \ --D_UNICODE -DLITTLE_ENDIAN -DZRTP_USE_ENTERPRISE=1 - -CFLAGS_D = $(DEFINES_D) -Zp8 -Gy -cbstring -Gz -Gm- -EHs-c- \ --GR- -GF -FI$(DDK)\inc\$(OS)\warning.h -Z7 -Od -Oi -Oy- -W3 - -!ELSE - -# Release - -OUT_DIR = release64_ec.km - -DEFINES_D = -DWIN64=1 -D_WIN64=1 -D_AMD64_=1 -D_M_AMD64 -D_WINDOWS \ --DSTD_CALL -DCONDITION_HANDLING=1 \ --DNT_UP=1 -DNO_DISK_ACCESS -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 \ --DWINNT=1 -D_WIN32_WINNT=0x0500 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 \ --DFPO=1 -DNDEBUG -D_DLL=1 -D_IDWBUILD -D_UNICODE \ --DLITTLE_ENDIAN -DZRTP_USE_ENTERPRISE=1 - -CFLAGS_D = $(DEFINES_D) -Zel -Zp8 -Gy -cbstring -Gz -QIfdiv- -QIf -Gi- -Gm- -GX- \ --GR- -GF -Oxs -Oy -FI$(DDK)\inc\$(OS)\warning.h -W3 -FAcs -Z7 - -!ENDIF - -ASM = ml -AFLAGS = /c /Cx /coff /Zi -AINCLUDE = -I. -I$(DDK)\inc - -CFLAGS = $(CFLAGS_D) -nologo -DHAVE_CONFIG_H=1 -DNT_DRIVER -D__BUILDMACHINE__=WinDDK \ - -I$(DDK)\inc\$(OS) -I$(DDK)\inc\ddk\$(OS) -I$(DDK)\inc\ddk\wdm\$(OS) \ - -I$(DDK)\inc\crt -I..\..\third_party\bnlib\config -I..\..\third_party\bnlib \ - -I..\..\third_party\bgaes -I..\..\test\include -I..\..\include -I..\..\include\enterprise - -.c.obj : - @$(CC) -c $(CFLAGS) $< /Fo$(OUT_DIR)/$( - -# -# THIS MAKEFILE WORKS WITH MICROSOFT NMAKE ONLY -# - -# change this to point to your DDK - -DDK = ..\..\..\..\winddk\3790 -OS = wxp -BASENAME = libzrtp - -#RELEASE = 1 - -CC = cl -ASM = ml -LIB = lib - -all: $(BASENAME).lib - -# bnlib (the BigNumber engine) - -bnlib = \ - ../../third_party/bnlib/bn.obj \ - ../../third_party/bnlib/bn32.obj \ - ../../third_party/bnlib/bninit32.obj \ - ../../third_party/bnlib/lbn32.obj \ - ../../third_party/bnlib/lbnmem.obj \ - ../../third_party/bnlib/legal.obj - -protocol = \ - ../../src/zrtp.obj \ - ../../src/zrtp_crc.obj \ - ../../src/zrtp_crypto_aes.obj \ - ../../src/zrtp_crypto_atl.obj \ - ../../src/zrtp_crypto_hash.obj \ - ../../src/zrtp_crypto_pk.obj \ - ../../src/zrtp_crypto_sas.obj \ - ../../src/zrtp_datatypes.obj \ - ../../src/zrtp_engine.obj \ - ../../src/zrtp_iface_sys.obj \ - ../../src/zrtp_initiator.obj \ - ../../src/zrtp_legal.obj \ - ../../src/zrtp_list.obj \ - ../../src/zrtp_log.obj \ - ../../src/zrtp_pbx.obj \ - ../../src/zrtp_protocol.obj \ - ../../src/zrtp_responder.obj \ - ../../src/zrtp_rng.obj \ - ../../src/zrtp_srtp_builtin.obj \ - ../../src/zrtp_string.obj \ - ../../src/zrtp_utils.obj \ - ../../src/zrtp_utils_proto.obj - -bgaes = \ - ../../third_party/bgaes/aes_modes.obj \ - ../../third_party/bgaes/aescrypt.obj \ - ../../third_party/bgaes/aeskey.obj \ - ../../third_party/bgaes/aestab.obj \ - ../../third_party/bgaes/sha1.obj \ - ../../third_party/bgaes/sha2.obj - -OBJECTS = $(bnlib) $(protocol) $(bgaes) - -!IFNDEF RELEASE - -# Debug - -OUT_DIR = debug.km - -DEFINES_D = -D_X86_=1 -Di386=1 -DSTD_CALL -DCONDITION_HANDLING=1 \ --DNT_UP=1 -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 \ --DWINNT=1 -D_WIN32_WINNT=0x0500 -DWIN32_LEAN_AND_MEAN=1 -DDBG=1 -D_DEBUG -DDEBUG -DDEVL=1 \ --DFPO=0 -D_DLL=1 -D_IDWBUILD -DRDRDBG -DSRVDBG -DDBG_MESSAGES=1 \ --D_UNICODE -DLITTLE_ENDIAN -DZRTP_USE_ENTERPRISE=0 - -CFLAGS_D = $(DEFINES_D) -Zel -Zp8 -Gy -cbstring -Gz -QIfdiv- -QIf -Gi- -Gm- -GX- \ --GR- -GF -FI$(DDK)\inc\$(OS)\warning.h -Z7 -Od -Oi -Oy- -W3 - -!ELSE - -# Release - -OUT_DIR = release.km - -DEFINES_D = -D_X86_=1 -Di386=1 -DSTD_CALL -DCONDITION_HANDLING=1 \ --DNT_UP=1 -DNO_DISK_ACCESS -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 \ --DWINNT=1 -D_WIN32_WINNT=0x0500 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 \ --DFPO=1 -DNDEBUG -D_DLL=1 -D_IDWBUILD -D_UNICODE \ --DLITTLE_ENDIAN -DZRTP_USE_ENTERPRISE=0 - -CFLAGS_D = $(DEFINES_D) -Zel -Zp8 -Gy -cbstring -Gz -QIfdiv- -QIf -Gi- -Gm- -GX- \ --GR- -GF -Oxs -Oy -FI$(DDK)\inc\$(OS)\warning.h -W3 -FAcs -Z7 - -!ENDIF - -ASM = ml -AFLAGS = /c /Cx /coff /Zi -AINCLUDE = -I. -I$(DDK)\inc - -CFLAGS = $(CFLAGS_D) -nologo -DHAVE_CONFIG_H=1 -DNT_DRIVER -D__BUILDMACHINE__=WinDDK \ - -I$(DDK)\inc\$(OS) -I$(DDK)\inc\ddk\$(OS) -I$(DDK)\inc\ddk\wdm\$(OS) \ - -I. -Ibnlib -Iinclude \ - -I$(DDK)\inc\crt -I..\..\third_party\bnlib\config -I..\..\third_party\bnlib \ - -I..\..\third_party\bgaes -I..\..\test\include -I..\..\include -I..\..\include\enterprise - -.c.obj : - @$(CC) -c $(CFLAGS) $< /Fo$(OUT_DIR)/$( - -# -# THIS MAKEFILE WORKS WITH MICROSOFT NMAKE ONLY -# - -# change this to point to your DDK - -DDK = ..\..\..\..\winddk2003 -OS = wnet -BASENAME = libzrtp -BINPATH = $(DDK)\bin\win64\x86\amd64 - -#RELEASE = 1 - -CC = $(BINPATH)\cl -ASM = $(BINPATH)\ml -LIB = $(BINPATH)\lib - -all: $(BASENAME).lib - -# bnlib (the BigNumber engine) - -bnlib = \ - ../../third_party/bnlib/bn.obj \ - ../../third_party/bnlib/bn32.obj \ - ../../third_party/bnlib/bninit32.obj \ - ../../third_party/bnlib/lbn32.obj \ - ../../third_party/bnlib/lbnmem.obj \ - ../../third_party/bnlib/legal.obj - -protocol = \ - ../../src/zrtp.obj \ - ../../src/zrtp_crc.obj \ - ../../src/zrtp_crypto_aes.obj \ - ../../src/zrtp_crypto_atl.obj \ - ../../src/zrtp_crypto_hash.obj \ - ../../src/zrtp_crypto_pk.obj \ - ../../src/zrtp_crypto_sas.obj \ - ../../src/zrtp_datatypes.obj \ - ../../src/zrtp_engine.obj \ - ../../src/zrtp_iface_sys.obj \ - ../../src/zrtp_initiator.obj \ - ../../src/zrtp_legal.obj \ - ../../src/zrtp_list.obj \ - ../../src/zrtp_log.obj \ - ../../src/zrtp_pbx.obj \ - ../../src/zrtp_protocol.obj \ - ../../src/zrtp_responder.obj \ - ../../src/zrtp_rng.obj \ - ../../src/zrtp_srtp_builtin.obj \ - ../../src/zrtp_string.obj \ - ../../src/zrtp_utils.obj \ - ../../src/zrtp_utils_proto.obj - -bgaes = \ - ../../third_party/bgaes/aes_modes.obj \ - ../../third_party/bgaes/aescrypt.obj \ - ../../third_party/bgaes/aeskey.obj \ - ../../third_party/bgaes/aestab.obj \ - ../../third_party/bgaes/sha1.obj \ - ../../third_party/bgaes/sha2.obj - -OBJECTS = $(bnlib) $(protocol) $(bgaes) - -!IFNDEF RELEASE - -# Debug - -OUT_DIR = debug64.km - -DEFINES_D = -DWIN64=1 -D_WIN64=1 -D_AMD64_=1 -D_M_AMD64 -D_WINDOWS \ --DSTD_CALL -DCONDITION_HANDLING=1 \ --DNT_UP=1 -DNT_INST=0 -D_NT1X_=100 \ --DWINNT=1 -D_WIN32_WINNT=0x0500 -DWIN32_LEAN_AND_MEAN=1 -DDBG=1 -D_DEBUG -DDEBUG -DDEVL=1 \ --DFPO=0 -D_DLL=1 -D_IDWBUILD -DRDRDBG -DSRVDBG -DDBG_MESSAGES=1 \ --D_UNICODE -DLITTLE_ENDIAN -DZRTP_USE_ENTERPRISE=0 - -CFLAGS_D = $(DEFINES_D) -Zp8 -Gy -cbstring -Gz -Gm- -EHs-c- \ --GR- -GF -FI$(DDK)\inc\$(OS)\warning.h -Z7 -Od -Oi -Oy- -W3 - -!ELSE - -# Release - -OUT_DIR = release64.km - -DEFINES_D = -DWIN64=1 -D_WIN64=1 -D_AMD64_=1 -D_M_AMD64 -D_WINDOWS \ --DSTD_CALL -DCONDITION_HANDLING=1 \ --DNT_UP=1 -DNO_DISK_ACCESS -DNT_INST=0 -DWIN32=100 -D_NT1X_=100 \ --DWINNT=1 -D_WIN32_WINNT=0x0500 -DWIN32_LEAN_AND_MEAN=1 -DDEVL=1 \ --DFPO=1 -DNDEBUG -D_DLL=1 -D_IDWBUILD -D_UNICODE \ --DLITTLE_ENDIAN -DZRTP_USE_ENTERPRISE=0 - -CFLAGS_D = $(DEFINES_D) -Zel -Zp8 -Gy -cbstring -Gz -QIfdiv- -QIf -Gi- -Gm- -GX- \ --GR- -GF -Oxs -Oy -FI$(DDK)\inc\$(OS)\warning.h -W3 -FAcs -Z7 - -!ENDIF - -ASM = ml -AFLAGS = /c /Cx /coff /Zi -AINCLUDE = -I. -I$(DDK)\inc - -CFLAGS = $(CFLAGS_D) -nologo -DHAVE_CONFIG_H=1 -DNT_DRIVER -D__BUILDMACHINE__=WinDDK \ - -I$(DDK)\inc\$(OS) -I$(DDK)\inc\ddk\$(OS) -I$(DDK)\inc\ddk\wdm\$(OS) \ - -I$(DDK)\inc\crt -I..\..\third_party\bnlib\config -I..\..\third_party\bnlib \ - -I..\..\third_party\bgaes -I..\..\test\include -I..\..\include -I..\..\include\enterprise - -.c.obj : - @$(CC) -c $(CFLAGS) $< /Fo$(OUT_DIR)/$( - - - - diff --git a/libs/libzrtp/projects/xcode/libzrtp_test.xcodeproj/project.pbxproj b/libs/libzrtp/projects/xcode/libzrtp_test.xcodeproj/project.pbxproj deleted file mode 100644 index c70f0fc50e..0000000000 --- a/libs/libzrtp/projects/xcode/libzrtp_test.xcodeproj/project.pbxproj +++ /dev/null @@ -1,295 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 8D6EECFF0F01458D00529121 /* zrtp_test_core.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D6EECF70F01458D00529121 /* zrtp_test_core.c */; }; - 8D6EED000F01458D00529121 /* zrtp_test_crypto.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D6EECF80F01458D00529121 /* zrtp_test_crypto.c */; }; - 8D6EED010F01458D00529121 /* zrtp_test_queue.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D6EECF90F01458D00529121 /* zrtp_test_queue.c */; }; - 8D6EED020F01458D00529121 /* zrtp_test_ui.c in Sources */ = {isa = PBXBuildFile; fileRef = 8D6EECFA0F01458D00529121 /* zrtp_test_ui.c */; }; - 8D6EED110F0145BF00529121 /* libzrtp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 8D6EED0F0F0145AA00529121 /* libzrtp.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - 8D6EED0E0F0145AA00529121 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 8D6EED030F0145AA00529121 /* libzrtp.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8996E0300EC9CA8C007D7FD5; - remoteInfo = libzrtp_ec; - }; - 8D6EED490F01487C00529121 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = 8D6EED030F0145AA00529121 /* libzrtp.xcodeproj */; - proxyType = 1; - remoteGlobalIDString = 8996DFD70EC9CA8C007D7FD5; - remoteInfo = libzrtp_ec; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 8D6EEC500F013D2A00529121 /* libzrtp_test_ec */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = libzrtp_test_ec; sourceTree = BUILT_PRODUCTS_DIR; }; - 8D6EECF50F01450800529121 /* zrtp_test_core.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_test_core.h; path = ../../test/pc/zrtp_test_core.h; sourceTree = SOURCE_ROOT; }; - 8D6EECF60F01450800529121 /* zrtp_test_queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zrtp_test_queue.h; path = ../../test/pc/zrtp_test_queue.h; sourceTree = SOURCE_ROOT; }; - 8D6EECF70F01458D00529121 /* zrtp_test_core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_test_core.c; path = ../../test/pc/zrtp_test_core.c; sourceTree = SOURCE_ROOT; }; - 8D6EECF80F01458D00529121 /* zrtp_test_crypto.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_test_crypto.c; path = ../../test/pc/zrtp_test_crypto.c; sourceTree = SOURCE_ROOT; }; - 8D6EECF90F01458D00529121 /* zrtp_test_queue.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_test_queue.c; path = ../../test/pc/zrtp_test_queue.c; sourceTree = SOURCE_ROOT; }; - 8D6EECFA0F01458D00529121 /* zrtp_test_ui.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = zrtp_test_ui.c; path = ../../test/pc/zrtp_test_ui.c; sourceTree = SOURCE_ROOT; }; - 8D6EED030F0145AA00529121 /* libzrtp.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = libzrtp.xcodeproj; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8D6EEC4E0F013D2A00529121 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D6EED110F0145BF00529121 /* libzrtp.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 08FB7794FE84155DC02AAC07 /* libzrtp_test */ = { - isa = PBXGroup; - children = ( - 8D6EED030F0145AA00529121 /* libzrtp.xcodeproj */, - 08FB7795FE84155DC02AAC07 /* Source */, - 1AB674ADFE9D54B511CA2CBB /* Products */, - ); - name = libzrtp_test; - sourceTree = ""; - }; - 08FB7795FE84155DC02AAC07 /* Source */ = { - isa = PBXGroup; - children = ( - 8DFEC0890F0125D3004540A4 /* include */, - 8DFEC08A0F0125DE004540A4 /* src */, - ); - name = Source; - sourceTree = ""; - }; - 1AB674ADFE9D54B511CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 8D6EEC500F013D2A00529121 /* libzrtp_test_ec */, - ); - name = Products; - sourceTree = ""; - }; - 8D6EED040F0145AA00529121 /* Products */ = { - isa = PBXGroup; - children = ( - 8D6EED0F0F0145AA00529121 /* libzrtp.a */, - ); - name = Products; - sourceTree = ""; - }; - 8DFEC0890F0125D3004540A4 /* include */ = { - isa = PBXGroup; - children = ( - 8D6EECF50F01450800529121 /* zrtp_test_core.h */, - 8D6EECF60F01450800529121 /* zrtp_test_queue.h */, - ); - name = include; - sourceTree = ""; - }; - 8DFEC08A0F0125DE004540A4 /* src */ = { - isa = PBXGroup; - children = ( - 8D6EECF70F01458D00529121 /* zrtp_test_core.c */, - 8D6EECF80F01458D00529121 /* zrtp_test_crypto.c */, - 8D6EECF90F01458D00529121 /* zrtp_test_queue.c */, - 8D6EECFA0F01458D00529121 /* zrtp_test_ui.c */, - ); - name = src; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 8D6EEC4F0F013D2A00529121 /* libzrtp_test_ec */ = { - isa = PBXNativeTarget; - buildConfigurationList = 8D6EEC5D0F013D3E00529121 /* Build configuration list for PBXNativeTarget "libzrtp_test_ec" */; - buildPhases = ( - 8D6EEC4D0F013D2A00529121 /* Sources */, - 8D6EEC4E0F013D2A00529121 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - 8D6EED4A0F01487C00529121 /* PBXTargetDependency */, - ); - name = libzrtp_test_ec; - productName = libzrtp_test_ec; - productReference = 8D6EEC500F013D2A00529121 /* libzrtp_test_ec */; - productType = "com.apple.product-type.tool"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 08FB7793FE84155DC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0410; - }; - buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "libzrtp_test" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - en, - ); - mainGroup = 08FB7794FE84155DC02AAC07 /* libzrtp_test */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = 8D6EED040F0145AA00529121 /* Products */; - ProjectRef = 8D6EED030F0145AA00529121 /* libzrtp.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 8D6EEC4F0F013D2A00529121 /* libzrtp_test_ec */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - 8D6EED0F0F0145AA00529121 /* libzrtp.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = libzrtp.a; - remoteRef = 8D6EED0E0F0145AA00529121 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXSourcesBuildPhase section */ - 8D6EEC4D0F013D2A00529121 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8D6EECFF0F01458D00529121 /* zrtp_test_core.c in Sources */, - 8D6EED000F01458D00529121 /* zrtp_test_crypto.c in Sources */, - 8D6EED010F01458D00529121 /* zrtp_test_queue.c in Sources */, - 8D6EED020F01458D00529121 /* zrtp_test_ui.c in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXTargetDependency section */ - 8D6EED4A0F01487C00529121 /* PBXTargetDependency */ = { - isa = PBXTargetDependency; - name = libzrtp_ec; - targetProxy = 8D6EED490F01487C00529121 /* PBXContainerItemProxy */; - }; -/* End PBXTargetDependency section */ - -/* Begin XCBuildConfiguration section */ - 1DEB928A08733DD80010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 1DEB928B08733DD80010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ARCHS = "$(ARCHS_STANDARD_32_BIT)"; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - SDKROOT = macosx; - }; - name = Release; - }; - 8D6EEC520F013D2B00529121 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - HEADER_SEARCH_PATHS = ( - ../../third_party/bnlib, - ../../third_party/bgaes, - ../../projects/gnu/config, - ../../include/enterprise, - ../../include, - ); - INSTALL_PATH = /usr/local/bin; - LIBRARY_SEARCH_PATHS = ( - ../../third_party/bnlib, - "\"$(SRCROOT)/../../../third_party/bnlib\"", - ); - OTHER_CFLAGS = ""; - PRODUCT_NAME = libzrtp_test_ec; - SYMROOT = build_test; - }; - name = Debug; - }; - 8D6EEC530F013D2B00529121 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - GCC_MODEL_TUNING = G5; - HEADER_SEARCH_PATHS = ( - ../../third_party/bnlib, - ../../third_party/bgaes, - ../../projects/gnu/config, - ../../include/enterprise, - ../../include, - ); - INSTALL_PATH = /usr/local/bin; - LIBRARY_SEARCH_PATHS = ( - ../../include/third_party/bnlib, - "\"$(SRCROOT)/../../../third_party/bnlib\"", - ); - OTHER_CFLAGS = "-DZRTP_USE_ENTERPRISE=1"; - PRODUCT_NAME = libzrtp_test_ec; - SYMROOT = build_test; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject "libzrtp_test" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB928A08733DD80010E9CD /* Debug */, - 1DEB928B08733DD80010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 8D6EEC5D0F013D3E00529121 /* Build configuration list for PBXNativeTarget "libzrtp_test_ec" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 8D6EEC520F013D2B00529121 /* Debug */, - 8D6EEC530F013D2B00529121 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; -} diff --git a/libs/libzrtp/projects/xcode/libzrtp_test.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/libs/libzrtp/projects/xcode/libzrtp_test.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 3d74d82b5b..0000000000 --- a/libs/libzrtp/projects/xcode/libzrtp_test.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/libs/libzrtp/src/zrtp.c b/libs/libzrtp/src/zrtp.c deleted file mode 100644 index a0ff8de91e..0000000000 --- a/libs/libzrtp/src/zrtp.c +++ /dev/null @@ -1,1208 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp main" - -/*----------------------------------------------------------------------------*/ -extern zrtp_status_t zrtp_init_rng(zrtp_global_t* zrtp); -extern void zrtp_down_rng(zrtp_global_t* zrtp); - -extern zrtp_status_t zrtp_defaults_sas(zrtp_global_t* global_ctx); -extern zrtp_status_t zrtp_defaults_pkt(zrtp_global_t* global_ctx); -extern zrtp_status_t zrtp_defaults_atl(zrtp_global_t* global_ctx); -extern zrtp_status_t zrtp_defaults_aes_cipher(zrtp_global_t* global_ctx); -extern zrtp_status_t zrtp_defaults_hash(zrtp_global_t* global_ctx); -extern zrtp_status_t zrtp_prepare_pkt(); -extern zrtp_status_t zrtp_done_pkt(); - - -void zrtp_config_defaults(zrtp_config_t* config) -{ - zrtp_memset(config, 0, sizeof(zrtp_config_t)); - - zrtp_memcpy(config->client_id, "ZRTP def. peer", 15); - config->lic_mode = ZRTP_LICENSE_MODE_PASSIVE; - - ZSTR_SET_EMPTY(config->def_cache_path); - zrtp_zstrncpyc(ZSTR_GV(config->def_cache_path), "./zrtp_def_cache_path.dat", 25); - - config->cache_auto_store = 1; /* cache auto flushing should be enabled by default */ - -#if (defined(ZRTP_USE_BUILTIN_CACHE) && (ZRTP_USE_BUILTIN_CACHE == 1)) - config->cb.cache_cb.on_init = zrtp_def_cache_init; - config->cb.cache_cb.on_down = zrtp_def_cache_down; - config->cb.cache_cb.on_put = zrtp_def_cache_put; - config->cb.cache_cb.on_put_mitm = zrtp_def_cache_put_mitm; - config->cb.cache_cb.on_get = zrtp_def_cache_get; - config->cb.cache_cb.on_get_mitm = zrtp_def_cache_get_mitm; - config->cb.cache_cb.on_set_verified = zrtp_def_cache_set_verified; - config->cb.cache_cb.on_get_verified = zrtp_def_cache_get_verified; - config->cb.cache_cb.on_reset_since = zrtp_def_cache_reset_since; - config->cb.cache_cb.on_presh_counter_set = zrtp_def_cache_set_presh_counter; - config->cb.cache_cb.on_presh_counter_get = zrtp_def_cache_get_presh_counter; -#endif - -#if (defined(ZRTP_USE_BUILTIN_SCEHDULER) && (ZRTP_USE_BUILTIN_SCEHDULER == 1)) - config->cb.sched_cb.on_init = zrtp_def_scheduler_init; - config->cb.sched_cb.on_down = zrtp_def_scheduler_down; - config->cb.sched_cb.on_call_later = zrtp_def_scheduler_call_later; - config->cb.sched_cb.on_cancel_call_later = zrtp_def_scheduler_cancel_call_later; - config->cb.sched_cb.on_wait_call_later = zrtp_def_scheduler_wait_call_later; -#endif -} - -zrtp_status_t zrtp_init(zrtp_config_t* config, zrtp_global_t** zrtp) -{ - zrtp_global_t* new_zrtp; - zrtp_status_t s = zrtp_status_ok; - - ZRTP_LOG(3, (_ZTU_,"INITIALIZING LIBZRTP...\n")); - - /* Print out configuration setting */ - zrtp_print_env_settings(config); - - new_zrtp = zrtp_sys_alloc(sizeof(zrtp_global_t)); - if (!new_zrtp) { - return zrtp_status_alloc_fail; - } - zrtp_memset(new_zrtp, 0, sizeof(zrtp_global_t)); - - /* - * Apply configuration according to the config - */ - new_zrtp->lic_mode = config->lic_mode; - new_zrtp->is_mitm = config->is_mitm; - ZSTR_SET_EMPTY(new_zrtp->def_cache_path); - zrtp_zstrcpy(ZSTR_GV(new_zrtp->def_cache_path), ZSTR_GV(config->def_cache_path)); - zrtp_memcpy(&new_zrtp->cb, &config->cb, sizeof(zrtp_callback_t)); - new_zrtp->cache_auto_store = config->cache_auto_store; - - ZSTR_SET_EMPTY(new_zrtp->client_id); - zrtp_memset(new_zrtp->client_id.buffer, ' ', sizeof(zrtp_client_id_t)); - zrtp_zstrncpyc( ZSTR_GV(new_zrtp->client_id), - (const char*)config->client_id, - sizeof(zrtp_client_id_t)); - - /* - * General Initialization - */ - init_mlist(&new_zrtp->sessions_head); - - zrtp_mutex_init(&new_zrtp->sessions_protector); - - init_mlist(&new_zrtp->hash_head); - init_mlist(&new_zrtp->cipher_head); - init_mlist(&new_zrtp->atl_head); - init_mlist(&new_zrtp->pktype_head); - init_mlist(&new_zrtp->sas_head); - - /* Init RNG context */ - s = zrtp_init_rng(new_zrtp); - if (zrtp_status_ok != s) { - ZRTP_LOG(1, (_ZTU_,"ERROR! zrtp_init_rng() failed:%s.\n", zrtp_log_status2str(s))); - return zrtp_status_rng_fail; - } - - /* Initialize SRTP engine */ - s = zrtp_srtp_init(new_zrtp); - if (zrtp_status_ok != s) { - ZRTP_LOG(1, (_ZTU_,"ERROR! zrtp_srtp_init() failed:<%s>\n", zrtp_log_status2str(s))); - return zrtp_status_fail; - } - - if (new_zrtp->cb.cache_cb.on_init) { - s = new_zrtp->cb.cache_cb.on_init(new_zrtp); - if (zrtp_status_ok != s) { - ZRTP_LOG(1, (_ZTU_,"ERROR! cache on_init() callback failed <%s>\n", zrtp_log_status2str(s))); - zrtp_srtp_down(new_zrtp); - return zrtp_status_fail; - } - } - - if (new_zrtp->cb.sched_cb.on_init) { - s = new_zrtp->cb.sched_cb.on_init(new_zrtp); - if (zrtp_status_ok != s) { - ZRTP_LOG(1, (_ZTU_,"ERROR! scheduler on_init() callback failed <%s>\n", zrtp_log_status2str(s))); - zrtp_srtp_down(new_zrtp); - return zrtp_status_fail; - } - } - - /* Load default crypto-components */ - zrtp_prepare_pkt(new_zrtp); - zrtp_defaults_sas(new_zrtp); - zrtp_defaults_pkt(new_zrtp); - zrtp_defaults_atl(new_zrtp); - zrtp_defaults_aes_cipher(new_zrtp); - zrtp_defaults_hash(new_zrtp); - - *zrtp = new_zrtp; - - ZRTP_LOG(3, (_ZTU_,"INITIALIZING LIBZRTP - DONE\n")); - return s; -} - - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_down(zrtp_global_t* zrtp) -{ - ZRTP_LOG(3, (_ZTU_,"DESTROYING LIBZRTP...\n")); - - if (!zrtp) { - return zrtp_status_bad_param; - } - - zrtp_comp_done(ZRTP_CC_HASH, zrtp); - zrtp_comp_done(ZRTP_CC_SAS, zrtp); - zrtp_comp_done(ZRTP_CC_CIPHER, zrtp); - zrtp_comp_done(ZRTP_CC_PKT, zrtp); - zrtp_comp_done(ZRTP_CC_ATL, zrtp); - zrtp_done_pkt(zrtp); - - zrtp_mutex_destroy(zrtp->sessions_protector); - - zrtp_srtp_down(zrtp); - - if (zrtp->cb.cache_cb.on_down) { - zrtp->cb.cache_cb.on_down(); - } - if (zrtp->cb.sched_cb.on_down) { - zrtp->cb.sched_cb.on_down(); - } - - zrtp_down_rng(zrtp); - - zrtp_sys_free(zrtp); - - ZRTP_LOG(3, (_ZTU_,"DESTROYING LIBZRTP - DONE\n")); - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_session_init( zrtp_global_t* zrtp, - zrtp_profile_t* profile, - zrtp_zid_t zid, - zrtp_signaling_role_t role, - zrtp_session_t **session) -{ - uint32_t i = 0; - zrtp_status_t s = zrtp_status_fail; - zrtp_session_t* new_session = NULL; - - if (!zrtp) { - return zrtp_status_bad_param; - } - - new_session = zrtp_sys_alloc(sizeof(zrtp_session_t)); - if (!new_session) { - return zrtp_status_alloc_fail; - } - - zrtp_memset(new_session, 0, sizeof(zrtp_session_t)); - new_session->id = zrtp->sessions_count++; - - { - zrtp_uchar32_t buff; - ZRTP_LOG(3, (_ZTU_,"START SESSION INITIALIZATION. sID=%u.\n", new_session->id)); - ZRTP_LOG(3, (_ZTU_,"ZID=%s.\n", hex2str((const char*)zid, sizeof(zrtp_uchar12_t), (char*)buff, sizeof(buff)) )); - } - - do { - /* - * Apply profile for the stream context: set flags and prepare Hello packet. - * If profile structure isn't provided, generate default. - */ - if (!profile) { - ZRTP_LOG(1, (_ZTU_,"Profile in NULL - loading default one.\n")); - zrtp_profile_defaults(&new_session->profile, zrtp); - } else { - ZRTP_LOG(1, (_ZTU_,"Loading User's profile:\n")); - if (zrtp_status_ok != zrtp_profile_check(profile, zrtp)) { - ZRTP_LOG(1, (_ZTU_,"ERROR! Can't apply wrong profile to the session sID=%u.\n", new_session->id)); - break; - } - - /* Adjust user's settings: force SHA-384 hash for ECDH-384P */ - if (zrtp_profile_find(profile, ZRTP_CC_PKT, ZRTP_PKTYPE_EC384P) > 0) { - ZRTP_LOG(3, (_ZTU_,"User wants ECDH384 - auto-adjust profile to use SHA-384.\n")); - profile->hash_schemes[0] = ZRTP_HASH_SHA384; - profile->hash_schemes[1] = ZRTP_HASH_SHA256; - profile->hash_schemes[2] = 0; - } - - zrtp_memcpy(&new_session->profile, profile, sizeof(zrtp_profile_t)); - - { - int i; - ZRTP_LOG(3, (_ZTU_," allowclear: %s\n", profile->allowclear?"ON":"OFF")); - ZRTP_LOG(3, (_ZTU_," autosecure: %s\n", profile->autosecure?"ON":"OFF")); - ZRTP_LOG(3, (_ZTU_," disclose_bit: %s\n", profile->disclose_bit?"ON":"OFF")); - ZRTP_LOG(3, (_ZTU_," signal. role: %s\n", zrtp_log_sign_role2str(role))); - ZRTP_LOG(3, (_ZTU_," TTL: %u\n", profile->cache_ttl)); - - ZRTP_LOG(3, (_ZTU_," SAS schemes: ")); - i=0; - while (profile->sas_schemes[i]) { - ZRTP_LOGC(3, ("%.4s ", zrtp_comp_id2type(ZRTP_CC_SAS, profile->sas_schemes[i++]))); - } - ZRTP_LOGC(3, ("\n")); ZRTP_LOG(1, (_ZTU_," Ciphers: ")); - i=0; - while (profile->cipher_types[i]) { - ZRTP_LOGC(3, ("%.4s ", zrtp_comp_id2type(ZRTP_CC_CIPHER, profile->cipher_types[i++]))); - } - ZRTP_LOGC(3, ("\n")); ZRTP_LOG(1, (_ZTU_," PK schemes: ")); - i=0; - while (profile->pk_schemes[i]) { - ZRTP_LOGC(3, ("%.4s ", zrtp_comp_id2type(ZRTP_CC_PKT, profile->pk_schemes[i++]))); - } - ZRTP_LOGC(3, ("\n")); ZRTP_LOG(1, (_ZTU_," ATL: ")); - i=0; - while (profile->auth_tag_lens[i]) { - ZRTP_LOGC(3, ("%.4s ", zrtp_comp_id2type(ZRTP_CC_ATL, profile->auth_tag_lens[i++]))); - } - ZRTP_LOGC(3, ("\n")); ZRTP_LOG(1, (_ZTU_," Hashes: ")); - i=0; - while (profile->hash_schemes[i]) { - ZRTP_LOGC(3, ("%.4s ", zrtp_comp_id2type(ZRTP_CC_HASH, profile->hash_schemes[i++]))); - } - ZRTP_LOGC(3, ("\n")); - } - } - - /* Set ZIDs */ - ZSTR_SET_EMPTY(new_session->zid); - ZSTR_SET_EMPTY(new_session->peer_zid); - zrtp_zstrncpyc(ZSTR_GV(new_session->zid), (const char*)zid, sizeof(zrtp_zid_t)); - - new_session->zrtp = zrtp; - new_session->signaling_role = role; - new_session->mitm_alert_detected = 0; - - /* - * Allocate memory for holding secrets and initialize with random values. - * Actual values will be written from the cache at the beginning of the protocol. - */ - new_session->secrets.rs1 = _zrtp_alloc_shared_secret(new_session); - new_session->secrets.rs2 = _zrtp_alloc_shared_secret(new_session); - new_session->secrets.auxs = _zrtp_alloc_shared_secret(new_session); - new_session->secrets.pbxs = _zrtp_alloc_shared_secret(new_session); - - if ( !new_session->secrets.rs1 || !new_session->secrets.rs2 || - !new_session->secrets.auxs || !new_session->secrets.pbxs) { - ZRTP_LOG(1, (_ZTU_,"ERROR! Can't allocate shared secrets sID=%u\n.", new_session->id)); - s = zrtp_status_alloc_fail; - break; - } - - /* Initialize SAS values */ - ZSTR_SET_EMPTY(new_session->sas1); - ZSTR_SET_EMPTY(new_session->sas2); - ZSTR_SET_EMPTY(new_session->sasbin); - ZSTR_SET_EMPTY(new_session->zrtpsess); - - /* Clear all stream structures */ - for (i=0; istreams[i].state = ZRTP_STATE_NONE; - new_session->streams[i].prev_state = ZRTP_STATE_NONE; - new_session->streams[i].mode = ZRTP_STREAM_MODE_UNKN; - } - - /* Initialize synchronization objects */ - s = zrtp_mutex_init(&new_session->streams_protector); - if (zrtp_status_ok != s) { - ZRTP_LOG(1, (_ZTU_,"ERROR! can't initialize Stream protector. sID=%u.\n", new_session->id)); - break; - } - s = zrtp_mutex_init(&new_session->init_protector); - if (zrtp_status_ok != s) { - ZRTP_LOG(1, (_ZTU_,"ERROR! can't initialize Init protector. sID=%u.\n", new_session->id)); - break; - } - - s = zrtp_status_ok; - } while (0); - - if (zrtp_status_ok != s) { - zrtp_sys_free(new_session); - return s; - } - - /* Add new session to the global list */ - zrtp_mutex_lock(zrtp->sessions_protector); - mlist_add(&zrtp->sessions_head, &new_session->_mlist); - zrtp_mutex_unlock(zrtp->sessions_protector); - - *session = new_session; - - ZRTP_LOG(3, (_ZTU_,"Session initialization - DONE. sID=%u.\n\n", new_session->id)); - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -void zrtp_session_down(zrtp_session_t *session) -{ - int i =0; - - if (!session) { - return; - } - - /* Stop ZRTP engine and clear all crypto sources for every stream in the session. */ - zrtp_mutex_lock(session->streams_protector); - for(i=0; istreams[i]; - zrtp_stream_stop(the_stream); - } - zrtp_mutex_unlock(session->streams_protector); - - /* Release memory allocated on initialization */ - if (session->secrets.rs1) { - zrtp_sys_free(session->secrets.rs1); - } - if (session->secrets.rs2) { - zrtp_sys_free(session->secrets.rs2); - } - if (session->secrets.auxs) { - zrtp_sys_free(session->secrets.auxs); - } - if (session->secrets.pbxs) { - zrtp_sys_free(session->secrets.pbxs); - } - - /* We don't need the session key anymore - clear it */ - zrtp_wipe_zstring(ZSTR_GV(session->zrtpsess)); - - /* Removing session from the global list */ - zrtp_mutex_lock(session->zrtp->sessions_protector); - mlist_del(&session->_mlist); - zrtp_mutex_unlock(session->zrtp->sessions_protector); - - zrtp_mutex_destroy(session->streams_protector); - zrtp_mutex_destroy(session->init_protector); - - zrtp_sys_free(session); -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_stream_attach(zrtp_session_t *session, zrtp_stream_t** stream) -{ - uint32_t i = 0; - zrtp_status_t s = zrtp_status_fail; - zrtp_stream_t* new_stream = NULL; - - ZRTP_LOG(3, (_ZTU_,"ATTACH NEW STREAM to sID=%d:\n", session->id)); - - /* - * Initialize first unused stream. If there are no available streams return error. - */ - zrtp_mutex_lock(session->streams_protector); - for (i=0; istreams[i].state) { - new_stream = &session->streams[i]; - zrtp_memset(new_stream, 0, sizeof(zrtp_stream_t)); - break; - } - } - zrtp_mutex_unlock(session->streams_protector); - - if (!new_stream) { - ZRTP_LOG(1, (_ZTU_,"\tWARNING! Can't attach one more stream. Limit is reached." - " Use #ZRTP_MAX_STREAMS_PER_SESSION. sID=%u\n", session->id)); - return zrtp_status_alloc_fail; - } - - /* - * Initialize the private data stream with default initial values - */ - zrtp_mutex_init(&new_stream->stream_protector); - _zrtp_change_state(new_stream, ZRTP_STATE_ACTIVE); - new_stream->mode = ZRTP_STREAM_MODE_CLEAR; - new_stream->id = session->zrtp->streams_count++; - new_stream->session = session; - new_stream->zrtp = session->zrtp; - new_stream->mitm_mode = ZRTP_MITM_MODE_UNKN; - new_stream->is_hello_received = 0; - - ZSTR_SET_EMPTY(new_stream->cc.hmackey); - ZSTR_SET_EMPTY(new_stream->cc.peer_hmackey); - ZSTR_SET_EMPTY(new_stream->cc.zrtp_key); - ZSTR_SET_EMPTY(new_stream->cc.peer_zrtp_key); - - new_stream->dh_cc.initialized_with = ZRTP_COMP_UNKN; - bnBegin(&new_stream->dh_cc.peer_pv); - ZSTR_SET_EMPTY(new_stream->dh_cc.dhss); - - ZRTP_LOG(3, (_ZTU_,"\tEmpty slot was found - initializing new stream with ID=%u.\n", new_stream->id)); - - do { - zrtp_string32_t hash_buff = ZSTR_INIT_EMPTY(hash_buff); - zrtp_hash_t *hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA256, new_stream->zrtp); - s = zrtp_status_algo_fail; - - if (sizeof(uint16_t) != zrtp_randstr( new_stream->zrtp, - (uint8_t*)&new_stream->media_ctx.high_out_zrtp_seq, - sizeof(uint16_t))) { - break; - } - - /* - * Compute and store message hashes to prevent DoS attacks. - * Generate H0 as a random nonce and compute H1, H2 and H3 - * using the leftmost 128 bits from every hash. - * Then insert these directly into the message structures. - */ - - zrtp_memset(&new_stream->messages, 0, sizeof(new_stream->messages)); - ZSTR_SET_EMPTY(new_stream->messages.h0); - ZSTR_SET_EMPTY(new_stream->messages.signaling_hash); - - /* Generate Random nonce, compute H1 and store in the DH packet */ - new_stream->messages.h0.length = (uint16_t)zrtp_randstr( new_stream->zrtp, - (unsigned char*)new_stream->messages.h0.buffer, - ZRTP_MESSAGE_HASH_SIZE); - if (ZRTP_MESSAGE_HASH_SIZE != new_stream->messages.h0.length) { - break; - } - - s = hash->hash(hash, ZSTR_GV(new_stream->messages.h0), ZSTR_GV(hash_buff)); - if (zrtp_status_ok != s) { - break; - } - zrtp_memcpy(new_stream->messages.dhpart.hash, hash_buff.buffer, ZRTP_MESSAGE_HASH_SIZE); - - /* Compute H2 for the Commit */ - s = hash->hash_c(hash, (char*)new_stream->messages.dhpart.hash, ZRTP_MESSAGE_HASH_SIZE, ZSTR_GV(hash_buff)); - if (zrtp_status_ok != s) { - break; - } - zrtp_memcpy(new_stream->messages.commit.hash, hash_buff.buffer, ZRTP_MESSAGE_HASH_SIZE); - - /* Compute H3 for the Hello message */ - s = hash->hash_c(hash, (char*)new_stream->messages.commit.hash, ZRTP_MESSAGE_HASH_SIZE, ZSTR_GV(hash_buff)); - if (zrtp_status_ok != s) { - break; - } - zrtp_memcpy(new_stream->messages.hello.hash, hash_buff.buffer, ZRTP_MESSAGE_HASH_SIZE); - - s = zrtp_status_ok; - } while (0); - - if (zrtp_status_ok != s) { - ZRTP_LOG(1, (_ZTU_,"\tERROR! Fail to compute messages hashes <%s>.\n", zrtp_log_status2str(s))); - return s; - } - - /* - * Preparing HELLO based on user's profile - */ - ZRTP_LOG(3, (_ZTU_,"\tPreparing ZRTP Hello according to the Session profile.\n")); - { - zrtp_packet_Hello_t* hello = &new_stream->messages.hello; - uint8_t i = 0; - int8_t* comp_ptr = NULL; - - /* Set Protocol Version and ClientID */ - zrtp_memcpy(hello->version, ZRTP_PROTOCOL_VERSION, ZRTP_VERSION_SIZE); - zrtp_memcpy(hello->cliend_id, session->zrtp->client_id.buffer, session->zrtp->client_id.length); - - /* Set flags. */ - hello->pasive = (ZRTP_LICENSE_MODE_PASSIVE == session->zrtp->lic_mode) ? 1 : 0; - hello->uflag = (ZRTP_LICENSE_MODE_UNLIMITED == session->zrtp->lic_mode) ? 1 : 0; - hello->mitmflag = session->zrtp->is_mitm; - hello->sigflag = 0; - - zrtp_memcpy(hello->zid, session->zid.buffer, session->zid.length); - - comp_ptr = (int8_t*)hello->comp; - i = 0; - while ( session->profile.hash_schemes[i]) { - zrtp_memcpy( comp_ptr, - zrtp_comp_id2type(ZRTP_CC_HASH, session->profile.hash_schemes[i++]), - ZRTP_COMP_TYPE_SIZE ); - comp_ptr += ZRTP_COMP_TYPE_SIZE; - } - hello->hc = i; - - i = 0; - while (session->profile.cipher_types[i]) { - zrtp_memcpy( comp_ptr, - zrtp_comp_id2type(ZRTP_CC_CIPHER, session->profile.cipher_types[i++]), - ZRTP_COMP_TYPE_SIZE ); - comp_ptr += ZRTP_COMP_TYPE_SIZE; - } - hello->cc = i; - - i = 0; - while (session->profile.auth_tag_lens[i] ) { - zrtp_memcpy( comp_ptr, - zrtp_comp_id2type(ZRTP_CC_ATL, session->profile.auth_tag_lens[i++]), - ZRTP_COMP_TYPE_SIZE ); - comp_ptr += ZRTP_COMP_TYPE_SIZE; - } - hello->ac = i; - - i = 0; - while (session->profile.pk_schemes[i] ) { - zrtp_memcpy( comp_ptr, - zrtp_comp_id2type(ZRTP_CC_PKT, session->profile.pk_schemes[i++]), - ZRTP_COMP_TYPE_SIZE ); - comp_ptr += ZRTP_COMP_TYPE_SIZE; - } - hello->kc = i; - - i = 0; - while (session->profile.sas_schemes[i]) { - zrtp_memcpy( comp_ptr, - zrtp_comp_id2type(ZRTP_CC_SAS, session->profile.sas_schemes[i++]), - ZRTP_COMP_TYPE_SIZE ); - comp_ptr += ZRTP_COMP_TYPE_SIZE; - } - hello->sc = i; - - /* - * Hmac will appear at the end of the message, after the dynamic portion. - * i is the length of the dynamic part. - */ - i = (hello->hc + hello->cc + hello->ac + hello->kc + hello->sc) * ZRTP_COMP_TYPE_SIZE; - _zrtp_packet_fill_msg_hdr( new_stream, - ZRTP_HELLO, - ZRTP_HELLO_STATIC_SIZE + i + ZRTP_HMAC_SIZE, - &hello->hdr); - } - - *stream = new_stream; - - ZRTP_LOG(3, (_ZTU_,"ATTACH NEW STREAM - DONE.\n")); - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_signaling_hash_get( zrtp_stream_t* stream, - char *hash_buff, - uint32_t hash_buff_length) -{ - zrtp_string32_t hash_str = ZSTR_INIT_EMPTY(hash_str); - zrtp_hash_t *hash = NULL; - - if (!stream || !hash_buff) { - return zrtp_status_bad_param; - } - - if (ZRTP_SIGN_ZRTP_HASH_LENGTH > hash_buff_length) { - return zrtp_status_buffer_size; - } - - if (stream->state < ZRTP_STATE_ACTIVE) { - return zrtp_status_wrong_state; - } - - hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA256, stream->zrtp); - hash->hash_c( hash, - (const char*)&stream->messages.hello.hdr, - zrtp_ntoh16(stream->messages.hello.hdr.length) * 4, - ZSTR_GV(hash_str) ); - - hex2str(hash_str.buffer, ZRTP_MESSAGE_HASH_SIZE, hash_buff, hash_buff_length); - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_signaling_hash_set( zrtp_stream_t* ctx, - const char *hash_buff, - uint32_t hash_buff_length) -{ - if (!ctx || !hash_buff) { - return zrtp_status_bad_param; - } - - if (ZRTP_SIGN_ZRTP_HASH_LENGTH > hash_buff_length) { - return zrtp_status_buffer_size; - } - - if (ctx->state != ZRTP_STATE_ACTIVE) { - return zrtp_status_wrong_state; - } - - str2hex(hash_buff, - ZRTP_SIGN_ZRTP_HASH_LENGTH, - ctx->messages.signaling_hash.buffer, - ctx->messages.signaling_hash.max_length); - ctx->messages.signaling_hash.length = ZRTP_MESSAGE_HASH_SIZE; - - ZRTP_LOG(3, (_ZTU_,"SIGNALLING HAS was ADDED for the comparison. ID=%u\n", ctx->id)); - ZRTP_LOG(3, (_ZTU_,"Hash=%.*s.\n", ZRTP_SIGN_ZRTP_HASH_LENGTH, hash_buff)); - - return zrtp_status_ok; -} - - -/*----------------------------------------------------------------------------*/ -static const char* zrtp_pkt2str[] = { - "Preshared", - "Multistream", - "DH-2048", - "ECDH-256", - "DH-3072", - "ECDH-384", - "ECDH-521", - "DH-4096" -}; - -static const char* zrtp_hash2str[] = { - "SHA-256", - "SHA1", - "SHA-384" -}; - -static const char* zrtp_cipher2str[] = { - "AES-128", - "AES-256" -}; - -static const char* zrtp_atl2str[] = { - "HMAC-SHA1 32 bit", - "HMAC-SHA1 80 bit" -}; - -static const char* zrtp_sas2str[] = { - "Base-32", - "Base-256" -}; - -zrtp_status_t zrtp_session_get(zrtp_session_t *session, zrtp_session_info_t *info) -{ - int i=0; - if (!session || !info) { - return zrtp_status_bad_param; - } - - zrtp_memset(info, 0, sizeof(zrtp_session_info_t)); - - ZSTR_SET_EMPTY(info->peer_clientid); - ZSTR_SET_EMPTY(info->peer_version); - ZSTR_SET_EMPTY(info->zid); - ZSTR_SET_EMPTY(info->peer_zid); - ZSTR_SET_EMPTY(info->sas1); - ZSTR_SET_EMPTY(info->sasbin); - ZSTR_SET_EMPTY(info->sas2); - ZSTR_SET_EMPTY(info->auth_name); - ZSTR_SET_EMPTY(info->cipher_name); - ZSTR_SET_EMPTY(info->hash_name); - ZSTR_SET_EMPTY(info->sas_name); - ZSTR_SET_EMPTY(info->pk_name); - - info->id = session->id; - zrtp_zstrcpy(ZSTR_GV(info->zid), ZSTR_GV(session->zid)); - zrtp_zstrcpy(ZSTR_GV(info->peer_zid), ZSTR_GV(session->peer_zid)); - - for (i=0; istreams[i]; - if ((full_stream->state > ZRTP_STATE_ACTIVE) && !ZRTP_IS_STREAM_FAST(full_stream)) - { - zrtp_zstrcpyc(ZSTR_GV(info->pk_name), zrtp_pkt2str[full_stream->pubkeyscheme->base.id-1]); - - zrtp_zstrncpyc( ZSTR_GV(info->peer_clientid), - (const char*)full_stream->messages.peer_hello.cliend_id, 16); - zrtp_zstrncpyc( ZSTR_GV(info->peer_version), - (const char*)full_stream->messages.peer_hello.version, 4); - - info->secrets_ttl = full_stream->cache_ttl; - } - } - - info->sas_is_ready = (session->zrtpsess.length > 0) ? 1 : 0; - if (info->sas_is_ready) { - zrtp_zstrcpy(ZSTR_GV(info->sas1), ZSTR_GV(session->sas1)); - zrtp_zstrcpy(ZSTR_GV(info->sas2), ZSTR_GV(session->sas2)); - zrtp_zstrcpy(ZSTR_GV(info->sasbin), ZSTR_GV(session->sasbin)); - info->sas_is_base256 = (ZRTP_SAS_BASE256 == session->sasscheme->base.id); - - info->sas_is_verified = 0; - if (session->zrtp->cb.cache_cb.on_get_verified) { - session->zrtp->cb.cache_cb.on_get_verified( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - &info->sas_is_verified); - } - - zrtp_zstrcpyc(ZSTR_GV(info->hash_name), zrtp_hash2str[session->hash->base.id-1]); - zrtp_zstrcpyc(ZSTR_GV(info->cipher_name), zrtp_cipher2str[session->blockcipher->base.id-1]); - zrtp_zstrcpyc(ZSTR_GV(info->auth_name), zrtp_atl2str[session->authtaglength->base.id-1]); - zrtp_zstrcpyc(ZSTR_GV(info->sas_name), zrtp_sas2str[session->sasscheme->base.id-1]); - - info->cached_flags = session->secrets.cached_curr; - info->matches_flags= session->secrets.matches_curr; - info->wrongs_flags = session->secrets.wrongs_curr; - } - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_stream_get(zrtp_stream_t *stream, zrtp_stream_info_t *info) -{ - if (!stream || !info) { - return zrtp_status_bad_param; - } - - zrtp_memset(info, 0, sizeof(zrtp_stream_info_t)); - - info->id = stream->id; - info->state = stream->state; - info->mode = stream->mode; - info->mitm_mode = stream->mitm_mode; - - if (stream->state > ZRTP_STATE_ACTIVE) { - info->last_error = stream->last_error; - info->peer_passive = stream->peer_passive; - info->res_allowclear= stream->allowclear; - info->peer_disclose = stream->peer_disclose_bit; - info->peer_mitm = stream->peer_mitm_flag; - } - - return zrtp_status_ok; -} - -void zrtp_session_set_userdata(zrtp_session_t *session, void* udata) { - session->usr_data = udata; -} -void* zrtp_session_get_userdata(zrtp_session_t *session) { - return session->usr_data; -} - -void zrtp_stream_set_userdata(zrtp_stream_t *stream, void* udata) { - stream->usr_data = udata; -} -void* zrtp_stream_get_userdata(const zrtp_stream_t *stream) { - return stream->usr_data; -} - -/*----------------------------------------------------------------------------*/ -void zrtp_profile_defaults(zrtp_profile_t* profile, zrtp_global_t* zrtp) -{ - zrtp_memset(profile, 0, sizeof(zrtp_profile_t)); - - profile->autosecure = 1; - profile->allowclear = 0; - profile->discovery_optimization = 1; - profile->cache_ttl = ZRTP_CACHE_DEFAULT_TTL; - - profile->sas_schemes[0] = ZRTP_SAS_BASE256; - profile->sas_schemes[1] = ZRTP_SAS_BASE32; - profile->cipher_types[0] = ZRTP_CIPHER_AES256; - profile->cipher_types[1] = ZRTP_CIPHER_AES128; - profile->auth_tag_lens[0] = ZRTP_ATL_HS32; - profile->auth_tag_lens[1] = ZRTP_ATL_HS80; - profile->hash_schemes[0] = ZRTP_HASH_SHA256; - - if (zrtp && (ZRTP_LICENSE_MODE_PASSIVE == zrtp->lic_mode)) { - profile->pk_schemes[0] = ZRTP_PKTYPE_DH2048; - profile->pk_schemes[1] = ZRTP_PKTYPE_EC256P; - profile->pk_schemes[2] = ZRTP_PKTYPE_DH3072; - } else { - profile->pk_schemes[0] = ZRTP_PKTYPE_EC256P; - profile->pk_schemes[1] = ZRTP_PKTYPE_DH3072; - profile->pk_schemes[2] = ZRTP_PKTYPE_DH2048; - } - profile->pk_schemes[3] = ZRTP_PKTYPE_MULT; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_profile_check(const zrtp_profile_t* profile, zrtp_global_t* zrtp) -{ - uint8_t i = 0; - - if (!profile || !zrtp) { - return zrtp_status_bad_param; - } - - /* - * Fail if the required base components are not present in the profile. - */ - if (0 > zrtp_profile_find(profile, ZRTP_CC_HASH, ZRTP_HASH_SHA256)) { - ZRTP_LOG(1, (_ZTU_,"WARNING! can't find 'SHA256 ' in profile.\n")); - return zrtp_status_fail; - } - - if (0 > zrtp_profile_find(profile, ZRTP_CC_SAS, ZRTP_SAS_BASE32)) { - ZRTP_LOG(1, (_ZTU_,"WARNING! can't find 'base32' in profile.\n")); - return zrtp_status_fail; - } - - if (0 > zrtp_profile_find(profile, ZRTP_CC_CIPHER, ZRTP_CIPHER_AES128)) { - ZRTP_LOG(1, (_ZTU_,"WARNING! can't find 'AES1287 ' in profile.\n")); - return zrtp_status_fail; - } - - if (0 > zrtp_profile_find(profile, ZRTP_CC_PKT, ZRTP_PKTYPE_DH3072)) { - ZRTP_LOG(1, (_ZTU_,"WARNING! can't find 'DH3K' in profile.\n")); - return zrtp_status_fail; - } - - if (0 > zrtp_profile_find(profile, ZRTP_CC_PKT, ZRTP_PKTYPE_MULT)) { - ZRTP_LOG(1, (_ZTU_,"WARNING! can't find 'Mult' in profile.\n")); - return zrtp_status_fail; - } - - if (0 > zrtp_profile_find(profile, ZRTP_CC_ATL, ZRTP_ATL_HS32)) { - ZRTP_LOG(1, (_ZTU_,"WARNING! can't find '32 ' in profile.\n")); - return zrtp_status_fail; - } - - if (0 > zrtp_profile_find(profile, ZRTP_CC_ATL, ZRTP_ATL_HS80)) { - ZRTP_LOG(1, (_ZTU_,"WARNING! can't find '80 ' in profile.\n")); - return zrtp_status_fail; - } - - /* - * Check that each component in the profile is in the global set of components. - */ - i = 0; - while (profile->sas_schemes[i]) { - if (!zrtp_comp_find(ZRTP_CC_SAS, profile->sas_schemes[i++], zrtp)) { - return zrtp_status_fail; - } - } - - i = 0; - while (profile->cipher_types[i]) { - if (!zrtp_comp_find( ZRTP_CC_CIPHER, profile->cipher_types[i++], zrtp)) { - return zrtp_status_fail; - } - } - - i = 0; - while (profile->pk_schemes[i]) { - if (!zrtp_comp_find(ZRTP_CC_PKT, profile->pk_schemes[i++], zrtp)) { - return zrtp_status_fail; - } - } - - i = 0; - while (profile->auth_tag_lens[i]) { - if (!zrtp_comp_find(ZRTP_CC_ATL, profile->auth_tag_lens[i++], zrtp)) { - return zrtp_status_fail; - } - } - - i = 0; - while (profile->hash_schemes[i]) { - if (!zrtp_comp_find(ZRTP_CC_HASH, profile->hash_schemes[i++], zrtp)) { - return zrtp_status_fail; - } - } - - /* Can't use Preshared with No cahce */ - if (NULL == zrtp->cb.cache_cb.on_get) { - i = 0; - while (profile->pk_schemes[i]) { - if (ZRTP_PKTYPE_PRESH == profile->pk_schemes[i++]) { - ZRTP_LOG(1, (_ZTU_,"WARNING! can't use Preshared PK with no cache.\n")); - return zrtp_status_fail; - } - } - } - - return zrtp_status_ok; -} - - -/*----------------------------------------------------------------------------*/ -int zrtp_profile_find(const zrtp_profile_t* profile, zrtp_crypto_comp_t type, uint8_t id) - -{ - uint8_t* prof_elem = NULL; - unsigned int i = 0; - - if (!profile || !id) { - return -1; - } - - switch (type) - { - case ZRTP_CC_HASH: - prof_elem = (uint8_t*)profile->hash_schemes; - break; - case ZRTP_CC_SAS: - prof_elem = (uint8_t*)profile->sas_schemes; - break; - case ZRTP_CC_CIPHER: - prof_elem = (uint8_t*)profile->cipher_types; - break; - case ZRTP_CC_PKT: - prof_elem = (uint8_t*)profile->pk_schemes; - break; - case ZRTP_CC_ATL: - prof_elem = (uint8_t*)profile->auth_tag_lens; - break; - default: - return -1; - } - - - i = 0; - while ( prof_elem[i] ) { - if (id == prof_elem[i++]) return i; - } - - return -1; -} - - -/*============================================================================*/ -/* ZRTP components management part */ -/*============================================================================*/ - - -/*----------------------------------------------------------------------------*/ -#define DESTROY_COMP(mac_node, mac_tmp, mac_type, mac_head, mac_comp)\ -{ \ - mac_node = mac_tmp = NULL;\ - mac_comp = NULL;\ - mlist_for_each_safe(mac_node, mac_tmp, mac_head) \ - {\ - mac_comp = (zrtp_comp_t*) mlist_get_struct(mac_type, mlist, mac_node); \ - if (mac_comp->free)\ - mac_comp->free((mac_type*)mac_comp);\ - mlist_del(mac_node);\ - zrtp_sys_free(mac_comp);\ - } \ -}break - -zrtp_status_t zrtp_comp_done(zrtp_crypto_comp_t type, zrtp_global_t* zrtp) -{ - mlist_t* node = NULL; - mlist_t* tmp = NULL; - zrtp_comp_t* comp = NULL; - - switch (type) - { - case ZRTP_CC_HASH: - DESTROY_COMP(node, tmp, zrtp_hash_t, &zrtp->hash_head, comp); - case ZRTP_CC_SAS: - DESTROY_COMP(node, tmp, zrtp_sas_scheme_t, &zrtp->sas_head, comp); - case ZRTP_CC_CIPHER: - DESTROY_COMP(node, tmp, zrtp_cipher_t, &zrtp->cipher_head, comp); - case ZRTP_CC_PKT: - DESTROY_COMP(node, tmp, zrtp_pk_scheme_t, &zrtp->pktype_head, comp); - case ZRTP_CC_ATL: - DESTROY_COMP(node, tmp, zrtp_auth_tag_length_t, &zrtp->atl_head, comp); - default: - break; - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -#define ZRTP_COMP_INIT(mac_type, mac_head, mac_elem)\ -{\ - mac_type* mac_e = (mac_type*)mac_elem; \ - mlist_add_tail(mac_head, &mac_e->mlist);\ - if (mac_e->base.init)\ - mac_e->base.init((mac_type*)mac_e);\ -} break;\ - -zrtp_status_t zrtp_comp_register( zrtp_crypto_comp_t type, - void *comp, - zrtp_global_t* zrtp ) -{ - switch (type) - { - case ZRTP_CC_HASH: - ZRTP_COMP_INIT(zrtp_hash_t, &zrtp->hash_head, comp); - case ZRTP_CC_SAS: - ZRTP_COMP_INIT(zrtp_sas_scheme_t, &zrtp->sas_head, comp); - case ZRTP_CC_CIPHER: - ZRTP_COMP_INIT(zrtp_cipher_t, &zrtp->cipher_head, comp); - case ZRTP_CC_ATL: - ZRTP_COMP_INIT(zrtp_auth_tag_length_t, &zrtp->atl_head, comp); - case ZRTP_CC_PKT: - ZRTP_COMP_INIT(zrtp_pk_scheme_t, &zrtp->pktype_head, comp); - default: - break; - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -#define ZRTP_COMP_FIND(mac_head, mac_id, mac_type, res)\ -{\ - mlist_t* mac_node = NULL;\ - mlist_for_each(mac_node, mac_head)\ - {\ - zrtp_comp_t* mac_e = (zrtp_comp_t*) mlist_get_struct(mac_type, mlist, mac_node);\ - if ( mac_id == mac_e->id )\ - {\ - res = (mac_type*)mac_e;\ - break;\ - }\ - }\ -} break; - -void* zrtp_comp_find(zrtp_crypto_comp_t type, uint8_t id, zrtp_global_t* zrtp) -{ - void* res = NULL; - - switch (type) - { - case ZRTP_CC_HASH: - ZRTP_COMP_FIND(&zrtp->hash_head, id, zrtp_hash_t, res); - case ZRTP_CC_SAS: - ZRTP_COMP_FIND(&zrtp->sas_head, id, zrtp_sas_scheme_t, res); - case ZRTP_CC_CIPHER: - ZRTP_COMP_FIND(&zrtp->cipher_head, id, zrtp_cipher_t, res); - case ZRTP_CC_PKT: - ZRTP_COMP_FIND(&zrtp->pktype_head, id, zrtp_pk_scheme_t, res); - case ZRTP_CC_ATL: - ZRTP_COMP_FIND(&zrtp->atl_head, id, zrtp_auth_tag_length_t, res); - default: - break; - } - - return res ; -} - -/*----------------------------------------------------------------------------*/ -char* zrtp_comp_id2type(zrtp_crypto_comp_t type, uint8_t id) -{ - if (ZRTP_COMP_UNKN == id) - return "Unkn"; - - switch (type) - { - case ZRTP_CC_HASH: - switch (id) - { - case ZRTP_HASH_SHA256: return ZRTP_S256; - case ZRTP_HASH_SHA384: return ZRTP_S384; - default: return "Unkn"; - } - break; - - case ZRTP_CC_SAS: - switch (id) - { - case ZRTP_SAS_BASE32: return ZRTP_B32; - case ZRTP_SAS_BASE256: return ZRTP_B256; - default: return "Unkn"; - } - break; - - case ZRTP_CC_CIPHER: - switch (id) - { - case ZRTP_CIPHER_AES128: return ZRTP_AES1; - case ZRTP_CIPHER_AES256: return ZRTP_AES3; - default: return "Unkn"; - } - break; - - case ZRTP_CC_PKT: - switch (id) - { - case ZRTP_PKTYPE_PRESH: return ZRTP_PRESHARED; - case ZRTP_PKTYPE_MULT: return ZRTP_MULT; - case ZRTP_PKTYPE_DH2048: return ZRTP_DH2K; - case ZRTP_PKTYPE_DH3072: return ZRTP_DH3K; - case ZRTP_PKTYPE_EC256P: return ZRTP_EC256P; - case ZRTP_PKTYPE_EC384P: return ZRTP_EC384P; - case ZRTP_PKTYPE_EC521P: return ZRTP_EC521P; - default: return "Unkn"; - } - break; - - case ZRTP_CC_ATL: - switch (id) - { - case ZRTP_ATL_HS32: return ZRTP_HS32; - case ZRTP_ATL_HS80: return ZRTP_HS80; - default: return "Unkn"; - } - break; - - default: - return "Unkn"; - } -} - -/*----------------------------------------------------------------------------*/ -uint8_t zrtp_comp_type2id(zrtp_crypto_comp_t type, char* name) -{ - switch (type) - { - case ZRTP_CC_HASH: - if (!zrtp_memcmp(ZRTP_S256, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_HASH_SHA256; - } - if (!zrtp_memcmp(ZRTP_S384, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_HASH_SHA384; - } - break; - - case ZRTP_CC_SAS: - if (!zrtp_memcmp(ZRTP_B32, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_SAS_BASE32; - } - if (!zrtp_memcmp(ZRTP_B256, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_SAS_BASE256; - } - break; - - case ZRTP_CC_CIPHER: - if (!zrtp_memcmp(ZRTP_AES1, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_CIPHER_AES128; - } - if (!zrtp_memcmp(ZRTP_AES3, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_CIPHER_AES256; - } - break; - - case ZRTP_CC_PKT: - if (!zrtp_memcmp(ZRTP_PRESHARED, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_PKTYPE_PRESH; - } - if (!zrtp_memcmp(ZRTP_MULT, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_PKTYPE_MULT; - } - if (!zrtp_memcmp(ZRTP_DH3K, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_PKTYPE_DH3072; - } - if (!zrtp_memcmp(ZRTP_DH2K, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_PKTYPE_DH2048; - } - if (!zrtp_memcmp(ZRTP_EC256P, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_PKTYPE_EC256P; - } - if (!zrtp_memcmp(ZRTP_EC384P, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_PKTYPE_EC384P; - } - if (!zrtp_memcmp(ZRTP_EC521P, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_PKTYPE_EC521P; - } - break; - - case ZRTP_CC_ATL: - if ( !zrtp_memcmp(ZRTP_HS32, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_ATL_HS32; - } - if (!zrtp_memcmp(ZRTP_HS80, name, ZRTP_COMP_TYPE_SIZE)) { - return ZRTP_ATL_HS80; - } - break; - - default: - return 0; - } - - return 0; -} diff --git a/libs/libzrtp/src/zrtp_crc.c b/libs/libzrtp/src/zrtp_crc.c deleted file mode 100644 index 847b4e3f3f..0000000000 --- a/libs/libzrtp/src/zrtp_crc.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define ZRTP_CRC32C_POLY 0x1EDC6F41 -#define ZRTP_CRC32C(crc_c,c,d) (c=(c>>8)^crc_c[(c^(d))&0xFF]) - -/*----------------------------------------------------------------------------*/ -uint32_t zrtp_generate_crc(const uint8_t* buff, uint32_t length) -{ - uint32_t i=0; - uint32_t crc32 = ~0L; - uint32_t result; - uint8_t byte0,byte1,byte2,byte3; - - static const uint32_t crc_c[256] = - { - 0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L, - 0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL, - 0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL, - 0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L, 0x5E133C24L, - 0x105EC76FL, 0xE235446CL, 0xF165B798L, 0x030E349BL, - 0xD7C45070L, 0x25AFD373L, 0x36FF2087L, 0xC494A384L, - 0x9A879FA0L, 0x68EC1CA3L, 0x7BBCEF57L, 0x89D76C54L, - 0x5D1D08BFL, 0xAF768BBCL, 0xBC267848L, 0x4E4DFB4BL, - 0x20BD8EDEL, 0xD2D60DDDL, 0xC186FE29L, 0x33ED7D2AL, - 0xE72719C1L, 0x154C9AC2L, 0x061C6936L, 0xF477EA35L, - 0xAA64D611L, 0x580F5512L, 0x4B5FA6E6L, 0xB93425E5L, - 0x6DFE410EL, 0x9F95C20DL, 0x8CC531F9L, 0x7EAEB2FAL, - 0x30E349B1L, 0xC288CAB2L, 0xD1D83946L, 0x23B3BA45L, - 0xF779DEAEL, 0x05125DADL, 0x1642AE59L, 0xE4292D5AL, - 0xBA3A117EL, 0x4851927DL, 0x5B016189L, 0xA96AE28AL, - 0x7DA08661L, 0x8FCB0562L, 0x9C9BF696L, 0x6EF07595L, - 0x417B1DBCL, 0xB3109EBFL, 0xA0406D4BL, 0x522BEE48L, - 0x86E18AA3L, 0x748A09A0L, 0x67DAFA54L, 0x95B17957L, - 0xCBA24573L, 0x39C9C670L, 0x2A993584L, 0xD8F2B687L, - 0x0C38D26CL, 0xFE53516FL, 0xED03A29BL, 0x1F682198L, - 0x5125DAD3L, 0xA34E59D0L, 0xB01EAA24L, 0x42752927L, - 0x96BF4DCCL, 0x64D4CECFL, 0x77843D3BL, 0x85EFBE38L, - 0xDBFC821CL, 0x2997011FL, 0x3AC7F2EBL, 0xC8AC71E8L, - 0x1C661503L, 0xEE0D9600L, 0xFD5D65F4L, 0x0F36E6F7L, - 0x61C69362L, 0x93AD1061L, 0x80FDE395L, 0x72966096L, - 0xA65C047DL, 0x5437877EL, 0x4767748AL, 0xB50CF789L, - 0xEB1FCBADL, 0x197448AEL, 0x0A24BB5AL, 0xF84F3859L, - 0x2C855CB2L, 0xDEEEDFB1L, 0xCDBE2C45L, 0x3FD5AF46L, - 0x7198540DL, 0x83F3D70EL, 0x90A324FAL, 0x62C8A7F9L, - 0xB602C312L, 0x44694011L, 0x5739B3E5L, 0xA55230E6L, - 0xFB410CC2L, 0x092A8FC1L, 0x1A7A7C35L, 0xE811FF36L, - 0x3CDB9BDDL, 0xCEB018DEL, 0xDDE0EB2AL, 0x2F8B6829L, - 0x82F63B78L, 0x709DB87BL, 0x63CD4B8FL, 0x91A6C88CL, - 0x456CAC67L, 0xB7072F64L, 0xA457DC90L, 0x563C5F93L, - 0x082F63B7L, 0xFA44E0B4L, 0xE9141340L, 0x1B7F9043L, - 0xCFB5F4A8L, 0x3DDE77ABL, 0x2E8E845FL, 0xDCE5075CL, - 0x92A8FC17L, 0x60C37F14L, 0x73938CE0L, 0x81F80FE3L, - 0x55326B08L, 0xA759E80BL, 0xB4091BFFL, 0x466298FCL, - 0x1871A4D8L, 0xEA1A27DBL, 0xF94AD42FL, 0x0B21572CL, - 0xDFEB33C7L, 0x2D80B0C4L, 0x3ED04330L, 0xCCBBC033L, - 0xA24BB5A6L, 0x502036A5L, 0x4370C551L, 0xB11B4652L, - 0x65D122B9L, 0x97BAA1BAL, 0x84EA524EL, 0x7681D14DL, - 0x2892ED69L, 0xDAF96E6AL, 0xC9A99D9EL, 0x3BC21E9DL, - 0xEF087A76L, 0x1D63F975L, 0x0E330A81L, 0xFC588982L, - 0xB21572C9L, 0x407EF1CAL, 0x532E023EL, 0xA145813DL, - 0x758FE5D6L, 0x87E466D5L, 0x94B49521L, 0x66DF1622L, - 0x38CC2A06L, 0xCAA7A905L, 0xD9F75AF1L, 0x2B9CD9F2L, - 0xFF56BD19L, 0x0D3D3E1AL, 0x1E6DCDEEL, 0xEC064EEDL, - 0xC38D26C4L, 0x31E6A5C7L, 0x22B65633L, 0xD0DDD530L, - 0x0417B1DBL, 0xF67C32D8L, 0xE52CC12CL, 0x1747422FL, - 0x49547E0BL, 0xBB3FFD08L, 0xA86F0EFCL, 0x5A048DFFL, - 0x8ECEE914L, 0x7CA56A17L, 0x6FF599E3L, 0x9D9E1AE0L, - 0xD3D3E1ABL, 0x21B862A8L, 0x32E8915CL, 0xC083125FL, - 0x144976B4L, 0xE622F5B7L, 0xF5720643L, 0x07198540L, - 0x590AB964L, 0xAB613A67L, 0xB831C993L, 0x4A5A4A90L, - 0x9E902E7BL, 0x6CFBAD78L, 0x7FAB5E8CL, 0x8DC0DD8FL, - 0xE330A81AL, 0x115B2B19L, 0x020BD8EDL, 0xF0605BEEL, - 0x24AA3F05L, 0xD6C1BC06L, 0xC5914FF2L, 0x37FACCF1L, - 0x69E9F0D5L, 0x9B8273D6L, 0x88D28022L, 0x7AB90321L, - 0xAE7367CAL, 0x5C18E4C9L, 0x4F48173DL, 0xBD23943EL, - 0xF36E6F75L, 0x0105EC76L, 0x12551F82L, 0xE03E9C81L, - 0x34F4F86AL, 0xC69F7B69L, 0xD5CF889DL, 0x27A40B9EL, - 0x79B737BAL, 0x8BDCB4B9L, 0x988C474DL, 0x6AE7C44EL, - 0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L, - }; - - for (i=0; i>8) & 0xff; - byte2 = (result>>16) & 0xff; - byte3 = (result>>24) & 0xff; - - crc32 = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3); - return ( crc32 ); -} - - -/*----------------------------------------------------------------------------*/ -void _zrtp_packet_insert_crc(char* packet, uint32_t length) -{ - uint32_t crc32; - uint32_t* packet_crc = (uint32_t*) (packet + length - 4); /* Last 4 bytes contain CRC */ - - *packet_crc = 0L; - crc32 = zrtp_generate_crc((const uint8_t*)packet, length-4); - *packet_crc = zrtp_hton32(crc32); -} - - -/*----------------------------------------------------------------------------*/ -int8_t _zrtp_packet_validate_crc(const char* packet, uint32_t length) -{ - ZRTP_UNALIGNED(uint32_t)*packet_crc = 0; - uint32_t original_crc32 = 0L; - uint32_t crc32 = 0L; - - packet_crc = (uint32_t*) (packet + length - 4); /* Last 4 bytes contain CRC */ - original_crc32 = zrtp_ntoh32(*packet_crc); - *packet_crc = 0L; - crc32 = zrtp_generate_crc((const uint8_t*)packet, length-4); - *packet_crc = zrtp_hton32(original_crc32); - - return !(original_crc32 == crc32); -} diff --git a/libs/libzrtp/src/zrtp_crypto_aes.c b/libs/libzrtp/src/zrtp_crypto_aes.c deleted file mode 100644 index f6058fd90e..0000000000 --- a/libs/libzrtp/src/zrtp_crypto_aes.c +++ /dev/null @@ -1,833 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - * Vitaly Rozhkov - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp cipher" - -typedef struct zrtp_aes_cfb_ctx { - uint8_t mode; - aes_encrypt_ctx aes_ctx[1]; - zrtp_v128_t iv; -} zrtp_aes_cfb_ctx_t; - -typedef struct zrtp_aes_ctr_ctx { - uint8_t mode; - aes_encrypt_ctx aes_ctx[1]; - zrtp_v128_t salt; - zrtp_v128_t counter; -}zrtp_aes_ctr_ctx_t; - - -/*===========================================================================*/ -/* Global AES functions */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_aes_cfb_stop(zrtp_cipher_t *self, void *cipher_ctx) { - zrtp_memset(cipher_ctx, 0, sizeof(zrtp_aes_cfb_ctx_t)); - zrtp_sys_free(cipher_ctx); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_aes_ctr_stop(zrtp_cipher_t *self, void *cipher_ctx) { - zrtp_memset(cipher_ctx, 0, sizeof(zrtp_aes_ctr_ctx_t)); - zrtp_sys_free(cipher_ctx); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_aes_stop(zrtp_cipher_t *self, void *cipher_ctx) -{ - zrtp_status_t res; - zrtp_cipher_mode_t *mode = (zrtp_cipher_mode_t*)cipher_ctx; - switch (mode->mode) { - case ZRTP_CIPHER_MODE_CTR: - res = zrtp_aes_ctr_stop(self, cipher_ctx); - break; - case ZRTP_CIPHER_MODE_CFB: - res = zrtp_aes_cfb_stop(self, cipher_ctx); - break; - default: - res = zrtp_status_bad_param; - break; - } - return res; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_aes_cfb_set_iv(zrtp_cipher_t *self, void* cipher_ctx, zrtp_v128_t *iv) -{ - zrtp_aes_cfb_ctx_t* ctx = (zrtp_aes_cfb_ctx_t*)cipher_ctx; - zrtp_memcpy(&ctx->iv, iv, sizeof(zrtp_v128_t)); - - /* clear previous context except the first byte (key length) */ - zrtp_bg_aes_mode_reset(ctx->aes_ctx); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_aes_ctr_set_iv(zrtp_cipher_t *self, void *cipher_ctx, zrtp_v128_t *iv ) -{ - zrtp_aes_ctr_ctx_t* ctx = (zrtp_aes_ctr_ctx_t*)cipher_ctx; - zrtp_v128_xor(&ctx->counter, &ctx->salt, iv); - - /* clear previous context except the first byte (key length) */ - zrtp_bg_aes_mode_reset(ctx->aes_ctx); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_aes_set_iv(zrtp_cipher_t *self, void *cipher_ctx, zrtp_v128_t *iv ) -{ - zrtp_status_t res; - zrtp_cipher_mode_t *mode = (zrtp_cipher_mode_t*)cipher_ctx; - - switch (mode->mode) { - case ZRTP_CIPHER_MODE_CTR: - res = zrtp_aes_ctr_set_iv(self, cipher_ctx, iv); - break; - case ZRTP_CIPHER_MODE_CFB: - res = zrtp_aes_cfb_set_iv(self, cipher_ctx, iv); - break; - default: - res = zrtp_status_bad_param; - break; - } - return res; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_aes_cfb_encrypt( zrtp_cipher_t *self, - void* cipher_ctx, - unsigned char *buf, - int len) { - zrtp_aes_cfb_ctx_t* ctx = (zrtp_aes_cfb_ctx_t*)cipher_ctx; - AES_RETURN res = zrtp_bg_aes_cfb_encrypt(buf, buf, len, ctx->iv.v8, ctx->aes_ctx); - - return (EXIT_SUCCESS == res) ? zrtp_status_ok : zrtp_status_cipher_fail; -} - -void zrtp_aes_ctr_inc(unsigned char *counter) { - if(!(++counter[15])) { - ++counter[14]; - } -} - -zrtp_status_t zrtp_aes_ctr_encrypt( zrtp_cipher_t *self, - void *cipher_ctx, - unsigned char *buf, - int len ) { - zrtp_aes_ctr_ctx_t* ctx = (zrtp_aes_ctr_ctx_t*)cipher_ctx; - AES_RETURN res = zrtp_bg_aes_ctr_crypt(buf, buf, len, ctx->counter.v8, zrtp_aes_ctr_inc, ctx->aes_ctx); - - return (EXIT_SUCCESS == res) ? zrtp_status_ok : zrtp_status_cipher_fail; -} - -zrtp_status_t zrtp_aes_encrypt( zrtp_cipher_t *self, - void *cipher_ctx, - unsigned char *buf, - int len) -{ - zrtp_status_t res; - zrtp_cipher_mode_t* mode = (zrtp_cipher_mode_t*)cipher_ctx; - switch (mode->mode) { - case ZRTP_CIPHER_MODE_CTR: - res = zrtp_aes_ctr_encrypt(self, cipher_ctx, buf, len); - break; - case ZRTP_CIPHER_MODE_CFB: - res = zrtp_aes_cfb_encrypt(self, cipher_ctx, buf, len); - break; - default: - res = zrtp_status_bad_param; - break; - } - return res; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_aes_cfb_decrypt( zrtp_cipher_t *self, - void* cipher_ctx, - unsigned char *buf, - int len) { - zrtp_aes_cfb_ctx_t* ctx = (zrtp_aes_cfb_ctx_t*)cipher_ctx; - AES_RETURN res = zrtp_bg_aes_cfb_decrypt(buf, buf, len, ctx->iv.v8, ctx->aes_ctx); - - return (EXIT_SUCCESS == res) ? zrtp_status_ok : zrtp_status_cipher_fail; -} - -zrtp_status_t zrtp_aes_ctr_decrypt( zrtp_cipher_t *self, - void *cipher_ctx, - unsigned char *buf, - int len) { - zrtp_aes_ctr_ctx_t* ctx = (zrtp_aes_ctr_ctx_t*)cipher_ctx; - - AES_RETURN res = zrtp_bg_aes_ctr_crypt(buf, buf, len, ctx->counter.v8, zrtp_aes_ctr_inc, ctx->aes_ctx); - return (EXIT_SUCCESS == res) ? zrtp_status_ok : zrtp_status_cipher_fail; -} - -zrtp_status_t zrtp_aes_decrypt( zrtp_cipher_t *self, - void *cipher_ctx, - unsigned char *buf, - int len) -{ - zrtp_status_t res; - zrtp_cipher_mode_t *mode = (zrtp_cipher_mode_t*)cipher_ctx; - - switch(mode->mode){ - case ZRTP_CIPHER_MODE_CTR: - res = zrtp_aes_ctr_decrypt(self, cipher_ctx, buf, len); - break; - case ZRTP_CIPHER_MODE_CFB: - res = zrtp_aes_cfb_decrypt(self, cipher_ctx, buf, len); - break; - default: - res = zrtp_status_bad_param; - break; - } - return res; -} - - -/*===========================================================================*/ -/* AES 128 implementation */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -void *zrtp_aes_cfb128_start(zrtp_cipher_t *self, void *key, void *extra_data) -{ - zrtp_aes_cfb_ctx_t *cipher_ctx = zrtp_sys_alloc(sizeof(zrtp_aes_cfb_ctx_t)); - if(NULL == cipher_ctx) { - return NULL; - } - cipher_ctx->mode = ZRTP_CIPHER_MODE_CFB; - zrtp_bg_aes_encrypt_key128(((zrtp_v128_t*)key)->v8, cipher_ctx->aes_ctx); - - return cipher_ctx; -} - - -void *zrtp_aes_ctr128_start( zrtp_cipher_t *self, void *key, void *extra_data) -{ - zrtp_aes_ctr_ctx_t *cipher_ctx = zrtp_sys_alloc(sizeof(zrtp_aes_ctr_ctx_t)); - if(NULL == cipher_ctx) { - return NULL; - } - - cipher_ctx->mode = ZRTP_CIPHER_MODE_CTR; - zrtp_memcpy(&cipher_ctx->salt, extra_data, sizeof(zrtp_v128_t)-2); - cipher_ctx->salt.v8[14] = cipher_ctx->salt.v8[15] =0; - - zrtp_memset(&cipher_ctx->counter, 0, sizeof(zrtp_v128_t)); - zrtp_bg_aes_encrypt_key128(((zrtp_v128_t*)key)->v8, cipher_ctx->aes_ctx); - - return cipher_ctx; -} - -void *zrtp_aes128_start( zrtp_cipher_t *self, void *key, void *extra_data, uint8_t mode) -{ - void *ctx; - switch (mode) { - case ZRTP_CIPHER_MODE_CTR: - ctx = zrtp_aes_ctr128_start(self, key, extra_data); - break; - case ZRTP_CIPHER_MODE_CFB: - ctx = zrtp_aes_cfb128_start(self, key, extra_data); - break; - default: - ctx = NULL; - break; - }; - return ctx; -} - -/*---------------------------------------------------------------------------*/ -/* Global CFB Test-Vectors */ -static uint8_t aes_cfb_test_key[32] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f -}; - -static uint8_t aes_cfb_test_iv[16] = { - 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, - 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff -}; - -static uint8_t aes_cfb_test_buf1a[50] = { - 0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x04, 0x30, - 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a -}; - -static uint8_t aes_cfb_test_buf1b[50]; -//static uint8_t aes_cfb_test_buf1c[50]; - -static uint8_t aes_cfb_test_buf2a[50] = { - 0x8e, 0xa2, 0xb7, 0xca, 0x51, 0x67, 0x45, 0xbf, - 0xea, 0xfc, 0x49, 0x90, 0x4b, 0x49, 0x60, 0x89 -}; - -static uint8_t aes_cfb_test_buf2b[50]; - -static uint8_t aes_cfb_test_key3[32]; -static uint8_t aes_cfb_test_iv3[16]; -static uint8_t aes_cfb_test_buf3a[50]; - -static uint8_t aes_cfb_test_buf3b[50] = { - 0x66, 0xe9, 0x4b, 0xd4, 0xef, 0x8a, 0x2c, 0x3b, - 0x88, 0x4c, 0xfa, 0x59, 0xca, 0x34, 0x2b, 0x2e, - 0xf7, 0x95, 0xbd, 0x4a, 0x52, 0xe2, 0x9e, 0xd7, - 0x13, 0xd3, 0x13, 0xfa, 0x20, 0xe9, 0x8d, 0xbc, - 0xa1, 0x0c, 0xf6, 0x6d, 0x0f, 0xdd, 0xf3, 0x40, - 0x53, 0x70, 0xb4, 0xbf, 0x8d, 0xf5, 0xbf, 0xb3, - 0x47, 0xc7 -}; - -uint8_t aes_cfb_test_buf3c[50] = { - 0xdc, 0x95, 0xc0, 0x78, 0xa2, 0x40, 0x89, 0x89, - 0xad, 0x48, 0xa2, 0x14, 0x92, 0x84, 0x20, 0x87, - 0x08, 0xc3, 0x74, 0x84, 0x8c, 0x22, 0x82, 0x33, - 0xc2, 0xb3, 0x4f, 0x33, 0x2b, 0xd2, 0xe9, 0xd3, - 0x8b, 0x70, 0xc5, 0x15, 0xa6, 0x66, 0x3d, 0x38, - 0xcd, 0xb8, 0xe6, 0x53, 0x2b, 0x26, 0x64, 0x91, - 0x5d, 0x0d -}; - -/* Global CTR Test-Vectors */ -uint8_t aes_ctr_test_nonce[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 -}; - -/* 258-bit AES CTR Test-Vectors */ -uint8_t aes_ctr_test_key256[48] = { - 0x00, 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x08, - 0x0A, 0x0B, 0x0C, 0x0D, 0x0F, 0x10, 0x11, 0x12, - 0x14, 0x15, 0x16, 0x17, 0x19, 0x1A, 0x1B, 0x1C, - 0x1E, 0x1F, 0x20, 0x21, 0x23, 0x24, 0x25, 0x26, - 0x83, 0x4E, 0xAD, 0xFC, 0xCA, 0xC7, 0xE1, 0xB3, - 0x06, 0x64, 0xB1, 0xAB, 0xA4, 0x48, 0x15, 0xAB -}; - -uint8_t aes_ctr_test_plaintext256[16] = { - 0x83, 0x4E, 0xAD, 0xFC, 0xCA, 0xC7, 0xE1, 0xB3, - 0x06, 0x64, 0xB1, 0xAB, 0xA4, 0x48, 0x15, 0xAB -}; - -uint8_t aes_ctr_test_ciphertext256[16] = { - 0x5d, 0x8e, 0xfd, 0xe6, 0x69, 0x62, 0xbf, 0x49, - 0xda, 0xe2, 0xea, 0xcf, 0x0b, 0x69, 0xe4, 0xf6 -}; - -/* 128-bit AES CFB Test-Vectors */ -uint8_t aes_ctr_test_key128[32] = { -0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6, -0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c, -0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, -0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0x00 -}; - -uint8_t aes_ctr_test_plaintext128[32] = { -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -uint8_t aes_ctr_test_ciphertext128[32] = { -0xe0, 0x3e, 0xad, 0x09, 0x35, 0xc9, 0x5e, 0x80, -0xe1, 0x66, 0xb1, 0x6d, 0xd9, 0x2b, 0x4e, 0xb4, -0xd2, 0x35, 0x13, 0x16, 0x2b, 0x02, 0xd0, 0xf7, -0x2a, 0x43, 0xa2, 0xfe, 0x4a, 0x5f, 0x97, 0xab -}; - - -zrtp_status_t zrtp_aes_cfb128_self_test(zrtp_cipher_t *self) -{ - - zrtp_status_t err = zrtp_status_fail; - int i = 0; - zrtp_v128_t tmp_iv; - zrtp_aes_cfb_ctx_t *ctx = (zrtp_aes_cfb_ctx_t*)self->start( self, - aes_cfb_test_key, - NULL, - ZRTP_CIPHER_MODE_CFB); - if(NULL == ctx) { - return zrtp_status_fail; - } - - ZRTP_LOG(3, (_ZTU_,"128 bit AES CFB\n")); - ZRTP_LOG(3, (_ZTU_,"1st test...\n")); - - zrtp_memcpy(aes_cfb_test_buf1b, aes_cfb_test_buf1a, sizeof(aes_cfb_test_buf1a)); - zrtp_memcpy(&tmp_iv, aes_cfb_test_iv, sizeof(aes_cfb_test_iv)); - self->set_iv(self, ctx, &tmp_iv); - - ZRTP_LOG(3, (_ZTU_,"\tencryption... ")); - - err = self->encrypt(self, ctx, aes_cfb_test_buf1b, sizeof(aes_cfb_test_buf1b)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 128-bit AES CFB encrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; i<16; i++) { - if (aes_cfb_test_buf1b[i] != 0x00) { - ZRTP_LOGC(1, ("ERROR! 128-bit AES CFB failed on encrypt test")); - self->stop(self, ctx); - return zrtp_status_fail; - } - } - ZRTP_LOGC(3, ("OK\n")); - - ZRTP_LOG(3, (_ZTU_,"\tdecryption... ")); - - zrtp_memcpy(&tmp_iv, aes_cfb_test_iv, sizeof(aes_cfb_test_iv)); - - self->set_iv(self, ctx, &tmp_iv); - err = self->decrypt(self, ctx, aes_cfb_test_buf1b, sizeof(aes_cfb_test_buf1b)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(3, ("ERROR! 128-bit AES CFB decrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; istop(self, ctx); - return zrtp_status_fail; - } - } - self->stop(self, ctx); - ZRTP_LOGC(3, ("OK\n")); - - ZRTP_LOG(3, (_ZTU_, "2nd test...\n")); - - ctx = self->start(self, aes_cfb_test_key3, NULL, ZRTP_CIPHER_MODE_CFB); - if (NULL == ctx) { - return zrtp_status_fail; - } - - ZRTP_LOG(3, (_ZTU_, "\tencryption... ")); - - zrtp_memcpy(&tmp_iv, aes_cfb_test_iv3, sizeof(tmp_iv)); - self->set_iv(self, ctx, &tmp_iv); - - err = self->encrypt(self, ctx, aes_cfb_test_buf3a, sizeof(aes_cfb_test_buf3a)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 128-bit AES CFB encrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; istop(self, ctx); - return zrtp_status_fail; - } - } - ZRTP_LOGC(3, ("OK\n")); - - ZRTP_LOG(3, (_ZTU_, "\tdecryption... ")); - zrtp_memcpy(&tmp_iv, aes_cfb_test_iv3, sizeof(tmp_iv)); - self->set_iv(self, ctx, &tmp_iv); - - err = self->decrypt(self, ctx, aes_cfb_test_buf3b, sizeof(aes_cfb_test_buf3b)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 128-bit AES CFB decrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; istop(self, ctx); - return zrtp_status_fail; - } - } - ZRTP_LOGC(3, ("OK\n")); - - self->stop(self, ctx); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_aes_ctr128_self_test(zrtp_cipher_t *self) -{ - uint8_t tmp_buf[32]; - zrtp_status_t err = zrtp_status_fail; - int i; - - zrtp_aes_ctr_ctx_t *ctx = (zrtp_aes_ctr_ctx_t*)self->start( self, - aes_ctr_test_key128, - aes_ctr_test_key128+16, - ZRTP_CIPHER_MODE_CTR); - - if (NULL == ctx) { - return zrtp_status_fail; - } - - ZRTP_LOG(3, (_ZTU_,"128 bit AES CTR\n")); - ZRTP_LOG(3, (_ZTU_, "1st test...\n")); - - ZRTP_LOG(3, (_ZTU_, "\tencryption... ")); - - self->set_iv(self, ctx, (zrtp_v128_t*)aes_ctr_test_nonce); - - zrtp_memcpy(tmp_buf, aes_ctr_test_plaintext128, sizeof(tmp_buf)); - err = self->encrypt(self, ctx, tmp_buf, sizeof(tmp_buf)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 128-bit encrypt returns error %d\n", err)); - self->stop(self, ctx); - return zrtp_status_fail; - } - - for (i=0; istop(self, ctx); - return err; - } - } - ZRTP_LOGC(3, ("OK\n")); - - ZRTP_LOG(3, (_ZTU_, "\tdecryption...")); - - self->set_iv(self, ctx, (zrtp_v128_t*)aes_ctr_test_nonce); - - err = self->decrypt(self, ctx, tmp_buf, sizeof(tmp_buf)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 128-bit AES CTR decrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; istop(self, ctx); - return zrtp_status_fail; - } - } - self->stop(self, ctx); - ZRTP_LOGC(3, ("OK\n")); - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_aes128_self_test(zrtp_cipher_t *self, uint8_t mode) -{ - zrtp_status_t res; - switch(mode){ - case ZRTP_CIPHER_MODE_CTR: - res = zrtp_aes_ctr128_self_test(self); - break; - case ZRTP_CIPHER_MODE_CFB: - res = zrtp_aes_cfb128_self_test(self); - break; - default: - res = zrtp_status_bad_param; - break; - } - return res; -} - -/*===========================================================================*/ -/* AES 256 implementation */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -void *zrtp_aes_cfb256_start(zrtp_cipher_t *self, void *key, void *extra_data) -{ - zrtp_aes_cfb_ctx_t *cipher_ctx = zrtp_sys_alloc(sizeof(zrtp_aes_cfb_ctx_t)); - if(NULL == cipher_ctx) { - return NULL; - } - - cipher_ctx->mode = ZRTP_CIPHER_MODE_CFB; - zrtp_bg_aes_encrypt_key256(((zrtp_v256_t*)key)->v8, cipher_ctx->aes_ctx); - return cipher_ctx; -} - -void *zrtp_aes_ctr256_start(zrtp_cipher_t *self, void *key, void *extra_data) -{ - zrtp_aes_ctr_ctx_t *cipher_ctx = zrtp_sys_alloc(sizeof(zrtp_aes_ctr_ctx_t)); - if(NULL == cipher_ctx) { - return NULL; - } - - cipher_ctx->mode = ZRTP_CIPHER_MODE_CTR; - zrtp_memcpy(&cipher_ctx->salt, extra_data, sizeof(zrtp_v128_t)-2); - cipher_ctx->salt.v8[14] = cipher_ctx->salt.v8[15] =0; - - zrtp_memset(&cipher_ctx->counter, 0, sizeof(zrtp_v128_t)); - - zrtp_bg_aes_encrypt_key256(((zrtp_v256_t*)key)->v8, cipher_ctx->aes_ctx); - - return cipher_ctx; -} - -void *zrtp_aes256_start(zrtp_cipher_t *self, void *key, void *extra_data, uint8_t mode) -{ - void *ctx = NULL; - switch (mode) { - case ZRTP_CIPHER_MODE_CTR: - ctx = zrtp_aes_ctr256_start(self, key, extra_data); - break; - case ZRTP_CIPHER_MODE_CFB: - ctx = zrtp_aes_cfb256_start(self, key, extra_data); - break; - default: - ctx = NULL; - break; - } - return ctx; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_aes_cfb256_self_test(zrtp_cipher_t *self) -{ - zrtp_status_t err; - int i; - zrtp_v128_t tmp_iv; - - zrtp_aes_cfb_ctx_t *ctx = (zrtp_aes_cfb_ctx_t*)self->start( self, - aes_cfb_test_key, - NULL, - ZRTP_CIPHER_MODE_CFB); - if (NULL == ctx) { - return zrtp_status_fail; - } - - ZRTP_LOG(3, (_ZTU_,"256 bit AES CFB\n")); - ZRTP_LOG(3, (_ZTU_, "1st test...\n")); - - zrtp_memcpy(aes_cfb_test_buf2b, aes_cfb_test_buf2a, sizeof(aes_cfb_test_buf2a)); - zrtp_memcpy(&tmp_iv, aes_cfb_test_iv, sizeof(tmp_iv)); - - ZRTP_LOG(3, (_ZTU_, "\tencryption... ")); - - self->set_iv(self, ctx, &tmp_iv); - err = self->encrypt(self, ctx, aes_cfb_test_buf2b, sizeof(aes_cfb_test_buf2b)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB encrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; i<16; i++) { - if (aes_cfb_test_buf2b[i] != 0x00) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB failed on encrypt test\n")); - self->stop(self, ctx); - return zrtp_status_fail; - } - } - ZRTP_LOGC(3, ("OK\n")); - - ZRTP_LOG(3, (_ZTU_, "\tdecryption... ")); - - zrtp_memcpy(&tmp_iv, aes_cfb_test_iv, sizeof(tmp_iv)); - self->set_iv(self, ctx, &tmp_iv); - - err = self->decrypt(self, ctx, aes_cfb_test_buf2b, sizeof(aes_cfb_test_buf2b)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB decrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - for (i=0; istop(self, ctx); - return zrtp_status_fail; - } - } - self->stop(self, ctx); - ZRTP_LOGC(3, ("OK\n")); - - ZRTP_LOG(3, (_ZTU_, "2nd test...\n")); - - ctx = self->start(self, aes_cfb_test_key3, NULL, ZRTP_CIPHER_MODE_CFB); - if(NULL == ctx){ - return zrtp_status_fail; - } - - ZRTP_LOG(3, (_ZTU_, "\tencryption...")); - - zrtp_memset (aes_cfb_test_buf3a, 0, sizeof(aes_cfb_test_buf3a)); - zrtp_memcpy(&tmp_iv, aes_cfb_test_iv3, sizeof(tmp_iv)); - - self->set_iv(self, ctx, &tmp_iv); - err = self->encrypt(self, ctx, aes_cfb_test_buf3a, sizeof(aes_cfb_test_buf3a)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB encrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; istop(self, ctx); - return zrtp_status_fail; - } - } - ZRTP_LOGC(3, ("OK\n")); - - ZRTP_LOG(3, (_ZTU_, "\tdecryption...")); - - zrtp_memcpy(&tmp_iv, aes_cfb_test_iv3, sizeof(tmp_iv)); - self->set_iv(self, ctx, &tmp_iv); - - err = self->decrypt(self, ctx, aes_cfb_test_buf3c, sizeof(aes_cfb_test_buf3c)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CFB decrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; istop(self, ctx); - return zrtp_status_fail; - } - } - self->stop(self, ctx); - ZRTP_LOGC(3, ("OK\n")); - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_aes_ctr256_self_test(zrtp_cipher_t *self) -{ - uint8_t tmp_buf[32]; - zrtp_status_t err = zrtp_status_fail; - int i; - - zrtp_aes_ctr_ctx_t *ctx = (zrtp_aes_ctr_ctx_t*)self->start( self, - aes_ctr_test_key256, - aes_ctr_test_key256+32, - ZRTP_CIPHER_MODE_CTR); - if (NULL == ctx) { - return zrtp_status_fail; - } - - ZRTP_LOG(3, (_ZTU_,"256 bit AES CTR\n")); - ZRTP_LOG(3, (_ZTU_, "1st test...\n")); - - ZRTP_LOG(3, (_ZTU_, "\tencryption... ")); - - self->set_iv(self, ctx, (zrtp_v128_t*)aes_ctr_test_nonce); - - zrtp_memcpy(tmp_buf, aes_ctr_test_plaintext256, sizeof(aes_ctr_test_plaintext256)); - err = self->encrypt(self, ctx, tmp_buf, sizeof(aes_ctr_test_plaintext256)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 256-bit encrypt returns error %d\n", err)); - self->stop(self, ctx); - return zrtp_status_fail; - } - - for (i=0; istop(self, ctx); - return err; - } - } - - ZRTP_LOGC(3, ("OK\n")); - - ZRTP_LOG(3, (_ZTU_, "\tdecryption...")); - - self->set_iv(self, ctx, (zrtp_v128_t*)aes_ctr_test_nonce); - - err = self->decrypt(self, ctx, tmp_buf, sizeof(tmp_buf)); - if (zrtp_status_ok != err) { - ZRTP_LOGC(1, ("ERROR! 256-bit AES CTR decrypt returns error %d\n", err)); - self->stop(self, ctx); - return err; - } - - for (i=0; istop(self, ctx); - return zrtp_status_fail; - } - } - self->stop(self, ctx); - ZRTP_LOGC(3, ("OK\n")); - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_aes256_self_test(zrtp_cipher_t *self, uint8_t mode) -{ - zrtp_status_t res; - switch (mode) { - case ZRTP_CIPHER_MODE_CTR: - res = zrtp_aes_ctr256_self_test(self); - break; - case ZRTP_CIPHER_MODE_CFB: - res = zrtp_aes_cfb256_self_test(self); - break; - default: - res = zrtp_status_bad_param; - break; - } - return res; -} - - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_defaults_aes_cipher(zrtp_global_t* global_ctx) -{ - zrtp_cipher_t* cipher_aes128 = zrtp_sys_alloc(sizeof(zrtp_cipher_t)); - zrtp_cipher_t* cipher_aes256 = zrtp_sys_alloc(sizeof(zrtp_cipher_t)); - if (!cipher_aes128 || !cipher_aes256) { - if (cipher_aes128) { - zrtp_sys_free(cipher_aes128); - } - if (cipher_aes256) { - zrtp_sys_free(cipher_aes256); - } - return zrtp_status_alloc_fail; - } - - zrtp_memset(cipher_aes128, 0, sizeof(zrtp_cipher_t)); - zrtp_memset(cipher_aes256, 0, sizeof(zrtp_cipher_t)); - - zrtp_memcpy(cipher_aes128->base.type, ZRTP_AES1, ZRTP_COMP_TYPE_SIZE); - cipher_aes128->base.id = ZRTP_CIPHER_AES128; - cipher_aes128->base.zrtp = global_ctx; - cipher_aes128->start = zrtp_aes128_start; - cipher_aes128->set_iv = zrtp_aes_set_iv; - cipher_aes128->encrypt = zrtp_aes_encrypt; - cipher_aes128->decrypt = zrtp_aes_decrypt; - cipher_aes128->self_test = zrtp_aes128_self_test; - cipher_aes128->stop = zrtp_aes_stop; - - zrtp_memcpy(cipher_aes256->base.type, ZRTP_AES3, ZRTP_COMP_TYPE_SIZE); - cipher_aes256->base.id = ZRTP_CIPHER_AES256; - cipher_aes256->base.zrtp = global_ctx; - cipher_aes256->start = zrtp_aes256_start; - cipher_aes256->set_iv = zrtp_aes_set_iv; - cipher_aes256->encrypt = zrtp_aes_encrypt; - cipher_aes256->decrypt = zrtp_aes_decrypt; - cipher_aes256->self_test = zrtp_aes256_self_test; - cipher_aes256->stop = zrtp_aes_stop; - - zrtp_comp_register(ZRTP_CC_CIPHER, cipher_aes128, global_ctx); - zrtp_comp_register(ZRTP_CC_CIPHER, cipher_aes256, global_ctx); - - return zrtp_status_ok; -} diff --git a/libs/libzrtp/src/zrtp_crypto_atl.c b/libs/libzrtp/src/zrtp_crypto_atl.c deleted file mode 100644 index 790a11006f..0000000000 --- a/libs/libzrtp/src/zrtp_crypto_atl.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - - -/*============================================================================*/ -/* SRTP Auth Tag Length support */ -/*============================================================================*/ - -zrtp_status_t zrtp_defaults_atl(zrtp_global_t* global_ctx) -{ - zrtp_auth_tag_length_t* atl32 = zrtp_sys_alloc(sizeof(zrtp_auth_tag_length_t)); - zrtp_auth_tag_length_t* atl80 = zrtp_sys_alloc(sizeof(zrtp_auth_tag_length_t)); - - if (!atl32 || !atl80) { - if(atl32) zrtp_sys_free(atl32); - if(atl80) zrtp_sys_free(atl80); - return zrtp_status_alloc_fail; - } - - zrtp_memset(atl32, 0, sizeof(zrtp_auth_tag_length_t)); - zrtp_memcpy(atl32->base.type, ZRTP_HS32, ZRTP_COMP_TYPE_SIZE); - atl32->base.id = ZRTP_ATL_HS32; - atl32->base.zrtp = global_ctx; - atl32->tag_length = 4; - - zrtp_memset(atl80, 0, sizeof(zrtp_auth_tag_length_t)); - zrtp_memcpy(atl80->base.type, ZRTP_HS80, ZRTP_COMP_TYPE_SIZE); - atl80->base.id = ZRTP_ATL_HS80; - atl80->base.zrtp = global_ctx; - atl80->tag_length = 10; - - zrtp_comp_register(ZRTP_CC_ATL, atl32, global_ctx); - zrtp_comp_register(ZRTP_CC_ATL, atl80, global_ctx); - - return zrtp_status_ok; -} diff --git a/libs/libzrtp/src/zrtp_crypto_ec.c b/libs/libzrtp/src/zrtp_crypto_ec.c deleted file mode 100644 index 6a7fd2907d..0000000000 --- a/libs/libzrtp/src/zrtp_crypto_ec.c +++ /dev/null @@ -1,461 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - */ - -#include "zrtp.h" - -/* Size of extra random data to approximate a uniform distribution mod n */ -#define UNIFORMBYTES 8 - - -/*============================================================================*/ -/* Bignum Shorthand Functions */ -/*============================================================================*/ - -int bnAddMod_ (struct BigNum *rslt, struct BigNum *n1, struct BigNum *mod) -{ - bnAdd (rslt, n1); - if (bnCmp (rslt, mod) >= 0) { - bnSub (rslt, mod); - } - return 0; -} - -int bnAddQMod_ (struct BigNum *rslt, unsigned n1, struct BigNum *mod) -{ - bnAddQ (rslt, n1); - if (bnCmp (rslt, mod) >= 0) { - bnSub (rslt, mod); - } - return 0; -} - -int bnSubMod_ (struct BigNum *rslt, struct BigNum *n1, struct BigNum *mod) -{ - if (bnCmp (rslt, n1) < 0) { - bnAdd (rslt, mod); - } - bnSub (rslt, n1); - return 0; -} - -int bnSubQMod_ (struct BigNum *rslt, unsigned n1, struct BigNum *mod) -{ - if (bnCmpQ (rslt, n1) < 0) { - bnAdd (rslt, mod); - } - bnSubQ (rslt, n1); - return 0; -} - -int bnMulMod_ (struct BigNum *rslt, struct BigNum *n1, struct BigNum *n2, struct BigNum *mod) -{ - bnMul (rslt, n1, n2); - bnMod (rslt, rslt, mod); - return 0; -} - -int bnMulQMod_ (struct BigNum *rslt, struct BigNum *n1, unsigned n2, struct BigNum *mod) -{ - bnMulQ (rslt, n1, n2); - bnMod (rslt, rslt, mod); - return 0; -} - -int bnSquareMod_ (struct BigNum *rslt, struct BigNum *n1, struct BigNum *mod) -{ - bnSquare (rslt, n1); - bnMod (rslt, rslt, mod); - return 0; -} - - -/*============================================================================*/ -/* Elliptic Curve arithmetic */ -/*============================================================================*/ - -/* Add two elliptic curve points. Any of them may be the same object. */ -int zrtp_ecAdd ( struct BigNum *rsltx, struct BigNum *rslty, - struct BigNum *p1x, struct BigNum *p1y, - struct BigNum *p2x, struct BigNum *p2y, struct BigNum *mod) -{ - struct BigNum trsltx, trslty; - struct BigNum t1, gam; - struct BigNum bnzero; - - bnBegin (&bnzero); - - /* Check for an operand being zero */ - if (bnCmp (p1x, &bnzero) == 0 && bnCmp (p1y, &bnzero) == 0) { - bnCopy (rsltx, p2x); bnCopy (rslty, p2y); - bnEnd (&bnzero); - return 0; - } - if (bnCmp (p2x, &bnzero) == 0 && bnCmp (p2y, &bnzero) == 0) { - bnCopy (rsltx, p1x); bnCopy (rslty, p1y); - bnEnd (&bnzero); - return 0; - } - - /* Check if p1 == -p2 and return 0 if so */ - if (bnCmp (p1x, p2x) == 0) { - struct BigNum tsum; - bnBegin (&tsum); - bnCopy (&tsum, p1x); - bnAddMod_ (&tsum, p2x, mod); - if (bnCmp (&tsum, &bnzero) == 0) { - bnSetQ (rsltx, 0); bnSetQ (rslty, 0); - bnEnd (&tsum); - bnEnd (&bnzero); - return 0; - } - bnEnd (&tsum); - } - - bnBegin (&t1); - bnBegin (&gam); - bnBegin (&trsltx); - bnBegin (&trslty); - - /* Check for doubling, different formula for gamma */ - if (bnCmp (p1x, p2x) == 0 && bnCmp (p1y, p2y) == 0) { - bnCopy (&t1, p1y); - bnAddMod_ (&t1, p1y, mod); - bnInv (&t1, &t1, mod); - bnSquareMod_ (&gam, p1x, mod); - bnMulQMod_ (&gam, &gam, 3, mod); - bnSubQMod_ (&gam, 3, mod); - bnMulMod_ (&gam, &gam, &t1, mod); - } else { - bnCopy (&t1, p2x); - bnSubMod_ (&t1, p1x, mod); - bnInv (&t1, &t1, mod); - bnCopy (&gam, p2y); - bnSubMod_ (&gam, p1y, mod); - bnMulMod_ (&gam, &gam, &t1, mod); - } - - bnSquareMod_ (&trsltx, &gam, mod); - bnSubMod_ (&trsltx, p1x, mod); - bnSubMod_ (&trsltx, p2x, mod); - - bnCopy (&trslty, p1x); - bnSubMod_ (&trslty, &trsltx, mod); - bnMulMod_ (&trslty, &trslty, &gam, mod); - bnSubMod_ (&trslty, p1y, mod); - - bnCopy (rsltx, &trsltx); - bnCopy (rslty, &trslty); - - bnEnd (&t1); - bnEnd (&gam); - bnEnd (&trsltx); - bnEnd (&trslty); - bnEnd (&bnzero); - - return 0; -} - -int zrtp_ecMul ( struct BigNum *rsltx, struct BigNum *rslty, struct BigNum *mult, - struct BigNum *basex, struct BigNum *basey, struct BigNum *mod) -{ - struct BigNum bnzero; - struct BigNum tbasex, tbasey; - struct BigNum trsltx, trslty; - struct BigNum tmult; - - bnBegin (&bnzero); - bnBegin (&tbasex); - bnBegin (&tbasey); - bnBegin (&trsltx); - bnBegin (&trslty); - bnBegin (&tmult); - - /* Initialize result to 0 before additions */ - bnSetQ (&trsltx, 0); - bnSetQ (&trslty, 0); - /* Make copies of base and multiplier */ - bnCopy (&tbasex, basex); - bnCopy (&tbasey, basey); - bnCopy (&tmult, mult); - while (bnCmp (&tmult, &bnzero) > 0) { - /* Test lsb of mult */ - unsigned lsw = bnLSWord (&tmult); - if (lsw & 1) { - /* Add base to result */ - zrtp_ecAdd (&trsltx, &trslty, &trsltx, &trslty, &tbasex, &tbasey, mod); - } - /* Double the base */ - zrtp_ecAdd (&tbasex, &tbasey, &tbasex, &tbasey, &tbasex, &tbasey, mod); - /* Shift multiplier right */ - bnRShift (&tmult, 1); - } - - bnCopy (rsltx, &trsltx); - bnCopy (rslty, &trslty); - - bnEnd (&bnzero); - bnEnd (&tbasex); - bnEnd (&tbasey); - bnEnd (&trsltx); - bnEnd (&trslty); - bnEnd (&tmult); - return 0; -} - - - -/*----------------------------------------------------------------------------*/ -/* Choose a random point on the elliptic curve. */ -/* Provision is made to use a given point from test vectors. */ -/* pkx and pky are the output point, sv is output discrete log */ -/* Input base is Gx, Gy; curve field modulus is P; curve order is n. */ -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_ec_random_point( zrtp_global_t *zrtp, - struct BigNum *P, - struct BigNum *n, - struct BigNum *Gx, - struct BigNum *Gy, - struct BigNum *pkx, - struct BigNum *pky, - struct BigNum *sv, - uint8_t *test_sv_data, - size_t test_sv_data_len) -{ - zrtp_status_t s = zrtp_status_fail; - unsigned char* buffer = zrtp_sys_alloc(sizeof(zrtp_uchar1024_t)); - - if (!buffer) { - return zrtp_status_alloc_fail; - } - zrtp_memset(buffer, 0, sizeof(zrtp_uchar1024_t)); - - do - { - if (test_sv_data_len != 0) { - /* Force certain secret value */ - if (bnBytes(P) != test_sv_data_len) { - break; - } - zrtp_memcpy(buffer+UNIFORMBYTES, test_sv_data, test_sv_data_len); - } else { - /* Choose random value, larger than needed so it will be uniform */ - if (bnBytes(P)+UNIFORMBYTES != (uint32_t)zrtp_randstr(zrtp, buffer, bnBytes(P)+UNIFORMBYTES)) { - break; /* if we can't generate random string - fail initialization */ - } - } - - bnInsertBigBytes(sv, (const unsigned char *)buffer, 0, bnBytes(P)+UNIFORMBYTES); - bnMod(sv, sv, n); - zrtp_ecMul(pkx, pky, sv, Gx, Gy, P); - - s = zrtp_status_ok; - } while (0); - - if (buffer) { - zrtp_sys_free(buffer); - } - - return s; -} - - -/*============================================================================*/ -/* Curve parameters */ -/*============================================================================*/ - -uint8_t P_256_data[] = -{ - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF -}; - -uint8_t n_256_data[] = -{ - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84, - 0xF3, 0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51 -}; - -uint8_t b_256_data[] = -{ - 0x5a, 0xc6, 0x35, 0xd8, 0xaa, 0x3a, 0x93, 0xe7, - 0xb3, 0xeb, 0xbd, 0x55, 0x76, 0x98, 0x86, 0xbc, - 0x65, 0x1d, 0x06, 0xb0, 0xcc, 0x53, 0xb0, 0xf6, - 0x3b, 0xce, 0x3c, 0x3e, 0x27, 0xd2, 0x60, 0x4b -}; - -uint8_t Gx_256_data[] = -{ - 0x6b, 0x17, 0xd1, 0xf2, 0xe1, 0x2c, 0x42, 0x47, - 0xf8, 0xbc, 0xe6, 0xe5, 0x63, 0xa4, 0x40, 0xf2, - 0x77, 0x03, 0x7d, 0x81, 0x2d, 0xeb, 0x33, 0xa0, - 0xf4, 0xa1, 0x39, 0x45, 0xd8, 0x98, 0xc2, 0x96 -}; - -uint8_t Gy_256_data[] = -{ - 0x4f, 0xe3, 0x42, 0xe2, 0xfe, 0x1a, 0x7f, 0x9b, - 0x8e, 0xe7, 0xeb, 0x4a, 0x7c, 0x0f, 0x9e, 0x16, - 0x2b, 0xce, 0x33, 0x57, 0x6b, 0x31, 0x5e, 0xce, - 0xcb, 0xb6, 0x40, 0x68, 0x37, 0xbf, 0x51, 0xf5 -}; - - - -uint8_t P_384_data[] = -{ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, - 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF -}; - -uint8_t n_384_data[] = -{ - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xC7, 0x63, 0x4D, 0x81, 0xF4, 0x37, 0x2D, 0xDF, - 0x58, 0x1A, 0x0D, 0xB2, 0x48, 0xB0, 0xA7, 0x7A, - 0xEC, 0xEC, 0x19, 0x6A, 0xCC, 0xC5, 0x29, 0x73 -}; - -uint8_t b_384_data[] = -{ - 0xb3, 0x31, 0x2f, 0xa7, 0xe2, 0x3e, 0xe7, 0xe4, - 0x98, 0x8e, 0x05, 0x6b, 0xe3, 0xf8, 0x2d, 0x19, - 0x18, 0x1d, 0x9c, 0x6e, 0xfe, 0x81, 0x41, 0x12, - 0x03, 0x14, 0x08, 0x8f, 0x50, 0x13, 0x87, 0x5a, - 0xc6, 0x56, 0x39, 0x8d, 0x8a, 0x2e, 0xd1, 0x9d, - 0x2a, 0x85, 0xc8, 0xed, 0xd3, 0xec, 0x2a, 0xef -}; - -uint8_t Gx_384_data[] = -{ - 0xaa, 0x87, 0xca, 0x22, 0xbe, 0x8b, 0x05, 0x37, - 0x8e, 0xb1, 0xc7, 0x1e, 0xf3, 0x20, 0xad, 0x74, - 0x6e, 0x1d, 0x3b, 0x62, 0x8b, 0xa7, 0x9b, 0x98, - 0x59, 0xf7, 0x41, 0xe0, 0x82, 0x54, 0x2a, 0x38, - 0x55, 0x02, 0xf2, 0x5d, 0xbf, 0x55, 0x29, 0x6c, - 0x3a, 0x54, 0x5e, 0x38, 0x72, 0x76, 0x0a, 0xb7 -}; - -uint8_t Gy_384_data[] = -{ - 0x36, 0x17, 0xde, 0x4a, 0x96, 0x26, 0x2c, 0x6f, - 0x5d, 0x9e, 0x98, 0xbf, 0x92, 0x92, 0xdc, 0x29, - 0xf8, 0xf4, 0x1d, 0xbd, 0x28, 0x9a, 0x14, 0x7c, - 0xe9, 0xda, 0x31, 0x13, 0xb5, 0xf0, 0xb8, 0xc0, - 0x0a, 0x60, 0xb1, 0xce, 0x1d, 0x7e, 0x81, 0x9d, - 0x7a, 0x43, 0x1d, 0x7c, 0x90, 0xea, 0x0e, 0x5f -}; - - -uint8_t P_521_data[] = -{ - 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF -}; - -uint8_t n_521_data[] = -{ - 0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, - 0xFF, 0xFA, 0x51, 0x86, 0x87, 0x83, 0xBF, 0x2F, - 0x96, 0x6B, 0x7F, 0xCC, 0x01, 0x48, 0xF7, 0x09, - 0xA5, 0xD0, 0x3B, 0xB5, 0xC9, 0xB8, 0x89, 0x9C, - 0x47, 0xAE, 0xBB, 0x6F, 0xB7, 0x1E, 0x91, 0x38, - 0x64, 0x09 -}; - -uint8_t b_521_data[] = -{ - 0x00, 0x51, 0x95, 0x3e, 0xb9, 0x61, 0x8e, 0x1c, - 0x9a, 0x1f, 0x92, 0x9a, 0x21, 0xa0, 0xb6, 0x85, - 0x40, 0xee, 0xa2, 0xda, 0x72, 0x5b, 0x99, 0xb3, - 0x15, 0xf3, 0xb8, 0xb4, 0x89, 0x91, 0x8e, 0xf1, - 0x09, 0xe1, 0x56, 0x19, 0x39, 0x51, 0xec, 0x7e, - 0x93, 0x7b, 0x16, 0x52, 0xc0, 0xbd, 0x3b, 0xb1, - 0xbf, 0x07, 0x35, 0x73, 0xdf, 0x88, 0x3d, 0x2c, - 0x34, 0xf1, 0xef, 0x45, 0x1f, 0xd4, 0x6b, 0x50, - 0x3f, 0x00 -}; - -uint8_t Gx_521_data[] = -{ - 0x00, 0xc6, 0x85, 0x8e, 0x06, 0xb7, 0x04, 0x04, - 0xe9, 0xcd, 0x9e, 0x3e, 0xcb, 0x66, 0x23, 0x95, - 0xb4, 0x42, 0x9c, 0x64, 0x81, 0x39, 0x05, 0x3f, - 0xb5, 0x21, 0xf8, 0x28, 0xaf, 0x60, 0x6b, 0x4d, - 0x3d, 0xba, 0xa1, 0x4b, 0x5e, 0x77, 0xef, 0xe7, - 0x59, 0x28, 0xfe, 0x1d, 0xc1, 0x27, 0xa2, 0xff, - 0xa8, 0xde, 0x33, 0x48, 0xb3, 0xc1, 0x85, 0x6a, - 0x42, 0x9b, 0xf9, 0x7e, 0x7e, 0x31, 0xc2, 0xe5, - 0xbd, 0x66 -}; - -uint8_t Gy_521_data[] = -{ - 0x01, 0x18, 0x39, 0x29, 0x6a, 0x78, 0x9a, 0x3b, - 0xc0, 0x04, 0x5c, 0x8a, 0x5f, 0xb4, 0x2c, 0x7d, - 0x1b, 0xd9, 0x98, 0xf5, 0x44, 0x49, 0x57, 0x9b, - 0x44, 0x68, 0x17, 0xaf, 0xbd, 0x17, 0x27, 0x3e, - 0x66, 0x2c, 0x97, 0xee, 0x72, 0x99, 0x5e, 0xf4, - 0x26, 0x40, 0xc5, 0x50, 0xb9, 0x01, 0x3f, 0xad, - 0x07, 0x61, 0x35, 0x3c, 0x70, 0x86, 0xa2, 0x72, - 0xc2, 0x40, 0x88, 0xbe, 0x94, 0x76, 0x9f, 0xd1, - 0x66, 0x50 -}; - -/*----------------------------------------------------------------------------*/ -/* Initialize the curve parameters struct */ -zrtp_status_t zrtp_ec_init_params( struct zrtp_ec_params *params, uint32_t bits ) -{ - unsigned ec_bytes = (bits+7) / 8; - params->ec_bits = bits; - switch (bits) { - case 256: - zrtp_memcpy (params->P_data, P_256_data, ec_bytes); - zrtp_memcpy (params->n_data, n_256_data, ec_bytes); - zrtp_memcpy (params->b_data, b_256_data, ec_bytes); - zrtp_memcpy (params->Gx_data, Gx_256_data, ec_bytes); - zrtp_memcpy (params->Gy_data, Gy_256_data, ec_bytes); - break; - case 384: - zrtp_memcpy (params->P_data, P_384_data, ec_bytes); - zrtp_memcpy (params->n_data, n_384_data, ec_bytes); - zrtp_memcpy (params->b_data, b_384_data, ec_bytes); - zrtp_memcpy (params->Gx_data, Gx_384_data, ec_bytes); - zrtp_memcpy (params->Gy_data, Gy_384_data, ec_bytes); - break; - case 521: - zrtp_memcpy (params->P_data, P_521_data, ec_bytes); - zrtp_memcpy (params->n_data, n_521_data, ec_bytes); - zrtp_memcpy (params->b_data, b_521_data, ec_bytes); - zrtp_memcpy (params->Gx_data, Gx_521_data, ec_bytes); - zrtp_memcpy (params->Gy_data, Gy_521_data, ec_bytes); - break; - default: - return zrtp_status_bad_param; - } - - return zrtp_status_ok; -} diff --git a/libs/libzrtp/src/zrtp_crypto_ecdh.c b/libs/libzrtp/src/zrtp_crypto_ecdh.c deleted file mode 100644 index 7a47e6c474..0000000000 --- a/libs/libzrtp/src/zrtp_crypto_ecdh.c +++ /dev/null @@ -1,559 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - */ - -#include "zrtp.h" - - -#define _ZTU_ "zrtp ecdh" - -static unsigned get_pbits(zrtp_pk_scheme_t *self) -{ - switch (self->base.id) { - case ZRTP_PKTYPE_EC256P: - return 256; - break; - case ZRTP_PKTYPE_EC384P: - return 384; - break; - case ZRTP_PKTYPE_EC521P: - return 521; - break; - default: - return 0; - } -} - -/*============================================================================*/ -/* Shared Elliptic Curve functions */ -/* */ -/* The Elliptic Curve DH algorithm and key generation is from */ -/* NIST SP 800-56A. The curves used are from NSA Suite B, which */ -/* uses the same curves as ECDSA defined by FIPS 186-3, and are */ -/* also defined in RFC 4753, sections 3.1 through 3.3. */ -/* The validation procedures are from NIST SP 800-56A section 5.6.2.6, */ -/* method 3, ECC Partial Validation. */ -/*============================================================================*/ - - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_ecdh_init(void *s) { - return zrtp_status_ok; -} - -static zrtp_status_t zrtp_ecdh_free(void *s) { - return zrtp_status_ok; -} - - -/*----------------------------------------------------------------------------*/ -/* Return dh_cc->pv holding public value and dh_cc->sv holding secret value */ -/* The public value is an elliptic curve point encoded as the x part shifted */ -/* left Pbits bits and or'd with the y part. */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_ecdh_initialize( zrtp_pk_scheme_t *self, - zrtp_dh_crypto_context_t *dh_cc) -{ - zrtp_status_t s = zrtp_status_fail; - struct BigNum P, Gx, Gy, n; - struct BigNum pkx, pky; - unsigned ec_bytes = 0; - unsigned pbits = 0; - struct zrtp_ec_params ec_params; - zrtp_time_t start_ts = zrtp_time_now(); - - if (!self || !dh_cc) { - return zrtp_status_bad_param; - } - - pbits = get_pbits(self); - if (!pbits) { - return zrtp_status_bad_param; - } - - zrtp_ec_init_params(&ec_params, pbits); - - ec_bytes = (ec_params.ec_bits+7) / 8; - - bnBegin(&P); - bnInsertBigBytes(&P, ec_params.P_data, 0, ec_bytes ); - bnBegin(&Gx); - bnInsertBigBytes(&Gx, ec_params.Gx_data, 0, ec_bytes ); - bnBegin(&Gy); - bnInsertBigBytes(&Gy, ec_params.Gy_data, 0, ec_bytes ); - bnBegin(&n); - bnInsertBigBytes(&n, ec_params.n_data, 0, ec_bytes ); - - bnBegin(&pkx); - bnBegin(&pky); - bnBegin(&dh_cc->sv); - s = zrtp_ec_random_point( self->base.zrtp, &P, &n, &Gx, &Gy, - &pkx, &pky, &dh_cc->sv, - NULL, 0); - - if (zrtp_status_ok == s) - { - bnBegin(&dh_cc->pv); - bnCopy (&dh_cc->pv, &pkx); - bnLShift (&dh_cc->pv, pbits); - bnAdd (&dh_cc->pv, &pky); - } - - bnEnd (&pkx); - bnEnd (&pky); - bnEnd (&P); - bnEnd (&Gx); - bnEnd (&Gy); - bnEnd (&n); - - ZRTP_LOG(1,(_ZTU_,"\tDH TEST: zrtp_ecdh_initialize() for %.4s was executed by %llums.\n", self->base.type, zrtp_time_now()-start_ts)); - return s; -} - - -/*----------------------------------------------------------------------------*/ -/* Compute the shared dhresult as the X coordinate of the EC point. */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_ecdh_compute( zrtp_pk_scheme_t *self, - zrtp_dh_crypto_context_t *dh_cc, - struct BigNum *dhresult, - struct BigNum *pv) -{ - struct BigNum P; - struct BigNum pkx, pky, rsltx, rslty; - unsigned ec_bytes = 0; - unsigned pbits = 0; - struct zrtp_ec_params ec_params; - zrtp_time_t start_ts = zrtp_time_now(); - - if (!self || !dh_cc || !dhresult || !pv) { - return zrtp_status_bad_param; - } - - pbits = get_pbits(self); - if (!pbits) { - return zrtp_status_bad_param; - } - - zrtp_ec_init_params(&ec_params, pbits); - - ec_bytes = (ec_params.ec_bits+7) / 8; - - bnBegin(&P); - bnInsertBigBytes( &P, ec_params.P_data, 0, ec_bytes ); - - bnBegin (&pkx); - bnBegin (&pky); - bnBegin (&rsltx); - bnBegin (&rslty); - - bnSetQ (&pkx, 1); - bnLShift (&pkx, pbits); - bnMod (&pky, pv, &pkx); - bnCopy (&pkx, pv); - bnRShift (&pkx, pbits); - - zrtp_ecMul (&rsltx, &rslty, &dh_cc->sv, &pkx, &pky, &P); - bnCopy (dhresult, &rsltx); - - bnEnd (&pkx); - bnEnd (&pky); - bnEnd (&rsltx); - bnEnd (&rslty); - bnEnd (&P); - - ZRTP_LOG(1,(_ZTU_,"\tDH TEST: zrtp_ecdh_compute() for %.4s was executed by %llums.\n", self->base.type, zrtp_time_now()-start_ts)); - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -/* ECC Partial Validation per NIST SP800-56A section 5.6.2.6 */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_ecdh_validate( zrtp_pk_scheme_t *self, - struct BigNum *pv) -{ - zrtp_status_t s = zrtp_status_fail; - struct BigNum P, b; - struct BigNum t1, t2; - struct BigNum pkx, pky, bnzero; - unsigned ec_bytes = 0; - unsigned pbits = 0; - struct zrtp_ec_params ec_params; - zrtp_time_t start_ts = zrtp_time_now(); - - if (!self || !pv) { - return zrtp_status_bad_param; - } - - pbits = get_pbits(self); - if (!pbits) { - return zrtp_status_bad_param; - } - - zrtp_ec_init_params(&ec_params, pbits); - - ec_bytes = (ec_params.ec_bits+7) / 8; - - bnBegin(&P); - bnInsertBigBytes( &P, ec_params.P_data, 0, ec_bytes ); - bnBegin(&b); - bnInsertBigBytes( &b, ec_params.b_data, 0, ec_bytes ); - - bnBegin (&t1); - bnBegin (&t2); - bnBegin (&pkx); - bnBegin (&pky); - bnBegin (&bnzero); - - bnSetQ (&pkx, 1); - bnLShift (&pkx, pbits); - bnMod (&pky, pv, &pkx); - bnCopy (&pkx, pv); - bnRShift (&pkx, pbits); - - do{ - /* Represent point at infinity by (0, 0), make sure it's not that */ - if (bnCmp (&pkx, &bnzero) == 0 && bnCmp (&pky, &bnzero) == 0) { - break; - } - /* Check coordinates within range */ - if (bnCmp (&pkx, &bnzero) < 0 || bnCmp (&pkx, &P) >= 0) { - break; - } - if (bnCmp (&pky, &bnzero) < 0 || bnCmp (&pky, &P) >= 0) { - break; - } - - /* Check that point satisfies EC equation y^2 = x^3 - 3x + b, mod P */ - bnSquareMod_ (&t1, &pky, &P); - bnSquareMod_ (&t2, &pkx, &P); - bnSubQMod_ (&t2, 3, &P); - bnMulMod_ (&t2, &t2, &pkx, &P); - bnAddMod_ (&t2, &b, &P); - if (bnCmp (&t1, &t2) != 0) { - break; - } - - s = zrtp_status_ok; - } while (0); - - bnEnd (&t1); - bnEnd (&t2); - bnEnd (&pkx); - bnEnd (&pky); - bnEnd (&bnzero); - bnEnd (&P); - bnEnd (&b); - - ZRTP_LOG(1,(_ZTU_,"\tDH TEST: zrtp_ecdh_validate() for %.4s was executed by %llums.\n", self->base.type, zrtp_time_now()-start_ts)); - return s; -} - - -/*============================================================================*/ -/* P-256, 384, 521 (FIPS 186-3) support. See RFC 4753 3.1, 3.2, 3.3 */ -/*============================================================================*/ - -static uint8_t sv256_data[] = { - 0x81, 0x42, 0x64, 0x14, 0x5F, 0x2F, 0x56, 0xF2, - 0xE9, 0x6A, 0x8E, 0x33, 0x7A, 0x12, 0x84, 0x99, - 0x3F, 0xAF, 0x43, 0x2A, 0x5A, 0xBC, 0xE5, 0x9E, - 0x86, 0x7B, 0x72, 0x91, 0xD5, 0x07, 0xA3, 0xAF -}; -static uint8_t pvx256_data[] = { - 0x2A, 0xF5, 0x02, 0xF3, 0xBE, 0x89, 0x52, 0xF2, - 0xC9, 0xB5, 0xA8, 0xD4, 0x16, 0x0D, 0x09, 0xE9, - 0x71, 0x65, 0xBE, 0x50, 0xBC, 0x42, 0xAE, 0x4A, - 0x5E, 0x8D, 0x3B, 0x4B, 0xA8, 0x3A, 0xEB, 0x15 -}; -static uint8_t pvy256_data[] = { - 0xEB, 0x0F, 0xAF, 0x4C, 0xA9, 0x86, 0xC4, 0xD3, - 0x86, 0x81, 0xA0, 0xF9, 0x87, 0x2D, 0x79, 0xD5, - 0x67, 0x95, 0xBD, 0x4B, 0xFF, 0x6E, 0x6D, 0xE3, - 0xC0, 0xF5, 0x01, 0x5E, 0xCE, 0x5E, 0xFD, 0x85 -}; - -static uint8_t sv384_data[] = { - 0xD2, 0x73, 0x35, 0xEA, 0x71, 0x66, 0x4A, 0xF2, - 0x44, 0xDD, 0x14, 0xE9, 0xFD, 0x12, 0x60, 0x71, - 0x5D, 0xFD, 0x8A, 0x79, 0x65, 0x57, 0x1C, 0x48, - 0xD7, 0x09, 0xEE, 0x7A, 0x79, 0x62, 0xA1, 0x56, - 0xD7, 0x06, 0xA9, 0x0C, 0xBC, 0xB5, 0xDF, 0x29, - 0x86, 0xF0, 0x5F, 0xEA, 0xDB, 0x93, 0x76, 0xF1 -}; -static uint8_t pvx384_data[] = { - 0x79, 0x31, 0x48, 0xF1, 0x78, 0x76, 0x34, 0xD5, - 0xDA, 0x4C, 0x6D, 0x90, 0x74, 0x41, 0x7D, 0x05, - 0xE0, 0x57, 0xAB, 0x62, 0xF8, 0x20, 0x54, 0xD1, - 0x0E, 0xE6, 0xB0, 0x40, 0x3D, 0x62, 0x79, 0x54, - 0x7E, 0x6A, 0x8E, 0xA9, 0xD1, 0xFD, 0x77, 0x42, - 0x7D, 0x01, 0x6F, 0xE2, 0x7A, 0x8B, 0x8C, 0x66 -}; -static uint8_t pvy384_data[] = { - 0xC6, 0xC4, 0x12, 0x94, 0x33, 0x1D, 0x23, 0xE6, - 0xF4, 0x80, 0xF4, 0xFB, 0x4C, 0xD4, 0x05, 0x04, - 0xC9, 0x47, 0x39, 0x2E, 0x94, 0xF4, 0xC3, 0xF0, - 0x6B, 0x8F, 0x39, 0x8B, 0xB2, 0x9E, 0x42, 0x36, - 0x8F, 0x7A, 0x68, 0x59, 0x23, 0xDE, 0x3B, 0x67, - 0xBA, 0xCE, 0xD2, 0x14, 0xA1, 0xA1, 0xD1, 0x28 -}; - -static uint8_t sv521_data[] = { - 0x01, 0x13, 0xF8, 0x2D, 0xA8, 0x25, 0x73, 0x5E, - 0x3D, 0x97, 0x27, 0x66, 0x83, 0xB2, 0xB7, 0x42, - 0x77, 0xBA, 0xD2, 0x73, 0x35, 0xEA, 0x71, 0x66, - 0x4A, 0xF2, 0x43, 0x0C, 0xC4, 0xF3, 0x34, 0x59, - 0xB9, 0x66, 0x9E, 0xE7, 0x8B, 0x3F, 0xFB, 0x9B, - 0x86, 0x83, 0x01, 0x5D, 0x34, 0x4D, 0xCB, 0xFE, - 0xF6, 0xFB, 0x9A, 0xF4, 0xC6, 0xC4, 0x70, 0xBE, - 0x25, 0x45, 0x16, 0xCD, 0x3C, 0x1A, 0x1F, 0xB4, - 0x73, 0x62 -}; -static uint8_t pvx521_data[] = { - 0x01, 0xEB, 0xB3, 0x4D, 0xD7, 0x57, 0x21, 0xAB, - 0xF8, 0xAD, 0xC9, 0xDB, 0xED, 0x17, 0x88, 0x9C, - 0xBB, 0x97, 0x65, 0xD9, 0x0A, 0x7C, 0x60, 0xF2, - 0xCE, 0xF0, 0x07, 0xBB, 0x0F, 0x2B, 0x26, 0xE1, - 0x48, 0x81, 0xFD, 0x44, 0x42, 0xE6, 0x89, 0xD6, - 0x1C, 0xB2, 0xDD, 0x04, 0x6E, 0xE3, 0x0E, 0x3F, - 0xFD, 0x20, 0xF9, 0xA4, 0x5B, 0xBD, 0xF6, 0x41, - 0x3D, 0x58, 0x3A, 0x2D, 0xBF, 0x59, 0x92, 0x4F, - 0xD3, 0x5C -}; -static uint8_t pvy521_data[] = { - 0x00, 0xF6, 0xB6, 0x32, 0xD1, 0x94, 0xC0, 0x38, - 0x8E, 0x22, 0xD8, 0x43, 0x7E, 0x55, 0x8C, 0x55, - 0x2A, 0xE1, 0x95, 0xAD, 0xFD, 0x15, 0x3F, 0x92, - 0xD7, 0x49, 0x08, 0x35, 0x1B, 0x2F, 0x8C, 0x4E, - 0xDA, 0x94, 0xED, 0xB0, 0x91, 0x6D, 0x1B, 0x53, - 0xC0, 0x20, 0xB5, 0xEE, 0xCA, 0xED, 0x1A, 0x5F, - 0xC3, 0x8A, 0x23, 0x3E, 0x48, 0x30, 0x58, 0x7B, - 0xB2, 0xEE, 0x34, 0x89, 0xB3, 0xB4, 0x2A, 0x5A, - 0x86, 0xA4 -}; - -zrtp_status_t zrtp_ecdh_selftest(zrtp_pk_scheme_t *self) -{ - zrtp_status_t s = zrtp_status_fail; - struct BigNum P, Gx, Gy, n, sv; - struct BigNum pkx, pky; - unsigned ec_bytes = 0; - unsigned pbits = 0; - struct zrtp_ec_params ec_params; - - zrtp_time_t start_ts = 0; - - uint8_t *sv_data = NULL; - size_t sv_data_len = 0; - uint8_t *pvx_data = NULL; - size_t pvx_data_len = 0; - uint8_t *pvy_data = NULL; - size_t pvy_data_len = 0; - - if (!self) { - return zrtp_status_bad_param; - } - - ZRTP_LOG(3, (_ZTU_, "PKS %.4s testing... ", self->base.type)); - - switch (self->base.id) { - case ZRTP_PKTYPE_EC256P: - sv_data = sv256_data; - sv_data_len = sizeof(sv256_data); - pvx_data = pvx256_data; - pvx_data_len = sizeof(pvx256_data); - pvy_data = pvy256_data; - pvy_data_len = sizeof(pvy256_data); - break; - case ZRTP_PKTYPE_EC384P: - sv_data = sv384_data; - sv_data_len = sizeof(sv384_data); - pvx_data = pvx384_data; - pvx_data_len = sizeof(pvx384_data); - pvy_data = pvy384_data; - pvy_data_len = sizeof(pvy384_data); - break; - case ZRTP_PKTYPE_EC521P: - sv_data = sv521_data; - sv_data_len = sizeof(sv521_data); - pvx_data = pvx521_data; - pvx_data_len = sizeof(pvx521_data); - pvy_data = pvy521_data; - pvy_data_len = sizeof(pvy521_data); - break; - default: - return 0; - } - - pbits = get_pbits(self); - if (!pbits) { - return zrtp_status_bad_param; - } - - zrtp_ec_init_params(&ec_params, pbits); - - ec_bytes = (ec_params.ec_bits+7) / 8; - - bnBegin(&P); - bnInsertBigBytes(&P, ec_params.P_data, 0, ec_bytes ); - bnBegin(&Gx); - bnInsertBigBytes(&Gx, ec_params.Gx_data, 0, ec_bytes ); - bnBegin(&Gy); - bnInsertBigBytes(&Gy, ec_params.Gy_data, 0, ec_bytes ); - bnBegin(&n); - bnInsertBigBytes(&n, ec_params.n_data, 0, ec_bytes ); - - bnBegin(&pkx); - bnBegin(&pky); - bnBegin(&sv); - s = zrtp_ec_random_point( self->base.zrtp, &P, &n, &Gx, &Gy, - &pkx, &pky, &sv, - sv_data, sv_data_len); - if (zrtp_status_ok == s) - { - struct BigNum pkx1, pky1; - - bnBegin(&pkx1); bnBegin(&pky1); - bnInsertBigBytes(&pkx1, pvx_data, 0, pvx_data_len); - bnInsertBigBytes(&pky1, pvy_data, 0, pvy_data_len); - s = (bnCmp (&pkx1, &pkx) == 0 && bnCmp (&pky1, &pky) == 0) ? zrtp_status_ok : zrtp_status_fail; - bnEnd(&pkx1); - bnEnd(&pky1); - } - - bnEnd (&pkx); - bnEnd (&pky); - bnEnd (&P); - bnEnd (&Gx); - bnEnd (&Gy); - bnEnd (&n); - bnEnd (&sv); - - if (zrtp_status_ok == s) { - zrtp_status_t s = zrtp_status_ok; - zrtp_dh_crypto_context_t alice_cc; - zrtp_dh_crypto_context_t bob_cc; - struct BigNum alice_k; - struct BigNum bob_k; - - start_ts = zrtp_time_now(); - - bnBegin(&alice_k); - bnBegin(&bob_k); - - do { - /* Both sides initalise DH schemes and compute secret and public values. */ - s = self->initialize(self, &alice_cc); - if (zrtp_status_ok != s) { - break; - } - s = self->initialize(self, &bob_cc); - if (zrtp_status_ok != s) { - break; - } - - /* Both sides validate public values. (to provide exact performance estimation) */ - s = self->validate(self, &bob_cc.pv); - if (zrtp_status_ok != s) { - break; - } - s = self->validate(self, &alice_cc.pv); - if (zrtp_status_ok != s) { - break; - } - - /* Compute secret keys and compare them. */ - s = self->compute(self, &alice_cc, &alice_k, &bob_cc.pv); - if (zrtp_status_ok != s) { - break; - } - s= self->compute(self, &bob_cc, &bob_k, &alice_cc.pv); - if (zrtp_status_ok != s) { - break; - } - - s = (0 == bnCmp(&alice_k, &bob_k)) ? zrtp_status_ok : zrtp_status_algo_fail; - } while (0); - - bnEnd(&alice_k); - bnEnd(&bob_k); - } - ZRTP_LOGC(3, ("%s (%llu ms)\n", zrtp_log_status2str(s), (zrtp_time_now()-start_ts)/2)); - - return s; -} - - -/*============================================================================*/ -/* Public Key support */ -/*============================================================================*/ - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_defaults_ec_pkt(zrtp_global_t* zrtp) -{ - zrtp_pk_scheme_t* ec256p = zrtp_sys_alloc(sizeof(zrtp_pk_scheme_t)); - zrtp_pk_scheme_t* ec384p = zrtp_sys_alloc(sizeof(zrtp_pk_scheme_t)); - zrtp_pk_scheme_t* ec521p = zrtp_sys_alloc(sizeof(zrtp_pk_scheme_t)); - - if (!ec256p || !ec384p || !ec521p) { - if(ec256p) { - zrtp_sys_free(ec256p); - } - if(ec384p) { - zrtp_sys_free(ec384p); - } - if(ec521p) { - zrtp_sys_free(ec521p); - } - return zrtp_status_alloc_fail; - } - - zrtp_memset(ec256p, 0, sizeof(zrtp_pk_scheme_t)); - zrtp_memcpy(ec256p->base.type, ZRTP_EC256P, ZRTP_COMP_TYPE_SIZE); - ec256p->base.id = ZRTP_PKTYPE_EC256P; - ec256p->base.zrtp = zrtp; - ec256p->sv_length = 256/8; - ec256p->pv_length = 2*256/8; - ec256p->base.init = zrtp_ecdh_init; - ec256p->base.free = zrtp_ecdh_free; - ec256p->initialize = zrtp_ecdh_initialize; - ec256p->compute = zrtp_ecdh_compute; - ec256p->validate = zrtp_ecdh_validate; - ec256p->self_test = zrtp_ecdh_selftest; - - zrtp_memset(ec384p, 0, sizeof(zrtp_pk_scheme_t)); - zrtp_memcpy(ec384p->base.type, ZRTP_EC384P, ZRTP_COMP_TYPE_SIZE); - ec384p->base.id = ZRTP_PKTYPE_EC384P; - ec384p->base.zrtp = zrtp; - ec384p->sv_length = 384/8; - ec384p->pv_length = 2*384/8; - ec384p->base.init = zrtp_ecdh_init; - ec384p->base.free = zrtp_ecdh_free; - ec384p->initialize = zrtp_ecdh_initialize; - ec384p->compute = zrtp_ecdh_compute; - ec384p->validate = zrtp_ecdh_validate; - ec384p->self_test = zrtp_ecdh_selftest; - - - zrtp_memset(ec521p, 0, sizeof(zrtp_pk_scheme_t)); - zrtp_memcpy(ec521p->base.type, ZRTP_EC521P, ZRTP_COMP_TYPE_SIZE); - ec521p->base.id = ZRTP_PKTYPE_EC521P; - ec521p->base.zrtp = zrtp; - ec521p->sv_length = 528/8; - ec521p->pv_length = 2*528/8; - ec521p->base.init = zrtp_ecdh_init; - ec521p->base.free = zrtp_ecdh_free; - ec521p->initialize = zrtp_ecdh_initialize; - ec521p->compute = zrtp_ecdh_compute; - ec521p->validate = zrtp_ecdh_validate; - ec521p->self_test = zrtp_ecdh_selftest; - - zrtp_comp_register(ZRTP_CC_PKT, ec256p, zrtp); - zrtp_comp_register(ZRTP_CC_PKT, ec384p, zrtp); - zrtp_comp_register(ZRTP_CC_PKT, ec521p, zrtp); - - return zrtp_status_ok; -} diff --git a/libs/libzrtp/src/zrtp_crypto_ecdsa.c b/libs/libzrtp/src/zrtp_crypto_ecdsa.c deleted file mode 100644 index fc86f12d2a..0000000000 --- a/libs/libzrtp/src/zrtp_crypto_ecdsa.c +++ /dev/null @@ -1,642 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - */ - -#include "zrtp.h" - -/* We don't have digital signatures ready yet. */ -#if 0 - -/* Size of extra random data to approximate a uniform distribution mod n */ -#define UNIFORMBYTES 8 - -/*============================================================================*/ -/* Shared Elliptic Curve functions */ -/* */ -/* The Elliptic Curve DSA algorithm, key generation, and curves are */ -/* from FIPS 186-3. The curves used are */ -/* also defined in RFC 4753, sections 3.1 through 3.3. */ -/*============================================================================*/ - -/*----------------------------------------------------------------------------*/ -/* Return dsa_cc->pv holding public value and dsa_cc->sv holding secret value */ -/* The public value is an elliptic curve point encoded as the x part shifted */ -/* left Pbits bits and or'd with the y part. */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t ECDSA_keygen( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - zrtp_ec_params_t *ec_params, -#ifdef ZRTP_TEST_VECTORS - uint8_t *sv_data, size_t sv_data_len, - uint8_t *pvx_data, size_t pvx_data_len, - uint8_t *pvy_data, size_t pvy_data_len, -#endif - unsigned Pbits ) -{ - zrtp_status_t s = zrtp_status_fail; - struct BigNum P, Gx, Gy, n; - struct BigNum pkx, pky; - unsigned ec_bytes; - - if (!ec_params) - return zrtp_status_bad_param; - - ec_bytes = (ec_params->ec_bits+7) / 8; - - do - { - if (!self || !dsa_cc) - { - s = zrtp_status_bad_param; - break; - } - - bnBegin(&P); - bnInsertBigBytes( &P, ec_params->P_data, 0, ec_bytes ); - bnBegin(&Gx); - bnInsertBigBytes( &Gx, ec_params->Gx_data, 0, ec_bytes ); - bnBegin(&Gy); - bnInsertBigBytes( &Gy, ec_params->Gy_data, 0, ec_bytes ); - bnBegin(&n); - bnInsertBigBytes( &n, ec_params->n_data, 0, ec_bytes ); - - bnBegin(&pkx); - bnBegin(&pky); - bnBegin(&dsa_cc->sv); - s = zrtp_ec_random_point( self->base.zrtp_global, &P, &n, &Gx, &Gy, -#ifdef ZRTP_TEST_VECTORS - sv_data, sv_data_len, - pvx_data, pvx_data_len, - pvy_data, pvy_data_len, -#endif - &pkx, &pky, &dsa_cc->sv ); - if ( s != zrtp_status_ok ) - break; - s = zrtp_status_fail; - - bnBegin(&dsa_cc->pv); - bnCopy (&dsa_cc->pv, &pkx); - bnLShift (&dsa_cc->pv, Pbits); - bnAdd (&dsa_cc->pv, &pky); - bnEnd (&pkx); - bnEnd (&pky); - bnEnd (&P); - bnEnd (&Gx); - bnEnd (&Gy); - bnEnd (&n); - - s = zrtp_status_ok; - } while (0); - - return s; -} - - -/*----------------------------------------------------------------------------*/ -/* Sign the specified hash value - must be size matching the curve */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t ECDSA_sign( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - zrtp_ec_params_t *ec_params, -#ifdef ZRTP_TEST_VECTORS - uint8_t *k_data, size_t k_data_len, - uint8_t *rx_data, size_t rx_data_len, - uint8_t *ry_data, size_t ry_data_len, - uint8_t *s_data, size_t s_data_len, -#endif - uint8_t *hash, uint32_t hash_len, - struct BigNum *dsasig ) -{ - zrtp_status_t s = zrtp_status_fail; - struct BigNum P, Gx, Gy, n; - struct BigNum h, s1, k, rx, ry, kinv, pkx, pky; - unsigned ec_bytes; - - if (!ec_params) - return zrtp_status_bad_param; - - ec_bytes = (ec_params->ec_bits+7) / 8; - - do - { - if (!self || !dsa_cc) - { - s = zrtp_status_bad_param; - break; - } - - bnBegin(&P); - bnInsertBigBytes( &P, ec_params->P_data, 0, ec_bytes ); - bnBegin(&Gx); - bnInsertBigBytes( &Gx, ec_params->Gx_data, 0, ec_bytes ); - bnBegin(&Gy); - bnInsertBigBytes( &Gy, ec_params->Gy_data, 0, ec_bytes ); - bnBegin(&n); - bnInsertBigBytes( &n, ec_params->n_data, 0, ec_bytes ); - - /* Hash to bignum */ - bnBegin(&h); - bnInsertBigBytes( &h, hash, 0, hash_len ); - bnMod (&h, &h, &P); - - /* Unpack signing key */ - bnBegin(&pkx); - bnBegin(&pky); - bnSetQ (&pkx, 1); - bnLShift (&pkx, ec_bytes*8); - bnMod (&pky, &dsa_cc->pv, &pkx); - bnCopy (&pkx, &dsa_cc->pv); - bnRShift (&pkx, ec_bytes*8); - - /* Choose signature secret k value */ - bnBegin(&rx); - bnBegin(&ry); - bnBegin(&k); - s = zrtp_ec_random_point( self->base.zrtp_global, &P, &n, &Gx, &Gy, -#ifdef ZRTP_TEST_VECTORS - k_data, k_data_len, - rx_data, rx_data_len, - ry_data, ry_data_len, -#endif - &rx, &ry, &k ); - if ( s != zrtp_status_ok ) - break; - s = zrtp_status_fail; - -#ifndef ZRTP_TEST_VECTORS - /* For further randomness we are going to add the secret key to k */ - bnAddMod_ (&k, &dsa_cc->sv, &n); - zrtp_ecAdd (&rx, &ry, &rx, &ry, &pkx, &pky, &P); -#endif - - /* Perform the signature */ - bnBegin (&s1); - bnMulMod_ (&s1, &rx, &dsa_cc->sv, &n); - bnAddMod_ (&s1, &h, &n); - bnBegin (&kinv); - bnInv (&kinv, &k, &n); - bnMulMod_ (&s1, &s1, &kinv, &n); - -#ifdef ZRTP_TEST_VECTORS - if (k_data_len != 0) - { - /* rx is checked in ec_random_point */ - struct BigNum s2; - int ok; - bnBegin(&s2); - bnInsertBigBytes(&s2, s_data, 0, s_data_len); - ok = (bnCmp (&s1, &s2) == 0); - bnEnd(&s2); - if (!ok) - break; - } -#endif - - /* Combine r, s into dsasig */ - bnBegin(dsasig); - bnCopy (dsasig, &rx); - bnLShift (dsasig, ec_bytes*8); - bnAdd (dsasig, &s1); - bnEnd (&rx); - bnEnd (&ry); - bnEnd (&k); - bnEnd (&kinv); - bnEnd (&s1); - bnEnd (&h); - bnEnd (&pkx); - bnEnd (&pky); - bnEnd (&P); - bnEnd (&Gx); - bnEnd (&Gy); - bnEnd (&n); - - s = zrtp_status_ok; - } while (0); - - return s; -} - - -/*----------------------------------------------------------------------------*/ -/* Verify a signature value - hash must be size matching the curve */ -/* Signing key should be in peer_pv entry of dsa_cc */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t ECDSA_verify( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - zrtp_ec_params_t *ec_params, - uint8_t *hash, uint32_t hash_len, - struct BigNum *dsasig ) -{ - zrtp_status_t s = zrtp_status_fail; - struct BigNum P, Gx, Gy, n; - struct BigNum rx, ry, pkx, pky, r, s1, sinv, u1, u2, u1x, u2x, u1y, u2y, h; - unsigned ec_bytes; - - if (!ec_params) - return zrtp_status_bad_param; - - ec_bytes = (ec_params->ec_bits+7) / 8; - - do - { - if (!self || !dsa_cc) - { - s = zrtp_status_bad_param; - break; - } - - bnBegin(&P); - bnInsertBigBytes( &P, ec_params->P_data, 0, ec_bytes ); - bnBegin(&Gx); - bnInsertBigBytes( &Gx, ec_params->Gx_data, 0, ec_bytes ); - bnBegin(&Gy); - bnInsertBigBytes( &Gy, ec_params->Gy_data, 0, ec_bytes ); - bnBegin(&n); - bnInsertBigBytes( &n, ec_params->n_data, 0, ec_bytes ); - - /* hash */ - bnBegin(&h); - bnInsertBigBytes( &h, hash, 0, hash_len ); - bnMod (&h, &h, &P); - - /* Unpack sig */ - bnBegin(&r); - bnBegin(&s1); - bnSetQ (&r, 1); - bnLShift (&r, ec_bytes*8); - bnMod (&s1, dsasig, &r); - bnCopy (&r, dsasig); - bnRShift (&r, ec_bytes*8); - - /* Unpack signing key */ - bnBegin(&pkx); - bnBegin(&pky); - bnSetQ (&pkx, 1); - bnLShift (&pkx, ec_bytes*8); - bnMod (&pky, &dsa_cc->peer_pv, &pkx); - bnCopy (&pkx, &dsa_cc->peer_pv); - bnRShift (&pkx, ec_bytes*8); - - /* Verify signature */ - bnBegin (&sinv); - bnInv (&sinv, &s1, &n); - bnBegin (&u1); - bnBegin (&u2); - bnMulMod_ (&u1, &sinv, &h, &n); - bnMulMod_ (&u2, &sinv, &r, &n); - - bnBegin (&u1x); - bnBegin (&u1y); - bnBegin (&u2x); - bnBegin (&u2y); - bnBegin (&rx); - bnBegin (&ry); - zrtp_ecMul (&u1x, &u1y, &u1, &Gx, &Gy, &P); - zrtp_ecMul (&u2x, &u2y, &u2, &pkx, &pky, &P); - zrtp_ecAdd (&rx, &ry, &u1x, &u1y, &u2x, &u2y, &P); - - if (bnCmp (&rx, &r) == 0) { - s = zrtp_status_ok; - } else { - s = zrtp_status_fail; - } - - /* Clean up */ - bnEnd (&rx); - bnEnd (&ry); - bnEnd (&r); - bnEnd (&s1); - bnEnd (&sinv); - bnEnd (&u1); - bnEnd (&u1x); - bnEnd (&u1y); - bnEnd (&u2); - bnEnd (&u2x); - bnEnd (&u2y); - bnEnd (&h); - bnEnd (&pkx); - bnEnd (&pky); - bnEnd (&P); - bnEnd (&Gx); - bnEnd (&Gy); - bnEnd (&n); - - } while (0); - - return s; -} - - - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC_dummy(void *s) -{ - return zrtp_status_ok; -} - - -/*============================================================================*/ -/* P-256 (FIPS 186-3) support. See RFC 4753, section 3.1. */ -/*============================================================================*/ - -/* Test vectors from RFC4754 */ -#ifdef ZRTP_TEST_VECTORS -static uint8_t sv256_data[] = { - 0xDC, 0x51, 0xD3, 0x86, 0x6A, 0x15, 0xBA, 0xCD, - 0xE3, 0x3D, 0x96, 0xF9, 0x92, 0xFC, 0xA9, 0x9D, - 0xA7, 0xE6, 0xEF, 0x09, 0x34, 0xE7, 0x09, 0x75, - 0x59, 0xC2, 0x7F, 0x16, 0x14, 0xC8, 0x8A, 0x7F, -}; -static uint8_t pvx256_data[] = { - 0x24, 0x42, 0xA5, 0xCC, 0x0E, 0xCD, 0x01, 0x5F, - 0xA3, 0xCA, 0x31, 0xDC, 0x8E, 0x2B, 0xBC, 0x70, - 0xBF, 0x42, 0xD6, 0x0C, 0xBC, 0xA2, 0x00, 0x85, - 0xE0, 0x82, 0x2C, 0xB0, 0x42, 0x35, 0xE9, 0x70, -}; -static uint8_t pvy256_data[] = { - 0x6F, 0xC9, 0x8B, 0xD7, 0xE5, 0x02, 0x11, 0xA4, - 0xA2, 0x71, 0x02, 0xFA, 0x35, 0x49, 0xDF, 0x79, - 0xEB, 0xCB, 0x4B, 0xF2, 0x46, 0xB8, 0x09, 0x45, - 0xCD, 0xDF, 0xE7, 0xD5, 0x09, 0xBB, 0xFD, 0x7D, -}; - -static uint8_t k256_data[] = { - 0x9E, 0x56, 0xF5, 0x09, 0x19, 0x67, 0x84, 0xD9, - 0x63, 0xD1, 0xC0, 0xA4, 0x01, 0x51, 0x0E, 0xE7, - 0xAD, 0xA3, 0xDC, 0xC5, 0xDE, 0xE0, 0x4B, 0x15, - 0x4B, 0xF6, 0x1A, 0xF1, 0xD5, 0xA6, 0xDE, 0xCE, -}; -static uint8_t rx256_data[] = { - 0xCB, 0x28, 0xE0, 0x99, 0x9B, 0x9C, 0x77, 0x15, - 0xFD, 0x0A, 0x80, 0xD8, 0xE4, 0x7A, 0x77, 0x07, - 0x97, 0x16, 0xCB, 0xBF, 0x91, 0x7D, 0xD7, 0x2E, - 0x97, 0x56, 0x6E, 0xA1, 0xC0, 0x66, 0x95, 0x7C, -}; -static uint8_t ry256_data[] = { - 0x2B, 0x57, 0xC0, 0x23, 0x5F, 0xB7, 0x48, 0x97, - 0x68, 0xD0, 0x58, 0xFF, 0x49, 0x11, 0xC2, 0x0F, - 0xDB, 0xE7, 0x1E, 0x36, 0x99, 0xD9, 0x13, 0x39, - 0xAF, 0xBB, 0x90, 0x3E, 0xE1, 0x72, 0x55, 0xDC, -}; - -static uint8_t h256_data[] = { - 0xBA, 0x78, 0x16, 0xBF, 0x8F, 0x01, 0xCF, 0xEA, - 0x41, 0x41, 0x40, 0xDE, 0x5D, 0xAE, 0x22, 0x23, - 0xB0, 0x03, 0x61, 0xA3, 0x96, 0x17, 0x7A, 0x9C, - 0xB4, 0x10, 0xFF, 0x61, 0xF2, 0x00, 0x15, 0xAD, -}; -static uint8_t s256_data[] = { - 0x86, 0xFA, 0x3B, 0xB4, 0xE2, 0x6C, 0xAD, 0x5B, - 0xF9, 0x0B, 0x7F, 0x81, 0x89, 0x92, 0x56, 0xCE, - 0x75, 0x94, 0xBB, 0x1E, 0xA0, 0xC8, 0x92, 0x12, - 0x74, 0x8B, 0xFF, 0x3B, 0x3D, 0x5B, 0x03, 0x15, -}; - - -#endif - -/*----------------------------------------------------------------------------*/ -/* Return dsa_cc->pv holding public value and dsa_cc->sv holding secret value */ -/* The public value is an elliptic curve point encoded as the x part shifted */ -/* left 256 bits and or'd with the y part. */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC256P_keygen( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 256); - return ECDSA_keygen(self, dsa_cc, ¶ms, -#ifdef ZRTP_TEST_VECTORS - sv256_data, sizeof(sv256_data), - pvx256_data, sizeof(pvx256_data), - pvy256_data, sizeof(pvy256_data), -#endif - 256); -} - - -/*----------------------------------------------------------------------------*/ -/* Sign the specified hash value */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC256P_sign( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - uint8_t *hash, uint32_t hash_len, - struct BigNum *dsasig ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 256); - return ECDSA_sign(self, dsa_cc, ¶ms, -#ifdef ZRTP_TEST_VECTORS - k256_data, sizeof(k256_data), - rx256_data, sizeof(rx256_data), - ry256_data, sizeof(ry256_data), - s256_data, sizeof(s256_data), - h256_data, sizeof(h256_data), -#else - hash, hash_len, -#endif - dsasig); -} - - -/*----------------------------------------------------------------------------*/ -/* Verify the signature on the hash value */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC256P_verify(struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - uint8_t *hash, uint32_t hash_len, - struct BigNum *dsasig ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 256); - return ECDSA_verify(self, dsa_cc, ¶ms, -#ifdef ZRTP_TEST_VECTORS - h256_data, sizeof(h256_data), -#else - hash, hash_len, -#endif - dsasig); -} - - - -/*============================================================================*/ -/* P-384 (FIPS 186-3) support. See RFC 4753, section 3.2. */ -/*============================================================================*/ - - - -/*----------------------------------------------------------------------------*/ -/* Return dsa_cc->pv holding public value and dsa_cc->sv holding secret value */ -/* The public value is an elliptic curve point encoded as the x part shifted */ -/* left 384 bits and or'd with the y part. */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC384P_keygen( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 384); - return ECDSA_keygen(self, dsa_cc, ¶ms, -#ifdef ZRTP_TEST_VECTORS - 0, 0, 0, 0, 0, 0, -#endif - 384); -} - - -/*----------------------------------------------------------------------------*/ -/* Sign the specified hash value */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC384P_sign( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - uint8_t *hash, uint32_t hash_len, - struct BigNum *dsasig ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 384); - return ECDSA_sign(self, dsa_cc, ¶ms, -#ifdef ZRTP_TEST_VECTORS - 0, 0, 0, 0, 0, 0, 0, 0, -#endif - hash, hash_len, dsasig); -} - - -/*----------------------------------------------------------------------------*/ -/* Verify the signature on the hash value */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC384P_verify(struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - uint8_t *hash, uint32_t hash_len, - struct BigNum *dsasig ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 384); - return ECDSA_verify(self, dsa_cc, ¶ms, hash, hash_len, dsasig); -} - - - -/*============================================================================*/ -/* P-521 (FIPS 186-3) support. See RFC 4753, section 3.3. */ -/*============================================================================*/ - - -/*----------------------------------------------------------------------------*/ -/* Return dsa_cc->pv holding public value and dsa_cc->sv holding secret value */ -/* The public value is an elliptic curve point encoded as the x part shifted */ -/* left 528 bits (note, not 521) and or'd with the y part. */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC521P_keygen( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 521); - return ECDSA_keygen(self, dsa_cc, ¶ms, -#ifdef ZRTP_TEST_VECTORS - 0, 0, 0, 0, 0, 0, -#endif - 528); -} - - -/*----------------------------------------------------------------------------*/ -/* Sign the specified hash value */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC521P_sign( struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - uint8_t *hash, uint32_t hash_len, - struct BigNum *dsasig ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 521); - return ECDSA_sign(self, dsa_cc, ¶ms, -#ifdef ZRTP_TEST_VECTORS - 0, 0, 0, 0, 0, 0, 0, 0, -#endif - hash, hash_len, dsasig); -} - - -/*----------------------------------------------------------------------------*/ -/* Verify the signature on the hash value */ -/*----------------------------------------------------------------------------*/ -static zrtp_status_t EC521P_verify(struct zrtp_sig_scheme *self, - zrtp_dsa_crypto_context_t *dsa_cc, - uint8_t *hash, uint32_t hash_len, - struct BigNum *dsasig ) -{ - struct zrtp_ec_params params; - zrtp_ec_init_params(¶ms, 521); - return ECDSA_verify(self, dsa_cc, ¶ms, hash, hash_len, dsasig); -} - - - -/*============================================================================*/ -/* Public Key support */ -/*============================================================================*/ - - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_defaults_sig(zrtp_global_ctx_t* zrtp_global) -{ - zrtp_sig_scheme_t* ec256p = zrtp_sys_alloc(sizeof(zrtp_sig_scheme_t)); - zrtp_sig_scheme_t* ec384p = zrtp_sys_alloc(sizeof(zrtp_sig_scheme_t)); - zrtp_sig_scheme_t* ec521p = zrtp_sys_alloc(sizeof(zrtp_sig_scheme_t)); - - if (!ec256p || !ec384p || !ec521p) - { - if(ec256p) zrtp_sys_free(ec256p); - if(ec384p) zrtp_sys_free(ec384p); - if(ec521p) zrtp_sys_free(ec521p); - return zrtp_status_alloc_fail; - } - - zrtp_memset(ec256p, 0, sizeof(zrtp_sig_scheme_t)); - zrtp_memcpy(ec256p->base.type, ZRTP_EC256P, ZRTP_COMP_TYPE_SIZE); - ec256p->base.id = ZRTP_SIGTYPE_EC256P; - ec256p->base.zrtp_global = zrtp_global; - ec256p->sv_length = 256/8; - ec256p->pv_length = 2*256/8; - ec256p->base.init = EC_dummy; - ec256p->base.free = EC_dummy; - ec256p->generate_key = EC256P_keygen; - ec256p->sign = EC256P_sign; - ec256p->verify = EC256P_verify; - - zrtp_memset(ec384p, 0, sizeof(zrtp_sig_scheme_t)); - zrtp_memcpy(ec384p->base.type, ZRTP_EC384P, ZRTP_COMP_TYPE_SIZE); - ec384p->base.id = ZRTP_SIGTYPE_EC384P; - ec384p->base.zrtp_global = zrtp_global; - ec384p->sv_length = 384/8; - ec384p->pv_length = 2*384/8; - ec384p->base.init = EC_dummy; - ec384p->base.free = EC_dummy; - ec384p->generate_key = EC384P_keygen; - ec384p->sign = EC384P_sign; - ec384p->verify = EC384P_verify; - - zrtp_memset(ec521p, 0, sizeof(zrtp_sig_scheme_t)); - zrtp_memcpy(ec521p->base.type, ZRTP_EC521P, ZRTP_COMP_TYPE_SIZE); - ec521p->base.id = ZRTP_SIGTYPE_EC521P; - ec521p->base.zrtp_global = zrtp_global; - ec521p->sv_length = 528/8; - ec521p->pv_length = 2*528/8; - ec521p->base.init = EC_dummy; - ec521p->base.free = EC_dummy; - ec521p->generate_key = EC521P_keygen; - ec521p->sign = EC521P_sign; - ec521p->verify = EC521P_verify; - - zrtp_register_comp(ZRTP_CC_SIG, ec256p, zrtp_global); - zrtp_register_comp(ZRTP_CC_SIG, ec384p, zrtp_global); - zrtp_register_comp(ZRTP_CC_SIG, ec521p, zrtp_global); - - return zrtp_status_ok; -} - -#endif /* don't have disgital signature ready for the moment*/ diff --git a/libs/libzrtp/src/zrtp_crypto_hash.c b/libs/libzrtp/src/zrtp_crypto_hash.c deleted file mode 100644 index 8154e8f970..0000000000 --- a/libs/libzrtp/src/zrtp_crypto_hash.c +++ /dev/null @@ -1,1638 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - * Vitaly Rozhkov - */ - -#include "sha2.h" -#include "sha1.h" - -#include "zrtp.h" - -#define _ZTU_ "zrtp hash" - - -/*============================================================================*/ -/* HASH function */ -/*============================================================================*/ - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_sha_c(zrtp_hash_t *self, const char* msg, uint32_t len, zrtp_stringn_t *dst) -{ - if (!self || !msg || !dst || !len) { - return zrtp_status_bad_param; - } - - switch (self->base.id) - { - case ZRTP_SRTP_HASH_HMAC_SHA1: { - sha1_ctx ctx; - if (dst->max_length < SHA1_DIGEST_SIZE) { - return zrtp_status_buffer_size; - } - sha1_begin(&ctx); - sha1_hash((const unsigned char*)msg, len, &ctx); - sha1_end((unsigned char*)dst->buffer, &ctx); - dst->length = SHA1_DIGEST_SIZE; - } break; - - case ZRTP_HASH_SHA256: { - sha256_ctx ctx; - if (dst->max_length < SHA256_DIGEST_SIZE) { - return zrtp_status_buffer_size; - } - sha256_begin(&ctx); - sha256_hash((const unsigned char*)msg, len, &ctx); - sha256_end((unsigned char*)dst->buffer, &ctx); - dst->length = SHA256_DIGEST_SIZE; - } break; - - case ZRTP_HASH_SHA384: { - sha384_ctx ctx; - if (dst->max_length < SHA384_DIGEST_SIZE) { - return zrtp_status_buffer_size; - } - sha384_begin(&ctx); - sha384_hash((const unsigned char*)msg, len, &ctx); - sha384_end((unsigned char*)dst->buffer, &ctx); - dst->length = SHA384_DIGEST_SIZE; - } break; - } - - return zrtp_status_ok; -} - -static zrtp_status_t zrtp_sha(zrtp_hash_t *self, const zrtp_stringn_t *msg, zrtp_stringn_t *dst) { - if (!self || !msg || !dst) { - return zrtp_status_bad_param; - } - return zrtp_sha_c(self, msg->buffer, msg->length, dst); -} - -/*----------------------------------------------------------------------------*/ -static void* zrtp_sha_begin(zrtp_hash_t *self) -{ - void *ctx = NULL; - - switch (self->base.id) { - case ZRTP_SRTP_HASH_HMAC_SHA1: - ctx = zrtp_sys_alloc(sizeof(sha1_ctx)); - if (ctx) { - sha1_begin(ctx); - } - break; - case ZRTP_HASH_SHA256: - ctx = zrtp_sys_alloc(sizeof(sha256_ctx)); - if (ctx) { - sha256_begin(ctx); - } - break; - case ZRTP_HASH_SHA384: - ctx = zrtp_sys_alloc(sizeof(sha384_ctx)); - if (ctx) { - sha384_begin(ctx); - } - break; - } - - return ctx; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_sha_update( zrtp_hash_t *self, - void *ctx, - const int8_t *msg, - uint32_t length) -{ - if (!ctx || !msg || !length) { - return zrtp_status_bad_param; - } - - switch (self->base.id) { - case ZRTP_SRTP_HASH_HMAC_SHA1: - sha1_hash((const unsigned char*)msg, length, (sha1_ctx*)ctx); - break; - case ZRTP_HASH_SHA256: - sha256_hash((const unsigned char*)msg, length, (sha256_ctx*)ctx); - break; - case ZRTP_HASH_SHA384: - sha384_hash((const unsigned char*)msg, length, (sha384_ctx*)ctx); - break; - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_sha_end( zrtp_hash_t *self, - void *ctx, - zrtp_stringn_t *digest) -{ - if (!ctx || !digest) { - return zrtp_status_bad_param; - } - - switch (self->base.id) { - case ZRTP_SRTP_HASH_HMAC_SHA1: - if (digest->max_length < SHA1_DIGEST_SIZE) { - return zrtp_status_buffer_size; - } - sha1_end((unsigned char*)digest->buffer,(sha1_ctx*)ctx); - digest->length = SHA1_DIGEST_SIZE; - break; - case ZRTP_HASH_SHA256: - if (digest->max_length < SHA256_DIGEST_SIZE) { - return zrtp_status_buffer_size; - } - sha256_end((unsigned char*)digest->buffer,(sha256_ctx*)ctx); - digest->length = SHA256_DIGEST_SIZE; - break; - case ZRTP_HASH_SHA384: - if (digest->max_length < SHA384_DIGEST_SIZE) { - return zrtp_status_buffer_size; - } - sha384_end((unsigned char*)digest->buffer,(sha384_ctx*)ctx); - digest->length = SHA384_DIGEST_SIZE; - break; - } - - zrtp_sys_free(ctx); - ctx = 0; - - return zrtp_status_ok; -} - - -/*============================================================================*/ -/* HMAC functions */ -/*============================================================================*/ - -typedef struct -{ - sha384_ctx context; - unsigned char k_ipad[128]; /* inner padding - key XORd with ipad */ - unsigned char k_opad[128]; /* outer padding - key XORd with opad */ -} hmac_sha384_context_t; - - -typedef struct -{ - sha256_ctx context; - unsigned char k_ipad[64]; - unsigned char k_opad[64]; -} hmac_sha256_context_t; - -typedef struct -{ - sha1_ctx context; - unsigned char k_ipad[64]; - unsigned char k_opad[64]; -} hmac_sha1_context_t; - - -/*----------------------------------------------------------------------------*/ -static void* zrtp_hmac_sha256_begin_c(zrtp_hash_t *self, const char *key, uint32_t length) -{ - const char *p_key; - uint32_t key_length; - char local_key[SHA256_BLOCK_SIZE]; - int i = 0; - hmac_sha256_context_t *ctx = zrtp_sys_alloc(sizeof(hmac_sha256_context_t)); - if (!ctx) { - return NULL; - } - zrtp_memset(ctx, 0, sizeof(hmac_sha256_context_t)); - - if (length > SHA256_BLOCK_SIZE) { - sha256_begin(&ctx->context); - sha256_hash((const unsigned char*)key, length, &ctx->context); - sha256_end((unsigned char*)local_key, &ctx->context); - - p_key = local_key; - key_length = SHA256_BLOCK_SIZE; - } else { - p_key = key; - key_length = length; - } - - /* - * the HMAC transform looks like: - * - * HASH(K XOR opad, HASH(K XOR ipad, text)) - * - * where K is an n byte key - * ipad is the byte 0x36 repeated 64 times - * opad is the byte 0x5c repeated 64 times - * and text is the data being protected - */ - - /* start out by storing key in pads */ - zrtp_memcpy(ctx->k_ipad, p_key, ZRTP_MIN(key_length, 64)); - zrtp_memcpy(ctx->k_opad, p_key, ZRTP_MIN(key_length, 64)); - - /* XOR key with ipad and opad values */ - for (i=0; i<64; i++) { - ctx->k_ipad[i] ^= (uint8_t)0x36; - ctx->k_opad[i] ^= (uint8_t)0x5c; - } - - /* perform inner hash */ - sha256_begin(&ctx->context); /* init context for 1st pass */ - sha256_hash(ctx->k_ipad, 64, &ctx->context); /* start with inner pad */ - - zrtp_memset(&local_key, 0, sizeof(local_key)); - return ctx; -} -static void* zrtp_hmac_sha384_begin_c(zrtp_hash_t *self, const char *key, uint32_t length) -{ - const char *p_key; - uint32_t key_length; - char local_key[SHA384_BLOCK_SIZE]; - int i = 0; - hmac_sha384_context_t *ctx = zrtp_sys_alloc(sizeof(hmac_sha384_context_t)); - if (!ctx) { - return NULL; - } - zrtp_memset(ctx, 0, sizeof(hmac_sha384_context_t)); - - if (length > SHA384_BLOCK_SIZE) { - sha384_begin(&ctx->context); - sha384_hash((const unsigned char*)key, length, &ctx->context); - sha384_end((unsigned char*)local_key, &ctx->context); - - p_key = local_key; - key_length = SHA384_BLOCK_SIZE; - } else { - p_key = key; - key_length = length; - } - - zrtp_memcpy(ctx->k_ipad, p_key, ZRTP_MIN(key_length, 128)); - zrtp_memcpy(ctx->k_opad, p_key, ZRTP_MIN(key_length, 128)); - - for (i=0; i<128; i++) { - ctx->k_ipad[i] ^= (uint8_t)0x36; - ctx->k_opad[i] ^= (uint8_t)0x5c; - } - - sha384_begin(&ctx->context); - sha384_hash(ctx->k_ipad, 128, &ctx->context); - - zrtp_memset(&local_key, 0, sizeof(local_key)); - return ctx; -} - -static void* zrtp_hmac_sha1_begin_c( zrtp_hash_t *self, - const char *key, - uint32_t length) -{ - const char *p_key; - uint32_t key_length; - char local_key[SHA1_BLOCK_SIZE]; - int i = 0; - hmac_sha1_context_t *ctx = zrtp_sys_alloc(sizeof(hmac_sha1_context_t)); - if (!ctx) { - return NULL; - } - zrtp_memset(ctx, 0, sizeof(hmac_sha1_context_t)); - - if (length > SHA1_BLOCK_SIZE) { - sha1_begin(&ctx->context); - sha1_hash((const unsigned char*)key, length, &ctx->context); - sha1_end((unsigned char*)local_key, &ctx->context); - - p_key = local_key; - key_length = SHA1_BLOCK_SIZE; - } else { - p_key = key; - key_length = length; - } - - zrtp_memcpy(ctx->k_ipad, p_key, ZRTP_MIN(key_length, 64)); - zrtp_memcpy(ctx->k_opad, p_key, ZRTP_MIN(key_length, 64)); - - for (i=0; i<64; i++) { - ctx->k_ipad[i] ^= (uint8_t)0x36; - ctx->k_opad[i] ^= (uint8_t)0x5c; - } - - sha1_begin(&ctx->context); - sha1_hash(ctx->k_ipad, 64, &ctx->context); - - zrtp_memset(&local_key, 0, sizeof(local_key)); - return ctx; -} - -static void* zrtp_hmac_begin(zrtp_hash_t *self, const zrtp_stringn_t *key) { - switch (self->base.id) - { - case ZRTP_SRTP_HASH_HMAC_SHA1: - return zrtp_hmac_sha1_begin_c(self, key->buffer, key->length); - case ZRTP_HASH_SHA256: - return zrtp_hmac_sha256_begin_c(self, key->buffer, key->length); - case ZRTP_HASH_SHA384: - return zrtp_hmac_sha384_begin_c(self, key->buffer, key->length); - default: - return NULL; - } -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_hmac_update(zrtp_hash_t *self, void *ctx, const char *msg, uint32_t length) -{ - if (!ctx || !msg) { - return zrtp_status_fail; - } - - if (0 != length) { - switch (self->base.id) { - case ZRTP_SRTP_HASH_HMAC_SHA1: - sha1_hash((const unsigned char*)msg, length, &((hmac_sha1_context_t*)ctx)->context); - break; - case ZRTP_HASH_SHA256: - sha256_hash((const unsigned char*)msg, length, &((hmac_sha256_context_t*)ctx)->context); - break; - case ZRTP_HASH_SHA384: - sha384_hash((const unsigned char*)msg, length, &((hmac_sha384_context_t*)ctx)->context); - break; - default: - return zrtp_status_bad_param; - } - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_hmac_end( zrtp_hash_t *self, - void *ctx, - zrtp_stringn_t *digest, - uint32_t len) -{ - zrtp_string128_t dst = ZSTR_INIT_EMPTY(dst); - - if (!ctx || !digest) { - return zrtp_status_fail; - } - - switch (self->base.id) - { - case ZRTP_SRTP_HASH_HMAC_SHA1: - /* finish up 1st pass */ - sha1_end((unsigned char*)dst.buffer, &((hmac_sha1_context_t*)ctx)->context); - - /* perform outer hash and init context for 2nd pass */ - sha1_begin(&((hmac_sha1_context_t*)ctx)->context); - /* start with outer pad */ - sha1_hash(((hmac_sha1_context_t*)ctx)->k_opad, 64, &((hmac_sha1_context_t*)ctx)->context); - /* then results of 1st hash */ - sha1_hash((const unsigned char*)dst.buffer, SHA1_DIGEST_SIZE, &((hmac_sha1_context_t*)ctx)->context); - /* finish up 2nd pass */ - sha1_end((unsigned char*)dst.buffer, &((hmac_sha1_context_t*)ctx)->context); - - len = (0 == len) ? SHA1_DIGEST_SIZE : ZRTP_MIN(len, SHA1_DIGEST_SIZE); - break; - case ZRTP_HASH_SHA256: - sha256_end((unsigned char*)dst.buffer, &((hmac_sha256_context_t*)ctx)->context); - sha256_begin(&((hmac_sha256_context_t*)ctx)->context); - sha256_hash(((hmac_sha256_context_t*)ctx)->k_opad, 64, &((hmac_sha256_context_t*)ctx)->context); - sha256_hash((const unsigned char*)dst.buffer, SHA256_DIGEST_SIZE, &((hmac_sha256_context_t*)ctx)->context); - sha256_end((unsigned char*)dst.buffer, &((hmac_sha256_context_t*)ctx)->context); - - len = (0 == len) ? SHA256_DIGEST_SIZE : ZRTP_MIN(len, SHA256_DIGEST_SIZE); - break; - case ZRTP_HASH_SHA384: - sha384_end((unsigned char*)dst.buffer, &((hmac_sha384_context_t*)ctx)->context); - sha384_begin(&((hmac_sha384_context_t*)ctx)->context); - sha384_hash(((hmac_sha384_context_t*)ctx)->k_opad, 128, &((hmac_sha384_context_t*)ctx)->context); - sha384_hash((const unsigned char*)dst.buffer, SHA384_DIGEST_SIZE, &((hmac_sha384_context_t*)ctx)->context); - sha384_end((unsigned char*)dst.buffer, &((hmac_sha384_context_t*)ctx)->context); - - len = (0 == len) ? SHA384_DIGEST_SIZE : ZRTP_MIN(len, SHA384_DIGEST_SIZE); - break; - default: - return zrtp_status_bad_param; - } - - digest->length = ZRTP_MIN(len, digest->max_length); - zrtp_memcpy(digest->buffer, dst.buffer, digest->length); - - zrtp_sys_free(ctx); - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_hmac_c( zrtp_hash_t *self, - const char *key, - const uint32_t key_len, - const char *msg, - const uint32_t msg_len, - zrtp_stringn_t *digest) -{ - unsigned char *p_key; - uint32_t l_key_len; - sha1_ctx context1; - sha256_ctx context2; - sha384_ctx context3; - unsigned char k_ipad[128]; /* inner padding - key XORd with ipad */ - unsigned char k_opad[128]; /* outer padding - key XORd with opad */ - unsigned i; - unsigned char local_key[SHA384_BLOCK_SIZE]; - uint32_t local_key_len = 0; - - - if (!self || !digest || !key || !msg) { - return zrtp_status_buffer_size; - } - - switch (self->base.id) { - case ZRTP_SRTP_HASH_HMAC_SHA1: - local_key_len = SHA1_BLOCK_SIZE; - break; - case ZRTP_HASH_SHA256: - local_key_len = SHA256_BLOCK_SIZE; - break; - case ZRTP_HASH_SHA384: - local_key_len = SHA384_BLOCK_SIZE; - break; - default: - return zrtp_status_bad_param; - } - - if (digest->max_length < local_key_len) { - return zrtp_status_buffer_size; - } - - if (key_len > local_key_len) { - switch (self->base.id) - { - case ZRTP_SRTP_HASH_HMAC_SHA1: - sha1_begin(&context1); - sha1_hash((const unsigned char*)key, key_len, &context1); - sha1_end(local_key, &context1); - break; - case ZRTP_HASH_SHA256: - sha256_begin(&context2); - sha256_hash((const unsigned char*)key, key_len, &context2); - sha256_end(local_key, &context2); - break; - case ZRTP_HASH_SHA384: - sha384_begin(&context3); - sha384_hash((const unsigned char*)key, key_len, &context3); - sha384_end(local_key, &context3); - break; - } - - p_key = local_key; - l_key_len = local_key_len; - } else { - p_key = (unsigned char*)key; - l_key_len = key_len; - } - - /* - * the HMAC transform looks like: - * - * HASH(K XOR opad, HASH(K XOR ipad, text)) - * - * where K is an n byte key - * ipad is the byte 0x36 repeated 64 times - * opad is the byte 0x5c repeated 64 times - * and text is the data being protected - */ - - /* start out by storing key in pads */ - zrtp_memset(k_ipad, 0, sizeof(k_ipad)); - zrtp_memset(k_opad, 0, sizeof(k_opad)); - zrtp_memcpy(k_ipad, p_key, ZRTP_MIN(l_key_len, local_key_len)); - zrtp_memcpy(k_opad, p_key, ZRTP_MIN(l_key_len, local_key_len)); - - /* XOR key with ipad and opad values */ - for (i=0; ibase.id) { - case ZRTP_SRTP_HASH_HMAC_SHA1: - /* perform inner hash */ - sha1_begin(&context1); /* init context for 1st pass */ - sha1_hash(k_ipad, local_key_len, &context1);/* start with inner pad */ - sha1_hash((const unsigned char*)msg, msg_len, &context1); /* then text of datagram */ - sha1_end((unsigned char*)digest->buffer, &context1); /* finish up 1st pass */ - - /* perform outer hash */ - sha1_begin(&context1); /* init context for 2nd pass */ - sha1_hash(k_opad, local_key_len, &context1);/* start with outer pad */ - sha1_hash((const unsigned char*)digest->buffer, SHA1_DIGEST_SIZE, &context1); /* then results of 1st hash */ - sha1_end((unsigned char*)digest->buffer, &context1); /* finish up 2nd pass */ - - digest->length = SHA1_DIGEST_SIZE; - break; - case ZRTP_HASH_SHA256: - sha256_begin(&context2); - sha256_hash(k_ipad, local_key_len, &context2); - sha256_hash((const unsigned char*)msg, msg_len, &context2); - sha256_end((unsigned char*)digest->buffer, &context2); - - sha256_begin(&context2); - sha256_hash(k_opad, local_key_len, &context2); - sha256_hash((const unsigned char*)digest->buffer, SHA256_DIGEST_SIZE, &context2); - sha256_end((unsigned char*)digest->buffer, &context2); - - digest->length = SHA256_DIGEST_SIZE; - break; - case ZRTP_HASH_SHA384: - sha384_begin(&context3); - sha384_hash(k_ipad, local_key_len, &context3); - sha384_hash((const unsigned char*)msg, msg_len, &context3); - sha384_end((unsigned char*)digest->buffer, &context3); - - sha384_begin(&context3); - sha384_hash(k_opad, local_key_len, &context3); - sha384_hash((const unsigned char*)digest->buffer, SHA384_DIGEST_SIZE, &context3); - sha384_end((unsigned char*)digest->buffer, &context3); - - digest->length = SHA384_DIGEST_SIZE; - break; - } - - return zrtp_status_ok; -} - -static zrtp_status_t zrtp_hmac( zrtp_hash_t *self, - const zrtp_stringn_t *key, - const zrtp_stringn_t *msg, - zrtp_stringn_t *digest) { - return zrtp_hmac_c(self, key->buffer, key->length, msg->buffer, msg->length, digest); -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_hmac_truncated_c( zrtp_hash_t *self, - const char *key, - const uint32_t key_len, - const char *msg, - const uint32_t msg_len, - uint32_t necessary_len, - zrtp_stringn_t *digest) -{ - uint32_t necessary_len_max = 0; - switch (self->base.id) { - case ZRTP_SRTP_HASH_HMAC_SHA1: - necessary_len_max = SHA1_DIGEST_SIZE; - break; - case ZRTP_HASH_SHA256: - necessary_len_max = SHA256_DIGEST_SIZE; - break; - case ZRTP_HASH_SHA384: - necessary_len_max = SHA384_DIGEST_SIZE; - break; - } - if (necessary_len > necessary_len_max) { - return zrtp_status_buffer_size; - } - - if (0 == necessary_len) { - zrtp_hmac_c(self, key, key_len, msg, msg_len, digest); - } else { - zrtp_string128_t dst = ZSTR_INIT_EMPTY(dst); - - zrtp_hmac_c(self, key, key_len, msg, msg_len, (zrtp_stringn_t *)&dst); - switch (self->base.id) { - case ZRTP_SRTP_HASH_HMAC_SHA1: - necessary_len = ZRTP_MIN(necessary_len, SHA1_DIGEST_SIZE); - break; - case ZRTP_HASH_SHA256: - necessary_len = ZRTP_MIN(necessary_len, SHA256_DIGEST_SIZE); - break; - case ZRTP_HASH_SHA384: - necessary_len = ZRTP_MIN(necessary_len, SHA384_DIGEST_SIZE); - break; - } - digest->length = ZRTP_MIN(necessary_len, digest->max_length); - zrtp_memcpy(digest->buffer, dst.buffer, digest->length); - } - - return zrtp_status_ok; -} - -static zrtp_status_t zrtp_hmac_truncated( zrtp_hash_t *self, - const zrtp_stringn_t *key, - const zrtp_stringn_t *msg, - uint32_t len, - zrtp_stringn_t *digest) { - return zrtp_hmac_truncated_c(self, key->buffer, key->length, msg->buffer, msg->length, len, digest); - -} - - -/*============================================================================*/ -/* SHA and SHMAC test cases */ -/*============================================================================*/ - - -/* - * SHA1 Test Vectors - */ - -static uint8_t sha1_msg_8[1] = { - 0xa8 -}; - -static uint8_t sha1_MD_8[20] = { - 0x99, 0xf2, 0xaa, 0x95, 0xe3, 0x6f, 0x95, 0xc2, - 0xac, 0xb0, 0xea, 0xf2, 0x39, 0x98, 0xf0, 0x30, - 0x63, 0x8f, 0x3f, 0x15 -}; - -static uint8_t sha1_msg_128[16] = { - 0xc5, 0xa2, 0x2d, 0xd6, 0xed, 0xa3, 0xfe, 0x2b, - 0xdc, 0x4d, 0xdb, 0x3c, 0xe6, 0xb3, 0x5f, 0xd1 -}; - -static uint8_t sha1_MD_128[20] = { - 0xfa, 0xc8, 0xab, 0x93, 0xc1, 0xae, 0x6c, 0x16, - 0xf0, 0x31, 0x18, 0x72, 0xb9, 0x84, 0xf7, 0x29, - 0xdc, 0x92, 0x8c, 0xcd -}; - -static uint8_t sha1_msg_512[64] = { - 0x7e, 0x3a, 0x4c, 0x32, 0x5c, 0xb9, 0xc5, 0x2b, - 0x88, 0x38, 0x7f, 0x93, 0xd0, 0x1a, 0xe8, 0x6d, - 0x42, 0x09, 0x8f, 0x5e, 0xfa, 0x7f, 0x94, 0x57, - 0x38, 0x8b, 0x5e, 0x74, 0xb6, 0xd2, 0x8b, 0x24, - 0x38, 0xd4, 0x2d, 0x8b, 0x64, 0x70, 0x33, 0x24, - 0xd4, 0xaa, 0x25, 0xab, 0x6a, 0xad, 0x15, 0x3a, - 0xe3, 0x0c, 0xd2, 0xb2, 0xaf, 0x4d, 0x5e, 0x5c, - 0x00, 0xa8, 0xa2, 0xd0, 0x22, 0x0c, 0x61, 0x16 -}; - -static uint8_t sha1_MD_512[20] = { - 0xa3, 0x05, 0x44, 0x27, 0xcd, 0xb1, 0x3f, 0x16, - 0x4a, 0x61, 0x0b, 0x34, 0x87, 0x02, 0x72, 0x4c, - 0x80, 0x8a, 0x0d, 0xcc -}; - -static uint8_t sha1_msg_2096[262] = { - 0x5f, 0xc2, 0xc3, 0xf6, 0xa7, 0xe7, 0x9d, 0xc9, - 0x4b, 0xe5, 0x26, 0xe5, 0x16, 0x6a, 0x23, 0x88, - 0x99, 0xd5, 0x49, 0x27, 0xce, 0x47, 0x00, 0x18, - 0xfb, 0xfd, 0x66, 0x8f, 0xd9, 0xdd, 0x97, 0xcb, - 0xf6, 0x4e, 0x2c, 0x91, 0x58, 0x4d, 0x01, 0xda, - 0x63, 0xbe, 0x3c, 0xc9, 0xfd, 0xff, 0x8a, 0xdf, - 0xef, 0xc3, 0xac, 0x72, 0x8e, 0x1e, 0x33, 0x5b, - 0x9c, 0xdc, 0x87, 0xf0, 0x69, 0x17, 0x2e, 0x32, - 0x3d, 0x09, 0x4b, 0x47, 0xfa, 0x1e, 0x65, 0x2a, - 0xfe, 0x4d, 0x6a, 0xa1, 0x47, 0xa9, 0xf4, 0x6f, - 0xda, 0x33, 0xca, 0xcb, 0x65, 0xf3, 0xaa, 0x12, - 0x23, 0x47, 0x46, 0xb9, 0x00, 0x7a, 0x8c, 0x85, - 0xfe, 0x98, 0x2a, 0xfe, 0xd7, 0x81, 0x52, 0x21, - 0xe4, 0x3d, 0xba, 0x55, 0x3d, 0x8f, 0xe8, 0xa0, - 0x22, 0xcd, 0xac, 0x1b, 0x99, 0xee, 0xee, 0xa3, - 0x59, 0xe5, 0xa9, 0xd2, 0xe7, 0x2e, 0x38, 0x2d, - 0xff, 0xa6, 0xd1, 0x9f, 0x35, 0x9f, 0x4f, 0x27, - 0xdc, 0x34, 0x34, 0xcd, 0x27, 0xda, 0xee, 0xda, - 0x8e, 0x38, 0x59, 0x48, 0x73, 0x39, 0x86, 0x78, - 0x06, 0x5f, 0xbb, 0x23, 0x66, 0x5a, 0xba, 0x93, - 0x09, 0xd9, 0x46, 0x13, 0x5d, 0xa0, 0xe4, 0xa4, - 0xaf, 0xda, 0xdf, 0xf1, 0x4d, 0xb1, 0x8e, 0x85, - 0xe7, 0x1d, 0xd9, 0x3c, 0x3b, 0xf9, 0xfa, 0xf7, - 0xf2, 0x5c, 0x81, 0x94, 0xc4, 0x26, 0x9b, 0x1e, - 0xe3, 0xd9, 0x93, 0x40, 0x97, 0xab, 0x99, 0x00, - 0x25, 0xd9, 0xc3, 0xaa, 0xf6, 0x3d, 0x51, 0x09, - 0xf5, 0x23, 0x35, 0xdd, 0x39, 0x59, 0xd3, 0x8a, - 0xe4, 0x85, 0x05, 0x0e, 0x4b, 0xbb, 0x62, 0x35, - 0x57, 0x4f, 0xc0, 0x10, 0x2b, 0xe8, 0xf7, 0xa3, - 0x06, 0xd6, 0xe8, 0xde, 0x6b, 0xa6, 0xbe, 0xcf, - 0x80, 0xf3, 0x74, 0x15, 0xb5, 0x7f, 0x98, 0x98, - 0xa5, 0x82, 0x4e, 0x77, 0x41, 0x41, 0x97, 0x42, - 0x2b, 0xe3, 0xd3, 0x6a, 0x60, 0x80 -}; - -static uint8_t sha1_MD_2096[20] = { - 0x04, 0x23, 0xdc, 0x76, 0xa8, 0x79, 0x11, 0x07, - 0xd1, 0x4e, 0x13, 0xf5, 0x26, 0x5b, 0x34, 0x3f, - 0x24, 0xcc, 0x0f, 0x19 -}; - - - -/* - * HMAC SHA1 Test Vectors from RFC 2202 - */ - -static uint8_t test_case1_hmac_sha1_key[20] = { - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b -}; -static uint8_t test_case1_hmac_sha1_data[8] = { - 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 -}; -static uint8_t test_case1_hmac_sha1_result[20] = { - 0xb6, 0x17, 0x31, 0x86, 0x55, 0x05, 0x72, 0x64, - 0xe2, 0x8b, 0xc0, 0xb6, 0xfb, 0x37, 0x8c, 0x8e, - 0xf1, 0x46, 0xbe, 0x00 -}; - - -static uint8_t test_case2_hmac_sha1_key[4] = { - 0x4a, 0x65, 0x66, 0x65 -}; -static uint8_t test_case2_hmac_sha1_data[28] = { - 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, - 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, - 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, - 0x69, 0x6e, 0x67, 0x3f -}; -static uint8_t test_case2_hmac_sha1_result[20] = { - 0xef, 0xfc, 0xdf, 0x6a, 0xe5, 0xeb, 0x2f, 0xa2, - 0xd2, 0x74, 0x16, 0xd5, 0xf1, 0x84, 0xdf, 0x9c, - 0x25, 0x9a, 0x7c, 0x79 -}; - - -static uint8_t test_case3_hmac_sha1_key[20] = { - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa -}; -static uint8_t test_case3_hmac_sha1_data[50] = { - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd -}; -static uint8_t test_case3_hmac_sha1_result[20] = { - 0x12, 0x5d, 0x73, 0x42, 0xb9, 0xac, 0x11, 0xcd, - 0x91, 0xa3, 0x9a, 0xf4, 0x8a, 0xa1, 0x7b, 0x4f, - 0x63, 0xf1, 0x75, 0xd3 -}; - - -static uint8_t test_case4_hmac_sha1_key[25] = { - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x19 -}; -static uint8_t test_case4_hmac_sha1_data[50] = { - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd -}; -static uint8_t test_case4_hmac_sha1_result[20] = { - 0x4c, 0x90, 0x07, 0xf4, 0x02, 0x62, 0x50, 0xc6, - 0xbc, 0x84, 0x14, 0xf9, 0xbf, 0x50, 0xc8, 0x6c, - 0x2d, 0x72, 0x35, 0xda -}; - - -static uint8_t test_case5_hmac_sha1_key[20] = { - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c -}; -static uint8_t test_case5_hmac_sha1_data[20] = { - 0x54, 0x65, 0x73, 0x74, 0x20, 0x57, 0x69, 0x74, - 0x68, 0x20, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e -}; -static uint8_t test_case5_hmac_sha1_result[20] = { - 0x4c, 0x1a, 0x03, 0x42, 0x4b, 0x55, 0xe0, 0x7f, - 0xe7, 0xf2, 0x7b, 0xe1, 0xd5, 0x8b, 0xb9, 0x32, - 0x4a, 0x9a, 0x5a, 0x04 -}; - - -static uint8_t test_case6_hmac_sha1_key[80] = { - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa -}; -static uint8_t test_case6_hmac_sha1_data[54] = { - 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x69, - 0x6e, 0x67, 0x20, 0x4c, 0x61, 0x72, 0x67, 0x65, - 0x72, 0x20, 0x54, 0x68, 0x61, 0x6e, 0x20, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x53, 0x69, 0x7a, - 0x65, 0x20, 0x4b, 0x65, 0x79, 0x20, 0x2d, 0x20, - 0x48, 0x61, 0x73, 0x68, 0x20, 0x4b, 0x65, 0x79, - 0x20, 0x46, 0x69, 0x72, 0x73, 0x74 -}; -static uint8_t test_case6_hmac_sha1_result[20] = { - 0xaa, 0x4a, 0xe5, 0xe1, 0x52, 0x72, 0xd0, 0x0e, - 0x95, 0x70, 0x56, 0x37, 0xce, 0x8a, 0x3b, 0x55, - 0xed, 0x40, 0x21, 0x12 -}; - - -static uint8_t test_case7_hmac_sha1_key[80] = { - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa -}; -static uint8_t test_case7_hmac_sha1_data[73] = { - 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x69, - 0x6e, 0x67, 0x20, 0x4c, 0x61, 0x72, 0x67, 0x65, - 0x72, 0x20, 0x54, 0x68, 0x61, 0x6e, 0x20, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x53, 0x69, 0x7a, - 0x65, 0x20, 0x4b, 0x65, 0x79, 0x20, 0x61, 0x6e, - 0x64, 0x20, 0x4c, 0x61, 0x72, 0x67, 0x65, 0x72, - 0x20, 0x54, 0x68, 0x61, 0x6e, 0x20, 0x4f, 0x6e, - 0x65, 0x20, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x2d, - 0x53, 0x69, 0x7a, 0x65, 0x20, 0x44, 0x61, 0x74, - 0x61 -}; -static uint8_t test_case7_hmac_sha1_result[20] = { - 0xe8, 0xe9, 0x9d, 0x0f, 0x45, 0x23, 0x7d, 0x78, - 0x6d, 0x6b, 0xba, 0xa7, 0x96, 0x5c, 0x78, 0x08, - 0xbb, 0xff, 0x1a, 0x91 -}; - - - -/* - * SHA256 Test Vectors - */ - -static uint8_t sha256_msg_8[1] = { - 0xbd -}; - -static uint8_t sha256_MD_8[32] = { - 0x68, 0x32, 0x57, 0x20, 0xaa, 0xbd, 0x7c, 0x82, - 0xf3, 0x0f, 0x55, 0x4b, 0x31, 0x3d, 0x05, 0x70, - 0xc9, 0x5a, 0xcc, 0xbb, 0x7d, 0xc4, 0xb5, 0xaa, - 0xe1, 0x12, 0x04, 0xc0, 0x8f, 0xfe, 0x73, 0x2b -}; - -static uint8_t sha256_msg_128[16] = { - 0xfd, 0xf4, 0x70, 0x09, 0x84, 0xee, 0x11, 0xb7, - 0x0a, 0xf1, 0x88, 0x0d, 0x0e, 0x0f, 0xef, 0xd4 -}; - -static uint8_t sha256_MD_128[32] = { - 0xb0, 0x1a, 0xe1, 0x6e, 0xed, 0x3b, 0x4a, 0x77, - 0x0f, 0x12, 0x7b, 0x98, 0x46, 0x9b, 0xa2, 0x6f, - 0xe3, 0xd8, 0xe9, 0xf5, 0x9d, 0x8a, 0x29, 0x83, - 0x21, 0x4a, 0xfe, 0x6c, 0xff, 0x0e, 0x6b, 0x6c -}; - - -static uint8_t sha256_msg_512[64] = { - 0x35, 0x92, 0xec, 0xfd, 0x1e, 0xac, 0x61, 0x8f, - 0xd3, 0x90, 0xe7, 0xa9, 0xc2, 0x4b, 0x65, 0x65, - 0x32, 0x50, 0x93, 0x67, 0xc2, 0x1a, 0x0e, 0xac, - 0x12, 0x12, 0xac, 0x83, 0xc0, 0xb2, 0x0c, 0xd8, - 0x96, 0xeb, 0x72, 0xb8, 0x01, 0xc4, 0xd2, 0x12, - 0xc5, 0x45, 0x2b, 0xbb, 0xf0, 0x93, 0x17, 0xb5, - 0x0c, 0x5c, 0x9f, 0xb1, 0x99, 0x75, 0x53, 0xd2, - 0xbb, 0xc2, 0x9b, 0xb4, 0x2f, 0x57, 0x48, 0xad -}; - -static uint8_t sha256_MD_512[32] = { - 0x10, 0x5a, 0x60, 0x86, 0x58, 0x30, 0xac, 0x3a, - 0x37, 0x1d, 0x38, 0x43, 0x32, 0x4d, 0x4b, 0xb5, - 0xfa, 0x8e, 0xc0, 0xe0, 0x2d, 0xda, 0xa3, 0x89, - 0xad, 0x8d, 0xa4, 0xf1, 0x02, 0x15, 0xc4, 0x54 -}; - -static uint8_t sha256_msg_2096[262] = { - 0xf6, 0xce, 0x82, 0x21, 0xbf, 0x64, 0x27, 0x3c, - 0x91, 0xc4, 0xcb, 0x41, 0xeb, 0xba, 0x1b, 0xfc, - 0xfa, 0x12, 0xc0, 0x43, 0xc7, 0x01, 0x31, 0x7e, - 0xb0, 0xc0, 0xcb, 0x66, 0x15, 0x7a, 0x23, 0x0c, - 0x53, 0x68, 0x9b, 0x1d, 0xf6, 0x3b, 0x33, 0x65, - 0x2a, 0xba, 0xa2, 0x93, 0x73, 0xac, 0xa6, 0x3c, - 0x9e, 0xf8, 0x98, 0x22, 0xf8, 0x0b, 0x43, 0xb5, - 0xbd, 0x7a, 0xf6, 0xda, 0xd3, 0xe8, 0xd8, 0xec, - 0xb8, 0x2b, 0x7c, 0x00, 0xba, 0xaa, 0xb5, 0x6e, - 0x66, 0x09, 0xac, 0x8d, 0x42, 0x09, 0x2f, 0xbd, - 0xbf, 0xa9, 0x4c, 0xab, 0x69, 0x92, 0x1f, 0xd0, - 0x61, 0xb1, 0xe8, 0x3b, 0x0d, 0x26, 0x60, 0x91, - 0x0e, 0x5d, 0x4e, 0x52, 0x72, 0x7a, 0x55, 0x5d, - 0x2b, 0xfb, 0x10, 0xb7, 0xc0, 0x98, 0x61, 0x88, - 0x43, 0x6e, 0x05, 0x66, 0x83, 0x5d, 0x6c, 0xd6, - 0x82, 0xaf, 0xc8, 0x10, 0x2a, 0xfa, 0x65, 0x03, - 0x3b, 0x47, 0x38, 0x99, 0x88, 0x73, 0xba, 0x3c, - 0x63, 0xd6, 0xf7, 0x99, 0x56, 0x23, 0xe1, 0xa4, - 0x14, 0x8f, 0xeb, 0xdc, 0xae, 0x36, 0xd3, 0xd0, - 0x0a, 0xba, 0xbf, 0xe2, 0x92, 0x2d, 0x8c, 0x4b, - 0x29, 0x31, 0x63, 0x5f, 0x63, 0x5d, 0x8d, 0x12, - 0xf5, 0xe3, 0x88, 0xbc, 0x6a, 0x70, 0x5a, 0x19, - 0x18, 0x54, 0x25, 0x94, 0x53, 0xe3, 0xfc, 0xc5, - 0xe0, 0x1b, 0xf5, 0x38, 0xac, 0x87, 0x7f, 0x70, - 0xbe, 0x62, 0xf6, 0x2b, 0x6b, 0x00, 0x75, 0xe8, - 0xc9, 0x6a, 0xec, 0xa7, 0x66, 0x49, 0x72, 0xf0, - 0x39, 0x05, 0xdc, 0x16, 0xd8, 0x2d, 0x8e, 0xbd, - 0xec, 0x1a, 0x91, 0x9a, 0xe2, 0xcf, 0xe6, 0x7a, - 0xe4, 0x24, 0x1a, 0x86, 0x08, 0x24, 0x1b, 0xc5, - 0xc7, 0xb3, 0x4a, 0xe2, 0xb0, 0x74, 0xd1, 0x30, - 0x5d, 0xe9, 0x37, 0xeb, 0xa7, 0xdc, 0x32, 0xc1, - 0x16, 0xfe, 0xbc, 0x90, 0x9b, 0xcf, 0x68, 0x72, - 0x82, 0xbd, 0xf7, 0xf7, 0xa2, 0x90 -}; - -static uint8_t sha256_MD_2096[32] = { - 0xef, 0xd3, 0x5c, 0x0d, 0x49, 0xe6, 0xa2, 0x2c, - 0x2b, 0x54, 0x59, 0x9a, 0xbb, 0x0d, 0xfa, 0x41, - 0x94, 0x35, 0xa5, 0xb7, 0x49, 0xef, 0x1c, 0x71, - 0x23, 0xd5, 0x9a, 0x2f, 0xb5, 0xdb, 0x8f, 0x75 -}; - - -/* - * HMAC SHA256 Test Vectors from RFC 4231 - */ - -static uint8_t test_case1_hmac_sha2_key[20] = { - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b -}; - -static uint8_t test_case1_hmac_sha2_data[8] = { - 0x48, 0x69, 0x20, 0x54, 0x68, 0x65, 0x72, 0x65 -}; -static uint8_t test_case1_hmac_sha256_result[32] = { - 0xb0, 0x34, 0x4c, 0x61, 0xd8, 0xdb, 0x38, 0x53, - 0x5c, 0xa8, 0xaf, 0xce, 0xaf, 0x0b, 0xf1, 0x2b, - 0x88, 0x1d, 0xc2, 0x00, 0xc9, 0x83, 0x3d, 0xa7, - 0x26, 0xe9, 0x37, 0x6c, 0x2e, 0x32, 0xcf, 0xf7 -}; -static uint8_t test_case1_hmac_sha384_result[48] = { - 0xaf, 0xd0, 0x39, 0x44, 0xd8, 0x48, 0x95, 0x62, - 0x6b, 0x08, 0x25, 0xf4, 0xab, 0x46, 0x90, 0x7f, - 0x15, 0xf9, 0xda, 0xdb, 0xe4, 0x10, 0x1e, 0xc6, - 0x82, 0xaa, 0x03, 0x4c, 0x7c, 0xeb, 0xc5, 0x9c, - 0xfa, 0xea, 0x9e, 0xa9, 0x07, 0x6e, 0xde, 0x7f, - 0x4a, 0xf1, 0x52, 0xe8, 0xb2, 0xfa, 0x9c, 0xb6 -}; - - -static uint8_t test_case2_hmac_sha2_key[4] = { - 0x4a, 0x65, 0x66, 0x65 -}; -static uint8_t test_case2_hmac_sha2_data[28] = { - 0x77, 0x68, 0x61, 0x74, 0x20, 0x64, 0x6f, 0x20, - 0x79, 0x61, 0x20, 0x77, 0x61, 0x6e, 0x74, 0x20, - 0x66, 0x6f, 0x72, 0x20, 0x6e, 0x6f, 0x74, 0x68, - 0x69, 0x6e, 0x67, 0x3f -}; -static uint8_t test_case2_hmac_sha256_result[32] = { - 0x5b, 0xdc, 0xc1, 0x46, 0xbf, 0x60, 0x75, 0x4e, - 0x6a, 0x04, 0x24, 0x26, 0x08, 0x95, 0x75, 0xc7, - 0x5a, 0x00, 0x3f, 0x08, 0x9d, 0x27, 0x39, 0x83, - 0x9d, 0xec, 0x58, 0xb9, 0x64, 0xec, 0x38, 0x43 -}; -static uint8_t test_case2_hmac_sha384_result[48] = { - 0xaf, 0x45, 0xd2, 0xe3, 0x76, 0x48, 0x40, 0x31, - 0x61, 0x7f, 0x78, 0xd2, 0xb5, 0x8a, 0x6b, 0x1b, - 0x9c, 0x7e, 0xf4, 0x64, 0xf5, 0xa0, 0x1b, 0x47, - 0xe4, 0x2e, 0xc3, 0x73, 0x63, 0x22, 0x44, 0x5e, - 0x8e, 0x22, 0x40, 0xca, 0x5e, 0x69, 0xe2, 0xc7, - 0x8b, 0x32, 0x39, 0xec, 0xfa, 0xb2, 0x16, 0x49 -}; - - -static uint8_t test_case3_hmac_sha2_key[20] = { - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa -}; -static uint8_t test_case3_hmac_sha2_data[50] = { - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, 0xdd, - 0xdd, 0xdd -}; -static uint8_t test_case3_hmac_sha256_result[32] = { - 0x77, 0x3e, 0xa9, 0x1e, 0x36, 0x80, 0x0e, 0x46, - 0x85, 0x4d, 0xb8, 0xeb, 0xd0, 0x91, 0x81, 0xa7, - 0x29, 0x59, 0x09, 0x8b, 0x3e, 0xf8, 0xc1, 0x22, - 0xd9, 0x63, 0x55, 0x14, 0xce, 0xd5, 0x65, 0xfe -}; -static uint8_t test_case3_hmac_sha384_result[48] = { - 0x88, 0x06, 0x26, 0x08, 0xd3, 0xe6, 0xad, 0x8a, - 0x0a, 0xa2, 0xac, 0xe0, 0x14, 0xc8, 0xa8, 0x6f, - 0x0a, 0xa6, 0x35, 0xd9, 0x47, 0xac, 0x9f, 0xeb, - 0xe8, 0x3e, 0xf4, 0xe5, 0x59, 0x66, 0x14, 0x4b, - 0x2a, 0x5a, 0xb3, 0x9d, 0xc1, 0x38, 0x14, 0xb9, - 0x4e, 0x3a, 0xb6, 0xe1, 0x01, 0xa3, 0x4f, 0x27 -}; - - -static uint8_t test_case4_hmac_sha2_key[25] = { - 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, - 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, - 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, - 0x19 -}; -static uint8_t test_case4_hmac_sha2_data[50] = { - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, 0xcd, - 0xcd, 0xcd -}; -static uint8_t test_case4_hmac_sha256_result[32] = { - 0x82, 0x55, 0x8a, 0x38, 0x9a, 0x44, 0x3c, 0x0e, - 0xa4, 0xcc, 0x81, 0x98, 0x99, 0xf2, 0x08, 0x3a, - 0x85, 0xf0, 0xfa, 0xa3, 0xe5, 0x78, 0xf8, 0x07, - 0x7a, 0x2e, 0x3f, 0xf4, 0x67, 0x29, 0x66, 0x5b -}; -static uint8_t test_case4_hmac_sha384_result[48] = { - 0x3e, 0x8a, 0x69, 0xb7, 0x78, 0x3c, 0x25, 0x85, - 0x19, 0x33, 0xab, 0x62, 0x90, 0xaf, 0x6c, 0xa7, - 0x7a, 0x99, 0x81, 0x48, 0x08, 0x50, 0x00, 0x9c, - 0xc5, 0x57, 0x7c, 0x6e, 0x1f, 0x57, 0x3b, 0x4e, - 0x68, 0x01, 0xdd, 0x23, 0xc4, 0xa7, 0xd6, 0x79, - 0xcc, 0xf8, 0xa3, 0x86, 0xc6, 0x74, 0xcf, 0xfb -}; - - -static uint8_t test_case5_hmac_sha2_key[20] = { - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c -}; -static uint8_t test_case5_hmac_sha2_data[20] = { - 0x54, 0x65, 0x73, 0x74, 0x20, 0x57, 0x69, 0x74, - 0x68, 0x20, 0x54, 0x72, 0x75, 0x6e, 0x63, 0x61, - 0x74, 0x69, 0x6f, 0x6e -}; -static uint8_t test_case5_hmac_sha256_result[16] = { - 0xa3, 0xb6, 0x16, 0x74, 0x73, 0x10, 0x0e, 0xe0, - 0x6e, 0x0c, 0x79, 0x6c, 0x29, 0x55, 0x55, 0x2b -}; -static uint8_t test_case5_hmac_sha384_result[16] = { - 0x3a, 0xbf, 0x34, 0xc3, 0x50, 0x3b, 0x2a, 0x23, - 0xa4, 0x6e, 0xfc, 0x61, 0x9b, 0xae, 0xf8, 0x97 -}; - - -static uint8_t test_case6_hmac_sha2_key[131] = { - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa -}; -static uint8_t test_case6_hmac_sha2_data[54] = { - 0x54, 0x65, 0x73, 0x74, 0x20, 0x55, 0x73, 0x69, - 0x6e, 0x67, 0x20, 0x4c, 0x61, 0x72, 0x67, 0x65, - 0x72, 0x20, 0x54, 0x68, 0x61, 0x6e, 0x20, 0x42, - 0x6c, 0x6f, 0x63, 0x6b, 0x2d, 0x53, 0x69, 0x7a, - 0x65, 0x20, 0x4b, 0x65, 0x79, 0x20, 0x2d, 0x20, - 0x48, 0x61, 0x73, 0x68, 0x20, 0x4b, 0x65, 0x79, - 0x20, 0x46, 0x69, 0x72, 0x73, 0x74 -}; -static uint8_t test_case6_hmac_sha256_result[32] = { - 0x60, 0xe4, 0x31, 0x59, 0x1e, 0xe0, 0xb6, 0x7f, - 0x0d, 0x8a, 0x26, 0xaa, 0xcb, 0xf5, 0xb7, 0x7f, - 0x8e, 0x0b, 0xc6, 0x21, 0x37, 0x28, 0xc5, 0x14, - 0x05, 0x46, 0x04, 0x0f, 0x0e, 0xe3, 0x7f, 0x54 -}; -static uint8_t test_case6_hmac_sha384_result[48] = { - 0x4e, 0xce, 0x08, 0x44, 0x85, 0x81, 0x3e, 0x90, - 0x88, 0xd2, 0xc6, 0x3a, 0x04, 0x1b, 0xc5, 0xb4, - 0x4f, 0x9e, 0xf1, 0x01, 0x2a, 0x2b, 0x58, 0x8f, - 0x3c, 0xd1, 0x1f, 0x05, 0x03, 0x3a, 0xc4, 0xc6, - 0x0c, 0x2e, 0xf6, 0xab, 0x40, 0x30, 0xfe, 0x82, - 0x96, 0x24, 0x8d, 0xf1, 0x63, 0xf4, 0x49, 0x52 -}; - - -static uint8_t test_case7_hmac_sha2_key[131] = { - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, - 0xaa, 0xaa, 0xaa -}; - -static uint8_t test_case7_hmac_sha2_data[152] = { - 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, - 0x61, 0x20, 0x74, 0x65, 0x73, 0x74, 0x20, 0x75, - 0x73, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x6c, - 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, 0x68, - 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63, 0x6b, - 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x6b, 0x65, - 0x79, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x61, 0x20, - 0x6c, 0x61, 0x72, 0x67, 0x65, 0x72, 0x20, 0x74, - 0x68, 0x61, 0x6e, 0x20, 0x62, 0x6c, 0x6f, 0x63, - 0x6b, 0x2d, 0x73, 0x69, 0x7a, 0x65, 0x20, 0x64, - 0x61, 0x74, 0x61, 0x2e, 0x20, 0x54, 0x68, 0x65, - 0x20, 0x6b, 0x65, 0x79, 0x20, 0x6e, 0x65, 0x65, - 0x64, 0x73, 0x20, 0x74, 0x6f, 0x20, 0x62, 0x65, - 0x20, 0x68, 0x61, 0x73, 0x68, 0x65, 0x64, 0x20, - 0x62, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x20, 0x62, - 0x65, 0x69, 0x6e, 0x67, 0x20, 0x75, 0x73, 0x65, - 0x64, 0x20, 0x62, 0x79, 0x20, 0x74, 0x68, 0x65, - 0x20, 0x48, 0x4d, 0x41, 0x43, 0x20, 0x61, 0x6c, - 0x67, 0x6f, 0x72, 0x69, 0x74, 0x68, 0x6d, 0x2e -}; -static uint8_t test_case7_hmac_sha256_result[32] = { - 0x9b, 0x09, 0xff, 0xa7, 0x1b, 0x94, 0x2f, 0xcb, - 0x27, 0x63, 0x5f, 0xbc, 0xd5, 0xb0, 0xe9, 0x44, - 0xbf, 0xdc, 0x63, 0x64, 0x4f, 0x07, 0x13, 0x93, - 0x8a, 0x7f, 0x51, 0x53, 0x5c, 0x3a, 0x35, 0xe2 -}; -static uint8_t test_case7_hmac_sha384_result[48] = { - 0x66, 0x17, 0x17, 0x8e, 0x94, 0x1f, 0x02, 0x0d, - 0x35, 0x1e, 0x2f, 0x25, 0x4e, 0x8f, 0xd3, 0x2c, - 0x60, 0x24, 0x20, 0xfe, 0xb0, 0xb8, 0xfb, 0x9a, - 0xdc, 0xce, 0xbb, 0x82, 0x46, 0x1e, 0x99, 0xc5, - 0xa6, 0x78, 0xcc, 0x31, 0xe7, 0x99, 0x17, 0x6d, - 0x38, 0x60, 0xe6, 0x11, 0x0c, 0x46, 0x52, 0x3e -}; - - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_sha_test( zrtp_hash_t *self, - const uint8_t *test_vector, - int vector_length, - const uint8_t *test_result, - int test_length) -{ - zrtp_status_t res; - zrtp_string256_t hval = ZSTR_INIT_EMPTY(hval); - - res = self->hash_c(self, (const char*)test_vector, vector_length, (zrtp_stringn_t*)&hval); - if (zrtp_status_ok != res) { - return res; - } - - return (0 == zrtp_memcmp(hval.buffer, test_result, test_length)) ? zrtp_status_ok : zrtp_status_fail; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_hmac_test( zrtp_hash_t *self, - const uint8_t *key, - uint16_t key_length, - const uint8_t *test_vector, - uint16_t vector_length, - const uint8_t *test_result, - int test_length) -{ - zrtp_status_t res; - zrtp_string256_t hval = ZSTR_INIT_EMPTY(hval); - zrtp_string256_t zrtp_key = ZSTR_INIT_EMPTY(zrtp_key); - zrtp_string256_t zrtp_test_vector = ZSTR_INIT_EMPTY(zrtp_test_vector); - - zrtp_zstrncpyc(ZSTR_GV(zrtp_key), (const char*)key, key_length); - zrtp_zstrncpyc(ZSTR_GV(zrtp_test_vector), (const char*)test_vector, vector_length); - - res = self->hmac(self, ZSTR_GV(zrtp_key), ZSTR_GV(zrtp_test_vector), ZSTR_GV(hval)); - if (zrtp_status_ok != res) { - return res; - } - - return (0 == zrtp_memcmp(hval.buffer, test_result, test_length)) ? zrtp_status_ok : zrtp_status_fail; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_sha256_self_test(zrtp_hash_t *self) -{ - zrtp_status_t res; - ZRTP_LOG(3, (_ZTU_,"SHA256 Testing\n")); - - ZRTP_LOG(3, (_ZTU_, "\t8-bit test... ")); - res = zrtp_sha_test(self, sha256_msg_8, sizeof(sha256_msg_8), sha256_MD_8, sizeof(sha256_MD_8)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t128-bit test... ")); - res = zrtp_sha_test(self, sha256_msg_128, sizeof(sha256_msg_128), sha256_MD_128, sizeof(sha256_MD_128)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t512-bit test... ")); - res = zrtp_sha_test(self, sha256_msg_512, sizeof(sha256_msg_512), sha256_MD_512, sizeof(sha256_MD_512)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t2096-bit test... ")); - res = zrtp_sha_test(self, sha256_msg_2096, sizeof(sha256_msg_2096), sha256_MD_2096, sizeof(sha256_MD_2096)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - return res; -} - -zrtp_status_t zrtp_sha384_self_test(zrtp_hash_t *self) -{ - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_hmac_sha256_self_test(zrtp_hash_t *self) -{ - zrtp_status_t res; - ZRTP_LOG(3, (_ZTU_,"HMAC SHA256 Testing\n")); - - ZRTP_LOG(3, (_ZTU_, "\t1 case test... ")); - res = zrtp_hmac_test( self, - test_case1_hmac_sha2_key, - sizeof(test_case1_hmac_sha2_key), - test_case1_hmac_sha2_data, - sizeof(test_case1_hmac_sha2_data), - test_case1_hmac_sha256_result, - sizeof(test_case1_hmac_sha256_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t2 case test... ")); - res = zrtp_hmac_test( self, - test_case2_hmac_sha2_key, - sizeof(test_case2_hmac_sha2_key), - test_case2_hmac_sha2_data, - sizeof(test_case2_hmac_sha2_data), - test_case2_hmac_sha256_result, - sizeof(test_case2_hmac_sha256_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t3 case test... ")); - res = zrtp_hmac_test( self, - test_case3_hmac_sha2_key, - sizeof(test_case3_hmac_sha2_key), - test_case3_hmac_sha2_data, - sizeof(test_case3_hmac_sha2_data), - test_case3_hmac_sha256_result, - sizeof(test_case3_hmac_sha256_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t4 case test... ")); - res = zrtp_hmac_test(self, - test_case4_hmac_sha2_key, - sizeof(test_case4_hmac_sha2_key), - test_case4_hmac_sha2_data, - sizeof(test_case4_hmac_sha2_data), - test_case4_hmac_sha256_result, - sizeof(test_case4_hmac_sha256_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t5 case test...")); - res = zrtp_hmac_test(self, - test_case5_hmac_sha2_key, - sizeof(test_case5_hmac_sha2_key), - test_case5_hmac_sha2_data, - sizeof(test_case5_hmac_sha2_data), - test_case5_hmac_sha256_result, - sizeof(test_case5_hmac_sha256_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t6 case test... ")); - res = zrtp_hmac_test(self, - test_case6_hmac_sha2_key, - sizeof(test_case6_hmac_sha2_key), - test_case6_hmac_sha2_data, - sizeof(test_case6_hmac_sha2_data), - test_case6_hmac_sha256_result, - sizeof(test_case6_hmac_sha256_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t7 case test...")); - res = zrtp_hmac_test(self, - test_case7_hmac_sha2_key, - sizeof(test_case7_hmac_sha2_key), - test_case7_hmac_sha2_data, - sizeof(test_case7_hmac_sha2_data), - test_case7_hmac_sha256_result, - sizeof(test_case7_hmac_sha256_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - return res; -} - -zrtp_status_t zrtp_hmac_sha384_self_test(zrtp_hash_t *self) -{ - zrtp_status_t res; - ZRTP_LOG(3, (_ZTU_,"HMAC SHA384 Testing\n")); - - ZRTP_LOG(3, (_ZTU_, "\t1 case test... ")); - res = zrtp_hmac_test( self, - test_case1_hmac_sha2_key, - sizeof(test_case1_hmac_sha2_key), - test_case1_hmac_sha2_data, - sizeof(test_case1_hmac_sha2_data), - test_case1_hmac_sha384_result, - sizeof(test_case1_hmac_sha384_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t2 case test... ")); - res = zrtp_hmac_test( self, - test_case2_hmac_sha2_key, - sizeof(test_case2_hmac_sha2_key), - test_case2_hmac_sha2_data, - sizeof(test_case2_hmac_sha2_data), - test_case2_hmac_sha384_result, - sizeof(test_case2_hmac_sha384_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t3 case test... ")); - res = zrtp_hmac_test( self, - test_case3_hmac_sha2_key, - sizeof(test_case3_hmac_sha2_key), - test_case3_hmac_sha2_data, - sizeof(test_case3_hmac_sha2_data), - test_case3_hmac_sha384_result, - sizeof(test_case3_hmac_sha384_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t4 case test... ")); - res = zrtp_hmac_test(self, - test_case4_hmac_sha2_key, - sizeof(test_case4_hmac_sha2_key), - test_case4_hmac_sha2_data, - sizeof(test_case4_hmac_sha2_data), - test_case4_hmac_sha384_result, - sizeof(test_case4_hmac_sha384_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t5 case test...")); - res = zrtp_hmac_test(self, - test_case5_hmac_sha2_key, - sizeof(test_case5_hmac_sha2_key), - test_case5_hmac_sha2_data, - sizeof(test_case5_hmac_sha2_data), - test_case5_hmac_sha384_result, - sizeof(test_case5_hmac_sha384_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t6 case test... ")); - res = zrtp_hmac_test(self, - test_case6_hmac_sha2_key, - sizeof(test_case6_hmac_sha2_key), - test_case6_hmac_sha2_data, - sizeof(test_case6_hmac_sha2_data), - test_case6_hmac_sha384_result, - sizeof(test_case6_hmac_sha384_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t7 case test...")); - res = zrtp_hmac_test(self, - test_case7_hmac_sha2_key, - sizeof(test_case7_hmac_sha2_key), - test_case7_hmac_sha2_data, - sizeof(test_case7_hmac_sha2_data), - test_case7_hmac_sha384_result, - sizeof(test_case7_hmac_sha384_result)); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - return res; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_sha1_self_test(zrtp_hash_t *self) -{ - zrtp_status_t res; - ZRTP_LOG(3, (_ZTU_,"SHA1 Testing\n")); - - ZRTP_LOG(3, (_ZTU_, "\t8-bit test... ")); - res = zrtp_sha_test(self, sha1_msg_8, sizeof(sha1_msg_8), sha1_MD_8, ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t128-bit test... ")); - res = zrtp_sha_test(self, sha1_msg_128, sizeof(sha1_msg_128), sha1_MD_128, ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t512-bit test... ")); - res = zrtp_sha_test(self, sha1_msg_512, sizeof(sha1_msg_512), sha1_MD_512, ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t2096-bit test... ")); - res = zrtp_sha_test(self, sha1_msg_2096, sizeof(sha1_msg_2096), sha1_MD_2096, ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - return res; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_hmac_sha1_self_test(zrtp_hash_t *self) -{ - zrtp_status_t res; - ZRTP_LOG(3, (_ZTU_,"HMAC SHA1 Testing\n")); - - ZRTP_LOG(3, (_ZTU_, "\t1 case test... ")); - res = zrtp_hmac_test(self, - test_case1_hmac_sha1_key, - sizeof(test_case1_hmac_sha1_key), - test_case1_hmac_sha1_data, - sizeof(test_case1_hmac_sha1_data), - test_case1_hmac_sha1_result, - ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t2 case test... ")); - res = zrtp_hmac_test(self, - test_case2_hmac_sha1_key, - sizeof(test_case2_hmac_sha1_key), - test_case2_hmac_sha1_data, - sizeof(test_case2_hmac_sha1_data), - test_case2_hmac_sha1_result, - ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t3 case test... ")); - res = zrtp_hmac_test(self, - test_case3_hmac_sha1_key, - sizeof(test_case3_hmac_sha1_key), - test_case3_hmac_sha1_data, - sizeof(test_case3_hmac_sha1_data), - test_case3_hmac_sha1_result, - ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t4 case test... ")); - res = zrtp_hmac_test(self, - test_case4_hmac_sha1_key, - sizeof(test_case4_hmac_sha1_key), - test_case4_hmac_sha1_data, - sizeof(test_case4_hmac_sha1_data), - test_case4_hmac_sha1_result, - ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t5 case test... ")); - res = zrtp_hmac_test(self, - test_case5_hmac_sha1_key, - sizeof(test_case5_hmac_sha1_key), - test_case5_hmac_sha1_data, - sizeof(test_case5_hmac_sha1_data), - test_case5_hmac_sha1_result, - ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t6 case test... ")); - res = zrtp_hmac_test(self, - test_case6_hmac_sha1_key, - sizeof(test_case6_hmac_sha1_key), - test_case6_hmac_sha1_data, - sizeof(test_case6_hmac_sha1_data), - test_case6_hmac_sha1_result, - ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - ZRTP_LOG(3, (_ZTU_, "\t7 case test... ")); - res = zrtp_hmac_test(self, - test_case7_hmac_sha1_key, - sizeof(test_case7_hmac_sha1_key), - test_case7_hmac_sha1_data, - sizeof(test_case7_hmac_sha1_data), - test_case7_hmac_sha1_result, - ZRTP_SRTP_HASH_HMAC_SHA1); - ZRTP_LOGC(3, ("%s\n", zrtp_status_ok == res?"OK":"FALSE")); - - return res; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_defaults_hash(zrtp_global_t* global_ctx) -{ - zrtp_hash_t* hash_sha384 = zrtp_sys_alloc(sizeof(zrtp_hash_t)); - zrtp_hash_t* hash_sha256 = zrtp_sys_alloc(sizeof(zrtp_hash_t)); - zrtp_hash_t* hash_sha1 = zrtp_sys_alloc(sizeof(zrtp_hash_t)); - if (!hash_sha256 || !hash_sha1 || !hash_sha384) { - if (hash_sha384) { - zrtp_sys_free(hash_sha384); - } - if (hash_sha256) { - zrtp_sys_free(hash_sha256); - } - if (hash_sha1) { - zrtp_sys_free(hash_sha1); - } - return zrtp_status_alloc_fail; - } - - zrtp_memset(hash_sha384, 0, sizeof(zrtp_hash_t)); - zrtp_memset(hash_sha256, 0, sizeof(zrtp_hash_t)); - zrtp_memset(hash_sha1, 0, sizeof(zrtp_hash_t)); - - zrtp_memcpy(hash_sha384->base.type, ZRTP_S384, ZRTP_COMP_TYPE_SIZE); - hash_sha384->base.id = ZRTP_HASH_SHA384; - hash_sha384->base.zrtp = global_ctx; - hash_sha384->block_length = SHA384_BLOCK_SIZE; - hash_sha384->digest_length = SHA384_DIGEST_SIZE; - - hash_sha384->hash_begin = zrtp_sha_begin; - hash_sha384->hash_update = zrtp_sha_update; - hash_sha384->hash_end = zrtp_sha_end; - hash_sha384->hash = zrtp_sha; - hash_sha384->hash_c = zrtp_sha_c; - hash_sha384->hash_self_test = zrtp_sha384_self_test; - - hash_sha384->hmac_begin_c = zrtp_hmac_sha384_begin_c; - hash_sha384->hmac_begin = zrtp_hmac_begin; - hash_sha384->hmac_update = zrtp_hmac_update; - hash_sha384->hmac_end = zrtp_hmac_end; - hash_sha384->hmac = zrtp_hmac; - hash_sha384->hmac_c = zrtp_hmac_c; - hash_sha384->hmac_truncated = zrtp_hmac_truncated; - hash_sha384->hmac_truncated_c = zrtp_hmac_truncated_c; - hash_sha384->hmac_self_test = zrtp_hmac_sha384_self_test; - - zrtp_memcpy(hash_sha256->base.type, ZRTP_S256, ZRTP_COMP_TYPE_SIZE); - hash_sha256->base.id = ZRTP_HASH_SHA256; - hash_sha256->base.zrtp = global_ctx; - hash_sha256->block_length = SHA256_BLOCK_SIZE; - hash_sha256->digest_length = SHA256_DIGEST_SIZE; - - hash_sha256->hash_begin = zrtp_sha_begin; - hash_sha256->hash_update = zrtp_sha_update; - hash_sha256->hash_end = zrtp_sha_end; - hash_sha256->hash = zrtp_sha; - hash_sha256->hash_c = zrtp_sha_c; - hash_sha256->hash_self_test = zrtp_sha256_self_test; - - hash_sha256->hmac_begin_c = zrtp_hmac_sha256_begin_c; - hash_sha256->hmac_begin = zrtp_hmac_begin; - hash_sha256->hmac_update = zrtp_hmac_update; - hash_sha256->hmac_end = zrtp_hmac_end; - hash_sha256->hmac = zrtp_hmac; - hash_sha256->hmac_c = zrtp_hmac_c; - hash_sha256->hmac_truncated = zrtp_hmac_truncated; - hash_sha256->hmac_truncated_c = zrtp_hmac_truncated_c; - hash_sha256->hmac_self_test = zrtp_hmac_sha256_self_test; - - - zrtp_memcpy(hash_sha1->base.type, ZRTP_S160, ZRTP_COMP_TYPE_SIZE); - hash_sha1->base.id = ZRTP_SRTP_HASH_HMAC_SHA1; - hash_sha1->base.zrtp = global_ctx; - hash_sha1->block_length = SHA1_BLOCK_SIZE; - hash_sha1->digest_length = SHA1_DIGEST_SIZE; - - hash_sha1->hash_begin = zrtp_sha_begin; - hash_sha1->hash_update = zrtp_sha_update; - hash_sha1->hash_end = zrtp_sha_end; - hash_sha1->hash = zrtp_sha; - hash_sha1->hash_c = zrtp_sha_c; - hash_sha1->hash_self_test = zrtp_sha1_self_test; - - hash_sha1->hmac_begin_c = zrtp_hmac_sha1_begin_c; - hash_sha1->hmac_begin = zrtp_hmac_begin; - hash_sha1->hmac_update = zrtp_hmac_update; - hash_sha1->hmac_end = zrtp_hmac_end; - hash_sha1->hmac = zrtp_hmac; - hash_sha1->hmac_c = zrtp_hmac_c; - hash_sha1->hmac_truncated = zrtp_hmac_truncated; - hash_sha1->hmac_truncated_c = zrtp_hmac_truncated_c; - hash_sha1->hmac_self_test = zrtp_hmac_sha1_self_test; - - zrtp_comp_register(ZRTP_CC_HASH, hash_sha384, global_ctx); - zrtp_comp_register(ZRTP_CC_HASH, hash_sha256, global_ctx); - zrtp_comp_register(ZRTP_CC_HASH, hash_sha1, global_ctx); - - return zrtp_status_ok; -} diff --git a/libs/libzrtp/src/zrtp_crypto_pk.c b/libs/libzrtp/src/zrtp_crypto_pk.c deleted file mode 100644 index 4130d6cbed..0000000000 --- a/libs/libzrtp/src/zrtp_crypto_pk.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp dh" - -/*============================================================================*/ -/* Global DH Functions */ -/*============================================================================*/ - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_dh_init(void *s) -{ - struct BigNum* p = NULL; - struct BigNum* p_1 = NULL; - uint8_t* p_data = NULL; - unsigned int p_data_length = 0; - zrtp_pk_scheme_t *self = (zrtp_pk_scheme_t *) s; - - switch (self->base.id) { - case ZRTP_PKTYPE_DH2048: - p = &self->base.zrtp->P_2048; - p_1 = &self->base.zrtp->P_2048_1; - p_data = self->base.zrtp->P_2048_data; - p_data_length = sizeof(self->base.zrtp->P_2048_data); - break; - case ZRTP_PKTYPE_DH3072: - p = &self->base.zrtp->P_3072; - p_1 = &self->base.zrtp->P_3072_1; - p_data = self->base.zrtp->P_3072_data; - p_data_length = sizeof(self->base.zrtp->P_3072_data); - break; - default: - return zrtp_status_bad_param; - } - - bnBegin(p); - bnInsertBigBytes(p, (const unsigned char *)p_data, 0, p_data_length); - - bnBegin(p_1); - bnCopy(p_1, p); - bnSub(p_1, &self->base.zrtp->one); - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_dh_free(void *s) -{ - zrtp_pk_scheme_t *self = (zrtp_pk_scheme_t *) s; - switch (self->base.id) { - case ZRTP_PKTYPE_DH2048: - bnEnd(&self->base.zrtp->P_2048); - bnEnd(&self->base.zrtp->P_2048_1); - break; - case ZRTP_PKTYPE_DH3072: - bnEnd(&self->base.zrtp->P_3072); - bnEnd(&self->base.zrtp->P_3072_1); - break; - default: - return zrtp_status_bad_param; - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static struct BigNum* _zrtp_get_p(zrtp_pk_scheme_t *self) -{ - struct BigNum* p = NULL; - switch (self->base.id) { - case ZRTP_PKTYPE_DH2048: - p = &self->base.zrtp->P_2048; - break; - case ZRTP_PKTYPE_DH3072: - p = &self->base.zrtp->P_3072; - break; - default: - break; - } - - return p; -} - -static zrtp_status_t zrtp_dh_initialize( zrtp_pk_scheme_t *self, - zrtp_dh_crypto_context_t *dh_cc) -{ - unsigned char* buffer = zrtp_sys_alloc(sizeof(zrtp_uchar128_t)); - struct BigNum* p = _zrtp_get_p(self); - zrtp_time_t start_ts = zrtp_time_now(); - - ZRTP_LOG(1,(_ZTU_,"\tDH TEST: %.4s zrtp_dh_initialize() START. now=%llums.\n", self->base.type, start_ts)); - - if (!buffer) { - return zrtp_status_alloc_fail; - } - if (!p) { - zrtp_sys_free(buffer); - return zrtp_status_bad_param; - } - - if (64 != zrtp_randstr(self->base.zrtp, buffer, 64)) { - zrtp_sys_free(buffer); - return zrtp_status_rng_fail; - } - - bnBegin(&dh_cc->sv); - bnInsertBigBytes(&dh_cc->sv, (const unsigned char *)buffer, 0, self->sv_length); - bnBegin(&dh_cc->pv); - bnExpMod(&dh_cc->pv, &self->base.zrtp->G, &dh_cc->sv, p); - - zrtp_sys_free(buffer); - - ZRTP_LOG(1,(_ZTU_,"\tDH TEST: zrtp_dh_initialize() for %.4s was executed ts=%llums d=%llums.\n", self->base.type, zrtp_time_now(), zrtp_time_now()-start_ts)); - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_dh_compute( zrtp_pk_scheme_t *self, - zrtp_dh_crypto_context_t *dh_cc, - struct BigNum *dhresult, - struct BigNum *pv) -{ - struct BigNum* p = _zrtp_get_p(self); - zrtp_time_t start_ts = zrtp_time_now(); - if (!p) { - return zrtp_status_bad_param; - } - - ZRTP_LOG(1,(_ZTU_,"\tDH TEST: %.4s zrtp_dh_compute() START. now=%llums.\n", self->base.type, start_ts)); - - bnExpMod(dhresult, pv, &dh_cc->sv, p); - ZRTP_LOG(1,(_ZTU_,"\tDH TEST: zrtp_dh_compute() for %.4s was executed ts=%llums d=%llums.\n", self->base.type, zrtp_time_now(), zrtp_time_now()-start_ts)); - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_dh_validate(zrtp_pk_scheme_t *self, struct BigNum *pv) -{ - struct BigNum* p = _zrtp_get_p(self); - if (!p) { - return zrtp_status_bad_param; - } - - if (!pv || 0 == bnCmp(pv, &self->base.zrtp->one) || 0 == bnCmp(pv, p)) { - return zrtp_status_fail; - } else { - return zrtp_status_ok; - } -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t zrtp_dh_self_test(zrtp_pk_scheme_t *self) -{ - zrtp_status_t s = zrtp_status_ok; - zrtp_dh_crypto_context_t alice_cc; - zrtp_dh_crypto_context_t bob_cc; - struct BigNum alice_k; - struct BigNum bob_k; - zrtp_time_t start_ts = zrtp_time_now(); - - ZRTP_LOG(3, (_ZTU_, "PKS %.4s testing... ", self->base.type)); - - bnBegin(&alice_k); - bnBegin(&bob_k); - - do { - /* Both sides initalise DH schemes and compute secret and public values. */ - s = self->initialize(self, &alice_cc); - if (zrtp_status_ok != s) { - break; - } - s = self->initialize(self, &bob_cc); - if (zrtp_status_ok != s) { - break; - } - - /* Both sides validate public values. (to provide exact performance estimation) */ - s = self->validate(self, &bob_cc.pv); - if (zrtp_status_ok != s) { - break; - } - s = self->validate(self, &alice_cc.pv); - if (zrtp_status_ok != s) { - break; - } - - /* Compute secret keys and compare them. */ - s = self->compute(self, &alice_cc, &alice_k, &bob_cc.pv); - if (zrtp_status_ok != s) { - break; - } - s= self->compute(self, &bob_cc, &bob_k, &alice_cc.pv); - if (zrtp_status_ok != s) { - break; - } - - s = (0 == bnCmp(&alice_k, &bob_k)) ? zrtp_status_ok : zrtp_status_algo_fail; - } while (0); - - bnEnd(&alice_k); - bnEnd(&bob_k); - - ZRTP_LOGC(3, ("%s (%llu ms)\n", zrtp_log_status2str(s), (zrtp_time_now()-start_ts)/2)); - - return s; -} - -/*----------------------------------------------------------------------------*/ -extern zrtp_status_t zrtp_defaults_ec_pkt(zrtp_global_t* zrtp); - -zrtp_status_t zrtp_defaults_pkt(zrtp_global_t* zrtp) -{ - zrtp_pk_scheme_t* presh = zrtp_sys_alloc(sizeof(zrtp_pk_scheme_t)); - zrtp_pk_scheme_t* dh2048 = zrtp_sys_alloc(sizeof(zrtp_pk_scheme_t)); - zrtp_pk_scheme_t* dh3072 = zrtp_sys_alloc(sizeof(zrtp_pk_scheme_t)); - zrtp_pk_scheme_t* multi = zrtp_sys_alloc(sizeof(zrtp_pk_scheme_t)); - - uint8_t P_2048_data[] = - { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34, - 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, - 0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD, - 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37, - 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, - 0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED, - 0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5, 0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6, - 0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D, 0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05, - 0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A, 0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F, - 0x83, 0x65, 0x5D, 0x23, 0xDC, 0xA3, 0xAD, 0x96, 0x1C, 0x62, 0xF3, 0x56, 0x20, 0x85, 0x52, 0xBB, - 0x9E, 0xD5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6D, 0x67, 0x0C, 0x35, 0x4E, 0x4A, 0xBC, 0x98, 0x04, - 0xF1, 0x74, 0x6C, 0x08, 0xCA, 0x18, 0x21, 0x7C, 0x32, 0x90, 0x5E, 0x46, 0x2E, 0x36, 0xCE, 0x3B, - 0xE3, 0x9E, 0x77, 0x2C, 0x18, 0x0E, 0x86, 0x03, 0x9B, 0x27, 0x83, 0xA2, 0xEC, 0x07, 0xA2, 0x8F, - 0xB5, 0xC5, 0x5D, 0xF0, 0x6F, 0x4C, 0x52, 0xC9, 0xDE, 0x2B, 0xCB, 0xF6, 0x95, 0x58, 0x17, 0x18, - 0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5, 0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10, - 0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAC, 0xAA, 0x68, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - }; - - uint8_t P_3072_data[] = - { - 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xC9, 0x0F, 0xDA, 0xA2, 0x21, 0x68, 0xC2, 0x34, - 0xC4, 0xC6, 0x62, 0x8B, 0x80, 0xDC, 0x1C, 0xD1, 0x29, 0x02, 0x4E, 0x08, 0x8A, 0x67, 0xCC, 0x74, - 0x02, 0x0B, 0xBE, 0xA6, 0x3B, 0x13, 0x9B, 0x22, 0x51, 0x4A, 0x08, 0x79, 0x8E, 0x34, 0x04, 0xDD, - 0xEF, 0x95, 0x19, 0xB3, 0xCD, 0x3A, 0x43, 0x1B, 0x30, 0x2B, 0x0A, 0x6D, 0xF2, 0x5F, 0x14, 0x37, - 0x4F, 0xE1, 0x35, 0x6D, 0x6D, 0x51, 0xC2, 0x45, 0xE4, 0x85, 0xB5, 0x76, 0x62, 0x5E, 0x7E, 0xC6, - 0xF4, 0x4C, 0x42, 0xE9, 0xA6, 0x37, 0xED, 0x6B, 0x0B, 0xFF, 0x5C, 0xB6, 0xF4, 0x06, 0xB7, 0xED, - 0xEE, 0x38, 0x6B, 0xFB, 0x5A, 0x89, 0x9F, 0xA5, 0xAE, 0x9F, 0x24, 0x11, 0x7C, 0x4B, 0x1F, 0xE6, - 0x49, 0x28, 0x66, 0x51, 0xEC, 0xE4, 0x5B, 0x3D, 0xC2, 0x00, 0x7C, 0xB8, 0xA1, 0x63, 0xBF, 0x05, - 0x98, 0xDA, 0x48, 0x36, 0x1C, 0x55, 0xD3, 0x9A, 0x69, 0x16, 0x3F, 0xA8, 0xFD, 0x24, 0xCF, 0x5F, - 0x83, 0x65, 0x5D, 0x23, 0xDC, 0xA3, 0xAD, 0x96, 0x1C, 0x62, 0xF3, 0x56, 0x20, 0x85, 0x52, 0xBB, - 0x9E, 0xD5, 0x29, 0x07, 0x70, 0x96, 0x96, 0x6D, 0x67, 0x0C, 0x35, 0x4E, 0x4A, 0xBC, 0x98, 0x04, - 0xF1, 0x74, 0x6C, 0x08, 0xCA, 0x18, 0x21, 0x7C, 0x32, 0x90, 0x5E, 0x46, 0x2E, 0x36, 0xCE, 0x3B, - 0xE3, 0x9E, 0x77, 0x2C, 0x18, 0x0E, 0x86, 0x03, 0x9B, 0x27, 0x83, 0xA2, 0xEC, 0x07, 0xA2, 0x8F, - 0xB5, 0xC5, 0x5D, 0xF0, 0x6F, 0x4C, 0x52, 0xC9, 0xDE, 0x2B, 0xCB, 0xF6, 0x95, 0x58, 0x17, 0x18, - 0x39, 0x95, 0x49, 0x7C, 0xEA, 0x95, 0x6A, 0xE5, 0x15, 0xD2, 0x26, 0x18, 0x98, 0xFA, 0x05, 0x10, - 0x15, 0x72, 0x8E, 0x5A, 0x8A, 0xAA, 0xC4, 0x2D, 0xAD, 0x33, 0x17, 0x0D, 0x04, 0x50, 0x7A, 0x33, - 0xA8, 0x55, 0x21, 0xAB, 0xDF, 0x1C, 0xBA, 0x64, 0xEC, 0xFB, 0x85, 0x04, 0x58, 0xDB, 0xEF, 0x0A, - 0x8A, 0xEA, 0x71, 0x57, 0x5D, 0x06, 0x0C, 0x7D, 0xB3, 0x97, 0x0F, 0x85, 0xA6, 0xE1, 0xE4, 0xC7, - 0xAB, 0xF5, 0xAE, 0x8C, 0xDB, 0x09, 0x33, 0xD7, 0x1E, 0x8C, 0x94, 0xE0, 0x4A, 0x25, 0x61, 0x9D, - 0xCE, 0xE3, 0xD2, 0x26, 0x1A, 0xD2, 0xEE, 0x6B, 0xF1, 0x2F, 0xFA, 0x06, 0xD9, 0x8A, 0x08, 0x64, - 0xD8, 0x76, 0x02, 0x73, 0x3E, 0xC8, 0x6A, 0x64, 0x52, 0x1F, 0x2B, 0x18, 0x17, 0x7B, 0x20, 0x0C, - 0xBB, 0xE1, 0x17, 0x57, 0x7A, 0x61, 0x5D, 0x6C, 0x77, 0x09, 0x88, 0xC0, 0xBA, 0xD9, 0x46, 0xE2, - 0x08, 0xE2, 0x4F, 0xA0, 0x74, 0xE5, 0xAB, 0x31, 0x43, 0xDB, 0x5B, 0xFC, 0xE0, 0xFD, 0x10, 0x8E, - 0x4B, 0x82, 0xD1, 0x20, 0xA9, 0x3A, 0xD2, 0xCA, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF - }; - - if (!dh2048 || !dh3072 || !presh || !multi) { - if (presh) { - zrtp_sys_free(presh); - } - if (dh2048) { - zrtp_sys_free(dh2048); - } - if (dh3072) { - zrtp_sys_free(dh3072); - } - if (multi) { - zrtp_sys_free(multi); - } - return zrtp_status_alloc_fail; - } - - zrtp_memset(dh3072, 0, sizeof(zrtp_pk_scheme_t)); - zrtp_memcpy(dh3072->base.type, ZRTP_DH3K, ZRTP_COMP_TYPE_SIZE); - dh3072->base.id = ZRTP_PKTYPE_DH3072; - dh3072->base.zrtp = zrtp; - dh3072->sv_length = 256/8; - dh3072->pv_length = 384; - dh3072->base.init = zrtp_dh_init; - dh3072->base.free = zrtp_dh_free; - dh3072->initialize = zrtp_dh_initialize; - dh3072->compute = zrtp_dh_compute; - dh3072->validate = zrtp_dh_validate; - dh3072->self_test = zrtp_dh_self_test; - zrtp_memcpy(zrtp->P_3072_data, P_3072_data, sizeof(P_3072_data)); - zrtp_comp_register(ZRTP_CC_PKT, dh3072, zrtp); - - zrtp_memset(dh2048, 0, sizeof(zrtp_pk_scheme_t)); - zrtp_memcpy(dh2048->base.type, ZRTP_DH2K, ZRTP_COMP_TYPE_SIZE); - dh2048->base.id = ZRTP_PKTYPE_DH2048; - dh2048->base.zrtp = zrtp; - dh2048->sv_length = 256/8; - dh2048->pv_length = 256; - dh2048->base.init = zrtp_dh_init; - dh2048->base.free = zrtp_dh_free; - dh2048->initialize = zrtp_dh_initialize; - dh2048->compute = zrtp_dh_compute; - dh2048->validate = zrtp_dh_validate; - dh2048->self_test = zrtp_dh_self_test; - zrtp_memcpy(zrtp->P_2048_data, P_2048_data, sizeof(P_2048_data)); - zrtp_comp_register(ZRTP_CC_PKT, dh2048, zrtp); - - zrtp_memset(multi, 0, sizeof(zrtp_pk_scheme_t)); - zrtp_memcpy(multi->base.type, ZRTP_MULT, ZRTP_COMP_TYPE_SIZE); - multi->base.id = ZRTP_PKTYPE_MULT; - zrtp_comp_register(ZRTP_CC_PKT, multi, zrtp); - - zrtp_memset(presh, 0, sizeof(zrtp_pk_scheme_t)); - zrtp_memcpy(presh->base.type, ZRTP_PRESHARED, ZRTP_COMP_TYPE_SIZE); - presh->base.id = ZRTP_PKTYPE_PRESH; - zrtp_comp_register(ZRTP_CC_PKT, presh, zrtp); - - return zrtp_defaults_ec_pkt(zrtp); -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_prepare_pkt(zrtp_global_t* zrtp) -{ - bnInit(); - bnBegin(&zrtp->one); - bnSetQ(&zrtp->one, 1); - bnBegin(&zrtp->G); - bnSetQ(&zrtp->G, 2); - - return zrtp_status_ok; -} - -zrtp_status_t zrtp_done_pkt(zrtp_global_t* zrtp) -{ - bnEnd(&zrtp->one); - bnEnd(&zrtp->G); - - return zrtp_status_ok; -} diff --git a/libs/libzrtp/src/zrtp_crypto_sas.c b/libs/libzrtp/src/zrtp_crypto_sas.c deleted file mode 100644 index 93fc851dee..0000000000 --- a/libs/libzrtp/src/zrtp_crypto_sas.c +++ /dev/null @@ -1,745 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -/* These 3-syllable words are no longer than 11 characters. */ -extern uint8_t hash_word_list_odd[256][12]; - -/* These 2-syllable words are no longer than 9 characters. */ -extern uint8_t hash_word_list_even[256][10]; - -/*----------------------------------------------------------------------------*/ -/* - * copyright 2002, 2003 Bryce "Zooko" Wilcox-O'Hearn - * mailto:zooko@zooko.com - * - * See the end of this file for the free software, open source license (BSD-style). - */ - -/** - * Copyright (c) 2002 Bryce "Zooko" Wilcox-O'Hearn - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software to deal in this software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of this software, and to permit - * persons to whom this 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 this software. - * - * THIS 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 THIS SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THIS SOFTWARE. - */ - -zrtp_status_t b2a(zrtp_stringn_t *os, zrtp_stringn_t *result) -{ - static const char chars[]="ybndrfg8ejkmcpqxot1uwisza345h769"; - - if (!os || !result) { - return zrtp_status_bad_param; - } else { - /* pointer into the os buffer, initially pointing to the "one-past-the-end" octet */ - const uint8_t* osp = (uint8_t*)os->buffer + os->length; - /* pointer into the result buffer, initially pointing to the "one-past-the-end" quintet */ - uint8_t* resp; - /* to hold up to 32 bits worth of the input */ - uint32_t x = 0; - - result->length = os->length*8; - result->length = (result->length % 5) ? ((result->length/5) + 1) : result->length/5; - - /* pointer into the result buffer, initially pointing to the "one-past-the-end" quintet */ - resp = (uint8_t*)result->buffer + result->length; - - /* Now this is a real live Duff's device. You gotta love it. */ - switch ((osp - (uint8_t*)os->buffer) % 5) { - case 0: - do { - x = *--osp; - *--resp = chars[x % 32]; /* The least sig 5 bits go into the final quintet. */ - x /= 32; /* ... now we have 3 bits worth in x... */ - case 4: - x |= ((uint32_t)(*--osp)) << 3; /* ... now we have 11 bits worth in x... */ - *--resp = chars[x % 32]; - x /= 32; /* ... now we have 6 bits worth in x... */ - *--resp = chars[x % 32]; - x /= 32; /* ... now we have 1 bits worth in x... */ - case 3: - /* The 8 bits from the 2-indexed octet. So now we have 9 bits worth in x... */ - x |= ((uint32_t)(*--osp)) << 1; - *--resp = chars[x % 32]; - x /= 32; /* ... now we have 4 bits worth in x... */ - case 2: - /* The 8 bits from the 1-indexed octet. So now we have 12 bits worth in x... */ - x |= ((uint32_t)(*--osp)) << 4; - *--resp = chars[x%32]; - x /= 32; /* ... now we have 7 bits worth in x... */ - *--resp = chars[x%32]; - x /= 32; /* ... now we have 2 bits worth in x... */ - case 1: - /* The 8 bits from the 0-indexed octet. So now we have 10 bits worth in x... */ - x |= ((uint32_t)(*--osp)) << 2; - *--resp = chars[x%32]; - x /= 32; /* ... now we have 5 bits worth in x... */ - *--resp = chars[x]; - } while (osp > (const uint8_t *)os->buffer); - } /* switch ((osp - os.buf) % 5) */ - - return zrtp_status_ok; - } -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t SAS32_compute( zrtp_sas_scheme_t *self, - zrtp_stream_t *stream, - zrtp_hash_t *hash, - uint8_t is_transferred ) -{ - zrtp_session_t *session = stream->session; - static const zrtp_string16_t sas_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_SAS_STR); - - zrtp_string64_t sas_digest = ZSTR_INIT_EMPTY(sas_digest); - zrtp_string8_t vad = ZSTR_INIT_EMPTY(vad); - - ZSTR_SET_EMPTY(session->sas1); - ZSTR_SET_EMPTY(session->sas2); - - if (!is_transferred && !stream->protocol) { - return zrtp_status_bad_param; - } - - /* - * Generate SAS source as: - * sashash = KDF(ZRTPSess, "SAS", (ZIDi | ZIDr), 256) - */ - if (!is_transferred) { - _zrtp_kdf( stream, - ZSTR_GV(stream->protocol->cc->s0), - ZSTR_GV(sas_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - ZRTP_HASH_SIZE, - ZSTR_GV(sas_digest)); - - - /* Binary sas value is the leftmost ZRTP_SAS_DIGEST_LENGTH bytes */ - zrtp_zstrncpy(ZSTR_GV(session->sasbin), ZSTR_GV(sas_digest), ZRTP_SAS_DIGEST_LENGTH); - } else { - zrtp_zstrcpy(ZSTR_GV(sas_digest), ZSTR_GV(session->sasbin)); - } - - /* Take the leftmost 20 bits from sas source and render bas32 value */ - sas_digest.length = 3; - sas_digest.buffer[2] &= 0xF0; - if (zrtp_status_ok == b2a(ZSTR_GV(sas_digest), ZSTR_GV(vad)) && vad.length >= 4) { - zrtp_zstrncpy(ZSTR_GV(session->sas1), ZSTR_GV(vad), 4); - return zrtp_status_ok; - } - - return zrtp_status_fail; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t SAS256_compute( zrtp_sas_scheme_t *self, - zrtp_stream_t *stream, - zrtp_hash_t *hash, - uint8_t is_transferred ) -{ - zrtp_session_t *session = stream->session; - ZSTR_SET_EMPTY(session->sas1); - ZSTR_SET_EMPTY(session->sas2); - - if (!is_transferred && !stream->protocol) { - return zrtp_status_bad_param; - } - - /* - * Generate SAS source as: - * sashash = KDF(ZRTPSess, "SAS", (ZIDi | ZIDr), 256) - */ - if (!is_transferred) - { - static const zrtp_string16_t sas_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_SAS_STR); - zrtp_string64_t sas_digest = ZSTR_INIT_EMPTY(sas_digest); - - _zrtp_kdf( stream, - ZSTR_GV(stream->protocol->cc->s0), - ZSTR_GV(sas_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - ZRTP_HASH_SIZE, - ZSTR_GV(sas_digest)); - - /* Binary sas value is last ZRTP_SAS_DIGEST_LENGTH bytes */ - zrtp_zstrncpy(ZSTR_GV(session->sasbin), ZSTR_GV(sas_digest), ZRTP_SAS_DIGEST_LENGTH); - } - - zrtp_zstrcpyc(ZSTR_GV(session->sas1), (const char *)hash_word_list_even[(uint8_t)session->sasbin.buffer[0]]); - zrtp_zstrcpyc(ZSTR_GV(session->sas2), (const char *)hash_word_list_odd[(uint8_t)session->sasbin.buffer[1]]); - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_defaults_sas(zrtp_global_t* zrtp) -{ - zrtp_sas_scheme_t* base32 = zrtp_sys_alloc(sizeof(zrtp_sas_scheme_t)); - zrtp_sas_scheme_t* base256 = zrtp_sys_alloc(sizeof(zrtp_sas_scheme_t)); - - if (!base32 || !base256) { - if (base32) { - zrtp_sys_free(base32); - } - if (base256) { - zrtp_sys_free(base256); - } - return zrtp_status_alloc_fail; - } - - zrtp_memset(base32, 0, sizeof(zrtp_sas_scheme_t)); - zrtp_memcpy(base32->base.type, ZRTP_B32, ZRTP_COMP_TYPE_SIZE); - base32->base.id = ZRTP_SAS_BASE32; - base32->base.zrtp = zrtp; - base32->compute = SAS32_compute; - - zrtp_memset(base256, 0, sizeof(zrtp_sas_scheme_t)); - zrtp_memcpy(base256->base.type, ZRTP_B256, ZRTP_COMP_TYPE_SIZE); - base256->base.id = ZRTP_SAS_BASE256; - base256->base.zrtp = zrtp; - base256->compute = SAS256_compute; - - zrtp_comp_register(ZRTP_CC_SAS, base32, zrtp); - zrtp_comp_register(ZRTP_CC_SAS, base256, zrtp); - - return zrtp_status_ok; -} - - -uint8_t hash_word_list_odd[256][12] = { - "adroitness", - "adviser", - "aftermath", - "aggregate", - "alkali", - "almighty", - "amulet", - "amusement", - "antenna", - "applicant", - "Apollo", - "armistice", - "article", - "asteroid", - "Atlantic", - "atmosphere", - "autopsy", - "Babylon", - "backwater", - "barbecue", - "belowground", - "bifocals", - "bodyguard", - "bookseller", - "borderline", - "bottomless", - "Bradbury", - "bravado", - "Brazilian", - "breakaway", - "Burlington", - "businessman", - "butterfat", - "Camelot", - "candidate", - "cannonball", - "Capricorn", - "caravan", - "caretaker", - "celebrate", - "cellulose", - "certify", - "chambermaid", - "Cherokee", - "Chicago", - "clergyman", - "coherence", - "combustion", - "commando", - "company", - "component", - "concurrent", - "confidence", - "conformist", - "congregate", - "consensus", - "consulting", - "corporate", - "corrosion", - "councilman", - "crossover", - "crucifix", - "cumbersome", - "customer", - "Dakota", - "decadence", - "December", - "decimal", - "designing", - "detector", - "detergent", - "determine", - "dictator", - "dinosaur", - "direction", - "disable", - "disbelief", - "disruptive", - "distortion", - "document", - "embezzle", - "enchanting", - "enrollment", - "enterprise", - "equation", - "equipment", - "escapade", - "Eskimo", - "everyday", - "examine", - "existence", - "exodus", - "fascinate", - "filament", - "finicky", - "forever", - "fortitude", - "frequency", - "gadgetry", - "Galveston", - "getaway", - "glossary", - "gossamer", - "graduate", - "gravity", - "guitarist", - "hamburger", - "Hamilton", - "handiwork", - "hazardous", - "headwaters", - "hemisphere", - "hesitate", - "hideaway", - "holiness", - "hurricane", - "hydraulic", - "impartial", - "impetus", - "inception", - "indigo", - "inertia", - "infancy", - "inferno", - "informant", - "insincere", - "insurgent", - "integrate", - "intention", - "inventive", - "Istanbul", - "Jamaica", - "Jupiter", - "leprosy", - "letterhead", - "liberty", - "maritime", - "matchmaker", - "maverick", - "Medusa", - "megaton", - "microscope", - "microwave", - "midsummer", - "millionaire", - "miracle", - "misnomer", - "molasses", - "molecule", - "Montana", - "monument", - "mosquito", - "narrative", - "nebula", - "newsletter", - "Norwegian", - "October", - "Ohio", - "onlooker", - "opulent", - "Orlando", - "outfielder", - "Pacific", - "pandemic", - "Pandora", - "paperweight", - "paragon", - "paragraph", - "paramount", - "passenger", - "pedigree", - "Pegasus", - "penetrate", - "perceptive", - "performance", - "pharmacy", - "phonetic", - "photograph", - "pioneer", - "pocketful", - "politeness", - "positive", - "potato", - "processor", - "provincial", - "proximate", - "puberty", - "publisher", - "pyramid", - "quantity", - "racketeer", - "rebellion", - "recipe", - "recover", - "repellent", - "replica", - "reproduce", - "resistor", - "responsive", - "retraction", - "retrieval", - "retrospect", - "revenue", - "revival", - "revolver", - "sandalwood", - "sardonic", - "Saturday", - "savagery", - "scavenger", - "sensation", - "sociable", - "souvenir", - "specialist", - "speculate", - "stethoscope", - "stupendous", - "supportive", - "surrender", - "suspicious", - "sympathy", - "tambourine", - "telephone", - "therapist", - "tobacco", - "tolerance", - "tomorrow", - "torpedo", - "tradition", - "travesty", - "trombonist", - "truncated", - "typewriter", - "ultimate", - "undaunted", - "underfoot", - "unicorn", - "unify", - "universe", - "unravel", - "upcoming", - "vacancy", - "vagabond", - "vertigo", - "Virginia", - "visitor", - "vocalist", - "voyager", - "warranty", - "Waterloo", - "whimsical", - "Wichita", - "Wilmington", - "Wyoming", - "yesteryear", - "Yucatan" - }; - -uint8_t hash_word_list_even[256][10] = { - "aardvark", - "absurd", - "accrue", - "acme", - "adrift", - "adult", - "afflict", - "ahead", - "aimless", - "Algol", - "allow", - "alone", - "ammo", - "ancient", - "apple", - "artist", - "assume", - "Athens", - "atlas", - "Aztec", - "baboon", - "backfield", - "backward", - "banjo", - "beaming", - "bedlamp", - "beehive", - "beeswax", - "befriend", - "Belfast", - "berserk", - "billiard", - "bison", - "blackjack", - "blockade", - "blowtorch", - "bluebird", - "bombast", - "bookshelf", - "brackish", - "breadline", - "breakup", - "brickyard", - "briefcase", - "Burbank", - "button", - "buzzard", - "cement", - "chairlift", - "chatter", - "checkup", - "chisel", - "choking", - "chopper", - "Christmas", - "clamshell", - "classic", - "classroom", - "cleanup", - "clockwork", - "cobra", - "commence", - "concert", - "cowbell", - "crackdown", - "cranky", - "crowfoot", - "crucial", - "crumpled", - "crusade", - "cubic", - "dashboard", - "deadbolt", - "deckhand", - "dogsled", - "dragnet", - "drainage", - "dreadful", - "drifter", - "dropper", - "drumbeat", - "drunken", - "Dupont", - "dwelling", - "eating", - "edict", - "egghead", - "eightball", - "endorse", - "endow", - "enlist", - "erase", - "escape", - "exceed", - "eyeglass", - "eyetooth", - "facial", - "fallout", - "flagpole", - "flatfoot", - "flytrap", - "fracture", - "framework", - "freedom", - "frighten", - "gazelle", - "Geiger", - "glitter", - "glucose", - "goggles", - "goldfish", - "gremlin", - "guidance", - "hamlet", - "highchair", - "hockey", - "indoors", - "indulge", - "inverse", - "involve", - "island", - "jawbone", - "keyboard", - "kickoff", - "kiwi", - "klaxon", - "locale", - "lockup", - "merit", - "minnow", - "miser", - "Mohawk", - "mural", - "music", - "necklace", - "Neptune", - "newborn", - "nightbird", - "Oakland", - "obtuse", - "offload", - "optic", - "orca", - "payday", - "peachy", - "pheasant", - "physique", - "playhouse", - "Pluto", - "preclude", - "prefer", - "preshrunk", - "printer", - "prowler", - "pupil", - "puppy", - "python", - "quadrant", - "quiver", - "quota", - "ragtime", - "ratchet", - "rebirth", - "reform", - "regain", - "reindeer", - "rematch", - "repay", - "retouch", - "revenge", - "reward", - "rhythm", - "ribcage", - "ringbolt", - "robust", - "rocker", - "ruffled", - "sailboat", - "sawdust", - "scallion", - "scenic", - "scorecard", - "Scotland", - "seabird", - "select", - "sentence", - "shadow", - "shamrock", - "showgirl", - "skullcap", - "skydive", - "slingshot", - "slowdown", - "snapline", - "snapshot", - "snowcap", - "snowslide", - "solo", - "southward", - "soybean", - "spaniel", - "spearhead", - "spellbind", - "spheroid", - "spigot", - "spindle", - "spyglass", - "stagehand", - "stagnate", - "stairway", - "standard", - "stapler", - "steamship", - "sterling", - "stockman", - "stopwatch", - "stormy", - "sugar", - "surmount", - "suspense", - "sweatband", - "swelter", - "tactics", - "talon", - "tapeworm", - "tempest", - "tiger", - "tissue", - "tonic", - "topmost", - "tracker", - "transit", - "trauma", - "treadmill", - "Trojan", - "trouble", - "tumor", - "tunnel", - "tycoon", - "uncut", - "unearth", - "unwind", - "uproot", - "upset", - "upshot", - "vapor", - "village", - "virus", - "Vulcan", - "waffle", - "wallet", - "watchword", - "wayside", - "willow", - "woodlark", - "Zulu" - }; diff --git a/libs/libzrtp/src/zrtp_datatypes.c b/libs/libzrtp/src/zrtp_datatypes.c deleted file mode 100644 index 980fb88a88..0000000000 --- a/libs/libzrtp/src/zrtp_datatypes.c +++ /dev/null @@ -1,124 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -/*---------------------------------------------------------------------------*/ -void zrtp_bitmap_right_shift(uint8_t *x, int width_bytes, int index) -{ - const int base_index = index >> 3; - const int bit_index = index & 7; - int i, from; - uint8_t b; - - if (index > width_bytes*8) { - for(i=0; i < width_bytes; i++) { - x[i] = 0; - } - return; - } - - if (bit_index == 0) { - /* copy each word from left side to right side */ - x[width_bytes-1] = x[width_bytes-1-base_index]; - for (i=width_bytes-1; i > base_index; i--) { - x[i-1] = x[i-1-base_index]; - } - } else { - /* set each word to the OR of the two bit-shifted words */ - for (i = width_bytes; i > base_index; i--) { - from = i-1 - base_index; - b = x[from] << bit_index; - if (from > 0) { - b |= x[from-1] >> (8-bit_index); - } - x[i-1] = b; - } - } - - /* now wrap up the final portion */ - for (i=0; i < base_index; i++) { - x[i] = 0; - } -} - -/*---------------------------------------------------------------------------*/ -void zrtp_bitmap_left_shift(uint8_t *x, int width_bytes, int index) -{ - int i; - const int base_index = index >> 3; - const int bit_index = index & 7; - - if (index > width_bytes*8) { - for(i=0; i < width_bytes; i++) { - x[i] = 0; - } - return; - } - - if (0 == bit_index) { - for (i=0; i < width_bytes - base_index; i++) { - x[i] = x[i+base_index]; - } - } else { - for (i=0; i < width_bytes - base_index - 1; i++) { - x[i] = (x[i+base_index] >> bit_index) ^ (x[i+base_index+1] << (8 - bit_index)); - } - - x[width_bytes - base_index-1] = x[width_bytes-1] >> bit_index; - } - - /* now wrap up the final portion */ - for (i = width_bytes - base_index; i < width_bytes; i++) { - x[i] = 0; - } -} - -void zrtp_v128_xor(zrtp_v128_t *z, zrtp_v128_t *x, zrtp_v128_t *y) -{ - _zrtp_v128_xor(z, x, y); -} - -/*---------------------------------------------------------------------------*/ -uint16_t zrtp_swap16(uint16_t x) { - return (x >> 8 | x << 8); -} - -uint32_t zrtp_swap32(uint32_t x) -{ - uint32_t res = (x >> 8 & 0x0000ff00) | (x << 8 & 0x00ff0000); - res |= (x >> 24 ) | (x << 24); - return res; -} - -#ifdef ZRTP_NO_64BIT_MATH -uint64_t zrtp_swap64(uint64_t x) -{ - uint8_t *p = &x; - uint8_t tmp; - int i; - - for(i=0; i<4; i++) { - tmp = p[i]; - p[i] = p[7-i]; - p[7-i] = tmp; - } - return x; -} -#else -uint64_t zrtp_swap64(uint64_t x) -{ - uint64_t res; - res = (x >> 8 & 0x00000000ff000000ll) | (x << 8 & 0x000000ff00000000ll); - res |= (x >> 24 & 0x0000000000ff0000ll) | (x << 24 & 0x0000ff0000000000ll); - res |= (x >> 40 & 0x000000000000ff00ll) | (x << 40 & 0x00ff000000000000ll); - res |= (x >> 56 & 0x00000000000000ffll) | (x << 56 & 0xff00000000000000ll); - return res; -} -#endif /* ZRTP_NO_64BIT_MATH */ diff --git a/libs/libzrtp/src/zrtp_engine.c b/libs/libzrtp/src/zrtp_engine.c deleted file mode 100644 index 1e2b4ac48d..0000000000 --- a/libs/libzrtp/src/zrtp_engine.c +++ /dev/null @@ -1,1480 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp engine" - -/*! - * Data type for state-handlers: every state has a state handler - * function which is called by zrtp_process_srtp(). - */ -typedef zrtp_status_t state_handler_t( zrtp_stream_t* stream, zrtp_rtp_info_t* packet ); -extern state_handler_t* state_handler[ZRTP_STATE_COUNT]; - -extern zrtp_status_t _zrtp_machine_process_sasrelay(zrtp_stream_t *stream, zrtp_rtp_info_t *packet); - -static void _zrtp_machine_switch_to_error(zrtp_stream_t* stream); -static zrtp_status_t _zrtp_machine_enter_initiatingclear(zrtp_stream_t* stream); -static zrtp_status_t _zrtp_machine_enter_clear(zrtp_stream_t* stream); -static zrtp_status_t _zrtp_machine_enter_pendingerror(zrtp_stream_t *stream, zrtp_protocol_error_t code); - -zrtp_status_t _zrtp_machine_process_hello(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); -zrtp_status_t _zrtp_machine_process_goclear(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); - -static void _send_helloack(zrtp_stream_t* stream); -static void _send_goclearack(zrtp_stream_t* stream); - -zrtp_status_t _zrtp_machine_start_send_and_resend_hello(zrtp_stream_t* stream); -static zrtp_status_t _zrtp_machine_start_send_and_resend_goclear(zrtp_stream_t* stream); -static zrtp_status_t _zrtp_machine_start_send_and_resend_errorack(zrtp_stream_t* stream); -static zrtp_status_t _zrtp_machine_start_send_and_resend_error(zrtp_stream_t* stream); - -void _clear_stream_crypto(zrtp_stream_t* stream); - - -/*===========================================================================*/ -// MARK: ===> Main ZRTP interfaces -/*===========================================================================*/ - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_process_rtcp(zrtp_stream_t *stream, char* packet, unsigned int* length) -{ - - /* - * In transition states, drop outgoing packets. In SECURE state, encrypt - outgoing packets. In all other states leave them unchanged. - */ - - if (stream) { - switch (stream->state) - { - case ZRTP_STATE_START_INITIATINGSECURE: - case ZRTP_STATE_INITIATINGSECURE: - case ZRTP_STATE_WAIT_CONFIRM1: - case ZRTP_STATE_WAIT_CONFIRMACK: - case ZRTP_STATE_PENDINGSECURE: - case ZRTP_STATE_WAIT_CONFIRM2: - case ZRTP_STATE_PENDINGCLEAR: - return zrtp_status_drop; - - case ZRTP_STATE_SASRELAYING: - case ZRTP_STATE_SECURE: - { - zrtp_rtp_info_t info; - - if (*length < RTCP_HDR_SIZE) { - return zrtp_status_fail; - } - - zrtp_memset(&info, 0, sizeof(info)); - info.packet = packet; - info.length = length; - info.seq = 0; /*sequence number will be generated in zrtp_srtp_protect_rtcp()*/ - info.ssrc = (uint32_t) *(packet+sizeof(uint32_t)); - - return _zrtp_protocol_encrypt(stream->protocol, &info, 0); - } - - default: - return zrtp_status_ok; - } - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_process_srtcp(zrtp_stream_t *stream, char* packet, unsigned int* length) -{ - - /* - * In transition states, drop incoming packets. In SECURE state, decrypt - * incoming packets. In all other states leave them unchanged. - */ - - if (stream) { - switch (stream->state) - { - case ZRTP_STATE_INITIATINGCLEAR: - case ZRTP_STATE_PENDINGCLEAR: - case ZRTP_STATE_INITIATINGSECURE: - case ZRTP_STATE_PENDINGSECURE: - return zrtp_status_drop; - - case ZRTP_STATE_SECURE: - case ZRTP_STATE_SASRELAYING: - { - zrtp_rtp_info_t info; - - if (*length < RTCP_HDR_SIZE) { - return zrtp_status_fail; - } - - zrtp_memset(&info, 0, sizeof(info)); - info.packet = packet; - info.length = length; - info.seq = 0; /*sequence number will be determined from packet in zrtp_srtp_unprotect_rtcp()*/ - info.ssrc = (uint32_t) *(packet+sizeof(uint32_t)); - - return _zrtp_protocol_decrypt(stream->protocol, &info, 0); - } - - default: - return zrtp_status_ok; - } - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_process_rtp(zrtp_stream_t *stream, char* packet, unsigned int* length) -{ - zrtp_rtp_info_t info; - - if (!stream || !packet || !length) { - return zrtp_status_bad_param; - } - - /* Skip packet processing within uninitiated stream */ - if ((stream->state < ZRTP_STATE_START) || (stream->state > ZRTP_STATE_NO_ZRTP)) { - return zrtp_status_ok; - } - - /* Prepare RTP packet: detect type and other options */ - if (zrtp_status_ok != _zrtp_packet_preparse(stream, packet, length, &info, 0)) { - return zrtp_status_fail; - } - - /* Drop packets in transition states and encrypt in SECURE state */ - switch (stream->state) - { - case ZRTP_STATE_START_INITIATINGSECURE: - case ZRTP_STATE_INITIATINGSECURE: - case ZRTP_STATE_WAIT_CONFIRM1: - case ZRTP_STATE_WAIT_CONFIRMACK: - case ZRTP_STATE_PENDINGSECURE: - case ZRTP_STATE_WAIT_CONFIRM2: - case ZRTP_STATE_PENDINGCLEAR: - if (ZRTP_NONE == info.type) { - /* Add dropped media to the entropy hash */ - ZRTP_LOG(1,(_ZTU_,"Add %d bytes of entropy to the RNG pool.\n", *length)); - zrtp_entropy_add(stream->zrtp, (unsigned char*)packet, *length); - - return zrtp_status_drop; - } - break; - - case ZRTP_STATE_SASRELAYING: - case ZRTP_STATE_SECURE: - if (ZRTP_NONE == info.type) { - return _zrtp_protocol_encrypt(stream->protocol, &info, 1); - } - break; - - default: - break; - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -extern int _send_message(zrtp_stream_t* stream, zrtp_msg_type_t type, const void* message, uint32_t ssrc); -zrtp_status_t zrtp_process_srtp(zrtp_stream_t *stream, char* packet, unsigned int* length) -{ - zrtp_rtp_info_t info; - zrtp_status_t s = zrtp_status_ok; - - if (!stream || !packet || !length) { - return zrtp_status_bad_param; - } - - if (*length <= RTP_HDR_SIZE) { - return zrtp_status_bad_param; - } - - /* Preparse RTP packet: detect type and other options */ - s = _zrtp_packet_preparse(stream, packet, length, &info, 1); - if (zrtp_status_ok != s) { - return s; - } - - /*************************************************************************/ - /* For Zfone3 Compatibility */ - if (ZRTP_ZFONEPING == info.type) { - zrtp_packet_zfoneping_t* ping = (zrtp_packet_zfoneping_t*) info.message; - zrtp_packet_zfonepingack_t pingack; - - zrtp_memcpy(pingack.version, ZRTP_ZFONE_PROTOCOL_VERSION, 4); - zrtp_memcpy(pingack.endpointhash, stream->session->zid.buffer, sizeof(pingack.endpointhash)); - zrtp_memcpy(pingack.peerendpointhash, ping->endpointhash, sizeof(pingack.endpointhash)); - pingack.peerssrc = info.ssrc; - - _zrtp_packet_fill_msg_hdr( stream, - ZRTP_ZFONEPINGACK, - sizeof(zrtp_packet_zfonepingack_t) - sizeof(zrtp_msg_hdr_t), - &pingack.hdr); - - _zrtp_packet_send_message(stream, ZRTP_ZFONEPINGACK, &pingack); - return zrtp_status_drop; - } - /*************************************************************************/ - - /* Skip packet processing within non-started stream */ - if ((stream->state < ZRTP_STATE_START) || (stream->state > ZRTP_STATE_NO_ZRTP)) { - return (ZRTP_NONE == info.type) ? zrtp_status_ok : zrtp_status_drop; - } - - /* - * This mutex should protect stream data against asynchr. calls e.g.: - * zrtp_stream_secure(), zrtp_stream_clear() etc. Media packet handlers - * don't change any internal data, so this applies only to ZRTP messages. - */ - if (info.type != ZRTP_NONE) { - zrtp_mutex_lock(stream->stream_protector); - } - - /* Extra protection. We need protocol to handle ZRTP messages in following states. */ - switch (stream->state) - { - case ZRTP_STATE_INITIATINGSECURE: - case ZRTP_STATE_WAIT_CONFIRM1: - case ZRTP_STATE_WAIT_CONFIRMACK: - case ZRTP_STATE_PENDINGSECURE: - case ZRTP_STATE_WAIT_CONFIRM2: - case ZRTP_STATE_SECURE: - case ZRTP_STATE_SASRELAYING: - if (!stream->protocol) { - if (info.type != ZRTP_NONE) { - zrtp_mutex_unlock(stream->stream_protector); - } - return zrtp_status_fail; - } - default: - break; - } - - /* Handle Error packet from any state */ - if (ZRTP_ERROR == info.type && stream->state > ZRTP_STATE_START) - { - switch (stream->state) - { - case ZRTP_STATE_NONE: - case ZRTP_STATE_ACTIVE: - case ZRTP_STATE_SECURE: - case ZRTP_STATE_PENDINGERROR: - case ZRTP_STATE_INITIATINGERROR: - case ZRTP_STATE_NO_ZRTP: - break; - default: - { - zrtp_packet_Error_t* error = (zrtp_packet_Error_t*) info.message; - _zrtp_machine_enter_pendingerror(stream, zrtp_ntoh32(error->code)); - } break; - } - } - - /* Process packet by state-machine according to packet type and current protocol state */ - if (state_handler[stream->state]) { - s = state_handler[stream->state](stream, &info); - } - - /* Unlock stream mutex for a ZRTP message packet. See comments above. */ - if (info.type != ZRTP_NONE) { - s = zrtp_status_drop; - zrtp_mutex_unlock(stream->stream_protector); - } - - return s; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_stream_start(zrtp_stream_t* stream, uint32_t ssrc) -{ - zrtp_status_t s = zrtp_status_ok; - /* - * (ZRTP stream starts from START state and HELLO packets resending. - * Stream can be started from START, ERROR or NOZRTP states only.) - */ - ZRTP_LOG(3,(_ZTU_,"START STREAM ID=%u mode=%s state=%s.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - if ( (ZRTP_STATE_ACTIVE != stream->state) && - (ZRTP_STATE_ERROR != stream->state) && - (ZRTP_STATE_NO_ZRTP != stream->state)) { - ZRTP_LOG(1,(_ZTU_,"ERROR! Can't start Stream ID=%u from %s state.\n", - stream->id, zrtp_log_state2str(stream->state))); - s = zrtp_status_wrong_state; - } else { - stream->media_ctx.ssrc = zrtp_hton32(ssrc); - - _zrtp_change_state(stream, ZRTP_STATE_START); - _zrtp_machine_start_send_and_resend_hello(stream); - } - - return s; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_stream_stop(zrtp_stream_t* stream) -{ - zrtp_status_t s = zrtp_status_ok; - /* - * Stop all packet replays, deinitialize crypto data and prepare the stream - * for the next use. The stream can be terminated from any protocol state. - */ - ZRTP_LOG(3,(_ZTU_,"STOP STREAM ID=%u mode=%s state=%s.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - /* - * Unlink deleted stream for the peer MiTM stream if necessary. It may - * prevent some recae-conditions as we always test for NULL before - * accessing linked_mitm. - */ - if (stream->linked_mitm) { - stream->linked_mitm->linked_mitm = NULL; - } - - if (stream->state != ZRTP_STATE_NONE) { - /* - * This function can be called in parallel to the main processing loop - * - protect internal stream data. - */ - zrtp_mutex_lock(stream->stream_protector); - - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - if (stream->zrtp->cb.sched_cb.on_wait_call_later) { - stream->zrtp->cb.sched_cb.on_wait_call_later(stream); - } - - _clear_stream_crypto(stream); - - zrtp_mutex_unlock(stream->stream_protector); - zrtp_mutex_destroy(stream->stream_protector); - - zrtp_memset(stream, 0, sizeof(zrtp_stream_t)); - - stream->mode = ZRTP_STREAM_MODE_UNKN; - - _zrtp_change_state(stream, ZRTP_STATE_NONE); - } else { - s = zrtp_status_wrong_state; - } - - return s; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_stream_clear(zrtp_stream_t *stream) -{ - /* - * This function can be called for two reasons: either our user is - * initiating the go-clear ritual or we accepting that ritual as - * initiated by the other end of the line. If our user initiates the - * go-clear process libzrtp switches to INITIATING_CLEAR and runs - * GoClear replays. The go-clear ritual can be started from SECURE state - * only. If the other end of the line is initiating and this function is - * being called to accept the go-clear procedure - protocol transites to - * CLEAR state imediately. One can accept go-clear from PENDING CLEAR - * state only. See state-macine diagram for more information. - */ - zrtp_status_t s = zrtp_status_fail; - - /* This function can be called in parallel to the main processing loop - protect stream data. */ - zrtp_mutex_lock(stream->stream_protector); - - ZRTP_LOG(3,(_ZTU_,"CLEAR STREAM ID=%u mode=%s state=%s.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - switch (stream->state) - { - case ZRTP_STATE_SECURE: - /* Clearing ritual can't be started if "allow clear" is disabled */ - if (stream->session->profile.allowclear) { - s = _zrtp_machine_enter_initiatingclear(stream); - } - break; - case ZRTP_STATE_PENDINGCLEAR: - s = _zrtp_machine_enter_clear(stream); - break; - default: - break; - } - - zrtp_mutex_unlock(stream->stream_protector); - - return s; -} - -/*----------------------------------------------------------------------------*/ -void _initiating_secure(zrtp_stream_t *stream, zrtp_retry_task_t* task) -{ - /* - * In accordance with the ZRTP standard, there can be multiple simultaneous - * DH streams, as well as preshared streams. - * - * Before entering the INITIATING_SECURE state, we check several conditions. - * For details see \doc\img\odg\zrtp_streams.odg and zrtp_statemach.odg) - */ - - /* The first call to this function is already protected by a mutex in zrtp_process_srtp() */ - uint8_t use_mutex = (task->_retrys > 0); - - if (!task->_is_enabled) { - return; - } - - if (use_mutex) { - zrtp_mutex_lock(stream->stream_protector); - } - - ZRTP_LOG(3,(_ZTU_,"\tInitiating Secure iteration... ID=%u.\n", stream->id)); - - /* Skip the last replay after switching to another state to avoid unwanted replays */ - if (stream->state <= ZRTP_STATE_START_INITIATINGSECURE) - { - stream->mode = _zrtp_define_stream_mode(stream); - ZRTP_LOG(3,(_ZTU_,"\tGot mode=%s. Check approval of starting.\n", zrtp_log_mode2str(stream->mode))); - if (!_zrtp_can_start_stream(stream, &stream->concurrent, stream->mode)) - { - if (task->_retrys > ZRTP_PROCESS_T1_MAX_COUNT) { - ZRTP_LOG(3,(_ZTU_,"\tInitiating Secure. Max retransmissions count reached" - "for stream ID=%u.\n", stream->id)); - - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_timeout, 0); - } else { - ZRTP_LOG(3,(_ZTU_,"\tInitiating Secure. stream ID=%u is DH but one more DH" - " stream is in progress - waiting...\n", stream->id)); - - task->_retrys++; - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } - } - else - { - ZRTP_LOG(3,(_ZTU_,"\tMode=%s Cccepted. Starting ZRTP Initiator Protocol.\n", zrtp_log_mode2str(stream->mode))); - _zrtp_cancel_send_packet_later(stream, ZRTP_PROCESS); - _zrtp_machine_enter_initiatingsecure(stream); - } - } - - if (use_mutex) { - zrtp_mutex_unlock(stream->stream_protector); - } -} - -zrtp_status_t _zrtp_machine_start_initiating_secure(zrtp_stream_t *stream) -{ - /* - * This function creates a task to do retries of the first packet in the - * "Going secure" procedure, and then _initiating_secure() will start - * protocol. - */ - zrtp_retry_task_t* task = &stream->messages.dh_task; - task->_is_enabled = 1; - task->_retrys = 0; - task->callback = _initiating_secure; - task->timeout = ZRTP_PROCESS_T1; - - /* - * Prevent race conditions on starting multiple streams. - */ - zrtp_mutex_lock(stream->session->init_protector); - - _zrtp_change_state(stream, ZRTP_STATE_START_INITIATINGSECURE); - _initiating_secure(stream, task); - - zrtp_mutex_unlock(stream->session->init_protector); - - return zrtp_status_ok; -} - - -zrtp_status_t zrtp_stream_secure(zrtp_stream_t *stream) -{ - /* - * Wrapper function for going into secure mode. It can be initiated in - * parallel to the main processing loop. The internal stream data has to - * be protected by mutex. - */ - - zrtp_status_t s = zrtp_status_fail; - - ZRTP_LOG(3,(_ZTU_,"SECURE STREAM ID=%u mode=%s state=%s.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - zrtp_mutex_lock(stream->stream_protector); - - /* Limit ZRTP Session initiation procedure according to the license */ - if ( (stream->state == ZRTP_STATE_CLEAR) && ZRTP_PASSIVE1_TEST(stream)) { - s = _zrtp_machine_start_initiating_secure(stream); - } else { - ZRTP_LOG(1,(_ZTU_,"\tWARNING! Can't Start Stream from %s state and with %d license mode. ID=%u\n", - zrtp_log_state2str(stream->state), stream->zrtp->lic_mode, stream->id)); - - if (!ZRTP_PASSIVE1_TEST(stream)) { - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event ) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_PASSIVE_RESTRICTION); - } - } - } - - zrtp_mutex_unlock(stream->stream_protector); - - return s; -} - - -/*===========================================================================*/ -/* State handlers */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_start( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_HELLO: - s = _zrtp_machine_process_hello(stream, packet); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! _zrtp_machine_process_hello() failed with status=%d. ID=%u\n", s, stream->id)); - break; /* Just stay in START state. */ - } - - /* Now we have ZIDs for both sides and can upload secrets from the cache */ - s = _zrtp_prepare_secrets(stream->session); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! _zrtp_prepare_secrets() failed with status=%d. ID=%u\n", s, stream->id)); - break; /* Just stay in START state. */ - } - - _send_helloack(stream); - _zrtp_change_state(stream, ZRTP_STATE_WAIT_HELLOACK); - break; - - case ZRTP_HELLOACK: - _zrtp_cancel_send_packet_later(stream, ZRTP_HELLO); - _zrtp_change_state(stream, ZRTP_STATE_WAIT_HELLO); - break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_wait4hello( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_HELLO: - s = _zrtp_machine_process_hello(stream, packet); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! _zrtp_machine_process_hello()2 failed with status=%d. ID=%u\n", s, stream->id)); - break; /* Just stay in the current state. */ - } - - /* Now we have ZIDs for both sides and can upload secrets from the cache */ - s = _zrtp_prepare_secrets(stream->session); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! _zrtp_prepare_secrets()2 failed with status=%d. ID=%u\n", s, stream->id)); - break; /* Just stay in the current state. */ - } - - /* Start initiating the secure state if "autosecure" is enabled */ - if ((stream->session->profile.autosecure) && ZRTP_PASSIVE1_TEST(stream)) { - if (!stream->session->profile.discovery_optimization) { - _send_helloack(stream); /* Response with HelloAck before start computing DH value */ - } - s = _zrtp_machine_start_initiating_secure(stream); - } else { - _send_helloack(stream); - - if (!ZRTP_PASSIVE1_TEST(stream)) { - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_PASSIVE_RESTRICTION); - } - ZRTP_LOG(2,(_ZTU_,"\tINFO: Switching to Clear due to Active/Passive restrictions.\n")); - } - - s = _zrtp_machine_enter_clear(stream); - } - - break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_wait4helloack( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t status = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_HELLO: - _send_helloack(stream); - break; - - case ZRTP_COMMIT: - { - /* Passive Initiator can't talk to anyone */ - if (ZRTP_PASSIVE2_TEST(stream)) - { - zrtp_statemachine_type_t role = _zrtp_machine_preparse_commit(stream, packet); - if (ZRTP_STATEMACHINE_RESPONDER == role) { - _zrtp_cancel_send_packet_later(stream, ZRTP_HELLO); - status = _zrtp_machine_enter_pendingsecure(stream, packet); - } else if (ZRTP_STATEMACHINE_INITIATOR == role) { - _zrtp_cancel_send_packet_later(stream, ZRTP_HELLO); - status = _zrtp_machine_start_initiating_secure(stream); - } else { - status = zrtp_status_fail; - } - } else { - ZRTP_LOG(2,(_ZTU_,"\tERROR: The endpoint is in passive mode and Signaling Initiator -" - " can't handle connections from anyone. ID=%u\n", stream->id)); - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_PASSIVE_RESTRICTION); - } - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_service_unavail, 1); - } - } break; - - case ZRTP_HELLOACK: - _zrtp_cancel_send_packet_later(stream, ZRTP_HELLO); - - /* Start initiating the secure state if "autosecure" is enabled */ - if ((stream->session->profile.autosecure) && ZRTP_PASSIVE1_TEST(stream)) { - status = _zrtp_machine_start_initiating_secure(stream); - } else { - if (!ZRTP_PASSIVE1_TEST(stream)) { - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_PASSIVE_RESTRICTION); - } - ZRTP_LOG(2,(_ZTU_,"\tINFO: Switching to Clear due to Active/Passive restrictions.\n")); - } - status = _zrtp_machine_enter_clear(stream); - } - - break; - - default: - break; - } - - return status; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_clear( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_GOCLEAR: - _send_goclearack(stream); - break; - - case ZRTP_HELLO: - _send_helloack(stream); - break; - - case ZRTP_COMMIT: - { - zrtp_statemachine_type_t role = _zrtp_machine_preparse_commit(stream, packet); - if (ZRTP_STATEMACHINE_RESPONDER == role) { - s = _zrtp_machine_enter_pendingsecure(stream, packet); - } else if (ZRTP_STATEMACHINE_INITIATOR == role) { - s = _zrtp_machine_start_initiating_secure(stream); - } else { - s = zrtp_status_fail; - } - } break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_initiatingclear( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_GOCLEARACK: - case ZRTP_COMMIT: - s = _zrtp_machine_enter_clear(stream); - break; - - case ZRTP_NONE: - s = zrtp_status_drop; - break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_pendingclear( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_GOCLEAR: - _send_goclearack(stream); - break; - - case ZRTP_COMMIT: - { - zrtp_statemachine_type_t role = _zrtp_machine_preparse_commit(stream, packet); - if (ZRTP_STATEMACHINE_RESPONDER == role) { - s = _zrtp_machine_enter_pendingsecure(stream, packet); - } else if (ZRTP_STATEMACHINE_INITIATOR == role) { - s = _zrtp_machine_start_initiating_secure(stream); - } else { - s = zrtp_status_fail; - } - } break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_start_initiatingsecure( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_HELLO: - _send_helloack(stream); - break; - - case ZRTP_COMMIT: - { - zrtp_statemachine_type_t role = _zrtp_machine_preparse_commit(stream, packet); - if (ZRTP_STATEMACHINE_RESPONDER == role) { - _zrtp_cancel_send_packet_later(stream, ZRTP_PROCESS); - s = _zrtp_machine_enter_pendingsecure(stream, packet); - } else { - s = zrtp_status_fail; - } - } break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_secure( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_CONFIRM2: - _zrtp_packet_send_message(stream, ZRTP_CONFIRM2ACK, NULL); - break; - - case ZRTP_SASRELAY: - /* - * _zrtp_machine_process_sasrelay() updates SAS, sends events and does - * other things if SAS transferring is allowed - */ - s = _zrtp_machine_process_sasrelay(stream, packet); - if (zrtp_status_ok == s) { - _zrtp_packet_send_message(stream, ZRTP_RELAYACK, NULL); - } - break; - - case ZRTP_GOCLEAR: - s = _zrtp_machine_process_goclear(stream, packet); - if (zrtp_status_ok == s) { - s = _zrtp_machine_enter_pendingclear(stream); - _send_goclearack(stream); - } - break; - - case ZRTP_NONE: - s = _zrtp_protocol_decrypt(stream->protocol, packet, 1); - break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_initiatingerror( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - switch (packet->type) - { - case ZRTP_ERROR: - _zrtp_machine_enter_pendingerror(stream, ((zrtp_packet_Error_t*) packet->message)->code ); - break; - - case ZRTP_ERRORACK: - _zrtp_machine_switch_to_error(stream); - break; - - default: - break; - } - - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_nozrtp( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_HELLO: - s = _zrtp_machine_process_hello(stream, packet); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! _zrtp_machine_process_hello()3 failed with status=%d ID=%u.\n", s, stream->id)); - break; - } - - _zrtp_change_state(stream, ZRTP_STATE_START); - _zrtp_machine_start_send_and_resend_hello(stream); - break; - - case ZRTP_COMMIT: /* this logic should be similar to Commit handler in ZRTP_STATE_WAIT_HELLOACK state */ - { - /* Passive Initiator can't talk to anyone */ - if (ZRTP_PASSIVE2_TEST(stream)) - { - zrtp_statemachine_type_t role = _zrtp_machine_preparse_commit(stream, packet); - if (ZRTP_STATEMACHINE_RESPONDER == role) { - s = _zrtp_machine_enter_pendingsecure(stream, packet); - } else if (ZRTP_STATEMACHINE_INITIATOR == role) { - s = _zrtp_machine_start_initiating_secure(stream); - } else { - s = zrtp_status_fail; - } - } else { - ZRTP_LOG(2,(_ZTU_,"\tERROR: The endpoint is in passive mode and Signaling Initiator -" - " can't handle connections from anyone. ID=%u\n", stream->id)); - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event ) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_PASSIVE_RESTRICTION); - } - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_service_unavail, 1); - } - } break; - - default: - break; - } - - return s; -} - - -/* Initiator logic */ -extern zrtp_status_t _zrtp_machine_process_while_in_initiatingsecure(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); -extern zrtp_status_t _zrtp_machine_process_while_in_waitconfirmack(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); -extern zrtp_status_t _zrtp_machine_process_while_in_waitconfirm1(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); - -/* Responder logic */ -extern zrtp_status_t _zrtp_machine_process_while_in_pendingsecure(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); -extern zrtp_status_t _zrtp_machine_process_while_in_waitconfirm2(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); - -/* PBX transferring logic */ -extern zrtp_status_t _zrtp_machine_process_while_in_sasrelaying(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); - -#if (defined(ZRTP_BUILD_FOR_CSD) && (ZRTP_BUILD_FOR_CSD == 1)) -/* Driven Discovery state-machine */ -extern zrtp_status_t _zrtp_machine_process_while_in_driven_initiator(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); -extern zrtp_status_t _zrtp_machine_process_while_in_driven_responder(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); -extern zrtp_status_t _zrtp_machine_process_while_in_driven_pending(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); -#endif - -state_handler_t* state_handler[ZRTP_STATE_COUNT] = -{ - NULL, - NULL, - _zrtp_machine_process_while_in_start, - _zrtp_machine_process_while_in_wait4helloack, - _zrtp_machine_process_while_in_wait4hello, - _zrtp_machine_process_while_in_clear, - _zrtp_machine_process_while_in_start_initiatingsecure, - _zrtp_machine_process_while_in_initiatingsecure, - _zrtp_machine_process_while_in_waitconfirm1, - _zrtp_machine_process_while_in_waitconfirmack, - _zrtp_machine_process_while_in_pendingsecure, - _zrtp_machine_process_while_in_waitconfirm2, - _zrtp_machine_process_while_in_secure, - _zrtp_machine_process_while_in_sasrelaying, - _zrtp_machine_process_while_in_initiatingclear, - _zrtp_machine_process_while_in_pendingclear, - _zrtp_machine_process_while_in_initiatingerror, - NULL, - NULL, -#if (defined(ZRTP_BUILD_FOR_CSD) && (ZRTP_BUILD_FOR_CSD == 1)) - _zrtp_machine_process_while_in_driven_initiator, - _zrtp_machine_process_while_in_driven_responder, - _zrtp_machine_process_while_in_driven_pending, -#endif - _zrtp_machine_process_while_in_nozrtp -}; - - -/*===========================================================================*/ -/* State switchers */ -/*===========================================================================*/ - -static void _zrtp_machine_switch_to_error(zrtp_stream_t* stream) -{ - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - _clear_stream_crypto(stream); - - _zrtp_change_state(stream, ZRTP_STATE_ERROR); - - if (stream->zrtp->cb.event_cb.on_zrtp_security_event) { - stream->zrtp->cb.event_cb.on_zrtp_security_event(stream, ZRTP_EVENT_PROTOCOL_ERROR); - } - if (stream->zrtp->cb.event_cb.on_zrtp_not_secure) { - stream->zrtp->cb.event_cb.on_zrtp_not_secure(stream); - } - stream->last_error = 0; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_enter_pendingclear(zrtp_stream_t* stream) -{ - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - _zrtp_change_state(stream, ZRTP_STATE_PENDINGCLEAR); - - /* - * We have to destroy the ZRTP Session Key because user may not press "clear - * button", and the remote endpoint may subsequently initiate a new secure - * session. Other secret values will be destroyed in Clear state or - * rewritten with new. - */ - { - zrtp_string64_t new_zrtpsess = ZSTR_INIT_EMPTY(new_zrtpsess); - // TODO: hash - stream->session->hash->hash( stream->session->hash, - ZSTR_GV(stream->session->zrtpsess), - ZSTR_GV(new_zrtpsess)); - zrtp_zstrcpy(ZSTR_GV(stream->session->zrtpsess), ZSTR_GV(new_zrtpsess)); - } - - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_PENDINGCLEAR); - } - - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -static zrtp_status_t _zrtp_machine_enter_initiatingclear(zrtp_stream_t* stream) -{ - - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - _zrtp_change_state(stream, ZRTP_STATE_INITIATINGCLEAR); - - { - zrtp_string64_t new_zrtpsess = ZSTR_INIT_EMPTY(new_zrtpsess); - // TODO: hash - stream->session->hash->hash( stream->session->hash, - ZSTR_GV(stream->session->zrtpsess), - ZSTR_GV(new_zrtpsess)); - zrtp_zstrcpy(ZSTR_GV(stream->session->zrtpsess), ZSTR_GV(new_zrtpsess)); - } - - return _zrtp_machine_start_send_and_resend_goclear(stream); -} - -/*---------------------------------------------------------------------------*/ -static zrtp_status_t _zrtp_machine_enter_clear(zrtp_stream_t* stream) -{ - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - _clear_stream_crypto(stream); - _zrtp_change_state(stream, ZRTP_STATE_CLEAR); - - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_CLEAR); - } - - /* - * Now, let's check if the transition to CLEAR was caused by Active/Passive rules. - * If local endpoint is a MitM and peer MiTM linked stream is Unlimited, we - * could break the rules and send commit to Passive endpoint. - */ - if (stream->zrtp->is_mitm && stream->peer_passive) { - if (stream->linked_mitm && stream->linked_mitm->peer_super_flag) { - ZRTP_LOG(2,(_ZTU_,"INFO: Current stream ID=%u was switched to CLEAR-mode due to Active/Passive" - " restrictions, but we are running in MiTM mode and peer linked stream is" - " Super-active. Go Secure!\n", stream->id)); - - /* @note: don't use zrtp_secure_stream() wrapper as it checks for Active/Passive stuff. */ - _zrtp_machine_start_initiating_secure(stream); - } - } - - return zrtp_status_ok; -} - - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_enter_initiatingerror( zrtp_stream_t *stream, - zrtp_protocol_error_t code, - uint8_t notif) -{ - if ( (ZRTP_STATE_ERROR != stream->state) && - (ZRTP_STATE_INITIATINGERROR != stream->state) && - (ZRTP_STATE_PENDINGERROR != stream->state) ) - { - stream->last_error = code; - - ZRTP_LOG(3,(_ZTU_,"\tEnter InitiatingError State with ERROR:<%s>, notification %s. ID=%u\n", - zrtp_log_error2str(stream->last_error), (notif?"Enabled":"Disabled"), stream->id)); - - /* If we can't deliver a ZRTP message, just switch to the ERROR state. */ - if (notif) { - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - _zrtp_change_state(stream, ZRTP_STATE_INITIATINGERROR); - _zrtp_machine_start_send_and_resend_error(stream); - } else { - _zrtp_machine_switch_to_error(stream); - } - } - - return zrtp_status_ok; -} - -zrtp_status_t _zrtp_machine_enter_pendingerror(zrtp_stream_t *stream, zrtp_protocol_error_t code) -{ - ZRTP_LOG(3,(_ZTU_,"\tEnter PendingError State with ERROR:<%s>. ID=%u\n", - zrtp_log_error2str(stream->last_error), stream->id)); - - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - _zrtp_change_state(stream, ZRTP_STATE_PENDINGERROR); - - stream->last_error = code; - _zrtp_machine_start_send_and_resend_errorack(stream); - return zrtp_status_ok; -} - - -/*===========================================================================*/ -/* Packet handlers */ -/*===========================================================================*/ - -zrtp_status_t _zrtp_machine_process_goclear(zrtp_stream_t* stream, zrtp_rtp_info_t* packet) -{ - zrtp_packet_GoClear_t *goclear = (zrtp_packet_GoClear_t*) packet->message; - zrtp_string128_t clear_hmac = ZSTR_INIT_EMPTY(clear_hmac); - static const zrtp_string16_t clear_hmac_str = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_CLEAR_HMAC_STR); - - if (!stream->allowclear) { - ZRTP_LOG(2, (_ZTU_,"\tWARNING! Allowclear is disabled but GoClear was received. ID=%u.\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_goclear_unsp, 1); - return zrtp_status_fail; - } - - stream->session->hash->hmac( stream->session->hash, - ZSTR_GV(stream->cc.peer_hmackey), - ZSTR_GV(clear_hmac_str), - ZSTR_GV(clear_hmac)); - clear_hmac.length = ZRTP_HMAC_SIZE; - - if (0 != zrtp_memcmp(clear_hmac.buffer, goclear->clear_hmac, ZRTP_HMAC_SIZE)) { - ZRTP_LOG(2, (_ZTU_,"\tWARNING! Wrong GoClear hmac. ID=%u.\n", stream->id)); - return zrtp_status_fail; /* EH: Just ignore malformed packets */ - } - - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_hello(zrtp_stream_t* stream, zrtp_rtp_info_t* packet) -{ - zrtp_session_t* session = stream->session; - zrtp_packet_Hello_t* peer_hello = NULL; - uint32_t comp_block_len = 0; - uint8_t id = 0; - - /* Size of HELLO packet must be bigger then . */ - if (*(packet->length) < (ZRTP_MIN_PACKET_LENGTH + ZRTP_HELLO_STATIC_SIZE + ZRTP_HMAC_SIZE)) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Wrong HELLO static size=%d must be=%d. ID=%u\n", *packet->length, - ZRTP_MIN_PACKET_LENGTH + ZRTP_HELLO_STATIC_SIZE + ZRTP_HMAC_SIZE, stream->id)); - - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_invalid_packet, 1); - return zrtp_status_fail; - } - - peer_hello = (zrtp_packet_Hello_t*) packet->message; - - /* Now we can verify packet size according to size of its parts */ - comp_block_len = ( peer_hello->hc + peer_hello->cc + - peer_hello->ac + peer_hello->kc + - peer_hello->sc) * ZRTP_COMP_TYPE_SIZE; - - if (*packet->length < (ZRTP_MIN_PACKET_LENGTH + ZRTP_HELLO_STATIC_SIZE + comp_block_len + ZRTP_HMAC_SIZE)) - { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Wrong HELLO dynamic size=%d must be=%d. ID=%u\n", *packet->length, - comp_block_len+ ZRTP_MIN_PACKET_LENGTH + ZRTP_HELLO_STATIC_SIZE + ZRTP_HMAC_SIZE, stream->id)); - - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_invalid_packet, 1); - return zrtp_status_fail; - } - - /* Every component quantity must be less than or equal to 7 */ - if ( (peer_hello->hc > ZRTP_MAX_COMP_COUNT) || (peer_hello->cc > ZRTP_MAX_COMP_COUNT) || - (peer_hello->ac > ZRTP_MAX_COMP_COUNT) || (peer_hello->kc > ZRTP_MAX_COMP_COUNT) || - (peer_hello->sc > ZRTP_MAX_COMP_COUNT) ) - { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Wrong HELLO packet data. Components count can't be greater" - " then 7. ID=%u\n", stream->id)); - - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_invalid_packet, 1); - return zrtp_status_fail; - } - - /* Print out ZRTP Hello message for debug purposes */ - { - char print_buffer[ZRTP_MAX_COMP_COUNT*20]; - zrtp_memcpy(print_buffer, peer_hello->comp, comp_block_len); - print_buffer[comp_block_len] = 0; - ZRTP_LOG(3,(_ZTU_,"\tProcessing HELLO from %.16s V=%.4s, P=%d, M=%d.\n", - peer_hello->cliend_id, peer_hello->version, peer_hello->pasive, peer_hello->mitmflag)); - ZRTP_LOG(3,(_ZTU_,"\t\tac=%d cc=%d sc=%d kc=%d\n", - peer_hello->ac, peer_hello->cc, peer_hello->sc, peer_hello->kc)); - ZRTP_LOG(3,(_ZTU_,"\t\t%s\n", print_buffer)); - } - - /* - * Check protocol version. Try to resolve versions missmatch according to ZRTP Draft sec. 5.1 - */ - { - uint32_t peer_version = 0; - peer_version = (char)((*peer_hello->version) - '0') *10; /* only 3 first octets are significant */ - peer_version += (char)(*(peer_hello->version+2) - '0'); - - if ((ZRTP_PROTOCOL_VERSION_VALUE/10) == peer_version) { - ZRTP_LOG(3,(_ZTU_,"\tReceived HELLO had the same protocol V.\n")); - } - else if ((ZRTP_PROTOCOL_VERSION_VALUE/10) < peer_version) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Received HELLO greater ZRTP V=%d - wait for other party" - " to resolve this issue. ID=%u.\n", peer_version, stream->id)); - } else { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Received a ZRTP_HELLO smaller ZRTP V=%d and we don't" - " support it - terminate session. ID=%u\n", peer_version, stream->id)); - - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_version, 1); - return zrtp_status_fail; - } - } - - /* Close session if ZID duplication */ - if (!zrtp_memcmp(stream->messages.hello.zid, peer_hello->zid, sizeof(zrtp_zid_t))) { - ZRTP_LOG(2,(_ZTU_,ZRTP_EQUAL_ZID_WARNING_STR)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_equal_zid, 1); - return zrtp_status_fail; - } - - /* All streams within a single session MUST have the same ZID */ - if (session->peer_zid.length > 0) { - if (0 != zrtp_memcmp(session->peer_zid.buffer, peer_hello->zid, sizeof(zrtp_zid_t))) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Received HELLO which had a different ZID from that of the" - " previous stream within the same session. sID=%u ID=%u\n", session->id, stream->id)); - - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_wrong_zid, 1); - return zrtp_status_fail; - } - } else { - zrtp_zstrncpyc(ZSTR_GV(session->peer_zid), (const char*) peer_hello->zid, sizeof(zrtp_zid_t)); - } - - /* - * Process Remote flags. - */ - if (peer_hello->pasive && peer_hello->uflag) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Received HELLO which both P and U flags set.\n")); - return zrtp_status_fail; - } - - stream->peer_passive = peer_hello->pasive; - stream->peer_super_flag = peer_hello->uflag; - - stream->peer_mitm_flag = peer_hello->mitmflag; - if (stream->peer_mitm_flag) { - stream->mitm_mode = ZRTP_MITM_MODE_CLIENT; - } - - /* Current version doesn't support Digital Signatures. Ignore peer Hello with S flag enabled. */ - if (peer_hello->sigflag) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! Received a ZRTP_HELLO with S flag enabled. We don't support Digital Signatures - ignore message.\n")); - return zrtp_status_fail; - } - - /* Copy packet for future hashing */ - zrtp_memcpy(&stream->messages.peer_hello, peer_hello, zrtp_ntoh16(peer_hello->hdr.length)*4); - stream->is_hello_received = 1; - - /* - * Choose PK exchange scheme and PK mode. - * We do this right after receiving Hello to speedup DH calculations. - */ - stream->pubkeyscheme = zrtp_comp_find(ZRTP_CC_PKT, ZRTP_PKTYPE_DH3072, session->zrtp); - id = _zrtp_choose_best_comp(&session->profile, peer_hello, ZRTP_CC_PKT); - if (id != ZRTP_COMP_UNKN) { - stream->pubkeyscheme = zrtp_comp_find(ZRTP_CC_PKT, id, session->zrtp); - } - - ZRTP_LOG(3,(_ZTU_,"\tReceived HELLO Accepted\n")); - - return zrtp_status_ok; -} - - -/*===========================================================================*/ -/* Packet senders */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -static void _send_and_resend_hello(zrtp_stream_t* stream, zrtp_retry_task_t* task) -{ - if ((task->_retrys == ZRTP_NO_ZRTP_FAST_COUNT) && !stream->is_hello_received) { - ZRTP_LOG(2,(_ZTU_,"WARNING! HELLO have been resent %d times without a response." - " Raising ZRTP_EVENT_NO_ZRTP_QUICK event. ID=%u\n", task->_retrys, stream->id)); - - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_NO_ZRTP_QUICK); - } - } - - if (task->_retrys >= (uint32_t)((ZRTP_STATE_WAIT_HELLOACK==stream->state)?ZRTP_T1_MAX_COUNT_EXT:ZRTP_T1_MAX_COUNT)) { - ZRTP_LOG(2,(_ZTU_,"WARNING! HELLO Max retransmissions count reached (%d retries). ID=%u\n", task->_retrys, stream->id)); - - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - _clear_stream_crypto(stream); - _zrtp_change_state(stream, ZRTP_STATE_NO_ZRTP); - - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_NO_ZRTP); - } - } else if (task->_is_enabled) { - zrtp_status_t s = _zrtp_packet_send_message(stream, ZRTP_HELLO, &stream->messages.hello); - task->timeout = _zrtp_get_timeout((uint32_t)task->timeout, ZRTP_HELLO); - if (zrtp_status_ok == s) { - task->_retrys++; - } - - - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } -} - -zrtp_status_t _zrtp_machine_start_send_and_resend_hello(zrtp_stream_t* stream) -{ - zrtp_retry_task_t* task = &stream->messages.hello_task; - - task->_is_enabled = 1; - task->callback = _send_and_resend_hello; - task->_retrys = 0; - - _send_and_resend_hello(stream, task); - - return zrtp_status_ok; -} - -static void _send_helloack(zrtp_stream_t* stream) -{ - _zrtp_packet_send_message(stream, ZRTP_HELLOACK, NULL); -} - - -/*---------------------------------------------------------------------------*/ -static void _send_and_resend_goclear(zrtp_stream_t* stream, zrtp_retry_task_t* task) -{ - if (task->_is_enabled) { - if (task->_retrys > ZRTP_T2_MAX_COUNT) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING!: GOCLEAR Nax retransmissions count reached. ID=%u\n", stream->id)); - _zrtp_machine_enter_clear(stream); - } else { - zrtp_packet_GoClear_t* goclear = (zrtp_packet_GoClear_t*) &stream->messages.goclear; - - _zrtp_packet_send_message(stream, ZRTP_GOCLEAR, goclear); - task->_retrys++; - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } - } -} - -static zrtp_status_t _zrtp_machine_start_send_and_resend_goclear(zrtp_stream_t* stream) -{ - zrtp_retry_task_t* task = &stream->messages.goclear_task; - zrtp_string128_t clear_hmac = ZSTR_INIT_EMPTY(clear_hmac); - static const zrtp_string16_t clear_hmac_str = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_CLEAR_HMAC_STR); - - zrtp_memset(&stream->messages.goclear, 0, sizeof(zrtp_packet_GoClear_t)); - - /* Compute Clear HMAC as: HMAC(hmackey, "Clear hmac") */ - stream->session->hash->hmac( stream->session->hash, - ZSTR_GV(stream->cc.hmackey), - ZSTR_GV(clear_hmac_str), - ZSTR_GV(clear_hmac)); - clear_hmac.length = ZRTP_HMAC_SIZE; - - zrtp_memcpy(stream->messages.goclear.clear_hmac, clear_hmac.buffer, clear_hmac.length); - _zrtp_packet_fill_msg_hdr( stream, - ZRTP_GOCLEAR, - sizeof(zrtp_packet_GoClear_t) - sizeof(zrtp_msg_hdr_t), - &stream->messages.goclear.hdr); - - task->_is_enabled = 1; - task->callback = _send_and_resend_goclear; - task->timeout = ZRTP_T2; - task->_retrys = 0; - - _send_and_resend_goclear(stream, task); - - return zrtp_status_ok; -} - - -static void _send_goclearack(zrtp_stream_t* stream) -{ - _zrtp_packet_send_message(stream, ZRTP_GOCLEARACK, NULL); -} - -/*---------------------------------------------------------------------------*/ -static void _send_and_resend_error(zrtp_stream_t* stream, zrtp_retry_task_t* task) -{ - if (task->_retrys >= ZRTP_ETI_MAX_COUNT) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! ERROR Max retransmissions count reached. ID=%u\n", stream->id)); - _zrtp_machine_switch_to_error(stream); - } else if (task->_is_enabled) { - if (zrtp_status_ok == _zrtp_packet_send_message(stream, ZRTP_ERROR, &stream->messages.error)) { - task->_retrys++; - } - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } -} - -static zrtp_status_t _zrtp_machine_start_send_and_resend_error(zrtp_stream_t* stream) -{ - zrtp_retry_task_t* task = &stream->messages.error_task; - - zrtp_memset(&stream->messages.error, 0, sizeof(zrtp_packet_Error_t)); - stream->messages.error.code = zrtp_hton32(stream->last_error); - - _zrtp_packet_fill_msg_hdr( stream, - ZRTP_ERROR, - sizeof(zrtp_packet_Error_t) - sizeof(zrtp_msg_hdr_t), - &stream->messages.error.hdr); - - task->_is_enabled = 1; - task->callback = _send_and_resend_error; - task->timeout = ZRTP_ET; - task->_retrys = 0; - - _send_and_resend_error(stream, task); - - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -static void _send_and_resend_errorack(zrtp_stream_t* stream, zrtp_retry_task_t* task) -{ - if (task->_retrys >= ZRTP_ETR_MAX_COUNT) { - ZRTP_LOG(2,(_ZTU_,"\tWARNING! ERRORACK Max retransmissions count reached. ID=%u\n", stream->id)); - _zrtp_machine_switch_to_error(stream); - } else if (task->_is_enabled) { - if (zrtp_status_ok == _zrtp_packet_send_message(stream, ZRTP_ERRORACK, NULL)) { - task->_retrys++; - } - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } -} - -static zrtp_status_t _zrtp_machine_start_send_and_resend_errorack(zrtp_stream_t* stream) -{ - zrtp_retry_task_t* task = &stream->messages.errorack_task; - - task->_is_enabled = 1; - task->callback = _send_and_resend_errorack; - task->timeout = ZRTP_ET; - task->_retrys = 0; - - _send_and_resend_errorack(stream, task); - - return zrtp_status_ok; -} - - -void _clear_stream_crypto(zrtp_stream_t* stream) -{ - if (stream->protocol) { - _zrtp_protocol_destroy(stream->protocol); - stream->protocol = 0; - } - - zrtp_wipe_zstring(ZSTR_GV(stream->cc.hmackey)); - zrtp_wipe_zstring(ZSTR_GV(stream->cc.peer_hmackey)); - zrtp_wipe_zstring(ZSTR_GV(&stream->cc.zrtp_key)); - zrtp_wipe_zstring(ZSTR_GV(stream->cc.peer_zrtp_key)); -} diff --git a/libs/libzrtp/src/zrtp_engine_driven.c b/libs/libzrtp/src/zrtp_engine_driven.c deleted file mode 100644 index cccc06b08d..0000000000 --- a/libs/libzrtp/src/zrtp_engine_driven.c +++ /dev/null @@ -1,152 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp dengine" - - -#if (defined(ZRTP_BUILD_FOR_CSD) && (ZRTP_BUILD_FOR_CSD == 1)) - -extern zrtp_status_t _zrtp_machine_process_hello(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); -extern zrtp_status_t start_send_and_resend_hello(zrtp_stream_t* stream); -extern zrtp_status_t start_initiating_secure(zrtp_stream_t *stream); -extern zrtp_status_t _zrtp_machine_start_send_and_resend_hello(zrtp_stream_t* stream); - - -/*----------------------------------------------------------------------------*/ -void zrtp_driven_stream_start(zrtp_stream_t* stream, zrtp_statemachine_type_t role) -{ - - ZRTP_LOG(3,(_ZTU_,"START Driven %s Stream ID=%u mode=%s state=%s.", - (ZRTP_STATEMACHINE_INITIATOR == role)?"INITIATOR":"RESPONDER", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - /* This function can be called in parallel to the main processing loop protect internal stream data. */ - zrtp_mutex_lock(stream->stream_protector); - - if ( (ZRTP_STATE_ACTIVE != stream->state) && - (ZRTP_STATE_ERROR != stream->state) && - (ZRTP_STATE_NO_ZRTP != stream->state)) - { - ZRTP_LOG(1,(_ZTU_,"ERROR! can't start stream ID=%u from state %d.", stream->id, stream->state)); - } - else - { - if (ZRTP_STATEMACHINE_INITIATOR == role) { - _zrtp_change_state(stream, ZRTP_STATE_DRIVEN_INITIATOR); - _zrtp_machine_start_send_and_resend_hello(stream); - } else if (ZRTP_STATEMACHINE_RESPONDER == role) { - _zrtp_change_state(stream, ZRTP_STATE_DRIVEN_RESPONDER); - } - } - - zrtp_mutex_unlock(stream->stream_protector); -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_driven_initiator( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_HELLO: { - s = _zrtp_machine_process_hello(stream, packet); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"ERROR! _zrtp_machine_process_hello()4 failed with status=%d. ID=%u",s, stream->id)); - break; /* Just stay in DRIVEN_INITIATOR state. */ - } - - /* Now we have ZIDs for both sides and can upload secrets from the cache */ - s = _zrtp_prepare_secrets(stream->session); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"ERROR! _zrtp_prepare_secrets()3 failed with status=%d. ID=%u",s, stream->id)); - break; /* Just stay in START state. */ - } - - // TODO: handle autosecure and licensing modes there - _zrtp_cancel_send_packet_later(stream, ZRTP_HELLO); - stream->mode = _zrtp_define_stream_mode(stream); - s = _zrtp_machine_enter_initiatingsecure(stream); - } break; - - default: - break; - } - - return s; -} - -zrtp_status_t _zrtp_machine_process_while_in_driven_responder( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_HELLO: { - s = _zrtp_machine_process_hello(stream, packet); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"ERROR! _zrtp_machine_process_hello()5 failed with status=%d. ID=%u", s, stream->id)); - break; /* Just stay in DRIVEN_INITIATOR state. */ - } - - /* Now we have ZIDs for both sides and can upload secrets from the cache */ - s = _zrtp_prepare_secrets(stream->session); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"ERROR! _zrtp_prepare_secrets()4 failed with status=%d. ID=%u", s, stream->id)); - break; /* Just stay in START state. */ - } - - // TODO: handle autosecure and licensing modes there - s = _zrtp_packet_send_message(stream, ZRTP_HELLO, &stream->messages.hello); - if (zrtp_status_ok == s) { - _zrtp_change_state(stream, ZRTP_STATE_DRIVEN_PENDING); - } - } break; - - default: - break; - } - - return s; -} - -zrtp_status_t _zrtp_machine_process_while_in_driven_pending( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_HELLO: { - s = _zrtp_packet_send_message(stream, ZRTP_HELLO, &stream->messages.hello); - } break; - - case ZRTP_COMMIT: { - zrtp_statemachine_type_t role = _zrtp_machine_preparse_commit(stream, packet); - if (ZRTP_STATEMACHINE_RESPONDER == role) { - s = _zrtp_machine_enter_pendingsecure(stream, packet); - } else if (ZRTP_STATEMACHINE_INITIATOR == role) { - s = _zrtp_machine_start_initiating_secure(stream); - } else { - s = zrtp_status_fail; - } - } break; - - default: - break; - } - - return s; -} - -#endif /* ZRTP_BUILD_FOR_CSD */ diff --git a/libs/libzrtp/src/zrtp_iface_cache.c b/libs/libzrtp/src/zrtp_iface_cache.c deleted file mode 100644 index 27191f80f3..0000000000 --- a/libs/libzrtp/src/zrtp_iface_cache.c +++ /dev/null @@ -1,963 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2012 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#if defined(ZRTP_USE_BUILTIN_CACHE) && (ZRTP_USE_BUILTIN_CACHE == 1) - -#define _ZTU_ "zrtp cache" - - -/* Windows kernel have it's own realization in Windows registry*/ -#if (ZRTP_PLATFORM != ZP_WIN32_KERNEL) - -static mlist_t cache_head; -static uint32_t g_cache_elems_counter = 0; -static mlist_t mitmcache_head; -static uint32_t g_mitmcache_elems_counter = 0; -static uint8_t inited = 0; -static uint8_t g_needs_rewriting = 0; - -static zrtp_global_t* zrtp; -static zrtp_mutex_t* def_cache_protector = NULL; - - -/* Create cache ID like a pair of ZIDs. ZID with lowest value at the beginning */ -void zrtp_cache_create_id( const zrtp_stringn_t* first_ZID, - const zrtp_stringn_t* second_ZID, - zrtp_cache_id_t id); - -/* Searching for cache element by cache ID */ -static zrtp_cache_elem_t* get_elem(const zrtp_cache_id_t id, uint8_t is_mitm); - -/* Allows use cache on system with different byte-order */ -static void cache_make_cross( zrtp_cache_elem_t* from, - zrtp_cache_elem_t* to, - uint8_t is_upload); - -static zrtp_status_t zrtp_cache_user_init(); -static zrtp_status_t zrtp_cache_user_down(); - - -/*===========================================================================*/ -/* libZRTP interface implementation */ -/*===========================================================================*/ - -#define ZRTP_CACHE_CHECK_ZID(a,b) \ - if ( (a->length != b->length) || \ - (a->length != sizeof(zrtp_zid_t)) ) \ - { \ - return zrtp_status_bad_param; \ - } - -zrtp_status_t zrtp_def_cache_init(zrtp_global_t* a_zrtp) -{ - zrtp_status_t s = zrtp_status_ok; - - if (!inited) { - zrtp = a_zrtp; - s = zrtp_mutex_init(&def_cache_protector); - if (zrtp_status_ok != s) { - return s; - } - - init_mlist(&cache_head); - init_mlist(&mitmcache_head); - s = zrtp_cache_user_init(); - - inited = 1; - } - - return s; -} - -void zrtp_def_cache_down() -{ - if (inited) { - mlist_t *node = NULL, *tmp = NULL; - - /* If automatic cache flushing enabled we don't need to store it in a disk as it should be already in sync. */ - if (!zrtp->cache_auto_store) - zrtp_cache_user_down(); - - mlist_for_each_safe(node, tmp, &cache_head) { - zrtp_sys_free(mlist_get_struct(zrtp_cache_elem_t, _mlist, node)); - } - mlist_for_each_safe(node, tmp, &mitmcache_head) { - zrtp_sys_free(mlist_get_struct(zrtp_cache_elem_t, _mlist, node)); - } - - init_mlist(&cache_head); - init_mlist(&mitmcache_head); - - zrtp_mutex_destroy(def_cache_protector); - - inited = 0; - zrtp = NULL; - } -} - - -zrtp_status_t zrtp_def_cache_set_verified( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - uint32_t verified) -{ - zrtp_cache_id_t id; - zrtp_cache_elem_t* new_elem = NULL; - - ZRTP_CACHE_CHECK_ZID(one_ZID, another_ZID); - zrtp_cache_create_id(one_ZID, another_ZID, id); - - zrtp_mutex_lock(def_cache_protector); - new_elem = get_elem(id, 0); - if (new_elem) { - new_elem->verified = verified; - } - zrtp_mutex_unlock(def_cache_protector); - - if (zrtp->cache_auto_store) zrtp_def_cache_store(zrtp); - - return (new_elem) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_def_cache_get_verified( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - uint32_t* verified) - -{ - zrtp_cache_id_t id; - zrtp_cache_elem_t* elem = NULL; - - ZRTP_CACHE_CHECK_ZID(one_ZID, another_ZID); - zrtp_cache_create_id(one_ZID, another_ZID, id); - - zrtp_mutex_lock(def_cache_protector); - elem = get_elem(id, 0); - if (elem) { - *verified = elem->verified; - } - zrtp_mutex_unlock(def_cache_protector); - - return (elem) ? zrtp_status_ok : zrtp_status_fail; -} - - -static zrtp_status_t cache_put( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - zrtp_shared_secret_t *rss, - uint8_t is_mitm ) -{ - zrtp_cache_elem_t* new_elem = 0; - zrtp_cache_id_t id; - - ZRTP_CACHE_CHECK_ZID(one_ZID, another_ZID); - zrtp_cache_create_id(one_ZID, another_ZID, id); - - { - char zid1str[24+1], zid2str[24+1]; - ZRTP_LOG(3,(_ZTU_,"\tcache_put() zid1=%s, zis2=%s MiTM=%s\n", - hex2str(one_ZID->buffer, one_ZID->length, zid1str, sizeof(zid1str)), - hex2str(another_ZID->buffer, another_ZID->length, zid2str, sizeof(zid2str)), - is_mitm?"YES":"NO")); - } - - zrtp_mutex_lock(def_cache_protector); - do { - new_elem = get_elem(id, is_mitm); - if (!new_elem) - { - /* If cache doesn't exist - create new one */ - if (!( new_elem = (zrtp_cache_elem_t*) zrtp_sys_alloc(sizeof(zrtp_cache_elem_t)) )) { - break; - } - - zrtp_memset(new_elem, 0, sizeof(zrtp_cache_elem_t)); - ZSTR_SET_EMPTY(new_elem->curr_cache); - ZSTR_SET_EMPTY(new_elem->prev_cache); - - new_elem->secure_since = (uint32_t)(zrtp_time_now()/1000); - - mlist_add_tail(is_mitm ? &mitmcache_head : &cache_head, &new_elem->_mlist); - zrtp_memcpy(new_elem->id, id, sizeof(zrtp_cache_id_t)); - - if (is_mitm) { - new_elem->_index = g_mitmcache_elems_counter++; - } else { - new_elem->_index = g_cache_elems_counter++; - } - - ZRTP_LOG(3,(_ZTU_,"\tcache_put() can't find element in the cache - create a new entry index=%u.\n", new_elem->_index)); - } - else { - ZRTP_LOG(3,(_ZTU_,"\tcache_put() Just update existing value.\n")); - } - - /* Save current cache value as previous one and new as a current */ - if (!is_mitm) { - if (new_elem->curr_cache.length > 0) { - zrtp_zstrcpy(ZSTR_GV(new_elem->prev_cache), ZSTR_GV(new_elem->curr_cache)); - } - } - - zrtp_zstrcpy(ZSTR_GV(new_elem->curr_cache), ZSTR_GV(rss->value)); - new_elem->lastused_at = rss->lastused_at; - if (!is_mitm) { - new_elem->ttl = rss->ttl; - } - - new_elem->_is_dirty = 1; - } while (0); - zrtp_mutex_unlock(def_cache_protector); - - if (zrtp->cache_auto_store) zrtp_def_cache_store(zrtp); - - return (new_elem) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_def_cache_put( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - zrtp_shared_secret_t *rss) { - return cache_put(one_ZID, another_ZID, rss, 0); -} - -zrtp_status_t zrtp_def_cache_put_mitm( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - zrtp_shared_secret_t *rss) { - return cache_put(one_ZID, another_ZID, rss, 1); -} - - -static zrtp_status_t cache_get( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - zrtp_shared_secret_t *rss, - int prev_requested, - uint8_t is_mitm) -{ - zrtp_cache_elem_t* curr = 0; - zrtp_cache_id_t id; - zrtp_status_t s = zrtp_status_ok; - - { - char zid1str[24+1], zid2str[24+1]; - ZRTP_LOG(3,(_ZTU_,"\tache_get(): zid1=%s, zis2=%s MiTM=%s\n", - hex2str(one_ZID->buffer, one_ZID->length, zid1str, sizeof(zid1str)), - hex2str(another_ZID->buffer, another_ZID->length, zid2str, sizeof(zid2str)), - is_mitm?"YES":"NO")); - } - - ZRTP_CACHE_CHECK_ZID(one_ZID, another_ZID); - zrtp_cache_create_id(one_ZID, another_ZID, id); - - zrtp_mutex_lock(def_cache_protector); - do { - curr = get_elem(id, is_mitm); - if (!curr || (!curr->prev_cache.length && prev_requested)) { - s = zrtp_status_fail; - ZRTP_LOG(3,(_ZTU_,"\tache_get() - not found.\n")); - break; - } - - zrtp_zstrcpy( ZSTR_GV(rss->value), - prev_requested ? ZSTR_GV(curr->prev_cache) : ZSTR_GV(curr->curr_cache)); - - rss->lastused_at = curr->lastused_at; - if (!is_mitm) { - rss->ttl = curr->ttl; - } - } while (0); - zrtp_mutex_unlock(def_cache_protector); - - return s; -} - -zrtp_status_t zrtp_def_cache_get( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - zrtp_shared_secret_t *rss, - int prev_requested) -{ - return cache_get(one_ZID, another_ZID, rss, prev_requested, 0); -} - -zrtp_status_t zrtp_def_cache_get_mitm( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - zrtp_shared_secret_t *rss) -{ - return cache_get(one_ZID, another_ZID, rss, 0, 1); -} - -zrtp_status_t zrtp_def_cache_set_presh_counter( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t counter) -{ - zrtp_cache_elem_t* new_elem = 0; - zrtp_cache_id_t id; - - ZRTP_CACHE_CHECK_ZID(one_zid, another_zid); - zrtp_cache_create_id(one_zid, another_zid, id); - - zrtp_mutex_lock(def_cache_protector); - new_elem = get_elem(id, 0); - if (new_elem) { - new_elem->presh_counter = counter; - - new_elem->_is_dirty = 1; - } - zrtp_mutex_unlock(def_cache_protector); - - if (zrtp->cache_auto_store) zrtp_def_cache_store(zrtp); - - return (new_elem) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_def_cache_get_presh_counter( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - uint32_t* counter) -{ - zrtp_cache_elem_t* new_elem = 0; - zrtp_cache_id_t id; - - ZRTP_CACHE_CHECK_ZID(one_zid, another_zid); - zrtp_cache_create_id(one_zid, another_zid, id); - - zrtp_mutex_lock(def_cache_protector); - new_elem = get_elem(id, 0); - if (new_elem) { - *counter = new_elem->presh_counter; - } - zrtp_mutex_unlock(def_cache_protector); - - return (new_elem) ? zrtp_status_ok : zrtp_status_fail; -} - - void zrtp_cache_create_id( const zrtp_stringn_t* first_ZID, - const zrtp_stringn_t* second_ZID, - zrtp_cache_id_t id ) -{ - if (0 < zrtp_memcmp(first_ZID->buffer, second_ZID->buffer, sizeof(zrtp_zid_t))) { - const zrtp_stringn_t* tmp_ZID = first_ZID; - first_ZID = second_ZID; - second_ZID = tmp_ZID; - } - - zrtp_memcpy(id, first_ZID->buffer, sizeof(zrtp_zid_t)); - zrtp_memcpy((char*)id+sizeof(zrtp_zid_t), second_ZID->buffer, sizeof(zrtp_zid_t)); -} - -zrtp_cache_elem_t* zrtp_def_cache_get2(const zrtp_cache_id_t id, int is_mitm) -{ - return get_elem(id, is_mitm); -} - - -static zrtp_cache_elem_t* get_elem(const zrtp_cache_id_t id, uint8_t is_mitm) -{ - mlist_t* node = NULL; - mlist_t* head = is_mitm ? &mitmcache_head : &cache_head; - mlist_for_each(node, head) { - zrtp_cache_elem_t* elem = mlist_get_struct(zrtp_cache_elem_t, _mlist, node); - if (!zrtp_memcmp(elem->id, id, sizeof(zrtp_cache_id_t))) { - return elem; - } - } - - return NULL; -} - -static void cache_make_cross(zrtp_cache_elem_t* from, zrtp_cache_elem_t* to, uint8_t is_upload) -{ - if (!to) { - return; - } - - if (from) { - zrtp_memcpy(to, from, sizeof(zrtp_cache_elem_t)); - } - - if (is_upload) { - to->verified = zrtp_ntoh32(to->verified); - to->secure_since= zrtp_ntoh32(to->secure_since); - to->lastused_at = zrtp_ntoh32(to->lastused_at); - to->ttl = zrtp_ntoh32(to->ttl); - to->name_length = zrtp_ntoh32(to->name_length); - to->curr_cache.length = zrtp_ntoh16(to->curr_cache.length); - to->prev_cache.length = zrtp_ntoh16(to->prev_cache.length); - to->presh_counter = zrtp_ntoh32(to->presh_counter); - } else { - to->verified = zrtp_hton32(to->verified); - to->secure_since= zrtp_hton32(to->secure_since); - to->lastused_at = zrtp_hton32(to->lastused_at); - to->ttl = zrtp_hton32(to->ttl); - to->name_length = zrtp_hton32(to->name_length); - to->curr_cache.length = zrtp_hton16(to->curr_cache.length); - to->prev_cache.length = zrtp_hton16(to->prev_cache.length); - to->presh_counter = zrtp_hton32(to->presh_counter); - } -} - - -/*===========================================================================*/ -/* ZRTP cache realization as a simple binary file */ -/*===========================================================================*/ - - -#if ZRTP_HAVE_STDIO_H == 1 - #include -#endif - -#include - -/*---------------------------------------------------------------------------*/ -#define ZRTP_INT_CACHE_BREAK(s, status) \ -{ \ - if (!s) s = status; \ - break; \ -}\ - -zrtp_status_t zrtp_cache_user_init() -{ - FILE* cache_file = 0; - zrtp_cache_elem_t* new_elem = 0; - zrtp_status_t s = zrtp_status_ok; - uint32_t cache_elems_count = 0; - uint32_t mitmcache_elems_count = 0; - uint32_t i = 0; - unsigned is_unsupported = 0; - - ZRTP_LOG(3,(_ZTU_,"\tLoad ZRTP cache from <%s>...\n", zrtp->def_cache_path.buffer)); - - g_mitmcache_elems_counter = 0; - g_cache_elems_counter = 0; - g_needs_rewriting = 0; - - /* Try to open existing file. If ther is no cache file - start with empty cache */ -#if (ZRTP_PLATFORM == ZP_WIN32) - if (0 != fopen_s(&cache_file, zrtp->def_cache_path.buffer, "rb")) { - return zrtp_status_ok; - } -#else - if (0 == (cache_file = fopen(zrtp->def_cache_path.buffer, "rb"))) { - ZRTP_LOG(3,(_ZTU_,"\tCan't open file for reading.\n")); - return zrtp_status_ok; - } -#endif - /* - * Check for the cache file version number. Current version of libzrtp doesn't support - * backward compatibility in zrtp cache file structure, so we just remove the old cache file. - * - * Version field format: $ZRTP_DEF_CACHE_VERSION_STR$ZRTP_DEF_CACHE_VERSION_VAL - */ - do { - char version_buff[256]; - memset(version_buff, 0, sizeof(version_buff)); - - if (fread(version_buff, strlen(ZRTP_DEF_CACHE_VERSION_STR)+strlen(ZRTP_DEF_CACHE_VERSION_VAL), 1, cache_file) <= 0) { - ZRTP_LOG(3,(_ZTU_,"\tCache Error: Cache file is too small.\n")); - is_unsupported = 1; - break; - } - - if (0 != zrtp_memcmp(version_buff, ZRTP_DEF_CACHE_VERSION_STR, strlen(ZRTP_DEF_CACHE_VERSION_STR))) { - ZRTP_LOG(3,(_ZTU_,"\tCache Error: Can't find ZRTP Version tag in the cache file.\n")); - is_unsupported = 1; - break; - } - - ZRTP_LOG(3,(_ZTU_,"\tZRTP cache file has version=%s\n", version_buff+strlen(ZRTP_DEF_CACHE_VERSION_STR))); - - if (0 != zrtp_memcmp(version_buff+strlen(ZRTP_DEF_CACHE_VERSION_STR), ZRTP_DEF_CACHE_VERSION_VAL, strlen(ZRTP_DEF_CACHE_VERSION_VAL))) { - ZRTP_LOG(3,(_ZTU_,"\tCache Error: Unsupported ZRTP cache version.\n")); - is_unsupported = 1; - break; - } - } while (0); - - if (is_unsupported) { - ZRTP_LOG(3,(_ZTU_,"\tCache Error: Unsupported version of ZRTP cache file detected - white-out the cache.\n")); - fclose(cache_file); - return zrtp_status_ok; - } - - /* - * Load MitM caches: first 32 bits is a MiTM secrets counter. Read it and then - * upload appropriate number of MitM secrets. - */ - do { - cache_elems_count = 0; - if (fread(&mitmcache_elems_count, 4, 1, cache_file) <= 0) { - ZRTP_INT_CACHE_BREAK(s, zrtp_status_read_fail); - } - mitmcache_elems_count = zrtp_ntoh32(mitmcache_elems_count); - - ZRTP_LOG(3,(_ZTU_,"\tZRTP cache file contains %u MiTM secrets.\n", mitmcache_elems_count)); - - for (i=0; i_index = g_mitmcache_elems_counter++; - new_elem->_is_dirty = 0; - - mlist_add_tail(&mitmcache_head, &new_elem->_mlist); - } - - if (i != mitmcache_elems_count) - ZRTP_INT_CACHE_BREAK(s, zrtp_status_read_fail); - } while(0); - if (s != zrtp_status_ok) { - fclose(cache_file); - zrtp_def_cache_down(); - return s; - } - - ZRTP_LOG(3,(_ZTU_,"\tAll %u MiTM Cache entries have been uploaded.\n", g_mitmcache_elems_counter)); - - /* - * Load regular caches: first 32 bits is a secrets counter. Read it and then - * upload appropriate number of regular secrets. - */ - cache_elems_count = 0; - if (fread(&cache_elems_count, 4, 1, cache_file) <= 0) { - fclose(cache_file); - zrtp_def_cache_down(); - return zrtp_status_read_fail; - } - cache_elems_count = zrtp_ntoh32(cache_elems_count); - - ZRTP_LOG(3,(_ZTU_,"\tZRTP cache file contains %u RS secrets.\n", cache_elems_count)); - - for (i=0; i_index = g_cache_elems_counter++; - new_elem->_is_dirty = 0; - - mlist_add_tail(&cache_head, &new_elem->_mlist); - } - if (i != cache_elems_count) { - s = zrtp_status_read_fail; - } - - if (0 != fclose(cache_file)) { - zrtp_def_cache_down(); - return zrtp_status_fail; - } - - ZRTP_LOG(3,(_ZTU_,"\tAll of %u RS Cache entries have been uploaded.\n", g_cache_elems_counter)); - - return s; -} - - -#define ZRTP_DOWN_CACHE_RETURN(s, f) \ -{\ - if (zrtp_status_ok != s) { \ - ZRTP_LOG(3,(_ZTU_,"\tERROR! Unable to writing to ZRTP cache file.\n")); \ - } \ - if (f) { \ - fclose(f);\ - } \ - return s;\ -}; - -static zrtp_status_t flush_elem_(zrtp_cache_elem_t *elem, FILE *cache_file, unsigned is_mitm) { - zrtp_cache_elem_t tmp_elem; - uint32_t pos = 0; - - /* - * Let's calculate cache element position in the file - */ - -// @note: I'm going to remove unused comments when random-access cache get more stable. (vkrykun, Nov 27, 2011) -// printf("flush_elem_(): calculate Element offset for %s..\n", is_mitm?"MiTM":"RS"); - - /* Skip the header */ - pos += strlen(ZRTP_DEF_CACHE_VERSION_STR)+strlen(ZRTP_DEF_CACHE_VERSION_VAL); - - pos += sizeof(uint32_t); /* Skip MiTM secretes count. */ - -// printf("flush_elem_(): \t pos=%u (Header, MiTM Count).\n", pos); - - if (is_mitm) { - /* position within MiTM secrets block. */ - pos += (elem->_index * ZRTP_MITMCACHE_ELEM_LENGTH); -// printf("flush_elem_(): \t pos=%u (Header, MiTM Count + %u MiTM Secrets).\n", pos, elem->_index); - } else { - /* Skip MiTM Secrets block */ - pos += (g_mitmcache_elems_counter * ZRTP_MITMCACHE_ELEM_LENGTH); - - pos += sizeof(uint32_t); /* Skip RS elements count. */ - - pos += (elem->_index * ZRTP_CACHE_ELEM_LENGTH); /* Skip previous RS elements */ - -// printf("flush_elem_(): \t pos=%u (Header, MiTM Count + ALL %u Secrets, RS counter and %u prev. RS).\n", pos, g_mitmcache_elems_counter, elem->_index); - } - - fseek(cache_file, pos, SEEK_SET); - - /* Prepare element for storing, convert all fields to the network byte-order. */ - cache_make_cross(elem, &tmp_elem, 0); - -// printf("flush_elem_(): write to offset=%lu\n", ftell(cache_file)); - - /* Flush the element. */ - if (fwrite(&tmp_elem, (is_mitm ? ZRTP_MITMCACHE_ELEM_LENGTH : ZRTP_CACHE_ELEM_LENGTH), 1, cache_file) != 1) { -// printf("flush_elem_(): ERROR!!! write failed!\n"); - return zrtp_status_write_fail; - } else { - elem->_is_dirty = 0; - -// printf("flush_elem_(): OK! %lu bytes were written\n", (is_mitm ? ZRTP_MITMCACHE_ELEM_LENGTH : ZRTP_CACHE_ELEM_LENGTH)); - return zrtp_status_ok; - } -} - -zrtp_status_t zrtp_cache_user_down() -{ - FILE* cache_file = 0; - mlist_t *node = 0; - uint32_t count = 0, dirty_count=0; - uint32_t pos = 0; - - ZRTP_LOG(3,(_ZTU_,"\tStoring ZRTP cache to <%s>...\n", zrtp->def_cache_path.buffer)); - - /* Open/create file for writing */ -#if (ZRTP_PLATFORM == ZP_WIN32) - if (g_needs_rewriting || 0 != fopen_s(&cache_file, zrtp->def_cache_path.buffer, "r+")) { - if (0 != fopen_s(&cache_file, zrtp->def_cache_path.buffer, "w+")) { - ZRTP_LOG(2,(_ZTU_,"\tERROR! unable to open ZRTP cache file <%s>.\n", zrtp->def_cache_path.buffer)); - return zrtp_status_open_fail; - } - } -#else - if (g_needs_rewriting || !(cache_file = fopen(zrtp->def_cache_path.buffer, "r+"))) { - cache_file = fopen(zrtp->def_cache_path.buffer, "w+"); - if (!cache_file) { - ZRTP_LOG(2,(_ZTU_,"\tERROR! unable to open ZRTP cache file <%s>.\n", zrtp->def_cache_path.buffer)); - return zrtp_status_open_fail; - } - } -#endif - - fseek(cache_file, 0, SEEK_SET); - - /* Store version string first. Format: &ZRTP_DEF_CACHE_VERSION_STR&ZRTP_DEF_CACHE_VERSION_VAL */ - if (1 != fwrite(ZRTP_DEF_CACHE_VERSION_STR, strlen(ZRTP_DEF_CACHE_VERSION_STR), 1, cache_file)) { - ZRTP_LOG(2,(_ZTU_,"\tERROR! unable to write header to the cache file\n")); - ZRTP_DOWN_CACHE_RETURN(zrtp_status_write_fail, cache_file); - } - if (1 != fwrite(ZRTP_DEF_CACHE_VERSION_VAL, strlen(ZRTP_DEF_CACHE_VERSION_VAL), 1, cache_file)) { - ZRTP_LOG(2,(_ZTU_,"\tERROR! unable to write header to the cache file\n")); - ZRTP_DOWN_CACHE_RETURN(zrtp_status_write_fail, cache_file); - } - - /* - * Store PBX secrets first. Format: , - * - * NOTE!!! It's IMPORTANT to store PBX secrets before the Regular secrets!!! - */ - pos = ftell(cache_file); - - count = 0; dirty_count = 0; - fwrite(&count, sizeof(count), 1, cache_file); - - mlist_for_each(node, &mitmcache_head) { - zrtp_cache_elem_t* elem = mlist_get_struct(zrtp_cache_elem_t, _mlist, node); - /* Store dirty values only. */ - if (g_needs_rewriting || elem->_is_dirty) { -// printf("zrtp_cache_user_down: Store MiTM elem index=%u, not modified.\n", elem->_index); - dirty_count++; - if (zrtp_status_ok != flush_elem_(elem, cache_file, 1)) { - ZRTP_DOWN_CACHE_RETURN(zrtp_status_write_fail, cache_file); - } - } else { -// printf("zrtp_cache_user_down: Skip MiTM elem index=%u, not modified.\n", elem->_index); - } - } - - fseek(cache_file, pos, SEEK_SET); - - count = zrtp_hton32(g_mitmcache_elems_counter); - if (fwrite(&count, sizeof(count), 1, cache_file) != 1) { - ZRTP_DOWN_CACHE_RETURN(zrtp_status_write_fail, cache_file); - } - - if (dirty_count > 0) - ZRTP_LOG(3,(_ZTU_,"\t%u out of %u MiTM cache entries have been flushed successfully.\n", dirty_count, zrtp_ntoh32(count))); - - /* - * Store regular secrets. Format: , - */ - - /* Seek to the beginning of the Regular secrets block */ - pos = strlen(ZRTP_DEF_CACHE_VERSION_STR)+strlen(ZRTP_DEF_CACHE_VERSION_VAL); - pos += sizeof(uint32_t); /* Skip MiTM secrets count. */ - pos += (g_mitmcache_elems_counter * ZRTP_MITMCACHE_ELEM_LENGTH); /* Skip MiTM Secrets block */ - - fseek(cache_file, pos, SEEK_SET); - - count = 0; dirty_count=0; - fwrite(&count, sizeof(count), 1, cache_file); - - mlist_for_each(node, &cache_head) { - zrtp_cache_elem_t* elem = mlist_get_struct(zrtp_cache_elem_t, _mlist, node); - - /* Store dirty values only. */ - if (g_needs_rewriting || elem->_is_dirty) { -// printf("zrtp_cache_user_down: Store RS elem index=%u, not modified.\n", elem->_index); - dirty_count++; - if (zrtp_status_ok != flush_elem_(elem, cache_file, 0)) { - ZRTP_DOWN_CACHE_RETURN(zrtp_status_write_fail, cache_file); - } - } -// else { -// printf("zrtp_cache_user_down: Skip RS elem index=%u, not modified.\n", elem->_index); -// } - } - - fseek(cache_file, pos, SEEK_SET); - - count = zrtp_hton32(g_cache_elems_counter); - if (fwrite(&count, sizeof(count), 1, cache_file) != 1) { - ZRTP_DOWN_CACHE_RETURN(zrtp_status_write_fail, cache_file); - } - - if (dirty_count > 0) - ZRTP_LOG(3,(_ZTU_,"\t%u out of %u regular cache entries have been flushed successfully.\n", dirty_count, zrtp_ntoh32(count))); - - g_needs_rewriting = 0; - - ZRTP_DOWN_CACHE_RETURN(zrtp_status_ok, cache_file); -} - - -/*==========================================================================*/ -/* Utility functions. */ -/* These functions are example how cache can be used for internal needs */ -/*==========================================================================*/ - - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t put_name( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - const zrtp_stringn_t* name, - uint8_t is_mitm) -{ - zrtp_cache_elem_t* new_elem = 0; - zrtp_cache_id_t id; - zrtp_status_t s = zrtp_status_ok; - - ZRTP_CACHE_CHECK_ZID(one_ZID, another_ZID); - zrtp_cache_create_id(one_ZID, another_ZID, id); - - zrtp_mutex_lock(def_cache_protector); - do { - new_elem = get_elem(id, is_mitm); - if (!new_elem) { - s = zrtp_status_fail; - break; - } - - /* Update regular cache name*/ - new_elem->name_length = ZRTP_MIN(name->length, ZFONE_CACHE_NAME_LENGTH-1); - zrtp_memset(new_elem->name, 0, sizeof(new_elem->name)); - zrtp_memcpy(new_elem->name, name->buffer, new_elem->name_length); - - new_elem->_is_dirty = 1; - } while (0); - zrtp_mutex_unlock(def_cache_protector); - - if (zrtp->cache_auto_store) zrtp_def_cache_store(zrtp); - - return s; -} - - -zrtp_status_t zrtp_def_cache_put_name( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - const zrtp_stringn_t* name) -{ - return put_name(one_ZID, another_ZID, name, 0); -} - - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t get_name( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - zrtp_stringn_t* name, - uint8_t is_mitm) -{ - zrtp_cache_elem_t* new_elem = 0; - zrtp_cache_id_t id; - zrtp_status_t s = zrtp_status_fail; - - ZRTP_CACHE_CHECK_ZID(one_ZID, another_ZID); - zrtp_cache_create_id(one_ZID, another_ZID, id); - - zrtp_mutex_lock(def_cache_protector); - do { - new_elem = get_elem(id, is_mitm); - if (!new_elem) { - s = zrtp_status_fail; - break; - } - - name->length = new_elem->name_length; - zrtp_memcpy(name->buffer, new_elem->name, name->length); - s = zrtp_status_ok; - } while (0); - zrtp_mutex_unlock(def_cache_protector); - - return s; -} - -zrtp_status_t zrtp_def_cache_get_name( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid, - zrtp_stringn_t* name) -{ - return get_name(one_zid, another_zid, name, 0); -} - - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_def_cache_get_since( const zrtp_stringn_t* one_ZID, - const zrtp_stringn_t* another_ZID, - uint32_t* since) -{ - zrtp_cache_elem_t* new_elem = 0; - zrtp_cache_id_t id; - - ZRTP_CACHE_CHECK_ZID(one_ZID, another_ZID); - zrtp_cache_create_id(one_ZID, another_ZID, id); - - zrtp_mutex_lock(def_cache_protector); - new_elem = get_elem(id, 0); - if (new_elem) { - *since = new_elem->secure_since; - } - zrtp_mutex_unlock(def_cache_protector); - - return (new_elem) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_def_cache_reset_since( const zrtp_stringn_t* one_zid, - const zrtp_stringn_t* another_zid) -{ - zrtp_cache_elem_t* new_elem = 0; - zrtp_cache_id_t id; - - ZRTP_CACHE_CHECK_ZID(one_zid, another_zid); - zrtp_cache_create_id(one_zid, another_zid, id); - - zrtp_mutex_lock(def_cache_protector); - new_elem = get_elem(id, 0); - if (new_elem) { - new_elem->secure_since = (uint32_t)(zrtp_time_now()/1000); - - new_elem->_is_dirty = 1; - } - zrtp_mutex_unlock(def_cache_protector); - - if (zrtp->cache_auto_store) zrtp_def_cache_store(zrtp); - - return (new_elem) ? zrtp_status_ok : zrtp_status_fail; -} - - -/*----------------------------------------------------------------------------*/ -void zrtp_def_cache_foreach( zrtp_global_t *global, - int is_mitm, - zrtp_cache_callback_t callback, - void *data) -{ - int delete, result; - unsigned index_decrease = 0; - mlist_t* node = NULL, *tmp_node = NULL; - - zrtp_mutex_lock(def_cache_protector); - mlist_for_each_safe(node, tmp_node, (is_mitm ? &mitmcache_head : &cache_head)) - { - zrtp_cache_elem_t* elem = mlist_get_struct(zrtp_cache_elem_t, _mlist, node); - - /* - * We are about to delete cache element, in order to keep our - * random-access file working, we should re-arrange indexes of - * cache elements go after the deleting one. - */ - if (index_decrease >0) { - elem->_index -= index_decrease; - } - - delete = 0; - result = callback(elem, is_mitm, data, &delete); - if (delete) { - { - char idstr[24*2+1]; - ZRTP_LOG(3,(_ZTU_,"\trtp_def_cache_foreach() Delete element id=%s index=%u\n", - hex2str((const char*)elem->id, sizeof(elem->id), idstr, sizeof(idstr)), - elem->_index)); - } - - index_decrease++; - - mlist_del(&elem->_mlist); - - /* Decrement global cache counter. */ - if (is_mitm) - g_mitmcache_elems_counter--; - else - g_cache_elems_counter--; - - g_needs_rewriting = 1; - } - if (!result) { - break; - } - } - zrtp_mutex_unlock(def_cache_protector); - - return; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_def_cache_store(zrtp_global_t *zrtp) -{ - zrtp_mutex_lock(def_cache_protector); - zrtp_cache_user_down(); - zrtp_mutex_unlock(def_cache_protector); - - return zrtp_status_ok; -} - -#endif /* ZRTP_PLATFORM != ZP_WIN32_KERNEL */ - -#endif /* ZRTP_USE_BUILTIN_CACHE */ diff --git a/libs/libzrtp/src/zrtp_iface_scheduler.c b/libs/libzrtp/src/zrtp_iface_scheduler.c deleted file mode 100644 index fe4a2fd014..0000000000 --- a/libs/libzrtp/src/zrtp_iface_scheduler.c +++ /dev/null @@ -1,375 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#define _POSIX_C_SOURCE 199309L /* for struct timespec */ -#include "zrtp.h" - -#if (defined(ZRTP_USE_BUILTIN_SCEHDULER) && (ZRTP_USE_BUILTIN_SCEHDULER ==1)) -#if (ZRTP_PLATFORM!=ZP_SYMBIAN) - -#if defined (ZRTP_DEBUG_WITH_PJSIP) && (ZRTP_DEBUG_WITH_PJSIP == 1) -# include -#endif - -/* Windows kernel have it's own realization based on kernel timers */ -#if (ZRTP_PLATFORM != ZP_WIN32_KERNEL) - -#define ZRTP_SCHED_QUEUE_SIZE ZRTP_MAX_STREAMS_PER_SESSION * 1000 -#define ZRTP_SCHED_LOOP_QVANT 20 - -#define ZRTP_SCHED_SLEEP(count) zrtp_sleep(ZRTP_SCHED_LOOP_QVANT*count); - - -/** Schedulling tasks structure */ -typedef struct -{ - zrtp_stream_t *ctx; /** ZRTP stream context associated with the task */ - zrtp_retry_task_t *ztask; /** ZRTP stream associated with the task */ - uint64_t wake_at; /* Wake time in milliseconds */ - mlist_t _mlist; -} zrtp_sched_task_t; - -/** Initiation flag. Protection from reinitialization. (1 if initiated) */ -static uint8_t inited = 0; - -/** Sorted by wake time tasks list. First task to do at the begining */ -static mlist_t tasks_head; - -/** Tasks queue protector againts race conditions on add/remove tasks */ -static zrtp_mutex_t* protector = NULL; - -/** Main queue symaphore */ -static zrtp_sem_t* count = NULL; - -static uint8_t is_running = 0; -#if (ZRTP_PLATFORM == ZP_WIN32 || ZRTP_PLATFORM == ZP_WINCE) -HANDLE scheduler_thread = NULL; -#else -static uint8_t is_working = 0; -#endif - - -/*==========================================================================*/ -/* Platform Dependent Routine */ -/*==========================================================================*/ - -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WINCE) -#include - -int zrtp_sleep(unsigned int msec) -{ - Sleep(msec); - return 0; -} - -int zrtp_thread_create(zrtp_thread_routine_t start_routine, void *arg) -{ - DWORD dwThreadId; - - scheduler_thread = CreateThread(NULL, 0, start_routine, 0, 0, &dwThreadId); - if (NULL == scheduler_thread) { - return -1; - } - - return 0; -} - -#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || (ZRTP_PLATFORM == ZP_ANDROID) -/* POSIX.1-2008 removes usleep, so use nanosleep instead when available */ -#if ZRTP_HAVE_NANOSLEEP -#include /* for nanosleep */ -#elif ZRTP_HAVE_UNISTD_H == 1 -#include -#else -#error "Used environment dosn't have - zrtp_scheduler can't be build." -#endif - -#if ZRTP_HAVE_PTHREAD_H == 1 -#include -#else -# error "Used environment dosn't have - zrtp_scheduler can't be build." -#endif - -int zrtp_sleep(unsigned int msec) -{ -#if ZRTP_HAVE_NANOSLEEP - struct timespec delay; - delay.tv_sec = msec / 1000; - delay.tv_nsec = (msec % 1000) * 1000000; - while (nanosleep(&delay, &delay)); -#else - usleep(msec*1000); -#endif - return 0; -} - -int zrtp_thread_create(zrtp_thread_routine_t start_routine, void *arg) -{ - pthread_t thread; - return pthread_create(&thread, NULL, start_routine, arg); -} -#endif - - -/*==========================================================================*/ -/* Scheduler Implementation */ -/*==========================================================================*/ -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN64) || (ZRTP_PLATFORM == ZP_WINCE) -static DWORD WINAPI sched_loop(void* param) -#elif (ZRTP_PLATFORM == ZP_SYMBIAN) -static int sched_loop(void* param) -#else -static void* sched_loop(void* param) -#endif -{ -#if defined (ZRTP_DEBUG_WITH_PJSIP) && (ZRTP_DEBUG_WITH_PJSIP == 1) - /* - Register current thread if it was created by - external system call(not pj_sip call) - */ - pj_thread_desc desc; - pj_thread_t *sched_loop_thread; - - if (pj_thread_is_registered()==PJ_FALSE){ - pj_thread_register("zrtp_sched_loop_thread", desc, &sched_loop_thread); - } -#endif - -#if (ZRTP_PLATFORM != ZP_WIN32 && ZRTP_PLATFORM != ZP_WINCE) - is_working = 1; -#endif - while (is_running) - { - zrtp_sched_task_t* task = NULL; - zrtp_sched_task_t task2run; - int ready_2_run = 0; - mlist_t* node = 0; - - /* Wait for tasks in queue */ - zrtp_sem_wait(count); - - zrtp_mutex_lock(protector); - - node = mlist_get(&tasks_head); - if (!node) { - zrtp_mutex_unlock(protector); - continue; - } - - task = mlist_get_struct(zrtp_sched_task_t, _mlist, node); - if (task->wake_at <= zrtp_time_now()) - { - task2run.ctx = task->ctx; - task2run.ztask = task->ztask; - mlist_del(node); - zrtp_sys_free(task); - ready_2_run = 1; - } - - zrtp_mutex_unlock(protector); - - if (ready_2_run) { - task2run.ztask->_is_busy = 1; - task2run.ztask->callback(task2run.ctx, task2run.ztask); - task2run.ztask->_is_busy = 0; - } else { - zrtp_sem_post(count); - } - - ZRTP_SCHED_SLEEP(1); - } - -#if (ZRTP_PLATFORM != ZP_WIN32)&& (ZRTP_PLATFORM != ZP_WINCE) - is_working = 0; -#endif - -#if (ZRTP_PLATFORM != ZP_WIN32) && (ZRTP_PLATFORM != ZP_WIN64) && (ZRTP_PLATFORM != ZP_WINCE) - return NULL; -#else - return 0; -#endif -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_def_scheduler_init(zrtp_global_t* zrtp) -{ - zrtp_status_t status = zrtp_status_ok; - - if (inited) { - return zrtp_status_ok; - } - - do { - init_mlist(&tasks_head); - - if (zrtp_status_ok != (status = zrtp_mutex_init(&protector))) { - break; - } - if (zrtp_status_ok != (status = zrtp_sem_init(&count, 0, ZRTP_SCHED_QUEUE_SIZE))) { - break; - } - - /* Starting processing loop */ - is_running = 1; - - if (0 != zrtp_thread_create(sched_loop, NULL)) { - zrtp_sem_destroy(count); - zrtp_mutex_destroy(protector); - - status = zrtp_status_fail; - break; - } - - inited = 1; - } while (0); - - return status; -} - -/*---------------------------------------------------------------------------*/ -void zrtp_def_scheduler_down() -{ - mlist_t *node = 0, *tmp = 0; - - if (!inited) { - return; - } - - /* Stop main thread */ - is_running = 0; - zrtp_sem_post(count); -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WINCE) - if (NULL != scheduler_thread) - { - WaitForSingleObject(scheduler_thread, INFINITE); - CloseHandle(scheduler_thread); - scheduler_thread = NULL; - } -#else - while (is_working) { - ZRTP_SCHED_SLEEP(1); - } -#endif - - /* Then destroy tasks queue and realease all other resources */ - zrtp_mutex_lock(protector); - - mlist_for_each_safe(node, tmp, &tasks_head) { - zrtp_sched_task_t* task = mlist_get_struct(zrtp_sched_task_t, _mlist, node); - zrtp_sys_free(task); - } - init_mlist(&tasks_head); - - zrtp_mutex_unlock(protector); - - zrtp_mutex_destroy(protector); - zrtp_sem_destroy(count); - - inited = 0; -} - -/*---------------------------------------------------------------------------*/ -void zrtp_def_scheduler_call_later(zrtp_stream_t *ctx, zrtp_retry_task_t* ztask) -{ - mlist_t *node=0, *tmp=0; - mlist_t* last = &tasks_head; - - zrtp_mutex_lock(protector); - - if (!ztask->_is_enabled) { - zrtp_mutex_unlock(protector); - return; - } - - do { - zrtp_sched_task_t* new_task = zrtp_sys_alloc(sizeof(zrtp_sched_task_t)); - if (!new_task) { - break; - } - - new_task->ctx = ctx; - new_task->ztask = ztask; - new_task->wake_at = zrtp_time_now() + ztask->timeout; - - /* Try to find element with later wacked time than we have */ - mlist_for_each_safe(node, tmp, &tasks_head) { - zrtp_sched_task_t* tmp_task = mlist_get_struct(zrtp_sched_task_t, _mlist, node); - if (tmp_task->wake_at >= new_task->wake_at) { - last = node; - break; - } - } - - /* - * If packet wasn't inserted (empty queue or all elements are smaller) - * Put them to the end of the queue. - */ - mlist_insert(last, &new_task->_mlist); - - zrtp_sem_post(count); - } while (0); - - zrtp_mutex_unlock(protector); -} - -/*---------------------------------------------------------------------------*/ -void zrtp_def_scheduler_cancel_call_later(zrtp_stream_t* ctx, zrtp_retry_task_t* ztask) -{ - mlist_t *node=0, *tmp=0; - - zrtp_mutex_lock(protector); - - mlist_for_each_safe(node, tmp, &tasks_head) { - zrtp_sched_task_t* task = mlist_get_struct(zrtp_sched_task_t, _mlist, node); - if ((task->ctx == ctx) && ((task->ztask == ztask) || !ztask)) { - mlist_del(&task->_mlist); - zrtp_sys_free(task); - zrtp_sem_trtwait(count); - if (ztask) { - break; - } - } - } - - zrtp_mutex_unlock(protector); -} - -void zrtp_def_scheduler_wait_call_later(zrtp_stream_t* ctx) -{ - while (ctx->messages.hello_task._is_busy) { - ZRTP_SCHED_SLEEP(1); - } - while (ctx->messages.commit_task._is_busy) { - ZRTP_SCHED_SLEEP(1); - } - while (ctx->messages.dhpart_task._is_busy) { - ZRTP_SCHED_SLEEP(1); - } - while (ctx->messages.confirm_task._is_busy) { - ZRTP_SCHED_SLEEP(1); - } - while (ctx->messages.error_task._is_busy) { - ZRTP_SCHED_SLEEP(1); - } - while (ctx->messages.errorack_task._is_busy) { - ZRTP_SCHED_SLEEP(1); - } - while (ctx->messages.goclear_task._is_busy) { - ZRTP_SCHED_SLEEP(1); - } - while (ctx->messages.dh_task._is_busy) { - ZRTP_SCHED_SLEEP(1); - } -} - -#endif /* not for windows kernel */ - -#endif // ZRTP_PLATFORM==ZP_SYMBIAN - -#endif /*ZRTP_USE_BUILTIN_SCEHDULER*/ diff --git a/libs/libzrtp/src/zrtp_iface_sys.c b/libs/libzrtp/src/zrtp_iface_sys.c deleted file mode 100644 index f26b651a38..0000000000 --- a/libs/libzrtp/src/zrtp_iface_sys.c +++ /dev/null @@ -1,489 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#if (defined(ZRTP_USE_BUILTIN) && (ZRTP_USE_BUILTIN == 1)) - -/*============================================================================*/ -/* Default realization of Mutexes synchronization routine */ -/*============================================================================*/ - -/*---------------------------------------------------------------------------*/ -#if (ZRTP_PLATFORM == ZP_WIN32_KERNEL) -#include - -struct zrtp_mutex_t -{ - NDIS_SPIN_LOCK mutex; -}; - -zrtp_status_t zrtp_mutex_init(zrtp_mutex_t **mutex) -{ - zrtp_mutex_t* new_mutex = zrtp_sys_alloc(sizeof(zrtp_mutex_t)); - if (!new_mutex) - return zrtp_status_alloc_fail; - NdisAllocateSpinLock(&new_mutex->mutex); - *mutex = new_mutex; - return zrtp_status_ok; -} - -zrtp_status_t zrtp_mutex_destroy(zrtp_mutex_t* mutex) -{ - NdisFreeSpinLock(&mutex->mutex); - zrtp_sys_free(mutex); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_mutex_lock(zrtp_mutex_t* mutex) -{ - NdisAcquireSpinLock(&mutex->mutex); - return zrtp_status_ok; -} - -zrtp_status_t zrtp_mutex_unlock(zrtp_mutex_t* mutex) -{ - NdisReleaseSpinLock(&mutex->mutex); - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -#elif (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN64) || (ZRTP_PLATFORM == ZP_WINCE) - -#include - -struct zrtp_mutex_t -{ - HANDLE mutex; -}; - -zrtp_status_t zrtp_mutex_init(zrtp_mutex_t** mutex) -{ - zrtp_mutex_t* new_mutex = zrtp_sys_alloc(sizeof(zrtp_mutex_t)); - if (!new_mutex) - return zrtp_status_alloc_fail; - new_mutex->mutex = CreateMutex(NULL, FALSE, NULL); - if (!new_mutex->mutex) { - zrtp_sys_free(new_mutex); - return zrtp_status_fail; - } - *mutex = new_mutex; - return zrtp_status_ok; -} - -zrtp_status_t zrtp_mutex_destroy(zrtp_mutex_t* mutex) -{ - zrtp_status_t s = (0 == CloseHandle(mutex->mutex)) ? zrtp_status_fail : zrtp_status_ok; - zrtp_sys_free(mutex); - return s; -} - -zrtp_status_t zrtp_mutex_lock(zrtp_mutex_t* mutex) -{ - return (WaitForSingleObject(mutex->mutex, INFINITE) == WAIT_FAILED) ? zrtp_status_fail : zrtp_status_ok; -} - -zrtp_status_t zrtp_mutex_unlock(zrtp_mutex_t* mutex) -{ - return (0 == ReleaseMutex(mutex->mutex)) ? zrtp_status_fail : zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || (ZRTP_PLATFORM == ZP_ANDROID) - -#if defined ZRTP_HAVE_PTHREAD_H -# include -#endif - -struct zrtp_mutex_t -{ - pthread_mutex_t mutex; -}; - - -zrtp_status_t zrtp_mutex_init(zrtp_mutex_t** mutex) -{ - zrtp_mutex_t* new_mutex = zrtp_sys_alloc(sizeof(zrtp_mutex_t)); - if (new_mutex) { - zrtp_status_t s = pthread_mutex_init(&new_mutex->mutex, NULL) == 0 ? zrtp_status_ok : zrtp_status_fail; - if (s == zrtp_status_fail) - zrtp_sys_free(new_mutex); - else - *mutex = new_mutex; - return s; - } - return zrtp_status_alloc_fail; -} - -zrtp_status_t zrtp_mutex_destroy(zrtp_mutex_t* mutex) -{ - zrtp_status_t s = (pthread_mutex_destroy(&mutex->mutex) == 0) ? zrtp_status_ok : zrtp_status_fail; - zrtp_sys_free(mutex); - return s; -} - -zrtp_status_t zrtp_mutex_lock(zrtp_mutex_t* mutex) -{ - return (pthread_mutex_lock(&mutex->mutex) == 0) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_mutex_unlock(zrtp_mutex_t* mutex) -{ - return (pthread_mutex_unlock(&mutex->mutex) == 0) ? zrtp_status_ok : zrtp_status_fail; -} - -#endif - - -/*============================================================================*/ -/* Default realization of Semaphores synchronization routine */ -/*============================================================================*/ - -#if (ZRTP_PLATFORM == ZP_WIN32_KERNEL) - -struct zrtp_sem_t -{ - KSEMAPHORE sem; -}; - -zrtp_status_t zrtp_sem_init(zrtp_sem_t** sem, uint32_t val, uint32_t limit) -{ - zrtp_sem_t *new_sem = zrtp_sys_alloc(sizeof(zrtp_sem_t)); - if (NULL == new_sem) { - return zrtp_status_alloc_fail; - } - - KeInitializeSemaphore(&new_sem->sem, val, limit); - *sem = new_sem; - return zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_destroy(zrtp_sem_t* sem) -{ - return zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_wait(zrtp_sem_t* sem) -{ - return KeWaitForSingleObject(&sem->sem, Executive, KernelMode, FALSE, NULL) == STATUS_SUCCESS ? - zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_sem_trtwait(zrtp_sem_t* sem) -{ - LARGE_INTEGER timeout; - timeout.QuadPart = 0; - - return KeWaitForSingleObject(&sem->sem, Executive, KernelMode, FALSE, &timeout) == STATUS_SUCCESS ? - zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_sem_post(zrtp_sem_t* sem) -{ - KeReleaseSemaphore(&sem->sem, IO_NO_INCREMENT, 1, FALSE); - return zrtp_status_ok; -} - - -#elif (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN64) || (ZRTP_PLATFORM == ZP_WINCE) - -struct zrtp_sem_t -{ - HANDLE sem; -}; - -zrtp_status_t zrtp_sem_init(zrtp_sem_t** sem, uint32_t val, uint32_t limit) -{ - zrtp_sem_t *new_sem = zrtp_sys_alloc(sizeof(zrtp_sem_t)); - if (NULL == new_sem) { - return zrtp_status_alloc_fail; - } - - new_sem->sem = CreateSemaphore(NULL, val, limit, NULL); - if (!new_sem->sem) { - zrtp_sys_free(new_sem); - return zrtp_status_fail; - } - *sem = new_sem; - return zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_destroy(zrtp_sem_t* sem) -{ - zrtp_status_t s = (0 == CloseHandle(sem->sem)) ? zrtp_status_fail : zrtp_status_ok; - zrtp_sys_free(sem); - return s; -} - -zrtp_status_t zrtp_sem_wait(zrtp_sem_t* sem) -{ - return (WaitForSingleObject(sem->sem, INFINITE) == WAIT_FAILED) ? zrtp_status_fail : zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_trtwait(zrtp_sem_t* sem) -{ - return (WaitForSingleObject(sem->sem, 0) == WAIT_OBJECT_0) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_sem_post(zrtp_sem_t* sem) -{ - return (0 == ReleaseSemaphore(sem->sem, 1, NULL)) ? zrtp_status_fail : zrtp_status_ok; -} - -#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || (ZRTP_PLATFORM == ZP_ANDROID) - -#if defined ZRTP_HAVE_STDIO_H -# include -#endif -#if ZRTP_HAVE_SEMAPHORE_H -# include -#endif -#if ZRTP_HAVE_FCNTL_H -# include -#endif -#if ZRTP_HAVE_ERRNO_H -# include -#endif - - -#if (ZRTP_PLATFORM == ZP_DARWIN) - -struct zrtp_sem_t -{ - sem_t* sem; -}; - -zrtp_status_t zrtp_sem_init(zrtp_sem_t** sem, uint32_t value, uint32_t limit) -{ - zrtp_status_t s = zrtp_status_ok; - char name_buff[48]; - zrtp_time_t now = zrtp_time_now(); - - zrtp_sem_t *new_sem = (zrtp_sem_t*)zrtp_sys_alloc(sizeof(zrtp_sem_t)); - if (0 == new_sem) { - return zrtp_status_alloc_fail; - } - - /* - * This bogusness is to follow what appears to be the lowest common - * denominator in Posix semaphore naming: - * - start with '/' - * - be at most 15 chars - * - be unique and not match anything on the filesystem - * We suppose to generate unique name for every semaphore in the system. - */ - - sprintf(name_buff, "/libzrtp.%llxZ%llx", now/1000, now); - new_sem->sem = sem_open(name_buff, O_CREAT | O_EXCL, S_IRUSR|S_IWUSR, value); - if ((sem_t *)SEM_FAILED == new_sem->sem) { - if (errno == ENAMETOOLONG) { - name_buff[13] = '\0'; - } else if (errno == EEXIST) { - sprintf(name_buff, "/libzrtp.%llxZ%llx", now, now/1000); - } else { - s = zrtp_status_fail; - } - new_sem->sem = sem_open(name_buff, O_CREAT | O_EXCL, 0644, value); - } - - if (new_sem->sem == (sem_t *)SEM_FAILED) { - s = zrtp_status_fail; - zrtp_sys_free(new_sem); - } else { - sem_unlink(name_buff); - *sem = new_sem; - } - - return s; -} - -zrtp_status_t zrtp_sem_destroy(zrtp_sem_t* sem) -{ - zrtp_status_t s = sem_close(sem->sem); - zrtp_sys_free(sem); - if (0 != s) { - s = zrtp_status_fail; - } - - return s; -} - -zrtp_status_t zrtp_sem_wait(zrtp_sem_t* sem) -{ - return (sem_wait(sem->sem) == 0) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_sem_trtwait(zrtp_sem_t* sem) -{ - return (sem_trywait(sem->sem) == 0) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_sem_post(zrtp_sem_t* sem) -{ - return (sem_post(sem->sem) == 0) ? zrtp_status_ok : zrtp_status_fail; -} - -#else - -struct zrtp_sem_t -{ - sem_t sem; -}; - - -zrtp_status_t zrtp_sem_init(zrtp_sem_t** sem, uint32_t value, uint32_t limit) -{ - zrtp_sem_t *new_sem = (zrtp_sem_t*)zrtp_sys_alloc(sizeof(zrtp_sem_t)); - if (NULL == new_sem) { - return zrtp_status_alloc_fail; - } - - if (sem_init(&new_sem->sem, 0, value) != 0) { - zrtp_sys_free(new_sem); - return zrtp_status_fail; - } - - *sem = new_sem; - return zrtp_status_ok; -} - -zrtp_status_t zrtp_sem_destroy(zrtp_sem_t* sem) -{ - zrtp_status_t s = sem_destroy(&sem->sem) == 0 ? zrtp_status_ok : zrtp_status_fail; - zrtp_sys_free(sem); - return s; -} - -zrtp_status_t zrtp_sem_wait(zrtp_sem_t* sem) -{ - return (sem_wait(&sem->sem) == 0) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_sem_trtwait(zrtp_sem_t* sem) -{ - return (sem_trywait(&sem->sem) == 0) ? zrtp_status_ok : zrtp_status_fail; -} - -zrtp_status_t zrtp_sem_post(zrtp_sem_t* sem) -{ - return (sem_post(&sem->sem) == 0) ? zrtp_status_ok : zrtp_status_fail; -} - - -#endif - - -#endif - - -/*============================================================================*/ -/* Default realization of general routine */ -/*============================================================================*/ - -#if defined ZRTP_HAVE_STRING_H -# include /* for memset() and memcpy() */ -#endif - -/*----------------------------------------------------------------------------*/ -#if (ZRTP_PLATFORM == ZP_WIN32_KERNEL) - -void* zrtp_sys_alloc(unsigned int size) -{ - void *VA; - return (NDIS_STATUS_SUCCESS != NdisAllocateMemoryWithTag(&VA, size, (ULONG)"zrtp")) ? NULL : VA; -} - -void zrtp_sys_free(void* obj) -{ - /* Length is 0 because memory was allocated with TAG */ - NdisFreeMemory(obj, 0, 0); -} - -void* zrtp_memcpy(void* dest, const void* src, unsigned int length) -{ - return memcpy(dest,src,length); -} - -void *zrtp_memset(void *s, int c, unsigned int n) -{ - return memset(s, c, n); -} - -zrtp_time_t zrtp_time_now() -{ - LARGE_INTEGER ft; - KeQuerySystemTime(&ft); - - ft.QuadPart -= 116444736000000000; - return (zrtp_time_t)(ft.QuadPart) / 10000; -} -#else - -/*---------------------------------------------------------------------------*/ -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN64) || (ZRTP_PLATFORM == ZP_WINCE) - -zrtp_time_t zrtp_time_now() -{ - LONGLONG ft; - -#if ZRTP_PLATFORM != ZP_WINCE - GetSystemTimeAsFileTime((LPFILETIME)&ft); -#else - SYSTEMTIME SystemTime; - GetSystemTime(&SystemTime); - SystemTimeToFileTime(&SystemTime, (LPFILETIME)&ft); -#endif - - ft -= 116444736000000000; - return (zrtp_time_t)(ft) / 10000; -} - -/*---------------------------------------------------------------------------*/ -#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_SYMBIAN) || (ZRTP_PLATFORM == ZP_BSD) || (ZRTP_PLATFORM == ZP_ANDROID) - -#if defined ZRTP_HAVE_SYS_TIME_H -# include -#endif - -zrtp_time_t zrtp_time_now() -{ - struct timeval tv; - if (0 == gettimeofday(&tv, 0)) { - return (zrtp_time_t)(tv.tv_sec)*1000 + (zrtp_time_t)(tv.tv_usec)/1000; - } - return 0; -} -#endif - - -void *zrtp_memset(void *s, int c, unsigned int n) -{ - memset(s, c, n); - return s; -} - -void* zrtp_memcpy(void* dest, const void* src, unsigned int length) -{ - memcpy(dest, src, (size_t)length); - return dest; -} - -void* zrtp_sys_alloc(unsigned int size) -{ - return malloc((size_t)size); -} - -void zrtp_sys_free(void* obj) -{ - free(obj); -} - -#endif /* default platform-dependent components realizations */ - -#endif /*ZRTP_USE_BUILTIN*/ diff --git a/libs/libzrtp/src/zrtp_initiator.c b/libs/libzrtp/src/zrtp_initiator.c deleted file mode 100644 index c23eb78512..0000000000 --- a/libs/libzrtp/src/zrtp_initiator.c +++ /dev/null @@ -1,557 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp initiator" - -extern zrtp_status_t _zrtp_machine_start_initiating_secure(zrtp_stream_t *stream); - -/*! These functions set constructs and start ZRTP messages replays */ -static zrtp_status_t _zrtp_machine_start_send_and_resend_commit(zrtp_stream_t *stream); -static zrtp_status_t _zrtp_machine_start_send_and_resend_dhpart2(zrtp_stream_t *stream); -static zrtp_status_t _zrtp_machine_start_send_and_resend_confirm2(zrtp_stream_t *stream); - -/*! - * We need to know the contents of the DH2 packet before we send the Commit to - * compute the hash value. So, we construct DH packet but don't send it till - * WAITING_FOR_CONFIRM1 state. -*/ -static void _prepare_dhpart2(zrtp_stream_t *stream); - -/* - * Parses DH packet: check for MitM1 attack and makes a copy of the packet for - * later. \exception: Handles all exceptions -- informs user and switches to - * CLEAR.(MITM attacks) - */ -static zrtp_status_t _zrtp_machine_process_incoming_dhpart1( zrtp_stream_t *stream, - zrtp_rtp_info_t *packet); -/* - * Just a wrapper over the protocol::_zrtp_machine_process_confirm(). - * \exception: Handles all exceptions -- informs user and switches to - * CLEAR. (SOFTWARE) - */ -static zrtp_status_t _zrtp_machine_process_incoming_confirm1( zrtp_stream_t *stream, - zrtp_rtp_info_t *packet); - - -/*===========================================================================*/ -/* State handlers */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_initiatingsecure( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_COMMIT: - if (ZRTP_STATEMACHINE_RESPONDER == _zrtp_machine_preparse_commit(stream, packet)) { - _zrtp_cancel_send_packet_later(stream, ZRTP_COMMIT); - s = _zrtp_machine_enter_pendingsecure(stream, packet); - } - break; - - case ZRTP_DHPART1: - if (ZRTP_IS_STREAM_DH(stream)) { - _zrtp_cancel_send_packet_later(stream, ZRTP_COMMIT); - - s = _zrtp_machine_process_incoming_dhpart1(stream, packet); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! _zrtp_machine_process_incoming_dhpart1() failed with status=%d ID=%u\n.", s, stream->id)); - break; - } - - _zrtp_machine_start_send_and_resend_dhpart2(stream); - - /* Perform Key generation according to draft 5.6 */ - s = _zrtp_set_public_value(stream, 1); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! set_public_value1() failed with status=%d ID=%u.\n", s, stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); - break; - } - - _zrtp_change_state(stream, ZRTP_STATE_WAIT_CONFIRM1); - } - break; - - case ZRTP_CONFIRM1: - if (ZRTP_IS_STREAM_FAST(stream)) { - s = _zrtp_set_public_value(stream, 1); - if (zrtp_status_ok != s) { - break; - } - - s = _zrtp_machine_process_incoming_confirm1(stream, packet); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! process_incoming_confirm1() failed with status=%d ID=%u.\n", s, stream->id)); - break; - } - - _zrtp_cancel_send_packet_later(stream, ZRTP_COMMIT); - _zrtp_change_state(stream, ZRTP_STATE_WAIT_CONFIRMACK); - s = _zrtp_machine_start_send_and_resend_confirm2(stream); - } - break; - - case ZRTP_NONE: - s = zrtp_status_drop; - break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_waitconfirm1( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_CONFIRM1: - s = _zrtp_machine_process_incoming_confirm1(stream, packet); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! process_incoming_confirm1() failed with status=%d ID=%u.\n", s, stream->id)); - break; - } - - _zrtp_change_state(stream, ZRTP_STATE_WAIT_CONFIRMACK); - _zrtp_cancel_send_packet_later(stream, ZRTP_DHPART2); - s = _zrtp_machine_start_send_and_resend_confirm2(stream); - break; - - case ZRTP_NONE: - s = zrtp_status_drop; - break; - - default: - break; - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_waitconfirmack( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_NONE: - s = _zrtp_protocol_decrypt(stream->protocol, packet, 1); - if (s == zrtp_status_ok) { - /* - * High level functions triggers mutexes for protocol messages only. - * We have manually protect this transaction triggered by media packet, not protocol packet. - */ - zrtp_mutex_lock(stream->stream_protector); - - ZRTP_LOG(3,(_ZTU_, "Received FIRST VALID SRTP packet - switching to SECURE state. ID=%u\n", stream->id)); - _zrtp_cancel_send_packet_later(stream, ZRTP_CONFIRM2); - _zrtp_machine_enter_secure(stream); - - zrtp_mutex_unlock(stream->stream_protector); - } - break; - - case ZRTP_CONFIRM2ACK: - _zrtp_cancel_send_packet_later(stream, ZRTP_CONFIRM2); - s = _zrtp_machine_enter_secure(stream); - break; - - default: - break; - } - - return s; -} - - -/*===========================================================================*/ -/* State switchers */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_enter_initiatingsecure(zrtp_stream_t* stream) -{ - zrtp_status_t s = zrtp_status_ok; - - ZRTP_LOG(3,(_ZTU_,"\tENTER STATE INITIATING SECURE for ID=%u mode=%s state=%s.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - if (!ZRTP_IS_STREAM_MULT(stream)) { - uint8_t id = ZRTP_COMP_UNKN; - zrtp_session_t *session = stream->session; - zrtp_packet_Hello_t *peer_hello = &stream->messages.peer_hello; - - /* - * ZRTP specification provides that default crypto components may be - * omitted from the Hello message, so we initialize components with - * default values. - */ - session->hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_HASH_SHA256, session->zrtp); - session->blockcipher = zrtp_comp_find(ZRTP_CC_CIPHER, ZRTP_CIPHER_AES128, session->zrtp); - session->authtaglength = zrtp_comp_find(ZRTP_CC_ATL, ZRTP_ATL_HS32, session->zrtp); - session->sasscheme = zrtp_comp_find(ZRTP_CC_SAS, ZRTP_SAS_BASE32, session->zrtp); - - id = _zrtp_choose_best_comp(&session->profile, peer_hello, ZRTP_CC_HASH); - if (id != ZRTP_COMP_UNKN) { - session->hash = zrtp_comp_find(ZRTP_CC_HASH, id, session->zrtp); - } - id = _zrtp_choose_best_comp(&session->profile, peer_hello, ZRTP_CC_CIPHER); - if (id != ZRTP_COMP_UNKN) { - session->blockcipher = zrtp_comp_find(ZRTP_CC_CIPHER, id, session->zrtp); - } - id = _zrtp_choose_best_comp(&session->profile, peer_hello, ZRTP_CC_ATL); - if (id != ZRTP_COMP_UNKN) { - session->authtaglength = zrtp_comp_find(ZRTP_CC_ATL, id, session->zrtp); - } - id = _zrtp_choose_best_comp(&session->profile, peer_hello, ZRTP_CC_SAS); - if (id != ZRTP_COMP_UNKN) { - session->sasscheme = zrtp_comp_find(ZRTP_CC_SAS, id, session->zrtp); - } - - ZRTP_LOG(3,(_ZTU_,"\tInitiator selected following options:\n")); - ZRTP_LOG(3,(_ZTU_,"\t Hash: %.4s\n", session->hash->base.type)); - ZRTP_LOG(3,(_ZTU_,"\t Cipher: %.4s\n", session->blockcipher->base.type)); - ZRTP_LOG(3,(_ZTU_,"\t ATL: %.4s\n", session->authtaglength->base.type)); - ZRTP_LOG(3,(_ZTU_,"\tVAD scheme: %.4s\n", session->sasscheme->base.type)); - } - - do{ - /* Allocate resources for Initiator's state-machine */ - s = _zrtp_protocol_init(stream, 1, &stream->protocol); - if (zrtp_status_ok != s) { - break; /* Software error */ - } - - _zrtp_change_state(stream, ZRTP_STATE_INITIATINGSECURE); - - /* Prepare DHPart2 message to compute hvi. For DH and Preshared streams only*/ - if (ZRTP_IS_STREAM_DH(stream)) { - _prepare_dhpart2(stream); - } - - s = _zrtp_machine_start_send_and_resend_commit(stream); - if (zrtp_status_ok != s) { - break; /* EH: Software error */ - } - - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_INITIATINGSECURE); - } - } while (0); - - if (zrtp_status_ok != s) { - if (stream->protocol) { - _zrtp_protocol_destroy(stream->protocol); - stream->protocol = NULL; - } - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); - } - - if (ZRTP_IS_STREAM_DH(stream)) { - /* - * If stream->concurrent is set this means that we stopped a concurrent - * DH stream to break a tie. This can happen when Commit messages are - * sent by both ZRTP endpoints at the same time, but are received in - * different media streams. Now current stream has finished DH setup and - * we can resume the other one. - */ - if (stream->concurrent) { - zrtp_stream_t* tctx = stream->concurrent; - stream->concurrent = NULL; - ZRTP_LOG(3,(_ZTU_,"\tRelease Concurrent Stream ID=%u. ID=%u\n", tctx->id, stream->id)); - _zrtp_machine_start_initiating_secure(tctx); - } - } - - - return s; -} - - -/*===========================================================================*/ -/* Packet handlers */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -static zrtp_status_t _zrtp_machine_process_incoming_dhpart1( zrtp_stream_t *stream, - zrtp_rtp_info_t *packet) -{ - zrtp_status_t s = zrtp_status_ok; - zrtp_packet_DHPart_t *dhpart1 = (zrtp_packet_DHPart_t*) packet->message; - - /* Validating DH (pvr is 1 or p-1) */ - bnInsertBigBytes(&stream->dh_cc.peer_pv, dhpart1->pv, 0, stream->pubkeyscheme->pv_length); - - s = stream->pubkeyscheme->validate(stream->pubkeyscheme, &stream->dh_cc.peer_pv); - if (zrtp_status_ok != s) { - ZRTP_LOG(2,(_ZTU_,"\tERROR! " ZRTP_MITM1_WARNING_STR " ID=%u\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_possible_mitm1, 1); - return s; - } - - /* Copy DH Part1 packet for further hashing */ - zrtp_memcpy(&stream->messages.peer_dhpart, dhpart1, zrtp_ntoh16(dhpart1->hdr.length)*4); - - return s; -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t _zrtp_machine_process_incoming_confirm1( zrtp_stream_t *stream, - zrtp_rtp_info_t *packet) -{ - return _zrtp_machine_process_confirm(stream, (zrtp_packet_Confirm_t*) packet->message); -} - - -/*===========================================================================*/ -/* Packet senders */ -/*===========================================================================*/ - -static void _send_and_resend_commit(zrtp_stream_t *stream, zrtp_retry_task_t* task) -{ - if (task->_retrys >= ZRTP_T2_MAX_COUNT) { - ZRTP_LOG(2,(_ZTU_,"WARNING! COMMIT Max retransmissions count reached. ID=%u\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_timeout, 0); - } else if (task->_is_enabled) { - zrtp_status_t s = zrtp_status_fail; - zrtp_packet_Commit_t* commit = (zrtp_packet_Commit_t*) &stream->messages.commit; - - s = _zrtp_packet_send_message(stream, ZRTP_COMMIT, commit); - task->timeout = _zrtp_get_timeout((uint32_t)task->timeout, ZRTP_COMMIT); - if (s == zrtp_status_ok) { - task->_retrys++; - } - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } -} - -/*---------------------------------------------------------------------------*/ -static zrtp_status_t _zrtp_machine_start_send_and_resend_commit(zrtp_stream_t *stream) -{ - zrtp_proto_crypto_t* cc = stream->protocol->cc; - zrtp_packet_Commit_t* commit = &stream->messages.commit; - zrtp_retry_task_t* task = &stream->messages.commit_task; - uint8_t hmac_offset = ZRTP_COMMIT_STATIC_SIZE; - zrtp_session_t *session = stream->session; - - zrtp_memcpy(commit->zid, stream->messages.hello.zid, sizeof(zrtp_zid_t)); - - zrtp_memcpy(commit->hash_type, session->hash->base.type, ZRTP_COMP_TYPE_SIZE); - zrtp_memcpy(commit->cipher_type, session->blockcipher->base.type, ZRTP_COMP_TYPE_SIZE); - zrtp_memcpy(commit->auth_tag_length, session->authtaglength->base.type, ZRTP_COMP_TYPE_SIZE ); - zrtp_memcpy(commit->public_key_type, stream->pubkeyscheme->base.type, ZRTP_COMP_TYPE_SIZE); - zrtp_memcpy(commit->sas_type, session->sasscheme->base.type, ZRTP_COMP_TYPE_SIZE); - - /* - * According to the last version of the internet draft 08b., hvi should be - * computed as: - * a) hvi=hash(initiator's DHPart2 message | responder's Hello message) for DH stream. - * b) For Multistream it just a 128 bit random nonce. - * c) For Preshared streams it keyID = HMAC(preshared_key, "Prsh") truncated to 64 bits - */ - switch (stream->mode) - { - case ZRTP_STREAM_MODE_DH: - { - void *hash_ctx = session->hash->hash_begin(session->hash); - if (!hash_ctx) { - return zrtp_status_alloc_fail; - } - - session->hash->hash_update( session->hash, - hash_ctx, - (const int8_t*)&stream->messages.dhpart, - zrtp_ntoh16(stream->messages.dhpart.hdr.length)*4); - session->hash->hash_update( session->hash, - hash_ctx, - (const int8_t*)&stream->messages.peer_hello, - zrtp_ntoh16(stream->messages.peer_hello.hdr.length)*4); - - session->hash->hash_end(session->hash, hash_ctx, ZSTR_GV(cc->hv)); - zrtp_memcpy(commit->hv, cc->hv.buffer, ZRTP_HV_SIZE); - hmac_offset += ZRTP_HV_SIZE; - } break; - - case ZRTP_STREAM_MODE_PRESHARED: - { - zrtp_string8_t key_id = ZSTR_INIT_EMPTY(key_id); - zrtp_status_t s = zrtp_status_ok; - - /* Generate random 4 word nonce */ - if (ZRTP_HV_NONCE_SIZE != zrtp_randstr(session->zrtp, (unsigned char*)cc->hv.buffer, ZRTP_HV_NONCE_SIZE)) { - return zrtp_status_rng_fail; - } - cc->hv.length = ZRTP_HV_NONCE_SIZE; - - /* - * Generate Preshared_key: - * hash(len(rs1) | rs1 | len(auxsecret) | auxsecret | len(pbxsecret) | pbxsecret) - */ - s = _zrtp_compute_preshared_key( session, - ZSTR_GV(session->secrets.rs1->value), - (session->secrets.auxs->_cachedflag) ? ZSTR_GV(session->secrets.auxs->value) : NULL, - (session->secrets.pbxs->_cachedflag) ? ZSTR_GV(session->secrets.pbxs->value) : NULL, - NULL, - ZSTR_GV(key_id)); - if (zrtp_status_ok != s) { - return s; - } - - /* Copy 4 word nonce and add 2 word keyID */ - zrtp_memcpy(commit->hv, cc->hv.buffer, ZRTP_HV_NONCE_SIZE); - hmac_offset += ZRTP_HV_NONCE_SIZE; - - zrtp_memcpy(commit->hv+ZRTP_HV_NONCE_SIZE, key_id.buffer, ZRTP_HV_KEY_SIZE); - hmac_offset += ZRTP_HV_KEY_SIZE; - } break; - - case ZRTP_STREAM_MODE_MULT: - { - if(ZRTP_HV_NONCE_SIZE != zrtp_randstr(session->zrtp, (unsigned char*)cc->hv.buffer, ZRTP_HV_NONCE_SIZE)) { - return zrtp_status_rng_fail; - } - - cc->hv.length = ZRTP_HV_NONCE_SIZE; - zrtp_memcpy(commit->hv, cc->hv.buffer, ZRTP_HV_NONCE_SIZE); - hmac_offset += ZRTP_HV_NONCE_SIZE; - }break; - default: break; - } - - _zrtp_packet_fill_msg_hdr(stream, ZRTP_COMMIT, hmac_offset + ZRTP_HMAC_SIZE, &commit->hdr); - - { - char buff[256]; - ZRTP_LOG(3,(_ZTU_,"\tStart Sending COMMIT ID=%u mode=%s state=%s:\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - ZRTP_LOG(3,(_ZTU_,"\t Hash: %.4s\n", commit->hash_type)); - ZRTP_LOG(3,(_ZTU_,"\t Cipher: %.4s\n", commit->cipher_type)); - ZRTP_LOG(3,(_ZTU_,"\t ATL: %.4s\n", commit->auth_tag_length)); - ZRTP_LOG(3,(_ZTU_,"\t PK scheme: %.4s\n", commit->public_key_type)); - ZRTP_LOG(3,(_ZTU_,"\tVAD scheme: %.4s\n", commit->sas_type)); - - ZRTP_LOG(3,(_ZTU_,"\t hv: %s\n", hex2str((const char*)commit->hv, ZRTP_HV_SIZE, (char*)buff, sizeof(buff)))); - } - - task->_is_enabled = 1; - task->callback = _send_and_resend_commit; - task->_retrys = 0; - _send_and_resend_commit(stream, task); - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static void _send_and_resend_dhpart2(zrtp_stream_t *stream, zrtp_retry_task_t* task) -{ - if (task->_retrys >= ZRTP_T2_MAX_COUNT) - { - ZRTP_LOG(1,(_ZTU_,"WARNING! DH2 Max retransmissions count reached. ID=%u\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_timeout, 0); - } else if (task->_is_enabled) { - zrtp_status_t s = _zrtp_packet_send_message(stream, ZRTP_DHPART2, &stream->messages.dhpart); - task->timeout = _zrtp_get_timeout((uint32_t)task->timeout, ZRTP_DHPART2); - if (zrtp_status_ok == s) { - task->_retrys++; - } - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } -} - -static void _prepare_dhpart2(zrtp_stream_t *stream) -{ - zrtp_proto_crypto_t* cc = stream->protocol->cc; - zrtp_packet_DHPart_t *dh2 = &stream->messages.dhpart; - uint16_t dh_length = (uint16_t)stream->pubkeyscheme->pv_length; - - zrtp_memcpy(dh2->rs1ID, cc->rs1.id.buffer, ZRTP_RSID_SIZE); - zrtp_memcpy(dh2->rs2ID, cc->rs2.id.buffer, ZRTP_RSID_SIZE); - zrtp_memcpy(dh2->auxsID, cc->auxs.id.buffer, ZRTP_RSID_SIZE); - zrtp_memcpy(dh2->pbxsID, cc->pbxs.id.buffer, ZRTP_RSID_SIZE); - - bnExtractBigBytes(&stream->dh_cc.pv, dh2->pv, 0, dh_length); - - _zrtp_packet_fill_msg_hdr( stream, - ZRTP_DHPART2, - dh_length + ZRTP_DH_STATIC_SIZE + ZRTP_HMAC_SIZE, - &dh2->hdr ); -} - -static zrtp_status_t _zrtp_machine_start_send_and_resend_dhpart2(zrtp_stream_t *stream) -{ - zrtp_retry_task_t* task = &stream->messages.dhpart_task; - - task->_is_enabled = 1; - task->callback = _send_and_resend_dhpart2; - task->_retrys = 0; - _send_and_resend_dhpart2(stream, task); - - return zrtp_status_ok; -} - - -/*---------------------------------------------------------------------------*/ -static void _send_and_resend_confirm2(zrtp_stream_t *stream, zrtp_retry_task_t* task) -{ - if (task->_retrys >= ZRTP_T2_MAX_COUNT) { - ZRTP_LOG(1,(_ZTU_,"WARNING! CONFIRM2 Max retransmissions count reached. ID=%u\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_timeout, 0); - } else if (task->_is_enabled) { - zrtp_status_t s = zrtp_status_ok; - s = _zrtp_packet_send_message(stream, ZRTP_CONFIRM2, &stream->messages.confirm); - task->timeout = _zrtp_get_timeout((uint32_t)task->timeout, ZRTP_CONFIRM2); - if (zrtp_status_ok == s) { - task->_retrys++; - } - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } -} - -static zrtp_status_t _zrtp_machine_start_send_and_resend_confirm2(zrtp_stream_t *stream) -{ - zrtp_retry_task_t* task = &stream->messages.confirm_task; - - zrtp_status_t s = _zrtp_machine_create_confirm(stream, &stream->messages.confirm); - if (zrtp_status_ok != s) { - return s; - } - - s = _zrtp_packet_fill_msg_hdr( stream, - ZRTP_CONFIRM2, - sizeof(zrtp_packet_Confirm_t) - sizeof(zrtp_msg_hdr_t), - &stream->messages.confirm.hdr); - - if (zrtp_status_ok == s) { - task->_is_enabled = 1; - task->callback = _send_and_resend_confirm2; - task->_retrys = 0; - _send_and_resend_confirm2(stream, task); - } - - return s; -} diff --git a/libs/libzrtp/src/zrtp_legal.c b/libs/libzrtp/src/zrtp_legal.c deleted file mode 100644 index f9b6ac6492..0000000000 --- a/libs/libzrtp/src/zrtp_legal.c +++ /dev/null @@ -1,742 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2012 Philip R. Zimmermann. All rights reserved. - * - * This software development kit (the "program", "library", or "SDK") - * is licensed under the terms of the GNU Affero General Public - * License (AGPL) as published by the Free Software Foundation, AGPL - * version 3 only, except as described below. - * - * If by private arrangement with Philip Zimmermann you've received - * this library under a different license, that license will supersede - * the terms set out in this document. - * - * You may not redistribute or use this library except according to - * the terms described in this document. Don't be confused by the - * AGPL. It is not the GPL, LGPL, Apache, MIT, BSD, Creative Commons, - * WTFPL, or any other license you might imagine. It is the AGPLv3, - * as included below. - * - * The AGPLv3 license places many complex restrictions on the usage - * and distribution of this library which might make it inconvenient - * to use in a commercial project or as part of a commercial service. - * You might be surprised by the extent of the requirements. Many - * people don't even consider the AGPL a free software license. So be - * sure to check the exact details of the license before you use this - * library for anything meaningful. For more information about the - * AGPLv3, visit: http://www.gnu.org/licenses/agpl-3.0.html - * - * To license this library under non-AGPLv3 terms, please contact: - * Philip Zimmermann (http://philzimmermann.com). - * - * As a special exception, you may combine this library with the code - * of FreeSWITCH or FreeSWITCH derivatives and modify, redistribute, - * and use the resulting source code and executable binaries - * (including modified versions of each) under the Mozilla Public - * License Version 1.1 (MPLv1.1). For more information about - * FreeSWITCH, visit: https://freeswitch.org/ - * - * As a restatement of the above, you may use, modify, and - * redistribute this library as if it were licensed under the MPLv1.1 - * if and only if it is combined with FreeSWITCH or a derivative work - * of the FreeSWITCH code. If it is not combined with anything, the - * terms of the AGPLv3 apply. If it is combined with any other - * program that is not FreeSWITCH or a derivative work of the - * FreeSWITCH code but not also combined with FreeSWITCH or a - * derivative work of the FreeSWITCH code in the same work, the terms - * of the AGPLv3 apply. - * - * I, Phil Zimmermann, would like to make the following non-binding - * request of any contributors to this library: please make your - * changes available for me to sublicense. I support myself in part - * on my ability to license software I've created to producers of - * proprietary software, and I'd like to include your contributions in - * the proprietary releases I make. You can allow me to do so either - * by placing your changes in the public domain (e.g. "I place these - * changes in the public domain") or by granting me certain rights to - * your changes (e.g. "I grant to Philip Zimmermann a non-exclusive, - * irrevocable, world-wide license to distribute, modify, use in any - * way, and sublicense under any terms my code and changes to - * libzrtp"). - * - * This file must be packaged together with the rest of the libZRTP - * SDK source code. That's why it's in a .c file. - * - * This software might be subject to export controls by the US - * Commerce Department's Bureau of Industry and Security. This - * software is provided "as is," with no warranty expressed or - * implied. - * - */ - -/* Force inclusion of this copyright string in the linked binary, - * accessible to the unix strings command. */ -#include "zrtp_legal.h" -volatile const char zrtpCopyright[] = - "\0libZRTP Copyright (c) 2006-2009 Philip R. Zimmermann."; - -/**************************************************************************** - - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If 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 convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 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 Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. - -****************************************************************************/ diff --git a/libs/libzrtp/src/zrtp_list.c b/libs/libzrtp/src/zrtp_list.c deleted file mode 100644 index 5cea2fcfdd..0000000000 --- a/libs/libzrtp/src/zrtp_list.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -/*----------------------------------------------------------------------------*/ -void init_mlist(mlist_t* head) { - head->next = head; - head->prev = head; -} - -/*----------------------------------------------------------------------------*/ -static void mlist_insert_node(mlist_t* node, mlist_t* prev, mlist_t* next) { - next->prev = node; - node->next = next; - node->prev = prev; - prev->next = node; -} - -void mlist_insert(mlist_t *prev, mlist_t *node) { - mlist_insert_node(node, prev->prev, prev); -} - -void mlist_add(mlist_t* head, mlist_t* node) { - mlist_insert_node(node, head, head->next); -} - -void mlist_add_tail(mlist_t *head, mlist_t *node) { - mlist_insert_node(node, head->prev, head); -} - -/*----------------------------------------------------------------------------*/ -static void mlist_remove(mlist_t* prev, mlist_t* next) { - next->prev = prev; - prev->next = next; -} - -void mlist_del(mlist_t *node) { - mlist_remove(node->prev, node->next); - node->next = node->prev = 0; -} - -void mlist_del_tail(mlist_t *node) { - mlist_remove(node->prev, node->next); - node->next = node->prev = 0; -} - -/*----------------------------------------------------------------------------*/ -mlist_t* mlist_get(mlist_t *head) { - return (head->next != head) ? head->next : 0; -} - -mlist_t* mlist_get_tail(mlist_t *head) { - return (head->prev != head) ? head->prev : 0; -} - -/*----------------------------------------------------------------------------*/ -int mlist_isempty(mlist_t *head) { - return (head->next == head); -} diff --git a/libs/libzrtp/src/zrtp_log.c b/libs/libzrtp/src/zrtp_log.c deleted file mode 100644 index b2576e5cf7..0000000000 --- a/libs/libzrtp/src/zrtp_log.c +++ /dev/null @@ -1,496 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#if (ZRTP_PLATFORM == ZP_WIN32_KERNEL) -#include -#include -#endif - -#if ZRTP_LOG_MAX_LEVEL >= 1 - -/*----------------------------------------------------------------------------*/ -#if defined ZRTP_HAVE_STDIO_H -# include -#endif -#if defined ZRTP_HAVE_STRING_H -# include -#endif -#if defined ZRTP_HAVE_STDARG_H -# include -#endif - -static const char* k_unknown = "UNKNOWN"; - -#if ZRTP_PLATFORM != ZP_WIN32_KERNEL -void zrtp_def_log_write(int level, char *buffer, int len, int offset) { - printf("%s", buffer); -} - -static zrtp_log_engine *log_writer = &zrtp_def_log_write; -#else -static zrtp_log_engine *log_writer = NULL; -#endif - -static uint32_t log_max_level = ZRTP_LOG_MAX_LEVEL; - - -/*----------------------------------------------------------------------------*/ -void zrtp_log_set_level(uint32_t level) { - log_max_level = level; -} - -void zrtp_log_set_log_engine(zrtp_log_engine *engine) { - log_writer = engine; -} - -/*----------------------------------------------------------------------------*/ -static void zrtp_log(uint8_t is_clean, const char *sender, uint32_t level, const char *format, va_list marker) -{ -#if (defined(ZRTP_USE_STACK_MINIM) && (ZRTP_USE_STACK_MINIM == 1)) - char *log_buffer = zrtp_sys_alloc(ZRTP_LOG_BUFFER_SIZE); -#else - char log_buffer[ZRTP_LOG_BUFFER_SIZE]; -#endif - char* sline = log_buffer; - uint32_t offset = 0; - int len = 0; - - if (!sline) { - return; - } - - if (!is_clean) { - /* Print sender with left aligment */ - uint32_t sender_len = strlen(sender); - *sline++ = ' '; - *sline++ = '['; - if (sender_len <= ZRTP_LOG_SENDER_MAX_LEN) { - while (sender_len < ZRTP_LOG_SENDER_MAX_LEN) { - *sline++ = ' ', ++sender_len; - } - while (*sender) { - *sline++ = *sender++; - } - } else { - int i = 0; - for (i=0; i= 1400) && (ZRTP_PLATFORM != ZP_WINCE) - len = _vsnprintf_s(sline, ZRTP_LOG_BUFFER_SIZE-offset-1, ZRTP_LOG_BUFFER_SIZE-offset-1, format, marker); -# else - len = _vsnprintf(sline, ZRTP_LOG_BUFFER_SIZE-offset, format, marker); -# endif -#elif (ZRTP_PLATFORM == ZP_WIN32_KERNEL) - RtlStringCchVPrintfA(sline, ZRTP_LOG_BUFFER_SIZE-offset, format, marker); -#elif (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || (ZRTP_PLATFORM == ZP_ANDROID) - len = vsnprintf(sline, ZRTP_LOG_BUFFER_SIZE-offset, format, marker); -#elif (ZRTP_PLATFORM == ZP_SYMBIAN) - len = vsprintf(sline, format, marker); -#endif - - if ((len > 0) && log_writer) { - (*log_writer)(level, log_buffer, len+offset, offset); - } - -#if (defined(ZRTP_USE_STACK_MINIM) && (ZRTP_USE_STACK_MINIM == 1)) - zrtp_sys_free(log_buffer); -#endif -} - - -#if ZRTP_LOG_MAX_LEVEL >= 1 -void zrtp_log_1(const char *obj, const char *format, ...) -{ - va_list arg; - va_start(arg, format); - zrtp_log(0, obj, 1, format, arg); - va_end(arg); -} -void zrtp_logc_1(const char *format, ...) -{ - va_list arg; - va_start(arg, format); - zrtp_log(1, NULL, 1, format, arg); - va_end(arg); -} - -#endif - -#if ZRTP_LOG_MAX_LEVEL >= 2 -void zrtp_log_2(const char *obj, const char *format, ...) -{ - va_list arg; - va_start(arg, format); - zrtp_log(0, obj, 2, format, arg); - va_end(arg); -} -void zrtp_logc_2(const char *format, ...) -{ - va_list arg; - va_start(arg, format); - zrtp_log(1, NULL, 2, format, arg); - va_end(arg); -} - -#endif - -#if ZRTP_LOG_MAX_LEVEL >= 3 -void zrtp_log_3(const char *obj, const char *format, ...) -{ - va_list arg; - va_start(arg, format); - zrtp_log(0, obj, 3, format, arg); - va_end(arg); -} -void zrtp_logc_3(const char *format, ...) -{ - va_list arg; - va_start(arg, format); - zrtp_log(1, NULL, 3, format, arg); - va_end(arg); -} - -#endif - -#endif - -/*---------------------------------------------------------------------------*/ -struct _error_strings_t -{ - zrtp_protocol_error_t code; - char* descr; -}; - -static const struct _error_strings_t _error_strings[] = { - {zrtp_error_unknown, "Unknown"}, - {zrtp_error_timeout, "Protocol Packets Retries Timeout"}, - {zrtp_error_invalid_packet, "Malformed packet (CRC OK, but wrong structure)"}, - {zrtp_error_software, "Critical software error: no memory, can't call some system function, etc"}, - {zrtp_error_version, "Unsupported ZRTP version"}, - {zrtp_error_hello_mistmatch,"Hello components mismatch "}, - - {zrtp_error_hash_unsp, "Hash type not supported"}, - {zrtp_error_cipher_unsp, "Cipher type not supported"}, - {zrtp_error_pktype_unsp, "Public key exchange not supported"}, - {zrtp_error_auth_unsp, "SRTP auth. tag not supported"}, - {zrtp_error_sas_unsp, "SAS scheme not supported"}, - {zrtp_error_no_secret, "No shared secret available, DH mode required"}, - - {zrtp_error_possible_mitm1, "Attack DH Error: bad pvi or pvr ( == 1, 0, or p-1)"}, - {zrtp_error_possible_mitm2, "Attack DH Error: hvi != hashed data"}, - {zrtp_error_possible_mitm3, "Attack Received relayed SAS from untrusted MiTM"}, - - {zrtp_error_auth_decrypt, "Auth. Error: Bad Confirm pkt HMAC"}, - {zrtp_error_nonse_reuse, "Nonce reuse"}, - {zrtp_error_equal_zid, "Equal ZIDs in Hello"}, - {zrtp_error_service_unavail,"Service unavailable"}, - {zrtp_error_goclear_unsp, "GoClear packet received, but not allowed"}, - - {zrtp_error_wrong_zid, "ZID received in new Hello doesn't equal to ZID from the previous stream"}, - {zrtp_error_wrong_meshmac, "Message HMAC doesn't match with pre-received one"} -}; - -const char* zrtp_log_error2str(zrtp_protocol_error_t error) -{ - int i=0; - for(i=0; i<22; i++) { - if (error == _error_strings[i].code) { - return _error_strings[i].descr; - } - } - - return k_unknown; -} - -/*---------------------------------------------------------------------------*/ -static char* _status_strings[zrtp_status_count] = -{ - "OK status", - "General, unspecified failure", - "Wrong, unsupported parameter", - "Fail allocate memory", - "SRTP authentication failure", - "Cipher failure on RTP encrypt/decrypt", - "General Crypto Algorithm failure", - "SRTP can't use key any longer", - "Input buffer too small", - "Packet process DROP status", - "Failed to open file/device", - "Unable to read data from the file/stream", - "Unable to write to the file/stream", - "SRTP packet is out of sliding window", - "RTP replay protection failed", - "ZRTP replay protection failed", - "ZRTP packet CRC is wrong", - "Can't generate random value", - "Illegal operation in current state", - "Attack detected", - "Function is not available in current configuration" -}; - -const char* zrtp_log_status2str(zrtp_status_t error) -{ - if (zrtp_status_count > error) { - return _status_strings[error]; - } else { - return k_unknown; - } -} - -/*---------------------------------------------------------------------------*/ -static char* _state_names[ZRTP_STATE_COUNT] = -{ - "NONE", - "ACTIVE", - "START", - "W4HACK", - "W4HELLO", - "CLEAR", - "SINITSEC", - "INITSEC", - "WCONFIRM", - "W4CONFACK", - "PENDSEC", - "W4CONF2", - "SECURE", - "SASRELAY", - "INITCLEAR", - "PENDCLEAR", - "INITERROR", - "PENDERROR", - "ERROR", - #if (defined(ZRTP_BUILD_FOR_CSD) && (ZRTP_BUILD_FOR_CSD == 1)) - "DRIVINIT", - "DRIVRESP", - "DRIVPEND", - #endif - "NOZRTP" -}; - -const char* zrtp_log_state2str(zrtp_state_t state) -{ - if (state < ZRTP_STATE_COUNT) { - return _state_names[state]; - } else { - return k_unknown; - } -}; - -/*---------------------------------------------------------------------------*/ -static char* _stream_mode_name[ZRTP_STREAM_MODE_COUNT] = -{ - "UNKNOWN", - "CLEAR", - "DH", - "PRESHARED", - "MULTI" -}; - -const char* zrtp_log_mode2str(zrtp_stream_mode_t mode) -{ - if (mode < ZRTP_STREAM_MODE_COUNT) { - return _stream_mode_name[mode]; - } else { - return k_unknown; - } -}; - -/*---------------------------------------------------------------------------*/ -static char* _msg_type_names[ZRTP_MSG_TYPE_COUNT] = -{ - "NONE", - "HELLO", - "HELLOACK", - "COMMIT", - "DH1", - "DH2", - "CONFIRM1", - "CONFIRM2", - "CONFIRMACK", - "GOCLEAR", - "CLEARACKE", - "ERROR", - "ERRORACK", - "PROCESS", - "SASRELAY", - "RELAYACK", - "PING", - "PINGACK", -}; - -const char* zrtp_log_pkt2str(zrtp_msg_type_t type) -{ - if (type < ZRTP_MSG_TYPE_COUNT) { - return _msg_type_names[type]; - } else { - return k_unknown; - } -} - -/*---------------------------------------------------------------------------*/ -static char* _event_code_name[] = -{ - "ZRTP_EVENT_UNSUPPORTED", - "ZRTP_EVENT_IS_CLEAR", - "ZRTP_EVENT_IS_INITIATINGSECURE", - "ZRTP_EVENT_IS_PENDINGSECURE", - "ZRTP_EVENT_IS_PENDINGCLEAR", - "ZRTP_EVENT_NO_ZRTP", - "ZRTP_EVENT_NO_ZRTP_QUICK", - "ZRTP_EVENT_IS_CLIENT_ENROLLMENT", - "ZRTP_EVENT_NEW_USER_ENROLLED", - "ZRTP_EVENT_USER_ALREADY_ENROLLED", - "ZRTP_EVENT_USER_UNENROLLED", - "ZRTP_EVENT_LOCAL_SAS_UPDATED", - "ZRTP_EVENT_REMOTE_SAS_UPDATED", - "ZRTP_EVENT_IS_SECURE", - "ZRTP_EVENT_IS_SECURE_DONE", - "ZRTP_EVENT_IS_PASSIVE_RESTRICTION", - "ZRTP_EVENT_PROTOCOL_ERROR", - "ZRTP_EVENT_WRONG_SIGNALING_HASH", - "ZRTP_EVENT_WRONG_MESSAGE_HMAC", - "ZRTP_EVENT_MITM_WARNING" -}; - -const char* zrtp_log_event2str(uint8_t event) -{ - if (event <= ZRTP_EVENT_WRONG_MESSAGE_HMAC) { - return _event_code_name[event]; - } else { - return k_unknown; - } -} - -static char* _sign_role_name[] = -{ - "Unknown", - "Initiator", - "Responder" -}; - -const char* zrtp_log_sign_role2str(unsigned role) { - if (role < ZRTP_SIGNALING_ROLE_COUNT) { - return _sign_role_name[role]; - } else { - return k_unknown; - } -} - -/*---------------------------------------------------------------------------*/ -typedef struct _zrtp_aling_test -{ - uint_8t c1; - uint_8t c2; - uint_8t c3; -} _zrtp_aling_test; - -void zrtp_print_env_settings(zrtp_config_t* config) -{ -#if (ZRTP_PLATFORM == ZP_WIN32) - char* platform = "Windows 32bit"; -#elif (ZRTP_PLATFORM == ZP_WIN32_KERNEL) - char* platform = "Windows Kernel 32bit"; -#elif (ZRTP_PLATFORM == ZP_WINCE) - char* platform = "Windows CE"; -#elif (ZRTP_PLATFORM == ZP_DARWIN) - char* platform = "Darwin OS X"; -#elif (ZRTP_PLATFORM == ZP_BSD) - char* platform = "BSD"; -#elif (ZRTP_PLATFORM == ZP_LINUX) - char* platform = "Linux OS"; -#elif (ZRTP_PLATFORM == ZP_SYMBIAN) - char* platform = "Symbian OS"; -#elif (ZRTP_PLATFORM == ZP_ANDROID) - char* platform = "Android OS"; -#endif - - ZRTP_LOG(3,("zrtp","============================================================\n")); - ZRTP_LOG(3,("zrtp","ZRTP Configuration Settings\n")); - ZRTP_LOG(3,("zrtp","============================================================\n")); - ZRTP_LOG(3,("zrtp"," PLATFORM: %s\n", platform)); -#if (ZRTP_BYTE_ORDER == ZBO_BIG_ENDIAN) - ZRTP_LOG(3,("zrtp"," BYTE ORDER: BIG ENDIAN\n")); -#else - ZRTP_LOG(3,("zrtp"," BYTE ORDER: LITTLE ENDIAN\n")); -#endif - ZRTP_LOG(3,("zrtp"," ZRTP_SAS_DIGEST_LENGTH: %d\n", ZRTP_SAS_DIGEST_LENGTH)); - ZRTP_LOG(3,("zrtp"," ZRTP_MAX_STREAMS_PER_SESSION: %d\n", ZRTP_MAX_STREAMS_PER_SESSION)); - ZRTP_LOG(3,("zrtp"," ZRTP_USE_EXTERN_SRTP: %d\n", ZRTP_USE_EXTERN_SRTP)); - ZRTP_LOG(3,("zrtp"," ZRTP_USE_STACK_MINIM: %d\n", ZRTP_USE_STACK_MINIM)); - ZRTP_LOG(3,("zrtp"," ZRTP_BUILD_FOR_CSD: %d\n", ZRTP_BUILD_FOR_CSD)); - ZRTP_LOG(3,("zrtp"," ZRTP_USE_BUILTIN: %d\n", ZRTP_USE_BUILTIN)); - ZRTP_LOG(3,("zrtp"," ZRTP_USE_BUILTIN_SCEHDULER: %d\n", ZRTP_USE_BUILTIN_SCEHDULER)); - ZRTP_LOG(3,("zrtp"," ZRTP_USE_BUILTIN_CACHE: %d\n", ZRTP_USE_BUILTIN_CACHE)); - ZRTP_LOG(3,("zrtp"," ZRTP_LOG_MAX_LEVEL: %d\n", ZRTP_LOG_MAX_LEVEL)); - - ZRTP_LOG(3,("zrtp"," sizeo of unsigned int: %d\n", sizeof(unsigned int))); - ZRTP_LOG(3,("zrtp"," size of unsigned long long: %d\n", sizeof(unsigned long long))); - ZRTP_LOG(3,("zrtp"," sizeo of three chars: %d\n", sizeof(_zrtp_aling_test))); - ZRTP_LOG(3,("zrtp","\n")); - ZRTP_LOG(3,("zrtp","ZRTP Initialization Settings\n")); - ZRTP_LOG(3,("zrtp"," client ID: %s\n", config->client_id)); - ZRTP_LOG(3,("zrtp"," license: %d\n", config->lic_mode)); - ZRTP_LOG(3,("zrtp"," MiTM: %s\n", config->is_mitm?"ENABLED":"DIABLED")); - ZRTP_LOG(3,("zrtp"," cache path: %s\n", config->def_cache_path.length?config->def_cache_path.buffer:"")); -} - -/*---------------------------------------------------------------------------*/ -void zrtp_log_print_streaminfo(zrtp_stream_info_t* info) -{ - ZRTP_LOG(3,("zrtp"," ZRTP Stream ID=%u\n", info->id)); - ZRTP_LOG(3,("zrtp"," mode: %s\n", zrtp_log_mode2str(info->mode))); - ZRTP_LOG(3,("zrtp"," state: %s\n", zrtp_log_state2str(info->state))); - ZRTP_LOG(3,("zrtp"," error: %s\n", zrtp_log_error2str(info->last_error))); - - ZRTP_LOG(3,("zrtp"," peer passive: %s\n", info->peer_passive?"ON":"OFF")); - ZRTP_LOG(3,("zrtp"," peer disclose: %s\n", info->peer_disclose?"ON":"OFF")); - ZRTP_LOG(3,("zrtp"," peer mitm: %s\n", info->peer_mitm?"ON":"OFF")); - ZRTP_LOG(3,("zrtp"," res allowclear: %s\n", info->res_allowclear?"ON":"OFF")); -} - -void zrtp_log_print_sessioninfo(zrtp_session_info_t* info) -{ - char buffer[256]; - - ZRTP_LOG(3,("zrtp"," ZRTP Session sID=%u is ready=%s\n", info->id, info->sas_is_ready?"YES":"NO")); - ZRTP_LOG(3,("zrtp"," peer client: <%s> V=<%s>\n", info->peer_clientid.buffer, info->peer_version.buffer)); - hex2str(info->zid.buffer, info->zid.length, buffer, sizeof(buffer)); - ZRTP_LOG(3,("zrtp"," zid: %s\n", buffer)); - hex2str(info->peer_zid.buffer, info->peer_zid.length, buffer, sizeof(buffer)); - ZRTP_LOG(3,("zrtp"," peer zid: %s\n", buffer)); - hex2str(info->zid.buffer, info->zid.length, buffer, sizeof(buffer)); - - ZRTP_LOG(3,("zrtp"," is base256: %s\n", info->sas_is_base256?"YES":"NO")); - ZRTP_LOG(3,("zrtp"," SAS1: %s\n", info->sas1.buffer)); - ZRTP_LOG(3,("zrtp"," SAS2: %s\n", info->sas2.buffer)); - hex2str(info->sasbin.buffer, info->sasbin.length, buffer, sizeof(buffer)); - ZRTP_LOG(3,("zrtp"," bin SAS: %s\n", buffer)); - ZRTP_LOG(3,("zrtp"," TTL: %u\n", info->secrets_ttl)); - - ZRTP_LOG(3,("zrtp"," hash: %s\n", info->hash_name.buffer)); - ZRTP_LOG(3,("zrtp"," cipher: %s\n", info->cipher_name.buffer)); - ZRTP_LOG(3,("zrtp"," auth: %s\n", info->auth_name.buffer)); - ZRTP_LOG(3,("zrtp"," sas: %s\n", info->sas_name.buffer)); - ZRTP_LOG(3,("zrtp"," pks: %s\n", info->pk_name.buffer)); -} diff --git a/libs/libzrtp/src/zrtp_pbx.c b/libs/libzrtp/src/zrtp_pbx.c deleted file mode 100644 index dbc2aa7cbb..0000000000 --- a/libs/libzrtp/src/zrtp_pbx.c +++ /dev/null @@ -1,691 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp mitm" - -extern zrtp_status_t _zrtp_machine_process_goclear(zrtp_stream_t* stream, zrtp_rtp_info_t* packet); - - -/*===========================================================================*/ -/* State-Machine related functions */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -static void _send_and_resend_sasrelay(zrtp_stream_t *stream, zrtp_retry_task_t* task) -{ - if (task->_retrys >= ZRTP_T2_MAX_COUNT) { - ZRTP_LOG(1,(_ZTU_,"WARNING! SASRELAY Max retransmissions count reached. ID=%u\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_timeout, 0); - } else if (task->_is_enabled) { - - zrtp_status_t s = _zrtp_packet_send_message(stream, ZRTP_SASRELAY, &stream->messages.sasrelay); - task->timeout = _zrtp_get_timeout((uint32_t)task->timeout, ZRTP_SASRELAY); - if (zrtp_status_ok == s) { - task->_retrys++; - } - if (stream->zrtp->cb.sched_cb.on_call_later) { - stream->zrtp->cb.sched_cb.on_call_later(stream, task); - } - } -} - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t _create_sasrelay( zrtp_stream_t *stream, - zrtp_sas_id_t transf_sas_scheme, - zrtp_string32_t* transf_sas_value, - uint8_t transf_ac_flag, - uint8_t transf_d_flag, - zrtp_packet_SASRelay_t* sasrelay ) -{ - zrtp_session_t *session = stream->session; - zrtp_status_t s = zrtp_status_fail; - void* cipher_ctx = NULL; - - /* (padding + sig_len + flags) + SAS scheme and SASHash */ - const uint8_t encrypted_body_size = (2 + 1 + 1) + 4 + 32; - - zrtp_memset(sasrelay, 0, sizeof(zrtp_packet_SASRelay_t)); - - /* generate a random initialization vector for CFB cipher */ - if (ZRTP_CFBIV_SIZE != zrtp_randstr(session->zrtp, sasrelay->iv, ZRTP_CFBIV_SIZE)) { - return zrtp_status_rp_fail; - } - - sasrelay->flags |= (session->profile.disclose_bit || transf_d_flag) ? 0x01 : 0x00; - sasrelay->flags |= (session->profile.allowclear && transf_ac_flag) ? 0x02 : 0x00; - sasrelay->flags |= 0x04; - - zrtp_memcpy( sasrelay->sas_scheme, - zrtp_comp_id2type(ZRTP_CC_SAS, transf_sas_scheme), - ZRTP_COMP_TYPE_SIZE ); - if (transf_sas_value) - zrtp_memcpy(sasrelay->sashash, transf_sas_value->buffer, transf_sas_value->length); - - /* Then we need to encrypt Confirm before computing Hmac. Use AES CFB */ - do { - cipher_ctx = session->blockcipher->start( session->blockcipher, - (uint8_t*)stream->cc.zrtp_key.buffer, - NULL, - ZRTP_CIPHER_MODE_CFB ); - if (!cipher_ctx) { - break; - } - - s = session->blockcipher->set_iv( session->blockcipher, - cipher_ctx, - (zrtp_v128_t*)sasrelay->iv); - if (zrtp_status_ok != s) { - break; - } - - s = session->blockcipher->encrypt( session->blockcipher, - cipher_ctx, - (uint8_t*)sasrelay->pad, - encrypted_body_size ); - } while(0); - if (cipher_ctx) { - session->blockcipher->stop(session->blockcipher, cipher_ctx); - } - - - - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! Failed to encrypt SASRELAY Message status=%d. ID=%u\n", s, stream->id)); - return s; - } - - /* Compute Hmac over encrypted part of Confirm */ - { - zrtp_string128_t hmac = ZSTR_INIT_EMPTY(hmac); - s = session->hash->hmac_c( session->hash, - stream->cc.hmackey.buffer, - stream->cc.hmackey.length, - (const char*)&sasrelay->pad, - encrypted_body_size, - ZSTR_GV(hmac) ); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! Failed to compute CONFIRM hmac status=%d. ID=%u\n", s, stream->id)); - return s; - } - zrtp_memcpy(sasrelay->hmac, hmac.buffer, ZRTP_HMAC_SIZE); - } - - return s; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_sasrelay(zrtp_stream_t *stream, zrtp_rtp_info_t *packet) -{ - zrtp_session_t *session = stream->session; - zrtp_packet_SASRelay_t *sasrelay = (zrtp_packet_SASRelay_t*) packet->message; - void* cipher_ctx = NULL; - zrtp_sas_id_t rendering_id = ZRTP_COMP_UNKN; - 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 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; - } - - /* Check the HMAC */ - s = session->hash->hmac_c( session->hash, - stream->cc.peer_hmackey.buffer, - stream->cc.peer_hmackey.length, - (const char*)&sasrelay->pad, - encrypted_body_size, - ZSTR_GV(hmac) ); - if (zrtp_status_ok != s ) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! Failed to compute CONFIRM hmac. status=%d ID=%u\n", s, stream->id)); - return zrtp_status_fail; - } - - if (0 != zrtp_memcmp(sasrelay->hmac, hmac.buffer, ZRTP_HMAC_SIZE)) { - ZRTP_LOG(2,(_ZTU_, ZRTP_VERIFIED_RESP_WARNING_STR)); - return zrtp_status_fail; - } - - ZRTP_LOG(3,(_ZTU_, "\tHMAC value for the SASRELAY is correct - decrypting...\n")); - - /* Then we need to decrypt Confirm body */ - do - { - cipher_ctx = session->blockcipher->start( session->blockcipher, - (uint8_t*)stream->cc.peer_zrtp_key.buffer, - NULL, - ZRTP_CIPHER_MODE_CFB ); - if (!cipher_ctx) { - break; - } - - s = session->blockcipher->set_iv(session->blockcipher, cipher_ctx, (zrtp_v128_t*)sasrelay->iv); - if (zrtp_status_ok != s) { - break; - } - - s = session->blockcipher->decrypt( session->blockcipher, - cipher_ctx, - (uint8_t*)sasrelay->pad, - encrypted_body_size); - } while(0); - if (cipher_ctx) { - session->blockcipher->stop(session->blockcipher, cipher_ctx); - } - - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! Failed to decrypt Confirm. status=%d ID=%u\n", s, stream->id)); - return s; - } - - ZRTP_LOG(2,(_ZTU_,"\tSasRelay FLAGS old/new A=%d/%d, D=%d/%d.\n", - stream->allowclear, (uint8_t)(sasrelay->flags & 0x02), - stream->peer_disclose_bit, (uint8_t)(sasrelay->flags & 0x01))); - - /* Set evil bit if other-side disclosed session key */ - stream->peer_disclose_bit = (sasrelay->flags & 0x01); - - /* Enable ALLOWCLEAR option only if both sides support it */ - stream->allowclear = (sasrelay->flags & 0x02) && session->profile.allowclear; - - /* - * We don't handle verified flag in SASRelaying because it makes no - * sense in implementation of the ZRTP Internet Draft. - */ - - /* - * Only enrolled users can do SAS transferring. (Non-enrolled users can - * only change the SAS rendering scheme). - */ - - rendering_id = zrtp_comp_type2id(ZRTP_CC_SAS, (char*)sasrelay->sas_scheme); - if (-1 == zrtp_profile_find(&session->profile, ZRTP_CC_SAS, rendering_id)) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! PBX Confirm packet with transferred SAS have unknown or" - " unsupported rendering scheme %.4s.ID=%u\n", sasrelay->sas_scheme, stream->id)); - - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_invalid_packet, 1); - return zrtp_status_fail; - } - - /* 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) && - (0 != zrtp_memcmp(sasrelay->sashash, zerosashash, sizeof(sasrelay->sashash))) ) - { - char buff[256]; - session->sasbin.length = ZRTP_MITM_SAS_SIZE; - /* First 32 bits if sashash includes sasvalue */ - zrtp_memcpy(session->sasbin.buffer, sasrelay->sashash, session->sasbin.length); - stream->mitm_mode = ZRTP_MITM_MODE_RECONFIRM_CLIENT; - - sas_hash_did_change = 1; - ZRTP_LOG(3,(_ZTU_,"\tSasRelay: SAS value was updated to bin=%s.\n", - hex2str(session->sasbin.buffer, session->sasbin.length, buff, sizeof(buff)))); - } - } else if (0 != zrtp_memcmp(sasrelay->sashash, zerosashash, sizeof(sasrelay->sashash))) { - ZRTP_LOG(1,(_ZTU_,"\tWARNING! SAS Value was received from NOT Trusted MiTM. ID=%u\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_possible_mitm3, 1); - return zrtp_status_fail; - } else { - ZRTP_LOG(1,(_ZTU_, "\rERROR! For SasRelay Other secret doesn't match. ID=%u\n", stream->id)); - } - - - /* 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; - } - - 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; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_sasrelaying( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_RELAYACK: - _zrtp_cancel_send_packet_later(stream, ZRTP_SASRELAY); - _zrtp_change_state(stream, ZRTP_STATE_SECURE); - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_REMOTE_SAS_UPDATED); - } - break; - - case ZRTP_GOCLEAR: - s = _zrtp_machine_process_goclear(stream, packet); - if (zrtp_status_ok == s) { - s = _zrtp_machine_enter_pendingclear(stream); - } - break; - - case ZRTP_NONE: - s = _zrtp_protocol_decrypt(stream->protocol, packet, 1); - break; - - default: - break; - } - - return s; -} - - -/*===========================================================================*/ -/* ZRTP API for PBX */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_stream_registration_start(zrtp_stream_t* stream, uint32_t ssrc) -{ - if (!stream) { - return zrtp_status_bad_param; - } - - ZRTP_LOG(3,(_ZTU_,"START REGISTRATION STREAM ID=%u mode=%s state=%s.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - if (NULL == stream->zrtp->cb.cache_cb.on_get_mitm) { - ZRTP_LOG(2,(_ZTU_,"WARNING: Can't use MiTM Functions with no ZRTP Cache.\n")); - return zrtp_status_notavailable; - } - - stream->mitm_mode = ZRTP_MITM_MODE_REG_SERVER; - return zrtp_stream_start(stream, ssrc); -} - -zrtp_status_t zrtp_stream_registration_secure(zrtp_stream_t* stream) -{ - if (!stream) { - return zrtp_status_bad_param; - } - - ZRTP_LOG(3,(_ZTU_,"SECURE REGISTRATION STREAM ID=%u mode=%s state=%s.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - if (NULL == stream->zrtp->cb.cache_cb.on_get_mitm) { - ZRTP_LOG(2,(_ZTU_,"WARNING: Can't use MiTM Functions with no ZRTP Cache.\n")); - return zrtp_status_notavailable; - } - - stream->mitm_mode = ZRTP_MITM_MODE_REG_SERVER; - return zrtp_stream_secure(stream); -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_register_with_trusted_mitm(zrtp_stream_t* stream) -{ - zrtp_session_t *session = stream->session; - zrtp_status_t s = zrtp_status_bad_param; - - if (!stream) { - return zrtp_status_bad_param; - } - - ZRTP_LOG(3,(_ZTU_,"MARKING this call as REGISTRATION ID=%u\n", stream->id)); - - if (NULL == stream->zrtp->cb.cache_cb.on_get_mitm) { - ZRTP_LOG(2,(_ZTU_,"WARNING: Can't use MiTM Functions with no ZRTP Cache.\n")); - return zrtp_status_notavailable; - } - - if (!stream->protocol) { - return zrtp_status_bad_param; - } - - /* 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 Secret.\n")); - return zrtp_status_bad_param; - } - - /* - * Generate new MitM cache: - * pbxsecret = KDF(ZRTPSess, "Trusted MiTM key", (ZIDi | ZIDr), negotiated hash length) - */ - if ( (stream->state == ZRTP_STATE_SECURE) && - ((stream->mitm_mode == ZRTP_MITM_MODE_REG_CLIENT) || (stream->mitm_mode == ZRTP_MITM_MODE_REG_SERVER)) ) - { - zrtp_string32_t kdf_context = ZSTR_INIT_EMPTY(kdf_context); - static const zrtp_string32_t trusted_mitm_key_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_TRUSTMITMKEY_STR); - zrtp_string16_t *zidi, *zidr; - - if (stream->protocol->type == ZRTP_STATEMACHINE_INITIATOR) { - zidi = &session->zid; - zidr = &session->peer_zid; - } else { - zidi = &session->peer_zid; - zidr = &session->zid; - } - - zrtp_zstrcat(ZSTR_GV(kdf_context), ZSTR_GVP(zidi)); - zrtp_zstrcat(ZSTR_GV(kdf_context), ZSTR_GVP(zidr)); - - _zrtp_kdf( stream, - ZSTR_GV(session->zrtpsess), - ZSTR_GV(trusted_mitm_key_label), - ZSTR_GV(kdf_context), - ZRTP_HASH_SIZE, - ZSTR_GV(session->secrets.pbxs->value)); - - session->secrets.pbxs->_cachedflag = 1; - session->secrets.pbxs->lastused_at = (uint32_t)(zrtp_time_now()/1000); - session->secrets.cached |= ZRTP_BIT_PBX; - session->secrets.matches |= ZRTP_BIT_PBX; - - s = zrtp_status_ok; - if (session->zrtp->cb.cache_cb.on_put_mitm) { - s = session->zrtp->cb.cache_cb.on_put_mitm( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - session->secrets.pbxs); - } - - ZRTP_LOG(3,(_ZTU_,"Makring this call as REGISTRATION - DONE\n")); - } - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_link_mitm_calls(zrtp_stream_t *stream1, zrtp_stream_t *stream2) -{ - if (!stream1 || !stream2) { - return zrtp_status_bad_param; - } - - ZRTP_LOG(3,(_ZTU_,"Link to MiTM call together stream1=%u stream2=%u.\n", stream1->id, stream2->id)); - - /* This APi is for MiTM endpoints only. */ - if (stream1->zrtp->is_mitm) { - return zrtp_status_bad_param; - } - - stream1->linked_mitm = stream2; - stream2->linked_mitm = stream1; - - { - zrtp_stream_t *passive = NULL; - zrtp_stream_t *unlimited = NULL; - - /* Check if we have at least one Unlimited endpoint. */ - if (stream1->peer_super_flag) - unlimited = stream1; - else if (stream2->peer_super_flag) - unlimited = stream2; - - /* Check if the peer stream is Passive */ - if (unlimited) { - passive = (stream1 == unlimited) ? stream2 : stream1; - if (!passive->peer_passive) - passive = NULL; - } - - /* Ok, we haver Unlimited and Passive at two ends, let's make an exception and switch Passive to Secure. */ - if (unlimited && passive) { - if (passive->state == ZRTP_STATE_CLEAR) { - ZRTP_LOG(2,(_ZTU_,"INFO: zrtp_link_mitm_calls() stream with id=%u is Unlimited and" - " Peer stream with id=%u is Passive in CLEAR state, switch the passive one to SECURE.\n")); - - /* @note: don't use zrtp_secure_stream() wrapper as it checks for Active/Passive stuff. */ - _zrtp_machine_start_initiating_secure(passive); - } - } - } - - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_update_remote_options( zrtp_stream_t* stream, - zrtp_sas_id_t transf_sas_scheme, - zrtp_string32_t* transf_sas_value, - uint8_t transf_ac_flag, - uint8_t transf_d_flag ) -{ - zrtp_retry_task_t* task = &stream->messages.sasrelay_task; - zrtp_status_t s = zrtp_status_ok; - char buff[256]; - - if (!stream) { - return zrtp_status_bad_param; - } - - ZRTP_LOG(3,(_ZTU_,"UPDATE REMOTE SAS OPTIONS mode. ID=%u\n", stream->id)); - ZRTP_LOG(3,(_ZTU_,"transf_sas=%s scheme=%d.\n", transf_sas_value ? - hex2str((const char*)transf_sas_value->buffer, transf_sas_value->length, (char*)buff, sizeof(buff)) : "NULL", - transf_sas_scheme)); - - if (NULL == stream->zrtp->cb.cache_cb.on_get_mitm) { - ZRTP_LOG(2,(_ZTU_,"WARNING: Can't use MiTM Functions with no ZRTP Cache.\n")); - return zrtp_status_notavailable; - } - - /* The TRANSFERRING option is only available from the SECURE state. */ - if (stream->state != ZRTP_STATE_SECURE) { - return zrtp_status_bad_param; - } - - /* Don't transfer an SAS to a non-enrolled user */ - if (transf_sas_value && !(stream->session->secrets.matches & ZRTP_BIT_PBX)) { - return zrtp_status_bad_param; - } - - /* 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")); - return zrtp_status_wrong_state; - } - - s = _create_sasrelay( stream, - transf_sas_scheme, - transf_sas_value, - transf_ac_flag, - transf_d_flag, - &stream->messages.sasrelay); - if(zrtp_status_ok != s) { - return s; - } - - s = _zrtp_packet_fill_msg_hdr( stream, - ZRTP_SASRELAY, - sizeof(zrtp_packet_SASRelay_t) - sizeof(zrtp_msg_hdr_t), - &stream->messages.sasrelay.hdr); - if(zrtp_status_ok != s) { - return s; - } - - _zrtp_change_state(stream, ZRTP_STATE_SASRELAYING); - - task->_is_enabled = 1; - task->callback = _send_and_resend_sasrelay; - task->_retrys = 0; - _send_and_resend_sasrelay(stream, task); - - return s; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_resolve_mitm_call( zrtp_stream_t* stream1, - zrtp_stream_t* stream2) -{ - zrtp_stream_t* enrolled = NULL; - zrtp_stream_t* non_enrolled = NULL; - zrtp_sas_id_t mitm_sas_scheme = ZRTP_COMP_UNKN; - zrtp_status_t s = zrtp_status_ok; - - if (!stream1 || !stream2) { - return zrtp_status_bad_param; - } - - ZRTP_LOG(3,(_ZTU_,"RESOLVE MITM CALL s1=%u, s2=%u...\n", stream1->id, stream2->id)); - - if (NULL == stream1->zrtp->cb.cache_cb.on_get_mitm) { - ZRTP_LOG(2,(_ZTU_,"WARNING: Can't use MiTM Functions with no ZRTP Cache.\n")); - return zrtp_status_notavailable; - } - - /* - * Both sides must be in the Secure state and at least one should be - * enrolled. - */ - if ((stream1->state != ZRTP_STATE_SECURE) || (stream2->state != ZRTP_STATE_SECURE)) { - return zrtp_status_bad_param; - } - - /* Check the stream enrollment options and choose one for transferring the call. */ - if (zrtp_is_user_enrolled(stream1)) { - if (zrtp_is_user_enrolled(stream2)) { - ZRTP_LOG(3,(_ZTU_,"\tBoth streams are enrolled - choose one with bigger ZID.\n")); - enrolled = zrtp_choose_one_enrolled(stream1, stream2); - } else { - enrolled = stream1; - } - } else if (zrtp_is_user_enrolled(stream2)) { - enrolled = stream2; - } - - if (!enrolled) { - return zrtp_status_bad_param; - } - else { - non_enrolled = (stream1 == enrolled) ? stream2 : stream1; - } - - ZRTP_LOG(3,(_ZTU_,"\tAfter Resolving: S1 is %s and S2 is %s.\n", - (stream1 == enrolled) ? "ENROLLED" : "NON-ENROLLED", - (stream2 == enrolled) ? "ENROLLED" : "NON-ENROLLED")); - - /* - * Choose the best SAS rendering scheme supported by both peers. Find the - * stream that can change it. - */ - { - uint8_t i=0; - - zrtp_packet_Hello_t *enhello = &enrolled->messages.peer_hello; - char *encp = (char*)enhello->comp + (enhello->hc + - enhello->cc + - enhello->ac + - enhello->kc)* ZRTP_COMP_TYPE_SIZE; - - - for (i=0; isc; i++, encp+=ZRTP_COMP_TYPE_SIZE) - { - uint8_t j=0; - zrtp_packet_Hello_t *nonenhello = &non_enrolled->messages.peer_hello; - char *nonencp = (char*)nonenhello->comp + (nonenhello->hc + - nonenhello->cc + - nonenhello->ac + - nonenhello->kc)* ZRTP_COMP_TYPE_SIZE; - - for (j=0; jsc; j++, nonencp+=ZRTP_COMP_TYPE_SIZE) - { - if (0 == zrtp_memcmp(encp, nonencp, ZRTP_COMP_TYPE_SIZE)) { - mitm_sas_scheme = zrtp_comp_type2id(ZRTP_CC_SAS, encp); - ZRTP_LOG(3,(_ZTU_,"\tMITM SAS scheme=%.4s was choosen.\n", encp)); - break; - } - } - if (j != nonenhello->sc) { - break; - } - } - } - if (ZRTP_COMP_UNKN == mitm_sas_scheme) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! Can't find matched SAS schemes on MiTM Resolving.\n" - " s1=%u s2=$u", stream1->id, stream2->id)); - return zrtp_status_algo_fail; - } - - s = zrtp_update_remote_options( enrolled, - mitm_sas_scheme, - &non_enrolled->session->sasbin, - non_enrolled->allowclear, - non_enrolled->peer_disclose_bit ); - if (zrtp_status_ok != s) { - return s; - } - - /* NOTE: new request from Philip Zimmermann - always send SASRelay to BOTH parties. */ - /* If non-enrolled party has SAS scheme different from chosen one - update */ - /*if (non_enrolled->session->sasscheme->base.id != mitm_sas_scheme) { */ - s = zrtp_update_remote_options( non_enrolled, - mitm_sas_scheme, - NULL, - enrolled->allowclear, - enrolled->peer_disclose_bit ); - if (zrtp_status_ok != s) { - return s; - } - /*}*/ - - return s; -} - -/*---------------------------------------------------------------------------*/ -uint8_t zrtp_is_user_enrolled(zrtp_stream_t* stream) -{ - if (!stream) { - return zrtp_status_bad_param; - } - - return ( (stream->session->secrets.cached & ZRTP_BIT_PBX) && - (stream->session->secrets.matches & ZRTP_BIT_PBX) ); -} - -zrtp_stream_t* zrtp_choose_one_enrolled(zrtp_stream_t* stream1, zrtp_stream_t* stream2) -{ - if (!stream1 || !stream2) { - return NULL; - } - - if (zrtp_memcmp( stream1->session->zid.buffer, - stream2->session->zid.buffer, - stream1->session->zid.length) > 0) { - return stream1; - } else { - return stream2; - } -} diff --git a/libs/libzrtp/src/zrtp_protocol.c b/libs/libzrtp/src/zrtp_protocol.c deleted file mode 100644 index 8a62e11aa0..0000000000 --- a/libs/libzrtp/src/zrtp_protocol.c +++ /dev/null @@ -1,1456 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp protocol" - - -/*===========================================================================*/ -/* PROTOCOL Logic */ -/*===========================================================================*/ - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t _attach_secret( zrtp_session_t *session, - zrtp_proto_secret_t* psec, - zrtp_shared_secret_t* sec, - uint8_t is_initiator) -{ - zrtp_uchar32_t buff; - static const zrtp_string16_t initiator = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_ROLE_INITIATOR); - static const zrtp_string16_t responder = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_ROLE_RESPONDER); - - const zrtp_string16_t* role = is_initiator ? &initiator : &responder; - const zrtp_string16_t* his_role = is_initiator ? &responder : &initiator; - - ZSTR_SET_EMPTY(psec->id); - ZSTR_SET_EMPTY(psec->peer_id); - psec->secret = sec; - - /* - * If secret's value is available (from the cache or from SIP) - use hmac; - * use zero-strings in other case. - */ - if (psec->secret) { - session->hash->hmac_truncated( session->hash, - ZSTR_GV(sec->value), - ZSTR_GVP(role), - ZRTP_RSID_SIZE, - ZSTR_GV(psec->id)); - - session->hash->hmac_truncated( session->hash, - ZSTR_GV(sec->value), - ZSTR_GVP(his_role), - ZRTP_RSID_SIZE, - ZSTR_GV(psec->peer_id)); - } else { - psec->id.length = ZRTP_RSID_SIZE; - zrtp_memset(psec->id.buffer, 0, psec->id.length); - - psec->peer_id.length = ZRTP_RSID_SIZE; - zrtp_memset(psec->peer_id.buffer, 0, psec->peer_id.length); - } - - ZRTP_LOG(3,(_ZTU_,"\tAttach RS id=%s.\n", - hex2str((const char*)psec->id.buffer, psec->id.length, (char*)buff, sizeof(buff)))); - ZRTP_LOG(3,(_ZTU_,"\tAttach RS peer_id=%s.\n", - hex2str((const char*)psec->peer_id.buffer, psec->peer_id.length, (char*)buff, sizeof(buff)))); - - return zrtp_status_ok; -} - -static zrtp_status_t _attach_auxs_secret(zrtp_stream_t *stream, - zrtp_proto_secret_t* psec, - zrtp_shared_secret_t* sec, - uint8_t is_initiator) -{ - zrtp_uchar32_t buff; - - zrtp_string32_t myH3; - ZSTR_SET_EMPTY(myH3); - zrtp_zstrncpyc(ZSTR_GV(myH3), stream->messages.hello.hash, sizeof(stream->messages.hello.hash)); - - zrtp_string32_t peerH3; - ZSTR_SET_EMPTY(peerH3); - zrtp_zstrncpyc(ZSTR_GV(peerH3), stream->messages.peer_hello.hash, sizeof(stream->messages.peer_hello.hash)); - - ZSTR_SET_EMPTY(psec->id); - ZSTR_SET_EMPTY(psec->peer_id); - psec->secret = sec; - - if (psec->secret) { - stream->session->hash->hmac_truncated(stream->session->hash, - ZSTR_GV(sec->value), - ZSTR_GV(myH3), - ZRTP_RSID_SIZE, - ZSTR_GV(psec->id)); - - stream->session->hash->hmac_truncated(stream->session->hash, - ZSTR_GV(sec->value), - ZSTR_GV(peerH3), - ZRTP_RSID_SIZE, - ZSTR_GV(psec->peer_id)); - } - else { - psec->id.length = ZRTP_RSID_SIZE; - zrtp_memset(psec->id.buffer, 0, psec->id.length); - - psec->peer_id.length = ZRTP_RSID_SIZE; - zrtp_memset(psec->peer_id.buffer, 0, psec->peer_id.length); - } - - ZRTP_LOG(3, (_ZTU_, "\tAttach RS/auxs id=%s.\n", - hex2str((const char*)psec->id.buffer, psec->id.length, (char*)buff, sizeof(buff)))); - ZRTP_LOG(3, (_ZTU_, "\tAttach RS/auxs peer_id=%s.\n", - hex2str((const char*)psec->peer_id.buffer, psec->peer_id.length, (char*)buff, sizeof(buff)))); - - return zrtp_status_ok; -} - -zrtp_status_t _zrtp_protocol_init(zrtp_stream_t *stream, uint8_t is_initiator, zrtp_protocol_t **protocol) -{ - zrtp_protocol_t *new_proto = NULL; - zrtp_status_t s = zrtp_status_ok; - - ZRTP_LOG(3,(_ZTU_,"\tInit %s Protocol ID=%u mode=%s...\n", - is_initiator ? "INITIATOR's" : "RESPONDER's", stream->id, zrtp_log_mode2str(stream->mode))); - - /* Destroy previous protocol structure (Responder or Preshared) */ - if (*protocol) { - _zrtp_protocol_destroy(*protocol); - *protocol = NULL; - } - - /* Allocate memory for all branching structures */ - do - { - new_proto = zrtp_sys_alloc(sizeof(zrtp_protocol_t)); - if (!new_proto) { - s = zrtp_status_alloc_fail; - break; - } - zrtp_memset(new_proto, 0, sizeof(zrtp_protocol_t)); - - new_proto->cc = zrtp_sys_alloc(sizeof(zrtp_proto_crypto_t)); - if (!new_proto->cc) { - s = zrtp_status_alloc_fail; - break; - } - zrtp_memset(new_proto->cc, 0, sizeof(zrtp_proto_crypto_t)); - - /* Create and Initialize DH crypto context (for DH streams only) */ - if (ZRTP_IS_STREAM_DH(stream)) { - if (stream->dh_cc.initialized_with != stream->pubkeyscheme->base.id) { - stream->pubkeyscheme->initialize(stream->pubkeyscheme, &stream->dh_cc); - stream->dh_cc.initialized_with = stream->pubkeyscheme->base.id; - } - } - - /* Initialize main structure at first: functions pointers and generate nonce */ - new_proto->type = is_initiator ? ZRTP_STATEMACHINE_INITIATOR : ZRTP_STATEMACHINE_RESPONDER; - new_proto->context = stream; - - /* Initialize protocol crypto context and prepare it for further usage */ - ZSTR_SET_EMPTY(new_proto->cc->kdf_context); - ZSTR_SET_EMPTY(new_proto->cc->s0); - ZSTR_SET_EMPTY(new_proto->cc->mes_hash); - ZSTR_SET_EMPTY(new_proto->cc->hv); - ZSTR_SET_EMPTY(new_proto->cc->peer_hv); - - if (ZRTP_IS_STREAM_DH(stream)) { - _attach_secret(stream->session, &new_proto->cc->rs1, stream->session->secrets.rs1, is_initiator); - _attach_secret(stream->session, &new_proto->cc->rs2, stream->session->secrets.rs2, is_initiator); - _attach_auxs_secret(stream, &new_proto->cc->auxs, stream->session->secrets.auxs, is_initiator); - _attach_secret(stream->session, &new_proto->cc->pbxs, stream->session->secrets.pbxs, is_initiator); - } - - s = zrtp_status_ok; - *protocol = new_proto; - } while (0); - - if (s != zrtp_status_ok) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! _zrtp_protocol_attach() with code %s.\n", zrtp_log_status2str(s))); - if (new_proto && new_proto->cc) { - zrtp_sys_free(new_proto->cc); - } - if (new_proto) { - zrtp_sys_free(new_proto); - } - *protocol = NULL; - } - - return s; -} - -/*----------------------------------------------------------------------------*/ -static void clear_crypto_sources(zrtp_stream_t* stream) -{ - zrtp_protocol_t* proto = stream->protocol; - if (proto && proto->cc) { - zrtp_memset(proto->cc, 0, sizeof(zrtp_proto_crypto_t)); - zrtp_sys_free(proto->cc); - proto->cc = 0; - } -} - -void _zrtp_protocol_destroy(zrtp_protocol_t *proto) -{ - /* Clear protocol crypto values, destroy SRTP unit, clear and release memory. */ - if (proto) { - /* if protocol is being destroyed by exception, ->context may be NULL */ - if (proto->context) { - _zrtp_cancel_send_packet_later(proto->context, ZRTP_NONE); - if (proto->_srtp) { - zrtp_srtp_destroy(proto->context->zrtp->srtp_global, proto->_srtp); - } - } - - clear_crypto_sources(proto->context); - zrtp_memset(proto, 0, sizeof(zrtp_protocol_t)); - zrtp_sys_free(proto); - } -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_protocol_encrypt( zrtp_protocol_t *proto, - zrtp_rtp_info_t *packet, - uint8_t is_rtp) -{ - zrtp_status_t s = zrtp_status_ok; - - if (is_rtp) { - s = zrtp_srtp_protect(proto->context->zrtp->srtp_global, proto->_srtp, packet); - } else { - s = zrtp_srtp_protect_rtcp(proto->context->zrtp->srtp_global, proto->_srtp, packet); - } - - if (zrtp_status_ok != s) { - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *hdr = (zrtp_rtp_hdr_t*) packet->packet; - - ZRTP_LOG(2,(_ZTU_,"ERROR! Encrypt failed. ID=%u:%s s=%s (%s size=%d ssrc=%u seq=%d pt=%d)\n", - proto->context->id, - zrtp_log_mode2str(proto->context->mode), - zrtp_log_status2str(s), - is_rtp ? "RTP" : "RTCP", - *packet->length, - zrtp_ntoh32(hdr->ssrc), - zrtp_ntoh16(hdr->seq), - hdr->pt)); - } - - return s; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_protocol_decrypt( zrtp_protocol_t *proto, - zrtp_rtp_info_t *packet, - uint8_t is_rtp) -{ - zrtp_status_t s = zrtp_status_ok; - - if (is_rtp) { - s = zrtp_srtp_unprotect(proto->context->zrtp->srtp_global, proto->_srtp, packet); - } else { - s = zrtp_srtp_unprotect_rtcp(proto->context->zrtp->srtp_global, proto->_srtp, packet); - } - - if (zrtp_status_ok != s) { - ZRTP_UNALIGNED(zrtp_rtp_hdr_t) *hdr = (zrtp_rtp_hdr_t*) packet->packet; - ZRTP_LOG(2,(_ZTU_,"ERROR! Decrypt failed. ID=%u:%s s=%s (%s size=%d ssrc=%u seq=%u/%u pt=%d)\n", - proto->context->id, - zrtp_log_mode2str(proto->context->mode), - zrtp_log_status2str(s), - is_rtp ? "RTP" : "RTCP", - *packet->length, - zrtp_ntoh32(hdr->ssrc), - zrtp_ntoh16(hdr->seq), - packet->seq, - hdr->pt)); - } - - return s; -} - - -/*===========================================================================*/ -/* CRYPTO Utilites */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -static zrtp_status_t _derive_s0(zrtp_stream_t* stream, int is_initiator) -{ - static const zrtp_string32_t zrtp_kdf_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_KDF_STR); - static const zrtp_string32_t zrtp_sess_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_SESS_STR); - static const zrtp_string32_t zrtp_multi_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_MULTI_STR); - static const zrtp_string32_t zrtp_presh_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_PRESH_STR); - - zrtp_session_t *session = stream->session; - zrtp_secrets_t* secrets = &session->secrets; - zrtp_proto_crypto_t* cc = stream->protocol->cc; - void* hash_ctx = NULL; - char print_buff[256]; - - switch (stream->mode) - { - /* - * S0 computing for FULL DH exchange - * S0 computing. s0 is the master shared secret used for all - * cryptographic operations. In particular, note the inclusion - * of "total_hash", a hash of all packets exchanged up to this - * point. This belatedly detects any tampering with earlier - * packets, e.g. bid-down attacks. - * - * s0 = hash( 1 | DHResult | "ZRTP-HMAC-KDF" | ZIDi | ZIDr | - * total_hash | len(s1) | s1 | len(s2) | s2 | len(s3) | s3 ) - * The constant 1 and all lengths are 32 bits big-endian values. - * The fields without length prefixes are fixed-witdh: - * - DHresult is fixed to the width of the DH prime. - * - The hash type string and ZIDs are fixed width. - * - total_hash is fixed by the hash negotiation. - * The constant 1 is per NIST SP 800-56A section 5.8.1, and is - * a counter which can be incremented to generate more than 256 - * bits of key material. - * ======================================================================== - */ - case ZRTP_STREAM_MODE_DH: - { - zrtp_proto_secret_t *C[3] = { 0, 0, 0}; - int i = 0; - uint32_t comp_length = 0; - zrtp_stringn_t *zidi = NULL, *zidr = NULL; - struct BigNum dhresult; -#if (defined(ZRTP_USE_STACK_MINIM) && (ZRTP_USE_STACK_MINIM == 1)) - zrtp_uchar1024_t* buffer = zrtp_sys_alloc( sizeof(zrtp_uchar1024_t) ); - if (!buffer) { - return zrtp_status_alloc_fail; - } -#else - zrtp_uchar1024_t holder; - zrtp_uchar1024_t* buffer = &holder; -#endif - - ZRTP_LOG(3,(_ZTU_,"\tDERIVE S0 from DH exchange and RS secrets...\n")); - ZRTP_LOG(3,(_ZTU_,"\t my rs1ID:%s\n", hex2str(cc->rs1.id.buffer, cc->rs1.id.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t his rs1ID:%s\n", hex2str((const char*)stream->messages.peer_dhpart.rs1ID, ZRTP_RSID_SIZE, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t his rs1ID comp:%s\n", hex2str(cc->rs1.peer_id.buffer, cc->rs1.peer_id.length, print_buff, sizeof(print_buff)))); - - ZRTP_LOG(3,(_ZTU_,"\t my rs2ID:%s\n", hex2str(cc->rs2.id.buffer, cc->rs2.id.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t his rs2ID:%s\n", hex2str((const char*)stream->messages.peer_dhpart.rs2ID, ZRTP_RSID_SIZE, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t his rs2ID comp:%s\n", hex2str(cc->rs2.peer_id.buffer, cc->rs2.peer_id.length, print_buff, sizeof(print_buff)))); - - ZRTP_LOG(3,(_ZTU_,"\t my pbxsID:%s\n", hex2str(cc->pbxs.id.buffer, cc->pbxs.id.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t his pbxsID:%s\n", hex2str((const char*)stream->messages.peer_dhpart.pbxsID, ZRTP_RSID_SIZE, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\this pbxsID comp:%s\n", hex2str(cc->pbxs.peer_id.buffer, cc->pbxs.peer_id.length, print_buff, sizeof(print_buff)))); - - ZRTP_LOG(3, (_ZTU_, "\t my auxsID:%s\n", hex2str(cc->auxs.id.buffer, cc->auxs.id.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3, (_ZTU_, "\t his auxsID:%s\n", hex2str((const char*)stream->messages.peer_dhpart.auxsID, ZRTP_RSID_SIZE, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3, (_ZTU_, "\this auxsID comp:%s\n", hex2str(cc->auxs.peer_id.buffer, cc->auxs.peer_id.length, print_buff, sizeof(print_buff)))); - - hash_ctx = session->hash->hash_begin(session->hash); - if (0 == hash_ctx) { - ZRTP_LOG(1,(_ZTU_, "\tERROR! can't start hash calculation for S0 computing. ID=%u.\n", stream->id)); - return zrtp_status_fail; - } - - /* - * NIST requires a 32-bit big-endian integer counter to be included - * in the hash each time the hash is computed, which we have set to - * the fixed value of 1, because we only compute the hash once. - */ - comp_length = zrtp_hton32(1L); - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&comp_length, 4); - - - switch (stream->pubkeyscheme->base.id) { - case ZRTP_PKTYPE_DH2048: - case ZRTP_PKTYPE_DH3072: - case ZRTP_PKTYPE_DH4096: - comp_length = stream->pubkeyscheme->pv_length; - ZRTP_LOG(3,(_ZTU_,"DH comp_length=%u\n", comp_length)); - break; - case ZRTP_PKTYPE_EC256P: - case ZRTP_PKTYPE_EC384P: - case ZRTP_PKTYPE_EC521P: - comp_length = stream->pubkeyscheme->pv_length/2; - ZRTP_LOG(3,(_ZTU_,"ECDH comp_length=%u\n", comp_length)); - break; - default: - break; - } - - bnBegin(&dhresult); - stream->pubkeyscheme->compute(stream->pubkeyscheme, - &stream->dh_cc, - &dhresult, - &stream->dh_cc.peer_pv); - - bnExtractBigBytes(&dhresult, (uint8_t *)buffer, 0, comp_length); - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)buffer, comp_length); - bnEnd(&dhresult); - -#if (defined(ZRTP_USE_STACK_MINIM) && (ZRTP_USE_STACK_MINIM == 1)) - zrtp_sys_free(buffer); -#endif - - /* Add "ZRTP-HMAC-KDF" to the S0 hash */ - session->hash->hash_update( session->hash, hash_ctx, - (const int8_t*)&zrtp_kdf_label.buffer, - zrtp_kdf_label.length); - - /* Then Initiator's and Responder's ZIDs */ - if (stream->protocol->type == ZRTP_STATEMACHINE_INITIATOR) { - zidi = ZSTR_GV(stream->session->zid); - zidr = ZSTR_GV(stream->session->peer_zid); - } else { - zidr = ZSTR_GV(stream->session->zid); - zidi = ZSTR_GV(stream->session->peer_zid); - } - - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&zidi->buffer, zidi->length); - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&zidr->buffer, zidr->length); - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&cc->mes_hash.buffer, cc->mes_hash.length); - - /* If everything is OK - RS1 should much */ - if (!zrtp_memcmp(cc->rs1.peer_id.buffer, stream->messages.peer_dhpart.rs1ID, ZRTP_RSID_SIZE)) - { - C[0] = &cc->rs1; - secrets->matches |= ZRTP_BIT_RS1; - } - /* If we have lost our RS1 - remote party should use backup (RS2) instead */ - else if (!zrtp_memcmp(cc->rs1.peer_id.buffer, stream->messages.peer_dhpart.rs2ID, ZRTP_RSID_SIZE)) - { - C[0] = &cc->rs1; - secrets->matches |= ZRTP_BIT_RS1; - ZRTP_LOG(2,(_ZTU_,"\tINFO! We have lost our RS1 from previous broken exchange" - " - remote party will use RS2 backup. ID=%u\n", stream->id)); - } - /* If remote party lost it's secret - we will use backup */ - else if (!zrtp_memcmp(cc->rs2.peer_id.buffer, stream->messages.peer_dhpart.rs1ID, ZRTP_RSID_SIZE)) - { - C[0] = &cc->rs2; - cc->rs1 = cc->rs2; - secrets->matches |= ZRTP_BIT_RS1; - secrets->cached |= ZRTP_BIT_RS1; - ZRTP_LOG(2,(_ZTU_,"\tINFO! Remote party has lost it's RS1 - use RS2 backup. ID=%u\n", stream->id)); - } - else - { - secrets->matches &= ~ZRTP_BIT_RS1; - if (session->zrtp->cb.cache_cb.on_set_verified) { - session->zrtp->cb.cache_cb.on_set_verified( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - 0); - } - - if (session->zrtp->cb.cache_cb.on_reset_since) { - session->zrtp->cb.cache_cb.on_reset_since(ZSTR_GV(session->zid), ZSTR_GV(session->peer_zid)); - } - - ZRTP_LOG(2,(_ZTU_,"\tINFO! Our RS1 doesn't equal to other-side's one %s. ID=%u\n", - cc->rs1.secret->_cachedflag ? " - drop verified!" : "", stream->id)); - } - - if (!zrtp_memcmp(cc->rs2.peer_id.buffer, stream->messages.peer_dhpart.rs2ID, ZRTP_RSID_SIZE)) { - secrets->matches |= ZRTP_BIT_RS2; - if (0 == C[0]) { - C[0] = &cc->rs2; - } - } - - - if (secrets->auxs && - (!zrtp_memcmp(stream->messages.peer_dhpart.auxsID, cc->auxs.peer_id.buffer, ZRTP_RSID_SIZE)) ) { - C[1] =&cc->auxs; - secrets->matches |= ZRTP_BIT_AUX; - } - - if ( secrets->pbxs && - (!zrtp_memcmp(stream->messages.peer_dhpart.pbxsID, cc->pbxs.peer_id.buffer, ZRTP_RSID_SIZE)) ) { - C[2] = &cc->pbxs; - secrets->matches |= ZRTP_BIT_PBX; - } - - /* Finally hashing matched shared secrets */ - for (i=0; i<3; i++) { - /* - * Some of the shared secrets s1 through s5 may have lengths of zero - * if they are null (not shared), and are each preceded by a 4-octet - * length field. For example, if s4 is null, len(s4) is 00 00 00 00, - * and s4 itself would be absent from the hash calculation, which - * means len(s5) would immediately follow len(s4). - */ - comp_length = C[i] ? zrtp_hton32(ZRTP_RS_SIZE) : 0; - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)&comp_length, 4); - if (C[i]) { - session->hash->hash_update( session->hash, - hash_ctx, - (const int8_t*)C[i]->secret->value.buffer, - C[i]->secret->value.length ); - ZRTP_LOG(3,(_ZTU_,"\tUse S%d in calculations.\n", i+1)); - } - } - - session->hash->hash_end(session->hash, hash_ctx, ZSTR_GV(cc->s0)); - } break; /* S0 for for DH and Preshared streams */ - - /* - * Compute all possible combinations of preshared_key: - * hash(len(rs1) | rs1 | len(auxsecret) | auxsecret | len(pbxsecret) | pbxsecret) - * Find matched preshared_key and derive S0 from it: - * s0 = KDF(preshared_key, "ZRTP Stream Key", KDF_Context, negotiated hash length) - * - * INFO: Take into account that RS1 and RS2 may be swapped. - * If no matched were found - generate DH commit. - * ======================================================================== - */ - case ZRTP_STREAM_MODE_PRESHARED: - { - zrtp_status_t s = zrtp_status_ok; - zrtp_string32_t presh_key = ZSTR_INIT_EMPTY(presh_key); - - ZRTP_LOG(3,(_ZTU_,"\tDERIVE S0 for PRESHARED from cached secret. ID=%u\n", stream->id)); - - /* Use the same hash as we used for Commitment */ - if (is_initiator) - { - s = _zrtp_compute_preshared_key( session, - ZSTR_GV(session->secrets.rs1->value), - (session->secrets.auxs->_cachedflag) ? ZSTR_GV(session->secrets.auxs->value) : NULL, - (session->secrets.pbxs->_cachedflag) ? ZSTR_GV(session->secrets.pbxs->value) : NULL, - ZSTR_GV(presh_key), - NULL); - if (zrtp_status_ok != s) { - return s; - } - - secrets->matches |= ZRTP_BIT_RS1; - if (session->secrets.auxs->_cachedflag) { - secrets->matches |= ZRTP_BIT_AUX; - } - if (session->secrets.pbxs->_cachedflag) { - secrets->matches |= ZRTP_BIT_PBX; - } - } - /* - * Let's find appropriate hv key for Responder: - * , , , . - */ - else - { - int res=-1; - char* peer_key_id = (char*)stream->messages.peer_commit.hv+ZRTP_HV_NONCE_SIZE; - zrtp_string8_t key_id = ZSTR_INIT_EMPTY(key_id); - - do { - /* RS1 MUST be available at this stage.*/ - s = _zrtp_compute_preshared_key( session, - ZSTR_GV(secrets->rs1->value), - NULL, - NULL, - ZSTR_GV(presh_key), - ZSTR_GV(key_id)); - if (zrtp_status_ok == s) { - res = zrtp_memcmp(peer_key_id, key_id.buffer, ZRTP_HV_KEY_SIZE); - if (0 == res) { - secrets->matches |= ZRTP_BIT_RS1; - break; - } - } - - if (session->secrets.pbxs->_cachedflag) - { - s = _zrtp_compute_preshared_key( session, - ZSTR_GV(secrets->rs1->value), - NULL, - ZSTR_GV(secrets->pbxs->value), - ZSTR_GV(presh_key), - ZSTR_GV(key_id)); - if (zrtp_status_ok == s) { - res = zrtp_memcmp(peer_key_id, key_id.buffer, ZRTP_HV_KEY_SIZE); - if (0 == res) { - secrets->matches |= ZRTP_BIT_PBX; - break; - } - } - } - - if (session->secrets.auxs->_cachedflag) - { - s = _zrtp_compute_preshared_key( session, - ZSTR_GV(secrets->rs1->value), - ZSTR_GV(secrets->auxs->value), - NULL, - ZSTR_GV(presh_key), - ZSTR_GV(key_id)); - if (zrtp_status_ok == s) { - res = zrtp_memcmp(peer_key_id, key_id.buffer, ZRTP_HV_KEY_SIZE); - if (0 == res) { - secrets->matches |= ZRTP_BIT_AUX; - break; - } - } - } - - if ((session->secrets.pbxs->_cachedflag) && (session->secrets.auxs->_cachedflag)) - { - s = _zrtp_compute_preshared_key( session, - ZSTR_GV(secrets->rs1->value), - ZSTR_GV(secrets->auxs->value), - ZSTR_GV(secrets->pbxs->value), - ZSTR_GV(presh_key), - ZSTR_GV(key_id)); - if (zrtp_status_ok == s) { - res = zrtp_memcmp(peer_key_id, key_id.buffer, ZRTP_HV_KEY_SIZE); - if (0 == res) { - secrets->matches |= ZRTP_BIT_AUX; - secrets->matches |= ZRTP_BIT_PBX; - break; - } - } - } - - } while (0); - - if (0 != res) { - ZRTP_LOG(3,(_ZTU_,"\tINFO! Matched Key wasn't found - initate DH exchange.\n")); - secrets->cached = 0; - secrets->rs1->_cachedflag = 0; - - _zrtp_machine_start_initiating_secure(stream); - return zrtp_status_ok; - } - } - - ZRTP_LOG(3,(_ZTU_,"\tUse RS1, %s, %s in calculations.\n", - (session->secrets.matches & ZRTP_BIT_AUX) ? "AUX" : "NULL", - (session->secrets.matches & ZRTP_BIT_PBX) ? "PBX" : "NULL")); - - _zrtp_kdf( stream, - ZSTR_GV(presh_key), - ZSTR_GV(zrtp_presh_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - session->hash->digest_length, - ZSTR_GV(cc->s0)); - } break; - - - /* - * For FAST Multistream: - * s0n = KDF(ZRTPSess, "ZRTP Multistream Key", KDF_Context, negotiated hash length) - * ======================================================================== - */ - case ZRTP_STREAM_MODE_MULT: - { - ZRTP_LOG(3,(_ZTU_,"\tDERIVE S0 for MULTISTREAM from ZRTP Session key... ID=%u\n", stream->id)); - _zrtp_kdf( stream, - ZSTR_GV(session->zrtpsess), - ZSTR_GV(zrtp_multi_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - session->hash->digest_length, - ZSTR_GV(cc->s0)); - } break; - - default: break; - } - - - /* - * Compute ZRTP session key for FULL streams only: - * ZRTPSess = KDF(s0, "ZRTP Session Key", KDF_Context, negotiated hash length) - */ - if (!ZRTP_IS_STREAM_MULT(stream)) { - if (session->zrtpsess.length == 0) { - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GV(zrtp_sess_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - session->hash->digest_length, - ZSTR_GV(session->zrtpsess)); - } - } - - return zrtp_status_ok; -} - - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_set_public_value( zrtp_stream_t *stream, - int is_initiator) -{ - /* - * This function performs the following actions according to ZRTP draft 5.6 - * a) Computes total hash; - * b) Calculates DHResult; - * c) Computes final stream key S0, based on DHSS and retained secrets; - * d) Computes HMAC Key and ZRTP key; - * e) Computes srtp keys and salts and creates srtp session. - */ - - zrtp_session_t *session = stream->session; - zrtp_proto_crypto_t* cc = stream->protocol->cc; - void* hash_ctx = NULL; - - static const zrtp_string32_t hmac_keyi_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_INITIATOR_HMAKKEY_STR); - static const zrtp_string32_t hmac_keyr_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_RESPONDER_HMAKKEY_STR); - - static const zrtp_string32_t srtp_mki_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_INITIATOR_KEY_STR); - static const zrtp_string32_t srtp_msi_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_INITIATOR_SALT_STR); - static const zrtp_string32_t srtp_mkr_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_RESPONDER_KEY_STR); - static const zrtp_string32_t srtp_msr_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_RESPONDER_SALT_STR); - - static const zrtp_string32_t zrtp_keyi_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_INITIATOR_ZRTPKEY_STR); - static const zrtp_string32_t zrtp_keyr_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_RESPONDER_ZRTPKEY_STR); - - uint32_t cipher_key_length = (ZRTP_CIPHER_AES128 == session->blockcipher->base.id) ? 16 : 32; - - const zrtp_string32_t *output_mk_label; - const zrtp_string32_t *output_ms_label; - const zrtp_string32_t *input_mk_label; - const zrtp_string32_t *input_ms_label; - const zrtp_string32_t *hmac_key_label; - const zrtp_string32_t *peer_hmac_key_label; - const zrtp_string32_t *zrtp_key_label; - const zrtp_string32_t *peer_zrtp_key_label; - - /* Define roles and prepare structures */ - if (is_initiator) { - output_mk_label = &srtp_mki_label; - output_ms_label = &srtp_msi_label; - input_mk_label = &srtp_mkr_label; - input_ms_label = &srtp_msr_label; - hmac_key_label = &hmac_keyi_label; - peer_hmac_key_label = &hmac_keyr_label; - zrtp_key_label = &zrtp_keyi_label; - peer_zrtp_key_label = &zrtp_keyr_label; - } else { - output_mk_label = &srtp_mkr_label; - output_ms_label = &srtp_msr_label; - input_mk_label = &srtp_mki_label; - input_ms_label = &srtp_msi_label; - hmac_key_label = &hmac_keyr_label; - peer_hmac_key_label = &hmac_keyi_label; - zrtp_key_label = &zrtp_keyr_label; - peer_zrtp_key_label = &zrtp_keyi_label; - } - - ZRTP_LOG(3, (_ZTU_,"---------------------------------------------------\n")); - ZRTP_LOG(3,(_ZTU_,"\tSWITCHING TO SRTP. ID=%u\n", zrtp_log_mode2str(stream->mode), stream->id)); - ZRTP_LOG(3,(_ZTU_,"\tI %s\n", is_initiator ? "Initiator" : "Responder")); - - /* - * Compute total messages hash: - * total_hash = hash(Hello of responder | Commit | DHPart1 | DHPart2) for DH streams - * total_hash = hash(Hello of responder | Commit ) for Fast modes. - */ - { - uint8_t* tok = NULL; - uint16_t tok_len = 0; - - hash_ctx = session->hash->hash_begin(session->hash); - if (0 == hash_ctx) { - return zrtp_status_fail; - } - - tok = is_initiator ? (uint8_t*)&stream->messages.peer_hello : (uint8_t*) &stream->messages.hello; - tok_len = is_initiator ? stream->messages.peer_hello.hdr.length : stream->messages.hello.hdr.length; - tok_len = zrtp_ntoh16(tok_len)*4; - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)tok, tok_len); - - tok = is_initiator ? (uint8_t*)&stream->messages.commit : (uint8_t*)&stream->messages.peer_commit; - tok_len = is_initiator ? stream->messages.commit.hdr.length : stream->messages.peer_commit.hdr.length; - tok_len = zrtp_ntoh16(tok_len)*4; - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)tok, tok_len); - - if (ZRTP_IS_STREAM_DH(stream)) - { - tok = (uint8_t*) (is_initiator ? &stream->messages.peer_dhpart : &stream->messages.dhpart); - tok_len = is_initiator ? stream->messages.peer_dhpart.hdr.length : stream->messages.dhpart.hdr.length; - tok_len = zrtp_ntoh16(tok_len)*4; - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)tok, tok_len); - - tok = (uint8_t*)(is_initiator ? &stream->messages.dhpart : &stream->messages.peer_dhpart); - tok_len = is_initiator ? stream->messages.dhpart.hdr.length : stream->messages.peer_dhpart.hdr.length; - tok_len = zrtp_ntoh16(tok_len)*4; - session->hash->hash_update(session->hash, hash_ctx, (const int8_t*)tok, tok_len); - } - - session->hash->hash_end(session->hash, hash_ctx, ZSTR_GV(cc->mes_hash)); - hash_ctx = NULL; - } /* total hash computing */ - - /* Total Hash is ready and we can create KDF_Context */ - zrtp_zstrcat(ZSTR_GV(cc->kdf_context), is_initiator ? ZSTR_GV(session->zid) : ZSTR_GV(session->peer_zid)); - zrtp_zstrcat(ZSTR_GV(cc->kdf_context), is_initiator ? ZSTR_GV(session->peer_zid) : ZSTR_GV(session->zid)); - zrtp_zstrcat(ZSTR_GV(cc->kdf_context), ZSTR_GV(cc->mes_hash)); - - /* Derive stream key S0 according to key exchange scheme */ - if (zrtp_status_ok != _derive_s0(stream, is_initiator)) { - return zrtp_status_fail; - } - - /* - * Compute HMAC keys. These values will be used after confirmation: - * hmackeyi = KDF(s0, "Initiator HMAC key", KDF_Context, negotiated hash length) - * hmackeyr = KDF(s0, "Responder HMAC key", KDF_Context, negotiated hash length) - */ - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GVP(hmac_key_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - session->hash->digest_length, - ZSTR_GV(stream->cc.hmackey)); - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GVP(peer_hmac_key_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - session->hash->digest_length, - ZSTR_GV(stream->cc.peer_hmackey)); - - /* - * Computing ZRTP keys for protection of the Confirm packet: - * zrtpkeyi = KDF(s0, "Initiator ZRTP key", KDF_Context, negotiated AES key length) - * zrtpkeyr = KDF(s0, "Responder ZRTP key", KDF_Context, negotiated AES key length) - */ - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GVP(zrtp_key_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - cipher_key_length, - ZSTR_GV(stream->cc.zrtp_key)); - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GVP(peer_zrtp_key_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - cipher_key_length, - ZSTR_GV(stream->cc.peer_zrtp_key)); -#if (defined(ZRTP_DEBUG_ZRTP_KEYS) && ZRTP_DEBUG_ZRTP_KEYS == 1) - { - char print_buff[256]; - ZRTP_LOG(3,(_ZTU_,"\t Messages hash:%s\n", hex2str(cc->mes_hash.buffer, cc->mes_hash.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t S0:%s\n", hex2str(cc->s0.buffer, cc->s0.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t ZRTP Sess:%s\n", hex2str(session->zrtpsess.buffer, session->zrtpsess.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t hmackey:%s\n", hex2str(stream->cc.hmackey.buffer, stream->cc.hmackey.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t peer_hmackeyr:%s\n", hex2str(stream->cc.peer_hmackey.buffer, stream->cc.peer_hmackey.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t ZRTP key:%s\n", hex2str(stream->cc.zrtp_key.buffer, stream->cc.zrtp_key.length, print_buff, sizeof(print_buff)))); - ZRTP_LOG(3,(_ZTU_,"\t Peer ZRTP key:%s\n", hex2str(stream->cc.peer_zrtp_key.buffer, stream->cc.peer_zrtp_key.length, print_buff, sizeof(print_buff)))); - } -#endif - /* - * Preparing SRTP crypto engine: - * srtpkeyi = KDF(s0, "Initiator SRTP master key", KDF_Context, negotiated AES key length) - * srtpsalti = KDF(s0, "Initiator SRTP master salt", KDF_Context, 112) - * srtpkeyr = KDF(s0, "Responder SRTP master key", KDF_Context, negotiated AES key length) - * srtpsaltr = KDF(s0, "Responder SRTP master salt", KDF_Context, 112) - */ - { - zrtp_srtp_profile_t iprof; - zrtp_srtp_profile_t oprof; - - ZSTR_SET_EMPTY(iprof.salt); - ZSTR_SET_EMPTY(iprof.key); - - iprof.rtp_policy.cipher = session->blockcipher; - iprof.rtp_policy.auth_tag_len = session->authtaglength; - iprof.rtp_policy.hash = zrtp_comp_find(ZRTP_CC_HASH, ZRTP_SRTP_HASH_HMAC_SHA1, session->zrtp); - iprof.rtp_policy.auth_key_len = 20; - iprof.rtp_policy.cipher_key_len = cipher_key_length; - - zrtp_memcpy(&iprof.rtcp_policy, &iprof.rtp_policy, sizeof(iprof.rtcp_policy)); - iprof.dk_cipher = session->blockcipher; - - zrtp_memcpy(&oprof, &iprof, sizeof(iprof)); - - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GVP(input_mk_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - cipher_key_length, - ZSTR_GV(iprof.key)); - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GVP(input_ms_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - 14, - ZSTR_GV(iprof.salt)); - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GVP(output_mk_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - cipher_key_length, - ZSTR_GV(oprof.key)); - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GVP(output_ms_label), - ZSTR_GV(stream->protocol->cc->kdf_context), - 14, - ZSTR_GV(oprof.salt)); - - stream->protocol->_srtp = zrtp_srtp_create(session->zrtp->srtp_global, &iprof, &oprof); - - /* Profiles and keys in them are not needed anymore - clear them */ - zrtp_memset(&iprof, 0, sizeof(iprof)); - zrtp_memset(&oprof, 0, sizeof(oprof)); - - if (!stream->protocol->_srtp) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! Can't initialize SRTP engine. ID=%u\n", stream->id)); - return zrtp_status_fail; - } - } /* SRTP initialization */ - - return zrtp_status_ok; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_enter_secure(zrtp_stream_t* stream) -{ - /* - * When switching to SECURE all ZRTP crypto values were already computed by - * state-machine. Then we need to have logic to manage SAS value and shared - * secrets only. So: we compute SAS, refresh secrets flags and save the - * secrets to the cache after RS2 and RS1 swapping. We don't need any - * crypto sources any longer - destroy them. - */ - - zrtp_status_t s = zrtp_status_ok; - zrtp_proto_crypto_t* cc = stream->protocol->cc; - zrtp_session_t *session = stream->session; - zrtp_secrets_t *secrets = &stream->session->secrets; - uint8_t was_exp = 0; - uint64_t exp_date = 0; - - ZRTP_LOG(3,(_ZTU_,"\tEnter state SECURE (%s).\n", zrtp_log_mode2str(stream->mode))); - - _zrtp_cancel_send_packet_later(stream, ZRTP_NONE); - - /* - * Compute the SAS value if it isn't computed yet. If there are several - * streams running in parallel - stream with the biggest hvi should - * generate the SAS. - */ - if (!session->sas1.length) { - s = session->sasscheme->compute(session->sasscheme, stream, session->hash, 0); - if (zrtp_status_ok != s) { - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); - return s; - } - - - ZRTP_LOG(3,(_ZTU_,"\tThis is the very first stream in sID GENERATING SAS value.\n", session->id)); - ZRTP_LOG(3,(_ZTU_,"\tSAS computed: <%.16s> <%.16s>.\n", session->sas1.buffer, session->sas2.buffer)); - } - - /* - * Compute a new value for RS1 and store the prevoious one. - * Compute result secrets' flags. - */ - if (ZRTP_IS_STREAM_DH(stream)) - { - ZRTP_LOG(3,(_ZTU_,"\tCheck expiration interval: last_use=%u ttl=%u new_ttl=%u exp=%u now=%u\n", - secrets->rs1->lastused_at, - secrets->rs1->ttl, - stream->cache_ttl, - (secrets->rs1->lastused_at + secrets->rs1->ttl), - zrtp_time_now()/1000)); - - if (secrets->rs1->ttl != 0xFFFFFFFF) { - exp_date = secrets->rs1->lastused_at; - exp_date += secrets->rs1->ttl; - - if (ZRTP_IS_STREAM_DH(stream) && (exp_date < zrtp_time_now()/1000)) { - ZRTP_LOG(3,(_ZTU_,"\tUsing EXPIRED secrets: last_use=%u ttl=%u exp=%u now=%u\n", - secrets->rs1->lastused_at, - secrets->rs1->ttl, - (secrets->rs1->lastused_at + secrets->rs1->ttl), - zrtp_time_now()/1000)); - was_exp = 1; - } - } - - if (!was_exp) { - secrets->wrongs = secrets->matches ^ secrets->cached; - secrets->wrongs &= ~ZRTP_BIT_RS2; - secrets->wrongs &= ~ZRTP_BIT_PBX; - } - } - - /* - * We going to update RS1 and change appropriate secrets flags. Let's back-up current values. - * Back-upped values could be used in debug purposes and in the GUI to reflect current state of the call - */ - if (!ZRTP_IS_STREAM_MULT(stream)) { - secrets->cached_curr = secrets->cached; - secrets->matches_curr = secrets->matches; - secrets->wrongs_curr = secrets->wrongs; - } - - - ZRTP_LOG(3,(_ZTU_,"\tFlags C=%x M=%x W=%x ID=%u\n", - secrets->cached, secrets->matches, secrets->wrongs, stream->id)); - - _zrtp_change_state(stream, ZRTP_STATE_SECURE); - /* - * Alarm user if the following condition is TRUE for both RS1 and RS2: - * "secret is wrong if it has been restored from the cache but hasn't matched - * with the remote one". - */ - if (session->zrtp->cb.event_cb.on_zrtp_protocol_event) { - session->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_SECURE); - } - if (session->zrtp->cb.event_cb.on_zrtp_secure) { - session->zrtp->cb.event_cb.on_zrtp_secure(stream); - } - - /* Alarm user if possible MiTM attack detected */ - if (secrets->wrongs) { - session->mitm_alert_detected = 1; - - if (session->zrtp->cb.event_cb.on_zrtp_security_event) { - session->zrtp->cb.event_cb.on_zrtp_security_event(stream, ZRTP_EVENT_MITM_WARNING); - } - } - - /* Check for unenrollemnt first */ - if ((secrets->cached & ZRTP_BIT_PBX) && !(secrets->matches & ZRTP_BIT_PBX)) { - ZRTP_LOG(2,(_ZTU_,"\tINFO! The user requires new un-enrolment - the nedpint may clear" - " the cache or perform other action. ID=%u\n", stream->id)); - - if (session->zrtp->cb.event_cb.on_zrtp_protocol_event) { - session->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_USER_UNENROLLED); - } - } - - /* - * Handle PBX registration, if required: If PBX already had a shared secret - * for the ZID it leaves the cache entry unmodified. Else, it computes a new - * one. If the PBX detects cache entry for the static shared secret, but the - * phone does not have a matching cache entry - the PBX generates a new one. - */ - if (ZRTP_MITM_MODE_REG_SERVER == stream->mitm_mode) - { - if (secrets->matches & ZRTP_BIT_PBX) { - ZRTP_LOG(2,(_ZTU_,"\tINFO! User have been already registered - skip enrollment ritual. ID=%u\n", stream->id)); - if (session->zrtp->cb.event_cb.on_zrtp_protocol_event) { - session->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_USER_ALREADY_ENROLLED); - } - } else { - ZRTP_LOG(2,(_ZTU_,"\tINFO! The user requires new enrolment - generate new MiTM secret. ID=%u\n", stream->id)); - zrtp_register_with_trusted_mitm(stream); - if (session->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_NEW_USER_ENROLLED); - } - - } - } - else if (ZRTP_MITM_MODE_REG_CLIENT == stream->mitm_mode) - { - if (session->zrtp->cb.event_cb.on_zrtp_protocol_event) { - session->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_CLIENT_ENROLLMENT); - } - } - - /* - * Compute new RS for FULL DH streams only. Don't update RS1 if cache TTL is 0 - */ - if (ZRTP_IS_STREAM_DH(stream)) - { - static const zrtp_string32_t rss_label = ZSTR_INIT_WITH_CONST_CSTRING(ZRTP_RS_STR); - - if (stream->cache_ttl > 0) { - /* Replace RS2 with RS1 */ - zrtp_sys_free(secrets->rs2); - secrets->rs2 = secrets->rs1; - - secrets->rs1 = _zrtp_alloc_shared_secret(session); - if (!secrets->rs1) { - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); - return zrtp_status_fail; - } - - /* - * Compute new RS1 based on previous one and S0: - * rs1 = KDF(s0, "retained secret", KDF_Context, negotiated hash length) - */ - _zrtp_kdf( stream, - ZSTR_GV(cc->s0), - ZSTR_GV(rss_label), - ZSTR_GV(cc->kdf_context), - ZRTP_HASH_SIZE, - ZSTR_GV(secrets->rs1->value)); - - /* - * Mark secrets as cached: RS1 have been just generated and cached; - * RS2 is cached if previous secret was cached as well. - */ - secrets->rs1->_cachedflag = 1; - secrets->cached |= ZRTP_BIT_RS1; - secrets->matches |= ZRTP_BIT_RS1; - if (secrets->rs2->_cachedflag) { - secrets->cached |= ZRTP_BIT_RS2; - } - - /* Let's update the TTL interval for the new secret */ - secrets->rs1->ttl = stream->cache_ttl; - secrets->rs1->lastused_at = (uint32_t)(zrtp_time_now()/1000); - - /* If possible MiTM attach detected - postpone storing the cache until after the user verify the SAS */ - if (!session->mitm_alert_detected) { - if (session->zrtp->cb.cache_cb.on_put) { - session->zrtp->cb.cache_cb.on_put( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - secrets->rs1); - } - } - - { - uint32_t verifiedflag = 0; - char buff[128]; - if (session->zrtp->cb.cache_cb.on_get_verified) { - session->zrtp->cb.cache_cb.on_get_verified( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - &verifiedflag); - } - - ZRTP_LOG(3,(_ZTU_,"\tNew secret was generated:\n")); - ZRTP_LOG(3,(_ZTU_,"\t\tRS1 value:<%s>\n", - hex2str(secrets->rs1->value.buffer, secrets->rs1->value.length, buff, sizeof(buff)))); - ZRTP_LOG(3,(_ZTU_,"\t\tTTL=%u, flags C=%x M=%x W=%x V=%d\n", - secrets->rs1->ttl, secrets->cached, secrets->matches, secrets->wrongs, verifiedflag)); - } - } /* for TTL > 0 only */ - else { - if (session->zrtp->cb.cache_cb.on_put) { - secrets->rs1->ttl = 0; - session->zrtp->cb.cache_cb.on_put( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - secrets->rs1); - } - } - } /* For DH mode only */ - - - if (session->zrtp->cb.event_cb.on_zrtp_protocol_event) { - session->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_SECURE_DONE); - } - - /* We have computed all subkeys from S0 and don't need it any longer. */ - zrtp_wipe_zstring(ZSTR_GV(cc->s0)); - - /* Clear DH crypto context */ - if (ZRTP_IS_STREAM_DH(stream)) { - bnEnd(&stream->dh_cc.peer_pv); - bnEnd(&stream->dh_cc.pv); - bnEnd(&stream->dh_cc.sv); - zrtp_wipe_zstring(ZSTR_GV(stream->dh_cc.dhss)); - } - - /* - * Now, let's check if the transition to CLEAR was caused by Active/Passive rules. - * If local endpoint is a MitM and peer MiTM linked stream is Unlimited, we - * could break the rules and send commit to Passive endpoint. - */ - if (stream->zrtp->is_mitm && stream->peer_super_flag) { - if (stream->linked_mitm && stream->linked_mitm->peer_passive) { - if (stream->linked_mitm->state == ZRTP_STATE_CLEAR) { - ZRTP_LOG(2,(_ZTU_,"INFO: Linked Peer stream id=%u suspended in CLEAR-state due to" - " Active/Passive restrictions, but we are running in MiTM mode and " - "current peer endpoint is Super-Active. Let's Go Secure for the linked stream.\n", stream->id)); - - /* @note: don't use zrtp_secure_stream() wrapper as it checks for Active/Passive stuff. */ - _zrtp_machine_start_initiating_secure(stream->linked_mitm); - } - } - } - - /* - * Increase calls counter for Preshared mode and reset it on DH - */ - if (session->zrtp->cb.cache_cb.on_presh_counter_get && session->zrtp->cb.cache_cb.on_presh_counter_set) { - uint32_t calls_counter = 0; - session->zrtp->cb.cache_cb.on_presh_counter_get( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - &calls_counter); - if (ZRTP_IS_STREAM_DH(stream)) { - session->zrtp->cb.cache_cb.on_presh_counter_set( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - 0); - } else if ZRTP_IS_STREAM_PRESH(stream) { - session->zrtp->cb.cache_cb.on_presh_counter_set( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - ++calls_counter); - } - } - - clear_crypto_sources(stream); - - return zrtp_status_ok; -} - - -/*===========================================================================*/ -/* Shared functions */ -/*===========================================================================*/ - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_create_confirm( zrtp_stream_t *stream, - zrtp_packet_Confirm_t* confirm) -{ - void* cipher_ctx = NULL; - zrtp_status_t s = zrtp_status_fail; - zrtp_session_t *session = stream->session; - uint32_t verifiedflag = 0; - - /* hash + (padding + sig_len + flags) + ttl */ - const uint8_t encrypted_body_size = ZRTP_MESSAGE_HASH_SIZE + (2 + 1 + 1) + 4; - - /* - * Create the Confirm packet according to draft 6.7 - * AES CFB vector at first, SIG length and flags octet and cache TTL at the end - * This version doesn't support signatures so sig_length=0 - */ - if (ZRTP_CFBIV_SIZE != zrtp_randstr(session->zrtp, confirm->iv, ZRTP_CFBIV_SIZE)) { - return zrtp_status_fail; - } - - zrtp_memcpy(confirm->hash, stream->messages.h0.buffer, ZRTP_MESSAGE_HASH_SIZE); - - if (session->zrtp->cb.cache_cb.on_get_verified) { - session->zrtp->cb.cache_cb.on_get_verified( ZSTR_GV(session->zid), - ZSTR_GV(session->peer_zid), - &verifiedflag); - } - - confirm->expired_interval = zrtp_hton32(session->profile.cache_ttl); - confirm->flags = 0; - confirm->flags |= session->profile.disclose_bit ? 0x01 : 0x00; - confirm->flags |= session->profile.allowclear ? 0x02 : 0x00; - confirm->flags |= verifiedflag ? 0x04 : 0x00; - confirm->flags |= (ZRTP_MITM_MODE_REG_SERVER == stream->mitm_mode) ? 0x08 : 0x00; - - /* Then we need to encrypt Confirm before Hmac computing. Use AES CFB */ - do - { - cipher_ctx = session->blockcipher->start( session->blockcipher, - (uint8_t*)stream->cc.zrtp_key.buffer, - NULL, - ZRTP_CIPHER_MODE_CFB); - if (!cipher_ctx) { - break; - } - - s = session->blockcipher->set_iv(session->blockcipher, cipher_ctx, (zrtp_v128_t*)confirm->iv); - if (zrtp_status_ok != s) { - break; - } - - s = session->blockcipher->encrypt( session->blockcipher, - cipher_ctx, - (uint8_t*)&confirm->hash, - encrypted_body_size ); - } while(0); - if (cipher_ctx) { - session->blockcipher->stop(session->blockcipher, cipher_ctx); - } - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"ERROR! failed to encrypt Confirm. s=%d ID=%u\n", s, stream->id)); - return s; - } - - /* Compute Hmac over encrypted part of Confirm */ - { - zrtp_string128_t hmac = ZSTR_INIT_EMPTY(hmac); - s = session->hash->hmac_c( session->hash, - stream->cc.hmackey.buffer, - stream->cc.hmackey.length, - (const char*)&confirm->hash, - encrypted_body_size, - ZSTR_GV(hmac) ); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"ERROR! failed to compute Confirm hmac. s=%d ID=%u\n", s, stream->id)); - return s; - } - - zrtp_memcpy(confirm->hmac, hmac.buffer, ZRTP_HMAC_SIZE); - - { - char buff[512]; - ZRTP_LOG(3,(_ZTU_,"HMAC TRACE. COMPUTE.\n")); - ZRTP_LOG(3,(_ZTU_,"\tcipher text:%s. size=%u\n", - hex2str((const char*)&confirm->hash, encrypted_body_size, buff, sizeof(buff)), encrypted_body_size)); - ZRTP_LOG(3,(_ZTU_,"\t key:%s.\n", - hex2str(stream->cc.hmackey.buffer, stream->cc.hmackey.length, buff, sizeof(buff)))); - ZRTP_LOG(3,(_ZTU_,"\t comp hmac:%s.\n", - hex2str(hmac.buffer, hmac.length, buff, sizeof(buff)))); - ZRTP_LOG(3,(_ZTU_,"\t hmac:%s.\n", - hex2str((const char*)confirm->hmac, ZRTP_HMAC_SIZE, buff, sizeof(buff)))); - } - } - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_confirm( zrtp_stream_t *stream, - zrtp_packet_Confirm_t *confirm) -{ - /* Compute Hmac over encrypted part of Confirm and reject malformed packets */ - void* cipher_ctx = NULL; - zrtp_status_t s = zrtp_status_fail; - zrtp_session_t *session = stream->session; - zrtp_string128_t hmac = ZSTR_INIT_EMPTY(hmac); - - /* hash + (padding + sig_len + flags) + ttl */ - const uint8_t encrypted_body_size = ZRTP_MESSAGE_HASH_SIZE + (2 + 1 + 1) + 4; - s = session->hash->hmac_c( session->hash, - stream->cc.peer_hmackey.buffer, - stream->cc.peer_hmackey.length, - (const char*)&confirm->hash, - encrypted_body_size, - ZSTR_GV(hmac) ); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! failed to compute Incoming Confirm hmac. s=%d ID=%u\n", s, stream->id)); - return zrtp_status_fail; - } - - - // MARK: TRACE CONFIRM HMAC ERROR -#if 0 - { - char buff[512]; - ZRTP_LOG(3,(_ZTU_,"HMAC TRACE. VERIFY\n")); - ZRTP_LOG(3,(_ZTU_,"\tcipher text:%s. size=%u\n", - hex2str((const char*)&confirm->hash, encrypted_body_size, buff, sizeof(buff)), encrypted_body_size)); - ZRTP_LOG(3,(_ZTU_,"\t key:%s.\n", - hex2str(stream->cc.peer_hmackey.buffer, stream->cc.peer_hmackey.length, buff, sizeof(buff)))); - ZRTP_LOG(3,(_ZTU_,"\t comp hmac:%s.\n", - hex2str(hmac.buffer, hmac.length, buff, sizeof(buff)))); - ZRTP_LOG(3,(_ZTU_,"\t hmac:%s.\n", - hex2str((const char*)confirm->hmac, ZRTP_HMAC_SIZE, buff, sizeof(buff)))); - } -#endif - - - if (0 != zrtp_memcmp(confirm->hmac, hmac.buffer, ZRTP_HMAC_SIZE)) { - /* - * Weird. Perhaps a bug in our code or our peer's code. Or it could be an attacker - * who doesn't realize that Man-In-The-Middling the Diffie-Hellman key generation - * but allowing the correct rsIds to pass through accomplishes nothing more than - * forcing us to fallback to cleartext mode. If this attacker had gone ahead and deleted - * or replaced the rsIds, then he would have been able to stay in the middle (although - * he would of course still face the threat of a Voice Authentication Check). On the - * other hand if this attacker wanted to force us to fallback to cleartext mode, he could - * have done that more simply, for example by intercepting our ZRTP HELLO packet and - * replacing it with a normal non-ZRTP comfort noise packet. In any case, we'll do our - * "switch to cleartext fallback" behavior. - */ - - ZRTP_LOG(2,(_ZTU_,"\tWARNING!" ZRTP_VERIFIED_RESP_WARNING_STR "ID=%u\n", stream->id)); - - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_auth_decrypt, 1); - return zrtp_status_fail; - } - - /* Then we need to decrypt Confirm body */ - do { - cipher_ctx = session->blockcipher->start( session->blockcipher, - (uint8_t*)stream->cc.peer_zrtp_key.buffer, - NULL, - ZRTP_CIPHER_MODE_CFB); - if (!cipher_ctx) { - break; - } - - s = session->blockcipher->set_iv( session->blockcipher, - cipher_ctx, - (zrtp_v128_t*)confirm->iv); - if (zrtp_status_ok != s) { - break; - } - - s = session->blockcipher->decrypt( session->blockcipher, - cipher_ctx, - (uint8_t*)&confirm->hash, - encrypted_body_size); - } while(0); - if (cipher_ctx) { - session->blockcipher->stop(session->blockcipher, cipher_ctx); - } - if (zrtp_status_ok != s) { - ZRTP_LOG(3,(_ZTU_,"\tERROR! failed to decrypt incoming Confirm. s=%d ID=%u\n", s, stream->id)); - return s; - } - - /* We have access to hash field and can check hmac of the previous message */ - { - zrtp_msg_hdr_t *hdr = NULL; - char *key=NULL; - zrtp_string32_t tmphash_str = ZSTR_INIT_EMPTY(tmphash_str); - zrtp_hash_t *hash = zrtp_comp_find( ZRTP_CC_HASH, ZRTP_HASH_SHA256, stream->zrtp); - - if (ZRTP_IS_STREAM_DH(stream)) { - hdr = &stream->messages.peer_dhpart.hdr; - key = (char*)confirm->hash; - } else { - hash->hash_c(hash, (char*)confirm->hash, ZRTP_MESSAGE_HASH_SIZE, ZSTR_GV(tmphash_str)); - - if (ZRTP_STATEMACHINE_INITIATOR == stream->protocol->type) { - hdr = &stream->messages.peer_hello.hdr; - hash->hash_c( hash, - tmphash_str.buffer, - ZRTP_MESSAGE_HASH_SIZE, - ZSTR_GV(tmphash_str) ); - } else { - hdr = &stream->messages.peer_commit.hdr; - } - key = tmphash_str.buffer; - } - - if (0 != _zrtp_validate_message_hmac(stream, hdr, key)) { - return zrtp_status_fail; - } - } - - /* Set evil bit if other-side shared session key */ - stream->peer_disclose_bit = (confirm->flags & 0x01); - - /* Enable ALLOWCLEAR option if only both sides support it */ - stream->allowclear = (confirm->flags & 0x02) && session->profile.allowclear; - - /* Drop RS1 VERIFIED flag if other side didn't verified key exchange */ - if (0 == (confirm->flags & 0x04)) { - ZRTP_LOG(2,(_ZTU_,"\tINFO: Other side Confirm V=0 - set verified to 0! ID=%u\n", stream->id)); - zrtp_verified_set(session->zrtp, &session->zid, &session->peer_zid, 0); - } - - /* Look for Enrollment replay flag */ - if (confirm->flags & 0x08) - { - ZRTP_LOG(2,(_ZTU_,"\tINFO: Confirm PBX Enrolled flag is set - it is a Registration call! ID=%u\n", stream->id)); - - if (stream->mitm_mode != ZRTP_MITM_MODE_CLIENT) { - ZRTP_LOG(2,(_ZTU_,"\tERROR: PBX enrollment flag was received in wrong MiTM mode %s." - " ID=%u\n", zrtp_log_mode2str(stream->mode), stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_invalid_packet, 1); - return zrtp_status_fail; - } - - /* Passive endpoint should ignore PBX Enrollment. */ - if (ZRTP_LICENSE_MODE_PASSIVE != stream->zrtp->lic_mode) { - stream->mitm_mode = ZRTP_MITM_MODE_REG_CLIENT; - } else { - ZRTP_LOG(2,(_ZTU_,"\tINFO: Ignore PBX Enrollment flag as we are Passive ID=%u\n", stream->id)); - } - } - - stream->cache_ttl = ZRTP_MIN(session->profile.cache_ttl, zrtp_ntoh32(confirm->expired_interval)); - - /* Copy packet for future hashing */ - zrtp_memcpy(&stream->messages.peer_confirm, confirm, zrtp_ntoh16(confirm->hdr.length)*4); - - return zrtp_status_ok; -} diff --git a/libs/libzrtp/src/zrtp_responder.c b/libs/libzrtp/src/zrtp_responder.c deleted file mode 100644 index 73e25f7495..0000000000 --- a/libs/libzrtp/src/zrtp_responder.c +++ /dev/null @@ -1,612 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Viktor Krykun - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp responder" - -extern zrtp_status_t _zrtp_machine_start_initiating_secure(zrtp_stream_t *stream); - -/* These functions construct packets for further replies. */ -static zrtp_status_t _prepare_dhpart1(zrtp_stream_t *stream); -static zrtp_status_t _prepare_confirm1(zrtp_stream_t *stream); - -/* Functions which are used to answer the Initiator's requests */ -static void _send_dhpart1(zrtp_stream_t *stream); -static void _send_confirm1(zrtp_stream_t *stream); - -/* - * Parses crypto-components list chosen by the initiator. doesn't perform any - * tests. Commit was fully checked by previous call of _zrtp_machine_preparse_commit(). - * \exception: Handles all exceptions -- informs user and switches to CLEAR. - * (zrtp_error_XXX_unsp and zrtp_error_software errors.) - */ -static zrtp_status_t _zrtp_machine_process_commit( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet); - -/* - * Parses DH packet: check for MitM1, MitM2 attacks and makes a copy of it for further usage. - * \exception: (MITM attacks, SOFTWARE) Informs user and switches to CLEAR. - */ -static zrtp_status_t _zrtp_machine_process_dhpart2( zrtp_stream_t *stream, - zrtp_rtp_info_t *packet); - -/* - * Just a wrapper over the protocol::_zrtp_machine_process_confirm(). - * \exception: (AUTH attacks, SOFTWARE) Informs user and switches to CLEAR. - */ -static zrtp_status_t _zrtp_machine_process_confirm2( zrtp_stream_t *stream, - zrtp_rtp_info_t *packet); - - -/*===========================================================================*/ -/* State handlers */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_pendingsecure( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_COMMIT: - _send_dhpart1(stream); - break; - - case ZRTP_DHPART2: - s = _zrtp_machine_process_dhpart2(stream, packet); - if (zrtp_status_ok != s) { - break; - } - - /* Perform Keys generation according to draft 5.6 */ - s = _zrtp_set_public_value(stream, 0); - if (zrtp_status_ok != s) { - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); - break; - } - - s = _prepare_confirm1(stream); - if (zrtp_status_ok != s) { - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); - break; - } - - _zrtp_change_state(stream, ZRTP_STATE_WAIT_CONFIRM2); - _send_confirm1(stream); - break; - - case ZRTP_NONE: - s = zrtp_status_drop; - break; - - default: - break; - } - - return s; -} - - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_while_in_waitconfirm2( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t status = zrtp_status_ok; - - switch (packet->type) - { - case ZRTP_DHPART2: - if (ZRTP_IS_STREAM_DH(stream)) { - _send_confirm1(stream); - } - break; - - case ZRTP_COMMIT: - if (ZRTP_IS_STREAM_FAST(stream)) { - _send_confirm1(stream); - } - break; - - case ZRTP_CONFIRM2: - status = _zrtp_machine_process_confirm2(stream, packet); - if (zrtp_status_ok == status) { - _zrtp_packet_send_message(stream, ZRTP_CONFIRM2ACK, NULL); - status = _zrtp_machine_enter_secure(stream); - } - break; - - case ZRTP_NONE: - status = zrtp_status_drop; - break; - - default: - break; - } - - return status; -} - - -/*===========================================================================*/ -/* States switchers */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_enter_pendingsecure( zrtp_stream_t* stream, - zrtp_rtp_info_t* packet) -{ - zrtp_status_t s = zrtp_status_ok; - - ZRTP_LOG(3,(_ZTU_,"\tENTER STATE PENDING SECURE for ID=%u mode=%s state=%s.\n", - stream->id, zrtp_log_mode2str(stream->mode), zrtp_log_state2str(stream->state))); - - do - { - if (!ZRTP_IS_STREAM_MULT(stream)) { - zrtp_packet_Commit_t *commit = (zrtp_packet_Commit_t*) packet->message; - - stream->session->hash = zrtp_comp_find( ZRTP_CC_HASH, - zrtp_comp_type2id(ZRTP_CC_HASH, (char*)commit->hash_type), - stream->zrtp); - stream->session->blockcipher = zrtp_comp_find( ZRTP_CC_CIPHER, - zrtp_comp_type2id(ZRTP_CC_CIPHER, (char*)commit->cipher_type), - stream->zrtp); - stream->session->authtaglength = zrtp_comp_find( ZRTP_CC_ATL, - zrtp_comp_type2id(ZRTP_CC_ATL, (char*)commit->auth_tag_length), - stream->zrtp); - stream->session->sasscheme = zrtp_comp_find( ZRTP_CC_SAS, - zrtp_comp_type2id(ZRTP_CC_SAS, (char*)commit->sas_type), - stream->zrtp); - - ZRTP_LOG(3,(_ZTU_,"\tRemote COMMIT specified following options:\n")); - ZRTP_LOG(3,(_ZTU_,"\t Hash: %.4s\n", commit->hash_type)); - ZRTP_LOG(3,(_ZTU_,"\t Cipher: %.4s\n", commit->cipher_type)); - ZRTP_LOG(3,(_ZTU_,"\t ATL: %.4s\n", commit->auth_tag_length)); - ZRTP_LOG(3,(_ZTU_,"\t PK scheme: %.4s\n", commit->public_key_type)); - ZRTP_LOG(3,(_ZTU_,"\tVAD scheme: %.4s\n", commit->sas_type)); - } - - if (ZRTP_IS_STREAM_DH(stream)) { - _zrtp_change_state(stream, ZRTP_STATE_PENDINGSECURE); - - /* - * If stream->concurrent is set this means that we stopped a concurrent - * DH stream to break a tie. This can happen when Commit messages are - * sent by both ZRTP endpoints at the same time, but are received in - * different media streams. Now current stream has finished DH setup and - * we can resume the other one. - */ - if (stream->concurrent) { - zrtp_stream_t* tctx = stream->concurrent; - stream->concurrent = NULL; - ZRTP_LOG(3,(_ZTU_,"\tRelease2 Concurrent stream=%u ID=%u\n", tctx->id, stream->id)); - _zrtp_machine_start_initiating_secure(tctx); - } - - s = _zrtp_protocol_init(stream, 0, &stream->protocol); - if (zrtp_status_ok != s) { - break; - } - - s = _zrtp_machine_process_commit(stream, packet); /* doesn't throw exception */ - if (zrtp_status_ok != s) { - break; /* Software error */ - } - - s = _prepare_dhpart1(stream); - if (zrtp_status_ok != s) { - break; /* EH: Always successful */ - } - - _zrtp_machine_process_while_in_pendingsecure(stream, packet); - - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_PENDINGSECURE); - } - } - else - { - _zrtp_change_state(stream, ZRTP_STATE_WAIT_CONFIRM2); - - s = _zrtp_protocol_init(stream, 0, &stream->protocol); - if (zrtp_status_ok != s) { - break; - } - - s = _zrtp_machine_process_commit(stream, packet); /* doesn't throw exception */ - if (zrtp_status_ok != s) { - break; /* Software error */ - } - - s = _zrtp_set_public_value(stream, 0); - if (zrtp_status_ok != s) { - break; /* Software error */ - } - - s = _prepare_confirm1(stream); - if (zrtp_status_ok != s) { - break; /* Software error */ - } - - _send_confirm1(stream); - } - } while (0); - - if (zrtp_status_ok != s) { - if (stream->protocol) { - _zrtp_protocol_destroy(stream->protocol); - stream->protocol = NULL; - } - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_software, 1); - } - - return s; -} - - -/*===========================================================================*/ -/* Packets handlers */ -/*===========================================================================*/ - -/*---------------------------------------------------------------------------*/ -static zrtp_status_t _check_commit(zrtp_stream_t *stream, zrtp_packet_Commit_t *commit) -{ - do { - /* check PUBLIC KEY TYPE */ - if (0 > zrtp_profile_find( &stream->session->profile, - ZRTP_CC_PKT, - zrtp_comp_type2id(ZRTP_CC_PKT, (char*)commit->public_key_type))) - { - /* Can't talk to them. ZRTP public key type not supported by current profile */ - ZRTP_LOG(2,(_ZTU_,"\tINFO: PKExch %.4s isn't supported by profile. ID=%u\n", - commit->public_key_type, stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_pktype_unsp, 1); - break; - } - - /* check HASH scheme */ - if ( 0 > zrtp_profile_find( &stream->session->profile, - ZRTP_CC_HASH, - zrtp_comp_type2id(ZRTP_CC_HASH, (char*)commit->hash_type)) ) - { - /* Can't talk to them. ZRTP hash type not supported by current profile */ - ZRTP_LOG(2,(_ZTU_,"\tINFO: Hash %.4s isn't supported by profile. ID=%u\n", - commit->hash_type, stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_hash_unsp, 1); - break; - } - - /* check CIPHER type */ - if ( 0 > zrtp_profile_find( &stream->session->profile, - ZRTP_CC_CIPHER, - zrtp_comp_type2id(ZRTP_CC_CIPHER, (char*)commit->cipher_type)) ) - { - /* Can't talk to them. ZRTP cipher type not supported by current profile */ - ZRTP_LOG(2,(_ZTU_,"\tINFO: Cipher %.4s isn't supported by profile. ID=%u\n", - commit->cipher_type, stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_cipher_unsp, 1); - break; - } - - /* check AUTH TAG LENGTH */ - if ( 0 > zrtp_profile_find( &stream->session->profile, - ZRTP_CC_ATL, - zrtp_comp_type2id(ZRTP_CC_ATL, (char*)commit->auth_tag_length)) ) - { - /* Can't talk to them. ZRTP auth tag length not supported by current profile */ - ZRTP_LOG(2,(_ZTU_,"\tINFO: Authtag %.4s isn't supported by profile. ID=%u\n", - commit->auth_tag_length, stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_auth_unsp, 1); - break; - } - - /* check SAS scheme */ - if ( 0 > zrtp_profile_find( &stream->session->profile, - ZRTP_CC_SAS, - zrtp_comp_type2id(ZRTP_CC_SAS, (char*)commit->sas_type)) ) - { - /* Can't talk to them. ZRTP SAS scheme not supported by current profile */ - ZRTP_LOG(2,(_ZTU_,"\tINFO: SAS %.4s isn't supported by profile. ID=%u\n", - commit->sas_type, stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_sas_unsp, 1); - break; - } - - return zrtp_status_ok; - } while (0); - - return zrtp_status_fail; -} - -/*---------------------------------------------------------------------------*/ -zrtp_statemachine_type_t _zrtp_machine_preparse_commit( zrtp_stream_t *stream, - zrtp_rtp_info_t* packet) -{ - zrtp_packet_Commit_t *commit = (zrtp_packet_Commit_t*) packet->message; - zrtp_statemachine_type_t res = ZRTP_STATEMACHINE_RESPONDER; - - zrtp_pktype_id_t his_pkt = zrtp_comp_type2id(ZRTP_CC_PKT, (char*)commit->public_key_type); - zrtp_stream_mode_t his_mode = (his_pkt == ZRTP_PKTYPE_PRESH) ? ZRTP_STREAM_MODE_PRESHARED : (his_pkt == ZRTP_PKTYPE_MULT) ? ZRTP_STREAM_MODE_MULT : ZRTP_STREAM_MODE_DH; - - ZRTP_LOG(3,(_ZTU_,"\tPreparse incoming COMMIT. Remote peer wants %.4s:%d mode lic=%d peer M=%d.\n", - commit->public_key_type, his_mode, stream->zrtp->lic_mode, stream->peer_mitm_flag)); - - /* - * Checking crypto components chosen by other peer for stream establishment - */ - if (zrtp_status_ok != _check_commit(stream, commit)) { - return ZRTP_STATEMACHINE_NONE; - } - - /* - * Passive ZRTP endpoint can't talk to ZRTP MiTM endpoints. - */ - if (!ZRTP_PASSIVE3_TEST(stream)) { - ZRTP_LOG(2,(_ZTU_,"\tERROR: The endpoint is in passive mode and can't handle" - " connections with MiTM endpoints. ID=%u\n", stream->id)); - if (stream->zrtp->cb.event_cb.on_zrtp_protocol_event ) { - stream->zrtp->cb.event_cb.on_zrtp_protocol_event(stream, ZRTP_EVENT_IS_PASSIVE_RESTRICTION); - } - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_service_unavail, 1); - return ZRTP_STATEMACHINE_NONE; - } - - /* - * Both sides are in "Initiating" state we need to break the tie: - * - if both sides wants to use the same scheme - side with lower vh switches to - * "Responder" state. - * - if both sides wants to use Preshared scheme and one of the sides are in MiTM mode it - * should switch to Responder state - * - if one side wants Preshared and onother one DH - DH should win. - * - rest of the combinations (DH - Multistream, Preshared - Multistream) are deperecated by the RFC - */ - if (ZRTP_STATE_INITIATINGSECURE == stream->state) - { - zrtp_pktype_id_t my_pkt = stream->pubkeyscheme->base.id; - zrtp_stream_mode_t my_mode = (my_pkt == ZRTP_PKTYPE_PRESH) ? ZRTP_STREAM_MODE_PRESHARED : (my_pkt == ZRTP_PKTYPE_MULT) ? ZRTP_STREAM_MODE_MULT : ZRTP_STREAM_MODE_DH; - - ZRTP_LOG(2,(_ZTU_,"\tBoth sides are in INITIATINGSECURE State - BREACK the TIE. ID=%u\n", stream->id)); - - if (his_mode == my_mode) { - if ( (his_mode == ZRTP_STREAM_MODE_PRESHARED) && (stream->peer_mitm_flag || stream->zrtp->is_mitm)) { - if (stream->peer_mitm_flag) { - ZRTP_LOG(3,(_ZTU_,"\tWe running in Gneral ZRTP Endpoint mode, but the" - " remote side is in MiTM - stay Initiating state.\n")); - res = ZRTP_STATEMACHINE_INITIATOR; - } - } else { - if (zrtp_memcmp( stream->protocol->cc->hv.buffer, - commit->hv, - (his_mode == ZRTP_STREAM_MODE_DH) ? ZRTP_HV_SIZE : ZRTP_HV_NONCE_SIZE) > 0) { - ZRTP_LOG(3,(_ZTU_,"\tWe have Commit with greater HV so stay Initiating state.\n")); - res = ZRTP_STATEMACHINE_INITIATOR; - } - } - } else { - if (my_mode == ZRTP_STREAM_MODE_DH) { - ZRTP_LOG(3,(_ZTU_,"\tOther peer sent Non DH Commit but we want DH - stay Initiating state.\n")); - res = ZRTP_STATEMACHINE_INITIATOR; - } - } - } - - if (res == ZRTP_STATEMACHINE_RESPONDER) - { - /* - * If other peer wants to switch "Preshared" we must be ready for this. Check - * for secrets availability and if we can't use "Preshared" we should force other - * peer to switch to "DH" mode. For this purpose we use our own Commit with DHxK - * in it. Such Commit should win competition in any case. - */ - if ((his_mode == ZRTP_STREAM_MODE_PRESHARED) && !stream->session->secrets.rs1->_cachedflag) { - ZRTP_LOG(3,(_ZTU_, "\tOther peer wants Preshared mode but we have no secrets.\n")); - res = ZRTP_STATEMACHINE_INITIATOR; - } - - /* - * If other peer wants to switch "Multistream" we must be ready for this. Check - * for ZRTPSess key availability. If we can't use "Multistream" we should force other - * peer to switch to "DH" mode. For this purpose we use our own Commit with DHxK - * in it. Such Commit should win competition in any case. - */ - if ((his_mode == ZRTP_STREAM_MODE_MULT) && !stream->session->zrtpsess.length) { - ZRTP_LOG(3,(_ZTU_,"\tOther peer wants Preshared mode but we have no secrets.\n")); - res = ZRTP_STATEMACHINE_INITIATOR; - } - - /* - * If other peer wants "Full DH" exchange but ZRTP Session key have been already - * computed - there is no sense in doing this. What is more, ZRTP Specification - * doesn't allow doing this. - */ - if ((his_mode == ZRTP_STREAM_MODE_DH) && (stream->session->zrtpsess.length > 0)) { - ZRTP_LOG(3,(_ZTU_,"\tOther peer wants DH mode but we have ZRTP session and ready for Multistream.\n")); - res = ZRTP_STATEMACHINE_NONE; - } - } - - /* - * If we decided to use Responder's state-machine - only one DH or Preshared stream - * can be run at the moment so check states. - */ - if ((res == ZRTP_STATEMACHINE_RESPONDER) && !_zrtp_can_start_stream(stream, &stream->concurrent, his_mode)) - { - ZRTP_LOG(3,(_ZTU_,"\tCan't handle COMMIT another DH with ID=%u is in progress.\n", stream->concurrent->id)); - - if ( (stream->concurrent->state <= ZRTP_STATE_INITIATINGSECURE) && - (zrtp_memcmp(stream->concurrent->protocol->cc->hv.buffer, commit->hv, ZRTP_HV_SIZE) < 0) ) - { - ZRTP_LOG(3,(_ZTU_,"\tPossible DEADLOCK Resolving. STOP CONCURRENT" - " Stream with ID=%u\n",stream->concurrent->id)); - _zrtp_cancel_send_packet_later(stream->concurrent, ZRTP_NONE); - } else { - res = ZRTP_STATEMACHINE_NONE; - } - } - - if (res == ZRTP_STATEMACHINE_RESPONDER) { - ZRTP_LOG(3,(_ZTU_,"\tChosen Responder State-Machine. Change Mode to %s," - " pkt to %.4s\n", zrtp_log_mode2str(his_mode), commit->public_key_type)); - stream->mode = his_mode; - stream->pubkeyscheme = zrtp_comp_find(ZRTP_CC_PKT, his_pkt, stream->zrtp); - } else { - ZRTP_LOG(3,(_ZTU_,"\tChosen Initiator State-Machine. Stay in current Mode\n")); - } - - return res; -} - -/*---------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_commit(zrtp_stream_t* stream, zrtp_rtp_info_t* packet) -{ - zrtp_packet_Commit_t *commit = (zrtp_packet_Commit_t*) packet->message; - - switch (stream->mode) - { - case ZRTP_STREAM_MODE_DH: - zrtp_zstrncpyc( ZSTR_GV(stream->protocol->cc->peer_hv), - (const char*)commit->hv, - ZRTP_HV_SIZE); - break; - case ZRTP_STREAM_MODE_PRESHARED: - zrtp_zstrncpyc( ZSTR_GV(stream->protocol->cc->peer_hv), - (const char*)commit->hv + ZRTP_HV_NONCE_SIZE, - ZRTP_HV_NONCE_SIZE); - case ZRTP_STREAM_MODE_MULT: - zrtp_zstrncpyc( ZSTR_GV(stream->protocol->cc->peer_hv), - (const char*)commit->hv, - ZRTP_HV_NONCE_SIZE); - break; - default: break; - } - - /* Copy Commit packet for further hashing */ - zrtp_memcpy(&stream->messages.peer_commit, commit, zrtp_ntoh16(commit->hdr.length)*4); - - return zrtp_status_ok; -} - - -/*----------------------------------------------------------------------------*/ -static zrtp_status_t _zrtp_machine_process_dhpart2( zrtp_stream_t *stream, - zrtp_rtp_info_t *packet) -{ - zrtp_status_t s = zrtp_status_ok; - zrtp_proto_crypto_t* cc = stream->protocol->cc; - zrtp_packet_DHPart_t *dhpart2 = (zrtp_packet_DHPart_t*) packet->message; - void *hash_ctx = NULL; - - /* - * Verify hash commitment. (Compare hvi calculated from DH with peer hvi from COMMIT) - * According to the last version of the internet draft 04a. Hvi should be - * computed as: hvi=hash(initiator's DHPart2 message | responder's Hello message) - */ - hash_ctx = stream->session->hash->hash_begin(stream->session->hash); - if (!hash_ctx) { - return zrtp_status_fail; - } - - stream->session->hash->hash_update( stream->session->hash, - hash_ctx, - (const int8_t*)dhpart2, - zrtp_ntoh16(dhpart2->hdr.length)*4); - stream->session->hash->hash_update( stream->session->hash, - hash_ctx, - (const int8_t*)&stream->messages.hello, - zrtp_ntoh16(stream->messages.hello.hdr.length)*4); - stream->session->hash->hash_end( stream->session->hash, - hash_ctx, - ZSTR_GV(cc->hv)); - - /* Truncate comuted hvi to 256 bit. The same length as transferred in Commit message.*/ - cc->hv.length = ZRTP_HASH_SIZE; - - if (0 != zrtp_zstrcmp(ZSTR_GV(cc->hv), ZSTR_GV(cc->peer_hv))) { - ZRTP_LOG(1,(_ZTU_,"\tERROR!" ZRTP_MIM2_WARNING_STR " ID=%u\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_possible_mitm2, 1); - return zrtp_status_fail; - } - - /* Validate DH exchange (pvi is 1 or p-1). For DH streams only */ - bnInsertBigBytes(&stream->dh_cc.peer_pv, dhpart2->pv, 0, stream->pubkeyscheme->pv_length); - - s = stream->pubkeyscheme->validate(stream->pubkeyscheme, &stream->dh_cc.peer_pv); - if (zrtp_status_ok != s) { - ZRTP_LOG(1,(_ZTU_,"\tERROR!" ZRTP_MITM1_WARNING_STR " ID=%u\n", stream->id)); - _zrtp_machine_enter_initiatingerror(stream, zrtp_error_possible_mitm1, 1); - return s; - } - - /* Copy DH Part2 packet for future hashing */ - zrtp_memcpy(&stream->messages.peer_dhpart, dhpart2, zrtp_ntoh16(dhpart2->hdr.length)*4); - - return s; -} - -/*----------------------------------------------------------------------------*/ -zrtp_status_t _zrtp_machine_process_confirm2( zrtp_stream_t *stream, - zrtp_rtp_info_t *packet) -{ - zrtp_packet_Confirm_t *confirm2 = (zrtp_packet_Confirm_t*) packet->message; - return _zrtp_machine_process_confirm(stream, confirm2); -} - - -/*===========================================================================*/ -/* Packets senders */ -/*===========================================================================*/ - -/*----------------------------------------------------------------------------*/ -static void _send_dhpart1(zrtp_stream_t *stream) -{ - _zrtp_packet_send_message(stream, ZRTP_DHPART1, &stream->messages.dhpart); -} - -static zrtp_status_t _prepare_dhpart1(zrtp_stream_t *stream) -{ - zrtp_proto_crypto_t* cc = stream->protocol->cc; - zrtp_packet_DHPart_t *dh1 = &stream->messages.dhpart; - uint16_t dh_length = (uint16_t)stream->pubkeyscheme->pv_length; - - zrtp_memcpy(dh1->rs1ID, cc->rs1.id.buffer, ZRTP_RSID_SIZE); - zrtp_memcpy(dh1->rs2ID, cc->rs2.id.buffer, ZRTP_RSID_SIZE); - zrtp_memcpy(dh1->auxsID, cc->auxs.id.buffer, ZRTP_RSID_SIZE); - zrtp_memcpy(dh1->pbxsID, cc->pbxs.id.buffer, ZRTP_RSID_SIZE); - - bnExtractBigBytes(&stream->dh_cc.pv, dh1->pv, 0, dh_length); - - _zrtp_packet_fill_msg_hdr( stream, - ZRTP_DHPART1, - dh_length + ZRTP_DH_STATIC_SIZE + ZRTP_HMAC_SIZE, - &dh1->hdr); - - return zrtp_status_ok; -} - -/*----------------------------------------------------------------------------*/ -static void _send_confirm1(zrtp_stream_t *stream) -{ - _zrtp_packet_send_message(stream, ZRTP_CONFIRM1, &stream->messages.confirm); -} - -static zrtp_status_t _prepare_confirm1(zrtp_stream_t *stream) -{ - zrtp_status_t s = _zrtp_machine_create_confirm(stream, &stream->messages.confirm); - if (zrtp_status_ok == s) { - s = _zrtp_packet_fill_msg_hdr( stream, - ZRTP_CONFIRM1, - sizeof(zrtp_packet_Confirm_t) - sizeof(zrtp_msg_hdr_t), - &stream->messages.confirm.hdr); - } - - return s; -} diff --git a/libs/libzrtp/src/zrtp_rng.c b/libs/libzrtp/src/zrtp_rng.c deleted file mode 100644 index c32fbe3a30..0000000000 --- a/libs/libzrtp/src/zrtp_rng.c +++ /dev/null @@ -1,351 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp rng" - -#define MD_DIGEST_LENGTH SHA512_DIGEST_SIZE -#define MD_CTX_init(a) -#define MD_Init(a) sha512_begin(a) -#define MD_Final(a,b) sha512_end(b,a) -#define MD_Cleanup(a) zrtp_memset(a,0,sizeof(*a)); - - -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN64) || (ZRTP_PLATFORM == ZP_WINCE) - -#include - -HCRYPTPROV g_hCryptProv; - -zrtp_status_t NtLmInitializeRNG(VOID) -{ - BOOL fSuccess; - - if (g_hCryptProv != 0) { - return zrtp_status_ok; - } - - fSuccess = CryptAcquireContext( &g_hCryptProv, - NULL, - NULL, - PROV_RSA_FULL, - CRYPT_VERIFYCONTEXT); - - return (TRUE == fSuccess) ? zrtp_status_ok : zrtp_status_fail; -} - -void NtLmCleanupRNG(VOID) -{ - if (g_hCryptProv) { - CryptReleaseContext(g_hCryptProv, 0); - g_hCryptProv = 0; - } -} - -int zrtp_add_system_state(zrtp_global_t* zrtp, MD_CTX *ctx) -{ - uint8_t buffer[64]; - - if(!CryptGenRandom(g_hCryptProv, sizeof(buffer), buffer)) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! Error during CryptGenRandom.\n")); - return 0; - } - - MD_Update(ctx, buffer, sizeof(buffer)); - ZeroMemory((PVOID)buffer, sizeof(buffer)); - - return sizeof(buffer); -} - -#elif (ZRTP_PLATFORM == ZP_WIN32_KERNEL) - -#include - -/*----------------------------------------------------------------------------*/ -int zrtp_add_system_state(zrtp_global_t* zrtp, MD_CTX *ctx) -{ - LARGE_INTEGER li1; - LARGE_INTEGER li2; - ULONG ul1; - ULONG ul2; - ULONGLONG ull; - PKTHREAD thread; - static int tsc_ok = 1; - /* - * WARNING! - * Of course it's not a real size of entropy added to the context. It's very - * difficult to compute the size of real random data and estimate its quality. - * This value means: size of maximum possible random data which this function can provide. - */ - static int entropy_length = sizeof(LARGE_INTEGER)*2 + sizeof(PKTHREAD) + - sizeof(ULONG)*2 + sizeof(LARGE_INTEGER)*2 + sizeof(ULONG)*2; - - li2 = KeQueryPerformanceCounter(&li1); - MD_Update(ctx, &li1, sizeof(LARGE_INTEGER)); - MD_Update(ctx, &li2, sizeof(LARGE_INTEGER)); - - ull = KeQueryInterruptTime(); - MD_Update(ctx, &ull, sizeof(ULONGLONG)); - - thread = KeGetCurrentThread(); - MD_Update(ctx, &thread, sizeof(PKTHREAD)); - ul2 = KeQueryRuntimeThread(thread, &ul1); - MD_Update(ctx, &ul1, sizeof(ULONG)); - MD_Update(ctx, &ul2, sizeof(ULONG)); - - KeQuerySystemTime(&li1); - MD_Update(ctx, &li1, sizeof(LARGE_INTEGER)); - - KeQueryTickCount(&li1); - MD_Update(ctx, &li1, sizeof(LARGE_INTEGER)); - - if (tsc_ok) { - __try { - ull = _RDTSC(); - MD_Update(ctx, &ull, sizeof(ULONGLONG)); - } __except(EXCEPTION_EXECUTE_HANDLER) { - tsc_ok = 0; - } - } - - return entropy_length; -} - -#elif ((ZRTP_PLATFORM == ZP_SYMBIAN)) -/* - * WARNING! - * This is just a stub to let you start with something little bit better then zero. - * We have no possibility to implement entropy collection in this abstract cross-platform - * application. This function MUST NOT be used as example in real applications. For more - * information read \ref RNG in developers guide - * - * To add real entropy - capture random data from microphone and camera. - */ -extern uint32_t zrtp_symbian_kernel_random(); -extern uint32_t zrtp_sum_of_pid_and_number_of_poccesses(); -extern uint64_t zrtp_get_system_time_crazy(); -extern unsigned int zrtp_get_pid(); -extern uint32_t zrtp_get_availible_heap(); - - -int zrtp_add_system_state(zrtp_global_t* zrtp, MD_CTX *ctx) { - uint64_t sysdate; - unsigned int pid; - uint32_t crazy_pid_sum; - - uint32_t heap_size; - - static int entropy_length = sizeof(sysdate) + sizeof(pid) - + sizeof(crazy_pid_sum) + sizeof(heap_size); - sysdate = zrtp_get_system_time_crazy(); - MD_Update(ctx,&sysdate,sizeof(sysdate)); - - pid = zrtp_get_pid(); - - MD_Update(ctx,&pid,sizeof(pid)); - - crazy_pid_sum = zrtp_sum_of_pid_and_number_of_poccesses(); - MD_Update(ctx,&crazy_pid_sum,sizeof(crazy_pid_sum)); - - heap_size = zrtp_get_availible_heap(); - MD_Update(ctx,&heap_size,sizeof(heap_size)); - - return entropy_length; -} - -#elif ( (ZRTP_PLATFORM == ZP_LINUX) || (ZRTP_PLATFORM == ZP_DARWIN) || (ZRTP_PLATFORM == ZP_BSD) || (ZRTP_PLATFORM == ZP_ANDROID) ) - -#if ZRTP_HAVE_STDIO_H == 1 -# include -#else -# error "Used environment dosn't have - zrtp_rng.c can't be build." -#endif - -/*----------------------------------------------------------------------------*/ -int zrtp_add_system_state(zrtp_global_t* zrtp, MD_CTX *ctx) -{ - uint8_t buffer[64]; - size_t bytes_read = 0; - static size_t length= sizeof(buffer); - FILE *fp = NULL; - - fp = fopen("/dev/urandom", "rb"); - if (!fp) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! can't get access to /dev/urandom - trying /dev/random.\n")); - fp = fopen("/dev/random", "rb"); - } - - if (fp) { - int number_of_retries = 1024; - while ((bytes_read < length) && (number_of_retries-- > 0)) { - setbuf(fp, NULL); /* Otherwise fread() tries to read() 4096 bytes or other default value */ - bytes_read += fread(buffer+bytes_read, 1, length-bytes_read, fp); - } - - if (0 != fclose(fp)) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! unable to cloas /dev/random\n")); - } - } else { - ZRTP_LOG(1,(_ZTU_,"\tERROR! RNG Can't open /dev/random\n")); - } - - if (bytes_read < length) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! can't read random string! Current session have to be closed.\n")); - return -1; - } - - MD_Update(ctx, buffer, length); - zrtp_memset(buffer, 0, sizeof(buffer)); - - return bytes_read; -} - -#endif - -/*----------------------------------------------------------------------------*/ -zrtp_status_t zrtp_init_rng(zrtp_global_t* zrtp) -{ - if (!zrtp->rand_initialized) { - zrtp_mutex_init(&zrtp->rng_protector); - MD_Init(&zrtp->rand_ctx); -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN64) || (ZRTP_PLATFORM == ZP_WINCE) - if (zrtp_status_ok != NtLmInitializeRNG()) { - ZRTP_LOG(1,(_ZTU_,"\tERROR! during CryptAcquireContext!\n")); - return zrtp_status_fail; - } -#endif - zrtp->rand_initialized = 1; - } - - return zrtp_status_ok; -} - -void zrtp_down_rng(zrtp_global_t* zrtp) -{ - if (zrtp->rand_initialized) { - zrtp_mutex_destroy(zrtp->rng_protector); -#if (ZRTP_PLATFORM == ZP_WIN32) || (ZRTP_PLATFORM == ZP_WIN64) || (ZRTP_PLATFORM == ZP_WINCE) - NtLmCleanupRNG(); -#endif - zrtp->rand_initialized = 0; - } -} - - -/* - * Call this to add entropy to the system from the given buffer, - * and also from the system state. It's OK to pass a null buffer - * with a length of zero, then we will just use the system entropy. - */ -/*----------------------------------------------------------------------------*/ -int zrtp_entropy_add(zrtp_global_t* zrtp, const unsigned char *buffer, uint32_t length) -{ - if (buffer && length) { - MD_Update(&zrtp->rand_ctx, buffer, length); - } - - return zrtp_add_system_state(zrtp, &zrtp->rand_ctx); -} - - -/* - * Random bits are produced as follows. - * First stir new entropy into the random state (zrtp->rand_ctx). - * Then make a copy of the random context and finalize it. - * Use the digest to seed an AES-256 context and, if space remains, to - * initialize a counter. - * Then encrypt the counter with the AES-256 context, incrementing it - * per block, until we have produced the desired quantity of data. - */ -/*----------------------------------------------------------------------------*/ -int zrtp_randstr(zrtp_global_t* zrtp, unsigned char *buffer, uint32_t length) -{ - //TODO: replace bg_aes_xxx() with our own block cipher component. - //TODO: Do the same with the hash functions. - - aes_encrypt_ctx aes_ctx; - MD_CTX rand_ctx2; - unsigned char md[MD_DIGEST_LENGTH]; - unsigned char ctr[AES_BLOCK_SIZE]; - unsigned char rdata[AES_BLOCK_SIZE]; - uint32_t generated = length; - - /* - * In few cases we need to gerate random value before initializing libzrtp engine. - * Following trick makes it possible. - */ - if (!zrtp->rand_initialized) { - if (zrtp_status_ok != zrtp_init_rng(zrtp)) { - return -1; - } - } - - zrtp_mutex_lock(zrtp->rng_protector); - - /* - * Add entropy from system state - * We will include whatever happens to be in the buffer, it can't hurt - */ - if ( 0 > zrtp_entropy_add(zrtp, buffer, length) ) { - zrtp_mutex_unlock(zrtp->rng_protector); - return -1; - } - - /* Copy the zrtp->rand_ctx and finalize it into the md buffer */ - rand_ctx2 = zrtp->rand_ctx; - MD_Final(&rand_ctx2, md); - - zrtp_mutex_unlock(zrtp->rng_protector); - - /* Key an AES context from this buffer */ - zrtp_bg_aes_encrypt_key256(md, &aes_ctx); - - /* Initialize counter, using excess from md if available */ - zrtp_memset (ctr, 0, sizeof(ctr)); - if (MD_DIGEST_LENGTH > (256/8)) { - uint32_t ctrbytes = MD_DIGEST_LENGTH - (256/8); - if (ctrbytes > AES_BLOCK_SIZE) - ctrbytes = AES_BLOCK_SIZE; - zrtp_memcpy(ctr + sizeof(ctr) - ctrbytes, md + (256/8), ctrbytes); - } - - /* Encrypt counter, copy to destination buffer, increment counter */ - while (length) - { - unsigned char *ctrptr; - uint32_t copied; - zrtp_bg_aes_encrypt(ctr, rdata, &aes_ctx); - copied = (sizeof(rdata) < length) ? sizeof(rdata) : length; - zrtp_memcpy (buffer, rdata, copied); - buffer += copied; - length -= copied; - - /* Increment counter */ - ctrptr = ctr + sizeof(ctr) - 1; - while (ctrptr >= ctr) { - if ((*ctrptr-- += 1) != 0) { - break; - } - } - } - - /* Done! Cleanup and exit */ - MD_Cleanup (&rand_ctx2); - MD_Cleanup (md); - MD_Cleanup (&aes_ctx); - MD_Cleanup (ctr); - MD_Cleanup (rdata); - - return generated; -} - -int zrtp_randstr2(unsigned char *buffer, uint32_t length) { - zrtp_global_t zrtp; - zrtp.rand_initialized = 0; - return zrtp_randstr(&zrtp, buffer, length); -} diff --git a/libs/libzrtp/src/zrtp_srtp_builtin.c b/libs/libzrtp/src/zrtp_srtp_builtin.c deleted file mode 100644 index 1d19e434bd..0000000000 --- a/libs/libzrtp/src/zrtp_srtp_builtin.c +++ /dev/null @@ -1,1469 +0,0 @@ -/* - * libZRTP SDK library, implements the ZRTP secure VoIP protocol. - * Copyright (c) 2006-2009 Philip R. Zimmermann. All rights reserved. - * Contact: http://philzimmermann.com - * For licensing and other legal details, see the file zrtp_legal.c. - * - * Vitaly Rozhkov - */ - -#include "zrtp.h" - -#define _ZTU_ "zrtp srtp" - -#if (!defined(ZRTP_USE_EXTERN_SRTP)) || (ZRTP_USE_EXTERN_SRTP == 0) - - -/* constants that are used for packet's parsing */ -#define octets_in_rtp_header 12 -#define uint32s_in_rtp_header 3 -#define octets_in_rtcp_header 8 -#define uint32s_in_rtcp_header 2 - - -/* - defines to make work with cipher component little bit easy -*/ -#define zrtp_cipher_init(self) \ - ( ((self)->cipher)->init(((self)->cipher)) ) - -#define zrtp_cipher_start(self, key, extra_data, mode) \ - ( ((self)->cipher)->start(((self)->cipher), (key), (extra_data), (mode)) ) - -#define zrtp_cipher_set_iv(self, iv) \ - ( ((self)->cipher)->set_iv( ((self)->cipher), ((self)->ctx), (iv)) ) - -#define zrtp_cipher_encrypt(self, buf, len) \ - ( ((self)->cipher)->encrypt( ((self)->cipher), ((self)->ctx), (buf), (len)) ) - -#define zrtp_cipher_decrypt(self, buf, len) \ - ( ((self)->cipher)->decrypt( ((self)->cipher), ((self)->ctx), (buf), (len)) ) - -#define zrtp_cipher_self_test(self) \ - ( ((self)->cipher)->self_test(((self)->cipher)) ) - -#define zrtp_cipher_stop(self) \ - ( ((self)->cipher)->stop(((self)->cipher), ((self)->ctx)) ) - -#define zrtp_cipher_free(self) \ - ( ((self)->cipher)->free(((self)->cipher)) ) - - - - -/*===========================================================================*/ -/* Replay protection serve functions set */ -/*===========================================================================*/ - - -/*! \brief Allocates and initializes replay protection context. Initialize - * mutexes and linked lists. - * \return - * - allocated replay protection context - * - NULL if error - */ -/*---------------------------------------------------------------------------*/ -zrtp_rp_ctx_t* rp_init() -{ - zrtp_rp_ctx_t *ctx = zrtp_sys_alloc(sizeof(zrtp_rp_ctx_t)); - if(NULL == ctx){ - return NULL; - } - - if(zrtp_status_ok != zrtp_mutex_init(&ctx->inc_sync)){ - zrtp_sys_free(ctx); - return NULL; - } - - if(zrtp_status_ok != zrtp_mutex_init(&ctx->out_sync)){ - zrtp_mutex_destroy(ctx->inc_sync); - zrtp_sys_free(ctx); - return NULL; - } - - init_mlist(&ctx->inc_head.mlist); - init_mlist(&ctx->out_head.mlist); - - return ctx; -} - - -/*! \brief Deinitializes and deallocates replay protection context. - * \param ctx - replay protection context - * \return - * - zrtp_status_ok - */ -/*---------------------------------------------------------------------------*/ -zrtp_status_t rp_destroy(zrtp_rp_ctx_t *ctx) -{ - mlist_t *pos, *n; - zrtp_rp_node_t *node = NULL; - - /*free all existing replay protection nodes in the incoming list*/ - zrtp_mutex_lock(ctx->inc_sync); - mlist_for_each_safe(pos, n, &ctx->inc_head.mlist){ - node = mlist_get_struct(zrtp_rp_node_t, mlist, pos); - mlist_del(&node->mlist); - zrtp_sys_free(node); - } - zrtp_mutex_unlock(ctx->inc_sync); - - zrtp_mutex_destroy(ctx->inc_sync); - - /*free all existing replay protection nodes in the outgoing list*/ - zrtp_mutex_lock(ctx->out_sync); - mlist_for_each_safe(pos, n, &ctx->out_head.mlist){ - node = mlist_get_struct(zrtp_rp_node_t, mlist, pos); - mlist_del(&node->mlist); - zrtp_sys_free(node); - } - zrtp_mutex_unlock(ctx->out_sync); - - zrtp_mutex_destroy(ctx->out_sync); - - zrtp_sys_free(ctx); - return zrtp_status_ok; -} - - -/*! \brief Finds replay protection node by given ssrc. Which linked list to search is - * determined by the direction param. - * \warning This function doesn't lock the linked list before search and is for internal usage. - * To find necessary replay protection node use get_rp_node() function. - * \param ctx - pointer to replay protection context - * \param direction - defines what list to search. It may have values: - * - RP_INCOMING_DIRECTION - * - RP_OUTGOING_DIRECTION - * \return - * - pointer to found replay protection node - * - NULL if node hasn't been found or if error - */ -/*---------------------------------------------------------------------------*/ -zrtp_rp_node_t *get_rp_node_non_lock( zrtp_rp_ctx_t *ctx, - uint8_t direction, - uint32_t ssrc) -{ - zrtp_rp_node_t *node = NULL; - mlist_t *pos; - mlist_t *head = NULL; - - switch(direction){ - case RP_INCOMING_DIRECTION: - head = &ctx->inc_head.mlist; - break; - case RP_OUTGOING_DIRECTION: - head = &ctx->out_head.mlist; - break; - default: - head = NULL; - break; - }; - - if(NULL != head){ - mlist_for_each(pos, head){ - node = mlist_get_struct(zrtp_rp_node_t, mlist, pos); - if(ssrc == node->ssrc){ - break; - }else{ - node = NULL; - } - } - } - - return node; -} - - -///*! \brief Finds replay protection node by given ssrc. Linked list to search is -// * determined by direction param. This function locks the linked list to -// * ensure exclusive access. -// * -// * \param ctx - pointer to replay protection context -// * \param direction - defines what list to search. It may have values: -// * - RP_INCOMING_DIRECTION -// * - RP_OUTGOING_DIRECTION -// * \param ssrc - value by which search will be made -// * \return -// * - pointer to found replay protection node -// * - NULL if node hasn't been found or if error -// */ -///*---------------------------------------------------------------------------*/ -//zrtp_rp_node_t *get_rp_node(zrtp_rp_ctx_t *ctx, uint8_t direction, uint32_t ssrc) -//{ -// zrtp_rp_node_t *node = NULL; -// zrtp_mutex_t *sync = NULL; -// -// switch(direction){ -// case RP_INCOMING_DIRECTION: -// sync = ctx->inc_sync; -// break; -// case RP_OUTGOING_DIRECTION: -// sync = ctx->out_sync; -// break; -// default: -// sync = NULL; -// break; -// }; -// -// if(NULL != sync){ -// zrtp_mutex_lock(sync); -// node = get_rp_node_non_lock(ctx, direction, ssrc); -// zrtp_mutex_unlock(sync); -// } -// -// return node; -//} - -/*! \brief Allocates new replay protection node for given direction and ssrc and adds it into - * appropriate linked list. - * \warning This function is for internal usage. Use add_rp_node() and add_rp_node_unique(). - * \param srtp_ctx - pointer to SRTP ctx related with created node. Used for removing node on SRTP session destruction. - * \param ctx - pointer to replay protection context - * \param direction - defines in which list newly created node will be inserted. It may have values: - * - RP_INCOMING_DIRECTION - * - RP_OUTGOING_DIRECTION - * \param ssrc - newly created replay protection node key value. - * \param is_unique - defines what should be returned when replay protection node - * with given direction and ssrc values already exists: - * - pointer to existing node if is_unique == 0 - * - NULL if is_unique == 1 - * \return - * - pointer to newly created replay protection node - * - pointer to existing replay protection node - * - NULL if is_unique == 1 and needed replay protection node already exists or if error - */ -/*---------------------------------------------------------------------------*/ -zrtp_rp_node_t *add_rp_node_ex( zrtp_srtp_ctx_t *srtp_ctx, - zrtp_rp_ctx_t *ctx, - uint8_t direction, - uint32_t ssrc, - uint8_t is_unique) -{ - zrtp_rp_node_t *node = NULL; - zrtp_mutex_t *sync = NULL; - mlist_t *head = NULL; - - switch(direction){ - case RP_INCOMING_DIRECTION: - sync = ctx->inc_sync; - head = &ctx->inc_head.mlist; - break; - case RP_OUTGOING_DIRECTION: - sync = ctx->out_sync; - head = &ctx->out_head.mlist; - break; - default: - sync = NULL; - head = NULL; - break; - }; - - if(NULL != sync && NULL != head){ - zrtp_mutex_lock(sync); - do{ - node = get_rp_node_non_lock(ctx, direction, ssrc); - - /*create new node if not found*/ - if(NULL == node){ - node = zrtp_sys_alloc(sizeof(zrtp_rp_node_t)); - if(NULL == node){ - break; - } - /*clean sliding window and on-top sequence number value*/ - zrtp_memset(node, 0, sizeof(zrtp_rp_node_t)); - node->ssrc = ssrc; - node->srtp_ctx = srtp_ctx; - mlist_add_tail(head, &node->mlist); -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_,"\tadd %s rp node. ssrc[%u] srtp_ctx[0x%08x]", - direction==RP_INCOMING_DIRECTION?"incoming":"outgoing\n", - zrtp_ntoh32(node->ssrc), node->srtp_ctx)); -#endif - }else if(is_unique){ - // ???: why do we need unique mode at all? - node = NULL; - } - - }while(0); - zrtp_mutex_unlock(sync); - } - - return node; -} - -/*! \brief Allocates new replay protection node for given direction and ssrc and adds it into - * appropriate linked list. This function is based on add_rp_node_ex(). - * \param srtp_ctx - pointer to SRTP ctx related with created node. Used for removing node on SRTP session destruction. - * \param ctx - pointer to replay protection context - * \param direction - defines in which list newly created node will be inserted. It may have values: - * - RP_INCOMING_DIRECTION - * - RP_OUTGOING_DIRECTION - * \param ssrc - newly created replay protection node key value. - * \return - * - pointer to newly created replay protection node - * - pointer to existing replay protection node - * - NULL if error - */ -zrtp_rp_node_t *add_rp_node(zrtp_srtp_ctx_t *srtp_ctx, zrtp_rp_ctx_t *ctx, uint8_t direction, uint32_t ssrc){ - /*not-unique mode*/ - // ???: why do we need unique mode at all? - return add_rp_node_ex(srtp_ctx, ctx, direction, ssrc, 0); -} - -///*! \brief Allocates new replay protection node for given direction and ssrc and adds it into -// * appropriate linked list. This function is based on add_rp_node_ex(). -// * \param srtp_ctx - pointer to SRTP ctx related with created node. Used for removing node on SRTP session destruction. -// * \param ctx - pointer to replay protection context -// * \param direction - defines in which list newly created node will be inserted. It may have values: -// * - RP_INCOMING_DIRECTION -// * - RP_OUTGOING_DIRECTION -// * \param ssrc - newly created replay protection node key value. -// * \return -// * - pointer to newly created replay protection node -// * - NULL if error or if needed node already exists -// */ -//zrtp_rp_node_t *add_rp_node_unique(zrtp_srtp_ctx_t *srtp_ctx, zrtp_rp_ctx_t *ctx, uint8_t direction, uint32_t ssrc){ -// /*unique mode*/ -// return add_rp_node_ex(srtp_ctx, ctx, direction, ssrc, 1); -//} - -/*! \brief Removes replay protection node with given ssrc from linked list defined by direction value. - * \param ctx - pointer to replay protection context - * \param direction - defines from which list replay protection node will be removed. It may have values: - * - RP_INCOMING_DIRECTION - * - RP_OUTGOING_DIRECTION - * \param ssrc - key value of replay protection node to remove - * \return - * - zrtp_status_ok if replay protection node has been removed successfully - * - zrtp_status_fail if node hasn't been found - */ -/*---------------------------------------------------------------------------*/ -zrtp_status_t remove_rp_node(zrtp_rp_ctx_t *ctx, uint8_t direction, uint32_t ssrc){ - zrtp_rp_node_t *node = NULL; - zrtp_mutex_t *sync = NULL; - zrtp_status_t res = zrtp_status_fail; - - switch(direction){ - case RP_INCOMING_DIRECTION: - sync = ctx->inc_sync; - break; - case RP_OUTGOING_DIRECTION: - sync = ctx->out_sync; - break; - default: - sync = NULL; - break; - }; - - if(NULL != sync){ - zrtp_mutex_lock(sync); - node = get_rp_node_non_lock(ctx, direction, ssrc); - if(NULL != node){ - mlist_del(&node->mlist); - zrtp_sys_free(node); - res = zrtp_status_ok; - } - zrtp_mutex_unlock(sync); - } - - return res; -} - - -zrtp_status_t remove_rp_nodes_by_srtp_ctx(zrtp_srtp_ctx_t *srtp_ctx, zrtp_rp_ctx_t *ctx){ - zrtp_status_t res = zrtp_status_ok; - zrtp_rp_node_t *node = NULL; - mlist_t *pos, *n; - - if((NULL == srtp_ctx) || (NULL == ctx)){ - return zrtp_status_bad_param; - } - - /* Walk over incoming nodes list */ - zrtp_mutex_lock(ctx->inc_sync); - mlist_for_each_safe(pos, n, &ctx->inc_head.mlist){ - node = mlist_get_struct(zrtp_rp_node_t, mlist, pos); - if((NULL != node->srtp_ctx) && (node->srtp_ctx == srtp_ctx)){ -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_,"\tremove incoming rp node. ssrc[%u] srtp_ctx[0x%08x]\n", - zrtp_ntoh32(node->ssrc), node->srtp_ctx)); -#endif - mlist_del(&node->mlist); - zrtp_sys_free(node); - } - } - zrtp_mutex_unlock(ctx->inc_sync); - - /* Walk over outgoing nodes list */ - zrtp_mutex_lock(ctx->out_sync); - mlist_for_each_safe(pos, n, &ctx->out_head.mlist){ - node = mlist_get_struct(zrtp_rp_node_t, mlist, pos); - if((NULL != node->srtp_ctx) && (node->srtp_ctx == srtp_ctx)){ -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_,"\tremove outgoing rp node. ssrc[%u] srtp_ctx[0x%08x]\n", - zrtp_ntoh32(node->ssrc), node->srtp_ctx)); -#endif - mlist_del(&node->mlist); - zrtp_sys_free(node); - } - } - zrtp_mutex_unlock(ctx->out_sync); - - return res; -} - - -/*===========================================================================*/ -/* Replay protection mechanism functions set */ -/*===========================================================================*/ - - -/*! \brief This function is used for RTCP replay protection to generate next sequence number - * of outgoing RTCP packet. If the sequence number is too large it returns zrtp_status_key_expired. - * See RFC3711 for more details. - * \param srtp_rp - pointer to replay protection engine data - * \return - * - zrtp_status_key_expired if next sequence number is too large - * - zrtp_status_ok otherwise - */ -zrtp_status_t zrtp_srtp_rp_increment(zrtp_srtp_rp_t *srtp_rp){ - - if(srtp_rp->seq++ > 0x7fffffff){ - return zrtp_status_key_expired; - }else{ - return zrtp_status_ok; - } -} - -/*! \brief Returns current on-top sequence number. This function is used for RTCP - * replay protection. - * \param srtp_rp - pointer to replay protection engine data - * \return current on-top sequence number - */ -uint32_t zrtp_srtp_rp_get_value(zrtp_srtp_rp_t *srtp_rp){ - return srtp_rp->seq; -} - - -/*! \brief This function checks packet sequence number position relative to - * sliding window current position and makes the decision to accept or discard packet. - * \param srtp_rp - pointer to replay protection engine data - * \param packet - pointer to packet structure - * \return - * - zrtp_status_ok if packet must be accepted - * - zrtp_status_old_pkt if packet sequence number is lower than lowest sequence number - * which can be into the sliding window at the current time. In this case packet must be discarded. - * - zrtp_status_fail if packet must be discarded - */ -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_rp_check(zrtp_srtp_rp_t *srtp_rp, zrtp_rtp_info_t *packet) -{ - int32_t delta = packet->seq - srtp_rp->seq; - if(delta > 0){ - /*if delta is positive, it's good*/ - return zrtp_status_ok; - }else if(ZRTP_SRTP_WINDOW_WIDTH-1 + delta < 0){ - /*if delta is lower than the bitmask, it's bad*/ - return zrtp_status_old_pkt; - }else{ - if(1 == zrtp_bitmap_get_bit(srtp_rp->window, ZRTP_SRTP_WINDOW_WIDTH-1 + delta)){ - /*delta is within the window, so check the bitmask*/ - return zrtp_status_fail; - } - } - return zrtp_status_ok; -} - -/*! \brief This function updates the sliding window state by setting appropriate bit and - * shifting the sliding window if needed. - * \param srtp_rp - pointer to replay protection engine data - * \param packet - pointer to packet structure - * \return - * - zrtp_status_ok - */ -/*---------------------------------------------------------------------------*/ -zrtp_status_t zrtp_srtp_rp_add(zrtp_srtp_rp_t *srtp_rp, zrtp_rtp_info_t *packet) -{ - int32_t delta = packet->seq - srtp_rp->seq; - if(delta > 0){ - /* packet sequence nubmer is larger than current on-top sequence number. - shift the window, set top bit and update on-top sequence number value */ - srtp_rp->seq = packet->seq; - zrtp_bitmap_left_shift(srtp_rp->window, ZRTP_SRTP_WINDOW_WIDTH_BYTES, delta); - zrtp_bitmap_set_bit(srtp_rp->window, ZRTP_SRTP_WINDOW_WIDTH-1); - }else - - /* commented by book, 19.07.07: - we need not consider case when delta == 0 - if(0 == delta){ - zrtp_bitmap_set_bit(srtp_rp->window, ZRTP_SRTP_WINDOW_WIDTH-1); - }else*/ - - { - /* - packet sequence number is into the sliding window. - set appropriate bit - */ - zrtp_bitmap_set_bit(srtp_rp->window, ZRTP_SRTP_WINDOW_WIDTH-1 + delta); - } - - return zrtp_status_ok; -} - - -/*===========================================================================*/ -/* Key derivation mechanism functions set */ -/*===========================================================================*/ - - -/*! \brief This function allocates key derivation context and initializes it with - * given master key, master salt and cipher. - * \param cipher - pointer to cipher that is used for key derivation - * \param key - pointer to master key - * \param salt - pointer to master salt - * \return - * - allocated key derivation context - * - NULL if error - */ -/*---------------------------------------------------------------------------*/ -zrtp_dk_ctx *zrtp_dk_init( zrtp_cipher_t *cipher, - zrtp_stringn_t *key, - zrtp_stringn_t *salt) -{ - zrtp_dk_ctx *ctx = NULL; -#if ZRTP_DEBUG_SRTP_KEYS - ZRTP_LOG(3,(_ZTU_,"\tzrtp_dk_init():\n")); - ZRTP_LOG(3,(_ZTU_,"\tcipher ID[%i]\n", cipher->base.id)); -#endif - do{ - ctx = zrtp_sys_alloc(sizeof(zrtp_dk_ctx)); - if(NULL == ctx){ - break; - } - - ctx->ctx = cipher->start(cipher, key->buffer, salt->buffer, ZRTP_CIPHER_MODE_CTR); - if(NULL == ctx->ctx){ - zrtp_sys_free(ctx); - ctx = NULL; - break; - } - - ctx->cipher = cipher; - }while(0); - - return ctx; -} - -/*! \brief This function derives key for different purposes like SRTP encryption, - * SRTP message authentication, etc. See RFC3711, "4.3. Key Derivation" for more details. - * \warning This function may change length field value in the result_key variable when - * length is larger than max_length field value. - * \param ctx - pointer to key derivation context - * \param label - defines purpose of key to derive - * \param result_key - out parameter. It contains derived key on success. - * \return - * - actually derived key length - * - -1 if error - */ -/*---------------------------------------------------------------------------*/ -uint16_t zrtp_derive_key( zrtp_dk_ctx *ctx, - zrtp_srtp_prf_label label, - zrtp_stringn_t *result_key ) -{ - zrtp_v128_t nonce; - uint16_t length; -#if ZRTP_DEBUG_SRTP_KEYS - char buffer[256]; - ZRTP_LOG(3,(_ZTU_,"\tzrtp_derive_key():\n")); -#endif - - /* set eigth octet of nonce to